window.alert = function(s) { if( !confirm(s) ) window.alert = null; }In case you're wondering... I found it embedded in the comments on this post: http://www.joehewitt.com/blog/firebug_for_iph.php. Cheers Menno van Slooten
More than 2 decades of writing software, and still loving it...
Wednesday, July 04, 2007
Handy "Alert Debugging" tool
One of the coolest things about OO Javascript is that methods can be written to as if they are variables. This means that you can re-write functions on the fly. Bad for writing maintainable code if you're not structured; Fantastic for things like MVC controllers (rather use the controller to forward calls on to the model, you use it to rewire the view so that it calls it directly, and all without the view even realising it!).
What I didn't realise was that the standard window object (and probably so many others out there) can have its methods overwritten like any other.
Probably the simplest example of that proves to be incredibly useful... changing the alert function so that the dialog becomes a confirm window. Clicking cancel means that no further alerts are shown to the user. Great for when you're writin Javascript without a debugger and have to resort to 'alert debugging'.
Tuesday, June 26, 2007
Tab Complete in Windows
Another one of those things that I can never remember off the top of my head so find myself constantly looking it up whenever I get access to a new machine.
I figure it may as well be my own site that I get the info from :-)
To switch on 'Tab Complete' in Windows command line change the following registry keys to '09':
I figure it may as well be my own site that I get the info from :-)
To switch on 'Tab Complete' in Windows command line change the following registry keys to '09':
- HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar
- HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar
Friday, June 22, 2007
Haiku
Saw a cracking Haiku on a t-shirt the other day:
Haiku are easy
But sometimes they don't make sense
Refridgerator.
Then my mind started dwelling on it:
Got the release out
But the testing's not finished
It's falling over
Or
Database is slow
Just can't see what's wrong with it
Set autotrace on
Or
A quick refactor
Turns into a bigger job
Should have unit tests
Haiku are easy
But sometimes they don't make sense
Refridgerator.
Then my mind started dwelling on it:
Got the release out
But the testing's not finished
It's falling over
Or
Database is slow
Just can't see what's wrong with it
Set autotrace on
Or
A quick refactor
Turns into a bigger job
Should have unit tests
Monday, May 28, 2007
Records
And to follow on from the last post... my current personal bests:
I figure if I keep them here, at least I'll always know where they are!
I figure if I keep them here, at least I'll always know where they are!
5km Run | 23:44 (Battersea Park, 'Beat the Baton' 28/05/07) |
10km Run | 53:23 (Hyde Park, 'Run London' 08/10/06) |
Half Marathon | 2:17:49 (Redcar, 'Tees Valley Half Marathon' 12/03/06) |
Rubik's cube | 57 seconds |
Targets
You've gotta have targets.
The more I try to motivate myself to do things, the more I realise that if I don't have a target it's incredibly difficult.
When I realised this it came as a big surprise to me. I'm really not the sort of person to have a 5 year plan or career goals, but it seems that if I don't set myself an only just achievable goal I find it very difficult to motivate myself to do much.
I keep myself fit so that I get the most out of playing football. But just having that in mind isn't enough to get me out and running. If I didn't set myself a target time for a 5km or 10km run and then book a place at a running event, then I'd just sit on my fat arse every night watching TV. OK, so I may be exaggerating my self deprecation, but you get the idea.
I find that this affects me in many different aspects of my life.
To motivate myself to run I set a target (public) 5km or 10km time (this year it's 22:30 and 50:00 respectively).
To motivate myself to learn to do the Rubik's cube, I set myself a target completion time (1 minute - yup, managed it).
To motivate myself to save money I set a target amount to reach by a certain date (nope, not telling you how much).
A friend of mine decided that he'd set himself the target of taking a photo a day for a year and posting it on his site. I may have to steal that idea next year... but until then you can find his here: www.ysr23.com/blog. It really is damn good.
I do the job I do because I just flat out enjoy it. As soon as it becomes too much of a chore I'll move on. And I reckon I'm doing alright career wise in whatever way you choose to measure it. For me the only measure that truly counts is enjoyment, and in the main it's a damn fine job. Well, it is most of the time anyway ;-)
Someone at work once said to me: You know, every now and again Tom Cruise probably gets up in the morning, probably on set, in his trailer and thinks to himself "Damn, gotta do some of that acting shit again today". OK, so he gets paid more in a minute that I do in a year, but you get the point.
And the big thing that keeps my enjoying my job is that I'm still learning new things. I suppose I have a clear target in my career to always keep on learning and to surround myself in people who can teach me. It's probably one of the biggest reasons why I'm so pleased to be working with Extreme Programming. It makes it easy to fulfill that goal. And it works on a clear system of easy to understand targets.
A release to the business has a target set of functionality.
A single story has a clearly defined purpose.
A unit test gives you a goal that must be met, and a clear way of determining the success or failure.
Layers of targets.
And if you're doing XP properly you get to celebrate when you meet those targets.
A brief whoop when the unit test passes.
A handful of jelly beans when the story's complete.
A damn big meal and a piss up when a release hits the business.
OK, so real life targets don't have quite the same level of celebration, but it's the same deal.
Set yourself a clear target and you get clarity of purpose in aiming for it, and the celebration when you pass it.
The more I try to motivate myself to do things, the more I realise that if I don't have a target it's incredibly difficult.
When I realised this it came as a big surprise to me. I'm really not the sort of person to have a 5 year plan or career goals, but it seems that if I don't set myself an only just achievable goal I find it very difficult to motivate myself to do much.
I keep myself fit so that I get the most out of playing football. But just having that in mind isn't enough to get me out and running. If I didn't set myself a target time for a 5km or 10km run and then book a place at a running event, then I'd just sit on my fat arse every night watching TV. OK, so I may be exaggerating my self deprecation, but you get the idea.
I find that this affects me in many different aspects of my life.
To motivate myself to run I set a target (public) 5km or 10km time (this year it's 22:30 and 50:00 respectively).
To motivate myself to learn to do the Rubik's cube, I set myself a target completion time (1 minute - yup, managed it).
To motivate myself to save money I set a target amount to reach by a certain date (nope, not telling you how much).
A friend of mine decided that he'd set himself the target of taking a photo a day for a year and posting it on his site. I may have to steal that idea next year... but until then you can find his here: www.ysr23.com/blog. It really is damn good.
I do the job I do because I just flat out enjoy it. As soon as it becomes too much of a chore I'll move on. And I reckon I'm doing alright career wise in whatever way you choose to measure it. For me the only measure that truly counts is enjoyment, and in the main it's a damn fine job. Well, it is most of the time anyway ;-)
Someone at work once said to me: You know, every now and again Tom Cruise probably gets up in the morning, probably on set, in his trailer and thinks to himself "Damn, gotta do some of that acting shit again today". OK, so he gets paid more in a minute that I do in a year, but you get the point.
And the big thing that keeps my enjoying my job is that I'm still learning new things. I suppose I have a clear target in my career to always keep on learning and to surround myself in people who can teach me. It's probably one of the biggest reasons why I'm so pleased to be working with Extreme Programming. It makes it easy to fulfill that goal. And it works on a clear system of easy to understand targets.
A release to the business has a target set of functionality.
A single story has a clearly defined purpose.
A unit test gives you a goal that must be met, and a clear way of determining the success or failure.
Layers of targets.
And if you're doing XP properly you get to celebrate when you meet those targets.
A brief whoop when the unit test passes.
A handful of jelly beans when the story's complete.
A damn big meal and a piss up when a release hits the business.
OK, so real life targets don't have quite the same level of celebration, but it's the same deal.
Set yourself a clear target and you get clarity of purpose in aiming for it, and the celebration when you pass it.
Subscribe to:
Posts (Atom)