March 31, 2004

A new virus?

I have recieved two emails tonight from websites where I have posted comments. Both looked like they were legit emails since they came from people that I have had conversations with. However, I have no idea why either of those people would send me a .pif file. I sent one of the pif's to my linux box and opened it in vi. It had a call to wininet.dll, so I doubt that it had good intentions.

Posted by carl at 10:31 PM

March 25, 2004

SelectDisplay Pattern

Earlier yesterday I remembered a "pattern" that I had found while developing the last web application I worked on. I actually found it in 2002 and implemented a fix, but never really thought much about it. Who knew it was a "pattern"? Yesterday, it all came together and I realised that it was a pattern and that I should quickly "put it out there" for others to find as well.

Last night I put it off until it was to late and ended up deciding to sleep on it. Which was probably a good thing, because I would have been ridiculed by the community (what little of the community that actually knows I exist). This pattern is so obvious that everyone has to have about 30 different ways that it has been implemented.

The first implementation that I came up with used a taglib. How silly am I... because that whole taglib is no longer needed with the advent of EL. Which is the reason why I would have been ridiculed, I was going to tell the world of my fabulous taglib only to realize last night in bed that EL would do the same thing without all of the fuss. So, with that, here is my simple SelectDisplay Pattern.

The Problem:

When displaying results from entering a form, the display values of a select (or drop down list) need to be displayed instead of the value that is stored in the database. Generally, these are foriegn keys to lookup tables that store a key value pair for often used values. States of the United States are an excellent example.

The Solution:

Select all of the rows from the lookup table and store the values in the application context of the web application server as a Map. You only do this once at startup. If the values of the lookup table are dynamic, then you will need to overwrite the cache for that lookup table whenever a save is made. When you need to display the value of the lookup you should use the following EL:

     ${statesOfAmerica[yourForm.stateId]}

The above EL will essentially make this call:

     stateId = ((YourForm) request.getAttribute("yourForm")).getStateId();
     ((Map) pageContext.getServletContext()
               .getAttribute("statesOfAmerica"))
               .get(stateId)

Like I said, not much of a "pattern". The plus side is that you don't have to do joins on your lookup tables in the database. You are allowing the application server to do the joins which isn't neccessarily a bad thing. Also, this is repeatable for any lookup you may have.

The initial implementation used an Iterator over a List. The next version the taglib iterated over the List once and pushed everything into a Map and used the Map for future calls. Both versions were fronted by a taglib. My next implementation will use only EL and will directly load the Map at startup.

Posted by carl at 09:37 AM

March 24, 2004

Sleep, where are you?

Why does this happen to me? I am so tired but I can not sleep. I have to be up in 4 hours and yet here I sit in front of my glowing monitor typing. If there was something productive going on, I would feel much better about it, but alas I am to tired to think about code. Grumble.

Posted by carl at 03:12 AM

March 19, 2004

WMD Intel Highlights

Here are some of the highlights from George Tenet's address on WMD.

Transcript of Tenet address on WMD intelligence from Thursday, February 5,
2004



From the national intelligence estimate of October 2002:



They never said there was an imminent threat.



About Saddam's WMD programs of the 1990's:



...intelligence services of the world had significantly underestimated his
progress.



And finally, we could not forget that Iraq lied repeatedly about its
unconventional weapons.



Intel for today:


Our second stream of information was that the United Nations could not and
Saddam would not account for all the weapons the Iraqis had,



In intercepts of conversations and other transactions, we heard Iraqis seeking
to hide prohibited items, worrying about their cover stories and trying to
procure items Iraq was not permitted to have.



Satellite photos showed a pattern of activity designed to conceal movement of
material from places where chemical weapons had been stored in the past.



Since the war we have found an aggressive Iraqi missile program concealed from
the international community.



We have confirmed that Iraq had new work under way on prohibited
solid-propellant missiles that were also concealed from the United Nations.



My provisional bottom line today: Saddam did not have a nuclear weapon, he still
wanted one, and Iraq intended to reconstitute a nuclear program at some point.
...Iraq intended to develop biological weapons. Clearly, research and
development work was under way that would have permitted a rapid shift to agent
production if seed stocks were available. But we do not yet know if production
took place. And just as clearly, we have not yet found biological weapons.
...Saddam had the intent and capability to quickly convert civilian industry to
chemical weapons production. However, we have not yet found the weapons we
expected.



About what we thought before the war:

...from a source who had direct access to Saddam and his inner circle said Iraq
was not in the possession of a nuclear weapon. However, Iraq was aggressively
and covertly developing such a weapon. ...The same source said that Iraq was
stockpiling chemical weapons and that equipment to produce insecticides under
the oil-for-food program had been diverted to covert chemical weapons
production.



A stream of reporting from a different sensitive source with access to senior
Iraqi officials said he believed production of chemical and biological weapons
was taking place, that biological agents were easy to produce and hide, and that
prohibited chemicals were also being produced at dual-use facilities. ...The
source said that there was an elaborate plan to deceive inspectors and ensure
prohibited items would never be found.



Finally:

So what do I think about all this today? Based on an assessment of the data we
collected over the past 10 years, it would have been difficult for analysts to
come to any different conclusions than the ones reached in October of 2002.



About human intelligence inside of Saddam's regime:

We did not have enough of our own human intelligence. We did not ourselves
penetrate the inner sanctum.



Human intelligence success stories:

A CIA spy led us to Khalid Sheik Mohammed, the mastermind of the September 11th
attacks.



Al Qaeda's operational chief Nashiri, the man who planned and executed the
bombing of the USS Cole, was located and arrested because of our human
reporting.



Human sources were critical to the capture of Hambali, the chief terrorist in
southeast Asia, who organized and killed hundreds of people when they bombed a
nightclub in Bali.



Only through intelligence did we know each of the major programs Libya had
going. Only through intelligence did we know when Libya started its first
nuclear weapons program and then put it on the back burner for years. Only
through intelligence did we know when the nuclear program took off again. We
knew because we had penetrated Libya's foreign supplier network.



And through intelligence last fall, when Libya was to receive a supply of
centrifuge parts, we worked with the foreign partners to locate and stop that
shipment.



And in repeated talks, when CIA officers were the only official Americans in
Libya, we and our British colleagues made clear just how much insight we had
into their weapons of mass destruction and missile programs.



When the Libyans said they would show us their Scud-Bs, we said, "Fine. We want
to examine your longer range Scud-Cs."



It was only when we convinced them that we knew Libya's nuclear program was a
weapons program that they showed us their weapons design.





Last but not least:

One final spy story. Last year in my annual worldwide threat testimony before
Congress in open session, I talked about the emerging threat from private
proliferators, especially nuclear brokers. I was cryptic about this in public,
but I can tell you now that I was talking about A.Q. Khan. His network was
shaving years off the nuclear weapons development timelines of several states,
including Libya.



Now, as you know from the news coming out of Pakistan, Khan and his network have
been dealt a crushing blow and several of his senior officers are in custody.
Malaysian authorities have shut down one of the network's largest plants. His
network is now answering to the world for years of nuclear profiteering.



What did intelligence have to do with this? First, we discovered the extent of
Khan's hidden network. We tagged the proliferators, we detected the networks
stretching across four continents offering its wares to countries like North
Korea and Iran.



Working with our British colleagues, we pieced together the picture of the
network, revealing its subsidiaries, its scientists, its front companies, its
agents, its finances and manufacturing plants on three continents. Our spies
penetrated the network through a series of daring operations over several years.




Through this unrelenting effort, we confirmed the network was delivering such
things as illicit uranium enrichment centrifuges. And as you heard me say in the
Libya case, we stopped deliveries of prohibited material.





 

Posted by carl at 10:25 PM

Bush didn't lie about WMD

Russ thinks President Bush lied about Iraq's WMD capabilities. I would like to say that not only did the President not lie, but he acted correctly on the information that he had. You have to remember that the US doesn't show all of its cards when it comes to what the intelligence services know. And if you think the intel services are anything like what you see on TV, you would be horribly mistaken. They don't always get it right in the end. They don't always have a man inside, which is one of the reasons why the President didn't have all of the information in this case.

One of the things that I have heard is "why are all of the people that are being caught, labeled as master minds?" Well, because they are :-) They are the bosses of the local cell. They planned large scale attacks on innocent targets. They funded the purchase of weapons, lodging, communications and travel of the people that carried out plans.

The President has done the best job he knows how to do. The people that report to him have done the best job they know how to do. The people that report to them have done the best job they know how to do and so on...

Is there some right wing hidden conspiracy going on to <insert favorite conspiracy theory here>? Goodness no. Any time I think I have uncovered a conspiracy at work it has lead to a complete misunderstanding OR a couple of people doing what they thought was right for the greater good... Which is exactly what President Bush was trying to do last year and is trying to do today.

Posted by carl at 10:10 PM

March 18, 2004

From Kablog

I am writing this entry from my Palm Tungsten C using a nifty J2ME app called Kablog. This should be a good way to capture those thoughts in the middle of the day and post them later at night. On the topics of blogs, James Gosling wrote an RSS Feed Reader called JNN. It is a smoking fast Java Swing application. You too can download JNN here.

Posted by carl at 12:41 AM

March 15, 2004

IDE Dilemma

This post, and the one from yesterday should trade titles... but I couldn't come up with a good title yesterday so... The problem with the IDE dilemma is that I haven't written code at home since the mandate was put in place. Using JBuilder has never been fun. I have never enjoyed opening JBuilder. We are still in the process of determining requirements at work, which is always a three month process no matter how small the project. Hopefully, I will start writing code at work and get used to JBuilder so the actual pain will go away. What pisses me off the most is the registration. We do all of our development on a standalone network, so getting the damn thing registered takes half an hour and the involvement of about 3 people.

Why buy something that is easy to set up and use, when we can buy something difficult, expensive and requires training? If you must hire 30 consultants to get something working, then it must a great product. This thought process just makes me want to kick people in the shins.

Posted by carl at 06:36 AM

March 14, 2004

Confusion

I have been struggling with a mandate from work to start using JBuilder X. As all of the readers of this blog know, I am a HUGE IntelliJ IDEA fan. Not to long ago I had a "You will have to pry the ALT+Enter out of my cold dead hands!" attitude, but that has since been replaced by a more "enterprise friendly, thou shalt not break the rules" frame of mind. Today is the last day that my IDEA license for 4.0 will work and today is the day that I will start using JBuilder X exclusively. My coding life sucks as of right now.

Posted by carl at 02:09 PM

March 10, 2004

Hmmmm AOP

News flash!! Pigs Fly!! I thought I would never say this, but I am actually interested in learning more about AOP. I spent the last two days with Crazy Bob, who, as it turns out, isn't all that crazy. He enlightened me to the usefulness of AOP. Actually, let me rephrase that... I have felt that AOP as a strategy seemed pretty good, but I was always concerned with the Byte Code enhancement part of the equation. It goes along the same lines of why I am not a particular fan of Hibernate, there is too much "magic" involved, and was not readily supported in the IDE.

Bob wrote a new AOP framework called DynAOP which does not use byte code enhancement to achieve AOP. This is very exciting because DynAOP enhances Java without having to alter the fundamentals of the language. DynAOP does not require you to a special compiler or a proprietary runtime. Vice using XML for configuration, which can be overly verbose, you use BeanShell to setup the advice, pointcuts, etc...

I am really looking forward to learning more about AOP and more specifically DynAOP. Beware of the pale chubby pigeon... it could be a pig.

Posted by carl at 11:38 PM

March 09, 2004

Software is like a movie

Mike scares me. I had this same thought about six months ago: The software industry should model itself after the movie industry.

I don't think the software industry will move forward until the roles of each player have been clearly defined and stabalized to the point where it is accepted to be the norm to have a "director". We are about to start a new project, I think I will take the following idea to my boss:

Lets give titles to each of the players on the team. The boss will be the producer. He will direct the overall flow of the project. Someone will be the director, he will be in charge of the day to day "movement" of the team. The testers will be the editors, they ensure that the bad parts of the movie.. I mean program... won't make it to the screen. And of course the developers will be the actors.

I always wanted to be in Hollywood :)

Posted by carl at 08:13 AM

March 07, 2004

CSS Goldmine

Erik linked to a CSS goldmine. Here are a couple of the items that I enjoyed.

A very slick rollover technique. It uses a single image and when you mouseover it moves the viewable part of the image. The change is faster than displaying a new image and you don't have as many images that have to be loaded. One trip from server to client is much better than three. Very cool.

Next up we have a sight dedicated to lists. When pictures aren't needed and speed is, then lists can't be beat. Listamatic has a huge list of lists :) Check it out. SimpleBits has a nice example of tabs using CSS and XHTML.

If round corners are you thing, then you should check out Albin's site. Not only are the corners round, but the layout examples are terrific.

All you have ever wanted to know about three column layouts can be found here.

Where did I gather all of this information from? From the best CSS site around: Tao of Mac. Thanks Rui.

Posted by carl at 11:54 PM

March 05, 2004

PLEAC Rocks

Through an odd bit of twists and turns while surfing, I happened upon PLEAC. This site is dedicated to solving the same problems in different languages thus creating a vast online knowledge base for each language represented. PLEAC will be a great resource whenever you want to sit down and learn a new language or you are bumping your head into a problem that you know has already been solved. The site is based off of Tom Christiansen and Nathan Torkington's Perl Cookbook. What a treasure trove this is.

And just for fun, here is a map of the twisty path I took to find this treasure: Dave Johnson's Blog had a link to wikidPad. Curious to see who built such an interesting peice of work, I deleted the wikidPad from the url and ended up at Jason Hormans Blog which then had a blurb from November 2003 about PLEAC. All I can say is, WOW! What luck.

Posted by carl at 01:16 AM

March 04, 2004

Benchmarks for .append()

There was an article in JDJ a couple of months ago that discussed the performance of StringBuffer's .append vs String concatenation. I am here to tell you, that our friend the Java Virtual Machine does some pretty weird optimizations. I would get vastly different results if I rearranged the order of the tests. Here are the four tests that I ran:

  • String str = "<" + i + ">";buffy.append(str);
  • buffy.append("<"+i+">");
  • String str = "" + i;buffy.append("<").append(str).append(">");
  • buffy.append("<").append(i).append(">");

Each line above was surrounded by a for loop with a counter called i and looped through the above lines 1,000,000 times. Each test started out with a brand new StringBuffer that was created before the timer began.

The odd test of the bunch was buffy.append("<"+i+">");. Depending on its placement in the test, it would either be in second place or dead last. His time would get clobbered if he followed buffy.append("<").append(i).append(">"); who always had good times and is by far the best approach to use. Let the StringBuffer do your concatenation and conversion and you will have a winner everytime.

Posted by carl at 06:03 PM

March 02, 2004

OC4J Goodness

Well, I wanted more information about the next Orion release... what I got instead was Oracle's 10g AS release which is J2EE 1.4 compatible. Oracle hasn't released many documents yet, so I will have to just give it a go. This is very exciting. I love Orion, but it doesn't really have the same type of name recognition that Oracle has. I can go into work and hoot and holler about Oracle's app server knowing that much of the server is really Orion. Very exciting news.

Posted by carl at 11:49 PM