2015 CNY KL TRIP 3D2N

The 2015 CNY KL TRIP

Day 1

今天,大年初一,和家人驾车上 KL 游玩。

我们住的 Grand Pacific Hotel,据说在 KL 有三个分行,最小的那间,但是它的房间还算大。我们来这里都是要靠 Waze Apps 带路的。大路可以用 Apple Maps,来到市区就要用 Waze Apps 了。

今日行程:天后宫,Berjaya  Time Square,  阿罗街。

我们去天后宫请了一只“金 羊咩咩”回家。

阿罗街,我们晚上去,很多吃的东西,太棒了。

天后宫 爸妈 Photo 19-2-15 6 48 42 pm

 

Day 2

我们开始第二天的旅程。通过 Waze Apps 和 Apple Maps 的辅助,我们抵达了如下行程:云顶,双峰塔,某个购物广场(只知道里面有五月天成员开的店),Petaling Street.

上云顶,少不了的就是赌场,我爸妈说他们是没有输赢啦。看到一个舞狮表演,同一个团体的表演我们下午在双峰塔那里看多一次,他们也有跑场的。两边观众都有很多老外。云顶那边还有看到很多中国旅客,而双峰塔那边很多孟加拉人。

我妹要去某个购物广场朝圣-某五月天成员开的店。我们用 Waze Apps。因为驾车有点快加上通讯线路有点慢,所以很多次都来不及,过头。突然间我看到前方有个熟悉的建筑,再看 gate,写着 “selamat datang ke Parlimen” (欢迎来到马来西亚国会大厦),哇!那么“雄伟壮观”。

晚上我们到 Petaling Street。因为早弯一个路的关系,多转了一个大弯才到目的地。但途中我们也算走完整个小印度。在那里我们吃了个很棒的晚餐。

Photo 20-2-15 7 49 24 pm

Day 3

今天,一大早,我们就结束了我们的旅程,驾车回柔佛了。出酒店的时候发现前方能很清晰看到巫统和国大党的建筑。

The Imitation Game: Alan Turing

The Imitation Game: Alan Turing

Today I watched this movie in GV Suntec City, The Imitation Game. The real story about Alan Turing, who known as the pioneer or creator of computer science, how we invented a machine that beats another machine – Enigma, A German Machine that can encode important military message.

Can’t control my tears when watched until the last part of the movie.

No many people know who is him, why he is so important. Without his works, there is no new mathematical fields exist – Computer Science. Without him, we don’t have Computer, Mac, iPhone, or maybe only exist 100 years later. Without him, the world war II may take longer to end, ten million more people be killed.

This is my first time, the hello world to book a movie ticket, through online, watched a movie in cinema. In my previous life, I only went to cinema once, when I am young, brought by my uncle. Then I joined two times with company events. Today, the fourth, but the first, happened. And this is the first time I walked through inner building from City Hall MRT how to find where the tower 4 level 3 is.

Tutorial on setup OpenCV on iOS

This tutorial is to setup OpenCV on iOS. To include opencv2.framework to iOS8 Objective C Project.

By following this tutorial: http://docs.opencv.org/doc/tutorials/ios/hello/hello.html#opencvioshelloworld

1) to download prebuilt opencv2.framework, the fine working version is 2.4.9.

2) to create new XCode Project, target iOS8.0 if you are under XCode 6.0.1 as this version not yet support iOS8.1

3) link opencv2.framework to XCode Project. Go to project build phase, and link following frameworks:
opencv2.framework
AssetsLibrary.framework
AVFoundation.framework
CoreGraphics.framework
CoreImage.framework
CoreMedia.framework
CoreVideo.framework
Foundation.framework
UIKit.framework
Accelerate.framework

Screen Shot 2015-01-20 at 12.42.28 am

4) Create <NameOfProject>-Prefix.pch, with following snippets of code add between ifdef / endif block.

#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif

5) in ViewController.h, add the following to header
#import <opencv2/highgui/cap_ios.h>
#include <opencv2/opencv.hpp>

Note, the most important line is #include <opencv2/opencv.hpp>, this is important to make the stuffs works. I spent few hours and found this solve my problems, which unable to recognize cvtColor function, OK, will introduce in next steps.

6) To do some testing, by adding a video camera, reading 30 frames per second, process the images by inverting the color…

7) Rename ViewController.m to ViewController.mm as we are going to put C PlusPlus Code. Extension mm allows coexist of Objective C and C PlusPlus.

8) In ViewController.h, add following line
@property (nonatomic, retain) CvVideoCamera* videoCamera;

9) In ViewController.mm, we initialize videoCamera and starts it.

self.videoCamera = [[CvVideoCamera alloc] initWithParentView:_ImageView];
self.videoCamera.delegate = self;
self.videoCamera.defaultAVCaptureDevicePosition = AVCaptureDevicePositionFront;
self.videoCamera.defaultAVCaptureSessionPreset = AVCaptureSessionPreset352x288;
self.videoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationPortrait;
self.videoCamera.defaultFPS = 30;
[self.videoCamera start];

10) In ViewController.h, add CvVideoCameraDelegate

Like this

@interface ViewController : UIViewController

11) In ViewController.mm, add following snippets of code before @end.

#pragma mark – Protocol CvVideoCameraDelegate

#ifdef __cplusplus
– (void)processImage:(Mat&)image;
{
// Do some OpenCV stuff with the image
Mat image_copy;
cvtColor(image, image_copy, CV_BGRA2BGR);
bitwise_not(image_copy, image_copy);
cvtColor(image_copy, image, CV_BGR2BGRA);
}
#endif

12) Run the project. Cheers.

Photo 20-1-15 12 51 57 am

Install CMake on Mac

CMake, the cross-platform, open-source build system. CMake is a family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice.

To install CMake on Mac, you can download the precompiled binaries here. Under platforms Mac OSX 10.6 or later, I chose cmake-3.1.0-Darwin64.dmg at the time of writing.

Once downloaded, run open cmake-3.1.0-Darvin64.dmg on terminal.

A finder view shown. Drag cmake-3.1.0-Darvin64.dmg to Applications shortcut, it will copy the binary to Applications folder.

Open the applications by sudo.

Do sudo /Applications/CMake.app/Contents/MacOS/CMake

Click on menu Tools, Install for Command line use.

You shall see the result, then you are done.

Screen Shot 2015-01-17 at 7.25.34 pm

Titanium Mobile Geolocation fix after upgrading to iOS8

My Titanium Mobile apps geolocation function was broken, after deployed a release target to iOS8.

The iOS8 introduces new privacy and restriction settings. We are required to include some flags in plist settings in order to make it work.

You can open tiapp.xml, and add the following flags under ios plist dict

<key>NSLocationAlwaysUsageDescription</key>
<string>Test NSLocationAlwaysUsageDescription</string><key>NSLocationWhenInUseUsageDescription</key>
<string>Test NSLocationWhenInUseUsageDescription</string>

Save and deploy. Cheers.

Swift Tutorial to add GCDWebServer into XCode Project

GCDWebServer is a former Objective-C project that embeds a web server in iOS / OSX application. This tutorial explains how to add GCDWebServer into Swift based iOS project.

Step 1:

Navigate to empty directory, run the following

git clone https://github.com/swisspol/GCDWebServer

Step 2:

Go into GCDWebServer directory, you will see there are GCDWebServer, GCDWebDAVServer, GCDWebUploader…. In this case, we just need GCDWebServer to build a simple HTTP Server. Copy this folder to your application root folder. Looks like this.

Screen Shot 2014-12-23 at 2.20.52 pm

Step 3:

Add a bridging header if it is not exist.

Right click your project navigator, add a new “header file” under iOS source tab. Name it as <YourApplicationName>-Bridging-Header.h.

In this file, put the following


#import "GCDWebServer.h"
#import "GCDWebServerDataResponse.h"

Step 4:

Go to your project navigator, build settings, Swift compiler – Code Generation, Objective-C Bridging Header, enter the path to the <YourApplicationName>-Bridging-Header.h

Screen Shot 2014-12-23 at 2.25.47 pm

Step 5:

Go to your project navigator, build phases, under Link Binary with Libraries, click to add “libz.dylib”.

Step 6:

At the time of writing, the current GCDWebServer not working properly and have to change something make it to work.

Find GCDWebServer.h and locate addDefaultHandlerForMethod, set the second one as addDefaultAsyncHandlerForMethod.

Find GCDWebServer.m and locate addDefaultHandlerForMethod, set the second one as addDefaultAsyncHandlerForMethod. Under first addDefaultHandlerForMethod, change the second line of the occurrence to addDefaultAsyncHandlerForMethod instead.

Screen Shot 2014-12-23 at 2.33.40 pm

Step 7:

Put following test code and run.

// http server

        let webServer = GCDWebServer()

        

        webServer.addDefaultHandlerForMethod(“GET”, requestClass: GCDWebServerRequest.self) { request in

            return GCDWebServerDataResponse(HTML:“<html><body><p>Hello World</p></body></html>”)

        }

        webServer.startWithPort(8080, bonjourName: nil)

        println(“Visit \(webServer.serverURL) in your web browser”)

Step 8:

Open your desktop browser, and open the link shown in debug console. You should be able to see Hello World displayed in the web page.

Cheers.