Saturday, July 18, 2009

why I love python

Lately, discussions at the NFJS conference and recent conversations with friends have made me introspective about why I like Python.

I first started using Python about 9 years ago. Previously, I'd used mostly C, C++, Perl, Pascal, and a very little bit of Visual Basic.

Pascal was what I'd learned in High School. VB, C, and C++ were what I'd used during college (I guess there was a teeeeny bit of Lisp thrown in there too). My first couple years as a software engineer, C++ was the hammer with which I'd pounded all programming nails.

Eventually I learned Perl. It was OK. But, like most people, I'd write Perl scripts and not be able to read them the next month.

After a recomendation I'd read online, I tried the Python tutorial. The conciseness was a revelation. The way it got out of my way and let me worry about the problem and not the compile/run/debug loop. Having dictionaries and lists as a first-class language features blew me away. I don't know why similar features in Perl never struck me in the same way.

Learning Python not only completely reinvigorated my interest in programming, but it also and completely changed the way I program. Maybe I still love Python because of the sentimental attachment to it from that first revelatory period of experimentation.

no fluff just stuff SLC 2009

It was pretty good. Only went to one session that was a dud. Decided to try to go to a number of different speakers in an attempt to not get burnt out. But, I should have just stuck with all of Venkat Subramanian's sessions the first day's afternoon. He's an awesome speaker.

I enjoyed seeing other dynamic languages -- groovy, scala, clojure. Definitely seems like mixing in Groovy to any java project would be pretty easy. Loved that it removed a lot of Java's verbosity, but kept the barrier of entry low. Groovy also seemed to be much more readable than clojure or scala.

Scala seemed very interesting -- liked the type inference, and concurrency support. But, I hate hate hate the underscore. And that g-damn colon that changed the operator/operand. Maybe if I used it every day, it'd seem more readable.

I guess if people can hate Python's significant whitespace (which I love), I can have an irrational hatred of Scala's underscores/colons.

Monday, July 13, 2009

further adventures in horrible code -- effin assert

Lots of assert() checks spread throughout our code, testing perfectly valid error conditions. Used sparingly, testing things that absolutely could not happen... ok. But checking for NULL values passed as parameters to various type comparison functions? Eeesh.

It's caused problems up a couple times before... but last Friday's was extra awesome. I'd been working for 3 days with a customer, trying to resolve the cause of a crash of our application at their site. Finally get them to install WinDbg and run our debug build so we can get some crash dumps.

Bang. Assertion failure. Nowhere near the crash we see when running a release build.

Dig into the crash dump. Dirty data in their database that the release-compiled version of our application just ignores because the assert() check is turned into a no-op by the preprocessor for release builds.

I can't tell them it's their data that needs to be fixed. This application and its periodic releases has been running just fine on their system for 5+ years.

But, I also can't run the debug version of the latest release to diagnose their current problem. It's stopping during initialization due to the asserts.

Argh.

Saturday, June 13, 2009

Friday, June 05, 2009

readin'

Just finished Use of Weapons by Iain M. Banks. For whatever reason, found it hard to get through. Mostly because I wasn't in much of a reading mood. The two timelines also confused me at first. I enjoyed it though, and will definitely re-read in a few months to see if I like it better the second time.

Next on the to-be-read pile, in no particular order
  • IronPython in Action
  • Watchmen
  • Dark Knight Returns
  • In Defense of Food
  • Pride and Prejudice and Zombies
In other news: Got a promotion at work (in semi-official-title but not in salary). Now I get to do even more of the things I'd rather not be doing. Good times.

Tuesday, January 20, 2009

parable of the goose

The windows near my cube overlook a winding river through the nearby golf course.

Early this morning the ice was pretty patchy. Open in places, other sections just thin enough.

Thin enough that geese walking across would crack through, plop into the water, and create a 3x-goose-size hole in the ice. A pair of them fell through within a section of ice around 30 feet across. Then, a different pair swam happily past in the open area.

One goose got so upset it starts swimming back and forth. Zigging and zagging, banging into the sides of the ice. Trying to get closer to its fellow stuck in the ice, then zooming towards the freely swimming pair. Lots of excitement and action, but ultimately no movement.

Later today....

While talking over all the crazy synchronization steps that my team has to follow in order to stay useful and relevant to the rest of the project, and how we'll transition that into our long-term goals, I tell them the above parable of the goose.

I was talking with the project's PM and current SD-manager (my boss), and was trying to describe how frustrated I was getting. Back and forth, the same discussions, different groups pulling our priorities all over, and ultimately no real progress towards the end goal.

Of course... rather than end the story there, I accidentally finish it up with the goose getting fed up and flying away.

The moral of the story:
I suck at fairy tales. But, I'm awesome at Fruedian slips.

Monday, January 12, 2009

belated reading/listening/watching/playing updates

Read:
  • The Algebraist, by Iain Banks. Re-read this. Even better the second time.
  • World War Z, by Max Brooks. Also a re-read, also awesome.
Listened:
  • Ancestor and Infected, by Scott Sigler. I think I'd have liked these better in print form than as audiobooks... The author does the audiobooks, which I assume allows them to be free. As stingey as I can be, I might pony up some cash if the voices of the characters weren't so lame. Story-wise, I much prefered Infected to Ancestor.
Watched:
  • Finally saw WALL*E, The Dark Knight, and Wanted. All great.
Played:
  • Many, many games with friends and family. Some new/continuing favorites: Ticket to Ride, Game of Thrones, Hey That's My Fish, Snorta, Samurai. 

Saturday, January 10, 2009

best weird debugging experience ever

I am captivated by each nugget of horrible code.

typedef struct RMAP
{
bill* pbill;
line* pline;
rule* prule;
} rmap;

I'm not sure what I find the most interesting... The fact that somebody thought it was fine to copy that struct definition throughout 15+ .c files.

Or, the fact that somebody slightly modified a couple of those instances.

typedef struct RMAP
{
bill* pbill;
line* pline;
rule* prule;
Bool overrideFlg;
} rmap;

typedef struct RMAP
{
bill* pbill;
line* pline;
rule* prule;
double accum;
} rmap;

Or... the best subtle weirdness, in one instance someone reordered the pointers.

typedef struct RMAP
{
rule* prule;
bill* pbill;
line* pline;
} rmap;

So... when you debug the following code in any of the _other_ .c files...

void myCrazyFunction(rmap* a_rmap)
{
rule* r = a_rmap->prule;
double reduction = r->reduction;
... blahblahblahblahblah ...
}

At runtime, everything works -- the definition of rmap used by the compiler is the definition within the .c file, and the third set of pointer-size bits within the a_rmap struct are assigned to 'r'.

But, when I try to debug the code in Visual Studio and hover over the a_rmap->prule I see a bunch of garbage. I hover of 'r', and I see it's got the values I expect.

I'm guessing the debugger finds the first instance of the rmap type in the .pdb file, and the one oddly ordered struct just so happens to be in the first .c file alphabetically (and also first in build order).

But, that realization doesn't come until about 2 hours of other wild goose chases through the rest of the call stack to eliminate the other 'more likely' possibilities.

Good times.

Tuesday, November 25, 2008

further adventures in wasting time

The 2 days I'd never get back eventually turned into around 4-5 days total of developing, creating unit tests, system testing, and correcting various bugs the tests didn't find.

And now 1 more day. Backing the changes out.

Released ~2 weeks ago; customers and internal support are finally installing the new version and KABOOM! Unknown references in the C Runtime library.

Superfantastic news! Turns out our development / production testing environment isn't at the same HP-UX patch level as most customers' systems. Thanks, Oracle 11g! Thanks, budget constraints that made someone decide they had to stick it on the same server we use for support!

Wednesday, November 12, 2008

twitterpated

I'm all aflutter over the news that HBO has ordered the pilot for Game of Thrones -- http://grrm.livejournal.com/58155.html

Monday, November 10, 2008

'tis the season

For zombies. Sweet, sweet zombies.


http://iamnotinfected.com/

and

http://survivetheoutbreak.com/

great ringtone, or greatest ringtone?

don't gamble

I should learn not to bet for or against the weather.

I'd let the leaves in the yard get away from me -- decided to take a few days off leaf duty until the maples dropped more of their leaves.

I wasn't able to do the raking Saturday, due to a bunch of errands that couldn't wait till Sunday. Decided the weekend was a waste raking-wise due to the predicted weekend rain.

Woke up Sunday to see that it hadn't rained. Decided I didn't want to get started on the leaves since the clouds looked ominous, and instead started on the rain gutters. Ick. No rain by the time I'd finished, and I was filthy anyway, so I started in on the leaves. Promised myself I'd go until the rain started.

No rain. For the four hours it took me to get the leaves off the front and side yard. Lame. Stupid rain, you were supposed to give me an excuse to go inside and watch bad TV.

16 new bags o' leaves to add to the 10+ from previous weekends. Still have the backyard to do, and about a quarter of the leaves from the maples in the front yard.

Wednesday, November 05, 2008

tell me what to do, lazyweb!

I want a laptop. Or a netbook. I don't particularly want to buy both.

After trying to type on a Eee PC 900(?), if I go the netbook route I definitely want to actually try typing on it in person. Right now, leaning towards a Eee 1000H or maybe the Samsung NC10.

Or, do I just spend another $800 or so and get a just-as-portable but more powerful system? Leaning towards either the Lenovo Thinkpad X200 (non-tablet) or buckling to peer pressure and getting a MacBook.

Or... do I go for an even bigger model so that Eclipse isn't all scrunched up? Or, do I just use it for 'fun' projects where Vim is all I'll need?

Yeah, I don't know what I want, and I've got conflicting requirements. Small! Big! Cheap! Oh, alright, spend 3x as much.

A decent keyboard and sturdy build are my only consistent criteria.

Monday, October 27, 2008

2 days I'll never get back

Through sheer happenstance, one of the test databases for our new system was (mis)configured in such a way that an Oracle sequence was generating very large ID's for a certain field.

Very large as in 123,456,789,236

Guess which horrible application uses a 'long' type to hold those IDs? Guess which horrible application is supported on both HP-UX and Windows? Guess what type might be 32bit on Windows and 64bit on HP-UX? Ding! Ding! Ding!

Spent all day Friday and today rejiggering the code to use 'long long'. Most of today was spent un-rejiggering and re-rejiggering the code to work around Oracle Pro*C's inability to use 'long long' as a host variable -- today I had to swap all that out of the embedded SQL in order to use character strings and stroll/sprintf to move values from the strings to 'long long' and vice-versa.

I had thought the code was 'OK' on HP-UX... after all these recent changes, I'm not so sure. The code to transfer the values from the query results to their 'long' variable instances seems wrong. In any case... it'll work the same on both platforms now.

I take some solace from finding the problem before any customer. We have at least 3 customers nearing 1-billion bills -- although the horrible app is 10+ years old, the rate they're adding bills to their systems grows every year. They can also start/change their sequences whenever they feel like it. So, maybe we had another 1-5 years before it became a major emergency.

Wednesday, October 22, 2008

disappointment, thy name is tiny keyboard

I've been resolutely avoiding purchasing an Eee PC (or other netbook) until I actually could get my hands on one and try typing.

Tried out an Eee 900? at BestBuy the other day -- not sure which exact 900 model. Too small. Maybe I'd eventually get used to it, but I've decided I definitely should go with the slightly larger Eee 1000H.

Tuesday, October 21, 2008

not spam

I never imagined I'd get an e-mail with subject line "Help with goat talk" and it would not be spam.

Tuesday, October 14, 2008

which is better?

  1. Laughing/crying at the right-wing, loony spam mails I get from my kook of an Aunt.
  2. Laughing at the "in no way related" e-mail containing the facts behind the rumors that inevitably follows a few days later
The latest example, a forward from the doublespeak-tastic 'American Family Council', with the subject line 'Fwd: If you think things are bad now, just wait....'
{snip}

In case you may think I’m a “the sky is falling” type of person, you should know: When it comes to predictions, I am a very reserved person. But not on this one. I cannot overstate the damage a liberal victory will do to our country. The upcoming election is the most important in the history of our nation. Yes, if the liberals win you will lose some of your religious freedoms and free speech rights. Churches and pastors will not be exempt. You will not be allowed to say certain things about a particular group. Every item of the homosexual agenda will be approved. All the laws protecting the unborn will be wiped away.

{snip}
And 5 days later, the next e-mail from her with the subject line, 'In Fairness to B. Obama. AND J. McCain.....Snopes.com' :
There are so many derogatory Political Emails floating thru space out there, that I am personally tired of having to wade thru them all - and acknowledge that it's hard to get the straight-forward Truth....

I think it might do us all well to consult those who have done the research on these (either bogus or real-truth) emails. (See links below)

Click here: snopes.com: Politics (Barack Obama)

Click here: snopes.com: Politics (John McCain)
My favorite part of the inevitable follow-up e-mail is the lack of self-awareness or any hint of an apology for adding to the onslaught of misinformation herself. Despite the fact that no one has asked her to, I'm glad she's warned us that she's "personally tired of having to wade thru" all those spam messages she passes along.

I've decided whenever I get baited into a political or religious discussion with my family, I'll make the saving throw by chiming in with, "While I appreciate that these Gay Agendas (*music sting*) make our meetings well organized, they're really making me re-think my conversion to Secret Islamism."

P.S. Also plus too as well : http://www.factcheck.org/

worst. impression. ever.

Dear Autoflush Toilet,

You ain't foolin' me! You're not a bidet!

Why does your sensor think my back is transparent?

You're horrible.

Love,
Steve



P.S. Now that you're thinking about me pooping, I'd like to point out that I deftly avoided use of any onomatopoeia.

P.P.S. Mostly because I couldn't connect the dots between this post and the punchline using the consignment store named "Grunts & Postures" near the first apartments of my wife and I.

P.P.P.S. First one to comment with a "full of shit" joke gets 15 demerits.

P.P.P.P.S. Yes, despite the demerits, it is still worth it.