20120121 A hack to parse RSS feeds with php
Just happened to assemble this script hack recently, out of the requirement for a quick’n’dirty feed parsing feature: $feed_contents = file_get_contents($feed_url); $xml = simplexml_load_string($feed_contents, LIBXML_NOCDATA); $feed_array = json_decode(json_encode($xml)); print_r($feed_array); // Surprise!! Now this evidently is not SimplePie or Magpie RSS or whatever feed reader library tickles your fancy*, but assuming the feed will never be [...]
20101122 Reading attribute values of custom components
Assuming you’ve defined a custom component which inherits from View and it’s called MyComponent, create a values/attrs.xml file and add a line for each attribute you want to allow in your component. The file should look more or less like this: <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="MyComponent"> [...]
20101119 Tiled backgrounds in Android
If you just point your UI element to an image resource, like this: android:background="@drawable/myBackgroundImage" you won’t get a tiled background. Instead, you’ll get the image stretched to the element size! Really horrible, if that’s not what you intended to do. The trick is to create another XML file in the drawable directory. This file contains [...]
20101025 Converting ‘My Tracks’ KML files for DDMS
KML files store geographical information about paths. They can be generated with applications such as Android’s My Tracks application, and in theory we should be able to load them into the emulator, using the DDMS Eclipse Plug-in, to debug and test applications which depend on the user’s location without having to be actually out in [...]
20100221 Breakpoint demolog, day 19: loading Song.xml == DONE
I didn’t really feel like doing too much today but I managed to convince myself to finish the loading of relevant data from the song’s file. I now only have to instantiate patterns, pattern entries and synth voices and send them that relevant data when loading. And adapt my old tracker-style playing routine to work [...]