Friday, January 20, 2017

Raspberry Pi Programming - typical electric components

Raspberry Pi provides a great platform to learn programming and gain knowledge of basic electric components.

At this moment I am considering that the most basic projects for a newbie with no educational background in electrical or electronic engineering would cover;

  1. Basic of electric circuits and personal safety
  2. Use of battery, LED and resistors
  3. Buzzer and sensors
The Raspberry Pi would then be connected to turn on/off and detect state of the component. Basics of Python programming would be needed, see my previous post. This is going to be fun, but expect some parts to get fried along the way even with only 3volts.

Next couple of days will be used to sort out which components for upcoming basic projects.

Which components should I use?

Wednesday, January 18, 2017

Python for kids

Every used Raspberry Pi and wanted to learn programming? It comes with a programming language called Python. You and any primary of secondary school going child can learn Python if they have access to the internet.

One such site is Learn Python

An online compiler is provider with the tutorials and is a great start. Put aside all those daunting and distracting stuff, like it being Python version 2 or 3 and just dive into the lesson.

You will emerge a very much better person after completing the lessons. Once you are done, pick up a Raspberry Pi project that uses Python and you are on the way to being in the Matrix. Examples of projects can be found at (link, link ) and

Friday, January 13, 2017

Howto reinstall Samsung Galaxy S5

The Samsung Galaxy S5 is a powerful phone and have lasted me over 2 years. Regular updates and the many different applications installed and removed does cause the storage to be bloated and its good option to clear everything and reinstall only the required apps after such a long time.

I will be doing a factory reset (wipe out all data on phone) then allowing the Galaxy S5 to restore last saved settings and finally restore application settings from Samsung Smart Switch (the PC software provided by Samsung). A USB cable is required to connect Galaxy S5 with the PC running the Smart Switch. Make sure the phone is detected when using the USB cable, else you may need to get another USB cable.

Backup all your data before proceeding. Copy your login information for Google, Samsung and other apps on a paper, if you need to.

Before we begin, there are 2 steps to be carried out;

Use the Backup and Restore.
From the phone, select the Settings (This usually looks like a gear when you pull down to display the menu from top of the screen) and choose Backup and Restore. Choose your backup and restore settings, including storing it on Google drive.

Backup other settings and apps to a PC or external storage as needed.

We will be using Samsung Switch, so go ahead and install this on a PC.  Start Smart Switch, plugin the Galaxy S5 phone to the PC via USB cable, then do backup of applications and other media that you require.

Here are steps taken to reinstall the smart phone from Samsung. Make sure the phone is fully charged BEFORE you start.

Step 1. FACTORY RESET (optional)
From the phone, select the Settings (This usually looks like a gear when you pull down to display the menu from top of the screen) and choose Backup and Restore. Then choose Factory Reset.

This may take a while as it will also reinstall default applications found on the phone.

Start the phone and follow the instructions to setup. I choose not restore all Apps from google but only the settings. Finish the setup with last steps that include confirmation of the phone name.

On the PC, start Smart Switch then plugin via USB the Galaxy S5 phone. If prompted to upgrade, accept and follow instructions provided. Strongly suggest that the CAUTION message displayed is followed to avoid wasted time on failed software update.

Smart Switch update software for Galaxy S5

Smart Switch CAUTION messages

You will need to disconnect the cable once its done. This will cause the phone to restart, wait a little bit as it flashes the text "SAMSUNG", then it will show "Android is upgrading" before the phone can resume as normal. For me, on the phone it mentioned optimizing app total of 284, and this restart process took just over 15minutes before I could get the login screen.

Start Smart Switch on the PC. Login to the phone and plug it to the PC using the USB cable.

Smart Switch should detect the phone, then clik on the Restore button and follow the instructions. Once restore is complete, disconnect he USB cable. On the phone, Check the Contact, calendar and other contents that is needed.

Find Lock a lost Samsung phone using a web browser.
Open a web browser and type location as and login with the Samsung account used with the phone. Here is a well documented site on ensuring that you enable basic actions that you can take when the phone is lost.

Wednesday, November 30, 2016

Howto Install Laravel Using Composer

Following are instructions to install Laravel Framework 5.3.16 on a Centos Linux 7. The PHP Composer 1.2.2 is used to install all the dependency packages. Detailed instructions on MS Windows environment were initially prepared in previous blog Howto Install Laravel Framework using Composer.

The system on a x86 64-bit computer consist of
CentOS Linux 7.2
HTTPD 2.4.6-40.el7.centos.4
PHP 7.0.13
MySQL 5.7.16-1.el7

Step 1. Install Laravel

Login to a command line terminal (CLI) as a normal user (with sudo rights) and type

 $ sudo yum install composer  
 $ composer -V  

This installs Composer 1.2.2. Minimum requirement is PHP 5.3.2 as mentioned as Composer website.

Install Laravel

 $ sudo yum install composer  
 $ composer -V  

Create your first application called hello.

 $> composer create-project --prefer-dist laravel/laravel hello   

This install Laravel 5.3.16 as shown in the image below. The folder tests and vendor is not shown.

Listing in hello folder.

Step 2. Run Artisan Serve

Start local artisan server

 $ cd hello  
 $ php artisan serve  

Open a web browser and point to the provided URL http://localhost:8000

To allow access to this instance with a domain name such as, start the server with following command

 $ php artisan serve --host= --port=8000  

Step 3. View the Results in HelloWorld

Test Laravel with a helloworld file

Open a terminal and go to the project folder ->hello ->resources ->views
Create a file helloworld.blade.php with following text

1:   <!DOCTYPE html>   
2:   <html>   
3:    <head>   
4:     <title>Laravel</title>   
5:    </head>   
6:    <body>   
7:   Hello World!   
8:    </body>   
9:   </html>   

Display this "VIEW" when the URL is /hello by editing the file web.php in the project folder ->hello ->routes

1:   Route::get('/hello', function () {    
2:     return view('helloworld');   
3:   });   

Save the file and start the artisan serve.

Open a web browser and type the URL mentioned above in Step 2. E.g.

This displays the Hello World! page with HTML formatting from the file resources/views/helloworld.blade.php


Tuesday, November 22, 2016

Raspbian Command Line Basics 102

This is continuation from Raspbian Command Line Basics 101

Here are 18 commands on configurations of Raspbian Jessie or Release 8.0 on a Raspberry Pi 2. This might work for other versions of Raspbian, as they are common Linux commands in most cases.

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


Display your device name and operating system information
$ uname -a

Change directory
$ cd directoryname

List files n a directory
$ ls
$ ls directoryname

Restart background services
$ sudo systemctl daemon-reload

Display disk usage or free space
$ free
$ free -h

Display disk usage by partitions
$ df -h

Display contents of a file
$ cat filename
e.g. to display CPU type
$ cat /proc/cpuinfo

Display the system date and time
$ date

Edit a file with Vim or Nano
$ vi filename
$ nano filename

Schedule shutdown at specific time
$ shutdown -h 21:00
or reboot
$ shutdown -r now

Configure Raspbian
$ sudo raspi-config


List installed packages
$ dpkg-query -l

To clear up disk space before updating
$ sudo apt-get clean

Update Raspbian system packages
$ sudo apt-get update

Upgrade installed packages
$ sudo apt-get dist-upgrade

Install a package
$ sudo apt-get install mypackagename
$ sudo apt-get install mypackagename -y

Remove an installed package
$ sudo apt-get remove mypackagename
or complete removal with its configuration files
$ sudo apt-get purge mypackagename

Search for a package online
$ apt-cache search mypackagename

Display information of a package
$ apt-cache show mypackagename


Default networking file is configured at

And the dhcpcd controls the networking interfaces

Display existing network interface settings
$ ifconfig

Display network routing table
$ route 
or display all numericals
$ route -n

Changes to the static ip in configuration file requires restart of the dhcpcd
$ sudo dhcpcd -k
$ sudo dhcpcd

Display status of running network interfaces
$ sudo service networking status

Restart network interfaces. Required after changes to network configuration.
$ sudo service networking restart

When there is network but web browser display "Unable to resolve name". Edit the domain name server at /etc/resolv.conf

nameserver x.x.x.x

Saturday, November 19, 2016

Oppo F1s How To Change Looks - Part 1

Oppo F1s is a decent phone running Android 5.1. Very responsive to the touch and with a nice big screen.

It's got a few things that new users just must do to personalize to look cute. Since there are so many things for customisation,  I will list few must know things to default theme.

Add screens

Default it comes with 2 screen where you can swipe left or right to go to each screen. Screens are a great way to organise contents. As you can see below,  there are 3 circles above the camera icon which means there are 3 screen.

Select an icon on the screen for the new screen. In this example,  I choose Theme Store icon and as drag it, the screen editor appears at bottom of screen.

Drag the icon to a new screen and release. If the icons are still wobbly or jello like,  tab on an empty space of the screen and it should end the editing mode. 

Create folder on a screen

Folders allow you to group several icons together on one screen.  With option to name the folder,  everything get more organised. Folders are shown as an icon with a little downwards arrow by it's side.

In order to create a folder,  identify the 2 icons for a folder.  Press on one icon and drag it on the centre of the other icon.  The icons will then be displayed in editing mode with the name of the folder above.  Click on that name and change the folder name.  Click the check mark and tap an empty space on the screen.

Change theme

Themes provide a feel of icon shapes,  background and lock screen that consistent.
Press Theme store icon and select a theme or press the download theme button.

The download button is to choose installed icons themes on the system.  Next press on apply and watch your screen and icon change. Other changes may effect fonts and lock screen.


Friday, November 11, 2016

Yum error Cannot retrieve metalink for repository

Yum provides installation, upgrades and removal of packages on Linux such as Centos. It is used to install other package repositories too. Over time, some of the certificates for installation would have changed and thats where you get this error when running Yum.

In this example, the error indicate Epel repository cannot be retrieved.

"Cannot retrieve metalink for repository: epel"

Some sysadmins have decided not to use that repo totally as they do not use that repo. E.g. when updating a package, they use

# yum --disablerepo="epel" update httpd


  1. Clean yum cache
  2. update the ca-certificate packages while disabling that repository with error.

Clean yum cache
# yum clean all

Update ca-certificate packages

In my Centos 6.3, it required to updated these related packages.