Blog

ZopeEditManager 0.9.7 Universal

If you do a lot with Zope and don’t like to have to use Zope’s ZMI editor, external editing is a godsend. Unfortunately the ZopeEditManager application for Mac OS X hasn’t been updated in quite a while. This is fine because it still functions well, but the problem is the most recent binaries are not universal. I don’t have anything else using Rosetta, so I’d prefer not to have to install it.

Thankfully because it’s open source you can download the source. I’ve done just that and built a quick universal binary. I’ve made no other changes, and it seems to work quite nicely.

ZopeEditManager 0.9.7 Universal
MD5: 5bd3e6497ec0d65d21c60e138c8d6fa5
SHA1: da5f5e216d518727d6f95fe2af32c0db2c6039f9

Emulating iPhone Mail Compose View

There have been a couple of situations where I’ve had several small data fields along side one large body of data. The iPhone’s mail view/compose UI fits this model fairly well, and it’s something users are used to. The problem is that it can be difficult to emulate.

Taking a look at a MFMailComposeViewController’s view hierarchy can demonstrate why. One might think it’s a simple UITableView with a UITextView (or something similar) as its footer view, or as the last table cell. In fact, the hierarchy looks like this:

  • MailComposeView
    • UIView
      • UIScrollView
        • UIView
          • ComposeRecipientView
          • MFComposeSubjectView
        • UITextContentView

I’ve left out a couple of views here, it illustrates the structure. This is different from the expectation that a table is being used. Having established that Apple is not using a UITableView for this structure, let’s try to do it anyway.

The structure I’d like to use is this (I’ve included a project downloadable below):

  • UIScrollView
    • UITableView
    • UITextView

Read More

Rethinking iPhone Tabular Input

I’m unhappy with the standard input paradigm for tabular data on the iPhone.

The most common pattern is a UITableView inside a UINavigationController. The user selects a row and a new UIViewController that allows the user to edit the value is pushed onto the UINavigationController. When the user is done, that UIViewController is popped and the user returns to the UITableView.

If you have a lot of rows to edit this can become tedious for both the developer and the user. As developers, we can create abstractions that make it a lot easier to edit different types of data in different rows. For users, there’s little to alleviate the back and forth of entering data.

In wanting to find a better way to present a table of editable values to the user, I began thinking about the new-ish UISearchController’s behavior. It overlays the UITableView when selected, moves to the top of the screen, and presents the keyboard. What if a row in the table did something similar when selected?

The video below is of a proof-of-concept I worked up. When a row is selected, a new view is overlaid that contains a label and text field mimicking the position of the row. That view then moves to the top, and the label and text field rearrange to be more friendly to data input. Touching ‘Done’ or touching outside of the input area (on the darkened table view) will dismiss the new view.

Quick testing shows this to work with UITableViewCellStyleValue1 and UITableViewCellStyleValue2. It won’t work with UITableViewCellStyleDefault since it expects both cell labels. It also looks just a bit weird with UITableViewCellStyleSubtitle.

Is this better than the back-and-forth of UINavigationController? I’m not sure. But this is, to me, more pleasant to use. It still feels like I’m in the same place in the application, instead of being whisked to another view.

This is fairly straight-forward in implementation, and I’d like to provide for text editing as well as values from a UIPickerView. In time I’d like to release this as open source through Water-Powered Ideas, but I want to work through the kinks first.

Outtake from Gabriel’s Passport Photos

Outtake from Gabriel’s Passport Photos

One area I felt iPhone apps lacked was in tea-timers. There exist several, and they’re generally pretty decent, but they lack a bit of configurability I’d like. So I wrote Infusion. The most important feature for me personally is being able to start a pre-defined timer with one touch after Infusion launches, but it’ll also let you customize the startup tab, add teas, edit existing ones, and even just use it as a generic timer. I tried to include a fairly large number of teas. Not many tisanes (herbals) or blends (yet) simply because it’s difficult to keep up the large numbers that are specific to vendors.

Enjoy!

Railo on FreeBSD with Tomcat and Apache

This is primarily written for myself for posterity, but maybe others might find it useful.  I find myself wanting to play with Railo, an Open Source ColdFusion engine.  Java on FreeBSD can be quite un-fun, but I’m going to assume a working JDK to start off with.

First thing is to get Apache and Tomcat installed:

cd /usr/ports/www/apache22 && make install
cd /usr/ports/www/mod_jk-apache2 && make install
cd /usr/ports/www/tomcat6 && make install

Next is to create the /usr/local/etc/apache22/workers.properties file. The mod_jk port gives you a sample to start from. Mine contains:

worker.list=default          # The name of the tomcat server
worker.tomcat.port=8009       # The port of the tomcat server
worker.tomcat.host=127.0.0.1  # The host of the tomcat server
worker.tomcat.type=ajp13      # The type of the connection
worker.tomcat.lbfactor=1      # The weight of the tomcat server

Then mod_jk needs to be added to httpd.conf:

LoadModule jk_module libexec/apache22/mod_jk.so    # Load the mod_jk module

# mod_jk basic configuration
<IfModule mod_jk.c>
    JkWorkersFile etc/apache22/workers.properties # Set the worker.properties file
     JkLogFile  /var/log/jk.log                   # Set the jk log
     JkShmFile  /var/log/jk-runtime-status        # Set the status file
     JkLogLevel error                             # Set the log level
</IfModule>

That was successful in getting Tomcat up and working. Now for Railo. Thankfully, that’s the easy part. Railo provides a WAR file that can easily be dropped into Tomcat’s webapps directory. After that it’s a simple matter of telling Apache what to do about it. I simply added the following to my mod_jk.c’s IfModule:

JkMount /*.cf* default
DirectoryIndex index.html index.cfm index.cfml

And hey presto. I also added a <Host> entry for a particular domain I wanted to use Railo with:

 <Host name="domain.com" appBase="/path/to/domain.com">
    <Context path="" docBase="www"/>
</Host>

And simply extracted the Railo WAR file there instead of in Tomcat’s webapps directory and used it as the basis for the particular site. The only thing is to make sure the web server has appropriate permissions on the WEB-INF directory.

This is a little project I’ve been working on. If you’re an amateur astronomer with an iPhone, take a look!

We have a Gabriel.

We have a Gabriel.

Rounding DateTimes in Cocoa

Let’s see here, what’s the currently supported way to round a datetime to the nearest hour in Cocoa?

// Round the current date to the nearest hour
NSDate * currentDateTime = [NSDate date];
NSCalendar * currentCalendar = [NSCalendar currentCalendar];
NSDateComponents * dateComponents = [currentCalendar components:NSEraCalendarUnit | 
                                                                NSYearCalendarUnit | 
                                                                NSMonthCalendarUnit | 
                                                                NSDayCalendarUnit | 
                                                                NSHourCalendarUnit | 
                                                                NSMinuteCalendarUnit 
                                                       fromDate:currentDateTime];
if ([dateComponents minute] >= 30) 
    [dateComponents setHour:[dateComponents hour] + 1];
[dateComponents setMinute:0];
NSDate * roundedDate = [currentCalendar dateFromComponents:dateComponents];

The API seems a little excessive.  I can appreciate what Apple has tried to do in making dates more flexible and easier to internationalize, but should basic manipulation really be that cumbersome?

The advantages of working from home.

The advantages of working from home.