Tuesday, October 28, 2014

Webhost Phpmyadmin 4.1.8 Blank Page After Login

Just got this strange result of Phymyadmin 4.1.8 successful login return
white/blank screen. If you do think already input the correct
user and password of a database than simply reload the page and
you will get the phpmyadmin panels working.

Happy coding ^^

Android SQLite Example

 Stress out to find a good example of `How to Android SQLite` had leaded me
to collect piece-by-piece. The result a working apk that uses SQLite as database. The example below is from |1| but with little changes


package com.example.webview2;

import android.app.Activity;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity {

 // Constants
 public static final String DATABASE_NAME = "highscores.db";
 public static final String HIGH_SCORE_TABLE = "highscore";
 public static final String COLUMN_ID = "ID";
 public static final String COLUMN_SCORE = "SCORE";
 public static final String COLUMN_NAME = "NAME";

 public static SQLiteDatabase scoreDB;

 /** Called when the activity is first created. */
 public void onCreate(Bundle savedInstanceState) {

  final EditText editTextName = (EditText) findViewById(R.id.editTextName);
  final EditText editTextScore = (EditText) findViewById(R.id.editTextHighScore);
  final WebView webview = (WebView) findViewById(R.id.webview);

  // initial the database

  Button saveHighScore = (Button) findViewById(R.id.buttonSaveHighScore);

  OnClickListener clickListener = new OnClickListener() {

   public void onClick(View v) {

    // First get the values from the EditText
    String name = editTextName.getText().toString();
    int score = 0;

    try {
     score = Integer
    } catch (NumberFormatException e) {

    // Add the values
    ContentValues values = new ContentValues();
    values.put(COLUMN_NAME, name);
    values.put(COLUMN_SCORE, score);
    scoreDB.insert(HIGH_SCORE_TABLE, null, values);

    // Retrieve the new list of scores





  public void initDB()
    scoreDB = openOrCreateDatabase(DATABASE_NAME,
        | SQLiteDatabase.OPEN_READWRITE, null);

      + " VARCHAR, " + COLUMN_SCORE + " INT)");
 public void readData(WebView webview){

    Cursor c = scoreDB.query(HIGH_SCORE_TABLE, new String[] {
      COLUMN_NAME, COLUMN_SCORE }, null, null, null, null,
      COLUMN_SCORE + " DESC ");

    StringBuilder builder = new StringBuilder();

High Scores

"); c.moveToFirst(); for(int i=c.getCount()-1; i>=0; i--) { // Get the data builder.append(" "); // Move the cursor c.moveToNext(); } builder.append("
"); builder.append(c.getString(0)); builder.append(""); builder.append(c.getString(1)); builder.append("
"); webview.loadData(builder.toString(), "text/html", "UTF-8"); // Close the cursor c.close(); } @Override protected void onResume() { super.onResume(); initDB(); } @Override protected void onPause() { super.onPause(); if (scoreDB.isOpen()) { scoreDB.close(); } } }

For some of you who new to Android development then you could
continue to below instructions. For those who needs quick snippet
hope the code above will help.

1. Linux OS, i am using Fedora19 64bit. If you are using
    winOS or MaxOS you need to consult the manual from the
    Android Developer Website
2. Android SDK dan NDK 64bit, i don't use ADT (Eclipse) so excuse me
    if the next instructions are Command Line related.
3. Follow this official Android Developer tutorial on how to build an apk
4. Once a project created, then simply copy-paste the code above
    MainActivity.java located under /src///MainActivity.java
    Wheren subX and SubY depends how you defined your package during
    project creation
5. $ android 
    The syntax above is to run the android manager and do some updates.
    Make sure the build tools for your API is installed. If you don't then
    `no build tools` error will address you that the build tools needs to be
    installed via the android manager.
6. $ ant debug
    I assumed the build process will successful. If error like
    no build tools or whatever, indicates that you have not installed the build
    tools as stated at #5
7. $ android avd
    To run the emulator, but you need to set the arm images using the android
8. $ adb install -r bin/yourapp-debug.apk
    There will be upload indicator shown. The command line above was
    taken from here and thank you the easy way of install/uninstall
9. Your apk supposed to be in the emulator by this point.

Internet references
|1| Android and SQLite
|2| Android Developer Data Storage

Wednesday, October 8, 2014

Kivy 1.8.0 Python-for-Android Failed to Build Twisted module

Failed to built Twisted module in python-for-android ? Well you are in luck :D
You  could try this command below:

1. you are on python-for-android root dir

$ pwd

Your python-for-android root could be somewhere but mine is located
on /opt

$ ./distribute -m "zope setuptools pkg_resources twisted"

I found that at the end of the build virtualenv is being auto built
and in my case it failed to build but we don't need it anyway.
At this point i assume you are already successful to build twisted module.

Have fun ^^

Thursday, October 2, 2014

Linux Python 2.7.X Failed to Compile cmathmodule.c undefined reference to `_Py_log1p`

Compile Python 2.7.5 was never thought by me. As this article written
i had to compile Python from scratch. Just to troubleshoot why
Python-for-android `distribute.sh -m ``kivy``` failed to build.

Here is the log:

And found out that `_math.o` is required since where it has
the _Py_log1p defined. I manually exec this compile and
linker command as follow:

$ pwd

$ gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include   -DPy_BUILD_CORE  -c ./Modules/_math.c -o Modules/_math.o

$ ar rc libpython2.7.a Modules/threadmodule.o  Modules/signalmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/zipimport.o  Modules/symtablemodule.o  Modules/arraymodule.o Modules/_math.
_math.c  _math.h  _math.o

$ ar rc libpython2.7.a Modules/threadmodule.o  Modules/signalmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/zipimport.o  Modules/symtablemodule.o  Modules/arraymodule.o Modules/_math.o Modules/cmathmodule.o  Modules/mathmodule.o  Modules/_struct.o  Modules/timemodule.o  Modules/operator.o  Modules/_weakref.o  Modules/_randommodule.o  Modules/_collectionsmodule.o  Modules/itertoolsmodule.o  Modules/stropmodule.o  Modules/_functoolsmodule.o  Modules/_elementtree.o  Modules/datetimemodule.o  Modules/_bisectmodule.o  Modules/fcntlmodule.o  Modules/selectmodule.o  Modules/socketmodule.o  Modules/md5module.o Modules/md5.o  Modules/shamodule.o  Modules/sha256module.o  Modules/sha512module.o  Modules/binascii.o  Modules/parsermodule.o  Modules/cStringIO.o  Modules/cPickle.o  Modules/zlibmodule.o  Modules/xmlparse.o Modules/xmlrole.o Modules/xmltok.o Modules/pyexpat.o  Modules/xxsubtype.o

$ ranlib libpython2.7.a

$ gcc -pthread  -Xlinker -export-dynamic -o python Modules/python.o libpython2.7.a -lpthread -ldl  -lutil -L/usr/local/lib -lz    -lm

$ make

And Python 2.7.5 built success! I actually got the above syntax-es
from make, here how i did:

$ pwd

$ make -d > build.log

`make -d` will throw alot of commands that being executed.
Capture the output for later review and copy-paste. Share your

Sunday, September 7, 2014

Linux XUbuntu 14.04 Unlocked My blocked Wifi

Wow! Yes XUbuntu 14.04 deserved it. My Lenovo Ideapad Y450 Laptop had its wifi lock bit set.
Well it was locked by the technician whom repaired the charger IC. Lack of linux knowledge leaded
the technician to use winOS to boot my laptop by simply replace the harddrive. Disabled the wifi
by software and did not switch it back on.

I've been using Fedora for about 7 years. In Fedora 20, i have no idea to switch it back on.
Goggling and several trial and error had been attempted with no success. Okay, i dropped the case
and no longer want to find out how to switch it back on since i have a free wifi modem and got it
connect with cable therefor internet backs on!

After using the Fedora 20 for a while i think my hardware had defected and leads to unstable operation.
And the most of all is that my Chrome browser could not even stand out for 5 minutes. It crashes frequently
and so the desktop ( XFCE4 ). Curious if it is really hardware problem, i download the Chromium browser
project and tried to build it on linux. Arggh! The installer only build for ubuntu distro starts version of 10
through 14.

Ok! i download the XUbuntu 14.04 and using `dd` to create a liveUSB. Plugin and boot, Aha! my
wifi is now accessible and it is alive! Nice, now i have my wifi back to service :P and time to
build and debug the chromium browser.

Sunday, August 31, 2014

Linux: Clear all Logs

Found this answer to clear all logs in my /var/log/*
Really save my day, thank you

Wednesday, August 13, 2014

PHPExcel Max Rows 65356 Problem

PHPExcel to generate *.xls file with list of data around 140K rows but limited to only
showing 65356 (~65K) rows per worksheet/sheet. Are you having the same problem like me?
If you are, then simply split the data to multiple sheets. Lets say i have 140K of data
then split the datas to 3 worksheets.

Done? Not quite. I had tried to implements the workaround to split the datas but
the loading process of the data, it pop-up a dialog with error message in microsoft-office
while other office application don't, then blank multiple sheets. If you set the name for
each sheet then you will see that the sheets are succesful renamed or set to desired name.

How come? well i do not have the exact answer but after some trials and errors,
i come up with 39999 (~39K) rows max for each sheet. And everything works as expected.
After i set the data to 300K and split the datas to multiple sheets with ~39K rows
per sheet, all the data generated and shown as expected.

So the real max rows for a workbook with multiple sheets is ~39K rows while
~65K rows for a workbook with a single worksheet. Hope this article would help.

Happy coding

Monday, August 4, 2014

Linux Remote Desktop Without Login

Remote Desktop options already set allow to connect and password is set.
But whenever you reboot and try to connect, you only see black screen.
Well you need to install tigervnc-server. I am using Fedora then

$ sudo yum install tigervnc-server

Edit /etc/sysconfig/vncservers to your desire, but keep in mind that:

1. Make sure the setting of  `1` then [1]  should match.
2. Check using ps -ef | grep vnc, and find rfbport 590X.
    where X shud match your configuration
3. If you set to config 1:yourusername then the rfbport will be
    5900 + 1 => rfbport 5901, where 5900 is the standard port of vnc
4. Similar to #3 if you set config 2:othername then the rfbport will be
    5900 + 2 => rfbport 5902
5. When you try to connect do not forget to specify to which port you
    are trying to connect. IP:PortNumber,
    If no port specified then default port to be connected is 5900
6. Check your firewall, make sure it allows connection to tcp with
    destination port 5900:5910 (port 5900 to port 5910)
7. auto start vncserver during startup, in my fedora simply
    $ sudo chkconfig vncserver on

Hopefully you will have successful connection to your target remote desktop
without any login at the target remote desktop.

Monday, July 21, 2014

CI 2.1.2 Profiler shows Warning at line 509, expected string got Object

Just want to note what i just found a bug of CI 2.1.2 in system/library/Profiler.php.
Where the $val is not evaluated to is_object and only expecting is_string() or is_array().
With no validation of is_object() the profiler triggers warning and it is ugly :D

Adding validation is_object() would fixed the warning.

at line 509:
if (is_array($val) )
$val = print_r($val, TRUE);

if (is_array($val) or is_object( $val))
$val = print_r($val, TRUE);


Saturday, June 7, 2014

JAVASCRIPT KeyPress Return Modified KeyCode

Streesss.. yup trying to solve a problem, that everytime a user hit single or double quote inside
input or textarea the keyCode should be return ` or `` respectively. Googling and found:
1. Dispatching Custom Event
2. Clever get cursor and insert char Solution

The #2 is my best solution. Also learn new stuf with #1. This is a short article but will found
very useful with the links. Keep coding.

LXDE Screenshot

Migrating from Gnome3 to LXDE  is so much fun! Experiencing lightweight desktop.
But hitting my PrtSc resulting no respon... What? Argghh i have to added manually.
The keybinding of PrtSc to LXDE. Calm down.. it wont hurt you anyway. Here is
the How-to:

1. $ sudo yum install -y scrot
2. create a bash-script then copy-paste and name it screenshot.sh

scrot '%Y-%m-%d%H:%M:%S_scrot.png' -e 'mv $f /home/adesanto/Pictures'

3. $ sudo chmod a+x screenshoot.sh
4. Copy the script to /usr/local/bin/screenshot.sh
5. Add this code into ~/.config/openbox/lxde-rc.xml


6. $ openbox --reconfigure

For additional feature i would like to have a click or snap sound whenever my PrtSc button
got hit/press. Edit the screenshot.sh to

scrot '%Y-%m-%d%H:%M:%S_scrot.png' -e 'mv $f /home/adesanto/Pictures' && paplay /opt/android-sdk-linux/samples/android-13/AccessibilityService/res/raw/sound_view_clicked.ogg

Notice i am using paplay to play an *.ogg file. Fedora has this as default application.
Have fun!

Thursday, June 5, 2014

LXDE, Lightweight Desktop. Touchpad Tap to be Disabled

My installed Fedora 19 is shipped with Gnome3 as default desktop, actually i downloaded the installer which Gnome3 default. The experiences learned that most of the applications run kinda unstable and
specially when my system wake-up from sleep or hibernation. My frequent applications are:
1. GVim
2. Chrome (browser)
3. sqldeveloper
4. Terminal
5. Skype
6. Empathy

Whenever the Sqldeveloper runs the problem starts to rise. The Gnome-shell could hit to 430MB++,
sqldeveloper usually hits around 400MB++, and the other applications shrink my 4GB memory
to +-700MB free left. Lucky to me to drop Eclipse as primary IDE/Editor, usually takes
around 500MB++.

Browsing on the net returned me with Cinnamon as lightwright desktop, but hummm... wait.
Somebody talks about LXDE, glorius victory! I just punch the keyboard straight

$ sudo yum -y install @lxde

Hurrayy! But wait.. my touchpad seems to sensitive. Setting using Keyboard/Mouse at Prefferences
does not help to reduce the touchpad Tap sensitivity. Browsing.. aha! Use gpointing-device-settings!

$ sudo yum -y install gpointing-device-settings

Run... select the tapping and disable. Problem solved and very happy with LXDE.
All my applications are run smooth, the 7 frequently used mentioned before.

Wednesday, February 19, 2014

Fedora 19 Gnome Synaptics Vertical Edge Scroll Permanently

Hi, just playing around and accidentally delete my ~/.config ~/.gnome and ~/.gnome2.
All my settings are reset and my touchpad no longer be able to vertical edge scrolling.
Googling with a little light pointing me to do $ man synaptics. 

The manual page was like hieroglyph but re-read over and over again earned
me some of knowledge to set some of the synaptics properties.
So here is my ~/.profile, i added 2 lines of the properties at the end of the file

xinput --set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Edge Scrolling" 1 1 0

As the manual says:

Synaptics Edge Scrolling
              8 bit (BOOL), 3 values, vertical, horizontal, corner

where the "1 1 0" meaning Vertical "on", Horizontal "on", Corner "off".

Happy scrolling ^^

Tuesday, February 18, 2014

Linux Gnome Login to Black Screen and Loop

Arghh... Linux Gnome Login to Black Screen and Loop. Something gone wrong
and i do not know what caused the loop. The ~/.xsession-errors shows:

[2350:2350:3195506791:ERROR:chrome_browser_main_x11.cc(62)] X IO Error detected
thunderbird12: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.
gnome-panel: Fatal IO error 0 (Success) on X server :0.0.
thunderbird12: Fatal IO error 2 (No such file or directory) on X server :0.0.
exe: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.
exe: Fatal IO error 2 (No such file or directory) on X server :0.0.
XOpenDisplay() failed
gnome-power-manager: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.

** (gnome-power-manager:1850): WARNING **: Failed to send buffer

** (gnome-power-manager:1850): WARNING **: Failed to send buffer
The application 'gnome-power-manager' lost its connection to the display :0.0;
most likely the X server was shut down or you killed/destroyed
the application.

To be honest i don't understand what was going on. Googling for hours end up
with a conclusion that the ~/.config has gone wrong. Since login using other user
account works fine. Then i come out with:

1. Open other terminal Ctrl+Alt+F2
2. $ sudo service gdm stop
3. Using current terminal issue $ sudo service gdm start
4. Expected result is new gnome session is running
5. And then shutdown/reboot the OS from the gnome session
    *) It forces the current configutation saved into ~/.config ~/.gnome ~/.gnome2
6. Expected result is after rebooting you are already be able to login and no more loop.

The solution above does not required to delete any files. Happy solving ^^

Friday, January 24, 2014

USBAspLoader with Atmega16A-PU Atmega16 Atmega32A-PU Atmega32

Running USBAspLoader atmega8A-16PU with no problem. It was a very victorious moment.
Since i am a newbie in micro-controller. Began with a little conversation in the electronic group.
That somebody has a problem to get the USBAspLoader run in atmega16. Thanks to him,
i encouraged myself to fork the source code at github and succeeded.

Here are the steps to setup everything to work (well i works in my case):
1. Clone or Download the code from the github.
2. The Makefile.inc already set the target MCU to atmega16 with xtal 16MHz
3. Plugin your ISP ( i use my cloned arduino as ISP)
4. Modify Makefile.inc if necessary to match-up your programmer.
    ( i use avrdude and notice i have set the -P /dev/ttyACM0, modfiy
      to match yours)
5. Goto the directory above firmware directory.
    $ make fuse
    $ make flash
6. At the hardware site make sure to arrange the 2 capacitors as described in 
    the schematic.

As you could noticed, the schematic is taken from metaboard and applies the same with Atmega16A. 
The jumper needs to be actived low to enable bootloader mode. Thus if the jumper
removed it will be running the program inside the Flash memory. Another catch-up 
was to unplugged arduino or other v-usb device, otherwise the OS 
( am using Fedora 19 64bit kernel 3.11.10-200.fc19.x86_64 ) will 
shows error that the manufacturer not found.

Have fun!

Linux Eagle 6.5.0 missing libssl.so.1.0.0 and libcrypto.so.1.0.0 How to

So excited to know the popular Eagle CAD an Electronic Design Automation tool is available
in Linux
. So got it download from cadsoftusa freeware. I am running Fedora 19 64bit
Kernel is 3.11.10-200.fc19.x86_64.

The eagle CAD is pre-compiled, so executed with
$ ~/eagle-6.5.0/bin/eagle
It throw error that libssl.so.1.0.0 not found.

I have made sure that OpenSSL is installed. Why it could not found the shared library.
$ locate libssl

Ahah! The solution is simple, just create a new symlink foreach lib and lib64:
# cd /usr/lib
# ln -s /usr/lib/libssl.so.10 /usr/lib/libssl.so.1.0.0
# ln -s /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so.1.0.0
# cd /usr/lib64
# ln -s /usr/lib/libssl.so.10 /usr/lib/libssl.so.1.0.0
# ln -s /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so.1.0.0
**) notice that i use '#' to denote creating the symlink using root

I found out that the Eagle CAD needs the libcrypto.so.1.0.0 too.
Now it runs smoothly. Have fun!

Monday, January 20, 2014

Linux AVR-CDC ttyACM Open and Close by modem-manager

Got stuck with my avr-cdc device detected as ttyACM. Ever since my kernel upgraded to
3.11.10-200.fc19.x86_64 the modem-manager takes place and keep restarting my avr-cdc.
I ended up stuck unable to upload any sketch to my arduino.

After googling for about an hour to find proper way to disable the modem-manager, no luck.
Ok, i will do it my way. Simply rename the modem-manager in /usr/sbin/modem-manager
to modem-manager-removed and kill the process. Ahah! It never restart anymore since
the kernel could not find the modem-manager application anymore.

Playing with my arduino with no problem :D