On Top Of the World!

ontop

|
UnitInfo and Punk Released
Available on the Software page. Huge thanks to Martin for the graphics and UI design!

|
Software Warranty
I find it disturbing that most F/OSS programs have a big disclaimer about not having any warranty. It leaves the impression that closed commercial programs do, which 99,99% of time isn't the case. :)

|
Replacing Apple's PHP
Needed to get gd2 support so thought why not as well update to latest 4.x PHP:

For JPG support, you'll ned libjpeg which won't compile directly. From the instructions here I found that you should simply:

> export MACOSX_DEPLOYMENT_TARGET=10.4
> ln -s `which glibtool` ./libtool
> cp /usr/share/libtool/config.sub .
> cp /usr/share/libtool/config.guess .


then just "configure --enable-shared" etc

LIBPNG
>curl -O http://surfnet.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.12.tar.gz


Don't bother with the no-config option, it can't find ZLIB.
>./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking --with-apxs --with-ldap=/usr --with-kerberos=/usr --enable-cli --with-zlib-dir=/usr --enable-trans-sid --with-xml --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-dbx --enable-sockets --with-iodbc=/usr --with-curl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc --with-mysql=/usr --with-mysql-sock=/var/mysql/mysql.sock --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-openssl=/usr
> make && sudo make install


And you should have PHP 4.4.4 with gdlib and OS X Server didn't notice a thing :P

Some stuff also from Apple, although IMHO Fink is overkill in this case:
|
What's SourceCache?
Working with different tools in OS X, you'll often notice these paths show up in console.log:
/SourceCache/JavaScriptCore/JavaScriptCore-418.3/bindings/objc/WebScriptObject.mm
/SourceCache/apache_mod_php/apache_mod_php-18.4/php/configure

What are they?
My guess is they're the development environment directories at Apple.

|
A Blast From the Past


|
KDX MacUnix
Copy app to /Applications/KDXServer1600, try and run it. Define shares and link folders if necessary:

ln -s /my/shared/folder /Applications/KDXServer1600/Bases/Default/Downloads.

Create a LaunchDaemon (from haxial.com):

sudo nano /Library/LaunchDaemons/com.haxial.kdxserver.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.haxial.kdxerver</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/KDXServer1600/KDXServer.command</string>
<string>--bkgnd</string>
<string>--nohup</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

Load the daemon:
$ launchctl load -w /Library/LaunchDaemons/com.haxial.kdxserver.plist
$ launchctl start com.haxial.kdxserver


http://developer.apple.com/macosx/launchd.html
man 5 launchd.plist
|
A Better Way
I was really excited about the idea of making a widget that'd ping servers. Finally some use for Dashboard. I was already running GeekTool, but thanks to pea, discovered this. Just add a shell console with this as the contents: "ping -qo address" and set some icons. Perfect!

|
Simply Brilliant


|
When Cron Gets Out of Hands
I noticed cron had been churning away at 82% CPU for the past 140 hours (!). sc_usage and fs_usage came up empty (with the latter crashing) - so did ktrace. Remembering that "crontab -e -u someuser" hung on "Installing new crontab", I checked the tabs dir for any temp files. There were many of them. Ultimately, this seemed to help:

$ rm -rf /var/cron/tabs/tmp.*
$ launchctl stop com.vix.cron

Back to using just /etc/crontab! :-/



|
pidof
Here's one way of recreating that handy utility. I'm assuming that the utility is always run after the program we're looking for, so it has a smaller PID

fiBook:~ filipp$ ps A | grep something | grep -v grep | awk '{print $1;}'

|
MacBook Memory Config Benchmarks
Using XBench and CineBench, it's apparent that MacBook's *are* in fact faster when using two DIMMs of the same size than using a single bigger DIMM. The configuration difference seems to have the biggest impact in graphics performance. Here's a link to the XBench comparison.

For reference, here's my PowerBook CineBench 9.5 results:

Processor : 1,5Ghz PB G4 1,25GB RAM
MHz : 1500
Number of CPUs : 1
Operating System : 10.4.7

Graphics Card : GeForce FX Go5200
Resolution : 1024x768
Color Depth : 24bit

****************************************************

Rendering (Single CPU): 152 CB-CPU
Rendering (Multiple CPU): --- CB-CPU


Shading (CINEMA 4D) : 161 CB-GFX
Shading (OpenGL Software Lighting) : 485 CB-GFX
Shading (OpenGL Hardware Lighting) : 1015 CB-GFX

OpenGL Speedup: 6.32
****

Next we have the 1x1GB config 2.0 Ghz MacBook:
Processor : MB 2GHz 1x1GB
MHz : 2000
Number of CPUs : 2
Operating System : 10.4.6

Graphics Card : Intel GMA950
Resolution : 1280x800
Color Depth : 24bit

****************************************************

Rendering (Single CPU): 307 CB-CPU
Rendering (Multiple CPU): 582 CB-CPU

Multiprocessor Speedup: 1.89

Shading (CINEMA 4D) : 336 CB-GFX
Shading (OpenGL Software Lighting) : 1068 CB-GFX
Shading (OpenGL Hardware Lighting) : 969 CB-GFX

OpenGL Speedup: 3.18

****************************************************

I'll post the 2x512 Results soon...

|
Repair Permissions != Chumbug
Contrary to popular belief, Disk Utility's Repair Permissions function can be very helpful. Here's an example:

Software Update wouldn't work ("There were errors bla-bla-bla). Installing from PKG gave a better error (checking from install log) something about broken DiscRecording Frameworks. Repair Permissions had this to say:

Symbolic link ./System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/Current->A repaired
Symbolic link ./System/Library/Frameworks/DVDPlayback.framework/Versions/Current->A repaired
Symbolic link ./System/Library/Frameworks/DiscRecording.framework/DiscRecording->Versions/Current/DiscRecording repaired
Symbolic link ./System/Library/Frameworks/DiscRecording.framework/Frameworks->Versions/Current/Frameworks repaired
Symbolic link ./System/Library/Frameworks/DiscRecording.framework/Resources->Versions/Current/Resources repaired
Symbolic link ./System/Library/Frameworks/DiscRecording.framework/Versions/A/Frameworks/DiscRecordingContent.framework/Versions/Current->A repaired
Symbolic link ./System/Library/Frameworks/DiscRecording.framework/Versions/A/Frameworks/DiscRecordingEngine.framework/Versions/Current->A repaired
Symbolic link ./System/Library/Frameworks/FWAUserLib.framework/Versions/Current->A repaired
Symbolic link ./System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current->A repaired
Symbolic link ./System/Library/PrivateFrameworks/AppleVA.framework/Versions/Current->A repaired
Symbolic link ./System/Library/PrivateFrameworks/BezelServices.framework/Versions/Current->A repaired
Symbolic link ./System/Library/PrivateFrameworks/Bom.framework/Versions/Current->A repaired

After this and a 10.4.7 Combo Install, the machine worked fine again.

Another example, Activity Monitor wouldn't start, system.log had this to say:

2006-10-17 16:07:18.904 Activity Monitor[21307] The tool is not setuid root - please repair the privileges

Needless to say, repairing permissions fixed the problem. I've also seen cases where no application would launch - meaning you get the "blinking desktop" problem with the Finder constantly trying to start itself up. It was caused by a broken /tmp symlink (which in OS X links to /private/tmp, and we also have /var/tmp!) which Disk Utility nicely repaired.

Repair Permissions is often called the "PRAM zap of the 21'st century" and I agree. But just as a PRAM zap could fix a no-video issue, Repair Permissions can also help sometimes.

|
Getting Stuff Into MySQL
Forget clumsy scripts to load SQL files into MySQL. Here's how it worked for me:

check your php.ini "upload_max_filesize"

$newFile = move_uploaded file ($FILES['yourfile']['tmp_name'], '/var/tmp/yourfile');
$sql = "LOAD DATA INFILE '$newFile'
INTO TABLE db.table
FIELDS TERMINATED BY ',' ENCLOSED BY '\"' ESCAPED BY '\"' LINES TERMINATED BY '\r'";


Strangely, MySQL 4.x doesn't like the "ENCLOSED BY" statement (it works, but will only import the first row)

|
Auto Junkmail Deletion
If You're using the "junkmail@yourdomain" technique to teach your server junk, You can make the server auto-delete learned stuff like this:

$ sudo bash
$ export EDITOR=nano; crontab -e -u cyrusimap
30 13 * * * /usr/bin/cyrus/bin/ipurge -d 1 -f user/junkmail


and if "crontab -e" gives you grief (like hanging and not writing the file), then just edit /etc/crontab

|
Back To Basics vol 2
Just so's I don't ever forget this again. To set up SSH without passwords:
mkdir ~/.ssh
ssh-keygen -t rsa
scp ~/.ssh/id_rsa.pub me@server:~/me/.ssh/authorized_keys2

man ssh

|