Thursday, February 12, 2015

What causes Mozilla Thunderbird to Freeze constantly?

The last 1 month after a re-installation of MS Windows 8 and Mozilla Thunderbird, some productivity have drop and temper going up. One of the reasons is due to Thunderbird 31.4 freezing constantly.

Thunderbird email client, have always been on my Linux and MS Windows PC for years. But somehow, something changed that caused a lot of difficulties for me to work with emails. It is not clear when this started but its about the time I re-installed the computer.

Thunderbird setup:

  1. Thunderbird updated to version 31.4.0
  2. Email profile uses IMAP with the SMTP server in the same local network. There are few folders apart from the standard INBOX, SENT, which is less than 12 folders. Check for new messages is set to every 10 minutes and at startup.
  3. Address book includes sync with Google contacts
  4. Calendar includes Lightning sync with Google calendars
  5. Local folder is contains standard folders, which is less than 5 folders.
  6. The Profile folder is in the onedrive folder


  1. After login, every 1 to 10 minutes Thunderbird freezes rather randomly. This "freeze" last about 30 seconds to 3 minutes and its not predictable.
  2. After I stop onedrive sync, problem still persist.
  3. Disconnect network and problem still persist.
Findings (to some extend)
Its unfortunate that I could not exactly identify the problem but I found 2 steps taken that have made this "freeze" vanish. In rush to resolve the problem, I did both at the same time.
  1. Using the Windows Explorer, access the C:\users\username and right click "appdata" folder, click "Advanced". UNCHECK Allow files in this folder to have contents indexed in addition to file properties, click "OK". Click "Apply" and choose to include subfolders.
  2. Open McAfee Internet Security Suite, it the default antivirus on the computer. Click on Real-Time Scanning (status is ON). Click "Real-Time Scanning:", current status is again On. Click "Settings", UNCHECK Email attachments. CHECK Strike a balance between the scan throroughness and my PC's speed (Recommended). Go back to the antivirus main screen, and turn off the "Scheduled Scans:"
If you encounter the same problem, do test and see which works for you.

Monday, February 2, 2015

Install Android Studio on Microsoft Windows 8

Android SDK is used for the development of Android mobile application and it utilises Java Technology. There are a number of ways to develop Android application but using command line, notepad or IDE, they will all require the basic system requirements;

  1. Java development Kit (JDK)
  2. Android SDK Tools. Alternatively, the Android Studio can be installed which comes with all the required SDK.
Following are steps to prepare for Android development on MS Windows 8 64-bit.

Step 1: 

Read information provided at the Android developer site. Then read up installation at Java site. More materials on JDK 7 is at
Good point to note is that Oracle has declared that the year 2015 is the end of public updates for JDK 7.

Following steps are just additional guide in case you prefer not to read fully the official installation guides.

Step 2:

Download JDK and install. At the point of writing, JDK 7 (jdk-7u25-windows-x64.exe) is downloaded from Oracle. Uccess MS Windows with Administration right to install and double click to start installation. This will have the JDK installed at C:\Program Files\Java\jdk1.7.0_25 which also installs a public JRE at C:\Program Files\Java\jre7 directory.

Click the Windows 8 search icon ->Settings, and type "Variable". Click on option to edit the system environment variables, then click "Environment variables", locate the system variables area, click the Variable "Path", then click "Edit". Append to the end of the "Variable value:"

;C:\Program Files\Java\jdk1.7.0_25\bin

Then click "OK".

Next, in  System variables, click "New..." and enter following values;
value: C:\Program Files\Java\jdk1.7.0_25

Then click "OK" until all the window closes.

Step 3:

Download and install the Android studio bundle from Double click and follow the installation instructions.

Note: this install at C:\Program Files\Android\Android Studio
and the SDK location: C:\Users\tboxmy\AppData\Local\Android\sdk

There is an option to manually install Android SDK Tools which is at revision 24.0.2. Ignore it.

Step 4:

Start Android Studio, start a new project and click
Tools-> Android-> SDK Manager.

It should recommend to install several basic packages to compile using the latest SDK (or Android). If you intend to compile for the Android 3.0 API, then check the box for "Android 3.0 (API 11)".

Click on the "Install ... packages..." button. Click on the accept license, then "Install".

Post Installation

  1. If your PC have the Intel Virtualization Technology feature, install Intel HAXM (see link) to speed up the Android Emulator. 
  2. Update the Android Studio (see My past post).
  3. Access the Android command line with ADB (see Debug Android App in Android Studio)

Post install notes:

These are just ramblings and just for personal reference.

As a minimum when setting up the Android SDK, download the latest tools and Android platform:

1. Open the Tools directory and select:
        Android SDK Tools
        Android SDK Platform-tools
        Android SDK Build-tools (highest version)
2. Open the first Android X.X folder (the latest version) and select:
        SDK Platform
        A system image for the emulator, such as
        ARM EABI v7a System Image


Proceed to create the first application from


Howto Update to Android Studio 1.1

The Android Studio 1.1 Preview 2 is released to address bug fixes. Many new Android developers will benefit lots from the bug fixes and will have better experience on Android development with this powerful IDE.

Look for details on the update at One nice feature is having the AVD Manager on a separate window. This is great for multi display set ups.

Thursday, January 8, 2015

Android: Calling Toast in Fragment class

A quick way to pop up messages within Android application is to use the Toast class. This doesn't require users to click any button for it to go away and helps in debugging Android interaction. The class reference can be found at An introduction to use of Toast can be found at It shows the basics of Toast and how to position it.

Syntax for the Toast is straight forward as the static function makeText is used. Syntax:

makeText(Context context, int resId, int duration)
makeText(Context context, CharSequence text, int duration)

Both gets the Context as the 1st param where this is commonly called via  the getApplicationContext() function from the Activity class. This is common in examples to use the ListView, e.g. Vogella.

Following error is given if this function is used outside of an Activity class;

can't resolve method getApplicationContext()

Sometimes, a piece of the user interface is separated from the Activity into smaller chunk called the Fragment class. For example, getting the Toast to pop up messages in the class that extends Fragment class involves getting the Activity context to be used in the Toast 1st param. Use the function getActivity( ) in Fragment class instead of getApplicationContext( ) function in Activity class.

In the example below, the Toast will contain message from text retrieved in the ListView.

ListView lv = (ListView) rootView.findViewById(;
        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView parent, View view, int position, long id) {
                int duration = Toast.LENGTH_SHORT;
                String text = (String)parent.getItemAtPosition(position);

                Toast toast = Toast.makeText(getActivity(), text, duration);


Project build: minSdkVersion 10

Monday, December 22, 2014

Debug Android App in Android Studio

In MS Windows, Android Studio provides debugging options in its IDE.

For some who prefer to use the command line, there is the command adb to call debugging. Example

adb logcat

But if you get an error that is similar to;

'adb' is not recognized as an internal or external command, operable program or batch file.

Then, the adb path must be made known. Here are notes for MS Windows 8, with Android Studio version 1.0.1

Step 1: Copy the path for the Android Platform-Tools.

This is by default 
C:\Users\[YOUR USERNAME]\AppData\Local\Android\sdk\platform-tools

Replace [YOUR USERNAME] with the username in use by your system. This means that the computer lab should have done this, otherwise "Administration" rights is needed.

Step 2: Edit the MS Windows, System Environment's Path variable

Open the Windows Environment Variables in System Properties. Add (or Edit) to the end of Path variable in "System variables" with the value in step 1 above. Close all the boxes and restart the MS Windows all "cmd" terminal.

Step 3: Test

Unplug the Android device OR turnoff the emulator. In the Android Studio's command prompt OR in MS Windows cmd prompt type 2 commands to test;

> adb version 
Android Debug Bridge version 1.0.32
> adb logcat
- waiting for device -

Quick Guide to Using ADB 

Following are basic commands to use the debugger from a terminal. Firstly, plugin a device (or start up an Android emulator). The ">" below is a prompt to enter commands from the command line.

List available emulator or devices
> adb devices
List of devices attached
4df7a2af25be30c1        device

In the above example, "4df7a2af25be30c1" is the attached mobile Android device.

Access the emulator or device shell
> adb shell
or a specific device
> adb -s 4df7a2af25be30c1 shell

From here, you can issue commands within the device. Press Ctrl - D to exit.
One commonly used command is logcat to display logging info of the application. Code learn provides some basic tips.

Display memory usage by application
> adb -s 4df7a2af25be30c1 shell dumpsys meminfo

or by a specific application

> adb -s 4df7a2af25be30c1 shell dumpsys meminfo  com.example.tboxmy.helloworld

Tuesday, December 16, 2014

Howto Linux Pretty Prompts

The linux terminal provides many useful functions to improve productivity and looks. Just imagine always having to access many remote Linux servers or creating sub shells and then forgetting which server or shell are you keying in the commands.

In the Bash shell, there as a programmable prompt (so to speak). It uses the variable named PS1 and PS2. For a beginner, its good to know how to modify the prompt displayed, change its colours and applying it to a single user or as default for all. Bash 4.2 added support for unicode which means way more fonts are available to make pretty prompts.


A simple assignment of the prompt is as follows;

export PS1='Demo$ '

The space after the '$' is commonly used to make typing more readable.

The prompt can be assigned with the Bash shell special characters. Some are visible and other not. Following list some of these characters;
\d     the date  in  "Weekday  Month  Date"  format (e.g., "Tue May 26")
\e     an ASCII escape character (033)
\h     the hostname up to the first '.'
\H    the hostname
\t      the current time in 24-hour HH:MM:SS format
\T     the current time in 12-hour HH:MM:SS format
\@     the current time in 12-hour am/pm format
\w     the current working directory
\W     the basename of current working directory

Example 1: Common prompt lets user know their login user name, server host name and working directory.
export PS1='[\u@\h \W]\$'

Example 2: Display time the prompt was executed.
export PS1='\t:\w$ '

Example 3: A two line prompt which documents the last history number.
export PS1='=\d \u@\h \!=\n\t $ '


The prompt supports colours as defined by ANSI (see This is in the format to display colours;


Example of ANSI colours
Black      0;30m       Dark Gray    1;30m
Red        0;31m       Bold Red     1;31m
Green      0;32m       Bold Green   1;32m
Yellow     0;33m       Bold Yellow  1;33m
Blue       0;34m       Bold Blue    1;34m
Purple     0;35m       Bold Purple  1;35m
Cyan       0;36m       Bold Cyan    1;36m
Light Gray 0;37m       White        1;37m

The first digit 0=normal, 1=bold, 4=underline and each code ends with the letter 'm'. At end of prompt, return to the default colour, with \[\e[m\]

Colour 40m onwards can be used to highlight the background.

Example 1: Prompt is in blue and user types in blue.
export PS1='[\[\e[0;34m\]\u@\h \W]\$ '

Example 2:Prompt is in blue and user types using default font colours.
export PS1='[\[\e[0;34m\]\u@\h \W]\$\[\e[m\] '

Example 3: Highlight text in prompt
export PS1='\[\e[1;34m\]\u\[\e[1;33m\]@\[\e[1;32m\]\h\[\e[1;37m\]:\[\e[1;31m\]\w \[\e[1;36m\]\$ \[\e[m\]'

Example 4: Blue background with red text.
export PS1='\[\e[44m\]\[\e[1;31m\][\u@\h \W]\$\[\e[m\] '

Saving changes

This PS1 value can be set in /etc/bashrc to be used by all users. Each user can change their prompt by editing the file ~/.bashrc with this PS1 or PS2 assignment.

Example: ~/.bashrc file
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc

# User specific aliases and functions

export PS1='[\[\e[0;34m\]\u@\h \W]\$\[\e[m\] '

Advanced prompt

To run a command before the bash prompt is displayed, use PROMPT_COMMAND. This supports many more flexible formatting of values for advance Linux administrators.

PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}" ' \
export PS1='[\[\e[0;34m\]\u@\h \W]\$\[\e[m\] '

Example 2: Charles Torvalds Basic Power Prompt
PROMPT_COMMAND='history -a;echo -en "\033[m\033[38;5;2m"$(( `sed -n "s/MemFree:[\t ]\+\([0-9]\+\) kB/\1/p" /proc/meminfo`/1024))"\033[38;5;22m/"$((`sed -n "s/MemTotal:[\t ]\+\([0-9]\+\) kB/\1/Ip" /proc/meminfo`/1024 ))MB"\t\033[m\033[38;5;55m$(< /proc/loadavg)\033[m"' \
PS1='\[\e[m\n\e[1;30m\][$$:$PPID \j:\!\[\e[1;30m\]]\[\e[0;36m\] \T \d \[\e[1;30m\][\[\e[1;34m\]\u@\H\[\e[1;30m\]:\[\e[0;37m\]${SSH_TTY} \[\e[0;32m\]+${SHLVL}\[\e[1;30m\]] \[\e[1;37m\]\w\[\e[0;37m\] \n($SHLVL:\!)\$ '


If you have Bash 4.2 onwards, then unicode characters can be added. First find a UTF 8 bit unicode you like from UTF8 or unicodelookup. Bash provide good number of symbols but does not map to 100% of the unicodes.

Ramblings...In UTF-8 unicode for U+2620, Hex is 2620 in Octal is 023040, in Decimal is 9760 and HTML is &#9760.

Example 1: Display skull and bones U+2620 or UTF-8 for URI encoding is E2 98 A0. The Octal equivalent is 342 230 240.
export PS1='[\u@\h \W]\342\230\240 '

Example 2: Display helm symbol U+2388 (See unicode) which is UTF-8 for URI encoding e2 8e 88
export PS1='[\u@\h \W]\342\216\210 '

Example 3: Multi line prompt
export PS1='\342\214\210\d \t \W\342\214\211\n\342\216\210 '


Wednesday, December 10, 2014

Howto Install Joomla 3 on MS Windows 8

Content Management Systems (CMS) provides a simple framework to focus on developing a web site to deliver specific contents. Basic stuff like user authentication, layout and web standards will be handled by the CMS while more important stuffs like getting the message across and providing a specific service can be the main focus.

Yes, gain insights of experts and community around the world by using a CMS like Joomla! that practices use of open source software (OSS) license.

Installation was done based on notes from at!_on_your_own_computer

Following are my notes on installation of Joomla! 3.3.6 on Windows 8. Before going to step 1, ensure the web server has;

Apache 2.4
PHP 5.4 (min 5.3.10), enable following PHP modules
  • Magic Quotes GPC Off
  • Register Globals Off   
  • Zlib Compression Support 
  • XML Support   
  • Database Support: (mysql, mysqli, pdo)  
  • MB Language is Default 
  • MB String Overload Off  
  • INI Parser Support    
  • JSON Support  
  • configuration.php Writeable
MySQL 5.5

Step 1: Getting Joomla!

Download Joomla! from and extract it to a folder, e.g. myjoomla.
Copy this to your web folder. e.g. C:\apache24htdocs

Step 2: Preparation

Create a MySQL database called myjoomla3. Login to MySQL client and type;

CREATE database myjoomla3;

 And logout.

Step 3: Installation

Open a web browser and enter URL Address. E.g. http://localhost/myjoomla and enter details. Complete the sections for "Configuration", "Database", "Overview".


I choose to create the default Administrator username as "admin".

Ensure the configuration for database created is entered correctly. Choose MYSQLi if you are prompted to do so.

Choose Install Sample Data: Default English (GB) Sample Data

Click "Install". When installation is completed, you will receive the confirmation message "Congratulations! Joomla! is now installed."

Open Windows Explorer and remove the installation folder in joomla named installation. E.g. C:\Apache24\htdocs\myjoomla\installation

Step 4: Post installation

Test the installation with a web browser as;
  1.  front-end page  at http://localhost/myjoomla/
  2.  site administration page  at http://localhost/myjoomla/administrator/
First access: Front-end on desktop

First access: Front-end on mobile
First access:Administration page

Step 5: Choosing a template

This is an extra step for looks. In a web browser open the Administration page, e.g. http://localhost/myjoomla/administrator

In the default Administration page, observer the left column and click "Template Manager". In the left menu choose "Styles". There are 4 styles available for you;
  1. Beez3 (for Front-end)
  2. Hathor (for Administration page)
  3. isis (Default for Administration page)
  4. protostar (Default for Front-end)
 Try to click on Hathor, notice the page has changed. Click Beez3, and in Front-end see the changes.


Wednesday, December 3, 2014

Install DebugKit for Cakephp 2.5

Debugging in Cakephp is made easier with the DebugKit. Here are steps to install the DebugKit on Centos 6 and CakePHP 2.5.6.

Following are notes based on installation instructions from the Debugkit site.

Step 1: Install CakePHP 2

See previous posting on Installing Cakephp.

Step 2: Download and extract

Read the instructions from DebugKit from Github then download and extract to the cakephp folder app/Plugin.

cd /var/www/html/cakephp-2.5.6/app/Plugin
mv debug_kit-master debug_kit
chown -R apache debug_kit-master

Step 3: Configure CakePHP

In app/Config/bootstrap.php add following line;


In app/Controller/AppController.php edit the class with the array line;

class AppController extends Controller {
         public $components = array('DebugKit.Toolbar');

In app/Config/core.php change debug from 2 to 1
         Configure::write('debug', 1);

Note: The Make sure to remove the 'sql_dump' element from your layout (usually app/View/Layouts/default.ctp)

In a web browser open the cakephp site to confirm if Debugkit is available. e.g. http://localhost/cakephp-2.5.6

Howto install CakePHP 2.5 on Centos 6

Installation of this PHP programming framework is based on the installation guide CakePHP from There is a document on upgrades from CakePHP 1.3, here.

The Centos Linux 6.4 setup based on requirements:
httpd 2.2.15-28x

Step 1: Extract Cakephp 

Download the code from
or from Linux console with proper permission (e.g. use sudo if you are not root user)

cd /var/www/html
chown -R apache cakephp-2.5.6
ls cakephp-2.5.6

This gives us the folders;
Cakephp2 folders

Cakephp2 folders for app

Step 2: Test installation

Ensure the web server is running, and open a web browser to that installation. E.g. http://localhost/cakephp-2.5.6/

It should appear with a page similar as below;

Step 3: Post installation

Follow instructions given at the test page to rectify any errors/recommendations. E.g.
  1. Change value of Security.salt in core.php file
  2. Change value of Security.cipherSeed in core.php file
  3. Configure to use a database in database.php
  4. Install the DebugKit
Its made easy to migrate from CakePHP 1.3 to 2.5. Good read on upgrading of 1.3 to 2 (in no particular order)
  1.  stacks
  2. Upgrade to CakePHP 2.
  3. CakePHP Migration.
  4. Authentication.

List files as a tree in Linux

Usually we have the directory listing as follows;

ls -l

Can we print the linux directory in a tree format? Yes we have several options, of which two is shown here.

Option 1

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'

Option 2

Install the tree package (Steve Baker, Francesc Rocher) then execute it.

This command can specify depth of folders.
tree -L 2