Twitter Twitter Icon - RSS RSS Feed Icon

Stuff.

Bio

A picture of me!

Tweets

Friends

Files

Oh noes :-(

A great shame. Start the rebellion!

TomNomNom.com

The web stuff of Tom Hudson.

Looking awesome with one liners Fri May 22 21:01:14 2009

Let's face it: there comes a time in ever developer's life when they want to start looking like an awesome *nix guru. Nothing impresses other newbie developers more than typing a seemingly massive command into a *nix shell and having magic happen.

Let me give you an example. I've got a whole bunch of modified files in an Subversion checkout that I want to revert. The obvious choice is to go for:


# svn revert -R *


But why stop there? Why not make yourself look awesome at the same time? You could easily have reverted those files with a mass of piped commands instead - looking awesome in the process.

Let's get a list of modified files, first:


# svn status


Let's grep out any modified files. We know that the line of any modified files starts with a big, fat capital 'M'.


# svn status | grep -e '^M'


Awesome! Now we're only showing the modified files! We've still got that big, fat ol' 'M' at the start of each line though. Let's get rid of it by using 'awk' to print only the second part of each line:


# svn status | grep -e '^M' | awk '{print $2}'


Wahey! We're almost there. All we need to do now is pass the output to the 'svn revert' command. We can do that by wrapping it all in back-ticks (`). Anything enclosed in back-ticks will be evaluated by the shell before the rest of the command is run:


# svn revert `svn status | grep -e '^M' | awk '{print $2}'`


Now we're really awesome! Not only have we reverted the modified files, but we looked awesome in the process!

Just remember: it's not all about looking awesome. You've actually learnt something today: how to use awk, grep and back-ticks (to look awesome).

Quit yo' jibba-jabba Thu Apr 23 20:41:40 2009

Well, I took some photos and sent them off to Zazzle. If you haven't a clue what I'm talking about then look here.

The photos can be seen on Flickr.
The email I sent with them was as follows:


Hi there,

I have attached digital photographs of the product, with attention
to the affected area.
Please note that this product is most definitely NOT a mug.

Many thanks.


I got a reply - with an unexpected twist:


Hello Thomas,

We truly appreciate the time you took to take this digital images,
I have put together a video of the images that you have provided.
If you would like to see it please respond to this email requesting
the video and I will attempt to forward it to you.

As a formality, your images have been received and we will be
forwarding your request for a replacement mug to our re-prints
department for initiation. Once this re-print is introduced into
production, you will be notified.

Your replacement item will be on the way shortly. There is no need
for you to return your defective product, but please do not discard
the original item until you have received and verified that the
replacement is acceptable. Should you not be satisfied with the
replacement item, you may be required to return both the original
and replacement shipments in order to be eligible for a refund.


WOW! Not only am I going to get my mug, but I don't have to return the poster! Wait a minute... A video?! They made a video from my photos? I had to see.


Hello Daniel,

Thank you very much for your quick response.

I would very much like to see the video you have created, please
send it to me.

Best regards,

Tom Hudson


And the reply...


Hello Thomas,

I thank you for making my Thursday, a good laugh is nice.

We are sorry that you did not receive the product you had ordered.

I have issued a reprint of the mug and upgraded the shipping. You
should receive it by the end of next week.

The *.wmv is attached and is 6mb.


I've uploaded the video to YouTube for your viewing pleasure. It's like I'm famous or something.

I've got to be honest: I'm more than impressed with the level of customer service I've received from Zazzle. They're definately not afraid to have a good laugh. And I got a free poster. I will treasure it forever.

Jabber the Hutt Tue Apr 21 20:22:09 2009

A few weeks ago I was busy having just been paid and wanted to spend some money. The wondrous place that is Reddit led me straight to a 'CSS is awesome' mug from Zazzle.com; so I pulled out my PayPal password and paid.

Yesterday I received my package from Zazzle. I promptly sent them this:


I ordered a 'CSS Is Awesome' mug a little over two weeks ago.

Today I received a long cardboard tube from you. The shipping label
indicated that the 2 foot long, 3 inch wide tube contained a mug. I excitedly
opened my big tube to find not an oddly proportioned mug, but a small
poster of Jabba the Hutt; the repulsive monster from the smash hit Star Wars.

I have to be honest: I have not been quite so disappointed in a long time.
I was looking very much forward to forcing my 'CSS is awesome' mug in
the face of my fellow web developers.

Please advise.


And every word of it true. I'd been duped! I wanted my mug, dammit! My mouth was dry from the lack of tea. And a poster of Jabba the god-damn Hutt?! It's not even a good poster. It's clearly a screengrab from the DVD that's been printed on regular HP photo paper.

Today I received a reply.


Thank you for contacting our support team. If you are able to take a digital
picture of the incorrect product received (with attention to the affected area)
and attach it to your response to this email in JPG or PNG format, please
do so. If you provide a picture, we can verify your claim and provide you with
a speedier resolution; along with the most appropriate return information*.

Please be sure to:

1. Attach the image rather than imbedding it into in the body of the email.
2. Include your preference for a refund or a replacement product
3. The order ID # of the incorrect order received (131 - .... - ....)
...


A digital picture of the incorrect product received? OK. With attention to the affected area?! What?! The only affected area here is my dry, non tea-filled mouth. Ah well. I'm a compliant type of guy, so I'm going to take some photos for them tomorrow.

Any suggestions for compromising situations involving a poor quality poster of Jabba the hut should be sent to mail@<thisdomain>


I give in. JQuery is awesome Fri Mar 27 12:55:37 2009

After spending far too long making my AJAX-y twitter feed work across all browsers: I decided to try JQuery. I know, I know... I'm behind the times - but I didn't want to start learning JQuery until I was a little more experienced in raw JavaScript; I wanted to know about the pitfalls that JQuery helps to patch over.

The results are in: JQuery is awesome. It took me a whole 20 minutes to make something that would have otherwise taken me hours. I wanted to hate JQuery, I really did; I wanted to keep tight hold of my getElementById() and be one of the few not jumping on the JavaScript-framework-bandwagon; but JQuery just makes things so damn easy.

If only you could have been there to see the big stupid grin on my face as I tested something quite complex in lots of different browsers and had it work first time in all of them.

Hurrah for JQuery!

Twitter and line-breaks Sun Mar 22 21:28:16 2009

I have had really busy day with regards to site updates. I've added a Twitter feed to the right bar (I also added the right bar, come to think of it), I've switched doctypes to XHTML 1.1 and moved to a new server.

It hasn't been without hiccups though. For one: I'm a bit of a JavaScript noob - I hadn't really done anything major with the DOM until today. I can see why so many people hate it.

I've also changed the way my BBCode-esque parser handles line-breaks. It used to try and figure out what to wrap in <p> tags and where to put <br/> tags, but now it just replaces carriage returns with <br/> tags. I realise this isn't semantically amazing, but the old way was convoluted, slow and always ended up causing my page not to validate properly. Until I come up with a better 'algorithm' for doing this stuff, <br/> tags will have to do.

Right... Comments... Maybe...

EDIT:
I'd like to apologise to anyone who has found this page searching for "twitter line breaks" or something similar.
Sorry: I have no idea how you insert a line-break into a tweet - but I am trying to find out for you :-P