“Super Randonneur” Saju!

Atlast, accomplished what I desired to accomplish this year. A “Super Randonneur” in cycling, by completing the set of 200, 300, 400 and 600kms brevet rides successfully this year.

A quick recap:
> Successfully completed BRM200 & BRM 300 in Jun & July this year; John & Michael (Mic) gave company for the most part, and we 3 could complete it quite okay, thanks to the nice weather šŸ™‚
> August BRM400 in vellore route was a failure. But, failure gives more learning than success!! Ā Isn’t it? Way too much headwind and elevation going up for the initial 100+kms. John had to quit because of extreme knee pain around 85k, and I continued solo for the rest of the ride. The headwind was so powerful that, riding even at 15kmph was extremely difficult. Added to this, no proper/regularĀ food intake made me drained up completely. When I needed to do the jawadhu mini-hill climb for the u-turn point, my battery was down. Couldn’t reach the 185km Control Point on time. So, eventually, accepted my own failure before the 185k CP, and decided to quit šŸ˜¦ I was very down, both physically and mentally.
> WantedĀ to give the 400 another shot, and decidedĀ to complete the BRM400 in coimbatore in Sep. This time, I could successfully complete it along with John, though the ride was another extremely tough one.

BRM 600 full story:
Coming to the current one, 23 Sep – Started 600kms BRM from JBC Elite, Velachery. Route is to ride till Samayapuram (Trichy), and return back the same route.
Ride till 185k CP, Ulundurpet A2B, was quite a comfortable one. I & John reached 2hours before the cut off point, and was happy to reach so early. Less we knew that we are going to see the real challenge after this only. Also met Mic, who reached much before us, and was taking a nice nap. After taking some rest here, we started the ride from A2B to the next CP.

So, here comes the first challenge.. John’s roadie tyre was low in air. Quick inspection revealed, the tyre has a puncture šŸ˜¦ And that was not alone. The other tyre had almost a tyre burst. So, we had to work on both the tyres. Tried fixing the puncture, but for some issue or the other, eventually settled with changing the tube. The other tyre, used the cut piece of the liner, for extra support for the tyre, and started our rideĀ again.

After a few kms, comes the real challenge.. Heavy Headwinds, with the elevation going up. Just reminded me of the Vellore 400 brevet. Added to this was.. Sun was showing no mercy. From a comfortable ride so far, the situation is now a complete 180 deg turnĀ šŸ˜¦

We 3 tried to draft each other. Not much help, as the head/cross wind was extremely strong. We were cruising slowly (no other choice).
But, then comes a shock that, around 270kms, Mic decided to quit; his muscle tear while doing the Datri 200kms ride, should have been the problem, I thought.

John and I continued. And, thenĀ comes the next shock. John also decided to quit. Not sure, if it is a chain reaction, or not. But, his health wasn’t good, just 2 days before the event. And 1 day recovery probably wasn’t just enough.

So, now, around 275kms into the ride, I am all alone. I was mentally feeling very weak, as both my usual partners had to quit. This thought somehow fully occupied my mind, and I wasn’t able to cruise the way I would normally go. Took a few minutes break at around 280kms. Recharged with water and Glucose. Started riding again. Luckily, the elevation from this point was going downwards, and the head/cross wind was takingĀ some rest. So, I could gather some speed, and was going just fine from this point. Saw the board ‘Samayapuram’, and felt really happy. I was looking for the Sona Mina hotel. In the Vellore 400brm, I missed the Control Point, and went further by passing over a bridge, and eventually I had to return back a few kms. With this flashing my mind, I was a little cautious this time, in not ‘missing’ the CP. It took a while of riding before I could spot the Sona Mina hotel, on the right side of the ride, and I was happy to atleast reach half way mark, 300kms!!

Took lunch, cleared the tummy, and took some rest. Started riding after an hour. The initial 20-25 kms of the return journey wasn’t again easy. Some head/cross wind, and also it was elevation up. So, again, slow cruising. I knew I may probably be running out of time. But, I didn’t want to push at this point, and drain my battery completely. So, took it easy. Reached Ulundurpet A2B some 20 minutes before the cut of point. Time is now 10:30 in the night.

After stamping the brevet card, and doing a quick dress change, I started for the next CP.. Around 12 midnight, was feeling extremely sleepy. 2nd sleepless night, na? So, expected šŸ™‚ Stopped in a bus stop, Slept on the passenger bench, and closed my eyes. Before I realize, I was in goodĀ sleep. Luckily, something woke me up after 30-45 minutes. Woke up, checked my clock, and I realized, I have slept for some time, and happy to see that took some right amount of sleep, without any planning šŸ˜‰

Started from there, and I was keeping a tab on the kms for the next CP. Unfortunately, my mind took all wrong calculations, and I was keeping a tab with 10 kms less in mind (than the correctone)Ā for the next CP; So, with the wrong 10km less in plan, I was taking far too many water/coffee/chips/snacks breaks. Luckily, I realised the mistake before it gotĀ out of my hand. Started a bit of push/accelerating, once I realized I have 10kms more than what I planned so far šŸ˜‰ Eventually, reached the next CP, Only Coffee, at Silavattam, comfortably before the cut off time.

Now, it is another 75 for the final CP, JBC elite at Velachery. The riders at the CP was feeling comfortable, as it is just 4 more hours to finish it off!! (5 hours for the cut off time).

MR arranged for hot idlies at the CP, and after having this, and a little bit of rest, started ride for the final leg. Once, I reached Chengalpet, I was feeling comfortable, as it is my home turf :D, and I was cruising comfortably, not too much speed, nor slow; just on the comfortable speed.

Soon I crossed Perungalathur, and while going towards Tambaram, noticed a couple of riders some 500meters before me, wrongly taking the chennai bye-pass road. Shouted from the bottom of my lungs to them that they are in the wrong route. Thank god, they heard me, stopped and came back to the GST. Felt good šŸ™‚

One more hour to the cut off time, I was near the Velachery bridge. I also saw a tender coconut shop. Considering more than an hour left, I decided to take it easy, and took 2 tender cocunuts from the shop and finished it like anything. Felt really energized šŸ™‚

After few minutes of rest/break, started slow ride again, and eventually reached JBC.

Thanks to Madras Randonneurs/Partha Dutta, and all volunteers for organizing this event nicely, and for all the support they have provided. Really appreciate.

And before I wrap this up, I should really thank John again. He gave me company for almost half of the ride, and his speed for the first 200kms was just awesome. Though I couldn’t match him, I was atleast trying to keep him on my eyesight šŸ™‚ The time saved, helped a lot during the headwind/elevation rides, in 200-300kms, to manageĀ it with a slower speed.

I am grateful to atleast 3 folks, who areĀ my motivators for me, in taking this long distance cycling a reality.

First, Ramalingam sir. A true motivator. At 63 years young, he is the best rider in our group, or, what I have seen so far. I wish, I will atleast do some riding, at his age.

Second, the seasoned cyclist,Ā SRĀ Krithika from WCCG Tambaram chapter. Her fb post on her 1000kms BRM ride, was so inspirational https://www.facebook.com/krithika.chidambaram/posts/1239828286044512.

Last but not least – Dhinesh Karthik. Though I have done many 100kms so far, my first 100kms was always special. The second half of it was difficult, with hot sun, heavy headwind in the chennai bypass route. And, Dhinesh made this difficult ride look so easy. I don’t think there is anybody else who can take give company to a newbie rider, make him feel very comfortable, lead him (thus, taking away some of the effect of the headwind), and make the difficult 100 into an easy 100. That first 100, Ā made me realize, I too can do 100kms easily šŸ™‚ Later on, this 100 is what became as multiple 100’s, and then 200’s, 300’s etc, and now, the 600!! So, thanks, Dhinesh!

Thanks to WCCG group, especially Tambaram chapter, for all the inspiration and support. I don’t think I would have reached this far, without joining our group. Let’s bring more SRs from our group!! Next year, we will bang the BRM events with a bigger gang!!!

I can’t close this, without thanking my wife Anu, for all the support she could provide. (be it preparing the break fast and packing it for the ride, or, providing the moral support, etc)

Next year targets? Yes, I do have. Will need to work more harder to achieve. Wish me good luck šŸ™‚ Hopefully, will achieve, atleast some of the targets šŸ™‚

Logging in Rust using Log

Having used a few logging frameworks/abstractions in .net, I was looking for an abstraction in Rust. Fortunately, easily found Log from Crates.io home page.

So, just thought of doing a simple proof of concept to see how my experience goes.

As a first step, created a new app using cargo

$ cargo new --bin log_sample

This creates a folder log_sample in my current folder.

Now, modified main.rs to look like below..

#[macro_use]
extern crate log;
extern crate env_logger;
fn main() {
env_logger::init().unwrap();
info!("starting up");
error!("error");
println!("Hello, world!");
}

Basically, added info! and error! calls to see the output, using log and env_logger crates.

Now, if i run the application,

$ cargo run
     Running `target/debug/log_sample`
ERROR:log_sample: error
Hello, world!

I don’t see “starting up!” appearing here. I tried to run using the app..

$ ./target/debug/log_sample 
ERROR:log_sample: error
Hello, world!

This also do not show up the “starting up”. Is there is something wrong? Not really. By default, it is logging only errors, which makes sense. How do I turn on the info logging also? Instructions from env_logger documentation is clear enough, and I tried the following.

$ RUST_LOG=info ./target/debug/log_sample 
INFO:log_sample: starting up
ERROR:log_sample: error
Hello, world!

There we go!! I do see the “starting up” now. So, the environment variable RUST_LOG is controlling what kind of data to log. Once I turned on info log using RUST_LOG=info, the info! calls also shows its output.

So, that was a cool abstraction for logging. Pretty good indeed!!

References:
https://github.com/rust-lang/log
http://doc.rust-lang.org/log/log/index.html
http://rust-lang.github.io/log/env_logger/

Hello Rust on a weekday evening!!

I was pretty interested, when Rust reached 1.0. Always wanted to say hello to rust some day or the other. Its approach on handling memory without using Garbage collector is very interesting. Rust way of ‘Ownerships’ and scopes were unique and innovative on its own, which makes me think, why this approach wasn’t tried before (Or, has somebody else already gave it a shot?!)

Anyway, today evening, I thought I should say Hello to RustĀ (rustlang). So, how did my experiment go?

Installation

Installation was fairly easy. I just had to run the following command in my terminal

curl -sSf https://static.rust-lang.org/rustup.sh | sh

HelloWorld!

Created a folder, hello_world, and created a new file main.rs

fn main() {
    println!("Hello, World!");
}

After saving the file, typed following in terminal..

rustc main.rs

That’s it. The application is created in the same folder (main), and running it was as easy as ..

./main

This prints “Hello, World!” in the terminal.

Based on my reading so far, it appears Rust is having a feel of high level languages, while still being a low level language, like C.

I’m very excited to say hello to Rust, and I intend to play with Rust more.

References

http://doc.rust-lang.org/book/

Getting started with Asp.Net VNext in Ubuntu/Linux – Step by Step

Happy to find that the next version of Asp.Net will beĀ officially supported by Microsoft on Linux and Macs šŸ™‚

Thought of giving it a shot on Ubuntu Linux to see how it works..

Credits:
Followed these guides/scripts..

https://github.com/aspnet/home
http://carolynvanslyck.com/blog/2014/09/dotnet-vnext-impressions/
http://www.ganshani.com/blog/2014/12/shell-script-to-setup-net-on-linux/

Step 1: Install Mono

wget http://download.mono-project.com/repo/xamarin.gpg
sudo apt-key add xamarin.gpg
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee --append /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install mono-complete
 
sudo certmgr -ssl -m https://go.microsoft.com
sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net
sudo certmgr -ssl -m https://nuget.org
mozroots --import --sync

Step 2: Install K Version Manager (KVM)

curl -sSL https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.sh | sh && source ~/.kre/kvm/kvm.sh

Step 3: Install K Runtime Environment (KRE)

kvm upgrade

Step 4: Get Sample Codes

git clone https://github.com/aspnet/Home.git

Step 5: Run Console Sample

cd Home/samples/ConsoleApp
kpm restore
k run

Step 6: Run Web Sample

cd Home/samples/HelloWeb
kpm restore
k kestrel

Now, go and launch your browser and navigate to http://localhost:5004

This gets some errors like.. “Object reference not set to an instance of an object”. As of now, to resolve this error, need to get a compatible version of libuv

wget http://dist.libuv.org/dist/v1.0.0-rc2/libuv-v1.0.0-rc2.tar.gz
tar -xvf libuv-v1.0.0-rc2.tar.gz
cd libuv-v1.0.0-rc2/
./gyp_uv.py -f make -Duv_library=shared_library
make -C out
sudo cp out/Debug/lib.target/libuv.so /usr/lib/libuv.so.1.0.0-rc2
sudo ln -s libuv.so.1.0.0-rc2 /usr/lib/libuv.so.1

Now, if you navigate to http://localhost:5004, you will see a nice welcome page šŸ™‚

That’s it.. Go ahead and try other samples from the downloaded repository folder.
Running asp.net vnext applications in Ubuntu/Linux is as easy as this!!

Using Python / pywinauto for automating Windows GUI applications

Install pywinauto

I prefer installing python packages using pip. Refer to my previous blogĀ https://techsaju.wordpress.com/2013/03/06/install-python-and-pip-on-windows/ for installing python and pip in windows

Once pip is installed, run the following from the commandline to install pywinauto

pip install pywinauto

Install swapy

Download and install swapy from https://code.google.com/p/swapy/

Swapy is a nice tool for inspecting the GUI apps, which helps greatly in genearating pywinauto code

Sample Codes

Automating Notepad

import pywinauto
pwa_app = pywinauto.application.Application()
pwa_app.start_('notepad.exe')

#Type some keys into the editbox
pwa_app.UntitledNotepad.Edit.TypeKeys("test{SPACE}from{SPACE}pywinauto")

#Get handle to the window
w_handle = pywinauto.findwindows.find_windows(title=u'Untitled - Notepad', class_name='Notepad')[0]
window = pwa_app.window_(handle=w_handle)

#Get text from the edit box
edit = window['Edit']
props = edit.GetProperties()
print props['Texts']

#Trigger the About menu item
window.MenuItem(u'&Help->&About Notepad').Click()

#Close the About window
w_about_handle = pywinauto.findwindows.find_windows(title=u'About Notepad', class_name='#32770')[0]
w_about = pwa_app.window_(handle=w_about_handle)
w_about.TypeKeys('%{F4}')

#Playing with list/combobox
window.MenuItem(u'F&ormat->&Font...').Click()

w_format_handle = pywinauto.findwindows.find_windows(title=u'Font', class_name='#32770')[0]
w_format = pwa_app.window_(handle=w_format_handle)

combo = w_format['ComboBox']
combo_props  = combo.GetProperties()
print combo_props['Texts'] #Prints all items in the combobox

Install Python and pip on Windows

Install Python

Install Python 2.7.3 fromĀ http://www.python.org/download/releases/2.7.3/

I installed to the default path C:\Python27.

Modify system/user environment variable PATH to include this path.

Install easy_install and pip

Download setup_tools for python 2.7 fromĀ https://pypi.python.org/pypi/setuptoolsĀ and run the installer wizard.

This installs easy_install.exe inĀ C:\Python27\Scripts (I’m using the default path, your path could vary)

Add this path also to the PATH environment variable.

From command line, run the following to install pip. This installs pip.exe to the same pathĀ Ā C:\Python27\Scripts

easy_install pip

Reference: http://blog.troygrosfield.com/2010/12/18/installing-easy_install-and-pip-for-python/

Mount usb drive in ArchLinux / Raspberry Pi

I prefer mounting devices by UUID, in general.

So, step 1, I did was to find the UUID of the usb drive. Run the following command..

sudo blkid -o list -c /dev/null

In my case, the command returned like below

device                      fs_type     label        mount point                     UUID
--------------------------------------------------------------------------------------------------------------------------
/dev/mmcblk0                                         (in use)                        
/dev/mmcblk0p1              vfat                     /boot                           44C8-CEF1
/dev/mmcblk0p2              ext4                     /                               fcee8534-f5f0-42ee-83ac-f943f878ee67
/dev/sda1                   vfat                     /media/data                     DB86-F67F

Here, DB86-F67F is the UUID of my usb drive!!

I wanted the normal user to be able to mount the drive. So, added the following into /etc/fstab file.

UUID=DB86-F67F /media/data vfat user,noauto,noatime,flush 0 0

Create a dir like, /media/data, and as a normal user run the following to mount the usb drive

mount /media/data

That’s all! I have mounted the usb drive into /media/data. You can replace /media/data with anything else you like!!

Reference: https://wiki.archlinux.org/index.php/USB_Storage_Devices

Using tmux to remotely work on Raspberry Pi

After having bought the device, I’m finding it to be quite cool. Considering the fact that it takes a very less power (around 3.5W) makes it good to okay it running all the time šŸ™‚

And, being able to run node.js from Raspberry Pi is quite useful. In order to keep the node.js running, even after I quit the ssh session, I wanted something, like ‘screen’ unix command. Finally, I ended up choosing tmux than screen, as tmux appears to be a modern equivalent with active development going on..

Btw, I used the ArchLinux Arm, instead of raspbian, as I liked the fact it is a rolling release distro, which also I wanted to experiment with. (Having used Debian/Ubuntu for a long time now)

Anyway, coming to the point, the process is quite easy for using tmux from cherrypy.
ssh server was already installed with Archlinux ARM. So, this step is taken care. (If not, just install an ssh server, like openssh)

The next step is to install tmux.
Use pacman to install tmux..

sudo pacman -S tmux

Now, from my other machine (I typically use ConnectBot in my Android Phone/tablet, with Hacker’s keyboard for better keyboard experience), connect to the Raspberry Pi device, and just type

tmux

This creates a new tmux session in Raspberry Pi. Here we need to run the necessary commands, say, run the node.js app.
Once we are done, just execute the following keyboard combination, to detach the tmux session.
Ctrl + B D (i.e., Press Ctrl + B and then press key D)

Please note, the tmux session still continues to run in the Raspberry Pi device šŸ™‚

Now, if we need to login back after some time and attach to the tmux session..

tmux attach

That’s it. Now, our shell will be connected to the old tmux session, as if we were still continuing to operate. Isn’t it cool šŸ™‚
I’m loving it. Especially, now I can use my Pi for downloading stuff, without having my main pc switched on all the time..

References:
http://robots.thoughtbot.com/post/2641409235/a-tmux-crash-course
http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer

Using express to generate an app

Continuing from the previous post on getting started with node.js, let’s now create a simple app using the express app generation tool, which helps in setting the basic app code, and also creates the recommended directory structure.

Install express globally

npm install -g express

I want to create an app with sessions support, and also wanted to use ejs for templating

express --sessions --ejs myapp

Install dependancies

cd myapp
npm install

Run the app

node app

That’s it. Now, navigate to http://localhost:3000 and you’ll see the barebone app running!!

Reference Url: http://expressjs.com/guide.html