On being temporarily mentally impaired

Ever had one of those I should have slept more last night because tying my shoes seems to take up my entire mental capacity moments. Yeah it’s like that at the moment. It’s like watching your thoughts unfold in a slow interval strobe light. Every two seconds something makes sense, and then you’re left wondering exactly what it is you were thinking about.

I was seriously stuck for quite a few moments trying to figure out how to do something in a while loop, before the strobe went off and I realized I can make the loop walk backwards just as easily as forwards. It might be a long day.

Words of Advice

When you’re developing software, the new version is not always the best. The tests that are run are always hugely insufficient, and if you keep up to date you’re just left with not working software most of the time. It’s better to have your own set of tests, and keep 2 versions, one that’s really tested for production, and another that you keep for development.

Second, when you have a bunch of scripts it’s a pain to maintain slightly different versions for each machine you work on. Here’s where setting your own variables in your bashrc comes in handy. I put a whereami variable in my bashrc, so it’s alwasy in the environment, and it will contain a word that identifies what computer I’m working on. Then in a perl script for instance I can say $location=$ENV{‘WHEREAMI’}, then have if statements to set the directory paths that I need for that machine.

Finally it saves you time in the long run to build in output file checking in your scripts, i.e. before you ask the computer to do something make sure the output file doesn’t exist. This allows you to have one script to run on every file of a certain type, and just to run it if everything completes the first time great. If there’s a bug that effected only a subset or you for some reason had to kill the jobs before they all finished, all you have to do is submit again, and it will only run the jobs that didn’t finish. Works best if the files aren’t put in their final location until complete, i.e. output to an output.txt.temp file, then after output.txt.temp is done move output.txt.temp to output.txt, the move command will never crash, that way you can just delete all the .temp files and run again.