Thursday, September 11, 2008

Installing Zune Theme on Windows XP

You can install Zune theme on Windows XP for free.
  1. Download the MSI installer from here.
  2. Run the installer.
  3. For XP x64, copy the theme from XP 32bit install in /Resources/Themes/Zune to the corresponding folder in x64.
  4. Select the Zune theme.

Bridging Windows XP Host Wireless Network to VirtualBox Guest Interface

It is quite easy to bridge the Windows XP host wireless networking to the VirtualBox guest interfaces. However, not all wireless adapter driver support packet injection that is needed for networking bridge. The following steps will guide you on bridging the wireless network and on how to force the packet injection.
  1. Select an Adapter N in the Network setup in VirtualBox.
  2. Set Attached to: Host Interface
  3. Add a new Host Interface if you haven't done so. You should see a VirtualBox Host Interface N after you have successfully added a new interface.
  4. Select the newly create virtual interface and the Wireless Network Connection.
  5. Right click and select Bridge....
  6. If your wireless adapter doesn't support packet injection, then the wireless connection will disconnect from the router.
  7. You can force it in Windows XP.
  8. On command prompt, run the following: netsh bridge show adapter
  9. ID which number is the wireless adapter.
  10. On command prompt, run the following: netsh bridge set adapter X forcecompatmode=enable
  11. This will force the bridge and the wireless will reconnect.

Wednesday, June 13, 2007

Install Build Essentials for Ubuntu Server 6.10

The default install don't have the essential tools installed for source build. To install the essentials, run the following apt-get install build-essential

Tuesday, June 12, 2007

Enable Apache Portable Runtime (APR) for Tomcat on Windows

Here are the simple steps to enable APR for Tomcat on Windows.
  1. Download the tcnative-1.dll from here.
  2. Put the DLL into system32 folder.
  3. That is!.

Windows Vista - Disappointing

Just bought a new notebook comes with Windows Vista Home Premium for my wife over the weekend. I am very disappointed with the OS so far. Here are the reasons.
  1. I am glad it finally comes with address book that is usable and have nothing to do any email client. However, after all this years, with OS X as example, people at Microsoft still don't know how to make an OS that is user friendly. The Windows Contact is not even close to the Contacts in Outlook. For example, how hard it is to put on A-Z index?! Also, why can't Vista make it easy for home user to import addresses from current Outlook contacts? CVS is so techie! I had to help my wife export it from Outlook using CVS file, and later import into Windows Contact.
  2. Windows Photo Gallery is a joke! First, after you pop in the memory card for your camera into the notebook, it doesn't know what to do with it. There is no dialog for import or whatsoever. You have to open up the Photo Gallery yourself, and import them manually into the Photo Gallery. The worse is that it thinks every import is associated to a single event. So, while importing, it prompts for a tag name, and the tag name is used as the folder name, and all the photos go into this folder. Forget about fixing your photos in the Photo Gallery; it doesn't know how to fix anything! Don't even try to export the photo into smaller size; it doesn't have that functionality! Go get yourself Picasa 2 from Google. It is free and does all the photo things correctly. The best thing is it runs on 2000/XP/Vista.
  3. Navigation in Vista is a nightmare. Everything is layered deep within who knows what. I felt like I am using the old Mac.
  4. Many features in Vista are there simply because Microsoft need to claim that Vista has just as many features as other Operating Systems. It is purely marketing, and not considering values and user friendliness of those features.

So, if you think you want Vista because it is pretty, don't get it. Stay with XP, and use all the free software out there that can give you just as many functionalities in Vista

Sunday, June 10, 2007

Creating All Parent Directories

This is the easiest way to create all parent directories.


File folder = new File(fileFolder);

// Returns true if all parent directories are created successfully.
// false otherwise.
folder.mkdirs();

Thursday, June 7, 2007

Generic HTTP Invoker Using URLConnection

Using the URLConnection to invoke any HTTP services, and return the response. You can this sample to invoke services over HTTP protocol.
  • SOAP
  • JSON-RPC, or
  • Just trying to retrieve a HTML page.
URL url = new URL(urlStr);
URLConnection urlConn = url.openConnection();

// Set the timeout.
urlConn.setConnectionTimeout(timeout * 1000);
urlConn.setReadTimeout(timeout * 1000);

// Specify the MIME type. 
// text/xml for SOAP
// text/plain, etc
urlConn.setRequestProperty("Content-type", contentType);
// Expected response MIME.
urlConn.setRequestProperty("Accept", contentType);

// Allow I/O for the connection.
urlConn.setDoInput(true);
urlConn.setDoOutput(true);

// Disable cache
urlConn.setUseCaches(false);

// No user interaction
urlConn.setAllowUserInteraction(false);

// To allow BASIC authentication
// create the Base 64 encoded credential.

String pwd = userId + ":" + password

sun.misc.BASE64Encoder base64Enc = new sun.misc.BASE64Encoder();
String encPwd = base64Enc.encode(pwd.getBytes());
urlConn.setRequestProperty("Authorization", "Basic" + encPwd);
urlConn.connect();

// Sending the request

PrintWriter writer = new PrintWriter(urlConn.getOutputStream());

writer.print(requestContent);

// Reading the response
StringBuffer sb = new StringBuffer();

String line;
while((line = in.readLine()) != null) {
    sb.append(line + "\n");
}

toReturn = sb.toString();