About this blog

The name of this blog is small alley. As in an alley, I hope to post a variety of things that I find interesting and as you walk through the alley, you would find things that you like.

I have posted some songs that I wrote. I am not a great singer. I sing and play the guitar purely for fun and I hope people who thinks they can't sing can be inspired by me. No former singing lessons and no former guitar training. Just pure fun......

The recording is also done at home with a drum machine and one guitar through a small amp. The sound file has been touched up slightly by removing the noise. Otherwise the songs are as original as it gets.

I practise Taiji regularly. For me, it is a great exercise requiring control of mind and body to perform well and for it to be enjoyable. You can get more videos of Taiji from YouTube.

Other posts include places and events that I think are interesting and more important, which I have time to upload.

Enjoy your walk through this small alley.....

Saturday, September 28, 2013

Raspberry Pi as a Wifi Hotspot

My intention was actually to set up a Raspberry Pi print server for my home.  After buying the Raspberry Pi, I realised that my printer does not support the ARM architecture.  However I am discovering other interesting ways to use the Pi and using it as a WiFi hotspot is one option.

While trying to set up the hotspot, I made reference to may wonderful posts found on the Internet.  However I found that the posts do not cover everything and there are assumptions that they made which does not apply to me.  Or they have missed posting some information/knowledge that I found was crucial in setting up the hotspot.  In posting my experience, I hope to fill in some gaps and help others just as I have been helped.

I set up my Pi hotspot using Raspbian and I am going to assume that you have got this set up on your SD card.

In my setup, I have the wired Ethernet cable connect to the router provided by my ISP.  I use the Edimax EW-7318USG dongle.  It is a couple of years old but it is supported by Linux out of the box.

Note that all commands are run from a terminal window.  I also assume you know how to use the nano editor.  You also need to know a bit about how networks are defined by IPs (Get this knowledge from the Internet if you have problems in this area).

Step 1

After you start up the Pi, update your system:-

sudo apt-get update
sudo apt-get upgrade


Type:-

ifconfig -a

and ensure that you see the eth0 and wlan0 listed.  Make a note of the IP address of eth0.  For example, mine says 192.168.1.77 and this IP is assigned by the DHCP server of my router.

You need to know this as your wlan0 needs to be set up on a different network - for example 192.168.0.0.  (Please look at the numbers carefully and compare with those assigned to eth0).

If you cannot see wlan0, your wifi adapter may not be detected or supported.  Search the Internet for solutions.

Step 2

Install iw:-

sudo apt-get install iw

After the installation, run:-

iw list


You should see some thing like this:-


Supported RX frame types:
* IBSS: 0xb0 0xc0 0xd0
* managed: 0x40 0xd0
* AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
* AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
* mesh point: 0xb0 0xc0 0xd0
* P2P-client: 0x40 0xd0
* P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0



Note that you have "AP" and "AP/VLAN" which indicate that your wlan0 can support hotspot configuration.  If not, you may need to buy another adapter.

Step 3

Get the necessary software:-

sudo apt-get install hostapd isc-dhcp-server iptables

Step 4

Configure your network interfaces (if you are worried, make a backup of all the files before changing them):-

sudo nano /etc/network/interaces

When the editor opens, change the entries to look something like this:-


auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0

iface wlan0 inet static
 address 192.168.0.1
 netmask 255.255.255.0

##iface wlan0 inet manual
##wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
##iface default inet dhcp

up iptables-restore < /etc/iptables.ipv4.nat



You can see that I have assigned the IP address 192.168.0.1 to my wlan0.  Remember, the wlan0 must be on a different network from eth0.

Step 5

Now you configure the DHCP server, isc-dhcp-server.

sudo nano /etc/dhcp/dhcpd.conf

Search through the file to find the location which says something like:-



default-lease-time 600;
max-lease-time 7200;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
authoritative;


Remove the hex sign "#" so that the line containing "authoritative" looks like this:-



default-lease-time 600;
max-lease-time 7200;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;


Next go to the bottom of the file and enter the following:-


subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.20;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}



Note that the above are my figures.  Take note of those numbers starting with "192" and change them to suit your need.  But remember they must be on the same network but different from that of eth0.

After you are done, save the file.


Next you need to link isc-dhcp-server to wlan0.  Do the following:-

 sudo nano /etc/default/isc-dhcp-server

Scroll down to INTERFACES="" and change it to say INTERFACES="wlan0"

Save the changes.


Step 6

Configure the access point - hostapd by creating the hostapd configuration file:-


sudo nano /etc/hostapd/hostapd.conf



Type the following into the empty file:-



interface=wlan0
driver=nl80211
#driver=rtl871xdrv
ssid=YourRaspberryPiRouter
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=YourPiRouterPhrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP



Replace "YourRaspberryPiRouter" and "YourPiRouterPhrase" with something suitable for your case.

Note that the nl80211 driver works for me.  Your wifi adapter may use another driver.  But I recommend you try nl80211 first as the hostapd software that comes with Raspbian works with this.  If you use another driver, you may need to tweak hostapd and I do not know how to do that.

Do not put in extra space at the end of the file.  hostapd can be picky.

Once you are done, save the file.


Now we will tell hostapd where to find this configuration file:-

sudo nano /etc/default/hostapd

Find the line #DAEMON_CONF="" and edit it so it says DAEMON_CONF="/etc/hostapd/hostapd.conf"

Remember to remove the # in front of "DAEMON".

Then save the file



Step 7

You will now configure the iptables to ensure that eth0 communicates with wlan0:-

sudo nano /etc/sysctl.conf



Go to the bottom and add the following line to start IP forwarding on boot:-

 net.ipv4.ip_forward=1

Save the file.

Also run

 sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"



Run the following (3 lines) to create the rules for iptables:-


sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state ELATED,ESTABLISHED -j ACCEPT

sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT



Save the rules by typing:-

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"


Step 8


To ensure that hostapd and isc-dhcp-server start up on boot, type the following:-



sudo update-rc.d hostapd enable
sudo update-rc.d isc-dhcp-server enable




The setup is completed.  Restart Pi:-

sudo shutdown -r now


After Pi boots up, use another device (tablet, HP, computer) to scan for the hotspot.  It should show up and allow you to connect to it.


If you encounter errors, try the following:-

Run hostapd and see what error messages are displayed and correct them.

sudo /usr/sbin/hostapd /etc/hostapt/hostapd.conf


Restart isc-dhcp-server to see if it display any errors and correct them.

sudo /etc/init.d/isc-dhcp-server restart


The iptables rules can be viewed by typing:-

iptables -L


Mine shows:-



Chain INPUT (policy ACCEPT)
target     prot opt source               destination        

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere          

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination



I hope the above helps.  I am not an expert but just want to share my experience.  Good luck.


Saturday, August 31, 2013

King of fruits in South East Asia

Heard of durian?  Well it is regarded as the king of fruits in South East Asia by many.  This year we have a bumper harvest.

It is an acquired taste.  Some find is repulsive but many in South East Asia likes the fruit very much.

It takes skill to select and open one.  However nowadays, most sellers are honest and they will select really good durians for you.  One of the seller allowed me to video tape his durian opening skill.  Enjoy the art form...




Sunday, July 21, 2013

Confirmation Ceremony of my son

On 21st July 2013, my youngest son was confirmed at the Our Lady of Perpetual Succour Church, Singapore.  If you are not sure what Confirmation is, you can search it on the Internet.

Basically it is one of the Sacraments where a Catholic receives the Holy Spirit to become an adult member of the church.


The picture above shows the Archbishop laying his hand on my son.



After the ceremony, we went to Werner Oven Restaurant and had German food.  May not be the best but we had a good family time - also with the god-parents of our children.


Sunday, June 23, 2013

Trip to Sikkim

Went to Sikkim with my students on 22nd Jun 2013.  Landed in Calcutta and it reminded me of the book entitled "City of Joy".

Below are some photos of Calcutta taken from outside our hotel and from our bus.















There are also new developments in Calcutta where mega malls and private housing are built.  Maybe another 4 to 5 years the area will be like a modern city.

The we flew to Bagdodra enroute by car to Sikkim.  At Bagdodra we had lunch at a mall.  Must say that I enjoyed the food. 






Below are pictures enroute to Gangtok.  It was a winding ride up the hill, above the clouds.











To go into Sikkim we need to obtain another permit. Spent about an hour there as things are done by hand.  Look at the poster carefully.  I noticed Sikkim has an interesting law that is hard to implement in Singapore.





The trip from Bagdogra to Gangtok took about 4 hours.  Gangtok is cool and the people are nice.  You'll find yourself living in and above the clouds.  Be prepared for wet conditions.









Went to a very nice shopping street of Sikkim.  It reminded me of Europe.




The video below showed the road condition.  Basically the roads are narrow.  At some parts, two cars can hardly pass each other.  Many parts of the roads also need maintenance.  The walkways along the shopping area are wider than the roads.




Also met a very talented driver for our group.  He played some great blues and we did some jamming.  I played some blues harp and that's what great about the harp - it is so portable.










Sunday, June 16, 2013

Family jamming together

Today (16th Jun 2013) jammed with my sons.  They are really wonderful (not forgetting the camera lady, my wife).  For our first session, I think it is ok.

Here are some of the videos.



After the jam, we had dinner at Stuttgart Blackforest Boutique S Cafe.  Why "S Cafe"?  According to the waitress, it is synonymous with Mercedes S-Class.  The ambience is indeed nice but they ran out of pork knuckles and cheese.  We had to settle for sausage and pasta.  Beer is good though.



Monday, June 10, 2013

Trip to Ipoh

My wife and I decided to be adventurous and took a bus up to Ipoh on 9th Jun 2013.  We'll are there for 3 full days and stayed at the French Hotel.

The trip to Ipoh was smooth though it took 8 hours.  But planned our own entertainment.  You should not rely on the system provided by the bus.  

Our experience of French Hotel was nice.  The room was nice and the staff were friendly and very helpful.  There is a nice cafe in the hotel where we had breakfast.  Only 3 types of breakfast were available but the setting was nice.  Google their website and you can find out more info there.




We tried to have the famous bean sprout chinese rice on the first night but the restaurants were crowded.  Some of the restaurants only open for dinner.  Anyway we settled for the second best but decided that we will go back another day.

Walked around the Old Town and had one of the famous curry noodle. The shop's name is Sin Seng Fatt. 



Took a stroll along one of the main street and saw some flats.  They looked like they needed some maintenance. 




Along the street we saw old buildings and shop houses.  Hope they're preserve them.



We finally ate at one of the many "authentic" shops that sell the Ipoh bean sprout chicken rice.  It tasted nice and the bean sprout was more "bulky" than those in Singapore.





It was about 8pm on a Monday night.  The picture below shows an almost deserted street.  But where we had dinner, there were some life.  


On the second day we went to the 3 "tongs" (caves in cantonese).  We booked a cab for 2.5 hours for the trip and paid RM80.  Book through your hotel and don't flag one from the street.

The first cave we went to was Perak Tong.  You should visit this if you only have time to visit one. Be adventurous and climb to the top to have a view of Ipoh. 














The next cave we visited is the Kek Lok Tong (Cave of Bliss).  There are some statutes of Buddhas facing out of the cave (the other side) and looking out to a nice garden.  Perhaps that is where one finds bliss.





The last cave we went to was the Sam Poh Tong (3 Treasures Cave). Frankly it was nothing special.  To me, they actually destroyed the natural limestone.







We also watched "Fast and Furious 6".  It cost us RM11 per person - something that we could not get in Singapore.

That night, we visited the Ding Hao foodcourt.  However many stores were closed.  Perhaps it was Monday. 




On the 3rd day, we bought some egg tarts.  They were nice.  Noticed we were the oldest customers in the queue.




Then we past by a coffeeshop and decided to have breakfast.  It is Singapore in the 70s.  But the food was nice.




Went by a music shop (branch of City Music) from Singapore.  We were the only and probably the first customers there.  The sales personnel were really nice and managed to play some guitar there.  Bought a headphone will can help me practise without the amp.  Available in Singapore too but decided to buy anyway as the shop really made us feel "at home" - the secret of making a sale without selling.



We spent the last day roaming around leisurely and thought of listening to some live music.  We came across a cluster of pubs and bistros which have a very nice facade.  However the band was not playing.  


We also had some food at the Josephine bistro at our hotel.  Sat at a table that was formed by one of those huge drums that was used to wind the cables - those cables that you see being laid along the roads.  The food was reasonable.







Travelling around Ipoh was not like Singapore.  Pubic transport was lacking and you may need to call for a cab to get around.  You need to bargain if you flag a taxi down - if you can come across one.  If you need to call a taxi, I recommend you dial 05 2534188 (BK Cab).

Ipoh can be described as a sleepy town. I don't mean to say it in a bad way.  The people we met are really nice.  It is a different experience from the buzz and rush of big town living.  If you really want to spend some time leisurely to enjoy good food, then Ipoh is a good place to visit for 2 days.

Also learned a bit of blues harp. Maybe will post what I learned later.