Pages

Showing posts with label tech_rant. Show all posts
Showing posts with label tech_rant. Show all posts

Monday, July 11, 2011

Cleaning up my GMail Account

Once i thought my Gmail account is impossible to fill, but after a few years, couple of mailing list, couple of crazy mailing list, now i often need to clean up my email to make sure no email is lost because my inbox is full. This is what i usually do

Find email that has an attachment
This is usually the quickest way to free same space. You can use
has:attachment to query the mail that contains attachment in the search box. Or if you want, you can even specify the type of file by using filename: .doc adding "label:" to the query can give more refined search. Too bad we can't sort it by the attachment size

Using date
We can also use date to delete our old email. This can be done by using the "before:" and "after:" query. For example :

label:notification before:2011/01/01 after:2010/01/01


Again, using label like the above example, can help to refine your search. And to lessen the impact if you search and then delete the wrong query :)

Starred mail
While using the query above is very useful but often the queries return hundred or even thousand of emails. GMail will page the result, dependent on your settings it can give 25, 50 or even 100 in each page. But still a tedious task to do. GMail can help you even more, by selecting all of the email in that page, another option will come out in the top, that will let you select all of the email in this query. And then delete it.

But this approach is a "scorched earth" approach. You will delete all of the email, but sometimes there are important email included in this search, the one that we usually mark with a star. Logically, we want another parameter in our query. Looking for a starred email can be done by adding is:starred parameter to our query. But what we need is a "not starred" parameter. This can be achieved by negating the previous parameter to :
-is:starred . But the problem is, even there's only one email in the thread that isn't starred. The thread would still be selected.

Thus why i create my own method to handle this. first i create a temporary label named "my_starred" then i go to each label and query

label:notification before:2011/01/01 after:2010/01/01 is:starred


selecting all, and add my_starred label. And then remove the notification label. After that you an select the notification label again with the date range, and then delete all the email. The last step is to go to the my_starred label, and change it back to the notification label. Repeat this for every other label that you want to clean up.

Thursday, February 24, 2011

Saving youtube video from google chrome

If you remember my post about youtube flv cache files, I've been saving my youtube video's manually. I like this approach because it allowed me to watch the video first, if I found it interesting then I will save the video. While some firefox plugin allow you to save youtube videos, it often force you to re-download the video from the beginning. And if you just download the video without watching it first, some time after one hour of waiting you just end up with a complete garbage !

These days I'm using Google Chrome as my main browser. So I'm faced with the same problem in a different environment. Unlike firefox, Chrome uses the windows temp to store its temporary files. Including the FLV files. But it's very defensive. You can't copy the cache while chrome uses it, and if you close the tab that shows the video, Chrome will immediately delete the file. Giving you no time to copy it. Damn you google guys :P

After some goggling i finally found a solution. Hobocopy to the rescue ! Hobocopy is an open source utility that can copy copy-protected file in windows. You can download hobo copy from here. Using this approach I can copy the protected files. The flv cache files can be identified easily by their name and size.  Usually it will start with fla and end up with .tmp extension. So using Hobocopy i can copy the file i want as simple as :

C:\HoboCopy.exe C:\temp F:\MyVideos\ fla18E.tmp

But you must be aware, since Hobocopy is not actually a file copy utility, the Syntax is a bit different.

Another thing that I've found out is about the firefox case. Remember when firefox only cache a part of my video but I can still play the full video in my browser. It turn out you can get the full FLV video's from Windows temp directory using this same exact method.

Now i can view my Youtube video's without worry about rebuffer and wasted a lot of bandwidth :D

Thursday, February 10, 2011

Screen Scrapping Guide for Java

I created and app about one year a go. The application need to screen scrap a website because it didn't give an API to access the data. When i started, I was confused by so many choice that available for screen scrapping in java. And at that time I've decided to go with NekoHTML, its very powerful but also complicated and a bit of nightmare to maintain. So today i decided to look for better alternative. It turn out, after one year I easily confused by the so many java library out there that i can use. So i decided to create this guide.

Regex
The simplest and probably the fastest way to do screen scrapping in Java. The regex class is already included in the standard java library. So you don't need to add another library and learn how they work.

The problem is, regex is very prone to error. There are many reason for the error. It could be because the html doesn't comply to standards, bad implementation, or even non matching tags. And also a simple change on the website could break the whole regex rule and you need to start from zero. 

To use regex, you need to be very diligent about white space character, or it's only a matter of time before it bites you.

NekoHTML
This is one of the best parser that i know. It often used on other framework such as HTMLUnit as the default html parser. It creates the DOM representation of the page, and then you can traverse through the DOM tree getting each node content. Since it such a low level access, its a bit of pain to maintain. And also you still need to traverse throug the node that isn't important for you. Such as empty text, series of newline, break tag, etc. 
To overcome this you can add a custom filter to remove the unnecessary tag, and uses XPath to query the tag that you are interested in. 

HTMLUnit
Beside as a framework for testing, you can use html Unit for screen scrapping. It can be used for screen scrapping. You just create a webclient and then you can access the tag that you are interested in using the getHtmlElementById or you can also uses XPath. Then you can access the data as an XML or Text. 

It gives a higher abstraction, you don't need to traverse the DOM tree manually. And it also gives build in cookie management, proxy access, JavaScript, CSS and Ajax Support. Everything that you ever need from a headless browsers.

The funny thing is, after looking for something new, i decided to stick with NekoHTML. Its fast, and implementing custom filter helps me a lot. And it also doesn't come with the unnecessary bagage such as Javascript, CSS and Ajax Support. I don't need it for the moment. And of course using XPath has become very valuable. It cuts my previous code to 1/3 even 1/4 in some case. No more manually navigating through the dome, and it's more intuitive. I think i finally found the right tool :)



Hope that helps , I'll re-write the rant some other time to give better explanation. :)



Saturday, January 29, 2011

Crazy

I'm going crazy. There's only so much that one people can handle. Got to do something, or i will break down and crumble.

Tuesday, December 14, 2010

Wireless setup

So i've got this Linksys WAP54G in my home, and try to set it up. I'm having trouble with the automatic setup, so reading this helps a lot.

Now i can ping and connect to my access point, I'm facing another problem. I didn't have any dhcp server. That's why my ubuntu laptop keep turning off the wifi connection. Setting the auto wireless to have a static ip address fix the problem.

Last but not least, i try connecting through my htc hero. Found the same problem , this article help me set the static ip address.

The funny thing i setup all this, because I'm having a problem adding a third gmail account on my htc hero.It keep saying it need reliable network.  Trying to clear the application data didn't work. So as a worked around i delete my second gmail account, and login to youtube using my third gmail account. And it worked.

Well at least after all this now i have a Wifi Access point in my home now :)

Saturday, November 20, 2010

Type of computer engineer

I believe The Computer Engineer Folks *yeah bad grammar* Could be generally separated into two categories.

  1. The one that like to solve computer problem like algorithm, building a compiler, using the most efficient way. They think coding is an Art
  2. And the one that only thinks programming as merely a tools to quickly solve real world problem.
And sadly, both type doesn't really have a place in my country. Hopefully one day i can make a place, for both :)

Tuesday, August 10, 2010

Stupid SVN Mistake :(

Okay, i've just wasted 4 hour of my time because some stupid mistake that i made.

Today, suddenly my local SVN server just stop working. I keep getting some error message :


Server sent unexpected return value (500 Internal Server Error) in response to OPTIONS request for ...

It worked fine yesterday ?

Trying to retrace changes that I've done in the past few days, I've remembered that i made some update to the subclipse client. This throw me into some wild goose chase. Long story short, after changing some settings, change svn client etc, finally i found the core of my problem looking at the httpd.conf file for my svn server.

I have this kind of Computer-OCD. When ever i see a file that i didn't know i tend to erase it. Later this day i found a passwd file in my C:\ drive. Thinking that no body use it, immediately i hit the Delete button. Lesson learned, that this file actually my password file for accessing my local svn server, and I simply forgotten about it. So i create new password file named svn-passwd to store my password and the svn worked fine.

Tuesday, June 1, 2010

This GMail trick is awesome

http://i.imgur.com/7z3om.png

I'm thinking of re-subscribing all of my milist using this trick :P

Tuesday, May 18, 2010

Forget to create trunk folder in SVN

Another one about SVN. Since i'm a bit hurry when adding my project to my SVN repositories. I forgot to create the common directories (trunk, branch and tags). After my project is stable i decided to move the code to the proper directories before tagging it.

After quick i found a simple and effective way. Since I'm working on windows, i made a simple batch script for it. Beware it tested lightly, and I didn't tune it to be a generic script.

@echo off
set repo=http://localhost/svn/myProject
echo "Repository location " %repo%

echo "Creating SVNTemp directory"
del SVNTemp
mkdir SVNTemp

echo "Checking out source from repo"
svn checkout %repo% SVNTemp

echo "Creating trunk in repo"
svn mkdir %repo%/trunk -m "creating trunk"

cd SVNTemp
FOR /F %%a IN ('dir /b *') do (
echo "Moving %%a to trunk"
C:\Progra~1\Subversion\bin\svn.exe mv %%a trunk
)
svn commit -m "organizing to trunk"
cd ..
@echo on

Saturday, May 8, 2010

The mystifying URL Encoding

I just found out about this things. I never really care about the difference between URL and URI. Whatever it is I just figured it will point to a resource somewhere in the internet. For all i know they can be used interchangeably, so far.

It turn out, when you're trying to generate your own URL programmatic-ally , it matters. One thing to know, that it encode space differently. URL will encode space into + as demand by html 4.0 specification. While with URI you can get the usual %20 character.

And what more annoying is this fact.  That you can't simply use URLEncoder to encode and decode URL, but you need to create a URI then execute the toURL() method.

Tapestry URL


Now something specific about tapestry. Since I'm creating an android client that will talk with tapestry server. I need to generate my own URL. In this URL fiasco it turn out that tapestry has its own URL Encoding policy. You can see the change in this jira. Tapestry substitute the '%' character with '$00'.

Luckily the you can get tapestry URLEncoder implementation from tapestry code. So i just use that class in my android app. And one problem solved.

Oh another thing i found out. Tapestry page isn't debug able with eclipse WTP. But the services are.

Cheers

~FD

Wednesday, May 5, 2010

Removing folder from SVN

Well, i haven't use SVN for a long time, so my memory is a bit lacking. I initially import all of my project to SVN, but I've forgotten some folder that should be excluded from the initial import. Such as generated bin files. And i want to remove it from SVN versioning.

The solution is pretty simple, you go to the folder that you didn't want to manage in windows explorer. Search for file and folder containing .svn, and don't forget to check search subdirectory, and search hidden file option. Sort by folder, delete all of the .svn folder.

Then go to eclipse, update your project. And then the bin  folder will have a question mark near it. Just right click add to svn:ignore. And you're finished. The bin folder wouldn't be managed by SVN any longer.

Update :
After migrating to eclipse galileo subclipse somehow treat this workaround  as un-ignored error. The better approach is to delete the folder from SVN Repositories View and check out the code again, and then add the folder to svn:ignore. The subclipse wiki explain in more detail.


~SD

Saturday, May 1, 2010

Color Harmony

Well, for someone like me who is color illiterate , this seems to be the perfect place to start. By learning it you make sure that the user that uses your web doesn't get a headache every time they uses your apps. :D

And this tool from Adobe is amazing :D

Friday, February 12, 2010

Reverse proxy in apache 2 karmic koala

It turn out to enable reverse proxy in apache 2 is very simple. All you have to do is enable 2 module using this command :

> sudo a2enmod proxy
> sudo a2enmod proxy_http

modify the virtual host for your sample, the default is in /etc/apache2/sites-enabled/000-default

add this 2 lines for each of your context
ProxyPass /itsme/ http://www.mysite.net:8080/itsme/
ProxyPassReverse /itsme/ http://www.mysite.net:8080/itsme/

restart the apache server using
> sudo /etc/init.d/apache2 restart

and its done :D

~FD

Sunday, January 3, 2010

Firefox FLV Cache

There are some tools for storing streaming video from youtube or other site like keepvid.com or flv plugins for firefox. But usually just use the manual way. I go to the firefox cache directory, see the latest and usually the largest file size. Copy it to other directory and give it an .flv extensions.

One thing that i don't understand, when I watch a rather long videos, usually the file in the cache would only store 25,584 KB of the file. This numbers is the same no matter what long video I cache. And what rather interest me is, when i see the video in my browser. It still replay able to its full length.

Today i Google some info, and i think i found the answer. First you can type about:cache in your firefox address bar. There you can see the Disk Cache Device information. It can show you how many entries in your cache, Maximum Storage Size, Storage in use, and a link to the cache directory.

Well one thing that i realize is, the size of 25,548. Is the size of half of the default Maximum Storage Size in firefox, which is 50 MB. So i tried to increase the Maximum Storage Size to 200 MB and refresh the video I'm watching, and finally able to get the full size video, which in my experiment is 29,418 KB.

I think firefox is limiting the size of a cache file into half of the maximum Disk Space. This because its almost imposible for a cache directory to only contains a single file. Almost all the time the directory will contains more than one file.

But that doesn't answer why i could re-play the full file in my browser ?

My guess is, it is stored in the memory. To prove it i try watch the firefox memory usage in windows task manager. And close the tab and reopen it again. The memory usage drop significantly, but not quite the same as the full size of the file. But i'm guessing that my hunch is correct.

Sunday, November 22, 2009

The karmic koala...

I've been postponing my upgrade from hardy heron to karmic koala for a long time. But because my laptop disk crash, somehow i've been forced to do it anyway :) So here is my experience...

Installation

The installation was easy and fast. Since I'm installing to another hardisk (used windows disk), i just used the default option and wipe the whole content of the disk.

After successfully installing karmic koala, now comes the detail part. I need to restore my data, since my previous hardisk luckily can be mount using ubuntu live cd, i just copy my home folder to a backup directory in the new one.

There's one problem though. Because in my previous installation I've installed Wine emulator, somehow some of my file was copied more than once. From the real path and from the wine path. Since i don't use Wine any longer, i think its better to remove .wine folder before start copying your old file.

Another thing you should notice when copying your old file is, you better do it with sudo. Because some of my file was created by root id, it failed to copy to the backup folder.

Program List - part 1

Before starting to install the programs there's one thing i like to mention. I use to manually modify the apt source list using vi to point to my favorite repository. But now i can do that through the synaptic manager repository settings. Since my favorite repository is available, one click would do the trick instead of copying several lines in the /etc/apt/sources.list :)
(a bit OOT, my favorite repository is dl2.foss-id.web.id, its blazing fast)

Here's the minimum list of program that i need to install after i finished my karmic installation :

- openssh
- pidgin
- rar plugin
- thunderbird mail client
- exaile (yes we can't live without mp3 anyomore :P)
- sun java 6


few of my own notes. Karmic comes with empathy as the default IM client. But it still lack many things, especially proxy option. Thats why i still need to install pidgin. Thunderbird is my default my client (and probably most people), Evolution is simply not my thing.

And for Exaile, i was using Amarok. But since it load many KDE library, i was looking for another alternative. Exaile seems nice enough. But the most important thing i missed from Amarok is the key binding to start and stop music using windows- z through b. If only another player incorpoorate this :(

The plugins

Yes, its not enough to simply install the programs, now everything come as a plugin :) For me it quite straigh forward, all i need is :

- Flash plugins, Flash Blocker Plugins, Ad Block Plus Plugin and Firebug plugins for my Firefox
- gstreamer for playing mp3 and mpeg files


Restoring

Well one thing i like about Firefox and Thunder bird, to restore all of your mail folder, rss, bookmark, etc. All you need to do is copy the old file and overwrite the old configuration. For thunderbird is a simple as this. copy the content of .mozilla-thunderbird from the old to the new one, open thunderbird and see all of your mail back to where it belongs. You can delete the new profile if you like.

For firefox you need to copy .mozilla/firefox/profiles.ini and .mozilla/firefox/[old profile folder] from the old one to the new one. I was using 3.0 and now 3.5 and the transition is very smoth, i even got my previous opened tab and history just like in my old hard disk :D


The UI

The default Karmic UI still feels somewhat clunky for my taste, so its time to tune it a little bit. I like putting all of bar on one place, preferably bottom. You used to able to do this by dragging the bar. But now you need to right click on the bar, choose properties, and choose the orientation to bottom.

The default ubuntu font is an eyesore to my taste, you can download your own font. There are 2 font that i like to mention, first is the sun font, the sans and serif is quite good. But for my karmic i like to try a new font, the droid font.

The droid font was designed for small system, so even in small display it doesn't break or become clunky. It fit perfeclty for my 14" laptop screen. To install it you just need too look for ttf-droid in the synaptic package manager.

After installing the droid font, you need to configure the appearance through System > Preference > Appearance > Fonts. My configuration is :
- Application fonts Droid Sans Japanese 8
- Document fonts Droid Sans Japanese 8
- Desktop fonts Droid Sans Japanese 8
- Window title fonts Droid Sans Bold 8
- Fixed width font Monospace 10

you need to change a little thing on Firefox to give it the finishing touch. Just go through firefox Edit > Preference > Content > Font. My Configuration is :
- Proportional Serif 15
- Serif Serif
- Sans-Serif Sans-Serif
- Monospace monospace 12


and Voila ... My Karmic Desktop is Prettier than my windows desktop :D

with this settings I've managed to continue my work, the other could be updated piece by piece, and here's some of the advanced part i've managed to set on the weekend.

Notification

Karmic comes with a new centralized notification, sometimes it can be very annoying, especially when you're using pidgin. It keeps popping every time my buddy sign on, combined with bad network, its a living hell for working. To solve this you need to configure your pidgin like this. Go to Tool ->Plugins -> 'Libnotify popups' -> Configure Plugin . And then remove 'Buddy signs on' checkbox.


LILO

My laptop is lenovo 3000 N200. Since Hardy Heron I've always get this problem. My DVD isn't detected on my Ubuntu, the funny thing I'm able to use the DVD for installation or using live cd.

It turn out i'm not the only one, lots of people having this kind of problem with this lenovo series. One of the solution is to set ACPI off in boot time, but has the risk of damaging the laptop in the long run. So i choose the other solution replacing grub with lilo as the boot loader.

Installing lilo is quite easy :
- Make sure you have live cd ready just incase anything happens
- Just go through synaptic and download the lilo package.
- Backup your /etc/fstab to lets say ~/backup/fstab.backup.
- Modify the fstab files so lilo would work, since lilo hasn't been updated to recognize UUID for the boot partition, you need to restore it to the old fasion way. For example like this

# /etc/fstab: static file system information.
#
#
proc /proc proc defaults 0 0
/dev/sda1 / ext4 defaults,errors=remount-ro 0 1 <--- the changes
#UUID=ca06fd83-becb-4012-8579-9e65662c9ef0 / ext4 errors=remount-ro 0 1

# /dev/sda2
UUID=948b4626-2f62-40c0-bc92-6ee8b69af42e /media/hda2 reiserfs defaults 0 2


- after that run sudo liloconf, since i didn't use grub anymore i just rewrite the MBR
- and then restart

And finaly my DVD worked and I've managed to backup my work :D

One thing, the default lilo is very slow comparing to grub. It took about 2-3 minute to start while grub could do under 1 minute. There's a way to speed up Lilo boot up time, by using the compact mode. You just need to type this as root,

lilo -c -v

see /etc/lilo.conf and make sure there's line saying compact and its not commented. Then lilo would boot up pretty fast. Comparable with grub, the side note is, this solution is intended for FD, could have some problem with old hardware. But since my laptop is not that old, so far i haven't had a problem with it.

Network Management Applet

Well this is another pain in the ass , but this has been a very long post. So lets leave it as it is and save it for another time :D

- Adeu -

Sunday, July 6, 2008

J2ME vs XML

Bagi yang pernah coding j2me pasti ngerasain betapa frustasinya coding di j2me itu. Pindah dari coding desktop or j2ee ke j2me membuat kita merasa seluruh tungkai seperti terbelenggu oleh rantai. Apalagi kalau membuat aplikasi client-server dimana harus pindah-pindah paradigma. Dari server yang rich with resource and API, to that sucky j2me. Belum lagi kalo ditambah gunain xml yang terlalu verbose sebagai protokol komunikasinya. Tetapi apa daya, gw terlalu cinta dengan good design, dan membuat gw tetap stick dengan XML.

Ok, enough with all the unstructured mumbling.

Dengan segala masalah itu, maka sebetulnya XML kurang disukai oleh developer j2me. Kalaupun harus memakai, tag-tag yang ada biasanya di buat sesederhana mungkin. Cara lain untuk mengatasi kelemahan XML, bisa juga dengan melakukan kompresi terhadap data sebelum dikirim. Tyniline lumayan bagus untuk mengatasi hal ini, and its free :D

Masalahnya, semua referensi tentang kompressi di internet adalah kasus dimana si client mendownload data dengan jumlah besar dari server. Nah sekarang bagaimana kalau yang diinginkan adalah hal kebalikannya. Gw ingin mengirim data dalam jumlah besar dari client ke server. Masa gw harus implement kompresi sendiri *hiks*

Tuesday, April 17, 2007

A Tapestry 4 Introduction

http://www.devshed.com/c/a/Apache/Apache-Tapestry-4-Tutorial/

This page is awesome!!! I just found it couple of days a go.

When it comes to java web programming I immediately skip to Tapestry. So I didn't learn those tiny servlet, or annoying JSP tags, i even knew very little about javascript. So that article give me great insight, and I'm thankful i don't have to go through that road :D

Thursday, April 12, 2007

Wiki

For couple of weeks i have this urge to install a wiki on my personal computer, and yesterday that urge finally satisfied, and I'm so Happy :D.

The quest start about a week a go, i'm looking for ready to be download wiki's on the internet. To my surprises i found out there's so many available wiki to be downloaded out there. It's like every one in the internet trying to make their own wiki :). So i try to compare some of them, and the more confused I've become.

Actually i already have a wiki in mind, its MediaWiki. A Wiki that being used for wikipedia, i've gotten used to reading wikipedia formatted article, and the interface is just so clean and nice :D. But at the first glance at MediaWiki site, i see that MediaWiki only provide online hosting for people that wanted to create their own wiki. So it doesn't suit my purpose and i began to look at other wiki. I found couple of good ones such as trac, and tikiwiki and starting to download them. Luckily, thats when i realized that MediaWiki provide a downloadable source. I'm so ashamed i didn't see it at the first time:P

So i download MediaWiki and try to install it at home.

First Day
MediaWiki is based on php with mysql or postgres as the Database. I Couldn't find any java based wiki that i can give more point than MediaWiki. So i stick with the best.

I'm a java developer for almost 3 years. My php skill sucks, i stuck at the beginner level and decided immediately not to pursue that path and stick to java. But i've previously succeded couple of time installing php on my computer. So i started installing apache httpd server on my computer, which is a piece of cake. And then installing php 5.0 which i try for couple of hours, but didn't work. Damn, its seems so easy 3 years a go. So i give up and decided to look for clue's in the internet tomorrow.

Second Day
I've download a step by step guide for installing php and httpd server from the internet, and also download the newest source for php and apache httpd server. Just in case my source conflicted with each other.

After following the guide, i've finally got php working on my computer. I've just missing a line from php.ini *yeah, that one annoying unimportant line:P*. So i tried installing media wiki, but when i try to configure it, a message saying that my php doesn't support mysql. No driver found for that database. I tried loading the module, restarting apache, but still it shows the same message.

I didn't have the source to compile php from scratch, and besides the docs definitely said that mysql support is already built in. So i tried installeng the newest php version. But still the same problem showed.

I'm thinking of giving up and look for some info the next day. But for one last try i try a futile effort and usually cure most wierd problems in windows. Restarting the computer. And magically it worked :P

Wikipedia only for me
And its totally worthed, i finally got my wiki working. And start creating a few docs for my project. The MediaWiki is so intuitive so i've got to almost 70% productivity just by guessing how it worked. By the time this is the first time i ever tried to edit a wiki. Argh, i'm so excited and delighted. I can also finally organize my ideas and though from my notes to a more organized media.

But got to learn the tutorial though :P

Wednesday, March 14, 2007

Subversion Without Network

My Friends and I have a small project out side of work. We meet on weekend and its been going for almost a year now.

At the beginning of our project we decided to use a repository server and decided that we'll use CVS. We struggle a lot trying to install the CVS server, but finally we have it running in a couple of weeks (yeah its not a great achievement :( )

In the middle of our project we have some misfortune. And because of that, our cvs server got shipped away (don't ask the details :P). Because its been months, since the start of our project, none of us remember the complete step to install the CVS server. Remembering the pain searching docs, etc, to install our CVS server in the first place, we decide not to install the CVS server and focused on our development.

I have reason for this, its not only because we are lazy or ignorant :P. We are waiting for the release of subclipse 1.2.0, An eclipse 3.2 (calisto) plugin for Subversion(SVN). Actually in the start of our project we already favor SVN over CVS. But the lack of stable plugin for calisto force us to use the alternative, CVS.

The story goes on and we successfully install SVN server and Subclipse.

As i mentioned earlier, we meet on weekend for this project. And do most of the work on weekdays after work. I don't own any laptop, so in the weekend i usually bring my source in an USB and manually merge the code. But since we have our SVN server setup, something gotta change.

After a couple reading of the subversion documentation, we finally find a way, so i can merge my source with the repository without have to buy a new laptop :P

Here's the complete step that work for me :
  1. First we set an eclipse workspace for me in one of my friends computer that connect to the repository.
  2. I plug my USB that contains my project from my home workspace.
  3. Using windows explorer, I search my src folder in my USB for all of .svn directory and delete it. Remember search the src folder and other folder that you need to commit like context folder in a web based project.
  4. I copy the src folder (and context to if you're working with a web based project) , from my USB to my workplace in my friends computer.
  5. I start eclipse in my friends computer
  6. Switch to my workplace
  7. Eclipse mark all of the changes i made at home.
  8. I Commit the changes to the SVN repositories.
  9. Done, clap your hands >:)
Actually at first try we try to copy all of the project source, from the USB to my workspace, but it didn't work. When we start eclipse, no files is marked changed. After reading the documentation, we find the reason. Its how subversion work.

After you initially add your files to subversion repository. Subversion create a .svn directory on your local folder, the folder is hidden. It stores a copy of the files in your current directory, and use it to determine changes you made to the files and directory.

PS : I have my own subversion server in my home, and commit the changes i made to the repository before i copy it to my USB. That's why my .svn repository don't mark that any changes has been made since last time i commit to SVN repository when i copy my project source to my workplace in my friends computer.

Friday, December 15, 2006

lesson no 1

I've got a lesson today.

If you compared two variable with different type, example BigDecimal with int. Then use the larger type comparator operand.

here's the code snippet

BigDecimal zeroInBigDecimal = new BigDecimal(0);

if (txtCloseLevel.getValue().intValue() < 0) {
JOptionPane.showMessageDialog(this, "Close Level Must Be Greater Or Equal Zero",
"Error", JOptionPane.ERROR_MESSAGE);
return false;
}
the getValue method returned a BigDecimal instant, so the comparation should be
if (txtCloseLevel.getValue().compareTo(zeroInBigDecimal) < 0) {

why?
Because i expect the intValue() method to return maximum integer value when the txtCloseLevel.getValue() return a value bigger than the maximum integer value. But instead it return a negative integer number. A lesson to be learned :P