June 21, 2013

Mountain Lion broke X11

Want to run apps under linux and pipe the graphical display to your mac using mountain lion?  This is how you do it.

August 5, 2008

iPone activation issue

This morning I awoke to the shinny new 2.0.1 update. Without a second though I installed it only to be left with a bricked iPhone. I could not complete the activation process and kept getting an error: “The iPhone cannot be used with iTunes because the information required for activation could not be obtained from the phone”.  Looked on Google and found a few unresolved issues then I decided to try the *#307* trick and was prompted to enable the radio. This was the fix for me as I post this from the word press app on a 2.0.1 iPhone. Hopefully this will help someone else when googling for help with the issue.<br><br>

The steps would be make emergency call enter *#3078 call enabled the radio and done.  You might try just entering 0 and calling I did not get a chance to try other combinations to see if it would even try to enable the radio.

July 11, 2008

The Abusive PickerView

iPhone SDK 2.0 is a welcome thing but some of the controls make you wonder how they are supposed to be easy to work with. One thing iPhone devs will need that has driven me nuts because so few implement it right yet in any of the apps I’ve seen it in. The odometer style pickerview, no one seems to understand so I’m going to break down the UIPickerView into its most basic components hopefully this helps someone with the spare time to develop for the iphone to create some kewl apps that use it to make the ui experience better.

First here is some sample code that should help you better understand how to virtually wrap the pickerview. What we have in the titleForRow method is an array the returns the value of the selected row modulus 10. This ensures we stay in our array and return the appropriate string label for the row we want. This means no matter what “row” the ui thinks we are in we will be returning what we want them to see for that row giving us the virtual wrap we want. The return could just as easily be simply the row%10 as an NSString without the array for a basic odometer style picker.

Picture 1.png

Some other code that helps us with the illusion is the numberOfRowsInComponent method. In here we return the number of possible rows to select. I started off using NSMaxIneger and quickly found this breaks everything so I bumped the number down until I got around 16384. This allows you to wrap around and around and force the user into having to be pretty dedicated to reach the end of the list breaking the illusion. Change the number down to 32 to see the end of the list and get a better feel for what is going on in the background as the delegate methods aid in rendering the UI.

Picture 3.png

Now what you really want to happen is if they hit the end of the list repopulate it and the easiest way to do this is redirect the list to its own middle. But if every time you did this you took them to the middle it would mess up their current selection so the algorithm has to be a little smarter and offset them to their current selection. There are three pieces to this. The first is the didSelectRow this delegate is called when the user stops moving the control. From here we want to call a delegate that is called when the control loads as well pickerViewLoaded. When the pickerViewLoaded delegate is called we setup the same max as the max returned in numberOfRowsInComponent because we want to go to the middle of the possible selections. We then take the max divided by two for the middle then use that value mod 10 to get the offset to take us to the nearest row divisible by ten. From here we can take the current selected row modulus ten and use that as the offset tot he current row we want them to be on. When we select this row without animation there should be no apparent movement to the end user and they should now be back towards the middle of the list.

Picture 5.png
Picture 6.png

The final piece of code here should enable us to return the number of horizontal components in the pickerview. As you can see the other methods have a component method that returns which column of data you are looking at. There is additional programming required for dealing with this but it shouldn’t be to difficult to figure out once you understand what you’re dealing with in the basics of the pickerview.

Picture 7.png

If your anything like me while the interface is unique but the loading mechanism I think could be significantly optimized but I think the user experience is one that as a developer I can live with because even with the overhead on the device it seems to work well enough. I would also like to disclaim this isn’t meant to be a definitive on the subject of the PickerView only a guide so application developers wanting to work with this control can do so without going bald because of the complexities of the control.

I attached the code as a project so building it in xcode and messing around with the parameters shouldn’t be to difficult.


January 30, 2008

I love my Mac Applescript + Mail.app

Normally I just enjoy computing more that I have switched to the mac platform. Mainly because all of the software just seems to be so well thought out. So much of my experience with Windows was whatever it took to get the job done as quickly as possible so we can move on to the next one. With the Mac there are just certain elements that make me fell all giddy inside as a technology enthusiast and software developer. One of these little moments came to me in the form of a post on MacOSXHints.com.

It was a very simple AppleScript something I have messed with in the past for creating some things I thought were missing in the Finder like a directory up button and directory refresh button on my Finder windows. But I hadn’t really thought of it in the same way I might think about a unix shell script. It just doesn’t seem structured enough to do anything really useful. Until I saw this tip, the jest of which was to announce the name of an incoming mail message sender instead of a simple incoming mail alert.

With very little modification here is my version of the script.

using terms from application "Mail"
on perform mail action with messages newMessages
repeat with newMessage in newMessages
tell application "Mail"
set senderName to (extract name from sender of newMessage)
set mailSubject to (get subject of newMessage)
say "E-Mail from " & senderName
say "Subject " & mailSubject
end tell
end repeat
end perform mail action with messages
end using terms from

Mail.app PrefPane

I saved this as a compiled application and move to Mail.app where I created a rule called Announce and was able to integrate it with my Address book and tell it to only fire for people who are in my family or friends groups. This means only people I know who send me e-mail all the time will run this script. Next I moved it to the top of the list so no other scripts would run before it. Now when my wife sends me an e-mail that might be of importance instead of hearing a bing and knowing I have some random e-mail that I will look at later I hear that she sent me an e-mail plus the subject so I can decide if it is something I should read or if she is just forwarding me another chain joke e-mail.

January 10, 2008

Calendar Server for iCal

I’ve been struggling with Markspaces Sync Together for Mac OS ever since leopard came out. They had a notice on their website for months concerning incompatibility with leopard but no notice as to when or if they would be working on making it compatible. Finally the time came I was ready to figure something else out. I found all kinds of tutorials on setting up a .mac clone which seemed interesting but all I really wanted was to keep my contacts and various calendar events in sync. I also wanted to share this information with my wife’s machine without it being a big hassle. I had read about calendar server before so I decided to set out to get it installed.

I have been working with open sourced software like this for years so I expected some bumps but figured in a few hours of free time I should have it up and running. I was so utterly wrong I could not have imagined the pain this software would cause. First what little documentation there is pre supposes configuration options and package installations that are almost sure to be incorrect for anyone who attempts the install. Second the server makes use of some new technologies like extended attributes for files that while mentioned are not described in enough detail for anyone not already intimately familiar with to make use of as for most installations this is disabled by default. So the setup isn’t the easiest to grind through. The good news is if you know what hurdles await there really is nothing to it.

So here are some of the steps required to get it up and running under Ubuntu 7.10.

My assumptions are that you are at least running a base installation of ubuntu and that you have not removed any of the packages installed by default and are using the default ext3 file system. I will also assume you understand how to deal with any issues regarding apt-get and mirrors.

First you want to get any extras that might not be installed by default with the following command.

apt-get install curl zope3 python-xml python-pyopenssl python-dateutil python-xattr python-pysqlite2 python-twisted python-vobject python-kerberos

Next you want to setup the file system for the metadata storage. This part took me quite a while to figure out that it was indeed a showstopper not to have a file system that supports this interaction. Fortunately I was running ext3 so it was a simple as running the following command mount -o remount,user_xattr /. This remounts the root partition with the ability to read and write the required metadata. This is required for whatever partition you store the data on only and once you have done this you may want to add user_xattr to your /etc/fstab in the options section.

Once this has completed you are ready to get the server from svn. You can place this any number of places popular ones include /opt /var and /usr/local so change your directory accordingly and run the following command.

svn checkout http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk CalendarServer

Keep in mind not everyone is a trunk kind of person you can also use the release versions found by pointing your browser to http://svn.calendarserver.org/repository/calendarserver/CalendarServer/tags/release/ and grabbing one of the directories you see in there and use that url in place of the one pointing to trunk.

After the files have finished downloading it is time to configure your server defaults you can do this by changing directory into the Calendar Server directory and running the command run -s once this has completed you need to create your config file so cd into conf and the run cp caldavd-test.plist caldavd-dev.plist. I don’t know why that was their naming convention but it is.

Now you have a working server ready to accept local connections to enable remote connections edit the caldavd-dev.plist and search for and replace it with the external interface you wish the service to listen on. You can now configure your client to access the server to test out prior to getting into the config file and securing it for your personal needs.

The client connection from iCal was pretty simple you go to the iCal menu select preferences. Then you select the accounts tab click the plus sign to add a new account. Type in your own description and then the username and password to connect to the server. Next enter the url to the server begining with http or https depending on your setup. Then the hostname or ip of the server you are connecting to. Leave off the trailing / it will auto setup your path if you elave it off. Click add and you should be reading your online calendar.

Some things I hope to see in the future are event notifications when something has changed on the server it should notify the client to check for modifications. It should also maintain the connection to the server when iCal is closed and update notifications accordingly. Overall thought I’m happy with how it does work and glad I took the time to get it setup.

December 17, 2007

Screen Sharing – Enable New Features

I noticed a post on digg talking about new features for Screen Sharing via the terminal so I decided to dig into the app itself and see what all was available. Using the trusty strings command from the command line I hit the binary inside System/Library/CoreServices/Screen Sharing.app/Contents/MacOS/Screen Sharing. After parsing it I found a few interesting items.

  • mFSWindow
  • mFSToolPalette
  • mFSQualitySlider
  • mFSControlButton
  • mFSCurtainButton
  • mFSShareButton
  • mFSCaptureButton
  • mFSExitButton
  • mFSFullScreenButton
  • mFSShowButton
  • mFSGetClipboardButton
  • mFSSendClipboardButton
  • mFSMultiDisplayPopUpButton
  • mFSMultiDisplayToolbarView

These all interested me very much as they seemed to represent items on the button bar which you can bring up by pressing the expander at the top right hand side of the window. I noticed they were using the defaults command line so I knew they were modifying the resources in the plist file on the hd so a quick trip over to ~/Library/Preferences I found the com.apple.ScreenSharing.plist file. I opened it using the Property List Editor which you can get by installing the developer tools in Leopard. Once opened I looked around and found the following xpath /NSToolbar Configuration ControlToolbar/TB Item Identifiers/ inside here were the dead giveaways. Items named very similar to the items I found inside the app itself. I extracted the most probable names from the list above and came up with the following valide toolbar items.

  • Quality
    • This controls things like bit depth, compression and the like move further to the right for quality or left for speed.
  • Control
    • Allows you to toggle between control and observer mode
  • Curtain
    • Lets you turn on the curtain on the remote display and prevents the remote user from interacting with the session. (Enables some type of frame buffer mode haven’t figured out the details yet.)
  • Share
    • Lets you turn on and off the user’s ability to control the machine.
  • Capture
    • Straight up screen cap of the remote display.
  • Exit
    • This option appears to only show up in full screen mode and controls exiting from that mode.
  • FullScreen
    • Takes the remote display full screen on your local display.
  • Show
    • Unsure what this does imagine it might be for some quick view feature, maybe ichat implements it.
  • GetClipboard
    • Gets the clipboard from the remote machine.
  • SendClipboard
    • Sends the clipboard from your local machine.
  • MultiDisplayPopUp
    • Only displays if the remote machine has multiple displays. It allows you to select the display individually or combine them into one super display in a single window via a drop down.

There is one other option that is very useful and that was an option you will notice at the bottom of the property list window. It is the ShowBonjourBrowser_Debug option a boolean with the value of no. Change it to yes and it enables a nice window on startup for selecting from a list of predefined clients or adding and connecting to new clients. The only issue I had with it is there is no way that I could see to rename the connection but if you add and save all your entries exit Screen Sharing and open the plist file back up in the editor you will see your entries under SavedComputers. In this dictionary there is a list of machines each machine has a property called name. Edit this name and it will be reflected in the Screen Sharing list under My Computers. Now I have my labels for when I’m outside my office and labels for when I’m in the office for connecting to my main machines.

Seeing this is promising that Apple realizes that home users need some of the functionality of their Apple Remote Desktop software without the 500 dollar price tag. I really wish I had come across a way to transfer files to and from machines but there are ways around that and at least with the features hidden under the surface now we have a powerful computer to computer remote management solution that won’t break the bank. I had already replaced the chicken with the jolly fast client but now it looks like I can drop all vnc clients on the mac in favor of this solution.

December 14, 2007

iPhone VNC

Today I had a bit of time to mess around with the VNsea.app for the iPhone. I had used it previously and was pretty disapointed with the way it just crashed after opening it. It has aged well, with the newest version supporting scaling and all sorts of interactive goodness. The ui is much more responsive than anything I ever used on my e805 which used a similarly clocked chip and had a 640×480 screen.

The things I love about the newest version are:

  • two finger scaling of the screen.
  • click modifiers at the bottom bar
  • auto screen size adjustments when rotating the screen
  • the idea of the more button for sending that ctrl-alt-del

The things that still need to be fixed:

  • link against the fixed working DNS libs please, dns doesn’t work
  • better layout of extra keys, were are the arrows
  • keyboard in landscape view
  • did I mention DNS

Those last few problems seem like they can be fixed rather easily now that stability issues have been addressed. The next little utility I’m really looking for is RDC for the iPhone. This along with the great mobile term package will mean I can remote admin all of my machines from my iPhone.

Here are a few action shots of the latest VNsea.app. It can be found in Installer.app or



September 6, 2007

Newest iPhone hacks

Well you no longer have to know what a command prompt even is to get many of the newest iPhone hacks onto your phone. When I initially saw the Installer.app I thought to myself, now that we are at a point where people can just drag and drop apps onto the iPhone who needs a dedicated app taking up screen real estate to install applications on the iPhone.

I was so wrong about the direction these guys were going. Now that summer board is here to give iPhone users a scrollable dash its no waste of an icon slot and what it offers is well worth the install.

First hit this site up and get the AppTap Installer. There is a version for Mac OS and a version for Windows. Both will get you were you need to be. Take special care of what version of iTunes you are running as this can cause some heart ache.

Once you have downloaded this app you can install it and just follow the instructions.

When the installation is complete look for this icon on your phone.


Click it and you should now see an interface similar to the following.


Once open the application will contact the repositories that are configured and if you have installed applications using it you will be prompted for updates if they exist. If they don’t you will see the default install tab where you can install Applications from. The first thing you should install would be the Community Sources as they will expand the number of programs you can install on the iphone.


Once this is installed you should figure out what dash you might like to use. I like the summer board because it just gives you the scroll effect and it seems to work perfectly. YMMV and there are a few eye candy choices you can find in Installer.app. If you find you want to free up space on the device for apps you no longer wish to use. The uninstall tab is where you go to remove items. Everything is pretty straight forward from there find the item you want to remove tap it to read about it and click uninstall if it is what you want to remove.

The final tab sources will show you what repos you have installed. This allows you to know where you might be downloading these apps from. Something to keep in mind with the way things are, there is nothing that prevents any of these repositories from installing bad stuff on your iPhone. Not that it is a real threat at this point but it could become one in the future so it is important to understand the potential risk involved. That being said the rewards so far are pretty fantastic auto update support and the ability to install apps over the edge network while away from your desktop is pretty sweet.


August 4, 2007

iPhone Hacks

It looks like the time to hack the iPhone for those of us with know how but little time is now. Here is the current situation. There is a way to mount the file system r/w and drag and drop files right in using MacFuse and an iPhone plugin. There is a way to get a working ssh server up and on the iphone. Lots of tools exist now that make this so easy there is no excuse not to do it. This weekend was supposed to be a C# code-a-thon for me but it turned into break down the latest iphone hacks-a-thon. Which is ok because I’ve been wanting to do some new stuff with the iPhone.

This is my current iPhone screen. This used a few hacks but took me only about 20 minutes from start to finish. Mainly because I’ve been watching what’s going on and keeping mental notes on where to find stuff so later I might be able to muddle my way through this.

For those ready to take the plunge first thing to get is iFuntastic. This little app lets you do what I think most people want to do, simply change out your ringtones. It also walks you through the whole jailbreak process with well written instructions and illustrations on what to do.

The next piece of software you need is MacFuse. This is the file system in userspace project from Google that allows for mounting all kinds of file systems on the Mac including now with iphonedisk, the iphone itself. Install MacFuse using the package from google code. Then download the iphonedisk source from svn. You may need to download and install the svn package first here. Then cd into the iphonedisk directory and run make. Once this is complete you can run ./mount.sh. If you have run the jailbreak from iFuntastic you should now have full access to the iphone file system.

Next you will need a way to remote control the phone via command line so you can chmod files on the filesystem to set executable bits. For this the iphone ssh install for mac comes in handy. With the iphone unmounted and having run through the jailbreak scripts you can simply uncompress iphone_ssh_install_for_mac.zip. Once that is done cd into the directory and run the script ./iPhoneMacSSHInstall.sh. This will run you through installing ssh on the iphone. I had to run through this script twice YMMV once I had it finished I did not feel like going back through it to see if I accidentally didn’t run the jailbreak for this step like I had thought I did.

Once these steps are complete you are able to install third party Apps without a whole lot of effort. The /Applications directory in the iPhone is where Application bundles go. Drag and drop them right in. Once in place you may need to fix permissions by sshing into you iphone cd into the app bundle and chmod +x the executable.

The first app I installed was Terminal. I simply drug the app into the Applications folder sshed into the iphone and typed chmod +x /Applications/Terminal.app/Terminal. Its important to note that in order for these changes to show u you will need to restart the iPhone or click finish in iFuntastic and click jail following the instructions.

The icon for field test mode I got from here. They have an explanation on how to install it that seemed all wrong. I mounted the file system and navigated to Applications. Then I right clicked on FieldTest.app and selected show contents. I drug the file Icon.png into the folder rebooted the iphone and the icon was where I expected it to be without editing plists.

May 18, 2007

iPhone Receives FCC Approval

Well it looks like the iPhone received FCC approval under model A1203 with an FCC id of BCGA1203. Apple request confidentiality for the specifics so it looks like we won’t be able to gather any of the phones features from the user manual or device photo’s but the availability of the phone in June now comes down to the manufacturing process and not the FCC.

Here are the 4 FCC Detail Links

Details for 824.2-848.8
Details for 1850.2-1909.8
Details for 2402.0-2480.0
Details for 2412.0-2462.0

It looks like from the details it will be July 1st before we can see the actual user manual online, here is to hopping we are holding the device in our hands before that date comes.