Another thing I never thought off

A while ago a made a post on web standards saving money (ie for google). Today I was listening to another podcast, they had an interview with Chris Dibona He works over at google. He was talking about how google has its own team of kernel hackers. He explained how some small improvements in the linux kernel of this team could save google millions of dollars.
My first reaction was offcourse, your site will run faster you need a couple of computers less and that’s where your savings come from. Well he explained it somewhat different. Let’s say you have 100.000 computers (prolly google has much much more), your computers will stay a little bit cooler maybe even consume less power. So your airco could run a little bit slower. So a code optimization could result in a cut back in power usage. You would maybe even save some trees!

It shows how in each and every sector of the it you have to worry about different things. I have to admit, when I’m doing java development and I’m not sure if I should choose an int or a long, I’ll be choosing a long because memory is no problem for us and it’s only running on 2 or 3 severs. These guys will check,recheck and then check again if they instead of the int maybe even could use a smaller datatype.

Xsd nillable

In one of my current projects we are sending data to another company. Because xml is somewhat the standard for exchanging data these days I wrote a small java app using velocity to generate the xml files. Sure I could have used Oracle’s features to create an xml file but if you use that feature you could just as well give them an ASCII file imho.

So I started by creating the xml schema (xsd). Because some fields can be empty I some nullable fields. And that’s where the issues started. We have some dateTime fields that can be null so I thought spitting out a <date /> tag or <date></date> would do the trick!!! Biep error, after some googling and reading a lot I came to the conclussion that I had to output this : <date xsi:nil=”true”/> . Stupid if you ask me, but hey it now works.

I wrote a small velocity macro that I called:

#macro( xmlempty $value $tag $cdata)
#if ($!value == "" || !$value)
< $tag xsi:nil="true"/>
#elseif ($cdata == "true")
< $tag>< ![CDATA[$!value]]>
< $tag>$!value

Works nice I have to say. The program was straight forward, a file that contains key value pairs. The key was the velocity template, the value was the query. I ran the query, retrieved the ResultSet cursor and while iterating it for every iteration I called upon the template that merged with my UTF-8 filewriter.

What kinde surprised me was the lack of good xsd/xml editors in the opensource. I tried the ones that were bundled with our myeclipse environment but they were more a pain than a gain. (omg lame!) So in the end I installed xmlspy and asked for a testing license. I have to say they have a really good product, but who wants to pay 600 รขโ€šยฌ for an xml editor. People come on, even ms visual studio .net 2005 pro only costs 750. They also have xml support built in, for that I’m willing to pay because of the added value but not for an xml editor. There are only a couple of things I need from an xml editor.

  • xsd code completion
  • Is my xsd valid
  • Why not, with linenumber error
  • Xml code completion using the provided xsd
  • Is my xml valid
  • Why not, with linenumber error
  • Maybe an xpath,xquery and xsl features

That should be sufficient. Hmm looks like a project for the future ๐Ÿ™‚

Python Commandline

Mostly when I code, I use java,c# or sometimes php. But now and then I use python. Today I wanted to download some podcasts that I hadn’t listen to in a while. (Read the other posts to know why) So I wanted to do a bulk download, the mp3z were named like and I wanted to download up to 30 or so.
I gave the pyhton commandline an go (been a while). How could I forget such a nice feature.

for x range(20):
	print "xxx0"+str(i+x)+".mp3"

copy paste it into a textfile and wget -i thefile.txt

Sweet issues

Yesterday I was building a small webapplication for a client. The user had to enter a code to retrieve some data. So I added a Label, a TextBox and a Button. I wrote my code tested it and it worked. I wanted to show it to the customer and suddenly it didn’t work??
Hmmm strange, I tried it a couple of times, still the same. Then I did it step by step. I filled in the code, pressed the button and voila there was the desired effect?
What was the problem? Well it seems that in the internet explorer version I had, when I filled the TextBox and pressed the enter button instead of clicking on the mouse button, the event of the login button pressed didn’t get fired. Firefox on the other hand tends to do press the submit button if you do the same actions. So you are on a textfield, enter some data and then hit the enter button. It will press the real form button, if there are more than one (like you have in appz) you have to take notice that the right ones backend action gets submit.
How did I fixed this, simple just hooked op the OnTextChange event with the same EventHandler of the ButtonPressed.
So if you do dev, please do check your browsers and don’t only trust the debugging sessions with your iexploder.

Also if haven’t heared about it yet, you should really checkout the firebug beta plugin for firefox (It wasn’t available on my ubuntu using apt-get, so you should install it from the xpi!)

a downside of offshoaring I never thought off

First off sorry if the title has spelling errors, English is not my mother tongue ๐Ÿ™‚

I’ve got my new car radio installed and I can again listen to my precious podcasts. I can even connect a usb stick with podcasts on it \o/.
Yesterday I was listen to a binrev show. They were discussing security aspects and offshoaring. They were talking about an offshoaring to china that wen’t horribly wrong. A well known US car builder wanted to offshoar the assembly line to China. They contacted a Chinese company to handle this. They sent all the data for building the shops. The chinese company took the data and created there own assembly line and started producing their own cars, they were almost an exact copy of the cars they were building in the US, because the didn’t have to do any research they had cut a lot of costs. Combine that fact with the low wages and you can imagine why the car was incredibly cheap.
They tried to sue the Chinese company but the (Chinese) judge ruled in favor of the Chinese company (what would you expect).

Maybe call me narrowminded, but I see this as another good reason not to do offshoaring (or do it,but don’t move everything). If I’m not mistaken more and more companies are offshoaring their it development to other countries. I’ve got no problem with that, but if you do, make sure that you know what you are doing. If you offshoar everything those companies know exactly how your company works. If they manage your email systems, I bet they have almost enough data to create an exact copy of your local company and produce all the products you produce. They didn’t even have to do any research. Ok, if they did it theirselves you would know. But what if one of their employees has a usb stick of 10 gig and they take the data and sell it to a small competitor over there. You can be sure that some big supermarket in the western world will notice and start importing it.

I haven’t noticed the offshoaring of IT development that much. But I know some companies are doing it, offcourse it’s cheaper. But did they ever think about what impact this could have? Just imagine that google had offshoared the actual writting of their search engine to a Chinese company? Would they still be in the position they are in at the moment? I really doubt it!

In short, think before you do something (as always)