NFC + Krautmilen + Android

kraut

We needed to make something to measure timings during the running event Krautmilen.

Equipment:

  1. Make a fugly Android app which could relay runners NFC keyring blips to a server API.
  2. Make a server API to handle the basic running logic (ie pair up names of runners with their start and finish times)

The application is quite simple: once the NFC tag has been blipped it sends an Intent to the application that contains the NDEF data. We grab the ID from the NDEF and perform a HTTP request to the server API.

Since the Android app basically just relays on sending NFC tag IDs to a server, there are lots of use cases, so we released it on Google Play yey! You can enter your own URL, make HTTP requests and use the data to whatever you want. NFC is everywhere nowdays; in travelcards, passports, library books and much more.

Here’s a small code example for handling the Intent:

private void handleIntent(Intent intent) {
      String action = intent.getAction();

      if(NfcAdapter.ACTION_TAG_DISCOVERED.equals(action) || NfcAdapter.ACTION_TECH_DISCOVERED.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {

            NdefMessage[] messages;
            Parcelable tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
            getTagData(tag);
      }
}

The only boring thing is that the Android device needs to be unlocked, because the device turns off the NFC chip when it is asleep. This is quite annoying but due to safety reasons it makes sense. You can go around that though, but you will have to root your Android device.

 

/Johanna

Relaying push notifications to your own API

We recently made a campaign for Loka mineral water, where users together reveal the new flavors. This is done by using Snapchat. We send users snaps containing puzzle pieces, and when they make a screen grab of a specific piece – we put that piece in the puzzle on the website.

Because of legal reasons we aren’t allowed to use the Snapchat API, but we still need to have some automation. For example we wanted to know immediately when a user made a screen grab of our puzzle piece snap, so we got around the problem by building an Android application.

In the latest Android SDK 4.4 (API 19) the “NotificationListenerService” was released. Using it, we can listen for incoming push notifications on our Nexus tablet. In the app, we’re just checking if the package name from the StatusBarNotification equals “com.snapchat.android” and if the notification ID matches the ID you get when someone is screenshoting your snap.

Then we post the username to our API, and cancel the notification from the NotificationListenerService.

code example:

@Override
   public void onNotificationPosted(StatusBarNotification statusBarNotif) {

       Notification notif = statusBarNotif.getNotification();

       if (notif != null){

           Bundle extras = notif.extras;
           Intent intent = new Intent(MainActivity.INTENT_NOTIFICATION);
           intent.putExtras(notif.extras);
           sendBroadcast(intent);

           Bundle intentExtras = intent.getExtras();
           String notifTitle = intentExtras.getString(Notification.EXTRA_TITLE);
           CharSequence notifText = intentExtras.getCharSequence(Notification.EXTRA_TEXT);

           int notificationId = statusBarNotif.getId();

           //Check if the notification is from snapchat, and the id matches the printscreen id from notification.
           if(statusBarNotif.getPackageName().equals(snapchatPackageName)){
               if(notificationId == printScreenId){
                  
                   //Split the String to get the username. 
                   String arr[] = notifText.toString().split(" ", 2);
                   String userName = arr[0];
                   
                   //Send to api.
                   runHttpPost(userName);
                  
                   //Cancel all notifications.
                   NLService.this.cancelAllNotifications();
               }
           }
           else{
               Log.i("Other", "Another type of notification.");
           }

       }
   }

Pantaluren.se (in swedish)

Vi lanserade just ett eget projekt. Earth People är delaktiga i detta, inte bara som byggare utan även som partners. Tjänsten är inte färdig eller perfekt, men vi gillar att släppa saker tidigt och iterera ofta, så ha det i åtanke. Hittar du nån bugg, säg hemskt gärna till.

Tjänsten heter Pantaluren, och är i sin enkelhet ett ställe att sälja din gamla iPhone på. Så småningom kommer vi ta emot fler slags enheter, men för nu endast iPhone.

Eftersom vi är som vi är byggdes tjänsten runt ett egetdesignat REST-API. Detta API går det bra att ansluta till vid behov, om du behöver en tjänst som värderar smarta mobiler. Hör bara av dig isåfall!

Om vi ska få in lite tekniskt fokus här på labsbloggen kan jag nämna att tjänsten är byggd på CodeIgniter/MySQL/Memcached och renderas som HTML5 av Handlebars.js och Require.js.

Instagram bingo

This is a game that’s perfect for a company event, like our own Helsinki kick off. You get a list with stuff that you’re supposed to capture with your smartphone camera, tag properly and upload to instagram. Some of them are bound to a place, some not. Hard task – more points. In the field you get to see the other teams’ progress, as well as your own, listed and on a map. You also get comments from the web app directly in your instagram feed, telling you if you got points or if the image is no good for some reason, wrong location for instance.

In the backend we have a database with teams, challenges and scores, and a web app connected to the instagram api. The app checks the participants’ feeds for tags included in the game, and compares the challenge geo data to the image location, considering a specified allowed offset in meters.

Our challenges would be something like “Eating a Panda liquorice ice cream in Esplanadin Puisto”. The team would then have to find out what and where Esplanadin Puisto is, try to get there, find a place that sells the particular Panda ice cream, and take the photo. Plus snap a picture of a mullet on the way.

A time frame factor could also be added to the game – “A woman walking into the Arabia Store between 12 and 12.15”

We can make this fun thing happen at your event too. While your staff get loads of fun and team building, your company gets lots of positive social media exposure. Everybody’s happy, for real.

http://perkele.earthpeople.se

NOW On Roskilde

Now On Roskilde is a mobile application which users easily can add to their homescreen.
It shows what’s on right now, together with related artists playing in the near future.

Since nothing is playing right now (+ the correct feed hasn’t been published yet), the app is pretty worthless at the moment. There is a way to get a preview though, by adding a querystring to the url. These urls below will fetch the Roskilde data feed from 2010.

# thu, july 1st 2010, 19:43
http://nowonroskilde.com/?timestamp=1278013434

# fri, july 2st 2010, 19:43
http://nowonroskilde.com/?timestamp=1278017704

nowonroskilde.com by Earth People is a quick hack put together for the Roskilde Labs competition. Also, feel free to use the php class we put together for this.

Extracting mood data from music


We have provided data from the Moody database to a group of researchers in the Netherlands, who have been doing some really interesting work. Menno van Zaanen gives us a report:

As a researcher working in the fields of computational linguistics and computational musicology, I am interested in the impact of lyrics in music. Recently, I have been researching what makes a song fit a particular mood. Why do we find some songs happy and others sad? Is it mainly the melodic part or mainly the lyrics that make the mood of a song? Do we agree upon this feeling or, in other words, do we consistently assign a mood to a song?

In particular, I am interested in building computational models that allow us to automatically assign a mood to a particular song. If we can successfully build such a model, we can also build a system that can filter songs from a large music collection based on their mood. For instance, your music player can create a playlist containing only happy songs by analyzing the songs in your music collection without manual interaction. Without such a system, people would need to listen to each song and indicate its mood by hand.

When building a computational model of mood in musical pieces, we need to have access to data. For instance, when we want to evaluate our model, we need musical pieces for which we know the corresponding mood, so we can check whether our model assigns the same mood as people have. Additionally, we use annotated data (songs together with their mood) as training data. This allows us to fine-tune our models to human preferences.

The data that we require for our computational model has to be annotated by people (as we are trying to model their preferences). Fortunately, the data collected using the Moody application fits our purposes exactly. People annotate their music into mood classes, which encodes information on what people think of these songs. This information is stored in a database for which the Moody plug-in acts as a graphical user interface.

The first dataset I received from the Moody database contained a list of songs, artists and mood tags, which I call the Moody Tags dataset. There is a total of 16 possible moods, which can be represented in a two-dimensional plane. One axis describes the valence, or polarity, of moods and the other axis describes arousal, or amount of energy. This looks exactly like the kind of information one needs when building a computational model of mood preferences.

While working with the Moody Tags dataset, I wondered in how far people consistently assign mood tags to music. The answer to this question cannot be found in the Moody Tags dataset, as there is only one tag assigned to each song. How exactly is this tag selected, taking into account that multiple people may annotate the same song with different mood tags?

It turns out that in the Moody database, tag counts are stored that describe for each value on the two axes, how often that value has been used to tag that particular song. Effectively, the Moody Tags dataset provides the tags that fit with the most often tagged value for both of the axes for each song. The raw counts of the tags can be extracted from the database as well and I will call that dataset the Moody Counts dataset.

Based on the Moody Counts dataset, I can analyze in how far people agree with each other when assigning mood to a song. Normally in the area of annotation, one would measure the amount of agreement, which is called inter-annotator agreement, using a metric such as Cohen’s Kappa or Krippendorff’s Alpha. Unfortunately, in this case, these metrics cannot be used, since I do not know exactly which annotator (user) tags which songs. Therefor, I need to come up with other metrics.

To make sure the dataset has enough annotations per songs, I checked the average number of annotations per song, which is approximately 19. The distribution of number of annotations per song can be found in the figure above. On the x-axis you can find the number of annotations per song and on the y-axis the number of songs with that many annotations. As you can see, there are just over 400 songs with only one annotation, but there are also songs with over 100 annotations.

Next, I check the percentage of songs that have only one mood assigned to it. This holds for 56.5% of the songs. However, it is a bit unfair to only provide this measure. First of all, there are quite a few songs that have only one annotation, which means that there can only be one mood assigned to these songs.

Computing the average percentage of the majority tag (which is the number of annotations of the most often selected mood divided by the total number of annotations for that song), shows that for both the arousal and valence dimensions this amounts to just over 95%. Again, here I am also using the songs with only one annotation, but if I remove these songs, so only take songs with two or more annotations into account, the percentages are still over 94%. Even when I only take songs into account that have 50 or more annotations, these percentages are over 91%.

Based on the data I have available at the moment, it seems that people tend to agree on the mood songs have. This makes it an interesting topic to research. Now we know that people generally agree, can we actually build a system that does this for us and will this system also be as consistent as we are in assigning mood to songs? Obviously, before we can actually answer this question, there are many other questions we need to answer first: What exactly contributes most to the mood of a songs, is it the melodic part or the lyrics? What properties of either melody or lyrics contribute most to the mood of a song? With datasets that are collected by applications such as Moody we may, at some point in the future, find out exactly how people perceive the mood of music.

Menno van Zaanen
Assistant professor at Tilburg University, the Netherlands

SimpleSong 0.2

SimpleSong is becoming quite an iTunes competitor, in it’s own way. I’ve used it quite a bit myself, much more often than I thought I would. If you’re tired of dealing with a library, and want a library free music player with a minimalistic approach, lightweight, and close to zero startup time – this might be your thing. Download SimpleSong SimpleSong Screenshot
New stuff:
– You can now doubleclick or drag tracks from the finder to the dock icon, to open the tracks as a playlist. This totally adds usefulness.

– Cmd + right arrow skips to next song.

– Fix of a small bug – the app didn’t stop looking for the next track in the end of a playlist.

So try a little do re mi fa!

Moot.ly is here!

Since April we’ve been keeping ourselves busy working on a new web application – http://moot.ly – and now it’s finally in the water, with a beta tag. It’s a communication tool, and we do believe the world needs another one of those.

Mootly focuses on the ongoing conversation around a topic, with a group of your friends. You start a discussion, a moot, about for example good lunch joints in your part of town, invite a few of your friends and start to chat. They can invite some of their friends who work in the same area, and after a little while your life is full of great lunches.

Use it to plan a travel, to share stuff with your friends that you don’t want to publish all over the web, to discuss music, to chat about a project at work or about last night’s party.

What’s great is that you know who you’re talking to, and that they’re actually interested in what you’re saying. And the discussion doesn’t have to die after a few oneline comments. Lunch never grows old, right?

So when you feel that the facebook status updates lacks a little depth, when twitter gets too much like a broadcast media, when a group mail seems a little old, and when you still would want to talk online with people you know – start a moot.

* The name Moot.ly is derived from the old english word for meeting, and is also of course a play on the idiom “a moot point”.

Sing a simple song

If you’re like me you have a lot of music on your computer. You’re also fed up with maintaining a library of it all. Half the time I would just listen to music in Quick Look, if only it wouldn’t stop the moment I leave the finder.

So this is as simple as it gets. You enter a search term and SimpleSong does a Spotlight search on your computer and plays the search result. You can search for anything really – artist, album, genre, comment – the whole id3 tag is accessible in Spotlight. A more narrow search query is quicker to find though. You can now also drag tracks from the finder to the dock icon, to open the tracks as a playlist, which of course totally adds usefulness.

You play it, you stop it, you skip a song. That’s it.


Download SimpleSong

SimpleSong Screenshot

Overlay app

Selecting an image would in some projects be quicker if you actually could see the image in the context. If you’re making a magazine, a brochure or a web banner, the design could be pretty much set, and you just need the image to go with it.

So, what Overlay does is to show your graphics with transparency. If you have an eps, pdf, or a png you could open it in Overlay and place it for example over your stock image provider, and then quickly browse through images.

Here I got my Pet World Grand Opening banner, for which I need a great pet shot.

You could also use this for say a photography shoot for an ad, when the design already is set. To instantly get to view the images in context could help you to spot mistakes or make small adjustments.

Download the app (mac only).

This is a rough alpha version, take it for what it is. One could easily imagine a few useful features like resizing, outlining the surface, inverting the colors and tabs with different artwork.