GeoJson from Exif

Now I’m at it, let’s try another one:
my first Swift project (or actually: experiment),”geojson-from-exif” is available on Github:

https://github.com/onderweg/geojson-from-exif

It’s a simple OS X command line tool thats converts Exif GPS data from a directory of images to a GeoJson structure.

WhereAmI-GeoJSON

My First fork on GitHub! :)

https://github.com/onderweg/whereami-geojson

OS X command line tool, written in objective C, to get your current geographic coordinates in GeoJson format, using the OS X CoreLocation framework.

When Apple announced Safari push notifications, I was really excited. Send pushing notifications to the desktop is a great way to keep users engaged with a (web) app.
Instead of sending for example e-mail updates, users can be notified using non-intrusive toast messages. Even when their browser is closed, similar to what users are used to on mobile devices.

Use cases are for example breaking news updates from a new site, or status updates from friends on social media sites.

APNS

Safari is the first browser that brings push notifications initiated from websites, to the desktop.
The Safari push notification service (APNS) – originally developed for iOS – is one of the new features Mavericks brings to OS X.

Having used this service in several projects, I’m really excited about the possibilities. But of course, only a small segment of web site visitors use Safari+MacOS. This means, at the moment, APNS can not be used for a broad audience.
Another downsite to APNS is, that you need a paid Apple developer account ($99/year) to be able to use APNS.

So, what are the alternatives?
Naturally, the best alternative would be other major browsers support desktop push notifications. But as far as I know, none of the major browsers currently support APNS like functionality (please correct if I’m wrong in the comments).

Chrome

Chrome comes closest to APNS like functionality: it has its own notification center build in for toast notifications, and supports push notifications. But this comes with some restrictions:

  • Web sites can display toast notifications, but only client side (via javascript) initiated
  • Push notifications are supported, but only from extensions

Firefox and IE

Firefox and IE don’t support desktop push notifications at the moment.
It seems desktop push notifications are on the Firefox roadmap since 2012. But current status remains unknown. Javascript toast notifications are supported though.

IE also has no support for push notifications from web apps, but IE 11 does provide support for live tiles for pinned sites. This means users need to add your site to their home screen to receive live updates.

3th party Push services

As long as web sites can’t push notifications directly, 3th party notification services may provide an alternative.

For mobile devices, I’am a fan of general notifications services like Prowl (iOS) and Pushover (Android/iOS).

Pushover, sends push notifications from API or web to devices using Pushover app:

  • Pro: iOS and Android support
  • Con: (iOS) app is relatively expensive ($4.99)
  • Push via API only per API key, not possible to push a message to list of API keys (users) in one request. Pushover does support delivery groups though, but there is no API support for adding users to a group at the moment.
  • Modern UI

Prowl, sends push notifications from API or web to devices using Prowl app:

  • Pro: API supports push to list of devices in a single POST request
  • Con: no Android app
  • Cheaper than Pushover, but still relatively expansive: $ 2.99
  • Active user support via Twitter, e.g. during service interruptions.

Both provide an easy to use API (authentication using API key, no oAuth… yeeeeh), so any (web) app can easily send push notifications to subscribed devices.

It would be great if there was as Chrome extension for Prowl or Pushover to bring notifications to the desktop using the same API. This would also mean users can receive a notification on both desktop and a mobile devices, so notifications are truly location independent.
But, unfortunately, for both services there is no Chrome extension available at the moment.

Pushbullet

A nice service that does have a Chrome extension is Pushbullet. Pushbullet can send push notifications to Android and Chrome, from its web interface or API. First impression is definitely good, but what I think is really missing at the moment:

  • API support for push to friend’s devices, or in general devices other than your own
  • API method for ‘push to all registered devices’. Currently, you need to request a list of devices, and push to a specific device ID.
  • There is no iOS app at the moment

Luckily, according to Pushbullet on Twitter, this may soon change.

Update 14 jan.: Google has plans to add push notifications this year (2014).

See also

Het is helaas nog altijd in Nederland moeilijk voor ontwikkelaars om toegang te krijgen tot webservies die gratis informatie geven over openbaar vervoer.

De NS kwam een tijd geleden eindelijk met een eigen API, maar deze is nog altijd in bèta stadium en informatie is nog niet volledig. Zo is er geen overzicht op te vragen van de dienstregeling van één bepaalde trein, bijvoorbeeld op basis van ritnummer.
De Somda API, die o.a. gebruikt wordt in de iPhone app trein, biedt deze informatie over dienstregelingen per trein wel. De Somda API is vrij te gebruiken, echter niet voor commerciële doeleinden.

Aan de NS API is verder jammer dat er alleen XML als output beschikbaar is, en niet het lichtere JSON. Tenslotte protesteert de stylist in mij heel erg bij inconsistent taalgebruik in de XML: Nederlands in de vertrektijden feed, en Engels in de overige gedeeltes van de NS API.

Als alternatief is er openOV. Openov is een heel mooi initiatief om data van vervoerders samen te brengen en toegankelijk te maken op een open manier. Het project is nog volop in ontwikkeling. En misschien daardoor nog niet altijd even bruikbaar. Zo is de documentatie nog rommelig en te specifiek voor ontwikkelaars die zich niet willen verdiepen in de achterliggende techniek. Er wordt zonder algemene inleiding veelvuldig gestrooid met termen als koppelvlakken, BISON en PubSub. Verder is openOV een verzameling van verschillende deelprojecten, waarbij een duidelijk overzicht op één plek ontbreekt. Zo is er documentatie voor de : KV78Turbo REST API (met documentatie), een project pagina, een Google Group, ruwe data voor die die-hards, en een NS API zonder documentatie.

Ondanks deze kritiek hoop ik dat ontwikkeling aan het project door blijft gaan, en zal leiden tot een voor iedereen toegankelijke REST interface, waarmee gemakkelijk actuele vertrektijden en dienstregelen van al het OV in Nederland opgevraagd kan worden. Het begin is er in elk geval, met de KV78Turbo API.

Dan is er nog 9292ov met hun open data initiatief. Opzich mooi, dat men zich ten doel stelt om data openbaar te maken via downloadbare datacollecties. Maar waar het meeste behoefte aan is onder bouwers van apps – een API waarmee dynamische data kan worden opgevraagd – ontbreekt het nog steeds. Ondanks aankondigingen in 2011 dat dit snel zou gaan gebeuren.

Er is stiekem echter wel een REST API beschikbaar die wordt gebruikt door de mobiele app van 9292ov.nl. Met een HTTP debugger als Charles kan je de calls naar https://api.9292.nl/0.1/ eenvoudig achterhalen. Je moet dan alleen nog wat instellen om communicatie via SSL te decoderen.

Maar helaas wordt deze API niet officieel ter beschikking gesteld aan het grote publiek. Hopelijk komt hier snel verandering in!

Update 25.03.2014 Bovenstaande API is inmiddels op Github uitgebreid gedocumenteerd! Knap gedaan. github.com/timvanelsloo/9292-api-spec.

In de tussentijd ben ik aan het experimenteren met de NS API in een Windows WPF applicatie met Metro interface. (zie post over Metro en WPF voor meer informatie).

Deze app is hier te downloaden

Windows 8 style apps in WPF

After building my first Windows 8 store app (using XAML and C#), I wondered whether it is doable to build desktop apps in the same style, without WINRT classes.
Since I preferred using XAML and C#, WPF was the application framework of choice.

Second step, how to build a Windows 8-style UI (formally known as Metro UI) without building my own controls form scratch?
Turns out there is an excellent solution for this: the mahapps.metro UI kit. Mahapps does the styling of common controls for you, and packs some Windows 8 specific controls, like a Panorama (sideways scrolling) view.

Last step was including Windows 8 components that make life as a programmer easier:

  • Asynchronous Programming with Async and Await, via Async Targeting Pack.
  • ASP.NET Web API. NuGet: `Install-Package Microsoft.AspNet.WebApi`.

Result is a personal reference app. What it does it simple: show current departure times for any bus stop and train station in the Netherlands, using the 9292ov (non-official) JSON API.




CodeIgniter – GAS ORM

CodeIgniter comes with an ActiveRecord implementation that is fairly straightforward. You can retrieve table rows easily, but you have to write your own logic if you need an extra layer of abstraction (models). Models can help for example to traverse relationships between entities easily, by lazy or eager-loading related entites when they are needed.

There are many PHP ORMs available that provide this abstraction, but none of them integrates nicely with CodeIgniter’s ActiveRecord. At least, I could find any.

I was looking for an ORM that:

  • is a layer on top of CodeIgniter’s ActiveRecord implementation. I don’t like importing a large 3th party library like Doctrine into my CodeIgniter projects, and trick CodeIgniter into using that instead of its own databases access layer.
  • Provides freedom in how and when to use it. I like the idea of convention over configuration, but in real world situations, using a framework that enforces too strict can be a burden. For example when using a legacy database.

Enter GAS ORM. Gas ORM is an excellent initiative by a single developer: Taufan Adity. GAS can be mixed with ActiveRecord calls, and supports convention as well as configuration. On top of that, the developer welcomes requests and questions. If you want to make handling database access with CodeIgniter easier: try it!

Gas code example:

$this->load->library('gas');
// to see available models :
// var_dump($this->gas->list_models());
$user = new User;

// Now you can use any available Gas method, or your User models public method

$user1 = $user->find(1);

$user1 = Gas::factory('user')->find(1);

I haven’t tested GAS extensively yet though, but the first version looks very promising.

Links