Recent Updates

Deploying Web Software Well Rested

A post by Keith Forsythe accurately sums up a practice we have been doing for a few months at my day job. In Keith’s words:

First thing in the morning, your development staff is fresh and ready to go. If you release at then end of a long day, and something bad happens in production, it can be brutal to try to figure it out. It’s like working 12 hours, then someone handing you a calculus problem. Good luck. The developer is much more likely to fix the issue quickly and correctly early in the day.

There are more good reasons too, read the full article on SkepTek.

iPhone Navigation View Controller Manipulation

Just a real quick one here. Sometimes when you are using a UINavigationController you want the effect of going forward but change the viewControllers to make the back button skip a step or two.

Here is how I decided to do it:

//Push new View
[self.navigationController pushViewController:
  someController animated:YES];

//Get ref to current stack including newly pushed
NSArray *vcs = [self.navigationController viewControllers];

//take as many of the original controllers as you want
NSMutableArray *newVcs = [NSMutableArray arrayWithArray:
  [vcs subarrayWithRange:NSMakeRange(0, ([vcs count] - 3))]];

//make sure you add the controller you just pushed
[newVcs addObject:[vcs objectAtIndex:([vcs count] - 1)]];

//overwrite the view controller array
[self.navigationController setViewControllers:newVcs];

There is one gotcha. For some reason viewWillAppear:animated is getting called twice. So code around that as needed.

iPhone UIView Coordinates

When you layout a UI on the iPhone you are essentially recursively adding views at specific coordinates. A lot of tool kits take this approach. It is easy to understand from an HTML perspective, a table row is inside a table.

It isn’t always intuitive to figure out programatically where a particular view is on the screen. I recently found a function that does exactly that convertPoint:toView:. The code below takes the center point of someView inside the controller’s view, which usually represents the screen. Then converts it to a point on the controller’s view.

CGPoint point = [someView convertPoint:someView.center
                                toView:[self view]];

Just for a point of reference I wanted to get this to see if the field the user was editing would be covered when the keyboard opened.

Transparency

I have really been enjoying Yehuda Katz’s series on Rails 3. His latest post is more like a diary entry, but to me it gives the most transparency into a major refactoring I have ever seen, open source or otherwise. I know it probably isn’t fun for him to do this everyday, but I bet in the long run it will save him time when answering “why did you do X?” questions.

I think this transparency pairs very well with the open source philosophy of honesty and openness. Now not only can we see the code, we can also see his motivations for the changes. When he breaks backward compatibility, I will be able to reread these posts and say yup that makes sense or conversely nope that wasn’t worth it. But at least we will have a starting point for discussion, rather than leaving me to speculate.

About Simpltry

Simpltry is a weblog focusing on, but not limited to, web development. Both client-side and server-side topics are covered, with a focus on Rails, Javascript and CSS.

Feeds/Syndication