zaterdag 7 november 2009

Android update panic

Today I wanted to try out the new Android 2.0 SDK update that was released last month. Aside from the new cool things I wanted to try out in the new release, I also wanted to see if things were different in the new API.
After downloading the new SDK, which was suprisingly only 22MB instead of the 224MB for 1.6, I found out this was an unnecessary step. It seems you can update 1.6 by simply go to Windows > Android SDK and AVD manager > Available Packages. Check the checkbox with the repository xml, click Install Selected and follow the screens from there. Afterwards you need to update "Android Development Tools" as well in your Eclipse software updates.
Unfortunately, the update didn't went as smooth as I hoped for. After updating I ran into the problem in comment 1 stated here http://code.google.com/p/android/issues/detail?id=3025. The emulator would start, but eclipse couldn't connect. ADB kill-server didn't work.
In the end, I got it running again. So, what was I doing wrong? It appears you need to update "Android DDMS" as well in your Eclipse software updates.

dinsdag 23 oktober 2007

Using Fiddler with localhost pages

Everybody who has ever used Fiddler might have stumbled upon the localhost problem. Because of some hardcoded things in IE7(?), all localhost requests don't pass Fiddler. To work around this, you can call the page you want to debug by using:

http://machinename:8080/index.html

This will let the request pass through Fiddler.

More on this subject can be found on the Fiddler helppages: http://www.fiddlertool.com/Fiddler/help/hookup.asp

donderdag 11 oktober 2007

Mobile Firefox

Mozilla is announcing a new mobile version of their Firefox browser. I can only cheer to that. :)
http://weblogs.mozillazine.org/schrep/archives/2007/10/mozilla_and_mobile.html

woensdag 10 oktober 2007

What to do with 22,000 cards

dinsdag 9 oktober 2007

Encoding URL form parameters in Java

When using Java to get the response of a HTTP connection, you can use the following function.

private String getHttpResponse(String url) {
StringBuffer response = new StringBuffer();
try {
URL connection = new URL(url);
URLConnection urlconnection = connection.openConnection();
BufferedReader breader = new BufferedReader(new InputStreamReader(urlconnection.getInputStream(), "UTF-8"));
String line = null;
while ((line = breader.readLine()) != null) {
response.append(line);
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return response.toString();
}


After it's declared, you can call it by using getHttpResponse("http://www.google.com");

The problem is that if you want to give any extra request parameters with it that are not in the english alphabet (like the german umlaut sign), it's pretty unpredictable how it is passed on to the called server if you don't have it properly encoded. So, what you want to do is have these request parameters encoded in the proper encoding (UTF-8 or Latin-1) before using it as a request paramater.

The java.net package has classes for these situations called URLEncoder en URLDecoder.
Example: cleanquery = URLEncoder.encode(query, "ISO-8859-1");

maandag 26 maart 2007

Hoera, we hebben een nieuwe blog

Eindelijk, een nieuwe blog.