Guest lecture in Gothenburg

On friday I gave a guest lecture in a course at LinCS at the University of Gothenburg. The course was ‘Understanding and designing for social media practices’ and is aimed at exploring methods for studying online social media.

The lecture was based on two previous studies of foursquare. The first one was a primarily interview based study where we looked at performative aspects of using foursquare. The second one deals with a study of log data from foursquare. The talk discussed what it means for people to share their location through the means of checking in (or what it means to check in), and discussed what this means for the genera of data, and showed examples of communicative features in the log data from foursquare.

The slides can be found on slideshare.

Posted in Uncategorized

Texture problems in Android OpenGL

Encountered such a stupid thing that I do not wish anyone else ever to encounter so I feel I have to write a post about it. Tl;dr: BitmapFactory.decodeResource may rescale the image to match the pixel density of the device, which is not good if you are concerned about the pixel size of the image.

I recently had a problem with textures in OpenGL ES 2.0 on Android. Everything worked like a charm on the development device I was using, and everyone was happy. But when I found a less common device in the office, I decided to try it on that device to see the performance. I did not expect it not to work, but was prepared that might be some performance issues. Little did I expect that nothing would show on the screen. Also, no proper error messages were shown anything. Just black screen.

When loading textures in OpenGL on android, people generally use something like

Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),R.drawable.cool_texture);
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);

Its doubtful that anything would go wrong with these two lines, so I went to check the most obvious things I could think of. First off I checked if the device required power of two sized textures (256×256, 512×512, etc). I created a texture that was 256×256 and loaded it. Did not work. So I went ahead and tried all kinds of things, stripped down the code to bare minimum to isolate where the problem was.

To cut things short. The problem was with the two lines, and the way BitmapFactory.decodeResources decodes resources… The bitmap I obtained ended up not being the dimensions of the image I created, but something slightly less. The fix:

final BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = false;
Bitmap bitmap =
BitmapFactory.decodeResource(context.getResources(),R.drawable.cool_texture, options);

Once this was added, I learned the problem indeed was with power of two sized textures, and could take care of it.

Ps. if you want to check the platform supports non-power of two sized textures, you can run this check:

        String extensions = gl.glGetString(GL10.GL_EXTENSIONS);
        mSupportsNPOT = extensions.indexOf("GL_OES_texture_npot") != -1;

Potentially not the nicest way of doing it, but it works. Ds.

Posted in Uncategorized

ProtoDB as an ORM – ProtoORM?

I believe coding should be seen as a craft, and as such there has to be as little between your creativity and executing on the creativity as possible. One such obstacle when it comes to most development of web applications, is the need to create a database structure. For years now I have been using different iterations of my own set of help functions in PHP. It started with some getters for fetching an array of rows from a MySQL query in one go, and later it evolved into what I called ProtoDB, which is available on GitHub. The core point of ProtoDB is that it creates the database structure as you code it. Setting some value for a column in a table will create that column if it does not exist, and will create the table if the table does not exists. This allows you to stay in the code editor and still work with a database. (Optimizing can always be done later.)

However, sometimes it can be nice to use a simple ORM, in order to group model functions together in an object oriented way. Most ORMs however (that I have seen), still require the database structure to be in place. The tables need to exist, and have the columns needed for the ORM to map to this structure. I have therefore started to expand on ProtoDB to create a basic ORM on top of it, which gives you the flexibility of ProtoDB and the benefits of an object oriented architecture of an ORM.

For now there is only one class Model that is the base of everything else.

namespace ProtoORM;
use \DB;

class Model {
 public static function create($row); // row is an associated array of values for columns given by the keys
 public static function find($id); // gets the model object with the given id
 public static function all(); // gives you an array of all objects in the table
 public function save(); // updates the table or inserts a new row
}

From this it is easy to create a new model, for instance a User:

class User extends ProtoORM\Model {
 protected $table = "users"; // sets the table name
}

// create a new user
$user = User::create("name"=>Mattias);
$user->save();

// later we can set some more info
$user->age = 31;
$user->role = 'dev';
$user->save();

$user = User::find($user_id);

The points of this is that the table ‘users’ does not need to exist before running this code. Everything will be added to the database structure as need. This is obviously only the beginning, and I aim to expand on it as I keep using it in some of my current projects.

I am also thinking about also implementing some kind of automation of migration files, in order for groups of people to work together in early stages of design.

 

Posted in Coding

Internships in the Populations programme

If you’re a PhD student working with things such as ubiquitous and mobile computing, statistics and inference, and formal modelling and analysis, the project I’m working in is offering internships! It’s preferably over the summer, but not restricted to it.

The Populations project is trying to advancing the design process and underlying science of mobile applications. We do this by designing, building and studying mobile apps through large deployments, and investigate new methods and analysis tools that allow us to advance this area of research and practice. If you’re interested in reading more you should check out the call.

Posted in Uncategorized

Informing Future Design workshop at MobileHCI

I’m co-organizing an upcoming workshop for MobileHCI this year. It is on the topic of “Informing Future Design via Large-Scale Research Methods and Big Data”. It is loosely based on previous workshops I have co-organized on Research in the Large. This year it goes beyond evaluation and instrumentation of app stores (which in my view have been a big theme for the previous workshops) and looks at how we can find new ways of incorporating large deployments as means to inform design. This means not only to iteratively improve existing systems and design ideas, but to use it in the ideation process of new ideas.

The deadline for the workshop submission is on May 10th and MobileHCI will be in Munich on August 27-30th. Check workshop web site for more info.

Posted in Research

Android WebView and File Input

While working on a web app that I wanted to embed in a WebView on Android to create a native app (hybrid), I encountered some problems with file input. The app is a simple one that allows users to upload photos, and shows a list of friends photos. (Instagram anyone?)

These days file input on mobile devices works pretty ok on iOS and Android devices. Adding <input type=’file’ /> will create a file input, and clicking it will let the user pick a file from your phone. At least from Chrome or Safari. However, when putting this in a WebView, it is currently not handled for you automatically.

Googling around to figure out what is going on reveals that this is something that has to be implemented by yourself by overriding a couple of functions in an instance of WebChromeClient. Unfortunately there are still a couple of issues with this. First of all, the functions that has to be overridden har undocumented. Second of all, returning the files seem to be devoid of file type, which is not necessarily a problem for everyone, but that was a problem for me.

First of all, the functions that has to be overridden are:

mWebView.setWebChromeClient(new WebChromeClient() {

@SuppressWarnings(“unused”)

public void openFileChooser(ValueCallback<Uri> uploadMsg, String AcceptType, String capture) {

this.openFileChooser(uploadMsg);

}

@SuppressWarnings(“unused”)

public void openFileChooser(ValueCallback<Uri> uploadMsg, String AcceptType) {

this.openFileChooser(uploadMsg);

}

public void openFileChooser(ValueCallback<Uri> uploadMsg) {

mUploadMessage = uploadMsg;

pickFile();

}

});

The three functions illustrate a progression of Android, where the last one is for early versions of android, and the last one is for Android 4.1+. Potentially then, this might change in the future.

The use of this then is to return the value in mUploadMessage by calling its callback.

Picking the file is easy enough using an intent call.

Intent chooserIntent = new Intent(Intent.ACTION_GET_CONTENT);

chooserIntent.setType(“image/*”);

startActivityForResult(chooserIntent, RESULTCODE);

 

And you return the file in onActivityResult:

protected void onActivityResult(int requestCode, int resultCode, Intent intent) {

mUploadMessage.onReceiveValue(intent.getData());

mUploadMessage = null;

}

 

(Note: There’s not error handling here, so remember to include that!)

So far so good. This will cause the file input data set, so we can submit it from a form, or access it from javascript.

What I needed this image for, was to both update a picture on the web page, and also to upload this data later on. The way I solved this was to use HTML5 local file reading through a FileReader object, and then reading the data using readAsDataURL

var reader = new FileReader();

reader.readAsDataURL(file);

reader.onload = function(e) {

var dataurl = e.target.result;

}

So we got dataurl as a URI object, which will be on the form “data:image/png;base64,…”. Or so is it normally. Problem is that from at least Android 4.2.2 (On my Nexus 4), the file object that is returned to javascript from Android does not have the file type set. (file.type===undefined). This makes the data URI to be invalid as it only describes binary data: “data:base64,…”. This caused major problems for me, but I managed to fix it. Fortunately the filename is set correctly, and so I can use the file ending. From that I can reform the dataurl to create a correct one

dataurl = “data:image/” + file.name.split(‘.’).slice(-1)[0] + “;base64,” + dataurl.split(‘,’)[1];

The rest of the script then works. You can use the dataurl to set the image src ($(“#theimage”).attr(‘src’,dataurl); and you can upload it as a string.

I’m guessing there might be a fix for this to get Android to pass a file with the correct type set, but without that fix, this one seems to work.

 

Posted in Uncategorized

Defended Mobility is the Message

On Monday I finally defended my PhD thesis – Mobility is the Message: Experiments with Mobile Media Sharing. The opponent was David Ayman Shamma from Yahoo! Research. He did an amazing job presenting his interpretation of my work, and we engaged in a lively discussion about the thesis. It was followed by questions from the committee, and the audience.

Now I’ve just got back to Glasgow, where I am visiting Matthew Chalmer’s group doing work in the Populations project at the University of Glasgow. I’ve been here since february and it’s been a super exciting environment so far with great energy! I’m determined that great stuff will come out of what we are doing right now. But more on that another time…

Posted in Research | Leave a reply

Representation and Communication at the University of Gothenburg

Today I’m giving a Pecha Kucha style presentation of our CSCW paper ‘Representation and Communication: Challenges in interpreting large social media datasets’ (Rost, M., Barkhuus, L., Cramer, H. and Brown, B.), at the University of Gothenburg during an event about social media research.

The purpose of Pecha Kucha is to make the presentations more focused and to the point. The format is to show 20 slides, each slide for 20 seconds. It restricts you from going on and on. It will be the first time I will do a Pecha Kucha presentation and am looking forward to it. I hope it will be as fun for the audience as I will have while giving it!

Find the abstract of the paper below.

Online services provide a range of opportunities for
understanding human behaviour through the large aggregate
data sets that their operation collects. Yet the data sets they
collect do not unproblematically model or mirror the world
events. In this paper we use data from Foursquare, a
popular location check-in service, to argue for the
importance of analysing social media as a communicative
rather than representational system. Drawing on logs of all
Foursquare check-ins over eight weeks we highlight four
features of Foursquare’s use: the relationship between
attendance and check-ins, event check-ins, commercial
incentives to check-in, and lastly humorous check-ins
These points show how large data analysis is affected by
the end user uses to which social networks are put.
Posted in Research | Leave a reply

Developer Options on Android 4.2

If you just updated an Android device to 4.2, and try to develop for it, you may have noticed that there are no Developer Options anymore. They used to be in the settings, just above “About phone”, but since 4.2 they are gone. This can make it difficult (impossible) to enable USB debugging. However there is a fix for it that once you know it is simple enough.

All you have to do to enable it is to go to Settings->About phone. Then go down to Build number, and tap it 7 times. After the first three times there will be a count down towards the hidden option. Just go back to the settings menu, and the Developer options will have appeared.

I found this from this forum thread.

Posted in Coding | Leave a reply

PhD defence

On March 11, I will defend my PhD thesis ‘Mobility is the Message: Experiments with Mobile Media Sharing’! The official announcement is here, and you can already find the thesis here.

The thesis is comprised of 6 papers and 100 pages of new material that brings the 6 papers together. Find the abstract for the thesis below.

This thesis explores new mobile media sharing applications by building, deploying, and studying their use. While we share media in many different ways both on the web and on mobile phones, there are few ways of sharing media with people physically near us. Studied were three designed and built systems: Push!Music,Columbus, and Portrait Catalog, as well as a fourth commercially available system – Foursquare. This thesis offers four contributions: First, it explores the design space of co-present media sharing of four test systems. Second, through user studies of these systems it reports on how these come to be used. Third, it explores new ways of conducting trials as the technical mobile landscape has changed. Last, we look at how the technical solutions demonstrate different lines of thinking from how similar solutions might look today.

Through a Human-Computer Interaction methodology of design, build, and study, we look at systems through the eyes of embodied interaction and examine how the systems come to be in use. Using Goffman’s understanding of social order, we see how these mobile media sharing systems allow people to actively present themselves through these media. In turn, using McLuhan’s way of understanding media, we reflect on how these new systems enable a new type of medium distinct from the web centric media, and how this relates directly to mobility.

While media sharing is something that takes place everywhere in western society, it is still tied to the way media is shared through computers. Although often mobile, they do not consider the mobile settings. The systems in this thesis treat mobility as an opportunity for design. It is still left to see how this mobile media sharing will come to present itself in people’s everyday life, and when it does, how we will come to understand it and how it will transform society as a medium distinct from those before. This thesis gives a glimpse of what this future may look like.

Posted in Research | Leave a reply