Hunch

Embedded HTTP server in Smisk 1.1.7

September 1, 2009 by Rasmus Andersson, tagged smisk and software, filed under software

Smisk 1.1.7 will not bring many new features, but one of them is a built-in HTTP server which can be used for local development, removing the need for a “real” HTTP server (e.g. Lighttpd or Apache httpd).

Simply give your application the --http flag:

$ ./app.py --http
httpd listening on localhost:8080 backed by application 6056

You can explicitly specify which host and/or what port the HTTP server should bind and listen to by instead using the --http-addr and --http-port flags.

$ ./app.py --http-port 8888
httpd listening on localhost:8888 backed by application 6034
$ ./app.py --http-port 8888 --http-addr 0.0.0.0
httpd listening on 0.0.0.0:8888 backed by application 6034

Your application will be started in a separate process as a stand-alone FastCGI server listening on 127.0.0.1:5990 and a smisk.util.httpd.Server is started on the main thread, connecting to your application.

Trying out the key-value store example application:

$ examples/mvc/key-value-store/app.py --http
httpd listening on localhost:8080 backed by application 6126
rmbp.local - - [01/Sep/2009 15:32:19] "GET / HTTP/1.1" 200 -
rmbp.local - - [01/Sep/2009 15:32:19] "GET /entry/ HTTP/1.1" 200 -
rmbp.local - - [01/Sep/2009 15:32:26] "GET /entry/my%20key HTTP/1.1" 404 -
rmbp.local - - [01/Sep/2009 15:32:27] "PUT /entry/my%20key HTTP/1.1" 204 -
rmbp.local - - [01/Sep/2009 15:32:29] "GET /entry/my%20key HTTP/1.1" 200 -
rmbp.local - - [01/Sep/2009 15:32:30] "DELETE /entry/my%20key HTTP/1.1" 204 -
rmbp.local - - [01/Sep/2009 15:32:31] "GET /entry/my%20key HTTP/1.1" 404 -
rmbp.local - - [01/Sep/2009 15:32:32] "GET /entry/ HTTP/1.1" 200 -

It’s currently being tested in smisk/master and can thus be checked out, built and tested.

5

Gitblog admin user interface

August 11, 2009 by Rasmus, tagged gitblog, software, ui and web, filed under software

I’ve laid the groundwork for the upcoming Gitblog user interface.

Screenshot of Gitblog admin UI

4

Gitblog

July 16, 2009 by Rasmus, tagged gitblog, programming and software, filed under software

So, my blog is back up again after a month downtime. We tried to upgrade Wordpress on our server and when pressing the upgrade button, Wordpress deleted every file on our server (writable by the web server user). So, all 30+ web sites hosted, all Hunch Stuff from 2003 to 2009 and our Subversion repository is gone forever. Nope, we’re stupid and did not have a backup.

I set out to write a better blog tool than Wordpress and here it is — behold the mighty Gitblog.

More info to come.

2

Spotify for the iPhone

July 1, 2009 by Rasmus Andersson, tagged spotify, software and iphone, filed under software and spotify

Late last week we put the finishing touches to a very special project we’ve been wanting to share with you for a while now. After many weeks of burning the midnight oil at Spotify HQ in an effort to squeeze into it every drop of musical goodness, we’ve finally completed work on the Spotify app for the iPhone and sent it over to the nice people at Apple.

We also wrote about this in the Spotify blog and BCC picked it up (on their front page news).

Here’s the playlist we used in the video: Spotify iPhone preview video, July 27, 2009.

Spotify on the Android

May 27, 2009 by Rasmus, tagged android, demo, google, mobile, preview, software, spotify and video, filed under software and spotify

We presented the Spotify mobile app for Android at the Google IO developer conference yesterday. What you see is work in progress and not the final product. We’ll put some finishing touches on the graphics as well as tweaking the code.

A wee bit more info can be found in our blog: Spotify mobile demo at Google Android I/O.

1

Write your own Spotify client

April 7, 2009 by Rasmus, tagged api, libspotify, software, spotify and spotify core, filed under software and spotify

spotify-core-logoWe just released libspotify – The Spotify Core library – into the wild. This will enable anyone to write their own Spotify client application.

libspotify is a C library which exposes all the features of the regular desktop application, except from the user interface – that, you have to write yourself ;). Now, of course there’s a catch: You have to have a Spotify premium account in order to use the library. But as the music-loving Spotify user you are, you’re already a Premium user, right? right?!.

First off, you need to apply for a application key which will be used to identify your application in our system. Then off to the download section and grab a copy of this funky library (the link that says something like “tar.gz”). This package includes all you need to get started – the compiled library, documentation, example code, the Spotify Core logotype as well as a copy of the terms of use.

At the moment, only Linux on IA-32 (Intel Architecture, 32-bit) is supported. Our goal is to support a host of additional platforms in the future.

The API have two distinct features: Objects, or structs, are reference counted using functions named like sp_<type>_{release,retain}. Second; you have to establish a sp_session object before calling any of the other library functions. Basically, you log in and receive a context object which is then passed around to the different library function calls.

The examples which are provided with the downloadable package can also be viewed on the website.

You should also read our brand new official Developer Blog at http://developer.spotify.com/blog/. Here’s the official post announcing libspotify.

2

Tokyo Cabinet Python bindings

March 2, 2009 by Rasmus, tagged code, dbm, python, software and tokyocabinet, filed under software

Today I released tc – Python bindings to the Tokyo Cabinet database library. The code is heavily based on that of Tasuku Suenagas pytc and improves in many ways (documentation, code structure, python 2.6 and 3.0 compatibility, robust setup.py, etc).

It’s currently available for Python 2.4, 2.5, 2.6 and 3.0 in MacPorts and PyPI. Source resides in the ‘Hub.

Continue reading...

10

Tokyo Cabinet

February 28, 2009 by Rasmus, tagged database, dbm, performance, python, software, tokyocabinet and tyrant, filed under software

Lately I’ve been researching some into the holy grail of keyed data storage – best combination of performance, scalability, efficiency and availability. There are many, many options available ranging from the Berkeley DB to BigTable implementations like Hypertable.

Last weekend I spent some time looking into using BDB in a BigTable fashion for managing schema-free tables. However my tests revealed many problems with a solution like that. For instance, BDB is really slow when writing random keys into databases of >100k row size. In the beginning of this week I had a chat with Jon Åslund regarding this idea and he introduced me to Tokyo Cabinet – a modern, battle-tested and extremely high-performance DBM.

Despite the somewhat uncool name, Tokyo Cabinet is a silent beast developed by Mikio Hirabayashi and used in the high-load environment of Japanese Facebook-equivalent Mixi. TC (short for Tokyo Cabinet) is written in C99 C, sporting a clean and modern API.

Mikio states TC improves on other DBMs in the following areas:

  • Improves space efficiency – smaller size of database file.
  • Improves time efficiency – faster processing speed.
  • Improves parallelism – higher performance in multi-thread environment.
  • Improves usability – simplified API.
  • Improves robustness – database file is not corrupted even under catastrophic situation.
  • Supports 64-bit architecture – enormous memory space and database file are available.

Continue reading...

3

Espressos' CSS-based themes

January 7, 2009 by Rasmus, tagged espresso, hmi, osx, software, theme, ui and ux

For quite some time I’ve been investigating and researching on how to best theme/skin/style a desktop application. Espresso from MacRabbit, available in public beta, takes an approach to themes I’ve been thinking about – CSS. Of course you should use CSS! Every kiddo knows it and those who don’t can quickly learn.


Espresso CSS-based themes (click for better quality)

2

Smisk 1.1 released

December 19, 2008 by Rasmus, tagged python, smisk and software, filed under software

Smisk 1.1 have been released, including an extensive python library introducing Content Negotiation, MVC design pattern support and much more.

Smisk is a web service framework for Python. Learn more about Smisk at the Smisk website. There is also some brand new documentation available.

Continue reading...