Thursday, November 27, 2008

Thanksgiving

Thanksgiving is my favorite holiday. There are no gifts, just enjoy each-others company. And in Bensen family tradition, we will enjoy the sunny 70 degree weather at the beach.

If you've been reading my blog this year, thanks for giving me the chance to teach.

If you've been blogging and teaching, especially talking about Delphi, and doing it without regard for repayment, thanks. We appreciate it more than you know.

If you help people in real need, you have my deepest thanks.

Thank you.

Tuesday, November 25, 2008

Cocoa and iPod Touch

Yesterday's post was a very popular post. Maybe it's because I've been neglecting this blog. Anyhow, I got my iPod Touch because my sister is a college student and my Dad bought her an iMac when Apple had their last back to school promotion. So I was pretty stoked to get a free to me iPod touch even if it's the older generate and 8 gigs.

t's an awesome little device. So I started learning Objective C and Cocoa last Wednesday evening. It takes a bit to get your head wrapped around Objective C, but once you get in the right mind-space it's pretty clear. At first it looks like C with a bunch of garbage. Then you start seeing how the C is decorated with the objective part and bam, your in the mind-space that's required to program in Objective C.

When I get into a new language/framework I try to pick something interesting that I want to create, even if I don't finish it, just to have a goal. I then try to figure out how the language and framework are designed so I can understand the advantages of the platform. For instance something I find interesting about Objective C is all method calls of objects are actually messages that go through a dispatch mechanism. Every time the compiler encounters a method call of the form [objectInstance func] the compiler replaces it with a C call to objc_msgSend. This means that method calls on an object in Objective C are a bit slower than a virtual method call to an object in C++ or Delphi.

My little pet project that has turned out to be a lot more work than I anticipated is to port DCannon2 to the iPhone. In toying around with the OpenGL ES I've had to modify much of the existing OpenGL code since things like glBegin and glEnd are removed for performance reasons from OpenGL ES. But DCannon for the iPhone is coming along.

Monday, November 24, 2008

iPod Touch

I've been using an iPod Touch for a few months now and I really like it. I only have a few songs on it and don't use it for video. I've got a few complaints but it's still the best PDA I've used. I used a Palm Pilot for years.

The v2.0 added the ability for iCal support for multiple calendars. This is huge and worth the $10 upgrade.

The Remote app is super cool. I can imagine it being totally awesome if you had an Apple TV.

The display is really bright and easy to look at.

The feel of the unit is really solid. The only part of the unit that doesn't feel solid is the power off button on the top.

I've held the latest version and it is easier to hold. The original iPod Touch had squared off edges which are sharp on your fingers. The volume control and external speaker on the new one would be two really nice features to have.

I wish the battery life was better.

I upgraded to v2.2 over the weekend and Safari hasn't crashed yet.

Lack of a To Do list in my opinion is a huge problem. I've tried every free 3rd party ToDo list and they all simply suck. I hope Apple makes one that syncs with the ToDos in iCal.

I wish the iPod Touch could sync with my Mac without plugging in the cable, running iTunes and pressing the sync button. But they probably don't want to run out of batteries in the middle of a sync.

Friday, November 21, 2008

Bathroom Remodel Project Nearing Completion

Here are some photos taken of the last few months of our master bedroom and master bathroom remodel:








We finally got tired of the really slow progress having only time after work and on weekends all the while trying to work around our daughters afternoon nap. So we hired a tile guy to finish the tile. Pretty good timing since the economy totally tanked.







DCanon 2

DCannon 2 is finally done and can be downloaded DCannon 2 here. It will require a a graphics card that can handle OpenGL. The entire game was built with Delphi 2009 and written in Delphi using OpenGL and SDL (used for the sound library and dynamically linked of course). David Lock deserves most of the credit.

Update: The original ZIP file uploaded omitted the sounds and graphics. This new one has it all.

DCannon 2 is a two player action packed arcade style game based on the original only with a whole lot more going on. We added night and day, volcanos, lava, lava waves, ice, lightening and thunder, meteorites, and lots of new weapons.

They keyboard controls for the red player (left player) are:

Move Left - A
Move Right - D
Aim Up - W
Aim Down - S
Increase Power - R
Decrease Power - F
Fire - SPACE
Next Weapon - Q
Previous Weapon - E
Toggle Lights - Z
Fire Jump Jets - X
Deploy Shields - C
Weapon Group 1 - 1
Weapon Group 2 - 2
Weapon Group 3 - 3
Weapon Group 4 - 4
Weapon Group 5 - 5


They keyboard controls for the blue player (right player) are:

Move Left - NUMPAD 8
Move Right - NUMPAD 5
Aim Up - NUMPAD 4
Aim Down - NUMPAD 6
Increase Power - +
Decrease Power - -
Fire - RETURN
Next Weapon - NUMPAD 9
Previous Weapon - NUMPAD 7
Toggle Lights - NUMPAD 1
Fire Jump Jets - NUMPAD 2
Deploy Shields - NUMPAD 3
Weapon Group 1 - INSERT
Weapon Group 2 - HOME
Weapon Group 3 - PAGE UP
Weapon Group 4 - DELETE
Weapon Group 5 - END

Tuesday, November 18, 2008

Using TInterfaceList with for in Syntax

In Delphi 2009 you may have notice that IInterfaceListEx has added to the list of interfaces supported by TInterfaceList:

TInterfaceList = class(TInterfacedObject, IInterfaceList, IInterfaceListEx)
For those of you who use interfaces this will be of interest but I've found that most people use the class directly rather than the interface. As it turns out we couldn't modify IInterfaceList because it would break a published interface, so we had to create a new interface to allow a developer using interfaces to use enumerators which are required for the for in syntax. So there you have it. If you like to use interfaces and you use IInterfaceList, you can now use the for in syntax.

Wednesday, November 5, 2008

November Photo of the Month


Here's a photo from my September backpacking trip of the Kern River.

Tuesday, October 28, 2008

Delphi Prism

The following is taken from the Delphi Prism product page:


Delphi Prism    Next generation Delphi development solution for .NET and Mono

  • Delphi Prism programming language for .NET and Mono 
  • Take advantage of the latest and greatest .NET technologies including WinForms, WPF, Silverlight, ASP.NET and LINQ
  • Use your existing Delphi programming skills to build .NET applications
  • Easily connect with all your data across multiple sources and tiers
  • Visualize and better understand your database structures with database design and modeling capabilities in Delphi Prism Architect edition
  • Powered by RemObjects Oxygene compiler technology

The fast way to build applications on .NET for Windows, Linux and Mac

Delphi Prism is the new .NET development solution from Embarcadero Technologies. In this Visual Studio based solution you’ll be able to use your existing Delphi programming skills to build .NET applications, taking advantage of the latest and greatest .NET technologies such as WinForms, WPF, Silverlight, ASP.NET and LINQ. You will of course also be able to develop database applications using familiar dbExpress functionality and .NET clients that connect to native DataSnap servers. Delphi Prism Architect includes database modeling and design capabilities based on ER/Studio that enable developers to design, model, and better understand their databases.
Key Delphi Prism features include:
  • Complete solution for .NET development
  • Powerful full featured Delphi Prism development language
  • dbExpress framework for building database applications
  • Supports development for the Mono platform 
  • Database modeling and design based on ER/Studio
  • DataSnap client creation
  • Blackfish SQL database with included deployment license

Wednesday, October 1, 2008

Alignment in Delphi 2009

Alignment of structures has changed a bit in Delphi 2009. The new layout is more compatible with C++. The old layout system is still available by setting {$OLDTYPELAYOUT ON}. So if you don't want to change your code for whatever reason you don't have to. Use {$ALIGN n} or {$An} to specify the alignment.

Thursday, September 25, 2008

Delphi 2009 - COM+ Custom Attributes

The COM+ tab in the Type Library editor of Delphi 2009 and C++Builder 2009 is no longer visible. The only options that did anything where the Transaction Model. If you go into the text tab (I won't suggest this very often but this is one of those times) and add one of the following custom attributes on the COM+ event object then when you register your COM+ event object in the Component Services this Transaction Model will be the default:

Transaction required:

custom('{17093CC5-9BD2-11CF-AA4F-304BF89C0001}', 0)


Requires a new transaction:

custom('{17093CC7-9BD2-11CF-AA4F-304BF89C0001}', 0)


Supports a transaction:

custom('{17093CC8-9BD2-11CF-AA4F-304BF89C0001}', 0)


Does not support a transaction:

custom('{17093CC6-9BD2-11CF-AA4F-304BF89C0001}', 0)


These custom attributes can be found in mtxattr.h. Note that the COM+ tab never worked with these two customer attributes defined in mtxattr.h:

#define TLBATTR_QUEUEABLE E5FC3761-0BBA-11d2-B8FE-00C04FC340EE
#define TLBATTR_COMTI_INTRINSICS 47065EDC-D7FE-4B03-919C-C4A50B749605


For a little history the original COM+ tab looked like this:


Everything on this page was stored by encoding the data as custom attributes in the type library. The Transaction Model used the custom attributes above which is the only useful piece of informationThe rest of the page used the custom attributes described below that only this COM+ page used so they were pointless. Note that no tools other than the this COM+ tab of the Type Library Editor and the menu item in Run | Install COM+ Objects from Delphi 7. All of the Microsoft custom attributes start with a GUID beginning with 17 while the Delphi custom attributes start with the GUID beginning with B0.

This custom attribute tells the IDE that the object is a COM+ event object and allows the COM+ tab and the Run | Install COM+ Objects menu item to be enabled:

custom('{B0FC9341-5F0E-11D3-A3B9-00C04F79AD3A}', True)

Call Synchronization where X is:

X = 0 (Ignored)
X = 1 (None)
X = 2 (Supported)
X = 3 (Required)
X = 4 (Requires New)

custom('{B0FC9344-5F0E-11D3-A3B9-00C04F79AD3A}', Value)


Creation Timeout where X is the timeout value:

custom('{B0FC9340-5F0E-11D3-A3B9-00C04F79AD3A}', X)


Allow inproc subscribers where X is True/False:

custom('{B0FC9345-5F0E-11D3-A3B9-00C04F79AD3A}', "X")


Fire in parallel where X is True/False:

custom('{B0FC9346-5F0E-11D3-A3B9-00C04F79AD3A}', "X")


Transaction Ignored:
custom('{B0FC9368-5F0E-11D3-A3B9-00C04F79AD3A}', 0)

JIT Activation:
custom('{B0FC9342-5F0E-11D3-A3B9-00C04F79AD3A}', True)

Object Pooling:
custom('{B0FC9343-5F0E-11D3-A3B9-00C04F79AD3A}' True)

Delphi 2009 - Exit

Exit is now very similar to the C++ return keyword where you can supply an optional parameter that is assigned to a functions return value. For example:

function DoStuff(Value: Boolean): Integer;
begin
  if Value then
    Exit(1);

  Result := 0;
end;

Post Ship Bliss...

This means lots of meetings. All day in fact. Nearly all week. Here's a pretty picture I took on my backpacking trip last week:


Brief note about the camera equipment I took on my 10 day 70 mile backpacking trip. I lugged around a Canon 5D, Canon 24-105 F4 IS, remote switch, two batteries and two 8gb Extreme IV memory cards totaling nearly 4lbs. Ouch! Was it worth it? I think so.