Main

July 20, 2007

Posts that should go away

Nothing to see here.. and no I'm not dead, just busy!

October 31, 2006

When error handling matters

.. well, at least error message translation does, so users don't see this (click on image to see larger):


Arrived there from a google search, error was gone a minute later.

June 01, 2006

Sometimes one just can't plan ahead

While in the process of looking through code to see what I need to change for my current project I decided to clean up our somewhat bloated constants file. You know, do the thing nobody else ever does? Remove unused constants!

While removing the lonely, unused constants and getting rid of some duplicates (user_id vs userid vs user_identifier that all point to the same string.. and so on..) I decided to remove a constants that will probably return to hunt me at some point. I've decided to live with the consequences of the change. It was either change mucho code to use the constant and be (that dirty word..) consistent or remove it. So I decided to remove it. If we have to change the value in the future, it'll be a lot of work, I admit it, but I'm willing to live with that result of my actions.


Today, I removed..

public static final int ZERO = 0;

RIP, leftovers of NSBCs.

May 25, 2006

Oracle optimizer is pure voodoo

A problem we ran into at work today..

A table with mucho data and a date column. The date column has an index on it and its type is just pure old date. A query using jdbc and java.sql.Timestamp type on a prepared statement generates a full table scan.. and the associated slllloowwwwwnnnessssssss.

Identical query using java.sql.Date on a prepared statement or to_date(String, format) in the SQL uses the index.

Am I missing some obvious Oracle clue here? Cause google isn't helping!

Edit: I realize we can hint to Oracle which indexes to use, but it would be nice to have a more general solution.

May 21, 2006

Images from JavaOne


Here's my collection of pictures from this year's JavaOne. I divided it into three categories:

  • General images from around the city. Mostly from touristy spots.
  • Musee Mechanique is a little museum of old amusement machines located at Fisherman's Wharf. Some are interesting, some fun but most are definitely in the creepy category.
  • This year's JavaOne backpacks were a fashionably-stark orange. It made spotting the geeks rather easy. I dedicate this last collection to the designers of the backpack. Good work.

Note: these were all taken with a 50mm prime lense, so "zoom" is created with photoshop.

May 19, 2006

JavaOne

Good conference this year. Went to some really good sessions and only a couple turned out to be duds so I'm definitely batting better than last year. I like the new session enrollment requirement and like it even more than Sun decided to repeat some of the most popular sessions. I'll be attending three of them this afternoon.

In the first general session, we were told it's the biggest JavaOne conference to date and I can certainly believe that looking at the lines to the sessions and crowds everywhere. What surprise me (pleasantly) was the amount of women this year. Nearly made me cry to see an actual line to the ladies room yesterday.

I'm sitting in the alumni lounge right now waiting for my next session ("Using Service Component Architecture to Wire BPEL Processes to Java™ Technology-Based Components" at noon). Only one other woman at the lounge beside me right now, but I'll bet it'll look better next year.

It's good to see that Java is pretty healthy and conference is doing well. Now if only Sun didn't come up with that hideous, orange color for the backpacks. You can spot the geeks all over town from half a mile away thanks to those. Pictures coming up soon!

PS: If you're in SF right now, awesome cream puffs in a little place accross the street from Yerba Buena Gardens (behind Moscone North). Worth the 2min walk!

PPS: To the geek who accidentally wondered to the ladies room and ran out horribly embarassed once he realized it: Sorry I laughed so hard dude!

May 01, 2006

When geeks have nightmares

Geeks are humans too. If you prick us, do we not bleed? As Shakespeare once wrote[0]. Being human we have bad dreams just like the rest of the population. It's just that ours are more amusing later in retelling on a weblog.

As my own example from last night shows..

My most recent nightmare?

Suddenly realizing it's the last day of JavaOne and I missed all sessions.

Yes, I really had that nightmare last night.


[0] I doubt he had computer programmers in mind, but, in his own way, he was a geek for his own time. Sort of. That really explains the whole ren-faire thing though, doesn't it?

March 23, 2006

New feature in the eclipse compiler, please?

Warning when a class (or instance) variable is declared as not private and not final. Pretty please?

I'd pay to have that.

March 06, 2006

Geek conferences should be free for women

Just to even out the odds. After all, over the years growing up boys had all the advantages of being encouraged to tinker with technology while girls are mostly given vapid, soul-less barbie dolls and stupid ponies. The overdose of pink and purple alone is likely responsible for more fried brain cells than teenage alcohol drinking.

So, if conference organizers want to avoid this, it's a simple solution. Make conferences free for women, provide them with some perks (maybe free hotel stays?) and they will flock like tweens to sparkles.

Although that would do away with the one huge perk of being a woman at a geek conference. The bathrooms are always clean and empty.

March 03, 2006

Waxing poetic about programming languages

This would have been more amusing if it wasn't so obviously written by a python enthusiast..

Python: Python cares deeply about you and does its best to make your life easier. Python is willing to try new things to make you happy -- "Sure, I can do generators, if that's what you want" -- and really doesn't mind if you're seeing other languages on the side. It insists upon arranging the cupboard into strict rows, but you stop noticing after a while, and eventually you come to prefer your shelves organized this way. Your friends think this is weird until they start dating Python too.

That really should say:

Python: I'm so beautiful and graceful and smart. If you don't love me you're obviously unbalanced and damaged!

Hey, if you're going to call C a "rat's nest of issues"...

Take your degree in Computer Science and shove it

Bush in India on outsourcing:

People do lose jobs as a result of globalization, and it's painful for those who lose jobs," the president said during a "round-table" discussion with students and young business people at the India School of Business, about 800 miles south of New Delhi.

"But the fundamental question is, 'how does a government or society react to that?'" he added. "And it's basically one of two ways. One is to say, losing jobs is painful, therefore, let's throw up protectionist walls. And the other is to say, losing jobs is painful, so let's make sure people are educated so they can find — fill the jobs of the 21st century."

What is he trying to tell us here.. that a BS degree is really not enough education or that programming is not a 21st century job?

March 02, 2006

Protected variables are evil

I cannot come up with a good reason why anyone would need a non-final protected variable in a class. In fact the term "protected" is really a huge misnomer, it should really be called "less-public" or "not-very-protected" , "abomination" or just plain old "evil".

I've been following this rule for years. If a variable is not final then it should be private. If you need to make it accessible to another class and there is no accessor then you're probably not doing something right. Yet I still see even very experienced programmers fall for the fallacy of protected variables. Why? Why? Why?

All that protected variables provide is a lot of really bad design that later lead to sneaky bugs which are hard to figure out and tend to live inside applications for years before someone stumbles into them "oh gee, that one class didn't realize this silly variable had to be initialized". I say down with protected variables, make them go away so they stop taunting the less experienced programmers with the possibility of easy access and magic values.

One would think this doesn't even need to be said.. but apparently that's not true! Speaking of things that shouldn't need to be said, how many java programmers don't realize that protected access works at the package level? I know of at least two that didn't.

February 17, 2006

Java Iterators are useful reason number 4231

Spotting code like this you know immediately it was never tested.

   for (String cur : list)
   {
        if(cur.dislike()) 
        {
           list.remove(cur);
        }
   }

What are the odds anyone ever ran this?

Hint: in the java 5 enhanced for-loop the Iterator is hidden hence cannot call remove on it. Calling remove on a list while it's being iterated over will always cause a ConcurrentModificationException.