Monthly Archives: September 2015

InnoDB Slower Update Performance

Yesterday, i had locking table problem in myIsam table. The solution proposed is to change existing myIsam table into InnoDB table. So we changed the engine table as proposed. For information, my existing table had about 50000 rows. Atfer changing the table functionality test was performed and the program worked well. But we notice another problem when real load is applied to the application. we notice the reduced TPS.

From mysql command “show full processlist”, we saw UPDATE query in action.

So in default localhos mysql server i tried to run that run the same query againts +- 5000 rows innodb table & +-5000 rows myIsam table

UPDATE testisam SET sent = sent + 1 WHERE id = ‘5000’;

Table isam, 100 query update on particular row

Id            sent       startupdate                        endupdate
5000       99           2015-09-23 15:48:53        2015-09-23 15:48:53

execution time ~ 1 s


UPDATE testinno SET sent = sent + 1 WHERE id = ‘5000’;

Table inno, 100 query update on particular row

Id            sent       startupdate                        endupdate
5000       99           2015-09-23 15:47:07        2015-09-23 15:47:11

execution time ~5 s

From the result above, in default configuration, UPDATE query to single row on innodb table will take longer time than myIsam table. While it is true that InnoDB engine will prevent table locking, several tuning and changes in query should be made in order to work well with InnoDB table.

So because this “tuning & changes in query” will take sometime to learn/read. I decided to revert back to MyIsam table.. 😛


Kodi video and add-on sound problem raspberry pi2

in previous post ive install kodi on raspberry pi2.
installation was successfull and i can see kodi start screen on my tv. but what about its feature to play any videos (almost format) and music files?

the next step is to try some movie files with different display size, from sd to hd.
all SD file size was played smoothly by kodi. but for 1080p size first i saw lag on video.
to solve this lag problem it is suggested that we change gpu parameter in /boot/config.txt to be larger than 160. just to make sure it is larger than 160 i set it to 512 haha don’t know whether it was necessary or not. alongside with increasing gpu mem i also try menu raspi-config to do the overclocking.

now the bottom of my /boot/config.txt  looks like this



i did the reboot and tried to play the 1080p video file and other video file. Viola there was no lag. But some of the videos didn’t output sound. There was just no output sound.
i tought maybe it was codec problem. so i move to next step. Testing video add-on. and yes, the same problem appeared, all add-on video (display) was playing well, but there was no sound :(. i’ve tried several add-ons such as youtube,, and ted talk.

after some googling i found some posts suggest us to set some options in kodi setting > system > audio output. you can try by yourself. i found my issue was solved by doing this..

Step 1. Testing analogue output

1. setting > system > audio output2. plug your headset/earphone (3.5 mm jack) to your raspberry pi 2
3. back to kodi menu, choose audio output device, change from default PI:HDMI to other output device >> PI:analogue. Don’t forget to adjust kodi volume with your remote :D. set the volume up to make sure it was not reset to minimum volume.
4. the sound shoud’ve came up by now :). now you can listen with your earphone all the time, or output it to speaker (using 3.5 mm jack).

Now what you want is offcourse sound output on you tv (via hdmi).

1. now choose “Audion Output Device” back to original >> PI:HDMI.
2. see if the sound appear, if not now check the “Output Configuration” menu.
3. Change from default “Best Match” to “Fixed”. Check “Limit sampling rate” the default value is “48.0”.
4. “This is”, Now my video that previously didn’t output sound on HDMI audio ouput begin to sound :D. if it still not ouput anything try to change default value “48.0” with other value available in the menu. see if one gives you what you want. dont forget check the kodi volume (via remote) each time you try your configuration.

So far this solution works for me. hope it works for you too

KODI XBMC installation on raspbian raspberry pi

Kodi / XBMC enable raspbian raspberry pi to act as module to convert dumb tv to smart tv :). ill also add how to connect xbmc via android phone.

What you need:

1. raspberry pi
2. internet connection
3. mouse
4. wifi module (for remote application on adroid phone)
5. hdmi cable

Raspberry pi 2 kodi hdmi connection
Raspberry pi 2 kodi hdmi connection

Step by step.

A. Install kodi/xmbc

1. sudo apt-get update
2. apt-get install kodi

B. enable kodi on startup

1. sudo nano /etc/default/kodi
2. change ENABLED=0 to ENABLED=1

C. enable kodi keyboard & mouse input

1. sudo nano /etc/udev/rules.d/10-permissions.rules
2. add these lines
# input
KERNEL==”mouse*|mice|event*”,   MODE=”0660″, GROUP=”input”
KERNEL==”ts[0-9]*|uinput”,      MODE=”0660″, GROUP=”input”
KERNEL==”js[0-9]*”,             MODE=”0660″, GROUP=”input”

# tty
KERNEL==”tty[0-9]*”,            MODE=”0666″

# vchiq
SUBSYSTEM==”vchiq”,  GROUP=”video”, MODE=”0660″
3. Save file

4. Add user kodi to input group
sudo usermod -a -G input kodi

5. reboot
sudo reboot

on this point when you plug hdmi, xbmc/kodi display will appear on your monitor screen.
you can control xbmc input via your mouse :D.

kodi add-on 9gag tv
kodi add-on 9gag tv

Now if you want to connect raspberry pi xbmc / kodi via android phone, follow instructions below

D. Connect raspberry pi kodi/xbmc via android phone
1. on kodi/xbmc display, choose setting > webserver
2. click enable webserver option, edit webserver port with any number you like.
The default value is 8080 but u can change it if you also have other webserver application installed on your raspberry pi such as apache
3. edit username and password, default value is username:kodi, password:kodi
4. install xbmc remote application on your android phone.
5. connect your android phone & rasberry pi to your home network. (hotspot), input your raspberry ip address, and username, password for kodi on xbmc remote application
6. Viola, now you can control raspberry pi kodi/xbmc via your android phone.

Raspberry pi how to connect raspberry to android phone

After you are able to install and connect you raspberry pi via laptop and lan.
maybe its necesarry for you to connect your rasberry pi via android phone.

here is how

What you need.

1. wifi module
2. access to rasberry pi (via putty or direct).
3. android phone with SSH Client application installed
here is to download SSH Client application

Step by step

1. plug in wifi module to raspberry pi
2. turn on raspberry pi. enter ifconfig command, wlan0 should come up in list, but not connected to any address
pi@raspberrypi ~ $ ifconfig
wlan0     Link encap:Ethernet  HWaddr
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

4. turn on wifi hotspot/tethering on your android phone
5. enter command sudo iwlist wlan0 scan | grep ESSID

pi@raspberrypi ~ $ sudo iwlist wlan0 scan | grep ESSID
ESSID:”HP-Print-41-Officejet Pro 8600″

6. edit wpa_supplicant.conf
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
add this line

ssid=”your essid name/copy paste from earlier scan result”
psk=”you hotspot password”

for example with my handphone


7. save file, and reboot raspberry pi.
8. after reboot you’ll see that now your raspberry wlan module is connected to you hotspot. enter command sudo ifconfig wlan0 to see its ip address.
9. open SSH client on your android phone and enter raspberry pi address,
10. Now you can access your raspberry via your android phone. :D.

raspberry SSH from android phone
raspberry SSH from android phone

to restart raspberry networking you can enter this command instead rebooting raspberry
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start

Raspberry pi 2 installation without keyboard & monitor

I assume you already download raspbian and write image file to Micro SD.
the next step is then turning on the power and see if we can access raspberry pi via laptop.

what you need

1. 2 lan cable that is connected to router. (any lan cable that on the network that offer dhcp). 1 cable for your laptop, 1 cable is for raspberry pi.
2. nmap installed on windows.
3. windows powershell

Step by step

1. power on your raspberry pi, dont plug lan cable first.
2. on your laptop which is connected to lan cable, open powershell
windows logo –> type powershell.
3. type ipconfig command to determine your ip address & netwrok
for example

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix  . :
Link-local IPv6 Address . . . . . : x.x.x.x
IPv4 Address. . . . . . . . . . . :
Subnet Mask . . . . . . . . . . . :
Default Gateway . . . . . . . . . :

4. do nmap scan (ping scan) to record all up connection, and put it on file
nmap -v -sn “your network” | findstr “your network part only ip” | findstr /v down > first.txt
for example
nmap -v -sn | findstr “10.2.133.” | findstr /v down > first.txt

this will output any up ip address in your network before you connect you raspberry pi to your network

5. plug in lan cable to your raspberry pi, wait for a while to make sure raspberry pi got dhcp ip address. then enter this command on power shell
nmap -v -sn | findstr “192.168.1” | findstr /v down > second.txt
this will output any up ip address in your network including your raspberry pi connection.

6. compare two files to see which one is you raspberry pi address
compare those two files using this command on powershell
compare (Get-Content .\first.txt) (Get-Content .\second.txt)

example result :

InputObject                                                 SideIndicator
———–                                                 ————-
Nmap scan report for                          =>
Nmap scan report for                           =>
Nmap scan report for                           <=

7. open putty, and try to ssh each IP address listed in result. one of those ip address list is your raspberry pi ip address. input username: pi and password: raspberry to login via putty to you raspberry pi

login raspberry pi via putty
login raspberry pi via putty

8. delete unnecessary files. on powershell enter this command:
del first.txt second.txt

Raspberry pi Recover micro SD space

After installing raspberry pi on my microSD card, i found that my micro SD is not fast enough. if you want to do the test you can go here.

I had to replace my micro SD with another micro SD with bigger capaticy and faster write/read speed. however when i try to re format my micro SD (use it in my android phone). it is displayed that my micro SD size is only 56 Mb, while its capacity is actually 16GB. Where the rest of capacity?

in windows there is disk management tools to manage our partition
(windows logo -> type disk management
or Control Panel\System and Security\Administrative Tools select computer management menu storage click disk management.)

there, my Micro SD (displayed as disk 1) is separated into 2 partition :

56 Mb of FAT partition
14 Gb of unallocated partition

I found out that there is no option to recover unallocated partition via this disk management tool (or is it?).

so i google and got this one

We can use diskpart command via windows cmd. cmd –> type diskpart –> enter, new diskpart window will appear.
2. on diskpart run this command, be carefull, replace “disk 1” with disk name that match your micro SD card.

DISKPART> select disk 1

Disk 1 is now the selected disk.


DiskPart succeeded in cleaning the disk.

DISKPART> create partition primary

DiskPart succeeded in creating the specified partition.


3. after exit, if you open file explorer now micro SD size will display its actual size, right click and format with file format you want to use. mine is FAT32.