" /> kasia in a nutshell: January 2003 Archives

« December 2002 | Main | February 2003 »

January 31, 2003

From the 'really bad code' collection..

I should start one.. really.

Today's gem:

public class Stupid { 

   private int _value = 0;

   public void setValue(int value) {
      if (value == _value) {
         _value = value;
      }
   }
}

Duh..huh.. huh.. why are we always seeing the same value?

January 29, 2003

JavaBlog noise

I really like the concept behind JavaBlogs... and for a while it really worked well for me. I've read many excellent entries on Java I may have (actually very likely would have) missed otherwise. Unfortunately, as is true with any growing website, the signal to noise ratio is becoming worse and worse.. and not in a good way.

When I first discovered JavaBlogs I read nearly every entry posted and most were great.. agreed with some, disagreed with others.. typical blog-reading experience. These days I find myself skipping more and more entries.. why? They're not about Java.. and many of the ones that are simply reiterate or link to previously posted entries.

I realize it's nearly impossible to run a site like this without some noise, but perhaps the idea of human-driven moderation system isn't a bad one for this particular application?

Of course, this brings up many, many issues.. main one:
- who determines what is acceptable and why are they qualified to do so..

I don't really have answer to that. My two experiences with human-driven moderation systems are dslreports.com and slashdot. The karma-like system on slashdot is obviously failing -- who reads the comments there anymore? The dslreports system is working quite well, I think -- but not sure this is a valid comparison, different type of website.

Is it necessarily a bad thing that a website about Java is listing entries that are not on-topic? Probably not for everyone. It may give some a better feeling of community.. but I already have that elsewhere.. I'd like Java please.

The obvious thing to point out here, of course, I'm posting this in my java-category and it will get posted on JavaBlogs. Guilty myself.

January 28, 2003

Cheap advertising!

Mere $20 not bad.. As I told Scott I spend more money on less amusing things on daily basis.

Here's hoping Chris gets some decent sashimi with the proceeds! God knows you can't get that in CT (decent sashimi that is.. I think you can get plenty of geeky chests here).

I do have a local copy...

Yikes

Reading old newspaper ads can be a traumatizing experience.
Check out this lysol ad.

Nevermind what a bad idea a douche is.. but with *lysol* ?? For marital bliss??

- kasia, who is now curled up in a fetal position.. twitching.

Easy error to miss

Spent some time today debugging an issue that turned out to be a very simple error which could be easily avoided.

Can you spot the bug in this code?

public class Buggy {

   private String value = null;
   
   public Buggy(String value) {
      value = value;
   }
  
   public String getValue() {
      String rval = value;
      return rval;
   }

}

When getValue() is called it returns a null object.. why?

value = value;

Should be:

this.value = value;

Easy to miss.. pain to debug.

Better yet.. Instead of using this.whatever just name the variables differently.. it makes for easier to read, less confusing code.


January 26, 2003

Geek studs

swoon.

Lifetime of learning

Dave - "Smokers Only":

You learn things in your late 20s that you can't imagine in your early 20s. And the early 30s have their lessons, as do the mid 30s and the late 30s (oh boy!) and then the early 40s. And some of the learning is pegged to other people's experiences. Like when one of your parents dies. Or a child goes to college. Or things out of your control (bypass surgery).

Eh, what does an old fart like that know anyway..

January 25, 2003

Good design and XP

Krzysztof Kowalczyk:

I've been thinking lately about good software design. It occurred to me that good design might contradict one of the XP principles: do the simplest thing possible. The problem is that good design is rarely the simplest thing that will work.

I disagree. More often than not (at least in Java, at least in my experience) the simple design is the better one. If you leave room for versatility and growth.. it benefits you more to have a simple design rather than a complex one.

I can think of countless times when I scrapped a complex code structure to replace it with something much more simple.. but much, much better. The problem is that simple and good isn't easy...

January 24, 2003

Maybe a bit too much..

Sure, Mark is great.. but there's only so much I want to dive into..

. . Porn! Full frontal nudity, baby. Need I say more? New pictures daily! . .

Can I pay $40 a year to assure this won't happen? Please? $80? I'll give up my laptop! Final offer!

Monterey

Most of these are horrible.. I had my camera set all wrong, so don't expect much in the terms of quality.

Jeremy has much better ones from the same trip.

January 23, 2003

Pictures from California

The weather was foggy and gloomy most of the time so I didn't have many chances for pictures.. I did take some in Monterey and such -- just need to go through them, organize, sort, find ones suitable to be shown publically and then I'll post them.

In the meantime, here's one.. looks like Jeremy needs a hug.

Entry from a plane

Where am I? Saturday Jan 18 2003 12-ish (eastern time) somewhere above upstate New York

There are very few people who can seriously enjoy being in Connecticut when it's not the pretty foliage season. It's not the foliage season - it's January -- which in our teeny state translates to cold, bitter, bone-chilling, tooth-cracking cold.

My flight this morning was scheduled to depart at 6:01am[0], so like a good little citizen of post-nine-eleven[1] America I arrived at the airport a full hour before scheduled take off. I assumed that since it's such an early flight on a Saturday the airport would be near empty. Wrong assumption. Thankfully I was pulled out of the ticketing line[2] so I could get through security in time to board my flight. Survived security - for once no personal searches[3] and the only inconvenience was taking out my laptop. Fine, no problem, I can live with that.

Let me summarize before I go on. This means I dragged myself out of my warm, fuzzy, cat-covered bed at an ungodly hour of 3:45am. Took a shower, dressed, put on makeup[4] and drove to the airport to make this six am flight. Excuse me, six-oh-one am flight.

Flight boarded as scheduled and I became the proud occupant of my favorite airplane seat - by the window. As plane taxied to the runway I prepared myself for the inevitable attack of nausea that usually accompanies take-offs and landings, well, at least for me it's usual. Engines whined, plane sped up.. and.. that's it. Stopped, turned around, back to sitting by the runway.

No, not on the runway -- by the runway.

The captain spoke: Some teeny sensor malfunction, they'll find out if we even have to go back to the gate for this and we'll be off.. Ten minutes tops!

Okay, that's not so bad, I have an hour to catch my connecting flight to San Jose, so ten minutes is not a problem. That's what I thought at the time anyway, unfortunately, ten minutes does indeed become a problem when it multiplies, strains and takes on a life of its own.

Ten minutes later:

Captain speaks: "Okie dokie, folks, we will just taxi back to the gate and replace that funky censor. That'll be just ten more minutes."

Two times ten minutes later:

Captain's voice: "Sorry folks, that didn't work, we now need to do some more maintenance, it'll be another ten minutes"

Three times ten minutes later, we now have our own little ten-minute family:

Captain booms: "Oops, heh-heh, well that didn't work either, it'll just be another ten minutes".

See the pattern yet? We're now up to four sets of ten minutes each.

Captain whines: "Well, gee, folks, don't know how to tell you this, but it'll be just a few more minutes".

Aha! Must have ran out of ten minute units we're down to the ambiguous 'few' unit[5].

Two hours later:

Captain pleads: "Oh, well, heh-heh, hm, yes, well, we'll be now asking you to depart the airplane as we try to fix this pesky little problem. This is for your convenience folks, so you can get yourself some breakfast".

He obviously never spent much time at the Bradley International Airport near Hartford Connecticut concourse B. There is one place you can buy food here.. and I use the term 'food' very loosely. Greasy hot dogs, foil-wrapped ancient muffins and lousy coffee. I settled for a cup of coffee.

At this point I realized I would miss my connecting flight[6] and made arrangements for a different one.

Summary: I have lousy coffee, a boarding pass for a flight several hours away out of Chicago to which I'm not sure when I'll get and I'm stuck at BDL in CT.


This is where I get to my point (I did open whining about Connecticut). There are many airports in this great country of ours in which one can be stuck for hours and happily spend the time shopping, eating, drinking and being merry. Bradley[7] is not one of them. The only vaguely entertaining thing to do here is watch other travelers' frustration with being delayed, missing connections and overall inconvenience. Spending four hours at this particular airport is truly cruel and unusual punishment. I've been to school detention[8] that was more fun and entertaining than this. There was the possibility that the plane has actually crashed and I went to hell.. but I dismissed that idea when I realized my cell phone still worked. If it was hell I wouldn't have digital service.

So as I sit here on the next flight out of Hartford to Chicago (11:37) I can't help but wonder just how many ten minute increments were produced between 6am and now? Yes, yes, easy mathematical equation but this was meant to be something more philosophical than that. At some point the ten minute increments which appear so short and easy take on a life of their own and become hours.. long, boring, horrible hours. I could probably come up with something more deep and thoughtful than that if it wasn't for the horrible noise coming from the engines - my near neighbors - in my aisle seat in the back of an overcrowded MD-80.

Maybe I was wrong.. maybe this is hell after all..


[edit: at the time I was writing this I have yet to find out my new connecting flight had a 2 hour delay.. how's that for a lousy day?]


[0] - can anyone explain to me why would a flight be scheduled for a minute after an hour? Why not 2 minutes? 30 seconds?

[1] - Isn't it frightening that this has become a word?

[2] - What is the point of buying electronic tickets if you still have to stand in line with all the un-ticketed passengers to get your concourse-door-opening boarding pass? Sure, it saves paper. Ok.

[3] - I knew wearing a baggy sweater over my clothes would help with that one *snicker*

[4] - To cover-up those lovely dark circles under my eyes from getting an unhealthy doze of merely three hours of sleep third night in a row. Did I mention I have problems sleeping on airplanes?

[5] - Every time I type 'unit' it comes out as 'unix' and I have to fix it.. even did it for this footnote!

[6] - Unless I can get to Chicago in an hour.. I drive fast, but not *that* fast!

[7] - Bradley International Airport near Hartford, Connecticut -- didn't I cover this part already?

[8] - It's been a while, but I still vividly remember sitting in a classroom full of bored students attempting to do homework. It's boring.


Back!

I'm back in Connecticut and freezing my behind off in the lovely cold spell we've been having. Sixty degree difference from one day to the other and off by three hours.. ah, the magic of flying accross a continent.

I wrote a couple of entries on the plane (one on the way there the other on the way back) and will be posting them as soon as I find my bloody pcmcia network card.. It's *somewhere* in my suitcase I just can't remember where. Probably snuggly nested among my dirty laundry.

I miss California already.. *sniff*

January 17, 2003

Super busy and away

I've been super-uber busy with work and other work.. and tomorrow I'm flying to California -- back Thursday morning.

In the meantime I'm about a week behind on personal email (I owe several people replies - so sorry).

Probably won't be blogging much in the upcoming few days.

January 14, 2003

A sane opinion on the vi-emacs front

Jason:


For quick changes, or making the same changes to a handful of files and I don't have Emacs up and running, vi is the weapon of choice. vi also seems to be good at very large files.

For long coding sessions where I am in the compile/edit/debug cycle, I prefer Emacs. What do you prefer?

The exact same thing! I do a fair amount of system adminstration (most of it outside of my day job) and emacs just seems horribly silly to load for a script edit. However, for my daily hours of Java programming (as in my day job) vi would never do.. if nothing else (oh, believe me there are plenty of reasons) one cannot write JDE extensions for vi!

Searchable Java docs

I am so behind times on documentation that it's not even funny. Recently I found out that javadoc in SDK 1.4 finally has a recursive option and today I found out that there do exist searchable Java docs. I'll probably still just grep through my local copy though :)

Thanks to Damon who posted this information in Jeremy's rant about the lack of searchable Java docs.

January 13, 2003

California -- next week

I'm flying to Northern California on Saturday (6am flight, yikes) and coming back Wednesday night. I may have an hour or two of time I have nothing scheduled for (yet) so anyone wanting to say hello, drop me a note and I'll see what I can do. Of course if you're a stalker, insane or otherwise dangerous -- please don't bother. I'm flexible on the insane part.

During my stay I'll be staying in lovely Palo Alto and probably using my laptop so much it will feel just like home. But warmer. And no snow.

The only dilemma I have is my luggage. My suitcase has a built-in combination lock (my carry-on suitcase is too small for four days -- really) and I'm afraid someone will spin the teeny wheels, lock it and then after they mark my curling iron as a potential bomb it will be destroyed for a search.. after that of course the entire contents of the suitcase (with my luck it will be on the return trip and will include dirty underwear) will be spilled all over the baggage area conveyor belt for all to admire. I think I'll put tape over the teeny wheels.. or write the combination on the suitcase.. right next to "Please, help yourself to anything inside".

I hate flying.

My domain renewal

As usual, I missed the renewal date on one of the domains I own (it expired the 7th) and some good soul renewed it for me.. but nobody I know has owned up to it so far.

So, whoever the nice person is, thank you!

January 11, 2003

Girl programmers

Interesting rant.

Hm, well, I'm not nearly as cool, my taste in clothes sucks and I spend my life in front of the computer wearing hole-covered jeans, but I do have to agree on one point. Indeed the best guys I've ever dated were programmers and others assorted computer geeks. I discriminate against windows users though.. we just don't speak the same language.

hmmm

What is the purpose of this site?

January 10, 2003

More Java pointers

To go with my previous entery about pointers "The Fishbowl" has his/hers own entry on the same topic.. both inspired by Jeremy's adventures with Java.

The part I really want to reference is this section:

  1. Before you start writing a method, decide whether it will ever return null. Document this decision in the @return section of the method's Javadoc.
  2. Never have a method return null unless there's a really good reason for it.
  3. If your method returns an array or a collection, there's no reason to ever return null. Return an empty array or collection instead.
  4. If you have a situation where null is a valid value for a variable, you can make use of the Introduce Null Object refactoring, to make the behaviour explicit.

That's very good advice.

Javablogs.com

I really like the idea, unfortunately I don't write enough about Java to add my blog as is... so I created rss feeds for each of my categories and added just the Java one.

This should work fine.. they will only index my Java-related entries and none of the other noise I spit out daily.

Now if I could just get that smaller gif to look better..

January 09, 2003

No pointers in Java?

Jeremy discovered the ever popular, friendly and loveable NullPointerException. Hey, now you can call yourself a Java programmer! (Okay, so it doesn't take much).

It's a common misconception that Java has no pointers. It's not exactly true. Java has pointers, they're just not explicit. Every object is a reference to a location making it a pointer... you just can't manipulate the pointers directly.

Which approach is better.. explicit or not? Well, that very much depends on the context and scope of the application. I'm sure everyone who ever went through learning C will however agree that non-explicit pointers are sure as hell easier to comprehend for someone who is just learning programming.

Here's why it's a pointer.. say you have two Strings s and t

String s = "hi"; String t = "hello";

These are two separate objects in two different locations.

t = s;

Now t and s both reference the same location hence referencing the same object. That is a behavior of a pointer. Now for the purists (hi Steve) that will argue that this is still not a pointer.. oh well.. it's all based on how you define it.

January 08, 2003

Guide to cultivating a hacker in the workplace

The hacker FAQ

The following list is an attempt to cover some of the issues that will invariably come up when people without previous experience of the hacker community try to hire a hacker. The author is seebs@plethora.net.

January 07, 2003

Why chaining calls is sometimes bad

There is a reason I really do not like chaining calls together when writing Java code. Here's why.

This statement:

object.setValue(rs.getString("value"), otherObject.geCode());


Becomes this nightmare when trying to step into the setValue method:

step Step completed: thread="ExecuteThread: '494' for queue: 'default'", weblogic.jdbc.pool.ResultSet.getString(), line=267, bci=0

step up
Step completed: thread="ExecuteThread: '494' for queue: 'default'", weblogic.jdbc.pool.ResultSet.getString(), line=269, bci=24

step
Step completed: thread="ExecuteThread: '494' for queue: 'default'", class.method(), line=561, bci=366

step
Step completed: thread="ExecuteThread: '494' for queue: 'default'", otherClass.getCode(), line=316, bci=0

step up
Step completed: thread="ExecuteThread: '494' for queue: 'default'", class.method(), line=561, bci=373

step
Step completed: thread="ExecuteThread: '494' for queue: 'default'", class.setValue(), line=782, bci=0

If the code was written this way:



String value = rs.getString("value");
String code = otherObject.getCode();
object.setValue(value, code);


The debugging process would have consisted of:

step Step completed: thread="ExecuteThread: '494' for queue: 'default'", class.setValue(), line=782, bci=0


That saves quite a few steps, typing and aggrevatioin time during debugging. Chaining is sometimes appropriate, often not... while this example may seem innocuous (it wasn't, but I can't publish code from work!) it illustrates just why chaining may become a pain really quickly when debugging.

January 06, 2003

Narcisistic endeavours

Jeremy is now ranking pretty nicely for open source blog.. this link should help him :)

I don't even rank.. but that's only fair considering I hardly ever write about open source.

Openssl

I don't normally run mod_ssl so didn't pay attention.. but if you're running it (and RedHat gives you mod_ssl by default, yucky yuck) and have openssl v 0.9.6c or lower.. you're vulnerable to .cinic worm. So go patch up.
May I just add.. RedHat is a pain to patch if you don't use an rpm..

January 05, 2003

Child

Warning: Rant ahead

It's a term I hear (I suppose technically, read) in discussions quite often. "Life is too short, child", "Don't worry about it, child".. ad nauseum..

It's patronizing, infuriating and unfortunately used quite too often. I wonder if this has anything to do with my gender.. are men ever referred to as 'children' in discussions?

The worst part is.. half the time the person using the term does not mean it in the way it comes across -- equal to a pat on a head and a lollipop in an outstretched hand.

I'm nearly thirty years old (eight months away, to be accurate) and I am not a child. I agree, I may act like one now and then and I may even sound like one occasionally but unless you happen to be a 54 year old Polish woman with facial features strikingly like my own, please do not call me that.

January 04, 2003

How to write like a wanker

A practical guide:

A real wanker considers his time infinitely more valuable than his reader's. (You are a real wanker, aren't you?) Accordingly, don't hesitate to conserve keystrokes. Address your reader as 'u'; 'you' is time-consuming and obsolete. Never 'see' something if you can 'c' it instead. Refer to groups as 'ppl' rather than 'people'. Don't put a task off until 'later', do it 'l8r'. Tell your critics to 'stfu' instead of asking them to 'shut the fuck up'. If your reader has the time to actually read the drivel you post, they surely have the time to decode your dribbling shorthand.

Good one.. [via: Mark]

January 03, 2003

The life of a cat owner

How am I supposed to get work done? She does this all the time!

Cell phone reboot

I had to reboot my cell phone today. It sounds funny, but honestly, it's not. It's a brand new phone and I spent several hours inputing all my telephone numbers into it -- I really don't want to have to get a new one.

It was happily charging itself.. then I noticed the battery meter was not changing.. so I unplugged it.. it continued to show the little blinking battery light as if it was still charging.. Opened it (it's a flip phone - Motorola T720) -- the pretty blue light didn't come on and no display.. *sniff*.

Pressing buttons didn't help.. power button non-responsive.. time for a reboot.

Battery out, battery in, turned on okay. Here's hoping this isn't a symptom of something breaking.

*fingers crossed*

Broadband?

It's 2003, high speed Internet access has been around and available to many of us for over four years now. In computer years - that's a lifetime.

What has changed in those years?

In 1999 Slashdot was just a wee website where geeks liked to exchange news that interested them - not the mecca of geekdom capable of nearly DOSing a site by simply linking to it that it is today. DSLReports was a small site Justin ran on his home DSL connection, not the powerhouse of broadband information it is today. In 1999 DSL was new, mythical technology capable of delivering high speed Internet access into our homes at affordable prices. Those were the days when paying $300 a month for an ISDN line seemed like a good deal.

What about today?

In a new poll on dslreports nearly 60% of voters admit to being a former customer of a failed broadband provider. (Poll is in progress, numbers can shift). Even with new technology -- that is a pretty high failure rate.

It's pretty obvious something isn't right.. for four years we've been paying under $50 a month for broadband.. but broadband is failing. People (me included) are complaining about increasing broadband costs.. and they have increased. Gone are the days of $30 a month cable connection and $40 a month DSL line. Providers are capping download speeds, limiting monthly bandwidth allowances and disallowing VPN access on residential accounts... and the prices are still rising.

Is the cost really rising though? Maybe we were just spoiled by years of artificially low costs.. and now they're stabilizing. In 1998 I would have gladly paid $100 a month for a 128K ISDN line.. why am I complaining about a $60 a month 1.8KB line in 2003?

In Asian countries (Japan, Korea) broadband pricess are significantly lower than US.. and falling. I wonder, though, if this is only because of the obvious territorial differences (smaller countries, denser population, cheaper to connect) or if they are just starting to go through the artificially lowered costs we're now leaving.

I wonder how this will all look in 2004.

January 02, 2003

Geeky date

No, not that kind of date.. Really. Just wanted to make a post at 1/2/3.

Yah, I missed the time and edited it in movable type.. so sue me.

January 01, 2003

Idea

Someone really should start a website containing locations of coffee shops with wireless internet access. Should be able to locate them by zip code, street address, state.. etc. with maps would be helpful.

Unless someone already made one of those and my google searching skills really stink.

Happy new year

Just got home in one piece and I thought it's appropriate to celebrate that..
Happy New Year. Really, it is.. *hic* (no, I did not drive)

SNET is no longer blacklisted, thank you Derek and Brandon from SNET for resolving this issue.