August 2nd, 2008

Comments

Running your iPhone SDK App on iPhone without the App Store

Writing your own iPhone apps is fun and all, but it’s completely useless to me if Apple’s going to make me pay $100 and wait for months to get it onto my phone - one of the flat-out stupidest things that mar an amazing product; well luckily, the hackers are stepping up and turning Apple’s cathedral into a bazaar by Jailbreaking out of Apple’s code-signing prison, and creating an awesome alternative to App Store called Cydia.

Using some elbow grease, you can write an app using Apple’s official SDK, test it in the simulator, then actually put it onto the phone to see how it works. If it works great, either host your own F/OSS iPhone repository, or pony up the cash and get it into the App Store.

Or, just click on this:

Here’s the steps to get an SDK app onto your phone:

  1. Since Apple enforces codesigning on the iPhone, you need to Jailbreak your phone - otherwise we have to have a dev key.
  2. Build your app using the “2.0 Device - Release” profile (*not* Simulator)
  3. Using Cydia, install OpenSSH, and use the network preferences pane to figure out your IP address
  4. Open up a terminal, and get your app onto the phone:

    Code Sample:

    cd /path/to/my/app/build/Release-iphoneos
    tar -czpvf MyAppName.tar.gz MyAppName.app
    scp MyAppName.tar.gz root@192.168.xxx.xxx:/Applications/   # Replace with your iPhone’s IP
    ssh root@192.168.xxx.xxx
    cd /Applications
    tar -xzpvf MyAppName.tar.gz
    rm MyAppName.tar.gz

  5. We need to “fake sign” our binary, so keep typing in the terminal…

    Code Sample:

    apt-get install ldid
    cd MyAppName.app
    ldid -S MyAppName
    exit

  6. Now, restart your iPhone - you should see the app in your Springboard

I make no guarantees about this method, but it at least worked with the AccelerometerGraph.app sample that Apple ships (and that ironically is completely useless unless it’s on an actual phone).

Update: Getting your apps into the Cydia list is as easy as going to this website and submitting a description / package - just like App Store, only way easier and Free’er!

Comments (2)

Dear Lazyweb: best solution for forums?

In my push to make Yikes! a real open-source app, one thing that the project needs is a good forum. Either hosted, or I can put it on my own server, as long as it’s easy to use. I’d also prefer that it supports OpenID. Beast looks pretty good (PS: you do *not* want to Google for that), but hosting >1 Rails site on my Linode may cause it to explode. Anyone had good/bad experiences?

Comments

Yikes! for nerds: how to get the code

I ran out of time yesterday, but as promised, here’s how to build and run Yikes!

Quick Start

Code Sample:

git clone git://github.com/xpaulbettsx/yikes.git
cd yikes
rake && rake ffmpeg
ruby lib/main.rb -l /path/to/videos -t /path/to/ipod/output -r 1800 -b

Getting the code

By far, the best way to get the code is via Git; this lets you view the entire commit history, as well as send me changes. If you don’t have Git, you can download precompiled source code trees for Linux or Mac OS X 10.5. The Git clone URL via Github is git://github.com/xpaulbettsx/yikes.git

Building (”Huh? Building? On Ruby?”)

(If you downloaded the precompiled version, skip this part!) Even though the application is in Ruby, we need to build ffmpeg and its associated libraries from source, so you need to have the XCode tools installed, and you probably need MacPorts as well. While building this takes forever, it’s fairly easy:

Code Sample:

rake && rake ffmpeg

Running the app

Right now, you have to run Yikes! from the command line, but the syntax is pretty easy. Here’s a sample:

Code Sample:

cd yikes_public

# The long version
ruby lib/main.rb --library /path/to/videos --target /path/to/ipod/output --rate 1800 --background

# or if you want the short version
ruby lib/main.rb -l /path/to/videos -t /path/to/ipod/output -r 1800 -b

# If you want to run it on the sample files for development, there’s an easier way
rake run

Comments (2)

Yikes! It’s your videos on your iPod!

For awhile, I’ve been working on a project that is pretty cool, and I’m finally getting near the “first 90% done” software development mark; now I’ve got the 2nd 90% to get it to production-quality, and the 3rd 90% will make it actually good. Here’s the screenshot:


Yes, the UI is rough-draft, I’ve got to go to town on it in CSSEdit

What’s it do?

In its simple mode, Yikes! will take a directory and convert all the movies to iPod/iPhone format (H.264 MPEG-4’s, so compatible with most players), and it will skip files it’s already converted. This isn’t too far off from what you could do with Handbrake and some clever bash scripts.

However, you can also run the program in background mode, and this is where it gets really useful. You give the program a folder of videos, and a place to put the iPod videos, and it will start a web site that you can go to on another computer, where you can see the converted videos, download them, or (and here’s the clever part), add it to iTunes as a video podcast, which will copy all the videos to your iPod automagically.

Where’s the code?

Github! http://github.com/xpaulbettsx/yikes
Update: Changed URL from earlier, merged webif-ramaze into master

Later today once I’m back at home I’ll put up a “how to get/build the code”, as it’s a little tricky. I’m working on official releases for Mac and Linux, and a Windows port is in the future; while I haven’t been coding towards it, I also have made sure to not choose anything that’s completely impossible for Win32.

Thoughts? Ideas? Comments? Want to help?

Since I’m always busy with work, it’s taken me quite a while to get to this point, and I’m definitely open to accepting contributions and making this a real open-source project; so far, I’ve set up Github and a bug tracker (but no mailing list, forums, documentation, etc). If you’re not handy with coding, websites, or art/design, I would even just appreciate suggestions or ideas for cool features. My Email address is paul at paulbetts dot org, let me know!

Comments (1)

A better Maximize button for Mac + Vim

I wrote about this before in a previous article, but this method has problems with Leopard and QuickSilver; its mechanism uses some clever-yet-not-maintainable methods to work. However, I finally tried Peter Maurer’s Witch, and it covers the same functionality, but with much less hacking.

To complete the fix for me, one of the things that I really miss full Maximize for is the Mac UI for Vim, MacVim. The developer decided that by default, hitting zoom does some sort of strange vertical-only maximize. To fix it, use the following command:

Code Sample:

defaults write org.vim.macvim MMZoomBoth 1

Comments (4)

Debugging .NET exceptions *without* VS installed using WinDbg

If your .NET app is crashing on a machine that doesn’t have Visual Studio, here’s the easy way to get the managed exception - people have written way better articles on SOS and WinDbg, but here’s a 10sec overview; even if you have no idea how WinDbg works, often just having the managed exception will give you enough good info, and WinDbg is way easier to install and lightweight than VS.

Install the Debugging Tool for Windows, then spin up WinDbg (or cdb, the command-line version if you’re even more metal). Either attach to a running instance of your program, or start a new one. Run these commands to get started once you get the prompt (if you don’t get the prompt, and you’ve attached, you need to break-in by hitting Ctrl-C):

Code Sample:

.sympath srv*http://msdl.microsoft.com/download/symbols
.sympath+ C:\path\to\your\binary\directory
.reload -f
g

Ok, your app is running - one thing that will totally fool you if you’re used to using VS is, if you start the program with WinDbg, your program will break-in immediately once you start it, before any code in your app has run (even the .NET startup code). Now, crash your app; you should’ve been kicked back into the debugger now and back at the prompt, with something like:

Code Sample:

CLR exception type: System.Collections.Generic.KeyNotFoundException
    "The given key was not present in the dictionary."
eax=001fe078 ebx=e0434f4d ecx=00000001 edx=00000000 esi=001fe100 edi=005461d8
eip=76c5f35f esp=001fe078 ebp=001fe0c8 iopl=0         nv up ei pl nz ac pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000216
KERNEL32!RaiseException+0×58:
76c5f35f c9              leave
0:000>

Now, here’s where we get to the real work - to debug .NET framework apps, we need the SOS extension, so we’ll pull that in, then use one of the functions that SOS defines (to see them all, run !help):

Code Sample:

0:000> .loadby sos mscorwks
0:000> !printexception

*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll -
PDB symbol for mscorwks.dll not loaded
Exception object: 22e0580c
Exception type: System.Collections.Generic.KeyNotFoundException
Message: The given key was not present in the dictionary.
InnerException: [none]

StackTrace (generated):
    SP       IP       Function
    001FE1F4 6BFB480D mscorlib_ni!System.ThrowHelper.ThrowKeyNotFoundException()+0×1d
    001FE1FC 06DF1E20 mscorlib_ni!System.Collections.Generic.Dictionary`2[[LogDebugger.EventGroupingKeys, LogDebugger.Engine],[System.__Canon, mscorlib]].get_Item(LogDebugger.EventGroupingKeys)+0×38
    001FE208 06494B36 LogDebuggerUI!LogDebugger.Ui.FilterEnvironment.[buildhighlightbrushmap]b__e(LogDebugger.LDEvent)+0xe

   [ [ rest of stack trace… ] ]

There’s way more you can do with WinDbg and SOS (it’s the way we debug Windows programs at Microsoft), but this should get anyone who wants a quick way to see an exception the way to do it. Using Mono, you can actually get the exception trace even easier (but you can’t do any debugging), as any app you run via the command line (i.e. via mono ./path/to/app.exe) will print the same information to STDERR.

Comments

I’ve found my new career

Ulrike Stoll: Na ja, du kannst mich ja vom Büro aus anrufen, wenn es etwas Wichtiges ist

paul.betts@gmail.com/Home: Na ja, du kannst mich ja vom Büro aus anrufen, wenn es etwas Wichtiges ist
de2en@bot.talk.google.com: Well, you can call me from the office of Justice if it is something important

Me: “The Office of Justice” - Awesome

(PS - that doesn’t *actually* say “Office of Justice” in German)

Comments

Everyone change your SSH keys, hooray

Your keys are teh pwn3d

I’m sure everyone who uses SSH has heard by now, but you need to change your SSH keys if you are using Debian/Ubuntu (or took a key from said OS like I did). If you’re thinking that it’s not a big deal, you’re gonna get put in the hurt locker - the only source of entropy in those keys are the PID of the process that created them. That means, there are only 32768 keys; it takes a hacker ~20 mins to break into any server he wants.

If all of your machines are Debian-based, the best thing for you to do is to just delete all the entries in ~/.ssh/authorized_keys until you can regenerate them and patch all of your systems.

In miscellaneous news

  • We’re finishing up the beta for my super-cool project at work today - so far my clever attempt to sneak Ruby/Python through the backdoor at WinSE is turning out wonderfully, mwa ha ha.
  • Summer finally seems like it’s here, it’s nice to be done with the crappy weather. I need to find a cool bike so that I can start riding to work. Days like this make me wish I had a dog to walk, that’d be nice too

Comments (2)

In Rainbows


In Rainbows - Radiohead


Just as you take my hand
Just as you write my number down
Just as the drinks arrive
Just as they play your favourite song
As your bad mood disappears
No longer wound up like a spring
Before you’ve had too much
Come back in focus again

Listening to this album uncompressed through good speakers is fucking amazing. Radiohead >> *

Comments

« Previous entries