Wednesday, December 26, 2012

How to disable screen blanking on gnome-shell

When watching movies on gnome shell with VLC, the screen blanks out time to time. First it was from the timeout defined in brightness setting panel. But when i disable the screen off setting some how it started to happen with a 10 min timeout again. So when i googled i found out about the below shell extension.
https://extensions.gnome.org/extension/241/yet-another-inhibit-suspend-extension-user-menu/

But this didn't solved the problem as well. But this extension will stop gnome shell from being idle, which will avoid locking your screen. So now it was time to dig more into this problem. After going through various forums i found out that the xserver has a power management mode and a screensaver which will actually turn off the display to save power. And for my surprise this had a default timeout of 10 mints :).

So i did a small modification to the above extension (which i will submit as a patch to the original developer later after some testing), which will execute the javascript statement on disabling screen locking :

Util.spawn(['xset', 's', 'off']);

And on enabling screen locking :

Util.spawn(['xset', 's', 'on']);

What the above "xset s" does is enabling and disabling the screensaver of xserver.

So at least now i have a solution for VLC when watching movies. Hope that this support will added into VLC core soon so that we don't need to have a extra extension installed.


Thursday, December 13, 2012

Gnome shell popup menu problem [Solved]

Well if you are a gnome shell user and using eclipse for development you may have come across this bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=343278. Well some thinks its related to java and some thinks its related to SWT. But my friends its a gnome shell bug or i would say a feature that's not yet implemented :).

My Story:
I was sick of unity because of the slowness and high memory usage which is believe its really unnecessary. Yes Yes i know the memory are cheap these days, but still i don't like to wast my memory unnecessarily.

So i went on searching for a DE that fits my needs, i tried gnome shell but gave up because of this problem.
Then KDE ................ Hmmmmm nop not my choice feels bit odd, may be due to the fact that i was a gnome user for very long time now.
Then i tried Cinnamon, well it was not the one i was looking for either. But for for my surprise it didn't had the right click problem. I knew that cinnamon was a fork of gnome shell and if cinnamon can fix this why not gnome :).

Well i did some search on the cinnamon issue list and came across the following issue https://github.com/linuxmint/Cinnamon/issues/482

Great now its time to find the change that they have done. So i went through the cinnamon commit history to find the changes and end up with the following commits.

https://github.com/linuxmint/Cinnamon/commit/f8c7922777b102dc574bb3695fc649b89879ebab

https://github.com/linuxmint/muffin/commit/9e45c4c8f1cc2f92f266a5f8e1c4e83d4ce70ef1

https://github.com/linuxmint/muffin/commit/0e575275078d4b8b518978448bba60f404b3746d

Now you need to clone mutter and gnome shell code from the gnome git repository. Then you need to create new branches based on the 3.6.1 tag for both the projects.

When appling changes you will need to map some files from cinnamon to gnome shell, muffin to mutter as follows since there are some file name differences.

Cinnamon     : src/cinnamon-global.c
Gnome Shell : src/shell-global.c

Muffin     : src/meta/compositor-muffin.h

Mutter    : src/meta/compositor-mutter.h


Now compile and install the changes. The problem will be solved :). I wonder why gnome shell developers are not considering taking this fix in from cinnamon :(.


Saturday, December 1, 2012

Make firefox blends into gnome 3 shell

Recently i decided to move the gnome shell due the unity being more memory hungry (still not greedy as windows) and slow. Gnome shell was fast for me and responsive that unity. So when i moved to Ubuntu Gnome Remix the default browser was Epiphany. I love the look and feel of it and the maximize mode which removes the titlebars to get more space. But still i miss firefox due to the add-ons I'm used to. So here comes the search for firefox add-on to make it look like Epiphany. i found the following add-ons which did the trick.

https://addons.mozilla.org/en-US/firefox/addon/adwaita/?src=userprofile
Above Gnome 3 add-on will make your firefox looks more like a gnome 3 application with Adwaita theme.






https://addons.mozilla.org/en-US/firefox/addon/htitle/?src=userprofile
Above will hide titlebars when you maximize firefox.






Thanks for generous people who contribute on making those two plugins.

Monday, November 5, 2012

Changing font size of view titles in Juno

If you are running the new eclipse platform which is 4.2 on linux you have already seen that the fonts sizes of view titles are pretty big. To adjust the font size for your prefference you need to edit the following file e4_default_gtk.css which is inside org.eclipse.platform_4.2.1.v201209141800/css. The version number might differ based on the updates you have installed in your sdk. The following entry in the above file needs to be change by providing the font size you would like to have

In above as you can see i have changed the default size to 8. Now save the file and start eclipse. You will have nice view titles which will match to you preference :).

Monday, October 8, 2012

Cloning a eclipse p2 repository

The following commands will help you to clone a eclipse p2 repository if you want to keep a local copy of a remote one.

Below command will clone the artifacts:

eclipse -nosplash -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source -destination


Below command will clone the meta data to same location:

eclipse -nosplash -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source -destination


Below command is optional,  But if there are any missing meta data it will create them for you:

eclipse -nosplash -application org.eclipse.equinox.p2.publisher.EclipseGenerator -source -features /features -bundles /plugins -artifactRepository file: -metadataRepository file: -destinationName "" -append -verbose -ignoreErrors -inplace


Sources :
http://wiki.eclipse.org/Equinox_p2_Repository_Mirroring
http://wiki.eclipse.org/Equinox_p2_Metadata_Generator

Friday, August 31, 2012

Eclipse feature patch not getting installed

Recently i was trying to modify an existing eclipse plugin to make it work with JUNO. The orginal plugin was installed without problem in JUNO but when trying it fails to find some classes since there are API changes in the platform.

So i patch the original plugin with the new API and ran the plugin using eclipse and it works successfully. Now it was time to make it a package so i can install the patch without modifying jar files manually. So i read about how to create a eclipse feature patch which was exactly what i was looking for. So i created the patch and when i try to install it i was getting the following error:
              [patch name] is not applicable to the current configuration and will not be installed.

So what i though was that some thing wrong with the plugins that contained in the feature patch. So i first tried by replacing the new classes in the original plugin jar and changed the manifest to include the new API dependency. And it worked. So now i was sured that my plugin code was not the problem. So i them replaces the original plugin jar with my patched plugin jar and this cause the plugin to disappear. So now it seems some thing wrong with my manifest of my patched jar.
So i went through the manifest of my patched plugin once again and i saw that i have messed with a dependency. The problem was a dependency plugin version was mentioned with a qualifier which actually didn't included in my feature patch. So my patched plugin fails to load because that version cannot be found at runtime. But when i run through eclipse that it works because the dependency plugin project is there in my workspace. Fixing the version solved the problem with the installation and the feature patch was successfully installed.

So for starters with eclipse platform plugin development like me, if you get the above error check you plugin manifest whether it is correct for the target runtime environment.

Thursday, July 5, 2012

Should we unit test legacy code?

This is a more frequent question I hear from my colleagues. Well my answer yes provided that the code will not thrown out tomorrow and the cost of writing will not eat up your budget.

Well there are some challenges to this especially with legacy code.  Well you need to refactore your code so it's mockable in areas you need to mock. I know there are people who says "Don't touch that code if its working." Well aren't you already touching it. What harm it will do if I do bit more changes and refactor the code so that's testable and I can test it and make sure I don't break any thing. Do we need to live with that stinking code forever. The more you modify the more it will stink if you don't clean it today.

Well personally I don't agree with it. If the cost you put today will have good ROI then we should do it. This will secure your legacy code from future modification too.

Well we should consider unit testing as tool that you will use to verify your code you just wrote. if you are following TDD this really easy.

So I wish some day the people who say no to unit testing or people who thinks its a wast of time will find its advantages and power :)

Sunday, April 22, 2012

Updating Nokia E66 on VirtualBox

Well i wanted to update my wife's phone software which is a Nokia E66. I don't have a separate windows installation on my pc since i'm using Ubuntu. So i normally keep a window installation in a VirtualBox vm for emergency cases like this.

Well when i tried to start to update in the Nokia Suite it just switch of the phone which will be in kind of like sleep mode. After some time the Nokia Suite reports the connection is interrupted. Well first i though its some thing to do with the phone. Well then again i though may be i should look at the usb connections available. Because in the Nokia Suite massage it says to restart the phone to try to run the update process again. So that means the phone is not switched off, its in a mode which the user interactions are disabled.

So what i did was, i created a empty filter criteria in the vm usb settings and then start the update operation again. So as soon as the phone screen switch off  for my surprise when i look at the usb device connections i saw some thing like "Nokia ROM .....". So i selected that. This cause the Nokia Suite to show some progress in the progress bar. The easiest way to find out whether your phone is switched it's mode is the usb activity indicator in the VM status bar. If its idle that means the phone has switched it's mode.

So for this phone it switches in the three modes before it restarts the phone. After the restart the phone had the new version of the software and the feature that is stated in the update information. Hope this will be help full for some one who is primarily not running windows but on a OS which can run VirtualBox.

Friday, March 23, 2012

My Git-SVN Experience

Well some time back i started to use Git at my work place so i can share the code with my fellow developers when doing parallel development. The main reason for this is that the code was not ready to be push to our central repo.

Well then i though of giving a try with git-svn so i can create topic branch and work on it, share it and then when things ready, commit it to central repo. But the first thing i saw from my fellow developers was a unhappy face :(.

Well there is a reason for this. Because git have lot of advance functionality which make you possible to do things that you even don't think of. And their alternative commands for same task which make most of people confuse (including me some time back) and using those in wrong places will put you in trouble.

Well i tried git-svn for first time and the cloning of the repo was fine. But it was fine on command line not in the tortiseGit UI. And before committing back to central repo i was force to svn rebase (even though there was no changes in the central repo after i cloned) and dcommit which i guess is bit confusing for some users. It also took a long time to commit a change with few local revisions which got success after retrying for the second time. Even though it was OK with me, but we need some thing more simpler which gets the job done quickly with out the need for going through manuals to find out descriptions of various commands.

So i though to give a try to bzr which also have a svn integration. But that will be in another post :).