<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>itsAnimesh.com &#187; script</title>
	<atom:link href="http://itsanimesh.com/tag/script/feed/" rel="self" type="application/rss+xml" />
	<link>http://itsanimesh.com</link>
	<description>A Techie Gyaan Vyaan Blog.</description>
	<lastBuildDate>Mon, 06 Sep 2010 18:50:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Access MSSQL with Python!!!</title>
		<link>http://itsanimesh.com/2010/04/24/access-mssql-with-python/</link>
		<comments>http://itsanimesh.com/2010/04/24/access-mssql-with-python/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 08:25:46 +0000</pubDate>
		<dc:creator>Animesh Kumar</dc:creator>
				<category><![CDATA[Techi Gyaan]]></category>
		<category><![CDATA[FOSS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://itsanimesh.com/?p=1807</guid>
		<description><![CDATA[I started using Python a while ago and one of the things I need to do is to be able to connect to Microsoft SQL server from Linux servers&#8230; Its suprising that only a few projects are alive for it&#8230; One of them is the commercial MxODBC from eGenix, while the other is called pymssql&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>I started using Python a while ago and one of the things I need to do is to be able to connect to Microsoft SQL server from Linux servers&#8230; Its suprising that only a few projects are alive for it&#8230; One of them is the commercial MxODBC from <a title="eGenix" href="http://www.egenix.com/products/python/mxODBC/" target="_blank">eGenix</a>, while the other is called pymssql&#8230; I gave pymssql a try and it worked almost at once on my Ubuntu machine&#8230;</p>
<p>First I installed the prerequisites: freetds and the python headers:</p>
<pre>aptitude install python2.5-dev freetds-dev</pre>
<p>There might be some other packages that are needed but that was the only ones I needed to install&#8230;. Then I decompressed the latest   release from <a title="pymssql" href="https://sourceforge.net/project/showfiles.php?group_id=40059" target="_blank">pymssql</a> at   sourceforge and installed:</p>
<p><strong>NOTE :</strong> for me the latest package did not work so I used <strong>pymssql-0.8.0</strong></p>
<pre>tar -xvzf pymssql-0.8.0.tar.gz
cd pymssql-0.8.0
python setup.py install</pre>
<p>Now you can test it out  by creating your own test script and it is as follows :</p>
<pre>import pymssql
conn = pymssql.connect(host='&lt;hostname&gt;', user='&lt;username&gt;', password='&lt;passwd&gt;', database='&lt;dbname&gt;')
cur = conn.cursor()
cur.execute('SELECT * FROM tbABCD')
row = cur.fetchone()
while row:
 print "ID=%s, Name=%s, Address=%s" % (row[0], row[1], row[2])
 row = cur.fetchone()
conn.close()</pre>
<p>The script ran perfectly&#8230;<br />
For more information on pymssql you can view its <a href="http://pymssql.sourceforge.net/documentation.php">documentation here</a>&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://itsanimesh.com/2010/04/24/access-mssql-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set Twitter Tweet as status message in Pidgin!!!</title>
		<link>http://itsanimesh.com/2009/03/08/set-twitter-tweet-as-status-message-in-pidgin/</link>
		<comments>http://itsanimesh.com/2009/03/08/set-twitter-tweet-as-status-message-in-pidgin/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 09:13:58 +0000</pubDate>
		<dc:creator>Animesh Kumar</dc:creator>
				<category><![CDATA[Fun Gyaan]]></category>
		<category><![CDATA[Techi Gyaan]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Pidgin]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Softwares]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://itsanimesh.com/?p=221</guid>
		<description><![CDATA[While browsing the net you would have heard about Twitter. Twitter is basically another name for micro blogging. In twitter you just have to sign up, then update a single line(&#8220;what you are currently doing?&#8221;) whenever you can. Its just so simple, no fuss about making a profile or writing down about the movies you [...]]]></description>
			<content:encoded><![CDATA[<p>While browsing the net you would have heard about <strong><a href="http://twitter.com/">Twitter</a></strong>. Twitter is basically another name for <a href="http://en.wikipedia.org/wiki/Micro-blogging">micro blogging</a>. In twitter you just have to sign up, then update a single line(&#8220;what you are currently doing?&#8221;) whenever you can. Its just so simple, no fuss about making a profile or writing down about the movies you like and blah blah&#8230;</p>
<p>A lot of us also use different instant messaging clients on a day to day basis. <strong><a href="http://www.pidgin.im/">Pidgin</a></strong> is one of these clients that runs on a number of platforms, including Windows, Linux, and other UNIX operating systems. The advantage of using pidgin is that instead of running GTalk, Yahoo Messenger and MSN Messenger separately, you can have everything-in-one.</p>
<p>Now Pidigin allows us to set a status message and that is exactly what we do in twitter. So here&#8217;s what we can do.. update twitter status alone and then get Pidgin to retrieve and set the tweet as the IM status automatically.. This can be done with a help of a code found at <a href="http://code.google.com/p/pidgin-twitterstatus/"><strong>Google Codes</strong></a>.</p>
<p>To do this follow the steps below. (I am taking it that you have already got Pidgin installed on your system.)</p>
<p><strong>1.</strong> Firstly we need to install <strong>Perl</strong>. Most Linux distros come with Perl preinstalled. Windows users, download and install Perl from <a href="http://www.activestate.com/activeperl/"><strong>here</strong></a>.</p>
<p><strong>2.</strong> Take a Command Prompt/Terminal and enter: perl -MCPAN -e shell (Linux users, would have to add a sudo before this). In the CPAN prompt that you got now, enter install XML::XPath and hit enter. This will download and install the Xpath module from Internet.</p>
<p><strong>3.</strong> Now launch Pidgin. Go to <strong>Help -&gt; About</strong> and scroll to the bottom of the page. You should see a line : <strong>Perl: Enabled</strong>.</p>
<p><strong>4.</strong> Download <strong>twitter.pl</strong> from <a href="http://code.google.com/p/pidgin-twitterstatus/downloads/list"><strong>http://code.google.com/p/pidgin-twitterstatus/downloads/list</strong></a> and put it into your Pidgin plugins folder. Usually the plugins folder is <strong>C:\Program Files\pidgin\plugins for Windows users and ~/.purple/plugins for Linux users.</strong></p>
<p><strong>5.</strong> Now restart Pidgin and go to <strong>Tools -&gt; Plugins</strong>. There will be a new plugin named <strong>Twitter Status Feed</strong>. Enable it and click on <strong>Configure Plugin</strong>. Enter your twitter user name in the dialog box that pops up.</p>
<p><strong>6.</strong> Now in the drop down box where we select our status choose Twitter.</p>
<p>Note : sometimes in Linux copying the twitter.pl in &#8220;<strong>~/.purple/plugins</strong>&#8221; may not work. If you have root privilege then copy the script in  &#8220;<strong>/usr/lib/purple-2/</strong>&#8220;.</p>
<p>Please leave comments if you face problems. <img src='http://itsanimesh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://itsanimesh.com/2009/03/08/set-twitter-tweet-as-status-message-in-pidgin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Script for Cricket Score!!!</title>
		<link>http://itsanimesh.com/2009/02/01/python_script_for_cricket_score/</link>
		<comments>http://itsanimesh.com/2009/02/01/python_script_for_cricket_score/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 08:21:22 +0000</pubDate>
		<dc:creator>Animesh Kumar</dc:creator>
				<category><![CDATA[Techi Gyaan]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://itsanimesh.com/?p=164</guid>
		<description><![CDATA[Here&#8217;s a script that i wrote to get the latest cricket score without visiting the site. It&#8217;s a python script that makes use of rediff scores. import urllib class Score(object): SCORE_URL = "" def __init__(self): self.vars = {} # dictionary variables read from the score file def refresh(self): """Refresh the score""" url_opener = urllib.URLopener() url [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a script that i wrote to get the latest cricket score without visiting the site. It&#8217;s a python script that makes use of <a href="http://livechat.rediff.com:80/sports/score/score.txt">rediff scores</a>.</p>
<p><strong><code>import urllib<br />
class Score(object):<br />
SCORE_URL = ""<br />
def __init__(self):<br />
self.vars = {} # dictionary variables read from the score file<br />
def refresh(self):<br />
"""Refresh the score"""<br />
url_opener = urllib.URLopener()<br />
url = url_opener.open(self.SCORE_URL)<br />
self.vars = {}<br />
for stmt in url.read().split('\n'):<br />
stmt = stmt.strip()<br />
if stmt == "": continue<br />
var, val = stmt.split('=')<br />
self.vars[var] = val<br />
url.close()<br />
return self.vars<br />
def render(self):<br />
"""Return the rendered text"""<br />
return "%(l1)s\n%(message)s\n%(tagline)s\n" % self.vars<br />
class RediffScore(Score):<br />
SCORE_URL = "http://livechat.rediff.com:80/sports/score/score.txt"<br />
def getMatchName(self):<br />
return self.vars['tagline']<br />
def getScore(self):<br />
return self.vars['l2']<br />
def getTeams(self):<br />
return self.vars['l1']<br />
def getDate(self):<br />
return self.vars['date']<br />
def getMessage(self):<br />
return self.vars['message']<br />
def getInterval(self):<br />
return self.vars['interval']<br />
if __name__ == '__main__':<br />
print 'Current score'<br />
sc = RediffScore()<br />
sc.refresh()<br />
print sc.render()<br />
</code></strong></p>
<p>Copy the script in a text editor and save it as <strong>score.py</strong> in your home folder.<br />
Now run the script by :<br />
<strong>animesh@animesh-laptop:~$ python score.py</strong></p>
<p>The output should be somewhat like :<br />
<strong>Current score<br />
Australia vs New Zealand<br />
Australia 181-10 (48.4)<br />
S Tait(9)</strong></p>
<p>Note: There is a problem with the script here.. i think when i copy pasted the file the indentation got messed up..<br />
So here&#8217;s a link from where you can download it..<br />
<a href="http://www.box.net/shared/uu203jgou0">http://www.box.net/shared/uu203jgou0</a></p>
<p>If you face any problem please comment. <img src='http://itsanimesh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://itsanimesh.com/2009/02/01/python_script_for_cricket_score/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Compress Pictures In Linux(Modified)!!!</title>
		<link>http://itsanimesh.com/2009/02/01/compress-pictures-in-linuxmodified/</link>
		<comments>http://itsanimesh.com/2009/02/01/compress-pictures-in-linuxmodified/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 08:03:10 +0000</pubDate>
		<dc:creator>Animesh Kumar</dc:creator>
				<category><![CDATA[Techi Gyaan]]></category>
		<category><![CDATA[FOSS]]></category>
		<category><![CDATA[Imagemagick]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Softwares]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://itsanimesh.com/?p=156</guid>
		<description><![CDATA[I got the script to move the new compressed images into a new folder that would be located in your home folder. As i explained before you need imagemagick installed on your system to run the script. In ubuntu it can be installed by typing in the terminal sudo apt-get install imagemagick Heres the script [...]]]></description>
			<content:encoded><![CDATA[<p>I got the script to move the new compressed images into a new folder that would be located in your home folder.</p>
<p>As i explained <a href="http://itsanimesh.com/2009/01/26/compress-pictures-in-linux/">before</a> you need <strong>imagemagick</strong> installed on your system to run the script.<br />
In ubuntu it can be installed by typing in the terminal <strong>sudo apt-get install imagemagick</strong></p>
<p>Heres the script :<br />
<code><strong>#!/bin/bash<br />
# A script to resize images.<br />
readonly OUT_FMT=&quot;_new.jpg&quot;<br />
if [ &quot;$#&quot; -eq 0 ] ; then<br />
  echo &quot;A script to resize images &quot;<br />
  echo &quot;How to use : $(basename $0) add_of_image1 add_of_image2 ...&quot;<br />
  exit 1<br />
fi<br />
read -p 'Enter name of Folder where compressed images would be located (would be made in your home folder) : ' fname<br />
mkdir ~/$fname<br />
for pic<br />
do<br />
  # New filename<br />
  out_name=&quot;${pic%.*}$OUT_FMT&quot;<br />
  if [ -e &quot;$out_name&quot; ] ; then<br />
    echo &quot;Output file $out_name exists, Not resizing!!!&quot;<br />
  elif [ &quot;${pic#*$OUT_FMT}&quot; == &quot;&quot; ] ; then<br />
    echo &quot;$pic already resized!!!&quot;<br />
  elif [ ! -r &quot;$pic&quot; ] ; then<br />
    echo &quot;Error : could not access $pic !!!&quot;<br />
  else<br />
    echo -n &quot;$pic -&gt; $out_name&quot;<br />
    convert -quality 80 -resize 800x600 &quot;$pic&quot; &quot;$out_name&quot;<br />
    if [ ! -e &quot;$out_name&quot; ] ; then<br />
      echo &quot; Error .. No output file!!!&quot;<br />
    else<br />
      echo &quot; ($(du -h &quot;$out_name&quot; | cut -f1))&quot;<br />
    fi<br />
  fi<br />
mv "$out_name" ./$fname/<br />
done<br />
</strong></code></p>
<p>I also didn&#8217;t explain the script properly in the previous post so i&#8217;ll that now.<br />
Firstly the script should be copied from here and pasted in a text editor. Then save it as <strong>resize.sh </strong> in your home folder(you can save it any where you wish but then how you call the scritp would change thats why its easier to save it in the home folder <img src='http://itsanimesh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ). Now open a terminal type:<br />
<strong>animesh@animesh-laptop:~$ sudo chmod +x resize.sh</strong></p>
<p>after this do <strong>animesh@animesh-laptop:~$ ./resize.sh aaa.jpg </strong><br />
This would ask a for a folder where new image should be placed<br />
<strong>Enter name of Folder where compressed images would be located (would be made in your home folder) : </strong><br />
Specify the name of a new folder where you wanna save the image.<br />
The new compressed image would be saved in the folder you specified with the name <strong>aaa_new.jpg</strong></p>
<p>You can also convert all pictures of a directory at once by<br />
<strong>animesh@animesh-laptop:~$ ./resize.sh Desktop/linux09/*.JPG</strong><br />
This to would ask for a folder where you would like to save the new compressed images.</p>
<p>Now in the line <strong>convert -quality 80 -resize 800&#215;600 &quot;$pic&quot; &quot;$out_name&quot;</strong> in script the value after <strong>-quality </strong> is the argument specifies the amount of JPEG/MIFF/PNG compression level, the lower the value(meaning 60 or 50) the higher is the compression(change it according to what you want). The <strong>-resize</strong> is used to resize an image, the argument following resize(i.e. 800&#215;600) can be changed to what you want.<br />
Leave a comment if you face any problems. <img src='http://itsanimesh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://itsanimesh.com/2009/02/01/compress-pictures-in-linuxmodified/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Compress Pictures In Linux!!!</title>
		<link>http://itsanimesh.com/2009/01/26/compress-pictures-in-linux/</link>
		<comments>http://itsanimesh.com/2009/01/26/compress-pictures-in-linux/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 14:06:45 +0000</pubDate>
		<dc:creator>Animesh Kumar</dc:creator>
				<category><![CDATA[Techi Gyaan]]></category>
		<category><![CDATA[FOSS]]></category>
		<category><![CDATA[Imagemagick]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Softwares]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://itsanimesh.com/?p=127</guid>
		<description><![CDATA[I have made a script to compress a set of images so that they can be mailed as images taken form a digicam are normally of 10 or 15MB and to upload a set of images is a pain in the ***. Firstly you need to install package Imagemagick&#8230; In ubuntu you can install by [...]]]></description>
			<content:encoded><![CDATA[<p>I have made a script to compress a set of images so that they can be mailed as images taken form a digicam are normally of 10 or 15MB and to upload a set of images is a pain in the ***. <img src='http://itsanimesh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Firstly you need to install package Imagemagick&#8230;<br />
In ubuntu you can install by <strong>sudo apt-get install imagemagick<br />
</strong><br />
Now just copy the attached in an editor:<br />
<code><strong>#!/bin/bash<br />
# A script to resize images.<br />
readonly OUT_FMT=&quot;_new.jpg&quot;<br />
if [ &quot;$#&quot; -eq 0 ] ; then<br />
  echo &quot;A script to resize images &quot;<br />
  echo &quot;How to use : $(basename $0) add_of_image1 add_of_image2 ...&quot;<br />
  exit 1<br />
fi<br />
for pic<br />
do<br />
  # New filename<br />
  out_name=&quot;${pic%.*}$OUT_FMT&quot;<br />
  if [ -e &quot;$out_name&quot; ] ; then<br />
    echo &quot;Output file $out_name exists, Not resizing!!!&quot;<br />
  elif [ &quot;${pic#*$OUT_FMT}&quot; == &quot;&quot; ] ; then<br />
    echo &quot;$pic already resized!!!&quot;<br />
  elif [ ! -r &quot;$pic&quot; ] ; then<br />
    echo &quot;Error : could not access $pic !!!&quot;<br />
  else<br />
    echo -n &quot;$pic -&gt; $out_name&quot;<br />
    convert -quality 80 -resize 800x600 &quot;$pic&quot; &quot;$out_name&quot;<br />
    if [ ! -e &quot;$out_name&quot; ] ; then<br />
      echo &quot; Error .. No output file!!!&quot;<br />
    else<br />
      echo &quot; ($(du -h &quot;$out_name&quot; | cut -f1))&quot;<br />
    fi<br />
  fi<br />
done<br />
</strong></code></p>
<p>Now save it as resize.sh in your home folder.</p>
<p>Now in the terminal type<br />
<strong>animesh@animesh-laptop:~$ sudo chmod +x resize.sh</strong></p>
<p>after this do <strong>animesh@animesh-laptop:~$ ./resize.sh aaa.jpg </strong><br />
This would return a file <strong>aaa_new.jpg</strong></p>
<p>You can also convert all pictures of a directory at once by<br />
<strong>animesh@animesh-laptop:~$ ./resize.sh Desktop/linux09/*.JPG</strong></p>
<p>The only problem with the script is that all the resized pictures would be in the same folder as original pictures. I am not able to move it in a new folder don&#8217;t know why. If you face any problem please leave a comment or if you know the solution to my problem please lemme know&#8230; <img src='http://itsanimesh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<strong><a href="http://itsanimesh.com/2009/02/01/compress-pictures-in-linuxmodified/">This post has being modified.</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://itsanimesh.com/2009/01/26/compress-pictures-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
