Archive for July, 2007

Clear CSS Defaults

Sunday, July 29th, 2007

Another really, really useful bit of code that I have been using is in CSS. CSS have default values, and often programmers will list all of the page elements to clear these values right at the beginning of the stylesheet, like so:

html, body, h1, h2, h3, h4, h5, h6, p, ul, ol, dl, li, dd, dt, img,
blockquote, q, table, thead, tbody, tfoot, caption, th, tr, td,
a, form, input, textarea,  pre {margin: 0; padding: 0;}

However, by using * as a wildcard, like you can in many languages, you can do all of that with a much smaller block of code:

* {margin: 0; padding: 0;}

As of yet I haven’t found any browser issues with this.

Server Document Root Solution

Thursday, July 26th, 2007

I’m going to begin and use my Web Development category for things I find useful, things I learn and discover and simply a place to note things down for future reference. I’m not attempting to teach people how to program.


The above works nicely when you’re working on a server with domains already configured and setup, however, commonly on a local server, DOCUMENT_ROOT will correspond to the htdocs folder, which obviously messes things up.

A simple way of solving this is:

An example of use:

Simple, yet effective.

Blog Interviewer

Monday, July 23rd, 2007

Huzzah, my blog is now on Blog Interviewer.

You can view it here.

Give me a thumbs up, please :)

Cuts and Bruises

Friday, July 20th, 2007

I am sat here with my index finger wrapped in tissue, under my bum. Not for any sort of pleasure, as you might think. I just had the most painful dinner I’ve ever had.

Mum called me downstairs because dinner was ready. I went down to get it, and she handed it to me on a tray. I put the tray down on the worktop so that I could get a knife and fork and some salt. I turned around, and just as I did I knew something was about to happen. Less than a milisecond later I heard a crash and pain shot up my body. So much pain, in fact, that I blacked out momentarily. I shouted “OW!” and looked down to realise that the plate had fallen off of the worktop and landed, edge side-down across the toes on my right foot. I wasn’t wearing any socks. The plate shattered upon impact with the bone on my big toe, which is currently quite swollen and bruised. A few shards of the plate cut my toe, one particularly big one slicing the webbing between my big toe.

I sat down on the couch in the living room whilst cursing, as my Mum dabbed at the blood on my foot. She then went to clean up the plate and dinner in the kitchen. Whilst she was doing so, she managed to cut her finger. I hobbled into the kitchen to get some painkillers, and as I was popping one out of the little plastic chamber they’re stored in, and sliding it out, I cut the index finger on my left hand. How ironic.

My foot stopped bleeding after a little while, but my finger is still dripping with blood. I came to tell people about this, and pretty much the entireity of the response I got was:

“Would have made a great YouTube video”

Ow.

Business Joke

Thursday, July 19th, 2007

This is an amusing joke that Pete sent me.

A man in a hot air balloon realised he was lost. He reduced altitude and spotted a woman below. He descended a bit more and shouted, “Excuse me, can you help me? I promised a friend I would meet him an hour ago, but I don’t know where I am.”

The woman below replied, “You’re in a hot air balloon hovering approximately 30 feet above the ground. You’re between 40 and 41 degrees north latitude and between 59 and 60 degrees west longitude.”

“You must be in IT”, said the balloonist.
“I am”, replied the woman, “How did you know?”

“Well”, answered the balloonist, “everything you told me is technically correct, but I’ve no idea what to make of your information, and the fact is I’m still lost. Frankly, you’ve not been much help at all. If anything, you’ve delayed my trip.”

The woman below responded, “You must be in Management.”

“I am”, replied the balloonist, “but how did you know?”

“Well”, said the woman, “you don’t know where you are or where you’re going. You have risen to where you are due to a large quantity of hot air. You made a promise, which you’ve no idea how to keep, and you expect people beneath you to solve your problems. The fact is you are in exactly the same position you were in before we met, but now, somehow, it’s my fucking fault.”