Friday, July 2, 2010

Connecting to HTTPS with Untrusted Certificate from iPhone OS

By default one can use NSURLRequest and NSURLConnection to connect to a HTTP/HTTPS server. However, the iPhone OS may block the connection if the HTTPS server does not have a trusted certificate (e.g. a self-signed certificate is considered untrusted). After some Googling, here is one of the solutions: Adding the following two functions to the NSURLConnection delegate.

Wednesday, June 30, 2010

Windows Azure SDK Requirements

  • Windows Vista / Windows 7 / Windows Server 2008 / Windows Server 2008 R2
  • IIS 7.0 (with ASP.NET, WCF HTTP Activation, Static Content, and optionally CGI)
  • Microsoft Visual Studio 2010/ Microsoft Visual Web Developer 2010 Express / Microsoft Visual Studio 2008 SP1 / Microsoft Visual Web Developer 2008 Express Edition with SP1.
  • SQL Server 2005 Express Edition or above

Friday, June 11, 2010

Access Java Class Variables from NDK

Access Java class variables from NDK (non-static function) in C:


  • env and obj are the first two parameters of the NDK function
  • "Ljava/lang/String;" is called the field descriptor of type String


Field Descriptor of other Variable Types:


  • Remember the semi-colon
  • Replace "Get" by "Set" for Set Field Functions

Field Descriptor Type Get Field Function
Z boolean GetBooleanField
B byte GetByteField
C char GetCharField
S short GetShortField
I int GetIntField
J long GetLongField
F float GetFloatField
D double GetDoubleField
Ljava/lang/String; String GetObjectField
[I int[] GetObjectField, and then cast it to an array
jintArray *arr = reinterpret_cast<jintArray*>(&data);
[Ljava/lang/Object; object[] GetObjectField, and then cast it to an array