NEWS:

Category Archivemac



Note to self & iPhone & mac & os x 28 Nov 2008 03:01 pm

Build and Compile your SQLite Database with Xcode

I’ve been working on setting up a database for an iPhone app. I haven’t worked with sqlite before so it’s yet another new thing to learn. I’ve been going through a few tutorials on the web and was partway through this one when I took the advice of his sidebar at the end of Step 3 to keep my database definition in sql and have it built when the app compiles. He linked to this screenshot by way of a how-to, which unfortunately didn’t work for me.

First off, to find the build rules for your project, right click on Targets in xcode and select Get Info:
main.m - GameDay

I also added a check to see if your db already exists to avoid build errors if it doesn’t. I decided to put it into an external file and execute that from the build rule. Here’s what my build rule looks like:

Target 201CGameDay201D Info
Uploaded with plasq’s Skitch!

Here’s the bash shell script:

#!/bin/bash
cd ${TARGET_BUILD_DIR}
if [ -f ${INPUT_FILE_BASE}.db ];
then
rm ${INPUT_FILE_BASE}.db;
fi
cat ${INPUT_FILE_PATH} | sqlite3 ${INPUT_FILE_BASE}.db

Put it in a file (sqlbuildrule.sh, for example) and place it in your project directory and set it to executable:
chmod +x sqlbuildrule.sh

At the end of the rule, click the + below “with output files” and enter this:
$(TARGET_BUILD_DIR)/$(INPUT_FILE_BASE).db

The script will look for a .sql file in your project directory and build it with the output going to your target build directory.

If you need to edit the shell script or change the “with output files” setting of the build rule, note that the way you use the environment variables is different. The shell uses them as regular bash variables: ${MY_VAR}, where Xcode uses parens: $(MY_VAR).

mac & ruby 21 Jul 2008 09:57 pm

Merb with Phusion Passenger

I just got Merb running under Phusion Passenger on my OS X Leopard MacBook and it all went well but with a couple gotchas. I looked at Manfred’s and TopFunky’s notes, but I couldn’t get Merb to kick in.

It turns out I was missing a config.ru as they were running straight Rails apps and Merb has to (gets to?) run as a Rack app. This page on Merbivore has all the info. I was being a bit dense about actually taking that first bit of code (# config.ru, etc) and putting it into a file at the root of my Merb app named config.ru. Once done Merb fired right up and it’s working swimmingly.

business & mac 11 Jul 2008 04:43 pm

Twice as fast. Half the price. Or not.

In April I changed jobs, moving from a position with a company-supplied phone to one without. I decided to go with AT&T as I wanted to make the plunge and get an iPhone. However, being a loooong time Apple customer (first Mac: 1984) I was aware that the new version was right around the corner, so I got a cheap LG flip phone and figured I’d upgrade when the new iPhone came out.

You’re probably already shaking your head at my naiveté. I’ve never been a heavy cell phone user — my plan before my company provided phone was a pay-as-you-go with Virgin, which suited my pretty well actually. I’m not a big talker, but I am a big emailer/web browser, etc., hence the iPhone lust.

So here’s some numbers I’m running through my head — the cost of my LG phone (a refurb, fwiw) was about $10 — they seem to be going for $80 used — I’d imagine AT&T would have gotten them for that at most. So say they funded $70 of my phone.

I have the cheapest phone plan at $40/month with a $10 media plan. So far:

AT&T -> Tom $70
Tom -> AT&T $50/mo * 3 = $150

Now, due to that $70 AT&T won’t provide me the upgrade price, but will generously allow me to upgrade for the open price of $399/$499 — although in order to do so I would still be required to extend my plan. Why? I don’t know.

What I would like to do:
AT&T -> Tom $200 (iPhone subsidy)
Tom -> AT&T $70/mo + $5/mo for text

I would even be happy to pay off that $70 debt I have for the LG subsidy. AT&T would be $25/month ahead, meaning they’d pay back the LG subsidy within a few months and have $300/year more of my cash indefinitely.

It’s just hard to not feel penalized as an existing customer and boy, do I regret not doing a pay-as-you-go plan for a while. At this point looking into alternatives like a cracked phone and switching providers would look good, if it was feasible. It just makes me want to leave AT&T. Here they have a chance to increase their revenue from me, but they manage to turn that around and make me an unhappy customer.

Sheesh.

mac & os x 26 Jun 2007 03:27 pm

Migrating user accounts w/o Firewire Target Disk

Perhaps this is an edge case, but recently I wanted to migrate my wife’s account from a G4 Yikes (1st generation G4 desktop machine) to a MacBook. It turns out that the G4 Yikes (aka, non-AGP graphics G4) is the only G4 (or, I believe G3) with built-in Firewire that won’t go into target disk mode.

You can, however, use the Migration Assistant with a mounted volume — if you happen to be able to yank the drive from the old machine and pop it in the new one, you’re good to go. I couldn’t, but had an external Firewire/USB drive. I used SuperDuper! to make a backup of the G4 HD, copied that to the external drive and then migrated from that onto the MacBook.

It worked great, but beware: you have to register SuperDuper! to get the full copy capability. I had registered, but was using a demo copy on the G4 and kept getting only the Users folder copied (which isn’t enough to Migrate from). With the registered version it will actually make a bootable volume.

Technorati Tags: ,