Friday, June 15, 2012

OpenGrok : Installation Guide

Hi Guys,
Here is one more useful post for Linux users who use grep to search strings or references in huge code-base.So here it is
Prerequisites :
1. jdk 1.6 + version
2.  tomcat 6 + version
3. exuberant-ctags
I will suggest that become root user (using sudo -s) so that you don’t need to give sudo prefix and then type the password every time you want to run any command. One line command to install all of these :
apt-get install sun-java6-jdk tomcat6 tomcat6-admin exuberant-ctags
4. Download the opengrok-0.8.1 from the site.
Steps:
1. Extract the downloaded package.
2. Create a directory structure like follows
  • mkdir /opengrok
  • mkdir /opengrok/bin(this will contain all lib file and jar file)
  • mkdir /opengrok/data ( this will contain the index data).
3. Go to extracted opengrok directory and run following commnad
  • cp -r run.sh opengrok.jar lib /opengrok/bin
4. Go to /opengrok/bin, open the run.sh file and Edit it in the following way
  • modify SRC_ROOT = /path/to/your/project/directory
  • modify DATA_ROOT = /opengrok/data
  • modify EXUB_CTAGS = /usr/bin/ctags (this is default location for ctags, you can verify with ur system if it doesn’t exist there)
5.  Go to extracted opengrok directory, and create one folder called source
  • mkdir source
  • cd source
  • unzip ../source.war
6. open WEB_INF/web.xml file and add the following code and save it
DATA_ROOT/opengrok/dataREQUIRED: Full path of the directory where data files generated by OpenGrok are stored
SRC_ROOT
//path/to/your/source/directory
REQUIRED: Full path to source tree
SCAN_REPOS
false
Set this variable to true if you would like the web application to scan for external repositories (Mercurial)
Here one more thing you do check for CONFIGURATION tab and in that please check the path of opengrok configuration file. The path should be same as the correct location of that configuration file.
7. Again zip the code
  • cd source
  • zip -r source.war ./
8. Now finally we need to start indexing, so just go to /opengrok/bin folder and give the following command
  • java -Xmx1524m -jar opengrok.jar -W /opengrok/configuration.xml -P -S -v -s  /path/to/your/source/directory  -d /opengrok/data
9.  After indexing completes, you have to modify the admin rights for apache so that you can manage it, So open /etc/tomcat6/tomcat-users.xml and add the following line


10. Now your setup is ready, you just need to deploy the source.war you created earlier. for that follow these steps
  • http://localhost:8080
  • click on manager webapp or directly open the link [http://localhost:8080/manager/html]
  • give username “admin” and password “admin”
  • There is a option in that page called Select War File to upload, there click Browse button and give the path for your source.war file.
  • And finally click on Deploy.
  • After Deploy is complete in List of Application on the same page, you can see /source click on it. And you have just completed the installation. you can see the opengrok home page.
11. If you are getting the permission denied error then add the following code in /etc/tomcat6/policy.d/50local.policy
grant codeBase "file:${catalina.base}/webapps/opengrok/" {
     permission java.security.AllPermission;
}; grant codeBase "file:${catalina.base}/webapps/opengrok/WEB-INF/lib/"; {    permission java.security.AllPermission; };
Thanks for Vincent Liu for his wonderful post which helped me a lot.

Tuesday, March 6, 2012

When to use the workqueue in driver code / What is workqueue

Hey guys,
Here is one more post about kernel, As I am going through Kernel code, I feel this doubt. Theoretically it is assumed that workqueue increased the performance. As you are allowing the interrupt to be enabled. So it means you are ready to handle another interrupt while putting the previous interrupt handler code in workqueue.
But is it a good way to put all the interrupt handler code in the workqueue function, The Answer is NO. Why ? To be part of my belief first you have to understand the basic functionality of workqueue. Linux Kernel developer came with this concept, because they want to reduce the overhead of unnecessary execution of code at the cost of performance(As no other interrupt will be allowed during that time). So what they do is, they divided the functionality in two parts, crucial part and the normal part. With this approach they decided which code should be executed before enabling the interrupt and which part should be executed later.
In summary,what developer should do is, decide the importance of the code in terms of functionality and performance and accordingly put the rest of the Not-so-Crucial part in the work function.
Hope it will help.

Thursday, March 1, 2012

Difference between schedule_work() and queue_work()

Hi Guys,
If you are newbie in Linus Kernel, you may have this doubt that what is the difference between these two methods,basically it is related to the choice that whether you want a dedicated workqueue(which in turn will need dedicated kernel thread) for your driver or you just want to use the default workqueue provided by kernel.
So if you want to control the workfunction in terms of scheduling independently,
you should go for create_workqueue method to create a workqueue. This function will create a workqueue and which in turn will create a seperate Kernel Thread on each and every processor available. Here I would also like to introduce a different version of same method which iscreate_singlethread_workqueue(), you should use this function only when you want to create only a single thread for all the processor.

Monday, February 20, 2012

Android: Push Platform logs in Kernel logs

Hi all,
Its good to write a new post after a long long time. So here I am with a very useful post about the debugging. Sometimes debugging your application could be a problem, when you don’t know whether this issue is because of platform code or kernel code. Specifically I must say, you will feel this scenario when you have to measure some time, and you need to decide whether this is coming from the kernel side or platform side. But as platform and kernel code uses different type of time-stamp, it is almost impossible to debug. So for that there is one command in the adb itself. Here are the steps :
1. Go to adb shell.
2. Type “logcat -f /dev/ksmg”
3. just use dmesg or cat /proc/kmsg to see the complete logs.
Here is one prerequisite, your phone should be rooted. otherwise you won’t have permission to the above steps. I hope it will help you.

Monday, January 23, 2012

Friday, December 23, 2011

Trip to St Marry's Island and Udupi


Hi there,

Here I am with one more travel blog, Must say one of the hectic but memorable trip to Udupi. So here are the details.

How to Go 
Udupi is around 62 Km from Mangalore, which is the nearest Airport from here. Although it is very well connected to other cities through Railway as well as Buses. As I am staying in Bangalore, so I go through the Car. By Road it is around 450 Kms from Bangalore, which takes around 10-12 hrs to reach Udupi. Inspite of the long distance, you will enjoy the ride, as this road passes through Western Ghats, which gives you the closure to nature. Must say, awesome beauty and road is also good.

Where to Stay
There are many hotels, lodges near by the Udupi main city. And if you are interested in staying beach resort that is also there. Better you book your accommodation in advance. As it is not very far from the Mangalore, many people prefer to stay in Mangalore too, because there you will find more and better option. But I will suggest you to stay in Udupi itself.

What to Visit
Basically there are two places mainly for which people come here, one is the Krishna Temple and second is island(beach too).Udupi Krishna Temple is very old temple and quite popular too in the region. Although the old temple is not that big, but in that small space itself you will good architecture. Location wise it is situated in the centre of city. So even if you are there for leisure, visit this place too as it is must go place for Udupi.    
                   Second and main place is the St Marry's Island, the story behind the island is, when Vasco da gama first came to India, first he reached here, put a cross as a mark, which in turn gives this place the name "St Marry's island". To go this island, first you need to go to Malpe Harbor, there is Ferry service available to the island. From here real journey starts, I must say this is one of the most beautiful beaches I have ever seen, water is so clean, clear sky, and if you are lucky you will see few dolphins too. it takes 30 mins to reach the island, but you will enjoy each and every minute. Even though area wise it is very small, but it is good, as one side of beach have sand all over, while other have rocks, and did I mention the water clarity(:P). You can sit, roam around, play or whatever you want to do with that place. Just try to be there early, so that you can stay there for atleast 4-5 hours. And remember, last ferry will start from island at 5 PM.
                   After coming from island, you can go to the beach which is known as Malpe beach, although it is not good to take bath as so much sand and salt is there in the water. But you can spend hours just sitting there and watching sun set. And must say white sand has its own charm. I like it.

When to go
As Udupi's weather is same most of the time of year, just avoid the rainy season. Rest of the time you can go. And one more thing it is really hot in the day time, so be ready for sun burn.

Others
You will get proper and all kind of food in Udupi, but be sure what you are eating, as sometimes they serve very weird things with fancy names. And you won't find anything at the island, so if you are planning to stay for long hours, just take drinking water and some snacks too. Apart from that I don't think anything else is required. If anything required it will be your part of experience, your stories to share with others.

Monday, November 7, 2011

SystemProperties in Android: Use them in Framework c files

Hi all,
Here I am with one more android blog. We generally used Sharedpreferences in Android to share information between Activities. But what if you want to have something at the time of boot. For that there is one solution which is systemproperties, using those you can share information or values at the time of boot. So for example if you want to save some settings by user, which should be applicable at the time boot. So do following
SystemProperties.set(String key, String val) // where key is name of property
Now to retrieve it in Java files you can directly use
SystemProperties.get(String key)
But if you want it in boot time it should be in cpp files so use
property_get( String name, char* var, NULL)
/* where name is property name, var is the variable in which u want to store value last parameter is for the default value which will be assigned to var when no property set.*/
And for the java things you can check Systemproperties.java for apis for different type of data
types. Although for cpp it is only supported for string type And if you want to save any property through c files, use property_set() method.
Hope it will you too, as it was really save my day.