blog

Mash for Live - a 24h Hack from Music Hack Day 2014 in Berlin

08 Sep 2014

For the weekend I visited Music Hack Day 2014 in Berlin. It was excellent!

read more »

On Forum Software: Madness

14 Jul 2013

I run a small private forum, which was (until now) running on phpBB, one of the most used software for forums.
There were some problems with that.

Let's begin with the plugin system.
What they call plugins is basically just a glorified search-and-replace mechanism which instantly fails if two plugins try to edit the same file. For me, this resulted in loud howls and some downtime as I tried to install a Thanks Mod.
Another fun thing is the UI in general. Once you have found your favourite thread to read (you had to click through about 4 buttons just to get logged in, then tried to use the search, which unfortunately doesn't search post titles or usernames) and now want to read the next page, you spend about 20 seconds just finding the next page option and then some more time clicking on this 4-pixel button, you tell yourself why pages? weren't computers invented so I don't have to turn pages anymore?. You gloss over that and want to insert your thoughts into the discussion. Pressing reply loads a new page with a very small input box, which cannot be extended in size. Why is it on another page if it's that small? Why does it reload the page when I request a preview? Why do I have to click on next after publishing my post?

All in all, phpBB just doesn't feel like the twenty-first century. It more or less feels like a military submarine built for the World War I, but with a fresh layer of paint from 1950.

Salvation

After I have put about a trillion hours into trying to deal with stuff like likes, youtube/soundcloud embeds and other such trickery, I finally gave up.
No! I found new hope! Discourse is the thing I have been looking for. It's clean, it's actively developed, it can moderate itself, it has notifications, it automatically converts any link you post into some useful representation of that link, and for the love of god, it is not built on a language that behaves like thinking putty (php is soft and easy to shape, but once you let it sit for a few minutes it flows back into a pile of mush; also, it falls apart when you try to make large structures).

To read more on the philosophy of Discourse, here is a blog post from the founder, Jeff Atwood.

read more »

Java 7 and the Files API

23 Jan 2013

I was happy about the fact that Oracle decided to reiterate their grasp on handling Files in Java 7.

So, there are mainly the new classes java.nio.file.Files and java.nio.file.PathFiles provides methods like isDirectory, exists, isReadable or copy. While the first of them are familiar from java.io.File, copy is new and allows for native-like performance when copying data. I haven't performed any specific Benchmarks, but research suggests they are more lightweight when used heavily and use the native OS functions for copying stuff. Also, handling symlinks seems to be prettier now.

Getting to the point: Beware of java.nio.file.Files.isReadable()! When converting tuSync to this new API, I noticed my code for checking my filebase had gotten really slow. Some profiling later, I found the culprit.
When checking about 10,000 files for read access, my profiler showed me this:

Method            --            Avg. time (ms)
java.io.File.canRead()          
-- 0.0333
java.nio.Files.isReadable()   -- 2.5679

Which means it takes about 80 times longer for Files.isReadable() to return.

According to this, which is my current system (Win7 x64), I am encountering a bug, which is already fixed. So if you run into this problem, either use the workaround path.getFileSystem().provider().checkAccess(path) or the old method, because it does exactly the same.

If you are in the future and Java 8 is out, you can happily update your JDK and move along to, like, attending to serious problems.

read more »

Music organizing philosophy, part 1

17 Jan 2013

Some general thoughts about how to store my music metadata.  

Warning: rather long read. If you are into music and are interested in a real-life example of linear algebra, read along.


Music is most fun when it's surprising, but meets your taste. Music listening (marketing) systems like Last.fm are based on that principle. Underlying suitable algorithms thus need a formalization of aesthetical similarity and a concept of what kind of music it is.

Music in a database should therefore, additionally to being ordered in Artist/Album/Genre, have attributes like mood, tempo, syntheticness or aggressivenessThe concept of tags, which I quite like, is an approach to this. Tags are boolean only, so they can't always be precise. A song can have a tag or  well,  not have a tag. By having a ginormous amount of sub-genres, sub-sub-genres and sub³genres, you can still add some granularity, however giving a song such tags can be time-consuming and mostly inaccurate.

Last.fm solved this by having each user tag his/her songs and display the most-used tags on a song first. For this to work, the song has to be listened to by many users. For less well-known music, there is never enough tag data for a song.

How to solve this?

With Math

Woo, math. You could describe a song with a set of properties (see above) each having a value specifying to what extent that property applies. Assigning these values (for me) often requires more thinking time than just assigning genres (or subgenres). Genres are basically predefined sets of values for the abovementioned properties, and because they are easier to deal with (in your brain), let's use a set of genres and a value for how much this song represents a genre.

Mathematically, a song is just a point in the n-dimensional space of properties. Viewing it as a space where the genres are the dimensions (so just a different basis, linear algebra whee), we can assign it coordinates in that space. If we have the mappings from our genres to their properties, using a little geometry, we can derive properties from a song by transforming the (genre,value) tuples to the (property,value) basis. This basis change happens through a transformation matrix, let's call it Mg→p.

The number of dimensions is rather infinite, let's limit it to the number of genres a user listens to.

What now?

So now that we have every song assigned a vector in our genre-basis, we can calculate the songs properties and also know, which tags (= genres) other users would assign to such a song.

Using the data we gain about the song from the user, we can construct and correct the genres position in the property-room, assigning each genre a vector of properties. From that, we can also construct Mg→p.

Going even further, since genres are often broad definitions, we can instead assign to a genre for each property a mean value and a standard derivation, which, when combined, gives us a definition of the variations (and fixed properties) of a genre.

We need to go deeper

Additionally, a user might react differently to a given song based on his current mood, situation or the time, giving it different ratings. So, when assigning values to a song, we need to compensate for how the user rated the other songs he listened to in the last few hours, comparing offsets and trends in specific properties.

If we ask the user about his mood, we can even build a profile and, when there is enough data, tell him what genres he might like in his current mood.


Conclusion: iTunes just isn't good enough.

Next time: How do we capture all that data and use it to play the user music to his liking?

If you're wondering: this post is a part of my attempt to design (and make) the best media-manager i could imagine. For updates on it, just follow github.com/cfstras/cfmedias

read more »

Go (a programming language by Google)

10 Jan 2013

Reading the Go documentation makes me drool. I mean, seriously, how has no one ever thought of that stuff?

read more »

Rant: About MTP & PTP together with Android 4

18 Dec 2012

Android (since Honeycomb) switched from USB Mass Storage to MTP/PTP.

I understand the reasons for (some) switch, it's just simpler to avoid filesystem-mess when your average windows starts crapping at that exFat. In general, it makes it easier for device developers to figure out partitioning, since they don't have to unmount the drive before making it accessible to the computer.

Now, there's two points I absolutely don't understand.

First: Why the HELL would you completely take out any support for Mass Storage? Every PC has it. Most smartphones have an sd-card that could be unmounted without any concerns. At least let me mount my SD card!

Second: WHY MTP? Has anyone noticed that the current implementation of MTP clients is absolutely horrible on the PC side? I don't know about Mac, but MTP on Windows has some horrible memory leaks (yup, i really got a complete system crash from just copying files), it's terribly slow and most important: it's not implemented as a mount protocol, but as something else you can only access through explorer, not through your average sync program.

On Linux it seems there are better implementations with FUSE, i might just have to make the switch - oh wait - there's no good music manager for linux, so why bother (let's not discuss that).

So while I am stuck with taking out my SD card whenever I have new Music, maybe someone will come up with a way to make my sgs3 enable UMS again. I mean seriously, this is a huge step backwards.

/edit - Quick Update:

I figured out how to work around Samsung and re-enable USB Mass Storage. Wee.

read more »

Rant: Memory Management in Java

30 Sep 2012

Since this is a pretty serious topic which is highly discussed, I will try to summarize all the arguments you might be reading and concluding them.

read more »

Rant: About IntelliSense

17 Jul 2012

So, Visual Studio seems like a good IDE. It has most features one would seek in a programming environment and has nice erm... nothing.

There is syntax-highlighting, but only for C/C++ and some other bullsh*t languagues (if you can call C# a programming language).

The main best feature I have found yet is the ability to have two windows of source code open at one point. Whoa, what a unique feature. Oh, and installing "Productivity Power Tools" lets you have a nice overview of the code as scrollbar, but that's an extension. Why would a piece of software like that cost a whopping 500 bucks? I mean, vim can do more than VS if you don't add any addons and is open source.

Now for IntelliSense.

IntelliSense is what Microsoft calls the Ctrl+Spacebar that every IDE has now. It lists every Member a node has once you start typing. It's pretty helpful if you're too lazy reading the APIs for the libraries you are using or if you just forgot what arguments a function takes.

But, for some reason, some numbnut at MS decided to handle the Ctrl+Space event in the main UI thread, hanging the whole of Visual Studio if you accidentally hit it when having a lot of includes in a file. Or if it just decides to rescan your whole workspace. It does that while the UI patiently waits for the scan to complete. Effectively, if you have a big solution open, VS will pause for a few minutes, giving you the ability to get some coffee. Or kick your monitor. Or shoot someone.

Better just not start using VS at all.

*tearing hair out of my head*

read more »

Realizing

03 Jul 2012

I just realized something:

I always was complaining about the huge amounts of RAM Firefox and Chrome(ium) waste. I switched to Chrome at some point because it deallocates RAM more dynamically, making long-lasting sessions possible. I exploited this to a point where 60% of my ram was occupied by Chrome. Because Windows took care of the last 40%, my System became unusable when I opened more tabs.

This problem totally vanished when I doubled my RAM to 12GB. I mean, it was only like 20€. Maybe I should think more about my tendency to waste RAM.

read more »

Colored Buddhabrot GIF

22 Apr 2012

read more »

Rant: Unity 3D (game engine)

09 Feb 2012

Unity 3D sucks. It's a huge game engine and editor which aims to bring noobs like you the opportunity to create a very bad game. It aims to be simple to use, yet it uses C#-Style scripts and uses Capital Style Variable Names So You Can'T Fucking See If Something Is A Variable, A Method Or A Class.

Also it's physics engine is buggy like hell. If you finally get it to work (almost) like you would need it, it stops working randomly once you go out of debug mode. Since you're not in debug mode anymore, you can't find the source of the error. Once you switch to debug mode, the bug is gone.

And when you finally did something that could be a game, and spent hours building levels and scripted objects, you decide to add some fancy graphics and they tell you anything that doesn't look crappy has to be made with a pro license.

Examples: Shadows need a pro license. Being able to work at a project in a team needs a pro license. Render-To-Texture needs a Pro license. Importing Blender meshes doesn't need a Pro license (but it doesn't work). Video playback needs a pro license. Even another skin needs a pro license. The "Pro" Version is just "1500$". (Basic) iOS Support costs 400$. Basic Android: another 400$. "Pro" iOS and Android each cost an additional 1500$.

I suggest everyone who wants to use Unity 3D to do something serious to find a wall and bang your head to it as long as you still think it's a good idea.

read more »

Blog

09 Feb 2012

Although nobody reads it, i decided this is now my blog. I'm gonna use it to whine and flame about utter bullshit software like Unity 3d.

by the way, i have a random dump of other stuff i do. It's mostly in German. If you can't read german, don't. It's here: http://cfs.q1cc.net/

read more »