November, 26, 2009

Six

Well technically, it was yesterday. As of yesterday, I’ve been posting to this blog for 6 years. Seems longer AND shorter than that.

— david @ 1:25 pm
November, 24, 2009

WOWODC 2010

Though it seems only a few weeks ago that WOWODC East wrapped up, it looks like Pascal is already hard at work organizing WOWODC 2010. Based on the success of WOWODC East, WOWODC 2010 will be held in Montreal again and will take place in August of next year. Details (as they become available) can be found here.

Talking about WOWODC, the recordings for both of 2009 WOWODCs are now available for sale. A complete list is available sessions is here and the WOCommunity store is here. Don’t forget that several of the WOWODC sessions were released into the wild for free, and can be found on iTMS or here.

— david @ 11:58 am
October, 30, 2009

WebObjects Wiki

The WebObjects community created a wikibook back in the day, but moved all of that content to our own wiki several years ago. Unfortunately the wikibook continues to out Google the up-to-date content at it’s new location. So in attempt to rectify that:

You can vist the WOCommunity.org site and the wiki at http://wiki.objectstyle.org

— david @ 10:08 am
August, 03, 2009

Enabling development rapid turnaround for D2W and RuleModeler

There are a few things I skimmed over or skipped in my WOWODC D2W presentation (too much information, not enough time). One particular item may trip up a new D2W developer, it is an important setting that allows RuleModeler to communicate with WOLips and enables rapid turnaround when you edit rules during development.

Luckily there is a page in the wiki that details the steps you need to take.

— david @ 10:06 pm
July, 27, 2009

WOWODC West Direct to Web Presentation

I received a lot of very positive feedback about my Direct to Web (D2W) presentation at WOWODC West this year. A lot of it was along the lines of: “Wow D2W is very cool, it’s sad that everyone doesn’t know about it” Well, I agree, D2W is very cool, and everyone should know about it. So, I suggested to Pascal that we release the video for my D2W presentation for free.

The first half of the presentation has been available for a few weeks now but the second half was delayed, waiting for the processed audio.

Well, I’m very pleased to announce that the post-production work is now complete and both halves of the presentation are now available from the WOCommunity site (part 1, part 2) or from the WO podcast feed on iTunes.

Direct to Web is a phenomenally powerful but underused part of WebObjects. I hope these videos do a little to help it gain some wider recognition.

For those of you who would like to play along at home, the Movies framework and MySQL database dump I used in the presentation are available here:

Finally, I hope that these videos give you a sense of the quality and depth of the presentation at WOWODC West in general (they were uniformly awesome). If you found mine interesting, I’m sure you will enjoy the others. Pascal should have them available for sale shortly – or better yet – tickets are still available for WOWODC East in Montreal at the end of August.

— david @ 8:42 am
June, 22, 2009

Direct To Web Rules Explained

Ramsey Gurley does a great job of explaining the D2W rules system (and why Project Wonder is invaluable) in this article on the wiki.

A highly recommended read.

— david @ 11:59 am
June, 18, 2009

Screencast: Using ERExcelLook

Project Wonder’s ERExcelLook is a framework that leverages Direct To Web and the ExcelGenerator framework to easily generate Excel exports. I just finished a short screencast on adding it to an existing project. The topics covered are:

  • Adding Direct To Web to an existing project
  • Adding and action to trigger an .xls export for an array of entities
  • Creating a new model file
  • Modifying the rules

Links for the screencast:

  • There is an archive of the completed sample project available here.
  • The project is based on the Movies database, and a MySQL dump is available here.
  • The Rule Modeler tool used in the screencast can be found here.
  • The screencast itself can be found here.

I hope you enjoy it, let me know what you think.

Update: Dave Holt points out that you can specify the worksheet name by adding it in parenthesis as the first item in your displayPropertyKeys array. i.e:

(
    "(WorksheetName)",
    "title",
    "dateReleased",
    "category",
    "studio.name"
)
— david @ 10:39 pm
June, 17, 2009

Advanced track at WOWODC 2009 East?

WOWDC 2009 West (held just before WWDC) was an outstanding success (and I’m not just saying that because I presented :-) ) We had a gathering of very knowledgeable and talented WO developers and the conversation over dinners and breaks was as illuminating and educational as the sessions themselves.

Pascal is working feverishly on hammering the videos into shape and working hard on planning WOWODC 2009 East to be held in Montreal late in August.

Our plan for WOWODC 2009 East is for a conference focused on getting novice WO developers up to speed on the tools and frameworks. The sessions we have planned should teach you how to setup and use the tools, understand the frameworks, and build your applications using the best practices around.

However, this year’s WOWODC West also made it clear that there is a lot of value for more advanced developers in simply being able to share their experience with one another. So we are thinking about adding a second track to WOWODC East. A second room for more advanced sessions, labs, and case studies.

For this to happen though, we will need your help. Are you interested in hanging out in Montreal with a bunch of other crazed WO developers? Would you be interested in hosting a lab, presenting a case study, or giving a session on a topic that is near and dear to your heart? Either way, please take a moment to fill out our latest survey (hosted by the kind folks at survs.com).

We also heard from several people that they didn’t know about WOWODC West and/or the other surveys we’ve run this year. If you know of any WebObjects developers who don’t follow the mailing lists or Twitter feeds (wowodc, wocommunity), or know about the WOCommunity organization, please spread the word!

— david @ 3:02 pm

Alternate D2W Looks

A Direct To Web Look is a set of templates for the common task pages that defines the look and feel of the application. In the bad old days the templates were heavily table based and many of your rules would end up setting display parameters (like table cell background colour etc.)

Thankfully this is changing. I demoed Ravi Mendis’ amazing ERDivaLook (now part of Project Wonder) at WOWODC 2009 West, but since then several others have come to light. So here is a list of the Looks that I know about (excluding the ones from Apple)

  • Project Wonder – ERDirectToWeb – Though technically not a Look, the templates in ERDirectToWeb can be duplicated with Wonder’s Template_creator.pl script and can be used as the basis for your own look. Heavily leverages the power of D2W to offer massive flexibility. Not a good choice for a first attempt at creating your own look but definitely worth looking at for ideas.
  • Project Wonder – ERNeutralLook – A nasty old school Look with lots of table based layout. However, ERNeutralLook can easily be duplicated using the Template_creator.pl script and is simple enough to be useable as the basis for your first attempt at creating your own Look
  • Project Wonder – AjaxLook – I’ve not used or investigate this Look at all. However my understanding is this it is an experiment only and not ready for prime time.
  • Project Wonder – ExcelLook – This very useful Look is a bit of an oddity in that it is not designed to create an end user interface. It does however, generate easily customizable Excel exports to any application. Look for a screencast on this one soon.
  • Project Wonder – ERDivaLook – A very powerful Ajax enabled, XHTML 1.0 strict, semantic markup based Look that looks like it will be amazing once it is completed. It is currently under heavy development and has dependencies on the new WO2 framework and requires WebObjects 5.4.x. Keep an eye on this one.
  • DMSimpleLook – Used by Denis Frolov as part of his SiteMonitor demo at WOWODC 2009 West. It is a simple look with only a few templates but may be a good starting point as the basis for your own look. The SiteMontior project is available here.
  • R2D2W – Ramsey Lee Gurley’s custom Look. This look boasts XHTML 1.1 strict compliance, Section 508 compliance for accessibility, RSS, inline SVG, and user management. I haven’t explored this one in detail yet, but it definitely looks interesting. The project page is here.
  • EVDirectToWeb – Guido Neitzer’s custom Look. Currently listed as unstable pre-alpha so take that under advisment. The project page including screen shots is here.

If you know of any other D2W Looks that are released into the wild, or have any additional experience with any of these. Let me know.

Update: Oops, forgot Guido’s EVDirectToWeb

— david @ 12:19 pm
June, 07, 2009

Direct To Web

At WOWODC this weekend I gave a talk on Direct To Web that spurred a lot of interest which I was thrilled to see.

Getting started with D2W is not an easy task and I owe a massive debt to the two chapters in the Wrox book: Professional WebObjects 5.0 with Java which is sadly out of print. The book was a team effort but I believe that Jim Roepcke wrote those two chapters and is still involved in the WebObjects community. I would like to send a big thanks his way.

— david @ 9:42 pm
May, 12, 2009

vitamin-d design inc. and MODx

My wife is a interior designer who specializes on corporate interiors. She’s been holding off creating a website believing that a poorly done or incomplete website (i.e: “under construction”) was worse than none at all. She and her partners recently decided rebranded the business and figured that now would be a good time to make that web thing happen.

Given that I am the de facto tech support professional around these parts, and I know a little bit about this thing we call the internets, I was pressed into service making it happen. Align/Codeferous has a CMS built in WebObjects that we use for our larger customers, but it would have been overkill for this project.

I decided to go with an open-source CMS called MODx which I’ve used a couple of times before and have grown to like quite a bit. The really nice thing about MODx is that it is very easy to slice up an existing design and get it deployed quickly. It took me about 4 hours to go from PDF mockups to completed design deployed in the CMS. It took longer to populate and tweak the content, but that’s always the way it goes.

So, here it is, the new name and home of the design firm previously known as Logue & Associates Inc:

vitamin-d.gif

— david @ 12:16 pm
May, 04, 2009

WOWODC West News

This is just a quick update about WOWODC West. As I’m sure you already know WOWODC West is a WebObjects focused developer conference being held in San Francisco June 6 & 7 (the weekend preceding WWDC).

I’ve blogged about how awesome it’s going to be so I don’t need to go into all that (beyond re-itterating that it will be AWESOME!)

  • Full session descriptions are now up at the WOWODC West site.
  • The Hotel Whitcomb attendee room rate is now only $99/night and is good for the duration of WWDC if you need it. Remember to state that you are a WOWODC 2009 attendee when booking your room.
  • The $50 early-bird discount ends on May 6 – that means you only have a couple of days left to take advantage of the savings. After May 6 conference tickets will increase to their regular $400.
— david @ 10:02 am
April, 16, 2009

WOWODC West 2009

WOWODC West 2009 will occur the weekend preceding WWDC (June 6-7) in San Francisco. From where I sit it looks like it’s going to be amazing. I’ve been talking to Pascal and the presenters list looks stellar (and I’m not saying that just ’cause I’m on it).

Like WWDC, I find WOWODC as valuable for the people and contacts I get to make as they are for the session content, but I have to say I’m pretty jazzed about the sessions at WOWODC West this year. I’m also glad that the community has been able to step up and fill in the gap left by WebObject’s anemic showing in the official WWDC’s sessions.

If you work with WebObjects I think you really owe it to yourself to attend WOWODC West this year. Full details are available on the WOCommunity website. If you are thinking of attending, book soon, the early bird pricing (a $50 savings) ends May 6th.

See you there!

— david @ 9:06 am
November, 25, 2008

Five

years

— david @ 12:03 pm
October, 18, 2008

Using multiple EOEditingContexts

The job of an EOEditingContext (EC) in WebObjects is to manage an object graph of EOEnterpriseObjects (EOs). Think of it as a sandbox that your EOs live in. Any changes made to those EOs – attributes changed, relationships created or destroyed, EOs added or deleted – are tracked by the EC and committed to the database by calling its saveChanges() method.

When you create a new WebObjects application you get one EC associated with each Session object. This Session Default Editing Context (SDEC) is obtained by calling defaultEditingContext() on the Session.

The SDEC has one major benefit over the ECs you create yourself: It is automatically locked and unlocked by the frameworks freeing you from this confusing and unwieldily task. For this reason most WebObjects examples/demos/tutorials rely on the SDEC exclusively leaving each user with one global EC for all of their EOs.

Unfortunately, following this example and using only the SDEC in a production application can prove to be highly dangerous.

No one likes a dirty sandbox

I have kids, and a cat, and we live in a cat filled neighbourhood. Cats and kids both really like sandboxes, but for different reasons. I’m sure you can see where this is going. No one likes to play in a dirty sandbox.

The problem with only using the SDEC for your application is this: It is really easy to dirty the sandbox. Because an EC tracks all of the changes made anywhere in its object graph, the potential for unwanted changes getting committed to the database grows with the complexity of your application.

When bad things happen to good object graphs

Let’s say a user lands on an edit page that has a bunch of fields including a WOPopup with an onclick binding that calls some JS to submit the form. They make a change via that popup and then choose to abandon their edit and navigate somewhere else on the site.

Unbeknownst to them, when the form was submitted the EO bound to that WOPopup had it’s values altered and the SDEC faithfully tracked that change. Even though the user didn’t save those changes by calling saveChanges() the SDEC still knows about them and is patiently waiting to commit them when told to.

If the user later chooses to edit another EO, or performs any action that calls saveChanges() on the SDEC that abandoned edit will get committed.

Or, perhaps you have a new object action that creates a new EO and binds it to an edit form. Again, for some reason, the user abandons the form. You now have an empty EO sitting in the SDEC just waiting to get committed at some point in the future. When it occurs, that commit will probably fail, throwing validation errors that will make absolutely no sense to the user, or worse yet it will succeed resulting in unwanted data in your database.

Solutions?

One possible solution to this problem is to tightly manage the contents of your SDEC. This can be done by routinely calling revert() on the SDEC to eliminate unwanted changes. This requires either making your application highly modal or working very hard to trap every possible way the user can abandon any part of the site that could result in EO changes.

Believe me, this can become tired very quickly.

Hrm, any other way?

I thought you’d never ask.

In my opinion, the cleanest way to handle these issues in your application is by using multiple ECs. By creating temporary ECs to wrap any EOs that are being edited, we can eliminate many of the problems mentioned above. If the user chooses to abandon an edit mid stream, the EC (and all of it’s changes) will just disappear when it is garbage collected.

"But you said I’d have to handle icky locking issues."

You are right, I did. But there is an easy solution. If you use Project Wonder and follow the instructions in this post, then pretty much all of the common cases of EC locking are handled automatically for you.

So it’s as easy as that?

Unfortunately no. There are a few additional things you need to think about.

  • There are peer and nested ECs
  • You cannot relate EOs in different ECs
  • You cannot move uncommitted (new) EOs between ECs

Peer and nested ECs

Usually peer ECs are the same as the SDEC, differing only in the fact that you created them. Because we are using Project Wonder for all of these examples, creating a peer EC is done like this:

EOEditingContext peerEc = ERXEC.newEditingContext();

When saveChanges() is called on peerEc any changes in it’s EOs will be committed to the database.

As their name implies, nested ECs are nested in another EC. They are created like this:

EOEditingContext peerEc = ERXEC.newEditingContext();
EOEditingContext nestedEc = ERXEC.newEditingContext(peerEc);

Unlike the peerEc, calling saveChanges() on the nestedEc does not committed the changes directly to the database. Instead it saves the changes up into it’s parent (peerEC).

Nested ECs are useful if you have a edit step that is dependent on another one. i.e. Creating a new Person EO, and from within that edit form provide the ability to open a new Address form – You wouldn’t want the new Address to be committed to the database until the Person was saved.

You cannot relate EOs in different ECs

As the heading states: YOU CANNOT RELATE EOs IN DIFFERENT ECs. This is going to be the biggest issue you face when working with multiple editing contexts. For instance this code will not work:

EOEditingContext sdec = Session().defaultEditingContext();
EOEditingContext myEc = ERXEC.newEditingContext();
EOQualifier qual = Person.EMAIL.eq("bob@bob.com");
Person myPerson = Person.fetchPerson(sdec, qual);

Address newAddress = Address.newAddress(myEc);
newAddress.addToPeopleRelationship(myPerson);
newAddress.editingContext().saveChanges(); //gonna go boom!

To make this work, you are going to need to change the code to something like this:

EOEditingContext sdec = Session().defaultEditingContext();
EOQualifier qual = Person.EMAIL.eq("bob@bob.com");
Person myPerson = Person.fetchPerson(sdec, qual);

EOEditingContext myEc = ERXEC.newEditingContext();
Address newAddress = Address.newAddress(myEc);//* see note
Person localPerson = myPerson.localInstanceIn(myEc);
newAddress.addToPeopleRelationship(localPerson);
newAddress.editingContext().saveChanges();

The myPerson.localInstanceIn(myEc) method is a convenience method in the WOLips Velocity eogeneration templates. It essentially wraps a call to:

EOUtilities.localInstanceOfObject(myEc, myPerson);

You cannot move uncommitted (new) EOs between ECs

The observant of you out there may have noticed that I called localInstance on the Person EO. The EO that we fetched from the DB. Not the new Address EO that we created. The reason I did that is because you cannot move uncommitted EOs between ECs. If you do this:

EOEditingContext ec1 = ERXEC.newEditingContext();
EOEditingContext ec2 = ERXEC.newEditingContext();
Person person = Person.newPerson(ec1);
Person localPerson =
    EOUtilities.localInstanceOfObject(ec, person);

localPerson will be null. And if you replace that EOUtilities call with:

Person localPerson = Person.localInstanceIn(ec2);

The call to localInstanceIn() will throw an Exception.

So, be sure to think about what objects are new and what are pre-existing. Either create your new EOs in the EC that you use to fetch your existing ones, or move your existing ones into the EC you use to create your new ones.

What about nested ECs?

Given a parent EC with a child EC: Saving the parent EC will commit its changes but will not save the changes in its children unless they’ve been saved first. So this code:

EOEditingContext parentEc = ERXEC.newEditingContext();
EOEditingContext childEc = ERXEC.newEditingContext(parentEc);
Person person = Person.newPerson(childEc);
parentEc.saveChanges();

Will not result in a new Person object being saved to the DB. For that to occur, the child EC needs to be saved first:

EOEditingContext parentEc = ERXEC.newEditingContext();
EOEditingContext childEc = ERXEC.newEditingContext(parentEc);
Person person = Person.newPerson(childEc);
childEc.saveChanges(); // move changes into my parent
parentEc.saveChanges();

The same rules that govern EOs in different ECs apply to nested ECs. However with nested ECs, once you’ve saved the child the EO will exist in the parent. You just need to retrieve it:

EOEditingContext parentEc = ERXEC.newEditingContext();
Person person = Person.newPerson(parentEc);

EOEditingContext childEc = ERXEC.newEditingContext(parentEc);
Address address = Address.newAddress(childEc);
childEc.saveChanges(); // move changes into my parent

// Get the address instance in the parent EC.
EOGlobalID gid = childEc.globalIDForObject(address);
address = (Address)parentEc.objectForGlobalID(gid);

person.setAddressRelationship(address);
parentEc.saveChanges();

The End

If you have stuck with me this long, I thank you. This is a fairly long (and perhaps rambling post) but working with multiple EOEditingContexts in WebObjects is an essential skill.

Project Wonder takes a great deal of pain out of working with multiple ECs (by eliminating most of the locking issues) but for the uninitiated, there are still some head scratchers that can crop up and I hope this post helps to illuminate them.

* Hey were does that newAddress() method come from? Well, I usually have a factory method generated by my eogeneration template that looks something like this:

public static Address newAddress(EOEditingContext ec) {
	return (Address)EOUtilities.createAndInsertInstance(ec,
						ENTITY_NAME);
}
June, 28, 2008

Lunch Bag Letdown…

Rogers announced their voice/data plans for the iPhone last week and to say I am disappointed is an understatement.

I will need to get an iPhone in the near future, my business and clients will demand it, but these plans are completely insane.

I have no idea what the folks at Rogers were thinking, but obviously none of it was good. You can find plenty of analysis of the plans on the web so I won’t go into that here, but for me the plans make no sense.

They are bundles of voice and data at arbitrary points without any of the flexibility that I require. What happens if I want more than the base level of voice minutes (150 minutes?!?) but without increasing my data? Where is the network calling? Where is the long-distance options?

The only thing that I can think of is that these plans are intentionally simplified to reduce the load on the CSRs for the initial launch of the phone. No options equals less questions and less time activating the phone. I’d like to think there is a reason beyond pure stupidity and greed, but maybe I’m being too generous…

Anyways, I am now left with this decision:

Do I buy the phone, lock in at the lowest plan, because I’m going to need to start developing on it soon anyway, and hope for things to get better?

Or do I say FU Rogers and wait. The spectrum auction is coming, maybe we’ll get a new GSM carrier without their collective heads wedged up one of Ted Rogers’ orifices. Maybe voting with my dollars will join the others that are feeling the same way and give Rogers a wake up call.

Regardless, I am conflicted and saddened…

— david @ 10:59 am
June, 14, 2008

WOWODC – debts must be repaid

I am recovering from the red-eye flight home from San Francisco, but thought I should take a minute to say something about WOWODC.

Pascal Robert went "above and beyond" to organize an exceptional gathering for the WebObjects community. I think that it is safe to say that everyone in attendance had a great time and learned an incredible amount.

Pascal did an insane amount of work and shouldered an insane amount of responsibility putting this year’s show together.

I just want to say how much I appreciate it.

— david @ 3:16 pm

WOWODC & WWDC 08

In no particular order, some of my favorite things:

— david @ 3:05 pm
May, 28, 2008

overflow:hidden

Google caching my brain, please disregard.

When using overflow:hidden to clear floats, IE 6 may need you to give the element a width or height (often 100% works fine).

— david @ 11:11 am
May, 15, 2008

WO Movies Example DB

I am slowly creeping towards the completion of the third WebObjects screencast. In preparation, I’ve created a tweaked version of the Apple Movies database tuned for MySQL and Wonder. You can grab the db dump and EO Model here. The model uses the MySQL protopypes from Project Wonder and the db dump matches it.

— david @ 12:14 pm
May, 14, 2008

WWDC08 Sold Out

The news that WWDC has sold out is causing some consternation in the Apple Dev community. The unexpected news (due to the rising popularity of the platform and the introduction of the new iPhone track at WWDC?) has caught a number of developers off guard. Accustom in past years of being able to register right up to the last minute, many are now scrambling to find tickets.

I’ve read several posts to various dev lists in the past hour containing plaintive pleas for anyone offering WWDC tickets to sell.

— david @ 5:52 pm
May, 09, 2008

Advanced WOComponent API Validation

WebObjects WOComponents are comprised of two files and a bundle. For example a WOComponent named "MyComponent" would have a bundle called MyComponent.wo, a Java file called MyComponent.java, and an API file called MyComponent.api.

Usually the majority of your time is spent editing the content of the .wo bundle and adding logic to the .java file. But when you create a reusable WOComponent it is also important to specify it’s bindings requirements so that the WOLips Component Editor (or WOBuilder if you are so inclined) knows what bindings the component accepts. This is the job of the API file.

WOLips Component Edtior – The API Tab

If you were to create a component named "MyReusableComponent" and in the API tab of the WOLips Component editor you added three bindings the editor window would look something like this:

api_window_1.png

Now if you were to open the MyReusableComponent.api file in a text editor instead of the API editor you’d find a chunk of xml that looked like this:

< ?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wodefinitions>
  <wo class="MyReusableComponent" wocomponentcontent = "false">
    <binding name="myBinding1" />
    <binding name="myBinding2" />
    <binding name="myBinding3" />
</wo></wodefinitions>

Back in the API editor if you selected the first binding and checked the "Required" checkbox you’d see the API change to this:

< ?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wodefinitions>
  <wo class="MyReusableComponent" wocomponentcontent = "false">
    <binding name="myBinding1" />
    <binding name="myBinding2" />
    <binding name="myBinding3" />
    <validation message="'myBinding1' is a required binding.">
       <unbound name="myBinding1"/>
    </validation>
</wo></wodefinitions>

The additional xml defines a validation message that will be triggered if it’s contents evaluate to true. In this case: if "myBinding1" is not bound.

Unfortunately, this is about as far as the validation rules currently go in the WOLips Component Editor. If you need validation that is any more complicated than “Required” or “Will Set” you are on your own…

On Your Own

Lets say our reusable component has an "action" and "href" binding. Either action or href needs to be bound but not both. Let’s start with the API xml that the Component Editor gives us:

< ?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wodefinitions>
  <wo class="MyReusableComponent" wocomponentcontent = "false">
    <binding name="action" />
    <binding name="href" />
    <validation message="'action' is a required">
        <unbound name="action"/>
    </validation>
</wo></wodefinitions>

I told the Component Editor to mark the "action" binding as being required to get the boilerplate validation message. Now lets extend the API to handle the "href" binding.

The validation message block supports <and> and <or> tags, so lets try with that:

< ?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wodefinitions>
  <wo class="MyReusableComponent" wocomponentcontent = "false">
    <binding name="action" />
    <binding name="href" />
    <validation message="Either 'action' or 'href' must be bound">
      <and>
        <unbound name="action"/>
        <unbound name="href"/>
      </and>
    </validation>
</wo></wodefinitions>

If we test this by embedding our component in a page we’ll see that it works for one potential case. We get a validation warning if we neglect to bind "action" or "href", however it fails to flag us if we bind both. So lets extend the validation rule to handle that case:

< ?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wodefinitions>
  <wo class="MyReusableComponent" wocomponentcontent = "false">
    <binding name="action" />
    <binding name="href" />
    <validation message="Either 'action' or 'href' must be bound">
      <or>
        <and>
          <unbound name="action"/>
          <unbound name="href"/>
        </and>
        <and>
          <bound name="action"/>
          <bound name="href"/>
        </and>
      </or>
    </validation>
</wo></wodefinitions>

Not Done Yet

Alternately we could use the "count" directive and write our validation like this:

< ?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wodefinitions>
  <wo class="MyReusableComponent" wocomponentcontent = "false">
    <binding name="action" />
    <binding name="href" />
    <validation message="Either 'action' or 'href' must be bound">
      <count test="!=1">
          <bound name="action"/>
          <bound name="href"/>
      </count>
    </validation>
</wo></wodefinitions>

Now We’re Done

The easiest way to learn the different options available for the API validation rules is to browse some existing examples – ERExtensions from Project Wonder or WO’s JavaWOExtensions are two good places to start. Simply open the Framework/Resources folder and browse through the various component API files you find there.

— david @ 11:45 am
May, 07, 2008

WOLips Cheat Sheet

Download it here. I’ve updated it a couple of times with suggestions, but if its still missing anything obvious let me know in the comments.

— david @ 10:12 am
April, 29, 2008

iPhone coming to Canada… soon…

From 680News Radio (yeah radio how quaint):

“We’re thrilled to announce that we have a deal with Apple to bring the iPhone to Canada later this year. We can’t tell you any more about it right now, but stay tuned,” said Ted Rogers, president and CEO of Rogers Communications Inc., in a statement issued today.

That’s just great. Potentially 8 more months to wait…

— david @ 8:32 am
April, 13, 2008

WOWODC 2008 Update

The WOWODC website has been updated with a speakers list and menu for the conference. For first time attendees there is also a travel tips page (which is applicable to WWDC attendees as well).

If you haven’t booked a hotel, I’d do so soon. Things are filling up quickly and it’s getting hard to find affordable accommodation.

— david @ 7:45 pm
April, 05, 2008

Connection Dictionary Twiddling – Part 2

I wrote about using Project Wonder’s ERXConfigurationManager to ‘twiddle’ your model connection dictionary settings here.

I only listed the global properties, but there are per model properties as well. Unfortunately the JDBC settings are not very well documented. So, to google index my brain, here are my notes: Most of the heavy lifting is done by the fixJDBCDictionary method in ERXModelGroup – you can read the source if you want to know all the values – here is a (MySQL) example with the most common ones:

  • MyModelName.URL=jdbc:mysql://localhost/my_dbname?capitalize…etc
  • MyModelName.DBUser=db_user
  • MyModelName.DBPassword=db_password
  • MyModelName.DBDriver=com.mysql.jdbc.Driver
— david @ 8:12 pm
April, 02, 2008

WOWODC 2008 Press

Pascal sent out the WOWODC press release earlier this week and we’ve seen the notice popping up on various sites all week. The best so far has got to be the post on ars technica:

"You think it’s hard being a Mac IT guy? Try being a WebObjects developer. Despite its ease of use, elegance, ridiculously low price, and variety of supported runtime environments, Apple’s web application framework gets next to no respect…"

— david @ 5:11 pm
March, 31, 2008

WOWODC 2008

Mark your calendar! WOWODC 2008 WOCommunity.org’s second annual WebObjects developers conference is taking place the weekend before WWDC at the Parc 55 Hotel in San Francisco.

Pascal Robert (who has done an amazing job pulling this all together) tells me we have an incredible roster of presenters and sessions lined up for the this year. If last years conference is anything to go by, it should be a rip-roaring good time.

Tickets are available here

Disclaimer: I am a member of the WOCommunity.org steering committee.

— david @ 8:39 am
March, 25, 2008

New Screencast

WO/ProjectWonder/WOLips – Part 2

I just completed part 2 of the WO/Wonder/WOLips series. This episode introduces:

  • Reusable components
  • Importing files into your project
  • DirectActions
  • Modeling relationships
  • Updating a db schema with Migrations

It should be in available in WebObjects Podcasts on iTunes, from the WOCommunity site, or direct from my .mac account here.

Resources

Source of the completed project.

As always, comments and suggestions welcome.

— david @ 9:36 pm
March, 21, 2008

Screencasts

I’ve been playing with the very cool ScreenFlow from vara software this week… Did I mention that it was very cool?

Anyway, I put together a couple of introductory screencasts on using WebObjects and WOLips. They can both be found in the WebObjects Podcasts on iTMS or from the WOCommunity site.

HelloWorld

The first is a short HelloWorld tutorial that introduces:

  • Launching Eclipse/WOLips for the first time
  • Creating a new WebObjects project
  • Project folder structure
  • Running the application
  • Modifying the application run settings
  • Editing components

Direct link from my .mac account here.

WO/ProjectWonder/WOLips

The second is a more advanced WO/Wonder/WOLips tutorial that introduces:

  • Database setup using Wonder’s Migrations (NOTE: I use WO 5.3 on Leopard – Migrations are broken in WO 5.4)
  • Inline bindings
  • WOLips’ Add Action, and Add Key dialogs
  • EOGeneration using the Wonder Velocity Template
  • ERXKey and chainable qualifiers

Direct link from my .mac account here.

Resources

Login form mockup.

Source of the completed project.

Notes:

The response from the WO lists has been very positive, so thank you everyone.

Lachlan Deck asked:

Probably helpful to explain why you’re making the ivars public (i.e., in the absence of getter/setters)

My general thoughts on this are:

If –

  • The ivars are only used by the component’s bindings (ie WORepetition item bindings)
  • Are used by bindings and are set in only one action or method in the component
  • Are never exposed by the api

Then I usually feel OK accessing them directly. If I need to expose the variable via the components API or I need to set the ivars value multiple places in the component then I will make the ivar private and wrap it with accessors.

Comments and suggestions welcome.

— david @ 2:02 pm
February, 27, 2008

WO Wideos

Seems like video is the new black in the WO community this week with the Ajax.framework from Project Wonder taking front billing.

Mike Schrag has posted a short video showing how to create and Ajaxify a new WebObjects app demonstrating some of the new features coming to WOLips.

John Larson has posted a YouTube video of some of the stuff he’s done leveraging the Ajax.framework.

— david @ 12:05 pm

WOLips Blog

Mike has created a WOLips blog, making it easier to track it’s meteoric progress.

Subscribed and into the links it goes.

— david @ 11:52 am
February, 22, 2008

La, la, la, I can’t hear you…

Recent reports of our brave and fearless leader sacking (and eliminating the post of) Canada’s National Science Advisor have got me very concerned.

In a time when the human race is facing what may arguably be some of the most complex and important scientific questions in our existence (global climate change, bioengineering, nanotechnology, etc) it is distressing to see the disregard for science shown by our current government.

Following in the footsteps of our southern neighbours, the current Conservative government appears to have set out to systematically dismantled the scientific advisory and oversight system and muzzle scientists for political purposes. This is dangerous and wrong.

Regardless of where you stand on the scientific issues, wouldn’t you want your leaders to be open to learned advice and the most up-to-date information on the topics? I would. Obviously Steven Harper and his crew don’t.

— david @ 11:28 am
February, 04, 2008

SuperDuper! tomorrow?

It looks like Shirt Pocket is planning on releasing a Leopard compatible version of SuperDuper! tomorrow.

— david @ 1:15 pm
January, 29, 2008

Migration to Velocity EOGenerator Complete

With the release of Leopard, I was saddened to learn that we’d lost the use of EOGenerator in the resulting tools deprecations. Thankfully, a couple of major competitors filling that role quickly arose.

I’d mentioned JavaEOGenerator before but after working with it for a bit I decided to go with the Velocity based EOGenerator (veogen) built into WOLips.

I’m happy to report that as of WOLips build 3.3.4778 all of the pieces are in place in the veogen engine to duplicate my existing EOGenerator templates (the last missing bit was the named and typed bindings for fetch specs).

Veogen works very well. It is a lot faster than the old EOGenerator and I didn’t find the template language difficult to figure out.

For those moving to veogen, the built in templates are pretty comprehensive but if you feel the need to customize, there are a number of templates on the wiki to help get you started. The wiki also contains a fairly comprehensive list of the available bindings here.

Go forth and generate.

— david @ 6:37 pm
January, 23, 2008

Cheese and Crackers!

I loves me the internets!

— david @ 6:26 pm
January, 16, 2008

The Mystery Box

J.J. Abrams (Lost, MI 3, Cloverfield) rifs on his creative origins and motivations in this highly entertaining TED talk. It’s a lot of fun, he’s a great speaker.

He also makes some interesting comments about what makes movies compelling. In doing so he says something to the effect that: "When people make sequels … they rip of the wrong thing."

I couldn’t agree more. Pretty much every time I’ve been disappointed by a sequel (Pirates of the Caribbean 2 and 3 anyone?) is because they made a sequel to the wrong parts of a movie I loved.

— david @ 12:05 pm

Winning the Oil End Game

I am not a climate scientist or engineer, I also don’t believe we can consume our way out of the climate crisis, but Amory Lovins makes a compelling case in this TED talk* that modern engineering can go a long way to ease our dependency on fossil fuels for transportation (one of the key contributors of CO2 emissions).

If you are interested in his full reasoning I suggest you read his book "Winning the Oil Endgame" which is available as a PDF download here.

*Is it obvious where I’ve been spending a lot of my free time?

— david @ 11:53 am
January, 15, 2008

The Manpollo Project

How might you go about convincing sceptics that global climate change is something to be worried about?

  • Step 1: Create a short (say 10 minute) video outlining the basic science behind the subject and then use risk management techniques to identify the relative risks of doing something vs doing nothing.
  • Step 2: Release it to the world and wait for the deluge…
  • Step 3: Create a comprehensive set of add-on videos that expand on the subjects and counter every conceivable argument to the science, math, and logic in the original (ie: No, it’s not Pascal’s wager and here’s why…)

This is exactly what wonderingmind42 (a US high school science teacher) has done. The result is a multi-hour youtube tour de force that extensively (yet accessibly) covers the basic science of global climate change along with the fundaments of risk management, the scientific method, information source assessment, and more. All the while keeping it civil and funnily hatted.

Once I started, I couldn’t stop. I watched (and enjoyed) the entire thing.

If you’re not sure about this whole "global warming thing", this is a good place to start. If you’re already convinced, but are looking for ways of explaining the risks to the more skeptical around you without degenerating into pitching horror scenarios, these videos are a great source of information and technique.

The Manpollo Project page has links to all of the videos here.

— david @ 3:28 pm

Nothing for me.

The Macworld 2008 keynote just completed and there is nothing there for me. I’m not disappointed (to be disappointed you need to have expectations) but there is just nothing there.

Time Capsule – Not a problem I needed a solution for.

AppleTV 2.0 – I’ve got a Mac Mini thanks.

Movie Rentals – Uh, no thanks.

iPhone Update – I live in CANADA remember?

MacBook Air – Cute, but I don’t need an unexpandable, fixed battery, non wired, paper think laptop – even if it is super portable. My MBP is my primary computer and I think it’ll stay that way for a while.

— david @ 3:27 pm
December, 04, 2007

Carina Round

We went to see Annie Lennox when she played here in October and I was absolutely blown away by her opening act. Carina Round played a solo accoustic set that gave me shivers. It was one of those tightrope, on the edge, balls out performances that you just don’t forget.

You can hear her stuff here, on her myspace page, and a good minimalist performance video here (Check out Ready to Confess for a glimpse of what we saw live).

Unfortunately none of her albums are available on iTunes in Canada so I had to order actual CDs from Amazon (shudder).

— david @ 1:18 pm
November, 26, 2007

Four!

November 25th marks the date.

— david @ 9:16 am
November, 16, 2007

SuperDuper! update

Dave Nanian from Shirt Pocket Software blogs about the trials and tribulations of getting SuperDuper! updated for Leopard. The post includes some interesting details, for instance: The funky new directory hard links that Time Machine uses are available to other applications (I did not know that!)

  1. I’m glad they are taking this much care to get SD! right.
  2. I’m glad I don’t have anything that relies on the OS X internals to that degree.
— david @ 4:58 pm
November, 11, 2007

Rule Modeler 1.4

Stéphane Corthésy has posted details about Rule Modeler 1.4 here. If you use WebObjects D2W (Direct to Web) then you will want to use this tool.

— david @ 7:53 pm
November, 09, 2007

Time Machine and a new motherboard

It looks like its backup week here at rebelog headquarters…

Apparently TimeMachine uses the MAC (MAC as in "Media Access Control" not Mac as in "Macintosh") address of your ethernet port to identify its backups. If you change your motherboard (like I just did with my MBP) then your MAC address changes and Time Machine will no longer associate your backup with your machine (because as far as TM is concerned it’s a new machine).

You can browse the backup, but if you wish to continue backing up, TM will tell you it cannot find the volume. Opening the TM preferences and pointing at the backup drive will fix that, but TM will create a new backup set from scratch.

Annoying.

— david @ 11:19 am

Mea Culpa… again.

I’ve been using Super Duper! for, like, ever (and therein lies the root of my problem.)

I’ve been using SD! to backup my laptop to an external LaCie drive every night. I’ve been doing this since said laptop was an Aluminum G4. I’ve been doing this since the default partition scheme was "Apple Partition Map". I’ve been doing this since before I got my MacBook Pro…

I’m sure you can see where this is going.

I took my MBP in for repair yesterday (finally got fed up with the thermal shutdown problem it’s always had). No problem I thought – the warm and fuzzy feeling that having a recent SD! backup gives you in full effect. I’ll just boot the new Mac Mini (Core 2 Duo) I bought for the living room off my backup and keep working until the MBP is back.

Uh, no.

Of course the Mac Mini wouldn’t boot from the backup drive (remember that old partition scheme?) OK, time to clone it to another drive… 3 hrs later and 96% of the way through the clone the destination drive dies. OK, try again, different drive, 2 1/2 hours later, the clone is complete (Yay!) but the clone is un-bootable (Boo!).

So, I re-installed Leopard on the destination drive and started to migrate from the backup… Estimated time to completion? ~5 hrs (at which point I gave up).

In case your are keeping track, that equates to an entire day wasted.

2 hrs later while shopping at the mall (and just around the corner from the Apple Store) my cell phone rings. It’s the Apple Store technician, my MBP is ready (Hooray for Pro Care!)

Lesson learned? Always. Test. Your. Backups. Warm and fuzzy feelings don’t actually mean your are safe. Trust, but verify.

— david @ 10:15 am
November, 06, 2007

D’oh!

After installing Leopard on my MBP I noticed that Mail wouldn’t allow me to do "Entire Message" searches. The "Entire Message" button was greyed out.

I tried rebuilding all of my mailboxes in Mail and forcing an index by calling:

    mdimport ~/Library/Mail

Neither helped.

It turns out the MBP’s boot drive had somehow been added to the Spotlight Privacy list…

D’oh!

— david @ 9:41 am
October, 31, 2007

Leopard: WebObjects Notes

Leopard is out and with it comes a slew of WebObjects changes. The release of WO 5.4, the official deprecation of the tool chain (which we’ve known was coming for some time), Apache 2 support, etc.

There’ve been some posts to the webobjects-dev list which I consider required reading. I don’t know if this stuff has made it into the wiki yet, so here are some links:

So, lots going on, and it all looks good IMHO. Should be a good year for WO.

Notes:

  • The permissions on /Library/WebObjects/Configuration needed to be fixed otherwise wotaskd and javamonitor barf.
  • /System/Library/WebObjects/Executables/WOOpenURL seems to be missing. I copied it from the WO53 install and that works. Upate: It turns out that it’s not needed for WO54, it just uses the open command.
— david @ 9:31 am

Leopard: Bug Fix!

nano/pico now refreshes correctly when you resize the terminal window! WOO. HOO.

— david @ 8:56 am
October, 16, 2007

Leopard

It’s official:

leopard_ship.gif

— david @ 9:02 am