Archive for the ‘Misc’ Category

Centillex ECOAccess

One of the things I’ve added to my "Things to tinker with when I get time" list is this ECO add-on from Thailand:

Centillex EcoAccess is a free library to enable declarative data access services for Borland ECO. It provides flexibilities to declare methods for querying or accessing ECO objects via OCL expression.

OK, so that meant bugger all to me as well when I read it, but looking at the code in the tutorials on the site, it makes a bit more sense.
Still not sure if I’d use it or not, but their use of attributes has got me curious. Worth a couple of hours playing with it to see, I think.

This one’s going straight into the pool room

I spoke with Matthew Overington, a journalist in Australia, a little while back about Model Driven Development in general, and ECO in particular. The resulting article showed up on BuilderAU back in August.

I wouldn’t normally post links to sites that have linked to an article I’m in, but I’m so tickled by this one, I just had to post. The article has been referenced on the Healthy Hair website, specifically on the Hair Loss blog (Who knew there was a blog about hair loss? Why wasn’t I told?).

Now the less kind amongst you who know what I look like, will no doubt be able to construct some terribly amusing reason why I’d be on this site. Oh, how we’d laugh! Sorry to spoil it for you, but you’d be wrong. There were no photos in the article. Ha!

My mum will be so proud. I’m not even upset that they messed up the quote. This one’s going straight into the pool room.

Talkman for Sony PSP

I wonder if this means I can get work to buy me a PSP?

From Wired:

One of the most interesting pieces of PSP software here isn’t even a game. Talkman is a voice-based translation system that uses a small microphone that plugs into the PSP’s USB port. To make sure that TGS attendees fully experienced the software, bilingual hostesses demonstrated Talkman in a soundproof booth that blocked out the cacophonous show floor.

Although the interface is cartoony — all the translation is handled through Max, a rather hideously designed purple bird — the software underneath is sophisticated. First, you pick out a location or theme to the phrases you want to translate — anything from "hospital" to "restaurant" to "nightlife." Then, you speak into the microphone.

Max spits out a list of phrases he thinks you might be saying. If what you said appears on the list, select it and Max will speak it back in any one of four languages — Chinese, Korean, English or Japanese. I tried some English and Japanese phrases, and Max recognized most everything perfectly. I’ll definitely be picking this up when Sony releases it in Japan on Nov. 17.

Here’s another article with a screenshot. Yes, the UI is ugly, but I still want to try it out.

That’s that for another year :-(

Not so long ago they were at the top of the competition ladder, but yesterday the last remaining wheel fell off the Broncos’ season 🙁

As bummed as I’m feeling, I know it’ll get worse tomorrow, as my Eels supporting colleague will be back in the office. This has been a tough year for me re: football. First Queensland lose the State of Origin, the Wallabies have been in a rut for awhile now, and finally the Broncos drop out of the finals. 

sigh….

ECO : Autoforms and Form Factories

I’ve been in New Zealand this week doing some Borland Developer Day’s events. Mornings we’ve been focusing on ECO, afternoons we’ve been focusing on the new MDA features in the next version of Together.

Anyway, during the ECO session in Wellington, I was talking about the AutoForms capabilities, and how you could register your own AutoForms for specific types. This is a really useful feature, as you can use the default AutoForm during early parts of your development, so that you can focus on getting the model developed, and then when ready, you can create custom forms to be used to view and edit your objects. Registering them with the AutoForm service means that you don’t have to change any of the code in your app that display’s your AutoForm, it will automatically use the new form you have registered.

After the session, one of the guys in the audience who’d been using ECO for awhile came up to me asked how to do this. To be honest, I thought I’d already blogged about this. Apparently not, so I had a few hours to kill in the Qantas lounge in Christchurch while I waited for my flight home, so I thought I’d write something up. You can grab the sample code here.

A few things first. If you haven’t seen the default AutoForm capabilities, download the source for this project and open it in Delphi 2005 Architect. Bring up Winform1, and note that I’ve set the ECOAutoForm property on the grdAllPeople DataGrid to True. Now I can simply double-click on a row in my grid, and an autoform will be created.  This is probably the simplest way to get ECO to display an AutoForm for an object.

NB: If you can’t see an ECOAutoForm property in the DataGrid’s on your form, you probably need to add an ECOAutoFormExtender component to the form. This will insert some ECO-specific properties into the DataGrid.

Also click on Button3, which is the button labeled "Show  Autoform" next to the upper grid. I’ve also set it to display an AutoForm for the currently selected Person in the grid. I’ve enabled this by setting it’s ECOListAction property to ShowAutoForm, and setting its BindingContext to my grdAllPeople grid, and its RootHandle property to the ExpressionHandle holding the collection of Person objects, in this case, ehAllPeople. This is probably the second simplest way to display an AutoForm for an object.

If you want to display an autoform for an ECO object via some other method (e.g., via a context menu, etc), then the following code (Which is also in the Click event of Button4 in the sample project) will achieve the desired result:

procedure TWinForm1.Button4_Click(sender: System.Object; e: System.EventArgs);
var
  autoContainer: IAutoContainer;
begin
  if Assigned(cmhSelectedAppointment.Element) then
  begin
    autoContainer := AutoContainerService.Instance.CreateContainer(
                       cmhSelectedAppointment.Element,
                       AutoContainerArgs.Create(EcoSpace,
                                                False,
                                                AutoContainerMemberVisibility.AllMembers,
                                                ContainerReusage.NeverReuse));
    if Assigned(autoContainer) then
    Form(autoContainer).Show;
  end;
end;

Firstly, we’re checking that an Appointment object has been selected in our grid, by seeing if the Element attribute of our CurrencyManagerHandle is assigned. Then, we’re using the AutoContainerService’s CreateContainer method to get back a reference to an IAutoContainer for the selected Appointment. Lastly, provided we got back a reference, we’re casting it as a Form and calling show to display it.

Running the project should show that clicking the button to invoke this code has the same result as double clicking in the grid.

Personally any time I want to display a form in my ECO apps, I use this code. Yes, it’s longer than just creating an instance of a custom form and assigning the ECOSpace and the ECO object you want to edit. However, bear with me for a minute and hopefully you’ll see the advantage.

Open the fAppointmentAutoForm unit and have a look at the TAppointmentForm it contains. I designed this form like I would design any other ECO Winforms. File | New | Other…ECO Enabled Windows Form, drop my controls down. set the ReferenceHandle’s ECOSpaceType and StaticValueTypeName properties, set up my databinding, etc. To convert this form into an ECO AutoForm, I have to do a few things:

1. Extend your form class so that it implements the IAutoContainer interface. You’ll need to add the Borland.Eco.AutoContainers and the Borland.Eco.ObjectRepresentation namespaces to your interface uses clause. Use Ctrl-Space from within your class declaration to declare the BuildControls, HookUpGUI and set_ECOSpace methods, and extend the declaration of your EcoSpace property so that has a setter method (the aforementioned set_EcoSpace).

2. Ctrl-Shift-C from inside the form classes declaration to stub out the implementations of these new methods. The code within them looks like the following:

procedure TAppointmentForm.set_EcoSpace(value: EcoSpace);
begin
  if value <> FEcoSpace then
    FEcoSpace := value;
end;
procedure TAppointmentForm.HookUpGUI(ecoSpace: EcoSpace; element: IElement);
begin
  FEcoSpace := ecoSpace;
  RHRoot.EcoSpace := self.EcoSpace;
  RHRoot.SetElement(element);
end;
procedure TAppointmentForm.BuildControls(element: IElement;
autoContainerArgs: AutoContainerArgs);
begin
// don’t need to do anything, unless you intend writing a generic
// autoform
end;

Most of these should be fairly self explanatory. The BuildControls method is empty, however if you wanted to dynamically create controls on your AutoForm, this is where you’d do it.

3. So, now our AutoForm is complete, however we need to register it with the AutoFormService. To do ths, we define a simple Factory class. In the same unit, you’ll see this under my form declaration. Its delcaration looks like this:

AppointmentAutoContainerFactory = class(System.Object, IAutoContainerFactory)
public
  function get_AutoContainer: IAutoContainer;
  function Matches(modelElement: IModelElement): Boolean;
end;

Its implementation looks like this:

function AppointmentAutoContainerFactory.get_AutoContainer: IAutoContainer;
begin
  Result := TAppointmentForm.Create(nil);
end;
function AppointmentAutoContainerFactory.Matches(modelElement: IModelElement): Boolean;
begin
  Result := modelElement.Name.Equals(Appointment.ClassName);
end;

You may need to add the Borland.Eco.UmlRt namespace to your Interface uses clause. The get_AutoContainer method is where we actually create an instance of our form. The Matches method will be called by the ECO Framework, passing in a reference to the model element for which it is trying to create an AutoForm. Your job in this method is to decide if your form will handle this class, in this case I’m checking whether it represents an Appointment, and if so returning true.

4. Lastly, I need to register my Factory with the AutoForm service, by adding the following code to the initialization section of the unit:

initialization
AutoContainerService.Instance.AddFactory(AppointmentAutoContainerFactory.Create);
finalization

That’s it. Now when you run your app, you should notice that when you request an autoform for an Appointment object you’ll get back our new form. This is regardless of how you request it (i.e.. double clicking in your grid, using the ECOListAction on your button, using the AutoForm code, ECOSpaceDebugger etc). You don’t need to change any of your forms, you can make the change in one place and the rest of your app will follow. Way cool!

In the sample code, the initialization section code is commented out, so you can easily see the before and after effect.

 

Technorati Tags: ,

24 hours of Delphi

So, we’re getting close to the 24 hours of Delphi online radio thingy (yes, I think that’s the official name). The schedule is up here

I’m going to be on at midnight PST, and then again at 11pm PST (which thankfully is a much more civilised 5pm and 4pm respectively where I am), but I’ll be sticking my head in whenever I can. I’ll also be making an effort to be online for the ECO bits, which are:

  • 3:00 am PST with Jan
  • 3:45 am PST with Jonas
  • 10:00 am PST with Daniel
  • 7:00 pm pST with Randy
  • 10:00pm with Tim and Dick

 

Hmm and Brian Long is always good value, and Marco, and…, OK, looks like I’m not going to get much work done for the next 24 hours.

OzTivo

Tivo isn’t sold here in Australia. As such, my inner geek has had to listen with frustration to my US-based colleagues talk about their Tivo’s for a couple of years now. Well no longer!

No, Tivo’s haven’t started selling here. No, Australia hasn’t changed from PAL over to NTSC. What has happened is a friend of mine pointed me to OzTivo, a community of volunteers who have done all the hardwork in figuring out how to convert US Tivos over to work with Australian TV, as well as provide Program Guide Data. So, a quick trip to EBay for a second-hand Tivo, and quite a few hours spent following instructions and hacking around with the cover off, my Tivo is up and running. It’s certainly not a task for my mum, but if you’d be comfortable installing a new hard drive in your PC and installing and configuring Linux, then you should be able to handle getting your own Tivo up and running.

Thank you OzTivo. You guys rock!