Mostrar / Ocultar Avisos

Attending Mt. West Ruby Conf.

I’m attending the Mt. West Ruby conf next week in Salt Lake City. If you’re attending let me know and I’ll attempt to buy a round.

I’m especially looking forward to this talk about Rhodes

GitPhone: An experimental iPhone app to stay connected with GitHub on the go

I started this project to test out some ideas for an iPhone app which utilizes a 3rd party API. Naturally, I chose GitHub because I’m an extreme fanboy. It’s not polished. There are no tests. It really doesn’t do anything useful and I really don’t where I want to take it. However, there is a good deal of infrastructure here that I feel is worth sharing, especially, since there are so few OSS iPhone apps out there in their entirety.

Get the code here => GitPhone on GitHub
Screen Shots => GitPhone Wiki

Adding a timer to a thread in Cocoa

Just storing this code away for future reference. It creates a new thread and adds a timer to it’s run loop.

This code creates a new thread and calls the secondThread method on self.

You’ll need to setup a new autorelease pool and start a run loop for your new thread. Ths code below does the following.

  • creates a new pool
  • creates a new timer to call the secondThreadMethod method every 5 seconds
  • adds the timer to the new thread’s run loop
  • starts the new thread’s run loop

Mini-Mallows: A Multi-Part Form Wrapper for Cocoa & iPhone

Mini-Mallows in Cocoa

All I wanted was some simple code to POST an image to a web service from my iPhone project. No big deal, right? Apparently, not.

Based on my google search results many people we were wanting the same thing and just not finding it. There are a couple iphone development sites giving examples and some really old open-source projects but nothing really felt right to me. So being a good developer I hacked something together which works for me and posted it on GitHub.

Issuing standard GETs and POSTs with Cocoa is pretty easy, but I couldn’t find anything easy to make multi-part forms for POSTing. This is where mini-mallows comes in. Just make some Cocoa, add some mini-mallows (form fields & a file), and POST.

Easy.

Current status

This project was written to satisfy my need to POST a single image and related form fields from an iPhone app to a web service. It only allows for the addition of one file per request. I am very open to comments, patches, and ridicule.

Installation

Get the code from GitHub => a href=”http://github.com/sschroed/mini-mallows”>http://github.com/sschroed/mini-mallows

Copy the files MultipartForm.h and MultipartForm.m anywhere you like into your Xcode project.

Usage

First, add your standard #import.

Create a NSURL object as you’ll need to send that to Mini-Mallows.

Now create a MultipartForm object and a few form fields and a file. I really wanted to call the class MiniMallows but MultipartForm is easier on the eyes.

When you are done adding fields and the file you can get a fully formed NSMutableURLRequest object from Mini-Mallows.

All set so POST the form.

Introducing BabyBeats

Well, I just submitted my first application to Apple. Wish me luck on getting it accepted.

BabyBeats - Life’s Soothing Rhythm.
Making bedtime easy for babies and their parents

BabyBeats plays a steady, comforting heartbeat. Babies will recognize the familiar sound and be comforted as it is similar to the sound they heard while safe and warm in utero, mommy’s heartbeat.

Just push the “Start Rhythm” button and adjust the volume for a continuous calming heartbeat. BabyBeats is specially made to work even when the phone ringer is set to mute so remember to shut off the ringer so incoming calls, emails, and text messages won’t disturb your baby.

BabyBeats

Windy City Rails

I’m attending the Windy City Rails conference on September 20th with 5 other Ruby.mn members. The plan is to pile into one minivan, dubbed the “MinniBus”, and motor down to Chicago. Good times expected.

WindyCityRails - September 20, 2008 - I'm attending!

RESTful_Easy_Messages now on GitHub.

I just pushed the 0.7 svn tag of the RESTful_Easy_Messages plug-in to GitHub so I can play with the cool kids. Go see it here => http://github.com/sschroed/restful_ezm. This will be the authoritative source from here on out.

It is in need of an update for Rails 2.1 so any help is appreciated.

RSpec and Rails Partials

For some reason Test:Unit and I are not friends. I’m not really sure why, but I always drop to voice mail when I call. So, I moved and started working on project with Andy and Heather Tinkham (two local MPLS software testers) to learn RSpec. More to come on that at a later date. Stealth mode now. Move along, nothing to see…

It’s been fun and I’m enjoying BDD. Once I get the basics down I’ll get into RSpec stories too. Anyway, back to the point.

On my current project we are working on a new version of the most important feature of the site. Without it, everything else is crap. It’s the main driver for adding content and it needs to be rock solid, no, diamond solid. And being a newly minted RSpec user I wanted spec it all out, cover every angle, even add view specs. Here is where my noobness shines.

The new feature is in it’s own partial which is nested in another partial nested within a page. Pretty standard stuff. With the process for writing Rails views and partials in mind I set about trying to write nested view specs. That doesn’t work. AT ALL. The RSpec view docs talk about the expect_render and stub_render methods but I still couldn’t figure it out.

So I called google and still nothing really popped out until I saw an archived email chain where someone said just spec the partials. WTF? OK? So I added a new file to my specs: spec/views/my_view_folder/partial_name.html.erb_spec.rb, added the following, and waited for autotest to run. And you know what? That bastard ran. Maybe I’m just dense, or missed a paragraph somewhere, but an example of the right way to do partial specs would have been sweet. I hope this helps other unsuspecting noob.

Note: Just in case this genero code is confusing replace “my_view_folder” with the actual name of the view directory and “partial” with the actual partial name. And change ControllerHelper to be the name of the actual helper. You get that when you run the RSpec scaffold generator. I did that because I’m lazy and didn’t want to make all the spec files by hand.

UPDATE: I’ve updated the source to show how to do locals.

Resources I found useful

Live Blogging from the F1 Web Challenge

Well it’s 8:30 am and we are about to get started with 24 hours of hard core web development. I’ll be updating our progress throughout the day.

Team Ruby.mnTeam setup

8:55 am Opening comments
8:57 am Our non-profit is Little Brother: Friends of the Elderly
12:07 pm Lunch break with a Rock Band challenge

There are some hard core Rock Band players here. I hope our rookie team can do well, and by that I mean not place last. I think we’ll do well. Here’s the band…

Vocals: Robert Fischer
Guitar: Nate Kadlac
Drums: Andy Tinkhan
Bass: Kathleen O’Brien, from Little brothers

Drum Master AndyRobert Rocks OnThe Band

So far we’re in 2nd place…

6:58 pm Dinner time. Mmmm Chipotle.

Here is the official flickr stream for the event >> Photo me, baby!

Notice how Team Ruby.mn is properly featured?

Alicia and Nate have created a sweet site design that just blows away Little Brother’s current site. Justin and I are hacking away at the CMS. Lars is maxing out his credit cards with the online donations. Andy has written a book of RSpec tests. And Coung and Robert are building the volunteer sign-up. Everything is still parts is parts but everything is progressing nicely.

8:17 pm Little Brothers brought in a surprise for us. We got a clown. No one else got a clown. We rule.

Lars and MagicPink BunnyOur ClownMonkey Coder

12:02 am Half way there. I’m tired.

12:32 am Domino’s Pizza just delivered. Why did I think it was a good idea?

3:27 am Sierra Bravo just gave out some raffle prizes. I won “The Ultimate MAtix Collection” in HD-DVD. I don’t have an HD-DVD player yet and someone just told me Blue-Ray won the format war so I got that going for me. Which is nice.

5:12 am Can’t. Speak. In. Complete… Sentences…

7:05 am I just noticed the sun in coming up. I’ve been awake for 25 hours now. So tired…

9:35 am The site looks sweet. We’re just putting on the final touches and preparing for our demo.

9:44 am Time for a photo check-in.
Count Down

THIS IS NO PLACE FOR THE WEAK!

Sleeping Dude.

TEAM RUbY.mn hard at work.

Team Ruby.mn

10:51 am 1h 10 m left. Subversion commits are flying all over the place. Robert is also live blogging the end.

11:42 am Our final revision, number 161, was just checked in. Here are the stats for our project…

+----------------------+-------+-------+---------+---------+-----+-------+
| Name                 | Lines |   LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers          |   579 |   467 |      16 |      58 |   3 |     6 |
| Helpers              |    32 |    29 |       0 |       1 |   0 |    27 |
| Models               |   356 |   294 |      11 |      36 |   3 |     6 |
| Libraries            |   455 |   315 |       2 |      27 |  13 |     9 |
| Integration tests    |    46 |    40 |       1 |       2 |   2 |    18 |
| Functional tests     |   304 |   246 |      12 |      39 |   3 |     4 |
| Unit tests           |   242 |   201 |       7 |      31 |   4 |     4 |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total                |  2014 |  1592 |      49 |     194 |   3 |     6 |
+----------------------+-------+-------+---------+---------+-----+-------+
  Code LOC: 1105     Test LOC: 487     Code to Test Ratio: 1:0.4

Fix: MySQL 5 on Mac OS X Leopard

This past weekend I bought a new MacBook and, of course, it has Leopard for the OS. As I was installing all of the development tools I need I kept having issues when trying to run MySQL 5.0.51. I installed from the Mac OS X packages.

After consulting google I came across Ted Hogan’s site. He explained that is was a permissions issue between “/usr/local/mysql/data” and the current logged in user. His fix is listed below.

You can get to this through the finder by using the “Go to Folder” dropdown item from the Finder’s “Go” menu. Just type in /usr/local and go from there. Also, you can modify the permissions by command-I (info dialog) at the bottom (Sharing & Permissions.) Be sure to click the options button (gear box at bottom) and select “Apply to enclosed items” as well.