Installing AdHoc Applications on the iPhone

If you’ve received an AdHoc iPhone application (a file with a .app extension) and associated provisioning file (a file with a .mobileprovision extension), follow these simple steps to install it on your iPhone.

  1. Connect your iPhone or iPod Touch to a computer with iTunes installed.
  2. Launch iTunes and switch to the Applications section of the Library
    iTunes Library Application Section
  3. If this is your first install of an app
    1. Save the provisioning file to your desktop…
      Saved Provisioning File on Desktop
    2. and drag it into iTunes
      Dragging the provisioning file into iTunes Library
  4. Save the application to your desktop…
    App saved on Desktop
  5. and drag it into iTunes
    Dragging the app into the iTunes Library
  6. Select your to your iPhone or iPod in the Device section in the left column of iTunes; then go to the Applications tab.
    iTunes Device Applications Tab
  7. Make sure you’ve either selected “All Applications” or that the checkbox next to the new app is selected.

  8. Click “Sync”
  9. Enjoy!

Tags: ,

A Not Entirely Accurate History of Programming Languages

James Iry has posted A Brief, Incomplete, and Mostly Wrong History of Programming Languages, a hilarious look at the development of programming languages over the years.

Some of my favorites:

On C:

“1972 - Dennis Ritchie invents a powerful gun that shoots both forward and backward simultaneously. Not satisfied with the number of deaths and permanent maimings from that invention he invents C and Unix.”
~ James Iry A Brief, Incomplete, and Mostly Wrong History of Programming Languages

On Objective-C:

“1986 - Brad Cox and Tom Love create Objective-C, announcing "this language has all the memory safety of C combined with all the blazing speed of Smalltalk." Modern historians suspect the two were dyslexic.”
~ James Iry A Brief, Incomplete, and Mostly Wrong History of Programming Languages

On LiveScript/JavaScript/ECMAScript:

“1995 - Brendan Eich reads up on every mistake ever made in designing a programming language, invents a few more, and creates... JavaScript”
~ James Iry A Brief, Incomplete, and Mostly Wrong History of Programming Languages

Visit his blog to read more.

Detecting Memory Leaks in the iPhone Simulator

Selecting executable in XCode
There are a number of useful debug flags for the iPhone that can be set in the environment. To access these settings, select your executable from the Groups & Files pane in XCode, then press ?I or select Get Info from the context menu.

Go to the Arguments tab and add the following entries into the “Variables to be set in the environment” box:

  • NSAutoreleaseFreedObjectCheckEnabled
  • NSDebugEnabled
  • NSZombieEnabled

Set the value for all each to YES.

Your settings should now look like:

Executable arguments settings

You may also want to set NSHangOnUncaughtException=YES. Additional useful debugging tips can be found in this thread.

Edit: CocoaDev has additional NSZombieEnabled tips, and notes that you may not want to leave this enabled all the time, especially if your application churns through a lot of objects, as the memory never gets freed. The fact that your code is running on a desktop or laptop system instead of the phone helps a lot here, so this is probably a lot less of a concern than for a desktop application. They also provide instructions for setting these flags in your .gdbinit using:

set env NSAutoreleaseFreedObjectCheckEnabled=YES
set env NSDebugEnabled=YES
set env NSZombieEnabled=YES

Tags:

CPU vs GPU

The Mythbusters demonstrate the difference between a CPU and a modern GPU using paintball-wielding robots:


CPU vs GPU from Juan Diez on Vimeo.

Virtual Serial Ports Under VMware

VMware has an option to create virtual serial ports. The “Named Pipe” used under Linux is actually a UNIX domain socket, which is not easily accessed by most tools. My goal was to be able to connect to the virtual serial port using minicom the same way I would connect to a physical device with a real serial port.

The solution is to use socat along with Unix98 pseudo-terminals (/dev/pts/*).

I set up the Virtual Machine to “Use named pipe”, “This end is the client”, “The other end is an application”, and “Yield CPU on poll”. I put the pipe in /export/vmware/DUT.serial0.

At host startup I run the following socat command using start-stop-daemon:

# start-stop-daemon --start --pidfile /var/run/socat.DUT.pid \
    --background --make-pidfile \
    --exec /usr/bin/socat -- \
    -ly -d -lpsocat:DUT \
    PTY,b115200,raw,link=/dev/ttyDUTSerial0,group=uucp,mode=660 \
    UNIX-LISTEN:/export/vmware/DUT.serial0,fork,owner=frank,group=frank,mode=755

DUT is a placeholder for the virtual machine’s name.

I can then make a minicom config using /dev/ttyDUTSerial0 for the serial port and work as usual.

The above is actually wrapped up in some Gentoo init scripts.
Read the rest of this entry »