Home

Previous 20

Jun. 29th, 2009

Calm, Collected

TwillTestCase for Django Testing

Here's a nifty recipe for producing a "test case" object that is basically a Twill engine. I dug this one up from a Bing cached page. The original web site has disappeared "503 Bad Gateway" and Google doesn't know about it anymore.

Boring Django technobabble behind the cut )

Top hit on Bing when I searched for Django web testing Twill was "Django and Twill" by Luke Plant. Google didn't show that result up until about item 6, but Google's front page contained more stuff related to Agile Development - and that's a little poor considering I was signed in to Google and have been searching for this kind of stuff for some time.

Jun. 18th, 2009

Calm, Collected

OOOH! SHINEY!

iPhone 3.0 update! Yay!

*upgrades iPhone 3G*

Now I have voice memos! And I can send MMS! and I have Spotlight search too!

*runs out of shiney things*

Okay. Bored now.
Tags:

Jun. 16th, 2009

Calm, Collected

Using tcpdump, tcprewrite and tcprelay to help write network-aware code

I have a particular need at present: I'm writing a piece of code which needs to be able to handle a lot of incoming UDP packets. First up I need to learn how to read what's in the packets, then I need to make decisions on where to send the packets, and on top of all this I need to do all this very quickly.

The rest of this post is about how I used tcpdump, tcprewrite and tcpreplay to sent  )
Calm, Collected

My "Bing" Experience

Search for this phrase using Google or Bing: "Where does Mac OS X Software Update store the downloaded packages?"

Google gets the appropriate link on the first page (Apple discussion forums). Bing misses the point altogether - I don't care about Java, J2EE or anything else, I just want to know where the downloaded packages are stored so I don't have to download 500MB of updates over and over again...

Another problem I have with Bing is the extreme brevity of the summaries.

So for today, Google 1 vs Bing 0.

Jun. 10th, 2009

Insanity, Madness

My Take on the WWDC 2009 Keynote

Go watch the 2-and-a-bit hours keynote presentation. Go on, I dare you.

Now go back in time and watch the 1:45 WWDC 2008 Keynote.

Here are my impressions on the differences:

  • Computer on stage set up so the presenter will have their back to the audience: NO!
  • Lengthy feature lists: NO!
  • Live product demonstrations: NO!
  • Featured products: Yes!
  • Featured developers: Yes!


For my commentary, read the rest of this rant … )
Calm, Collected

SNMP? Ouch!

For various perverse reasons I'm looking into SNMP. Here are a couple of articles I've found which are helping me overcome the rising bile induced by that horrid acronym:

Now, let's see if I can pull an Isaac Asimov with this stuff…

May. 1st, 2009

Insanity, Madness

When Interface Design Goes Wrong

http://lifehacker.com/5231478/office-2010-screenshots-preview-whats-to-come

The body, in which I rant (surprise surprise) about the UI of Microsoft Office 10 )

At least you might feel that you've achieved something by navigating that interface to successfully reply to a voicemail message.

Mar. 24th, 2009

Calm, Collected

Django model-aware validation of models using forms

Here's a situation: you're writing a test suite for a web application, and you notice that - as an example - one of your models has a bunch of checkboxes. These checkboxes are used as "reminders" for various types of thing that the model is working with. Each type of thing has a number of checkboxes that it might use, but at this point in time all we care about is that if thing "A" can use 5 checkboxes, we don't have checkboxes 6 or onwards checked.

You could validate that in the form.

But what about the situation where your model is used programatically by other developers?

Here's a tip on how to use the validation you've built into the form, to validate the model. Pretty nifty:

http://www.pointy-stick.com/blog/2008/10/15/django-tip-poor-mans-model-validation/

Hope it helps!

Mar. 23rd, 2009

Calm, Collected

Undoing an "oops" in your commit message

Say you're using Subversion upstream, and you have pre-commit hooks to make sure that every commit refers to an open ticket.

In git, you might accidentally commit with a message, "fixes stuff", which was supposed to be "Fixes #45, stuff was broken." If you catch it right away, you can use:

git commit --amend

This will let you fix that commit message, by adding a new commit to the side of the broken one.

If you messed something up earlier, have already merged your changes into the "master" branch, and only now have realised that something is wrong? Hmm… I'm not sure how to fix that one. What I've done is reset the "master" to an old commit before the mistake was made, then play back the patches by hand with an appropriate commit message.

There must be a better way.

Mar. 19th, 2009

Insanity, Madness

"Why do you want to test that your browser is working"

Both the Ruby on Rails and Django communities talk about testing web applications using all manner of tools, including Selenium. Selenium is an in-browser testing suite - your test suite sends the Selenium client a bunch of things to do, the Selenium client simulates the clicking of certain buttons, typing of certain strings, and then your test suite verifies that behaviour is as expected. This type of testing is necessary since no two browsers are equal (and one browser is more unequal than others).

So understand my chuckling when I read this:

The help came from an XP seminar I attended last year, where I actually asked the question, "how do I test the user interface of a web application, i.e.: that when the user clicks on a given page she gets the expected result? The answer was "You don't. Why do you want to test that your browser is working?"


The irony is palpable.

Mar. 18th, 2009

Deriving a functional specification

Do you have a huge body of legacy code, and a desire to move that code from one language or framework to another?

Have a read of this: http://www.cafeaulait.org/slides/sdbestpractices2006/legacy/index.html

If you structure your tests correctly (ie: testing what, not how), you'll end up with a nice corpus of tests that turn out to be the functional specification of the software. Now translate those tests to your new language/framework of choice, and start writing the code to make the tests pass!

How easy was that?

Mar. 16th, 2009

Calm, Collected

Using branches with git-svn

Just a quick note: if you have your subversion-tracking "head" called "svn-trunk" for example, and you branch off to, say, "ticket-30" to do some work on ticket #30, here's how merging ends up working:

  • Make sure changes are all committed in your ticket-30 branch
  • Switch to the svn-trunk branch
  • git svn fetch then git svn rebase to get the latest version of the Subversion-controlled code
  • giv merge ticket-30
  • resolve conflicts
  • git commit -m "This is the message that shows up in SVN commit logs"
  • git svn dcommit


So for example if you perform 15 changes in the ticket-30 branch, you'll only end up with 1 change in the Subversion repository which is every change that was made to svn-trunk during the git merge ticket-30 process.

Mar. 10th, 2009

The Day After Tomorrow

I watched this movie again last night. It's an entertaining piece that got me thinking - how do you move 150 million people in one day? We have hard enough time evacuating a sports arena after a football game, when everyone is behaving in a more-or-less controlled manner.

Mar. 4th, 2009

Imitation is the sincerest form of flattery …

MacBook: http://www.apple.com/macbookpro/

MSI MacBook wannabe: http://www.engadget.com/2009/03/03/hands-on-with-msis-x-slim-x320-x340-and-gt725-laptops/

LOL
Tags: ,

Feb. 23rd, 2009

How can we minimise our carbon footprint?

What would you suggest as a means to reduce the carbon cost of running your household in a sustainable manner? That is, you could potentially reduce your carbon cost to 0 by simply disconnecting your house from electricity and gas supply and living without a source of heat - I argue that this is not sustainable since we need heat for cooking and sanitation.

My suggestion is that we need to approximately double the cost of electricity so that (a) wind and solar-thermal power generation becomes economically productive, (b) people consume less electricity to start with, and (c) we have money to spare to invest in researching more efficient means of generating electricity from non-fuel sources.

Try switching off your Internet connection for a week. I bet you can't do it.

Feb. 17th, 2009

Insanity, Madness

25 days to swim Atlantic? I don't think so.

http://www.smh.com.au/articles/2009/02/08/1234027855873.html

Jennifer Figge of Aspen, Colorado, swam from the Cape Verde Islands to Chacacharacare. She spent time in the water on 19 out of 25 days to cover a distance of about 2500 km. The article on the SMH quotes the distance from Cape Verde to Trinidad as about 3380 km, but doesn't indicate that a the Cape Verde Islands and Chacacharacare are significantly closer.

I'm impressed by the feat, but saying that she swam across the Atlantic is a bit of a stretch. )I'm expecting that when the crew gets their numbers together, we'll find that she actually swam about 200km of the 2500km between the islands. An impressive feat by all means, but I wouldn't say that she actually swam across the Atlantic.
Tags:

Feb. 16th, 2009

Calm, Collected

5-minute guide to git-svn

After installing git (with Subversion support)[1], the process of interaction with a Subversion repository is as follows:
Unix Wizard Magic behind the cut. )
One last thing: installing git on Mac OS X is best done using MacPorts. Make sure to use “sudo port install git +svn +doc”. Installing git on Linux should be simple using the distribution’s package manager.
Calm, Collected

Things that make you go, "WTF?"

The MySQL command line client has an option "--i-am-a-dummy" which turns on "safe updates". The idea is that any update or delete will fail unless there is a WHERE clause - which is a common mistake of people new to this whole SQL thing - and even better, the WHERE clause has to reference a unique key (eg: the primary key of the table).

The catch is that the default for this flag is off, so only those people who know about the danger will know to switch it on. In the meantime the real dummies are out there with command line clients that allow unsafe updates.
So if you're a system administrator who knows what you're doing, you might enable the option in the global config file and require users to un-enable it on their own. )
Tags:

Feb. 6th, 2009

Music

New CF card for my ancient camera!

I have a really (really!) ancient Nikon Coolpix 995 camera. It uses Compact Flash memory, but has a maximum size restriction of 256MB on the card it uses. So I bought a new 8GB card for it and it work just fine!

How'd I do it? Simple actually - open up Disk Utility, partition the CF card into a 256MB FAT partition and the rest was formatted as FAT32. Now the camera is happy, and I can use the rest of the CF to store stuff on - as a substitute for a thumb drive. Of course, I can't get to the rest of the card from the camera itself, but them's the breaks.

Feb. 5th, 2009

Insanity, Madness

Another reason I hate MySQL or Django or something

Okay, so this isn't really MySQL's fault. It's a Django problem. Way back in the day this application that I'm maintaining was written in Django 0.95. I've managed to port the forms and models across to Django 1.0-ish. I've included South so we can do database schema migration (and in fact part of the first batch of fixes was to improve performance by modifying the database), and everything was sweet.

But then... )

Previous 20

June 2009

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930    

Advertisement

Syndicate

RSS Atom
Powered by LiveJournal.com