Wednesday, August 28, 2013

Raspberry Pi Course is now confirmed! - 12 Sep 2013

I am excited to announce that the Raspberry Pi course is now confirmed! Each participant will get the following:

HRD101 1-Day Getting Started with Raspberry Pi and Python Programming

The Raspberry Pi is a low-cost (US$35) credit-sized computer that connects to your TV and keyboard. Running Linux as the operating system, it can be used for many purposes such as word-processing, games, spreadsheets, web browsing, and more; almost everything that you can do with a regular computer. What’s more, usng the Raspberry you can connect the  general purpose input and output (GPIO) pins right on the board to drive external hardware such as LEDs, motors, and relays. Programming on the Raspberry Pi is made simple using the Python language. Hence, this course will get you started with Raspberry Pi and the Python programming language.

Setting up the Raspberry Pi
    Preparing the SD Card
    Booting up the Raspberry Pi
    Configuring the Raspberry Pi
Getting around Linux on the Raspberry Pi
    Command Line
    Installing Useful Applications
Programming Python on the Raspberry Pi
    Hello World!
    Reserved Words
    Language syntax
    Objects and Modules
    Using IDLE

Course outlines and application form here.

Bayview Hotel
30 Bencoolen Street
Singapore 189621

12 Sep 2013 (Thu)

9am to 5pm


Sunday, August 25, 2013

Xamarin Course on 2-4 Oct 2013

In this 3-day workshop, you will learn the fundamentals of building cross-platform mobile apps targeting iOS and Android devices using Xamarin and C#.

Using the Xamarin Studio, you cannow write iOS and Android apps using your familiar C# language. When you are ready to deploy your apps, the Xamarin compiler will compile your app into the native binary for each platform. The end result is you have a first class application that is optimized for the respective platform that it is compiled for.

• Introduction to Xamarin and Xamarin Studio
• HelloWorld using Xamarin Studio
• Using the emulators and simulator
• Handling Screen Rotations
• User interface Design
• Multi-screen applications
• Files Handling & Data Storage
• Cross-platform Code Sharing for Android and iOS
    o Strategies for cross-platform code sharing
    o Web Services
    o Data Storage

Course outlines and application form here.

Bayview Hotel
30 Bencoolen Street
Singapore 189621

2-4 Oct 2013 (Wed-Fri)

9am to 5pm


Saturday, August 24, 2013

iOS Tip - Detecting Network Connectivity Type

An iOS device typically have a two ways to get connected to the Internet – Wi-Fi or 3G/4G. Typically in your application, you should refrain from downloading large amount data when the user is connected to the 3G network. Instead, all the heavy downloading should be done when the user is connected to WiFi. So how do you check if the device is connected to WiFi or 3G?

The easiest way to check if the connectivity option available on your iOS device is to use the Reachability class provided by Apple. To do so, download the code sample from: and copy the Reachability.h and Reachability.m file into your own project.

Next, add a reference to the SystemConfiguration.framework in your project.

To use the Reachability class, import its header file:

#import "Reachability.h"

Finally, use the following code snippet to check the type of connectivity you have on your iOS device:

    Reachability *reachability =
        [Reachability reachabilityForInternetConnection];
    [reachability startNotifier];
    NetworkStatus networkStatus =
        [reachability currentReachabilityStatus];
    if(networkStatus == NotReachable) {
        NSLog(@"No Internet");
    else if (networkStatus == ReachableViaWiFi) {
    else if (networkStatus == ReachableViaWWAN) {
    [reachability stopNotifier];

iOS Tip - Playing Sound

A very common task in iOS is playing sound. For example, your application needs to play some background audio when the user clicks on some buttons, etc.

You can make use of the AudioServicesPlaySystemSound() method in the AudioToolbox.framework to play back an audio file.

First, you need to add the AudioToolbox.framework to your project and then import its header file:


Then, assuming your project has an audio file named c9.aiff, the following code snippet will play back the audio file:

    SystemSoundID soundID;   
    NSString *soundPath =
        [[NSBundle mainBundle] pathForResource:@"c9"
    NSURL *soundPathURL = [NSURL fileURLWithPath:soundPath];
        (__bridge CFURLRef)soundPathURL, &soundID);

If you do not have an audio file and want to play the sound that is already available on your iOS device, you can specify the system sound ID directly, like this:
    int systemSoundID = 1304;
    AudioServicesPlaySystemSound (systemSoundID);

The list of system sound ID is available here:

Wednesday, August 21, 2013

iOS Tip: Getting the Path to the Documents folder

Files created by your iOS applications are usually stored in the Documents folder of your application sandbox. Often, you need to obtain the path to this folder (you cannot hard-code this during design time as this is specific to each device).

The easiest way to get the path of the Documents folder of your application is to use the NSFileManager class, like this:

- (NSURL *)applicationDocumentsDirectory
    return [[[NSFileManager defaultManager]
               inDomains:NSUserDomainMask] lastObject];

Tuesday, August 20, 2013

iOS Tip: Disabling ARC for Specific Classes

Beginning with iOS 5, Apple has provided the Automatic Reference Counting (ARC) feature to free the developers from having to manually manage  the allocation and freeing of objects. However, if you are using some third-party libraries that have yet to support ARC, you can choose to selectively disable ARC for specific classes as ARC is a compiler feature.

To disable ARC for specific classes, select the project name in Xcode and select the Build Phases tab:

Expand the Compile Sources section then select the files representing the classes that you want to disable ARC. Press the Enter key and then enter the following statement in the pop-up window:


Press Enter and that’s it! The selected files will now compile without ARC. 

Saturday, August 17, 2013

Android Tip: Launching App Ops

In Android 4.3, Google has included an application known as App Ops. App Ops is an activity that allows users to enable/disable individual permissions of installed applications. Instead of granting a blanket of permissions during installation time, App Ops allows users to fine-tune the individual permission granted to applications.

At this moment, there is no way a user can directly go to the App Ops activity as it seems like Google is still fine-tuning the application (there are however, third-party apps on the Google Play that help you to do that – Permission Manager is a good example). However, if you are a developer, you can use the following intent to jump right into it:

startActivity(new Intent(

This will launch the App Ops activity.

Friday, August 16, 2013

Foundation of Android Programming course on 16-17 Sep 2013 (Mon-Tue) is now confirmed!

The Foundation of Android Programming Course on 16-17 Sep 2013 (Mon-Tue) is now confirmed! If you have always wanted to create your own Android apps but were too busy to commit to learning it, this is your best chance.

This course is intensive and in 2 days you will get your Android apps up and running. Unlike other courses where you will sit through boring lectures, this course focuses on hands-on. You are expected to write code and deploy your apps onto your Android devices. 

To get the most out of this course, you are expected to have some basic programming experiences (such as C, C++, Visual Basic, Java, C#, etc). 

Enough said. You will find the 2 days the best investment you have ever made!

Bayview Hotel Singapore
30 Bencoolen Street 
Singapore 189621

Course Fee
S$997 (nett; no GST)
* applicable for PIC credit for companies; check with IRAS for your company's eligibility 

9am to 5pm

You need to bring along your own Windows or Mac laptop for the course.

Thursday, August 15, 2013

Android Tip: Checking the Availability of an Intent

Android developers are all too familiar with the concepts of Intent. But often, if you are not careful, calling an Intent using an action name that matches no activities will result in your application crashing.  In order to prevent that, you are advised to check for the availability of that Intent prior to calling it.

To check if an Intent is available, use the isIntentAvailable() method, defined below:

import android.content.Context;

public static boolean isIntentAvailable(
Context context, String action)
    final PackageManager packageManager =     
    final Intent i = new Intent(action);
    List list =
    return list.size() > 0;

This method returns a true if there is at least one activity that matches your action name. You can call it as follows:

String action = "net.learn2develop.secondactivity";

//---check if intent is available---
if (isIntentAvailable(this, action)) {
    Intent i = new Intent(action);
        i, "List of Apps"));
} else {
    Toast.makeText(this, "Intent is not available",