MSBuild MSB6003 Work Around

April 16th, 2014

One of the QC items not fixed in the XE6 release is 98008, probably because it is still in the Reported state even though it was submitted August 23, 2011. I have previously blogged about the state of QC, so I won’t get into that issue again, suffice to say I hope the QPS initiative continues, and QC incidents get reviewed.

I have been encountering the same error as QC98008 because between DevX, TeeChart, and TMS the search paths for units (stored in OPTSETS) has exceeded the 32,000 character limit primarily because the same paths are used multiple times by MSBuild when constructing the build command.  It was included in the ResourcePath, IncludePath, UnitSearchPath and ObjectPath.  Since no OBJ files were in use, and resources are included in the project files, we simply changed the CodeGear.Delphi.Targets file located in the Delphi Bin folder, setting both the ResourcePath and ObjPath to an empty string (lines 192 & 194) as follows:


This resolved the duplicate path issue that resulted in the exceedance of the 32000 character limit.

XE6 Released with some Interesting Features

April 16th, 2014

I attended the webinar today announcing Delphi XE6. It’s been a long road for the EMBT dev team to provide both C++ and Object Pascal support for iOS, Android, OS X, and Windows in the same environment. Kudos to them for accomplishing that feat, and incorporating over 2000 bug fixes into the XE6 release.  The article lists 500+ fixes for customer reported issues.  I assume the remaining 1500+ items were issues found internally.  Using QC for Windows I found that there are already 17 bug reports for XE6 build 20.0.15596.9843.  Unfortunately I cannot get a listing of all the issues fixed because querying using 20.0 or the full build # in Resolved in Build field yields 0 results.

I am looking forward to installing a trial in a VM, and checking out the latest “Key New Features” - Quality, performance and stability!  It was great to see that the VCL got some love and of special interest to me was the tethering capabilities for mobile devices.  I can’t wait until 64 bit OS X apps and Linux are supported, but the product is definitely heading in the right direction.

Using CodeSite to Spot Peformance Optimization Opportunities

April 14th, 2014

I have been using CodeSite for a long time now (since v2 days), but I am still continually impressed by the product and it’s capabilities.  If you want to do something with your log data, chances are CodeSite has you covered, you just need to figure out how it is implemented.

Today, I wanted to see if I could filter on the TimeStamp column shown as a TimeDifference in order to only see log entries where the difference between one line and the next was over a second.  I figured this would show me potential opportunities for code optimization.  Initially I thought I would have to write some sort of log mining tool since there didn’t seem to be any capability to filter the log in this manner.  Developers often immediately jump to “I can solve this by writing some code”, but instead I asked my trusted friend Google.

Google showed me some release notes from a few versions back that documented a new feature in 4.62.  I hadn’t used this version so I had no idea the following was possible:

5. The CodeSite Viewers now support Time Difference Navigation. Specifically, a
   new mode has been added to the Message Navigation buttons (First, Previous,
   Next, and Last) to allow navigating to a message where the amount of time
   that has passed since the previously logged message exceeds some threshold.
   This new navigation mode is extremely helpful is locating time gaps in a
   message log.

   To use Time Difference Navigation, simply click on the "Browse for ..."
   drop-down button located between the Previous and Next navigation buttons.
   At the end of the popup menu, a new Time Difference menu item is available.
   Clicking the Time Difference menu item results in a dialog box asking for a
   threshold value (in milliseconds). Clicking OK closes the dialog box and
   puts the Viewer into Time Difference Navigation mode.  You can then use the
   First, Previous, Next, and Last navigation buttons to locate messages where
   the Time Difference of that message exceeds the specified threshold.

   To toggle back into normal Message Navigation mode, simply select the Time
   Difference menu item again from the drop down list of message types. The
   previous Message Navigation settings will be restored.

This is a sweet suite feature….thanks Ray!

How to Avoid Getting Upset with OptSets

April 4th, 2014

OptSets are a great thing for using consistent settings across multiple projects and machines (such as a build machine). Although they were introduced in D2009, I have found that there are still issues using them in XE4 which I believe are problems in the software and not my wetware.

The first issue is the DPROJ. Settings are present in the DPROJ that when checked in can have adverse effects on the build machine and other developers unless the same setting is present in the OPTSET (such as compiler related ones). This means you have to make sure when editing the OPTSET that the desired changes are in fact being saved, and understand the difference between Applying an OPTSET and adding a Reference to it.

Some of the settings in the DPROJ should be local IMO (the selection of the build config for instance, or run parameters), but they’re not, so I would recommend not checking in the DPROJ unless you have to. At a minimum, you might want to check in one version, and enable VCS-ignore, only updating the DPROJ under version control when absolutely necessary. This can cause issues with GIT when trying to switch branches, so it’s not ideal, but it has the added advantage that Delphi won’t screw up the DPR file when adding units.

If you utilize Search paths in the OPTSET files, you don’t have to add more than the core application classes to your Delphi project. Error Insight will produce more false positives, but in my experience most developers ignore it anyway or disable it. Other side effects might include the IDE refactoring support, but I find that most refactorings don’t work reliably enough, or across units so I rely on manual refactoring as recommended by Michael Feathers from Object Mentor.

OPTSET files are a subset of MSBuild XML including BuildEvents. Unfortunately, these just don’t work as indicated here.  It’s only been 3 releases, so give it time!

For the most part, OPTSET files work, but beware, editing them in the IDE can produce results other than what you might expect. This may be PEBKAC, but for that reason I use NotePad++, or another external editor, but beware that you will have to close and re-start the IDE for any changes to take effect. Likewise, if you switch between GIT branches with other versions of the OPTSET files, you should re-start the IDE to be sure the correct settings are in use.

It would be nice to have OPTSETS that work as you would expect 100% of the time, but the existing implementation is usable if you understand the limits, and while I am sure this article doesn’t cover all of them, I hope it alleviates some grief.

Vote for Me!

April 4th, 2014

Actually I am not running for an office of any kind.  I would actually appreciate some votes for my QC items (if that truly counts for anything in terms of prioritization).  Specifically, I would like to see QC # 123768 and 93267 fixed, but feel free to search through all my reports and vote for them ;-)

Out of Memory - Solved!

April 2nd, 2014

I recently read EMBT’s Delphi RoadMap and was very happy so see that QPS (Quality, Performance, Stability) is item #2 on the Delphi 2014 list.  I certainly hope that these items appear in order of priority.  One of the primary issues I keep hitting is the Out of Memory error, although far less frequently thanks to Andreas’ workaround.  If you can’t see the QC report in your web browser, perhaps like me, you are not authorized to see it on the web.  I can view it fine in the QC Windows Client:

Out of Memory Error - solved internally

Out of Memory Error - solved internally

I am happy to see that this bug has finally been fixed according to the QC # and many other duplicate ones.  It appears to have been fixed as early as January 30, 2014 according to the Closed status replicated from the internal bug tracking system.  For those SA purchasers suffering from this problem, it kind of makes you wonder why this hasn’t been shipped as an update.

I was just going through my QC reports since I wanted to see if the QPS initiative had resulted in some of my long standing reports being addressed.  Sadly I don’t see any movement in that direction yet as a great number of my QC items are still in the Reported state with no comments of any kind.  Perhaps the QPS initiative will mean that QC will no longer be administered by “volunteers”, or perhaps they will recruit additional volunteers to help with the backlog.  I know I would happily volunteer to screen QC reports if it meant helping the product get better and I received a free license for my efforts…

Another Broken Link in the Wall

February 10th, 2014

Chris Rolliston recently blogged that the Mobile Pack for Delphi Pro is being discounted 50% until the end of March, so I thought I would check it out.  A percentage  doesn’t tell you anything because retailers sometimes mark up the product so they can discount it by 70% to attract buyers.

I went to Embarcadero’s site and clicked on the store link, thinking why would you ever buy from a reseller?  Then I clicked on the Buy Now link for XE5 and got a contact page.  I tried the Buy Now links for C++ Builder and RAD Studio and both of those work…

It just dawned on me….perhaps you buy from a reseller because they don’t have a tendency to have broken links ;-)

I finally found the pricing page for the offer and it might be tempting except that your require XE5.  I still don’t understand how EMBT can sell the Mobile Pack as a separate product when it is so tightly coupled to the version of Delphi.  What good is buying support for the Mobile Pack alone when the next version will likely require XE6 if the trend to date continues?  If you need to upgrade or buy both items and buy SA on both to keep a usable environment, then they are a single product IMHO.

Even Apple has UX Issues

February 7th, 2014

Today I was trying to figure out how to put a photo back on my iPhone so I could send it to a friend via iMessage. There used to be a photos “tab” in iTunes, but for some reason it wasn’t present so I googled for a solution, and while other users reported similar problems none of the fixes worked. As it happened I expanded the iTunes window horizontally and discovered an interesting UI quirk.

The Photos, iTunes U, Books and On This Phone “tabs” were not shown, but there was no visual indication in the “toolbar” or segmented control that additional selections were available. iTunes also did not show a horizontal scrollbar. You can see the issue in this screen recording showing iTunes with a minimal horizontal width, and then one sufficient to show all items.

An Interface You Can Count On

January 15th, 2014

Using refcounted interfaces can be difficult, especially when introducing them into legacy code.  Unfortunately, interfacing is key to breaking dependencies and making code more testable.

There are only two approaches I have seen to debugging refcount issues:

1) Create a descendant of TInterfacedObject and override the _AddRef/_Release to log class information and the current refcount.  You could also use copy/paste inheritance (although I do not recommend making a habit of it), and change the implementations.

2) Create your own Interface like I did that exposes the RefCount and ClassName properties and make it the root ancestor for all interfaces used in your project instead of IInterface.  Then you can see the implementing class, and it’s refcount in the debugger, and log it as well if you see fit.  I wonder why TInterfacedObject doesn’t have such properties to begin with…

Here is an interface you can count on ;-) :

/// Interface that should be used as the ancestor
/// for all interfaces so we can see the refcount
/// when debugging without potentially altering it
/// by calling _AddRef/_Release.

IRefCountInterface = interface(IInterface)
function GetRefCount :Integer;
function GetClassName: string;
property RefCount :integer read GetRefCount;
property ClassName :string read GetClassName;

UI Design - What Not To Do

December 19th, 2013

I would never claim to be a good UI designer.  What I know of design is from personal use.  One principle that applies to both code and UI design is that consistency is king.  I often look to widely used commercial software as models for UI design.

Of course, one of the software packages I use most often is the Delphi IDE.  That’s why it’s particularly frustrating to see that when attempting to add a new unit test case to a project right clicking the project and choosing Add New -> Other… invokes the New Items Delphi dialog as shown below:

New Items Dialog invoked from Project Manager local Menu

New Items Dialog invoked from Project Manager local Menu

If I choose File -> New -> Other from the main menu I get the following New Items dialog, that does include the Unit Test folder in the tree, and provide a Test Case item.

New Items Dialog invoked from IDE Main Menu

New Items Dialog invoked from IDE Main Menu

Now considering the project I have selected in the project manager is a Unit Test project, one might think the Unit Test item should appear on the Add New local menu flyout.

Add New Flyout Menu

Add New Flyout Menu

I thought I could work around the initial limitations of the menu by Customizing it, but after adding the Test Case item using the Customize Dialog, it still doesn’t appear on the local menu.  It only appears on the main menu.

Customize New Menu Dialog

Customize New Menu Dialog

You might also notice the label “Default Application in Startup”.  To me this label is very confusing, so I invoked the help which indicates:

“If you want to set a default application type, drag the item that represents the application type from the center pane and drop it on this button. To remove the default application, click the button.”

Not only is the help incomplete, it is also inconsistent.  Within a single sentence it conveys conflicting semantics.  An application type is not the same as a default application.  It doesn’t mention anything to do with “Startup” as the label indicates.  In short, it does not sufficiently describe the functionality to which this option pertains.

I decided to experiment, so I changed the default application to a console application, closed all projects, closed the IDE, and re-launched it.  A new console application project was in fact created.  How this pertains to Menu customization is beyond me.  Personally, I don’t care if the IDE creates a new project because most of the time I am loading an existing project to work on it, or I explicitly create one.

In short, just as a poet carefully chooses his words, developers and documentation writers also have to do likewise.  In the case of documentation, it also makes more sense to be overly explicit to ensure the reader cannot misinterpret your prose.  Consistent UIs with logical grouping of functionality, meaningful hints and labels and discover-ability are also important in an age where users don’t read manuals, expecting software to be intuitive.  Of course it helps to dog food your own product, as if you were an actual end user…