Archive for the ‘software’ Category

readable IOMessage errors

Monday, April 21st, 2008

perror() has it’s uses, but sometimes it’s more convenient to just have a string translation for the global error.
awk '/#define/ {
if(match($0,"[/][*][ ]*.+[*][/]"))
{
a=substr($0,RSTART+3,RLENGTH-6)
}
else a="";
printf " case %s : return \"%s - %s\";\n",$2,$2,a;
next
};
/^#/' /usr/include/sys/errno.h

You can make something similar for IOMessages
awk '/#define/ {
printf " case %s : return \"%s\";\n",$2,$2;
next
};' '/Developer/SDKs/MacOSX10.5.sdk/System/Library/
Frameworks/IOKit.framework/Versions/A/Headers/IOMessage.h'

removing meta-annoying

Monday, April 21st, 2008

xattr -l -p com.apple.quarantine ~/Downloads/*

CUPS docs

Sunday, December 9th, 2007

CUPS PPD extension spec
Apple Q&A 1352
Printing with Cocoa

netbooting

Tuesday, November 27th, 2007

Did you ever want to netboot one machine by plugging it in to another one that’s running a netboot server? If the "server" is running mac OS X 10.5 … well, here is one way to skin the cat:

bash-3.2# cat /etc/bootpd.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>bootp_enabled</key>
	<false/>
	<key>dhcp_enabled</key>
	<string>en0</string>
	<key>netboot_enabled</key>
	<string>en0</string>
	<key>Subnets</key>
	<array>
 		<dict>
 			<key>name</key>
 			<string>10.0.4.0</string>
 			<key>net_address</key>
 			<string>10.0.4.0</string>
 			<key>net_mask</key>
 			<string>255.255.255.0</string>
 			<key>net_range</key>
			<array>
				<string>10.0.4.2</string>
				<string>10.0.4.9</string>
			</array>
 			<key>allocate</key>
			<true/>
 			<key>dhcp_router</key>
 			<string>10.0.4.1</string>
 		</dict>
        </array>
</dict>
</plist>

Don’t forget that you also need to make sure tftp is running and not blocked by a firewall, and that you copied all the appropriate resources into /private/tftpboot. You may need to create a folder and a symlink like this:

bash-3.2# mkdir -p /private/tftpboot/private
bash-3.2# ln -s .. /private/tftpboot/private/tftpboot

and copy things over with something like this:

bash-3.2# cd /Library; find NetBoot -name ppc -o -name i386 | xargs tar -c |tar -x -C /private/tftpboot

then make sure that this file looks like this (note the -s option):

bash-3.2# cat /System/Library/LaunchDaemons/tftp.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>Disabled</key>
	<false/>
	<key>Label</key>
	<string>com.apple.tftpd</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/libexec/tftpd</string>
		<string>-s</string>
		<string>/private/tftpboot</string>
	</array>
	<key>inetdCompatibility</key>
	<dict>
		<key>Wait</key>
		<true/>
	</dict>
	<key>InitGroups</key>
	<true/>
	<key>Sockets</key>
	<dict>
		<key>Listeners</key>
		<dict>
			<key>SockServiceName</key>
			<string>tftp</string>
			<key>SockType</key>
			<string>dgram</string>
		</dict>
	</dict>
</dict>
</plist>

You can start the tftpd using launchctl:

bash-3.2# launchctl load /System/Library/LaunchDaemons/tftp.plist
bash-3.2# launchctl start com.apple.tftpd

You need to serve the image somehow. In 10.5 and later the default webserver is Apache 2.2 so serving images larger than 2 GB is no problem. You can turn on Web Sharing in System Prefs and then make a symlink like the one above.

Did I forget anything? Oh yeah. You need to create a NetInstall image with System Image Utility. And don’t forget to create the require ".sharepoint" symlink:

bash-3.2# ln -s NetBootSP0 /Library/NetBoot/.sharepoint
bash-3.2# ln -s /Library/NetBoot /Library/WebServer/Documents/NetBoot
bash-3.2# /usr/libexec/bootpd -d

hacking WWAN for the MC727

Tuesday, November 13th, 2007
<key>AppleWANDeviceNovatelUSB</key>
<dict>
 <key>CFBundleIdentifier</key>
  <string>com.apple.driver.AppleWWANSupport</string>
 <key>IOClass</key>
  <string>AppleWWANSupport</string>
 <key>IOProbeScore</key>
  <integer>10000</integer>
 <key>IOProviderClass</key>
  <string>IOUSBDevice</string>
 <key>idProduct</key>
  <integer>16640</integer>
 <key>idVendor</key>
  <integer>5136</integer>
</dict>

backing up with rsync

Monday, October 1st, 2007

rysnc is a handy tool.

remoteHost=some.host.somewhere
remote_vol=/Volumes/backupDrive
remote_path=${remote_vol}/myComputer
rsh_command="ssh -i ~/.ssh/id_dsa -l myUserAcct"

rsync -avzR --no-implied-dirs --exclude=Library**Caches/ --delete-excluded --rsh="${rsh_command}" "${localDirs[*]}" ${remoteHost}:${remote_path%/}/

Cascading Style Sheets, level 2

Wednesday, September 26th, 2007

The CSS2 Specification
http://www.w3.org/TR/REC-CSS2/

command line options for G3 playback

Tuesday, September 25th, 2007

... -i /Volumes/... -6 stereo -b 900 -w 512 -m -f mp4 -e ffmpeg -o thing.m4v -L

display directory usage size

Tuesday, July 31st, 2007

~ $ du -k -c -L|grep -E "^[0-9]{5,}"

Nokia theme zipper tutorial

Tuesday, July 31st, 2007

For those interested in creating Nokia series 40 themes on a platform other than Windose, here follows a quick few lines of code that will facilitate packaging your effort of labor into something useful:

~ $ cd themeFolder~/themeFolder $ zip -j -l -X ../wondertheme.nth theme_descriptor.xml~/themeFolder $ zip -j -X ../wondertheme.nth *.{png,mid,jpg,gif}

Leave a comment to request more about this.