Showing posts with label geek. Show all posts
Showing posts with label geek. Show all posts

Saturday, August 9, 2008

Grrr... I hate closed source software

So in my new life as a tech administrator, I've gotten to play with OS X server and client machines. It turns out that OSX includes more or less the equivalent of Norton Ghost for free — that's a good thing. Our school hadn't configured or used this functionality in the past — that's a bad thing. Enter me to save the day!

Anyway, long story short, our previous tech guy had upgraded our server to 10.5 in order to fix some now-forgotten-about bug (grrr #1: paying to get upgrades that are really bugfixes). So, long story short, after a long time today setting up an image and setting up the server to use it, I had a problem: for some reason Mac's System Image program wasn't seeing my source disk as a valid image. I couldn't figure out what was going on for the longest time, until finally on Mac's website I discovered it: with the 10.5 version of the System Image program, you can only create images of System 10.5 and later. Our client machines all have 10.4.x on them.

Grrrr.

It's funny what you end up taking for granted in the open source world I'd been living in. Here are the things that would normally be unimaginable:
#1. That I can't update without making a big expenditure (and in this case, it would not just be one new client license but many)
#2. That I can't downgrade if an updated piece of software isn't any good (i.e. I can't get or run the 10.4 System Image program on my 10.5 server).

To solve this, I'll have to downgrade everything to the 10.4 server and hope that whatever bug bugged our last tech guy won't affect our new environment.

It's also quite puzzling to me that the System Image software cares about what kind of volume it's installing. I'd think with the base infrastructure in place, you'd be able to distribute images of any kind -- Window, Linux, Mac, what have you. I can understand that their might be some value-added stuff the System Image software can do that's specific to the OS, but it seems strange that they couldn't support at least a base functionality for any old system disk.

Lazy web programmers (or are they just stupid?)

I'm setting up some online auto-billing to save the pain-in-the-ass of stamps and checks here... this always gives me a chance to see some fine web programming on display. Here's an error message I just got that, unfortunately, is not at all uncommon:
Please enter 10 digits, leaving out characters such as "-" or "/".

My first response is: you lazy piece-of-crap programmer, how hard is it to strip out the character.

But then I realized something — the programmer isn't exactly lazy, they're stupid, because they took the time to write the code that generates the error message, but didn't take the time to just do what the user wants.

Here's some pythonic pseudo-code to illustrate:

To do it the right way
inputstring = get_idno_from_webform()
inputstring = inputstring.replace('-','').replace('/','')

To do it the wrong way...
inputstring = get_idno_from_webform()
def confirm_idno ()
inputstring = get_string_from_webform()
try:
assert(inputstring.isalphanum())
except:
show_obnoxious_error_message()
confirm_idno()
else:
do_the_right_thing()


Grrr... makes you wonder -- who hires these people and how much do they make?

(Note: I realize that even in the ideal code you'd need an error message for cases where the user typed something totally invalid, so maybe they're just lazy after all. Still, the error code that handles things like a user typing "!)(*@!$#KJ" should pretty much never run, whereas the code that handles dashes (which are printed on the bill as part of the number) is really much more important and will be called for more often than not.)

Monday, July 21, 2008

Python debugging

So I just discovered the awesomeness that is ipython -- specifically, the awesomeness that is the ipython embedded shell.

Ever wished you could just stop at a given point in your program and start poking around using the handy dandy python shell? Here's how.

# We clear the args because arguments to your program will confuse IPython
import sys
sys.argv = []
# And now we embed a shell...
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()
ipshell()

This even works from in the midst of a GUI (I use it in the midst of my gtk program).

For a lazy programmer like me, this is a godsend. Now rather than reading back through my code to find out what I need to do, I can plop the below code wherever I'm in the midst of working, then find myself landed in a shell where I can inspect my objects, variables, etc., figure out just what I need to add to my code, and give it a test run.