A few days ago I decided that Google recommend IDE for developing on Android (Eclipse) was pants on head silly. Somewhere between the high memory usage (700MB on idle), poor performance on my laptop (It would lag every time I scrolled) and other annoyances (e.g. when it thought there was a bug, were their wasn’t but would not run anything until I fixed the imaginary bug). Thus I decided to see if NetBeans (My preferred IDE for working with Java) could be a better alternative.
Setting up Android to work on NetBeans
Off the bat, NetBeans does not have many development tools for Android. In fact after an evening of searching I managed to only find one plugin for NetBeans. The plugin I found was nbandroid, which hasn’t been updated in a few months, but for now was the best option.
Installing the Android for NetBeans plugin was quite easy, the NetBeans Wiki has a well written tutorial on how to get everything set up.
Initial thoughts
NetBeans is a much cleaner and easier to use interface in comparison to Eclipse, however a few differences stood out to me.
Firstly, you will need to have a reasonable understanding of android projects’ file structures, otherwise your pretty much back to square one. If you have a good reference material this should not be an issue, but if your looking just to have a play around it could end up being a little headache.
Within the next few hours I will be releasing an update to my Google Chrome extension Twitter Status URL Shortener. It’s a worthwhile update, mostly because I’ve been meaning to update it for a while and I’ve made a few neat adjustments based on feedback.
Some of the key changes are:
The icon no longer takes up real estate next to the URL bar.
Smarter URL shortening i.e. if the URL is shorter or about the same length as the shortened URL it will not bother shortening it.
It’s faster! I adjusted the speed a little and now it’s a little more suitable for fast typing users.
Support for goo.gl.
Caching was also added, which makes tweeting URL’s multiple times faster.
A few weeks ago I wrote a neat little PHP Class which makes talking to twitter via their API really easy for Socialize This. You can download it and contribute to it, on it’s Google Project homepage. Here are a few quick examples of how to use it:
Update you Timeline (Send a tweet)
$t->updateStatus('Messing about with my Twitter API script');
A few days ago Google opened up their URL shortening service goo.gl to the public. Luckily it is pretty easy to make use of the API and shorten URL’s in PHP. Here is a function I put together which you can make use of.
<?php
// Coded by Mike Rogers (http://www.fullondesign.co.uk/) 1st October 2010.
function shorten($url, $qr=NULL){
if(function_exists('curl_init')){
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, 'http://goo.gl/api/shorten');
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'security_token=null&url='.urlencode($url));
$results = curl_exec($ch);
$headerInfo = curl_getinfo($ch);
curl_close($ch);
if ($headerInfo['http_code'] === 201){ // HTTP Code 201 = Created
$results = json_decode($results);
if(isset($results->short_url)){
$qr = !is_null($qr)?'.qr':'';
return $results->short_url.$qr;
}
return FALSE;
}
return FALSE;
}
trigger_error("cURL required to shorten URLs.", E_USER_WARNING); // Show the user a neat error.
return FALSE;
}
// Example: Just the Short URL
echo shorten('http://www.google.com/');
// Example: Give the Short Code URL and image it.
$qrURL = shorten('http://www.google.com/', TRUE);
echo '<img src="'.$qrURL.'" />';
?>