category_name=blog%2Fapple

Capturing AirPort Extreme Log with Lion Server Syslog

August 9, 2011 | Comments Off

Mac OS X Lion Server can be used as a syslog server to capture the log messages from an Apple AirPort Extreme wireless router. The instructions below walk you through setting this up.

Syslog is controlled by a plist file found in the launch daemons directory. The full path to the file is:

/System/Library/LaunchDaemons/com.apple.syslogd.plist

You need to edit this file to add a network listener. The plist is stored in a binary format so you need to use the plutil to convert it to XML using this command:

$ pushd /System/Library/LaunchDaemons
$ sudo plutil -convert xml1 /System/Library/LaunchDaemons/com.apple.syslogd.plist
$ sudo vim /System/Library/LaunchDaemons/com.apple.syslogd.plist
$ sudo plutil -convert binary1 /System/Library/LaunchDaemons/com.apple.syslogd.plist
$ sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
$ sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist

Here is a complete example of the modified plist file. The new key is the NetworkListener. Be sure you add it nested inside the Sockets key or it will not work.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnableTransactions</key>
<true/>
<key>EnvironmentVariables</key>
<dict>
<key>ASL_DISABLE</key>
<string>1</string>
</dict>
<key>HopefullyExitsLast</key>
<true/>
<key>JetsamProperties</key>
<dict>
<key>JetsamMemoryLimit</key>
<integer>300</integer>
<key>JetsamPriority</key>
<integer>-49</integer>
</dict>
<key>Label</key>
<string>com.apple.syslogd</string>
<key>MachServices</key>
<dict>
<key>com.apple.system.logger</key>
<true/>
</dict>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/syslogd</string>
</array>
<key>Sockets</key>
<dict>
<key>NetworkListener</key>
<dict>
<key>SockServiceName</key>
<string>syslog</string>
<key>SockType</key>
<string>dgram</string>
</dict>
<key>AppleSystemLogger</key>
<dict>
<key>SockPathMode</key>
<integer>438</integer>
<key>SockPathName</key>
<string>/var/run/asl_input</string>
</dict>
<key>BSDSystemLogger</key>
<dict>
<key>SockPathMode</key>
<integer>438</integer>
<key>SockPathName</key>
<string>/var/run/syslog</string>
<key>SockType</key>
<string>dgram</string>
</dict>
</dict>
</dict>
</plist>

Once you have updated the plist the next step is to update the configuration of your AirPort Extreme. Under Applications => Utilities open the AirPort Utility and connect to your AirPort Extreme. On the Advanced tab select the “Logging & Statistics” panel. Enter the IP address of your Mac OS X Lion Server in “Syslog Destination Address:” and select “6 – Informational” for the “Syslog Level:”. You can see a screenshot of the AirPort Utility settings below. Update the settings on the AirPort Extreme.

AirPort Extreme Advanced Configuration

Now, you probably want to verify that the logging is actually happening. Open Console.app on your server and look at “All Messages”. While looking at the logs go to another machine (I used my MacBook Air with a wireless connection to the AirPort Extreme) and open System Preferences and then Network. Select your network adapter and ask for it to renew the DHCP lease. You should see some activity in the log.

Another way to verify the logging is to turn wifi off on your laptop. You should see a message like this:

8/9/11 8:43:09.000 AM 80211: Disassociated with station 60:33:4b:2c:de:c0

When you turn wifi back on you will see something similar to this:

8/9/11 8:43:10.000 AM 80211: Rotated TKIP group key.
8/9/11 8:43:21.000 AM 80211: Associated with station 60:33:4b:2c:de:c0
8/9/11 8:43:21.000 AM 80211: Authenticating station 60:33:4b:2c:de:c0 to RADIUS.
8/9/11 8:43:21.000 AM 80211: Installed unicast CCMP key for supplicant 60:33:4b:2c:de:c0
8/9/11 8:43:21.000 AM natpmp: Binding added for udp, 173.164.164.17:32770 to 10.0.1.104:4500 with lifetime 7200
8/9/11 8:43:21.000 AM natpmp: Binding added for udp, 173.164.164.17:32771 to 10.0.1.104:5353 with lifetime 7200

That’s it. You now have syslog data being captured on your Mac OS X Lion server from your AirPort Extreme base station!

Heading to Big Nerd Ranch later this month!

October 3, 2010 | Comments Off

One of the podcasts I listen to on a regular basis is called MacBreak. The hosts are Leo Leporte, Alex Lindsay, Andy Ihnatko and a rotating list of other Mac/Apple/iOS luminaries. If you aren’t familiar with it head over to http://twit.tv/mbw and have a listen. It is highly recommended for anyone interested in all things Macintosh (and iOS too).

A few episodes ago Alex Lindsay mentioned that his company was going to be hosting a one week Commuter iOS Class at their San Francisco offices so their team could come up to speed developing applications for iOS devices. The class would be taught by the folks from Big Nerd Ranch. Usually the BNR folks teach classes from their monastery at a secret location just outside Atlanta, Georgia. Having them venture out to San Francisco; wow, what an opportunity. Oh, did I mention that Alex Lindsay also announced that there were a limited number of spots open to the unwashed masses to attend and the class would be held from 2:00 p.m. until 10:00 p.m. each day so folks could continue to do at least part of their day jobs.

All in all this just sounded too good to pass up so I fired off an e-mail to the folks at BNR to let them know I wanted to attend. My fingers were crossed because I know how quickly their classes fill up. Needless to say I wouldn’t be writing this post if I didn’t get in. :-)

So, I’m off to the Pixel Corps offices later this month to soak up some more iOS goodness. Hope to see a few of you there too.

BTW: Here is a link to the course description for anyone curious.

MacBook Pro Development Environment

October 1, 2010 | 6 Comments

This article covers the steps I went through to setup my MacBook Pro for Google App Engine (GAE) development. I am using the Python runtime in GAE so the focus here is on a Python development environment.

Python

Setting Python 2.5 as Default

My MacBook Pro is running Snow Leopard. I am planning to host my projects on Google App Engine and it requires Python 2.5. Snow Leopard ships with Python 2.6 as the default. You can switch to Python 2.5 using a few simple commands, as follows:

$ defaults write com.apple.versioner.python Version 2.5
$ sudo defaults write /Library/Preferences/com.apple.versioner.python Version 2.5

After issuing these commands you should logout and login, launch a Terminal window and issue the command

$ python --version

It should report Python 2.5.4 as the result. If it still says Python 2.6.1 then your change did not take effect. To troubleshoot the problem start with man python. It includes information on how to switch the default version of Python on your system.

Additional Python Modules

Google App Engine expects that the ssl module is installed. This is so it can verify the identity of the GAE servers when trying to deploy your projects. Install it like this:

$ curl http://pypi.python.org/packages/source/s/ssl/ssl-1.15.tar.gz --output ssl-1.15.tar.gz
$ tar xvf ssl-1.15.tar.gz
$ cd ssl-1.15
$ sudo python setup.py install

If you want to use the GAE image manipulation classes while running on the local development server you will need to install PIL using the following command.

$ sudo easy_install pil

The following will be necessary for building some other python libraries later in the process.

$ sudo easy_install docutils

The following modules are necessary if you choose to install IPython (see next section). If you are planning on skipping the IPython installation these can be skipped as well.

$ sudo easy_install readline
$ sudo easy_install nose
$ sudo easy_install pexpect

IPython

The IPython interactive interpreter is a good addition to your Python development environment. It does not come pre-installed on Snow Leopard. You can download the latest stable version using this command:

$ curl http://ipython.scipy.org/dist/0.10/ipython-0.10.tar.gz --output ipython-0.10.tar.gz
$ tar -xzf ipython-0.10.tar.gz
$ cd ipython
$ sudo python setup.py install

Google App Engine SDK

The Google App Engine SDK for Python is available at http://code.google.com/appengine/downloads.html. As of this writing you can use the following command to grab the latest version:

$ curl http://googleappengine.googlecode.com/files/GoogleAppEngineLauncher-1.3.7.dmg --output GoogleAppEngineLauncher-1.3.7.dmg

Once you download the dmg file open it in Finder and run the installer. It will place all of the necessary files on your machine. Once complete locate the GoogleAppEngineLauncher.app icon in Finder and double-click on it. This application provides a nice UI for managing your GAE projects.

Source Code Management Tools

Git

I am planning on managing the source code for my projects with git and will store my master repositories on http://github.com. Apple does not include a copy of git on the machine by default. An installer is available at http://help.github.com/mac-git-installation/. While you are at it also create an account on github if you don’t already have one. It is useful for social coding in the wider open-source community.

Mercurial

Some of the Django open source software I plan on using is maintained using a distributed source control management tool called Mercurial. An installer for this is available at http://mercurial.selenic.com. Download and install the software.

$ curl http://mercurial.selenic.com/release/mercurial-1.6.3.tar.gz --output mercurial-1.6.3.tar.gz
$ tar xvf mercurial-1.6.3.tar.gz
$ cd mercurial-1.6.3
$ make PREFIX=/System/Library/Frameworks/Python.framework/Versions/2.5 all
$ sudo make PREFIX=/System/Library/Frameworks/Python.framework/Versions/2.5 install
$ hg version

Django-nonrel

I plan on implementing my web applications on top of the Django framework. Some modifications are required in order for this framework to run properly on GAE since Google uses Big Table for data storage instead of a relational database. Everything necessary to get Django working in GAE is included as part of the Django-nonrel project. Specific instructions for GAE are available at http://www.allbuttonspressed.com/projects/djangoappengine.

Use the commands listed below to install copies of all the necessary components onto your machine. Everything will be stored in a folder called DjangoStuff under your home directory.

$ mkdir $HOME/DjangoStuff
$ cd $HOME/DjangoStuff
$ hg clone https://bitbucket.org/wkornewald/django-nonrel
$ hg clone https://bitbucket.org/wkornewald/djangoappengine
$ hg clone https://bitbucket.org/wkornewald/djangotoolbox
$ hg clone https://bitbucket.org/wkornewald/django-dbindexer
$ hg clone https://bitbucket.org/wkornewald/django-testapp

Now, pick another folder where you want to setup a practice application. I am calling mine cs-practice since this is also the name of my Google App Engine application.

Use the following commands to configure the practice application for Django-nonrel development.

$ mkdir $HOME/cs-practice
$ cd $HOME/cs-practice
$ ln -s $HOME/DjangoStuff/django-nonrel/django django
$ ln -s $HOME/DjangoStuff/djangoappengine djangoappengine
$ ln -s $HOME/DjangoStuff/djangotoolbox/djangotoolbox djangotoolbox
$ ln -s $HOME/DjangoStuff/django-dbindexer/dbindexer dbindexer
$ cp -r $HOME/DjangoStuff/django-testapp/* .

Once you have the practice folder setup you need to edit the app.yaml file and change the application name to reflect the Google App Engine application name you selected when registering on http://appengine.google.com.

iMac bluetooth problems gone, but how?

August 1, 2010 | Comments Off

My 27″ iMac has been having some very strange bluetooth problems lately. As mentioned in a recent blog post, all bluetooth devices were unavailable according to the operating system. Reboots didn’t fix the problem. Checking through the console logs turned up messages about the bluetooth drivers not working properly. Fortunately I had a USB keyboard so I was able to make a full backup of the system before scheduling an appointment with the genius at the Apple Store.

Now it has been a couple weeks and I have the machine back and Apple didn’t find anything wrong. In fact, they say the bluetooth works fine. I turned everything on and it works fine here too. I had a hunch that this might be the case. Last week my 13″ MBP had the exact same issue. No bluetooth devices would work with it. In this case a full reboot did correct the problem.

So, what bluetooth devices do I have, and which one is misbehaving and causing all of these problems? I don’t know for sure, but I suspect either the new iPhone 4 or the Plantronics Bluetooth Headset I have. The Apple Bluetooth Keyboard and Magic Mouse seem to be working fine. I have noticed other issues with the bluetooth on the iPhone 4 when it syncs with the Alpine IWA-505 head unit in my truck so my money is on the iPhone 4 being the cause in all of these bluetooth problems. Time will tell.

Wireless Keyboards and Mice are Great Until….

July 13, 2010 | Comments Off

Tonight I sat down at my 27″ iMac to get a little work done. The first thing I do is tap the keyboard and move the mouse to wake the machine from sleep mode. The machine awoke and then quickly displayed the Connection Lost graphics in the middle of the screen for both the mouse and keyboard. My first thought; no problem, it’s just the batteries so I replaced them. Still no connection (and it did seem kind of odd for both the mouse and keyboard batteries to be dead at the same time.) Looking up at the system tray I see an odd Bluetooth icon. Here’s a closeup of what I found:

LittleSnapper.png

The Bluetooth: Not Available message in the system tray is not a good sign. Next I opened up Console.app to see if there were any indications of what the root cause for this behavior was. It appears there is truly something wrong with the Bluetooth Module. Here is what it showed:

[AppleUSBBluetoothHCIController][FindInterfaces] some interface pipes were not found. Device is no good a a transport

A visit to the support forums at Apple led me to an idea to reset the SMC on the iMac. I tried that and still nothing. At this point I’m not a happy camper. It is looking like the Bluetooth Module in my iMac has given up the ghost.

Next step, the iPhone Apple AppStore application to make a Genius Bar appointment.

genius.png

If you have read this far then you might be wondering why I’m telling you all of this. The reason is simple. Without a USB keyboard and mouse laying around somewhere none of the troubleshooting above would have been possible. Having a wireless bluetooth keyboard and mouse ship by default with the iMac is a really odd choice on Apple’s part.

Thankfully I have a keyboard and mouse from the Xserve in my garage. In case you forgot what these old fashion beasts look like, here’s a picture of the dynamic duo that saved my bacon tonight!

backup_plan.png

Busy Folks at Big Nerd Ranch!

May 1, 2010 | Comments Off

The folks over at Big Nerd Ranch are really busy these days. In addition to building a new learning center it looks like they are writing no less than three new books to be released this year. If you have ever read through Cocoa Programming for Mac OS X by Aaron Hillegass or had the fortune to attend one of his classes then you already know that these new books will likely become a core part of your programming library in the future.

The first new title is iPhone Programming: The Big Nerd Ranch Guide, written by Joe Conway and Aaron Hillegass. According to Amazon this book will be available for purchase on May 4th in paper form and May 6th for the Kindle. You can pre-order it now.

The second new book is titled More Cocoa Programming for Mac OS X: The Big Nerd Ranch Guide and is being written by Aaron Hillegass and Juan Pablo Claude. According to Amazon’s web site this book will be available in mid-July, 2010. At this point it appears the book will only be available in print form. Hopefully this will change and a Kindle version will be made available.

The third new book will be titled Objective-C Programming: The Big Nerd Ranch Guide and is being written by Aaron Hillegass and Mark Fenoglio. Amazon pegs the release of this book sometime in December, 2010. Cover art for this book has not been released yet.

iPad Review – First 24 hours

April 5, 2010 | Comments Off

My experience with it so far is mixed. Like you I tried to touch-type on the keyboard and that really didn’t work at all. I have tried to do the two finger plus thumbs approach and am not that fast typing like that. The keyboard is big enough that I find it kind of weird to hold it in one hand and type with the other. My hand has to move too far to get all the keys unlike on the iPhone where everything is much closer together. I have not tried to hook up a bluetooth keyboard yet either. I expect that to work much better for things like typing e-mails.

I ended up purchasing the 64GB version instead of the 16GB version. The change was based on a recommendation I heard on MacBreak Weekly. They mentioned that based on their preview use (had it for about a week before April 3rd) they feel that if you are going to use it to read books then you will easily fill the 16GB and then have to pick/choose which items to sync to your iPad. With the 64GB version you can just dump all the books/PDFs you want on it and not worry about running out of space.

I have the Kindle for iPad application on it and pulled down all my Kindle books. Very cool! It just works! I also downloaded the iBooks application from the App Store. That application reads the ePub format. I have purchased a number of technical books in the past few years from Pragmatic Programmers. All of their books are available in ePub format so I downloaded that version and loaded them into the iPad too.

So far I really like having all of my technical books in one place like this. I have not tried reading out in full sunlight, but expect it will be an issue. For reading indoors it works fine. Not as easy on the eyes as the Kindle, but it shows all of the technical illustrations in the books in full color which is much better.

I purchased the Pages, Numbers and Keynote applications from Apple also. They really show off the sort of things you can accomplish with the iPad, but the crash a lot. I feel more like a beta tester of these apps than just a user. Sort of a let down, but then I have been here before with other Apple products. Eventually these will be great applications.

With the iPad I also purchased the Apple case for the iPad. I was really surprised when I opened it up at home. The quality of the case is really bad. It only cost $39, but it sucks compared to the case that Amazon sells for the Kindle. After about 2 hours of using the iPad in the case I got so annoyed with it that now I am using the iPad without a case. I am shopping for a different case now.

I have had Safari crash on me more than once now on the iPad. It seems like the crashes were always on very long (lots of scrolling) web pages so maybe it is a memory issue. I’m not sure, but the end result is you are just reading along on the page and all of a sudden you are back to the menu of icons wondering how you got there.

Even more surprising than the crashes of apps on the device is the crash I experienced this morning of the Xcode development environment on the desktop. Apple released an update to Xcode that includes all of the iPad development tools yesterday. I was working on a sample application this morning, following the instructions on how to build an app when all of a sudden Xcode just up and crashed on me. This is very unusual. Earlier versions of Xcode have been very stable for years.

Over all I think purchasing one as a developer at this point is a good move, but for basic consumers it is probably more sensible to wait about 3 months before jumping on the iPad bandwagon.

Mac Market Share Increasing!

January 17, 2009 | Comments Off

I was at the local library today to do a couple hours programming in a quiet environment without the normal distractions of my home office. To my surprise when I looked around I saw a sea of Apple MacBook and MacBook Pro laptops. Sure, there were a few Toshiba or HP laptops too, but the majority of the machines in the room had shinning bright Apple logos on the screens.

My unscientific survey in the library today yielded the following numbers:

System Count
White MacBook 2
Unibody 13″ Macbook 1
15″ MacBook Pro 2
12″ PowerBook 1
Toshiba 1
HP 2
IBM 1

That breaks down to 60% Apple, 40% Microsoft.

Now that’s what I like to see! Maybe the recent discussion on the macsb about Mac market share isn’t so far fetched after all. Here are a few interesting links:

Who knows if this is all true or not. With the recent announcement that Steve Jobs will be taking a six month leave of absense from Apple due to health concerns the future for Apple is less clear than it once was. I’m sure Apple will do just fine over the next 12-18 months since there are a number of products already in development. The big concern has to be about the sort of innovations that Apple can concieve of and execute on after the current pipeline runs dry. Will there be other folks at Apple with the same vision and forsight as Steve Jobs? Probably, but it is far from certain.

Atleast for now it seems like the market share for Apple will continue to climb. Microsoft will have to hit a home run with the new Windows 7 operating system if they want to fend off the onslaught of Mac OS X. Being a long time developer on both platforms I can say that from my point of view having more users on the Mac makes me happy! I look forward to developing, releasing and selling more applications on the Mac platform.

Software Design: Want vs. Need

January 13, 2009 | Comments Off

I am always surprised at how short-sighted some folks are who design software. It seems like there is no shortage of people who feel that you just have to listen to your customers to build great software. In my experience, if all you do is build what the customer says he/she wants then your software will likely be obsolete in a year (maybe even less time) and your customers will ultimately be very unhappy with you.

To build great software you have to listen intently to what the customer is saying so you can identify the pain and suffering that usually lies unexpressed just below the surface of comments like “All I need is a widget that does X.”

Check out what BusinessWeek magazine had to say about this phenomenon:

“It’s really hard to design products by focus groups. A lot of times, people don’t know what they want until you show it to them.”
– BusinessWeek, May 25 1998

Probably my favorite quote about building great software came from someone on the team that built the NeXT computer. I think they really understood what it takes to build quality systems (software and hardware) that last.

“It took us three years to build the NeXT computer. If we’d given customers what they said they wanted, we’d have built a computer they’d have been happy with a year after we spoke to them – not something they’d want now.”
– Someone on the NeXT Team

It all comes down to making a decision to apply your knowledge and understanding of technology to address the immediate problems for the customer and to push beyond so you can give the customer a system they can grow with. The ultimate measure of success is when a user says “Hey, now I need to do Y with the widget.” and you can reply with something like “Okay, this is how you do that with the system we built.” If you find yourself replying with something more like “Hmmm, we could add that to the software but it will cost you.” then you are doing it wrong!

MobileMe Mail Error

July 12, 2008 | Comments Off

Here we go again. Software Update just notified me that “.mac is now MobileMe” and that an update to Mac OS X was available. Being a masochist I went ahead and ran the update. Everything went smoothly for the most part. I was even able to connect to MobileMe Mail using Safari. I logged in successfully and started poking around the web interface. Guess what….

Yup, once again Apple’s servers are not up to the task. Here is the message I was greeted with shortly after the initial user interface was displayed in the browser window:

Picture 1.png

Apple builds some killer hardware, a great desktop OS, a great music device, some excellent applications, and a really cool phone. They just don’t seem to be able to get server computing right though.

I’m not sure if it’s that they don’t allocate sufficient engineering resources to the problems, or if their data centers are under-powered or what, but these problems just aren’t acceptable. This isn’t new territority. Companies in the on-line space such as Google, Amazon, eBay and AOL have been doing this for years. Building scalable, robust server farms that can handle the kind of load .mac subscribers (oops, I meant MobileMe) exert on the infrastructure just isn’t rocket science.

The new user interface in MobileMe looks promising. I just want it to work reliably and to always be there when I need it.

Come on Apple. You make great XServe servers. Throw more of them at the problem if it’s just a resource issue. Looking at the growth of Apple stock share prices, the increased sales of Mac desktop and notebook computers, and the insanely successful iPhone I think you can afford to hire some top-gun server developers if what you need is more engineering talent to correct this problem.

Please, make MobileMe something everyone loves and can’t live without. Show the rest of the on-line world you mean business here!

Next Page »

www.idevelopsoftware.com is Stephen Fry proof thanks to caching by WP Super Cache