Posts
Punk 1.1
The best IMDb widget’s been updated to version 1.1 :) This is mainly a maintenance release, fixing compatibility with updated IMDBd layout.
It’s also using akas.imdb.com as the data source which means you can search for translated titles as well (many thanks Joshua L?dke for the feature request). It’s also sporting a “better than nothing” progress indicator. :)
Btw, the name came from the fact that it was initially supposed to be a “do you feel lucky” - type widget which only gave you the first result.
Posts
Content-Encoding- gzip
Safari 3.1 just came out and with it, the awesome Develop menu, also for Tiger (my main dev. platform). I do profile my sites occasionally using Firebug, but the little recommendations that Safari’s Network Timeline gives were surprisingly accurate. More specifically the little “You could save bandwidth by having your web server compress this transfer…” popup.
Indeed, Apache 2.x now comes with mod_deflate built in (instead of mod_gzip) and enabling it was a simple matter of:
Posts
Editable DVD Ripping
HandBrake is fantastic, but what if you need the DVD material for editing? I notice I’ve been asked this question more than once and since I couldn’t find any simple guide online, I thought I’d write one down myself.
It used to be all about DropDV which by now seems to be discontinued. The best (most consistent, fast and with good image quality) is to use Apple’s MPEG2 Component (20 EUR) and the fabulous MPEG Streamclip.
Posts
Apache FOP java.lang.NoClassDefFoundError
This is what typically happens trying to run Apache FOP on Leopard’s default Tomcat:
java.lang.NoClassDefFoundError org.apache.fop.fo.expr.NCnameProperty.getColor(NCnameProperty.java:52) org.apache.fop.fo.properties.ColorProperty$Maker.convertPropert ... The thing that got it running for me was:
nano /Library/Tomcat/bin/tomcat-launchd.sh export JAVA_OPTS="-Djava.awt.headless=true" … just before it calls startup.sh. You don’t really notice it, but FOP will actually give an error about not having permissions to use the window server, after which it just keeps dying of that NoClassDefFoundError.
I got it working the last time because I launched another copy of Tomcat from the Terminal within the GUI and didn’t notice a org.
Posts
UFO Sundae #11
The past few weeks have been completely crazy. Tonight, over 4 months of work are coming together in a major update to a service management system I’ve been privileged to work on. As I sit here, waiting for the DNS changes to propagate, I thought I’d try and put down some things…
If you’ve noticed that this site has been become extremely fast for quite a while now, it’s because it’s running on the greatest server ever - our own.
Posts
Tomcat on Leopard Server (Grrr)
Tomcat used to be under the Application Services, now it’s hidden in Web > Enable Tomcat checkbox (talk about minimalist).
$CATALINA_HOME is in /Library/Tomcat The documentation (a whopping one page!) is wrong though, the port is not 9006, but 8080, since JBoss is no longer around, I guess. You also have to manually edit your tomcat-users.xml… grr…
There’s also something missing from default Tomcat. For instance, an Apache FOP servlet would simply not work (it seems like there’s some XML libs missing or something).
Posts
Random Flash Disk Benchmarks
I got my hands on a 2GB IDE flash disk for a little hardware project I’m working on. When someone says SSD’s are really fast, they’re not talking about just any non-mechanical hard drive. The unit in question was nearly 3x slower than an elderly 4200RPM IDE drive in terms of just plain write speed, as illustrated by timing the creation of a 1GB file:
2GB IDE Flash
real 1m43.425s 30GB 4200RPM
Posts
ddrescue
Data recovery can sometimes be rocket science, but mostly it’s just about being very “persuasive” - trying and trying until you get something out. When drives fail, they often just become so slow that they appear dead to most software. That’s why you need tools that can be persistant and ddrescue is very good at that.
One of it’s greatest features (and one that sets it apart from any commercial tool I’ve ever used) is the possibility to stop the rescue at any point thanks to a log file.
Posts
Install 10.4 Server Admin Tools on 10.5
Despite it’s many quirks, Leopard Server is still an impressive upgrade. I would say even more so than Leopard Workstation (?). One of the not-so-great changes is that you can only use the new admin tools to monitor 10.4 services (not configure) and the 10.4 admin tools installer will not work on 10.5.
In other words, you need Tiger to admin Tiger and Leopard to admin Leopard. While it seems it is indeed impossible to run the Leopard tools on Tiger, the reverse is actually quite simple.
Posts
JavaScript Input Validation
What could be a better “comeback” subject than one of the lamest and most boring of all time - how to validate form input in JavaScript. Everyone and their dog has their way, here’s mine, which I think is quite flexible and reusable.
We typically need 3 things for validation - the names of fields to check, some checking criteria and a more user-friendly message to report to the user in case of an error.
Posts
Tidbits for week 6
The D5 interview with Jobs and Gates is available on the iTunes Store. I thought Bill came across as very focused, down-to-earth and open.
Speaking of the iTS, it appears one is able to buy only one album every 24 h since their payment system is down most of the time. One of the great benefits of online delivery is instant gratification so this is extremely annoying…
Perian 1.
Posts
Random Midnight Tidbits
Nothing major to report this time, just an assortment of more and less useful tidbits.
It’s possible to still use Server Admin and WG if you only have SSH sticking out of your server’s firewall:
$ ssh -l user -L 311:server:311 -L 625:server:625 -N server Connect to address “0.0.0.0” to avoid a weird authentication error in WG.
The default irssi package in MacPorts doesn’t have Perl so you can’t user scripts with it.
Posts
/var/folders?
It appears there’s a new cache/tmp folder in Leopard - /var/folders. The subfolder names are hashed, but from this mosxhints post we learn that you can read the hash using getconf, so we can jump directly to the cache folder using:
open $(getconf DARWIN_USER_CACHE_DIR) Looking closer, this is very similar to Tiger’s /var/tmp/folders/userid except there’s a lot more stuff in there under Leopard.
This seems like a good place to look if you’re experiencing mysterious HDD space loss.
Posts
Cool Tools - a Weekly Roundup
WriteRoom About 6 years ago, a customer brought a PowerBook 100 in for repairs. She was a writer and when I asked why she was still using (and spending good money on fixing) that ancient Mac when she could easily buy a new one. She replied that she’s much more productive on the old one because there are no distractions. That the limitations of the machine and software actually help the user to do one thing really well…
Posts
Display Mirroring during Installation
I’ve recently discovered how cool it is to explain something using screencasts. They’re a lot quicker to make than writing an article, a lot more efficient at explaining specific procedures and concepts and IMHO are just plain more enjoyable to follow. Recording these is also a great way to practice one’s diction and “thought accuracy”.
I use the Canopus TwinPact 100 scan converter to capture the screen (neat box, rubbish software) which makes it possible to also cast stuff like installations and fullscreen apps.
Posts
csv_replace.rb
A short Ruby script I’ve found to be quite useful. It replaces values of the first CSV column with the values in the second column inside any text file (but it was specifically meant for MySQL dumps). I often use it whenever an entity relationship changes in a webapp. Since it’s just a fulltext find/replace it’s also much less error-prone than actually trying to consider the references themselves.
#!/usr/bin/env ruby # Replace values of column 1 with column 2 require 'csv' def usage puts "Usage: csv_replace csvfile sqlfile" exit 1 end if ARGV.
Posts
Installing Leopard on the 15
Leopard requires at least an 867Mhz CPU, this iMac has 800. I only need the install to test some OS hacks so I’m pretty sure the 67Mhz delta will not have a big impact. Time to modify some packages…
Clone the Leopard DVD onto a writable volume
mkdir ~/osinstall; cd ~/osinstall xar -xf /Volumes/Leopard/System/Installation/Packages/OSInstall.mpkg sed -i .old -e 's/866000000/0/' ./Distribution mv OSInstall.mpkg ../ sudo xar -cf /Volumes/Leopard/System/Installation/Packages/OSInstall.mpkg . Boot the iMac with the modified package and install
Posts
Compressing PDF's in Leopard
One of the Tiger features that’s now missing in Leopard is the PDF Service that compresses bitmaps in PDF files. Not something terribly vital but definitely useful on occasion. The good news is that you can basically create one yourself.
Open Automator and add the Apply Quartz Filter to PDF Documents action. When prompted, also add the copy action, but move it after the Quartz filter Set the filter to Reduce File Size Save as a Print Workflow plugin Print > PDF > Compress PDF (or whatever you called it) and you should get a compressed PDF on your desktop (or whatever you chose) with the document name (most of the time) as the file name.
Posts
Site updates
Many thanks to all who reminded me that the RSS was totally busted! It’s fixed now with a few other site-wide improvements.
The RSS broke because my hosting company had changed the default PHP setting _short_open_tag to 1 which is murder for pages that have XML in them. Luckily they allow directory-specific php.ini configuration.
I’ve finally managed to get rid of the RapidWeaver template that had served me for so long.
Posts
useradd.sh v1.2
I’ve updated useradd to support both Tiger and Leopard. Many thanks go to Allan Sanderson for his Leopard changes and bringing the need for an update to my attention in the first place!
There are some other improvements as well, including checking if the user already exists, cloning the non-localized bits from the User Template and semi-random, dictionary-based default passwords.
I’ve tested the script on 10.4.10 and 10.5.1.
Some remarks:
Posts
Ditching Transmission :(
I’ve been a big fan of Transmission ever since it came out. I think it used to be a fantastic, native BitTorrent client that was really easy to use for the basic stuff, but could do more when you needed it to. I think they still have the best interface for creating Torrents and the extra Mac native features like hot folders and Growl support are terrific… BUT.
My troubles began some months ago when my net connection started dropping intermittently.
Posts
An Old Presentation
Was cleaning the HD and stumbled on a presentation I had given over a year ago at school.
It was meant for Media Engineering students to give them a different perspective on programming. That it’s not just about classes and objects and polymorphism, but a very powerful tool and a form of creative problem solving. That programming, just like everything else in life, is not about some UML chart that is executed to the t, but rather a series of hundreds of little problems, failures and achievements.
Posts
9 vs X
Some things I learned about OS 9 and X interpoperability today, the hard way:
You can’t trust Tiger’s Finder to backup Classic system software. I tried backing up the whole drive into a folder on another drive (like you would using OS 9) and the copied System Folder only had 27 items, whereas the original had 35. I didn’t have time to investigate further, but the point is - use ditto instead of Finder.
Posts
Naming Convention
Was cleaning up my Mac network when I realised I’m currently running my personal record number of Macs in my room - 6, so of-course I had to take a picture to capture the moment:
I (and 25 million other geeks) like to call my machines after a theme - mine’s Futurama, so here they are, the group of 6, from left to right:
15” MBP… err… this isn’t named yet as it’s just a temp machine G4 Mac mini aka nibbler - server testing system - ‘cause it’s small and it downloads things :-) 12” PowerBook - fry - my most-used workhorse named after my favourite character The G4 tower aka cubert - no idea how a media/file server relates to Farnsworth’s son, but that’s how I named it (“hedonism bot” would be more aprioriate) WhiteBook - main development/work machine.
Posts
Speaking of Leopard
Been running it on my own machine for a few weeks now. Some things that I really like:
Higlighting with Cmd-F search. I can finally see the search result instantly within any app!! New Tarminal and Console.app The “modal” Software Update ie shutting down all open apps before installing updates. The lack of this is the biggest reason why so many OS X users had system trouble after a SU.
Posts
View Source in NetNewsWire
Maybe it’s just me, but I couldn’t, for the life of me, figure out how to view the XML source of a newsfeed in NetNewsWire. Yes, I even checked Help…
Luckily NNW is AppleScriptable:
tell application "NetNewsWire" set theSource to XML text of selectedSubscription tell application "TextEdit" make new document with properties {text:theSource} end tell end tell Kludgy? You tell me. Speaking of NNW and AS, I wrote a script that exported NNW feeds to an iPod a while back.
Posts
BOEUF Filters
BOEUF (Bunch Of Extremely Useful Functions) is my own “mini framework” for building web applications. One of the coolest new features I’ve been able to add to it recently are filters.
Filters are functions that are attached to any of the 4 basic actions - create, read, update or delete. You simply create a function called “f_update_post” and that function will be called every time the table “post” is updated. BOEUF evaluates filters after the entity relationships (e.
Posts
A Random Speedtest
Ran speedtest.net using the phone to connect. The 3G scripts are from Mr. Barkman’s page. The 3G package should go up to 384⁄128.
3G scripts over GPRS SE GPRS w/ GPRS SE 3G w/ 3G attached SE GPRS w/ 3G attached 4m/1m cable modem So nothing really new here:
To use 3G you should have 3G enabled on the phone. I wonder how many customers forget this and just think that mobile internet is just supposed to be slow….
Posts
iTunes Plus (Finally!)
iTunes Plus is now available also in the Finnish Store. They’ve also dropped the price so you no longer have to pay a premium for DRM-free, 256kbit/s M4A-s which is great.
Upgrading your existing purchases isn’t free however and costs about 3 EUR on average per album (25% of the album price). :( The system will not suggest upgrading your existing copy when you try to buy a Plus version of something you already own (which is what prompted me to find more about this).
Posts
SIGGRAPH Encore
BlenderNation reported that this year’s SIGGRAPH presentations are now online and are available for free until October 31st, which is really cool!
I found that it’s also possible to download them should you want to keep some around as a reference or have limited connectivity. All of the shows are defined in this JS file. You can pick the videoName property of the show you like and paste it as the argument with the same name to this URI (example).
Posts
OpenLocation.scpt
To rid yourself of Safari’s Address bar once and for all:
Set your most important non-search sites in the “Bookmarks Bar” bookmark folder so they’re accessible with Cmd-1…9 Hide the Address bar To enter URL’s, use either QuickSilver, or something else. I chose to make a really simple AppleScript that I trigger with Cmd-Shift-K which is tailored exactly to my needs. Using “open location” from Standard Additions means that this will also launch the proper protocol helper if needed (eg if I say “ftp://someplace"):
Posts
Final Cut Server
About a month ago, I was the lucky member of a group of about 30 to attend a Final Cut Server training event in Amsterdam. This was right after IBC (which I’ve never been to) so Apple had the actual Engineers behind the product on site who later also did the 2-day training course. Our group was taught by Matthew MacManus who I think did a great job, giving lots of insight into the application, even after, what must have been an excruciating week.
Posts
Finding Out Group Membership
AFAIK, group membership is not stored on a per-user basis. In other words, if you want to find out which groups a specific user is member of, you have to ask that from Groups, not Users.
The first time I ran into this I was pretty bummed out because it seemed you had to poll every specific group to see if the member belongs to it. Then I read this helpful hint from Mr.
Posts
MySQL+PHP setups over SSH
The process is pretty much the same every time so this could almost be wrapped into a script.
1. Grab MySQL and PHP I like to use the official MySQL and Marc Liyenage’s PHP packages. Both are in this case running on 32bit PPC (an XServe G4) using Apache 1.3 on OS X Server 10.4.x.
curl -O http://mysql.tonnikala.org/Downloads/MySQL-5.0/mysql-5.0.45-osx10.4-powerpc.dmg curl -O http://www2.entropy.ch/download/entropy-php-5.2.4-1.tar.gz 2. Unpack and install hdiutil attach mysql-5.0.45-osx10.4-powerpc.dmg cd /Volumes/mysql-5.
Posts
dirstat.py
I was preparing a presentation for school about a web project I’ve recently been working on and thought that it would be kinda cool to give some examples on the file distribution for the build method that I use. To hopefully get a useful comparison between how much “stuff” there is and what the system can do.
I ended up writing a small Python utility (dirstat.py) that does exactly that - give me statistics on any directory with all the different files (based on extension), their count, total filesize, number of lines in all the files of that type and the percentage of code that these files represent of the whole project.
Posts
Collective Early Beta
I was on the edge of getting kicked out of school just a few months ago (working too much on “other stuff”… long story), but they were kind enough to give me one last year to finish my studies. This means crunch time as I have a bunch of courses to do. One of those is my thesis which is worth a lot of points.
The topic of my thesis is “Peer-to-peer Content Distribution” (or something like that) (the old one didn’t pan out and I just posted what I had to the Streaming411 wiki) and it talks about what we all have been doing for years - sharing stuff online.
Posts
The Lost Song
I was a drummer before I really got involved in all of this computer nonsense. First in a band called Kingpin and after that in Patient Zero. I still think back at those times as some of the most fulfilling of my life. There’s a sense of immediacy, instant gratification and, dare I say it, humility that you get from playing an instrument that’s very different from coding and other creative processes of that kind.
Posts
The P1i...Phone
With so many Mac geeks raving about their shiny iPhones (and I’m not being sarcastic - it’s one heck of a gadget) I thought I’d go ahead and say it - no, I didn’t get one, I got the Sony Ericsson P1i instead.
Firstly, you can’t get an iPhone to work safely in Europe (short of AT&T roaming, of course). Secondly, and as masochistic as it may sound, I really wanted a mobile device that I could program for.
Posts
Mail.app Address Cache Backup
Someone recently asked me if it’s possible to backup the address cache that Mail.app uses to auto-complete address fields. This is a pretty good idea since it may contain several addresses that one might be using, but has never added to the Address Book.
This information is stored inside Envelope Index, a file in your Library/Mail folder. Luckily, Apple made the wise choice of using SQLite as the DB backend (maybe Mail.
Posts
View Source... in Mail.app
Accidentally discovered what looks to me like an undocumented feature in Mail.app. When you hit Opt-Cmd-U, the same shortcut as Safari’s View > View Source, you actually get the text/plain representation of the email. As in this:
The logical explanation would be that Mail.app uses a WebView to display messages.
Posts
DVD Backups From Your DVB PVR
Reading an article on how to backup stuff from your PVR onto DVD’s in a local PC magazine using Windows tools got me thinking about how to achieve the same thing using a Mac (without Windows). I had always been looking for a compressed XviD-based method, but a DVD solution has 2 important advantages:
No transcoding necessary. We essentially just unwrap the PVR files and put them on discs.
Posts
Screengrabs from DVD Player
It used to be that whenever you took a screenshot of Apple’s DVD Player application, you’d just get a black box where the video should be. At some point that had been replaced by this, much less confusing, yet equally frustrating error message:
Well today I discovered a fairly simple workaround for this “issue”. Just use the screencapture command line utility with the -i -s switches (to select only the area around the player, for example):
Posts
dash.fm
Couldn’t sleep, most probably because of the heat. Turned out to be a great opportunity for some late night Widget coding. :) dash.fm is a lastm.fm widget that shows a user’s name with link to user page, total track count and names of the last 10 played tracks. Weird that there really wasn’t anything like this out there before…
It’s a bit of an experiment - all of the logic is actually handled on the server using XSLT.
Posts
X360 Media Streaming
This was to be an article about a gazillion ways one can stream media to your X360 from whatever platform, but instead I’m just going to say that, with it’s current software, the Xbox 360 really isn’t a viable media hub solution.
The problem is of course video playback and the console fails in two key areas: DivX and subtitle support. Given the history of DivX, the former may never actually change.
Posts
Enabling Apple's VNC Server Over SSH
This bit has been haunting me for a while. It seems every time I have only one piece of the puzzle and so I finally decided to sit down, figure it out and write it down for future generations. :)
So, here’s our scenario: you’re at the office behind a PC. Somewhere on the far side of the Net you have a Mac running SSH. You want to run some graphical app on the Mac.
Posts
The 360
Never thought I’d spend a minute to actually “review” a Microsoft product, but here I am. Got an Xbox 360 last Friday and I must say I’m pretty impressed. Our home had been a Nintendo house for generations, but the Wii just didn’t feel right. After my kid sister OK-d skipping Twilight Princess, the die was cast.
I think overall the hardware looks decent enough to keep under you TV in your living room.
Posts
iTunes - Deleting Albums From Smart Playlists
Easily the most annoying thing about Smart Playlists is that you can’t modify your Library through them. So you just added a new album and you find it from Recently Added (an incredibly useful playlist IMHO), but the album turns out to be crap. Now you have to find that tune from the Library, select it and all the other from that album and delete them. Or just write a script to do it for you:
Posts
Toggling cross-compilation
Many source distribution will compile fine for both i386 and PPC Macs. For those that don’t, I keep this function in my .bash_profile:
ub() { echo -n "Cross-compiling " if [ $1 = "on" ] then export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386" export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" echo enabled else unset LDFLAGS CFLAGS echo disabled fi }
Posts
SuperView
The following compound sentence will allow you to take screenshots of basically any remote Mac which has SSH running and passwordless SSH login set up:
ssh mymac "echo 'adminpass' | sudo -S screencapture /tmp/screen.png && sudo sips --resampleWidth 400 > /dev/null 2>&1 /tmp/screen.png && cat /tmp/screen.png; sudo rm /tmp/screen.png" > screen.png && open screen.png The sudo is necessary to be able to make screenshots from a “windowless” environment.
One of these days I will integrate this into a widget which will look just like the ARD widget (guess where I got the idea for this) and read the remote pass from the Mac OS keychain.
Posts
SafariReload
Every now and again you run into silly (but useful) sites with silly (and useless) session timeouts with no means of changing them. So you do something else while working with the sites only to come back and find out you’ve been logged out.
Well, here’s a little script to help with this situation:
property reloadInterval : 120 property reloadUrls : {"gsx", "mac.com"} on idle tell application "System Events" if (application "Safari" is not frontmost) then tell application "Safari" repeat with anUrl in reloadUrls repeat with theDoc in (every document whose URL contains anUrl) do JavaScript "window.