Made a thing in an "introduction to programming" class where non-engineers learned to write code. I might actually stick around, was fun to spend time on a random sketch while everyone else learned about variables.
P5 Sketch: Sprites and Feedback Texture Rendering
Martin Dittus · 2011-10-03 · code · write a comment
Heatmap Calendars of Last.fm Scrobbles
Martin Dittus · 2011-09-10 · code, data mining, konsum, muzak, pop culture, tools · 4 comments
After five amazing years at Last.fm I decided to hand in my notice a few months ago, my last day was at the end of August. As a parting gift and sign of appreciation of the many things Last.fm has given me I produced a series of data visualisations of the scrobbles of all Last.fm staff, alumni, and community moderators I could find, and published it last week. In total the series encompasses 8.7 million scrobbles across ~180 graphs. The visualisation is a structured heatmap that is designed to reveal periodicities: years, months, day of week, hour of day. Storytelling
Pool Radio: An Aggregator of Mediators
Martin Dittus · 2008-05-10 · code, konsum, pop culture, recommendation engines, tools · write a comment
Over the past extended weekend I created Pool Radio, a tool that provides access to hopefully interesting Last.fm radio stations. See also the announcement in the Subscribers and their tag radio stations group forum, with some great comments by Nectar_Card. I'm aware that not a lot of people will find this site very useful, but people with an appreciation for the random and obscure can definitely benefit from it. Here are a couple of great user tag stations I've enjoyed over the last week: raw_u's etiopia tag radio (tag page), jirkanne's lllllllllllllll tag radio (tag page), JessiCoplin's scott storch tag
Creatures Demo Sketch
Martin Dittus · 2007-12-19 · code · write a comment
... needs Java. Might post a description later. Update 2007-12-21 I spent a bit of time making swarming actually work, and tweaked some other things. Much nicer already.
Swing Zombie
Martin Dittus · 2007-03-22 · code · 1 comment
For a completely unrelated reason I was browsing old code project directories and found a copy of Stringulator, a throwaway weekend quickie from mid 2002. Turns out it runs on OS X, and it's relatively smooth. The best part though: when you turn on motion blur a relatively minor rendering bug gets triggered somewhere that makes the graphics look much cooler that ever intended... Now I wonder: did it also have a working fullscreen mode?
Creating PNG from Memory Pixel Buffers with RMagick
Martin Dittus · 2006-07-09 · code · write a comment
Just so I won't forget, and because it's useful to know. require 'RMagick' # generate rgb image buffer pixeldata = [] 14.times do |y| 100.times do |x| pixeldata ...or simply write to file. Result: Any hints on more lightweight PNG writers? ImageMagick can be a pain to install. There are some neat tricks for image-builders on why's sparklines for minimalists page, but jzp's PNG code shown there is for a very specific image and visualization format, and I don't understand PNG enough to adapt it. Update 2006-12-09: Olle Jonsson sends a link to png, a lightweight pure-Ruby PNG library by
Spotlight Helps Fight Comment Spam!
Martin Dittus · 2006-07-07 · code, data mining, osx, tools · write a comment
I'm using a combination of fairly primitive methods to cope with blog spam. As this blog doesn't get too much comments the amount of manual work is relatively limited; main line of defense is an old-fashioned and relatively short blacklist. I'm notified of incoming comments, and in the rare event that a spam comment gets through I'll inspect it for new keywords. For a couple of months now it's become apparent that specific posts seem to attract more spam than others. I just thought that it may be great to have a statistic of this phenomenon -- so that I
So What's a Functional Language, Then?
Martin Dittus · 2006-05-26 · code, links · write a comment
A couple of days ago Chaosradio Express published another great podcast: "Programmiersprachen und Dylan", a conversation between Tim Pritlove and Andreas Bogk on the subject on the Dylan programming language, and programming languages in general. The podcast has a duration of nearly two hours, but if you speak German and are interested in topics of such an abstract nature it's well worth your time. They start off from the very beginning (programming language basics, Turing machines etc) and gradually introduce more and more concepts of the Dylan language, some of which are really fascinating. All Roads Lead to Lisp I'm
YARV makes REXML > 200% faster
Martin Dittus · 2006-03-27 · code · write a comment
I finally found a good test case to compare YARV's execution speed with the plain ruby interpreter -- and the results are quite satisfying. The script I benchmarked reads and parses 3.300 small XML files, extracts data, and writes the result to a tab separated file. (You can find a description of how to install YARV in the comments of why's recent article "YARV Merged Matz".) About the Test Case The benchmarked script, export.rb, is a real-life script that I wrote a couple of days ago: A friend is working on a profile matching algorithm for a community site, and
Bookmarklet: Display Feed Links on Current Page
Martin Dittus · 2006-03-16 · code, tools · 5 comments
I found an older article on the Google Reader blog where they post a great bookmarklet: It displays feeds referenced by the current page and allows you to preview them in Google Reader. Convenient for their users, and a great building block for a more generic tool. I've modified their code in a number of ways -- the most obvious change is that the bookmarklet-generated links will point directly to the respective feed URLs, not to a Google Reader preview page. Then there are some cosmetic changes (I didn't like their choice of generated markup), but not much else.
SQLite3FeedCache: A Custom Thread-Safe Database Cache for FeedTools
Martin Dittus · 2006-03-07 · code · 2 comments
I just finished a first version of a custom database cache for FeedTools 0.2.23 -- basically a drop-in replacement for the default DatabaseFeedCache. I did this for two reasons: first, because I could (always a good reason), and second, because DatabaseFeedCache does not work at all in multi-threaded applications. DatabaseFeedCache is based on ActiveRecord, and while ActiveRecord is supposed to be thread-safe since version 0.9 I've found this not no be true, at least when using SQLite3. The implementation of SQLite3FeedCache is as basic as it gets, to the point where it's rather inefficient -- it does not even
Low-Level Logging with Ruby
Martin Dittus · 2006-02-20 · code · write a comment
While browsing the Ruby presentation of Srdjan Marinovic I came upon the following snippet, a great example of what makes Ruby such an exciting and productive language: class Foo alias_method : old_say, :say_greeting def say_greeting(*args) log... old_say(*args) end end The code above redirects calls to an existing method old_say in class Foo to a proxy method say_greeting, which logs the method call before it hands over to the original method. This demonstrates how Ruby classes are inherently "open", in that they can be modified at runtime. That code sequence can be used to override both method calls to your own
Parsing an OPML Document Recursively With Ruby While Preserving Its Structure
Martin Dittus · 2006-02-14 · code, tools · 3 comments
I just started to write an aggregator in Ruby which will form the basis of a number of web applications, and a couple of minutes into the project I'm already excited about the expressiveness of Ruby and its standard library. So much so that I had to share the results of my first five minutes of coding. I decided that the aggregator I'm writing will take its feed URLs from an OPML document. A nice property of OPML is that it allows you to group feeds into a hierarchy of named elements, so that you can e.g. group some feeds
Serving .rhtml Files on OS X With Apache and ERB
Martin Dittus · 2006-01-11 · code, osx, software · 5 comments
This documents how Apache 1.3 on OS X can be set up to serve .rhtml files using Ruby's ERB template system. Most of the required configuration is already described in Brian Bugh's article Using ERB/rhtml Templates On Dreamhost, but OS X's basic setup is conservative enough to require a little additional configuration. However the real reason I'm writing this is that I additionally wanted to limit the handling of .rhtml scripts to my user account's "personal web sharing" directory (which maps to a tilde URL like http://127.0.0.1/~username/), and this isn't as straight-forward, so it took me a while to
Revisiting Aggregators Part I: User-Designed Interfaces
Martin Dittus · 2006-01-04 · code, commentary, data mining, software, tools · 2 comments
Recently there have been a number of requests for new ideas in the aggregator market, and as I'm constantly dissatisfied with my feed consumption experience (no matter the tool) I have lots of opinions on the state of aggregator software -- and even some ideas for improvement. I'll save the grand overview for later; because some things are better shown than told I thought a good start would be to show sketches of what I'd like to see in the next generation of aggregators. Here's Sketch One, which is kind of an accumulation of concepts, and which describes the basis
An OPML Feed of 22C3 Blogs
Martin Dittus · 2005-12-29 · code, conferences, tools · write a comment
Another 22C3-related Ruby script: I thought it would be neat to convert the list of Weblogs writing about 22C3 into an OPML file which can then easily be imported into your favorite aggregator. Ruby to the rescue. The script scrapes the Wiki page (or rather its export format version) and iterates over the table of blogs, adding a feed URL of each blog to the OPML outline. Look at the code for further information. Of course you can also simply get the exported OPML file linked below; but I expect that the Wiki page will change a lot even after
A Printable Schedule for 22C3
Martin Dittus · 2005-12-24 · code, conferences, tools · 1 comment
Just before I left my house over the holidays I wanted to print out the schedule for 22C3, and found that I couldn't -- no matter which browser, OS and method I chose, the schedule table was unreadable. A couple of hours later I sat in a train and had some time to spare, so I hacked together a Ruby script that parses the iCal version of the schedule for 22C3 and creates an HTML page with a clean, readable timetable that you can also print ;) You can get the script below, and a version of the generated HTML
Where Mailfeed.org Is Launched, and We Start Talking About a Conversation
Martin Dittus · 2005-12-23 · code, links, site updates, web services · write a comment
I just had a couple of wonderful days of being busy deploying a new site, MailFeed.org. The site is a public service derived from the mailfeed.rb script posted earlier: you send email to an address at mailfeed.org, and it shows up in a public feed. If you don't know it yet have a look at the site, and then come back. Originally the idea for this arose of a nuisance a friend wanted to get rid of: that there still are people sending out email newsletters instead of writing feeds. But during the last couple of days I found that
Using the FeedTools Cache in Plain Ruby Scripts
Martin Dittus · 2005-12-08 · code, tools · 4 comments
FeedTools is an amazingly complete Ruby library by Bob Aman for accessing, parsing and generating feeds from within Ruby. While it is designed to work well with Rails applications, you can just as easily use it in your Ruby scripts: feed = FeedTools::Feed.open('http://dekstop.de/weblog/index.xml') puts feed.title feed.items.each { |item| puts item.title puts item.link } Requesting a feed every time you run your script is fine as long as you only parse your own feeds, but you should be a bit more polite as soon as you start requesting someone else's feed. Over time feeds can cost site owners a lot of
How to Use the Rails Inflector in Your Ruby Scripts
Martin Dittus · 2005-12-06 · code, stuff, tools · write a comment
I've written a Ruby script that extracts keywords from a MovableType-exported plaintext database, and while doing so wanted to include the Rails Inflector so that the script could merge singular and plural versions of the same word. It wasn't that obvious to me how to include the Inflector in Ruby scripts outside of Rails, and I searched for a while until I found the proper usage; so I'll document it here to save other Ruby newbies some time. In the end it boiled down to finding the proper require statements -- I'm not sure if this is the best way
mailfeed.rb: Read Email in Your Feed Reader
Martin Dittus · 2005-12-04 · code, tools, web services · write a comment
A friend has asked me for a way to read email newsletters from within his feed reader, and after some digging around I found it's straightforward enough to access POP3 mail from within Ruby, so I created mailfeed.rb. mailfeed.rb is a Ruby script that generates an RSS 2.0 feed from the content of an email inbox. This can e.g. be used to read email-based newsletters from within your feed reader. (See also: MailFeed for PHP, pymailfeed for Python.) It's really a pretty simple script, so there are a number of caveats -- e.g. there is no limit on the
Better del.icio.us Browser Bookmarklets
Martin Dittus · 2005-08-16 · code, tools, web services · 1 comment
I've been using modified del.icio.us bookmarklets to feed my del.icio.us account, and thought I should share those. More experienced users will find nothing new here, but it's just as likely that it will interest some people. del.icio.us already have a list of bookmarklets for various browsers, and I started from there. I have made two additions to the default bookmarklets: a faster way to enter an extended bookmark description, and the ability to add a predefined tag. This is my generic "add to del.icio.us" bookmarklet, "add bookmark": javascript:location.href='http://del.icio.us/new/martind? url='+encodeURIComponent(location.href) +'&title='+encodeURIComponent(document.title) +'&extended='+encodeURIComponent(getSelection()) Note the code after "extended=" -- this tells the
Using launchd to Transparently Whitelist Safari's Cookies
Martin Dittus · 2005-07-30 · code, osx, site updates, tools · write a comment
I was looking for ways to automatically start my Safari CookieFilter script, because if I had to launch it manually every time I wanted to clean up Safari's cookies I would never really use it. On a Windows machine I would put the script into the Autostart folder so that it would be executed upon system startup, but I've found that I never really reboot my Mac, so that wouldn't work. Another option would be a script that invokes CookieFilter before it launches Safari, and to only start Safari via this script -- but this idea seemed to simple and
Safari Cookie Whitelist Filter in Perl
Martin Dittus · 2005-07-25 · code, osx, tools · write a comment
Since Tiger I've been pretty satisfied with Safari, and there are fewer reasons to install third party plugins than ever. Yeah I could use Firefox's keyword search, but after having one too many browser crashes due to a SIMBL plugin running amok I figured I could just as well live without it. The only thing that has really been missing was a working Cookie whitelist. There is Cookies Eater, another SIMBL plugin; but that hasn't been updated for the current Safari version yet. And even if it had been, I'm not so sure that SIMBL is the best way to