Sai Charan2023-01-22T22:53:20-08:00http://www.saicharan.in/Sai Charanme@saicharan.inDIY Water Leak Sensor with ESP8266 NodeMCU and Homebridge ServerSai Charanme@saicharan.inhttp://www.saicharan.in2023-01-22T10:05:00-08:00https://www.saicharan.in/blog/2023/01/22/diy-water-leak-sensor-with-esp8266<p>A leak at home got me looking at water level sensors, but Arlo’s recent <a href="https://9to5google.com/2023/01/02/arlo-end-of-life-policy/">annoucement</a> EOL’ing camera support pushed me over the edge into DIY IoT devices.</p>
<p>Luckily, in a really simple form, a water leak sensor simply uses water to close the circuit; so a closed circuit indicates water (or some other conductor!) was detected between the leads. Note that this set up cannot be used to detect leak of distilled water, because, well, distilled water cannot conduct electricity.</p>
<p>A brief search for a low-cost MCU with ADC and WiFi support turned up the ESP8266 family which costs ~$3 as of this writing. Awesome!</p>
<p>Specifically, I picked up the ‘ESP8266 ESP-12 D1 Mini NodeMCU Lua WeMos D1 Mini WIFI 4M Bytes Module’. I powered the MCU via a micro-USB. Solder 24-gauge wires to the 3.3V and the ADC pins on the chip, and let the open leads on the other ends of the wire lay on the floor where I’d like to detect leaks. And, done – that’s the hardware set up.</p>
<p>Next up, software. Programming for the ESP8266 is pretty straight forward, given the really awesome set of libraries for:</p>
<ul>
<li>Connecting the MCU to WiFi</li>
<li>Running a basic web server on the MCU</li>
<li>mDNS support so new devices can be auto-discovered</li>
<li>And, of course, to read the sensor values via ADC</li>
</ul>
<p>The next bit is to integrate with HomeKit (using <a href="https://homebridge.io">Homebridge</a>). Fortunately, again, I stumbled upon the very simple, and readable <a href="https://github.com/ dauden/homebridge-nodeMCU">dauden/homebridge-nodeMCU</a> repository that I tweaked a bit to include mDNS-based device discovery support. My adaptation of this Homebridge plugin is <a href="https://github.com/scharan/homebridge-nodeMCU">here</a>, and also includes the NodeMCU code.</p>
<p>Easy peasy!</p>
<p>Future:</p>
<ul>
<li>I’m also experimenting running this set up with 2x1.5v AA batteries; the Blink wireless camera has demonstrated that even with a WiFi device onboard, the set up can be made to last ~2 years, but let’s see how efficient this particular set up is!</li>
<li>One can of course 3D-print enclosures for this setup and make it appropriately water proof, perhaps? I’ll include 3D-print model files, if I get that far!</li>
</ul>
Terence Tao on WorkSai Charanme@saicharan.inhttp://www.saicharan.in2021-08-30T13:28:28-07:00https://www.saicharan.in/blog/2021/08/30/quote-terence-tao-work-hard<p>Relying on intelligence alone to pull things off at the last minute may work for a while, but, generally speaking, at the graduate level or higher it doesn’t.</p>
Automating Let's Encrypt Certs for DD-WRT with acme.shSai Charanme@saicharan.inhttp://www.saicharan.in2021-01-17T13:12:00-08:00https://www.saicharan.in/blog/2021/01/17/automate-letsencrypt-certs-dd-wrt-acme-sh<p>Following up on previous notes on setting up <a href="/blog/2021/01/05/letsencrypt-renew-certs-private-network-dns/">Let’s Encrypt for private networks</a> and <a href="/blog/2021/01/05/letsencrypt-ssl-certs-dd-wrt/">SSL for DD-WRT routers</a>, here’s notes on automating renewal of Let’s Encrypt certificates using <a href="https://acme.sh">acme.sh</a>.</p>
<p>I use Hurricane Electric’s free DNS service for delegating DNS management for the the private subdomains – DNS resolution is handled externally, but certificates are provisioned on the private network. You can find other free DNS providers on the Let’s Encrypt <a href="https://community.letsencrypt.org/t/dns-providers-who-easily-integrate-with-lets-encrypt-dns-validation/86438">community page</a>.</p>
<p>If you don’t want to make your private subdomain public, you can create a <code class="language-plaintext highlighter-rouge">dummy.domain.ext</code>, for example, and fetch wildcard certificates instead. If you are willing to open port 53 on your router and port forward, here’s <a href="/blog/2021/01/05/letsencrypt-renew-certs-private-network-dns/">another alternative</a>. Open to more suggestions, please post them in the comments.</p>
<h3 id="setup-instructions">Setup Instructions</h3>
<ul>
<li>Prerequistites are a DD-WRT router with exeternal USB storage support. My notes on the setup are <a href="/blog/2020/06/24/managing-your-internet-of/#choosing-a-version-of-dd-wrt">here</a> and <a href="/blog/2021/01/05/letsencrypt-ssl-certs-dd-wrt/">here</a>.</li>
<li>First, delegate your subdomain’s <em>public</em> DNS resolution to <a href="https://dns.he.net">https://dns.he.net</a> by setting up <code class="language-plaintext highlighter-rouge">NS</code> records for <code class="language-plaintext highlighter-rouge">subdomain.domain.ext</code> to point to <code class="language-plaintext highlighter-rouge">ns[1-5].he.net</code>, then add the subdomain to <a href="https://dns.he.net">https://dns.he.net</a> via ‘Add a new domain’ page on the ‘Zone Functions’ menu.</li>
<li>Then, download <a href="https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh">https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh</a>, give it execute permissions: <code class="language-plaintext highlighter-rouge">chmod +x ./acme.sh</code>.</li>
<li>Next, run the following by adjusting the variables as appropriate.</li>
</ul>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>export HE_Username=""
export HE_Password=""
./acme.sh --install \
--home /jffs/etc/acme.sh/ \
--config-home /jffs/etc/acme.sh/data \
--cert-home /jffs/etc/acme.sh/certs \
--accountemail "email@domain.ext" \
--useragent "DD-WRT acme.sh" --force
</code></pre></div></div>
<ul>
<li>Then copy the corresponding <code class="language-plaintext highlighter-rouge">dns_<provider>.sh</code> from <a href="https://github.com/acmesh-official/acme.sh/tree/master/dnsapi">https://github.com/acmesh-official/acme.sh/tree/master/dnsapi</a> to <code class="language-plaintext highlighter-rouge">/jffs/etc/acme.sh/dnsapi/</code>.</li>
<li>Test issuing a new cert:
<code class="language-plaintext highlighter-rouge"># /jffs/etc/acme.sh/acme.sh --issue --dns dns_he -d subdomain.domain.ext --config-home /jffs/etc/acme.sh/data 2>&1 >> /jffs/etc/acme.sh/logs/log.txt --staging --force</code></li>
<li>Revoke the test cert
<code class="language-plaintext highlighter-rouge"># /jffs/etc/acme.sh/acme.sh --revoke -d subdomain.domain.ext --revoke-reason 4 --config-home /jffs/etc/acme.sh/data/ --staging</code></li>
<li>Issue a production certificate by running the issue command above without <code class="language-plaintext highlighter-rouge">--staging</code> option.</li>
<li>Setup cron. Remember to prefix the cron command with <code class="language-plaintext highlighter-rouge">root</code> as pointed out <a href="https://wiki.dd-wrt.com/wiki/index.php/CRON#Cron_Job_Instruction:_Locations">here</a>.</li>
</ul>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Every day at 3 AM: https://crontab.guru/#0_3_*_*_*
0 3 * * * root /jffs/etc/acme.sh/acme.sh --renew --dns dns_he -d subdomain.domain.ext --config-home /jffs/etc/acme.sh/data >> /jffs/etc/acme.sh/logs/log.txt # --staging --force
</code></pre></div></div>
<h3 id="references">References</h3>
<ul>
<li><a href="https://github.com/acmesh-official/acme.sh/wiki/How-to-install">https://github.com/acmesh-official/acme.sh/wiki/How-to-install</a></li>
<li><a href="https://community.letsencrypt.org/t/dns-providers-who-easily-integrate-with-lets-encrypt-dns-validation/86438">https://community.letsencrypt.org/t/dns-providers-who-easily-integrate-with-lets-encrypt-dns-validation/86438</a></li>
</ul>
The Best Test of Truth...Sai Charanme@saicharan.inhttp://www.saicharan.in2021-01-12T23:07:00-08:00https://www.saicharan.in/blog/2021/01/12/best-test-of-truth<p>Reading Stratechery’s <a href="https://stratechery.com/2019/tech-and-liberty/">Tech and Liberty</a>, ‘The Marketplace of Ideas’ section, I see this quote:</p>
<blockquote>
<p>The theory of our Constitution is “that the best test of truth is the power of the thought to get itself accepted in the competition of the market,” Abrams v. United States, 250 U.S. 616, 630, 40 S.Ct. 17, 63 L.Ed. 1173 (1919) (Holmes, J., dissenting).</p>
</blockquote>
<p>And, the first thing that jumps at me is the implication that <em>Tuth</em>, by this interpretation, <em>is a point-in-time artifact</em>. What’s marketable today is different from yesterday, and arguably, will change tomorrow; the need of each hour would vary, even if history repeats. I realize Justice Holmes is focused on the judgement at hand and this statement is completely accurate in that context.</p>
<p>This may be experience bias, but makes me wonder what would fall into the <em>Vedic</em> interpretation of truth – eternal, changeless, even if interpreted differently by experts: Ekam Sat, Viprah Bahudah Vadanti/एकं सद्विप्रा बहुधा वदन्ति - <a href="https://en.wikisource.org/wiki/The_Rig_Veda/Mandala_1/Hymn_164">Rig Veda 1:164:46</a>.</p>
<p>Or, may be I interpreted the above ancient statement as referring to Truth? This <em>is</em> open to interpretation: from the context of Hymn 164, the physical allusion is to a deity, but an overload of the word <em>Sat</em> is Truth, and therefore, the corresponding interpretation would be one of <em>Absolute Truth</em>, if I may. This is the interpretation I’ve grown up with.</p>
<p>What is Truth, to you?</p>
Renewing Let's Encrypt SSL Certificates for Private Networks using DNS ChallengeSai Charanme@saicharan.inhttp://www.saicharan.in2021-01-05T22:10:00-08:00https://www.saicharan.in/blog/2021/01/05/letsencrypt-renew-certs-private-network-dns<p>Note to self on setup for auto-renewing Let’s Encrypt SSL certificates from an (almost) private network.</p>
<h3 id="the-usual-rant">The Usual Rant</h3>
<p>This would’ve been really simple if <a href="domains.google.com">Google Domains</a> provided an API interface to add/update/remove DNS TXT records – and would be fully workable from a fully private network, I could (or maybe should?) use a DNS provider with an API and be done, but this setup is worth documenting for myself. For DNS providers with APIs to change DNS records, Certbot’s <a href="https://certbot.eff.org/docs/using.html#dns-plugins">DNS plugins</a> are, IMO, easy ways to renew certs. You could also go manual with your own auth, cleanup, and deploy hooks<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">1</a></sup>. Anyway, here goes.</p>
<p><em>Update 08/30/2021</em>: acme.sh’s <a href="https://github.com/acmesh-official/acme.sh/wiki/DNS-alias-mode">DNS Alias</a> mode can help if you use a free DNS service with API like the excellent <a href="https://dns.he.net/">Hurricane Electric’s DNS</a>. All it takes is setting up an <code class="language-plaintext highlighter-rouge">_acme-challenge.domain CNAME _acme-challenge.alias.domain</code> and issue/renew the cert with <code class="language-plaintext highlighter-rouge">--challenge-alias alias.domain</code> parameter.</p>
<h3 id="the-idea">The Idea</h3>
<p>The idea behind this setup is that of the <a href="https://github.com/siilike/certbot-dns-standalone#standalone-dns-authenticator-plugin-for-certbot">Standalone DNS Authenticator Plugin for Certbot</a> – I just could not get it to work<sup id="fnref:5" role="doc-noteref"><a href="#fn:5" class="footnote" rel="footnote">2</a></sup> out of the box even with port forwarding enabled, so I improvise by replicating the setup. Basically: send DNS resolution requests off to a DNS that you can update really quick (or even better, automate). This is achieved by inserting an <code class="language-plaintext highlighter-rouge">NS</code> record for the subdomain in question and pointing <code class="language-plaintext highlighter-rouge">_acme-challenge.subdomain</code> to a dummy.subdomain.domain.ext <code class="language-plaintext highlighter-rouge">CNAME</code> that sends off resolvers to your new DNS, where you work your magic.</p>
<h3 id="prerequisites">Prerequisites:</h3>
<ul>
<li>A DNS provider with no API support to add/update/remove DNS <code class="language-plaintext highlighter-rouge">TXT</code> records.</li>
<li>A local/remote instance of AdGuardHome v0.105.0<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">3</a></sup> or later – this nifty application has a <a href="https://github.com/AdguardTeam/AdGuardHome/blob/master/openapi/">REST API</a> with a <a href="https://github.com/AdguardTeam/AdGuardHome/blob/master/openapi/openapi.yaml">swagger spec</a>!</li>
<li>An internet router that allows port forwarding (forward 53 to your local server hosting AdGuardHome)<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">4</a></sup> <sup id="fnref:3:1" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">1</a></sup>.</li>
<li>Local server with certbot on a private network.</li>
</ul>
<h3 id="the-setup">The Setup</h3>
<p>For each subdomain of domain.ext, set up these two DNS entries:</p>
<ul>
<li>subdomain NS ns.domain.ext</li>
<li>_acme-challenge.subdomain CNAME dummy.subdomain.domain.ext</li>
</ul>
<p><em>Pro tip: always use –staging servers else you will run up against the really low (~5 failures/hour) <a href="https://letsencrypt.org/docs/rate-limits/">rate limits</a> for production servers.</em></p>
<ul>
<li>Next, run the certbot command to renew certificate manually: <code class="language-plaintext highlighter-rouge"># certbot --manual --preferred-challenges dns certonly -d subdomain.domain.ext --verbose --debug-challenge --staging</code></li>
<li>Go to AdGuardHome > Filters > Custom Filtering Rules and add appropriate entries
<ul>
<li><code class="language-plaintext highlighter-rouge">||subdomain.domain.ext^$dnsrewrite=NOERROR;A;W.X.Y.Z</code> (private IP is acceptable)<sup id="fnref:6" role="doc-noteref"><a href="#fn:6" class="footnote" rel="footnote">5</a></sup></li>
<li><code class="language-plaintext highlighter-rouge">||_acme-challenge.subdomain.domain.ext^$dnsrewrite=NOERROR;TXT;challenge-txt</code>, where challenge-txt is from the output of <code class="language-plaintext highlighter-rouge">certbot</code> command above.</li>
</ul>
</li>
<li>Continue the command above, your certificates from staging Let’s Encrypt’s servers would be ready.</li>
<li>Revoke these test certs with <code class="language-plaintext highlighter-rouge"># certbot revoke --cert-path /etc/letsencrypt/live/subdomain.domain.ext/cert.pem [--staging]</code></li>
<li>Repeat the <code class="language-plaintext highlighter-rouge">certbot</code> command without the <code class="language-plaintext highlighter-rouge">--staging</code> flag.</li>
</ul>
<p>Best part – all of this can be automated.<sup id="fnref:3:2" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">1</a></sup> <sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">6</a></sup></p>
<h3 id="references--notes">References & Notes</h3>
<ul>
<li><a href="https://digwebinterface.com/?hostnames=_acme-challenge.saibox.saicharan.in&type=A&showcommand=on&colorize=on&trace=on&ns=resolver&useresolver=8.8.4.4&nameservers=sains.mooo.com">https://digwebinterface.com/?hostnames=_acme-challenge.saibox.saicharan.in&type=A&showcommand=on&colorize=on&trace=on&ns=resolver&useresolver=8.8.4.4&nameservers=sains.mooo.com</a></li>
<li><a href="https://community.letsencrypt.org/t/solved-dns-problem-servfail-looking-up-caa-for-mit42-de/20965/5">https://community.letsencrypt.org/t/solved-dns-problem-servfail-looking-up-caa-for-mit42-de/20965/5</a></li>
<li><a href="https://github.com/siilike/certbot-dns-standalone">https://github.com/siilike/certbot-dns-standalone</a></li>
<li><a href="https://dnsviz.net/d/saitest.saicharan.in/X_QJ1g/dnssec/">https://dnsviz.net/d/saitest.saicharan.in/X_QJ1g/dnssec/</a></li>
<li><a href="https://github.com/AdguardTeam/AdGuardHome/blob/master/openapi/openapi.yaml">https://github.com/AdguardTeam/AdGuardHome/blob/master/openapi/openapi.yaml</a></li>
<li><a href="https://www.withoutthesarcasm.com/letsencrypt-for-private-networks/">https://www.withoutthesarcasm.com/letsencrypt-for-private-networks/</a></li>
</ul>
<div class="footnotes" role="doc-endnotes">
<ol>
<li id="fn:3" role="doc-endnote">
<p>This renewal can be automated by using auth- and deploy- <a href="https://certbot.eff.org/docs/using.html#manual">hooks</a>. Example commands <code class="language-plaintext highlighter-rouge">certbot -d subdomain.domain.ext --agree-tos --manual --preferred-challenges dns --manual-auth-hook ./adguard-dns-auth.sh --manual-cleanup-hook ./adguard-dns-clean.sh --manual-public-ip-logging-ok --force-renewal certonly</code> <a href="#fnref:3" class="reversefootnote" role="doc-backlink">↩</a> <a href="#fnref:3:1" class="reversefootnote" role="doc-backlink">↩<sup>2</sup></a> <a href="#fnref:3:2" class="reversefootnote" role="doc-backlink">↩<sup>3</sup></a></p>
</li>
<li id="fn:5" role="doc-endnote">
<p>For my record, this command did not work: <code class="language-plaintext highlighter-rouge">certbot --non-interactive --agree-tos --email certmaster@domain.ext certonly --preferred-challenges dns --authenticator certbot-dns-standalone:dns-standalone --certbot-dns-standalone:dns-standalone-address=0.0.0.0 --certbot-dns-standalone:dns-standalone-ipv6-address=:: --certbot-dns-standalone:dns-standalone-port=53 -d subdomain.domain.ext --force-renewal --staging --verbose --debug-challenges</code> <a href="#fnref:5" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:1" role="doc-endnote">
<p>AdGuardHome v0.105.0+ is required to support <a href="https://github.com/AdguardTeam/AdGuardHome/wiki/Hosts-Blocklists#dnsrewrite"><code class="language-plaintext highlighter-rouge">dnsrewrite</code></a> <a href="#fnref:1" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:2" role="doc-endnote">
<p>By default, only allow allow: 127.0.0.1, and your public IP: <code class="language-plaintext highlighter-rouge">curl -k https://domains.google.com/checkip</code>. <strong><em>Temporarily</em></strong> update firewall rules to allow out-of-network requests. This too can be automated via AdGuardHome’s REST API: <code class="language-plaintext highlighter-rouge">GET /control/access/list</code> and <code class="language-plaintext highlighter-rouge">POST /control/access/set</code> in combination with <code class="language-plaintext highlighter-rouge">ufw</code> or similar. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:6" role="doc-endnote">
<p>I ran into <code class="language-plaintext highlighter-rouge">SERVFAIL looking up CAA for ...</code> error from certbot. Turns out the problem was a missing <code class="language-plaintext highlighter-rouge">A</code> record for subdomain.domain.ext in AdGuardHome, which is where the need for this entry originates from. <a href="https://dnsviz.net">https://dnsviz.net</a> was very helpful deduce this problem. It was on top of the list of DNS errors reported! <a href="#fnref:6" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:4" role="doc-endnote">
<p><code class="language-plaintext highlighter-rouge">GET /status</code>, add/update corresponding dnsrewrite entry into <code class="language-plaintext highlighter-rouge">user_rules[]</code> and <code class="language-plaintext highlighter-rouge">POST /control/filtering/set_rules</code> can be used in conjunction with the auth- and deploy- hook scripts to automate the entries that get inserted for <code class="language-plaintext highlighter-rouge">challenge-txt</code>. <a href="#fnref:4" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
</ol>
</div>
Let's Encrypt SSL Certificates for DD-WRTSai Charanme@saicharan.inhttp://www.saicharan.in2021-01-05T21:53:00-08:00https://www.saicharan.in/blog/2021/01/05/letsencrypt-ssl-certs-dd-wrt<p>Note to self on setting up Let’s Encrypt SSL certificates for DD-WRT.</p>
<p>Prerequisites: a router with DD-WRT with a USB port (to mount external USB drive via jffs), an external USB drive, and a domain to assign to your router. My notes on the router setup are <a href="/blog/2020/06/24/managing-your-internet-of/">here</a>.</p>
<ul>
<li><a href="https://certbot.eff.org/docs/using.html#nginx">Create</a> or <a href="https://certbot.eff.org/docs/using.html#renewing-certificates">renew</a> the necessary certificate.</li>
<li><code class="language-plaintext highlighter-rouge">openssl rsa -in privkey.pem -out key.pem</code></li>
<li><code class="language-plaintext highlighter-rouge">scp *.pem root@router:/jffs/etc/</code></li>
<li>Router settings > Administration > Web Access > Protocol > HTTPS (check this box)</li>
<li>Router settings > Administration > Remote Access > Use HTTPS (check this box), and set Web GUI Port to <code class="language-plaintext highlighter-rouge">443</code></li>
<li>Save, Apply Settings, and Reboot Router (for good measure).</li>
<li>Copy to <code class="language-plaintext highlighter-rouge">/jffs/etc/</code> and run this <a href="https://gist.githubusercontent.com/alexandrusavin/69b26846d6593d6f217219b5bd8882c4/raw/a832c0b89cf8e975acda14f46355e93a676a2893/binds_on_mount.sh">script</a>, following instructions from this <a href="https://gist.github.com/alexandrusavin/69b26846d6593d6f217219b5bd8882c4#file-letsencrypt-ddwrt-md">gist</a></li>
</ul>
<p>Effectively, this mount-binds the corresponding <code class="language-plaintext highlighter-rouge">cert.pem</code>, and <code class="language-plaintext highlighter-rouge">key.pem</code> into <code class="language-plaintext highlighter-rouge">/etc/*.pem</code> followed by <code class="language-plaintext highlighter-rouge">servicestart httpd</code>.</p>
<p>Worked like a charm!</p>
<h3 id="references">References</h3>
<ul>
<li><a href="https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1194082#1194082">https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1194082#1194082</a></li>
<li><a href="https://gist.github.com/alexandrusavin/69b26846d6593d6f217219b5bd8882c4">https://gist.github.com/alexandrusavin/69b26846d6593d6f217219b5bd8882c4</a></li>
</ul>
Airprint with CUPS on DD-WRTSai Charanme@saicharan.inhttp://www.saicharan.in2020-07-27T15:27:00-07:00https://www.saicharan.in/blog/2020/07/27/dd-wrt-cups-airprint<p>Another note to self on enabling Airprint for a legacy network printer with Avahi and CUPS on DD-WRT (HP P3005).</p>
<p>Prerequisites: router with DD-WRT and a USB port (to install cupsd via Entware), a network capable printer. My notes on the router setup are <a href="/blog/2020/06/24/managing-your-internet-of/">here</a>.</p>
<p>Mostly a rehash of the tutorials from TomatoUSB<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup> and EzUnix<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup>, in case those links go dead:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">opkg install hplip-full</code></li>
<li><code class="language-plaintext highlighter-rouge">opkg install cups cups-filters cups-pdf</code> # this was required to get CUPS to recognize <code class="language-plaintext highlighter-rouge">application/pdf</code> as valid filter and to enable <code class="language-plaintext highlighter-rouge">pdftoraster</code> needed below.</li>
<li>
<p>Add this to Firewall starup script:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> # CUPSd WebInterface (http/tcp)
iptables -I INPUT -p tcp --dport 631 -i vlan2 -j ACCEPT
# CUPSd printer port
iptables -I INPUT -p tcp --dport 9100 -i vlan2 -j ACCEPT
</code></pre></div> </div>
</li>
<li>Navigate to CUPS web interface http://< router-ip >:631 > Administration > <code class="language-plaintext highlighter-rouge">Add Printer</code>
<ul>
<li>Choose HP Printer (HPLIP), <code class="language-plaintext highlighter-rouge">Continue</code></li>
<li>Connection: socket://< network-printer-ip >:9100, <code class="language-plaintext highlighter-rouge">Continue</code></li>
<li>Provide Name, Description, Location and choose to ‘Share This Printer’, <code class="language-plaintext highlighter-rouge">Continue</code></li>
<li>Choose Make: HP, <code class="language-plaintext highlighter-rouge">Continue</code></li>
<li>Choose Model: HP LaserJet p3005…, <code class="language-plaintext highlighter-rouge">Add Printer</code></li>
</ul>
</li>
<li>
<p>Run:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> echo "image/urf application/pdf 100 pdftoraster" > /opt/share/cups/mime/airprint.convs
echo "image/urf urf string(0,UNIRAST<00>)" > /opt/share/cups/mime/airprint.types
</code></pre></div> </div>
</li>
<li>
<p>Create <code class="language-plaintext highlighter-rouge">/opt/etc/avahi/services/airprint-hpp3005.service</code> with the following content <sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">3</a></sup>,<sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">4</a></sup>:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">AirPrint HP1220C @ %h</name>
<service>
<type>_ipp._tcp</type>
<subtype>_universal._sub._ipp._tcp</subtype>
<port>631</port>
<txt-record>txtvers=1</txt-record>
<txt-record>qtotal=1</txt-record>
<txt-record>Transparent=T</txt-record>
<txt-record>URF=none</txt-record>
<txt-record>rp=printers/(name-from-cups)</txt-record>
<txt-record>note=your note</txt-record>
<txt-record>product=(GPL Ghostscript)</txt-record>
<txt-record>printer-state=3</txt-record>
<txt-record>printer-type=0x82b01c</txt-record>
<txt-record>pdl=application/octet-stream,application/pdf,application/postscript,image/gif,image/jpeg,image/png,image/tiff,image/urf,text/html,text/plain,application/vnd.cups-banner,application/vnd.cups-command,application/vnd.cups-pdf,application/vnd.cups-postscript</txt-record>
</service>
</service-group>
</code></pre></div> </div>
<p>You could generate this file from TJ Fontaine’s <a href="https://github.com/tjfontaine/airprint-generate">airprint-generate</a>, but that did not work for me with some Python errors I chose not to pursue.</p>
</li>
<li><code class="language-plaintext highlighter-rouge">/opt/etc/init.d/rc.unslung restart</code></li>
</ul>
<p>Done, you should find this printer via Airprint. You can use the CUPS web interface to configure printer defaults (duplex, two-sided printing, economy/high quality etc.).</p>
<p>For the record, HP p3005 has a decent web interface at http://< printer-ip > and also at the CUPS port: http://< printer-ip >:631.</p>
<h3 id="references">References</h3>
<div class="footnotes" role="doc-endnotes">
<ol>
<li id="fn:1" role="doc-endnote">
<p><a href="http://tomatousb.org/forum/t-638158/airprint-and-google-cloud-print-via-optware">http://tomatousb.org/forum/t-638158/airprint-and-google-cloud-print-via-optware</a> <a href="#fnref:1" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:2" role="doc-endnote">
<p><a href="https://www.ezunix.org/index.php?title=Enable_iOS_AirPrint_with_any_printer_supported_by_CUPS">https://www.ezunix.org/index.php?title=Enable_iOS_AirPrint_with_any_printer_supported_by_CUPS</a> <a href="#fnref:2" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:3" role="doc-endnote">
<p><a href="https://www.linuxbabe.com/ubuntu/set-up-cups-print-server-ubuntu-bonjour-ipp-samba-airprint">https://www.linuxbabe.com/ubuntu/set-up-cups-print-server-ubuntu-bonjour-ipp-samba-airprint</a> <a href="#fnref:3" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:4" role="doc-endnote">
<p><a href="https://wiki.archlinux.org/index.php/Avahi#AirPrint_from_Mobile_Devices">https://wiki.archlinux.org/index.php/Avahi#AirPrint_from_Mobile_Devices</a> <a href="#fnref:4" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
</ol>
</div>
Managing Your Internet OfSai Charanme@saicharan.inhttp://www.saicharan.in2020-06-24T19:25:00-07:00https://www.saicharan.in/blog/2020/06/24/managing-your-internet-of<p>This is yet another note to self on setting up my home network to isolate ‘smart’ and other IoT devices into isolated networks in their own subnets, but having a functional UX for the family.</p>
<h3 class="no_toc" id="contents">Contents</h3>
<ol id="markdown-toc">
<li><a href="#end-goal" id="markdown-toc-end-goal">End Goal</a></li>
<li><a href="#choosing-a-version-of-dd-wrt" id="markdown-toc-choosing-a-version-of-dd-wrt">Choosing a version of DD-WRT</a></li>
<li><a href="#virtual-interface-wlan-and-vlan-setup" id="markdown-toc-virtual-interface-wlan-and-vlan-setup">Virtual Interface (WLAN) and VLAN Setup</a></li>
<li><a href="#mdns-setup-for-media-devices" id="markdown-toc-mdns-setup-for-media-devices">mDNS Setup for Media Devices</a></li>
<li><a href="#static-route" id="markdown-toc-static-route">Static Route</a></li>
<li><a href="#firewall" id="markdown-toc-firewall">Firewall</a></li>
<li><a href="#caveat" id="markdown-toc-caveat">Caveat</a></li>
<li><a href="#conclusion" id="markdown-toc-conclusion">Conclusion</a></li>
<li><a href="#acknowledgements" id="markdown-toc-acknowledgements">Acknowledgements</a></li>
</ol>
<h3 id="end-goal">End Goal</h3>
<p>Here’s an outline of the end goal in ASCII art:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> / WLAN B1 (10.2.2.1/24) - Miscl. Devices
/
ISP -- Gateway/Router-A ---- Gateway/Router-B ---- WLAN B2 (10.3.3.1/24) - IoT Devices
| (DD-WRT) \
| [10.1.1.100/32] \ LAN B3 (10.4.4.1/24)
WLAN A1 | |
(10.1.1.1/24) AppleTV Chromecast
| | |
Mobile Phones
</code></pre></div></div>
<p />
<h3 id="choosing-a-version-of-dd-wrt">Choosing a version of DD-WRT</h3>
<p>The version of firmware recommended on DD-WRT’s <a href="https://dd-wrt.com/support/router-database/">router database</a> is quite a bit dated, and using the bleeding edge beta from the forums isn’t always dependable, so I’ve recently started picking up builds recommended on <a href="https://support.flashrouters.com/setup-guides/dd-wrt-features/i-want-to-upgrade-the-dd-wrt-firmware-of-my-flashrouter/">flashrouter</a>.</p>
<h3 id="virtual-interface-wlan-and-vlan-setup">Virtual Interface (WLAN) and VLAN Setup</h3>
<p>Router-B runs <a href="https://www.dd-wrt.com">DD-WRT</a> firmware in the Gateway mode. The basic setup itself is a straight forward adaptation of Guest Wi-Fi <a href="https://wiki.dd-wrt.com/wiki/index.php/Guest_WiFi_+_abuse_control_for_beginners">setup on dd-wrt wiki</a>. Basically, Wireless > Basic Settings > new Virtual interface with AP Isolation enabled, and running a Unbridged network configuration with NAT, Net Isolation and DNS redirection enabled. In addition, I have a VLAN setup for <code class="language-plaintext highlighter-rouge">LAN B3</code> with one of the physical LAN ports on the router. Similar configuration for the VLAN, can be configured under Setup > Networking. The IP Address/subnet here will be that of the interface, eg. <code class="language-plaintext highlighter-rouge">10.x.y.z/24</code>. At the bottom of Setup > Networking > DHCPD, I setup a different DHCPD for each of the WLANs, and VLAN.</p>
<p><img src="/images/vap-setup.png" alt="Virtual Interface Setup" /></p>
<h3 id="mdns-setup-for-media-devices">mDNS Setup for Media Devices</h3>
<p>These rely on <a href="https://en.wikipedia.org/wiki/Multicast_DNS">mDNS</a> broadcasts to allow client devices to discover services. However, by default these broadcasts don’t are local to the subnet of the (AppleTV/Chromecast) device. A solution for cross subnet/interface broadcasts would be the <a href="https://www.avahi.org/">avahi-daemon</a>. Fortunately, DD-WRT supports installing tools such as this via <a href="https://github.com/Entware/Entware">Entware</a> <code class="language-plaintext highlighter-rouge">opkg</code> command. I have Entware running off a tiny flash drive setup as described in <a href="https://wiki.dd-wrt.com/wiki/index.php/Installing_Entware">installing Entware</a> followed by <code class="language-plaintext highlighter-rouge">opkg update && opkg upgrade && opkg install avahi-utils</code>. Here’s my <code class="language-plaintext highlighter-rouge">/opt/etc/avahi/avahi-daemon.conf</code> <sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[server]
use-ipv4=yes
use-ipv6=no
check-response-ttl=no
use-iff-running=no
allow-interfaces=br0,vlan2,vlan6
allow-point-to-point=yes
enable-dbus=no
[publish]
publish-addresses=yes
publish-hinfo=yes
publish-workstation=no
publish-domain=yes
[reflector]
enable-reflector=yes
reflect-ipv=no
[rlimits]
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=30
rlimit-stack=4194304
rlimit-nproc=3
[wide-area]
enable-wide-area=yes
</code></pre></div></div>
<p>This snippet in Administration > Commands > Save Startup will auto start <code class="language-plaintext highlighter-rouge">avahi-daemon</code>:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Start avahi/mDNS
echo "nogroup:x:114:nobody" >> /etc/group
/opt/etc/init.d/rc.unslung start
</code></pre></div></div>
<p>And save the following with ‘Save Firewall’. [The TTL bit was a nice find][1].</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Chromecast/AppleTV mDNS advertisements on vlan6 (AppleTV/Chromecast), from WAN
iptables -I INPUT -p udp --dport 1900 -i `get_wanface` -j ACCEPT
iptables -I INPUT -p udp --dport 1900 -i vlan6 -j ACCEPT
iptables -I FORWARD -p udp --dport 5353 -i `get_wanface` -j ACCEPT
iptables -I FORWARD -p udp --dport 5353 -i vlan6 -j ACCEPT
iptables -I INPUT -p udp --dport 5353 -i `get_wanface` -j ACCEPT
iptables -I INPUT -p udp --dport 5353 -i vlan6 -j ACCEPT
# Increase IP TTL so it can go an extra hop
iptables -t mangle -A PREROUTING -d 239.255.255.250 -j TTL --ttl-inc 1
iptables -t mangle -A PREROUTING -d 224.0.0.251 -j TTL --ttl-inc 1
</code></pre></div></div>
<p>I verified avahi-daemon/mDNS working by firing up <a href="http://tildesoft.com/">Tildesoft</a>’s Discovery app and looking for my devices and also by firing up YouTube app for casting and the phone’s AirPlay to mirror the screen. The devices are now discoverable by phones and other clients.</p>
<p>However, the actual AirPlay mirroring and casting don’t work :-)</p>
<h3 id="static-route">Static Route</h3>
<p>mDNS discovery responses contain the IP/Port of the service so clients know how to reach these devices.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>_googlecast._tcp.
Chromecast-xyz
10.4.4.4:8009
...
</code></pre></div></div>
<p>Starting with a simple <code class="language-plaintext highlighter-rouge">traceroute 10.4.4.4</code> in <code class="language-plaintext highlighter-rouge">WLAN A1</code> in subnet 10.1.1.1/24, it was clear that the network did not know how to route the packets destined for 10.4.4.4. So a friend suggested adding a static route in Gateway/Router-A for packets bound to 10.4.4.0/24 with Gateway 10.1.1.100. And <code class="language-plaintext highlighter-rouge">traceroute</code> went until the gateway, and stopped at that with 100% packet loss.</p>
<h3 id="firewall">Firewall</h3>
<p>The final piece of the puzzle was in figuring out the firewall rules. I started off with a catchall rule that accepted all forwarded traffic to <code class="language-plaintext highlighter-rouge">vlan2</code> (which is the default WAN interface on DD-WRT devices; run <code class="language-plaintext highlighter-rouge">get_wanface</code> in an SSH session into your router to check).</p>
<p>Then I added ports 8008, 8009, and high ports as a FORWARD rule, an adaptation from <sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup>, including this to the ‘Save Firewall’ script. Note that I had also added TCP ports based on a packet type from a <a href="https://www.wireshark.org/">Wireshark</a> packet capture of the session that failed to connect with firewall enabled for UDP packets.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># https://blog.g3rt.nl/allow-google-chromecast-host-firewall-iptables.html
# Punch a hole out of the router into the private 'WAN'
iptables -I FORWARD -i vlan2 -p tcp --dport 7000 -j ACCEPT
iptables -I FORWARD -i vlan2 -p tcp -m multiport --sports 32768:61000 -m multiport --dports 32768:61000 -j ACCEPT
iptables -I FORWARD -i vlan2 -p tcp -m multiport --dports 8008:8009 -j ACCEPT
# van6: Media Center
iptables -I FORWARD -i vlan6 -p tcp --dport 7000 -j ACCEPT
iptables -I FORWARD -i vlan6 -p tcp -m multiport --sports 32768:61000 -m multiport --dports 32768:61000 -j ACCEPT
iptables -I FORWARD -i vlan6 -p tcp -m multiport --dports 8008:8009 -j ACCEPT
</code></pre></div></div>
<p />
<h3 id="caveat">Caveat</h3>
<p>We have some early Wemo light switches which did not really play nice with AP and Net Isolation on the Virtual Interfaces, so for the corresponding VAP, these are disabled.</p>
<h3 id="conclusion">Conclusion</h3>
<p>And, that’s all folks. With this, I have devices isolated in their own networks/subnets that are firewalled off, but still usable across subnets for casting/AirPlay mirroring.</p>
<h3 id="acknowledgements">Acknowledgements</h3>
<p>Thanks to the DD-WRT contributors, community for the very usable software and readable documentation. Thank you to the authors of <a href="https://www.shackleton.io">https://www.shackleton.io</a> and <a href="https://blog.gert.nl">https://blog.gert.nl</a> for the very helpful tips. Many thanks to <a href="https://github.com/zyxmon">@zyxmon</a> and <a href="https://github.com/ryzhovau">@ryzhovau</a> of Entware for quickly <a href="https://github.com/Entware/Entware/issues/483">fixing a bug</a> with avahi-utils on DD-WRT.</p>
<p>And of course, to my family, for bearing with many, many, many network disruptions!</p>
<h4 class="no_toc" id="references">References</h4>
<div class="footnotes" role="doc-endnotes">
<ol>
<li id="fn:1" role="doc-endnote">
<p><a href="https://www.shackleton.io/blog/2019/05/07/internet-of-shit.html">https://www.shackleton.io/blog/2019/05/07/internet-of-shit.html</a> <a href="#fnref:1" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:2" role="doc-endnote">
<p><a href="https://blog.g3rt.nl/allow-google-chromecast-host-firewall-iptables.html">https://blog.g3rt.nl/allow-google-chromecast-host-firewall-iptables.html</a> <a href="#fnref:2" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
</ol>
</div>
On Good and EvilSai Charanme@saicharan.inhttp://www.saicharan.in2020-06-20T04:10:00-07:00https://www.saicharan.in/blog/2020/06/20/quote-good-and-evil-van-gogh<p>Yes, evil often seems to surpass good. But then, in spite of us, and without our permission, there comes at last an end to the bitter frosts. One morning the wind turns, and there is a thaw. And so I must still have hope.</p>
OpenVPN Client on ASUS RT-AC68U with DD-WRT FirmwareSai Charanme@saicharan.inhttp://www.saicharan.in2020-05-26T04:11:30-07:00https://www.saicharan.in/blog/2020/05/26/ddwrt-openvpn-client-httpserver<p>Note to self on setting up OpenVPN Client on Asus RT-AC68U Router with DD-WRT.</p>
<p>The goal of this exercise was to have OpenVPN client installed on a router that allows my family to enable/disable VPN via simple webapp, without dealing with the full settings page of the router management tool.</p>
<p>I had an old TM-AC1900 Cellspot router, but that’s basically a hobbled (in software) version of the capable RT-AC168U hardware. So, first step is to get a capable firmware installed.</p>
<p>I could not host this stand-alone webapp on a local store or webserver as CORS protection kicks in (both for DD-WRT and for the stock ASUS RT-AC68U firmware). With <code class="language-plaintext highlighter-rouge">ssh</code> access to the router, I can host the standalone webapp on the same webserver and avoid the CORS restriction.</p>
<p>Between the stock ASUS firmware vs DD-WRT, I prefer DD-WRT <del>for this setup since access to http://router.local/user/ is not password protected, so the user experience (UX) is seamless – for local users connected to. Another ‘benefit’ with DD-WRT is the use of ‘Basic Authentication’ as opposed to some other protocol with the ASUS stock firmware</del> (for an early iteration, I leant towards an insecure setup to simplify UX for the family – in my case, the DD-WRT router wasn’t directly connected to the WAN, but behind another router, so I was taking a risky chance). For actual auth with the router firmware to enable/disable the OpenVPN client, I simply hard-coded the <code class="language-plaintext highlighter-rouge">Authentication: Basic <hash></code> header. Much of the ‘reverse engineering’ of the request/response for the enable/disable OpenVPN client were by simply observing the network traffic with the browser developer tool’s <a href="https://developers.google.com/web/tools/chrome-devtools/network/#search">network tab</a> <sup id="fnref:6" role="doc-noteref"><a href="#fn:6" class="footnote" rel="footnote">1</a></sup> and looking at the request/response headers and the form data.</p>
<ol>
<li>Transform an old TM-AC1900 to RT-AC68U with this excellent guide from <a href="https://www.bayareatechpros.com/ac1900-to-ac68u/">Bay Area Tech Pros</a><sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">2</a></sup>
<ul>
<li>Crucial to getting the CFE to show up was clear NVRAM in step 20 (Power off, Hold WPS button and power on while holding WPS button until the power LED begins to flash quickly)</li>
<li>And, navigating to 192.168.1.1 very quickly (seems like the CFE page is only available for a short window after reboot/reset/nvram clear)</li>
</ul>
</li>
<li>Upgrade RT-AC68U to DD-WRT, with the latest beta from the ftp location <sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">3</a></sup>.</li>
<li>Setup OpenVPN client. I tried both <a href="https://protonvpn.com">ProtonVPN</a> and <a href="https://surfshark.com">Surfshark VPN</a> <sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">4</a></sup> as the providers, both of which have <a href="https://support.surfshark.com/hc/en-us/articles/360003086114-DD-WRT-router-tutorial">excellent</a> <a href="https://protonvpn.com/support/vpn-router-ddwrt/">documentation</a> <sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">5</a></sup>. Retrieve the OpenVPN credentials from https://account.protonvpn.com/account#openvpn or https://account.surfshark.com/setup/manual, respectively.</li>
<li><code class="language-plaintext highlighter-rouge">ssh</code> into the router, copy the standalone webapp to <code class="language-plaintext highlighter-rouge">/jffs/<user>/</code>, and run <code class="language-plaintext highlighter-rouge">ln -s /jffs/<user>/webapp.html /www/user/webapp.html</code></li>
<li><code class="language-plaintext highlighter-rouge">/jffs/<user>/</code> is persistent storage, but <code class="language-plaintext highlighter-rouge">/www/user</code> isn’t and gets reset on reboot. So create a startup script with the above <code class="language-plaintext highlighter-rouge">ln</code> command.</li>
<li>A stripped down version of the webapp I hacked up is <a href="/work/VPNWebapp.html">here</a> <sup id="fnref:5" role="doc-noteref"><a href="#fn:5" class="footnote" rel="footnote">6</a></sup>.</li>
</ol>
<h4 id="quick-references">Quick References</h4>
<div class="footnotes" role="doc-endnotes">
<ol>
<li id="fn:6" role="doc-endnote">
<p><a href="https://developers.google.com/web/tools/chrome-devtools/network/#search">https://developers.google.com/web/tools/chrome-devtools/network/#search</a> <a href="#fnref:6" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:1" role="doc-endnote">
<p><a href="https://www.bayareatechpros.com/ac1900-to-ac68u/">https://www.bayareatechpros.com/ac1900-to-ac68u/</a> <a href="#fnref:1" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:2" role="doc-endnote">
<p><a href="ftp://ftp.dd-wrt.com/betas/2020/05-26-2020-r43261/asus-rt-ac68u/">ftp://ftp.dd-wrt.com/betas/2020/05-26-2020-r43261/asus-rt-ac68u/</a> <a href="#fnref:2" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:3" role="doc-endnote">
<p><a href="https://account.protonvpn.com/account#openvpn">https://account.protonvpn.com/account#openvpn</a>, <a href="https://account.surfshark.com/setup/manual">https://account.surfshark.com/setup/manual</a> <a href="#fnref:3" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:4" role="doc-endnote">
<p><a href="https://protonvpn.com/support/vpn-router-ddwrt/">https://protonvpn.com/support/vpn-router-ddwrt/</a>, <a href="https://support.surfshark.com/hc/en-us/articles/360003086114-DD-WRT-router-tutorial">https://support.surfshark.com/hc/en-us/articles/360003086114-DD-WRT-router-tutorial</a> <a href="#fnref:4" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:5" role="doc-endnote">
<p><a href="https://wiki.dd-wrt.com/wiki/index.php/Web_server">https://wiki.dd-wrt.com/wiki/index.php/Web_server</a> <a href="#fnref:5" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
</ol>
</div>
Wireguard VPN SetupSai Charanme@saicharan.inhttp://www.saicharan.in2020-01-07T14:04:00-08:00https://www.saicharan.in/blog/2020/01/07/wireguard-vpn<p>Note to self on setting up Wireguard VPN service.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Enable wireguard PPA (not required on Ubuntu Eoan)
sudo add-apt-repository ppa:wireguard/wireguard -y
sudo apt-get update -y
# Install dependencies and wireguard
sudo apt-get install linux-headers-$(uname -r) -y
sudo apt-get install wireguard -y
## IP Forwarding
sudo sed -i -e 's/#net.ipv4.ip_forward.*/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
sudo sed -i -e 's/#net.ipv6.conf.all.forwarding.*/net.ipv6.conf.all.forwarding=1/g' /etc/sysctl.conf
sudo sysctl -p
## Firewall
sudo ufw allow 51820/udp
sudo ufw allow 22/tcp
sudo ufw enable
# Use the key generated here below
wg genkey
sudo vim /etc/wireguard/wg0.conf
</code></pre></div></div>
<p>Add the following to <code class="language-plaintext highlighter-rouge">/etc/wireguard/wg0.conf</code></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[Interface]
Address = 10.14.0.0/32
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
ListenPort = 51820
PrivateKey = <output from wg genkey>
[Peer]
PublicKey = <from your client>
# This should match that of the client's configuration. Ensure it is in the same subet as defined in the 'Address' field of the [Interface] section above
AllowedIPs = 10.14.0.10/32
## WireGuard Service
wg-quick up wg0
sudo systemctl enable wg-quick@wg0
</code></pre></div></div>
<p>On the client, use configurations as this one.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[Interface]
PrivateKey = <client's private key, auto generated by most clients; else use 'wg genkey'>
Address = 10.14.0.10/32
DNS = <Your preferred DNS or router Gateway IP address>
[Peer]
PublicKey = <Server's public key; listed on running 'sudo wg' on the server, after setting up the server config as above, with a private key included>
AllowedIPs = ::/0, 0.0.0.0/0
Endpoint = <server-dns-name>:52121
</code></pre></div></div>
<p>On the server, repeat the <code class="language-plaintext highlighter-rouge">[Peer]</code> section(s) as needed, one for each additional client. Remember to provide unique IPs to each client, ensuring the address fall in the subnet range provided in the server’s <code class="language-plaintext highlighter-rouge">Address</code> field in the <code class="language-plaintext highlighter-rouge">[Interface]</code> section.</p>
<h4 id="references">References</h4>
<ol>
<li><a href="https://mikkel.hoegh.org/2019/11/01/home-vpn-server-wireguard">https://mikkel.hoegh.org/2019/11/01/home-vpn-server-wireguard</a></li>
<li><a href="https://github.com/vijayshinva/AzureWireGuard/blob/master/AzureWireGuard/CustomScripts/AzureWireGuard.sh">https://github.com/vijayshinva/AzureWireGuard/blob/master/AzureWireGuard/CustomScripts/AzureWireGuard.sh</a></li>
</ol>
Man's Troubles - Man HimselfSai Charanme@saicharan.inhttp://www.saicharan.in2019-12-23T15:09:00-08:00https://www.saicharan.in/blog/2019/12/23/quote-mans-troubles<p>‘I gazed around myself, and my soul was wounded by human suffering. I then looked inside myself, and saw that man’s troubles come from man himself.’</p>
On being in a hurrySai Charanme@saicharan.inhttp://www.saicharan.in2019-12-23T14:58:00-08:00https://www.saicharan.in/blog/2019/12/23/quote-being-in-a-hurry<p>“We’re in such a hurry most of the time we never get much chance to talk,” Pirsig writes. “The result is a kind of endless day-to-day shallowness, a monotony that leaves a person wondering years later where all the time went and sorry that it’s all gone.”</p>
On Poems & ProofsSai Charanme@saicharan.inhttp://www.saicharan.in2019-12-23T14:56:00-08:00https://www.saicharan.in/blog/2019/12/23/quote-poems-and-proofs<p>A NON-MATHEMATICIAN MIGHT ASK if any of these problems have real-world applications, but is that fair? No one asks a poet what a new poem “does.” The poem’s simplicity, elegance, and beauty are sufficient reasons for its existence. Aren’t the same things true for a mathematical proof?</p>
Computation is a means, not an end.Sai Charanme@saicharan.inhttp://www.saicharan.in2019-12-23T14:53:00-08:00https://www.saicharan.in/blog/2019/12/23/quote-apollo-computation-means<p>The lesson, maybe, is simple: If your phone is so much more powerful than the computers that put humanity on the moon, then why are you just staring at Instagram all day? Computation is means, not end.</p>
Messaging in SmalltalkSai Charanme@saicharan.inhttp://www.saicharan.in2019-12-23T14:49:00-08:00https://www.saicharan.in/blog/2019/12/23/quote-messaging-smalltalk<p>The key in making great and growable systems is much more to design how its modules communicate rather than what their internal properties and behaviors should be.</p>
On Passing Statistical TestsSai Charanme@saicharan.inhttp://www.saicharan.in2019-12-23T14:47:00-08:00https://www.saicharan.in/blog/2019/12/23/quote-passing-statistical-tests<p>To be brief, a CSRNG should be unbreakable by smart attackers with lots of resources. If a CSRNG does not pass statistical tests, then this means that it can be broken by a chimpanzee. But if it passes the tests, this does in no way prove that it is cryptographically strong; it just means that the chimpanzee will be stumped.</p>
Meaning of ImpossibleSai Charanme@saicharan.inhttp://www.saicharan.in2019-02-03T09:45:00-08:00https://www.saicharan.in/blog/2019/02/03/quote-feynman-criticisms<p>After two years of working together, I finally knew for sure what I had long suspected: “Stupid” was just an expression Feynman applied to everyone, including himself, as a way to focus attention on an error so it was never made again.</p>
<p>I also learned that “impossible,” when used by Feynman, did not necessarily mean “unachievable” or “ridiculous.” Sometimes it meant, “Wow! Here is something amazing that contradicts what we would normally expect to be true. This is worth understanding!”</p>
List Comprehensions in C++Sai Charanme@saicharan.inhttp://www.saicharan.in2018-08-20T17:30:00-07:00https://www.saicharan.in/blog/2018/08/20/list-comprehensions-c++<p>From Bartosz Milewski’s <a href="https://bartoszmilewski.com/2009/10/21/what-does-haskell-have-to-do-with-c/">What Does Haskell Have to Do with C++?</a>: Haskell style list comprehensions of the form</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>one x = 1
count lst = sum [one x | x <- lst]
</code></pre></div></div>
<p>can be written in modern C++ like so:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>template<class T> struct
one {
static const int value = 1;
};
template<class... lst> struct
count {
static const int value = sum<one<lst>::value...>::value;
};
</code></pre></div></div>
<p>The author calls out the comparison between <code class="language-plaintext highlighter-rouge">one<lst>::value...</code> and <code class="language-plaintext highlighter-rouge">[one x | x <- lst]</code>. I’ve used packs like this before, but looking at this juxtaposition was a revelation.</p>
Parallels Between Physics and Distributed Systems ConceptsSai Charanme@saicharan.inhttp://www.saicharan.in2018-08-20T11:00:00-07:00https://www.saicharan.in/blog/2018/08/20/physics-and-computerscience<p>The ACM Queue article titled <a href="https://queue.acm.org/detail.cfm?id=2953944">Standing on Distributed Shoulders of Giants</a> was a fascinating read. Some excerpts:</p>
<blockquote>
<p>“Two-phase commit is the anti-availability protocol.”</p>
</blockquote>
<blockquote>
<p>“Computing is like Hubble’s universe…Everything is getting farther away from everything else.”</p>
</blockquote>
<blockquote>
<p>“Shared memory works great… as long as you don’t share memory.”</p>
</blockquote>
<p>This one took a bit of squinting at to make sense. Here, Pat Helland is referring to the fact that there are retries and given we store copies for redundancy, we can only know for certain <em>where</em> the request was processed <strong>**OR**</strong> that it was successfully completed. In a sense, once you know it was completed, you can back trace where it was done, but that is hindsight.</p>
<blockquote>
<p>“In a distributed system, you can know where the work is done or you can know when the work is done but you can’t know both.”</p>
</blockquote>
<p>This one’s on eventual consistency:</p>
<blockquote>
<p>“While not yet observed, a put does not really exist… it’s likely to exist but you can’t be sure. Only after it is seen by a get will the put really exist.”</p>
</blockquote>
<p>The references at the end of the article are also good refreshers on Distributed Systems/Computing.</p>
Emulating PDP-11 Abstract Machine as the Root Cause of Spectre and MeltdownSai Charanme@saicharan.inhttp://www.saicharan.in2018-08-20T07:30:00-07:00https://www.saicharan.in/blog/2018/08/20/root-cause-of-spectre-meltdown<p>The following excerpts from the ACM Queue <a href="https://queue.acm.org/detail.cfm?id=3212479">article</a> caught my attention.</p>
<blockquote>
<p>“The root cause of the Spectre and Meltdown vulnerabilities was that processor architects were trying to build not just fast processors, but fast processors that expose the same abstract machine as a PDP-11. This is essential because it allows C programmers to continue in the belief that their language is close to the underlying hardware.”</p>
</blockquote>
<blockquote>
<p>“The quest for high ILP was the direct cause of Spectre and Meltdown.”</p>
</blockquote>
<p>By the definition that a “low-level language” should be “close to metal”, C is not a low-level language anymore. “Close to metal” means the language constructs and memory model should <em><strong>trivially</strong></em> map to processor feature/instruction set. If the language, compiler and processor had first-class support for parallel constructs we would not have needed to encounter Spectre/Meltdown.</p>
<p>The author makes the case for modern languages, compilers and processors to move away from the simplistic flat-memory and sequential-execution legacy that we have inherited from PDP-11. The paradigm shift from CPU to GPU is a case in point – rather than resorting to speculative execution (ILP), parallelism is supported by the GUP processor and the language exposes the necessary vectorization and parallelization primitives, so programmers actively think and program for parallelism/concurrency.</p>
<p>On a related note, the author David Chisnall, concludes:</p>
<blockquote>
<p>“There is a common myth in software development that parallel programming is hard. This would come as a surprise to Alan Kay, who was able to teach an actor-model language to young children, with which they wrote working programs with more than 200 threads. It comes as a surprise to Erlang programmers, who commonly write programs with thousands of parallel components. It’s more accurate to say that parallel programming in a language with a C-like abstract machine is difficult, and given the prevalence of parallel hardware, from multicore CPUs to many-core GPUs, that’s just another way of saying that C doesn’t map to modern hardware very well.”</p>
</blockquote>
We are systematically creating races out of things that ought to be a journeySai Charanme@saicharan.inhttp://www.saicharan.in2013-05-02T04:28:20-07:00https://www.saicharan.in/blog/2013/05/02/quote-we-are-systematically-creating-races-out-of-things-that-ought-to-be-a-journey<p>We are systematically creating races out of things that ought to be a journey.</p>
Static Website on Google App EngineSai Charanme@saicharan.inhttp://www.saicharan.in2013-04-10T01:32:52-07:00https://www.saicharan.in/blog/2013/04/10/static-website-on-google-app-engine<p>I’ve been experimenting with hosting <a href="https://developers.google.com/appengine/docs/python/gettingstarted/staticfiles">static</a> websites on <a href="https://developers.google.com/appengine/">Google App Engine</a>(GAE) for a while now. One major deterrent to an otherwise <a href="https://github.com/scharan/scharan.github.com/blob/master/app.yaml">straight</a> <a href="https://github.com/scharan/scharan.github.com/blob/master/Makefile#L25">forward</a> procedure was the fact that GAE did not automatically serve index.html when encountering static folders. Now that I found <a href="https://github.com/scharan/scharan.github.com/blob/master/app.yaml#L16">this</a> workaround on <a href="http://stackoverflow.com/a/6566464/162471">Stack Overflow</a>, the static website is ready for GAE!</p>
<p>But there was another hurdle waiting.</p>
<p>GAE’s <a href="https://developers.google.com/appengine/docs/domain">instructions</a> on using custom domain names for GAE hosted apps did not work. Specifically, Step 5 (Add New URL), failed with the following error:
We are unable to process your request at this time. Please try again later. (Error #1000)
After a bit of searching and experimenting, <em>*only*</em> <a href="https://code.google.com/p/googleappengine/issues/detail?id=5021#c13">this</a> apparently silly technique actually worked. Along with <a href="https://support.google.com/a/bin/answer.py?hl=en&answer=2518373">naked domain redirection</a>, this is now a static site, fully hosted on Google App Engine. Even though this runs off GAE, there are zero machine instances running. This can be verified in the <a href="https://github.com/scharan/scharan.github.com/blob/master/app.yaml">app.yaml</a> not relying on any executable script.</p>
<p><em>*Update*</em>: GAE does not currently support <a href="http://stackoverflow.com/q/14340373/162471">custom 404</a> handlers. So, until then, back to Amazon S3 hosting.</p>
Levenshtein Distance for Handling Redirects from BloggerSai Charanme@saicharan.inhttp://www.saicharan.in2013-04-06T01:07:26-07:00https://www.saicharan.in/blog/2013/04/06/levenshtein-distance-for-handling-redirects-from-blogger<p>Here’s a problem I’ve long faced and a neat use of Levenshtein Distance.</p>
<p>This website started off as a blog on <a href="http://www.blogger.com">blogger.com</a>. Over time, it was migrated to a self hosted Wordpress site and now runs off a <a href="/blog/2011/08/22/migrating-to-jekyll/">Jekyll generated</a>, Amazon <a href="/blog/colophon.html">S3 hosted</a> bucket.</p>
<p>However, since the blogger hosted site still got a lot of traffic from search, I did not take it down. I’ve always wanted to redirect the traffic to my new website, but Blogger apparently only features redirects in the other <a href="https://support.google.com/blogger/bin/answer.py?hl=en&answer=2472689">direction</a>. While <a href="http://www.webupd8.org/2009/06/how-to-redirect-your-blogger-blog-to.html">Webupd8.org</a> has a solution, I could not get it working in this case. There were at least two problems that were in the way:</p>
<ul>
<li>URL structure of the current website also includes the date of publication, in addition to the year and month.</li>
<li>while migrating to Jelyll, some of the URL ‘<a href="http://en.wikipedia.org/wiki/Clean_URL#Slug">slugs</a>’ also changed.</li>
<li>I did not want to host a server to do this; I had <a href="/blog/2009/07/06/redirecting-blogger-traffic/">tried this</a> and have moved on.</li>
</ul>
<p>To deal with these two and also handle correct redirects automatically, here is my quick solution:</p>
<ul>
<li>On the blogger.com hosted website, place a redirect to a special page to handle redirects from blogger (in this case, /blog/blogger-redirect.html).
<meta expr:content=""0;url=http://saicharan.in/blog/blogger-redirect.html?from="+data:blog.url" http-equiv="refresh" /></li>
<li>This special page first detects the ‘<a href="http://en.wikipedia.org/wiki/HTTP_referer">referer</a>’, then extracts the year, month and slug from the blogger URL. If the referer is not found, extract the query parameter <code class="language-plaintext highlighter-rouge">from</code>. This is a minor optimization in case referer is set (eg. with Google Chrome); one could simply always use the query parameter method (IE and Firefox seem to remove <code class="language-plaintext highlighter-rouge">referer</code>).</li>
<li>It then lists the URLs on the month-page (eg. /blog/YYYY/MM/) of this website, and computes the <em><a href="http://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein’s distance</a></em> between the blogger-slug from the blogger URL and the slugs from the month-page URLs.</li>
<li>If the minimum amongst the computed Levenshtein distances is less than 5, automatically redirect to the URL with that minimal Levenshtein distance (<a href="http://blogger.saicharan.in/2009/03/viewvc-integration-with-google-prettify.html">example</a>).</li>
<li>If not, admit that we made a booboo and list all pages for that month, and additionally providing the search box (<a href="http://blogger.saicharan.in/2007/01/this-is-test-post-from-google-docs.html">example</a>).</li>
</ul>
<p>Notes:</p>
<ul>
<li>I am pretty sure this may affect the SEO ratings, but I am unsure how exactly that will be. So, if you use it, be cautious.</li>
<li>This solution needs Javascript to work, but has the advantage of not requiring any server backend.</li>
<li>I used <a href="http://stackoverflow.com/a/11958496/162471">this</a> JavaScript implementation of Levenshtein’s distance.</li>
<li><a href="https://github.com/scharan/scharan.github.com/blob/master/blog/blogger-redirect.html">This</a> is the source code for my solution.</li>
<li>Yes, the source code could do with some more optimization :/</li>
</ul>
Handling 404 Errors in JavascriptSai Charanme@saicharan.inhttp://www.saicharan.in2013-02-06T00:41:54-08:00https://www.saicharan.in/blog/2013/02/06/handling-404-errors-in-javascript<p><a href="/blog/colophon.html">Migrating</a> between hosting and blogging solutions can cause headaches. Now that I’ve moved to an Amazon S3 hosted <a href="/blog/2011/08/24/static-blog-using-jekyll/">static website</a>, I needed an intelligent way to handle certain features like tags and categories that I had with the blogger.com and Wordpress hosted site, <em><strong>without</strong></em> the need to host a server.</p>
<p>JavaScript to the <a href="https://github.com/scharan/scharan.github.com/blob/master/_includes/error.html">rescue</a>!</p>
<ul>
<li>I first identified the specific causes of problem using the crawl statistics from Google’s <a href="https://www.google.com/webmasters/tools/home">Webmasters</a> tool.</li>
<li>I then <a href="https://github.com/scharan/scharan.github.com/blob/master/_includes/error.html">crafted</a> JavaScript specifically tailored for these situations.</li>
<li>Put that into my <a href="https://github.com/scharan/scharan.github.com/blob/master/_includes/error.html">404.html</a>.</li>
</ul>
<p>This solution is specific to my use case, but you can get the idea.</p>
Wonder without GooglingSai Charanme@saicharan.inhttp://www.saicharan.in2013-01-01T13:15:12-08:00https://www.saicharan.in/blog/2013/01/01/wonder-without-googling<p><code class="language-plaintext highlighter-rouge">Great advice on so many levels. Happy New Year!</code></p>
<p>Wonder without googling.</p>
When you have tasted flightSai Charanme@saicharan.inhttp://www.saicharan.in2012-09-23T07:13:18-07:00https://www.saicharan.in/blog/2012/09/23/when-you-have-tasted-flight<p>When once you have tasted flight, you will forever walk the earth with your eyes turned skyward, for there you have been and there you will always long to return.</p>
Import Skype contacts into GmailSai Charanme@saicharan.inhttp://www.saicharan.in2012-07-31T10:09:11-07:00https://www.saicharan.in/blog/2012/07/31/import-skype-contacts-into-gmail<p>Gmail’s contact details includes provision to add usernames from other IM networks. Having this in one place is very handy on the Android phone, for instance.</p>
<p>Naïvely exporting Skype’s address book via Skype > Contacts > Advanced > Backup contacts to file & importing them into Gmail isn’t sufficient. This process imports the contact information alright, but not the skype names, defeating the purpose of the import.</p>
<p>A little digging up reveals the culprit. Skype uses the vCard v3.0 Property <code class="language-plaintext highlighter-rouge">X-SKYPE-USERNAME:</code>, while Gmail expects <code class="language-plaintext highlighter-rouge">X-SKYPE:</code>. So, here is some wizardry to fix this (on a Linux/Unix machine).</p>
<ul>
<li>Export contacts to skypename.vcf file from Skype > Contacts > Advanced > Backup contacts to file, and copy it to a linux machine.</li>
<li>I did not want the pictures of my Skype contacts to be imported. I filtered out the relevant fields using:
egrep “^BEGIN:|^END:|^VERSION:|^TEL;|^EMAIL:|^ADR:|^N:|^FN:|^X-SKYPE-USERNAME:” skypename.vcf > skype-cleaned.vcf</li>
<li>Change the vCard property to match Gmail’s expectations:
sed -i s/-USERNAME// skype-cleaned.vcf</li>
<li>Prettify the vCard file to include newlines after each vCard entry <em>(note: this step is not absolutely necessary)</em>.
sed -i “s/^END:VCARD/END:VCARD\<code class="language-plaintext highlighter-rouge">echo -e '\n\n'</code>/g” skype-cleaned.vcf</li>
<li>Import skype-cleaned.vcf into Gmail & choose to merge contacts appropriately.</li>
</ul>
Installing mosh from sourceSai Charanme@saicharan.inhttp://www.saicharan.in2012-07-27T10:05:41-07:00https://www.saicharan.in/blog/2012/07/27/installing-mosh-from-source<p>Installing <a href="http://mosh.mit.edu/">mosh</a>, the MObileSHell on a linux box with no <code class="language-plaintext highlighter-rouge">sudo</code> access can be quite a bit of a pain. And, with many users working with shared, managed linux gateways, I suppose this could be useful to a larger audience.</p>
<p>In this note, I will attempt to install <code class="language-plaintext highlighter-rouge">mosh</code> into the home directory of user <code class="language-plaintext highlighter-rouge">sai</code> with home directory at <code class="language-plaintext highlighter-rouge">/home/sai</code> assuming user <code class="language-plaintext highlighter-rouge">sai</code> does not have root access on this machine. This note further assumes that a basic development environment is already set up and available.</p>
<p>Installation notes:</p>
<ul>
<li>First create the local directory to install into: <code class="language-plaintext highlighter-rouge">mkdir -p ~/usr</code></li>
<li>As listed in the <a href="http://mosh.mit.edu/#getting">building from source</a> section, <a href="http://code.google.com/p/protobuf/">Protocol Buffers</a> and <a href="http://search.cpan.org/~rgiersig/IO-Tty-1.07/Pty.pm">IO::Pty</a> Perl module. To do this, download Protocol Buffers, untar and run:
./configure –prefix=/home/sai/usr && make && make check && make install
from the source root directory.</li>
<li>Download mosh, untar and run
export PKG_CONFIG_PATH=/home/sai/usr/lib/pkgconfig && ./configure –prefix=/home/sai/usr && make && make install
from the mosh source root directory.</li>
<li>Note that IO::Pty is not needed at compile/install time. Instead, it is needed to run mosh, which is a perl script. The steps are a little more involved, but I am going to gloss over the details here. Feel free to seek clarifications in the comments section below.
<ul>
<li>Run <code class="language-plaintext highlighter-rouge">cpan</code> (I chose ‘no’ for manual configuration).</li>
<li>Inside cpan, run <code class="language-plaintext highlighter-rouge">install IO::Tty</code>; if the files fail to download, download the files manually, transfer to <code class="language-plaintext highlighter-rouge">~/.cpan/sources/authors/<appropriate-path></code>.</li>
<li>These following two commands allow local install paths from within cpan command. Source: <a href="http://www.perlmonks.org/?node_id=630027">PerlMonks</a>.
cpan> o conf mbuildpl_arg “–install_base /home/sai/usr/local/”
cpan> o conf makepl_arg “PREFIX=/home/sai/usr/local/”</li>
<li>Again, run <code class="language-plaintext highlighter-rouge">install IO::Tty</code></li>
</ul>
</li>
<li>Add these lines to your .bashrc or appropriate startup shell configuration file:
export PERL5LIB=$PERL5LIB:/home/sai/usr/local/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/sai/usr/lib:
export PATH=$PATH:/home/sai/bin:</li>
</ul>
<p>Thats it. You should now be able to run <code class="language-plaintext highlighter-rouge">mosh</code>. To test, you can run: <code class="language-plaintext highlighter-rouge">mosh localhost</code>.</p>
<p><em>Note</em>. I used <code class="language-plaintext highlighter-rouge">cpan</code> since <code class="language-plaintext highlighter-rouge">cpanm</code> was not available on the system.</p>
The silent majority of expertsSai Charanme@saicharan.inhttp://www.saicharan.in2012-07-14T02:14:58-07:00https://www.saicharan.in/blog/2012/07/14/the-silent-majority-of-experts<p>James Hague quotes <a href="http://www.forth.com/resources/evolution/">Elizabeth Rather</a>:</p>
<blockquote>
<p>…there are people solving real problems with Forth, but they don’t hang-out in the newsgroup.</p>
</blockquote>
Liquid, Fluid site layoutSai Charanme@saicharan.inhttp://www.saicharan.in2012-07-12T15:48:38-07:00https://www.saicharan.in/blog/2012/07/12/liquid-fluid-site-layout<p>Inspired by <a href="http://en.wikipedia.org">wikipedia</a>, <a href="http://www.marco.org">marco.org</a> and other gorgeous websites, I added the necessary CSS for this website to adapt dynamically with varying layouts – note: no Javascript, just plain CSS. The solution is two fold:</p>
<ul>
<li>In the <code class="language-plaintext highlighter-rouge"><head></code> tag, add the following <code class="language-plaintext highlighter-rouge"><meta></code> tag:
<meta name="viewport" content="width=device-width" /></li>
<li>In the CSS file, add special CSS rules for varying screen sizes using this syntax:
@media (max-width: 1024px) {
/* CSS rules for screen sizes < 1024 px */
}
And yes, as always you may need to provide IE specific rules/overrides in a separate CSS file.</li>
</ul>
<p>Go ahead and try it: for the most ‘effect’ & live preview, resize your browser window. Or view this site on your tablet or mobile device.</p>
DNS migrated to Amazon's Route53Sai Charanme@saicharan.inhttp://www.saicharan.in2012-07-11T08:11:52-07:00https://www.saicharan.in/blog/2012/07/11/dns-migrated-to-amazons-route53<p>As of 3PM PST on 07/10/2012, the DNS provide for my domain <a href="http://www.saicharan.in">saicharan.in</a> is Amazon’s <a href="https://aws.amazon.com/route53/">Route53</a> service. Here is the migration log.</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">$ sudo pip install cli53</code> (see <a href="https://github.com/barnybug/cli53/#installation">installation notes</a>).</li>
<li>Choose to <a href="https://www.gandi.net/admin/domain?filter.zone.id=<zoneid>">‘see the zone file’</a> on Gandi.net’s <a href="https://www.gandi.net/admin/domain/zone/list#main">DNS zones page</a> and copy the zone file contents.</li>
<li>Create a file name saicharan.in containing the copy of the zone file from previous step.</li>
<li>As explained <a href="http://opensourcehacker.com/2011/11/23/migrating-from-bind-dns-servers-to-amazon-route-53-by-using-cli53/">here</a> unlike <a href="http://en.wikipedia.org/wiki/BIND">BIND</a>, cli53 does not infer <code class="language-plaintext highlighter-rouge">$ORIGIN</code> from the zone file name. For import to be successful, add the following line to the top of the file from the previous step.
$ORIGIN saicharan.in</li>
<li><code class="language-plaintext highlighter-rouge">$ touch ~/.boto</code></li>
<li>Add the following to ~/.boto:
[Credentials]
aws_access_key_id = [your AWS ID]
aws_secret_access_key = [your AWS key]</li>
<li><code class="language-plaintext highlighter-rouge">$ cli53 create saicharan.in</code></li>
<li><code class="language-plaintext highlighter-rouge">$ cli53 import example.com --file saicharan.in --replace --wait</code></li>
<li>Change saicharan.in’s DNS servers on Gandi.net’s control panel. The new name servers can be got by running:
$ cli53 info saicharan.in</li>
</ul>
Chrome Sync with Google Apps AccountsSai Charanme@saicharan.inhttp://www.saicharan.in2012-05-09T15:04:09-07:00https://www.saicharan.in/blog/2012/05/09/chrome-sync-with-google-apps-accounts<p>To enable <a href="http://support.google.com/chrome/bin/answer.py?hl=en&answer=165139">Chrome Sync</a> with a <a href="https://google.com/a/saicharan.in/">Google Apps account</a>, the admin must enable this feature. Instructions are in <a href="https://code.google.com/p/chromium/issues/detail?id=19589#c64">comment 64</a> as suggested on <a href="http://stackoverflow.com/q/8566726/162471">stackoverflow.com</a>.</p>
RHEL RPM RepositoriesSai Charanme@saicharan.inhttp://www.saicharan.in2012-05-03T12:46:35-07:00https://www.saicharan.in/blog/2012/05/03/rhel-rpm-repositories<p>For CentOS/RHEL, additional common packages are available at:</p>
<ul>
<li>EPEL 6 (i386): <a href="http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm">http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm</a></li>
<li>rpmforge (i386, EL 6): <a href="http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm">http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm</a></li>
</ul>
<p>For instance, <code class="language-plaintext highlighter-rouge">tmux</code> is available on EPEL while <code class="language-plaintext highlighter-rouge">htop</code> is available on rpmforge.</p>
Export & Import of GPG KeysSai Charanme@saicharan.inhttp://www.saicharan.in2012-04-30T18:07:55-07:00https://www.saicharan.in/blog/2012/04/30/export-import-of-gpg-keys<p>To remedy a case of corrupted gpg keys on Linux (if you have the GPGKeys elsewhere):</p>
<ul>
<li>First create a ‘Backup’ [on Windows, via the GPG4Win > GNU Privacy Assistant (GPA)].</li>
<li>Next, copy the backup file to Linux & on Linux, run: <code>gpg --import /path/to/backup/file</code>.</li>
<li>
<p>Lastly, set the necessary level of trust:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ gpg --edit-key <uid>;
gpg> trust
...
1 = I don't know or won't say
2 = I do NOT trust
3 = I trust marginally
4 = I trust fully
5 = I trust ultimately
m = back to the main menu
...
Your decision? 1
gpg> quit
</code></pre></div> </div>
</li>
</ul>
<p>Thankfully, a trusted Windows machine had GPG4Win which allowed me to export the key and saving my day!</p>
FreeNX on UbuntuSai Charanme@saicharan.inhttp://www.saicharan.in2012-04-29T14:41:37-07:00https://www.saicharan.in/blog/2012/04/29/freenx-on-ubuntu<p>I have been a VNC user (both <a href="http://www.realvnc.com">RealVNC</a> & <a href="http://www.tightvnc.com/">TightVNC</a>) for a number of years. It definitely has advantages such as “accessing your ‘real’ desktop”. But, it is slightly annoying to know that if your remote monitor is on, anybody watching it can actually see your screen without your knowledge. Further, with different screen resolutions on the remote and local systems, VNC only ‘scales’ the display which is not very nice especially when resolution is scaled down.</p>
<p>Which is where the alternative of <a href="www.nomachine.com">NoMachine</a> turned up on my radar. On my Ubuntu desktop, I installed the <a href="http://www.nomachine.com/select-package.php?os=linux&id=1">NX Free Edition</a> software; client, node & server: in that order. On my windows, I set up the <a href="http://www.nomachine.com/download-package.php?Prod_Id=3655">NX Windows Client</a>. Set up a tunnel from my Windows machine to my remote desktop, which is needed since my desktop is behind a gateway.</p>
<p>Finally, to access the GNOME session, I had to change the configuration as <a href="http://ubuntuforums.org/showpost.php?p=11586915&postcount=8">suggested here</a>.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/usr/NX/etc/node.cfg
Comment out this line:
CommandStartGnome = "/etc/X11/Xsession gnome-session"
And replace it with this line:
CommandStartGnome = "/usr/bin/gnome-session --session=gnome-classic"
</code></pre></div></div>
<p>The screen resolution with NX is remarkably crisp & clear. Now I can get to work on remote GUI without squinting!</p>
<p>Update: To access an existing X11 session, choose ‘Shadow’ as the Desktop type. (See <a href="http://serverfault.com/a/44326/88592">this link</a> for details).</p>
Dtrace on Linux (Ubuntu)Sai Charanme@saicharan.inhttp://www.saicharan.in2012-04-27T11:17:37-07:00https://www.saicharan.in/blog/2012/04/27/dtrace-on-linux-ubuntu<p>So I needed to use on <a href="http://www.crisp.demon.co.uk/">Dtrace</a> on Linux. I picked the <a href="ftp://crisp.dyndns-server.com/pub/release/website/dtrace/dtrace-20120409.tar.bz2">April 2012</a> release of the <a href="ftp://crisp.dyndns-server.com/pub/release/website/dtrace">software</a>.</p>
<p>Followed these instructions from <a href="http://mustalikachwala.blogspot.com/2012/03/lazyswamp-dtrace-on-linux.html">Mustali Kachwala’s blog</a>:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ bunzip2 < dtrace-*.bz2 | tar xvf -
$ sudo apt-get install bison
$ sudo apt-get install flex
$ sudo apt-get install zlib1g-dev
$ sudo apt-get install libelf-dev
$ cd dtrace-[TAB]
$ make all
</code></pre></div></div>
<p><code> $ make install</code> failed to find gnu/stubs-32.h. As suggested on <a href="http://stackoverflow.com/a/7412698/162471">Stackoverflow</a>, I did <code> sudo apt-get install libc6-dev-i386</code>. Note that <code> sudo apt-get install libc6-dev</code> did not work; probably <a href="http://stackoverflow.com/questions/7412548/gnu-stubs-32-h-no-such-file-or-directory#comment8957902_7412698">Timothy’s comment</a> in the same SO thread is a pertinent explanation. <code> make all</code> was successful, but notified me that <code> build/ctfconverter</code> did not exist, so no <code> linux*.ctf</code> files were produced; but that did not seem an error; just a warning.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># First, I needed to comment out the lines
# that attempted to install *.ctf files.
$ sudo make install
$ sudo make load
</code></pre></div></div>
<p>Notice that the <code> install</code> script installed <code> dtrace</code> at <code> /usr/sbin</code>, and not <code> /usr/bin</code>. This distinction is important since there is a default version of <code> dtrace</code> at <code> /usr/bin/dtrace</code>, which does NOT take most of the options that the newly compiled version of <code>dtrace</code> accepts.</p>
<p>Then & only then did the <a href="https://wikis.oracle.com/display/DTrace/Introduction">options & examples on the wiki</a> begin to work.</p>
Remembering the Neverhood ChroniclesSai Charanme@saicharan.inhttp://www.saicharan.in2012-03-29T11:06:09-07:00https://www.saicharan.in/blog/2012/03/29/remembering-the-neverhood-chronicles<p>Since this morning, the memory of a computer game that I played as a kid kept surfacing in my head. Weirdly, the name kept eluding me; until a Google search for <a href="https://www.google.com/search?q=computer+clay+game">‘computer clay game’</a> turned up the one and only ‘Neverhood Chronicles’ :)</p>
<p>Here is an image sourced from <a href="http://en.wikipedia.org/wiki/The_Neverhood">Wikipedia</a>:</p>
<p><a href="http://en.wikipedia.org/wiki/The_Neverhood"><img src="http://upload.wikimedia.org/wikipedia/en/1/12/The_Neverhood_-_box_art.jpg" alt="The Neverhood" title="The Neverhood!" /></a></p>
<p>The opening line is unassumingly simple:</p>
<blockquote>
<p>“<em>Hello. Me Willie. Me Willie Trombone. You read this, you do good. Willie happy. <br />
You play Neverhood you do more good. And look out for bad. <br />
Willie knows, bad is always where you forget to look</em>.”</p>
</blockquote>
<p>Well, getting it running was painstakingly hard, even given its extremely modest system requirements:</p>
<ul>
<li>Pentium 75 mhz</li>
<li>8 Mg RAM (16 recommended)</li>
<li>1 Mg VRAM</li>
<li>SVGA monitor</li>
<li>Quad speed CD ROM</li>
<li>8-bit sound card & speakers (16-bit recommended)</li>
<li>10 Mg available hard disk space for Installation</li>
<li>Microsoft Windows 95.</li>
</ul>
<p>Luckily, I tend to preserve my old original CDs/DVDs. And, with a little help from the free <a href="http://www.microsoft.com/windows/virtual-pc/default.aspx">Windows VirtualPC</a>, its pure gεεk joy!</p>
Migrated to Gandi.netSai Charanme@saicharan.inhttp://www.saicharan.in2012-03-25T09:15:43-07:00https://www.saicharan.in/blog/2012/03/25/migrating-to-gandinet<p>For various reasons & non-reasons, I decided to move my <a href="http://saicharan.in">domain</a> from <a href="http://domains.nettigritty.com">Nettigritty</a> to <a href="http://gandi.net">Gandi.net</a>.</p>
<p>As of this writing, the transition has been successful. With Nettigritty not my domain registrar, I also decided to move away from their hosting solution. If you have been following this blog, as noted <a href="/blog/2011/08/22/migrating-to-jekyll/">here</a>, <a href="/blog/2011/08/24/static-blog-using-jekyll/">here</a> & <a href="/blog/colophon.html">here</a>, this blog now runs as a <a href="http://jekyllrb.com">Jekyll</a> generated, <a href="https://github.com/scharan/scharan.github.com/">Github</a> hosted static site. I recently successfully experimented with Amazon’s <a href="http://aws.amazon.com/s3/">S3</a> to run a static site.</p>
<p>Since this website does not have too much traffic I realize I don’t need a dedicated hosting solution. Therefore, for purposes of economy, speed & availability, I decided to run it off Amazon S3. So, this page you are seeing is now served off S3.</p>
<p>Getting here has not been completely straight forward, so the rest of this piece is a little chronicle of the extras:</p>
<ul>
<li>DNS setup on Gandi.net from scratch.</li>
<li>Without a hosting provider, this site does not have a real A record. So, people who visit http://saicharan.in would then get an error message. As naked domains cannot be DNS mapped with CNAME records, a little <a href="https://forums.aws.amazon.com/thread.jspa?threadID=55995">digging</a> around revealed <a href="http://wwwizer.com">wwwizer.com</a> as a free(!) service for this very purpose. However, I also found that Google Apps also provides this service for Apps enabled sites. Since this domain has also been setup for Google Apps, I simply set up the appropriate A records as listed at on the <a href="https://www.google.com/a/cpanel/saicharan.in/DomainSettingsDomains">dashboard page</a> (warning: access restricted page). In summary, the DNS set up is:
<ul>
<li>saicharan.in. 10800 IN A 216.239.36.21</li>
<li>www.saicharan.in. 10800 IN CNAME saicharan.in.s3-website-us-east-1.amazonaws.com.</li>
</ul>
</li>
<li>Set up S3 bucket, add bucket policy and enable bucket as a website. See <a href="http://aws.typepad.com/aws/2011/02/host-your-static-website-on-amazon-s3.html">this</a> for details.</li>
<li>Wait for DNS entries to propagate.</li>
</ul>
Give it five minutesSai Charanme@saicharan.inhttp://www.saicharan.in2012-03-01T14:10:45-08:00https://www.saicharan.in/blog/2012/03/01/give-it-five-minutes<p>Absolutely true wisdom from 37signals.com’s Jason. <a href="https://37signals.com/svn/posts/3124-give-it-five-minutes">Give it five minutes</a></p>
Anyconnect VPN on Ubuntu x64Sai Charanme@saicharan.inhttp://www.saicharan.in2012-02-04T04:16:28-08:00https://www.saicharan.in/blog/2012/02/04/anyconnect-vpn-on-ubuntu-x64<p>Connecting to the VPN website to launch Anyconnect installer was not helping – either with Firefox, nor with Chrome. The Applet kept loading to eternity with no installation. Chanced upon <a href="http://blog.mattwoodward.com/installing-cisco-anyconnect-on-64-bit-ubuntu">http://blog.mattwoodward.com/installing-cisco-anyconnect-on-64-bit-ubuntu</a>, which suggested that on Firefox, I disable the IcedTea-Web plugin for Java Applets – and it worked. After the disable, I was given a link to download the installer for ‘Linux _x86_64’ platforms, which when run installed the VPN without any further hassle.</p>
Quest for a good AntivirusSai Charanme@saicharan.inhttp://www.saicharan.in2012-01-26T03:55:41-08:00https://www.saicharan.in/blog/2012/01/26/quest-for-a-good-free-antivirus-<p>I have long been a loyal customer of Norton Internet Security product – and I can vouch for its comprehensive, effective protection. However, when my most recent subscription expired, due to my Grad-student budget I decided to try other alternatives that I had access to via other subscriptions, or free software.</p>
<p>My ISP, Charter Inc. provides its users a security solution titled <a href="http://www.myaccount.charter.com/customers/supportgeneral.aspx?pagetype=1">‘Charter Security Suite’</a> which in turn is an offering from F-Secure. While I have been skeptic of anything other than Symantec/Mc Afee/Zone Alarm, I decided to give it a try. After all, F-Secure is a for-profit organization and I must be paying for it indirectly (by paying my ISP).</p>
<p>It turns out to be quite noisy. I have grown used to Norton silently making decisions for me based on its <a href="http://www.symantec.com/about/profile/universityresearch/sharing.jsp">Symantec WINE</a>. But being an early adopter, I occasionally did manually choose my trust levels with Norton. The Charter Security Suite on the other hand, asked me if I trusted Google Talk, Yahoo Messenger and nearly every other prevalent software out there.</p>
<p>And, curiously, this antivirus was not the first program to startup. It usually started after quite a few software that connect to the Internet were up and running – bad, right?</p>
<p>And then there was that fiasco with one software update – Charter’s suite asked me if I trusted the exact same binary about 30 times! That was the limit.</p>
<p>I had the free <a href="http://windows.microsoft.com/en-US/windows/products/security-essentials">Microsoft Security Essentials</a> running on my parent’s PCs and they never mentioned it nor was there any incident of virus on their systems - a good thing. So I decided to try it. Install was a breeze and the quick scan completed in under 15 minutes without affecting my system performance. Nice!</p>
<p>But I was not comfortable with no firewall on my Windows PC – enter <a href="http://www.zonealarm.com/security/en-us/zonealarm-pc-security-free-firewall.htm">Zone Alarm</a>. I had used it a master’s student and remember being very satisfied with it. The download size (~150MB) was a bit of a brow-riser, but the install and setup was fantastic. Funnily, I kept waiting for ZoneAlarm to pop-up and ask me to set up something – but good thing I was disappointed there. I then dug into the settings to find all in good shape – software that I trusted was already trusted; no pesky pop-ups.</p>
<p>So that is my current setup - Microsoft Security Essentials and ZoneAlarm Firewall - both free & so far so good.</p>
Reading on the InternetSai Charanme@saicharan.inhttp://www.saicharan.in2011-11-01T07:52:19-07:00https://www.saicharan.in/blog/2011/11/01/reading-on-the-internet<p>I tend to have this belief that one spends a fair amount of your time reading on the internet. If that is true now or in foreseeable future, you may want to read on.</p>
<p>There has been a fair amount of work on making the world a more readable place. Of these, three tools are on my radar: <a href="http://readability.com">http://readability.com</a>, <a href="http://instapaper.com">http://instapaper.com</a> and Safari’s Reader mode.</p>
<p>Readability.com specializes in making your reading experience a good one: it removes clutter, ads and all that and shows you just text. And renders it beautifully at that. They have a paid app and also a free bookmarklet that lets you do this.</p>
<p><a href="http://Instapaper.com">http://Instapaper.com</a> is basically a reading list (read later option) that you can access from any browser with a native iPad/iPhone/iPod paid app. However, my interest in this is mostly the bookmarlket that cleans up the text.</p>
<p>On the heels of Instapaper and Readability, Apple released a browser in-built ‘Reader’ mode. Simply click on the reader button in the far end of the address bar for web-pages that are ‘readable’ and you are presented with a fantastic clean view of the content. So far, my favorite has been readability.com’s bookmarklet, but now I find myself doing all my reading in Safari browser (available even for PC). See this for what I mean: <a href="http://www.apple.com/safari/whats-new.html#gallery-read-reader">http://www.apple.com/safari/whats-new.html#gallery-read-reader</a></p>
<p>Very easy on the eyes and zero distraction. Highly Recommended.</p>
Default runlevel on CentOSSai Charanme@saicharan.inhttp://www.saicharan.in2011-10-26T01:20:18-07:00https://www.saicharan.in/blog/2011/10/26/default-runlevel-on-centos<p>A reminder to self (this should work for all BSD-like systems, including Fedora & RHEL) —</p>
<p>Edit /etc/inittab as root. The number after the first colon after id is the default runlevel.</p>
<pre class="brush: shell">
id:3:initdefault:
</pre>
<p>BTW, I prefer runlevel 3 (no GUI).</p>
<p>Reference: <a href="http://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-boot-init-shutdown-sysv.html">http://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-boot-init-shutdown-sysv.html</a></p>
Ubuntu 11.10, PuTTy, tmux & UTF-8Sai Charanme@saicharan.inhttp://www.saicharan.in2011-10-16T18:46:22-07:00https://www.saicharan.in/blog/2011/10/16/ubuntu-1110-putty-tmux-utf8<p>After the upgrade today, firing up a tmux session via PuTTy with my usual “Session Settings > Translation > Remote Character Set” pointing to “ISO-8859-6:1999 (Latin/Arabic)”, I found that line drawings were all messed up: the lines were drawn with the ‘a’ like characters, instead of lines. It occured to me that the newly updated Ubuntu ncursesw libraries and/or tmux may have fixed something. Promptly switching to ‘UTF-8’ as the remote character set brought back the good looking line-drawings.</p>
Gitweb with 'side-by-side' diffSai Charanme@saicharan.inhttp://www.saicharan.in2011-10-09T16:20:40-07:00https://www.saicharan.in/blog/2011/10/09/gitweb-with-sidebyside-diff<p><strong>Update</strong>: With git v1.7.9.5, this hack below is not needed anymore. Gitweb comes with sidebyside diff.</p>
<p>Bonus: Simultaneously scroll left and right files with overflow.</p>
<p>Dependencies: <a href="http://jquery.com/">jQuery</a></p>
<p>Usage: Simply include jQuery in gitweb/gitweb.cgi (within the head tag).</p>
<p>Future work: Going by <a href="http://kerneltrap.org/mailarchive/git/2009/6/11/4701">this thread</a> on kerneltrap.org, ‘side-by-side’ diff appears to have been on the team’s TODO list and never gotton around to being implemented. So, except for the simultaneous scrolling, I intend to port this to Perl and hope to get it integrated into Gitweb core. Simultaneous scrolling needs to be done in Javascript and the fact that external dependencies are <a href="http://kerneltrap.org/mailarchive/git/2009/6/11/4701">frowned upon</a>,</p>
<blockquote>
<p>Note that we frown upon introducing extra dependencies for gitweb, unless they are optional, and best detected automatically.</p>
</blockquote>
<p>scrolling needs to be handled separately in gitweb.js (the currently implementation depends on <a href="http://jquery.com">jQuery</a>).</p>
<p>Screenshot: <a href="/images/side-by-side-diff-with-scroll.jpg"><img src="/images/side-by-side-diff-with-scroll.jpg" alt="Gitweb side-by-side diff" /></a></p>
<p>Gist: <a href="https://gist.github.com/1274726">https://gist.github.com/1274726</a></p>
<script src="https://gist.github.com/1274726.js"> </script>
Richard Stallman & Steve JobsSai Charanme@saicharan.inhttp://www.saicharan.in2011-10-08T05:24:16-07:00https://www.saicharan.in/blog/2011/10/08/richard-stallman--steve-jobs<p>Richard Stallman <a href="http://stallman.org/archives/2011-jul-oct.html#06_October_2011_(Steve_Jobs\)">wrote</a>:</p>
<blockquote>
<p>Steve Jobs, the pioneer of the computer as a jail made cool, designed to sever fools from their freedom, has died.</p>
<p>As Chicago Mayor Harold Washington said of the corrupt former Mayor Daley, “I’m not glad he’s dead, but I’m glad he’s gone.” Nobody deserves to have to die - not Jobs, not Mr. Bill, not even people guilty of bigger evils than theirs. But we all deserve the end of Jobs’ malign influence on people’s computing.</p>
<p>Unfortunately, that influence continues despite his absence. We can only hope his successors, as they attempt to carry on his legacy, will be less effective.</p>
</blockquote>
<p>When I first read it, I was shocked. Somehow, my respect and admiration for Steve, and the news of his demise seemed to confuse the whole thing. Perhaps, I thought, Stallman did not wait ‘the appropriate amount of time’ after Jobs’ passing - but hey, what is the appropriate amount of time? As <a href="http://daringfireball.net/2011/10/thoughts_and_observations_iphone_4s">Gruber</a> put it, ‘…life goes on.’</p>
<p>I could sense a fringe thought that I seemed to be actively fending away: that there was some truth in Stallman’s words; and that he was being very respectful in what he said. But then, I could not place my thoughts - like I mentioned earlier, I seemed to be in a limbo of sorts.</p>
<p>And then there was light! Dave Winer, the guy credited with inventing RSS, first tweeted <a href="https://twitter.com/#!/davewiner/status/122417111640453121">this</a></p>
<blockquote>
<p>Stallman’s epitaph for Jobs is appropriate and respectful. http://r2.ly/7f3u</p>
</blockquote>
<p>and followed up with <a href="http://scripting.com/stories/2011/10/08/stallmanSteve.html">this</a>. And I seem to agree - Stallman was right; and appropriately respectful too. Brilliant, well thought out & effectively communicating piece of writing from Dave.</p>
<p>To relate with the concluding paragraph from Stallman, it helps to be familiar with Apple’s ‘Think Different’ ad campaign. A transcript of it is here: <a href="http://saicharan.in/blog/2011/10/06/heres-to-the-crazy-ones/">http://saicharan.in/blog/2011/10/06/heres-to-the-crazy-ones/</a></p>
Here's to the Crazy OnesSai Charanme@saicharan.inhttp://www.saicharan.in2011-10-06T11:56:06-07:00https://www.saicharan.in/blog/2011/10/06/heres-to-the-crazy-ones<p><a href="http://www.loopinsight.com/">The Loop</a> linked to a <a href="http://www.youtube.com/watch?feature=player_embedded&v=8rwsuXHA7RA">video</a> on Youtube and titled it <a href="http://www.loopinsight.com/2011/10/06/steve-jobs-narrates-the-crazy-ones/">‘Steve Jobs narrates The Crazy Ones’</a>. Here is a transcription (puctuation & emphasis is as I inferred, listening):</p>
<blockquote>
<p>Here is to the crazy ones. The misfits. The rebels. The trouble makers. The round pegs in the square holes; the ones who see things differently. They’re not fond of rules and they have <em>no</em> respect for the status quo. You can quote them, disagree with them; glorify or vilify them. About the only thing you <strong>can’t</strong> do is ignore them - because they change things. They push the human race forward. While some may see them as the crazy ones, we, see genius. Because people who are crazy enough to think they can change the world, are the ones <em>who do</em>.</p>
</blockquote>
<p>And the video:</p>
<p> <iframe width="160" height="120" src="http://www.youtube.com/embed/8rwsuXHA7RA?showinfo=0" frameborder="0" allowfullscreen></iframe></p>
Steve on Courage, Heart and IntuitionSai Charanme@saicharan.inhttp://www.saicharan.in2011-10-05T18:50:10-07:00https://www.saicharan.in/blog/2011/10/05/steve-on-courage-heart-and-intuition<p>…have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.</p>
Remembering Steve JobsSai Charanme@saicharan.inhttp://www.saicharan.in2011-10-05T17:38:16-07:00https://www.saicharan.in/blog/2011/10/05/remembering-steve-jobs<p>In his commencement address at Stanford, <a href="http://apple.com/stevejobs">Steve Jobs</a> said (<a href="http://news.stanford.edu/news/2005/june15/jobs-061505.html">Stanford News</a>)-</p>
<blockquote>
<p>Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure - these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.</p>
</blockquote>
<p>In the light of this, as <a href="http://twitter.com/roshnimo">@roshnimo</a> <a href="https://twitter.com/krtgrphr/status/121736094776700928">notes</a>, it feels a tad foolish to mourn. </p>
Texnic Center error 'pdflatex.exe: Could not Initialize GUI'Sai Charanme@saicharan.inhttp://www.saicharan.in2011-09-04T10:02:07-07:00https://www.saicharan.in/blog/2011/09/04/texnic-center-error-pdflatexexe-could-not-initialize-gui<p>Another note to self —<br />
This error only means that MikTeX was <a href="http://www.latex-community.org/forum/viewtopic.php?f=31&t=310#p1043">unable to find and/or install some missing packages</a>. To fix this (on Windows), run ‘mo.exe’ from the command prompt and choose ‘Yes’ for ‘Install missing pacakges on-the-fly’. (‘Ask me first’ did not work for me).</p>
You want to know how to do itSai Charanme@saicharan.inhttp://www.saicharan.in2011-09-03T03:01:34-07:00https://www.saicharan.in/blog/2011/09/03/quote-you-want-to-know-how-to-do-it<p>You wanna know how you do it?</p>
<p>Here’s how, they pull a knife, you pull a gun. He sends one of yours to the hospital, you send one of his to the morgue. That’s the Chicago way.</p>
Jekyll feature: Retain Modified Time StampSai Charanme@saicharan.inhttp://www.saicharan.in2011-09-02T05:54:03-07:00https://www.saicharan.in/blog/2011/09/02/jekyll-feature-retain-modified-time-stamp<p>To ease publishing via Jekyll, I needed to push via FTP to my hosting provider. I decided to the perl utility from sourceforge: <a href="http://sourceforge.net/projects/ftpsync/">ftpsync</a>. However, running it made me notice that Jekyll always regenerated all files and obviously, they had a ‘now’ timestamp. This was basically throwing off the FTPSync utility which ended up pushing the entire site, defeating the very purpose of the utility.</p>
<p>So, I made a two line fix that handles static pages and _posts/ as follows: The time stamp of the markdown/static page is copied to the published post page. So, even though Jekyll regenerates the entire site, the timestamps are adjusted to prevent unnecessary push via tools like FTPSync. Note that other pages will still have the ‘now’ timestamp.</p>
<p>The diff can be <a href="https://github.com/scharan/jekyll/compare/handle-modified-timestamps#diff-0">viewed here</a>. Feedback/suggestions welcome in comments.</p>
URL Selection in PuttySai Charanme@saicharan.inhttp://www.saicharan.in2011-09-01T08:26:22-07:00https://www.saicharan.in/blog/2011/09/01/url-selection-in-putty<p>Finally! Used <a href="http://tech.arantius.com/select-urls-in-putty">this</a> article to fix the partial URL selection problem with PuTTy. In addition to ‘:’, I also ‘set to class 2’ the characters: ‘?’ & ‘#’.</p>
Tributes to Steve JobsSai Charanme@saicharan.inhttp://www.saicharan.in2011-08-25T04:15:00-07:00https://www.saicharan.in/blog/2011/08/25/tributes-to-steve-jobs<p>Here are a few more reflections from people I read:</p>
<ul>
<li><a href="http://daringfireball.net/2011/08/resigned">John Gruber</a></li>
<li><a href="http://scripting.com/stories/2011/08/25/thanksSteve.html">Dave Winer</a></li>
<li><a href="http://pogue.blogs.nytimes.com/2011/08/25/steve-jobs-reshaped-industries/">David Pogue</a></li>
<li><a href="http://www.marco.org/2011/08/24/steve-jobs-resigns-as-apple-ceo">Marco Arment</a> closes with -</li>
</ul>
<blockquote>
<p>Steve, if for some crazy reason you’re reading this:</p>
<p>You’ve defined a generation and changed the world.</p>
<p>Thank you.</p>
<p>We wish you the best.</p>
</blockquote>
<p>May be I’ll add a few more as they pop up.</p>
When GOD called Vic GundotraSai Charanme@saicharan.inhttp://www.saicharan.in2011-08-25T03:10:00-07:00https://www.saicharan.in/blog/2011/08/25/when-god-called-vic-gundotra<p>Being an Apple fanboy, I enjoyed this piece. It is interesting that after Steve Jobs resigned, many such stories have surfaced.</p>
<p>Vic Gundotra <a href="https://plus.google.com/107117483540235115863/posts/gcSStkKxXTw">recalls</a>:</p>
<blockquote>
<p>Steve laughed. He said, “Vic, unless the Caller ID said ‘GOD’, you should never pick up during services”. […]</p>
</blockquote>
<p>and concludes -</p>
<blockquote>
<p>But in the end, when I think about leadership, passion and attention to detail, I think back to the call I received from Steve Jobs on a Sunday morning in January. It was a lesson I’ll never forget. CEOs should care about details. Even shades of yellow. On a Sunday.</p>
<p>To one of the greatest leaders I’ve ever met, my prayers and hopes are with you Steve.</p>
</blockquote>
<p>Nice!</p>
When Steve Held Open the DoorSai Charanme@saicharan.inhttp://www.saicharan.in2011-08-25T02:40:00-07:00https://www.saicharan.in/blog/2011/08/25/when-steve-held-open-the-door<p><a href="http://tumblr.davidcairns.org/post/9359368094/so-steve-jobs-has-left-his-role-as-apples-ceo">David Cairns</a> writes:</p>
<blockquote>
<p>Anyway, I knew the distance pretty well, so when I sensed that I was reaching the other side of the quad, I opened my eyes and looked down and Steve was holding the door for me, grinning to himself. I have no idea how long he had been holding it, though it was probably only a couple seconds, long enough to cause him to smile at my basking in the open air.</p>
<p>Those couple seconds probably cost Apple $1.4bn.</p>
</blockquote>
<p>Must have quite an experience!</p>
Static Blog Using JekyllSai Charanme@saicharan.inhttp://www.saicharan.in2011-08-24T00:00:00-07:00https://www.saicharan.in/blog/2011/08/24/static-blog-using-jekyll<p>This is what it took me to migrate from WordPress to Jekyll:</p>
<ul>
<li>Import blog using the wordpressdotcom importer.</li>
<li>Use Disqus WP plugin to export comments into Disqus.</li>
<li>Generate static pages (include Disqus code in Jekyll template).</li>
<li>Add search functionality.</li>
<li>Add personal pages (about/search/rss).</li>
</ul>
<p>Done! (A preview is available <a href="http://aws.saicharan.in">here</a>.)</p>
<p>Update:</p>
<ul>
<li>Adding tags was a lot more effort. A little help from <a href="https://gist.github.com/143571#gistcomment-7054">this gist</a> saved the day.</li>
<li>Adding pages for year, month and day was a ton more effort. I modified archive.rb from <a href="https://github.com/josegonzalez/josediazgonzalez.com/_plugins">josegonzalez</a> and also customized his _layout/archive_*.html</li>
<li>Added an error handler with some JS to show my own custom error page.</li>
</ul>
<p>You can find the sources here: <a href="https://github.com/scharan/scharan.github.com">https://github.com/scharan/scharan.github.com</a>.</p>
<p><em>Update:</em></p>
<p>I also modified <a href="https://github.com/metajack/jekyll/blob/master/emacs/jekyll.el">metajack’s jekyll.el</a> to add a date: header (with date & time) on publish: <a href="https://gist.github.com/1171592">https://gist.github.com/1171592</a>. The gist:</p>
<script src="https://gist.github.com/1171592.js?file=jekyll.el"></script>
Migrating to JekyllSai Charanme@saicharan.inhttp://www.saicharan.in2011-08-22T00:00:00-07:00https://www.saicharan.in/blog/2011/08/22/migrating-to-jekyll<p>Ah! The joy of <a title="markdown" href="http://daringfireball.net/projects/markdown/" target="_blank">markdown</a>! I preferred to write text, not markup. As @gruber states at the opening, markdown allows me write simply. However, it was painful to blog with this workflow:</p>
<ul>
<li>write in markdown</li>
<li><a href="http://daringfireball.net/projects/markdown/dingus" target="_blank">convert to HTML</a></li>
<li>copy paste the HTML to blog editor</li>
<li>publish</li>
</ul>
<p>It was just too painful. Enter <a href="http://jekyllrb.com" target="_blank">Jekyll</a>. I first came across <a href="http://www.allthingsdistributed.com/2011/08/Jekyll-amazon-s3.html" target="_blank">Jekyll</a> here on <a href="http://allthingsdistributed.com" target="_blank">allthingsdistributed.com</a>. <a href="http://tom.preston-werner.com/" target="_blank">Tom Preston-Werner</a> (Jekyll’s author) notes <a href="http://tom.preston-werner.com/2008/11/17/blogging-like-a-hacker.html" target="_blank">here</a>, he needed something simpler - so he wrote Jekyll.</p>
<p>I liked my new <a title="munich theme" href="https://github.com/scharan/munich" target="_blank">munich theme</a>, and so wrote my own <a href="https://github.com/scharan/scharan.github.com/blob/master/index.html" target="_blank">index.html</a>, <a href="https://github.com/scharan/scharan.github.com/blob/master/_layouts/default.html" target="_blank">default.html</a>, <a href="https://github.com/scharan/scharan.github.com/blob/master/_layouts/post.html" target="_blank">post.html</a> and <a href="https://github.com/scharan/scharan.github.com/blob/master/css/munich.css" target="_blank">css</a>. You can see the work in progress here: <a href="http://aws.saicharan.in" target="_blank">aws.saicharan.in</a>.</p>
SaveURI has a new home!Sai Charanme@saicharan.inhttp://www.saicharan.in2011-08-18T00:00:00-07:00https://www.saicharan.in/blog/2011/08/18/saveuri-has-a-new-home<p>On Github: <a href="https://github.com/scharan/saveuri" target="_blank">https://github.com/scharan/saveuri</a></p>
Persisting/restoring ssh-agent across screen/tmux sessionsSai Charanme@saicharan.inhttp://www.saicharan.in2011-08-15T00:00:00-07:00https://www.saicharan.in/blog/2011/08/15/persistingrestoring-ssh-agent-across-screentmux-sessions<p>As a heavy user of screen and now of tmux, I find it annoying that each time I disconnect the terminal and reconnect and then reattach to screen/tmux, I find that inside the screen/tmux sessions, SSH_AUTH_SOCK variable is stale: it does not point anymore to the ‘current’ agent.pid file. So, here is a script to fix that: <a href="https://github.com/scharan/Goodies/blob/master/ssh-agent-restore">https://github.com/scharan/Goodies/blob/master/ssh-agent-restore</a></p>
'gitweb' setup without root accessSai Charanme@saicharan.inhttp://www.saicharan.in2011-08-14T00:00:00-07:00https://www.saicharan.in/blog/2011/08/14/gitweb-setup-without-root-access<p><strong>Setting up gitweb on a machine with no root access:</strong>
<br />
<br /></p>
<div>First, set up lighttpd:</div>
<div>Download from <a href="http://www.lighttpd.net/download">http://www.lighttpd.net/download</a></div>
<pre class="brush:shell">
$ mkdir -p ~/usr
$ tar -xvf lighttpd-*; cd !$;
$ ./configure --prefix /home/<you>/usr
$ make
$ make install ## lighttpd is now at ~/usr/sbin/
</pre>
<p><br /></p>
<div>- Now, if all is well, you should be able to run git instaweb in your local git repository.</div>
<div>- If you see a message like base-docroot not found at /PATH/TO/SOME/WHERE, then it probably did not find that directory.</div>
<div>To resolve this, you can do one of two things:</div>
<div> 1. Find the directory named gitweb/ that contains index.cgi, gitweb.cgi and static/ and run</div>
<pre class="brush:shell"> $ git config --get instaweb.gitwebdir "/PATH/TO/gitweb/" (I figured this from /usr/bin/git-instaweb)</pre>
<p><br /></p>
<div> 2. Emulate a local install</div>
<pre class="brush:shell">
$ mkdir -p ~/www/static
$ git config --get instaweb.gitwebdir "/home//www"
$ scp ssh://my-ubuntu-machine-with-sudo-access:/usr/share/gitweb/* ~/www/
$ scp ssh://my-ubuntu-machine-with-sudo-access:/usr/share/gitweb/static/* ~/www/static
$ cd git-repo; git instaweb;
</pre>
<p><br /></p>
<div> - If it instead start and you then see an error like: 404 Not found, the folder exists but</div>
<div> - the index.cgi file is not found, simply do step 2 above.</div>
<p>
<br /></p>
<div><strong>Setting up highlight (on a machine with no root access):</strong></div>
<div>- Download hightlight from here: <a href="http://www.andre-simon.de/zip/download.html">http://www.andre-simon.de/zip/download.html</a></div>
<div> $ tar -xvf hightlight*; cd !$;</div>
<div> $ make</div>
<div> $ edit 'makefile'<span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;"> </span></div>
<pre class="brush:shell">
# Destination directory for installation (intended for packagers)
DESTDIR =
# Root directory for final installation
PREFIX = /home/csgrads/scharan/usr # or something appropriate.
$ make install
$ PATH=$PATH:~/usr/bin/:
</pre>
<p><br /></p>
<div>- Download lua from here: <a href="http://www.lua.org/ftp/lua-5.1.4.tar.gz">http://www.lua.org/ftp/lua-5.1.4.tar.gz</a></div>
<pre class="brush:shell">
$ make linux
$ Edit makefile to point INSTALL_TOP to ~/usr/local
</pre>
<p><br /></p>
<div> - Edit ~/www/gitweb.cgi: enable highlight feature (you gotta grep for it).</div>
Vonage Usage: Python ScriptSai Charanme@saicharan.inhttp://www.saicharan.in2011-08-09T00:00:00-07:00https://www.saicharan.in/blog/2011/08/09/vonage-usage-python-script<p>This eases checking international minutes used with a Vonage World plan <a href="http://saicharan.in/work/vonage.py" target="_blank">http://saicharan.in/work/vonage.py</a>. Just put in your vonage username/password in the script. You would also want to</p>
<pre class="brush: shell">$ sudo pip install libxml2dom</pre>
<p>Further, to avoid manual check, here is a crontab entry to automatically check usage at 6 AM everyday. It then emails you if you have overshot the usage (defaults to 3000 mins/month). My mail.sh is available on: <a href="https://github.com/scharan/Goodies/blob/master/mail.sh" target="_blank">Github</a>.</p>
<pre class="brush: shell">0 6 * * * vonage.py 1>/tmp/vonage-mail; ret=$?; if [ $ret -ne 0 ]; then mail.sh "Vonage Usage: $ret" /tmp/vonage-mail; fi</pre>
<p>The script:
<script type="text/javascript" src="http://gist-it.appspot.com/github/scharan/Goodies/raw/master/vonage.py"></script>
<!--script src="https://gist.github.com/1137615.js"> Vonage Usage Gist </script--></p>
Readability for Chrome: Save to InstapaperSai Charanme@saicharan.inhttp://www.saicharan.in2011-08-08T00:00:00-07:00https://www.saicharan.in/blog/2011/08/08/readability-for-chrome-save-to-instapaper<p>I love readability (readability.com) for the clutter free reading experience. As a student, I prefer freebies. Instapaper does a great job of reading lists - and its free too. I wanted to combine the Readability’s ‘Read Later’ shortcut (shift + `) to save to Instapaper. Turns out, its easy:</p>
<p>On Windows, goto:
%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\Extensions\oadggleneidfmbhhedlildjnpgcggmch\1.6_0\js</p>
<p>On Ubuntu Linux, goto:
~/.config/chromium/Default/Extensions/oadggleneidfmbhhedlildjnpgcggmch/1.6_0/js/</p>
<p>Replace the contents of ‘save.js’ with the script below. <del datetime="2011-08-13T03:10:26+00:00">You will have to replace with the string that follows instapaper.com/j/ in your personal bookmarklet - sorry, its a wee little bit more effort.</del> Found a way to avoid user specific token. This works out of the box.
<script type="text/javascript" src="http://gist-it.appspot.com/github/scharan/Goodies/raw/master/save.js"></script>
<!--pre class="brush: javascript">(function(){var d=document,z=d.createElement('scr'+'ipt'),b=d.body,l=d.location;try{if(!b)throw(0);d.title='(Saving...) '+d.title;z.setAttribute('src',l.protocol+'//www.instapaper.com/j/ms9ZEqYS9JfG?u='+encodeURIComponent(l.href)+'&t='+(new Date().getTime()));b.appendChild(z);}catch(e){alert('Please wait until the page has loaded.');}}());</pre--></p>
<p>That piece of code is and adaptation from Instapaper’s ‘Read Later’ bookmarklet: <a href="http://www.instapaper.com/extras">http://www.instapaper.com/extras</a></p>
<p>Now simply disable/re-enable the Readability plugin, open (or reload if already open) the page you wish to ‘read later’ and hit (shift + `) keys. If you are logged in with Instapaper, you should see the Saved! popup on the top left. Else, you will be prompted to login and then Instapaper saves your bookmark, returning you to the page you were on.</p>
<p>Neat!</p>
Indian Almanac BookmarkletSai Charanme@saicharan.inhttp://www.saicharan.in2011-08-08T00:00:00-07:00https://www.saicharan.in/blog/2011/08/08/indian-almanac-bookmarklet<p>Traditional events require fairly strict observances throughout the year. For this, I tend to rely on the online service: <a href="http://mypanchang.com" target="_blank">http://mypanchang.com</a>. Though I bookmarked the page, it is error prone in that you will be always be shown the date that you bookmarked. Instead, it would be of immense help to view today’s almanac. So, here is my bookmarklet for showing today’s almanac for Los Angeles. You can edit it to show your city’s almanac by looking at the URL for your city from here: <a href="http://www.mypanchang.com/selectyourcity2011.html" target="_blank">http://www.mypanchang.com/selectyourcity2011.html</a></p>
<p>Bookmarklet: <a href="javascript: function panchangam(){var d = new Date(); var day=d.getDate(); var month=d.getMonth(); var year = d.getFullYear();location.href='http://www.mypanchang.com/phppanchang.php?'+'&yr='+year+'&cityhead=Los Angeles, CA&cityname=LosAngeles-CA'+'&monthtype=0&mn='+month+'#'+day};panchangam();"> LA South Indian Almanac </a></p>
<script type="text/javascript" src="http://gist-it.appspot.com/github/scharan/Goodies/raw/master/almanac.js"></script>
<!--pre class="brush: javascript">javascript: function panchangam(){var d = new Date(); var day=d.getDate(); var month=d.getMonth(); var year = d.getFullYear();location.href='http://www.mypanchang.com/phppanchang.php?'+'&yr='+year+'&cityhead=Los Angeles, CA&cityname=LosAngeles-CA'+'&monthtype=0&mn='+month+'#'+day};panchangam();</pre-->
Texnic Center and Adobe Reader XSai Charanme@saicharan.inhttp://www.saicharan.in2011-05-04T00:00:00-07:00https://www.saicharan.in/blog/2011/05/04/texnic-center-and-adobe-reader-x<p>After I upgraded to Adobe Reader X, Texnic center started throwing up an error:”[DocOpen(“%bm.pdf”)][FileOpen(“%bm.pdf”)] Cannot execute the command.”</p>
<p>Digging up a little on Adobe DDE, I found a solution here: <a href="http://forums.adobe.com/message/3301219#3301219">http://forums.adobe.com/message/3301219#3301219</a></p>
<p>Here is the fix:
Build > Define Output Profiles > Choose ‘LaTeX => PDF’ > Viewer tab. In three locations where ‘acroview’ is the value, change it to ‘acroviewR10’ and you are good to go!</p>
gContactSync bugSai Charanme@saicharan.inhttp://www.saicharan.in2011-04-12T00:00:00-07:00https://www.saicharan.in/blog/2011/04/12/gcontactsync-bug<p>Found a weird behavior with gContactSync 0.3.2 Thunderbird plugin- on both Windows and Linux (Fedora 14), the sync stops after 111 contacts. Poked around the internet and found that there were no documented bugs on this.</p>
<p>Decided to fix it for myself cos I found that it <em>really</em> syncs all the contact information to Thunderbird, including the photo.</p>
<p>gContactSync has a nice ‘verbose log’ feature for debugging information - but was not of much help since the log stopped after 111 contacts.</p>
<p>Next tool for me was the ‘Error Console’ in Thunderbird. Not surprisingly, I found an error on line 181 in content/GContact.js, that read “ ‘type’ not defined” :</p>
<p><pre class=”brush:”javascript>
181 type = type.substring(type.indexOf(“#”) + 1);
182 return new com.gContactSync.Property(arr[i].childNodes[0].nodeValue,
183 type);
</pre></p>
<p>Darn! Just as a test, I simply pre-pended ‘if(type)’ to line 181, resulting in:</p>
<p><pre class=”brush:”javascript>
181 if(type) type = type.substring(type.indexOf(“#”) + 1);
182 return new com.gContactSync.Property(arr[i].childNodes[0].nodeValue,
183 type);
</pre></p>
<p>It worked! Not really got a chance to investigate what happens/does not happen when ‘type’ is NOT defined, but things seem to work for now. I also submitted this here: <a href="http://www.pirules.org/extensions/submit_error.php">http://www.pirules.org/extensions/submit_error.php</a></p>
Mapping Win key in Fedora (14)Sai Charanme@saicharan.inhttp://www.saicharan.in2011-04-08T00:00:00-07:00https://www.saicharan.in/blog/2011/04/08/mapping-win-key-in-fedora-14<p>Learnt/inferred a few things here [correct me via comments if I am wrong conceptually; note that these have worked for me] -</p>
<ul>
<li>Win key is called/referred to as the 'super key'</li>
<li>You may have to get xmodmap to explicitly recognize the key.</li>
<li>You can get the keycode for any key using 'xev' command, as discussed here: <a href="http://forums.fedoraforum.org/showpost.php?s=9af5fdea1041e19ff96815fb3470f904&p=913923&postcount=9" target="_blank">http://forums.fedoraforum.org/showpost.php?s=9af5fdea1041e19ff96815fb3470f904&p=913923&postcount=9</a></li>
<li>Once you find out the keycode for you Win key, you can get xmodmap to 'recognize' it as noted in <a href="http://forums.fedoraforum.org/showpost.php?s=9af5fdea1041e19ff96815fb3470f904&p=913308&postcount=3" target="_blank">http://forums.fedoraforum.org/showpost.php?s=9af5fdea1041e19ff96815fb3470f904&p=913308&postcount=3</a></li>
<li>Then, configure Win+key combinations via System > Preferences > Keyboard Shortcuts.</li>
</ul>
SaveURI Updated for Firefox 4Sai Charanme@saicharan.inhttp://www.saicharan.in2011-03-31T00:00:00-07:00https://www.saicharan.in/blog/2011/03/31/saveuri-updated-for-firefox-4<p>Made some time to update the firefox extension at <a href="https://addons.mozilla.org/en-US/firefox/addon/saveuri/">https://addons.mozilla.org/en-US/firefox/addon/saveuri/</a></p>
<p>It was a more than a minor compatibility break. I have submitted the new version for review. But for those of you wish to test it for me, here is a link: <a href="http://saicharan.in/beta/saveuri/saveuri-0.3.3-fx.xpi">http://saicharan.in/beta/saveuri/saveuri-0.3.3-fx.xpi</a></p>
<p>Warning: This has not yet been approved by a Mozilla reviewer - for testing only!</p>
<p>Instructions: If your Firefox browser saves the file rather than install it, simply drag and drop the file to the browser window and restart your browser!</p>
<p><strong>Update: </strong>The extension has been approved and is now available at <a href="https://addons.mozilla.org/en-US/firefox/addon/saveuri/">https://addons.mozilla.org/en-US/firefox/addon/saveuri/</a> Thanks everyone for the geek-joy!</p>
while(*a++ == *b++)Sai Charanme@saicharan.inhttp://www.saicharan.in2010-05-11T00:00:00-07:00https://www.saicharan.in/blog/2010/05/11/whilea-b<p>Among the most elegant implementations is the string copy function (assuming you have allocated enough memory in the dest buffer):</p>
<pre class="brush: cpp">//Assuming for elegance you don't have to return the number of bytes copied.
void strcpy(char* src, char* dest){
while(*dest++ = *src++);
}</pre>
<p><br /></p>
<p>But I have often wondered what happens at the assembler such *s gets you only a single byte/character. So here is a simple program that explores this - but in string compare:</p>
<pre class="brush: cpp">int main(){
char *a="String One", *b="String Two";
while(*a++==*b++);
return 0;
}</pre>
<p><br /></p>
<p>I compiled this with ‘gcc -S’ option and got the following assembly code:</p>
<pre class="brush: plain linenums">
.file "testpointer.c"
.def ___main; .scl 2; .type 32; .endef
.section .rdata,"dr"
LC0:
.ascii "a\0"
LC1:
.ascii "b\0"
.text
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
subl $16, %esp
call ___main
movl $LC0, 8(%esp)
movl $LC1, 12(%esp)
L2:
movl 8(%esp), %eax
movb (%eax), %dl
movl 12(%esp), %eax
movb (%eax), %al
cmpb %al, %dl
sete %al
incl 8(%esp)
incl 12(%esp)
testb %al, %al
jne L2
movl $0, %eax
leave
ret</pre>
<p><br /></p>
<p>Line 24: “cmpb %al, %dl” says it all. compare <strong>Lower</strong> <strong>Byte</strong> of register ‘a’ and register ‘d’. Now I can be in peace ;)</p>
<p><br />
<br />
References:
<br /></p>
<ol>
<li><a href="http://www.codeguru.com/cpp/cpp/cpp_mfc/tutorials/article.php/c9415">http://www.codeguru.com/cpp/cpp/cpp_mfc/tutorials/article.php/c9415</a></li>
</ol>
<p><br /></p>
<ol>
<li><a href="http://www3.itu.edu.tr/~kesgin/mul06/intel/instr/sete_setz.html">http://www3.itu.edu.tr/~kesgin/mul06/intel/instr/sete_setz.html</a></li>
</ol>
<p><br /></p>
<ol>
<li><a href="http://homepage.mac.com/randyhyde/webster.cs.ucr.edu/www.artofasm.com/DOS/ch09/CH09-6.html#HEADING6-83">http://homepage.mac.com/randyhyde/webster.cs.ucr.edu/www.artofasm.com/DOS/ch09/CH09-6.html#HEADING6-83</a></li>
</ol>
Efficient Substr implementationSai Charanme@saicharan.inhttp://www.saicharan.in2010-05-10T00:00:00-07:00https://www.saicharan.in/blog/2010/05/10/efficient-substr-implementation<p>I came up with this implementation of substring method. Anyone got ideas to make it more terse <em>and</em> more efficient?</p>
<pre class="brush: cpp">bool substring(const char* str, const char* substr){
const char *currentString = str, *backTrackString = str, *currSubstr = substr;
while( strlen(backTrackString) >= strlen(substr) ){
while( *currSubstr && *currentString++ == *currSubstr++);
if( !*currSubstr ) return true;
currentString = backTrackString++;
currSubstr = substr;
}
return false;
}</pre>
<p><br /></p>
<p>In particular, can we do without atleast one of the local variables - while still being as efficient or better? A more basic question - so you think this is efficient?</p>
Binary Search TreeSai Charanme@saicharan.inhttp://www.saicharan.in2010-05-10T00:00:00-07:00https://www.saicharan.in/blog/2010/05/10/binary-search-tree<p>The following code tests if the input binary tree is, in fact, a Binary Search Tree. This was as terse as I could get it. Any got more terse code? Suggestions/comments welcome.</p>
<pre class="brush: cpp linenums">bool IsBST(TreeNode* node){
if( !node ) return true;// trivially true.
if( node->left )
if( node->left->val > node->val ) return false; //fail early
if( node->right )
if( node->right->val < node->val ) return false; //fail early
return ( IsBST(node->left) && IsBST(node->right) ); //recursively test subtrees
}</pre>
<p><br />
Update: <span style="text-decoration: line-through;"> Notice the tail recursion? Its super-efficient!</span>
<br />
Update-update: Thanks to Kartik (see comments below) for pointing out that the last line is NOT tail-recursive.
<br />
Yet another update: The algorithm is does NOT check for IsBST(). The criterion of root being greater than all right children and smaller than left children is not always checked. See <a href="http://en.wikipedia.org/wiki/Binary_search_tree">http://en.wikipedia.org/wiki/Binary_search_tree</a> for more details.</p>
With Great Power Comes Great ResponsibilitySai Charanme@saicharan.inhttp://www.saicharan.in2010-05-07T00:00:00-07:00https://www.saicharan.in/blog/2010/05/07/with-great-power-comes-great-responsibility<p>I was working on a remote FreeBSD system and issued a sudo command. I really liked what the ‘preamble’ to the ‘password:’ prompt was - <br /> <br /></p>
<pre><code>We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
Password:
</code></pre>
<p><br />
<br /></p>
<p>With great power comes great responsibility - and my mind instantly went to this story: <a href="http://www.justpasha.org/folk/rm.html">http://www.justpasha.org/folk/rm.html</a>
<br />
<br />
Hail Unix!</p>
JS e-mail ValidatorSai Charanme@saicharan.inhttp://www.saicharan.in2009-11-19T00:00:00-08:00https://www.saicharan.in/blog/2009/11/19/js-e-mail-validator<p>NOTE: I have avoided character classes to aid understanding for newbies. Wizards, bear with the verbosity!</p>
<p>Came up with this nice little email validator JS regexp. Someone got something shorter?</p>
<pre class="brush: javascript">function validateEmail( email ){
var emailRe = new RegExp("^[a-zA-Z]+([a-zA-Z0-9_]*.[a-zA-Z0-9_]+)*@([a-zA-Z0-9_]+.[a-zA-Z0-9_]+)*$",'i');
return( emailRe.test( email ) );
}</pre>
<p>Does this miss any cases? Try it out here: <input id="email" type="text" value="Email" /> <button onclick="validateEmail( getElementById('email').value );return false;"> Validate email! </button></p>
<script type="text/javascript">
function validateEmail( email ){ var emailRe = new RegExp("^[a-zA-Z]+([a-zA-Z0-9_.][a-zA-Z0-9_]+)+@([a-zA-Z0-9]+([.a-zA-Z0-9_])+)$",'i'); alert( emailRe.test( email ) ? "Valid" : "Invalid email" ); }
</script>
<p><strong>Update: </strong>This script allowed ‘*’ in the email ID. The correct re would be: <pre class="brush: javascript">var emailRe = new RegExp(“^[a-zA-Z]+([a-zA-Z0-9<em>].[a-zA-Z0-9</em>]+)+@([a-zA-Z0-9<em>]+.[a-zA-Z0-9</em>]+)+$”,’i’);</pre></p>
<p><strong>Bug again!</strong> The ‘.’ character outside the character class [] matches <em>ANY</em> single character. This, however, definitely works! <pre class="brush: javascript">var emailRe = new RegExp(“^[a-zA-Z]+([a-zA-Z0-9<em>.][a-zA-Z0-9</em>]+)+@([a-zA-Z0-9]+([.a-zA-Z0-9_])+)$”.’i’);</pre>
The test code now does not permit ‘*’ in the email ID.</p>
Interesting recursion problemSai Charanme@saicharan.inhttp://www.saicharan.in2009-11-12T00:00:00-08:00https://www.saicharan.in/blog/2009/11/12/interesting-recursion-problem<p>Found this interesting recursion problem on StackOverflow.
<a href="http://stackoverflow.com/questions/1705374/how-to-capture-a-string-into-variable-in-a-recursive-function">http://stackoverflow.com/questions/1705374/how-to-capture-a-string-into-variable-in-a-recursive-function</a></p>
<pre class="brush: cpp">int resultSize( vector< vector<string> > vector ){
int x=1;
for( int i=0; i<vector.size(); i++ )
x *= vector[i].size();
return x;
}
vector<string> enumAll(const vector< vector > allVecs ){
//__ASSERT( allVecs.size() > 0 );
vector result;
if( allVecs.size() == 1 ){
for( int i=0 ; i< allVecs[0].size(); i++){
result.push_back( allVecs[0][i] );
}
return result;
}
const vector< vector<string> > tempVector(allVecs.begin()+1, allVecs.end() );
vector tempResult = enumAll( tempVector );// recurse
int size = resultSize( tempVector );
for( int i=0; i<allVecs[0].size(); i++ ){
for( int j=0; j<size; j++){
//enumAll on each tempVector is called multiple times. Can be optimzed.
result.push_back( allVecs[0][i] + tempResult[j] );
}
}
}</pre>
<p>Also see the other solution by Young which solves this problem using tail-recursion.</p>
<p>It is interesting problem in itself to transform a plain recursion into tail-recursion. The general method to do this is to eliminate the need for any processing post recursion. For this, one needs to pass all the data as parameters. This is pretty obvious when comparing the two solutions. Plain recursion takes only one parameter, while tail-recursion takes a lot more parameters.</p>
<p>In my view, the advantage of plain recursion is pedagogy: it is very easy to follow the algorithm - the divide and conquer is so very obvious! With tail-recursion, we manually do a lot of book-keeping. This part is not so obvious in the present example.</p>
<p>Plain recursion:
<a href="http://stackoverflow.com/questions/1705374/how-to-capture-a-string-into-variable-in-a-recursive-function/1723192#1723192">http://stackoverflow.com/questions/1705374/how-to-capture-a-string-into-variable-in-a-recursive-function/1723192#1723192</a></p>
<p>Tail Recursion:
<a href="http://stackoverflow.com/questions/1705374/how-to-capture-a-string-into-variable-in-a-recursive-function/1707808#1707808">http://stackoverflow.com/questions/1705374/how-to-capture-a-string-into-variable-in-a-recursive-function/1707808#1707808
</a></p>
Stackoverflow Teacher BadgeSai Charanme@saicharan.inhttp://www.saicharan.in2009-11-11T00:00:00-08:00https://www.saicharan.in/blog/2009/11/11/stackoverflow-teacher-badge<p>Yay! Just got the stackoverflow teacher badge! Yay!</p>
<iframe src="http://stackoverflow.com/users/flair/162471.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="210" height="60"></iframe>
Metaprogramming is not magicSai Charanme@saicharan.inhttp://www.saicharan.in2009-11-03T00:00:00-08:00https://www.saicharan.in/blog/2009/11/03/metaprogramming-is-not-magic<p>I have always wondered why I like programming languages like Lisp etc. Sort of found an answer here:</p>
<blockquote>
<p>“Metaprogramming is not magic. It is simply another tool in the prepared programmer’s toolbox. It’s awfully nice when that tool is also part of the programming language we use. Otherwise, we are limited in what we can say conveniently in our programs by the somewhat arbitrary lines drawn between real and meta.”</p>
</blockquote>
<p>Source: <a href="http://www.cs.uni.edu/~wallingf/blog/archives/monthly/2009-11.html#e2009-11-02T18_59_40.htm">http://www.cs.uni.edu/~wallingf/blog/archives/monthly/2009-11.html#e2009-11-02T18_59_40.htm</a></p>
What I read, am reading and want to readSai Charanme@saicharan.inhttp://www.saicharan.in2009-10-12T00:00:00-07:00https://www.saicharan.in/blog/2009/10/12/what-i-readam-reading-and-want-to-read<p>This is a list for my reference. It will be a “live” post and act as my SPOC for reading.</p>
<p>In progress:</p>
<ul>
<li>Beautiful Code</li>
<li>Code Complete 2</li>
<li>The Pragmatic programmer</li>
<li>Structure and Interpretation of Computer programs</li>
</ul>
<p>Done:</p>
<ul>
<li>The Lost Symbol</li>
<li>The mythical man-month</li>
<li>Joel on Software</li>
<li>More Joel on Software</li>
<li>make (O’Rielly)</li>
</ul>
<p>Wishlist:</p>
<ul>
<li>Coders at work by Peter Siebel</li>
<li>The Innovator’s Dilemma</li>
<li>Elements of Style</li>
<li>Godel, Escher & Bach</li>
<li>The story of Civilization by Will & Durant</li>
<li>Paradigms Of Artificial Intelligence Programming by Peter Norvig</li>
<li>The design of everyday things</li>
<li>Founders at work</li>
<li>The Brothers Karamazov</li>
</ul>
Why hitting 'reload' speeds up page renderingSai Charanme@saicharan.inhttp://www.saicharan.in2009-08-17T00:00:00-07:00https://www.saicharan.in/blog/2009/08/17/why-hitting-reload<p>This is a response to David Pogues’ tweet question: <a href="http://twitter.com/Pogue/status/3332520918" target="_blank">http://twitter.com/Pogue/status/3332520918 </a></p>
<p>The ‘rendering’ or ‘drawing-model’ of a browser is based on HTML. Each visual in HTML element is defined by a HTML ‘tag’. For browsers to display/render the page, they need some a certain amount of HTML tags to be available. So when you are faced with a blank page, it means that the browser is waiting for the HTML.</p>
<p>Now, when you hit the reload button, remember that a part of the page has already been downloaded to the browser. Instead of discarding this info, the browser merely spits it out onto the window (thus displaying the page partially) and requests for the page once again. Now that a part of the page is already displayed (even if only partially), the user believes that the page has rendered rather quickly.</p>
<p>If you hit the stop button, however, you will be stuck with a blank page. By hitting stop, you are telling the browser ‘dont bother to try and render this page’. By hitting reload, you are still showing interest. Another way to observe progressive rendering is while the page is loading ( the browser shows a blank or a partially rendred page), go to File > Work Offline (in Firefox). You will see the page quickly render the partial page that was succuessfully downloaded. It is a sort of ‘best-effort’ service.</p>
<p><strong>Related concept: </strong>Progressive rendering. Jeff Atwood’s take on the ‘Lost Art of Progressive Rendering’: <a href="http://www.codinghorror.com/blog/archives/000444.html">http://www.codinghorror.com/blog/archives/000444.html</a></p>
<p>This means that browsers don’t need to really download the entire page before it can be displayed to the user. But, this depends on how the page has been desinged: <a href="http://www.vbulletin.org/forum/showthread.php?t=161099 " target="_blank">http://www.vbulletin.org/forum/showthread.php?t=161099</a>.</p>
Deleting filesSai Charanme@saicharan.inhttp://www.saicharan.in2009-08-06T00:00:00-07:00https://www.saicharan.in/blog/2009/08/06/deleting-files<p>In my quest for speeding up automated, no-questions asked deletion of the corrupt dev SDKs (which go upto 25 GB), I discovered this:
> rmdir /S /Q .</p>
<p>I even timed it this time: about an hour to delete a 25 GB SDK. And no questions asked. The above command does not write any output to the console! While this can be quite disconcerting initially, it does save a lot of computation time and resources ( I/O is the most expensive operation, remember? ).</p>
<p>Earlier on, I used to use <code class="language-plaintext highlighter-rouge">> del /s /f /q *. </code>. But that used to delete only the files and not the directories. Deleting the directories manually was another pain. Also, this command had the habit of “informing the user” of what it is deleting – and would take about 3 to 4 hours!</p>
<p>Do let me know if you find some faster way to delete the SDK!!</p>
HN Submit buttonSai Charanme@saicharan.inhttp://www.saicharan.in2009-07-12T00:00:00-07:00https://www.saicharan.in/blog/2009/07/12/hn-submit-button<p>I have been attempting to add “share” functionality to my website. Initially, I used the Digg button (<a href="http://digg.com/tools/integrate" target="_blank">http://digg.com/tools/integrate</a>) and Reddit button (<a href="http://www.reddit.com/button" target="_blank">http://www.reddit.com/button</a>).</p>
<p>Next I wanted to add <a title="Hacker News" href="http://news.ycombinator.com/news" target="_blank">Hacker News</a> button. But there was none. But then again, there was this bookmarklet (<a href="http://ycombinator.com/bookmarklet.html" target="_blank">http://ycombinator.com/bookmarklet.html</a>). So I created the required HTML to get the required functionality, just using the bookmarklet:</p>
<pre class="brush: html"><a href="javascript:window.location=%22http://news.ycombinator.com/submitlink?u=%22+encodeURIComponent(document.location)+%22&t=%22+encodeURIComponent(document.title)"> Submit </a></pre>
<p>Then I thought of making a Hacker News submit button, just like Reddit and Digg. So I decided to read the sources and build the HN button based on that. Man, Digg’s JS was such mess (yes, it was the minified version, but still, far too many lines of code). Reddit’s was a great deal simpler, easy-to-read and intuitive. Check them out: <a href="http://digg.com/tools/diggthis.js" target="_blank">http://digg.com/tools/diggthis.js</a> and <a href="http://www.reddit.com/button.js" target="_blank">http://www.reddit.com/button.js.</a></p>
<p>So I modelled the HN button based on Reddits’ Javascript. Here it is: <a href="http://saicharan.in/work/hn.js" target="_blank">http://saicharan.in/work/hn.js</a> OR <a href="https://github.com/scharan/Goodies/blob/master/hn.js" target="_blank">https://github.com/scharan/Goodies/blob/master/hn.js</a></p>
<p>To use it, simply include the following line:</p>
<pre class="brush:html"><script type="text/javascript" src="http://saicharan.in/work/hn.js"></script></pre>
<p>Here is the code:
<script type="text/javascript" src="http://gist-it.appspot.com/github/scharan/Goodies/raw/master/hn.js"></script></p>
<p><strong>Update:</strong> This article briefly made it to the front page of HN! I saw it at #19!. Here are the comments from HN: <a title="HN Button << Comments from HN" href="http://news.ycombinator.com/item?id=700053" target="_blank">http://news.ycombinator.com/item?id=700053</a></p>
GMail: Automatic Message TranslationSai Charanme@saicharan.inhttp://www.saicharan.in2009-07-12T00:00:00-07:00https://www.saicharan.in/blog/2009/07/12/gmail-autmatic-message-translation<p>This morning GMail surprised me yet again. Opening an email, I saw a new functional bar: Translate this message: From:<Language> To:<Language>.</p>
<p>I tried out the machine translation from English to Hindi. It was amazing. Took under 2 second (yes, to send the request to the servers, do the translation and to render the translated text on the browser window).</p>
<p>There was also that pretty helpful (right-)side bar: “Translate this conversation”.
Pretty neat translation. And very seamless user experience too! Man I am blown away.</p>
Redirecting blogger trafficSai Charanme@saicharan.inhttp://www.saicharan.in2009-07-06T00:00:00-07:00https://www.saicharan.in/blog/2009/07/06/redirecting-blogger-traffic<p>Having moved to my own domain, I was monitoring traffic to my site on Google Webmasters site. I notices that Google still returned results from my blogger-hosted domain. I wanted people to be redirected to my new domain.</p>
<p>Here is what I did:</p>
<ul>
<li> Blogger > Settings > Publishing > Advanced Settings. Chose to redirect to my sub-domain blog.saicharan.in</li>
<li>In my domain management cpanel > Subdomains, created blog.saicharan.in and added the home directory as my blog directory.</li>
<li>Using the wordpress admin interface, I changed the structure of my blog permalinks to be of blog/year/month/date/title.</li>
</ul>
<p>Now come the interesting part. While wordpress provided me text to add in my .htaccess, it did not provide the code for redirection. Google helped me add the following line in my .htaccess file that did the trick!</p>
<p><code> RedirectMatch permanent ^/[0-9]{4}/[0-9]{2}/([a-z0-9]+) http://saicharan.in/blog/$1 </code></p>
<p>That did the trick. Thanks to BlogBloke!</p>
<p>References:
<a href="http://www.blogbloke.com/migrating-redirecting-blogger-wordpress-htaccess-apache-best-method/" target="_blank">http://www.blogbloke.com/migrating-redirecting-blogger-wordpress-htaccess-apache-best-method/</a></p>
Default runlevel on UbuntuSai Charanme@saicharan.inhttp://www.saicharan.in2009-07-01T00:00:00-07:00https://www.saicharan.in/blog/2009/07/01/default-runlevel-on-ubuntu<p>Changing the default runlevel on ubuntu was quite different from that of RedHat/Fedora. Ubuntu has no <code class="language-plaintext highlighter-rouge">inittab</code>. Instead, I had to rename the <code class="language-plaintext highlighter-rouge">S30gdm*</code> and <code class="language-plaintext highlighter-rouge">S30kdm*</code> files in <code class="language-plaintext highlighter-rouge">/etc/rc2.d/</code> to <code class="language-plaintext highlighter-rouge">KS30gdm*</code> and <code class="language-plaintext highlighter-rouge">KS30kdm*</code> (the renaming is just like in fedora).</p>
.bash_profile in ubuntuSai Charanme@saicharan.inhttp://www.saicharan.in2009-07-01T00:00:00-07:00https://www.saicharan.in/blog/2009/07/01/bash_profile-in-ubuntu<p>I updated my <code class="language-plaintext highlighter-rouge">.bash_profile</code> in my ubuntu instance but the changes were not getting reflected in my shell.</p>
<p>A bit of searching revealed that I have to instead add a new <code class="language-plaintext highlighter-rouge">.sh</code> file in <code class="language-plaintext highlighter-rouge">/etc/profile.d/</code> that contained the necessary aliases and updates to my <code class="language-plaintext highlighter-rouge">PATH</code> etc. It appears like Ubuntu auto runs all <code class="language-plaintext highlighter-rouge">.sh</code> files in <code class="language-plaintext highlighter-rouge">/etc/profile.d/</code> whenever a login session is created.</p>
<p><code class="language-plaintext highlighter-rouge">.bash_profile</code> was a lot more personal customization. Wonder how I could this personal customization in ubuntu. Any one any ideas? Let us know via comments.</p>
<p>@update: Thanks to manoj for pointing out <code class="language-plaintext highlighter-rouge">.bashrc</code> (had forgotton about it). <code class="language-plaintext highlighter-rouge">.bashrc</code> does help with personalizing the environment.</p>
Ubuntu sshdSai Charanme@saicharan.inhttp://www.saicharan.in2009-06-30T00:00:00-07:00https://www.saicharan.in/blog/2009/06/30/ubuntu-sshd<p><code>#sudo apt-get install openssh-server</code></p>
<p>Done! Simple as that.</p>
<p>Ref: <a href="http://www.cyberciti.biz/tips/howot-install-ubuntu-linux-ssh-server.html" target="_blank">http://www.cyberciti.biz/tips/howot-install-ubuntu-linux-ssh-server.html</a></p>
ld terminated with signal 9Sai Charanme@saicharan.inhttp://www.saicharan.in2009-06-30T00:00:00-07:00https://www.saicharan.in/blog/2009/06/30/ld-terminated-with-signal-9<p>Been trying to build substantial amout of code on linux vmware image. Three times the build has failed with <em>“ld terminated with signal 9”</em>. A simple google revlealed that I might have run out of swap space!</p>
<p>So I run <code class="language-plaintext highlighter-rouge">sudo swaon -s</code> and get nothing at all!</p>
<p>Then a google for “<strong>turning on swap space”</strong> got me to do the following:</p>
<p><code class="language-plaintext highlighter-rouge"># sudo dd if=/dev/zero of=/moreswap bs=1M count=512</code>: that creates a 512 MB file named moreswap filled with zeros.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># sudo mkswap /moreswap
# sudo swapon /moreswap
</code></pre></div></div>
<p>Appended the following line to <code class="language-plaintext highlighter-rouge">/etc/fstab</code> to make this change permanent.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/moreswap none swap sw 0 0
</code></pre></div></div>
<p>Worked like a charm!</p>
<p>Ref: <a href="http://www.linux.com/archive/feature/113956" target="_blank">http://www.linux.com/archive/feature/113956</a></p>
Hello WordPress! My new home online!Sai Charanme@saicharan.inhttp://www.saicharan.in2009-06-19T00:00:00-07:00https://www.saicharan.in/blog/2009/06/19/hello-world<p>Migrated to Wordpress. In about 5 seconds. Yup. I am as impressed with the 5-second install as I am with this import feature.</p>
<p>The Dashboard > Tools > Import > Blogger option is fantastic. Once with WordPress, I guess I will stay with it for a real long time!</p>
<p>Three cheers to WordPress :)</p>
CVS, ViewVC integration with Google PrettifySai Charanme@saicharan.inhttp://www.saicharan.in2009-03-19T00:00:00-07:00https://www.saicharan.in/blog/2009/03/19/cvs-viewvc-integration-with-google-prettify<p>Been wanting to do this for long: browse SVN/CVS via a web interface. Ofcourse, it is a solved problem. But I wanted this set up for my own local CVS repos.</p>
<p>ViewVC to the rescue.</p>
<p>Prerequisites: Python2.x, Apache2.0+, CVS, CVS/SVN Python Bindings.</p>
<p>Detailed installation process:</p>
<ul>
<li>
<p>ViewVC:</p>
<p>I have CVSNT on my workstation. So I downloaded ViewVC-1.0.7 from <a href="http://www.viewvc.org/download.html">http://www.viewvc.org/download.html</a> (spcecifically, version 1.0.7 from<a href="http://viewvc.tigris.org/servlets/ProjectDocumentList?folderID=6004"> http://viewvc.tigris.org/servlets/ProjectDocumentList?folderID=6004</a>).</p>
<p>To install ViewVC, first unpack it to some folder, run ‘python viewvc-install’ from the command line, with the current directory as the unpacked directory. I chose all the defaults values when prompted.</p>
<p>Next, I configured viewvc to pick up my repositories by editing the <install-dir>/viewvc.conf file. I changed the cvs_roots and cvsnt_exe_path variables.</install-dir></p>
</li>
<li>
<p>SVN Python bindings for ViewVC:
ViewVC is written in python and <a href="http://www.blogger.com/tigris.org">tigris.org</a> provides python bindings to talk to the CVS/SVN repository. This can be got from <a href="http://subversion.tigris.org/getting.html#windows%20http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100">subversion.tigris.org Documents Area.</a> Be sure to download the version appropirate for your version of python. Simply run the installer. You will be asked to point the installer to the Apache installation directory.</p>
</li>
<li>
<p>mod_python:</p>
<p>You will need to download the mod_python for Apache if you dont have it already. You can check the <apache-install-dir>/modules/ directory. Look for mod_python.so file. If it is not here, download it from here: <a href="http://www.apache.org/dist/httpd/modpython/win/3.3.1/">http://www.apache.org/dist/httpd/modpython/win/3.3.1/</a> I used this: <a href="http://www.apache.org/dist/httpd/modpython/win/3.3.1/mod_python-3.3.1.win32-py2.5-Apache2.2.exe">http://www.apache.org/dist/httpd/modpython/win/3.3.1/mod_python-3.3.1.win32-py2.5-Apache2.2.exe</a></apache-install-dir></p>
</li>
<li>
<p>Configuring Apache: edit the httpd.conf file to add the following:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>LoadModule python_module modules/mod_python.so
ScriptAlias /viewcvs "C:/Program Files/viewvc-1.0.7/bin/mod_python/viewvc.py"
<location>
AddHandler python-program .py
PythonPath "[r'c:\\Program Files\\viewvc-1.0.7\\bin\\mod_python']+sys.path"
PythonHandler apache
PythonDebug On
AddDefaultCharset UTF-8
</location>
</code></pre></div> </div>
<p>NOTE: The above will work if you have chosen the defaults while installing ViewVC.</p>
</li>
</ul>
<p>Done! Goto: http://your-machine/viewcvs.</p>
<p>However, I got an error when I did this: “ImportError: No module named apache”.</p>
<p>So, I tried the alternate approach:</p>
<ul>
<li>Copy <viewvc-install-dir>/bin/cgi/*.cgi to <apache-install-dir>/cgi-bin/</li>
<li>
<p>Add the following line to the <apache-install-dir>/conf/httpd.conf file:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ScriptAlias /viewvc /cgi-bin/viewvc.cgi
</code></pre></div> </div>
</li>
<li>Restart Apache.</li>
</ul>
<p>Done! Go to: http://localhost/cgi-bin/viewvc.cgi</p>
<p>It works for me!! I wish I could fix the other method too.</p>
<p>Good. Now that it works, I should be happy. But I was not :( When I ‘view’ a source file, it does not do the syntax highlighting (I use CVS with C++/C projects and I was not getting the syntax highlighting for these languages). So what do I do? Wanted to integrate some open source syntax highlighters. I dug thru’ the code of viewvc.py and from there went on to find the place where the markup is done. (search the code base for view_markup function. I use <a href="http://sourcenav.sourceforge.net/download.html">RedHat sourcenavigator</a> to browse and read code). They seemed to be using some PHP code to get the job done. However, I remembered I was very happy with Google’s Prettify (any code you browse on code.google.com has probably used Google prettify to syntax highlight the code). So I decided to use it.</p>
<p>Also, using the Google Pettify is quite simple:</p>
<ul>
<li>
<p>Add the following lines to the “head” section:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code><link href="[docroot]/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="[docroot]/prettify/prettify.js"></script>;
</code></pre></div> </div>
</li>
<li>Add <code class="language-plaintext highlighter-rouge">onload=prettyPrint()</code> attribute to the <code class="language-plaintext highlighter-rouge"><body></code> tag.</li>
<li>Put your code in <code class="language-plaintext highlighter-rouge"><pre class="prettyprint"></code> or <code class="language-plaintext highlighter-rouge"><code class="prettyprint"></code> tags.</li>
<li>Done!</li>
</ul>
<p>It took quite some reading of the ViewVC python code to figure out simple ways to do it. Here is my story:</p>
<p>I read thru the ViewVC python code and found that there was a header and footer being used for each page. Then there was a template for markup and each of the different views that ViweVC supports. Then I stumbled upon the EZT class (EaZyTemplates). Just what I needed to integrate with Google Prettify!! So I found the templates being loaded by ViewVC. They are loacated under <code class="language-plaintext highlighter-rouge"><viewvc-install-dir>/templates/</code>. Here are my modifications:</p>
<ul>
<li>Download Google Prettify from: [http://code.google.com/p/google-code-prettify/]</li>
<li>Unzip it. Copy the src folder to <code class="language-plaintext highlighter-rouge"><viewvc-install-dir>/templates/docroot/</code></li>
<li>I renamed the <code class="language-plaintext highlighter-rouge">src</code> folder to <code class="language-plaintext highlighter-rouge">prettify</code> (just to help me later)</li>
<li>
<p>Add the following lines to <code class="language-plaintext highlighter-rouge"><viewvc-install-dir>/templates/include/header.ezt</code>, in the <code class="language-plaintext highlighter-rouge">head</code> section:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code><link href="[docroot]/prettify/prettify.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="%5Bdocroot%5D/prettify/prettify.js"></script>
</code></pre></div> </div>
<p>Also, modify the body tag to: <code class="language-plaintext highlighter-rouge"><body onload="prettyPrint()"></code>;</p>
</li>
<li>
<p>Modify <code class="language-plaintext highlighter-rouge"><viewvc-install-dir>/templates/markup.ezt</code>. Change this:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code><div id="vc_markup"> <pre>[markup]</pre> </div>
</code></pre></div> </div>
<p>to:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code><div id="vc_markup"> <pre class="prettyprint">[markup]</pre> </div>
</code></pre></div> </div>
</li>
</ul>
<p>Done!. Have fun! And post your questions as comments.</p>
NS2 nam errorSai Charanme@saicharan.inhttp://www.saicharan.in2009-03-02T00:00:00-08:00https://www.saicharan.in/blog/2009/03/02/ns2-nam-error<p>I have been bothered by this error while running ns/nam for a long time now. Finally found that <code class="language-plaintext highlighter-rouge">tk</code> needed patching :( Here is the error that I got and the solution that helped me fix it. Error:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[root@localhost]# nam:
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox <mousewheel> {</mousewheel>
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
invoked from within
"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Listbox <mousewheel> {</mousewheel>
%W yview scroll [expr {- (%D)}] units
}
bind Li..."
</code></pre></div></div>
<p>And, I got the solution to this on: <a href="http://forums.fedoraforum.org/showthread.php?t=206795"> http://forums.fedoraforum.org/showthread.php?t=206795.</a></p>
<p>Essentially you need to patch tk8.4.18 with the patches from: <a href="http://bugs.gentoo.org/show_bug.cgi?id=225999">http://bugs.gentoo.org/show_bug.cgi?id=225999</a></p>
<p>Details of how to patch are available at: <a href="http://forums.fedoraforum.org/showpost.php?s=a2bb89875669ff26ed61cd371399a517&p=1131049&postcount=3">http://forums.fedoraforum.org/showpost.php?s=a2bb89875669ff26ed61cd371399a517&p=1131049&postcount=3</a></p>
Google default languageSai Charanme@saicharan.inhttp://www.saicharan.in2009-03-02T00:00:00-08:00https://www.saicharan.in/blog/2009/03/02/google-default-language<p>Each time I use Google from office, Google responds in Thai. I fixed that by going to <a href="www.google.com/ncr">www.google.com/ncr</a>.<br /><br />Now onwards, I hope to always get results in English :) Btw, if you happen to clear your cookies, you should go to <a href="www.google.com/ncr">www.google.com/ncr</a> again.<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div></p>
My Reading ListSai Charanme@saicharan.inhttp://www.saicharan.in2009-02-17T00:00:00-08:00https://www.saicharan.in/blog/2009/02/17/my-reading-list<p>Very frequently my friends ask for my reading list. So I decided to follow the <a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a> and <a href="http://en.wikipedia.org/wiki/Single_responsibility_principle">SRP</a> principles to help them and help myself. Hence this blog entry. Here goes:</p>
<p>My favourite tech blogs/sites:</p>
<p>Programming blogs:</p>
<ol>
<li><a href="http://codinghorror.com/">codinghorror.com</a></li>
<li><a href="http://blog.objectmentor.com/">blog.objectmentor.com</a> (this along with its original site at <a href="http://butunclebob.com/">butunclebob.com</a>)</li>
<li><a href="http://thedailywtf.com/">thedailywtf.com</a></li>
<li><a href="http://c2.com/">c2.com</a> –> Advanced stuff. Really interesting though. It takes some time to follow their style of expression - but is definitely worth a shot.</li>
<li><a href="http://www.reddit.com/">Reddit.com</a> In particular, <a href="http://www.reddit.com/r/programming/">http://www.reddit.com/r/programming/</a> & <a href="http://www.reddit.com/r/technology/">http://www.reddit.com/r/technology/</a></li>
</ol>
<p>Programming + Technology + Perspectives (my favourite pass-times):</p>
<ol>
<li><a title="Hacker News" href="http://news.ycombinator.com" target="_blank">news.ycombinator.com</a></li>
<li><a href="http://steve-yegge.blogspot.com/" target="_blank">steve-yegge.blogspot.com</a></li>
<li><a href="http://paulgraham.com/" target="_blank">paulgraham.com</a></li>
<li><a href="http://joelonsoftware.com/" target="_blank">joelonsoftware.com</a></li>
<li><a href="http://norvig.com/" target="_blank">norvig.com</a></li>
<li><a href="http://googleblog.blogspot.com/" target="_blank">googleblog.blogspot.com </a></li>
<li><a href="http://ted.com/" target="_blank">TED.com</a> - My personal favorite for advances in human thought and creativity!</li>
</ol>
<p>Tech News:</p>
<ol>
<li><a href="http://digg.com/">digg.com</a></li>
<li><a href="http://slashdot.org/">slashdot.org</a></li>
</ol>
<p>Management: ( Yeah, I am interested in <span style="font-style: italic;">Genuine</span> management! )</p>
<ol>
<li><a href="http://sethgodin.typepad.com/">sethgodin.typepad.com</a></li>
</ol>
<p>PS: I will update this post as my reading list changes (Yes. that includes additions <span style="font-weight: bold;">and</span><span style="font-style: italic; font-weight: bold;"> </span>deletions as well. For deletions, I will keep the links, but the text will be struck off like <del>this</del>).</p>
Creating DLLs with MinGWSai Charanme@saicharan.inhttp://www.saicharan.in2008-09-17T00:00:00-07:00https://www.saicharan.in/blog/2008/09/17/creating-dlls-with-mingw<p>This morning, I was asked how to use existing C code in C++ code. So I took the route of converting the C code into a DLL and then linking to it from the C++ code. So I had to figure out how to do this using MinGW on Windows. Here is an account of my experiments (distilled ofcourse!):<br />There are three things you need to do:<br />1. Convert the existing into a DLL.<br />2. Include the header of the DLL in the sources where you wish to use the library.<br />3. Build your code, linking against your DLL.<br /><br />Here are the steps:<br />a) For this, you need to add the following code to the header file containing the declarations of the functions that are to be used:<br /><br />#ifdef __cplusplus<br />#define cppfudge “C”<br />#else<br />#define cppfudge<br />#endif<br /><br />#ifdef BUILD_DLL<br />// the dll exports<br />#define EXPORT __declspec(dllexport)<br />#else<br />// the exe imports<br />#define EXPORT extern cppfudge __declspec(dllimport)<br />#endif<br /><br />b) Front of each function that you want to use from the DLL, prepend the word EXPORT. For example:<br />EXPORT int hello(void);<br /><br />c) Create the create the object code using the following command:<br />>gcc -c -DBUILD_DLL TestDLL.c, where TestDLL.c is the source file.<br /><br />d) Next, use the object code to create the DLL with the following command:<br />>gcc -shared -o TestDLL.dll TestDLL.o -Wl,–out-implib,TestDLL.a, Note that TestDLL has to be replaced with whatever is the actual DLL name.<br />>Creating library file: TestDLL.a (This is the output of the command)<br /><br />e) Now, compile the actual file (note that this file should include the TestDLL.h header)<br />>gcc Main.cpp -o Main.exe TestDLL.dll<br /><br />f) Done! Run the executable:<br />>Main.exe<br />Hello World!<br /><br />><br /><br /><a href="http://sites.google.com/site/scharan20/Home/DLL.zip?attredirects=0">Here </a>are the files that I have used to test these things. I have tested them on Windows XP using MinGW32. I have used the following link for reference: http://www.emmestech.com/moron_guides/moron2.html<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div></p>
Global C++ Exception HandlerSai Charanme@saicharan.inhttp://www.saicharan.in2008-07-29T00:00:00-07:00https://www.saicharan.in/blog/2008/07/29/global-c-exception-handler<p>Just found out that many C++ compilers provide the <code>std::set_terminate() </code>function for catching any unanticipated exceptions. Read here for more: <a href="http://www.extinguishedscholar.com/wpglob/?p=176">http://www.extinguishedscholar.com/wpglob/?p=176</a><div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div></p>
C/C++ resources onlineSai Charanme@saicharan.inhttp://www.saicharan.in2008-06-11T00:00:00-07:00https://www.saicharan.in/blog/2008/06/11/cc-resources-online<p>The following is a continually updated list of my personal favorites for C/C++ reference:<br /><br />C:<br />C-FAQs: <a href="http://c-faq.com/index.html">http://c-faq.com/index.html</a><br />Overflows in C: <a href="http://www.fefe.de/intof.html">http://www.fefe.de/intof.html</a><br /><br />C++:<br />Stanford Library: <a href="http://cslibrary.stanford.edu/">http://cslibrary.stanford.edu</a><br />C++ Coding Conventions(CERN): <a href="http://pst.web.cern.ch/PST/HandBookWorkBook/Handbook/Programming/CodingStandard/c++standard.pdf">http://pst.web.cern.ch/PST/HandBookWorkBook/Handbook/Programming/CodingStandard/c++standard.pdf</a><br />C++ Casting: <a href="http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/BitOp/cast.html">http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/BitOp/cast.html</a> & <a href="http://www.nacs.uci.edu/dcslib/sun/compilers/c-plusplus/c%2B%2B_ug/Cast.new.doc.html">http://www.nacs.uci.edu/dcslib/sun/compilers/c-plusplus/c%2B%2B_ug/Cast.new.doc.html</a><div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div></p>
Wrong Characters being DisplayedSai Charanme@saicharan.inhttp://www.saicharan.in2008-06-10T00:00:00-07:00https://www.saicharan.in/blog/2008/06/10/wrong-characters-being-displayed<p>Had this problem with my keyboard layout getting changed just too often. The problem was as follows: Off and on, my keyboard was behaving erratically. It would mis-behave and then come back to normal. I suspected a change of keyboard layout - I had this problem earlier on my Linux Box and RI pointed out that my keyboard layout was UK English!<br /><br />So, I too started off searching google for this, and things were mostly pointing to IME/Languages. When I opened the Regional Language Options in the Control Panel, the language bar popped up. I noticed that the language was set to Finnsh. Once I changed that to English, another icon appeared next to it - the Keyboard icon. It was in Finnish. So I changed it to English and all was well. But then I was wondering how these settings were changing so often. SO I went to the Regional Language Options in the Control Panel. Went to the languages tab and clicked on the Details button. From there, I selected the Finnish Language and Keyboard settings. At the bottom there is a Key Settings button. That was the major culprit. Click that button and you will see that Alt+Shift is assigned to “Switch between input Languages” option. I simply removed that key-binding to avoid un-intended switching between languages.<br /><br />Also, I use the alt+shift combo often in my work - so that was the probem! Now we know! So change your keyboard settings and get back to efficient mode.<br /><br />One last advice. If you ever face such a problem, make the language bar visible: Control Panel > Regional Language Options > Details > Language Bar Button > Show Language Bar. Once you see the language bar, you can know at once if your keyboard layout is the problem.<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div></p>
ThinkPad T60 TouchPad Scroll in Office 2007Sai Charanme@saicharan.inhttp://www.saicharan.in2008-06-10T00:00:00-07:00https://www.saicharan.in/blog/2008/06/10/thinkpad-t60-touchpad-scroll-in-office-2007<p>Found this link on Google. It was reported as on the day of posting as a possibly problematic site. But I went on and found the info in that site very useful. So here is the link:<br /><a href="http://www.lvlolvlo.net/2007/02/11/office-2007-on-a-thinkpad-ultranav-support-for-scrolling-fix/">http://www.lvlolvlo.net/2007/02/11/office-2007-on-a-thinkpad-ultranav-support-for-scrolling-fix/</a><div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div></p>
VirusRemoval.vbs Windows Script HostSai Charanme@saicharan.inhttp://www.saicharan.in2008-03-27T00:00:00-07:00https://www.saicharan.in/blog/2008/03/27/virusremoval-vbs-windows-script-host<p>Atlast! Got rid of that damn warning.<br /><br />msconfig did not show up this thing. No amount of standard registry scans helped me find this. I looked at the standard Run, RunOnce & Shell hives under HKLM/Software/Microsoft/Windows/CurrentVersion/. Just no use. No entries that were tell-tale traces of this VirusRemoval.vbs.<br /><br />But done at last! Took some patient Google-searching though. Some kind soul had provided the entire code of the VirusRemoval.vbs script file at:<br /><a href="http://www.thinkdigit.com/forum/showthread.php?t=71097">http://www.thinkdigit.com/forum/showthread.php?t=71097</a>. Looking at the code was enough to tell me where the virus had made entries in the registry.<br /><br /><br />Goto: HKLM/Software/Microsoft/WindowsNT/CurrentVersion/Winlogon. Under that, you will find a key called Userinit. Double click that key. A dialog box will open up with a string parameter. Edit that to remove just the offending entry. <span style="font-weight: bold;">Warning: </span>If you are not sure what the offending entry is, DONOT modify the key. Please post back the contents of the key here, and we could work out something!<br /><br />After cleaning up my registry, the value of Userinit for me is: C:\WINDOWS\system32\userinit.exe<br /><br />Good Luck!<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div></p>
Install RPMs on UbuntuSai Charanme@saicharan.inhttp://www.saicharan.in2008-03-19T00:00:00-07:00https://www.saicharan.in/blog/2008/03/19/install-rpms-on-ubuntu<p>Check this link. It describes the use of a tool called ‘alien’ to install RPMs on Ubuntu linux!<br /><br /><a href="http://theunixgeek.blogspot.com/2008/03/why-i-switched-back-to-ubuntu.html#c2746545558233032385">http://theunixgeek.blogspot.com/2008/03/why-i-switched-back-to-ubuntu.html#c2746545558233032385</a><div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div></p>
yum ntfs-3gSai Charanme@saicharan.inhttp://www.saicharan.in2008-02-16T00:00:00-08:00https://www.saicharan.in/blog/2008/02/16/yum-ntfs-3g<p>To install ntfs support for Fedora linux, use the following as root:</p>
<p>yum install fuse fuse-libs ntfs-3g</p>
<p>reference: http://www.mjmwired.net/resources/mjm-fedora-f7.html#ntfs</p>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>
Adobe Reader Commenting Not AllowedSai Charanme@saicharan.inhttp://www.saicharan.in2008-02-06T00:00:00-08:00https://www.saicharan.in/blog/2008/02/06/adobe-reader-commenting-not-allowed<p>At last!
Wanted to allow my prof. to be able to comment the pdf files that my LaTeX produces. But, even though I was NOT setting any such restrictions in LaTeX, the Adobe Reader always showed that Commenting was not allowed. After a Google search, I got this post in the Adobe Forums: http://www.adobeforums.com/webx/.3c05f5b1</p>
<p>In short: You cannot comment unless explicitly permitted. For this, you need to get to Adobe Acrobat (not the reader), and set the permission from: Commenting > Enable for Commenting in Adobe Reader.</p>
<p>Then you will be allowed to comment or markup :)</p>
<p>Update: If you don’t mind a few additions of Foxit, you might want to try Foxit reader(<span style="font-size: -1;"><span class="a">www.foxitsoftware.com</span></span>) for commenting your PDF documents without any of the above hassle.</p>
WIndows Script Host: Unable to open fileSai Charanme@saicharan.inhttp://www.saicharan.in2008-02-04T00:00:00-08:00https://www.saicharan.in/blog/2008/02/04/windows-script-host-unable-to-open-file<p>For quite some time a lot of my friends kept getting a windows script host error whenever they tried to open a drive. It says: Windows Script Error: Unable to find file: “….vbs”.</p>
<p>Spending some time on google led me to this site:
http://www.mydigitallife.info/2007/04/19/unable-to-open-hard-or-usb-flash-drive-with-windows-script-host-cannot-find-script-file-autorunvbs-error/</p>
<p>All we need to do is to either delete the autorun.inf file there or modify the content in to get rid of the offending startup file info. To delete the file:</p>
<p>del:\autorun.inf /f /s /q /a</p>
<p>To modify the file, first remove its hidden-file attribute: (see http://forums.techarena.in/showthread.php?t=717194)
<strong>attrib</strong> -s -h -r:\autorun.inf</p>
<p>Go ahead and edit this file now.</p>
TeXnicCenter and Adobe Reader 8.0Sai Charanme@saicharan.inhttp://www.saicharan.in2008-02-04T00:00:00-08:00https://www.saicharan.in/blog/2008/02/04/texniccenter-and-adobe-reader-8-0<p>I recently upgraded my Adobe Reader to version 8. The new interface is cool and all that, but I had an issue with using TeXnicCenter. Whenever I view a compiled document from TeXnicCenter, and then closed the Adobe reader or recompiled the file (causing adobe reader to close the document), the Adobe reader was crashing. A Google search yielded the following link which is very useful. It is almost a text-book type of solution which just works!</p>
<p>http://dikkie.net/2007/02/16/texniccenter-and-adobe-reader-80/</p>
Why is switch case better than if else if?Sai Charanme@saicharan.inhttp://www.saicharan.in2008-01-28T00:00:00-08:00https://www.saicharan.in/blog/2008/01/28/why-is-switch-case-better-than-if-else-if<p>Why is switch case better than else if? Or is it?
Here is some code I got into trouble with:
.
.
.
if(dim==0){
…//do lots of things
…return;
}
doSomeCommonThingsHere();
if(dim==3)
…doSomething3();
else if(dim==4)
…doSomething4();
else if(dim==5);
…doSomething5();
doSomeMoreCommonSomethings();
.
.
.
See anything?</p>
<p>I did not, initially. The semi colon after else if(dim==5). How I unearthed the bug? GDB was crashing. So no debugger to help me:( I figured out that only the dim==5 case was working well - and that none of the cases above it were working correctly. So I considered moving one of the earlier case code to the end to see if I can figure out the problem. While moving the code I accidentally noticed the semi-colon. Man! Computers are dumb - or was it me dumb?</p>
<p>Now did say switch case might have been better? Maybe. Because we are <span style="font-style: italic;">taught</span> to put the break; statement at the end of each case to prevent it from falling-through right? What if I forgot to put the break; ? I guess it is easier to “find” a missing break than a missing ;. Did you see the semi-colon after missing?</p>
<p>Now why did I use such a large number of if-else-if statements? I was using “Incremental development”. I did not see the other cases coming in hordes. Shortsighted you might say, but I did not even intend to do the other cases in the first place. WOW! How easily changing requirements can screw up such wonderfully working code. Screw the changing requirements. Now you see how difficult is the job of a designer - he has to really think of extensibility - see extensibility in a new light?</p>
<p>Consider for a moment the above code. I was actually telling the computer to do things wrong!!! When will these computers learn to understand (:D) Or will they ever?</p>
MinGW GProf with Eclipse 3.3 (Europa )Sai Charanme@saicharan.inhttp://www.saicharan.in2007-09-14T00:00:00-07:00https://www.saicharan.in/blog/2007/09/14/mingw-gprof-with-eclipse-3-3-europa<p>To use MinGW gprof with Eclipse, in the project settings, under complier, enable the gprof option. Further, in the Linker section, under command line, add -pg to your list. Build the program. Run the program and check that the gmon.out file has been created.</p>
<p>You can run gprof as follows:
gprof.exe.</p>
<p>You can run gprof from within eclipse by configuring the external tools:</p>
<ol>
<li>Open the external tools dialog</li>
<li>Double click on program to create a new program configuration</li>
<li>Give this profile a name, eg. gprof</li>
<li>In the location text box, give the FULL path to the grpof command</li>
<li>In the working directory, choose: ${workspace_loc:/path/to/executable}</li>
<li>Arguements: ${file_prompt} ${GMON}, where GMON has been assigned the path to the gmon.out file using the variables button.</li>
</ol>
<p>References:
1.<a href="http://publib.boulder.ibm.com/infocenter/systems/topic/com.ibm.aix.cmds/doc/aixcmds2/gprof.htm">http://publib.boulder.ibm.com/infocenter/systems/topic/com.ibm.aix.cmds/doc/aixcmds2/gprof.htm</a>
2.<a href="http://gcc.gnu.org/ml/fortran/2006-11/msg00217.html">http://gcc.gnu.org/ml/fortran/2006-11/msg00217.html</a></p>
ब्लोग्गीं, और हिंदी मे!Sai Charanme@saicharan.inhttp://www.saicharan.in2007-04-18T00:00:00-07:00https://www.saicharan.in/blog/2007/04/18/%e0%a4%ac%e0%a5%8d%e0%a4%b2%e0%a5%8b%e0%a4%97%e0%a5%8d%e0%a4%97%e0%a5%80%e0%a4%82-%e0%a4%94%e0%a4%b0-%e0%a4%b9%e0%a4%bf%e0%a4%82%e0%a4%a6%e0%a5%80-%e0%a4%ae%e0%a5%87<p>हेल्लो वर्ल्ड!
गूगल ki गूढ़ विल से हिंदी मे ब्लोग करना बहुत आसान हैं। इस फेतुरे के लिए शुक्रिया!!! लव यू गूगल! कीप उप थे गूढ़ वर्क!</p>
<p>Please excuse my rustic hindi…I was just experimenting :) If you are unable to read the Hindi correctly, then please read this article on enabling Indic fonts for various OSs: <a href="http://en.wikipedia.org/wiki/Wikipedia:Enabling_complex_text_support_for_Indic_scripts">http://en.wikipedia.org/wiki/Wikipedia:Enabling_complex_text_support_for_Indic_scripts</a></p>
Routing and Remote Access Service Fails!Sai Charanme@saicharan.inhttp://www.saicharan.in2007-01-27T00:00:00-08:00https://www.saicharan.in/blog/2007/01/27/routing-and-remote-access-service-fails<p>This afternoon, we were suddenly unable to browse the internet. Suspicious about the proxy server being down, I checkout from our main browsing computers. I was able to ping the students proxy.
A little more digging up led me to figure out that there was something wrong with our lab router that handles the internet traffic to the student’s proxy; the main browsing systems bypass the router.
I disabled the routing service and set it up again. Though the routing service itself did not throw up any error, the event log had logged the error message. I was unable to browse even from the router itself. Also, the IIS server on the router also failed.
I restarted the system thinking it might help - but to no avail!
Checking the event log revealed that the Routing and Remote Access service had thrown up an error - Unable to add the internal adapter to the routing service - incorrect parameter. Looking at the event log messages for a few hours earlier, I hit upon a message saying that a duplicate name had been detected on the network. I then realized that this was quite likely since our server had a name Dell1, which was quite possible to be duplicated over the network since there were a plethora of Dell machines springing up here. So I renamed our machine and restarted - Bingo! it was running like a good ol’ boy!
Lesson to be learnt: Event log <span style="font-weight: bold; font-style: italic;">is </span>Holy Grail!.</p>
Now, thats a Palindrome...Sai Charanme@saicharan.inhttp://www.saicharan.in2006-12-16T00:00:00-08:00https://www.saicharan.in/blog/2006/12/16/now-thats-a-palindrome<p>Now <span style="font-style: italic;">that</span> is a palindrome:</p>
<p>A man, a plan, a canoe, pasta, heros, rajahs, a coloratura, maps, snipe, percale, macaroni, a gag, a banana bag, a tan, a tag, a banana bag again (or a camel), a crepe, pins, Spam, a rut, a Rolo, cash, a jar, sore hats, a peon, a canal – Panama!</p>
<p>From <em>Common Lisp, the Language (2nd ed)</em>.</p>
<p>And now, <a href="http://www.norvig.com/"><span style="font-style: italic;">this</span></a> is a geek: <a href="http://www.norvig.com/pal2.html">http://www.norvig.com/pal2.html</a> and this <span style="font-style: italic;">is</span> a palindrome: <a href="http://www.norvig.com/pal1txt.html">http://www.norvig.com/pal1txt.html</a></p>
<p>Read more at the <a href="http://googleblog.blogspot.com/2004/06/man-plan-pointless-program.html">Google Blog</a>.</p>
Subclipse Proxy ConfigurationSai Charanme@saicharan.inhttp://www.saicharan.in2006-12-14T00:00:00-08:00https://www.saicharan.in/blog/2006/12/14/subclipse-proxy-configuration<p>Whew! That was a real big deal.</p>
<p>I wanted to checkout the newly open-sourced <a href="http://code.google.com/p/google-web-toolkit/source">Google Web Toolkit</a> using <a href="http://www.eclipse.org/">Eclipse</a> via the <a href="http://subclipse.tigris.org/">Subversion plugin</a>. I work behind a proxy and have a choice of three proxies offering varying capabilities and restrictions - some require authentication while others don’t. When I tried checkout, I was in for a real surprise - I was getting an error message saying <span style="font-weight: bold;">Error 407: Proxy authentication required</span>. Since I did not set any proxy in the first place, I was wondering how a proxy was picked up and why I was not being <span style="font-style: italic;">prompted</span> for authentication!</p>
<p>When I searched the Eclipse preferences dialog for SVN, I did not find any place where I can set up a proxy. Also, I wondered if Subclipse had somehow chosen to use my Windows default proxy configuration. So, I went to Control Panel > Internet Connection > Connections > LAN Settings. Nope, the default proxy that I had configured for my windows was different from the one that Subclipse was using - the default proxy did not require authentication while Subclipse was trying a proxy that required authentication. Exasperating!</p>
<p>Just wanted to be sure which proxy was being used. As usual, the <a href="http://www.ethereal.com/">Ethereal</a> network protocol analyzer came to my rescue. I figured out that by default, Subclipse had chosen a proxy that needed authentication (I am yet to find out how it found the proxy address in the first place!) and had not prompted me for authentication. Then, a search through Eclipse help led me to this link: <a href="http://svnbook.red-bean.com/en/1.1/ch07.html#svn-ch-7-sect-1.2">http://svnbook.red-bean.com/en/1.1/ch07.html#svn-ch-7-sect-1.2.</a></p>
<p>In short, I had to edit the registry to set my proxy - call that user friendly??? Well, since most of the time people who check out code are geeks, may be I should excuse this!!! Here is where I had to go:
HKCU\Software\Tigris.org\Subersion\Servers\Global\http-proxy-host and http-proxy-port values. Once I set up the proxy there, all worked well.</p>
<p>Whew!!! Breathe easy now :)</p>
Testing the RAM for defects on WindowsSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-29T00:00:00-08:00https://www.saicharan.in/blog/2006/11/29/testing-the-ram-for-defects-on-windows<p>Somebody had asked me to look at some problem being created by Ulead DVD Factory 10.0. The error reported was some failure to read a memory location. This message repeated for Nero also, after a few days.
I suspected faulty RAM, after seeing the log. The message was EXCEPTION_ACCESS_VIOLATION. But, I did not know the right tools for testing the RAM. So, a Google Search led me to the following tools:
1) <a href="http://www.memtest86.com/">MemTest</a>
2) Microsoft’s <a href="http://oca.microsoft.com/en/windiag.asp">Windows Memory Diagnostic</a>.</p>
<p>I did not test Memtest, but I used the Microsoft solution. It was easy to use, but the UI is not for the layman.</p>
<p>Notes:</p>
<ul>
<li>Please keep a floppy disk handy. If you are one of those forward looking geeks, and do not have a floppy drive, you need to have a CD writer. Check out the details provided <a href="http://oca.microsoft.com/en/windiag.asp#quick">here</a> for working with a CD.</li>
<li>After you run the program and have created a floppy, boot from the floppy.</li>
<li>To run Advanced Diagnostic tests, hit the T button on your keyboard.</li>
</ul>
Sorting Algorithms : A visual treatmentSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-20T00:00:00-08:00https://www.saicharan.in/blog/2006/11/20/sorting-algorithms-a-visual-treatment<p>Check out this link at: <a href="http://netlib.bell-labs.com/cm/cs/pearls/sortanim.html">http://netlib.bell-labs.com/cm/cs/pearls/sortanim.html</a>
It is from the <a href="http://netlib.bell-labs.com/cm/cs/pearls/">Programming Pearls</a> site. Gives some insight into the working of the algorithm. Check the behaviour of different algorithms on different inputs. However, it would be more helpful if we also have some control over the speed; this will help the visualization better!</p>
<p>Let me see if I can fix that recipe (ofcourse, I will start with the <a href="http://netlib.bell-labs.com/cm/cs/pearls/SortAnim.java">SortAnim.java</a> provided at the <a href="http://netlib.bell-labs.com/cm/cs/pearls/">site</a>).</p>
Eclipse Update behind a proxySai Charanme@saicharan.inhttp://www.saicharan.in2006-11-18T00:00:00-08:00https://www.saicharan.in/blog/2006/11/18/eclipse-update-behind-a-proxy<p>Updating Eclipse from behind a proxy was quite counter-intuitive for me; or was it??? I had expected to find the proxy setting in the same window where the updater hooks up to the internet. Unfortunately, with Eclipse, it was under Window > Preferences > Install/Update > Use HTTP Proxy…
But this option of not having to hunt around the eclipse site for the plug-ins is a real killer concept. Saves a lot of time too. One up to the <a href="http://www.eclipse.org/">Eclipse</a>project.</p>
Installation of Sun Studio 10 on Sun Solaris MachineSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-16T00:00:00-08:00https://www.saicharan.in/blog/2006/11/16/installation-of-sun-studio-10-on-sun-solaris-machine<ol>
<li>First uninstall the existing version by typing:</li>
</ol>
<pre class="ScreenText"><kbd class="UserType"> - cd /var/sadm/prod/</kbd><kbd class="Filename-Command">com.sun.studio_10</kbd> - Run the batch uninstaller. - Further info on uninstalling can be found at: <a href="http://docs.sun.com/source/819-0485/remove.html">http://docs.sun.com/source/819-0485/remove.html</a></pre>
<ol>
<li>Next, put the Tar file in the directory in which you wish to install. Untar it. Keep the tar file in the same directory as the installer file.</li>
<li>Run the installer and follow instructions.</li>
</ol>
C TidbitSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T08:21:00-08:00https://www.saicharan.in/blog/2006/11/15/c-tidbit<p>The assignment operator returns something! In the case of a character, it returns the character that was assigned. So, it is useful to write code this way:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>while ((to[i] = from[i]) != '\0')
</code></pre></div></div>
Excellent, free iCal CalendarsSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T08:20:00-08:00https://www.saicharan.in/blog/2006/11/15/excellent-free-ical-calendars<p>This is a log of my adventures with iCal Calendar clients and format.
I tried Outlook Calendar & Google Calendar. Both were good. But, when I tried Google Calendar, it was in the offing and so I could not get much out of it. It was good but was accessible only when on the net.</p>
<p>So, I hit upon <a class="external text" title="http://www.ipi.fi/~rainy/index.php?pn=projects&project=rainlendar" href="http://www.ipi.fi/%7Erainy/index.php?pn=projects&project=rainlendar" rel="nofollow" target="_new">Rainlander</a>. It was good, it integrated with Outlook and also understood the iCal format. But, I wanted to fill out just one calendar and use it on any client - both application and web-based. So, I filled out the Google Calendar (whew, that took really long!). Then, I realized that I could not actually use it anywhere else at that stage of development of Google Calendar.</p>
<p>So, I again filled out the Outlook calendar (because I had read this time that I can use the <a class="external text" title="http://outlook2ical.sourceforge.net" href="http://outlook2ical.sourceforge.net/" rel="nofollow" target="_new">outlook2ical</a> utility, which is free!!!). Bingo, I used the outlook2ical utility and could export my Outlook calendar to the iCal format which is widely supported.</p>
<p>Next, I experimented with <a class="external text" title="http://phpicalendar.com" href="http://phpicalendar.com/" rel="nofollow" target="_new">phpicalendar</a> using the .ics file that I exported with outlook2ical utility. It is cool and easy to use (as long as I had XAMPP with me, I had nothing to worry!)</p>
Using Minix on VMWareSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T08:15:00-08:00https://www.saicharan.in/blog/2006/11/15/using-minix-on-vmware<ul>
<li>There is nothing special that you need to do incase you need to run Minix on VMWare. Infact, you can download the VMWare ready image of Minix from here. Only, this image is not allowing ftp access to VMWare. After much effort, I found an image file for Minix 2.0.4 which was consolidated. The website is so confusing. It does not specify clearly what needs to be downloaded and they have lots of things there too!!!</li>
<li>To allow ping to work, just set up NAT as described <a title="VMWare" href="http://sricharan-log.blogspot.com/2006/11/vmware-internet-access-from-guest-vm.html">here</a>.</li>
<li>Read <a href="http://groups-beta.google.com/group/comp.os.minix/browse_thread/thread/0d6ca6030eba125a">this post</a> or <a href="http://sricharan-log.blogspot.com/2006/11/minix-ftp-tlenet-access.html">this post</a> to enable FTP and Telnet access to Minix.</li>
</ul>
VMWare : SSH access to RH9 from Windows using PuTTYSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T08:13:00-08:00https://www.saicharan.in/blog/2006/11/15/vmware-ssh-access-to-rh9-from-windows-using-putty<p>Refer to my <a href="http://sricharan-log.blogspot.com/2006/11/vmware-internet-access-from-guest-vm.html">previous post</a> regarding setting up Internet access via RH9 Guest OS. Make sure you have similar settings. Then, just change the firewall settings to allow incoming SSH connections.</p>
<p>Nothing else needs to be done.</p>
VMWare : Internet access from Guest VM (RedHat 9)Sai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T08:13:00-08:00https://www.saicharan.in/blog/2006/11/15/vmware-internet-access-from-guest-vm-redhat-9<ul>
<li>You donot need to create any internet sharing in windows etc. VMWare will take care of that for you.</li>
<li>To set up internet access from the guest VM, set the VM to use NAT for ethernet.</li>
<li>Set the IP address to the same segment as that of VMNet8. (just make sure that it is not .2).</li>
</ul>
<p>Now you can access the Internet from the Guest VM!</p>
VMWare : Do's & DontsSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T08:12:00-08:00https://www.saicharan.in/blog/2006/11/15/vmware-dos-donts<ul>
<li>VMWare by default creates two Vitual Network Adapters: VMNet1 & VMNet8.</li>
<li>VMNet1 is useful for host-only connection.</li>
<li>VMNet8 is for NAT access.</li>
<li>Donot change the IP domains which are assigned by default. You could wreck the DHCP, DNS & Routing domian that VMWare creates.</li>
<li>To change these settings, please use: Edit > Virtual Network Settings > NAT.</li>
<li>By default, the IP Address .2 with the VMNet8 segment, is the IP address of VMWare's DNS & router.</li>
</ul>
Windows : Autorun is Disabled?Sai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T08:11:00-08:00https://www.saicharan.in/blog/2006/11/15/windows-autorun-is-disabled<p>Here is a solution for the Geeks; it modifies the Windows registry:</p>
<pre> 1. Start RegEdit (regedt32.exe).2. Go to HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/Cdrom.3. Edit the Autorun value to '1' to enable autorn, and '0' to disable autorun.4. Close RegEdit.</pre>
<p>NOTE: You may have to restart the system.</p>
<p>A simpler solution (not guaranteed to work if autorun has been disabled in the registry, as in my case) is:</p>
<pre> 1. Right-click on the drive.2. Choose properties.3. Choose Autoplay.4. Choose the action you want to take for various file types.</pre>
Linux : Mounting a USB device - made simplerSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T08:09:00-08:00https://www.saicharan.in/blog/2006/11/15/linux-mounting-a-usb-device-made-simpler<p>1) At the terminal, log in as root.</p>
<p>2) Open the /etc/fstab file for editing.</p>
<p>3) Append the following entry to the file: /dev/sda1 /mnt/usb autofs
0 0</p>
<p>4) Start > System Tools > Disk Management</p>
<p>5) Select the device to be mounted and mount.</p>
<p>NOTES:</p>
<p>1) /dev/sda1 is the name of the device whose file system you want to mount at /mnt/usb (this too is your choice!)</p>
<p>2) autofs tells the mount command that the filesystem type should (attempted to) be detected automatically. If you want, you can explicitly specify a file system.</p>
<p>3) In the options, DONOT specify the kudzu option. The kudzu option will cause /etc/fstab to be updated when the usb device is unmounted or unplugged. Thus, the entry will vanish after this. For more information regarding kudzu, use man kudzu at the terminal.</p>
<p>4) In the options, please specify user and NOT owner. If you donot specify user, the DiskManagement will not show the USB device if this is launched by a non-root user (by default). The GUI for DiskManagement is actually a command called usermount that reads from /etc/fstab and displays a list. Hence, if user is NOT specified, the device will not show up in the list. Further, the user option indicates that ANY user can mount this device!!!</p>
<p>5) For convinience, the DiskManagement can be added to the launcher panel (Start > System Tools. Right Click on DiskManagement and click on Add to Launcher Panel)</p>
Changing the default command for RedHat8 Launch PanelSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T08:09:00-08:00https://www.saicharan.in/blog/2006/11/15/changing-the-default-command-for-redhat8-launch-panel<p>For accessing the Windows Network using Samba, only Nautilus seemed to be understanding the smb:// protocol. I did not want to each time start a terminal and type nautilus to start Nautilus. So, I wanted to add a launch panel icon. I could not find a way to add and configure a new icon. So I dragged the Help icon from the Main Menu and modified its Properties to run the command /usr/bin/nautilus. But this by default opened my home directory. I wanted it to open smb://Hostname. I had experimented earlier at the terminal and found that nautilus took as its command line arguements the location to be opened. So, I changed the command to /usr/bin/nautilus smb://Hostname. This worked well for me. But, I wanted some more sophistication. I wanted to log in directly since smb:// (like <a class="external free" title="ftp://" href="ftp:///" rel="nofollow" target="_new">ftp://</a>), takes the username and password separated by a colon followed by @ and the hostname. So, I changed the command to /usr/bin/nautilus smb://User Name:Password@Hostname. Nut, commandline did not parse the space separated user name (which Windows allows). So, as an additional change, using my instincts from my working with Linux, I enclosed the User Name within single quotes. This worked well. Similar strategy is also required to be used with the password if it contains spaces. Remember that while typing the username and password in the address bar of nautilus or at the Properties panel of the Launch Panel, the Password in NOT masked. So, it is at your risk that you do this.</p>
<p>So, all said and done, here is how the command looked at the end of the experimental session:</p>
<pre>/usr/bin/nautilus smb://'User Name':'Pass word'@Hostname</pre>
Samba Server SetupSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T08:04:00-08:00https://www.saicharan.in/blog/2006/11/15/samba-server-setup<p>Check if the Samba server is installed: You can check this by going to Main Menu > System Settings > Server Settings > Services. Then, look for a service named smb. If it is present, that means, the Samba server is installed. If it is not started, start it up.</p>
<p>If you donot have the Samba server installed on your system, you should install it from the RedHat 9 CDs. The server along with the GUI to configure Samba are present on CDs 1, 2 & 3.</p>
<pre>- Insert CD1.- Go to the CDROM and navigate to RedHat > RPMS.Here, look for a file called samba*.rpm. Install it.- Insert CD2. Navigate to RedHat > RPMS.Install a package called redhat-config-samba*.- Insert CD3. Navigate to RedHat > RPMS.Install a package called samba-swat*</pre>
<p>NOTE: <strong>SWAT</strong> is a browser based configuration tool for Samba. It talks be default on port 901. So, to use this, httpd should be running on Linux and the firewall should not block this port.) We will use the GUI rather than SWAT for configuration.</p>
<ul>
<li>Go to the command prompt and type: /usr/bin/redhat-config-samba (it is in /usr/bin folder).</li>
<li>Login as root.</li>
<li>You will get a screen similar to the one shown here.</li>
<li>Go to Preferences > Server Settings. The default settings are shown here. I had to keep the group to something different from what was the Workgroup on my Windows system. Give a nice description; this is what people from other systems will see as the title for the Server (eg. In Windows, in the My Network Places, Show Work Group Computer, this is what will be seen.)</li>
<li>On the Security tab,</li>
</ul>
<pre>- set the Authentication Mode to User.- set the Encrypted Password to Yes.- set Guest account to the user for whom you are setting up this share.(I donot as yet know how to allow for anonymous shares...)- click OK.</pre>
<ul>
<li>Go to Preferences > Samba Users.</li>
</ul>
<pre>- click add.- Select the Unix username for the user whom you want topermit to use the share. When he logs in, he will be takent to his homedirectory unless some other shared folder has been specified.- If the user is logging in from Windows, provide his Windows username</pre>
<p>(this simplifies authentication and hepls to map Windows users to Linux users, I think so, I am not sure about this part).</p>
<pre>- Provide a password (preferrably different from his Linux login password).- click OK.</pre>
<ul>
<li>Click Add, and add a shared folder to allow access from outside the Linux machine.</li>
<li>To access this share from Windows, Go to My Network Places > View Workgroup Computers > Microsoft Windows Networks. Go to the appropriate workgroup that you had specified earlier. Here you will find the Samba Server with the description you provided earlier. Open this Samba and there you go!!!</li>
</ul>
<p>Now someone please tell me how to access the Windows Shares from Linux. Any help would be appreciated. :)</p>
<p>UPDATE: Okay, just discovered that File & Printer Sharing must be enabled on Windows for accessing the Shared Files! For this, please run the Network Setup Wizard with appropriate options!!!</p>
VMWare : Internet / FTP / Telnet Access to Linux Guest from Windows HostSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T05:36:00-08:00https://www.saicharan.in/blog/2006/11/15/vmware-internet-ftp-telnet-access-to-linux-guest-from-windows-host<p>1) After installing VMWare workstation or VMWare Player, find out the IP Subnet of the VM Network Adapter named VMNet8. This is the VMAdapter that is used for NAT connectivity.
2) Set up the Linux host’s IP address to be in the same IP Subnet as VMNet8. Just make sure that you donot use the IP addresses subnet.1 OR subnet.2 Subnet.1 is used by VMNet8 while subnet.2 is used as the IP of the NAT Gateway. (Refer to VMWorkstation documentation for more details).
4) Set the default Gateway to subnet.2
3) Set up VMWare to use Ethernet in NAT mode.
4) Done.</p>
VMWare : Sharing Files by Connecting to Windows from LinuxSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T05:34:00-08:00https://www.saicharan.in/blog/2006/11/15/vmware-sharing-files-by-connecting-to-windows-from-linux<p>Check out this link from VMWare Documentation: <a href="http://www.vmware.com/support/gsx3/doc/running_fileshare_lin2win_gsx.html#1089626">http://www.vmware.com/support/gsx3/doc/running_fileshare_lin2win_gsx.html#1089626</a></p>
Minix - FTP & Tlenet AccessSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T05:32:00-08:00https://www.saicharan.in/blog/2006/11/15/minix-ftp-tlenet-access<p>I had a problem accessing my Minix VMWare guest OS, via FTP or Telnet. Here is how the problem was solved…</p>
<p>A little bit of history:
Yesterday, I had to set up a RedHat 9 Guest OS for one of my faculty members. I realized that even though telnet was installed and running, I was unable to access it even locally!!! Then I realized that I had to edit the ‘telnet’ file in /etc/xinetd.d to allow incoming telnet connections (inspite of changes to the firewall configuration to allow incoming telnet connections).</p>
<p>Back to present:
So I realized that perhaps something similar needs to be done even with Minix (after all, it is a variant of Unix and must have similar security features!!!). But, when I went to the /etc folder in Minix, I found no xinetd.d folder. Looking around, I found the serv.access file. Guessing that it must be the right place to look, I opened it. Bingo!
There it was. Only, I had to decipher how the entires should look like in that file. Ever so helpful, a comment asked me to man serv.access. Also, I looked at the /usr/adm/log file. It was all there - all those access denied messages…</p>
<p>Initially, my /etc/serv.access file was like this:</p>
<h1 id="etcservaccess">/etc/serv.access</h1>
<h1 id="2006-05-21">2006-05-21</h1>
<h1 id="see-the-servaccess5-man-pages-to-learn-how-to-edit-this-file">See the serv.access(5) man pages to learn how to edit this file</h1>
<h1 id="to-make-your-system-safe-on-the-network">to make your system safe on the network.</h1>
<h1 id="this-is-insecure-replace-with-something-more-specific-asap">this is insecure! replace with something more specific asap</h1>
<p>telnet ftp: +* log;</p>
<h1 id="this-is-better-keep-outsiders-out">this is better, keep outsiders out</h1>
<h1 id="telnet-ftp-local-log">telnet ftp: +*.local log;</h1>
<h1 id="this-records-all-unsuccessful-access-attempts-inusradmlog">this records all unsuccessful access attempts in/usr/adm/log</h1>
<p><em>: -</em> log;</p>
<p>After a reading the man page and a little tinkering, I changed the line “telnet ftp: +* log;” to “telnet ftp: + log;”. i.e., I just removed the *. May be very insecure, but it does the job for me. Perhaps one could add an IP address or a range of IPs to enhance security (as described in the man page).</p>
<p>One another word:
This might be very helpful on the VMWare front:</p>
<p>I am still using NAT. I had to just set the IP address of my Minix to be on the same subnet as VMNet8 (which is the default subnet on which VMWare does NAT-ing). Also, the default gateway on the guest OS - Minix - had to be set to VMNet8-subnet-.2 ( The .2 IP is the gateway across which VMWare does NAT).</p>
<p>Thats it!!!. All works fine now…</p>
Adding a FaviconSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T05:31:00-08:00https://www.saicharan.in/blog/2006/11/15/adding-a-favicon<p>Check out this Wiki article : http://en.wikipedia.org/wiki/Favicon</p>
FTP Server on Windows 2003 Server R2Sai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T05:30:00-08:00https://www.saicharan.in/blog/2006/11/15/ftp-server-on-windows-2003-server-r2<p>We had set up IIS on Windows 2003 server. Along with HTTP, we also had to set up FTP server to allow our staff members to be able to upload info to their respective folders.
The initial set up worked, but it was readonly, inspite of the folder permission being write. Then, I checked out that if I logged in as admin, I could create folders! So, I went to check out the folder permissions for the admin account. It was exactly as I had configured the staff account (FULL CONTROL), except that the permission were only for the current folder. For the staff account permissions, I had chosen to give full control to “This folder, and subfolders and files(as intuition and common sense would have served anyone). But, I must confess that I donot fully understand the NTFS permissions structure. So, I changed the staff permissions to this folder only and bingo! it worked.</p>
Networking LessonsSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T05:29:00-08:00https://www.saicharan.in/blog/2006/11/15/networking-lessons<p>Subnets, Non-routable IPS:
Learner’s Perspective - <a href="http://www.easydesksoftware.com/news/news28.htm">http://www.easydesksoftware.com/news/news28.htm</a></p>
<p>Admin’s Perspective - <a href="http://www.pku.edu.cn/academic/research/computer-center/tc/html/TC0000.html">http://www.pku.edu.cn/academic/research/computer-center/tc/html/TC0000.html</a>
Admin’s Perspective - <a href="http://www.pku.edu.cn/academic/research/computer-center/tc/html/TC0305.html">http://www.pku.edu.cn/academic/research/computer-center/tc/html/TC0305.html</a></p>
Network Access across a routerSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T05:22:00-08:00https://www.saicharan.in/blog/2006/11/15/network-access-across-a-router<p>This document recapitulates the tasks that were needed to be done by us to enable access between the online and offline systems in the lab at my hostel:</p>
<p>1) First set up a DNS ( with a domain name say ssshcc.edu )</p>
<ul>
<li>Set up the forward and reverse lookup zones
2) Set up the DNS machine to act as the router also between the two segments.
3) For each computer on the online and offline segments, change the primary DNS suffix of the computer to the DNS domain name ( as specified in step 1 )</li>
<li>Right Click My Computer > Properties</li>
<li>Computer Name</li>
<li>Change</li>
<li>More</li>
<li>Type in the new Primary DNS Suffix
4) For each machine in the online and offline segements, make sure that the guest account is allowed network access.</li>
<li>Start > Control Panel > Local Security Policy > Local Policy > User Rights Assignment > Deny Logon over Network</li>
<li>Remove the Users whom you wish to allow network access (if the name is in the list)
5) Make sure that the default gateways and Primary and Secondary DNServers are correctly entered in the Network Configuration.
6) In the lab, i.e., in the SSSHCC, the online systems donot have guest login interactively, but we want the guest users from the offline segement to be able to access the online systems. For this, we enable the Guest user account on the Online systems, but prevent their Interactive Login as follows:</li>
<li>Start > Control Panel > Local Security Policy > Local Policy > User Rights Assignment > Deny Logon Locally</li>
<li>Add Guest user.
7)Here, you can choose the custom list and add the required IPs or choose then Any computer option as required.
8) One last setting: The windows firewall by default allows only computers on the same segment to access each other. This needs to be changed:</li>
</ul>
<p>It is like this: Port 445 (which is what windows uses for file and printer sharing) by default accepts connections only from computers on the same subnet as itself. This behaviour can be changed as described in the document: <a href="https://docs.google.com/View?docid=ajgs46pc346b_9dxvvjc">https://docs.google.com/View?docid=ajgs46pc346b_9dxvvjc</a>.
You can find Microsoft’s description of the solution(KB840634) at<a href="http://support.microsoft.com/kb/840634"> http://support.microsoft.com/kb/840634</a></p>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>
Windows XP Pro: Network access: logon failureSai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T05:20:00-08:00https://www.saicharan.in/blog/2006/11/15/windows-xp-pro-network-access-logon-failure<p>Windows XP Pro: Network access: logon failure: the user has not been granted the requested logon type at this computer</p>
<p>Solutions:
0) Start > Control Panel > Administrative Tools > Local Security Policy > Local Policies > User Rights Assignment:</p>
<ul>
<li>Goto : Deny Access to this Computer from the Network</li>
<li>Remove the user name to whom you wish give permission to access the computer over the network.
1) Just run the network setup wizard and turn on file and printer sharing. If that does not help, try the next link:
2) <a href="http://www.experts-exchange.com/Operating_Systems/Windows_Server_2003/Q_21072962.html?qid=21072962">http://www.experts-exchange.com/Operating_Systems/Windows_Server_2003/Q_21072962.html?qid=21072962</a>
3) <a href="http://www.experts-exchange.com/Operating_Systems/Windows_Server_2003/Q_21072962.html">http://www.experts-exchange.com/Operating_Systems/Windows_Server_2003/Q_21072962.html</a></li>
</ul>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>
Matlab license manager error: Solaris 10Sai Charanme@saicharan.inhttp://www.saicharan.in2006-11-15T05:15:00-08:00https://www.saicharan.in/blog/2006/11/15/matlab-license-manager-error-solaris-10<p>If the Sun Machine is not properly shut down when Matlab (license) server is running, you will be unable to start matlab after the reboot. You will get an error -15.
To trouble shoot, I did the following:</p>
<ul>
<li>I knew that lmstart command present int $MATLAB/etc directory starts the matlab license manager.</li>
<li>To start the license manager (i.e., to run the lmstart command), you need to be logged in as a non-root user.</li>
<li>So, I tried to start the license manager.</li>
<li>I got a message saying that I needed to delete some files: /var/tmp/lm_<em>.log and /var/tmp/lm_</em>.dat</li>
<li>For this you need to log in as root.</li>
<li>Once this is done, run lmstart again.</li>
<li>Done.</li>
</ul>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>
The Best GDB tutorial....Sai Charanme@saicharan.inhttp://www.saicharan.in2006-04-20T08:52:00-07:00https://www.saicharan.in/blog/2006/04/20/the-best-gdb-tutorial<p>Once again, GDB comes to my rescue. Preparing for some exam, I need to debug. I need some advanced debug commands. Man pages are too long and do not provide examples. So, where do I go? To where I always went for GDB. To <a href="http://www.dirac.org/linux/gdb/">Peter Jay Salzman’s web site tutorial ofcourse</a>!
It seems to have been recently updated and it is great. Very technical and yet understandable too! - a rare combination. It is still under massive reconstruction as the web site puts it, but still great to go.
You can find his homepage <a href="http://www.dirac.org/p/">here</a> and his usful linux notes <a href="http://www.dirac.org/p/linux/">here</a>.
He seems to use all those things that I am interested in (kind of one-stop for me!), except that I use Matlab while he prefers Mathematica. His LaTeX links are <a href="http://www.dirac.org/tex/">here</a>. And <a href="http://www.dirac.org/hackers/">here</a>is his list of hackers (both good and bad as he puts it.)</p>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>
What the hell is that service?Sai Charanme@saicharan.inhttp://www.saicharan.in2006-04-16T01:33:00-07:00https://www.saicharan.in/blog/2006/04/16/what-the-hell-is-that-service<p>Two days ago, my system became damn slow. Then, I started looking at the processes and services running. Then, I Googled them and found these amazing sites:</p>
<p><a href="http://www.liutilities.com/">http://www.liutilities.com</a>
<a href="http://www.processlibrary.com/">http://www.processlibrary.com</a>
<a href="http://www.auditmypc.com/">http://www.auditmypc.com</a></p>
<p>For my own quick reference, here is the list of the processes that were running on my machine; now, most of them are scrapped. BTW, my machine is now like a tuned string, waiting to be played with.
*) Bonjour: Apple Computer’s
*) vptray : Symatec AV VirusProtectionTray
*) qttask : QuickTime Task
*) cftmon :The cftmon.exe process is a component used in MsOffice to perform language related functions. It is closely tied to the ‘Language Bar’ present in MsOffice, so if you use the Language Bar you should leave this process running. If, on the other hand, you do not use the language bar, you should terminate this process to free up system resources.
*) igfxtray.exe is a process which allows you to access the Intel Graphics configuration and diagnostic application for the Intel 810 series graphics chipset. This program is a non-essential system process, and is installed for ease of use via the desktop tray.
*) Intel hotcommand hkcmd.exe is installed alongside Intel multimedia devices and allows configuration and diagnostic options for these devices. This program is non-essential process to the running of the system, but should not be terminated unless suspected to be causing problems.
*) vsmon.exe is a processs associated with the ZoneAlarm personal firewall. It is used to monitor Internet traffic and generate alerts depending on the security rules configured by the user.
*) Adobelmsvc.exe is a process which belongs to Adobe Acrobat. This program is non-essential process to the running of the system, but should not be terminated unless suspected to be causing problems.
*) mdnsresponder.exe is a process associated with “Bonjour for Windows” software. It is used by ITunes for music sharing. This is a non-essential process. Disabling or enabling this is down to user preference.
*) mdm.exe is associated with Microsoft Windows process debugging system. It allows the user to debug Internet Explorer errors by using a script interface tool. This is a non-essential process. Disabling or enabling this is down to user preference. Note: is also a process which is registered as the Win32.Lydra.a information stealing Trojan. This Trojan allows attackers to access your computer, personal data and information. It is a registered security risk and should be removed immediately.
*) AcroTray.exe is the Acrobat Assistant used when you print your documents to a PDF. While converting documents to a PDF this process should not be removed.
*) Adobelm_Cleanup.0001 is a process which belongs to Adobe Acrobat. This program is non-essential process to the running of the system, but should not be terminated unless suspected to be causing problems.
*) lsass.exe is a system process of the Microsoft Windows security mechanisms. It specifically deals with local security and login policies. This program is important for the stable and secure running of your computer and should not be terminated.
*) Scrss.exe is a process which is registered as the HacDef-R Trojan. This Trojan allows attackers to access your computer, stealing passwords, Internet banking and personal data. It is a registered security risk and should be removed immediately.
*) smss.exe is a process which is a part of the Microsoft Windows Operating System. It is called the Session Manager SubSystem and is responsible for handling sessions on your system. This program is important for the stable and secure running of your computer and should not be terminated.
*) PSNGive.exe is a process associated with the lite version of Post-it Note from 3M.</p>
<p>References:
http://www.auditmypc.com
http://www.processlibrary.com
http://www.liutilities.com</p>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>
Installing Mandrake LinuxSai Charanme@saicharan.inhttp://www.saicharan.in2006-04-16T01:29:00-07:00https://www.saicharan.in/blog/2006/04/16/installing-mandrake-linux<p>The other day, my one of my friends had a problem installing Mandrake Linux. On first thougts, I thought I would get an image aided tutorial ready, but then, I checked out the all resourceful Google and found these. The second link is classic:
<a href="http://member.melbpc.org.au/%7Eparsonsd/linux/Mandrake10_Install.html">http://member.melbpc.org.au/~parsonsd/linux/Mandrake10_Install.html</a>
<a href="http://www.mandrake.tips.4.free.fr/install100.html">http://www.mandrake.tips.4.free.fr/install100.html</a></p>
<p>So, happy Mandraking!</p>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>
Lookout - Outlook!!Sai Charanme@saicharan.inhttp://www.saicharan.in2006-04-16T01:03:00-07:00https://www.saicharan.in/blog/2006/04/16/lookout-outlook<p>Here is where I again had a hell lot of problems. I wanted to make a birthday calendar and export it in the standard iCal format to my Google Calendar etc, as iCal was hailed on the web as the defacto standard for calendars.
I started with Sunbird 0.3a1. Thinking that I could export things in iCal format, I filled in all the birthdays I wanted to. And, then I found that all I had done was a waste. It only allowed me to export selected items as iCal. Thinking that maybe the default format for the calendar is iCal, I looked in my profile directory and bingo! nothing like *.ical, *.vsc or *.vcal. Then the Mozilla Foundation’s documentation told me that from this version of sunbird, the default file format was .sdb, some SQLite format. Gone waste was my effort.
Lesson #1: Always look for the existance of the features you need in the s/w you choose.</p>
<p>So, what do I do? Google it ofcourse!
This is what Google yielded and had some good reviews too: <a href="http://outlook2ical.sourceforge.net/">http://outlook2ical.sourceforge.net/</a>
It was some VB script. Things went cool till I exported the calendar and imported it into Sunbird. The recurring events which were supposed to recur every year once were recurring every day for a month! Give up?
Lesson #2: Never trust feature description. Check out the features ur self.</p>
<p>What next?
I wanted to somehow get this b’day business running, so I filled out the calendar in Outlook (for the simple reason that it was faster to add in Outlook than in Sunbird, donno why). Then, I bumped into this: <a href="http://www.rainlendar.com/">http://www.rainlendar.com</a>. A very cute utility that seamlessly integrates with Outlook (oh my God!), reads from and understands iCal files! Thought this was a jackpot. Installed the software and loved its interface and cool features. Under the config > Plugins, i checked the Outlook option and refreshed the rainlendar on my desktop, it began showing the bithdays on the CORRECT days and onMouseOver(), it displayed the subject and description in a pop-up!
Cute piece of work.</p>
<p>Next, I wanted to take this calendar of outlook to my workplace. How?
I chose Calendar. Then I said File > Archive. I saved only the Calendar to an archive.pst (which was non-empty (~256 kb) ). Then I closed Outlook and made another copy of this file.
Next, on my Win XP with Outlook 2003, I found the archive of the current Outlook files here C:\Documents and Settings\%USER_NAME%\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst
Just to see if I can import, I changed the name of the file from Outlook.pst to OldOutlook.pst. As expected, Outlook did not open saying it could not find the file Outlook.pst; but, it gave me file open dialog where I chose the archive.pst. Then agagin it gave some error and closed. The next time I opened Outlook, it opened, but there was nothing there. So, I decided to import the stuff. I chose File > Import and Export > Import from another file or program > Personal Files Folder (.pst).
Here I chose the backup file of the Outlook.pst that I had made earlier (did not want to take any chances with my calendar!). Then, I chose to import the calendar and hit the Finish button. Done!
I opened my calendar on the left tab and yo! the birthdays were there!!!</p>
<p>Okay, so much so far, but not good enough for me to export to iCal yet. Anyone ne ideas? Please lemme know.</p>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>
Firefox extension updated!Sai Charanme@saicharan.inhttp://www.saicharan.in2006-04-11T20:28:00-07:00https://www.saicharan.in/blog/2006/04/11/firefox-extension-updated<p>At last! The <a href="http://sricharan-log.blogspot.com/2006/04/new-firefox-extension.html">SaveURI</a> 0.1 for firefox is ready! Now I can breathe easy. It is available <a href="http://scharan20.googlepages.com/SaveURI-0.1-fx.xpi">here</a>. Try it and post your comments.
As I said earlier, this extension is useful for “remembering” the URL of every page that you visited and saved. This is still in beta as it has only just been submitted to <a href="https://addons.mozilla.org/developers/main.php">Mozilla Foundation</a> for review.
Cheers! Now I can do something else while I wait for the review. :)</p>
<p>Update:
Yesterday, the Firefox 1.5.0.1 running on my system said I needed to upgrade, on saying go ahead, it checked my extensions for compatibility and said SaveURI is incompatible with 1.5.0.2! Anyway, later, I downloaded FF 1.5.0.2 from <a href="http://getfirefox.com/">Get Firefox</a> and installed it. Then, I installed the SaveURI extension and it works just right!
Any ideas? <a href="mailto:scharan20@gmail.com">Buzz me</a>.</p>
<p>Update:
This morning (20th April), SaveURI 0.3 was ready. Queued it up for approval at the MDC. Waiting for their approval. If you want to try it, it is available <a href="http://scharan20.googlepages.com/SaveURI-0.3.0.1-fx.xpi">here</a>. Try it and let me know.</p>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>
Post-it notes for the PCSai Charanme@saicharan.inhttp://www.saicharan.in2006-04-10T02:42:00-07:00https://www.saicharan.in/blog/2006/04/10/post-it-notes-for-the-pc<p>That is one hell of a software for forgetfulls like me. You can cover your desktop with post-its and even set off an alarm on specific notes!. Terrific! You can download the lite version from <a href="http://dw.com.com/redir?pid=10508740&merid=59813&amp;mfgid=59813&ltype=dl_dlnow&lop=link&edId=3&siteId=4&oId=3040-2351_4-10508740&ontId=2351_4&destUrl=http://www.download.com%2F3001-2351_4-10508740.html">here</a>. You can try the newest version for 30 days from <a href="http://www.3m.com/us/office/postit/digital/digital_notes.html">here</a>. Beware! version 4.2 needs .Net framework 1.1. You can get that <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=262d25e3-f589-4842-8157-034d1e7cf3a3&displaylang=en">here</a>.
The maker is father of paper-post-its – <a href="http://www.3m.com/">3M.</a>Three cheers to 3M!</p>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>
New Firefox ExtensionSai Charanme@saicharan.inhttp://www.saicharan.in2006-04-09T22:55:00-07:00https://www.saicharan.in/blog/2006/04/09/new-firefox-extension<p>Today, SaveURI- a firefox extension that I wrote is ready. It was a litte difficult to get things going, but it was fun.</p>
<p>By the way, this extension simply saves the URI or URL of every page that you save so that you don’t have to search for the parent site link. This was a problem I had for long, especially when I was doing my master’s project. The links were just not available on any of the pages that I had saved. I needed them all for my report references. I am glad I could solve my own problems.
You can download the extension <a href="http://scharan20.googlepages.com/SaveURI.xpi">here</a>. Just be careful if you are using the CustomizeGooogle extension as SaveURI is in the test phase and WILL clash with the latter extenssion.</p>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>
Welcome!Sai Charanme@saicharan.inhttp://www.saicharan.in2006-04-09T22:52:00-07:00https://www.saicharan.in/blog/2006/04/09/welcome<p>Welcome to my (b)log.
Here, I will be recording my experiments with Computers & Computing.</p>
<div class="blogger-post-footer">My experiments with Computers, Computing, Programming & Software.</div>