Posts
DIY iPod > Last.fm Uploader
last.fm is a really cool site. I’ve found lots of interesting bands and information from there. Their software is unfortunately pretty crummy. The first time I tried it, the official client mysteriously crashed on me on launch for almost 6 months straight. It’s also not very Mac-like (Cmd-S for Stop, hello?). iScrobbler, especially the 1.5.x series, is getting better, but doesn’t support iPods.
The official last.fm client tries to upload track data from an iPod but at least for me, fails miserably.
Posts
Use Spotlight on Your iPod
Spotlight, by default doesn’t index iPods which is a bummer because the filenames are mangled. OK, no biggie we can just enable it and rebuild the index:
sudo mdutil -i on /Volumes/fliPod sudo mdutil -E /Volumes/fliPod Unfortunately that will not give you access to the audio files since Spotlight also ignores hidden files and folders. This is where mdimport comes in:
mdimport -f /Volumes/fliPod/iPod_Control And now you can easily find your music from the iPod on any Mac.
Posts
Testing for Power
Say you have a Mac with intermittent poweron problems. How would you test for something like that? How would you know if the part you replaced actually had any effect? You can do this manually, just powering on the unit, or you can let the machine do the work for you:
echo "mypass" | sudo -S pmset repeat poweron MTWRFSU $(php -r "echo date ('H:i:s"', time() + 120);") halt If you put that in your Login Items, the Mac will shutdown and start up after 2 minutes indefinitely.
Posts
SysExtract
Here’s a little script I wrote that can extract certain packages from a Mac OS X install. I’ve used it to create clean installs from “used” systems and also as a tool for updating crucial system components for OS deployment images.
It’s geared mostly for Intel-installs, but since 10.4.10 might actually work also on PPC. Just check the PKGS array.
It’s not very safe. I hosed my NetInfo database more than once while working with it (thanks to the -pp option which Post Processes the created install by, among other things, deleting the NI DB), but I thought the general idea of using ditto and package Receipts to restore system components was pretty cool and actually quite useful.
Posts
HereShell
Errr, this is about as basic as it gets, but:
tell application "Finder" set currDir to quoted form of POSIX path of (target of window 1 as alias) set theCommand to text returned of (display dialog "" default answer "ls") try set out to do shell script "cd " & currDir & ";" & theCommand if (out is not "") then display alert out end if on error e display alert e buttons "Bummer" end try end tell Save that to the right place, give it a shortcut and now I can run shell commands into the frontmost Finder window.
Posts
PHP and OS X's OpenLDAP
After spending nearly a full day figuring out how to make PHP (5.2.x) authenticate to OS X Server’s (10.4.9) OpenLDAP, I decided to put down the results:
Must always do ldap_set_option ($ds, LDAP_OPT_PROTOCOL_VERSION, 3) or else you get a Protocol error
Trying to do an anonymous bind before searching for a users DN for authentication is moot. PHP will tell you Server is unwilling to perform and /var/log/slapd.log will read something like unauthenticated bind (DN with no password) disallowed.
Posts
Perian 1.0
Perian is a pretty neat project. Weird that no-one really thought of this before - to wrap ffmpeg and a few support libs in a QuickTime component, instead of just every format individually. I know I’ve certainly debated with friends about which approach would be better - QT-based or a standalone player. It seems that with Apple TV, the answer has become pretty obvious.
Aniways, version 1.0 had recently come out and one of the coolest features is ofcourse subtitle (SRT) support.
Posts
B.O.E.U.F.
BOEUF (“Bunch Of Extremely Useful Functions”) is a helper library (a “mini-framework” if you will) designed to make the most tedious operations of building PHP websites a little bit easier. I’m using it to drive a few web projects at the moment, including this very same blog.
It’s been inspired in part by CakePHP, but maybe most of all by good-old oldskool PHP/MySQL development. It gives you:
A data-driven development workflow.
Posts
Coda - a Quick Review
The name of Panic’s latest “big app” would suggest that it has something to do with coding, which it totally does, but I also remembered the word from choir practice. In music, “coda” means “the concluding passage of a piece or movement, typically forming an addition to the basic structure.”
I wouldn’t consider myself a professional web developer, although I’ve worked as one in the past. On projects ranging from simple web pages to a full CMS.
Posts
Back Online
This blog isn’t what it used to be. In a good sense. Hopefully. It is now running on a hand-made blogging engine I call Flannel (the name actually comes from a CMS I wrote that runs for example this site), temporarily still using the RapidWeaver template.
There were quite a few reasons I wanted to do this and here are the most important ones:
RW was really becoming a drag as a blogging tool.
Posts
Reading Version Numbers
I’ve been working alot with software version numbers lately (did I mention I have a job now?) and one of the tools I developed, that didn’t eventually get implemented was a little utility that could fetch the Info.plist info from a bundle based on it’s bundle id, for example:
$ versioneer org.videolan.vlc * org.videolan.vlc: 0.8.6b Since it can also work with the plists from a user’s homedir, you can also do bigger lookups:
Posts
Tunnelling Media Over SSH
If this site had a “just too cool” section, this next bit would be the first one there. You’re at the office and want to play some tunes from your home Mac. Do you set up a file server to access them? Or maybe some streaming system? Try to hack iTunes to share beyond the LAN?
Or just use SSH (which you’re probably serving anyway). The trick is to cat the remote file over the SSH tunnel to a local media player that can read from stdin, like mpg123:
Posts
New article for afp548.com
Terminal Productivity Tips. I think it came out OK - I think I said everything I wanted to say. I actually worked on it for quite a long while, trying to make sure everything is accurate and works the way it should. There’s certainly some stuff in there I would have loved to read about some time ago. I truly hope it’ll come in useful for someone. It’s kind of a vast subject I guess, but you can always only start somewhere.
Posts
The best media player money can't buy
It turns out that for my needs, the best x-format media player out there right now is the command-line version of MPlayer. It plays anything, is infinitely customisable, has proper support for subtitles (with live interactive retiming!) and most importantly, allows me to easily create the perfect UI for it, tailored exactly to my needs. In most cases this means “play this file” or “play this file and use this other file for the subtitles”.
Posts
Updates on the 6200c
A while back I reported about my experiences with the ProCaster 6200c DVBc PVR device. I’ve now done a bit more research into free playback, transcoding and editing solutions and here are some results:
VLC will not play back the files. All you get is noise and no audio.
ffmpeg/ffplay doesn’t know what to do with them either. It recognizes the audio track, but only sees a subtitle track where the video data should be.
Posts
Detecting RSS readers
I find it strange that there’s no (AFAIK) standard way to differentiate between a regular web browser and an RSS aggregator. Ideally, you’d think that the client requests a certain mimetype so your webapp could make some decisions. This isn’t much of an issue in most cases, since you just provide an alternate link the the RSS feed, but I ran into a problem with authentication.
I wanted RSS users to be able to authenticate using standard HTTP methods, while still giving browser users a nice login window through which they could also reset the password or whatever.
Posts
XLD - A Quick Review
I ran into a situation where I had a music CD as a single FLAC file with the tracks defined in a cuesheet. The generally-fabulous Max wouldn’t do anything with this combo (it opened the .cue file, but that was it). The command-line FLAC decoder does support cue indexes, but just as I was getting ready for some shellscript/Automator mumbo jumbo, I decided to pull a Google search for “flac cue os x” and that’s when I stumbled on this wonderful little utility called XLD.
Posts
Here's My Truth - Tell Me Yours
The following has nothing to do with what’s usually said on this site, but I feel it’s important since there’s not much first-hand English commentary and foreign news services have been (too) diplomatic on the subject.
I’m talking about what’s recently been happening in Estonia. There’s an information war going on between Estonia and Russia at the moment one that revolves around the s.c. “Bronze Soldier”…
How it all began I will try to sum up the key events that lead to this situation, as best as I can (there’s a really good documentary series about the occupation over at the Museum of Occupations home-page).
Posts
iTunes U
Here’s something I didn’t even know existed - Apple’s iTunes U service. They describe it like so:
iTunes U is a free, hosted service for colleges and universities that provides easy access to their educational content, including lectures and interviews, 24 hours a day, 7 days a week
Seems to be the same thing that powers the ADC on iTunes system. This is pretty cool too:
One-click iPod support.
Posts
Cleaning up your Podcasts
I was running out of HD space again and for the heck of it checked how much space my downloaded podcasts were taking up - 1.9GB. This wasn’t that surprising, but I did notice there were media files of podcasts lying around that I had unsubscribed from a looong time ago. So I needed something that would do two things:
a) Delete all the podcasts I had already listened to b) Go through all the residue in the Podcast folder and delete whatever I had already unsubcribed from.
Posts
QuickTime 7.1.6
Two things about the latest QuickTime update I haven’t noticed having been mentioned anywhere:
- Timecode and closed captioning display in QuickTime Player The first one is easy, we can now view the frame number, or, if the movie has a timecode track, different timecode formats:
It seems this might be tied to Compressor 3’s ability to do non-destructive timecode overlays.
Closed captioning has still remained a mystery to me.
Posts
The LEFT OUTER JOIN
So let’s say you’re fetching posts from your blog app and also want to show the comment count for every post. You can’t use a typical JOIN because some posts may not have any comments at all and doing a separate query in the comments table is just plain wasteful. Use a LEFT OUTER JOIN instead:
SELECT *, COUNT(comments.id) AS comment_count FROM posts LEFT OUTER JOIN comments ON (posts.id = comments.
Posts
Safari tip of the week - history search
At least once a week, I run into a situation where I want to revisit a site I had visited earlier but forgot to bookmark or didn’t even think of bookmarking. All I can remember is a part of the page’s title. Wouldn’t it be nice if there was a slick tool that would allow you to quickly search your browser history? I was all ready to fire up XCode when I discovered that the Safari team had already thought of this.
Posts
iftop
Wouldn’t it be cool to know exactly what connection is eating how much of your bandwidth? Now you can, thanks to iftop.
It has many useful commands (like regex filtering), just hit “h” to read about them. And ofcourse I just had to build a universal package (it goes into /usr/local/sbin) I discovered this little gem through Neubia. more info from man iftop.
Posts
Why I don't like Symbian
Just a few points why I think Symbian in general, and S60 in particular suck really bad. And I’m not alone in this:
Windows-only I wonder how well the web would have taken off if the servers and development tools for making webapps and homepages would have been Windows-only. Some wonderful people have made an effort to get a Symbian toolchain running on *NIXes but they’re all hopelessly outdated since there’s no support from Nokia.
Posts
Why I don't like Symbian
Just a few points why I think Symbian in general, and S60 in particular suck really bad. And I’m not alone in this:
Windows-only I wonder how well the web would have taken off if the servers and development tools for making webapps and homepages would have been Windows-only. Some wonderful people have made an effort to get a Symbian toolchain running on *NIXes but they’re all hopelessly outdated since there’s no support from Nokia.
Posts
The ProCaster 6200c
Haven’t found anything on this elsewhere yet, so some quick notes on our new DVB box. The image quality is really good, the PVR stuff looks very impressive looking indistinguishable from broadcast quality. Makes sense since it’s probably not transcoded at all. And the fact that it can record up to 4 broadcasts at once is really cool.
The EPG works well and the interface isn’t half bad, especially after the firmware update (which seem to come out pretty regularly, you can even download betas!
Posts
A simple build system
Nowadays it seems that whenever you’re working on something, you, at some point, have to start releasing stuff. Typically you can’t just take the directory of your app, compress it and upload somewhere. And even if you could, doing it manually would be extremely munday at best.
In a typical webapp project, creating a “build” means:
a) cleaning up our configuration of any sensitive information b) removing any data that should not be included in the distribution c) archiving and compressing the build d) id each archive (typically using a timestamp) the build e) uploading the archive somewhere.
Posts
Temporarily changing passwords
This came up on comp.sys.mac.system - how could you easily change a users password without having admin access to the system? Say a customer asks you to install Final Cut Studio before going into a meeting and forgets to give you his password (or writes down the wrong one, or whatever). Do you just wait for the customer to return and tell them they’ll have to wait another 45 mins for the 30+ GB to finish installing?
Posts
Audio playback with Python
I was really surprised there’s seemingly no way to do cross-platform sound output with Python. Looks like you can definitely do it under Windows, and maybe even on Linux, but I couldn’t find any info about OS X. There’s the rather cryptic mention of Carbon.Snd Sound Manager in the Python docs but I honestly have no idea what that is or how to use it.
Anyways, since I (and probably any other Python user on OS X) had PyObjc installed, I decided to use Cocoa to do my sound playback.
Posts
A Universal Subtitle Format and Distribution Method
OnTrees will be a weekly “column” about ideas for tools and technologies I think would make working with computers and consuming media more enjoyable and fulfilling. The name comes from the slogan of another site I run. I normally just jot my ideas down as iCal To Dos, but I think it’s time to try and articulate them. If for no other reason than to help me better understand them myself and obviously in the hopes of someone else picking up on them.
Posts
Checking for existance
There’s no built-in for checking if a file exists when developing Dashboard Widgets in JavaScript. But with a little help from the BSD subsystem we can do it easily. For this to work, you obviously need to have the following set in your Info.plist:
<key>AllowSystem</key> <true/> That opens up a whole world of possibilities. I find that the most effective way is to use file. This way we can even check if something is of the correct type.
Posts
Why I switched to Safari (again)
I’ve been a big fan of Camino. Ever since it was called Chimera. Whenever a new Mac OS would come out, that I didn’t have the hardware for, I could still use a modern, native Mac browser thanks to them. These guys have done a tremendous job bridging the Gecko rendering engine with a OS X L&F that in many ways feels more “Mac” than Apple’s own browser. I originally switched to Camino because:
Posts
Data URL-s
I needed a really quick way to post photos from my phone, so decided to write a little photogallery app. You just dump pictures off the phone to a certain directory and that’s it. In the process of reading about imagecopyresized, I stumbled on this method of embedding images:
<img src='data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD' alt='Picture' /> That’s called a data URL and they were first introduced in 1998.
In PHP, I couldn’t find a way to read the data directly with imagejpeg(), so I end up overwriting 1 thumbnail for a whole directory of images.
Posts
Finding things
I find it ironic, that things get increasingly difficult to find as their physical proximity increases (ie distance decreases). Thanks to Google, I can easily find a solution to a problem some guy, thousands of kilometres, and more importantly, years away, found and yet I’m utterly helpless if I have to find my bus ticket under the pile of papers that is my workdesk. In other words, filipp’s search theorem states that “the physical distance of an object is inversely proportionate to the chance of me actually finding it”.
Posts
Running iCal Server on FreeBSD 6.2
Lots of dependencies to work through, but it’ll work eventually. Kerberos was something that I didn’t bother with (just commented out the relevant lines in the run script) since this is just for a mobile application development project. I also had to comment out line 46 in run.sh.
Posts
Mac Mythbusters: white on black saves battery
While reviewing Journler, I stumbled upon a funny command - Toggle Low Light Display. This is the same as System Preferences > Universl Acces > White on Black and is obviously meant for writing in the dark, but it made me wonder if it would also help to conserve battery power. The reasoning being that in a standard black-on-white configuration we’re burning pixels that really don’t have to be lit at all.
Posts
Thou shalt not delete!
This came up in the chatroom. How do you protect a folder from being deleted while still being able to write to it? Locking it directly doesn’t work, locking the parent one does, but then you can’t write to the parent dir. Standard UNIX permissions are of little help, as there is no such thing as a “delete bit”. Enter Access Control Lists. First let’s make sure they’re on:
> sudo fsaclctl -p / -e and then we can just take away the right to delete:
Posts
with(something)
I discovered a nice little shortcut for setting element properties in JavaScript. Instead of saying:
nameDiv = document.createElement('div') nameDiv.className = 'nameDiv'; nameDiv.innerText = showName; nameDiv.title = showName; You can kind of “zoom in to” the element:
with (nameDiv = document.createElement('div')) { className = 'nameDiv'; innerText = showName; title = showName; }
Posts
XML stuff
A (weird) way to convert PHP arrays to XML. I came up with this for Collective - passing media metadata (with getid3) from the server to JavaScript. It’s not supposed to work with numeric indexes - the algorithm doesn’t break, it just produces invalid XML (can’t have numbers as element names):
function array2xml($array) { foreach ($array as $k => $v) { if (is_array($v)) { $out .= "<$k " . array2xml($v) .
Posts
Geek humour
> make love make: *** No rule to make target `love'. Stop. > echo "love" > Makefile; make love Makefile:1: *** missing separator. Stop.
Posts
Punk 1.0.6
Released yesterday. The version number is completely made up. Supports the new IMDb layout and is rewritten to use XMLHttpRequest which should also work through proxies by using the system settings. XMLHttpRequest seems to also give you caching for free (at least it creates cruft in the Cache folder).
This is probably the most succesful thing I’ve ever made (thanks largely to Martin’s nice UI) and this version even got some comments from actual users!
Posts
Concatenating a bunch of files
A useful little tidbit. To merge the contents of all the files in an arbitrary directory hierachy into one single file, while skipping dot-files:
> find . -type f \! -name ".*" -exec cat {} > /Users/filipp/specs.txt \;
Posts
XMLHttpRequest and redirects
Hit a major bummer while updating the Punk widget today. Essentially, the onreadystatechange handler will miss the redirect/Location: (302) header being sent. IMDb uses 302 when there’s only one search result and catching that was a really nice shortcut instead of having to parse the page to find out what has happened. The widget used curl before with which it’s super-easy to notice these things, but for some other reasons, I had already re-written everything to use XMLHttpRequest.
Posts
Scraping google.com
I don’t know when this happened, but it seems you can’t scrape (parse) google.com as easily as before. At least with Python, a simple
s=urllib.urlopen('http://www.google.com/search?q=define%3Aesoteric') r=s.read() print r will give you this notice instead:
/snip/ Your client does not have permission to get URL /search?q=define%3Aesoteric from this server /snip/
And here’s me not understanding why my regexes are not matching. :) Apparently, you should at least show some kind of User Agent.
Posts
OpenSSL is cool
No news there, but some neat tricks: To test a certificate:
> cat mycert.crt mycert.key > mycert.pem > openssl s_server -cert mycert.pem -www and then check https://localhost:4433
To strip a passphrase from an RSA keyfile:
> openssl rsa -in mykey.key -out newkey.pem Whenever someone says you should “use make to create hash links” what they really mean is you should use Makefile.crt that comes with mod_ssl to create hash symlinks for Apache.
Posts
Windows and OS X benchmarks
I’ve said this before, but one thing that baffles me is in all the benchmarks and performance comparisons, people tend to compare a fresh copy of Windows against a fresh copy of OS X. I think this is completely false. Every self-respecting reviewer should, first of all install all the software they would normally in a production machine, preferably use the reviewed system as their main system for a while.
Posts
Stranger than fiction
filipp@fiBook.local [Metadata] > curl -v http://127.0.0.1/~filipp/collective/show.php?id=rss * About to connect() to 127.0.0.1 port 80 * Trying 127.0.0.1... * connected * Connected to 127.0.0.1 (127.0.0.1) port 80 > GET /~filipp/collective/show.php?id=rss HTTP/1.1 User-Agent: curl/7.13.1 (powerpc-apple-darwin8.0) libcurl/7.13.1 OpenSSL/0.9.7l zlib/1.2.3 Host: 127.0.0.1 Pragma: no-cache Accept: */* < HTTP/1.1 200 OK < Date: Sat, 24 Feb 2007 10:27:41 GMT < Server: Apache/1.3.33 (Darwin) PHP/5.2.0 < X-Powered-By: PHP/5.2.0 < Set-Cookie: PHPSESSID=4fnmhuf56d5h3ifqg6qcai8k12; path=/ < Expires: Thu, 19 Nov 1981 08:52:00 GMT < Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 < Pragma: no-cache < Transfer-Encoding: chunked < Content-Type: text/xml AND
Posts
Using Google's sitemap generator with RW
The sitemap generation process may seem a little daunting at first but it’s actually quite simple, even when you’re just using RapidWeaver. All you have to do is download their Sitemap Generator script. Then make a local export of your RW site (ie ~/Sites/mysite.com). The sitemap generator has 3 modes of operation, we’re interested in having it generate the map based on the directory structure, so config.xml would be:
<site base_url="http://mysite.