Archive for November, 2006
November 30, 2006 at 4:42 am · Filed under animation, music, random
This song if from the accordion-aficionado Jason Webley, watch it through and by the end you’ll be singing along. Rather unusual to find a video like this that looks like it was actually made by cutting out bits of paper/(I don’t know - it might be in flash but i don’t think so).
If you really like the song, you can even download it. Now isn’t that nice.
GO - Jason Webley - Eleven Saints.
November 28, 2006 at 7:31 am · Filed under random
Every year, google sends out a limited number of gifts to the highest adsense customers. Where exactly they draw the line between the top few that get the gifts and the others who just getting a passing nod of acceptance on the way past, no-one knows. But, irrespective of that fact, a number of people do get these gifts. And they’ve been getting better over the years too.
Three years ago (thats 2004 fyi), the gift was a ‘Mood lighting AM/FM Radio‘.

Yes. I Know what you’re thinking. Its pretty naff. But a present is a present, so don’t be a snob. I don’t know- you could put it in the bathroom I guess. Get some tunes while pooping. I suppose it’d be good for that. Maybe. If you want. I…. I wouldn’t, but its up to you.
But we digress. After the rather anticlimactic gift for 2004 Google upped the ante ever so slightly. This was 2005’s gift:

Now thats getting slightly better. If you can’t make it out the package contained a headphone/microphone set, a 128mb thumbdrive, a usb notebook light, a usb hub, a wireless travel mouse and it all came in a rather nice carry case. Bravo. This set of goodies is definitely more worthy of the postage.
So what about this year?
Will it be a usb mug warmer? A dancing usb santa? A big wad of usb money?
No. Its something far cooler.

Yes. Thats right. Thats its a digital photo frame! How good is that!
The specs of this are reportedly as follows:
- 3.6 inch TFT digital photo frame
- 960 x 240 TFT screen, 16 mega-color
- Picture: JPG format
- Audio: MP3, WMA, WAV and records WAV itself
- Video: ASF only
- Media: Internal memory and SD card, comes with sample slideshow in memory
- USB 1.1 interface
- Power: 4 AA batteries or USB 5V or AC/DC power adapter
Not bad for a bit of adsensing.
(And yes I know - adsensing is not a verb)
November 17, 2006 at 2:55 am · Filed under random
What pray tell is ice surfing?
Well its not surfing on ice. That would be crazy! Crazy I say. You can’t surf on ice, its just impossible.
No - rather ice surfing is like roof rack surfing, a past time everyone can enjoy, from infant toddler to aged grandparent. Truly a risk free pastime.
So where does the ice part of ICE SURFING come from?. Its not from ice. Its the name of a train. Just watch this and you’ll see.
So the message is clear - train surfing, extreme ice surfing even, gives you leukemia. So if you don’t want it, don’t go ice surfing. Simple as that.
November 14, 2006 at 10:38 am · Filed under Uncategorized, code, comics
So you’re writing a system that runs through xml files huh?
And does it dynamically each time you load the page.
Sounds like you should do some load testing.
Well heres a lovely baby small python script that helps you do just that. It makes 10,000 files for you. Oh so pretty.
s= """
---the test data---
"""
for i in range(0,10000):
f = open ("%d-%d.xml"%(i,i),'w')
f.write(s)
f.flush()
f.close()
(and if your interested the system passed - 2 seconds to run through 10000 files isn’t bad)
November 13, 2006 at 11:26 am · Filed under code
Consider the following -
You want the user to enter a date into a text field. When the page intially loads you want the field to default to yesterday. Simple yes? Well getting the page to display it is, yes. But what about the code behind it?
Well in C# you can use the DateTime class to handle this kind of thing, so we’ll do that.
System.DateTime.Today;
Thats fine if you want your DateTime object to be today. But what if you want it to be yesterday? An interesting question.
Ill give you a hint - this doesn’t work
System.DateTime.Yesterday;
Well, after some searching through the api’s I could see no simple way of doing it. There is no .RemoveDay method. You could play around with ticks and all sorts of other fancy things but there is this very simple way of doing it.
System.DateTime.Today.AddDays(-1);
Simple huh?
Initially I was thinking its kind of counter intuitive but now that I’ve been using it for while it makes sense.
Just another thing to put down to experience.

November 9, 2006 at 8:25 am · Filed under random
Well, it would be better than a simple no entry sign.

November 7, 2006 at 8:16 am · Filed under random, search
So theres search and theres search.
You may favor Google, if you’ve never used this internet thing, you may not. Regardless, you can’t say Microsoft isn’t trying. Hey, they’re version of maps is alot better for North Wales than google maps is, so no complaining.
But this post is about search. More preciesly, Ms. Dewey. What can you do with search - beyond making it more relevant, easier to use and quicker?
Well you could make it funny. And that’s exactly what Ms Dewey does. It’s powered by Microsoft Live Search so it must have had their blessing at some point.

There are definitely some funny responses to find. For instances “shooting” brings up a raft of different senarios with guns as props and theres even some google bashing to be had.
If your interested, and I’m certain I have no idea why you possible could be, but the actresses name is Janina Gavankar. If you search for that on Ms Dewey you get a lovely little speech about how great she is. Funny stuff.

November 6, 2006 at 4:20 am · Filed under code
Have you ever needed to save something to a file in c#?
You have you say.
Well heres a nifty trick I just found. Its old and simple, but its new to me so I’m going to share it anyway.
If you were doing this -
...
System.IO.FileStream fs=new System.IO.FileStream("test.pdf",System.IO.FileMode.CreateNew);
...
and the file already existed it would throw an exception. My initial reaction would be to wrap it in something that checked whether the file was already existent and then change what happens as appropriate.
But no! There is another way.
Thanks to some thoughtful developers you can do this instead…
...
System.IO.FileStream fs=new System.IO.FileStream("test.pdf",System.IO.FileMode.OpenOrCreate);
...
Now isn’t that just lovely. What a clever little function, System.IO.FileMode.OpenOrCreate - Thanks Microsoft!

Next entries »