<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"><channel><title>TechDiary</title><description>thoughts, ideas, scratch pad ...</description><managingEditor>noreply@blogger.com (My Notes about ...)</managingEditor><pubDate>Mon, 9 Sep 2024 15:45:36 +0530</pubDate><generator>Blogger http://www.blogger.com</generator><openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">49</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">25</openSearch:itemsPerPage><link>http://techdiary-viki.blogspot.com/</link><language>en-us</language><itunes:explicit>no</itunes:explicit><itunes:keywords>perl,scripting,shell,script</itunes:keywords><itunes:subtitle>Perl: Tips &amp; Tutorials</itunes:subtitle><itunes:category text="Education"><itunes:category text="Educational Technology"/></itunes:category><itunes:category text="Technology"/><itunes:author>Viki</itunes:author><itunes:owner><itunes:email>vikas.nv@gmail.com</itunes:email><itunes:name>Viki</itunes:name></itunes:owner><item><title>Quotes</title><link>http://techdiary-viki.blogspot.com/2016/02/quotes.html</link><pubDate>Mon, 22 Feb 2016 21:08:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-3370023304055252919</guid><description>“You are not your idea, and if you identify too closely with your ideas, you will take offense when they are challenged.”&lt;br /&gt;
Catmull, E. and Wallace, A. (2014) Creativity, Inc.: Overcoming the Unseen Forces That Stand in the Way of True Inspiration&lt;br /&gt;
&lt;br /&gt;
“This is one of the most important lessons of the scientific method: if you cannot fail, you cannot learn.”&lt;br /&gt;
Ries, E. (2011). The Lean Startup: How Today's Entrepreneurs Use Continuous Innovation to Create Radically Successful Businesses.&lt;br /&gt;
&lt;br /&gt;
“The trick to having good ideas is not to sit around in glorious isolation and try to think big thoughts. The trick is to get more parts on the table.”&lt;br /&gt;
Johnson, S. (2010). Where Good Ideas Come From: The Natural History of Innovation&lt;br /&gt;
&lt;br /&gt;
“Failure isn’t a necessary evil. In fact, it isn’t evil at all. It is a necessary consequence of doing something new.”&lt;br /&gt;
Catmull, E. and Wallace, A. (2014). Creativity, Inc.: Overcoming the Unseen Forces That Stand in the Way of True Inspiration</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>ElasticSearch -- Why Why its still RED</title><link>http://techdiary-viki.blogspot.com/2016/02/elasticsearch-why-why-its-still-red.html</link><category>cluster</category><category>elasticsearch</category><category>red</category><category>status</category><pubDate>Mon, 22 Feb 2016 21:07:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-1478882091135571615</guid><description>RED: Damnit. Some or all of (primary) shards are not ready.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;YELLOW: Elasticsearch has allocated all of the primary shards, but some/all of the replicas have not been allocated.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;GREEN: Great. Your cluster is fully operational. Elasticsearch is able to allocate all shards and replicas to machines within the cluster.&lt;br /&gt;
&lt;br /&gt;
* shards not ready: not enuf file descriptors/ memory/ disk space&lt;br /&gt;
* when a node is restarted, the bigdesk shows no of docs, size, etc which keeps increasing &amp;amp; when that gets stable is when the status goes green&lt;br /&gt;
* you can keep backup nodes, when one goes &amp;nbsp;down u can up another but should have the same node name</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Elastic Search -- Notes on Restart nodes </title><link>http://techdiary-viki.blogspot.com/2016/02/elastic-search-notes-on-restart-nodes.html</link><category>elasticsearch</category><category>nodes</category><category>shards</category><category>shutdown</category><category>start</category><category>status</category><pubDate>Mon, 22 Feb 2016 21:05:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-374745630801572250</guid><description>Steps to shutdown &amp;amp; restart Elastic Search:&lt;br /&gt;
1. Disable all crons&lt;br /&gt;
2. Shutdown the non-master nodes first one by one&lt;br /&gt;
3. Shutdown master&lt;br /&gt;
4. Start the master by enabling its cron&lt;br /&gt;
5. Wait for the master to come up &amp;amp; show "red" in bigdesk and let it load approx number of docs&lt;br /&gt;
6. Start the data node one by one, wait until the bigdesk shows "yellow" &amp;amp; wait until the data nodes have approx number of docs&lt;br /&gt;
7. Wait until all shards are "started" in http://xyz:9200/_cat/shards&lt;br /&gt;
8. Start the non-data nodes now</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Perl dancer app.pl -- auto reload (not using the Dancer's feature auto_reload)</title><link>http://techdiary-viki.blogspot.com/2015/10/perl-dancer-apppl-auto-reload-not-using.html</link><category>auto_reload</category><category>md5</category><category>perl</category><category>perl dancer</category><pubDate>Thu, 29 Oct 2015 14:08:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-5443029213251939203</guid><description>Here is a script that can be added as a cron -&lt;br /&gt;
To kill and start the Dancer's app.pl, whenever there are changes to files in lib directory of your app.&lt;br /&gt;
&lt;br /&gt;
The script relies on the modified times of all files residing in the lib folder of your Dancer's app.&lt;br /&gt;
If there is a change in the mtime i.e. (stat(file))[9] of any of your files, it kills the Dancer app and starts again.&lt;br /&gt;
&lt;br /&gt;
In the script below change the &lt;b&gt;[perl-path]&lt;/b&gt; to your Perl installation location. And&amp;nbsp;&lt;b&gt;"/home/vikas/dancer/esui/bin"&lt;/b&gt; to your Dancer's bin location.&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------script--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
#!&lt;b&gt;[perl-path]&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
use strict;&lt;br /&gt;
use Digest::MD5 qw(md5_hex);&lt;br /&gt;
&lt;br /&gt;
my $appdir = &lt;b&gt;"/home/vikas/dancer/esui/bin"&lt;/b&gt;;&lt;br /&gt;
&lt;br /&gt;
if (-f "$appdir/iam.running") {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; my $old_mtime_md5 = '';&lt;br /&gt;
&amp;nbsp; &amp;nbsp; open(F, "$appdir/last.fstat.md5") and do {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; chomp($old_mtime_md5 = &lt;f&gt;);&lt;/f&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; close F;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; };&lt;br /&gt;
&amp;nbsp; &amp;nbsp; my $new_mtime_md5 = getMtimeMD5();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if ($new_mtime_md5 ne $old_mtime_md5) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # restart the app.pl&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; system("echo $new_mtime_md5 &amp;gt; $appdir/last.fstat.md5");&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; system("cat $appdir/iam.running | xargs kill -9 &amp;amp;&amp;amp; rm -f $appdir/iam.running");&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; system("( sh -c 'echo \$\$&amp;gt;$appdir/iam.running &amp;amp;&amp;amp; exec $appdir/app.pl' &amp;gt;/tmp/esui.dancer.log 2&amp;gt;&amp;amp;1 ) &amp;amp;");&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
} else {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; my $new_mtime_md5 = getMtimeMD5();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; system("echo $new_mtime_md5 &amp;gt; $appdir/last.fstat.md5");&lt;br /&gt;
&amp;nbsp; &amp;nbsp; system("( sh -c 'echo \$\$&amp;gt;$appdir/iam.running &amp;amp;&amp;amp; exec $appdir/app.pl' &amp;gt;/tmp/esui.dancer.log 2&amp;gt;&amp;amp;1 ) &amp;amp;");&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sub getMtimeMD5 {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; my $mtimes = '';&lt;br /&gt;
&amp;nbsp; &amp;nbsp; opendir(D, "$appdir/../lib") and do {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while (my $f = readdir(D)) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; next if (!-f "$appdir/../lib/$f");&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $mtimes .= (stat("$appdir/../lib/$f"))[9];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; closedir(D);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; };&lt;br /&gt;
&amp;nbsp; &amp;nbsp; return md5_hex($mtimes);&lt;br /&gt;
}</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Elasticsearch DSL to Perl Search::Elasticsearch query/filter body</title><link>http://techdiary-viki.blogspot.com/2015/10/elasticsearch-dsl-to-perl.html</link><category>DSL queries</category><category>elasticsearch</category><category>JSON</category><category>perl dancer</category><category>search::elasticsearch</category><category>webapp</category><pubDate>Wed, 28 Oct 2015 23:06:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-8110362483417630928</guid><description>I use "sense", chrome extension to try out all the DSL queries for Elasticsearch.&lt;br /&gt;
&lt;br /&gt;
When I find a suitable query, I copy that to a notepad &amp;amp; modify the DSL query (JSON format) into a Perl data structure since I primarily use Perl dancer for development.&lt;br /&gt;
&lt;br /&gt;
This manual conversion can become tedious if the queries go lengthy. For this I added a Perl dancer route to handle this conversion.&lt;br /&gt;
&lt;br /&gt;
This Perl dancer route basically converts the JSON formatted DSL query into a Perl data structure so that it can be used to pass into a filter or query of Search::Elasticsearch object.&lt;br /&gt;
&lt;br /&gt;
Here are the snippets of both the dancer app and the HTML page that uses the route. In the HTML page you have to modify [YOURSERVER] to your server where you host the Perl dancer app.&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------route--handler------------------------------------------------&lt;br /&gt;
package miscroutes;&lt;br /&gt;
use Dancer ':syntax';&lt;br /&gt;
use Dancer::Plugin::Ajax;&lt;br /&gt;
use Data::Dumper;&lt;br /&gt;
&lt;br /&gt;
any ['ajax', 'post'] =&amp;gt; '/json2perl' =&amp;gt; sub {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; my $req_ds = from_json(request-&amp;gt;body);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; local $Data::Dumper::Indent = 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; local $Data::Dumper::Quotekeys = 0;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; local $Data::Dumper::Sortkeys = 0;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; local $Data::Dumper::Deparse = 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; local $Data::Dumper::Terse = 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; return sprintf "%s", Dumper($req_ds);&lt;br /&gt;
};&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
---------------------------------------------------standalone--html--page------------------------------------------&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt; JSON to Perl DS &amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;script type="text/javascript" src="http:/[YOURSERVER]/javascripts/jquery.js"&amp;gt; &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; function submit_() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $.ajax({&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; type: "POST",&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cache:false,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data: $("textarea#in").val().replace(/(?:\r\n|\r|\n)/g,''),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; url: "http://[YOURSERVER]/json2perl",&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; success: function(d) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $("textarea#out").val(d);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dataType: "text",&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; error: function(j, errstr, err) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $("div#res").html("ERRORED: "+errstr);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; $(document).ready(function() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
&amp;lt;textarea type="text" id="in" style="width:500px;height:600px;"&amp;gt;&amp;lt;/textarea&amp;gt;&lt;br /&gt;
&amp;lt;textarea type="text" id="out" style="width:400px;height:600px;"&amp;gt;&amp;lt;/textarea&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
&amp;lt;button onclick="submit_();" &amp;gt;Convert&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=res&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Perl dancer - enable CORS</title><link>http://techdiary-viki.blogspot.com/2015/10/perl-dancer-enable-cors.html</link><category>Access-Control-Allow-Origin</category><category>ajax</category><category>CORS</category><category>cross-domain requests</category><category>No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.</category><category>perl dancer</category><pubDate>Wed, 28 Oct 2015 22:52:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-4650399675059651816</guid><description>While developing using Perl dancer, it is common to run the app.pl located in ./bin directory while testing.&lt;br /&gt;
And suppose you have web pages that requests data from your dancer app through AJAX.&lt;br /&gt;
You will likely get into a situation where the browser in which you are trying to load the web page errors out saying -&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre class="literallayout" style="background-color: white; font-family: Monaco, Consolas, 'Lucida Console', monospace; font-stretch: normal; margin-bottom: 10px; margin-top: 10px;"&gt;No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'null' is therefore not allowed access.&lt;/pre&gt;
&lt;pre class="literallayout" style="background-color: white; font-family: Monaco, Consolas, 'Lucida Console', monospace; font-size: 18px; font-stretch: normal; margin-bottom: 10px; margin-top: 10px;"&gt;&lt;/pre&gt;
&lt;div style="background-color: white; font-stretch: normal; margin-bottom: 10px; margin-top: 10px;"&gt;
&lt;span style="font-family: inherit;"&gt;This is because of a security feature of AJAX requests. You can solve this by adding a hook into your dancer app, like this -&lt;/span&gt;&lt;/div&gt;
&lt;pre class="literallayout" style="background-color: white; font-family: Monaco, Consolas, 'Lucida Console', monospace; font-size: 18px; font-stretch: normal; margin-bottom: 10px; margin-top: 10px;"&gt;&lt;/pre&gt;
&lt;pre class="literallayout" style="background-color: white; font-stretch: normal; margin-bottom: 10px; margin-top: 10px;"&gt;&lt;span style="font-family: Monaco, Consolas, Lucida Console, monospace;"&gt;&lt;span style="font-size: 18px;"&gt;hook before =&amp;gt; sub {
    my $route = shift;
    header 'Access-Control-Allow-Origin' =&amp;gt; '*';
};&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Monaco, Consolas, 'Lucida Console', monospace; font-size: 18px;"&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Automate download web page (after evaluating Javascript/Ajax on page) for offline viewing</title><link>http://techdiary-viki.blogspot.com/2015/06/automate-download-web-page-after.html</link><category>download web page</category><category>firefox</category><category>mechanize</category><category>mozrepl</category><category>offline viewing</category><category>perl</category><category>perl module install</category><category>www</category><category>www::mechanize::firefox</category><pubDate>Fri, 19 Jun 2015 17:53:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-5113132404162940900</guid><description>At times there is a need to download a webpage for offline viewing and the issue comes when the page is dynamic.&lt;br /&gt;
&lt;br /&gt;
Dynamic web pages uses Javascript to modify the HTML or add styles dynamically, or even have AJAX calls in the web pages that downloads content to be displayed.&lt;br /&gt;
&lt;br /&gt;
If you download the same using a command line tool like 'wget' or 'curl' you will get the web page in its initial state &amp;amp; you need to be connected to internet/intranet so that the browser does the Javascript/AJAX stuff.&lt;br /&gt;
&lt;br /&gt;
To download a fully evaluated web page you need these things --&lt;br /&gt;
&lt;br /&gt;
1. Perl&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;a. This module installed -&amp;nbsp;&lt;a href="http://search.cpan.org/~corion/WWW-Mechanize-Firefox-0.78/lib/WWW/Mechanize/Firefox.pm" target="_blank"&gt;&lt;span style="background-color: white; color: #545454; font-family: arial, sans-serif; font-size: x-small; line-height: 18.2000007629395px;"&gt;WWW::&lt;/span&gt;&lt;span style="background-color: white; color: #6a6a6a; font-family: arial, sans-serif; font-size: x-small; font-weight: bold; line-height: 18.2000007629395px;"&gt;Mechanize&lt;/span&gt;&lt;span style="background-color: white; color: #545454; font-family: arial, sans-serif; font-size: x-small; line-height: 18.2000007629395px;"&gt;::&lt;/span&gt;&lt;span style="background-color: white; color: #6a6a6a; font-family: arial, sans-serif; font-size: x-small; font-weight: bold; line-height: 18.2000007629395px;"&gt;Firefox&lt;/span&gt;&lt;/a&gt;&amp;nbsp;(&lt;a href="http://www.cpan.org/modules/INSTALL.html" target="_blank"&gt;how to install Perl module&lt;/a&gt;)&lt;br /&gt;
2. Mozilla Firefox with &lt;a href="https://addons.mozilla.org/en-us/firefox/addon/mozrepl/" target="_blank"&gt;MozRepl &lt;/a&gt;plugin added and started&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;a.&amp;nbsp;Once installed, start the MozRepl in your firefox as below:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Tools-&amp;gt;MozRepl-&amp;gt;Start&lt;br /&gt;
&lt;br /&gt;
To confirm if the plugin is installed and running try this:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmnZgwnjOIxFfFJ_csarkoK9fF4yS5r0NV7dPJqaQ8ZpeGPEgD4WveV1mhPs15QPN7GgU5VkH9mWoxKBaXvbItjDIGPjC2cDrsbLMORBD7X6ayxzsbGL8GS9omJJfqdCdBNidiNEyMyxI/s1600/mozrepl.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="161" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmnZgwnjOIxFfFJ_csarkoK9fF4yS5r0NV7dPJqaQ8ZpeGPEgD4WveV1mhPs15QPN7GgU5VkH9mWoxKBaXvbItjDIGPjC2cDrsbLMORBD7X6ayxzsbGL8GS9omJJfqdCdBNidiNEyMyxI/s320/mozrepl.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And the code to download --&lt;br /&gt;
&amp;nbsp; &amp;nbsp; my $mech = new WWW::Mechanize::Firefox;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; $mech-&amp;gt;get("http://webURLtoDownload", 'no_cache' =&amp;gt; 1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; $mech-&amp;gt;save_content("$tmp_file_for_dwnload");&lt;br /&gt;
&lt;br /&gt;
For more details about the WWW::Mechanize::Firefox you can read &lt;a href="http://search.cpan.org/~corion/WWW-Mechanize-Firefox-0.78/lib/WWW/Mechanize/Firefox.pm" target="_blank"&gt;here&lt;/a&gt;</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmnZgwnjOIxFfFJ_csarkoK9fF4yS5r0NV7dPJqaQ8ZpeGPEgD4WveV1mhPs15QPN7GgU5VkH9mWoxKBaXvbItjDIGPjC2cDrsbLMORBD7X6ayxzsbGL8GS9omJJfqdCdBNidiNEyMyxI/s72-c/mozrepl.JPG" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Steps to convert any Perl Dancer route handler to a Perl subroutine</title><link>http://techdiary-viki.blogspot.com/2015/06/steps-to-convert-any-perl-dancer-route.html</link><category>MVC</category><category>perl</category><category>perl dancer</category><category>template</category><category>Template toolkit</category><pubDate>Mon, 15 Jun 2015 15:08:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-6138507914737508886</guid><description>For those who don't know what is Dancer; it is a Perl MVC framework and can be &lt;a href="http://www.perldancer.org/" target="_blank"&gt;checked out here&lt;/a&gt;. &lt;a href="http://search.cpan.org/~yanick/Dancer-1.3136/lib/Dancer/Cookbook.pod" target="_blank"&gt;The cookbook&lt;/a&gt; is very elaborate.&lt;br /&gt;
&lt;br /&gt;
Here is what this post is all about --&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# Way to convert any dancer route handler to a Perl subroutine&lt;br /&gt;
# 1. copy the route handler code, give it a subroutine name&lt;br /&gt;
# 2. remove use Dancer related lines from 'use' statements&lt;br /&gt;
# 3. include 'use &lt;a href="http://search.cpan.org/~abw/Template-Toolkit-2.26/lib/Template.pm" target="_blank"&gt;Template&lt;/a&gt;;'&lt;br /&gt;
# 4. create a Template object with options as in -&lt;br /&gt;
### my $template = Template-&amp;gt;new({&lt;br /&gt;
### &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INCLUDE_PATH &amp;nbsp;=&amp;gt; &amp;nbsp; &amp;nbsp;'/opt/my/webapp/views',&lt;br /&gt;
### &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;OUTPUT =&amp;gt; $output_file,&lt;br /&gt;
### &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ABSOLUTE =&amp;gt; 1,&lt;br /&gt;
### });&lt;br /&gt;
# 5. in your template change the template variables to look like this -&amp;gt; [% tmpl_var %]&lt;br /&gt;
# 6. use the 'process' command of Template to write the final html&lt;br /&gt;
#&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
That's all for now.&lt;/div&gt;
&lt;div&gt;
Thanks&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Configuring Apache  -- enable Virtual Hosts -- for PerlDancer -- CGI on Plack -- Linux</title><link>http://techdiary-viki.blogspot.com/2013/05/configuring-apache-enable-virtual-hosts.html</link><category>apache</category><category>httpd</category><category>perl dancer</category><category>virtual host</category><category>webapp</category><pubDate>Sun, 12 May 2013 08:41:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-146839968600094247</guid><description>Virtual Hosts in Apache can be used to host different web applications on the same server. Each application listening on different ports. &lt;br /&gt;
&lt;br /&gt;
Assuming your Perl Dancer installation (which can be done using cpan shell/ppm shell/cpanminus) and creation of the web app scaffold, say in, /opt/webapp is already done.&lt;br /&gt;
&lt;br /&gt;
Uncomment the rewrite module&lt;br /&gt;
&lt;br /&gt;
Decide on the port on which to listen to (this example uses, 4129); and add another Listen directive along with the one that is already there.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Listen 4129&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
There will already be entry for Virtual Host at the end of the httpd.conf; which needs to be uncommented. An example for the VirtualHost directive --&lt;br /&gt;
&lt;br /&gt;
&lt;textarea style="height: 320px; width: 550px;"&gt;&lt;virtualhost *:4129&gt;
    ServerName example.com
    DocumentRoot "/opt/webapp/public/"
    ServerAdmin admin@localhost
  
    &lt;directory "/opt/webapp/public/"&gt;
       AllowOverride None
       Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
       Order allow,deny
       Allow from all
       AddHandler cgi-script .cgi
    &lt;/Directory&gt;

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ /dispatch.cgi/$1 [QSA,L]

    ErrorLog  "/opt/webapp/logs/error.log"
    CustomLog "/opt/webapp/logs/access.log" common
&lt;/VirtualHost&gt;&lt;/textarea&gt;&lt;br /&gt;
&lt;br /&gt;
Restart httpd</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Javascript: Using ajax &amp; jquery-csv to load a CSV file on client side</title><link>http://techdiary-viki.blogspot.com/2012/10/javascript-using-ajax-jquery-csv-to.html</link><category>ajax</category><category>client side database processing</category><category>client side file processing</category><category>csv</category><category>javascript</category><category>jquery-csv</category><pubDate>Tue, 16 Oct 2012 13:48:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-251005151826190082</guid><description>Basically, the need here is to store the required data in a CSV on the server so all that the client side Javascript needs to do is read that CSV and fetch the required data.&lt;br /&gt;
&lt;br /&gt;
Here is a small snippet of code that uses ajax in &lt;a href="http://jquery.com/" target="_blank"&gt;jquery&lt;/a&gt; to read the CSV file and &lt;a href="http://code.google.com/p/jquery-csv/" target="_blank"&gt;jquery-csv&lt;/a&gt; to parse the CSV and convert it into an array of arrays. &lt;br /&gt;
&lt;br /&gt;
&lt;script src="jquery-1.8.1.min.js" type="text/javascript"&gt; &lt;/script&gt;&lt;br /&gt;
&lt;script src="jquery.csv-0.64.min.js" type="text/javascript"&gt;&lt;/script&gt;
var csv_as_array = [];&lt;br /&gt;
function drawVisualization() {&lt;br /&gt;
&amp;nbsp; $.ajax({&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; url: "data-store/data1.csv",&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; aync: false,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; success: function (csvd) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; csv_as_array = $.csv2Array(csvd);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }, &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataType: "text",&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; complete: function () {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // use the array of arrays (variable csv_as_array)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // for further processing&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp; });&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
This I have used along with google charts to create charts depending on the CSV file passed.</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>HTML context recognizer, data extration, context driven content extraction</title><link>http://techdiary-viki.blogspot.com/2012/09/html-context-recognizer-data-extration.html</link><category>context based parsing</category><category>html</category><category>html parse</category><category>python</category><pubDate>Sun, 2 Sep 2012 22:28:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-8827033368367726697</guid><description>This is just an idea to ease the extraction of data from websites. This works on websites that are well structured and consistent in the structure. Usually, all the well crafted websites create webpages dynamically where the server uses a template at its end, so this idea should work.&lt;br /&gt;
&lt;br /&gt;
The idea is divided into two modules, HtmlContextRecognizer and Gather. The other modules used are BeautifulSoup and argparse.&lt;br /&gt;
&lt;br /&gt;
The idea is basically this -- given a sample (text appearing on a webpage) the HtmlContextRecognizer &lt;br /&gt;
recognizes the 'context' in which it appears, that is the tags it is surrounded with and the attributes it has.&lt;br /&gt;
&lt;br /&gt;
And the module Gather, it uses HtmlContextRecognizer and extends its concept to do two things --&lt;br /&gt;
1. recognizes the context of a sample data text and uses this context to gather 'like' data&lt;br /&gt;
2. recognizes the context of a anchor text and uses this context to gather 'like' urls for navigation&lt;br /&gt;
&lt;br /&gt;
As an example, I used it to extract jokes from a website that has a collection of sms'es.&lt;br /&gt;
&lt;br /&gt;
I have not thought of any application for this, other than the one I mentioned above. Let me know how you used it.&lt;br /&gt;
&lt;br /&gt;
Link to scripts: &lt;a href="https://docs.google.com/folder/d/0B0-iayzVpwJ3T0gzSFdkMXJ1Vzg/edit"&gt;https://docs.google.com/folder/d/0B0-iayzVpwJ3T0gzSFdkMXJ1Vzg/edit&lt;/a&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Debian/LXDE running on Acer Iconia A500 tab</title><link>http://techdiary-viki.blogspot.com/2011/08/debianlxde-running-on-acer-iconia-a500.html</link><category>android</category><category>debian</category><category>hacking</category><category>lxde</category><pubDate>Wed, 24 Aug 2011 18:47:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-1239981366687788113</guid><description>I got a chance to have this tablet for sometime, and since then I have been hacking it. The first thing to do is most obvious, to root the device. I have reloaded the tablet with Taboonay's ROM (1.1) based on the Android Honeycomb 3.1 stock ROM. It has it's cool features, about which you can read &lt;a href="http://forum.xda-developers.com/showthread.php?t=1138051"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;And thanks to &lt;a href="http://lanrat.com/android/debian"&gt;lanrat &lt;/a&gt;for an article about this.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;*** Do this if you fully understand what you are doing***&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Now over to getting Debian on to the tablet.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Your device should be rooted. You need some free space on the SD card, about 1 GB is sufficient for this.&amp;nbsp;Secondly you have to prepare a base installer image of Debian, I did this on Ubuntu 11.04. If you do not have a Linux box don't sweat it, get&lt;a href="http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/"&gt; Linux on a pen drive&lt;/a&gt; and boot from that.&amp;nbsp;And you need the Android terminal, also set it up such that your $PATH variable has /system/xbin in the beginning. For installing/configuring LXDE you need to have a mouse and keyboard connected to your tablet (I used an old bluetooth keyboard and mouse from Logitech EX100).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Once you are in Ubuntu open a terminal and do the following to create the base image -&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;sudo -s&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;apt-get install debootstrap&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;dd if=/dev/zero of=debian.img seek=1073741824 bs=1 count=1 # I use 1 GB image size **&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;mke2fs -F debian.img&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;mkdir debian&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;mount -o loop debian.img debian/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;debootstrap --verbose --arch armel --foreign lenny debian http://ftp.us.debian.org/debian&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;umount debian/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;rm -r debian/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;** you can use lesser image size (800 MB) if you do not want to install LXDE.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;With that you have a Debian base installer image. Now download this &lt;a href="https://docs.google.com/document/pub?id=1XQe5zyelNj1lpMUAsROzySv1kYMxObiOxAZfAWrKWZw"&gt;chroot script&lt;/a&gt;, which will be used to set up environment to run Debian (save this file as bootdebian). Copy this image and the chroot script to the SD card, such that it lays in&amp;nbsp;&lt;/div&gt;&lt;div&gt;/mnt/external_sd&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Now put back the SD card into the tablet and power on. Following commands will make the chroot script&lt;/div&gt;&lt;div&gt;executable in Android terminal and turn it into a command, open Android terminal on the tablet and type -&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;su&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;mount -o remount,rw -t yaffs2 /dev/block/mmcblk0p3 /system&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;cat /mnt/external_sd/bootdebian &amp;gt; /system/xbin/bootdebian&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;dos2unix /system/xbin/bootdebian&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;rm /mnt/external_sd/bootdebian&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;chmod 777 /system/xbin/bootdebian&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;With that done, you have a command 'bootdebian' which can be run to set up to run Debian.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;After this you need to complete the Debian install, for that run the following commands on the Android terminal -&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;bootdebian&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;/debootstrap/debootstrap --second-stage&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;echo 'deb http://ftp.us.debian.org/debian lenny main' &amp;gt;/etc/apt/sources.list&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;apt-get autoclean&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;apt-get update&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;exit&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;This completes the Debian install. From now on if you want to work on a real Linux box, you just have to ope n the Android terminal and run 'bootdebian'.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Now, commands for installing LXDE -&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;bootdebian&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;apt-get install xdm&lt;/span&gt; # this downloads ~30 MB&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;apt-get install lxde&lt;/span&gt; # this downloads ~100 MB, so you can 'take wakelock' the terminal &amp;amp; go for a walk&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Once the apt-get completes the installations, it starts configuring the LXDE. This is the time you need your hardware keyboard (if not mouse) when it asks for some settings. Look for the place where it asks for which display manager and select 'xdm'.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Next you need to install the tightvncserver so as to create vnc session. For that, run&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;apt-get install tightvncserver&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Once done with that, you can start the session with these commands -&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;export USER=root&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;vncserver -geometry 1280x736 -depth 16&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Above command will ask you for setting up passwords. This creates a session on localhost:1, which is a basic desktop. To start LXDE in the session, you have to instruct the vncserver using the xstartup script. For doing this, run the following commands -&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;vncserver -kill :1&lt;/span&gt; &amp;nbsp;# first kill the running session&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: yellow;"&gt;vi /root/.vnc/xstartup&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;This opens the vi editor loaded with the vncserver's start up script. Edit this script such that it looks something like this -&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #f1c232;"&gt;#!/bin/sh&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #f1c232;"&gt;xrdb $HOME/.Xresources&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #f1c232;"&gt;xsetroot -solid grey&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #f1c232;"&gt;#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &amp;amp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #f1c232;"&gt;#x-window-manager &amp;amp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #f1c232;"&gt;#/etc/X11/Xsession&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: #f1c232;"&gt;startlxde&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Save the file and close. Start the VNC session.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;To view the session, you can either use the AndroidVNC application on your tablet or any VNC viewer on your PC.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;This ends!&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Script to set the compatibility mode of executable files on Windows 7</title><link>http://techdiary-viki.blogspot.com/2011/03/script-to-set-compatibility-mode-of.html</link><category>compatibility mode</category><category>python</category><category>python script set windows compatibility mode</category><category>script</category><category>windows</category><category>windows compatibility mode script</category><pubDate>Sun, 20 Mar 2011 22:20:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-6524511394391137982</guid><description>I wanted to install the portable Ubuntu on my Windows machine, and so I downloaded the executable from the &lt;a href="http://sourceforge.net/projects/portableubuntu/"&gt;sourceforge project site&lt;/a&gt;&amp;nbsp;and installed it.&lt;br /&gt;
&lt;br /&gt;
It did not work, I initially thought I have to change the compatibility mode of the executables and set it to Windows XP SP2. There were too many files for which I had to change, so I came up with a script.&lt;br /&gt;
&lt;br /&gt;
This script takes these options:&lt;br /&gt;
-p /--path &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;for which you pass the path (all executable files under this path will be considered)&lt;/span&gt;&lt;br /&gt;
-m /--mode &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;for which you pass the compatibility mode (list of valid modes given at the end of the post)&lt;/span&gt;&lt;br /&gt;
-a /--runasadmin &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;which is a toggle option which enables/disables the "Run as Administrator" option (default: disabled)&lt;/span&gt;&lt;br /&gt;
-v /--verbose &lt;span class="Apple-style-span" style="background-color: #ffe599;"&gt;which is a toggle option which print more information (default: disabled)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The script did work :) ... but the portable Ubuntu did not :(&lt;br /&gt;
&lt;br /&gt;
You can download the script from &lt;a href="http://www.box.net/shared/noigp2zdal"&gt;here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Don't worry to run this script on the same directory multiple times, the Windows registry takes care of duplicates by adding a file as a single entry.&lt;br /&gt;
&lt;br /&gt;
List of compatibility modes (that go with --mode/ -m option):&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;"WIN95": "Windows 95 compatibilty mode",&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;"WIN98": "Windows Millennium or 98 compatibility mode",&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;"NT4SP5": "NT 4.0 Service Pack 5 compatibility mode",&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;"WIN2000": "Windows 2K compatibility mode",&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;"WINXPSP2": "Windows XP Service Pack 2 compatibility mode",&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;"WINSRV03SP1": "Windows Server 2003 SP 1 compatibility mode"&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;EDIT:&lt;/b&gt;&lt;br /&gt;
How to run this script on Windows... ?&lt;br /&gt;
Firstly, install python on your Windows machine. For installation you should download an appropriate&lt;br /&gt;
setup file for your Windows machine from this &lt;a href="http://www.python.org/download/releases/2.7.1/"&gt;link&lt;/a&gt;, then double click the setup file and follow the on screen instructions.&lt;br /&gt;
Secondly, download the script from &lt;a href="http://www.box.net/shared/noigp2zdal"&gt;here&lt;/a&gt;. And here is how to run it:&lt;br /&gt;
Open a command terminal in Windows by hitting Windows+R keys and entering "cmd" (no quotes)&lt;br /&gt;
Then, navigate to the directory to which you downloaded the script (using 'cd'), when you are there&lt;br /&gt;
type these commands:&lt;br /&gt;
&lt;span class="Apple-style-span" style="background-color: orange;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;python&amp;nbsp;compatibility_change.py --path "c:\\path\\to\\executables" --mode&amp;nbsp;WINXPSP2&lt;/span&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>IMDB API</title><link>http://techdiary-viki.blogspot.com/2011/03/imdb-api.html</link><category>extract movie details</category><category>imdb</category><category>imdb api</category><category>imdb python api</category><category>movie details from imdb</category><category>python imdb api</category><category>python module movie details</category><pubDate>Thu, 3 Mar 2011 21:09:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-6617508622730511930</guid><description>[UPDATE: links are update]&lt;br /&gt;
&lt;br /&gt;
Here I present the module which provides APIs to get information about movies from IMDB.&lt;br /&gt;
&lt;br /&gt;
This is about a Python implementation of IMDB API.&lt;br /&gt;
&lt;br /&gt;
You don't have to download the IMDB's databases locally to use these APIs.&lt;br /&gt;
&lt;br /&gt;
I have used Peteris Krumins' xgoogle library along with the BeautifulSoup to develop this in Python.&lt;br /&gt;
&lt;br /&gt;
You may have to install the BeautifulSoup module (download from &lt;a href="http://www.crummy.com/software/BeautifulSoup/download/3.x/BeautifulSoup-3.2.0.tar.gz"&gt;here&lt;/a&gt;) and xgoogle library (from &lt;a href="http://www.box.net/shared/r218urokj2pq0dg988hs"&gt;here&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
And &lt;a href="http://www.box.net/shared/nekju4unfq"&gt;here&lt;/a&gt; is the link for &lt;a href="http://www.box.net/shared/nekju4unfq"&gt;IMDB API&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Here is a little bit of description about the usage:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; from pIMDB import pIMDB&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(sys.argv) &amp;lt; 2:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Usage: %s &lt;movie name=""&gt;" % sys.argv[0]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit(1)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; movie = re.sub(r'[^a-zA-Z0-9\']+', ' ', sys.argv[1])&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; imdb = pIMDB(movie)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; imdb.parse_imdb_page()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "imdb link:\n\t", imdb.imdb_link&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie name:\n\t", imdb.movie&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie rating:\n\t%s/%s" % (imdb.rating, imdb.outof)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie details:\n\t%s" % '\n\t'.join(imdb.details)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie storyline:\n\t%s" % imdb.storyline&lt;/movie&gt;&lt;br /&gt;
&lt;br /&gt;
It also has an API to download the poster from the IMDB website, you can use it as here:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; imdb.download_poster('/tmp/destination.jpg')&lt;br /&gt;
&lt;br /&gt;
That's the end of the story :)&lt;br /&gt;
&lt;br /&gt;
PS: Write a comment on how you used this module</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">8</thr:total><author>vikas.nv@gmail.com (Viki)</author><enclosure length="31056" type="application/x-gzip" url="http://www.crummy.com/software/BeautifulSoup/download/3.x/BeautifulSoup-3.2.0.tar.gz"/><itunes:explicit>no</itunes:explicit><itunes:subtitle>[UPDATE: links are update] Here I present the module which provides APIs to get information about movies from IMDB. This is about a Python implementation of IMDB API. You don't have to download the IMDB's databases locally to use these APIs. I have used Peteris Krumins' xgoogle library along with the BeautifulSoup to develop this in Python. You may have to install the BeautifulSoup module (download from here) and xgoogle library (from here) And here is the link for IMDB API Here is a little bit of description about the usage: &amp;nbsp;&amp;nbsp;&amp;nbsp; from pIMDB import pIMDB &amp;nbsp;&amp;nbsp;&amp;nbsp; if len(sys.argv) &amp;lt; 2: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Usage: %s " % sys.argv[0] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit(1) &amp;nbsp;&amp;nbsp;&amp;nbsp; movie = re.sub(r'[^a-zA-Z0-9\']+', ' ', sys.argv[1]) &amp;nbsp;&amp;nbsp;&amp;nbsp; imdb = pIMDB(movie) &amp;nbsp;&amp;nbsp;&amp;nbsp; imdb.parse_imdb_page() &amp;nbsp;&amp;nbsp;&amp;nbsp; print "imdb link:\n\t", imdb.imdb_link &amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie name:\n\t", imdb.movie &amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie rating:\n\t%s/%s" % (imdb.rating, imdb.outof) &amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie details:\n\t%s" % '\n\t'.join(imdb.details) &amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie storyline:\n\t%s" % imdb.storyline It also has an API to download the poster from the IMDB website, you can use it as here: &amp;nbsp;&amp;nbsp;&amp;nbsp; imdb.download_poster('/tmp/destination.jpg') That's the end of the story :) PS: Write a comment on how you used this module</itunes:subtitle><itunes:author>Viki</itunes:author><itunes:summary>[UPDATE: links are update] Here I present the module which provides APIs to get information about movies from IMDB. This is about a Python implementation of IMDB API. You don't have to download the IMDB's databases locally to use these APIs. I have used Peteris Krumins' xgoogle library along with the BeautifulSoup to develop this in Python. You may have to install the BeautifulSoup module (download from here) and xgoogle library (from here) And here is the link for IMDB API Here is a little bit of description about the usage: &amp;nbsp;&amp;nbsp;&amp;nbsp; from pIMDB import pIMDB &amp;nbsp;&amp;nbsp;&amp;nbsp; if len(sys.argv) &amp;lt; 2: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Usage: %s " % sys.argv[0] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit(1) &amp;nbsp;&amp;nbsp;&amp;nbsp; movie = re.sub(r'[^a-zA-Z0-9\']+', ' ', sys.argv[1]) &amp;nbsp;&amp;nbsp;&amp;nbsp; imdb = pIMDB(movie) &amp;nbsp;&amp;nbsp;&amp;nbsp; imdb.parse_imdb_page() &amp;nbsp;&amp;nbsp;&amp;nbsp; print "imdb link:\n\t", imdb.imdb_link &amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie name:\n\t", imdb.movie &amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie rating:\n\t%s/%s" % (imdb.rating, imdb.outof) &amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie details:\n\t%s" % '\n\t'.join(imdb.details) &amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nmovie storyline:\n\t%s" % imdb.storyline It also has an API to download the poster from the IMDB website, you can use it as here: &amp;nbsp;&amp;nbsp;&amp;nbsp; imdb.download_poster('/tmp/destination.jpg') That's the end of the story :) PS: Write a comment on how you used this module</itunes:summary><itunes:keywords>perl,scripting,shell,script</itunes:keywords></item><item><title>Configure Gmail on your N900</title><link>http://techdiary-viki.blogspot.com/2010/11/configure-gmail-on-your-n900.html</link><category>gmail</category><category>n900</category><pubDate>Thu, 18 Nov 2010 20:34:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-3843532486366081239</guid><description>Here is a little guide to setup Gmail on your N900 using the Email application that comes by default on N900.&lt;br /&gt;
&lt;br /&gt;
I am writing this because I could not find a working solution when I tried Google-ing "how to configure n900 for gmail".&lt;br /&gt;
&lt;br /&gt;
Basically, I just helped my N900 to resolve imap.gmail.com and smtp.gmail.com&lt;br /&gt;
So here goes the steps...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Connect to the internet on your PC/laptop and ping imap.gmail.com &amp;amp; smtp.gmail.com. Note down the IP addresses of both. Here is a screen shot of the command prompt&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWrpmMXhkh073G1pAkgm36EwEFudPLVGqNc04O5RCz4cgWOOqaCOuEGFvHMe_45ls2-YI7CLdJF7NGwnNWIoJOMcyQPLlxV02rZjU54G8HjsBA9ODG1Yes9SvcEQoMwTGQE2Ut00Jpvug/s1600/cmd-scrshot.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="164" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWrpmMXhkh073G1pAkgm36EwEFudPLVGqNc04O5RCz4cgWOOqaCOuEGFvHMe_45ls2-YI7CLdJF7NGwnNWIoJOMcyQPLlxV02rZjU54G8HjsBA9ODG1Yes9SvcEQoMwTGQE2Ut00Jpvug/s320/cmd-scrshot.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;2. Now on your N900 launch the Terminal and gain root access (if you don't know what I am telling, read this &lt;a href="http://maemo.org/downloads/product/Maemo5/rootsh/"&gt;Rootsh&lt;/a&gt;)&lt;br /&gt;
3. Edit the file /etc/hosts (I use vi to edit)&lt;br /&gt;
4. Add following two lines to the file (do not delete any lines already existing in the file)&lt;br /&gt;
72.14.213.109&amp;nbsp;&amp;nbsp; imap.gmail.com&lt;br /&gt;
74.125.53.109 &amp;nbsp; smtp.gmail.com &lt;br /&gt;
(Replace the IP addresses in the above lines to what you noted down in the 1st step)&lt;br /&gt;
5. Save the file and exit the editor&lt;br /&gt;
6. Launch the Email application on N900. Follow the wizard that it shows by selecting Gmail in the list of providers that it shows.&lt;br /&gt;
7. Enter your user name and password and go till you click finish.&lt;br /&gt;
&lt;br /&gt;
The account you set up should work fine. If not, tap on Edit settings for the account and make sure the settings are as shown in the screen shot below&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8Hz8O_evQB1omnR-oTvmyT6In__4n6pMXHJUy6ag0Dy4v-kUoKBth6A4Zf36zbdxS10rIsq8qD_SZPJmYqrlJ24eupfX4igdUYWGi9_LO2LKuCVqkA-R5cH5OduxF7hiWK9udiIMY2dU/s1600/Screenshot-n900-gmail-settings.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8Hz8O_evQB1omnR-oTvmyT6In__4n6pMXHJUy6ag0Dy4v-kUoKBth6A4Zf36zbdxS10rIsq8qD_SZPJmYqrlJ24eupfX4igdUYWGi9_LO2LKuCVqkA-R5cH5OduxF7hiWK9udiIMY2dU/s320/Screenshot-n900-gmail-settings.png" width="189" /&gt;&lt;/a&gt;&lt;/div&gt;</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWrpmMXhkh073G1pAkgm36EwEFudPLVGqNc04O5RCz4cgWOOqaCOuEGFvHMe_45ls2-YI7CLdJF7NGwnNWIoJOMcyQPLlxV02rZjU54G8HjsBA9ODG1Yes9SvcEQoMwTGQE2Ut00Jpvug/s72-c/cmd-scrshot.jpg" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Frozen Bubble on N900 :) !!!</title><link>http://techdiary-viki.blogspot.com/2010/10/frozen-bubble-on-n900.html</link><category>frozen bubble</category><category>n900</category><category>n900 games</category><pubDate>Wed, 6 Oct 2010 20:34:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-10426932342475919</guid><description>Have you played this game, frozen bubble? Its the most addictive game I have ever played ... next to some games like bejeweled. I had this game on my previous phone Nokia 5800. So I was searching for this game ... hoping some one would have ported it to N900 (currently I own it). WOW I found it here http://maemo.org/packages/view/frozen-bubble/&lt;br /&gt;
&lt;br /&gt;
It is still in development repository but I have used it and it is working perfectly. It has great music and great graphics this time, and its called frozen bubble 2.&lt;br /&gt;
&lt;br /&gt;
Enjoy!</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>how to re-organize menu icons on N900 (with catorise)</title><link>http://techdiary-viki.blogspot.com/2010/08/how-to-re-organize-menu-icons-on-n900.html</link><pubDate>Sun, 29 Aug 2010 21:27:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-2703602096263238545</guid><description>You can get the icons in the menu of your N900 organized into folders using an application called catorise.&lt;br /&gt;This app automatically groups the menu icons and puts them into different folders of meaningful names.&lt;br /&gt;But sometimes you feel ... hey this icon should be in the games folder why is it put into the ovi folder??? I felt this when i saw bounce in ovi folder after installing catorise.&lt;br /&gt;And so i launched the xterm and started looking for some kind of a config file or something where i can change the grouping. Went into the /opt folder to check out the installed apps ... there was a folder catorise cd into it and ls ... there was something very obviously named file 'menu'. But i need to be root to edit this, became root and opened this file using vi. It is a simple config file with this syntax -&gt;&lt;br /&gt;app name: folder name&lt;br /&gt;I changed -&gt;&lt;br /&gt;bounce: ovi&lt;br /&gt;to this -&gt;&lt;br /&gt;bounce: games&lt;br /&gt;Saved it and closed it.&lt;br /&gt;Then ran the perl script named catorise in pwd.&lt;br /&gt;This changed the grouping, bounce appears in games than in ovi :)</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>PCron ---- portable cron :)</title><link>http://techdiary-viki.blogspot.com/2010/03/pcron-portable-cron.html</link><category>cron for windows</category><category>crontab</category><category>portable cron</category><category>portable scheduler</category><category>scheduler</category><pubDate>Wed, 24 Mar 2010 20:05:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-6324283119672364167</guid><description>PCron&lt;br /&gt;&lt;br /&gt;Cron for Windows &amp;amp; ... :)&lt;br /&gt;&lt;br /&gt;Cron is basically a job scheduler available in Linux and its variants/flavors.&lt;br /&gt;I have tried to implement the functionality of Cron in Python so that it can be used in Windows and ....&lt;br /&gt;&lt;br /&gt;You should have Python 2.5 + installed to use this.&lt;br /&gt;&lt;br /&gt;Input for PCron is a plain text file (lets' call it pcrontab) with syntax/format similar to *nix crontab. pcrontab can have formats such as -&gt; */12 and 12-20&lt;br /&gt;Here is an example of a pcrontab:&lt;br /&gt;*/5      *      *       *       *       F:\Program Files (x86)\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe&lt;br /&gt;57-59        18        *        *        *         F:\Program Files (x86)\Calc.exe&lt;br /&gt;&lt;br /&gt;In above example, first line instructs PCron to start the program mpc-hc.exe every 5 minutes.&lt;br /&gt;And the second line instructs PCron to start the program Calc.exe on 18:57, 18:58, 18:59&lt;br /&gt;&lt;br /&gt;To understand more on the syntax of pcrontab ... look at the picture below which  explains about crontab -&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAXLiRHt-LW4IzdKB5OKMsLgqWqsN-AO-BG0IkMa6nZ2oQ1nkNUpWh2-fkTyann0sJACgqH1frpSYeXw4U6_8Nl5vZWYuDnu6zOteZfNTXK8A5_W1-dN_h5BmWL9SGrAGpWEXcNj1UOH4/s1600/crontab-syntax.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 130px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAXLiRHt-LW4IzdKB5OKMsLgqWqsN-AO-BG0IkMa6nZ2oQ1nkNUpWh2-fkTyann0sJACgqH1frpSYeXw4U6_8Nl5vZWYuDnu6zOteZfNTXK8A5_W1-dN_h5BmWL9SGrAGpWEXcNj1UOH4/s320/crontab-syntax.gif" alt="" id="BLOGGER_PHOTO_ID_5452214707023343554" border="0" /&gt;&lt;/a&gt;Usage:&lt;br /&gt;python pcron.py --taskfile &lt;full&gt;&lt;br /&gt;Examples:&lt;br /&gt;    python pcron.py --taskfile c:\\pcrontab.txt&lt;br /&gt;    python pcron.py --taskfile /home/vikas/pcrontab&lt;br /&gt;Currently it writes out logs to stdout, so you have to redirect it ... to say /dev/null or a file&lt;br /&gt;&lt;br /&gt;Limitations:&lt;br /&gt;Each time you add an entry into the pcrontab, you have to restart the script or wait until the script reloads the pcrontab (it reloads in every 5 minutes ~)&lt;br /&gt;Does not support entire format/syntax combinations as compared to crontab&lt;br /&gt;&lt;br /&gt;More things to come:&lt;br /&gt;An editor for pcrontab ... that would detect changes in pcrontab and initiates automatic reload in pcron&lt;br /&gt;Support for a timeout field in pcrontab, which enables us to run a program for a certain period of time&lt;br /&gt;&lt;br /&gt;You can download the scripts from here:&lt;br /&gt;&lt;a href="http://docs.google.com/leaf?id=0B0-iayzVpwJ3OTk4NDI0MjAtZGQzNy00N2I3LWFlMGYtMGYxZDQ1NjNlYjdk&amp;amp;hl=en"&gt;TimedPopenNT&lt;/a&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/leaf?id=0B0-iayzVpwJ3YjRkMDAyN2MtODE3Zi00MDg5LWJhNmItODVkYThlOWQ0Yjkx&amp;amp;hl=en"&gt;Scheduler&lt;/a&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/leaf?id=0B0-iayzVpwJ3NTAyNzk2YWQtM2Q2My00YTIyLWIxZGQtMDQ5OTdmZjUwMDIy&amp;amp;hl=en"&gt;pcron&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;On Windows you can generate a .exe file using py2exe and use that as standalone instead of the script.&lt;/full&gt;</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAXLiRHt-LW4IzdKB5OKMsLgqWqsN-AO-BG0IkMa6nZ2oQ1nkNUpWh2-fkTyann0sJACgqH1frpSYeXw4U6_8Nl5vZWYuDnu6zOteZfNTXK8A5_W1-dN_h5BmWL9SGrAGpWEXcNj1UOH4/s72-c/crontab-syntax.gif" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Extract or Reap or Download Pictures from HTML Web Pages</title><link>http://techdiary-viki.blogspot.com/2009/06/extract-or-reap-images-from-html-web.html</link><category>download pictures</category><category>extract jpeg files</category><category>extract pictures webpage</category><category>jpeg reaper</category><category>picture reaper</category><category>web reaper</category><pubDate>Thu, 18 Jun 2009 21:12:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-6279973689533908368</guid><description>&lt;span style="font-family:verdana;"&gt;I was exploring python and the HTML parsers that it has. I hit a page that explained about the SGMLParser and its uses.&lt;br /&gt;&lt;br /&gt;Using this package I had written a simple script that could extract pictures from simple HTML pages. While experimenting it with many websites I noticed some websites did not allow my script to reap or extract pictures.&lt;br /&gt;&lt;br /&gt;Then I found that it is because of the User-Agent string in the HTTP request. Some websites do not respond properly to HTTP requests that have unknown User-Agent string. I then used the urllib's FancyURLOpener to change the User-Agent to Firefox.&lt;br /&gt;&lt;br /&gt;Now that the script work on most of the websites, i would like to post the code here. Feel free to modify to make it more robust and reliable, post a comment or a link to your modified script.&lt;br /&gt;&lt;br /&gt;This script search pictures from web pages and download them for you. All you need to do is&lt;br /&gt;get the URL of the web page from which you want the pictures to be downloaded and pass it as&lt;br /&gt;an argument to this script. Here is how to use it:&lt;br /&gt;    0. Note that python is installed on your system to run this script (Windows/Linux/Solaris ... OS independent;)&lt;br /&gt;    1. Download this script and save it as gal_ext.py&lt;br /&gt;    2. Open a command-prompt (if Windows) or Terminal (if you use any *nix OS)&lt;br /&gt;    3. Type "python gal_ext.py 'http://URL'&lt;br /&gt;    4. Here note that the 'http://' is mandatory&lt;br /&gt;Using this script you can avoid downloading images with a web browser, which takes a long time and is annoying to right click on every image and save them. This way you can download picture from web faster and easier. Since this is a script it is open for modifications and is free to use. But if you modify, make a note to send it to me ;). Thanks&lt;br /&gt;&lt;br /&gt;The code is here (&lt;a href="http://docs.google.com/View?id=dg2jxmfs_51dsk6x7gv"&gt;or a link for you to download&lt;/a&gt;):&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="Python"&gt;&lt;br /&gt;from sgmllib import SGMLParser&lt;br /&gt;import sys&lt;br /&gt;import os&lt;br /&gt;import re&lt;br /&gt;import urllib&lt;br /&gt;from urllib import FancyURLopener&lt;br /&gt;from urlparse import urlparse&lt;br /&gt;&lt;br /&gt;class URLLister(SGMLParser):&lt;br /&gt;def reset(self):&lt;br /&gt;SGMLParser.reset(self)&lt;br /&gt;self.urls = []&lt;br /&gt;&lt;br /&gt;def start_a(self, attrs):&lt;br /&gt;href = [v for k, v in attrs if k=='href']&lt;br /&gt;if href:&lt;br /&gt;self.urls.extend(href)&lt;br /&gt;&lt;br /&gt;class MyURLOpener(FancyURLopener):&lt;br /&gt;version = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6'&lt;br /&gt;&lt;br /&gt;def url_mapper(var):&lt;br /&gt;regexp = re.compile('.+?(http://.+&amp;amp;?)', re.I)&lt;br /&gt;values = urlparse(var)&lt;br /&gt;if len(values) &gt;= 5 and values[4] != '':&lt;br /&gt;obj = regexp.search(values[4])&lt;br /&gt;if obj:&lt;br /&gt;values = urlparse(obj.group(1))&lt;br /&gt;else:&lt;br /&gt;if values[4] != '': print('Could not get real url from:' + values[4])&lt;br /&gt;site = re.sub('[^0-9a-zA-Z_/]', '_', values[1])&lt;br /&gt;location_file = re.findall('(.+)/(.+)', values[2])&lt;br /&gt;try:&lt;br /&gt;if len(location_file[0]) != 2:&lt;br /&gt;return ''&lt;br /&gt;except IndexError:&lt;br /&gt;return ''&lt;br /&gt;location = location_file[0][0]&lt;br /&gt;file = location_file[0][1]&lt;br /&gt;location = re.sub('\.{2,}/', '/', location)&lt;br /&gt;location = re.sub('[^0-9a-zA-Z_/]', '_', location)&lt;br /&gt;location = location + '/' + file&lt;br /&gt;return site + location&lt;br /&gt;&lt;br /&gt;if __name__ == '__main__':&lt;br /&gt;url_opener = MyURLOpener()&lt;br /&gt;parser = URLLister()&lt;br /&gt;sys.argv[1] = urllib.unquote(sys.argv[1])&lt;br /&gt;try:&lt;br /&gt;usock = url_opener.open(sys.argv[1])&lt;br /&gt;except IOError:&lt;br /&gt;print 'skipping ' + sys.argv[1]&lt;br /&gt;sys.exit(0)&lt;br /&gt;parser.feed(usock.read())&lt;br /&gt;parser.close()&lt;br /&gt;usock.close()&lt;br /&gt;count = 0&lt;br /&gt;urlfs = urlparse(sys.argv[1])&lt;br /&gt;print "Url fs: ", urlfs&lt;br /&gt;parent = urlfs[1]&lt;br /&gt;try:&lt;br /&gt;parent += urlfs[2]&lt;br /&gt;parent = re.search('(.+)/.+',parent).group(1)&lt;br /&gt;except IndexError:&lt;br /&gt;parent = urlfs[1]&lt;br /&gt;for img_url in parser.urls:&lt;br /&gt;if re.search('\.jpe?g$', img_url):&lt;br /&gt;print "looking at: " + img_url&lt;br /&gt;if not re.match('^http://', img_url):&lt;br /&gt;img_url = 'http://' + parent + '/' + img_url&lt;br /&gt;loc = url_mapper(img_url)&lt;br /&gt;if os.path.exists(loc): continue&lt;br /&gt;url_opener1 = MyURLOpener()&lt;br /&gt;retrieve = url_opener1.retrieve&lt;br /&gt;if loc == '':&lt;br /&gt;print "\turl_mapper returned NULL for " + img_url&lt;br /&gt;continue&lt;br /&gt;loc_dir = re.match('(.+)/.+', loc).group(1)&lt;br /&gt;try:&lt;br /&gt;print('\ttrying to save ' + img_url)&lt;br /&gt;if not os.path.exists(loc_dir):&lt;br /&gt; os.makedirs(loc_dir)&lt;br /&gt;retrieve(img_url, loc)&lt;br /&gt;except IOError:&lt;br /&gt;print('\tSkipping saving ' + img_url)&lt;br /&gt;continue&lt;br /&gt;count += 1&lt;br /&gt;print "\tImg fetched: ",count&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Installing andLinux on Windows Vista</title><link>http://techdiary-viki.blogspot.com/2009/05/installing-andlinux-on-windows-vista.html</link><category>andlinux</category><category>andlinux cannot connect to</category><category>linux emulator on windows</category><category>Linux on Vista</category><category>Linux on Windows Vista</category><category>problem installing andlinux on Windows Vista</category><pubDate>Thu, 28 May 2009 22:23:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-8028371167936487863</guid><description>After downloading the &lt;a href="http://downloads.sourceforge.net/andlinux/andlinux-beta2-kde.exe"&gt;andLinux installer (KDE version)&lt;/a&gt;, launch the installer as Administrator. And follow the steps with default options set.&lt;br /&gt;&lt;br /&gt;Reboot/Restart machine after installation.&lt;br /&gt;&lt;br /&gt;Click on Unblock if the Firewall prompts.&lt;br /&gt;&lt;br /&gt;After the reboot, you click on Konsole (any) launcher on KDE Menu from system tray, you are likely to get this error "&lt;em&gt;could not launch ... could not connect to&lt;/em&gt; 192.168.11.150"&lt;br /&gt;&lt;br /&gt;So this guide explains how to fix this issue, for the launchers to work on Windows Vista.&lt;br /&gt;&lt;br /&gt;First thing to do is to go to the "Network and Sharing Center" from Control Panel. You can see the "customize" and "view status" links on "Unidentified Network". Click on the "view status", click on properties and double click "Internet Protocol Version 4". That should open up a dialog where you can change the IP and the subnet mask, change the IP to 192.168.10.1 and subnet mask to 255.255.254.0. Click on OK OK ....&lt;br /&gt;&lt;br /&gt;Secondly, open the "andlinux Console" get sudo access and edit the file /etc/network/interfaces.&lt;br /&gt;After edit the file should have IP of 192.168.10.150 and the mask 255.255.254.0 under eth1&lt;br /&gt;&lt;br /&gt;Thirdly edit file /etc/profile to have IPs set to 192.168.10.150&lt;br /&gt;&lt;br /&gt;Fourthly navigate to the andlinux installation folder goto Xming folder edit X0.hosts and add the following IPs 192.168.10.150 and 192.168.10.1&lt;br /&gt;&lt;br /&gt;Lastly few registry changes, regedit and navigate to \\HKEY_LOCAL_MACHINE\\SOFTWARE\\andLinux\\Launcher&lt;br /&gt;Here you find to keys "IP" and "Port" set them to 192.168.10.150 and 2081 respectively.&lt;br /&gt;(Remember to click on Decimal while editing Port value) And close the regedit.&lt;br /&gt;&lt;br /&gt;Finally kill  KDE Menu, Xming. Restart andLinux service, and then start Xming and KDE Menu.&lt;br /&gt;Now the launchers work fine.&lt;br /&gt;&lt;br /&gt;If clicking on a launcher does not start, you open the andLinux Console application and execute:&lt;br /&gt;"/etc/init.d/networking restart". After this any launcher should work fine.&lt;br /&gt;&lt;br /&gt;!Enjoy!</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><author>vikas.nv@gmail.com (Viki)</author><enclosure length="563097803" type="application/octet-stream" url="http://downloads.sourceforge.net/andlinux/andlinux-beta2-kde.exe"/><itunes:explicit>no</itunes:explicit><itunes:subtitle>After downloading the andLinux installer (KDE version), launch the installer as Administrator. And follow the steps with default options set. Reboot/Restart machine after installation. Click on Unblock if the Firewall prompts. After the reboot, you click on Konsole (any) launcher on KDE Menu from system tray, you are likely to get this error "could not launch ... could not connect to 192.168.11.150" So this guide explains how to fix this issue, for the launchers to work on Windows Vista. First thing to do is to go to the "Network and Sharing Center" from Control Panel. You can see the "customize" and "view status" links on "Unidentified Network". Click on the "view status", click on properties and double click "Internet Protocol Version 4". That should open up a dialog where you can change the IP and the subnet mask, change the IP to 192.168.10.1 and subnet mask to 255.255.254.0. Click on OK OK .... Secondly, open the "andlinux Console" get sudo access and edit the file /etc/network/interfaces. After edit the file should have IP of 192.168.10.150 and the mask 255.255.254.0 under eth1 Thirdly edit file /etc/profile to have IPs set to 192.168.10.150 Fourthly navigate to the andlinux installation folder goto Xming folder edit X0.hosts and add the following IPs 192.168.10.150 and 192.168.10.1 Lastly few registry changes, regedit and navigate to \\HKEY_LOCAL_MACHINE\\SOFTWARE\\andLinux\\Launcher Here you find to keys "IP" and "Port" set them to 192.168.10.150 and 2081 respectively. (Remember to click on Decimal while editing Port value) And close the regedit. Finally kill KDE Menu, Xming. Restart andLinux service, and then start Xming and KDE Menu. Now the launchers work fine. If clicking on a launcher does not start, you open the andLinux Console application and execute: "/etc/init.d/networking restart". After this any launcher should work fine. !Enjoy!</itunes:subtitle><itunes:author>Viki</itunes:author><itunes:summary>After downloading the andLinux installer (KDE version), launch the installer as Administrator. And follow the steps with default options set. Reboot/Restart machine after installation. Click on Unblock if the Firewall prompts. After the reboot, you click on Konsole (any) launcher on KDE Menu from system tray, you are likely to get this error "could not launch ... could not connect to 192.168.11.150" So this guide explains how to fix this issue, for the launchers to work on Windows Vista. First thing to do is to go to the "Network and Sharing Center" from Control Panel. You can see the "customize" and "view status" links on "Unidentified Network". Click on the "view status", click on properties and double click "Internet Protocol Version 4". That should open up a dialog where you can change the IP and the subnet mask, change the IP to 192.168.10.1 and subnet mask to 255.255.254.0. Click on OK OK .... Secondly, open the "andlinux Console" get sudo access and edit the file /etc/network/interfaces. After edit the file should have IP of 192.168.10.150 and the mask 255.255.254.0 under eth1 Thirdly edit file /etc/profile to have IPs set to 192.168.10.150 Fourthly navigate to the andlinux installation folder goto Xming folder edit X0.hosts and add the following IPs 192.168.10.150 and 192.168.10.1 Lastly few registry changes, regedit and navigate to \\HKEY_LOCAL_MACHINE\\SOFTWARE\\andLinux\\Launcher Here you find to keys "IP" and "Port" set them to 192.168.10.150 and 2081 respectively. (Remember to click on Decimal while editing Port value) And close the regedit. Finally kill KDE Menu, Xming. Restart andLinux service, and then start Xming and KDE Menu. Now the launchers work fine. If clicking on a launcher does not start, you open the andLinux Console application and execute: "/etc/init.d/networking restart". After this any launcher should work fine. !Enjoy!</itunes:summary><itunes:keywords>perl,scripting,shell,script</itunes:keywords></item><item><title>Parsing and Storing parts or paragraphs of log file</title><link>http://techdiary-viki.blogspot.com/2009/05/parsing-and-storing-parts-or-paragraphs.html</link><category>data extraction</category><category>parse file extract multiple lines</category><category>parsing logs</category><category>Perl Regular Expressions</category><category>regular expression perl Perl regex options</category><pubDate>Sat, 9 May 2009 19:20:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-5271467873355319502</guid><description>At many times we need to parse and store parts of a log file. Suppose an error log, you would like to parse all errors. If the errors span only one line, you could use a grep.&lt;br /&gt;&lt;br /&gt;But if the errors span multiple lines ... you need to put a little logic into your script. There are many ways to do this, but this script that i post here is more readable and can be modified to other's requirement.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/Doc?id=dg2jxmfs_49hjdfdvc9"&gt;Link to the code&lt;/a&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/Doc?id=dg2jxmfs_50gm9mghfj"&gt;Link to a sample input&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the example script i am parsing an error log (named 'input.txt'). The script stores all lines that start with "SQL0204N" till it finds an empty line. Likewise it extracts all errors, even if the error messages span multiple lines.</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Perl script inside a DOS Batch file</title><link>http://techdiary-viki.blogspot.com/2009/04/perl-script-inside-dos-batch-file.html</link><pubDate>Wed, 1 Apr 2009 15:05:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-2367434498340904148</guid><description>Whenever I wanted to invoke a utility passing a file as an argument I used to create a shortcut of the utility in the Send To folder, as described here :&lt;br /&gt;&lt;h1 class="title"&gt;&lt;a href="http://support.microsoft.com/kb/310270"&gt;&lt;span style="font-size:100%;"&gt;How to Add Items to the "Send To" Menu&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;But how to have a Perl script in the "Send To" menu??&lt;br /&gt;&lt;br /&gt;I got an idea when browsing through this page :&lt;br /&gt;&lt;h1&gt;&lt;a href="http://www.dostips.com/DtCodeInterfacing.php"&gt;&lt;span style="font-size:100%;"&gt;DOS Batch - Interfacing non DOS Software&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;I created a batch script as described in the page. Then modified the part of the batch file where the Perl script actually starts.&lt;br /&gt;&lt;br /&gt;I wanted to have a utility that can encrypt/decrypt a text file. A basic encryption was sufficient, so considered the &lt;span style="font-weight: bold;"&gt;Caesar cipher.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;I completed the script and added it to the Send To menu&lt;span style="font-weight: bold;"&gt;.&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;a style="font-family: georgia;" href="http://docs.google.com/Doc?id=dg2jxmfs_46frvwj43t"&gt;Link to the script&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: georgia;"&gt;&lt;span&gt;A small modification to the above script to handle binary files. &lt;a href="http://docs.google.com/Doc?id=dg2jxmfs_47gchnbgfc"&gt;Here is the link.&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>andLinux   ---    Run Linux from Windows</title><link>http://techdiary-viki.blogspot.com/2008/12/andlinux-run-linux-from-windows.html</link><category>emulated Linux</category><category>emulated PC software</category><category>linux from windows</category><category>parallel OS</category><category>use windows and linux parallely</category><pubDate>Sat, 13 Dec 2008 22:10:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-5498531799646678577</guid><description>Have you ever had a feeling of using Linux when you are working on Windows???&lt;div&gt;Or&lt;/div&gt;&lt;div&gt;Felt like using those very useful Linux commands fromWindows???&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is possible ...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Everybody knows that you can have a Dual-Boot on your PC with Linux &amp;amp; Windows. In which you have to restart the PC to access the other OS. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But there are several other ways to have Other OS run right from Windows, that is for example use Linux when you have logged on to Windows... Yes... Virtual Machines (also popular as VM) is one of them. But running a VM requires that your hardware to be really good.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is one more option, we now have emulated PC software like &lt;a href="http://www.andlinux.org/"&gt;andLinux&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are many other softwares other than andLinux, such as CygwinX, MKS Toolkit, etc&lt;/div&gt;&lt;div&gt;But I found andLinux to be really very handy, straight-forward &amp;amp; useful.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Installing andLinux is as simple as installing other software ... clikcing Next, Next, Next ... &amp;amp; finnaly Finish :) there is a very &lt;a href="http://www.andlinux.org/install.php"&gt;elaborate tutorial&lt;/a&gt; on its web site&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However if you are the curious cat... you can also fiddle around &amp;amp; do the installation without the tutorial.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The home page of andLinux says &lt;span class="Apple-style-span" style="font-style: italic;"&gt;"a&lt;/span&gt;&lt;span class="Apple-style-span"  style=" ;font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;ndLinux is not just for development and runs almost all Linux applications without modification&lt;/span&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;". &lt;/span&gt;I have installed a lot many applications to andLinux, and its really true.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After installation you can see the icons of andLinux in system tray. You may see these icons :&lt;/div&gt;&lt;div&gt;KDE menu (andLinux)&lt;/div&gt;&lt;div&gt;Xming (andLinux)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;While installing say you choose E: drive as destination. It gets installled in a folder E:\andLinux.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It will create some folders &amp;amp; files in E:\andLinux, I will list some folders &amp;amp; files with thier &lt;span class="Apple-style-span"  style="font-size:medium;"&gt;purposes:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;1. settings.txt, a plain-text file that will have some paths necessary for andLinux to work properly&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;2. srvstart.bat, batch file, that has the command to start the andLinux service&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;3. srvstop.bat, batch file, has the command to stop andLinux service&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;4. startup.bat, again a batch file used to start the andLinux as deamon&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;5. Drives, directory, where the andLinux's filesystem is stored as files (base.drv, mine is 4GB in size and swap.drv)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;6. Launcher, directory, where all the executables can be seen. A good place to check out what all linux apps you get after installing andLinux.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;7. There are other directories as well, netdriver, pulseaudio &amp;amp; Xming&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;One application that is very usefull after installing andLinux is the &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;synaptic.&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; It is the application manager of andLinux. You can find this from KDE Menu / open a terminal &amp;amp; type &lt;span class="Apple-style-span" style="font-style: italic;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;synaptic.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is a huge collection of linux applications that you can select &amp;amp; install. As i feel the GUI is staright-forward &amp;amp; easy to understand, compared to CygwinX. It is more responsive on my machine with 512 MB of RAM &amp;amp; Dual Core Intel.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It is still in Beta, you can go to the &lt;a href="http://www.andlinux.org/downloads.php"&gt;andLinux&lt;/a&gt; website to download it. There is a &lt;a href="http://linuxtracker.org/index.php?page=torrents&amp;amp;category=466"&gt;torrent tracker&lt;/a&gt; also.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;EnJoy ...&lt;/div&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Script to comment parts of code in a source file</title><link>http://techdiary-viki.blogspot.com/2008/12/script-to-comment-parts-of-code-in.html</link><category>comment other scripts</category><category>comment source code</category><category>commenting script</category><category>script to comment source files</category><pubDate>Fri, 12 Dec 2008 17:01:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-109124640280445146</guid><description>&lt;div&gt;A friend of mine wanted a script to comment parts of code in a source file. We were chatting &amp;amp; i gave him this solution:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; "&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;me: perl --i.bak -pe 's/^(.*)$/#$1/gi if ($. &gt;=start_line_number &amp;amp;&amp;amp; $. &lt;= end_line_number)' filename&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; "&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;Try above command in terminal. Where start_line_number is the line number where u shud start commenting &amp;amp; end_line_number is where u want to stop commenting.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But he wanted that the script should take a function name as input rather than line numbers ... this is what he says: (name not published ;))&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;myfrend: hey vikas, i need a script to start commenting the codes without using line numbers, but using function name....is it possible?&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:13px;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;me: u mean to say u have function names ... &amp;amp; u want to comment the whole functions?&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;u mean to say u have function names ... &amp;amp; u want to comment the whole functions?&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;myfrend: yeah&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;s&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:13px;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;me: it is possible ... if u can get correct start&amp;amp;end boundaries for the functions&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:13px;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;myfrend: yeah..how to get it....its difficult&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:13px;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;me: how big can the file be .. that is MAX big file size?&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:13px;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;myfrend: say around 3000 lines&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I was asking a lot of questions about the source files like do they follow coding standards, etc .. &amp;amp; all that. So he suggested what he wanted to do ... i mean the logic ... he said:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;myfrend: my logic is : search for function name, then keep a counter to increment/decrement when { or } is found, when counter is zero, exit the prgm&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;me: this is holds good ... but u have to account for { } occuring on same line ... &amp;amp; account for comments, etc&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;myfrend: ok&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Got some free time to think about it ... &amp;amp; wrote a script for this. This may not be a complete solution, but a good starting point i guess.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is the link to the script:&lt;/div&gt;&lt;div&gt;&lt;a id="publishedDocumentUrl" class="tabcontent" target="_blank" href="http://docs.google.com/Doc?id=dg2jxmfs_43gbtd2jfq"&gt;http://docs.google.com/Doc?id=dg2jxmfs_43gbtd2jfq&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;PS - myfrend :&lt;div&gt;If you permit I can publish your name ... with a hyperlink possibly to your blog ;)&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item><item><title>Get Spiritual ...</title><link>http://techdiary-viki.blogspot.com/2008/08/get-spiritual.html</link><category>photo gallaries</category><category>srivatsa shroff's photo galleries</category><category>temples</category><category>vatsa</category><pubDate>Thu, 21 Aug 2008 17:01:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3366815763976900792.post-2113603536724058090</guid><description>Get spiritual ...&lt;br /&gt;&lt;br /&gt;Take a look at the photo galleries shared by my good friend in his blog.&lt;br /&gt;&lt;br /&gt;http://srivatsashroff.blogspot.com&lt;br /&gt;&lt;br /&gt;Notice lot of temples in the galleries, that is all with getting spiritual :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;PS: Obviously, this is post has nothing to do with Perl | ;) |&lt;br /&gt;Viki</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><author>vikas.nv@gmail.com (Viki)</author></item></channel></rss>