My Ubunut was giving me problems starting up yesterday. After investigating for a while, I figured that it was due to corrupt reiserfs on /var So I set to fix the problem by running reiserfsch --check on my /var partition. I rebooted Ubuntu in Recovery Mode. To My surprise, I could not do fsck on my /var as it was mounted and some applications seemed to be using it. I always thought that Recovery Mode does not boot the installed kernel instead it boots an alternate image. This was merely a misconception.
Now with no Ubuntu live CD I could virtually not solve the problem! So I thought about tricking my Ubuntu. I edited my /var/fstab, commented out the mount /var and rebooted my machine. Now the /var was not mounted and I could run fsck on that partition. Some applications did complain about missing files etc. but it at least allowed me to run fsck on my /var partition. After fixing problems by doing reiserfsck --rebuild-tree I removed the commented line from fstab, mounted /var and switched to runlevel 5 and my Ubuntu is back fixed again
How I tricked my Ubuntu
on
Tuesday, December 29, 2009
Labels:
reiserfs
,
ubuntu
,
ubuntu crash
0
comments
Runnable jar using maven assembly plugin
on
Thursday, December 03, 2009
Labels:
fat jar
,
maven
,
one jar
2
comments
I faced a nagging problem of not able to create a runnable jar using Maven assembly plugin. I had a couple of dependencies which were required at runtime. I used the jar-with-dependecies assembly to achieve this. But my Main-Class attribute from the MANIFEST.MF was lost every time.
The solution to this problem is archive configuration under assembly plugin as described here
The solution to this problem is archive configuration under assembly plugin as described here
One thing I miss from KDE
on
Friday, October 09, 2009
Labels:
gnome
,
kde
,
ubuntu
0
comments
About 6 months back I migrated to Ubuntu from OpenSUSE. I explicitly did not choose Kubunut as I did not really like KDE 4. It actually sucked! Before that my default window manager was always KDE and I thought about GNOME being lame. But not anymore!
There were a number of things that I missed from KDE most of which had alternatives in GNOME. But I still miss the cool feature of KDE where you could just open the "Run Dialogue" (Alt + F2) and use it as a simple calculator. You could say type "2*2" and press enter. It would do the calculation and show you the output instead of starting any application.
Havent found an alternative to that yet in GNOME!
There were a number of things that I missed from KDE most of which had alternatives in GNOME. But I still miss the cool feature of KDE where you could just open the "Run Dialogue" (Alt + F2) and use it as a simple calculator. You could say type "2*2" and press enter. It would do the calculation and show you the output instead of starting any application.
Havent found an alternative to that yet in GNOME!
Common we are in 2009! Use an IDE!!
Labels:
Java
,
Java coding conventions
0
comments
I have seen a number of people using a naming convention of prefixing letter 'I' to names of any interfaces in Java like IHuman, IMonster. This was a very famous and essential practice about a couple of decades ago (I believe. Not that I am soo old!) I remember reading about prefixes like "lpstr" indicating that it is a "Long Pointer to the String". But all this was followed in C and C++. It was important at that time since the languages were not type safe and there were no mature IDE's. It would be easier to recognize that this pointer is to this this type of variable etc. which would prevent a lot of silly mistakes too. Seems like a few people with inclination towards Microsoft standards in .Net still like it and recommend it.
Personally I think we are in year 2009, I use IDE (Eclipse) for development and I have never needed to really see 'I' prefixed to an interface. It adds very less value. Only thing you can accidently end up doing is say do new Interface(); but your IDE will complain the very next moment anyway. I can always see what methods I can call by simply typing '.' In case I have any doubts. I generally use F4 to see hierarchy which will clearly show me that it is an Interface by coloring it purlple or I would directly F3 to get into code to see whats there.
People who still follow this beautiful practice, I am sorry but I absolutely hate it! for others, keep your Alt + Shift + R ready ;)
Personally I think we are in year 2009, I use IDE (Eclipse) for development and I have never needed to really see 'I' prefixed to an interface. It adds very less value. Only thing you can accidently end up doing is say do new Interface(); but your IDE will complain the very next moment anyway. I can always see what methods I can call by simply typing '.' In case I have any doubts. I generally use F4 to see hierarchy which will clearly show me that it is an Interface by coloring it purlple or I would directly F3 to get into code to see whats there.
People who still follow this beautiful practice, I am sorry but I absolutely hate it! for others, keep your Alt + Shift + R ready ;)
Environmental variables, Maven and Eclipse
on
Tuesday, October 06, 2009
Labels:
eclipse
,
maven
1
comments
If you use m2eclipse for building Maven projects in Eclipse, there are some issues while building projects having variables defined which refer Environmental Variables.
Some of our developers came out with an idea of replacing the value locally to point to the directory on their machine like
This lead to numerous incidents where developers checked in the hard coded path for this variable in our code repository, which lead to failed builds on our Hudson.
A better way to manage this is using profiles. You can create a profile in your settings.xml which resides under .m2 directory in your home directory on Linux (not sure where on Windows). Example profile configuration is as follows,
Now you have a profile named eclipse which points to the absolute path for the varialbe appserver.home.
Now checking out / importing a maven project you can specify profile as eclipse. Or in an already checked out Maven project (note that the project needs to be checked out as Maven Project. Same thing will not work on simple java projects even if they use maven), go to project properties -> Maven and set the profile to "eclipse" (the same as id parameter in your settings.xml)
Now what this does is when you make build from eclipse, it uses the profile "eclipse" and resolves the variable to the right value. Advantage of this approach is that you do not need to change pom.xml of the project so it avoids the problem of checking in the hard coded values by mistake.
<properties>
<appserver.home>${env.APPSERVER_HOME}</appserver.home>
</properties>
Some of our developers came out with an idea of replacing the value locally to point to the directory on their machine like
<properties>
<appserver.home>/home/developer/software/appserver/</appserver.home>
</properties>
This lead to numerous incidents where developers checked in the hard coded path for this variable in our code repository, which lead to failed builds on our Hudson.
A better way to manage this is using profiles. You can create a profile in your settings.xml which resides under .m2 directory in your home directory on Linux (not sure where on Windows). Example profile configuration is as follows,
<profiles>
<profile>
<id>eclipse</id>
<properties>
<appserver.home>/home/developer/software/appserver</appserver.home>
</properties>
</profile>
</profiles>
Now you have a profile named eclipse which points to the absolute path for the varialbe appserver.home.
Now checking out / importing a maven project you can specify profile as eclipse. Or in an already checked out Maven project (note that the project needs to be checked out as Maven Project. Same thing will not work on simple java projects even if they use maven), go to project properties -> Maven and set the profile to "eclipse" (the same as id parameter in your settings.xml)
Now what this does is when you make build from eclipse, it uses the profile "eclipse" and resolves the variable to the right value. Advantage of this approach is that you do not need to change pom.xml of the project so it avoids the problem of checking in the hard coded values by mistake.
Spell check under Openoffice
Labels:
Linux
,
openoffice
1
comments
Are you unable to do auto spell check in the OpenOffice applications? To make it work, you need to go to the application (oowriter, oocalc etc) menu, go to Tools -> Options -> Language Settings -> Languages and set the "Default language for the documents" to something standard. In my case "English (USA)" just worked fine.
Reliance Netconnect on Ubuntu
on
Friday, October 02, 2009
Labels:
netconnect
,
reliance
,
ubuntu
2
comments
I am absolutely delighted as I write this post. I am using Reliance Netconnect on my Ubunut 9.04.
And if you are under impression that it was achieved after hours of googling, trial and error and after running hundreds of commands, then you are wrong.
To get it working,
And if you are under impression that it was achieved after hours of googling, trial and error and after running hundreds of commands, then you are wrong.
To get it working,
- Plug in the dongle.
- Wait till the network manager applet menu shows "Auto Mobile Broadband (CDMA) connection"
- Best way to make it work is to select the "Auto Mobile Broadband (CDMA) connection" and let it figure out the settings
- After step 4, it tries to establish connection but obviously fails since the user and password are not provided
- Now, right click on the network manager applet and select edit connections.
- Go to "Mobile Broadband" tab
- Now there is already a configuration created named "Auto Mobile Broadband (CDMA) connection"
- Edit that configuration and add your user name and password.
- Now connect like in step 8 by clicking on Network manager applet and selecting the "Auto Mobile Broadband (CDMA) connection"
- Enjoy high speed mobile broadband on Ubuntu!
Annoying system beep under Xubuntu 8.10
on
Tuesday, April 14, 2009
Labels:
Linux
,
xubuntu
0
comments
If you face a problem of getting an annoying system beep at startup / shutdow and any other actions under xubuntu 8.10, the only solution is to blacklist the pcspkr module.
edit the /etc/modprobe.d/blacklist file as root (sudo) and add line,
blacklist pcspkr
Although the changes will apply only after you reboot the machine, you can do
sudo modprobe -r pcspkr
This will remove the pcspkr module and disable the annoying sound
edit the /etc/modprobe.d/blacklist file as root (sudo) and add line,
blacklist pcspkr
Although the changes will apply only after you reboot the machine, you can do
sudo modprobe -r pcspkr
This will remove the pcspkr module and disable the annoying sound
Setting default alarm for events in Lightning (Thunderbird Calendar)
on
Sunday, April 12, 2009
Labels:
Lightning
,
thunderbird
0
comments
With new Lightning version 0.9, I had started facing a problem where if an event was created or sent to me by someone, which did not have default alarm set, there wont be any alarm going off before the event.
It was probably my sheer laziness that I never really looked for an option for this, If you are facing a same problem here is how to fix it,
go to Edit -> Preferences -> Lightning -> Alarms and set the "Default alarm setting for events" to "On"
It was probably my sheer laziness that I never really looked for an option for this, If you are facing a same problem here is how to fix it,
go to Edit -> Preferences -> Lightning -> Alarms and set the "Default alarm setting for events" to "On"
Problems with Thunderbird calendar after Thunderbird upgrade
Labels:
Linux
,
thunderbird
,
ubuntu
0
comments
If you are not able to see the calendar data after upgrading your Thunderbird, specially after upgrading your linux version, the problem can be solved by installing libstdc++5.
I recently upgraded to Xubuntu 8.10 from OpenSUSE 10.3 (late but worth it) and after importing my mail data, I could not see the calendar. The Thunderbird version I used before was 2.0.0.6 and the new version was 2.0.0.17. I tried installing the lower version (in /opt keeping the prebuild version) and it complained to start. It complained about missing libstdc++5.so after I installed that (sudo apt-get install libstdc++5) all worked fine.
After a bit of googling that the problem with latest version is that it is dependant on libstdc++6 whereas the calendar plugin is dependant on libstdc++5 (I am using Lightning version 0.9 which presumably is the latest)
I recently upgraded to Xubuntu 8.10 from OpenSUSE 10.3 (late but worth it) and after importing my mail data, I could not see the calendar. The Thunderbird version I used before was 2.0.0.6 and the new version was 2.0.0.17. I tried installing the lower version (in /opt keeping the prebuild version) and it complained to start. It complained about missing libstdc++5.so after I installed that (sudo apt-get install libstdc++5) all worked fine.
After a bit of googling that the problem with latest version is that it is dependant on libstdc++6 whereas the calendar plugin is dependant on libstdc++5 (I am using Lightning version 0.9 which presumably is the latest)
Time measurement accuracy in Java
on
Friday, February 06, 2009
Labels:
Java
,
performance
0
comments
An interesting article about time measurement under Java
http://www.simongbrown.com/blog/2007/08/20/millisecond_accuracy_in_java.html
Beware if you are doing any performance measurements on Windows.
http://www.simongbrown.com/blog/2007/08/20/millisecond_accuracy_in_java.html
Beware if you are doing any performance measurements on Windows.
java.library.path and LD_LIBRARY_PATH
on
Friday, January 09, 2009
As everyone might know, you have to set the java.library.path system property for making sure that you can load some JNI libraries in your java application. But often it wont be enough for you to specify java.library.path. The libraries which are referencing other shared libraries, would depend on standard way to resolve the libraries. Which means that if you have a foo.so which you are trying to load in your Java application, and foo.so references or is dynamically linked to bar.so, foo.so will look for the bar.so using the LD_LIBRARY_PATH.
java.library.path only works to resolve the immidiate native library that you are loading in your code. Loading of the other dependent libraries is left to the first library. The JNI library that you load will rely on the OS dependent way to resolve its references.
The catch is that, you will have to provide both java.library.path and LD_LIBRARY_PATH in such case for the libraries to load successfully. So its reliable to depend on the OS dependent way (LD_LIBRARY_PATH) of loading library files than java.library.path system property.
java.library.path only works to resolve the immidiate native library that you are loading in your code. Loading of the other dependent libraries is left to the first library. The JNI library that you load will rely on the OS dependent way to resolve its references.
The catch is that, you will have to provide both java.library.path and LD_LIBRARY_PATH in such case for the libraries to load successfully. So its reliable to depend on the OS dependent way (LD_LIBRARY_PATH) of loading library files than java.library.path system property.
How to get the byte array Class instance?
Have you ever wondered how you can get handle to the Class instance for bye array (byte [])? Its easier to get handle to instances of other primitives like Integer by just doing Integer.class. I don't know if there is any better and standardized way to do it, but I just did (new byte [0]).class.
Any one knows a better way?
Any one knows a better way?