Pages

Monday, October 22, 2012

Android Wifi tethering


A short note on Android hotspot/adhoc network sharing. I have been thinking to buy a Galaxy Nexus 7 for sometime. The hindrance so far has been Android devices inability to connect to Ad-hoc network.

My conclusion is that if you are running on Android 4.x+ it is easy to tether network connection between Android devices only.

In case you want to share/tether/hotspot to an Android device there is no easy way out. For example if you want to share iPhone's internet connection with an Android device you possibly cannot (at least its not straight forward). Vice versa is possible. That is you can share your internet connection from an Android device with an iPhone(At least the latest Android versions).

If you are running 4.x + Android version you do not need to install any additional application to tether. The stock ICS+ OS supports WiFi tether and few other ways to share internet connection.

What I was successfully able to test

* I could tether Google Galaxy Nexus(GNex) with a Samsung Galaxy S2. GNex acted as Hotspot.
* I could tether Galaxy S2 with GNex. Samsung Galaxy S2 acted as Hotspot.

In both the cases Devices were running on Android version 4.1.x +

So, it is a safe bet to buy Nexus 7 in case you have an android device Running on Android ICS. But if you own an iPhone and thought you can share the internet connection through that, well you may be in a fix. Think again.

I am posting this for other users who may have wasted a lot of time trying to figure out why their Android devices does not detect Ad-hoc networks.

Friday, April 13, 2012

Remove all Ruby Gems

To remove all gems from your system, this should work.


gem list | cut -d" " -f1 | xargs gem uninstall -aIx

On JRuby following works


gem list --no-versions | while read x; do sudo gem uninstall $x -a; done

Many a times you may run in to situation where you simply want to clean up all the gems installed. I found this article very helpful. Above command is copied from their. You can read detail on the site.

Wednesday, January 25, 2012

Git Reference card

Git create remote branch

To create a local branch

git branch branch_name

To switch/checkout local branch

git checkout branch_name

You can combine above two in one step instead

git checkout -b your_branch

Create remote branch (so that other co-workers/programmers/whoever can pull)

git push -u origin your_branch

Others can pull this by

git checkout origin/your_branch

View diff in GIT

What you will commit

git diff

diff between two branch

git diff master..branch_1

diff since last commit

git diff HEAD

Diff with stash

git stash show -p stash@{0}

Git create and apply patch

git diff --no-prefix > patchfile

and

patch -p0 < patchfile

Detail on stackoverflow

Ignore files

Easiest way is to create a .gitignore file in root folder. You can have .gitignore in subfolders in case you want to include rules specific to subfolders. This does not apply to already tracked file. To ignore already tracked file you would need to remove it from Git. In case you want to retain the file

git rm --cached

Undo last commit

git reset --soft HEAD^

Read more about this on Stackoverflow

This entry is a note to self for being amnesiac

Monday, November 28, 2011

Disqus(ted)

Great added Disqus to blog. Looks like I lost all old comments (of whatever few I had).

Friday, July 08, 2011

Sinatra: memcached as session store

A simple route for using memcached as session store. Assuming that Memcache server is running already.

require 'rubygems'
require 'sinatra'

use Rack::Session::Memcache, :memcache_server => 'localhost:11211', :expire_after => 3600, :namespace => "sinatra.chandankumar.com"

get "/" do
"value = " << session[:value].inspect
# Actual code to do something useful
end

# Route to set session variable
# for example to set session key :value invoke URL /set?value=ActualValue
get "/set" do
session[:value] = params[:value].inspect
# Code to do something
end

This would enable you to spawn multiple instances of (same) Sinatra app while sharing session store to achieve non sticky session. Helps scaling the front end.

To install Memcache service one could use Couchbase. Couchbase server is memcache compatible and it is comes with a nice admin interface to manage instances. More info about couchbase http://www.couchbase.com/couchbase-server/overview

Tuesday, June 21, 2011

Monday, June 20, 2011

Install ruby using RVM

This is note to self, for installing ruby 1.8.7 using RVM. Other versions can be installed in same way "mostly". Just replace the version 1.8.7 with version intended

Verbose documentation about RVM installtion can be found at https://rvm.beginrescueend.com/rvm/install/

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >>

add above line in ~/.bashrc file in the end

rvm package install zlib
rvm package install openssl
rvm install 1.8.7--with-openssl-dir=$HOME/.rvm/usr
rvm use 1.8.7 --default

zlib and openssl is required in many cases.