Author Archive

rails app producing “error or missing database”

Brad Midgley

You see an error like this in your logs: ActiveRecord::StatementInvalid (SQLite3::SQLException: SQL logic error or missing database: INSERT INTO…). The statement it prints out is working fine when you run it directly.

First, one thing you can tell from this error is you are running the application using a different user id than you are testing with. Are you completely sure you want to run sqlite3 on some kind of production system? :)

If you really are sure, then address the problem. The other identity can’t read/write the database file AND folder.

Continue reading

MacGyver meet iPhone

Brad Midgley

sim1 I have multiple phones and as a mobile developer I end up switching sim cards between phones often. This is tricky with iPhone since it has a carrier that requires the use of something like a paperclip to release it. It is a slick design and helps maintain the slick profile, but it can be a pain.

In a customer meeting, we found we needed to demonstrate the use of a phone that had no sim. Imagine my horror when I found that the sim was in my iPhone and I didn’t have a paperclip to release the sim card door!

Continue reading

RadiantCMS customized

Brad Midgley

Kolob Canyon greenery

We are working on a very interesting project right now that allows us to adapt RadiantCMS to serve several different functions in a big picture system.

Radiant is a powerful content management system that has very good design for factoring out redundancy in your web content. Think of the Don’t-Repeat-Yourself principle applied to the web content, where we unfortunately put up with duplication far too often.

I was impressed with the hierarchy of web content in Radiant: layouts, snippets, ways to bring this together with tags. The tags reminded me of JSP work in past projects, but in this case it feels like borrowing a good idea and making it do more.

The extension design is interesting and allows us to focus customization work outside the core of the system. There are also a lot of interesting extensions already available.

Radiant runs

Continue reading

best railsconf title

Brad Midgley

The best title had to be When to Tell Your Kids About Client Caching. Parents might identify more with this. Interesting stuff in any case.

Continue reading

Ruby performance work

Brad Midgley

Railsconf had several performance-related talks. This one went over a lot of interesting territory.

  • Who knew the Date class performed so badly?? Use equivalent ops in Time or get date::performance
  • Use String::<< instead of String::+=
  • Tune your custom sql with virtual attributes

It’s surprising that things we might not think are performance issues are problematic in ruby. One reason to optimize after you gather metrics that identify problem areas.

rowing

(Image courtesy of rowingbike.com)

Continue reading

RubyMine

Brad Midgley

During his talk at railsconf, Gregg Pollack showed off Jetbrains Rubymine, an awesome IDE for ruby & rails. I wouldn’t be surprised to find out Jetbrains had a spike in their downloads coinciding with the talk. It is a nice IDE. I was happy to see it includes git support out of the box (I only had to set the path to the git executable).  I like the web preview for rails applications. On the downside, I had difficulty opening a large project. I had to stick to more typical rails applications.

It might be time for me to try eclipse again and see how RDT stacks up now.

Contact your usergroup and you can get a deal with Jetbrains to get discounts if you go that route.

Continue reading

Bricked iPhone? Say it ain’t so…

Brad Midgley

I have a few suggestions for developers using bleeding edge systems on iPhone.

1. The OS will expire. Be sure you update to the latest available system before you, say, go out of town to Railsconf. We’ve been warned you don’t use OS3 on a production phone, but that’s easy advice to ignore when things seem to be going swimingly.

2. Download every beta OS for your device even if you don’t expect to use it. I found OS3 beta5 won’t install on this iPhone. I don’t think I’m alone here, but it might only affect the original iPhone. I had to go to a beta4 to get running again.

3. If you do find you can’t run the latest beta, mangle the Apple URL to download an older image. Since I didn’t have beta4 downloaded, what I did was copy Apple’s URL for the beta5 image, change the fives to fours, and

Continue reading

Can’t build for iPhone OS 2 or 2.2.x after iPhone SDK 3.0 beta 3 upgrade

Brad Midgley

After upgrading to iPhone SDK 3.0 beta3, I found all my Xcode projects only had two build options remaining: iPhone OS 3 Device and iPhone OS 3 Simulator.

I still need to build for multiple systems to test all the custom iPhone development we do at Surgeworks, but I also need iPhone OS 3.0 so I can diagnose issues and get all our Native Apps ready for the scheduled release of new iPhone models in June that will feature the new operating system.

Ivan Kalaica suggested how to fix this issue: to check out all projects again from SVN (Subversion). That worked, and all targets are now available in Xcode again.

Continue reading

SQLite wrappers on iPhone

Brad Midgley

On a recent project that needed to keep data in sqlite, I experimented with an implementation of ActiveRecord and also sqlitepersistentobjects. I had passed up a few others that were too complicated or licensed under something like the GPL that prevented commercial work.

While the ActiveRecord author has to get an award for the quickest replies to email, sqlitepersistentobjects was easiest to get working. You don’t even “set up” a database for this wrapper. When you save an object an sqlite database “somewhere” is updated with the right tables. This presumably also handles updates to the metadata but I didn’t play with that.

With iPhone OS 3.0 coming up in a few months and including CoreData, this becomes a question of what to use for legacy devices or projects released before summer. CoreData is going to become the standard way to persist data locally.

Continue reading

iPhone os 3.0 beta intrigue

Brad Midgley

iPhone os 3.0 sdk improves connectivity like bluetooth and usb

Continue reading