NEW NGELEPEN, JAVA, INDONESIA - MAY 31:  A gir...

Image by Getty Images via Daylife

After learning about gwt plugin for eclipse, i decided to give it a try. Unfortunately, running hello world in itself became a learning curve.

Eclipse provides nice interface to install the plugins. It did not complain in installing gwt and app engine SDK's and other binaries. Hello world project was created with no issues. Till here was cake walk. Moment i started compiling, jvm threw up lots of backtraces.

Compiling module com.jatspeak.gwt.first.Firstcut
Locking assertion failure.  Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0xb73ad7c7]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0x31) [0xb73ad891]
#2 /usr/lib/libX11.so.6(_XReply+0x254) [0x8a653494]
#3 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0x8b76edce]
#4 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0x8b758d77]
#5 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0x8b758ef3]
#6 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so(Java_sun_awt_X11GraphicsEnvironment_initDisplay+0x26) [0x8b759136]
#7 [0xb13bf008]
#8 [0xb13b8b6b]
#9 [0xb13b8b6b]
#10 [0xb13b6236]
#11 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb764beec]
#12 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb781bae8]
#13 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb764bd1f]
#14 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so(JVM_DoPrivileged+0x32d) [0xb76a982d]
#15 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/libjava.so(Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2+0x3d) [0xb735530d]
#16 [0xb13be898]
#17 [0xb13b8a94]
#18 [0xb13b6236]
#19 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb764beec]
Locking assertion failure.  Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0xb73ad7c7]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_lock+0x2e) [0xb73ad96e]
#2 /usr/lib/libX11.so.6 [0x8a652619]
#3 /usr/lib/libX11.so.6(XGetVisualInfo+0x26) [0x8a648666]
#4 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0x8b7580b9]
#5 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0x8b758303]
#6 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0x8b758fa1]
#7 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so(Java_sun_awt_X11GraphicsEnvironment_initDisplay+0x26) [0x8b759136]
#8 [0xb13bf008]
#9 [0xb13b8b6b]
#10 [0xb13b8b6b]
#11 [0xb13b6236]
#12 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb764beec]
#13 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb781bae8]
#14 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb764bd1f]
#15 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so(JVM_DoPrivileged+0x32d) [0xb76a982d]
#16 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/libjava.so(Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2+0x3d) [0xb735530d]
#17 [0xb13be898]
#18 [0xb13b8a94]
#19 [0xb13b6236]
Solution :- You need to run awt in headless mode. Upon googling some folks prescribed that you better "sed" the .so file, but that is not required. Putting a VM argument -Djava.awt.headless=true will serve the purpose as well. Many times the programs like servlets etc may not know how to connect to a DISPLAY in windowing system. Thus headless will enable them to connect without a display

Thus, headless compiles the gwt project.

Movin forward, while running the project, again lots of linkages were found absent. Fortunately, the error mentions that that listdc++5.so cannot be opened.

Solution :-
Ubuntu(8.10) ships with a mroe recent version of this library, so you will need to install the 5th version by sudo apt-get install libstdc++5

Conclusion :- In case your configuration has these two attributes
  1. Java 1.5
  2. Ubuntu Intrepid (8.10)
You may need to perform above two step in order to say Hello!
Reblog this post [with Zemanta]
Android Developer Phone 1 and iPhone 3G

Image by closari via Flickr

I was doing some research on writing device drivers for android. I accidently hit a page about capacitive display screens. iPhone and G1 sport a capacitve screen, whereas HTC touch, O2, diamond etc  have a resistive screen. Resistive screens are in play since a long time and they have powered the smartphones for a long time.

This is what wikipedia has to say about capicitive screens.

A capacitive touchscreen panel is coated with a material, typically indium tin oxide, that conducts a continuous electrical current across the sensor.[2][3] The sensor therefore exhibits a precisely controlled field of stored electrons in both the horizontal and vertical axes - it achieves capacitance. The human body is also an electrical device which has stored electrons and therefore also exhibits capacitance. Capacitive sensors work based on proximity, and do not have to be directly touched to be triggered. It is a durable technology that is used in a wide range of applications including point-of-sale systems, industrial controls, and public information kiosks. It has a higher clarity than Resistive technology, but it only responds to finger contact and will not work with a gloved hand or pen stylus. Capacitive touch screens can also support Multitouch. A good example of this is Apple Inc.'s iPhone and iPod touch.

This is its take on resistive screens.

A resistive touchscreen panel is composed of several layers. The most important are two thin metallic electrically conductive and resistive layers separated by thin space. When some object touches this kind of touch panel, the layers are connected at a certain point; the panel then electrically acts similar to two voltage dividers with connected outputs. This causes a change in the electrical current which is registered as a touch event and sent to the controller for processing.

Resistive touchscreen panels are generally the most affordable technology but offer only 75% clarity (premium films and glass finishes allow transmissivity to approach 85%) and the layer can be damaged by sharp objects. Resistive touchscreen panels are not affected by outside elements such as dust or water and are the type most commonly used today. The Nintendo DS is an example of a product that uses resistive touchscreen technology.


The articles on web had some interesting take on usage of these screens. Resistive screens are far less expensive than capacitive screens. But the most important single factor supporting the continued use of resistive screens is the huge opportunity in the Asian market and its need for screens that support handwriting recognition input with a stylus. A capacitive screen or QWERTY keyboard just won't suffice in markets like China, given the nature of its alphabet.

Thus, capacitive will find itself into high end phones, whereas resistive will be people's choice for phone screen.


Reblog this post [with Zemanta]

Playing around with android

| No Comments | No TrackBacks
For testing out space suits and whatnot.

Image via Wikipedia

I have been androiding since last 2 days. I started from scratch, understood the documentation, went through tutorials, read sample code here and there, and did some exercises. Finally, after a whole day, i was able to build something productive on top of it. Blame my creativity, whatever i wished to build for it, was coincidently turning out to be enhancement of already present feature. Contacts, Calls, messaging etc. All this lead to some more efforts towards building the android operatng system from scratch. Following were the steps
  1. Get repo scripts from google
  2. Get checkout of the trunk
  3. Copy buildspec.mk to root. It ususally resides in one of the internal folders.
After this, i decided to compile the simulator. I launched make, and after 15-20 odd minutes, make returned some errors. These errors were due to INT_MAX being used in some of the cpp files. I am on Ubuntu interpid (8.10). This has gcc version 4.3.x. For optimization purposes, headers have been cleaned out. Thus, android folks forgot to put #include into one of the files where they were using INT_MAX. I fired make again.

 After some time, it compained giving double definition of template swap. This came in one of the stl files. I had to comment to move further.

All was built peacefully, and finally the simulator started building. At this point linker errors related to wxheaders-2.6 appeared. Somehow, the program was unable to link to gtk headers properly.I spent good 1 hour trying to fix it by installing different versions. After pondering upon variouos options, i thought it would be best to drop the simulator and instead compile an arm image for the emulator. I did changes in buildspec.mk by specifying correct target, and fired make again.

This time it complained not finding the definition of swap (the same template that i had commented earlier due to double definition). I uncommented it, and put make again.

After around 45 mins of screen scrolls, it had put system, ramdisk, kernel, and userdata images in proper folders.

I ran following command  

ashish@zeus:~ out/host/linux-x86/bin/emulator -system out/target/product/generic/ -kernel prebuilt/android-arm/kernel/kernel-qemu -data out/target/product/generic/userdata.img

This brought up the emulator on screen running the bundled apps. I changed a couple of strings in Contacts application, and build the images again by make. This time it was very fast and after firing up the emulator again, i could see the change s being reflected there.

Next few days would be building some core features and perhaps building some more apis.



android_screen.jpg.



Reblog this post [with Zemanta]

Finished Configuration

| No Comments | No TrackBacks
An example of a computer cluster

Image via Wikipedia

Finally finished configuration and created a new user. I took time to understand that unlike wordpress, movable is a blog cluster. There are global settings, an there are local settings as well. In case you need to add a new user, it is through global system setting, instead of manage->users in the blog dashboard.

Anyways, things have settled down now, and i wish to work on following two things in nest 2 weeks Drupal, Android and Thunderbird. My priority is Drupal -> Android -> Thunderbird. I have 11 days to finish it all. To assist in blogging, i have put scribefire in Firefox .
Reblog this post [with Zemanta]

Learning Curves

| No Comments | No TrackBacks
Hello All

I will be discussing the learning curves in here. I like code hacking and learning new things. All if this involves learning curves. I enjoy doing that, and will be posting about the learning curves on this blog. Here goes the first one, th blog installation in itself.

For the first time, i configured a movabletype blog for this purpose(learning curves involved here too!!). It was not a piece of cake as wordpress. I almost did it 1 hour back, and ran into cross site scripting issues, as i was loading the static files (css, js) from files.jatspeak.com and other stuff from blog.jatspeak.com. When i was about to write something, blog was screaming permission denied. Finally, everything from the scratch, and all went on fine :)

Following was my process...

  1. Download movabletype from http://www.movabletype.com/downloads/blogger/MT-4.23-en.tar.gz
  2. Untar it.
  3. Fire up mysql. and create a new database, say "learning"
  4. Locate cgi-bin in your httpd.conf, in my case it was at /usr/lib/cgi-bin.
  5. From the untarred folder, copy everything else apart from mt-static folder, and put it somewhere on cgi-bin
  6. Fire up http://<yourpath to cgi-bin>/mt.cgi.
  7. It will generate a new mt-config.cgi file now.It will ask about the presense of mt-static folder. You will need to provide both filepath, and weburl. It is stores in StaticFilePath and StaticWebPath properties in mt-config.cgi.
  8. It will take you through a series of nicely decorated, curve cornered windows in the process. After it says all is right, it will ask to crate a admin user (i got stuck at this point first)
  9. After you give a user, it asks for publishing path. This is fairly simple.
  10. You are done after this.It will take you to dashboard.

Pitfalls
  1. There is somebug while writing mt-config.cgi file. If you did not provide a proper path, and submit details, an ugly looking page will greet you. This means that javascript and css have not loaded due to absense of a path. In case you use firefox, install firebug. It will complain saying "getById()" not found. These errors are due to incorrect StaticWebPath and Weburl etc. You need to fix them. Most probably, your mt-config.cgi file is improper.
  2. Your dashboard comes up and you try to do a new post, but on clicking the editor nothing happens. This is die to cross site scripting prevention in firefox 3. You are most likely to face this problem in firefox 3 only. The firebug error would be "Permission denied to property w.App". Unfortunately, either live with it and use a different browser, or else simply reinstall everything. Remeber there are three different paths
      1. Path to mt.cgi, in cgi-bin
      2. Path to mt-static, which is asked while configuration
      3. Path for publishing, which is asked sometime after you have creating admin user.
  3. All 3 paths should be in same domain/subdomian. In my case, the domains were same, but subdomains were different. 
Following links helped me out.
Cross site scripting error just came to my mind.

In case you are stuck while installing MovableType, i'll be glad to help. Mail me at ashish[at]jatspeak.com

Next steps -
  1. Create a new user
  2. Put some nice theme
  3. Starting doing real work.

I just finished installing Movable Type 4!

| 1 Comment
Welcome to my new blog powered by Movable Type. This is the first post on my blog and was created for me automatically when I finished the installation process. But that is ok, because I will soon be creating posts of my own!