Skip to main content

Posts

Showing posts from November, 2008

Sample ant build file for OSGi bundles

Okay.. after I put the example the other day, I realised it is so worse to be clicking on export and choosing the manifest file all the time. So For a quick start people can use this build.xml

<?xml version="1.0" encoding="UTF-8"?> <project name="BundleName" default="deploy" basedir="."> <property name="version" value="1.0.0" /> <property name="src" location="src" /> <property name="build" location="build" /> <property name="deployloc" location="/home/to/equinox/bundles" /> <property name="dist" location="dist" /> <property name="buildfilename" value="${ant.project.name}-${version}.jar"/> <path id="classpath.buildtime"> <pathelement location="/home/to/equinox/equinox.jar" /> <pathelement loca…

Intrepid: Keyboard repeats keys too fast - Sovled!

Yet another weekend, Yet another fix :).. Well a workaround, actually..

This has been a problem for a while. Ubuntu Intrepid has very annoying too fast key repeat rate. and the gnome-keyboard-properties ignores any setting changed. There were some workarounds proposed like xorg.conf. they dint work on my lappy. I also played around experiments, in vain. Miserably. But very well pointed out by Jorge Peixoto de Morais Neto, You can set the repeat settings with kbdrate

just add the following line in /etc/rc.local
#/etc/rc.local kbdrate -r 25 -d 500
This should solve the quick repeats. If this fixes your issue, Please contribute at the bug in launchpad.

Google App Engine vs Microsoft Azure

Side Stepping on my OSGi trail, I saw a few articles on the new Azure platform for Cloud computing from Microsoft! People claiming it to be up agains Amazon EC2 and Google App Engine.



Come on.. Having never used it, I cant speak for EC2 but; App Engine and Azure? Where is the comparision.

By Choosing Azure, I am basically TIED to Windows all the way! Just look at the long list of Auzure SDK Requirements:

Supported Operating Systems: Windows Server 2008 Enterprise; Windows Server 2008 Standard; Windows Vista Business; Windows Vista Business 64-bit edition; Windows Vista Home Premium; Windows Vista Home Premium 64-bit edition; Windows Vista Ultimate; Windows Vista Ultimate 64-bit editionRequired SoftwareWindows Vista SP1 (when installing on Windows Vista) .NET Framework 3.5 SP1 IIS 7.0 (with ASP.NET and WCF HTTP Activation) Microsoft SQL Server Express 2005 or Microsoft SQL Server Express 2008 Windows PowerShell (optional)
On the other hand, App engine can live on Windoze, Linux or Mac. …

(NOT) yet Another Getting Started with OSGi

Last week I have been learning OSGi.

I got my first application running in OSGi. I am not going to write another getting started post with code that will show a hello world. But rather give you an idea how to start getting in the mud. And then may be show you more than a direction :)

I used Equinox 3.4 (OSGi R4) implementation. I prefered it over Felix. Why - Eqinox is simple, and a single jar download. But I guess that aint a thing to notice. You can get Equinox jar from here. If the link is broken, go here, download the equinox framework, it should be ~0.95MB.

Start equinox framework as java -jar equinox.jar -consoleYou would have seen this on a lot of sites. but I did fall on two things flat on my face; missing -console and doing it wrong --console :P

As per the spec, (and by now, you know) a bundle is a jar with some special informtion in MANIFIEST.MF. A Bundle jar need not DO anything. It could just sit installed or be active (by exporting packages and services). So if you have…

Get Nerdy with VLC.

VLC media player gives a few things with less explored Extended Settings. A Webcam (in-built on lappy, prefered) together with VLC can do some pretty nerdy stuff. I cought a collegue by suprise when she walked into my cube saw her self in my laptop movin on my screen. Well.. thats only the beginning of endless uses and other things you can do. (You can even shave without a mirror- Yeah it is so good)

Open vlc. Open Capture Device from the Media(older File) menu.

Select the one for opening the webcam (V4L or DirectShow)For the basic use, just click play. At this point youu should see a vlc window playing what the webcam is capturing.Go full screen (there is your mirror, go ahead shave :)
This is good enough for basic nerd level. Stop here unless you want to get really nerdy :).

Now Open Extended Settings (CTRL+E) from tools.
Go to Video Tab. Play aroound.. Have fun
Examples:
go to Color Fun > Color Extraction > enter 00FF00 and Image modification > Motion Detect.. Coool eh?
Geo…

MANIFEST.MF in Plain Java, EJB, OSGi - catching the drift

While reading about OSGi, I realised how the importance of MANIFEST.MF has grown over time. The once only-a-jar-information file has had its ups and downs. When I was in school, *chapter jar* was an "assignment" / "reference". It wasn't worth a class' time spent on it. Today a whole new technology relies on this humble text file.

Past: Long long ago, in stone age (yeah I am exaggerating), the MANIFEST.MF was auto-generated while jar-ing. More or less it was not used. Well, yeah if you are developing a java application to be distributed to end-users (the jars you used to double click, which are so replaced by jnlpa.k.a WebStart apps now). This file would give a place to specify the class path
Manifest-Version: 1.0 Created-By: 1.4.2 (Sun Microsystems Inc.) Main-Class: com.big.long.package.MyAppMain Class-Path: mod1.jar mod2.jar lib/lib.jarThis will be set when running
java -jar myapp.jarwhich other wise would have to be something like
java -jar myapp.jar -cp al…

Mission OSGi

Finally some time for OSGi.

With release of Spring dm Server, My interest for OSGi got two-fold. Although I did have some close-encounters with OSGi (aah its just a jar called differently - bundle; and MANIFEST.MF drives it all, o I know OSGi), I haven't read into a lot of it. So now, I am diving into it.

To start I picked Neil's blog. He also has a draft of his upcoming book, OSGi in Practice. So It is a good place to start.

That gives me to start a new tag (osgi) :)

Switch (ing) enum (s) in java

Java 1.5 enums are a life saver. There is a small gotcha in thier use especially in a switch statement(More so for a guy coming from hard core 1.4).

When creating an enum reference - you would need to Qualify with enum Type. However, The case labels while switch(ing) on an enum variable will only take enum constant of the *SAME* enum type. And ONLY the constant name. It SHOULD not be QUALIFIED.

Ex: In the following code, The second case label gives a compilation error.

public class EnumTest { enum WeekDays {SUN, MON, TUE, WED, THU, FRI, SAT}; public static void main(String arg[]) { WeekDays r = WeekDays.SUN; switch (r) { case SUN: break; case WeekDays.MON: break; default: break; } } }
There are good advantages here. For one, Refactoring doesnot involve lot of changes. Maintains Typesafety. It avoids a possibility of human error where you are comparing Fruit enums and Vegitable enums. Because they are different :)

44th President of America - Barack Obama

"Yes we can!" - Hope - Change - *United* Stated of America

Now they are - Barack Obama - 44th President of America.

I am proud that I am a part of this. And I consider myself fortunate to be living this moment.

I hope that all this Good Will is converted to Peace, Prosperity for the US and the World. So the next generation is given a better tomorrow.

God Speed!

Slow Login Intrepid Ibex - X is the problem?.

I have upgraded my laptop to the latest Ubuntu (Intrepid Ibex). I was happy to notice My Audio is now working fine. Headphones too :) My flash issue is still open (I think it is in Adobe's Court - and they dont seem to bother) Everything else *looked* fine.

However, on a deeper examination. There is a small issue (not a deal breaker, though). The user login takes a little longer. I looked at the syslog.

There are some noticiably interesting things (All I think it boils down to X11, I may be wrong)
X (crashes? and) is restarted RIGHT before gdm login screen appears. There a log of compiz real segfault-ing
WARNING: gdm_slave_xioerror_handler: Fatal X error - Restarting :0Nov 2 13:02:27 sar-akshaya kernel: [ 6185.471607] compiz.real[5767]: segfault at 2b0021 ip 08055c8c sp bf9ad770 error 4 in compiz.real[8048000+34000] Nov 2 13:02:28 sar-akshaya gdm[5326]: Sigfile not found. After a couple quick screen flickers, login screen appears and after login credentials are entered, for the WH…

Americans! Go and Vote!

There is only a little chance you will find yourself in a more important day in history. And for you americans who can vote, I cant urge you more, Please Vote. If I cant motivate you, May be a cup of Starbucks can!

(I like the way "proudly" is emphasised!!)
Like Linus Torvolds, I can't vote. But make yours worthwhile.