Wednesday, January 20, 2016

RPI2 - Dashing Dashboard Installation Tutorial

Dashboard provide a quick view of information on the system. This can be a desktop application or web based. One such example on Raspberry Pi 2 is Dashing which is based on the Sinatra Framework and Ruby.

The Sinatra Framework from provides web application development quickly on Ruby. Example of installation on Ruby;

$ sudo gem install sinatra

Pre Installation checklist

  1. Raspbian Jessie
  2. Ruby

Installation of Dashboard on Dashing.

Step 1: Install Dashing.

$ sudo apt-get update
$ sudo apt-get install ruby-dev
$ sudo apt-get install ruby2.1-dev
$ sudo gem install bundler

Install Dashing 1.3.4 and create a new project called my_dashboard_project.

$ sudo gem install dashing

Step 2: Create a new project space

$ dashing new my_dashboard_project
$ cd my_dashboard_project
$ ls -l
total 36
drwxr-xr-x  6 pi pi 4096 Jan 20 12:34 assets
-rw-r--r--  1 pi pi  339 Jan 20 12:34
drwxr-xr-x  2 pi pi 4096 Jan 20 12:34 dashboards
-rw-r--r--  1 pi pi  122 Jan 20 12:34 Gemfile
drwxr-xr-x  2 pi pi 4096 Jan 20 12:34 jobs
drwxr-xr-x  2 pi pi 4096 Jan 20 12:34 lib
drwxr-xr-x  2 pi pi 4096 Jan 20 12:34 public
-rw-r--r--  1 pi pi   65 Jan 20 12:34
drwxr-xr-x 11 pi pi 4096 Jan 20 12:34 widgets

Change your directory to my_dashboard_project and bundle gems

$ bundle

Display installed gems

$ bundle show

Step 3: Start the dashing server

$ dashing start

Point web browser location at http://localhost:3030/sample

Whats next?

There are additional widgets that can be installed and new dashboards can be created. Here is an example of adding a widget from dashing.

Installing Server Status Squares widget with GIST_ID = 9588819

$ dashing stop
$ dashing install 9588819

From server status squares widget, copy the file server_status_squares.erb to the dashing dashboard directory in the project created above.

$ cp server_status_squares.erb dashboards

Point web browser location at http://localhost:3030/server_status_squares


Dashboard on PI
Tutorial on Sinatra: Sinatra docsJust do it, Singing with Sinatra.
Dashing: Shopify,

Monday, January 18, 2016

Android Studio - Proguard Error Shows Unable to compute hash

In Android development, the standard development kit includes a tool to shrink, optimise and obfuscate the APK. This tool is known as Proguard.

Android Studio will provide the options to use Proguard if it is enabled. However, some classes or files do NOT like to be optimised and obfuscated. In particular Javascript files and reference to classes that do not exist in the path. Here is an example of how the error message may appear when building the signed APK on Linux & MS Windows.


Error:Execution failed for task ':app:packageMinirelease'.
> Unable to compute hash of /usr/development/BakersPercentage/app/build/intermediates/classes-proguard/minirelease/classes.jar

MS Windows

Error from proguard during build
Since the problem is a warning on GMS packages, I resolved on Android Studio 1.4 as follows;

Step 1: Verify project works

Open the project and make sure it can build without errors. 

Step 2: Edit build.gradle (Module: app)
Copy the existing release build type and paste as a new build release named minirelease (or any name you fancy).

buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), ''
            signingConfig signingConfigs.config
        minirelease {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), ''
            signingConfig signingConfigs.config

Step 3: Edit

Add the following lines

 -keep class** { *; }

Step 4: Build Signed APK

In Android Studio menu, choose Build-> Clean Project

Build-> Generate Signed APK...
Enter Key details and click Next.
In Build Type: choose minirelease.
Click Finish.


Friday, January 15, 2016

Android http audio streaming and MediaPlayer

MediaPlayer class provides a player for local files and online streaming. Its a pretty flexible class and allows syn and asyn calls to suit almost every type of needs.

Formats supported by Android is at

There are cases where online streams can be played on an Android emulator but not on actual Android device. This happened for Samsung Galaxy S5 with Android 5 OS.

This is what I found;

  1. There are two type of AAC streams in my list of sites. Streams using AAC-LTP AAC with SBR+PS doesnt work but AAC-LC is played satisfactorily.
  2. Audio in MP3 plays fine on emulator and actual Android device.

There are other APK that managed to play the same audio streams on That S5. Probably there is another type of mediaplayer-like class to stream audio with support of the AAC-LTP.

Conclusion if MediaPlayer stream doesnt play over HTTP
  1. Try to play the stream on VLC player and see if it works. Verification process.
  2. Seek alternative stream format if one doesnt work. Remember, only MP3 and AAC-LC works.
  3. Incorporate a decoder to manage the unsupported format. 
  4. Consider to use AudioTrack instead of MediaPlayer. This will require manual assignment of the codec and audio format.

Raspberry Pi 2 and a VGA monitor

The Raspberry Pi 2 (RPI2) model B (more details) comes with many input/output connectors and of which its display output is using HDMI type A. This HDMI is also known as Full HDMI.

Model B is the big brother of Model A+ that is much more cheaper for specific implementation in an embedded project where the most minimal use of electrical power is needed.

The RPI2 can be hooked up to a decent monitor or projector using VGA connectors. All that is needed is a HDMI to VGA adapter. This adapter may comes with additional functions like audio output, additional power source or USB. Price differences are huge but here is an example that I got from online and it works just fine with the NEC AccuSync LCD52v monitor.

HDMI to VGA cable plugged to RPI2 and female VGA.


Raspbian Command Line Basics 101

A few commands to display configurations of Raspbian on a Raspberry Pi 2.

At the Raspbian terminal, users can access a whole load of information. These can be useful for troubleshooting graphics, program conflicts and networking issues.

The commands
1. Display version of the Raspbian.
$ lsb_release -a

2. Display the GPU chip version
$ vcgencmd version

3. The monitor hdmi mode
$ vcgencmd get_config hdmi_mode

4. Display current configuration
$ tvservice -s

5. Is the monitor using CEA or DMT
$ vcgencmd get_config hdmi_group

6. Display supported CEA mode for the monitor
$ tvservice -m CEA

7. Display all IP devices configured
$ ip a
Or just eth0 device
$ ip addr show dev eth0

Raspbian: Example output of basic commands

Friday, January 8, 2016

Howto Configure Static IP Address for Raspberry Pi 2

This is specifically for Raspbian Linux on Raspberry Pi 2 (RPI) using a wired ethernet cable.

Step 1. Connect the ethernet cable.

By default this connection is called eth0. Ensure its connected, look for the blinking lights then steady light on the RPI.

Step 2. Configure the static network information.

In this example I am using the following static IP address information:
IP address:

At the Panel, right click the network icon and choose "WiFi Networks (dhcpcdui) Settings".

Choose following;
Configure: interface eth0
Automatically configure empty options: checked
IP Address:
DNS Server:

Click Apply. Close the window and reboot RPI.


Test using the web browser or access the terminal and try the ping command.

Reference: RPiconfig in elinux

Tuesday, December 8, 2015

Introduction to IPTABLES Tutorial

My notes on iptables commands.

Firewall tutorial for iptables

  1. View
  2. Append rules
  3. Insert a rule
  4. Delete a rule
  5. Default Policy
  6. Saving the rules

The problem with devices and applications not being able to access the server is usually due to configuration of the iptables firewall. This can be configured on an application or through command line terminal.

Monday, December 7, 2015

Raspberry Jam Kuala Lumpur 2015 - Kids at the Workshop

The Raspberry Jam Kuala Lumpur 2015 saw quite a huge turnout. This first Jam for Malaysia was on 5 Dec 2015 at Asia Pacific University (APU), Kuala Lumpur.

There were concurrent (parallel) sessions of free talks and hands-on workshop. Since the workshop was hands-on, participants who purchase/register for the workshop online included the price of hardware. This consist of;

Raspberry Pi 2 model B
Power adapter
Raspberry case (red & white)
Micro SD card (8GB)

There were ample parking along the road side as the huge parking lot was full. Probably due to a fun run being held at the same venue. A goody pack was given out during registration. At the first talk, the presenter from APU introduced a work in progress of a robot that uses raspberry pi (RP) and adruino.
Tele-presence and Tour Guide Robot using RP by APU
Its off to the workshop after that talk. The workshop title was "Getting your Raspberry Pi up and running and setting up for File sharing" and was conducted by Raspberry Pi Penang.

The number of participants was double the online registrations, as they allow walk-in registrations. There was another kid at the front row but Martha was nervous, not in a mood to talk to anyone. A quick check of our hardware and its found that the micro SD card doesn't come with an adapter. The laptops and PCs only had the standard SD card readers. Thanks to Fazli (I don't think he recognise me) for sharing his SD adapter.

Setting up the RP
Done fixing RP and casing

Following the instructions, she completed the installation of Raspbian (from MS Windows), updating and upgrading the Raspbian Jessie. Installed and configured Samba for file sharing. Didn't get a chance to test the file sharing as the instructor took more time than the allocated 1 hour session.

Martha updating Raspbian

While she was waiting for the others to complete the steps, Martha found Minecraft in the installed Rasbian. Tried to find the keys and explored Minecraft world. Its the first time for her to setup and she had an enjoyable learning experience.

Generally steps to create a file sharing server with the RP during the workshop;

Step 1: Install Raspbian

Download latest Rasbian image, currently its Jessie from and create the image on the SD card. Insert the blank SD card into the computer used to write the image. For MS Windows users, the software is called Win32DiskImager-0.9.5-binary and for Linux, the software is pre-installed called "dd".

Step 2: Update and Upgrade Raspbian

Take the SD card and install in the RP (make sure power is off). Plug-in all the cables (Monitor, keyboard, mouse, network) and turn on RP power. Watch the monitor screen as it boots.

Configure the settings from the "preferences" menu and reboot.

Open the terminal and type;
sudo apt-get update
sudo apt-get upgrade -y


Additionally I would suggest;
1. Change the default pi user password
2. Add additional tools, at the terminal type;
sudo apt-get install raspberrypi-ui-mods

Step 3: Install Samba

At the terminal type:

sudo apt-get install samba samba-common-bin

Assign access of the default pi user for file sharing. When prompted for password, enter the pi user password.

sudo smbpasswd -a pi

Restart samba

sudo /etc/init.d/samba restart


From a computer in the same network, use the network share tools to access the RP via IP address. You will need to enter the pi user password.


On a MS Windows, open the Windows Explorer and click on the network. type in the hostname of the Raspberry Pi. Select the option to Connect as a different credentials, since the Windows is likely to be logged in with a user other than the name "pi".

On MS Windows 8.1, the samba share needs to be map manually. Open a command prompt and type the following;

net use windowsdir shareserver\sharepath /USER:username thepassword

net use Z:  \\\pihome /USER:pi thepassword

Wednesday, October 28, 2015

Check Disk Usage on Windows with WinDirStat

Running out of disk space and wondering where it all went to? Windows users can have their disk summarised and a treemap generated through the use of WinDirStat.

This Windows programme is a port from an open source application called KDirStat written for KDE running on Linux/BSD/Unix type operating system. In the spirit of open source, One characteristics of being open source is having others extend or provide their own version of the software. For example, altWinDirStat from from WinDirStat with some updates. Its a matter of seeing who can stand the test of time in the open source world.

Wouldn't you agree that it opens up more possibilities and increase access to better software?

In the diagram above, there are 3 distinct areas in the default layout after scanning of a directory. Which by the way can include a network share. 

In the area for Directory Summary, users can choose to access the sub-directories details and even delete directories. Click on a directory and its highlighted in the treemap. In the File extension summary, just a click and the disk view of that extension is shown. Click on the Coloured Treemap and the item is highlighted in directory and file extension summary areas, immediately.

Its a nifty and fast tool.