Posts
Xbox 360 vs PS 3
Instead of doing something useful, here I am, writing about what could be the most pointless subject ever. LOL. As if the millions of screaming teenagers weren’t enough, I’m going to chime in on this subject and say it: the Xbox 360 is a better gaming system than the PlayStation 3. Here’s why:
###Graphics### First impressions are important here. From the moment I saw Resistance 2 on the PS3, I realised that the 360 is graphically more capable.
Posts
TVIX HD M-6500A Review
Not much info out there on this device, especially from a Mac user’s perspective, so here goes. I’ve used this thing for about 4 months now so this “review” might have some points that some others might miss. I usually just skip to the conclusion, so:
The Good Really does support a wide range of video formats. Haven’t run into a file that it couldn’t handle. They’re of course out there (QuickTime comes to mind), but for all intents and purposes, I’d say the format support is more than adequate.
Posts
DVR-106D Patch
This one’s a bit of a “blast from the past”, but I found so much confusing and contradictory information on the subject that I decided to write down the exact steps myself.
To region unlock, and get rid of the crippling 4x ripping speed of a Pioneer DVR-106 DVD writer (a very popular SuperDrive Apple used in many G4 towers and iMacs back in the day), complete these easy steps:
Posts
Happy 1234567890!
Today’s the big day, or more exactly, today at 01:31:30 is the big second:
filipp@Vorchan.local [~] > date -r 1234567890 laupäev, 14. veebruar 2009. 01:31:30 EET … when the Unix timestamp hits the magical 1234567890 number!
And here it is:
Thanks to Jens for bringing this up…
Oh, and to any friends reading this - happy Valentine’s. ;-)
Posts
Mail.app Delivery Receipts
Everybody hates delivery receipts, but who cares when the customer needs them. Mail.app doesn’t support them, but does have the hidden preference UserHeaders which can include any additional headers, including Disposition-Notification-To.
Here’s a very simple AppleScript I wrote that toggles the header. When not set, it allows you to select a receipt address (from every address of every account) and when set, deletes the preference (the whole key, including any other custom headers you might have defined!
Posts
Zend_Db_Table Autoincrement ID
The otherwise excellent Zend Framework manual unfortunately doesn’t mention how to get the auto-incremented ID of a Zend_Db_Table. Luckily this is pretty simple when we know that Zend_Db_Table uses the same Zend_Db adapter mechanism.
In your Zend_Db_Table_Abstract subclass, just override the insert method:
public function create(array $data) { parent::insert($data); return parent::getDefaultAdapter()->lastInsertId(); } Not sure if that’s the best way of doing it, but it works and makes sense.
Posts
Server Backup Script
Here’s a server backup script that someone else might find userful as well. By “server backup” I mean configuration (/etc and serveradmin) and Open Directory as well as calendar and wiki data.
The OD backup is the entire archive which also includes user passwords. Very handy in case you have to re-od-master a server.
#!/usr/bin/env bash # serverbackup.sh ODPASS=somepass # Password used to encrypt the OD archive CALDATA=/Library/CalendarServer/Documents WEBDATA=/Library/Collaboration BACKUP_DST=/Volumes/BackupRAID/backup/server SERVICES='mail afp calendar dirserv swupdate web dns radius dhcp' logger -p local0.
Posts
iCal Server Backups
As with any backups, simply taking them is only half the work - you should also make sure you can restore them. Unfortunately that’s not as straight-forward as you would think with iCal Server.
Say one of your users has accidentally deleted a group calendar (R/W permissions mean the user can delete, but not create cals under a group delegate). This happened yesterday so you know you should have the calendar in last week’s snapshot.
Posts
Syncing Notes to Your iPod
Syncing notes from Mail.app to your iPod touch is not as bad as it may seem. I wanted to put a shopping list on mine, and almost joined the angry hordes when I couldn’t find a “Notes” checkbox in the syncing prefs, but it turns out all you have to do is save the note on any IMAP account (must have “Store notes in Inbox” option checked under Mailbox Behaviours) and then check your mail on the iPod.
Posts
Networked Syslog
Centralized logging can be a Really Good thing and something that I think every SA should consider if they have more than 1 system to look after. Unfortunately Apple’s documentation on the subject is only correct for the client side, however:
"To configure Mac OS X Server as a log server that accepts log messages from other systems on the network: 1 Open /etc/rc and locate the following line: /usr/sbin/syslogd -s -m 0" .
Posts
Twenty Hours of Risk
As I understand, my biggest gripes with the Drobo (noise, heat, slow speed, no FireWire) have been fixed in the 2.0 version. However there’s one thing that is not mentioned anywhere on the product pages:
… namely the insane amount of time it takes to rebuild the set. I just thought it would be nice to upgrade the last 300 GB drive to 500 GB. It’s been doing that for the past 4 hours and by the looks of it I’ll be sleeping with earplugs tonight.
Posts
Generating Passwords
There’s no shortage of ways to generate passwords on a Mac. I used to like Xyzzy, until I realised it’s really not that good. Keychain Access is fine for quickly generating one random password for, say a MySQL account, but isn’t really appropriate for creating password lists. There’s also plenty of cool tricks to generate them from within “the BSD subsystem”, but I always seem to forget them when the need comes.
Posts
Mail.app From Menu
To cut a long story short - how do you define multiple “From:” addresses for an email account in Mail.app?
I always thought you’d just have to create a separate account. But what if the 2 accounts are actually on the same server? Mail.app won’t allow you to create two account with the same incoming server host name.
It turns out this is all very simple - just add the From: addresses to the Email Address: field in the Account Information tab, separated by commas.
Posts
More on iCal Server
I would like to take this opportunity to vent some steam over Apple iCal Server. I was going to simply file a bug about this, but even that didn’t work. :-/
Yeah, that’s what I get for some groups after the 10.5.6 server update. “domain CalDAV No Calendar Home Error / code 1” - WTF!!!! And the web is full of these reports. I can browse the principal just fine from a web browser at https://server:8443/principals/groups/whatever/ but iCal just won’t work.
Posts
Antivirus Is the Virus
Today I was reminded again of the fact that the only current virus-related threat on OS X are the antivirus software themselves:
That’s 442 different VirusBarrier processes spawned off for no apparent reason in a totally normal user environment (Mail, Safari, TextMate etc). I noticed the problem when I tried to open an SSH connection but got the following error instead:
-bash: fork: Resource temporarily unavailable That means the system has exceeded the limit of processes per user, which in Leopard is already pretty generous:
Posts
A Deployment Plan
I’m just finishing up my biggest deployment project yet - 72 Macs (70 iMacs and 2 Mac Pro’s). 21 iMacs got new 1TB drives, all were upgraded to 4GB RAM and all of them went out in 4 different software configurations. With this sort of job, it really helps to have a plan. Here’s one:
Planning and preparation Determine how many different software configurations you have and how they relate to each other; name them.
Posts
Deploying Lightroom 2
I was pleasently surprised with Adobe today. Turns out Lightroom 2 is really simple to deploy:
Download and install Adobe Photoshop Lightroom 2.1 Launch the app and when prompted, enter you Volume License number. Open /Library/Application Support/Adobe/Lightroom copy “Lightroom 2.0 Registration” to some shared storage. Drop the registration file in the same place on any deployment target. I think I like Lightroom even more now. :P
Posts
Got ACSA
Passed the final exam in Apple’s ACSA certification trail today and thought I’d write down some thoughts.
First of all, I’m really glad that the ACSA cert exists. It gives working geeks something to strive for, something meaningful to show when applying for a job and not to mention some much-needed leverage for negotiating a raise. It’s also just a great way to learn new stuff, which becomes harder and harder as you become the “go-to-guy”.
Posts
Monitoring Load Average
Probably the most general indication that something’s wrong with a server is an unusually high load average. Typically this will be a stuck DirectoryService or httpd or imapd process which is then slowing everything down. Luckily it’s pretty simple to keep tabs on load average, for example by using the following script:
MAILTO="filipp@mydomain.tld" COOKIE=/private/tmp/loadcheck LOAD=$(uptime | awk {'print $11'} | sed 's/,/./') SUBJECT="$(hostname) is under heavy load!" if [[ -e $COOKIE ]]; then exit 0 fi BODY="$(ps -rax | head -n 4)" if [[ $(echo "print $LOAD > 1" | bc) -eq 1 ]]; then echo $BODY | mail -s "$SUBJECT" $MAILTO touch $COOKIE fi exit 0 This will send the email only once and you’ll have to delete the cookie to reset it.
Posts
iLife Installer Workaround
If you’ve ever tried to build a deployment image directly from individual iLife packages (onto say a sparse image), then you’ve no doubt seen this error message:
installer: Error - You are attempting an unsupported installation. If you wish to install an individual application, please use the iLife installer and select the Custom button. Bummer. Well, luckily there’s a really simple workaround:
touch /tmp/com.apple.mpkg.iLife and then run installer again.
Posts
Macup 1.0
Why yet another rsync wrapper for the Mac? Because I really felt there was’t one that met my needs:
Simple Finder-based source selection - just label everything important with the Violet label. Exclusion list support - if there’s anything inside the important folder that you don’t want to back up (say Microsoft User Data in you Documents), just mark it with a Gray label Added flexibility via Smart Searches - just save a search as “Macup” to really fine tune your selection criteria.
Posts
Pretty Weak
… and it’s been like that the whole day. Who cares though, mobilemeisdown is up. :D
Posts
OpenFire vs iChat Server
I turned to OpenFire shortly after discovering that iChat server doesn’t support group-based buddy lists. There’s only the really crude jabber_autobuddy script, but even that has to be run every time you add a user and sometimes users get stuck at a “Waiting for authorisation” message. No thanks.
A list of things I really like about OpenFire:
Support for group-based buddy lists Conference support and chatroom management Has a real admin interface Can work with any LDAP server Runs on 10.
Posts
mailspray
Some months ago I attended a Symantec Mail Security training course (a kickass system, btw). They had this little graphical testing utility which accepted an SMTP server address, from field, etc and a list of .eml files and the number of copies to send.
I thought this was a brilliant tool and was pretty surprised to not find an equivalent on the Mac. However, OS X being Unix, it took about 30 minutes to write one myself, this time in Ruby:
Posts
Cascading Software Update Server
Page 307 of Mac OS X Deployment v10.5 says to change:
<key>metaIndexURL</key> <string>http://swscan.apple.com/content/meta/mirror-config-1.plist</string> to
<key>metaIndexURL</key> <string>http://sus.pretendco.com:8088/index.sucatalog</string> in /etc/swupd/swupd.plist to cascade updates from one SUS to another. My experience has been that it’s incorrect. Here’s the line that works:
<key>metaIndexURL</key> <string>http://sus.pretendco.com:8088/catalogs.sucatalog</string> index.sucatalog lists the actual update packages themselves whereas we want a list of SU servers. catalogs.sucatalog looks exactly like mirror-config-1.plist, except that it lists your master SUS’s address.
Posts
Turned 0x1C
There’s now two dashboard widgets that I find actually useful, the first is the excellent dashLicious and the second, the newborn DashLog:
It allows you to remotely monitor any log file (using good old tail -f). All you need is the widget, some SSH hosts defined in your .ssh/config and passwordless authentication configured. On the back you can select some typical log files or define a custom one:
This thing’s straight out of the oven so there will probably be some stinky bits in there.
Posts
mc pkg
In an attempt to avoid using the Finder as much as possible until Apple rebuilds it from scratch, I’ll be using mc. :P
Here’s the 4.6.1 PKG inside a DMG. Built from MacPorts, ofcourse.
Posts
Templar
So you’ve just finished up setting up the new server at the office and now you need to send account info to 45 people. You can make an email template and then find/replace each user’s info in or just create a generic one (ie afp://newserver/yourusernamehere). The first is tedious and error prone, the second seems fine… until you get emails from 25 people who are not able to log in because they just click the link and their password doesn’t work.
Posts
rtorrent pkg
Some people have been asking me about rtorrent and where to get it for the Mac. It’s in both fink and MacPorts, but if you think that installing a whole package management stack is a bit overkill for a nice BitTorrent client, I’ve compiled an internet-ready (yay!) DMG using MacPorts. You can download it from here.
At 6.8MB it includes a lot of stuff you would normally never need, like the header files of libtorrent and all support libraries.
Posts
AppleScript's path to me
Just something to be aware of:
POSIX path of (path to me) & "Contents/Resources" as string -> "/Users/flepalaa/Desktop/Backup.app/Contents/Resources" property myPath : POSIX path of (path to me) & "Contents/Resources" as string set the result to myPath -> "/Applications/AppleScript/Script Editor.app/Contents/Resources" Apparently the latter is what path to me was “supposed” to mean before 10.5. AppleScript makes me want to smoke crack. :P
Posts
serveradmin settings indices
There’s one more really annoying thing with serveradmin:
mail:~ file$ sudo serveradmin settings vpn:Servers:com.apple.ppp.pptp:IPv4:DestAddressRanges:_array_index:0 = \"10.64.200.200\" vpn:Servers:com.apple.ppp.pptp:IPv4:DestAddressRanges:_array_index:0 = "10.64.200.200" mail:~ file$ sudo serveradmin settings vpn:Servers:com.apple.ppp.pptp:IPv4:DestAddressRanges:_array_index:1 = \"10.64.200.254\" Invalid index "1", must specifiy array elements in order Index = 1, count = 0, currentArray = () for key: "vpn:Servers:com.apple.ppp.pptp:IPv4:DestAddressRanges:_array_index:1" And actually the manpage doesn’t say anything about how to work with numeric indices:
“When setting array values, special notation is needed.
Posts
serveradmin settings all
Trying to back up 10.4 server settings, you might run into this gross serveradmin bug:
machine:~ root# serveradmin settings all > all.sabackup 2008-09-01 14:34:43.994 serveradmin[12811] Exception in doCommand: *** -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0) serveradmin(12811,0xa000ed88) malloc: *** Deallocation of a pointer not malloced: 0x15c3bc0; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug But luckily it’s easy to work around with a little bit of shell:
Posts
serveradmin settings & IP addresses
In 2005 I complained about a bug in serveradmin which resulted in garbled input when using IP numbers. It’s not just with DNS either, the same problem exists also with VPN settings. 10.4.11 has this bug as well:
machine:~ root# serveradmin settings \ vpn:Servers:com.apple.ppp.pptp:IPv4:DestAddressRanges:_array_index:0 = "192.168.2.200" vpn:Servers:com.apple.ppp.pptp:IPv4:DestAddressRanges:_array_index:0 = 192.167999 Gross. Here’s the “workaround”:
machine:~ root# serveradmin settings \ vpn:Servers:com.apple.ppp.pptp:IPv4:DestAddressRanges:_array_index:0 = \"192.168.2.200\" In other words, shell is chomping the quotes and serveradmin gets confused with the dotted quad.
Posts
GoogleConverter
A fun little project that could work well in an “intro to practical programming” course:
filipp@probook.local [~] > gc 14 in in cm 14 in = 35.56 centimeters Wait, but we already have units(1)! Yes, but can it do this:
filipp@probook.local [~] > gc 14,9 usd in eur 14,9 U.S. dollars = 10,1650976 Euros All a whopping 8 lines of PHP (the working man’s language):
#!/usr/bin/env php <?php array_shift ($argv); if (count ($argv) == 0) die ("Not enough arguments\n"); $q = implode ("+", $argv); $c = file_get_contents ("http://www.
Posts
last.fm and WebClip
When WebClip was first demoed I thought it was the coolest thing ever. About a year (?) later, I finally found a use for it - a lightweight last.fm radio player.
Go to your last.fm > Listen File > Open in Dashboard Hover over the Flash player, click + Enter Flip the widget and uncheck “Only play audio in Dashboard”
Posts
Going Oldschool
This site has been majorly downgraded today. I ditched the old XML-RPC blog engine and replaced it with a shiny, yet totally oldschool text file based solution. Sure, it doesn’t have comments or categories, but there’s something incredibly liberating to sit here and blog using nano over SSH.
The RSS should work, and an Apache Redirect makes sure the old RSS links still work, but previous links to old stories have not been remapped (the new system just uses the text file’s mtime’s timestamp as the ID, while the old one used a counter).
Posts
Migrating Group Wiki Pages
It’s surprisingly difficult to transfer entire wikis between groups since it’s not just a matter of copying static HTML files as I thought previously. Here’s a rough sketch of the process. It worked for me, but might not for everyone.
# wikimove from to SRC=$1; DST=$2 cd /Library/Collaboration/Groups # Take a backup cp -r $SRC $SRC.bak; cp -r $DST $DST.bak # Transfer the old search indices sqlite3 $SRC/wiki/index.db .dump | sed 's/groups\/$SRC\//groups\/$DST\//' | sqlite3 $DST/wiki/index.
Posts
Use Expect for SMTP testing
I learned about Expect from a past ADC video session about OS X deployment. Here’s a very practical use for it - testing an SMTP server. Just run it with expect filename.
spawn telnet smtpserver 25 expect "220 " send "MAIL FROM:test@example.com\r" expect "250 Ok$" send "RCPT TO:testuser@server\r" expect "250 Ok$" send "DATA\r" expect "354" send "From: "SMTP Test" <test@example.com> Subject: This is a test Date: Wed, 02 Jul 2008 15:08:43 +0000 Body of test message r.
Posts
About Leopard's group mail handling
Just some observations on how 10.5.4 server handles group mails and aliases:
Mail > Settings > Mailing Lists > Enable server group … tells the server to scan all groups that have “Mailing list” enabled and update group member addresses into /etc/postfix/aliases. It uses the user record’s Info > Email data. I would suggest setting the scanning to 1 min when setting things up. It uses /etc/postfix/aliases Nested groups are not expanded :( Users with only the Primary Group ID set to a mailinglist-enabled group will not be included in the postfix alias.
Posts
Moving .forward files to postfix aliases
I don’t like .forward files. They destroy any hope of having any kind of idea what aliases are being used. Postfix aliases are pretty bad too, but at least they’re all in the same place.
Here’s a handy and very simple PHP snippet that converts .forward files to postfix aliases. It’s not perfect, especially if you have vacation autoresponses enabled (ie |/bin/vacation -a …), but it does save time:
#!/usr/bin/env php <?
Posts
Testing for Power v2
A while back I presented a solution to a pretty icky problem - how to test for intermittent power issues. Here’s a slightly improved version of that script. It keeps the machine on for 2 minutes before shutting down and also keeps an activity log. The delay is also used as the power on interval.
if [[ $USER != "root" ]]; then echo "This must be run as root" exit 1 fi ROOTPW="1234" DELAY=120 LOGFILE=~/Desktop/poweron.
Posts
PurpleSync
Here’s a pretty neat little AppleScript (did I just say that?!) for backing up random bits of your home folder. Just flag anything with the Purple Label in the Finder and PurpleSync will pick it up and back it up to a destination of your choosing, which it will prompt for only once (delete the pref file to reset).
If you only have Apple’s rsync (2.6.3), then this will unfortunately butcher the extended attributes (like the label) and ACLs, since it does not understand the -X and -A arguments.
Posts
makeuser
The inability to create user accounts from the command line is something that every Mac SA runs into at some point. Then we write our own scripts (here’s mine, here’s dre’s, for example).
But then today I discovered this:
zulu-30:~ admin$ /Library/Receipts/RemoteDesktopClient.pkg/Contents/Resources/makeuser ERROR: You must be root to run this tool. ERROR: --longname not provided. ERROR: Flag --shortname not provided. makeuser -r "<volume path>" [ -0 -v -h ] {other options} General Options: ---------------- -h | --help : Print command help.
Posts
ddrescue AppleScript Applet
As said before, ddrescue is a really great data rescue utility. I’ve made a really simple AS application wrapper for it. Just name the applet, for example, “ddrescue-disk2s3”, copy it on your backup drive, launch and give sudo your password.
It functions just like the shell snippet I, but contains the ddrescue binary so it’s super easy to move around, also you don’t have to edit any text files - just put the failing drive’s /dev name in the app name.
Posts
Restarting an Installation
I recently had to re-partition a 10.5 server just after the install had been done (the boot partition turned out too small). The server was completely headless at that point and I couldn’t just resize the parts using diskutil because this was all on RAID 5.
There’s an interesting “feature” in Server Assistant - the server will eject any optical media until you get to the serial number part. I tested this several times and the results were consistant.
Posts
procatcher.sh
I a while back I wrote a short tutorial on how to get stuff from a DVB PVR onto DVD-s using a Mac (many thanks to all who wrote in and left comments!).
I’ve since been able to refine the method and get it down to just a few simple steps:
Decode and edit the AVR files using ProjectX as explained Run procatcher.sh on the ProjectX output folder, giving the name of the DVD volume that you’d like as the second argument (better keep it within 8 characters and without spaces).