Wednesday, April 9, 2008

Eclipse for Spring



I've been trying to decide which IDE is better for spring framework related development. After a brief study I decided to go with Eclipse. Because it's light weight, feature rich and easy to use.
So if you are new to eclipse and want to download and install it to be used as a development environment for your project(with spring support). Here is what you got to do.... Get Eclise IDE for Java EE Developers from http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/europa/winter/eclipse-jee-europa-winter-win32.zip

Then follow the install guide for spring ide from here.
http://springide.org/project/wiki/SpringideInstall

Converting javascript string to int

Well it seems sometimes good to know all the basics before you go and do something. But most of the time people won't understand the basics until they come across a problem because of not knowing the basics. I'm these days working on a code base, where original developer no longer available. Time to time I get funny error. Yesterday when we checked interfaces after sometimes, I noticed that date is in correct. Actually it showed 1st of April! It worked fine last month!
So had to dig down to the code base and start debugging. Finally I figured out that it was a error due to Javascript string to int conversion. Consider these examples.
  1. parseInt('08',10)  // 8
  2. parseInt('8',8)    // 0 
  3. parseInt('08')     // 0
In our case, developer had used 3rd method where as he should have used first! Below is a total list of examples extracted from http://www.kourbatov.com/faq/convert2.htm

  1. parseInt('123.45')  // 123
  2. parseInt('77')      // 77
  3. parseInt('077',10)  // 77
  4. parseInt('77',8)    // 63  (= 7 + 7*8)
  5. parseInt('077')     // 63  (= 7 + 7*8)
  6. parseInt('77',16)   // 119 (= 7 + 7*16)
  7. parseInt('0x77')    // 119 (= 7 + 7*16)
  8. parseInt('099')     // 0 (9 is not an octal digit)
  9. parseInt('99',8)    // 0 or NaN, depending on the platform
  10. parseInt('0.1e6')   // 0
  11. parseInt('ZZ',36)   // 1295 (= 35 + 35*36)

Thursday, April 3, 2008

Do not do this with SVN!!

I had same copy of code at 2 locations in svn. I checked out one version(say A) and edited. And wanted to put the same copy to the other version(say B). So I checked out from B to another location and copied the working copy from A to B. And i started working on B. I committed... checked out.... no problems were detected until I checked out the code for a deployment from svn version of B. It was not update!!!
Guess what? As I copied version working copy of A to B. All the svn files came with A.
So I've been working inside a B svn copy but actually committing them to svn copy of A.

So if you ever wanted to update one svn copy to match another. Use export to export latest code and then copy them back to not up to date svn checkout!!!

Awk

Awk is a great tool if you are into shell scripts! If you are interested here are some links that might help you get started
http://www.vectorsite.net/tsawk_1.html#m2
http://www.uga.edu/~ucns/wsg/unix/awk/

Shell script problem

I wanted to split a string in shell array of the from 2008032800 to something like 2008 03 28 00. But as it seems this is extremely difficult to do using shell scripts! I tried in vain using grep and cut :'(
This is as close as I got
echo "2008032800" | grep "^.\{2\}"

Interestingly grep when match a part of a string, it continues to rip it off from the original text and remaining part is used again to match the regex! I wonder whether that is the correct thing to do!

Wednesday, April 2, 2008

All about laptop batteries...

Laptop batteries can create nice little headaches if we don't really pay attention to how they react to some of the things we do. For example you might think that charging battery full and then allowing it to discharge operating from battery alone once in a while, has nothing to do with life time of the battery. Believe it or not it's true. Actually it's being said that, doing so twice a month is required for battery. Also NEVER allow your Li/Ion battery to be at 100% charged and A/C plugged on (still charging..) . I'll tell you from the experience it'll cost you more than you expected if you do so.
So in a nutshell this is what you need to do to maximum your battery life...
1. Charge battery to 96-98% then disconnect a/c adapter and allow it to discharge maximum possible (3-5%) then charge again!
2. Make sure you charge 100% and discharge to 0% once in a month
3. Don't expose batteries to heat! it reduce battery life time.
4. If you are not using battery for long period (like weeks) remove your battery from laptop and keep it separate.
5. Do not ever discharge a battery using a method other than using laptop!

That is all about batteries that I got to know last few weeks! Hope this will help you to get the maximum out of your laptop battery. Finally if your battery is good as dead and can't find a cheap replacement look at ebay! I will give you more information on finding a replacement battery soon!

Evolution for Windows Users

As predicted by Gav, Evolution + Lighting is problematic. For example I can view the calendar objects sent via Outlook, but can't accept them.... So here I have found a windows version of the Evolution... hope it's useful for those who need a free mail client for windows

http://sourceforge.net/project/showfiles.php?group_id=159440&package_id=194380&release_id=492523

Getting calendar support for thunderbird


I've been receiving so many calendar objects from Outlook people recently and unfortunately I was not able to read any of them as it seems total junk in my Thunderbird client. So today I decided something had to be done about this. After few seconds of Googling I found a nice extension called "Mozilla Lightning" to get the job done. If you have the same problem here is the link to the solution
https://addons.mozilla.org/en-US/thunderbird/addon/2313

Tuesday, April 1, 2008

Wow it's tech time

Finally I've decided to talk abt the technical matters that I encounter every day and how I got them solved through a blog. Since my personal blog http://dilanspersonalblog.blogspot.com doesn't allow the tech stuff as it's personal, this will be my new home for technical discussions. Also all of you are welcomed to make any comments regarding the posts. See ya soon with the first technical post.......... :)