lifehack Personal Technology Web Development

How I improved my Handwriting

During high school, my term exams (quizzes) required handwritten answers spanning multiple pages.

My handwriting was barely readable.

Based on some observations I started to write the letters with,

1) consistent shapes
2) same size
3) equal spaces between the letters and words.

This made my handwriting very readable but not necessarily pretty.

A few years back when I took an interest in typography I realized why this technique worked.

A printed page mostly uses a single font (letters of the same “shape”), same font size (same size) and consistent spacing between the characters (equal spaces). This among other things makes the page very readable.

I hope this technique helps someone improve their handwriting skills.

LG Optimus music Personal smartphone

Playing music on the LG Optimus V

I finally bought a smartphone. Its an LG Optimus V with Android 2.2 OS.

It’s my first smartphone ever. I was excited to transfer and play some music from my mp3 collection on the Mac using the pre-installed Music application on the smartphone.

I did not find any easy and quick instructions to transfer music files to the LG Optimus V.

Here is how I loaded music files from my Mac to my new LG Optimus V smartphone:

  • Connect the smartphone to your Mac using the supplied USB cable.
  • The “Turn USB Storage On” button should pop up on your smartphone. Press this button.
  • The smartphone should now appear as a folder on your Mac Finder.
  • Using Mac Finder, create a new folder on the smartphone and name it Music
  • Copy music files from your Mac into the new Music folder on the smartphone.
  • Wait for the copying to complete.
  • Press the eject button on the Mac Finder to safely remove the smartphone from your Mac.
  • A “Turn USB Storage Off” button should appear on the smartphone. Press this button.
  • Start the Music app on the smartphone and you should be able to see/play the music files
    on your smartphone.

This is the quick and dirty method to play music on your smartphone.

Syncing your music files between the Mac and your smartphone is an obvious problem with this approach. If you know of any good applications for the Mac or PC that syncs music files for Android phones, please leave a comment.

I am discovering new apps for the LG Optimus V every day and will share them as I discover interesting apps.

[Update 02/15/2011]

Bluetooth is another option to transfer your music files from your Mac to your LG Optimus V smartphone.

You have to pair your smartphone with the Mac to transfer files.

Once your smartphone and your Mac are paired, just right click on the album folder or an individual music file and send to the “paired” phone.

Programming python Technology Web Development

Python modules, packages and code organization tips

Java has namespaces and a class per file construct to organize code.

C# (CSharp) has namespaces to organize code.

When I started to code in Python I was looking for a way to organize and structure code.

Python code can be organized into modules and packages.

Packages translate to a folder in the file system.

A class called Song in can be imported into another module using the statement

from music.songs import Song

I was getting a python module not found or class not found error even though I had the right package folder structure.

On reading the python manual closely I realized that you need to create a file in the package folder.

The folder now looks like,

After creating an empty file in the package folder, I was able to import the Song class from music.songs module without any errors.

Some more tips on Python code organization.

Axis2 C# Java Programming Technology Uncategorized Web Development

Building a JSON Axis2 REST Client for a WCF Service.

Using JSON as the message format for a WCF REST service has some advantages
if you are building a backend service for a purely browser based application.

For instance, JSON is natively supported in all of the major web browsers.

I had to build a REST client using Axis2 that uses the JSON message format.

The blog post Enabling JSON in Apache Axis2 explains the conventions that are used to map XML to JSON and how to configure axis2.xml so that your client application can use the XML/JSON mapping convention of your choice.

I chose the mapped namespace convention which can be configured by adding the two lines to your axis2.xml

<messageFormatter contentType="application/json"

<messageBuilder contentType="application/json"

If you choose the mapped namespace convention you may get an exception that says “JSON mapped namespaces are not supported in Axis2”. If you see the above Axis2 exception then you need to patch jettison.

Instructions on the exception and the patch are in the “Building a JSON web service with Java and Axis2” post by Marcus Schiesser.

The ServiceClient (org.apache.axis2.client.ServiceClient) object can be used to make REST API calls in Axis2.

The ServiceClient can be configured using the Options (org.apache.axis2.client.Options) object.

For a REST style service invocation you need the following options,

Options options = new Options();
options.setTo(new EndpointReference("http://your.service.endpoint.url"));
options.setProperty(Configuration.MESSAGE_TYPE, "application/json");
options.setProperty(Configuration.ENABLE_REST, Constants.VALUE_TRUE);

//reuse HTTP clients
options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE);
options.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);

The httpClient object is created via the MultiThreadedHttpConnectionManager. This is needed for managing the HTTP connections if your client is used in a multithreaded application. See the post “Improving Axis2 Client HTTP Transport Performance”

Finally, you have to engage the addressing module and set the ServiceClient options

client = new ServiceClient();

The ServiceClient sendReceive call takes an OMElement which I created using custom XML serialization on the message objects.

Make sure you cleanup the http connections via the httpconnectionManager used to create the httpClient. Again. see the post “Improving Axis2 Client HTTP Transport Performance” on how to do this correctly.

The sendReceive call can be made non-blocking if you are looking for further improvements in performance.

The response returned by the sendReceive call is an OMElement again and can be de-serialized using custom XML de-serialization on your message objects.

If you are looking for pure SOAP interoperability between WCF .NET SOAP client and an Axis2 service be sure to chek out my other post Axis2 and WCF .Net Interoperability (Interop)

Facebook Technology Uncategorized

How to Add Music Player to your Facebook Page

Update (Sept 7th, 2012):
The instructions in this post are no longer valid. However, I am leaving this post as it contains some useful information and comments.
Facebook tools/apis have been constantly changing. If you want to use their tools going to their website directly is your best bet.

If  you maintain a Facebook page for your band, Facebook provides an application called the Music Player that you can use to upload songs to your band’s page.

When you upload a new song it is automatically published into the news feed of all your fans. You don’t have to send out fan updates to publicize new songs. Publishing into your fan’s news feed is currently the best way to get the attention of Facebook users.

Here are the steps to add Music Player to your Facebook band page :

Login to Facebook. Make sure you are the page admin for the page you are editing.

Ads and Pages
Ads and Pages

Click on “Ads and Pages” on the left menu.

Update: If you don’t see the “Ads and Pages” link on the left menu simply go to this link to edit pages

Edit Pages
Edit Pages

Click on “Edit Page” link at the bottom of the page you want to edit.

More Applications
More Applications

Click on “Browse More”  which will take you to the application search page.

Search Music Player
Search Music Player

Type music player in the search box and hit enter. This should take you to the Search Results page.

Music Player application
Music Player application

You should be able to see the “Music Player by Facebook” application in the search results.

Click on it.

Add Music Player to Page
Add Music Player to Page

Click on Add to my page. This should pop-up a dialog.  Select the page.

Thats it.

You should now be able see the “Music Player” application on your page.

You can edit the “Music Player” application to upload and display albums on your fan page.

Tip: You can add the “Music Player” to any page in general, not just a Band page.

Gadgets Technology Uncategorized

Virtual Box – Access host [Mac OS X] physical ethernet port from guest OS [Windows 7].

If you are in a hurry here is the quick summary :

To access the host machine’s ethernet adapter/port from your guest os, you need to create a bridged adapter on the virtual machine. The bridged adapter maps a virtual interface on the guest os to the physical ethernet adapter/port on the host machine.

Got some time ? Then read on…

I got  a new TRENDnet  Gaming Adapter TEW-647GA (Wireless Bridge) to connect my 20 GB PS3 to the Internet and also to explore the Internet@TV features of my Samsung LED TV.


The wireless bridge comes with a setup utility on a CD. If you are on a Windows machine then setup is a breeze. But if you are on a Macbook/Macbook Pro/Mac you may not be so lucky. Fortunately, for me I had  Virtual Box with Windows 7 set up as a guest instance.

How to Access the host ethernet port from the guest OS ?

Connect the wireless bridge to the built-in ethernet port on the host and power up it up.

From your guest OS, mount the host CD drive  and run the setup.exe utility.

By default virtual box sets up the guest os to use NAT networking, running the setup utility with the default (NAT) virtual machine networking configuration will fail. The wireless bridge will not be recognized by the setup utility.

Reconfigure the guest virtual machine with a bridged adapter and map this new adapter to the physical built-in ethernet network adapter.

Run setup utility again from the guest os.

Setup.exe should now discover the wireless bridge connected to the ethernet port on the host machine.

Follow the instructions on the TRENDnet  installation guide. On my Window 7 guest OS I had to ignore the error messages that said configuration had failed. The configuration had in fact completed successfully and I was able to connect to my Netgear WGR614 router and the internet.

Disconnect the wireless bridge from the ethernet port and connect it to the gaming console. The gaming console should automatically pick up an IP via DHCP and your gaming console should be connected to the net.

Have fun!

Additional Notes :

You can configure an extra adapter (adapter 2) on your virtual machine if adapter 1 is configured with NAT networking already. TRENDnet Setup utility will still recognize the wireless bridge connected to the ethernet port.

Facebook Technology Uncategorized Web Development

How to Post to a Facebook Fan Page on Behalf of the Page.

Quick Summary

Use the Facebook.showPermissionDialog FBJS api call to authorize the Page for which you are an admin. Set the enableProfileSelector to true and include the page id in the profileSelectorIds. Once  the app user has authorized and given the extended permissions, You can use the Stream.publish api call with the page id as the target id and publish on behalf of the page.

The Details – Posting to the Facebook Fan Page on behalf of the page.

Facebook allows you to create pages aka fan pages for your website, business, product, or almost just about anything. Page admins can customize their pages by adding facebook applications from the app directory to their pages. Using Facebook applications for fan pages allows you to integrate into the social connections of your fans better.

Applications with extended permissions can publish to a user’s wall, news feed stream or profile. In addition, applications can now publish to a Page wall.

Publishing to a Page as a user is fairly simple with Stream.publish facebook api, the Facebook developer api covers this well. You can prompt the user for  ‘publish_stream’ extended permissions using the  fb:prompt-permission FBML tag, preferably during an initial set up workflow.

Once the user has authorized your app and given the extended permission, You just have to set the target id to the page id in your Stream.publish api call.  See the sample php api call below,

$facebook->api_client->stream_publish($message, $attachment,$action_links, $target_id);

Publishing on behalf of  a page is trickier.  Page admins have to authorize the app to publish on behalf of a page. You can do this by using

the Facebook.showPermissionDialog FBJS api call.

Facebook.showPermissionDialog('publish_stream, read_stream', ondone, showProfileSelector, [1234,2345]);

Just replace the profileSelectorIds ( [1234, 2345]) and include the page id in the FBJS call above. This should bring up a permission dialog and show

a “profile  selector” including the page for which you are an admin.

You should now be able to use the Stream.publish api call with the page id as the target id and publish on behalf of the page.

Programming software Technology Uncategorized Web Development

UI Programming Models

I found this excellent post Toward a better UI programing model with pointers to various UI programming models.

Web designers are forced to think within the constraints of the web browser when it comes to user interaction design.

The post above discusses more general approaches to user interaction design and not just within the context of the web browser.

Since I am mostly involved in web UI interactions these days this post was very refreshing as it brought a new perspective to me.

While developing the UI for a web app recently I realized that the web design world is in the search-discovery cycle of  “patterns” that guide user interactions.  Patterns in user interactions has the dual benefit of helping both designers and users. Much like the “guidelines” on Windows ( Windows User Experience Interaction Guidelines ) or Mac (Apple Human Interface Guidelines ) development platforms that help Windows or Mac application developers respectively while standardizing the user interactions of the applications developed on those platforms. These guidelines ensure strict quality, improves user experience and makes the life of designers easier.

There are plenty of resources that discuss “web ui interaction patterns” .

Designing Interfaces is a good resource if you are designing web user interactions. Rob Adams one of the core developers of Adobe’s Flex  has an excellent set of introductory articles which not only apply to designing user interfaces using Adobe’s Flex but applies to user interface design in general. I especially liked the Structuring your Application part.

Everyone loves the web, even if there are a few frustrations that we still have to overcome 🙂

Happy Surfing !

Microsoft Technology Uncategorized

MPLS ALT.NET – The first get together.


Yesterday was the first ever MPLS ALT.NET get together at the Bulldog N.E Thanks Ira Mitchell and Jim Swanson for hosting. Judging by the turnout at the initial meet one can easily tell that there is a great enthusiasm for alt .net in Minneapolis.

Jim and Ira do a better job of explaining What ALT .NET is all about.

The folks at Redmond, WA do a great job trying to build awesome tools for developers but often times committing resources to every available tool in the open source community is not possible. Filling this gap is where a community like ALT .NET can help.

The state of Microsoft and the OSS community is better explained by Ayende Rahien.

I hope that this community becomes successful and brings in the best of the OSS, Java and RoR communities into the .NET world.

Debugging Microsoft Technology Web Development

Capturing, Debugging localhost HTTP traffic with Fiddler


If you are using Fiddler 2 follow the instructions in the Fiddler FAQ

Why don’t I see traffic sent to http://localhost or

Fiddler does not capture packets sent to the localhost URL which makes debugging web applications hosted in your local machine painful.

Here is how I configured Fiddler to debug web applications hosted in your local machine,

Lets say your application is accessed using the URL http://localhost:8090/MySpiffyApp/default.aspx. To make fiddler capture the HTTP requests sent to this URL, all you have to do is edit the HKCU\Software\Microsoft\Fiddler\ReverseProxyForPort and set the decimal value to 8090. This tells fiddler to proxy all traffic sent to HTTP port 8888 (default proxy port) to HTTP port 8090. Now access the application using the fiddler proxy port


and you should be able to see the packet trace in Fiddler.

If you see the page below instead of your application then try restarting Fiddler and make sure the registry key name matches exactly as above.

GET / HTTP/1.1 Host: localhost:8888 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv: Gecko/20070309 Firefox/ Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: ASPSESSIONIDAADBDSRQ=NJJLKNGCKNJMNIIFAIDFCEIB Cache-Control: max-age=0

If you’d like to configure Fiddler as a reverse proxy instead:

  1. Set the HKCU\Software\Microsoft\Fiddler\ReverseProxyForPort registry DWORD to the local port you’d like to route inbound traffic to
  2. Restart Fiddler

Let me know if this didn’t work for you or if you have another way of debugging web applications hosted on your local machine.