If you kinda tired of constantly changing your wireless network when you're at home or office, batch file could be a great help for you. A single click is enough to setup your wireless connection. I was using Net Profiles and I'm a satisfied user, but this single click idea beats Net Profiles.
Of course you've to create a batch file for each connection you want to setup, but that's not too much to do (imho).
FYI, I'm using Vista. For XP, the command could be a bit different but the idea is still the same (c'mon improvise).
Now, here's the simple command line to connect to a wireless lan:
netsh wlan connect name="network name" interface="Connection name under Manage Network Connection" ssid="the ssid"
example:
netsh wlan connect name="hpsetup" interface="Wireless Network Connection" ssid="hpsetup"
in case you use static ip in your office or home, the command goes like this:
netsh interface ipv4 set address "Connection name under Manage Network Connection" static the_static_ip mask the_gateway
example:
netsh interface ipv4 set address "Wireless Network Connection" static 192.168.1.102 255.255.255.0 192.168.1.103
One more thing, running under Vista you need to run the batch file as administrator.
After all, it's only one click away.....
Tuesday, July 07, 2009
Tuesday, June 16, 2009
Virtual Serial Port
How did I start to play around with it? It all began when a friend of mine was asking me for a favour to help him develop a simple software to communicate to another software thru serial port. My laptop doesn't have a serial port (of course, unless it was a very very old laptop) and I only have one usb to serial converter.
My first idea is to buy another usb to serial converter and a null modem cable to connect 2 laptops, thereby I can test the serial communication. Another idea is to use my old desktop (I have one and lent it to someone and actually forgot about it until I need it) but I don't think it is easy to do.
Then today at the office, asking my friend and he gave me one brilliant solution called VIRTUAL SERIAL PORT. I never heard it until today and my oh my... it is the solution to my problem (Thanks Adhi).
Googling around and I found one free driver (http://com0com.sourceforge.net/). Easy to install and I think I don't need to setup anything more, unless I need to configure another serial port pair. One thing lacking is the GUI to configure the ports. Anyway, it's free and open source, I couldn't be happier.
My first idea is to buy another usb to serial converter and a null modem cable to connect 2 laptops, thereby I can test the serial communication. Another idea is to use my old desktop (I have one and lent it to someone and actually forgot about it until I need it) but I don't think it is easy to do.
Then today at the office, asking my friend and he gave me one brilliant solution called VIRTUAL SERIAL PORT. I never heard it until today and my oh my... it is the solution to my problem (Thanks Adhi).
Googling around and I found one free driver (http://com0com.sourceforge.net/). Easy to install and I think I don't need to setup anything more, unless I need to configure another serial port pair. One thing lacking is the GUI to configure the ports. Anyway, it's free and open source, I couldn't be happier.
Friday, June 05, 2009
Turning Toshiba Satellite illumination led off
The first time I got my Toshiba M300 (actually it's not mine, it's my office's), I love to see all the LEDs light up the laptop.

Not until a week that it already bored me to see my laptop lights up as if it was a festival. Then to my dismay, I found out that turning off the LEDs wasn't easy (I did manage to turn it off though).
My colleague buying the same laptop as mine, also find it difficult and he did ask me how.
Today, someone asked me (she's using toshiba also) how to turn the LED off and gladly I told her and write in this post on the how to.
1. Press fn button and click on the rightmost button

2. Click on the HWSetup button

3. Go to Illumination tab and select Off and click OK. You're done.
Not until a week that it already bored me to see my laptop lights up as if it was a festival. Then to my dismay, I found out that turning off the LEDs wasn't easy (I did manage to turn it off though).
My colleague buying the same laptop as mine, also find it difficult and he did ask me how.
Today, someone asked me (she's using toshiba also) how to turn the LED off and gladly I told her and write in this post on the how to.
1. Press fn button and click on the rightmost button

2. Click on the HWSetup button

3. Go to Illumination tab and select Off and click OK. You're done.
MD5 hash
This morning I read a blog discussing about how to keep a secure password. The usual way to store a password is first to hash it using MD5 hash and store it in a db. The benefit of using MD5 is you cannot do a reverse-hash.
Here's how you code it in Java :
To convert it in hex, here's the code (actually I got it from here):

One more tips, for better security, you might consider to add salt before hashing the password to make it less vulnerable. The changes looks like this :
"The salt" here should be created dynamically and stored it along with the hashed password to be used later.
An excellent post on secure password scheme could be found here.
Here's how you code it in Java :
MessageDigest md = java.security.MessageDigest.getInstance("MD5");
md.update("your password here");
byte[] hashed= md.digest();
To convert it in hex, here's the code (actually I got it from here):

One more tips, for better security, you might consider to add salt before hashing the password to make it less vulnerable. The changes looks like this :
md.update("The salt" + "your password here");"The salt" here should be created dynamically and stored it along with the hashed password to be used later.
An excellent post on secure password scheme could be found here.
Friday, May 22, 2009
Being critical with your own capacity
This post I think only relates to small company where employees are less than 30 ppl or where there're no strict structure applied.
It's about how people responses when they're given task while they're still working on one.
By far, I've seen 3 ways of ppl managing their capacity:
So which type is the best?
I would say a small company only needs 1 or 2 "Yes man" and a lot of "rational guy".
There are times where resources are limited and adding more resource is not the best solution. This is where "Yes man" is very helpful, however having too many "Yes man" won't be good either considering the quality of the work.
A growing company is a company which also learn to realize quality does come with price.
One caution for "rational guy", sometimes he might become too rational that he start to reject the task for the sake of task dislike using the current task as an excuse.
It's about how people responses when they're given task while they're still working on one.
By far, I've seen 3 ways of ppl managing their capacity:
- "Yes man" (or "can do guy")
This guy will say yes and confidently say I can to all the tasks given to him. Usually this type of guy is a smart guy, able to work everything fast and done as it seems. This guy is willing to sacrifice everything for the sake of finishing all the tasks. One thing I notice though, shortcuts were applied everywhere to get things done. The simple reason for this is there are a lot of tasks in hand, and as quickly as possible he wants to get rid of them all one by one. - Rational guy
This type of guy is the rational thinking one, when given a new task he will look at his capacity first and dare to say "I can't" if he's asked to finish the task using the time allocated for other task. Mostly guys with this type are a bit perfectionist, they have their argument that task should be finished in a right way, with few shortcuts (or none if possible). - Quiet guy
Given tasks beyond his capacity, he will keep quiet. He will keep on working on the tasks one by one, sadly without minding the time limit he has. The result is this guy will work overtime at most and doesn't meet the schedule. The quality of his work might not matter for him, he will keep on working and someday when he is tired enough, he will resign and start over in other place.
So which type is the best?
I would say a small company only needs 1 or 2 "Yes man" and a lot of "rational guy".
There are times where resources are limited and adding more resource is not the best solution. This is where "Yes man" is very helpful, however having too many "Yes man" won't be good either considering the quality of the work.
A growing company is a company which also learn to realize quality does come with price.
One caution for "rational guy", sometimes he might become too rational that he start to reject the task for the sake of task dislike using the current task as an excuse.
Thursday, March 19, 2009
Scheduling a project correctly? Almost impossible!
Scheduling a software project, I can't say that it's enjoyable. To say that it's complicated, risky and very unreliable task is agreeable for me. All the task durations set are all guestimate, basically based on hunches. After all, who can measure software development correctly. And to imagine that everything would go smooth is one thought that should never cross your mind.
The latest schedule that I arranged was a schedule for documentation project, actually it was a product reverse engineereed and documented. We have a client bought the product and they're interested in buying the source code along with the complete documentation.
At first, I thought for this project I was a bit lucky, no development needed. The thought that I forbid to cross my mind actually entered in. Thinking that documentation are all measureable, I began to arrange the schedule. The project started and after a month passed by, I begin to notice that problems start to creep in along with their surprises :
I hate the idea that working over hours is the only solution to finish the project on time. I prefer working smart, which are :
The project is still on its way, let's see whether we could finish the project on time or not :)
and whether the smart way will prevail over working over hours.
Before I finish, some books that I read also mentioned that software projects tend to not meet it's schedule, which I hope I could disagree with. These two books I would like to recommend : Secrets of Success Software and Mythical Man Month.
The latest schedule that I arranged was a schedule for documentation project, actually it was a product reverse engineereed and documented. We have a client bought the product and they're interested in buying the source code along with the complete documentation.
At first, I thought for this project I was a bit lucky, no development needed. The thought that I forbid to cross my mind actually entered in. Thinking that documentation are all measureable, I began to arrange the schedule. The project started and after a month passed by, I begin to notice that problems start to creep in along with their surprises :
- New things to be documented start to pop up, things that I didn't see in the first place.
- Tools that we used sometimes stressed us up, even M$Word! The documentation has reached almost 500 pages, when my team tried to format the doc sometimes it stopped working. And still not to mention other tools we used. Are we picking a wrong tools here? Nope, I don't think so. Problems definitely will be met whatever the tools we picked.
- Human resources. When one member of the team quits, it left a hole that couldn't be filled straight away.
- The skills required. Not everybody has the skill to document, create diagrams, read existing code.
- Interrupt. I have to help other project and what can I do but to assign my time to help.
I hate the idea that working over hours is the only solution to finish the project on time. I prefer working smart, which are :
- Finding patterns repeatedly used in the documentation. I'm lucky enough to have a teammate who is also able to recognize patterns repeatedly used in the documentation. Create/automate it once and solve it for all.
- Start measuring the time spent for a task and focus on working faster for the same task either by optimizing the way we work, finding the common things (i.e. pattern) or even using copy paste :)
- Spend less time on the normal working hours for other things we usually do (e.g. reading mails, newspaper, etc).
The project is still on its way, let's see whether we could finish the project on time or not :)
and whether the smart way will prevail over working over hours.
Before I finish, some books that I read also mentioned that software projects tend to not meet it's schedule, which I hope I could disagree with. These two books I would like to recommend : Secrets of Success Software and Mythical Man Month.
Tuesday, February 17, 2009
Running grails app in eclipse
Running grails app in eclipse actually is quite simple if... you know how.
Here's how :
- Import your grails app as existing project in eclipse
- Find {app-name}.launch in the project root and right click select Run As and the .launch configuration name

- There's all to it :)
If you want to know how to debug grails app, see my previous post.
Here's how :
- Import your grails app as existing project in eclipse
- Find {app-name}.launch in the project root and right click select Run As and the .launch configuration name

- There's all to it :)
If you want to know how to debug grails app, see my previous post.
Debugging Grails
Debugging grails almost got me crazy. I followed as said, trying it many times. At last google led me to this link which shed some light.
Let's get to the point, here's how to enable debugging grails (groovy) :
- Add JDK's tools.jar to your project build path.
Yep, that's all.
Or I'll be more specific here :
- Open your project properties, go to Java Build Path
- On tab Libraries, Add External JARs.
- Pick tools.jar from your {JDK_HOME}/lib
Fyi, I'm using grails 1.0.4 and groovy eclipse 1.5.7.20081120_2330.
Let's get to the point, here's how to enable debugging grails (groovy) :
- Add JDK's tools.jar to your project build path.
Yep, that's all.
Or I'll be more specific here :
- Open your project properties, go to Java Build Path
- On tab Libraries, Add External JARs.
- Pick tools.jar from your {JDK_HOME}/lib
Fyi, I'm using grails 1.0.4 and groovy eclipse 1.5.7.20081120_2330.
Tuesday, January 27, 2009
Extracting excel sheet index
First, this post has nothing to do with Java. It only serves as a reminder for me.
I was in the middle of documenting things where I have to use Excel with many sheets. The need for me is to have automatic numbering on each sheet, where the index depends on the sheet index (fortunate for me). Excel doesn't provide a function for retrieving index, I tried to put the index on the sheet name and further extract it. It works with the 1st excel file (because the other sheets were copied from the 1st sheet and excel voluntarily add index to the new copy's name), but with the 2nd excel file I don't want to put the index on the sheet name myself. The macro below (see this link) helps me on extracting the sheet index :

I was in the middle of documenting things where I have to use Excel with many sheets. The need for me is to have automatic numbering on each sheet, where the index depends on the sheet index (fortunate for me). Excel doesn't provide a function for retrieving index, I tried to put the index on the sheet name and further extract it. It works with the 1st excel file (because the other sheets were copied from the 1st sheet and excel voluntarily add index to the new copy's name), but with the 2nd excel file I don't want to put the index on the sheet name myself. The macro below (see this link) helps me on extracting the sheet index :

- Type above code.
- In Excel press Alt + F11 to enter the VBE.
- Press Ctrl + R to show the Project Explorer.
- Right-click desired file on left (in bold).
- Choose Insert -> Module.
- Paste code into the right pane.
- Press Alt + Q to close the VBE.
- Save workbook before any other changes.
Subscribe to:
Posts (Atom)

