Feeds:
Posts
Comments

Hi Welcome u,

Old is Gold

Take the old beautiful soup It works fine but new soup has some problem with unicode and string.

sorry If i confused you.

Now for sometime I have been working on the parsing html data in python.For this operation we have the standard module called “BeautifulSoup“.When I was working with this suddenly i have faced the problem “HTMLParserError” after i got to go google.

It says that

“you r using the new BeautifulSoupSome modifications has been done on the new soup module that is the parsing is happening from html rather to use lxml.”

So, again I asked the version to find my soup.

again it says politely,

“navatux@localhost$python

>>>import BeautifulSoup

>>>BeautifulSoup.__version__”

>>>”"” Here you need to notice the output .ie Version

So, I did the same thing and I got the number 3.1.7

again I conducted him.

It says,

“Try to install the version 3.0.1a” will be somewhat good.

Again i need to follow that.

I did it downloaded the exact version and installed(3.0.1a) after uninstalled the old one(3.1.7).

Reference:

http://stackoverflow.com/questions/601166/issues-with-beautifulsoup-parsing?s=0c3dca2e-3f3b-4a13-8d79-c13b1204dd7d

Now it works fine. :-)

If i face any new issue let you know :-)

bye ;-)

Python Experience

Hi Friends,

I have been working with python for quite long.I got to write some scripting it.Even from my college days itself I started to roam around c,c++ and Java now python.It is seems to be easy when you compare with others since Other tools appears too much code to pick up when you compare with python code.but in Performance vice we have to think a while with python!!!

Even I have good experience with python programming,I frankly say I have to improve a lot like coding in a professional way using classes and it’s concepts as well as analyzing the better performance way? yeah thats absolutely important..Any suggestions.?

Currently my code look like:

CONSTANTS  = 1.0

def  fun2(arg2):

process2

def fun1(args1):

process1

fun2(arg2)

def fun3(arg3):

exit

In the way I am doing but I wanna improve from this..

Recently I was coming through MAP,REDUCE,FILTER,LAMBDA builtin methods.I think they recommended mostly not to use map since acquiring high memory.

Python has potential to grow.but it is lacking i think.

Start Struts2.0

Hello Friends,

Here I would like to share some knowledge about Struts2.0 , I came to learn this technology before sometimes back.There are lot of concepts which shapes struts framework to compete with other talented one like Django.

It has some more concepts for your mind:

1.FilterDispatcher

2.ActionProxy

3.ActionInvocation

4.ActionSupport

5.Interceptors

6.ValueStack

7.OGNL Expressions(Object Grapical Navigational Language)

8.ResultTypes

9.Field Validators

10.JSP & Bean classes

We should have to be good in above all.I am a starter on the above.Even I don’t know the knowledge about JSP.

Command of the Day

#find + egrep

Command of the Day:

If you see my previous couple of post you would be comfortable to use “egrep” and “find” utilities.

Here One Question arises on me:

How would you combine both commands like you need to find some file in your disk also you have find the string from that file:

my thoughts:

find . -name “nava.txt” | egrep -in “NAVANEETHAN”

Is it correct? Why it is not correct?

find . -name “nava.txt” -exec egrep “NAVANEETHAN” {} \;

(or)

find . -name “nava.txt” -print0 | xargs -0 egrep “NAVANEETHAN” refer    

Command of the day

#2 FIND utility

Here I am giving the “find” command utility’s purpose which will be very useful for quite to be familiar with your linux box

I am following from this day itself.Hope will be useful for you.

Very simple to learn.

Description:

basically find command used to find a file/directory in particular location.It will be used to find based on size,type,name,mtime..etc.

Examples:

Find a file using it’s name

find . -name “nava.txt”

find . -iname “navA.txt”

Here .(current directory,-name(case sensitive name of the file))

Find Empty file in / directory

find / -empty

Find Non-Hidden empty files

find  /  -maxdepth -1  -empty -not  -name “.*”

Find TOP 5 big files in Current directory

find / -type f -exec ls -s {} \; | sort -n -r | head -5

Find TOP 5 small files in Current Directory

find / -type  f  -exec ls -s {} \; | sort -n | head -5

Find TOP 5 small files except empty files

find /  -not  -empty -type f -exec ls -s {} \; | sort -n | head -5

Find all Directories

find / -type d

Find all files

find / -type f

Find Hidden Files

find / -type f  -name “.*”

Find files by size

find / -size +100M

Note:{ +100M ( > 100MB) , -100M( < 100MB), 100M (== 100MB)  }

Finally:

Thanks for your time ;-)

#1

Hi Friends,

Today I have learned the command to search a word in a file along with line number

Command:

egrep -in “nava|neethan” *.txt

Explanation:

egrep extended grep -in insensitive case and number “nava|neethan” word to be searched (nava or neethan) *.txt look up files

sample output:    egrep -in “nava|neethan” name.txt

1:nava is my first name

2:neethan is my last name

3:navaneethan = Navaneethan

Thanks for visiting today’s command of the day!!

#My Mistake

Hi Friends,

Happy to meet you all again after nice nap

Yesterday something happened to me by mistake,Actually In my task I need to move the contents of one person who blogged in our django product to his wordpress account So obviously i got a little overview then i discussed with senior person he removed some glitches in my view which was helpful to get it,then after sometime i was doing to copy the content manually to move after a couple of minutes i got scold for my stupendous action from him then i realized it eventually .Because as a developer whatever we do is ,should be in programmatic way and thinking is absolutely important,was my ever bid mistake; then atleast got the view clearly now itself and I started to do it just in django to make the victim’s all contents as a text file in django . That was my immediate work to finish it.So I had gotten his userprofile object and from that I was trying to get his all content

Up=UserProfile.objects.get(email=’XXX’)

wp=WebPage.objects.filter(userprofile=up)

for w in wp:

fin.write(‘\n’+'######PAGE TITLE:#######’+str(w.page_title)+’\n’)

fin.write(‘######PAGE CONTENT######’+'\n’)

fin.write(str(w.page_content)+’\n’)

This was my snippet to make a text file with his content i did the required procedure in python to create a text file it was not revealed here

Again i faced a problem here to move

While I am using this code to move the all contents as a text format which is shown a error “Unicode error”,because it consistes some othe wide characters apart from ascii that was the general one .and my hand was having my chin

I got solution which solved that problem = Unicode error in django it was given saltycrane(search in google)

Use smart_str() and smart_unicode()

This is the elegant way to get the format of string or unicode in django

fin.write(‘\n’+'######PAGE TITLE:#######’+smart_str(w.page_title)+’\n’)

……………………

……………………

It grabs the contents in the correct format and taught a lesson to think thoroughly !!!

Thanks for your time !!!

regards,

Navaneethan R

Some vim commands

Hi Friends,

HAPPY NEW YEAR This year brings happiness

:recently_I_Learned _some_vim _commands

:i_am_happy_to_share_with_you

Now I would like to share with you some vim commands which i known recently,I hope you can get your commands in direct googling ,but here i would like to share my familiar commands with you

Actually Vim is a powerful editor there are a lot of plugins available even we can maintain a todo list in vim taskpaper is used to do that.

In some previous days i used Vim to open,read,write simple purpose just recent days only i started to use for search,copy for those purposes too
There are a lot of editors available command line utility is the good for programmers like technician
Vim(old) is gold

:  To enter into vim command mode

vim commands only has to be entered in this mode only,so when ever we need to do enter vim commands we should use this colon character
:e file_name To open a file [Eg: :e post.txt]
:tabnew To open new tab
:tabfirst[tablast] Switch to first tab ,last tab respectively
:sav or :w used to save the files
Replace a string in a file

:%s/old_string/new_string/g here the string replacement occurs in all lines of the file

if you want to do this operation in a particular set of lines
:3,44s/old_string/new_string/g

:3,$s/old_string/new_string/g Starting line no 3 to End OF file
:%s/^/start/g Add the String “Start” in all starting lines of your file
:%s/$/end/g Add the String “end” in all ending lines of your file

:g/string/d Delete all lines what has the string
:v/string/d Delete all lines what hasn’t contain the string

:2,45 w another_file.txt // Witre the lines from 2 to 45 to another file
:2,45 w >> another_file.txt //To append those lines to another file
Change Color Scheme
:colorscheme morning [morning,evening,desert....]
Auto-completion
Ctrl+n Ctrl+p (in insert mode)

Complete wordCtrl+x Ctrl+l

Complete line:set dictionary=dict Define dict as a dictionnary

Ctrl+x Ctrl+k Complete with dictionnary

set shiftwidth=3 //for indentation space

set autoindent //auto indent

Would you want to change the Case in all lines of your file
Execute this command in your vim mode
:for i in range(0,line(‘$’))

["indent need"]call setline(i,tolower(getline(i)))

endfor

Explanation:
Get the No of lines in for loop and call the function setline to set all lines as lowercase similar that we can peroform for toupper(),..
If you want to change the cases in line only
Press ‘V‘(caps)
and press ‘e‘ then press ‘u‘  for small case
press ‘E‘ then press ‘U” for big case

Do in All tabs:

If you want to do your vim commands in all opened tabs means you can use the command tabdo
:tabdo %s/old_string/new_string/g

okay these are the commands which i learnt recenly ;-) I hope this will be useful for you in some way
okay if you find any problem with this means send me for a discussion
thanks!!

FILES in LINUX

FHS root filesystem

Continue Reading »

Books

I have gone this week to Roundana in Erode to visit the book fair festival which was very very nice and this is the first time to me that seen this much of books and good organization .The trip was very pleasure for me and enjoyed a lot ,there is no words in my dictionary to explore my emotion after stepped out of it.I think every year which has been conducted this book fair as well as there are more models or leaders had visited and given a talk in this shop day-by-day almost ten days,it is also a fortune to have it.

I have visited all sections almost,Most of the times i couldn’t able to step out of each section ,especially the Tamil novels,English books,leader’s history so nice to read,please have a look on it with your passion

Eventually I have bought four books

1.Main kampf by A.hitler

2.Billgates the software sultan by chokkan

3.learn yoga

4.Kanndhasan kavithaigal

Billgates the software sulthan by chokkan

After reached home stated read Billgates the software sultan the character was awesome,It explore how he became from normal state to enlarged,what were the reasons,what was his talents,so much things elaborated there. finished in almost 10 hrs.

author : http://nchokkan.wordpress.com

Main kampf by A.hitler

It is the autobiography by adolf hitler who had written this couple of volumes when he was imprisoned which i need to read right now …It feels slowly moving anyway the words are good see as a newbie..to keep on going…

learn yoga

It tells about the aasanas which has to make healthier the uses of each aasana…,the ways to do those informations has been attached there,..

Kanndhasan kavithaigal

In my college time I used myself to write some poems in tamil after that it was seemed like the reluctant one, on accout of the long gap,so i bought this book to have a touch with my tamil skills..I hope this ll be great and will occur elegantly ,wish me friends

My belief full thought is books are the absolutely true friends which helps more to lead you in the good way,Those are always the profitable even if you spend more money than your income.

Our the great living leader Dr.APJ Abdulkalam had come the previous year for this great occasion,and he talked that in every each family you should maintain a library,and atleast you should spend a hour for your true friends that meant for books i hope we can achieve this crisp talk by the leaders way.

bye bye :-)

Older Posts »

Follow

Get every new post delivered to your Inbox.

Join 146 other followers