Saturday, May 24, 2008

Basics: Lucene and Search

Basics about Lucene ranking -- here

Search Internals by user rainman on wikipedia

This might also be helpful -- a thesis

Sunday, April 06, 2008

I/O Redirection in shell or shell scripting

You will come across this situation when you want to run a process in background. Mostly, you want to capture the output or the errors thrown by the process.

As you must be already knowing, three file descriptors are available by default in any programming language. Similar is the case for a shell or shell scripting. The three are standard input (stdin), standard output (stdout) and standard error (stderr). Their corresponding file descriptors are 0, 1 and 2.

You can use these file descriptors while redirecting your input/output.

Syntax for redirection is as follows
M>N
# "M" is a file descriptor, which defaults to 1, if not explicitly set.
# "N" is a filename.
# File descriptor "M" is redirect to file "N."


Example: To redirect stdout to filename
1>filename
To redirect stderr to errorlog
2>errorlog

Another format is
M>&N
# "M" is a file descriptor, which defaults to 1, if not set.
# "N" is another file descriptor.


Example: To redirect both stderr and stdout to the same file
1>somefile 2>&1

More about I/O redirection here.

MySQL: Purge Master Logs

Binary logs sometime take up too much space on the server. I wanted space so I had to delete the database logs. They were taking up around 2GB space.

http://dev.mysql.com/doc/refman/5.0/en/purge-master-logs.html --> this link will tell you how to delete the logs.

If you want to turn off the logs, then edit /var/mysql/my.cnf on Ubuntu and comment out the following lines
  • line starting with log_bin
  • line starting with expire_log_days
  • line starting with max_binlog_size
If you want to save space and also want the logs then you can ignore commenting log_bin line and try reducing the values for expire_log_days and max_binlog_size.

expire_log_days will tell you the number of days for which the logs will be kept. If it's value is 2. Then all logs older than 2 days will be deleted.

max_binlog_size is the maximum size of the log file. If a log file reaches this limit, then a new log file will be created and appended to. Note, the old log file will not be deleted unless expire_log_days condition satisfies.

Tuesday, April 01, 2008

Move running process to background in Linux

Use the following sequence of keystrokes if you want to move a running process to background in Linux.

CTRL+Z

bg


CTRL+Z will suspend the process and the command prompt will return to you. Type bg and press enter to send the process to background.

If you want to logout but keep the process running even after logging out then type disown -a. This will detach the process and it will continue to run even if you log out.

To start a process in detached mode, use nohup command.

nohup <command to start the process>

man nohup for more details.

Wednesday, February 27, 2008

Ignoring files in subversion

Two lessons for today
  1. How to ignore files in subversion
  2. How to create a transcript
1. How to ignore files in subversion
To ignore a directory: svn propedit svn:ignore
The above command will open an editor, add the directory you want to ignore in the editor and exit from the editor. Note that the directory you are trying to ignore is not added to the repository or else it won't work.
To ignore a file: svn propedit svn:ignore
Again in the editor, add the files you want to ignore and exit. You can even use wildcards when you enter the file names. Ex: '*' to ignore all the files in the directory.

I have shown a method to ignore files using propedit. The same can be done using propset also. Details are here and here.

2. How to create a transcript

You will most probably be asked for a transcript while you are asking for help on IRC channels. Transcript is a copy of the text printed on the terminal. Whatever you have typed and whatever has been printed to the terminal by the commands that you executed.

The simplest way to create a transcript in Linux is to run the script command. After running the script command, run/type whatever commands you want to and when done, type 'exit' to stop the script. A file with the name typescript is created which will have the transcript of whatever you have done on the terminal.

Tuesday, February 19, 2008

Use your GPRS phone as modem in Ubuntu

'Bunch of me: Linux Redux: Use your GPRS phone as modem in Ubuntu tells how to do it.

Configuring Bluetooth on Ubuntu

This article on LinuxQuestions.org explains clearly how to configure bluetooth on Ubuntu to send/receive files to/from bluetooth devices and also how to set up bluetooth keyboard and mouse.

Few useful linux commands

- To see how long your machine has been running
$ uptime
- To see some computer stats
$ lspci
- To see system temperature and battery charge
$ acpi -t
- To see a list of all running processes
$ ps aux
- To view the current date, time and year
$ date
- For a simple calendar
$ cal
- To see what programs are running with path names
$ ps -aux
- To see your current IP address
$ ifconfig -a
- To see what your system is doing at startup
$ dmesg
- To see information about the computer users
$ finger -l

More commands later...

Thursday, February 14, 2008

Social Graph API

Social Graph API is something to check out. Here is a blog from Google Code Blog. I haven't checked it out yet but plan to do so soon. I hope it does what it claims to do and does that well.

If you are wondering what this API does, here is a snippet from Google's blog entry.

we crawl the Web to find publicly declared relationships between people's accounts, just like Google crawls the Web for links between pages. But instead of returning links to HTML documents, the API returns JSON data structures representing the social relationships we discovered from all the XFN and FOAF. When a user signs up for your app, you can use the API to remind them who they've said they're friends with on other sites and ask them if they want to be friends on your new site.

Wednesday, February 13, 2008

Social application for Orkut

I have checked out Open Social, a common set of APIs which can be used to build social applications that work across multiple websites. I think it is really cool and at the same time not so good.

I think it is cool because, there will be a lot of applications that will be created for Orkut now, just like those you find on Facebook. But at the same time, the saddest part is that there will be many useless applications which will clutter the site and confuse everybody.

Google has announced that Open Social applications will be available to users now. So, gear up and be ready to see it on your Orkut login sometime soon. Earlier, these were available only in the sandbox.

Well, I am looking forward for an application which could allow you to tag and share photos from your friends' albums. I really like few photos from my friend's photo album and would like to tag them so that I can easily see them when I want and also would like to allow our common friends to see what I have tagged. Hoping to see if something similar would be available.

Grand Challenges for Engineering

National Academy of Engineering has a special site where in it will publish the grand challenges for engineering for the 21st century. The committee members are selected from varied fields. I am really looking forward to see what the grand challenges will be.

The challenges identified will be published to the website on 15th Feb, so don't forget to check them out.