Planet Compsoc

February 08, 2010

Blood God

Personal Projects Versus Work

Since I started work, I’ve found that I’ve done less and less work on any of the personal projects that I’ve picked up over time. As I write this, I can think of at least four different projects that I was going to do some work on when I next got an opportunity (such as today – as I’ve had the day off), but I’ve not touched in weeks at best. Of course, these opportunities don’t really come round all that often, as I don’t often have time after work (at least, not if I want to eat and get some sleep), and I always seem to end up otherwise engaged at weekends.

However, when I do have a day where I don’t really need to do anything and have the time to spare (like today) I inevitably end up wasting it through watching TV/films, playing on the XBox, or writing blogs like this. I’ve convinced myself that the main problem is that I spend 40+ hours a week in the office looking at one project or another there. This might involve writing actual code (as most of last week did), integrating various components to solve problems that way, performing analysis on what we need to do or any number of other activities, most of which are things I’d need to do on the personal projects. Given this, I guess I’ve been subconsciously avoiding doing anything on them as it seems too much like work.

Of course, by being apathetic in regard to these projects, they’re ever growing in number as I come up with an idea for something that I (or others) might find useful, and therefore add it to the list. A prime example is the Choob functionality I mentioned in passing in my previous entry about Code Style last month (which was a lot of hot air, and no real action), but there are also a whole load of other things that I’ve been thinking about for a while and should probably do something about.

So, what do I do about this? Well, I guess it all comes down to forcing myself to sit down and write some code, rather than wandering off and parking myself in front of the TV for an entire day. With this in mind I’m going to try and set aside a couple of hours each week (be it at the weekend, or one evening), where I can get something written. This will mean that I need to actually think about what needs doing, and break it up into suitable chunks – but that’s something that would need doing anyway if the projects are to avoid spiralling out of control.

I guess if I can manage that, then I should also be able to keep this blog a bit more up to date, especially with progress, so I may even start updating this more often. Of course, it could all fail miserably, so I guess we’ll just have to see!

by Chris Hawley at February 08, 2010 08:00 PM

February 04, 2010

Alp

HTML5 Theora Video Codec for Silverlight

I’m glad to announce the first release of our fully managed Theora audio / video decoder implementation for the Silverlight platform! The Highgate media suite will bring installation-free support for HTML5 streaming video to an additional ~40% of web users overnight.

Theora

So, a few drinks will be in order to celebrate the release at the FOSDEM beer event, Friday — drop by! And of course, I’d like to invite anyone excited about making open codecs a first class citizen of the Silverlight / Moonlight ecosystem to visit the Mono dev room over the weekend for source code and some frivolous demos between sessions.

Technology

We’ll be releasing a high-performance decoder for Theora video / Ogg Vorbis audio streams that plugs into the Silverlight 3 streaming media abstraction, as well as a reference front-end player interface and JavaScript bridge layer providing basic compatibility with standard HTML5 media tags, adding support for the standard to Internet Explorer and extending the capabilities of WebKit-based browsers like Safari and Epiphany. A cunning plan, one might say!

by alp at February 04, 2010 11:02 PM

February 03, 2010

Connorhd

WebApp – An Android experiment

After thinking about a JavaScript API to allow alerts on an Android phone in this post, I came up with a method of adding this using the current Java Android app API. The solution involves starting a Webkit instance in a custom app, and intercepting links with a certain prefix. In this example android://alert/description creates an alert with title “alert” and description “description”.

To demonstrate here are some screenshots of a sample page using a sample application (if you have an Android phone you can use that link to download it and try it yourself):

The application when you load it:

When clicking go an alert is created:

Viewing the created alert:

The example page is very simple javascript:

function go() {
	window.location = 'android://'+document.getElementById('title').value
		+'/'+document.getElementById('text').value;
}

The source for the app follows and is also fairly simple, most of the code is the rather complex way alerts are generated on Android:

package uk.co.connorhd.android.webapp;
 
import java.net.URLDecoder;
 
import uk.co.connorhd.android.webapp.R;
import uk.co.connorhd.android.webapp.WebApp;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
 
public class WebApp extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    WebView webview = new WebView(this);
 
    // We're testing, clear the cache.
    webview.clearCache(true);
 
    setContentView(webview);
 
    webview.getSettings().setJavaScriptEnabled(true);
 
    final Activity activity = this;
    webview.setWebViewClient(new WebViewClient() {
      int alert = 1;
 
      public void onReceivedError(WebView view, int errorCode,
          String description, String failingUrl) {
        Toast.makeText(activity, "Oh no! " + description,
            Toast.LENGTH_SHORT).show();
      }
 
      public boolean shouldOverrideUrlLoading(WebView view, String url) {
        // Is it a hack?
        if (url.startsWith("android")) {
          String ns = Context.NOTIFICATION_SERVICE;
          NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
          int icon = R.drawable.icon;
          CharSequence tickerText = "WebApp Alert!";
          long when = System.currentTimeMillis();
 
          Notification notification = new Notification(icon,
              tickerText, when);
          notification.flags = Notification.FLAG_AUTO_CANCEL;
          Context context = getApplicationContext();
 
          String[] split = url.split("/");
 
          CharSequence contentTitle = URLDecoder.decode(split[2]);
          CharSequence contentText = URLDecoder.decode(split[3]);
 
          Intent notificationIntent = new Intent(activity,
              WebApp.class);
          PendingIntent contentIntent = PendingIntent.getActivity(
              activity, 0, notificationIntent, 0);
 
          notification.setLatestEventInfo(context, contentTitle,
              contentText, contentIntent);
 
          mNotificationManager.notify(alert++, notification);
        } else {
          view.loadUrl(url);
        }
        return true;
      }
    });
 
    webview.loadUrl("http://connorhd.co.uk/files/WebApp.htm");
  }
}

This could easily be extended (and I may try to do this myself for Ircster) to provide all the standard browser functionality (for example the back button doesn’t currently work) and a more complete API to interface with Android.

by Connorhd at February 03, 2010 11:56 PM

Website based smartphone applications

First of all, most applications for smartphones (in this post smartphone mainly means iPhone or Android) are actually just interfaces (often simplified) to websites, i.e. Twitter, Google Maps, etc. However, both the Android and iPhone appear to fail quite badly at allowing websites to directly integrate with the phone, and I have some thoughts on how they could work better. When thinking about these ideas I am mainly thinking of what features I would like to see when developing phone specific features for Ircster (a fairly major project I am working on that I will eventually get round to writing blog post(s) about), but I think the same features would be useful to a large number of developers and lead to a better platform for users and developers alike.

Looking at the iPhone first, it does allow websites to be directly added as “applications” (applications meaning buttons on the iPhones menu). It also allows some limited customisation of the way the website is displayed when it is accessed as an application using html meta tags (i.e. <meta content="yes" name="apple-mobile-web-app-capable" />). This is a good start, however, the iPhone seems to be completely let down here by not allowing background applications, meaning there is no way to run a website constantly and alert the user on specific events, or receive sensor information (i.e. GPS) while the phone is being used for another purpose.

Android on the other hand supports background applications, however it does not allow (as far as I can tell) for websites to be added as applications, and does not have a way for websites to interact with the phones features. What I would like to see is a JavaScript API allowing phone features such as alerts to be triggered by the website (possibly similar to the message passing feature in Chrome extensions), and also for the phone to reply to the app with sensor information such as GPS location. This seems to fit in very well with the ideas behind Chrome OS and applications being simply websites. (While considering this it occurred to me some of this functionality could be hacked into Android using its current Java app platform, something I have started working on and will demonstrate in another blog post.)

Desktop applications definitely seem to be being replaced by websites, I don’t see why the opposite should be true on phones (websites should not need to write specific phone apps). I’d like to see APIs included with smartphone browsers (Google Gears is a potential start, although this appears to be deprecated on Android) that provide more direct interaction with the phones features (alerts, access to sensors, local storage and local serving of content) and allow complete applications to be developed as websites for multiple platforms.

by Connorhd at February 03, 2010 12:06 AM

February 01, 2010

Sinjo

Mirror’s Edge (PC) Review

I picked up Mirror’s Edge in the recent Steam sales (along with far too many other games, which saw off a little more money than I’d hoped). I didn’t get it with any of my own expectations, only the knowledge that people had told me it was a must buy. Unfortunately the game left me wondering what had deluded these people into thinking something like that.

If you care about the story not being spoiled you may want to avert your eyes. The game starts with you being plonked down on a roof somewhere in some city where the graphical bloom goes up to 11 and stays there at all times. You’re taught your repertoire of jumping and fighting techniques in one go, god forbid you should forget them, and then launched into the game. The story is set in your regulation future dystopia, where the police are evil, the government are evil and concrete blocks are extremely springy. You’re not really given too much motivation to hate the government; you just take the game’s word for it and set about acting like a royal prick with a poorly explained briefcase fetish.

Sadly, the game play doesn’t even come close to making up for the plot. There is one route, and only one route, and any deviation from it will result in crunchy death as you faceplant into the pavement. Most of the time this route is helpfully painted red, but the game occasionally decides you’re more competent than that and lets you decide what to do. Don’t be fooled though, there’s one path, and any attempt at creativity will be duly rewarded with death.

Linearity aside, the game still manages to produce an unnecessarily frustrating experience. Every time you grab an object or ledge, you’re treated to a face full of concrete and have to stop and move the camera around, breaking the flow of the game. This, teamed up with the loss of momentum every time you jump over anything higher than a cinder block, caused a steady feeling of rage which didn’t really subside at any point in the game.

The lack of choice in paths reared its ugly head more than once during the game, but one incident stuck out more than the others. In a section in chapter 7 the character is running on top of some ventilation shafts and some pipes are highlighted red on the other side of the room. I spent a good half hour wall running along the wall that headed directly to them, only to be left disappointed at the game’s edge detection and plummeting to an inevitable death. It turned out that I was meant to run along a wall parallel to what I was aiming at and make possibly the most hilarious jump ever to reach the bars.

The edge detection was a constant annoyance. At times it seemed like the protagonist simply wasn’t trying, but as soon as a bit of concrete turned red it may as well have been a fucking spring board. The net result is that you only go where the game wants you to go, no matter what incredible leap that may involve. Occasionally it will even help you when you don’t jump far enough, and you’ll end up performing a mid air vault for a pipe or ledge.

Overall, I’m confounded as to why people recommended this game so highly. While it’s a nice concept, it’s totally marred by a lack of polish (no, not bloom, there’s enough of that) in the execution. Bring on the release of Assassin’s Creed II on a real platform.

by Sinjo at February 01, 2010 08:58 PM

Trip

Copenhagen (Part 2)

(Not that it particularly matters as they’re both disjointed and flow in no particular direction, but for chronology’s sake – read Copenhagen (Part 1) here first, if it piques your interest.)

After a long stint of not updating and people rolling their eyes and claiming “you’re never going to update on Copenhagen, are you?”, here it is. Hand-rolled and clumsily written, I’ve done it at last.

I had a flight back to the UK that afternoon (emissions offset!), and so we only had time to visit a place that was enthusiastically recommended to me by a kind volunteering partner at Klimaforum. She said: “Visit Christiania! It’s … something else entirely. Copenhagen’s worst kept secret.”

Here’s a nice shot of what I mean by Christiania:

Christiania

It’s easy to fall into misconceptions. Graffiti. Low-rise buildings with a ruffled look about them. Barrels with naked flames on the street with people huddling around them. No cars in sight. Sleepy cafes, sparsely decorated.

But I think it’s a place of rich history. Known as “Freetown Christiania”, it claims to be autonomous. According to the fascinating Wikipedia page, some portions of the law behind supervision have been transferred to the state (under the Christiania Law of 1989). There are some regulations and rules of Christiania, created independently of the government. Razi affectionately commented, later on, how such a place demonstrated how true democracy could potentially work. Major matters in Christiania were apparently decided by voting, and it enforced its own sanctions.

I cannot remember exactly, but there has been a long history of conflicts about the supposed tolerance of cannabis in that region and numerous episodes of governmental authorities trying to regain control of the region. Christiania stood for freedom, liberty and art: it was a focal point for gay activism, for example, and it was (at times) belligerent and bellicose to government authorities. But of course, the tensions have somewhat settled down into a comfortable status quo. We found it a lovely place to walk around and it was obviously one of the biggest tourist hotspots. There were small stalls selling Christiania merchandise and I suspect the massive thrusts of tourism to the area brings welcome profit.

Just outside Christiania.
Just outside Christiania.


The outer regions of Christiania.

null

null

We had a quick walk around the area and encountered a formidable (?) looking building with very interesting looking chairs:

null

null

null

null

We were tempted to put our own signature on one of the walls, but decided against it. It was a lovely little place though, even though everything was closed in that building that day.

At that time, there were also small, independent art exhibitions held in Christiania pertaining to the climate change summit. They were largely activist in nature, with some very striking models – almost caricature-like, even. Some of them seemed solemn in nature, while others grieved for a world already ‘lost’. Some seemed to gleam with a sense of hopefulness, depicting children holding hands together to protect the earth. A few of them were satirical in nature, criticizing the ‘greed’ of green capitalism with grasping hands and painted bank notes. All in all, an interesting viewing, even if I remembered only to take a few photos of them:

Forgive me, but my memory is quite fuzzy. I remember taking the long tube ride back to Copenhagen airport (after making a few wrong stops) and just hanging casually with Razi. The planeride back to the UK was pleasant enough, and it all left a sweet taste in my mouth. :)

If I were to give Copenhagen a flavour, it would be hot chilli with potatoes and leek. It would sound like a bamboo flute and smell like clovers. I really enjoyed it, and even though I arrived in Copenhagen with no real noble agenda, it was really interesting to taste the culture, meet amazing people and be part of such a well-organized academic forum. I liked the organic food and all the bitterly cold nights, even. I enjoyed speaking to the funky people on the bus, and I will remember those moments where we all held our baited breaths as the police stopped to examine our bus. I adored the confusing train ticket dispensers, that funny Cantonese-speaking restaurant owner, the crowds of protests, the strength and solidarity of it all … it was what Morshed would call a perfect ‘hippie-venture’. Also, I thank Razi and friends for accompanying me (or did I accompany them?) on this. Couldn’t have done it without you.

Next stop: Sahara! Just kidding. Somewhere a little closer – Edinburgh, maybe? ROAD TRIP!

by admin at February 01, 2010 01:34 AM

January 31, 2010

icStatic

Nexus One

I recently bit the bullet and ordered myself a new phone – a brand spanking new HTC/Google Nexus One.

These are a few comments after having the phone a few weeks:

The good stuff:

  • The screen is fantastic, very very sharp and excellent colour range
  • The phone is really fast most of the time
  • Contacts management is excellent, although the facebook integration needs a bit of improvement
  • The integration with google apps and services is fantastic
  • The range of Android apps available is pretty good
  • I like the live wallpapers, I’m looking forward to some more nice third party ones coming out
  • The web browser is excellent – I’m really looking forward to the full flash support coming over the next few months
  • Battery life – for this class of phone its excellent, I am able to get a full day out of it on light-moderate use.

The bad stuff:

  • The screen is hard to see outside
  • The bezel around the screen is too small considering the screen is touch sensitive right to the edge – if you hold the phone wrong and touch the edges it either ignores your input or clicks in a random location. This means its practically impossible to use the phone one handed
  • The ‘pattern lock’ screen is utterly useless – when you draw the pattern you can see the smudges on the screen of the pattern. There seems to be no option to use a standard PIN/button combination
  • The software still seems a bit flakey – but it is a brand new version, so hopefully this will get better in time
  • The facebook app leaves a lot to be desired
  • Lots of bugs related to the Messaging app – it seems to pick up the first word of some messages and make this the title/sender, so I have a number of messages with random titles

Things I want:

  • An Android DropBox app
  • Flash support
  • Multi-touch support – the phone’s hardware supports it
  • The ability to specify a border for the touch screen where outputs outside it are ignored – so I can use my phone one handed.

Some of my picks for the ‘best of android’:

  • Locale
  • Spotify
  • Last.fm
  • SMS Popup
  • SMS Backup
  • ShopSavvy
  • Shazam
  • Quickpedia
  • Places Directory
  • Meebo IM
  • KeePassDroid
  • Jewels
  • handyCalc/handyConverter/handyCurrency
  • Flood-It!
  • Daft Machine
  • ConnectBot
  • beebPlayer
  • Bebbled
  • Barcode Scanner
  • Alarming!
  • Advanced Task Killer
  • Astrid

Pay-as-you-go or Contract?

A phone like this consumes a massive amount of data, so my existing PAYG Three deal had to go – I hardly ever had a signal anyway. I contemplated a few choices, looking at contracts and what not. I eventually settled on two options, the T-mobile PAYG unlimited internet and texts SIM only deal for £10/mo, and the O2 deal which is similar but for £15/mo. After looking at the T&Cs and very very fine print, I ruled out the O2 deal as it only allowed for 200mb/mo ‘fair use’ – Fair? No… So I went with T-Mobile. While browsing their site I stumbled across another deal – a 6-month internet booster. The deal gives you 6 months of ‘unlimited’ (1gb/mo) internet on your phone for a £20 once off payment. So essentially £3.30 a month for unlimited internet. SCORE!

Closing Thoughts

Overall I really like this phone, it has a few annoying gripes that hopefully will get worked out, but its got a good solid foundation to build on with future iterations of the firmware. If you are after an Android phone, this is the one to get.

Mini aside

Apple announced their ‘iPad’ this week. Considering the hype this was a monumental let down. Essentially the iPad is a giant iPod Touch. It’s not even a bigger iPhone because it can’t make phone calls! There are plenty of rants about this device which I won’t repeat, however the one thing I think was their biggest mistake – no multitasking. What were they thinking

I think people are going to buy this expecting a netbook style device with a touch screen and be incredibly disappointed. I have been considering a tablet style device for a while and was hoping that the Apple Tablet would be the one, it’s not – in fact my shiny new phone does a better job – it will fit in my pocket!

by icStatic at January 31, 2010 08:48 PM