Extending Nautilus with Scripts

Nautilus is the default file browser we get with Gnome. Today I found out about wonderful feature of it. We can very easily extend Nautilus functionalities by adding our own custom scripts.  These scripts can be any executable file like shell script, python script or even C/C++ program.  You only have copy your scripts to
~/.gnome2/nautilus-scripts
We can get information such as current directory path, selected files using environmental variables set by Nautilus. Full set of variables are as follows.
  • NAUTILUS_SCRIPT_SELECTED_FILE_PATHS -lists the paths of the currently selected files, separated by newlines. Works only on local filesystem.
  • NAUTILUS_SCRIPT_SELECTED_URIS - contains the URIs (file://file) of the selected files, separated by newlines. Works on both local and remote filesystems.
  • NAUTILUS_SCRIPT_CURRENT_URI - contains the URI of the current directory. Works for both local and remote filesystems.
  • NAUTILUS_SCRIPT_WINDOW_GEOMETRY -provides the window location and geometry of the browser window.
Nautilus also passes list of selected files as args to your script.  So we can use them to do what ever processing we want to do.

This is a simple script that will prompt all selected files in a message box.

#!/bin/bash
#Author: M.A.C.Sandarenu http://sandarenu.blogspot.com
for arg
do
fileList="${fileList}${arg}, "
done
zenity --info  --text="You have selected following file(s) ""$fileList"
 

CrossOver Rocks.....

I managed to grab a copy of CodeWeaver's CossOver software using their 28th October promotion campaign. For those who don't know about CodeWeaver, they are the people behind the FOSS project wine which enables users to run windows applicaiton on their Linux boxes. CrossOver is commercial counterpart of the wine. The gave away $70 worth CrossOver Professional version for free on 28 Oct as a pomotion.

I Installed Microsoft Office 2007 on my Fedora 9 box using CrossOver and it works fine. I managed to install Word, Excel and Powepoint, but had problems with installing Visio.

Unfortunately CodeWeaver's aren't going to do this kind of promotions in near future. So you'll have to use Wine if you didn't managed to grab a copy on 28th Oct.










 

I'm Back after some time.....

During last few days I was unable to do any blogging simply because I was too busy with my work at hSenid. I just started my first job at hSenid 1st of October and It was really wonderful. On the first day itself I was put in to a really challenging project. I had to learn lot of new technologies such as JSLEE, SMPP, JMS, JMX, AOP and so on...
I'd learnt lot of new things and I'll hopping to share with you all as I get some free time :)
 

HTML Signatures for Your Favorite Webmail Services

Today I got to know about wonderful Firefox add-on called WiseStamp. It allows you to add nice HTML signatures to popular webmail services like Gmail, Yahoo, Live mail and AOL mail. This was a add-on I waited for long time. Some time ago I used Greasemonkey script to add HTML signature for Gmail. Now with WiseStamp I can use common set of signatures for all my webmail accounts.

Give it a try, You'll love it.
 

7 Years of Excellence - Faculty of Information Technology, University of Moratuwa

[Press release from FIT anniversary celebration committee]
 
The Faculty of Information Technology (FIT), University of Moratuwa which was established in year 2001 is the only faculty of its kind, producing pioneers to the ever growing IT industry in Sri Lanka. With the rapid growth and expansion of the information technology, FIT provides immense service to the nation by creating highly skilled IT professionals to bridge the gap between the demand and supply of IT personnel in the industry.

Despite the lack of adequate resources, both physical and human, the Faculty commenced its academic activities with a batch of 47 students in 2002. Its first home was a rented facility at Borella. The intake was increased to 100 in 2005 in response to the steadily increasing demand by the IT industry and also to provide more opportunities in this field to the talented youth of the country.

Though a fledgling faculty, FIT started its first postgraduate program in IT in 2004 with the PG Diploma/M.Sc. in Information Technology. In August 2008, the Faculty launched another postgraduate program, the PG Diploma/M. Sc in Artificial Intelligence (AI). This is the first postgraduate programs of this kind in Sri Lanka. The faculty also conducts several professional development programs from time to time. The FIT will continue to develop and expand its academic programs, adapting to the ever-changing needs of the IT industry to become an entity which both the students and the industry would look up to.

A landmark in the faculty's march towards progress is the completion of the first phase of a new state of the art building complex at the University of Moratuwa premises in August 2008. To celebrate this occasion and 7 years of excellence in the field of IT education, the Faculty will hold a series of events comprising of a multi religious ceremony, a symposium and a cricket tournament, followed by an exhibition of student innovations.

An academic conference on the theme "Graduation, Entrepreneurship and Success", will be held on 27th September 2008 at the new faculty premises with the participation students, alumni, members of the staff and industry representatives. Lead by a distinguished panel of resource persons, this conference is intended to provide students with the opportunity to experience through role models and success stories, how they can make a success of their careers in many different ways after graduation. The objectives of this symposium can be further elaborated as:

  • To create a culture of entrepreneurship among the students.
  • To learn through the experience of accomplished entrepreneurs.
  • An opportunity for the students to interact with the industry leaders.
  • To create better awareness among the corporate community about the Faculty of IT.
  • To establish links with the industry to emphasize the value and recognition of the Faculty as a leading educational body.
  • To broaden the knowledge of students on new trends in the IT industry

Among the distinguished resource persons at this event will be Mr.W.K.H Wegapitiya, CEO of Laugfs Holdings Limited, Dr. Sanjiva Weerawarana, Chairman & CEO of WSO2, Mr. Mohamed Azmeer, CEO of ConceptNursery, Mr. Ramesh Shanmuganathan, Group's Chief Information Officer, John Keels Holdings, Mr. Harsha Purasinghe, CEO of Microimage (Pvt) Ltd and Peter De Almeida, CEO of e-nable (Pvt) Ltd.


The event will conclude with a get-together at which all students past and present, will come together to celebrate the inauguration of the Faculty's new home. They will be joined by the industry representatives to create an enthralling atmosphere of celebration and entertainment.
 

Error on launching Tomcat from Eclipse in Fedora 9

Last few days I was doing some self learning on Servlets and JSP.  After doing few examples using Text Editor, I wanted to see how to create dynamic website using Eclipse; my favourite IDE. I followed the instructions given in a article in IBM site. But when I try to start the Tomcat server from Eclipse I got an strange error.

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/logging/LogFactory



I didn't have a clue about this error. As usual Google save my day. I found this post regarding the same error by Greg Johnson.

In order to solve this problem you have to download the Apache commons 1.1.1 and copy commons-logging-api-1.1.1.jar to /usr/share/tomcat/bin folder.  After copping that jar I was able to start Tomcat from Eclipse without any issue.

Thanks Greg, you save my day :)
 

End of a Beginning....

graduate

It seems yesterday that I first walked into the university, yet 4 and 1/2 years have passed. Exams of my final semester at university finished yesterday :)

It was a wonderful 4 1/2 years at FIT. I take this moment to Thank all academic, non-academic staff and my batch mates at Faculty of Information Technology, University of Moratuwa for guidance and support they gave me during all these years.

Next step of my journey begins 1st of October as a Software Engineer at hSenid....

 

Firefox on Fedora - No sound on Flash Videos

I recently shifted to Fedora from Windows XP. In Fedora it did not give sounds when I was watching flash videos such as from YouTube in Firefox. It was a big problem for me. But after some research I found out that it is due to not installing a dependency library 'libflashsupport' with Adobe Flash plugin. Fixing this problem is very simple, just insall that library using yum.

yum install libflashsupport

After intalling it I got the sounds. :)
 

Reading Excel Date fields from Java

Previously I posted on how to read data from Microsoft Excel file using Apache POI HSSF. This is a small addition to that.

If the Excel file you are to read is using 'Date' fields, then you have to be little careful about it. In HSSF these Date fields are taken as numeric fields. Anyway that is how Dates are handled in Excel; it uses an Integer to keep number of days since 1900-Jan-0. Luckily the there is a small utility provided by HSSF to covert these Execl Dates to Java Date format. Just use HSSFDateUtil.getJavaDate(double) method.


//Date of Birth
HSSFRow row = sheet.getRow(ROW_C_DOB);
//Handle Excel Date type cells
HSSFCell cell = row.getCell(COLUMN_DATA);
if(cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC)
{
  Date d = HSSFDateUtil.getJavaDate(cell.getNumericCellValue());
  client.setBirthDay(d);
}
else
{
  String tmp =    row.getCell(COLUMN_DATA).getRichStringCellValue().toString();
  client.setBirthDay(Util.getDate(tmp)); 
} 
 

Getting Started with OpenCV

Finally our final year project is finished. As I've promised in my previous post I'm going to do few posts on OpenCV. In this post I'm going to tell you how to configure MS Visual Studio 2005 to work with OpenCV library. 

Step 1: Installiny OpenCV

First you have to download the OpenCV library from Sourceforge and run the installer. It will install OpenCV library on your computer. By default it will be installed to "C:\Program Files\OpenCV". Installer will add "C:\Program Files\OpenCV\bin" to system's PATH variable. But sometimes this do not happen properly. In such cases you'll have to add OpenCV bin directory manually to the system's PATH.

OpenCV installer

Download OpenCV: http://sourceforge.net/projects/opencvlibrary/

Step 2: Configuring VS 2005

In order to use OpenCv from VS you have to add libraries and header files to projects path. Create Win32 Console Application in VS 2005. Then right click the project form the Solution Explorer and select Properties.

project properties

Under "Configuration Properties -> C/C++ -> General" put following folders to "Additional Include Directories".

C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\cv\include\
C:\Program Files\OpenCV\cvaux\include
C:\Program Files\OpenCV\otherlibs\highgui

set include directories

Then under "Configuration Properties -> Linker -> Input" put following folders to "Additional Dependencies". Add them line by line with double quotes.

"C:\Program Files\OpenCV\lib\cv.lib"
"C:\Program Files\OpenCV\lib\cvaux.lib"
"C:\Program Files\OpenCV\lib\cxcore.lib"
"C:\Program Files\OpenCV\lib\highgui.lib"

set linker dependancies

Sometimes it is possible that you don't have above lib files in "C:\Program Files\OpenCV\lib" folder. In such situations you just have to compile the OpenCV solution.

It is also possible for you to get complains regarding corex100.dll (it can be corexXXX.dll) when running your OpenCV application. If you get such error build the OpenCV solution and check whether the "C:\Program Files\OpenCV\bin" folder is in your system PATH, if not you either have to add that to the path or copy all the DLLs in bin folder to C:\WINDOWS\SYSTEM32 folder.

opencv solution

So that basically what you have to do to configure VS2005. You can check whether you have configured the VS correctly by compiling and running some sample applications in the "C:\Program Files\OpenCV\samples\c" folder. So have fun with OpenCV.

 

Back to Firefox 2

It's being nearly a month or so I've started using Firefox 3 browser. Yes it has lot of cool new features such as new address bar. But I'm having a big problem with new FF3. It is giving me "Network Timeout Error" all the time.

FFtimeout

I have to do multiple refreshes to view the page, and if the page is having lost of images than those are also not loaded.  But when I checked the same site with IE, it loads the page correctly and without any issues.

When I searched the Google for this issue I found that FF3 is having some issue related to this Timeout problem. http://wiki.mozilla.org/Firefox3_Timeout_Problem

So until a fix is available I'm going back to good old FF2.

 

Gmail Provides Remote Sign Out and Tracking of Account Activities

If you are using Gmail this may the security feature that you were looking for ages... Now Google let you monitor your account activities and Sign out remotely. This is very good news for people like me because I access gmail from multiple computers, including from the computers at university labs.  Read more about this from

Gmail Blog >>>

gmail_Remote_Signout1

gmail_Remote_Signout2
 

All-in-One Media Converter

 FormatFactory is a free application that can convert video, audio and images in to different file formats. It also supports batch file conversion as well. As reported by DownloadSquad is seems to be really good application. FormatFactory

 

OpenCV - Computer Vision Library

OpenCV is an open source computer vision library developed by Intel. This library is written in C/C++ and it has lot of very powerful image processing features.

I got to know about this library few months back when I was doing researches for our final year project. Our project "Sign2Voice" interprets signs of sign language to voice in real time using a video captured using simple webcam.

OpenCV has rich image processing API that that provides wide range of functionally ranging from simple image processing tasks to machine learning algorithms.  In our project we uses OpenCV library to detect and identify sign language hand gestures. We uses Haar-Cascade classifier provided with OpenCV to detect hand. After training the classifier with set of positive and negative images we can use the classifier to detect objects. OpenCV has a good trained classifier for face detection.

Training of Haar-classifier is not an easy task. This became especially difficult because there is nor proper documentation for this process. Their are few web sites that give instructions on how to train, but they are not that comprehensive.

We had to do lot of experiments and learn through trail and error to find out how to do the training properly. After lot of failures we managed to achieve good results in had detection. 

hand_detect hand_detect1

 

I'm planning to do some posts regarding how to train haar-classifier share the knowledge I gained with you in future. So keep you figures crossed. :)

 

Artificial Neural Networks for Solving Complex Problems

I just completed my independent study review paper. As the title suggests, it was about "Using Artificial Neural Networks to Solve Complex Problems". If you haven't heard about neural networks before, they are a new approach for solve problem inspired by inner workings of human brain. In traditional computing we have to give step by step instructions on how to solve specific problem to the computer. But in ANN that is not necessary, they can learn how to solve a particular problem from samples.

ANN technology is not a new thing, they exist since 1940s. When I first started this study, I thought that ANNs are only used for pattern recognition/classification and predicting some factors. But when I go more deeper in to the research, I was amazed by the diversity of fields where ANN is used. Most of the applications I came across during my review were successful in achieving their goals, but in field of cryptography use of ANN was not as successful as other fields.

Even though ANN technology is very successful in solving complex problem they have their own set of limitations. Major limitation is it's lack of ability to explain how they generate output. Another main limitation is not having formal method to find optimal network architecture for solving particular problem. But even with these limitations, future of ANN looks promising. There is lot of research going on in dedicated ANN hardware and hybrid ANNS. 

You can download my complete review paper here. Hope this will help you to learn more about ANN and it's applications.

 

A Picture is Worth More Than Thousand Words

This picture tells the whole story....ATT1135779

 

Being Punctual....

Well, what do you think about this....being punctual?

I’m not sure about you, but I hate people coming late and not doing things on time. Especially in here most of the people don’t take this seriously, they never come on time. As an undergraduate I have seen lot of my batch mates coming to lectures, group meetings late. They are the most selfish people; they don’t think that they are wasting time of others. As professionals I think we should learn about how to do time management and being punctual.

I found these two articles at lifehack about the importance of being punctual and most importantly how to do that. Hope this will encourage you to be punctual...

 

සාමයේ පහන් දැල්වෙන, සුභ වෙසක් මංගල්‍යයක් වේවා - Have a Peaceful Vesak

vesak-card-2

 

University of Moratuwa is the 1st in Top 10 Universities for Google Summer of Code 2008

Few weeks back I posted about that Sri Lanka being among the top ten counties in Google Summer of Codes 2008. But there is more good news. This time among top 10 universities. I'm very proud to see that University of Moratuwa(UOM) is the 1st among top 10 universities. This is a BIG BIG achievement for us.

Congratulations to all my friend at UOM.  

 

image

image

Read more about this....
 

Sri Lanka among Top 10 for Google Summer of Code 2008

Sri Lankan academic community is making its name more and more visible in the global arena. I saw this in the Google Open Source Blog which list out the top 10 countries at Google Summer of Codes 2008. It is very happy to see that Sri Lanka is among the top in both applicants and accepted project vise. 

image

image

See the full blog post at Google Open Source Blog...