Friday, September 20, 2013

How to install updates from console on linux

There are two options to install updates.

1. Using yum
2. GUI

It is very simple if you have already yum installed on your machine.

$ yum update

It should automatically install all the updates of different software on your machine. 

Using GUI, it is very simple process. Just follow the instructions on GUI.

Wednesday, September 18, 2013

Problem with tagger and chunkers of NLTK on linux

I installed NLTK using the commands which were found here: http://nltk.org/install.html

Everything got installed successfully. So when I started using this nltk package like this:

python
>>> import nltk
>>> text = nltk.word_tokenize("And now for something completely different")
>>> text
['And', 'now', 'for', 'something', 'completely', 'different']

But when I try to tag these tokens, there are some errors as shown below.

>>>  nltk.pos_tag(text)
  File "", line 1
    nltk.pos_tag(text)
    ^
IndentationError: unexpected indent
>>> nltk.pos_tag(text)
Traceback (most recent call last):
  File "", line 1, in
  File "/usr/lib/python2.6/site-packages/nltk/tag/__init__.py", line 99, in pos_tag
    tagger = load(_POS_TAGGER)
  File "/usr/lib/python2.6/site-packages/nltk/data.py", line 605, in load
    resource_val = pickle.load(_open(resource_url))
  File "/usr/lib/python2.6/site-packages/nltk/data.py", line 686, in _open
    return find(path).open()
  File "/usr/lib/python2.6/site-packages/nltk/data.py", line 467, in find
    raise LookupError(resource_not_found)
LookupError:
**********************************************************************
  Resource 'taggers/maxent_treebank_pos_tagger/english.pickle' not
  found.  Please use the NLTK Downloader to obtain the resource:
  >>> nltk.download()
  Searched in:
    - '/root/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'
**********************************************************************


The way you can fix it is: Run this command which downloads the tagger:
>>> nltk.download('maxent_treebank_pos_tagger')

It downloads this package to some directory on your machine. For me it downloaded here: /root/nltk_data...

And all the system related files with regard to NLTK are in this directory: /usr/lib/python2.6/site-packages/nltk
So, I created a new directory called 'taggers' and copy this 'maxent_treebank_pos_tagger' to this new directory named: /usr/lib/python2.6//site-packages/nltk/taggers/

Now when you run this command:
>>> tagged = nltk.pos_tag(tokens)
[('At', 'IN'), ('eight', 'CD'), ("o'clock", 'JJ'), ('on', 'IN'), ('Thursday', 'NNP'), ('morning', 'NN')]

Similarly when you try to do this:
>>> entities = nltk.chunk.ne_chunk(tagged)
You will see similar results that you have to download chunker and corpora, follow the similar procedure and execute these two commands:

>>> nltk.download('maxent_ne_chunker')
>>> nltk.download('words')

This can help you install the chunkers package and when you execute this command, you can get the parse tree
>>> entities = nltk.chunk.ne_chunk(tagged)
>>> entities
Tree('S', [('At', 'IN'), ('eight', 'CD'), ("o'clock", 'JJ'), ('on', 'IN'), ('Thursday', 'NNP'), ('morning', 'NN'), Tree('PERSON', [('Arthur', 'NNP')]), ('did', 'VBD'), ("n't", 'RB'), ('feel', 'VB'), ('very', 'RB'), ('good', 'JJ'), ('.', '.')])

Hope this helps!


Thursday, September 5, 2013

Install/add network printer to your system list in linux through command line

Initially check if CUPS (Common Unix Printing System) daemon is running or not using this command:

$$ /etc/init.d/cups status

You will see something like this on your terminal:

$$ cupsd (pid ****) is running...

If the daemon is not running, then start the daemon using these commands:

$$ /etc/init.d/cups start
$$ chkconfig cups on

To add the network printer, use this command:

$$ lpadmin -p Printer_name -E -v socket://


To set a default printer:

$$ lpadmin -d  Printer_name

To check the printer status and see if printer is in ready mode:

$$ lpq

 You see something like this when your printer is ready and there are no entries:

$$ Printer_name  is ready
$$ no entries

To check the printers installed on your machine, you can use this command:

$$ lpstat -p -d

If you want to delete a printer on your machine:

$$ lpadmin -x Printer_name




**part of this has been taken from http://sumitgoel.me

Wednesday, June 26, 2013

Applying for F-1 US visa from India

This post is intended to share my experience with those who are applying for F-1 visa to pursue education in the United States of America. Please note that this post is based on my OWN personal experience ONLY. Please follow the US-traveldocs (http://www.ustraveldocs.com/in/) website for the correct information.

There are many good websites online which gives a very detailed information about applying to F-1 visa. Here is how I applied for the visa.

Step-1: Receive i-20 from the university of your choice

Step-2: Pay SEVIS fee online (save this payment confirmation slip)

Step-3: Fill up DS-160 form online (My visa interview is in Hyderabad. So, no need for me to upload my photograph online. I went to OFC for a separate photo and fingerprint collection.)

Step-4: Take appointment for OFC and visa interview on ustraveldocs website

Step-5: At OFC: Take these documents along with you: passport, appointment confirmation, DS-160 confirmation. (Good to take i-20 as well but not required. I was not asked to show i-20)

You will be given a token number and asked to be seated. When your token number shows up, they will take your photograph and collect your finger prints (all fingers). They may ask you why you are going to the States.

Step-6: At the US consulate for visa interview: Take all the required documents which may include: passport, appointment confirmation, DS-160, SEVIS receipt, i-20, admission letter, GRE scorecard, TOEFL scorecard, funding letters (if no funding then bank loan documents that support you financially), transcripts, degree certificates, etc. And proceed for the interview.

Good luck for all the aspirants who want to pursue education in the US!

Tuesday, May 28, 2013

How to plot multiple graphs (scatter plots or histograms) on a same window in R?

Recently I have been working with R and bumped into different interesting facts of R. Here is how you can plot multiple graphs in the same window.

Your variable is x is a dependent variable on independent variables a, b, c and d. For example,

 a <- rnorm(100)
 b <- rnorm(100)
 c <- rnorm(100)
 d <- rnorm(100)


x <- a+b+c+d

If you want to understand how x is dependent upon each of these variables, you can make a scatter plot. If you want to see all these four dependency graphs on a same plot, you can use layout function in R.

Execute these commands..

M <- matrix(c(1:4), byrow=TRUE, nrow=2)
> layout(M)
> plot(x, a)
> plot(x, b)
> plot(x, c)
> plot(x, d)

Its that easy!

If you want to plot two histograms on a same plot, heres how you can do!


> hist1 <- hist(rnorm(500,3))
> hist2 <- hist(rnorm(500,5)) #500 random numbers centered around 5
> plot( hist1, col=rgb(0,0,1,1/4), xlim=c(0,10))  # first histogram
> plot( hist2, col=rgb(1,0,0,1/4), xlim=c(0,10), add=T)  # second histogram


Sunday, October 23, 2011

Learnings from the book of James

The main idea of this post is to share with you my reflections on the book of James and how it taught me few most important lessons. In our sunday school at Church, we studied the book of James and today we were reflecting on what each one of us have learnt through this study.

First of all, I want to write the things which were given in the prologue of this book in my study bible.

1. Putting faith into action through words and deeds.
2. Submitting to God under God's care.
3. Prayer needs to be a priority in our lives.

For me I found the book of James as a great instructory blessing. The words written are very simple and gives a clear instruction on how to be our walk with Christ as a Christian in everyday life. Few verses have become my favorites.

"Abraham believed God, and it was credited to him as righteousness"

It taught me that having no faith in God is a sin. Also, believing God brings blessing into our lives. Trust in him makes us righteous. Abraham was called God's friend. How amazing it is to be a friend of God - who is the almighty!

"Everyone should be quick to listen, slow to speak and slow to become angry,"

It taught me to be more patient to listen than to speak quickly. I feel that there is a great gain in listening. It makes the other person happy that we are giving him/her attention to what she is speaking and also, we can learn and improve our understanding about different things. Also, the verse says slow to become angry. In this modern world, I feel it is one of the toughest things. But surrendering ourselves to God and lean on him will help us able to follow HIS instructions through HIS word.

"God opposes the proud but gives grace to the humble"

This teaches us to be humble to gain the grace of God in our lives. Also, as we see in the book of Proverbs, "pride walketh before fall", if the grace of God is not in our lives, our lives will be shattered and meaningless.

"Is anyone in trouble? He should pray"

Gives us an instruction that prayer is an important tool to face the troubles of everyday life. Taught me the importance of prayer to survive in this competent world.

Hope these verses are a blessing to you too.

Thanks,
A sinner saved by grace.

Thursday, January 27, 2011

Tips on Time Management and Writing E-mails

Found it interesting!

Tips on Time Management and Writing E-mails


IN GRADUATE STUDY FOR THE 21ST CENTURY (Palgrave Macmillan, 2005),
Gregory Colon Semenza notes that “poor time management and inadequate organization skills” often create the major barrier to a successful graduate school experience. To help you manage your time and your work materials, we’ve summarized some of his suggestions.

DATE BOOKS may be out of date (or style) but...it’s important to have something that will help you keep track of your appointments and deadlines. Here’s a great tip: create a one- page weekly TO-DO listing of your deadlines, appointments and tasks, and post it somewhere that’s
easily accessible.

USE YOUR COMPUTER AS AN ORGANIZATIONAL TOOL. Create a folder for each area of your work: research, teaching, coursework and your academic portfolio. In your research folder, begin developing your list of references and keep copies of any papers you’ve written for any seminar you’ve taken. Bookmark important websites and electronic databases like Academic Search Premier available on the UNL Libraries resources page. In your teaching folder, keep copies of your syllabi and lesson plans for every course you teach. Begin developing your teaching statement and save each draft (you never know when you’ll want to return to an earlier
version). Save future job search materials like your CV and other documentation materials in your academic portfolio folder. The time you put into organizing these materials now will save you a great deal of time later.

ESTABLISH A ROUTINE. As much as possible try to follow a regular daily schedule so that by the time you are ready to write your dissertation your work habits will be well established. Doing so will allow you to coordinate your activities with those of your adviser, graduate
colleagues, and family and friends, and will alleviate the feeling that someone is always demanding your time.

PRIORITIZE. PRIORITIZE. PRIORITIZE. In graduate school, you need to be very protective of your research and writing time. It doesn’t matter when you set aside time to write or plan your next teaching lecture. It DOES matter that you recognize that these tasks are more important than some of your other tasks, like checking e-mail. Save the more mundane tasks for low energy times. If you’re a doctoral or master’s student who is expected to complete a thesis, spend the bulk of your day on research-related activities. And learn to say “no” — to friends, family, maybe even your graduate adviserJ. Managing your time in one area of your professional life will help you do it in other areas, too.

Having said that, BE REASONABLE ABOUT WHAT YOU CAN DO AND WHEN. If you have to work at night or on weekends, try to choose a time thatminimizes disruptions of your personal and family time.

USE HOLIDAY BREAKS TO FOCUS ON RESEARCH. Stay near the university during the summer. If you stay on campus and spend time on your research and writing, you’ll have a much better chance of finishing in a timely manner.

MAINTAIN SOME SORT OF DAILY PHYSICAL ACTIVITY during graduate school. Exercise can help you structure your day and release stress, contributes to greater confidence, keeps you healthy and clears a space in your mind for those “aha” moments that help you break through barriers in your thinking. Hobbies are good, too. Go to a UNL basketball game. Attend a
show at the Lied Center. Learn to knit (yes, there are health benefits to knitting). Like people who exercise regularly, people who take time to enjoy their favorite hobbies tend to experience less stress.

BEGIN WORKING ON YOUR CURRICULUM VITAE NOW. By building your vita early in your graduate career, you’ll be able to track your accomplishments while noting the gaps in your experience.

FIVE QUICK TIPS FOR WRITING EFFECTIVE E-MAILS

E-MAIL IS AN INCREASINGLY PREFERRED TOOL FOR COMMUNICATION between students and faculty. When communicating with your professors via e-mail, it’s important to remember that many faculty view an e-mail message as a letter that was delivered quickly rather than a quick conversation. Here are a few tips to keep in mind when writing e-mail
messages to your professors.

USE APPROPRIATE SALUTATIONS AND TITLES.
Like letters, e-mails should begin with a proper salutation. If “Dear
Dr. Smith” seems too formal, begin your message with “Hello Dr. Smith,” but avoid the kinds of casual greetings you would use with friends (e.g., “Hey”) or no greeting at all. When in doubt about using Dr. or the professor’s first name, use Dr.; the faculty member will let you know when it’s okay to use his or her first name.

IDENTIFY YOURSELF.
Faculty interact with a large number of students every semester. At the beginning of your message, refer to the class you’re taking with the faculty member or how the faculty member knows you, especially when you’re contacting someone who doesn’t know you very well. Conclude your message with more than just your first name. Provide your full name and NUID number.

AVOID TEXT ACRONYMS.
If you’re responding to e-mails on a Blackberry or smart phone, it’s
tempting to abbreviate or shorten words and phrases (e.g., u instead of you). However, abbreviations are easy to misinterpret or may be completely misunderstood.

BEWARE OF YOUR TONE.
Perhaps the most difficult part of writing an e-mail is achieving the right tone. If you’re writing an especially sensitive e-mail, let your final draft sit overnight and reread it before sending to make sure the message is appropriate. You also can ask a colleague or friend to read your message and offer feedback about how the message might be perceived. Remember, e-mail creates a permanent record of your communication that you have no control over after you click the send button. So if you’re worried about the tone of your e-mail, you might want to skip the message altogether and ask for a meeting with the faculty member.

KEEP IT SIMPLE.
Long e-mails with too many questions can get confusing. If your message is more than one or two paragraphs, rethink the purpose of the message. You may want to start with the most important question or topic. A lengthy e-mail may be a signal that the subject warrants a meeting rather than a written communication. E-mail communication is an important part of building positive relationships with your professors. It’s always worthwhile to take the time to make sure your messages are clear and appropriate.

RESOURCES
Jerz, D. & Bauer, J. (2000, December 12). Writing effective e- mail: Top
10 tips. Retrieved October 7, 2010 from
http://jerz.setonhill.edu/writing/etext/e-mail.htm#message. Toth, E.
(2009, April 28). Don’t e-mail me this way. The Chronicle of Higher
Education. Retrieved October 8, 2010, from
http://chronicle.com/article/Dont-E-Mail-Me-This- Way/44818/.