Author Archives: admin

Disabling Certificate Validation in an HTTPS Connection

By default, accessing an HTTPS URL using the URL class results in an exception if the server’s certificate chain cannot be validated has not previously been installed in the truststore. If you want to disable the validation of certificates for testing purposes, you need to override the default trust manager with one that trusts all certificates.

Great tutorial and sample code here!

Parsing date fields with NSDateFormatter ignoring locale

In many cases if the iOS device international settings is not set to US, you may have errors parsing text-based dates from e.g. RSS feeds.
The solution is to set the NSDateFormatter locale to en_US_POSIX.

NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
[dateFormatter setLocale:locale];
[locale release];

by Luke Redpath on

Disable Android 2.3 View overscrolling on prior versions

Update Developers reported, that this does not work/misbehaves on several devices, so should be avoided.

Android Gingerbread enables by default overscrolling in default orange style, which could be disturbing in many layouts.
To disable it you can use the setOverScrollMode method with the OVER_SCROLL_NEVER parameter, however it is not available on prior Android versions.
Here is a safe solution for all Android versions:

public static void disableOverscroll(View view) {
Class viewCls = view.getClass();
try {
Method m = viewCls.getMethod("setOverScrollMode",
new Class[] { int.class });
int OVER_SCROLL_NEVER = (Integer) viewCls.getField(
m.invoke(view, OVER_SCROLL_NEVER);
} catch (Exception e) {
// swallow

By alex on

“Real” URL encoding in iOS

Sometimes if you wish to encode a whole URL including /,&,: , [NSString stringByAddingPercentEscapes:] fails, to solve this issue, use CFURLCreateStringByAddingPercentEscapes

+ (NSString*)urlEncode: (NSString*) url {
    NSString* encoded = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)url, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]",kCFStringEncodingUTF8);
    return [encoded autorelease];


Android 3.x Action Bar customization

The ActionBar UI component has been introduced in Android 3.0 and above, and it seems to become the standard way to use tabs and context/action menus in Android applications.
You may also customize the ActionBar associated to your application in different ways through this great tutorial, however you might run into errors when you wish to override Tab item styles, to resolve this issue,
check this blog for a very straightforward solution. (due to private API issues)