tag:blogger.com,1999:blog-318510252024-03-18T14:54:12.029+05:45jw@l@nta's weblogMostly Linux hacks, FOSS matters and my occasional travelogues.Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.comBlogger111125tag:blogger.com,1999:blog-31851025.post-81409634235766894812012-03-19T08:34:00.000+05:452013-03-01T20:57:13.734+05:45Multiple SSID on OpenWRT with bandwidth limit<div dir="ltr" style="text-align: left;" trbidi="on">
If you're a network junkie and not been living under the rocks, you must have heard of <a href="https://openwrt.org/" target="_blank">OpenWRT</a>. It's a Linux distribution for embedded devices (routers) and gives you power to do things usually impossible or difficult with inbuilt router firmware. Wireless Freedom indeed.<br />
<br />
This was my scenario: I had to create two wireless APs for my office, one for the guests (no password but bandwidth limited) and another for non-guest users (password protected but no limit on bandwidth). That way the visitors will have free wireless internet, but with limited bandwidth. The office staffs will have to connect to a password protected wifi for unrestricted bandwidth.<br />
<br />
The requirements for the APs are,<br />
<br />
<b>Free Wifi for visitors</b><br />
- SSID: FreeWifi<br />
- Password: none<none></none><br />
- Bandwidth limit: 256Kbps uplink, 128Kbps downlink<br />
<br />
<b>Office Wifi for staffs</b><br />
- SSID: OfficeAP<br />
- Password: 1234567890<br />
- Encryption: WPA2<br />
- Bandwidth limit: none<br />
<br />
Here's how I did it on OpenWRT. Connect to OpenWRT shell.<br />
<br />
1. First create two wireless APs with above configuration. Add the following lines to /etc/config/wireless (Remove any existing 'wifi-iface' configurations)<br />
<br />
<code>
# Free Wifi<br />
config 'wifi-iface'<br /> option 'device' 'wifi0'<br /> option 'ssid' 'FreeWifi'<br /> option 'mode' 'ap'<br /> option 'network' 'lan'</code><br />
<br />
<code># Office Wifi<br />config 'wifi-iface'<br /> option 'device' 'wifi0'<br /> option 'ssid' 'OfficeAP'<br /> option 'mode' 'ap'<br /> option 'network' 'lan'<br /> option 'encryption' 'psk2'<br /> option 'key' '1234567890'</code><br />
<br />
As simple as that! Now to enable the wifi, go to shell and <br />
<br />
<code>
# wifi down; wifi up</code><br />
<br />
2. Now to limit bandwidth, we'll be using <a href="http://lartc.org/wondershaper/" target="_blank">wondershaper</a>. To install:<br />
<br />
<code>
# opkg update<br />
# opkg install wshaper</code><br />
<br />
3. Now find which interface is the FreeWifi assigned to<br />
<br />
<code>
# iwconfig</code><br />
<br />
On mine, it was on ath0<br />
<br />
4. Modify /etc/config/wshaper and start wondershaper<br />
<br />
<code>
config 'wshaper' 'settings'<br /> option 'network' 'ath0'<br /> option 'downlink' '256'<br /> option 'uplink' '128'</code><br />
<br />
Now, start wondershaper.<br />
<br />
<code>
# /etc/init.d/wshaper start</code><br />
<br />
5. By default, wshaper isnt enabled at startup. so,<br />
<br />
<code>
# ln -s /etc/init.d/wshaper /etc/rc.d/S99wshaper</code></div>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com338tag:blogger.com,1999:blog-31851025.post-85412445390345514922011-12-26T13:34:00.005+05:452011-12-26T14:26:45.112+05:45LinuxMint Debian and adjustmentsI recently moved to <a href="http://blog.linuxmint.com/?p=1818">Linux Mint Debian</a> after using Ubuntu for since quite a while. (Reason: Like <a href="http://linux.slashdot.org/story/11/05/03/1516235/ubuntu-unity-the-great-divider">many</a>, I'm not so much fond of Unity)<br /><br />However, Debian is not as polished as Ubuntu. Here are some of the fixes I made:<br /><br /><span style="font-weight: bold;">Installing 686-pae kernel</span><br /><br />LM Debian comes with 486 kernel, which has support for single CPU only. The first thing to do is install 686-pae kernel<br /><br /><code># apt-get install linux-image-686-pae</code><br /><br />Reboot and choose the new kernel.<br /><br /><span style="font-weight: bold;">Installing Virtualbox</span><br /><br />Virtualbox is available in the repository.<br /><br /><code># apt-get install virtualbox</code><br /><br />However, virtualbox wont work because of the newly installed 686-pae kernel, so we need to rebuild the vboxdrv modules. This requires linux headers for 686-pae kernel.<br /><br /><code># apt-get install linux-headers-686-pae</code><br /><br />This should rebuild the vboxdrv modules automatically, post installation. But if it doesnt, do the following:<br /><br /><code># dpkg-reconfigure virtualbox-dkms</code><br /><br /><span style="font-weight: bold;">Installing Wine</span><br /><br />Unfortunately, Wine is not available in the repo. Use the repo at http://www.lamaresh.net/<br /><br />Add the following line to /etc/apt/sources.list, or via Synaptic - Settings - Repositories - Other Software - Add<br /><br /><code>deb http://www.lamaresh.net/apt squeeze main</code><br /><br />Then update and install.<br /><br /><code># apt-get update<br /># apt-get install wine</code><br /><br /><span style="font-weight: bold;">Fixing Mint-X themes</span><br /><br />There are two Mint themes, Mint-X and Mint-X-Metal, which are very soothing and greenish. However there's a little glitch with expander plus (+) signs (eg, visible while installing software using Synaptic). To fix, open /usr/share/themes/Mint-X/gtk-2.0/gtkrc file (as root) and remove the following line:<br /><br /><code>GtkExpander::expander_spacing = 16</code><br /><br />Do the same for /usr/share/themes/Mint-X-Metal/gtk-2.0/gtkrc too.<br /><br />Also, if you want to change the font size for panels, look for <span style="font-style: italic;">font_name</span> variable in this gtkrc file.<br /><br /><span style="font-weight: bold;">Few other changes</span><br /><br />You might also wanna install <span style="font-style: italic;">ttf-devanagari-fonts</span> and <span style="font-style: italic;">ttf-mscorefonts-installer</span>. Also download the latest <a href="http://www.mozilla.org/en-US/firefox/new/">Firefox</a> (currently 9.0) and install it to /opt/firefox/<br /><br /><code># tar -jxf firefox-9.0.tar.bz2 -C /opt/</code><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikqd4X4svK0sRiI0xmqG91SPquH2at8ZtAVwmJPAZVlgr754l2ccS7hfZG5VsQQgH44RmDiEx6unT3nB0UGbqFI-nTHC1sPvxIfP6tAV-kriPWyRCgvSKZi7ywZAZHo-7DHjWO7g/s1600/Screenshot.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikqd4X4svK0sRiI0xmqG91SPquH2at8ZtAVwmJPAZVlgr754l2ccS7hfZG5VsQQgH44RmDiEx6unT3nB0UGbqFI-nTHC1sPvxIfP6tAV-kriPWyRCgvSKZi7ywZAZHo-7DHjWO7g/s400/Screenshot.png" alt="" id="BLOGGER_PHOTO_ID_5690354317506459282" border="0" /></a>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com12tag:blogger.com,1999:blog-31851025.post-48183224170659026192011-10-13T21:14:00.003+05:452011-10-13T21:25:58.233+05:45RIP Dennis Ritchie (1941-2011)<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://upload.wikimedia.org/wikipedia/commons/0/01/Dennis_MacAlistair_Ritchie_.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 426px; height: 493px;" src="http://upload.wikimedia.org/wikipedia/commons/0/01/Dennis_MacAlistair_Ritchie_.jpg" alt="" border="0" /></a><br />My life revolves around tools and technology, the foundation of which you laid. I've loved and enjoyed <a href="http://en.wikipedia.org/wiki/The_C_Programming_Language_%28book%29">The C Programming Language</a> more than any computer text so far. May you rest in peace..<br /><br /><code>#include <stdio.h><br /><br />main(){<br /> printf("RIP, Dennis Ritchie!");<br />}</code>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com3tag:blogger.com,1999:blog-31851025.post-51378009698190493772011-10-10T05:01:00.018+05:452011-10-11T13:14:26.883+05:45Gosaikunda TrekTravelogue after a long time. Not that I haven't been traveling, but have been too lazy to write. However recently I went to Langtang trail upto Gosaikunda, the memoir of which is worth mentioning. The scenery along the trail is just superb and the Gosaikunda and other lakes around are just magnificent!<br /><br />We (<a href="https://www.facebook.com/thapa">Rajendra</a>, <a href="https://www.facebook.com/suspenceb">Subash</a> and me) started from Sundarijal and ended up at Dhunche via Gosaikunda. Took 5 days (29th Sept - 3rd Oct, 2011) and trekked up to a height of 4730m.<br /><br /><span style="font-weight: bold;">Day 1</span><br />We started from Sundarijal. Actually the plan was to go to Dunche / Syabrubesi first and start from there, but since the bus tickets were hard to get due to Dashain we decided to start from the opposite end.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-TTtbrZ3EpV1b6OnStmZTKMwFpACphXQL0JoXp4eNU-vGM7RrA4oqbt_IL7BhvwIFtyWY30nRum0U8TGu_m6CbqsQJm4Kg63srXduRIoNIzAOYJz8Ux17lVvyqs4EP_1Jd49neA/s1600/IMG_0866.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 267px; height: 400px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-TTtbrZ3EpV1b6OnStmZTKMwFpACphXQL0JoXp4eNU-vGM7RrA4oqbt_IL7BhvwIFtyWY30nRum0U8TGu_m6CbqsQJm4Kg63srXduRIoNIzAOYJz8Ux17lVvyqs4EP_1Jd49neA/s400/IMG_0866.JPG" alt="" id="BLOGGER_PHOTO_ID_5661655884030619026" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixgZuh9rmhucNtinR1pjMmLdLezTd7SRFKS7STsowGZ7vCDfYokM5-G3J7-d6K87enC2lPGUTQ6g0vlpiUYOoOMN2Avum1zWxvbhgckWt7hfJ_-JuOhMgQinyrEaMQj_ZK-g1ibg/s1600/IMG_0878.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixgZuh9rmhucNtinR1pjMmLdLezTd7SRFKS7STsowGZ7vCDfYokM5-G3J7-d6K87enC2lPGUTQ6g0vlpiUYOoOMN2Avum1zWxvbhgckWt7hfJ_-JuOhMgQinyrEaMQj_ZK-g1ibg/s400/IMG_0878.JPG" alt="" id="BLOGGER_PHOTO_ID_5661655892513891794" border="0" /></a><br />The Sundarijal - Chisapani was quite familiar trail. We started around noon and reached there by evening. Apart from few downhills, the trail is all the way up.<br /><br />Elevation: <span style="font-weight: bold;">2194m</span><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggvlLekVcJXF4Jc1uJjyxgelsLL1c0yhyqt79dvUSUq0jbMmyXHeUb9aNq3YIWsPVUFkv-kgvSsitqLQxxNsz_2oZwxlC5tdqgNFGQk_EhnB-8ZnWgUfHa4CwMzlefZD4gsoCJ7w/s1600/IMG_0910.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggvlLekVcJXF4Jc1uJjyxgelsLL1c0yhyqt79dvUSUq0jbMmyXHeUb9aNq3YIWsPVUFkv-kgvSsitqLQxxNsz_2oZwxlC5tdqgNFGQk_EhnB-8ZnWgUfHa4CwMzlefZD4gsoCJ7w/s400/IMG_0910.JPG" alt="" id="BLOGGER_PHOTO_ID_5661655890813293346" border="0" /></a><br /><span style="font-weight: bold;">Day 2</span><br />Headed towards Chipling Danda. But first we went all the way downhill to Chipling Phedi then a *tough* climb to Chipling Danda. Stayed there for a while for lunch and for much needed rest.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibSC_gnjHdsRjDI7aZG18MURvrILrDNtLhyphenhyphenanBLzl_xl3ZPg7xSyx3cZ5Kf47KJ80gNgn39NEXojSjPwTIzAlXOL2fepgpP7gwndhVZvUvM8g8DF19A1iu1W9mbv7YiufIV8UUeA/s1600/IMG_0944.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibSC_gnjHdsRjDI7aZG18MURvrILrDNtLhyphenhyphenanBLzl_xl3ZPg7xSyx3cZ5Kf47KJ80gNgn39NEXojSjPwTIzAlXOL2fepgpP7gwndhVZvUvM8g8DF19A1iu1W9mbv7YiufIV8UUeA/s400/IMG_0944.JPG" alt="" id="BLOGGER_PHOTO_ID_5661655897623242754" border="0" /></a><br />Then towards Kutumsang, the next stop. Not as tough climb as before but still it was all the way uphill. Finally reached Kutumsang. Had some noodles there.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsscxClLd2_Gu23VbjtFruyvJ5NlrBQhVEKW8PrHtwKKC6NMaLXkPzBePr3Jt5TQmXDyDDKX3YD2Lu7XzbV9x67ZCVH7iN_6Iav1Jx21WCzEPbmTsiKaieXU8ledWyWJom3xEMHw/s1600/IMG_0957.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsscxClLd2_Gu23VbjtFruyvJ5NlrBQhVEKW8PrHtwKKC6NMaLXkPzBePr3Jt5TQmXDyDDKX3YD2Lu7XzbV9x67ZCVH7iN_6Iav1Jx21WCzEPbmTsiKaieXU8ledWyWJom3xEMHw/s400/IMG_0957.JPG" alt="" id="BLOGGER_PHOTO_ID_5661655894279966994" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYrKzawtlVIEuATo4AN0cUftjRPpCEVUHoqO4rXjVB3qhLjeArKOdeI11SiMuF20UqT_fGbmETE89qL6wKGjE1r31rDKklDZuikyBrFlPfCUQrBVqHH9tIGP-l_dtc_VdmzHxaaQ/s1600/IMG_0983.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYrKzawtlVIEuATo4AN0cUftjRPpCEVUHoqO4rXjVB3qhLjeArKOdeI11SiMuF20UqT_fGbmETE89qL6wKGjE1r31rDKklDZuikyBrFlPfCUQrBVqHH9tIGP-l_dtc_VdmzHxaaQ/s400/IMG_0983.JPG" alt="" id="BLOGGER_PHOTO_ID_5661656816498882674" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3X8uv4_Xi9jtPPjXfWpxJ9zZ47txLaRAhzORrf5u2Sa25zOeTsoRRKPDEBr3gplwtxO4tnC_73s2m-vZpe9j9FFhbTJrOtMl98NX6YLWl9bbWMw-A0LL9tEEW8qh2IaSdygvPSg/s1600/IMG_0997.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3X8uv4_Xi9jtPPjXfWpxJ9zZ47txLaRAhzORrf5u2Sa25zOeTsoRRKPDEBr3gplwtxO4tnC_73s2m-vZpe9j9FFhbTJrOtMl98NX6YLWl9bbWMw-A0LL9tEEW8qh2IaSdygvPSg/s400/IMG_0997.JPG" alt="" id="BLOGGER_PHOTO_ID_5661656820070908674" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKyYaiBDSmbhhAeIQP1-2OXtJZ7-rHhNYkHHunpWPPfkcb2Mk7YbDo8QMw7ZPMQtblej1JfrB_T3-8Q2ybsrU6l9_l0d07TC4aponOupZTLYY4bGjxqNpXai-Wb9kUJDSnrT7d9Q/s1600/IMG_1004.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKyYaiBDSmbhhAeIQP1-2OXtJZ7-rHhNYkHHunpWPPfkcb2Mk7YbDo8QMw7ZPMQtblej1JfrB_T3-8Q2ybsrU6l9_l0d07TC4aponOupZTLYY4bGjxqNpXai-Wb9kUJDSnrT7d9Q/s400/IMG_1004.JPG" alt="" id="BLOGGER_PHOTO_ID_5661656819965841954" border="0" /></a><br />It was already getting late so we were in a dilemma whether to head towards Magengoth or not. But we still thought to give it a shot.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw8eODsIbkRRxwuxcs1zMqybA_6wMazkb106f6l11eUHTQauKCE8cWWQsEvYAMIM6hOLjPHmTHE2jfFNPMBl5ewc7xFlBFs92xJUhliKvJhWic3P3_zmSzqaaUzkv1aZoe9ZUWJA/s1600/IMG_1028.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw8eODsIbkRRxwuxcs1zMqybA_6wMazkb106f6l11eUHTQauKCE8cWWQsEvYAMIM6hOLjPHmTHE2jfFNPMBl5ewc7xFlBFs92xJUhliKvJhWic3P3_zmSzqaaUzkv1aZoe9ZUWJA/s400/IMG_1028.JPG" alt="" id="BLOGGER_PHOTO_ID_5661656823647200754" border="0" /></a><br />However we got caught on the way due to magnificent scenery of sunset along the way. By the time we were done taking snaps, it was already dark. Plus met a women who was the owner of a hotel at the next stop. Even she advised us to return back to Kutumsang.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgv0nuLajz0k4k08PmnWA4Tg2OAV6mhqITvePT-v5q49FK4pcK84yL-KZJNwWZbExwVG2IXQZDlQZNBNaFJGdF6MFpktOIsG-JI4wHPZQ8orMl0lOc2qdhW382Wo84KdBDHDxPQ9w/s1600/IMG_1068.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgv0nuLajz0k4k08PmnWA4Tg2OAV6mhqITvePT-v5q49FK4pcK84yL-KZJNwWZbExwVG2IXQZDlQZNBNaFJGdF6MFpktOIsG-JI4wHPZQ8orMl0lOc2qdhW382Wo84KdBDHDxPQ9w/s400/IMG_1068.JPG" alt="" id="BLOGGER_PHOTO_ID_5661656825576004802" border="0" /></a><br />Night at Kutumsang. Elevation: <span style="font-weight: bold;">3630m</span><br /><br /><span style="font-weight: bold;">Day 3:</span><br />Chilly morning, but the cute little daughter of the owner of the hotel made it interesting. She was perky, talkative and fun.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVdLPKMJcjyz7EB9yxTbSTM6_d9YPH8lSFCIIsdnXsbvFRy8-W2ZE9WQAuQSaFzkL_P3bu_uYrVxWvI0EVwCM62L_qbg95VIOyo_wbpKgRd5lNRP9qJEslHTYPHa38Th_hxhZUDw/s1600/IMG_1126.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVdLPKMJcjyz7EB9yxTbSTM6_d9YPH8lSFCIIsdnXsbvFRy8-W2ZE9WQAuQSaFzkL_P3bu_uYrVxWvI0EVwCM62L_qbg95VIOyo_wbpKgRd5lNRP9qJEslHTYPHa38Th_hxhZUDw/s400/IMG_1126.JPG" alt="" id="BLOGGER_PHOTO_ID_5661661247890526306" border="0" /></a><br />After breakfast we headed towards Magengoth. And it was tough climb. Took 3 hours to reach there. Rested for a while and we had Dhido there, which I regretted as the curry was too chilly and burned my stomach later.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrLPBQeSuh-nGDAiyRCwLpA6_fkQhpZXrv5zRfBdqVJPT43KXpCftCaLJ6eCQB-8gOZgRiFzOd21bhssVFMgFWtHNnxhsEROFeS8nczFFZMMgHq-gP5X_VT32igFV1hO2mXHLZAQ/s1600/IMG_1135.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 267px; height: 400px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrLPBQeSuh-nGDAiyRCwLpA6_fkQhpZXrv5zRfBdqVJPT43KXpCftCaLJ6eCQB-8gOZgRiFzOd21bhssVFMgFWtHNnxhsEROFeS8nczFFZMMgHq-gP5X_VT32igFV1hO2mXHLZAQ/s400/IMG_1135.JPG" alt="" id="BLOGGER_PHOTO_ID_5661661247344871618" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6EpfDEL3j76_J8Y4YOJ60EQvIhHyYE89l5seje_NPlKgAgUa_NaTNVqrnlSm59a_cvaThHRNmc7lfHtwxSN_SJKdiXIB8pkBp0UKSTpf8J7sPMVRNvlxU5uno5ph0QhGQqbQgnw/s1600/IMG_1138.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6EpfDEL3j76_J8Y4YOJ60EQvIhHyYE89l5seje_NPlKgAgUa_NaTNVqrnlSm59a_cvaThHRNmc7lfHtwxSN_SJKdiXIB8pkBp0UKSTpf8J7sPMVRNvlxU5uno5ph0QhGQqbQgnw/s400/IMG_1138.JPG" alt="" id="BLOGGER_PHOTO_ID_5661661254329798466" border="0" /></a><br />Headed off to Tharepati then. Little elevated road but not that tough. Took 2 and half hour to reach there. The view of the mountains was supposed to be amazing from there, but unfortunately it was raining when we reached there. Stopped by a hotel there and had some tea.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs6_2ROLrrqRsYwqZV-DXT1OOmjeG8lX6_Iccqt8BLZ-1O3oVMIZIwl4Rdjbj4BgkIAJi-R8Itss3Qbv_e94h9c3PNDtBGRtNi6Dl60YjOS4VGjurN2-IhtDN3PWtvlVoEACKv7w/s1600/IMG_1144.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs6_2ROLrrqRsYwqZV-DXT1OOmjeG8lX6_Iccqt8BLZ-1O3oVMIZIwl4Rdjbj4BgkIAJi-R8Itss3Qbv_e94h9c3PNDtBGRtNi6Dl60YjOS4VGjurN2-IhtDN3PWtvlVoEACKv7w/s400/IMG_1144.JPG" alt="" id="BLOGGER_PHOTO_ID_5661661252339530946" border="0" /></a><br />Then off to Ghopte. The trail was all the way downhill and rocky. It was so steep we wondered how the trekkers taking the opposite route would climb that. On the way you come across a spring and a giant boulder you cannot miss.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2hT9t5GBzGa-_WfpvaUj98KuZqNdKb4mjsr6gf2dCAzeYvciqZCR-IG_LKX-upnDdGmejdeWlaOldV6iyzVkbb0hncS_eRJFZAqDnnVL8WNkhxtaUt9iMnOw5IQGf0foP6gMQaA/s1600/IMG_1155.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2hT9t5GBzGa-_WfpvaUj98KuZqNdKb4mjsr6gf2dCAzeYvciqZCR-IG_LKX-upnDdGmejdeWlaOldV6iyzVkbb0hncS_eRJFZAqDnnVL8WNkhxtaUt9iMnOw5IQGf0foP6gMQaA/s400/IMG_1155.JPG" alt="" id="BLOGGER_PHOTO_ID_5661664810061773874" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZbHp3iya9a3dyJcd-hLKGr9ZbEwlnLABWfIIG6-y0P-lpfGXKvXoE-LAvym9v9mq59McJDLA6TdHe52P9mCsjjVzlEEP4iy-cMMTQeF1HfsSf1G3H4UqPHcCBmAjpnzr6jKe-AA/s1600/IMG_1153.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZbHp3iya9a3dyJcd-hLKGr9ZbEwlnLABWfIIG6-y0P-lpfGXKvXoE-LAvym9v9mq59McJDLA6TdHe52P9mCsjjVzlEEP4iy-cMMTQeF1HfsSf1G3H4UqPHcCBmAjpnzr6jKe-AA/s400/IMG_1153.JPG" alt="" id="BLOGGER_PHOTO_ID_5661661257969389586" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL2ii36uUt3R6MArtV6r0ZfeU9kGGEgZ7of_xod046_u7_YG6N-ep3GnTBTLPRFTUihtbFWqjKo33m3GGwLvIQLbigWyniVTiMeMgxAGp7Q2VRzWYTyf4vuXJdUaxl1k_pwq25rQ/s1600/IMG_1163.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 267px; height: 400px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL2ii36uUt3R6MArtV6r0ZfeU9kGGEgZ7of_xod046_u7_YG6N-ep3GnTBTLPRFTUihtbFWqjKo33m3GGwLvIQLbigWyniVTiMeMgxAGp7Q2VRzWYTyf4vuXJdUaxl1k_pwq25rQ/s400/IMG_1163.JPG" alt="" id="BLOGGER_PHOTO_ID_5661664807725840130" border="0" /></a><br />Finally Ghopte. Had no energy to move beyond. Elevation:<span style="font-weight: bold;"> 3430m</span><br /><span style="font-weight: bold;"><br />Day 4:</span><br />Chilly and shivering night. We moved early in the morning. What was ahead was perhaps the toughest road we've encountered so far.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4iA-jWbFsjn3htQcc8VFDcQDGKKtG9tUKog4RHYoExKieYx-NBRZOgNdXvuTMhTVmCI6jxrq9kHRZGXQojJfreOtXesL7yy6pJEMgsxuHcLjZDs3Wv_Mw0fRVe-4A1DhoVISLfQ/s1600/IMG_1168.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4iA-jWbFsjn3htQcc8VFDcQDGKKtG9tUKog4RHYoExKieYx-NBRZOgNdXvuTMhTVmCI6jxrq9kHRZGXQojJfreOtXesL7yy6pJEMgsxuHcLjZDs3Wv_Mw0fRVe-4A1DhoVISLfQ/s400/IMG_1168.JPG" alt="" id="BLOGGER_PHOTO_ID_5661664812838810306" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizGhYH6CwjmjzsArMXkm-oM88qU6YOVOsx4q5H04Xw17LB0kX0044aPiSkx3NbpUuEdcA1KJzJSvS6KX5j8iurTZoESE0PfIDsA7g4jO_08FhP4HPw77mgIynKLk9RW0-m8mRtsQ/s1600/IMG_1183.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizGhYH6CwjmjzsArMXkm-oM88qU6YOVOsx4q5H04Xw17LB0kX0044aPiSkx3NbpUuEdcA1KJzJSvS6KX5j8iurTZoESE0PfIDsA7g4jO_08FhP4HPw77mgIynKLk9RW0-m8mRtsQ/s400/IMG_1183.JPG" alt="" id="BLOGGER_PHOTO_ID_5661664813249719554" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQPI8VDcIUAr0Xw1I-1ay4xS5txxM24a-hSeIG3EBifHiF_0w-PlwTXyzxs74KwIF06_odvSvlHXlek-vzJxFUzbFXbxZS1VPBG2l3uqG6OFxoioLXFnBU5h3x4alDjZ9H0iT70A/s1600/IMG_1197.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 267px; height: 400px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQPI8VDcIUAr0Xw1I-1ay4xS5txxM24a-hSeIG3EBifHiF_0w-PlwTXyzxs74KwIF06_odvSvlHXlek-vzJxFUzbFXbxZS1VPBG2l3uqG6OFxoioLXFnBU5h3x4alDjZ9H0iT70A/s400/IMG_1197.JPG" alt="" id="BLOGGER_PHOTO_ID_5661664825935050178" border="0" /></a><br />Ghopte to Laurebina Phedi was a series of tough ups and downs. The hotels at phedi are visible from quite a distance, but it took us almost 3 hours to reach there. Even the pass at the top starts being visible, but is yet too far.<br /><br />Finally reached Laurebina Phedi (elevation: 3700m). Had some lunch and prepped for the final climb. We were climbing upto 4700m next so had the garlics and chocolates ready. It was supposed to take us 3-4 hours to climb. And if we're not careful enough, we might even catch altitude sickness!<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNbb8D0dMhweE6uPidUkNwv-YyWDiv1fVEFkCD17ZAxQWYFP2pX73svJWFyh7CvK_LvZ4Zgw3OcPF5u43e-93xyuRd1WJEKbjZGpfRd8K69tpl29_qOrvxyEkyKY4-OvUX_wtdMw/s1600/IMG_1199.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNbb8D0dMhweE6uPidUkNwv-YyWDiv1fVEFkCD17ZAxQWYFP2pX73svJWFyh7CvK_LvZ4Zgw3OcPF5u43e-93xyuRd1WJEKbjZGpfRd8K69tpl29_qOrvxyEkyKY4-OvUX_wtdMw/s400/IMG_1199.JPG" alt="" id="BLOGGER_PHOTO_ID_5661665912920841794" border="0" /></a><br />Toughest climb so far! The landscape started changing rapidly, from greenish to barren rocks. Even noticed Danphe (Lophophorus) along the way. And since the air was getting thinner, it was a slow and steady climb. Sounds of own footsteps, long breaths and wilderness. Thankfully the air was misty. Also met couple of tourists returning from the pass. Stopped by a hotel along the way for some tea! Cant believe there was a hotel in that altitude (4100m). The owner was extremely nice and the tea was cheap.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8vLWD7m7y_OK2ZrHBljbEtdw3XH77PhaZBhyphenhyphenIou1k11xucHr13jYsQFNlsFB8DUgNHq4TEilL2jhnU9t4SJ9qM-wApVaTkUJ_hU1SVJ2osSaIgvl9_n8ECWACKGmJ7u6i8rUK5w/s1600/IMG_1218.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8vLWD7m7y_OK2ZrHBljbEtdw3XH77PhaZBhyphenhyphenIou1k11xucHr13jYsQFNlsFB8DUgNHq4TEilL2jhnU9t4SJ9qM-wApVaTkUJ_hU1SVJ2osSaIgvl9_n8ECWACKGmJ7u6i8rUK5w/s400/IMG_1218.JPG" alt="" id="BLOGGER_PHOTO_ID_5661665917535692530" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifQuFFoTllf8O7t3YdORanJgDpR_QU-ILzE53QY2oSngbEWXYo2h3J4isWFQqdgwbI1vWCmcJNN-BL6gsz-FfzW1RsKkIUv2PqedqhrvcWNUf7XSF9R4C3RIyDUYvrFrDGHMvSDQ/s1600/IMG_1220.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifQuFFoTllf8O7t3YdORanJgDpR_QU-ILzE53QY2oSngbEWXYo2h3J4isWFQqdgwbI1vWCmcJNN-BL6gsz-FfzW1RsKkIUv2PqedqhrvcWNUf7XSF9R4C3RIyDUYvrFrDGHMvSDQ/s400/IMG_1220.JPG" alt="" id="BLOGGER_PHOTO_ID_5661665916406461074" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXc7-kSof2bl8-y1vkWehzdsL7npkCD_BXL8Gw8HjdN5waXaS4PkMbHB7ilzJaBo9B46MmnBXiU0w1UfsnTvYxXyilTnrEjTq2K3m8EbbCoPUqw82hciGChL_W1tDcVzzIvb7Sqg/s1600/IMG_1226.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXc7-kSof2bl8-y1vkWehzdsL7npkCD_BXL8Gw8HjdN5waXaS4PkMbHB7ilzJaBo9B46MmnBXiU0w1UfsnTvYxXyilTnrEjTq2K3m8EbbCoPUqw82hciGChL_W1tDcVzzIvb7Sqg/s400/IMG_1226.JPG" alt="" id="BLOGGER_PHOTO_ID_5661665921639011810" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilFMPfwDriHETHPOgO-dStDXLZpJa60UBclpNU2ByK-eZypS0TwAosCciDpYDLUFLepkRWneQM5iTJg0Ezojtp1mdo0KHT-ULmRHIn4CRiKViYmZZa80r562axaVek5eUQ2r1auw/s1600/IMG_1249.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilFMPfwDriHETHPOgO-dStDXLZpJa60UBclpNU2ByK-eZypS0TwAosCciDpYDLUFLepkRWneQM5iTJg0Ezojtp1mdo0KHT-ULmRHIn4CRiKViYmZZa80r562axaVek5eUQ2r1auw/s400/IMG_1249.JPG" alt="" id="BLOGGER_PHOTO_ID_5661667538538681090" border="0" /></a><br />Started walking again. We all started getting headache due to cold and altitude. Finally reached the top. Frozen snow of the mountain!! And all of a sudden, the sky cleared up and it was sunny. Played with snow and took lots of photographs. Then crossed the pass (~4700m)!<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2VLksMujzokSOjgaEZYpcHeRUawgqc36tamZ8V-AQrg0Q-_vREFyezZwOnuyw5nLcuIuQ7cZZVkABeIJLMKxuCFBT315RlFZlkgviQayqA0izNT80uNw5iuG99FiwQoh0yQcV2Q/s1600/IMG_1263.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2VLksMujzokSOjgaEZYpcHeRUawgqc36tamZ8V-AQrg0Q-_vREFyezZwOnuyw5nLcuIuQ7cZZVkABeIJLMKxuCFBT315RlFZlkgviQayqA0izNT80uNw5iuG99FiwQoh0yQcV2Q/s400/IMG_1263.JPG" alt="" id="BLOGGER_PHOTO_ID_5661667548730078146" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFM2_4zC7gqzcvUT_pzQZ5p5SolPy_vqYaRbkP5uBjR-OH7Si4v5AMsu0ewT-Y0Sxd7uW2Od4L-SdnfHsEZAqkYriVQdEEONyERHhmEQjThkgR9JRE_yyU_7iXvxVxYlQKXNTJTw/s1600/IMG_1260.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFM2_4zC7gqzcvUT_pzQZ5p5SolPy_vqYaRbkP5uBjR-OH7Si4v5AMsu0ewT-Y0Sxd7uW2Od4L-SdnfHsEZAqkYriVQdEEONyERHhmEQjThkgR9JRE_yyU_7iXvxVxYlQKXNTJTw/s400/IMG_1260.JPG" alt="" id="BLOGGER_PHOTO_ID_5661667543630608354" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIa0798ID5z8SCOOWX5LtHInGzRowFZTuz7TfMW8JIQ3ITwyGfcXh8db21jq7Gw4UCPfnPesUKkBmBkfmoJsz6WN0pajeXIe13DZhCsFEjx52_viYQ-IJ_G2eJA4N3-xn3kYJB4Q/s1600/IMG_1251.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIa0798ID5z8SCOOWX5LtHInGzRowFZTuz7TfMW8JIQ3ITwyGfcXh8db21jq7Gw4UCPfnPesUKkBmBkfmoJsz6WN0pajeXIe13DZhCsFEjx52_viYQ-IJ_G2eJA4N3-xn3kYJB4Q/s400/IMG_1251.JPG" alt="" id="BLOGGER_PHOTO_ID_5661667545777125218" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZr1OMRYAPrkAPKbk9y6bHykw3hje-qPIdl2k-z-Dtg8cCh7o0ADf2MQENhlRAGIfmvcS6TjdftsEd5BThvgk66oQTEQq4XMeFPl8mk-ZBu9iTQLvqXX14_hHDeMNhBCumsEx6Jw/s1600/IMG_1265.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZr1OMRYAPrkAPKbk9y6bHykw3hje-qPIdl2k-z-Dtg8cCh7o0ADf2MQENhlRAGIfmvcS6TjdftsEd5BThvgk66oQTEQq4XMeFPl8mk-ZBu9iTQLvqXX14_hHDeMNhBCumsEx6Jw/s400/IMG_1265.JPG" alt="" id="BLOGGER_PHOTO_ID_5661667552175185490" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxN5bt_ifmgNQ7bC9ssYDS58Xa2k38e2z4_ovNK2JmL9y4F8XWCtIVQGrNmQ0TL8pB0Daz17TBPY1opwdQgz5ef4FESVdUB0XiCorxOhJhmRYYJ4vE0yCGcTU_XLLwZQCy8zOQdw/s1600/IMG_1268.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxN5bt_ifmgNQ7bC9ssYDS58Xa2k38e2z4_ovNK2JmL9y4F8XWCtIVQGrNmQ0TL8pB0Daz17TBPY1opwdQgz5ef4FESVdUB0XiCorxOhJhmRYYJ4vE0yCGcTU_XLLwZQCy8zOQdw/s400/IMG_1268.JPG" alt="" id="BLOGGER_PHOTO_ID_5661668608421038354" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfVNPzP7ra0olV_yUPgqIbvpoUdtktWro2eFUY9O9NlHMp2J9ifJb6QAMBCQyf3vUBodCJZq-6bVg4kyMH3QymAqPnxqr6mUJUQkn1AAHDNyehEixmzSkqbHNBTGenkF9mv2H9MA/s1600/IMG_1273.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfVNPzP7ra0olV_yUPgqIbvpoUdtktWro2eFUY9O9NlHMp2J9ifJb6QAMBCQyf3vUBodCJZq-6bVg4kyMH3QymAqPnxqr6mUJUQkn1AAHDNyehEixmzSkqbHNBTGenkF9mv2H9MA/s400/IMG_1273.JPG" alt="" id="BLOGGER_PHOTO_ID_5661668611672603554" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIwlWwpNPW6NAq3djLfWuRXK137He5hh4QY5ikUUWUZUDFNVED9h8gsXl0Y2n8ocvkHH7tjFz8pG-6fDWODOTSggGPpoh3Lgldi3gJT7wXLAi-oLs22pe_3bcMwD7I95YZLa3aqQ/s1600/IMG_1270.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIwlWwpNPW6NAq3djLfWuRXK137He5hh4QY5ikUUWUZUDFNVED9h8gsXl0Y2n8ocvkHH7tjFz8pG-6fDWODOTSggGPpoh3Lgldi3gJT7wXLAi-oLs22pe_3bcMwD7I95YZLa3aqQ/s400/IMG_1270.JPG" alt="" id="BLOGGER_PHOTO_ID_5661668608033992002" border="0" /></a><br />Then another wonder happened. As soon as we crossed the pass, it got cloudy again and it started snowing!! Amidst the snowfall, we walked along Surya Kunda (lake), Ganesh Kunda and several others. Finally reached Gosaikunda. It goes without saying, the lake and surrounding is beautiful.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGF9AgLTTxZWKCl4-Hx_dvkqAlll_VvCAZXjOSqrfK-Ou1ho6ir5WVj1k6kcXbK3DCCjXQFv-mjkzjHxtWPexx-zSdduprW4Ls0TMDJufRv_m9OXjZFUyUKRKYJMUEF5xdMoWGMA/s1600/IMG_1275.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGF9AgLTTxZWKCl4-Hx_dvkqAlll_VvCAZXjOSqrfK-Ou1ho6ir5WVj1k6kcXbK3DCCjXQFv-mjkzjHxtWPexx-zSdduprW4Ls0TMDJufRv_m9OXjZFUyUKRKYJMUEF5xdMoWGMA/s400/IMG_1275.JPG" alt="" id="BLOGGER_PHOTO_ID_5661668614415194450" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD8G0MmaRT83wA9JMHmvAX4-QF-JNheodGpavMKv3rW0FG9V4zpOqg6mXXyK95pmPkoWYkt5XZ4taDJhaoZYpUsHwKhMhoI9dsVsUkVKC6vLUcYtltd87K99zqZHcqtnXaDI5Z4w/s1600/IMG_1282.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD8G0MmaRT83wA9JMHmvAX4-QF-JNheodGpavMKv3rW0FG9V4zpOqg6mXXyK95pmPkoWYkt5XZ4taDJhaoZYpUsHwKhMhoI9dsVsUkVKC6vLUcYtltd87K99zqZHcqtnXaDI5Z4w/s400/IMG_1282.JPG" alt="" id="BLOGGER_PHOTO_ID_5661668616612032354" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHSygs2qo6IqqBKkR_yAJ_P94Nd6tmanFC8XtoUi1Ph7A0T9CMUZzGLo8LhD0-JYbkCFbfvQY2tnyNlS6kNSSFfAqRGs_u7N5X8ixNa1QoRpqYaEiVi16ihUGoK6fyy8avEcIxzA/s1600/IMG_1287.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHSygs2qo6IqqBKkR_yAJ_P94Nd6tmanFC8XtoUi1Ph7A0T9CMUZzGLo8LhD0-JYbkCFbfvQY2tnyNlS6kNSSFfAqRGs_u7N5X8ixNa1QoRpqYaEiVi16ihUGoK6fyy8avEcIxzA/s400/IMG_1287.JPG" alt="" id="BLOGGER_PHOTO_ID_5661669293209295154" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip9VEaJtC-qKmgxBVdibIVyT8472IsumsE7oGxIYP3poHGa9SVHCcYzOA6HsKZ60r40_zuwXrOaMXXEBYxBLs_pHHACxfk9ThAJw89qVhJ4SPRfCP-OsWPERUBolfDj33lelWoXw/s1600/IMG_1291.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip9VEaJtC-qKmgxBVdibIVyT8472IsumsE7oGxIYP3poHGa9SVHCcYzOA6HsKZ60r40_zuwXrOaMXXEBYxBLs_pHHACxfk9ThAJw89qVhJ4SPRfCP-OsWPERUBolfDj33lelWoXw/s400/IMG_1291.JPG" alt="" id="BLOGGER_PHOTO_ID_5661669292829868050" border="0" /></a><br />Stayed for the night there. Elevation: <span style="font-weight: bold;">4300m</span><br /><br /><span style="font-weight: bold;">Day 5:</span><br />Took a lot of snaps around Gosaikunda early in the morning. Some breakfast and then headed towards Dhunche, all the way downhill.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji5d-eSYiE7yi7REXg8HdxmQ4T8Vn703Z6mO6M2rVO2a_St1zGbHNTkzJA65IDm2Kxia4zQL8kyCwjhWCuf4QLJ-2g-BFIiPdRDge61VKH7ACkK8Oiz8ZFVtFaQETDjViDPY7N9A/s1600/IMG_1364.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji5d-eSYiE7yi7REXg8HdxmQ4T8Vn703Z6mO6M2rVO2a_St1zGbHNTkzJA65IDm2Kxia4zQL8kyCwjhWCuf4QLJ-2g-BFIiPdRDge61VKH7ACkK8Oiz8ZFVtFaQETDjViDPY7N9A/s400/IMG_1364.JPG" alt="" id="BLOGGER_PHOTO_ID_5661669295693221410" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPehzKXFBhpyT1avsJrwsmX3QjuDP8lKrVvfzkqOarb1Z8ccQ_KRJTtkIwuAB9voJ5uBF019Ka_9KXR66lwYgJQW_HXYckdfnEImUqg8X94qidkVd7Ph5XWXgiK7lkSlwGF4K-cw/s1600/IMG_1306.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPehzKXFBhpyT1avsJrwsmX3QjuDP8lKrVvfzkqOarb1Z8ccQ_KRJTtkIwuAB9voJ5uBF019Ka_9KXR66lwYgJQW_HXYckdfnEImUqg8X94qidkVd7Ph5XWXgiK7lkSlwGF4K-cw/s400/IMG_1306.JPG" alt="" id="BLOGGER_PHOTO_ID_5661669297230945106" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh93gg8Jd8Qpm1omv2kZTUDi9kIfrgFU6q3crpBhMCrBlQyuegSfzA-3kKjSPZaGgEHz57w1Pc_SbOJH4pstoAxXdA_nQ8cvhYdftWoJN9wbtghEfQGvtDD8d1YQBoGgsxw5Le7PQ/s1600/IMG_1386.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh93gg8Jd8Qpm1omv2kZTUDi9kIfrgFU6q3crpBhMCrBlQyuegSfzA-3kKjSPZaGgEHz57w1Pc_SbOJH4pstoAxXdA_nQ8cvhYdftWoJN9wbtghEfQGvtDD8d1YQBoGgsxw5Le7PQ/s400/IMG_1386.JPG" alt="" id="BLOGGER_PHOTO_ID_5661669296206526130" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXy_xmcrYYcvHwS3nhKRdE2MXHmvi2N_yCGY3z5Meb9d10f1CDyMZZmygmy2t-LLRYzG_CmbjNh9TGsEqaRn13hI7Tg27vU7wZW6Y30H0jrXY4cSLoYm2e7TSSWI5lQe8hba5KzQ/s1600/IMG_1405.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXy_xmcrYYcvHwS3nhKRdE2MXHmvi2N_yCGY3z5Meb9d10f1CDyMZZmygmy2t-LLRYzG_CmbjNh9TGsEqaRn13hI7Tg27vU7wZW6Y30H0jrXY4cSLoYm2e7TSSWI5lQe8hba5KzQ/s400/IMG_1405.JPG" alt="" id="BLOGGER_PHOTO_ID_5661669982720851346" border="0" /></a><br />Took us a whole day to reach Dhunche via Laurebinayak and Sing Gompa. Having walked uphill for 4 days, the downhill walk was knee-aching. Reached Dhunche in the evening. Elevation:<span style="font-weight: bold;"> 1950m!</span><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFsnmNTpxIIHoMSQ8n8mMZW4xOLVmq3kdDmQByYcV-ZoZe04u2OII2jhsDKKTgVzmko_sd4OPhTH11cStC_ShVFcOQ4jMjhc3RTuSqSdFA8nn5ziuDL9-5n84JCAoOcJWsMfvarw/s1600/IMG_1423.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFsnmNTpxIIHoMSQ8n8mMZW4xOLVmq3kdDmQByYcV-ZoZe04u2OII2jhsDKKTgVzmko_sd4OPhTH11cStC_ShVFcOQ4jMjhc3RTuSqSdFA8nn5ziuDL9-5n84JCAoOcJWsMfvarw/s400/IMG_1423.JPG" alt="" id="BLOGGER_PHOTO_ID_5661669982645545730" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji1F5aMhaqxdzob04DJqKx2qekAHjjOokp5N6QZjVL0BAZBQsSYecHqQBfUK7OTSpqVrHsxs6qbaIRMqc7CxL4fyH7m75EbAApz_U8HxZ401Jzl67POsUlpzs7L9ZrTigmhMWd5A/s1600/IMG_1425.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji1F5aMhaqxdzob04DJqKx2qekAHjjOokp5N6QZjVL0BAZBQsSYecHqQBfUK7OTSpqVrHsxs6qbaIRMqc7CxL4fyH7m75EbAApz_U8HxZ401Jzl67POsUlpzs7L9ZrTigmhMWd5A/s400/IMG_1425.JPG" alt="" id="BLOGGER_PHOTO_ID_5661669989013416082" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvzsuV6PnodBYmJNeiLijeSj8txJECPy5FIErAGIgDmwoF-bfbIS5l49AN7Q6GlMoBg7K2Ezxbd_a_NNRUvBzSXdpUW9vUnkNNApFsxYN4FxpS41V75w5PEXw1Hn8m9n0ciKLS9Q/s1600/IMG_1438.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvzsuV6PnodBYmJNeiLijeSj8txJECPy5FIErAGIgDmwoF-bfbIS5l49AN7Q6GlMoBg7K2Ezxbd_a_NNRUvBzSXdpUW9vUnkNNApFsxYN4FxpS41V75w5PEXw1Hn8m9n0ciKLS9Q/s400/IMG_1438.JPG" alt="" id="BLOGGER_PHOTO_ID_5661669987378962994" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfl-cbKe0BGP8loNAU-PKpHBJ95FOBVI8ePN4xvKqJmtF4YvQ-Aak4xFH6jn6IsWSusiylDKg2UcJ376HM3O-6tprLqSc-gBZpQbEca7BtqRaoh0Y72A3Myj4Mujn039BH_QucRw/s1600/IMG_1449.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfl-cbKe0BGP8loNAU-PKpHBJ95FOBVI8ePN4xvKqJmtF4YvQ-Aak4xFH6jn6IsWSusiylDKg2UcJ376HM3O-6tprLqSc-gBZpQbEca7BtqRaoh0Y72A3Myj4Mujn039BH_QucRw/s400/IMG_1449.JPG" alt="" id="BLOGGER_PHOTO_ID_5661669993211090866" border="0" /></a><br />We were supposed to stay there for the night and return Kathmandu the other day, but due to festive season the buses were hard to get. Fortunately we got a jeep returning back to Kathmandu and we jumped in. Returning Kathmandu the same day (although hurriedly) seemed wiser to us than staying there for the night and getting lost the next day)<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRewt4Jic5hB9C1cR6a8mzFT6kALZwwy-lGOb9lyU13FL6w6aKMI2FbRNkNBndolHszt9CzniSHRHfRM4v_XSQtayyB3EHVJtqHPxzRc0AwjJhyphenhyphenFOBPIS8VEIQxxOov8hpvrJAZg/s1600/IMG_1484.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRewt4Jic5hB9C1cR6a8mzFT6kALZwwy-lGOb9lyU13FL6w6aKMI2FbRNkNBndolHszt9CzniSHRHfRM4v_XSQtayyB3EHVJtqHPxzRc0AwjJhyphenhyphenFOBPIS8VEIQxxOov8hpvrJAZg/s400/IMG_1484.JPG" alt="" id="BLOGGER_PHOTO_ID_5661670589768693426" border="0" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFnfQsRvc_vz4oMaf0gdkD1w4AVOsuHw2pUUIPzs_I8rCjzKciRgJXjXvwBR6TT9D5hnQx2XxsOIbFADnIK03VxiN5sBcIpctSq6_A1VY30t5iGSZDS29fWcgpbmjVnmuQQTfIRw/s1600/IMG_1505.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFnfQsRvc_vz4oMaf0gdkD1w4AVOsuHw2pUUIPzs_I8rCjzKciRgJXjXvwBR6TT9D5hnQx2XxsOIbFADnIK03VxiN5sBcIpctSq6_A1VY30t5iGSZDS29fWcgpbmjVnmuQQTfIRw/s400/IMG_1505.JPG" alt="" id="BLOGGER_PHOTO_ID_5661670592631445058" border="0" /></a>Reached Kathmandu by 10pm. <span style="font-weight: bold;">Elevation: 1400m</span> :)<br /><br /><span style="font-weight: bold;">Other Useful Links:</span><br />1. Few photos on Flickr: <a href="http://www.flickr.com/photos/jwalanta/sets/72157627858559272/">http://www.flickr.com/photos/jwalanta/sets/72157627858559272/</a><br />2. Map: <a href="http://www.explore-himalaya.com/photo%20gallery/maps/lantang_&-Helumbu-trek.jpg">http://www.explore-himalaya.com/photo%20gallery/maps/lantang_&-Helumbu-trek.jpg</a> (although I suggest you buy a paper map with contours and all, if you're planning to trek)<br />3. Detail Guide: <a href="http://www.yetizone.com/Langtang/Trek/langtang_trek.shtml">http://www.yetizone.com/Langtang/Trek/langtang_trek.shtml</a>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com13tag:blogger.com,1999:blog-31851025.post-75180932869559100962011-09-11T06:59:00.011+05:452011-09-13T08:59:56.734+05:45Reprojection to EPSG:900913 using MapServer<div dir="ltr" style="text-align: left;" trbidi="on">If you are embedding a map on some web page (read: <a href="http://openlayers.org/">OpenLayers</a>) and need to add layers from some third party GIS server, you're most likely to come across the word "Mercator" and its myriads of standards. Web based mapping services use Spherical Mercator, however commercial GIS services (like, <a href="http://www.esri.com/">Esri</a>) might use some other standards like EPSG:4326. This incompatibility leads to a lot of trouble as OpenLayers only accepts Spherical Mercator.<br /><div dir="ltr" style="text-align: left;" trbidi="on"><br />From <a href="http://docs.openlayers.org/library/spherical_mercator.html">OpenLayers Docs</a>:<br /><blockquote>Spherical Mercator is a de facto term used inside the OpenLayers community – and also the other existing Open Source GIS community – to describe the projection used by Google Maps, Microsoft Virtual Earth, Yahoo Maps, and other commercial API providers.<br /><br />This term is used to refer to the fact that these providers use a Mercator projection which treats the earth as a sphere, rather than a projection which treats the earth as an ellipsoid. This affects calculations done based on treating the map as a flat plane, and is therefore important to be aware of when working with these map providers.<br /><br />In order to properly overlay data on top of the maps provided by the commerical API providers, it is neccesary to use this projection. This applies primarily to displaying raster tiles over the commercial API layers – such as TMS, WMS, or other similar tiles.<br /><br />In order to work well with the existing commercial APIs, many users who create data designed for use within Google Maps will also use this projection. One prime example is OpenStreetMap, whose raster map tiles are all projected into the ‘spherical mercator’ projection.<br /><br />Projections in GIS are commonly referred to by their “EPSG” codes, identifiers managed by the European Petroleum Survey Group. One common identifier is “EPSG:4326”, which describes maps where latitude and longitude are treated as X/Y values. Spherical Mercator has an official designation of EPSG:3857. However, before this was established, a large amount of software used the identifier EPSG:900913. This is an unofficial code, but is still the commonly used code in OpenLayers. Any time you see the string “EPSG:4326”, you can assume it describes latitude/longitude coordinates. Any time you see the string “EPSG:900913”, it will be describing coordinates in meters in x/y.</blockquote><br />If you are to overlay third party GIS layer, which is not in spherical mercator, you'll have to reproject the layer.<br /><blockquote>One of the reasons that the Spherical Mercator projection is so important is that it is the only projection which will allow for overlaying image data on top of commercial layers like Google Maps correctly. When using raster images, in the browser, it is not possible to reproject the images in the same way it might be in a ‘thick’ GIS client. Instead, all images must be in the same projection.</blockquote><br />There are several tools for reprojection, but the popular (and free) one is <a href="http://mapserver.org/">MapServer</a>. The process is <a href="http://docs.openlayers.org/library/spherical_mercator.html#creating-spherical-mercator-raster-images">explained here</a>. The process works like this:<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYnD3Mn4R2qqiFbJ4r7eG2bh6zoqyA3zZgDWh5-_nRvdr7v9g-4TXMDkLFgHzMdIDE_jg1RmK-TqlJsS45mRqNJnDHvbI2aoeKQw4PD2bDoFIQ3IKFquxsCRmgt1ufQhkOMMcvdw/"><img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYnD3Mn4R2qqiFbJ4r7eG2bh6zoqyA3zZgDWh5-_nRvdr7v9g-4TXMDkLFgHzMdIDE_jg1RmK-TqlJsS45mRqNJnDHvbI2aoeKQw4PD2bDoFIQ3IKFquxsCRmgt1ufQhkOMMcvdw/" style="cursor: hand; cursor: pointer; display: block; height: 142px; margin: 0px auto 10px; text-align: center; width: 471px;" border="0" /></a><span style="font-weight: bold;">However this doesn't work.</span> It turned out, MapServer doesn't reproject to 900913 properly (even after adding the 900913 reprojection line to /usr/share/proj/epsg). Maybe a bug.<br /><br />So here's the hack: MapServer does reproject to EPSG:3857. But EPSG:3857 and EPSG:900913 are same thing. So we need to write an intermediate proxy which takes WMS request for 900913, replaces the 900913 to 3857 in the WMS request URL and redirects the request to MapServer.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjsVYQyUKleNhiyjX2Q6pU-EQCfwBcYsLNhbjZbtTYdVPo00BJUu-Sn1nEzz1_nPItIiTgki3Dr9zew-50mVmCHW5dPveKFdtfPprc6F_t_FMGo0NAxqBJ7zDyM5twUKYui9dALw/"><img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjsVYQyUKleNhiyjX2Q6pU-EQCfwBcYsLNhbjZbtTYdVPo00BJUu-Sn1nEzz1_nPItIiTgki3Dr9zew-50mVmCHW5dPveKFdtfPprc6F_t_FMGo0NAxqBJ7zDyM5twUKYui9dALw/" style="cursor: hand; cursor: pointer; display: block; height: 255px; margin: 0px auto 10px; text-align: center; width: 477px;" border="0" /></a>Here's the PHP script (reproject.php) to act as proxy:<br /><br /><code><?php<br />header("Location: http://{mapserver_address}/cgi-bin/mapserv?" . str_ireplace("epsg%3A900913","epsg%3A3857",$_SERVER['QUERY_STRING'])); </code><br /><br />1. Install MapServer. In Ubuntu,<br /><code><br />sudo apt-get install apache2 php5 cgi-mapserver mapserver-bin </code><br /><br />for verification, check http://localhost/cgi-bin/mapserv<br /><br />2. Put the reproject.php file to web root (/var/www)<br /><br />3. Write a configuration file (say, wms.map) and place it in the same folder as mapserv (usually at /usr/lib/cgi-bin/)<br /><br /><code>MAP<br /><br />NAME "reprojected_wms"<br />PROJECTION<br />"init=epsg:3857"<br />END<br /><br />WEB<br />IMAGEPATH "/var/www/docs_maps/"<br />IMAGEURL "http://{mapserver_address}/docs_maps/"<br /><br />METADATA<br />"wms_title" "Reprojected WMS<br />"wms_onlineresource" "http://{mapserver_address}/reproject.php?map=wms.map&"<br />"wms_srs" "EPSG:3857"<br />"wms_server_version" "1.1.1"<br />END<br />END<br /><br />EXTENT 8865484.246776307 3016430.900654626 9864020.0791919 3587377.91450212<br /><br />LAYER<br />NAME "My Layer<br />TYPE RASTER<br />STATUS OFF<br />CONNECTION "http://{GIS_Server}/WMSServer?"<br />CONNECTIONTYPE WMS<br />PROJECTION<br />"init=epsg:3857"<br />END<br />METADATA<br />"wms_title" "GIS Layer"<br />"wms_srs" "EPSG:3857"<br />"wms_name" "1"<br />"wms_server_version" "1.1.1"<br />"wms_format" "image/png"<br />"wms_cache_to_disk" "1"<br />END<br /><br />END<br />CONFIG "PROJ_LIB" "/usr/share/proj"<br /><br />END</code><br /><br />Now use the WMS URL http://{mapserver_address}/reproject.php?map=wms.map& wherever needed.<br /><br />Many thanks to <a href="http://twitter.com/prabhasp">Prabhas</a> for devising the steps and helping me with this blog.</div></div>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com2tag:blogger.com,1999:blog-31851025.post-47960901798597617582011-09-10T14:49:00.004+05:452011-09-10T19:11:24.375+05:45File upload over web is broken!XKCD had a nice comic on '<a href="http://xkcd.com/949/">File Transfer</a>' yesterday.<br /><div dir="ltr" style="text-align: left;" trbidi="on"><span style="text-decoration: underline;"><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://xkcd.com/949/"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 456px; height: 614px;" src="http://imgs.xkcd.com/comics/file_transfer.png" alt="" border="0" /></a></span>The comic neatly illustrates the woes of transferring files. However this makes one realize another side of the story:<br /><br /><span style="font-weight: bold;">File upload over web is broken!</span><br /><br />Have you realized that every browser now has more-or-less functional download manager and features like pause/resume. Even almost all web servers support partial file download, and the feature is exploited by myriads of download accelerators out there.<br /><br />But how about file uploads? You choose the file, hit the Upload button, and wait! No such thing as progress bars, upload pause/resume and, obviously, upload-accelerators are out of question.<br /><br />This was okay some years back, when the web was mostly one way business. Not anymore! Nowadays we upload videos, photos and a lot of other large sized files. And how the browsers support the process?<br /><br /><div style="text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic5ZOElMI5gNmIWcr13Ydpsue-O2lmYhUOfRKi5cB2gjSZDWZZxHlhPukP-7BOZ8R5pDLpZvfvNEDfS6459gpEmZ8UYnHx3dIy1wcuSW8l_QJwnX8ERhDXtAC5b2pDMc9Vif3lvw/s1600/upload.png"><img style="margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 198px; height: 52px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic5ZOElMI5gNmIWcr13Ydpsue-O2lmYhUOfRKi5cB2gjSZDWZZxHlhPukP-7BOZ8R5pDLpZvfvNEDfS6459gpEmZ8UYnHx3dIy1wcuSW8l_QJwnX8ERhDXtAC5b2pDMc9Vif3lvw/s320/upload.png" alt="" id="BLOGGER_PHOTO_ID_5650720098768867042" border="0" /></a><br /></div><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8L1fZpwpedxUusfuUVy1XjbuMRFuwGaiqIthIceaRcBMRdszaTSlD9yaqel9TZtpC0ZIM0GxMEbRekv5mMKHqw90bOU8cjE1wPbh3U6MFIJnT8nMpgss_lZuGt7tMIuHNl5A14w/s1600/Screenshot.png"><img style="margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 184px; height: 40px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8L1fZpwpedxUusfuUVy1XjbuMRFuwGaiqIthIceaRcBMRdszaTSlD9yaqel9TZtpC0ZIM0GxMEbRekv5mMKHqw90bOU8cjE1wPbh3U6MFIJnT8nMpgss_lZuGt7tMIuHNl5A14w/s320/Screenshot.png" alt="" id="BLOGGER_PHOTO_ID_5650720242074049698" border="0" /></a><br /><br />And that's it! Some versions back, there wasn't any such indicator available altogether.<br /><br />There are workarounds though, like using <a href="http://www.uploadify.com/">Flash</a> or <a href="http://jupload.sourceforge.net/">Java</a>. Or even better using <a href="http://www.matlus.com/html5-file-upload-with-progress/">HTML5</a>. But the whole upload process needs some serious overhauling.<br /></div>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com3tag:blogger.com,1999:blog-31851025.post-10684390513847130092011-09-03T19:54:00.011+05:452011-09-03T20:48:24.580+05:45Weird behaviour while rotating image in C#I was working on an image processing code in C#. Had to rotate an image by few degrees around a specified point. This can be done either by <a href="http://www.dreamincode.net/code/snippet2640.htm">transformation</a> or <a href="http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-rotate">matrix method</a>.
<br /><code>
<br />private Bitmap rotateImage(Bitmap b, int x, int y, float angle)
<br />{
<br /> //create a new empty bitmap to hold rotated image
<br /> Bitmap returnBitmap = new Bitmap(b.Width, b.Height);
<br />
<br /> //make a graphics object from the empty bitmap
<br /> Graphics g = Graphics.FromImage(returnBitmap);
<br />
<br /> Matrix m = new Matrix();
<br /> m.RotateAt((float)angle, new PointF(x,y));
<br />
<br /> g.Transform = m;
<br /> g.DrawImage(b, 0, 0);
<br />
<br /> return returnBitmap;
<br />}
<br /></code>
<br />However this wont work properly. It rotates the image, but strangely enough at the same time scales it down too (on larger images).
<br />
<br />After some digging into MSDN, found this page, <a href="http://msdn.microsoft.com/en-us/library/1bttkazd.aspx">http://msdn.microsoft.com/en-us/library/1bttkazd.aspx</a>, which says:
<br /><blockquote>GDI+ may automatically scale an image as you draw it, which would decrease performance. Alternatively, you can control the scaling of the image by passing the dimensions of the destination rectangle to the DrawImage method. </blockquote>So to avoid scaling, the above DrawImage line should be changed to
<br /><code>
<br /> g.DrawImage(b, 0, 0, b.Width, b.Height);
<br /></code>
<br />I have no idea why any function would have "automatic" behaviour. But this is how it works. Weird.
<br />Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com2tag:blogger.com,1999:blog-31851025.post-33966488140918936732011-07-11T07:43:00.004+05:452011-07-11T08:06:45.656+05:45Obfuscated awesomeness in CRecently I've been bumping into obfuscated tiny C codes that does magic. Codes that are couple of lines in length but require pages of explanation on how it works.<br /><br />There are lots of these in <a href="http://www.ioccc.org/main.html">The International Obfuscated C Code Contest</a> page, but here are some of the cool ones I've found in other places. (I'll update this list as I bump into more)<br /><br /><a href="http://a1k0n.net/2011/06/26/obfuscated-c-yahoo-logo.html">Yahoo! Logo ASCII Animation in six lines of C</a><br />20fps, antialiased ASCII art animation of the Yahoo! logo in six lines of C.<br /><br /><a href="http://a1k0n.net/2006/09/15/obfuscated-c-donut.html">Donut animation</a><br />Donut animation with, well, donut shaped code. More impressive version <a href="http://a1k0n.net/2006/09/20/obfuscated-c-donut-2.html">here</a>.<br /><br /><a href="http://j.mearie.org/post/7462182919/spelt-number-to-decimal"></a><a href="http://j.mearie.org/post/7462182919/spelt-number-to-decimal">Spelt Number to Decimal</a><br />Spelt number (like, one, four, etc) in four lines of C<br /><br /><a href="http://j.mearie.org/post/1181041789/brainfuck-interpreter-in-2-lines-of-c">Brainfuck interpreter in 2 lines of C</a><br />For those who didnt know <a href="http://en.wikipedia.org/wiki/Brainfuck">Brainfuck</a> is a programming language.Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com0tag:blogger.com,1999:blog-31851025.post-25298820369023214072011-06-14T07:53:00.006+05:452011-06-14T08:10:01.107+05:45NTC PSTN Number to NameNTC's <a href="http://www.ntc.net.np">website</a> has a nice feature called <a href="http://www.ntc.net.np/telsearch.php">Telephone search</a>. This is particularly handy when you get a call from landline (PSTN) number and have no idea who's calling. Ofcourse you can go to the site and search, but the following bash script makes it faster.<br /><pre name="code" class="bash">#!/bin/bash<br /><br />#<br /># Nepal Telecom PSTN Number to Name search<br />#<br /><br />if [ "$1" == "" ] ; then<br /> echo "Usage: " $0 "phone_number"<br /> exit<br />fi<br /><br /># Prefix 01, if not provided<br />if [[ $1 =~ ^01 ]] ; then<br /> NUMBER=$1<br />else<br /> NUMBER="01$1"<br />fi<br /><br />wget -q http://ntc.net.np/telsearchRes.php <br />--post-data "searchFor=name&telno=$NUMBER&submitted=Search" -O - | html2text | grep "$NUMBER" | tr '_' ' ' | sed 's/ [\ ]*/ /g'<br /></pre><br />Save the file, chmod it as executable. <br /><br />To use,<br /><pre>./telsearch 5544132<br />| 1 |015544132|Ntc |Cellular Mobile And New S|Jawalakhel|<br /></pre>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com6tag:blogger.com,1999:blog-31851025.post-35512233726595345192011-05-14T06:54:00.003+05:452011-05-14T07:19:24.994+05:45Fixing overused touchpad with sticky noteIf you're like me who spends more time with laptop than anything/one else, you'll end up with touchpad like this:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIROZrxJzPdKeIhWLZ1EbQ3teGDXTbSSR1rcf5Xl4otVvN35LYFaahdqJ50BRv7I9C3Jtv0BOGZpHUULkVJAJHftwGkJsx22BPAFGZO8fAbiiH3_knZFolEO8umvAgt9zdOezkmQ/s1600/baretouchpad.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 362px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIROZrxJzPdKeIhWLZ1EbQ3teGDXTbSSR1rcf5Xl4otVvN35LYFaahdqJ50BRv7I9C3Jtv0BOGZpHUULkVJAJHftwGkJsx22BPAFGZO8fAbiiH3_knZFolEO8umvAgt9zdOezkmQ/s400/baretouchpad.jpg" alt="" id="BLOGGER_PHOTO_ID_5606378572123119906" border="0" /></a>Due to overuse, the outer coarse layer wears off and touchpad starts acting funny. Plus it's difficult to slide your finger over it.<br /><br />Fix? Stick a sticky-note over the touchpad. This surprisingly works!<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrw4NUpEe7__1EGd-qvhFTuPzbeQ-03jieCae2QBZ8XvxDKoKtDyCo5D52EwJsAHE5UY-D3SDVD0bLsbcJ9ncbuZHXI802gI_Wv1MzYx8Rh1olhUEllQGdPZr55zI1JvpC0LsHyw/s1600/stickynote.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 314px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrw4NUpEe7__1EGd-qvhFTuPzbeQ-03jieCae2QBZ8XvxDKoKtDyCo5D52EwJsAHE5UY-D3SDVD0bLsbcJ9ncbuZHXI802gI_Wv1MzYx8Rh1olhUEllQGdPZr55zI1JvpC0LsHyw/s400/stickynote.jpg" alt="" id="BLOGGER_PHOTO_ID_5606378708160493938" border="0" /></a>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com12tag:blogger.com,1999:blog-31851025.post-5066970790915524322011-05-10T08:18:00.003+05:452011-05-10T08:29:11.305+05:45Grub2 recordfail FAILI have this headless, keyboardless server running on Ubuntu 10.04. Runs fine, but once in a while while there's power cut off the server still remains dead when the power is back. I connected monitor and keyboard and found that the problem is with Grub2.<br /><br />Turns out there's a variable named <span style="font-weight: bold;font-size:85%;" ><span style="font-family: courier new;">recordfail</span></span> which is set to 1 during next boot whenever there's some problem with the computer (like due to power failure).<br /><br />Now if you see /boot/grub/grub.cfg file, it has the following lines:<br /><pre>if [ ${recordfail} = 1 ]; then<br /> set timeout=-1<br />else <br /> set timeout=10<br />fi<br /></pre>Which means, the timeout counter is disabled whenever the recordfail variable is set. This is nice for desktop environment, which has a monitor, so I can see the Grub countdown is disabled so I can proceed with Repair option if I have to, but for headless servers the computer just sits idle at Grub screen, puzzling the poor sysadmin.<br /><br />Fix? I changed the <span style="font-size:85%;"><span style="font-weight: bold; font-family: courier new;">timeout=-1</span></span> to <span style="font-size:85%;"><span style="font-weight: bold; font-family: courier new;">timeout=10</span></span>.Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com4tag:blogger.com,1999:blog-31851025.post-31192317900764954422011-03-19T17:50:00.004+05:452011-03-19T18:04:47.704+05:45Nepal Map APIDistrict-level Nepal Map PHP API. Generates variable-sized map of Nepal with user defined colors for districts.<br /><br />Source and example:<br /><a href="https://github.com/jwalanta/NepalMapAPI">https://github.com/jwalanta/NepalMapAPI</a><br /><br />Demo (with <a href="http://plugins.jquery.com/project/maphilight">maphilight</a> jQuery plugin):<br /><a href="http://diyaalo.com/nepalmapapi/">http://diyaalo.com/nepalmapapi/</a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqaGN1lQ5Y3pPGuH4eKVNIyjoDmAwfi17WCvrHaIXqbhVb3ssyQHQMYmBAXdcskaEYjJRlys6x4yC9I9R8A9f85ZU2KpK6DjCY5at9n-s9rRPFx9spXs2CntPQ2cw_9qDv6xdCug/s1600/nepalmapapi.png"><img style="display: block; margin: 0px auto 10px; text-align: left; cursor: pointer; width: 400px; height: 229px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqaGN1lQ5Y3pPGuH4eKVNIyjoDmAwfi17WCvrHaIXqbhVb3ssyQHQMYmBAXdcskaEYjJRlys6x4yC9I9R8A9f85ZU2KpK6DjCY5at9n-s9rRPFx9spXs2CntPQ2cw_9qDv6xdCug/s400/nepalmapapi.png" alt="" id="BLOGGER_PHOTO_ID_5585763411306848946" border="0" /></a>Thanx a lot to <a href="http://twitter.com/jitendra_">Jitendra</a> for providing the GIS map of Nepal.Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com1tag:blogger.com,1999:blog-31851025.post-2737931572003639932011-02-08T18:09:00.006+05:452011-02-08T18:52:45.413+05:45Javascript Deselect on FocusHere's the scenario: you've got two text input, userid and email address. For email address field, I want to have the domain part pre-filled (say, @example.com). Now when the user enters the userid and jumps to email input, the browser selects the whole text as default behavior. But I want to append userid to the beginning and select <span style="font-style:italic;">only the userid part</span>. Using jQuery, the usual code would be like this:<br /><br />However, THIS DOESN'T WORK!!<pre name="code" class="html"><br /><input type='text' id='userid' /><br /><input type='text' id='email' value='@example.com' /><br /></pre><pre name="code" class="javascript"><br /><script><br /> $(document).ready(function(){<br /> $('#email').focus(function(){<br /> if ($(this).val()=='@example.com'){<br /><br /> // add userid to the beginning<br /> $(this).val($('#userid').val()+$(this).val());<br /><br /> // select the userid part<br /> $(this).attr('selectionStart',0);<br /> $(this).attr('selectionEnd',$('#userid').val().length);<br /><br /> }<br /> });<br /> });<br /></script><br /></pre>To make this to work, you need to set the selectionStart and selectionEnd values after a while the inputbox is focused.<pre name="code" class="javascript"><br /><script><br /> $(document).ready(function(){<br /> $('#email').focus(function(){<br /> if ($(this).val()=='@example.com'){<br /><br /> // add userid to the beginning<br /> $(this).val($('#userid').val()+$(this).val());<br /><br /> // select the userid part, after 50ms interval<br /> setTimeout(function(){<br /> $('#email').attr('selectionStart',0);<br /> $('#email').attr('selectionEnd',$('#userid').val().length);<br /> },50);<br /> }<br /> });<br /> });<br /></script><br /></pre>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com4tag:blogger.com,1999:blog-31851025.post-21191246567564042142011-02-03T14:20:00.003+05:452011-02-04T03:25:23.684+05:45Fixing resolution for bigger external monitorIf you happen to connect our Linux laptop or netbook to an external monitor, you're likely to get into resolution trouble. For smaller resolutions (<=1024x768), it's not a bigger deal but once you try higher and unusual resolutions, like 1440x900, things don't turn out that well. Here's how to switch to such resolutions under (Ubuntu) Linux. I'm connecting my laptop (Intel 845GM chipset) to an external monitor (1440x900 native). <br /><br />Fire up terminal and run the following command; first calculate VESA CVT mode lines <pre style="background-color: rgb(238, 238, 238); padding: 10px;">$ cvt 1440 900<br /></pre>Output:<br /><pre style="background-color: rgb(238, 238, 238); padding: 10px;"># 1440x900 59.89 Hz (CVT 1.30MA) hsync: 55.93 kHz; pclk: 106.50 MHz<br />Modeline "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync<br /></pre><br />Now, lets see my card's supported resolutions out of the box.<br /><pre style="background-color: rgb(238, 238, 238); padding: 10px;">$ xrandr<br /></pre>Output:<br /><pre style="background-color: rgb(238, 238, 238); padding: 10px;">Screen 0: minimum 320 x 200, current 1280 x 800, maximum 4096 x 4096<br />VGA1 connected (normal left inverted right x axis y axis)<br />1360x768 59.8<br />1024x768 60.0<br />800x600 60.3 56.2<br />848x480 60.0<br />640x480 59.9 59.9<br />1440x900_60.00 59.6<br />LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 331mm x 207mm<br />1280x800 59.9*+<br />1024x768 60.0<br />800x600 60.3<br />640x480 59.9<br />TV1 disconnected (normal left inverted right x axis y axis)<br /></pre><br />In the above output, VGA1 is the external monitor and LVDS1 is the laptop's LCD panel. Now use the modeline information to create a new custom resolution and add it to VGA1<br /><pre style="background-color: rgb(238, 238, 238); padding: 10px;">$ xrandr --newmode "1440x900" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync<br />$ xrandr --addmode VGA1 1440x900<br /></pre>The changes are temporary though. If you want it to make it permanent, add them to ~/.xprofile<br /><br />Now go to System > Preferences > Monitors. The external monitor's list of resolutions should show 1440x900.<br /><br /><span style="font-weight: bold;">Some more info:</span><br />Connecting to external monitor has two options, mirror or extend. Choosing mirror gives the same output to both monitors. Extend, well, extends the display over both monitors. But it has a catch: for Compiz to extend over external monitor, the maximum possible horizontal resolution (see first line of xrandr output above, in my case 4096) should be at least double of sum of total horizontal resolution of two monitors.<br /><br />In my case, if I try to extend my 1280x800 to an 1440x900 external monitor, its not gonna work as 2*(1280+1440)=5440 > 4096. So mirroring is the only option. However if you set the resolution while compiz is on, it's gonna be "confused". Here's the workaround:<br /><br />1. Add the custom resolution as described above<br />2. Disable Compiz (System > Preference > Appearance > Visual Effects > None)<br />3. Change Resolution, and set the laptop's output to off<br />4. Enable Compiz againJwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com7tag:blogger.com,1999:blog-31851025.post-68980351587979933672010-12-25T07:18:00.009+05:452010-12-25T12:55:28.125+05:45Load Balancing LTSP clients using Ethernet BridgingTypical <a href="http://ltsp.org/">LTSP</a> setup has the following configuration:<br /><pre style="background-color: rgb(238, 238, 238);"><br /> +-------------+<br /> | Server |<br /> +-------------+<br /> | eth0 | eth1 |<br /> +------+------+<br /> / |<br /> / |<br /> Internet Switch<br /> |<br /> +---------+-------------+<br /> | | |<br /> Client-1 Client-2 ... Client-n<br /><br /> LTSP Clients<br /><br /></pre>The problem with this is that the network card bottlenecks the performance. Once the number of clients increases (usually >5), even though the server is capable of handling the load, the network card (usually, 100BASE-TX) can't provide the throughput.<br /><br />There are two solutions to this:<br />1. Use 1000BASE-T (gigabit) ethernet cards and switches<br />2. Use <a href="http://en.wikipedia.org/wiki/Load_balancing_%28computing%29">load balancing</a><br /><br />Using gigabit ethernet cards solves the problem but they are expensive. The switches are expensive too. Plus there are <a href="https://help.ubuntu.com/community/UbuntuLTSP/FlowControl">flow control problems</a> if the clients have 100Base-TX cards, which is usually the case.<br /><br />Load balancing is an easier and cheaper approach. Although this can also go fairly <a href="https://www.ltsp-cluster.org/documentation/technical-introduction">complicated</a>, here i'm going for the simplest one using <a href="http://www.tldp.org/HOWTO/html_single/Ethernet-Bridge-netfilter-HOWTO/">ethernet bridging</a>.<br /><br />The trick is to use multiple NICs connected to multiple switches. Then bridge the cards to provide a common interface. Here's what it looks like:<br /><pre style="background-color: rgb(238, 238, 238);"><br /> +--------------------+<br /> | Server |<br /> +------------------- +<br /> | eth0 | eth1 = eth2 |<br /> +------+------+------+<br /> / | |<br /> / | |<br /> Internet Switch Switch<br /> | |<br /> +----+-------+ +----+-------+<br /> | | | | | |<br /> C-1 C-2 ... C-n C-1 C-2 ... C-n<br /><br /> LTSP Clients LTSP Clients<br /><br /></pre>Lets say, there are three NICs: eth0, eth1 and eth2. eth0 is connected to internet. eth1 (say, 192.168.0.254) is connected to LTSP clients. eth2 is unused and is supposed to be bridged with eth1.<br /><br />First install bridge-utils<br /><pre style="background-color: rgb(242, 242, 242);"># apt-get install bridge-utils<br /></pre>Create a bridge (br0) and add eth1 and eth2 to it<br /><pre style="background-color: rgb(242, 242, 242);"># brctl addbr br0<br /># brctl stp br0 off<br /># brctl addif br0 eth1<br /># brctl addif br0 eth2<br /></pre>Now release the IP addresses of eth1 and eth2<br /><pre style="background-color: rgb(242, 242, 242);"># ifconfig eth1 down<br /># ifconfig eth2 down<br /># ifconfig eth1 0.0.0.0 up<br /># ifconfig eth2 0.0.0.0 up<br /></pre>Assign the LTSP IP address to bridge.<br /><pre style="background-color: rgb(242, 242, 242);"># ifconfig br0 192.168.0.254 up<br /></pre>Now connect eth1 and eth2 to separate switches, and each switch to (equal number of) LTSP clients.Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com0tag:blogger.com,1999:blog-31851025.post-82174861068049917732010-12-21T19:37:00.006+05:452010-12-21T20:04:12.889+05:45Tiny Issue TrackerI find most <a href="http://en.wikipedia.org/wiki/Comparison_of_issue-tracking_systems">issue trackers</a> bloated for most of my requirements. I usually need a simple issue tracker to communicate between couple of persons but most issue trackers available have plethora of features, usually with full blown database.<br /><br />So here's my solution: Tiny Issue Tracker. A PHP/SQLite based, single-file issue tracker.<br />Source: <a href="https://github.com/jwalanta/tit" target="_blank">https://github.com/jwalanta/tit</a><br /><br /><span style="font-weight: bold;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3iDW1wkzIUFfFJGiOGhqSi8eMj5WvAptIy7ElNq0XtuiPdA44BuGE-X6GIk8rlteG5gfa58_OZsCFrHsw1aIZnInaVU_jk4NiZD3xGhxBTY6O_MKr9aDAc_SxtHtZPYgu-Psm6Q/s1600/tit.png"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 148px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3iDW1wkzIUFfFJGiOGhqSi8eMj5WvAptIy7ElNq0XtuiPdA44BuGE-X6GIk8rlteG5gfa58_OZsCFrHsw1aIZnInaVU_jk4NiZD3xGhxBTY6O_MKr9aDAc_SxtHtZPYgu-Psm6Q/s400/tit.png" alt="" id="BLOGGER_PHOTO_ID_5553138848615578210" border="0" /></a><br />Features</span><br />- Super Lightweight (currently ~17KB, ~500 lines of code)<br />- Multi-user<br />- Email Notifications<br />- Auto DB creation on first run<br />- Issue Priority (High, Medium, Low)<br />- Comment on issues<br />- Throw and run!<br /><br /><span style="font-weight: bold;">Installation</span> is as simple as it can get:<br />- Modify configurations in the file (tit.php)<br />- Upload to webserver (rename if necessary) & load from browser<br /><br /><span style="font-weight: bold;">Demo</span><br />http://diyaalo.com/tit<br />username, password = demo, demo123<br />Check email notifications at http://demo123.mailinator.com/<br /><br />PS: The acronym is a complete coincidence though :PJwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com2tag:blogger.com,1999:blog-31851025.post-11036633105821070572010-12-14T16:22:00.008+05:452010-12-14T17:00:29.647+05:45HackJatra v0.1<a href="http://twitter.com/jitendra_">Jitendra</a> started the discussion, but i wouldn't be wrong if i say we all had the itch. A <a href="http://en.wikipedia.org/wiki/Hackathon">hackathon</a> was in everybody's mind since quite a while. So we started a email discussion among fellow hackers, mostly Pulchowk Campus BCT'ians. We had few projects in mind - ATM Locator, Khanchuwa and Online Nepali Donation system. All we needed was a date for the event. But before we could finalize that, we coined a term for the event.<br /><br />HackJatra. For non-Nepalis out there, Jatra means festivity. Later the term was also informally understood as "Hack by day, Jatra by night" :P. More on that later..<br /><br />Finally, we fixed the date and venue: 11th December, 2010 at <a href="http://www.otrc.gov.np/">IT Park</a> Banepa, starting from 9am.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijhEd50UYye4l5E16KaTj5Ns2OV5WzHyUexq8lBVZVu1OkBno7cRc5N_Ss4D5iUS7DAHd2DSIy4eY7L1ts70h05zFoDtaf82sZrr9B3ewluvRmGj3d5P_rWH_ruwRO9VQLmk24Zg/s1600/IMG_8486.JPG"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijhEd50UYye4l5E16KaTj5Ns2OV5WzHyUexq8lBVZVu1OkBno7cRc5N_Ss4D5iUS7DAHd2DSIy4eY7L1ts70h05zFoDtaf82sZrr9B3ewluvRmGj3d5P_rWH_ruwRO9VQLmk24Zg/s400/IMG_8486.JPG" alt="" id="BLOGGER_PHOTO_ID_5550490931019833650" border="0" /></a><br />The project we did were:<br /><br /><span style="font-weight: bold;">1. ATM Locator</span><br />Map enabled app to list and search ATMs in Nepal.<br />Team: Abhinav Singh, <a href="http://twitter.com/bibstha">Bibek Shrestha</a>, Jitendra Harlalka, Subodh Satyal, Sushil Shilpakar<br /><br /><span style="font-weight: bold;">2. Khanchuwa</span><br />Community based delicacies listing portal. The idea was discussed at BarCamp Kathmandu 2010.<br />Team: <a href="http://twitter.com/jwalanta">Jwalanta Shrestha</a>, <a href="http://twitter.com/askmeaks">Abhishek Singh</a><br /><br /><span style="font-weight: bold;">3. Tweet NEA</span><br />Automated twitter accounts to tweet the loadshedding schedule.<br />Team: <a href="http://twitter.com/manish_modi">Manish Modi</a>, <a href="http://twitter.com/ssapkota">Suraj Sapkota</a><br /><br />More on the projects in the <a href="http://hackjatra.pbworks.com/">wiki</a>.<br /><br />Needless to say, the event was extremely fun. The joy of hacking for fun with extremely talented fellow hackers is indescribable. The projects we started are almost done; few more hours of collaborations and they'll all be ready to launch.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTgbNnSBA320kod2IhQ_y2BSLOGzhhZSGnVuDIhWfW208K5tpFuTTvRv65ttsjvNn0iaO4_THUiL6d0o7vMyKnjzqDwinzlLhDBfuRNwJAdF6QlDb6hIfrNMlgasFRrfJJtIU5HA/s1600/IMG_8489.JPG"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 267px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTgbNnSBA320kod2IhQ_y2BSLOGzhhZSGnVuDIhWfW208K5tpFuTTvRv65ttsjvNn0iaO4_THUiL6d0o7vMyKnjzqDwinzlLhDBfuRNwJAdF6QlDb6hIfrNMlgasFRrfJJtIU5HA/s400/IMG_8489.JPG" alt="" id="BLOGGER_PHOTO_ID_5550491083701784610" border="0" /></a><br /><span style="font-weight: bold;">Future plans:</span><br />1. Do some branding of HackJatra; create a logo, have a website and make the projects more accessible and sharable.<br />2. Encourage other teams to do similar HackJatras<br />3. Do another HackJatra ASAP<br /><br />O BTW, we even had booze party by night (Jatra :P)Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com6tag:blogger.com,1999:blog-31851025.post-62200948134480213942010-11-12T07:10:00.009+05:452010-11-12T10:16:50.961+05:45Generating Tag Cloud the Unix way<strong>UPDATE:</strong> I've modified the script to add color and transparency :)<br /><br /><a href="http://twitter.com/#%21/ushaft">Ushaft</a>'s this <a href="http://twitter.com/#%21/ushaft/status/2845863957233664">tweet</a> on creating <a href="http://en.wikipedia.org/wiki/Tag_cloud">tag cloud</a> caught my attention. While there are better tools available <a href="http://tagcrowd.com/">online</a>, i decided to give it a try in Linux :)<br /><br />First we need to generate a frequency list of words out of a file. No brainer. I used the GNU/GPL <a href="http://en.wikipedia.org/wiki/GNU_General_Public_License">license</a> as source text.<br /><br /><pre style="padding: 10px; background-color: #eee;">cat /usr/share/common-licenses/GPL |<br />tr 'A-Z' 'a-z' |<br />sed 's/[^a-z ]//g' |<br />sed 's/\s/\n/g' |<br />awk '{if (length($1)>=3) print $1 }' |<br />sort | uniq -c | sort -nr > freq.txt</pre><br />Explanation (per line):<br />1. Print the license<br />2. Convert to lowercase<br />3. Remove punctuations<br />4. One word per line<br />5. Discard words with 2 or less long<br />6. Grab frequency and write to freq.txt<br /><br />freq.txt needs some editing to remove irrelevant words like "the", "but", etc.<br /><br />Now to create tag cloud, i wrote a simple awk script that outputs svg file. Saved this as gentagcloud.awk (Please change the width, height and scale variable to your taste)<br /><br /><pre style="padding: 10px; background-color: #eee;">#!/bin/awk -f<br /><br />BEGIN { <br /> WIDTH=1000<br /> HEIGHT=600<br /> SCALE=1<br /> <br /> OFS=""<br /> <br /> print "<?xml version=\"1.0\" <br /> encoding=\"UTF-8\" standalone=\"no\"?>"<br /> print "<svg width=\"",WIDTH,"\" height=\"",<br /> HEIGHT,"\" version=\"1.1\" <br /> xmlns=\"http://www.w3.org/2000/svg\">"<br />}<br /><br />{ <br />R = int(rand()*9)<br />G = int(rand()*9)<br />B = int(rand()*9)<br /><br />print "<text style=\"fill:#",R,G,B,";opacity:0.75;<br /> font-size:",$1*SCALE,"px;\" <br /> x=\"",rand()*(WIDTH-100),"\" <br /> y=\"",rand()*HEIGHT,"\">",$2,"</text>" <br />}<br /><br />END{ print "</svg>" }</pre><br />Now to create tag cloud,<br /><br /><pre style="padding: 10px; background-color: #eee;">awk -f gentagcloud.awk < freq.txt > tagcloud.svg</pre><br />Tada! Tag cloud generated, view tagcloud.svg in your browser or image viewer<br /><br />If you have ImageMagick installed, you can convert it directly to png too. (Transparency isnt handled properly. If you have workarounds, please comment)<br /><br /><pre style="padding: 10px; background-color: #eee;">awk -f gentagcloud.awk < freq.txt | convert - tagcloud.png</pre><br />BTW, the tag cloud was like this: (lil' ugly, but WTH :))<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY7rWui11GBq0G8gEIKwWSLeuFcegtQaG3WaLF-EGCzlKaDz6zAmeyod_vuJRFScb_txFS-uNXfKGxXuSiRJr3UD-vPq9CeR43iVc6hGq71tDbqnzQrJ9aIwimL3QJV-Dmz9YL-Q/s1600/tagcloud.png"><img style="cursor:pointer; cursor:hand;width: 400px; height: 260px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY7rWui11GBq0G8gEIKwWSLeuFcegtQaG3WaLF-EGCzlKaDz6zAmeyod_vuJRFScb_txFS-uNXfKGxXuSiRJr3UD-vPq9CeR43iVc6hGq71tDbqnzQrJ9aIwimL3QJV-Dmz9YL-Q/s400/tagcloud.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5538513271650052898" /></a>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com3tag:blogger.com,1999:blog-31851025.post-47028474786679729612010-02-25T23:58:00.004+05:452010-02-26T02:28:14.596+05:45Internet Connection Sharing in Linux over Ad-hoc WirelessLaptops are common these days and so is wireless networking that comes with it. Almost all of us use Wireless Router for wireless networking and internet sharing. But most of us might not be familiar with <a href="http://en.wikipedia.org/wiki/Wireless_ad_hoc_network">ad-hoc mode</a> that works in every wireless card and can eliminate the use of router altogether. Here's how:<br /><br />To setup ad-hoc wireless, you basically set two or more wireless cards to same <a href="http://en.wikipedia.org/wiki/Service_set_(802.11_network)#Service_Set_identifier_.28SSID.29">ESSID</a> in ad-hoc mode and different IP addresses.<br /><br /><b>Setting the wireless card in ad-hoc mode</b><br /><br />Generally <a href="http://www.linuxcommand.org/man_pages/iwconfig8.html">iwconfig</a> is used to set the wireless mode, but if you have <a href="http://madwifi.org/">madwifi</a> drivers (<a href="http://jwalanta.blogspot.com/2009/01/no-wifi-to-master-mode.html">see this too</a>), the commands are slightly different. Go to terminal and type,<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">iwconfig</pre>If you see interfaces named wlan0, wlan1, etc iwconfig will work. If you see interface names similar to ath1 and wifi0, then madwifi specific commands are to be used.<br /><br /><b>For general wifi cards:</b><br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">sudo iwconfig wlan0 mode ad-hoc</pre><i>Replace wlan0 with the interface name as listed by iwconfig</i><br /><br /><b>For cards using madwifi driver:</b><br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">sudo wlanconfig ath1 destroy<br />sudo wlanconfig ath1 create wlandev wifi0 wlanmode adhoc</pre>Now set essid. Pick some name like 'adhocwifi'<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">sudo iwconfig wlan0 essid adhocwifi</pre>If required, to set encryption key<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">sudo iwconfig wlan0 key 1234567890</pre>Now set IP address:<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">sudo ifconfig wlan0 192.168.0.1</pre>Follow the above steps for another wireless card and set IP address in same subnet, say 192.168.0.2, and ping each other.<br /><br />The whole ad-hoc mode setting can also be done using GUI network-manager, but since i'm not so much fond of graphical interface i'm not covering it. It should be simple.. :)<br /><br /><b>Internet Connection Sharing</b><br /><br />Now to share the internet over wireless,<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE</pre><i>where ppp0 is the connection you want to share (PPPoE connection in this case)</i><br /><br />You also need to enable IP forwarding:<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"</pre>Or, to enable permanently add the following line to /etc/sysctl.conf<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">net.ipv4.ip_forward=1</pre>Some <a href="http://www.wlink.com.np/">ISP</a>s might limit the <a href="http://en.wikipedia.org/wiki/Time_to_live">TTL</a> so that you wont be able to share the internet. Fix:<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">sudo iptables -t mangle -A PREROUTING -j TTL --ttl-inc 1</pre><div><br /></div><div><b>Using the shared internet (in Linux)</b></div><br />Now to use the shared internet on another computer, set it to ad-hoc mode and assign IP address in the same subnet as described above and perform the following:<br /><br />1. Set the IP of computer sharing internet as gateway<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">sudo route add default gw 192.168.0.1</pre>2. Set DNS server. We're using Google's DNS.<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">sudo sh -c "echo 'nameserver 8.8.8.8' >> /etc/resolv.conf"</pre>You can also use IP and DNS Masquerading to ease the task.<br /><br /><b><br /></b><div><b>Using the shared internet (in M$ Windows)</b><br /><div><br /><div>If you want to use the shared internet on M$ Windows,<br /><br />1. Connect to the Wireless Network (in this case 'adhocwifi')<br />2. Go to Network Connections<br />3. Right click the Wireless Connection<br />4. Select the Internet Protocol (TCP/IP) and click Properties<br />5. Set IP to 192.168.0.2 (or accordingly in the same subnet as set on Linux box), gateway to 192.168.0.1 (as set on Linux box) and DNS to 8.8.8.8</div></div></div>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com15tag:blogger.com,1999:blog-31851025.post-9228171549102893072010-02-19T11:46:00.003+05:452010-02-19T11:58:47.472+05:45Overriding extension compatibility check for FF3.5+Disabling extension compatibility check for Firefox was easy. Go to about:config and create a boolean value named <i>extensions.checkCompatibility</i> and set it to <i>false.</i><div><i><br /></i></div><div>Until Firefox 3.5! </div><div>(More specifically, products that are based on < Gecko 1.9.2)<br /></div><div><br /></div><div>Newer Firefox requires you to append version number to the variable. This will ensure the extension override wont work forever as FF is upgraded to next version. For example, in Firefox 3.6, the variable would be <i>extensions.checkCompatibility.3.6</i></div><div><i><br /></i></div><div>Explained in detail here:</div><div>http://kb.mozillazine.org/Extensions.checkCompatibility</div>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com0tag:blogger.com,1999:blog-31851025.post-10744404278180597852010-02-17T06:58:00.003+05:452010-02-17T09:18:14.517+05:45Converting Latex document to HTML / ODT / DOCI do all my documents in Latex. Actually i usually use emacs <a href="http://orgmode.org/">org-mode</a> first and later convert it to Latex, but when it comes to using bibtex, it's all latex. It works great and the output dvi/pdf files look so professional. However recently i had to submit the file in .doc format, and i had a real hard time finding good tools to do that.<br /><br />There are no direct Latex to .doc converters, so the best bet is to go Latex -> HTML -> DOC. There are lots of Latex to HTML converters like <a href="http://www.latex2html.org/">latex2html</a>, <a href="http://hutchinson.belmont.ma.us/tth/">tth</a> and <a href="http://pauillac.inria.fr/%7Emaranget/hevea/index.html">hevea</a>, but most of them either don't produce good HTML or mess with bibliography references. But after some research i found the best: <a href="http://www.cse.ohio-state.edu/%7Egurari/TeX4ht/">TeX4ht</a><br /><br />TeX4ht is available in ubuntu/debian repo, so to install<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">sudo apt-get install tex4ht</pre>Conversion is simple:<br /><pre style="padding: 10px; background-color: rgb(238, 238, 238);">htlatex document</pre>(please note, there is no .tex suffix)<br /><br />This will generate document.html, css and bunch of .png files.<br /><br />Now to convert it to wordprocessor files (odt, doc..),<br />1. Open the html file with OpenOffice.org<br />2. File > Save as<br />3. Choose the format you want to save it in (odt, doc)<br /><br />If you have images in the document, they will be linked instead of embedded in the document. To fix this: (<a href="http://wiki.services.openoffice.org/wiki/Documentation/OOo3_User_Guides/Getting_Started/Inserting_an_image_from_a_file#Embedding_linked_images">source</a>)<br />1. Edit > Links<br />2. Click "Break Link" for each image linkJwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com1tag:blogger.com,1999:blog-31851025.post-88104029342573071582010-02-04T10:26:00.006+05:452010-02-04T11:15:35.359+05:45mpg123: Lightest mp3 player in LinuxIf you are in search of the lightest barebone mp3 player in Linux, nothing can beat <a href="http://www.mpg123.de/">mpg123</a>. Unless you want flashy visualizations and playlist management and such, mpg123 can save you a lot of memory and cpu horsepower.<br /><br />Installation is easy. In Ubuntu,<br /><pre style="background-color: #eee; padding: 10px;">sudo apt-get install mpg123<br /></pre><br />Mpg123 comes with loads of options. Check out the man page for details. Here I'm gonna share a few usage tips.<br /><br /><b>Shuffle-play a directory of mp3s:</b><br /><pre style="background-color: #eee; padding: 10px;">mpg123 -CZ /path/to/mp3/folder/*<br /></pre><br />-Z option is for shuffle, -C is for control. From man page:<br /><pre style="background-color: #eee; padding: 10px;">-C, --control<br /> Enable terminal control keys. By default use ’s’ to<br /> stop, ’p’ to pause, ’f’ to jump forward to the next<br /> song, ’b’ to jump back to the beginning of the song,<br /> ’,’ to rewind, ’.’ to fast forward, and ’q’ to quit.<br /> Type ’h’ for a full list of available controls.</pre><br /><b>Equalizer:</b><br /><br />Don't fall off your chair! Yes, mpg123 also comes with 32-band equalizer. But there's no inbuilt graphical UI for that, you need to create the plain-text file. There's an <a href="http://www.igalaxie.com/ltt/mp3/misc/gtk_mpg123_equal.html">editor</a> though if you like, but creating one is not hard either. From man page:<br /><pre style="background-color: #eee; padding: 10px;">-E file, --equalizer<br /> Enables equalization, taken from file. The file needs to<br /> contain 32 lines of data, additional comment lines may be<br /> prefixed with #. Each data line consists of two floating-<br /> point entries, separated by whitespace. They specify the<br /> multipliers for left and right channel of a certain<br /> frequency band, respectively. The first line corresponds<br /> to the lowest, the 32nd to the highest frequency band.<br /> Note that you can control the equalizer interactively<br /> with the generic control interface.</pre><br />I've made one with party feel: <a href="http://jwalanta.com.np/files/party.txt">party.txt</a><br /><br />Usage:<br /><pre style="background-color: #eee; padding: 10px;">mpg123 -CZ -E party.txt mp3_file<mp3_file(s)><mp3_file><br /></mp3_file></mp3_file(s)></pre><br /><b>Songs again and again:</b><br /><br />Plus if you kind of person who listens to couple of songs again and again for weeks (instead of shuffled huge playlist), then hi5! :) and here's how to do that with mpg123:<br /><pre style="background-color: #eee; padding: 10px;">mpg123 -CZ song1.mp3 song2.mp3<br /></pre>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com1tag:blogger.com,1999:blog-31851025.post-29671405254879546822010-02-03T08:02:00.003+05:452010-02-03T08:19:33.645+05:45Making DLink DWL-650+ PCMCIA Wireless card work under linuxThe DLink <a href="http://www.dlink.com/products/?pid=23">DWL-650+</a> PCMCIA Wireless card doesn't work on recent Linux distros (I tried Ubuntu Hardy to Jaunty). After plugging in, the system hangs with CapsLock flashing.<br /><br />Turns out the card is handled by <a href="http://acx100.sourceforge.net/">acx</a> module and the support is broken for this card. So use ndiswrapper instead.<br /><br />First blacklist acx module. Open /etc/modprobe.d/blacklist.conf file and add the following line<br /><pre style="background-color: rgb(238, 238, 238); padding: 10px;">blacklist acx</pre>Now install ndiswrapper<br /><pre style="background-color: rgb(238, 238, 238); padding: 10px;">sudo apt-get install ndiswrapper-common</pre>Now get the Windows driver for the card from <a href="ftp://ftp.dlink.com/Wireless/DWL650+/Driver/dwl-650+_drivers_306.zip">here</a>. Extract the file, go to the winxp folder and,<br /><pre style="background-color: rgb(238, 238, 238); padding: 10px;">sudo ndiswrapper -i AIRPLUS.INF</pre>The card should work now.Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com2tag:blogger.com,1999:blog-31851025.post-39025380247853031492009-05-31T22:55:00.004+05:452009-06-01T11:09:58.762+05:45NTC's GPRS in Linux via Bluetooth using Nokia phoneThe following guide explains how to connect to <a href="http://www.ntc.net.np/">Nepal Telecom</a>'s <a href="http://en.wikipedia.org/wiki/GPRS">GPRS</a> service from Linux via Bluetooth using Nokia phone. This guide is based on <a href="http://koti.kapsi.fi/mcfrisk/linux_gprs.html">Linux GPRS Guide</a>. The steps have been tested on Nokia 6600, 6630 and 5300 but should work on all Nokia phones.<br /><br />NTC's GPRS is *really* slow so I won't recommend it for everyday use. However simple mail checking and <a href="http://twitter.com/jwalanta">tweeting</a> ;) should do just fine.<br /><br /><span style="font-weight: bold;">Requirements</span><br />1. Nokia Phone<br />2. <a href="http://www.ntc.net.np/">Nepal Telecom</a> <a href="http://ntc.net.np/mobile/mob_gprsConfig.php">GPRS Account</a><br />3. <a href="http://en.wikipedia.org/wiki/File:BluetoothUSB.jpg">Bluetooth Dongle</a> (if not inbuilt in your PC/laptop)<br />4. Linux (the following steps were tested on Ubuntu)<br /><span style="font-weight: bold;"><br />Steps</span><br />1. Download <a href="http://www.jwalanta.com.np/files/ntgprs.tar.gz">ntgprs.tar.gz</a> and extract (ntgprs, ntgprs-wvdial.conf and ntgprs-disconnect)<br />2. Copy the files to /etc/ppp/peers/ (you need root or sudo access)<br />3. Turn on Bluetooth on your Nokia phone<br />4. Plug in Bluetooth Dongle to PC or enable it (if inbuilt)<br />5. Fire up terminal (the commands to be entered are in bold-face):<br /><br />Make sure the bluetooth is running on PC:<br /><pre style="background-color: #eee; padding: 10px;">$ <span style="font-weight: bold;">hciconfig</span><br />hci0: Type: USB<br />BD Address: 11:11:11:11:11:11 ACL MTU: 672:3 SCO MTU: 48:1<br />UP RUNNING PSCAN ISCAN<br />RX bytes:149397 acl:1046 sco:0 events:764 errors:0<br />TX bytes:40320 acl:628 sco:0 commands:74 errors:0<br /></pre><br />The following command will find bluetooth address of your phone<br /><pre style="background-color: #eee; padding: 10px;">$ <span style="font-weight: bold;">hcitool scan</span><br /><span style="font-weight: bold;"></span>Scanning ...<br />00:0E:6D:C2:99:42 Nokia<br /></pre><br />Create a RFCOMM port and bind it to phone's Bluetooth address.<br /><pre style="background-color: #eee; padding: 10px;">$ <span style="font-weight: bold;">sudo rfcomm bind /dev/rfcomm0 00:0E:6D:C2:99:42 1</span><br /></pre><br />Please note that the bluetooth address in the above command should match the address found by 'hcitool scan' command.<br /><br />Check if the port has been created<br /><pre style="background-color: #eee; padding: 10px;">$ <span style="font-weight: bold;">rfcomm -a</span><br />rfcomm0: 00:0E:6D:C2:99:42 channel 1 closed<br /></pre><br />Now dial.<br /><pre style="background-color: #eee; padding: 10px;">$ <span style="font-weight: bold;">sudo pon ntgprs</span><br /><br />--> WvDial: Internet dialer version 1.60<br />--> Initializing modem.<br />--> Sending: ATH<br />ATH<br />OK<br />--> Sending: ATE1<br />ATE1<br />OK<br />--> Sending: AT+CGDCONT=1,"IP","internet","",0,0<br />AT+CGDCONT=1,"IP","internet","",0,0<br />OK<br />--> Sending: AT+CBST=0,0,1;+CHSN=6,0,0,0;+CGDCONT=,,"ntnet"<br />AT+CBST=0,0,1;+CHSN=6,0,0,0;+CGDCONT=,,"ntnet"<br />OK<br />--> Modem initialized.<br />--> Sending: ATD*99#<br />--> Waiting for carrier.<br />ATD*99#<br />CONNECT<br />~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~<br />--> Carrier detected. Waiting for prompt.<br />~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~<br />--> PPP negotiation detected.<br />Serial connection established.<br />using channel 9<br />Using interface ppp0<br />Connect: ppp0 <--> /dev/rfcomm0<br />sent [LCP ConfReq id=0x1 <asyncmap>]<br />rcvd [LCP ConfAck id=0x1 <asyncmap>]<br />rcvd [LCP ConfReq id=0x0 <auth> <mru> <asyncmap>]<br />sent [LCP ConfAck id=0x0 <auth> <mru> <asyncmap>]<br />sent [PAP AuthReq id=0x1 user="user" password="pass"]<br />rcvd [PAP AuthAck id=0x1 ""]<br />PAP authentication succeeded<br />sent [IPCP ConfReq id=0x1 <addr> <ms-dns1> <ms-dns3>]<br />rcvd [IPCP ConfReq id=0x0 <addr>]<br />sent [IPCP ConfNak id=0x0 <addr>]<br />rcvd [IPCP ConfNak id=0x1 <addr> <ms-dns1> <ms-dns3 7="" 15="">]<br />sent [IPCP ConfReq id=0x2 <addr> <ms-dns1> <ms-dns3 7="" 15="">]<br />rcvd [IPCP ConfReq id=0x1 <addr>]<br />sent [IPCP ConfAck id=0x1 <addr>]<br />rcvd [IPCP ConfAck id=0x2 <addr> <ms-dns1> <ms-dns3 7="" 15="">]<br />Cannot determine ethernet address for proxy ARP<br />local IP address 10.1.4.101<br />remote IP address 10.0.0.1<br />primary DNS address 202.70.64.5<br />secondary DNS address 202.70.64.15<br />Script /etc/ppp/ip-up started (pid 9902)<br />Script /etc/ppp/ip-up finished (pid 9902), status = 0x0</ms-dns3></ms-dns1></addr></addr></addr></ms-dns3></ms-dns1></addr></ms-dns3></ms-dns1></addr></addr></addr></ms-dns3></ms-dns1></addr></asyncmap></mru></auth></asyncmap></mru></auth></asyncmap></asyncmap></pre><br />To disconnect<br /><pre style="background-color: #eee; padding: 10px;">$ <span style="font-weight: bold;">sudo poff ntgprs</span><br /></pre>Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com5tag:blogger.com,1999:blog-31851025.post-56942966331357573352009-04-07T06:08:00.011+05:452009-04-07T06:47:10.185+05:45Easy bandwidth shaping in LinuxThere is an extensive and nicely written <a href="http://tldp.org/HOWTO/Adv-Routing-HOWTO/">HOWTO</a> on this topic but here I'm talking about some really easy to use bandwidth shaping tools -- <a href="http://lartc.org/wondershaper/">wondershaper</a> and <a href="http://www.monkey.org/%7Emarius/trickle/">trickle</a>.<br /><br /><span style="font-weight: bold;">Wondershaper</span><br />This is the easiest tool I have found to limit bandwidth of a particular interface. All it takes is,<br /><pre class='bash:nocontrols:nogutter' name='code'><br />$ sudo wondershaper {interface} {down} {up}<br /></pre>the <span style="font-style: italic;">{down}</span> and <span style="font-style: italic;">{up}</span> are bandwidth in kilobits. So for example if you want to limit the bandwidth of interface eth1 to 256kbps uplink and 128kbps downlink,<br /><pre class='bash:nocontrols:nogutter' name='code'><br />$ sudo wondershaper eth1 256 128<br /></pre>To clear the limit,<br /><pre class='bash:nocontrols:nogutter' name='code'><br />$ sudo wondershaper clear eth1<br /></pre>Easy, eh?<br /><br /><span style="font-weight: bold;">Trickle</span><br />Unlike wondershaper, which limits the bandwidth to an entire interface, trickle is user-space bandwidth limiting tool. The syntax is,<br /><pre class='bash:nocontrols:nogutter' name='code'><br />$ trickle -u {up} -d {down} {program}<br /></pre>Both {up} and {down} and bandwidth in KB/s. Now if you invoke it as,<br /><pre class='bash:nocontrols:nogutter' name='code'><br />$ trickle -u 8 -d 8 firefox<br /></pre>It will fire up Firefox, limiting the bandwidth to 8KB/s. This is very useful specially if you are a web developer and want to test your application under various bandwidth conditions.<br /><br />Furthermore, you can also run trickle as daemon (trickled) which can limit the bandwidth to several programs.Jwalanta Shresthahttp://www.blogger.com/profile/06367719783695306601noreply@blogger.com7