Saturday, March 29, 2008

What’s your data backup solution?

Everybody knows you should back up your data regularly. One of the most common things I said to students when I was teaching was ‘Save early, save often.’

There are many horror stories of people loosing precious data, like a fellow student when I was learning programming who lost his project.

We were both working on our Java project for our programming major. I had just completed mine and was documenting it, and he was putting the finishing touches to his code, checking for bugs etc. It had been a really good session for him, he was on a roll. He had gone hard and written he entire program in one go, without saving it. As Mr. Murphy predicted, just as he hit the save button the computer crashed. He lost everything.

I’ve been there done that also, unfortunately.

I had just finished a whole bunch of bug fixes, updates and improvements to my MySQL interface software, and it rocked! Just as I was finishing it the phone rang. It was my sister, and we started chatting about stuff. While we were talking I began to hear a strange ticking noise coming from the computer. At first I thought some dust or something had got into the fan. But then, it all went black – no more hard drive. I not only lost my software, but everything else on the hard drive. At about that point I thought ‘ Hmmm…. I wonder if I’ve backed any of that up anywhere.’ The short answer was ‘no.’

I managed to get some of the data back thanks to the wonderful people at Quay Computers here in Wellington. But it was a hard lesson to learn – other people are not the only ones who need to save often, save early. I need to do it too.

So I got an external hard drive and began doing irregular backups on that. It worked fine, sort of. I’ve since had numerous OS failures (thanks Vista!!) where I’ve had to reinstall and then get my data from the backup drive. So at least I haven’t lost too much during that process. But it was always cluncky and I never did it often enough.

So I came up with a cunning plan, thanks in a small part to my father. He was going overseas and needed a way to store and carry video and picture files. Potentially a lot of data. We ended up buying a portable hard drive – the Western Digital Passport portable hard drive. At 120gig it had enough capacity, and being powered via USB made it easy for him to carry around and plug into a machine in an internet cafĂ© and download all his pictures. It’s nice and small so it does not take up a lot of room in his luggage etc. it worked flawlessly for him, so I thought I’d give it a go as well.


Where this is better than my old hard drive is that it is powered via USB, I don’t have to plug it in and turn it on. It just turns on when I turn my PC on.

I also don’t have to decide what to back up. It knows what files have changed and what is new etc. all I have to do it click the .exe to launch the synchronisation software and then forget it. All my selected folders, including email, browser favourites, music etc are al encrypted and copied to the hard drive.

It’s a very simple elegant solution that means no mater what happens to my OS or my hard drive, I’ll always have my data backed up. And as a bonus I can just plug the drive into my laptop and carry on working on the same files, including all my development files, which is a huge bonus.

So when you’re thinking about how to back up your data, have a good look at an external portable drive. They come in many flavours and sizes and most offer encryption. I’d recommend getting one the is USB powered as it saves having to remember to turn it on etc and you can set your PC to run the synchronisation software on startup.

But not matter what strategy you use, make sure you DO have a strategy, and that your strategy works.

And always remember – save early, save often.

Sunday, March 23, 2008

High school reunion

This weekend I attended my high school reunion. I was 50 years ago that Rangitikei College was founded, and while I wasn’t there for the start, I did attend for a number of years some time after.

I say ‘a number’ because I don’t know what the years were. I’m crap like that. I got my starting dates wrong and then had everyone scratching their heads wondering why I spent 2 years in the third form.

I had been a bit nervous about going back and seeing all the people I grew u with. I cut pretty much all ties to my home town when I was 22, and apart form a couple of short stints, I’ve only really gone back to visit my folks. So the thought of seeing my old mates and catching up was great. But I also was worried that I had not done enough in the 20 odd years I’ve been away.

Certainly I’ve been out and travelled, seen a bunch of the world and done some weird and wonderful things. But at 42 I’m still single with no kids, no house and I’m not ‘part’ of a community. I do have a good job, earning good money and I’m damn good at what I do. So I guess on balance I could turn up and at least not be a dismal failure.

So on Friday after dropping a mate at the airport, I drove up. And as I travelled, with hits of the late 70s and early 80s on the stereo I began remembering all the adventures I’d shared with the guys I grew up with. By the time I drove up my parents driveway I was keen to see all the guys and relive the days of my youth. All doubts about being there were gone.

After a quick cuppa with my folks I went up to the school for a look around. So much had changed, and yet so much was the same. There were tall trees where before there was just grass. I spent some time wondering if there was a tree when we used to play bulrush here…

But a tree can grow quite big in 25 odd years, so I’m sure it wasn’t there when I was at school.

Some of the old buildings were gone, sadly. The technical studies block where the older boys used to hang my upside down from the cloak pegs by my socks was gone.

Another block where we used to hang out in a sun trap now has an extra building in front of it, effectively killing off the spot where were used to spend our lunchtimes.

The pre-fabs which were falling down when we were there, were still there, and had even had a coat of paint!!

And then I started bumping into people I knew…. And who knew me.

I was talking to one guy I was in the third form with, and who was now the official photographer, when I got a slap on my bum and a grinning face said ‘we’re over here’.

One of my high school crushes had recognised me, from behind and had come over to drag me back to the group.

That might sound like a great feat of recognition, in a crowded marquee, to spot me in a crowd, but not really. I was only 4 feet tall at high school, the shortest person there. I was still the sorted person in the tent, so it didn’t take a rocket scientist to figure out who I was.

But it was nice to be recognised and to catch up and find out what she had been up to. Married, 2 kids, living up north and looking happy with her life.

And there was so much of that. Everyone I saw from my year looked great. They all looked so young and happy. There was such a positive feeling the whole weekend and it was just like sitting around at lunchtime after exams, when there was nothing left to worry about except what to do over the summer holidays.

Many had moved away, to nearby cities, some had moved further afield and more than a few had stayed and raised families. But they were all pleased to see old friends and classmates, even if it took some time to place the names and faces.

There was so much head bobbing to check name tags that we looked like a flock of flamingos grazing the waters edge. And so many cries of ‘Oh my god, you haven’t changed a bit!’

In my case it was true. Once a short arse, always a short arse. But it was true of so many others as well. And it was the smiles that did it for me.

Someone would be standing chatting and I would know that I knew them, but could not place them. And then they would smile, and that would key the memory and I would know exactly who they were, and what we’d got up to, and even the excuses we came up with when we got caught.

And I think that is a marvellous thing. The key was smiling. For that to be imprinted as the most effective path to my memories must mean that we did a lot of smiling way back then.

I met people that I didn’t even remember that I knew until some mentioned their names.

In my third form year, my form teacher was a young woman in her first year, fresh from teacher’s college. She was the not-so-secret crush of just about every boy in my year. And we had all read that she would be attending the reunion and it didn’t take long for the guys to start asking if anyone had spotted her.

No-one had, and pretty soon we had organised search parties to track her down. Even the girls in our year got in on it, because she was a great teacher and popular with everyone. We never found her, sadly, but shared many great stories of her classes, and some of her out-of-school escapades.

I also was lucky enough to see my favourite teacher – Mrs. B. (and that’s what we called her)

It was after the official opening, which was just like most of our assemblies. So nothing much had changed there.

She walked up and gave me a big grin and said, ‘I know that face’. I couldn’t place her for a second and then it hit me. I gave her the biggest hug and was suddenly very glad that I had made the trip. At 70 she looked great. She was happy and smiling and still the same lovely person that I remembered.

More memories were shared and I got the opportunity to thank her and to tell her that she made a difference. She instilled in me an abiding love of science and made me see that learning was not always a chore that had to be done because ‘it had to be done’. It can be a fun experience too.

The only negative part of the weekend was the failure of so many locals to turn up. Many of the kids who had stayed behind simply didn’t attend. Perhaps feeling less than adequate, or somehow feeling they would be looked down on for staying put.

I can understand that. I had those same fears. But they needn’t have worried. There was no pretentiousness, no ‘Well I earn so much more than you…’ or ‘I’ve done this and this and this and you’ve done nothing’.

Everyone was just excited to hear what their friends had been up to, and many were disappointed that so many people they were hoping to see hade not made it.

Myself included. As more memories surfaced I found myself asking ‘where is .. so and so’. Often the answer was, ‘Oh he’s around but not coming’.

It was a shame, and they missed out on what was a great weekend.

I’m very glad I went. It was worth making the effort, spending the money, dealing with the doubt.

So many of the people I lost touch with are now just a txt or an email away. The ties that I cut were renewed so easily, it was as if they were just waiting for the chance to be revived.

If you get the opportunity to get together with old friends, no matter what the event, do it. Don’t worry that your life is not a shining example of achievement. None of us became rich and famous. But it didn’t matter. As soon as we started talking we were all back in school, talking about what we’d got up to over the weekend, laughing and singing along with the band.

Thursday, March 13, 2008

Silver Stripe wins big!!

It was awesome to hear this week that local company Silver Stripe will be supplying the CMS for the Democrats in the US presidential lection later this year.


Its great when a local company that seems to have its heart in the right place, produces good gear and is out tackling the big bad world, pull off a big win like this.


It will certainly be one of the most watched elections in US history and there will be no room for error, and no second chances. But I’m sure the team at Silver Stripe are up to it. And the benefits for the rest of us will be heaps also.


They will be yet another kiwi flag flying on the internationally stage, highlighting that the brain drain hasn’t taken all the talent to Australia yet. And it will mean lots of development work will be done to ensure the CMS is robust, secure and world class.


That mean we’ll have a CMS we can source from ‘guys just down the road’ and know that it is good.


I’ve already done a bit of testing on the system for work, and it looks quite good. With the push to be 100% for the US elections, I’m sure the few bugs and niggles that are still around will be dealt with and the CMS will be bomb-proof.


To the team working on the CMS, I don’t envy you the overtime, but I do wish you very good luck and I hope it all goes as smoothly as any important IT project can go J

Monday, March 10, 2008

Reinventing the wheel

It’ something you get told all the time when you’re writing code – ‘Don’t re-invent the wheel.’


It’s usually in response to the fact that innovation takes time and effort. While it may be true that using tried and tested code can save time and effort, it does not advance anything. And if you’re not advancing you’re going backwards.


I used to get told this all the time, ‘just download something off the net’, usually by people who didn’t understand coding, innovation or the cost involved in trying to shoe-horn someone else’s code in your application. Not to mention the ongoing support and security issues.


It has to be said however there are limits. I mean if you innovated every time you did something you’d probably never complete anything. There is certainly a place for using what others have done before if it will make your life easier, but it’s never as good as getting the old grey matter working away at doing it better yourself.


I use code, frameworks etc all the time, and I re-use stuff I have written previously as much as possible. But I’m always thinking of better ways of getting the job done.


A good example of that it what happened today –


I was working on a web-form template. This template is designed to be able to take just about anything you want to throw at it and it will build a cohesive form for you.


So far so good.


Last week I had it all going well, it was doing just what I wanted it to and I was quite happy with it. But then today I was adding a select box control that had to be coded differently from the other controls (text, checkboxes etc), and I looked at a different way of doing it.


I figured out a way that worked really well and then it occurred to me my other controls could be coded this way and it would be heaps better. (It solved a problem I had with multiple controls with the same name accessing the database).


So I spent the afternoon re-coding my code from last week to reflect the evolution of the select box control.


I ended up with a form that is much more robust and flexible.


So if you have to opportunity to innovate, don’t waste it, get in and see if you can come up with a better way. You’ll b glad you did if it works out. And f you don’t, the mental exercise is always good :-)

Saturday, March 8, 2008

Don’t trust the experts

One lesson that I keep re-learning is that you should not blindly trust the experts.


Sometimes they get it wrong, sometimes they don’t know the answer and sometimes they just don’t care.


Often though, instead of telling you they don’t know, they will give you an answer to make you go away and stop hassling them.


Now I’m not suggesting this is a malicious thing, more that a lot of people can’t admit they don’t know the answer so they’ll either have a stab at getting it right or make something up that sound plausible.


A couple of recent examples of this are when my Vista PC went on the fritz and when I got digital TV installed.


My Vista PC was working fine (well as fine as it gets for Vista) but then weird(er) stuff started happening.


When I would boot it up things would be fine up until it went to display the login screen, then my monitor would display a ‘no signal’ message and go into hibernation. The hard drive was still merrily spinning away and as far as I could tell the OS was loading properly.


I’d re-boot into safe mode and it would work fine. After playing for a bit I figured it was the Nvidia video card drivers causing the problem.

Things continued on until I got fed up with it and took it into the computer hospital (it was still under warranty).


They had a look at it and ended up re-installing the OS and everything was fine. Apparently the OS was totally corrupted.


I figured ‘fair enough’ it was not something I would have been able to fix by tweaking stuff.


The initial diagnosis of faulty RAM (made when I dropped the PC off proved to be wrong).


So I took my fixed PC home and eagerly plugged it in (I’d been without it for a whole week!!)


It booted up and bugger me…. Same problem!!


Since it was the weekend I decided to try a re-install myself. After all I had nothing to loose. So I re-installed Vista and away we went. No problems. Everything was fine…..


Right up until I installed the Nvidia drivers. Then guess what….. ‘no signal’.


So into safe mode I went, rolled back the driver to the Microsoft generic one, and then rebooted back into normal mode.


Everything was fine. My PC hummed along quite happily. (apart from the screen saver not working because I have a wireless mouse etc.)


Then Windows did an automatic update and whopps!!! Those damn Nvidia drivers were back in charge. We battled for a bit with the drivers taking over every time windows even thought about updating.


Long story – short, I buggered things up trying to disable the drivers.


Now I’m back using XP and I’ve had no trouble at all.


The lesson in this is that my first instincts were correct. The experts said I had faulty RAM and then a corrupt OS. Now to be fair they guys where I took my PC are great. They give the best service ever and a probably one of the cheapest places to get things fixed.


I’ve bought 3 PCs and a laptop from them and you can bet my next PC will be coming from them also.


But in this case they got it wrong and I was pretty sure I was right when I told them what was happening.

The lesson here is if you think you know what’s going wrong don’t be afraid to trust your instincts. And if what the experts tell you sound a little ‘off’ don’t be afraid to call them on it. I really think that most of us are smarter than we give ourselves credit for.

Now for my digital TV.

I got it installed with my broadband as a package. No worries there. When the guys were hooking it up the picture was really bad. It was wavy and bumpy. Some channels were better than others and it didn’t happen all the time.

They fiddled around a bit and came to the conclusion that it was either my TV that was the problem of my DVD recorder.

My TV is only a few month old, and while not being a flash one (A Dick Smiths special) it should still have been able to cope with digital TV.

Now I admit the picture was always a bit of a problem, but I put that down to it being a cheap telly.

But with the way it was wobbling it was just not fun to watch. If you sat way back it wasn’t too bad, but I couldn’t watch it for more than an hour or so without getting a headache.

So I persevered for a bit until yesterday when I went looking for a new telly.

So I was looking at about $2000 to get a good telly that I hoed would solve the problem. That’s a bit much considering I don’t spend a lot of time watching it. And I had no guarantee that the new telly would not have the same problem.

Then last night I was trying to finish watching Apocalypse Now (I’d got halfway though and then couldn’t take the wavy picture any more) so I dragged the TV cabinet out and started fiddling with the wires, with some interesting results.

At one point I got the Simpsons all in shades of blue. It looked quite cool actually.

Then suddenly I got a solid picture. Bingo!!

So I sat down quite happy to watch the rest of the movie.

Now I have good steady picture and good sound.

Another case of the user triumphing by ‘having a go’.

So the next time something does not work and the experts walk away with a shrug of the shoulders, don’t just put up with it.

Have a go yourself. You’re a smart person, figure it out and make it work.

Might be best if you turn the power off first though. (unlike me)

Wednesday, March 5, 2008

Regular expressions in PHP

Yes I know, regular expressions are hard!!

I know I should use them more, but they just do my head in.

Every now and then though I come up against a problem that really should be done with a regular expression and I make the effort to get my head around the weird syntax and come up with something to solve the problem.

I did that the other day at work where i wanted to clean input parameters from a URL when a form is submitted.

Now, I've done this many times before an a number of different ways, but I think my latest attempt is the best I've come up with so far.

Here is the expression I came up with (and a couple of variations) -

$myVariable = eregi_replace("[^a-z]", "", $HTTP_GET_VARS['form-variable']);

What this does is strip out anything that is not a letter from form-variable, which means no nasties like SQL injection and cross-site scripting attacks will be able to play.

Using eregi_replace means it is not case sensitive, so you don't have to worry about capitalization.

The [^a-z] part specifies what to look for. The '^' at the start of the class (the [] bit) means look for everything that is not in the following list. So you just have to put in the characters you want to let through in the list.

The "" part specifies what to do with the characters the expression finds that are not in the list. It this case I've set it to replace them with nothing - effectively deleting them.

And the last bit id where you get the string to be evaluated. In this case the GET variable.

This has worked really well for me. It strips out all the bad characters and leaves the good ones.


Here are a couple more variations of the expression that are really useful.

$page = eregi_replace("[^-a-z.0-9\\/_:?=]", "", $_SERVER['REQUEST_URI']);

I use this one to check for correctly formed URLs. As the URLs I'm checking are all part of a CMS I'm building I can determine exactly what should be in the URL.
i.e. hyphens, letters, numbers, slashes, underscores, colons, question marks and equals signs.

Anything else will be stripped out.

$myVariable = eregi_replace("[^0-9]", "", $HTTP_GET_VARS['form-variable']);

This is useful for checking that the variable is numeric. Things like ID values etc.

I still have trouble with getting my head around how the expressions work, but at least I'm making small steps and figuring out how to get them working for me.

If anyone has any good expressions feel free to add them in the comments section. All help is good help. :-)

Sunday, March 2, 2008

Cool software

Every now and then you find something that’s just soo cool.

One of my work colleagues found a product called Jing and told the rest of us all about it.

It’s a tool for grabbing screenshots and annotating them. But you can also take movies with sound, and share them online with anyone.

I’ve used other products for this kind of thing but none were as easy and as much fun as Jing.

Reading through the end user license agreement, I think I owe them my soul at some point in the future.








Screenshot from Jing

But given that I probably already owe it to pretty much every software manufacturer in history, I don’t think it likely to be much of a problem.

I usually try to read the EULA on stuff that I install. Most of them seem to be more about covering their butt in case something goes wrong. But a lot of them are just plain weird.

I mean, when you buy a car should Ford or Holden be able to tell you where you can drive it? Who can sit in it?

And at some point in the future they can change who can sit in it without telling you and then sue you for breaking the agreement?

No-one would put up with that. So why do we put up with these strange end user licence agreements?

What is the weirdest EULA I wonder?

What is the craziest thing software vendors have tried to get away with?

Saturday, March 1, 2008

Security on broadband

Along with the 'getting on board' theme, i recently got on board with broadband. Yes, I know.

I'm one of the last people in the world to do it, but I'm a slow learner.

And I have to say it's great. We had a broadband connection at my previous job, and that was one of the reasons i wasn't in a hurry to move. It was marginally faster than my dial up for surfing.

Granted, when you wanted to download large files it was quite a bit faster. But how often do you download 800mb files?

But I'm very impressed with the speed of my connection at home. I can now watch stuff on YouTube etc and it actually works!!


One of my big concerns now that I'm 'always on' is security. I don't want my PC to become a bot to send out spam from some guy named Boris promoting willy enhancing apparatus.

So I did a bit of research and the consensus seems to be that since the hackers use blended strategies to get in, it makes sens to use blended strategies to keep them out.

So what am I using?

Well lets start with the firewall:

I've got the free version of Zone Alarm running and I've locked out pretty much anything that should not have access to the Internet. i.e. my browser (Firefox) and email client (Outlook). The only other stuff that has access by default (i.e. I don't get a popup every time they go and access the Internet) are my other security programs.

Anti-virus - I'm running NOD32. This came pre-installed so I left it there. It had good reviews, so no worries. This looks for viruses etc the traditional way, using signature files that it updates regularly.

That is backed up with ThreatFire, which also scans for suspect activity based on what programs should be doing. It's a different approach to the same problem.

I've also got Spybot Search and Destroy - because it's good.

And to make the mix just slightly more interesting I also run my web browser in Sandboxie. So anything downloaded, installed etc by the broswer only plays in the sandbox and does no alter settings in my OS. It seems to work fine.

All the programs work together without much hassle, and they were all pretty easy to download, install and configure.

I don't think in this day and age that you can be 100% secure, but at least you can make a determined effort.

This blended defense has worked well so far, with no infections or problems reported.

If anyone has any other strategies, feel free to post them in the comments. I'm always interested to find better ways of keeping my PC safe.

Time to get on board...

So here I am, getting on board.

I've been writing and expounding on theories (some conspiracy some not) for a number of years, and while I've read blogs and been involved in various communities on the web, I've never really had a good crack at blogging myself.

So here I am getting on board with actively blogging.

I'll try yo keep this from degenerating into something like a slagging session and try to post things that might be helpful or at least thought provoking.

Feel free to post comments, but please no spammers, you're not helping anything.

I get into some interesting things with my work, and do a bit or research on the web, mostly to do with code, and when i find something that I think might be useful I'll inclue it here.

Well now that I'm on board it's time to get to it. :-)