Friday 30 August 2013

英国知多少?

英国 Q & A
问:我需要带电脑去吗?
答:旅行有tablet 当然最好。可以为明天的旅程做好准备。网上看地图,地铁,都很方便。

问:上网方便吗?
答:若用手机上网,可以到电话公司(vodanfone, O2, car phone, etc) 购买 ‘data plan' 的sim card. 电脑上网,可以到有免费wifi
的cafe 去。

问:free wifi 是真的免费吗?
答:在很多cafe 或 McD 都有free wifi。但是这都是 secured wifi。意识说,你还是需要密码才可以使用免费wifi。所以你必须是他们的顾客,方可索取密码。

问:容易找到复印机或photostate 文件吗?
答:比起大马, 1:50 ,非常难找。 别想翻版书本。一般上图书馆里会有。当然不是免费。

问:我喜欢打篮球
答:篮球场不多,而且都被踢足球的给占了。

问:我喝不惯牛奶,喜欢喝豆浆。
答:可以在超市 (tesco) 找到进口的罐装豆浆。

问:中餐馆好吃吗?
答:还可以。大多数是煮给‘鬼’吃。咖喱可以是甜而不辣。

问:发烧感冒咳嗽如何是好?
答:看医生,医生问你一两句后,就踢你回去,简直是浪费时间。一般都是自行到 farmacy (boots) 买药。

问:英国有种族歧视吗?
答:法律不允许。虽然如此, 到时你还是会感应到。

问:英国圣诞节热闹吗?
答:死城。

问:英国天气好吗?
答:一年下两次雨,一次四个月,一次八个月。哈哈!基本上除了短短的夏天,最好有件风衣/雨衣防身。

问:英国有高楼大厦吗?
答:少。

问:英国人一日三餐吃什么?
答:英国人吃很多面包和土豆,加奶的红茶,煎蛋、炒蛋、煮荷包蛋或白煮蛋(配吐司吃),三明治, baguette, panini, 香肠 等等。

问:英国的甜品好吃吗?
答:非常甜。

问:有机会看到皇室吗?
答:电视。或者去buckingham palace 碰碰运气吧。

问:英国有夜生活吗?
答:酒吧,没了。晚上没有 pasar malam. 没有mamak档。

问:英国有盗版软件/游戏吗?
答:你会很想念 imbi, lowyat plaza.

问:英国同性恋多吗?
答:如果你是,你不会寂寞的。

问:英国电视好看吗?
答:一共五个台,较教育兴。没得看英超,除非你有sky (像Astro) 另收费。不过,如果安装 freeview or freesat, 那么就有额外百多两百电台可以收看。

问:WeChat 微信流行吗?
答:大多数人用 whatsapp.

问:英国人数学好吗?
答:买东西,找钱时,记得要在他面前数一数。有时会少一两英镑!不晓得是不是故意的。

问:英国是岛国,海鲜很好吗?
答:不是每个超市都有鱼卖。

问:博物馆值得去吗?
答:免费,而且非常值得参观。London National Gallerry, British Musuem, Naturual History Musuem 都很不错。

问:英国水果蔬菜种类多吗?
答:用不到脚趾

问:剑桥和牛津哪个好?
答:本土人说剑桥要聪明的,牛津要成绩好的。一般来说,牛津比较出名于文学,音乐,戏剧等。

问:我的电器在英国可以用吗?
答:英国的标准电源是220/240伏特,插头是方行3插。在大马用的都可以在英国用。

问:我要看卫兵换岗?
答:可以到Buckingham Palace or Windsor Castle。但是,最好是先检查换岗日期及时间。在白金汉宫 (Buckingham Palace), 11:13便开始。
http://www.royal.gov.uk/RoyalEventsandCeremonies/ChangingtheGuard/Overview.aspx

问:那里可以买到价格便宜,而且品质还不错的衣服,裤子,。。。
答:Primark, Next

Tuesday 5 March 2013

Mobile Development with C#

Mobile Development using C#
Building mobile applications can be as easy as opening up your IDE, throwing something together, doing bit of testing, etc. Many people think that the indigenous languages Objectiv-C, Java, respectively, are the only choice.
However, number of platforms for building mobile apps has emerged. e.g.: PhoneGap, Appcelerator, Xamarin, etc.

Xamarin is the one that I have experienced in one of my experiment.If you are famliar with C#, then this is the right tool for you. Basically, it allowed you to build with single language - C#, class libary and runtime that work across all 3 mobiel platforms (iOS, Android and Windows). Besides, you can either develop your application via Monodev IDE or Visual Studio. So flexible.

Debugging
My experience with Xamarin is only limited to Android platform only (this is the only one can be excuted in windows, unless you have Mac).
It was fine and easy to do a debugging in the given emulator. But, I am sure you will come to a stage where you would prefer to debug it or test your application in a real device.
In Xamarin, debugging can be done over USB Connection. But, this can be achieved on paid/licensed version only. So, please do not waste your time to figure out how to do it with a trail version.

I have a HTC wildfire mobile with Android. I tried the debugging process mentioned in Xamarin website. In order to debug in real device, you need to connect your mobile with the given USB cable to your PC. And, of course you will be asked to provide a proper usb driver installed in your computer before anything.

There are number of drivers available from google, named as google usb driver, but it is only available for certain devices. Not HTC wildfire :(
http://developer.android.com/sdk/win-usb.html#WinUsbDriver

According to the developer guide for android (the above link), you may seek for the right driver via the OEM USB drivers. However, if you are using HTC mobile for development. Please finger cross. Because I personally found HTC didn't provide this kind of USB driver at all.

So, how to proceed?
Cheat sheet of installing HTC Wildfire Android SDK Drivers

In order to debug on your HTC smartphone on windows 7, you need to install USB drivers.
1. First, get Android SDK and install the Android SDK.
2. Next, need to hack or modify the driver (file) to add support for your HTC mobile. Look for "android_winusb.inf" in your machine.

Please see the settings below. Warning! it may or may not work for you. Please backup your orignal driver / file before any modification.
Again, it works for me. But, I will not responsible to any changes you have made.

Good luck. And have fun!

JL

----------------------------------------------------------------------------------------------------------------
File name:  android_winusb.inf

;
; Android WinUsb driver installation.
;
[Version]
Signature           = "$Windows NT$"
Class               = AndroidUsbDeviceClass
ClassGuid           = {3F966BD9-FA04-4ec5-991C-D326973B5128}
Provider            = %ProviderName%
DriverVer           = 08/27/2012,7.0.0000.00001
CatalogFile.NTx86   = androidwinusb86.cat
CatalogFile.NTamd64 = androidwinusba64.cat

[ClassInstall32]
Addreg = AndroidWinUsbClassReg

[AndroidWinUsbClassReg]
HKR,,,0,%ClassName%
HKR,,Icon,,-1


[Manufacturer]
%ProviderName% = Google, NTx86, NTamd64


[Google.NTx86]

;Google Nexus One
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_0D02
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_0D02&MI_01
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E11
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E12&MI_01

;Google Nexus S
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E21
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E22&MI_01
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E23
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E24&MI_01

;Google Nexus 7
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_4E40
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E41
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E42
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E42&MI_01
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E44&MI_01

;Google Nexus Q
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_2C10
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_2C11

;Google Nexus (generic)
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_4EE0
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4EE1
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4EE2
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4EE2&MI_01
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4EE3
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4EE4&MI_01
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4EE5
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4EE6&MI_01

;HTC Incredible
%SingleAdbInterface%        = USB_Install, USB\VID_0BB4&PID_0C9E
%CompositeAdbInterface%     = USB_Install, USB\VID_0BB4&PID_0C9E&MI_01

; HTC Wildfire
%SingleAdbInterface%        = USB_Install, USB\VID_0BB4&PID_0C8B
%CompositeAdbInterface%     = USB_Install, USB\VID_0BB4&PID_0C8B&MI_01

;T-Mobile G2
%SingleAdbInterface%        = USB_Install, USB\VID_0BB4&PID_0C91
%CompositeAdbInterface%     = USB_Install, USB\VID_0BB4&PID_0C91&MI_01


[Google.NTamd64]

;Google Nexus One
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_0D02
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_0D02&MI_01
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E11
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E12&MI_01

;Google Nexus S
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E21
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E22&MI_01
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E23
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E24&MI_01

;Google Nexus 7
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_4E40
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E41
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E42
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E42&MI_01
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E44&MI_01

;Google Nexus Q
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_2C10
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_2C11

;Google Nexus (generic)
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_4EE0
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4EE1
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4EE2
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4EE2&MI_01
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4EE3
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4EE4&MI_01
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4EE5
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4EE6&MI_01

;HTC Incredible
%SingleAdbInterface%        = USB_Install, USB\VID_0BB4&PID_0C9E
%CompositeAdbInterface%     = USB_Install, USB\VID_0BB4&PID_0C9E&MI_01

;HTC Wildfire
%SingleAdbInterface%        = USB_Install, USB\VID_0BB4&PID_0C8B
%CompositeAdbInterface%     = USB_Install, USB\VID_0BB4&PID_0C8B&MI_01

;T-Mobile G2
%SingleAdbInterface%        = USB_Install, USB\VID_0BB4&PID_0C91
%CompositeAdbInterface%     = USB_Install, USB\VID_0BB4&PID_0C91&MI_01

[USB_Install]
Include = winusb.inf
Needs   = WINUSB.NT

[USB_Install.Services]
Include     = winusb.inf
AddService  = WinUSB,0x00000002,WinUSB_ServiceInstall

[WinUSB_ServiceInstall]
DisplayName     = %WinUSB_SvcDesc%
ServiceType     = 1
StartType       = 3
ErrorControl    = 1
ServiceBinary   = %12%\WinUSB.sys

[USB_Install.Wdf]
KmdfService = WINUSB, WinUSB_Install

[WinUSB_Install]
KmdfLibraryVersion  = 1.9

[USB_Install.HW]
AddReg  = Dev_AddReg

[Dev_AddReg]
HKR,,DeviceInterfaceGUIDs,0x10000,"{F72FE0D4-CBCB-407d-8814-9ED673D0DD6B}"

[USB_Install.CoInstallers]
AddReg    = CoInstallers_AddReg
CopyFiles = CoInstallers_CopyFiles

[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WdfCoInstaller01009.dll,WdfCoInstaller","WinUSBCoInstaller2.dll"

[CoInstallers_CopyFiles]
WinUSBCoInstaller2.dll
WdfCoInstaller01009.dll

[DestinationDirs]
CoInstallers_CopyFiles=11

[SourceDisksNames]
1 = %DISK_NAME%,,,\i386
2 = %DISK_NAME%,,,\amd64

[SourceDisksFiles.x86]
WinUSBCoInstaller2.dll  = 1
WdfCoInstaller01009.dll = 1

[SourceDisksFiles.amd64]
WinUSBCoInstaller2.dll  = 2
WdfCoInstaller01009.dll = 2

[Strings]
ProviderName                = "Google, Inc."
SingleAdbInterface          = "Android ADB Interface"
CompositeAdbInterface       = "Android Composite ADB Interface"
SingleBootLoaderInterface   = "Android Bootloader Interface"
WinUSB_SvcDesc              = "Android USB Driver"
DISK_NAME                   = "Android WinUsb installation disk"
ClassName                   = "Android Device"



Google Maps Javascript API

According to Google website
(http://code.google.com/apis/maps/documentation/javascript/),
the JavaScript Maps API v3 is a free service, available for any web site that
is free to consumers. If you have any concern, read the above sentence again….  Or check the terms, clause 9.1 if not
clear.

So, what it is? Interactive map with more controls on the map and particularly about the
flexibilities on what you can do and you want do with the map? Yup, this is pretty much what the API allow you to do with. 
However, it is not really straightforward. But it is straightforward only if you are familiar with JavaScript, as well as
the meaning of callback or asynchronous. No worry, it is not the end of the world.

It is pretty helpful to start with the basic samples under
the developer’s guide. Of course, if you prefer to do something quick, just need a
map and some markers on the map to pin-point your location or some of your favourite
locations, then I would suggest you jump into ‘Using Closures in Event
Listeners’ – Event topic,  and ‘Geocoding’.

The 1st one covered the codes on how to create
location, and more importantly the Markers. And, the second topic will be all
about ‘the convertor’ convert location name into geographic coordinates. You
need something like latitude and longitude for the position on the map. A
marker needs it. (just refer to the sample code about how to geocode an address
(either from user input or from db) and place a marker at the returned latitude
and longitude values. http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding)

Yup, before I close the topic, one thing I need to emphasis
here is the :

<!DOCTYPE html> tag.
Makesure you change your default doc type to this one. Else, you  can’t see the map.

JL

Google MAP API

I was looking for google map solution It has been available to public for ages
already. But, I believed you wouldn’t dive in until you really want to use
it. So, I started with Google static map first. The static map looks good and
easy to configure and use. As long as you know what parameters mean, then you
can produce a static map that meet your requirement. But the only drawback was
no navigator control on the map. Meaning that, you cannot zoom in and out or
place an orange human for street view, etc. Correct me if I am wrong.

As mentioned, this is a static map. So, it is just a graphic.
When you right click it, you can save the whole image as a picture or image.

To me, the easiest way to cope up and understand the effect
of each parameter is to get your hands dirty. I tried copying one of the examples
(URL) from the maps.googleapis.com. And, I’ve made some changes to the query
string with the given parameters.

Example:
http://maps.googleapis.com/maps/api/staticmap?size=512×512&maptype=roadmap\&markers=size:mid|color:red|Singapore,Singapore|London,UK|Kajang,Malaysia|Canada&sensor=true

Discover what you can do with Google Maps APIs here:
https://developers.google.com/maps/


As a result after a quick
investigation on Google static map, I think I need something more dynamic. So,
I decided to explore the more advance map api which is the Google’s Javascript
Maps V3.

Monday 28 January 2013

Social Media Integration OAuth and OpenId

2 years ago, I started a family tree development with Facebook Connect. It was a project using facebook integration in ASP.NET.  However, I wasn't quite conviced with the javascript api from facebook. I think mainly because it is not stable enough. I awared that there are something called OAuth and OpenID available. And, these should be the right things to apply in my project. But, not really doing any further research on them.

A year ago, I played with JS Node. A fun stuff to investigate especially writting server side javascript for twitter tweeks.

Recently, I've better exposure to other projects, such as the interaction with twitter, linkedIn integration, etc. LinkedIn was the one which I found quite interesting especially the seriousness of the data.

Well, regardless which Social Media you want to connect and integrate, you need an authentication process to be done before you are allowed to pull any information from them. Basically, there are 2 famous component/technolgoies available in the market that widely used by the social media providers:

1. OAuth  (e.g.: LinkedIn, Facebook ) - All about authentication token.
2. OpenId (e.g.: Google, Yahoo, etc) - More suitable for Single Signon.

I found couple of websites provide useful and handy example on how to use DotNetOAuth: (http://www.dotnetopenauth.net/)

DotNetOAuth and LinkedIn in MVC:
http://scatteredcode.wordpress.com/2011/12/01/dotnetopenauth-oauth-and-mvc-for-dummies/


OpenId - Single SignOn using Google in MVC3
http://www.tkglaser.net/2012/02/single-sign-on-using-google-in-asp-mvc.html
(where you can use the same component (DotNetOpenAuth.dll) from http://www.dotnetopenauth.net/


Facebook Connect
http://devtacular.com/articles/bkonrad/how-to-retrieve-user-data-from-facebook-connect-in-aspnet/








How to run unit test for your Xamarin Application in AppCenter?

How to run unit test for your Xamarin application in AppCenter?  When we talk about Building and Distributing your Xamarin app, you m...