Ika's Weblog XML
Architecting the Thought.

After a very painful data-migration process

The blog has moved to a new location: www.freshblurbs.com

Please, kindly update your RSS Reader with the new URL:
http://www.freshblurbs.com/rss.xml

I apologize for the temporary inconvenience but in the long run the new server is going to be much more featue-rich and comfortable, benefiting both me and my kind readers.

11/29/05

Date Ranges Using Joda Time

Date range is a core notion for a wide range of applications. For example, it can represent start day and end day of an event (e.g. JavaOne conference) in terms of a date. Unfortunately, I have seen too many projects where developers "solve" this by introducing two properties (Date startDate, Date endDate) for their classes. That is real bad solution.

Joda-Time is a simplified date API for Java. It is much handier to use Joda-Time than JDK's Calendar. Joda group has just announced that they released Hibernate support, too. That makes Joda useful in practical terms, too, now :)

Yet, Joda's Interval class has the precision of milliseconds. That's not what we mean by a date range. When I say, JavaOne will be held May 16 - 19 2005 it means that the dates are: 20050516:00:00:00:0000 and 20050519:11:59:59:999 in millisecond precision. Joda, has a notion of Partial dates which helps but we still need a helper method:

YearMonthDay startDay = new YearMonthDay(2004, 12, 25);
YearMonthDay endDay = new YearMonthDay(2004, 12, 25); 
Interval dateRange = WhateverHelper.createInterval (startDay, endDay); 

... 

public Interval createInterval ( YearMonthDay startDay, YearMonthDay endDay) {    

    TimeOfDay DAYSTART = new TimeOfDay(00, 00);    
        //- End instance is exclusive in Joda's Interval    
        //- so the interval will be up to 11:59:59:999    
    TimeOfDay DAYEND = new TimeOfDay(12, 00)     

    DateTime startDate = startDay.toDateTime(DAYSTART);    
    DateTime endDate = endDay.toDateTime(DAYEND);     

    return new Interval ( startDate, endDate);

}

Of course, a cleaner way would be to have a DateRange extends Interval with a constructor that has the signature of our helper method, does conversions similiar to what goes into the helper, after which calls super() and otherwise inherits data and behaviour from the Interval class.

Creating such subclass is trivial but then Joda only has Hibernate support for Interval. Since they have value type definition and our modifications are minimal you could persist DateRange using the value type definition for Interval but as Steve Ebersole noted (thanks) you would run into Java casting problems. It'd work on writing to the database (DateRange is castable to Interval) but not in reverse (Interval is not castable to DateRange).

Hopefully, Joda guys will add DateRange support.

posted by irakli, 11:50 | link | comments

11/28/05

Apache.org Is Down

Surprisingly enough apache.org is dead. I would not be surprised, in the least, if it was Sourceforge, because that dude is dead more often than alive, but this is the first time I witnessed the same with Apache, and it sucks.

I am sitting here waiting for the site to come up and thinking how some sites have become integral parts of our lives and yet we do not realize how much we depand on them... until they die. Then we start whining and posting on blogs...

*Sigh*

P.S. Is somebody over there even working on this? Takes a while.

posted by irakli, 07:39 | link | comments

11/25/05

The Beauty of Precision

Check out Ronaldinho video and pay attention to what he is doing with the goal :) Four times in a row.

Ronaldinho rocks :)

posted by irakli, 16:21 | link | comments

11/23/05

To Use or Not To Use "Select * From"

Pizza_milkshake, a PHP/MySQL celebrity from the IRC (where lots of LAMP dudes reside) has posted an article about this subject. This view seems to be growing in popularity since I noticed it referred to several times during my today's visit @ MySQL on Freenode.

Even though it has some valid points, I do not necessarily agree to this oppinion and I definitely do not agree to the assertive tone of the paper. Being spoiled with ORM tools à la Hibernate, I kinda smell that there is more to this discussion than what is covered in the mentioned paper.

Among other things, there are two things that matter in software engineering style: resulting performance and productivity. Yes, you always want your code to be the fastest, most efficient, yadda, yadda, yadda, but you also want your program to be flexible, easy to maintain and you do want to write it as fast as possible and get to more important things in this life :-)

Anyway, to achieve all these good stuff, shorter the code - the better, less code duplication - even better. I am not just whining about the length of explicitely enumerated list of fields. That's a lesser problem. Bigger problem is that you will be using these field names somewhere later. So something is used in several places. See the threat? You change in one place, forget to change in another - oops! On the other side, you could have used a star in one, pretty critical, place and there you go - one less place to worry about.

In addition, remembering that PHP is a dynamic language, one place may be all you need. If you can think it through well, you can write your data objects so that they have the same properties as whatever the table has in the DB and then other objects dynamically find-out about these properties via some mechanism à la Java Reflection (but for PHP) and you end-up with a situation that for a significant number of your objects, the only place you need to define field names - is in the database. Need to add one more field, or remove? Do it in the database and never worry about possible code incosistency.

How is that? Would you use * if it delivered so much productivity/maintainability boost? You should.

I am not saying that all objects should be mapped to a DB like that and completely loaded each time (pizza_milkshake had a valid point that sometimes you do not want to populate recordset with all fields from a table) but there are times when you do want and when it helps. So, it is as much wrong to declare * as evil, as to have a habbit of using it all the time :)

cheers.

posted by irakli, 20:20 | link | comments

11/22/05

Listen To Your Employees - They Are Valuable!

“If you leave us our money, our buildings and our brands, but take away our people, the Company will fail. But if you take away our money, our buildings, and our brands, but leave us our people, we can rebuild the whole thing in a decade.”
 
 -- Richard R. Deupree, Former CEO of Procter & Gamble, 1947

posted by irakli, 11:14 | link | comments

11/17/05

Good Enough Ain't Good

Watch Sun's video parody on Dell servers :)

posted by irakli, 10:43 | link | comments

Google - Content Authoring

It seems, after doing most things possible with content, Google is begining to enter content authoring market, too, with the new initiative: Google Base.

These guys really don't waste their time :)

posted by irakli, 10:09 | link | comments

Huh? 8 Core Ready for Prime Time?

Jonathan Shwartz of Sun claims that Sun's Niagara project will be available Q1, 2006:

"Real soon now (we've said January, but there is that holiday rush to think about), we'll be introducing our new Niagara-based product line. As I discussed a while back, Niagara is our internal code name for a radical shift in computing, and a redesign of SPARC. Niagara systems take the concept of dual core processors (with which most of you are familiar), and goes to an absolute extreme - building 8 cores, each capable of running 4 jobs simultaneously (4 threads), onto a single chip. Doing the math, we'll be delivering a 32-way chip, running 9.6GHz, which sips power (about 70 watts). On performance-per-watt metrics, we believe we'll be a factor of 5 better than what IBM just announced. A factor of 5."

And according to him, it is built for plain, old Solaris, so (we can assume) - no worries to run Java apps on it flawlessly.

Very interesting... Let's see, January is not too far away :)

posted by irakli, 10:01 | link | comments

What Do They Teach in Business Schools?

Aside from the piece of paper and beer-buddies-network, what do B schools give as the return on investment? IMHO, there is no way a B school (any!) can teach a person how to be a good businessman. Just like an art school can teach you something but can never teach you how to be true artist. So, considering there are many other places (less expensive, too) where you can build that "network", what does B school give you?

Probably, knowledge of common "language" as in - set of terms and notions? People who did MBA understand each-other's language. Not that it's going to help them in any way if they do business in a non-American culture (e.g. Saudi Arabia), but, in some common circumstances (western civilization) - it may.

Boils down to the same oooold thing - communication is the key :-)

posted by irakli, 00:20 | link | comments

11/16/05

Advantages of Custom-Built, Open Source Enterprise Portals

David Geer published an article in the Enterprise Open-Source Journal titled Advantages of Custom-Built, Open Source Enterprise Portals. I think it is an interesting article, but you can not trust me since part of it is based on David's interview with me. So, don't trust me and read it :)

EOSJ has some odd publishing format (IMHO) so you may be better off checking out the html version of the article online. All the rights to the article belong to respective parties.

enjoy.

posted by irakli, 15:34 | link | comments

11/14/05

Add Google "Counter" to Your Site

No explanation needed: http://www.google.com/analytics/

posted by irakli, 14:47 | link | comments

11/13/05

TechCrunch

I became a techcrunch.com addict!

posted by irakli, 21:55 | link | comments

Farewell to Peter Drucker

Peter Drucker, widely considered the father of modern management theory died at the age of 95 on Nov 11th. Here is link about his life and work.

http://en.wikipedia.org/wiki/Peter_Drucker

Rest in peace.

posted by irakli, 20:55 | link | comments

You never know...

Following is a joke I heard today. No doubt it's a variation on a very old theme, but still quite funny, IMHO:

A taxi driver picks up a nun and can’t stop staring at her. “I must tell you something, Sister, but I am afraid to offend you,” he says.

“Go on, my dear son, you can’t offend me,” the nun replies. “I've seen and heard a lot in this life.”

“I’ve always fantasized about french-kissing a nun,” the cabbie admitted.

“Well, you have to be single,” the passenger replied, “and Catholic.”

Excited, the guy behind the wheel howled, “Yes, Sister, I’m single, and I’m Catholic too!”

“Okay, then,” the nun murmured. “Pull into the next alley!”

The cabbie complied, and the nun slipped him her tongue. But while pulling out of the alley, he started crying. “You got your kiss,” the nun remarked. “What could be wrong?”

“Forgive me, Sister, for I have sinned,” the taxi driver confessed. “I lied. I’m married, and I’m Jewish.”

“That’s okay,” chuckled the person in the backseat. “My name is Kevin, and I’m on my way to a Halloween party.”

posted by irakli, 16:55 | link | comments

11/08/05

Amazon Mechanical Turk - Web 2.0?

Amazon Mechanical Turk seems a kindof thing that Web 2.0 will, probably, be all about. I admit - I did not get the full essence of the idea. Still seems vague to me. Maybe it's ok - the product is beta, or maybe it's because I had a really long day and it's 11:40pm. Whichever of these two, or even if something entirely different - it does sound interesting.

Curious to see how it develops.

posted by irakli, 22:40 | link | comments

GPL Revisited.

I have seen too many people, on too many occasions confusing what GPL is about. Most common error is to think that one can not use a GPLed product with a commercial application. More sophisticated version of the confusion is some mumbling that involves the word "derivative" :-)

I think the root cause of the error is that 1) GPL License (as any legal document) is obscure 2) GPL FAQ that is intended to remove the obscurity is too long and it is hard to find the important piece within it. But there is a piece that clarifies many things, stating:

Question: I just found out that a company has a copy of a GPL'ed program, and it costs money to get it. Aren't they violating the GPL by not making it available on the Internet?
Answer: No. The GPL does not require anyone to use the Internet for distribution. It also does not require anyone in particular to redistribute the program. And (outside of one special case), even if someone does decide to redistribute the program sometimes, the GPL doesn't say he has to distribute a copy to you in particular, or any other person in particular.

What the GPL requires is that he must have the freedom to distribute a copy to you if he wishes to. Once the copyright holder does distribute a copy program to someone, that someone can then redistribute the program to you, or to anyone else, as he sees fit.

What does this mean? GPL does not prohibit you to use your software, of any license kind, with GPLed ones. Constraints only arise when you decide to ship your software to third parties (which, if you are developing a web application for own usage may never happen). GPL does not require you to publish your code that you use with a GPLed software, but it prevents you from denying others the right for redistribution once you give them your code.

Bottomline: GPL prohibits you from prohibiting others, does not require you to do anything in your own world.

posted by irakli, 15:31 | link | comments

11/06/05

Komodo 3.5 Is Shipping Now

BusinessWire reports that ActiveState shipped Komodo 3.5 probably the best IDE for scripting languages and a multi-platform one, in addition.

I was writing about Komodo in one of my recent blogs. ActiveState has decided to include the quote in their press-release on BusinessWire. I am glad to see it and wholeheartedly wish them the best of luck with their great product.

posted by irakli, 12:14 | link | comments

11/05/05

Count Words and Characters on Mac

Paul Gorman has written a small tool (NanoCount) that I found very nifty. It's as simple as it gets: shows a running word count. It also lets you set a goal for number of words,

posted by irakli, 08:54 | link | comments

11/03/05

Nifty Java Developer Toolset

Recently, I stumbled upon http://www.shiftone.org/ They have got some REAL nice toys in their toolbox, I must say. I was impressed. Actually, except ExQ I quite loved all of them. I don't see the value of ExQ since I am a big believer in Hibernate but if you are still in the age of raw SQL - maybe you will find ExQ useful, too.

But other projects are real, real cool. I have been looking for an OOC JNDI for a while, now. Arbor XML Processor is nice, too. I've begun using JRat and find it very useful for JDK1.4 projects because of its significantly low overhead (as opposed to OptimizeIt, JProbe et al). I will definitely look into joCache. Just by description it looks like it could be JBossCache done right :-)

All of the products are very user-friendly and comfy to use.

Two thumbs up to ShiftOne!

posted by irakli, 15:33 | link | comments


Copyright (C). Irakli Nadareishvili. Picktek Ltd.