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. 

Tuesday, September 29, 2015

Tutorial on Multiple Fragments in Activity

Here is an example to describe in codes how to create Fragment classes with Android Studio 1.4.

I wanted to be able to receive Button events and switch the Fragment depending on user selection. Need to be careful with rendering the layouts lower than API 23, as it did not generate the Design view properly.

Android Fragments in an Activity

Friday, September 25, 2015

Notes on the Sunshine app

Reviewed back lessons over last few months.

"Notes on Udacity Developing Android Apps"

Biggest problem was not passing the correct object to the ViewList. It kept giving a null error upon running the application.

The logging system was truly helpful for errors at runtime.

Upgrade to Android Studio 1.4 RC2

That was fast, RC1 was out in early September 2015 and shortly after that RC2 is released on 23 September. View the upgrade installation for Canary channel, RC1 at "Upgrade to Android Studio 1.4 RC1". Upgrade was smooth and without any problem recompiling target API 21 apk.

RC2 provide bug fixes and includes;

  • Update to the Theme Editor (using style.xml files)
  • In performance monitors it includes GPU and network profiler
  • The Vector Asset Wizard creates Android XML vector drawables, icons, from SVG files
  • Improved Android permission checks 
It is stable in terms of use and will surely provide a good experience for first time Android developers. With Android Studio 1.4, education institutions will surely be able to introduce Android Programming to a more advanced level, similar to how C++ was widely used.

Here are steps to upgrade RC2 from RC1;

Step 1: Check for updates

Start Android Studio and in the menu choose Help-> Check for Updates...
Click "Update and Restart". Ensure you have administrator rights to update the application or accept the request to update if such a request window appears.

Step 2: Restart Android Studio

This would be automatic if all went well. Verify RC2 is installed in the About.


Monday, September 21, 2015

Upgrade to Android Studio 1.4 RC1

Just saw there is an update to Android Studio to version 1.4RC1.

In existing Android Studio 1.1, update can be done easily with these steps;

(Tested on MS Windows 8.1)

Step 1: Update Android Studio

Open existing Android Studio (in this case its version 1.1) and click "Check", which is at the bottom of the Android Studio start page.

Step 2: Update configuration

After it searches for update on the Internet, click "Update and Restart"

After it has installed the update, choose to import my settings from a previous version (keep existing configuration).

Step 3: Update Plugin and other components

Platform and Plugin Updates, click "update". Click "Update now".

Click "Exit Studio and launch SDK Manager".
Choose "Install .. packages..." button. Choose ".

In Choose Packages to Install, choose "Accept License and click Install. My case above, it took 2.9GB of downloads.

Start Android Studio and complete rest of installation.

See an example of creating an Android Studio Project.


Problem 1. After creating a new project, there is an Gradle sync error:

Warning:The project encoding (windows-1252) does not match the encoding specified in the Gradle build files (UTF-8). This can lead to serious bugs.

Solution: Upon new installation, the default IDE encoding uses Windows-1252 instead of UTF-8 as in project files. Change this from Android Studio menu File-> Settings-> Editor->File Encodings

Change the default encoding for project files to UTF-8. Click OK. Restart Android Studio and create a new project.

Problem 2: Rendering Problems.

Build the project.


Sunday, September 20, 2015

Samsung S5 Wifi not connecting automatically

Samsung S5 is a powerful Android mobile phone. In May 2015, the S5 received an update to Android 5.0 but has since had a problem with the wifi.

The smart network switch automatically switches from wifi when it gets weak, to mobile data. Usually, to save on mobile data its a good idea to turn it off. This way, even if wifi is weak it still stays on until signal is lost.

It can connect to wifi. However even after choosing smart wifi, it does not automatically reconnect when returning to the most wifi access point (AP) that it has saved the password. I say most because it can connect to open public wifi like Starbucks.

Previously, before the upgrade it was able to connect without problem.

Even resetting to factory did not help. Probably had something to do with me restoring my backup.

Here is how I got it working, clearing the S5 phone cache.

Step 1: Power off the S5

Step 2: At same time hold down following keys;
Volume up, power on/off, Home.

When it vibrates or see the galaxy start screen, release the power on/off.

Step 3: clear cache and restart
Use the volume key to select clear cache. Press the power button.

Once it says cache cleared, use volume button to select restart of phone and press power button.


Thursday, September 17, 2015

Howto Screenshot Desktop

The print screen key or "PrtSc" can be used to create a screenshot of the desktop and windows. This will activate gnome-screenshot from the gnome-utils package.

Gnome-utils contain;

  • dictionary
  • disk usage analyser
  • screenshot tool
  • search 

By default on a server setup of Centos Linux 6, the screenshot is not installed. This can be done easily.

Step 1: Install gnome-screenshot

As a admin role (root) at the terminal, type
# yum install gnome-utils

Step 2: Take screenshot of desktop or active windows

Screenshot of desktop
Press the print screen key or "PrtSc"

Screenshot of active window
Hold "Alt" key and press the print screen key or "PrtSc"

Edit the graphics name and press Save.

Delayed screenshot
This is useful if the screenshot can only be taken without user intervention.

  1. On desktop menu click Applications-> Accessories-> Take Screenshot
  2. Choose which area of desktop to take screenshot and enter the number of seconds for "Grab after a delay of ___ seconds.
  3. Click "Take Screenshot"


Paint program on Centos

Linux comes with open source software (OSS) for graphics editing, such as XPaint, GIMP and Tuxpaint. Vector editing can be done with Inkscape and xfig.

XPaint is a light weight program to do simple graphics editing and carries the GPL license.

Currently maintained by Jean-Pierre Demailly, but as stated in the "About" message, not to send bug reports.

Installation of XPaint (currently version on Centos Linux 6.2 64 bits is quite straight forward.


  • Xawd3d 1.5
  • gv 3.7.1
  • linXaw3dXft 1.6.2b
  • netpbm 10.47.05
  • psutils 1.17

Step 1: Install XPaint

Login with admin role (root) and type

# yum install xpaint
type y and press Enter

Step 2: Start XPaint

On the Centos Linux desktop, choose Applications-> Graphics ->XPaint

Click "Canvas" button and choose "New Canvas"

Tips on initial use of XPaint

Open an image to edit
File-> Open image...

Drawing lines, rectangle, circles, polygon
Click the Tool icon and choose the drawing tool.


Tuesday, September 15, 2015

Howto Install WordPress 4 on Centos Linux 6

WordPress in a PHP based content management system licensed under GPL v2. Since it has been around for a long time, there are many forums, blogs and video to help users and developers.

  1. Create web pages without needing to know HTML
  2. Provide blog tools
  3. Themes to quickly create different look and feel
  4. Plugins to extend its functionalities
  5. Mobile ready site
  6. Provide multiple authors to manage their own contents.

WordPress 4.3 has just been released and here is a guide to install on Centos 6.4

Pre-installation recommendation
PHP 5.4 (works on 5.3.3)
MySQL 5.5 (works on 5.1)
mod_rewrite in Apache module
Bind-utils (works on 9.8.2)

Step 1: Obtain WordPress

Open a terminal and download the WordPress installation file.

$ wget --no-check-certificate
$ tar xvzf latest.tar.gz
$ ls wordpress

Copy the whole folder to the web server directory. Example if the web server runs with permission for user apache.
$ mkdir /var/www/html/wp1
$ cp -r wordpress/* /var/www/html/wp1
$ chown -R apache.apache /var/www/html/wp1

Read the readme.html file with a web browser.

Step 2: Configure MySQL and create wp-config.php

Create the database wp1 in MySQL
$ mysql -u root -p
> create database wp1;
> /q

Open a web browser with URL to the installed page of WordPress.


Fill the fields and click Submit.

Click Run the Install.

Fill the 5-minutes WordPress Install information
  • Site Title
  • Username
  • Password
  • Confirm password
  • Your E-mail
  • Privacy
Click Install WordPress.

Click Log In.

Enter the admin username and password.

View the admin user's dashboard.

Restart apache web server.
$ sudo service httpd restart

Step 3: View the site

Enter in the web browser URL

The default left panel list;
  1. Site name
  2. Search tool
  3. Recent post
  4. Recent comments
  5. Archives
  6. Categories
  7. Meta (Site Admin, Logout, Entries RSS, Comments RSS,


Problem 1: When choosing to add a new theme, the following error is displayed.
"unexpected error occurred. Something may be wrong with or this server’s configuration. If you continue to have problems, please try the support forums."

Solution: Ensure the server can connect to site. Restart Apache web server.

Problem 2: Pages are blank, and there are no error or warning messages.

Solution: Turn on the debug by changing the value false to true in /var/www/html/wp1/wp-config.php

define('WP_DEBUG', true);