Dec 17, 2011

iPad, iPad 2, AppleTV & 5 Ghz WiFi


At home, I have never been able to connect my iPad 2 or AppleTV to my 5 Ghz WiFi network. I can see my 5 Ghz wireless access point ID (SSID) listed and do get prompted to enter my password, but the result is a cryptic message "Unable to Join Network" with no additional details.


"To allow your iPad, iPad 2, and AppleTV to connect to your 5 Ghz WiFi - if you have set your router set to '802.11N Only' mode - turn on your WMM setting (in the QoS section). Or change your 5 Ghz SSID to use 'Mixed Mode' instead of "802.11N Only' mode."

Finally I found a solution thanks to this post in the Apple discussion forums. To summarize, to optimize my home wireless I have my 2.4 Ghz SSID set to mixed mode to allow my devices which don't support 802.11N to connect to my WiFi using 802.11G. On my 5 Ghz SSID, because I do not have any 802.11A devices, I have it set to use '802.11N Only'.

I had off and on tried to find a solution and the best answer I seemed to come up with were some obscure posts saying that the iPad/iPad2/AppleTV do not support 40 Mhz Channel Width on the 5 Ghz band... However changing between 20 Mhz Only, 40 Mhz Only or "Auto Select" had no effect for my iDevices, but it did slow down my WiFi speed on my laptop.

I found the solution to this connection issue surprising. There are two options I have confirmed to work. The first solution was to change my 5 Ghz SSID setting from "N Only" mode to "Mixed Mode" and restart. My iDevices connected no problem with "40 Mhz Channel Width" selection. Digging a little deeper the better solution (for me) was to keep the "N Only" setting but in my Quality of Service tab of my router settings turn on WMM support.

https://discussions.apple.com/thread/2780119?start=0&tstart=0

Jun 3, 2011

Memory Fu, a very cool and intriguingly fun game now in the App store

A great, simple, yet intriguingly fun game with an entertaining narrative component (rarely seen in some of the more simple games).  Technically a very well crafted game, with a specific objective to keep things simple and fun, also boasts a very cool classic/retro Japanese style - both for the simply animated characters, the sound effects, and the music. It's not angry birds, but it is a great game.

Additionally, the developer, Brian DeWeese (http://briandeweese.wordpress.com), is a really cool guy who deserves your $0.99 for the crazy good game he's pushed out in record time; so, take a look and give Memory Fu your support.

Apr 11, 2011

Building 3rd party stuff for linking inside your .app wrapper / bundle

I posted this in response to a discussion thread on the Homebrew mailing list and thought I would post it to my blog for SEO and for myself when I need to look into this more at a later date. - sean

I spent a little time trying to figure relative linking out with [Home]brew as apposed to linking a hardcoded '/use/local/...'. I have not spent much time at this yet, but when building libraries with Xcode for including in my OS X App bundle's '@executable_path' is used instead of a full hard system path. You can get info about your compiled libraries and dependencies with 'otool -L':
$ otool -L libboost_filesystem-mt.dylib libboost_filesystem-mt.dylib:
    @executable_path/../Frameworks/libboost_filesystem-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    @executable_path/../Frameworks/libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
You can change your dylib's dependency path's with 'install_name_tool'. Given a binary 'MyBinary':
$ otool -L MyBinary MyBinary:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
    /usr/local/lib/myLib.dylib (compatibility version 1.0.0, current version 1.0.0) 
$ install_name_tool -change /usr/local/lib/myLib.dylib @executable_path/../Frameworks/myLib.dylib MyBinary
Whenever we recompile however we'll need to re-run install_name_tool. It turns out the root issue is how myLib.dylib was built... To fix this update the Makefile that generated myLib.dylib, and change it, adding the -install_name flag to the libtool line which might then look something like this:
libtool -dynamic -flat_namespace -install_name @executable_path/../Frameworks/myLib.dylib \ -lSystem -compatibility_version 1.0 -current_version 1.0.0 \ -o myLib.dylib -undefined suppress $(OBJS)
I'm still interested in a fairly generic way to shoehorn this into common configure scripts, but I haven't looked into it much at this point; it's just on my to-do list. I don't have an easily available comprehensive list of all the options I used, but these might assist others a bit:
CFLAGS="-arch x86_64 -arch i386" [-arch ppc] <- If you are building for PPC (or even can)
LDFLAGS="-arch x86_64 -arch i386" [-arch ppc]
building for backwards compatibility to an older SDK:
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch x86_64 -arch i386"
You may need to add this flag to configure (when building fat binaries):
./configure --disable-dependency-tracking
You can also use the 'file' command or 'lipo -info' to check if 'fat' or 'slim' and or what architectures it's build for:
$ file libboost_filesystem-mt.dylib     libboost_filesystem-mt.dylib: Mach-O universal binary with 2 architectures
    libboost_filesystem-mt.dylib (for architecture x86_64): Mach-O 64-bit executable x86_64
    libboost_filesystem-mt.dylib (for architecture i386): Mach-O executable i386
[ update 2011.04.11 @ 19:15 PT ]
Some more related info I found... "@rpath" may be better than "@executable_path"
http://www.dribin.org/dave/blog/archives/2009/11/15/rpath/

Mar 29, 2011

Quickies (I'll want to find these again in the future)

Hide or un-hide a file or folder from the OS X Finder:
> chflags nohidden ~/Library
> chflags hidden ~/bin

Customize your zsh prompt (a bit over the top, but hey — it's flexible!)
Oh My Zsh! on GitHub @ http://github.com/robbyrussell/oh-my-zsh


[ updated 20110330 @ 00:00:31 by Sean Roehnelt ]


- eom

Feb 17, 2011

Tron, Daft Punk, Tron: Legacy

It's a cool world, I'm sure Daft Punk was influenced by Tron; Tron: Legacy however took all of it's inspiration from Daft Punk.

The movie is good because it stands on the shoulders of Daft Punk's masterful soundscape and music. I don't know if there's a name for this type of relationship (other than maybe self referential possibly?), but it's cool shit! Sort of like the first time you wrap your brain around writing a C compiler in C. Initially difficult to grasp and later makes perfect sense to the extent you can't imagine a more logical creation path or process. Until I think of-or learn a better term I'll refer to the concept as a 'Beeblebrox'. Ya, him, Zaphod Beeblebrox, due to his "semi-half-cousin" relation of sharing "three of the same mothers" as "Ford Prefect" via "an accident with a contraceptive and a time machine" and the fact his direct ancestors from his father are also his direct descendants. I digress… In any case, the Tron: Legacy soundtrack is some of my favorite music; right up there with Pink Floyd.

- eom

Feb 15, 2011

Your MacBook can sleep smarter

I love my MacBook Pro, it's my primary computer actually and I used it for just about everything email, surfing, writing, and programming. I don't even think this is odd at all anymore as most of my friends and co-workers use laptop's as their primary computers; I suspect it could be the normal case at this point.

On several occasions when I've come back to my computer I've been surprised to find it powered off, weird, so I press the power button (I use the power button so seldomly that it feels a bit odd because the button is perfectly flush mounted which I apparently forget from time to time). Next, also to my surprise, it wakes from hibernation so I check ... sure enough the battery is almost dead. My wife or a family member must have unplugged it or tripped over the cord detaching the mag-safe power connector. I very much appreciate the SafeSleep functionality but it really needs to be a little smarter in my opinion. It just needs an additional hibernation timeout setting to save even more battery in instances like I've had.

I've been using iPhones for nearly 3 years and my iPad for almost a year and it's surprising to me that my unibody MBP hasn't learned the same tricks already. So, thinking I must be missing an obvious power setting somewhere I poked around apple's support forum's but wasn't able to find any useful information. It happened again recently and I dug a little deeper. I didn't find a way to setup sleep as I've described but I did find a way to use SafeSleep when connected to AC Power and switch to hibernation sleep when running on your battery. Doing so requires Terminal but the command is quick and easy.

Let's define a few terms for clarity:
Sleep
The default on supported desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep.

SafeSleep
The default on supported portables. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from disk image.

Hibernation
Only settable via the 'pmset' command. The system will store a copy of memory to persistent storage (the disk), and will remove power to memory. The system will restore from disk image. If you want "hibernation" - slower sleeps, slower wakes, and better battery life, you should use this setting.

DeepSleep
Activates kernel power management to automatically hibernate a machine after it has slept for a specified time period. This saves power while asleep. This setting defaults to ON for supported hardware. DeepSleep only works if Hibernation or SafeSleep are turned on.
Yes, DeepSleep is exactly what I want, but why isn't it working then if it "defaults to ON"? Oh, "for supported hardware"...
The setting 'DeepSleep' will be visible via 'pmset -g' if the feature is supported on this machine.
OK. Let's see what's supported on my unibody MacBook Pro (MacBookPro5,4). Open Terminal and type the command 'pmset -g' and the return key. You should see something similar to:
pmset -g
Active Profiles:
Battery Power -1
AC Power -1*
Currently in use:
hibernatemode 3
halfdim 0
lidwake 1
acwake 0
womp 1
sleep 30
disksleep 10
sms 1
hibernatefile /var/vm/sleepimage
ttyskeepawake 1
displaysleep 15
Nope, not supported. I think the 2nd generation MacBook Air may be the only laptops that support DeepSleep at the time of this post... It looks like we can however enable Hibernation when we are not running on AC Power. Here are the commands I use, tweak them to your preferences:

My Hibernation setting when running on battery power
$ pmset -b hibernatemode 25 displaysleep 5 disksleep 3 sleep 30 womp 1 lidwake 1 acwake 1 lessbright 1 halfdim 1 sms 1
My SmartSleep setting when running no AC power adapter

pmset -c hibernatemode 3 displaysleep 10 disksleep 10 sleep 30 womp 1 lidwake 1 acwake 1 lessbright 1 halfdim 1 sms 1
pmset arguments (excerpt from 'man pmset'):
hibernatemode
change hibernation mode. Please use caution. (value = integer) [3, and 25 are safe. You don't want to use 0 on a portable. ]

displaysleep
display sleep timer; replaces 'dim' argument in 10.4 (value in minutes, or 0 to disable)

disksleep
disk spindown timer; replaces 'spindown' argument in 10.4 (value in minutes, or 0 to disable)

sleep
system sleep timer (value in minutes, or 0 to disable) [only effects the timeout, not the sleep mode]

womp
wake on ethernet magic packet (value = 0/1) [wired ethernet only has no effect over wifi]

powerbutton
sleep the machine when power button is pressed (value = 0/1)

lidwake
wake the machine when the laptop lid (or clamshell) is opened (value = 0/1)

acwake
wake the machine when power source (AC/battery) is changed (value = 0/1)

lessbright
slightly turn down display brightness when switching to this power source (value = 0/1)

halfdim
display sleep will use an intermediate half-brightness state between full brightness and fully off (value = 0/1)

sms
use Sudden Motion Sensor to park disk heads on sudden changes in G force (value = 0/1)

hibernatefile
change hibernation image file location. Image may only be located on the root volume. Please use caution. (value = path)