Log entry markup

Earlier this year, I worked for an engineer by the name of Tushar. He’s a very bright guy and probably one of the best software engineers I’ve ever worked with. He uses the following ‘mark-up’ scheme to help identify log file entries.

=== Marks the start of a process (where a process may comprise several methods/objects).
Information; useful information that isn’t an error
>>> Marks the start of a function/method
<<< Marks the end of a function/method
ooo Warning: A warning entry; more serious than ‘Information’ but less serious than an error
*** An error or exception

When you’re formatting your log entry, simply add the appropriate marker at the beginning of the string.

WinMerge Line Filters

I used WinMerge to compare the contents of two folders; there were a large number of text files in both sides that were different simply because a version number had been updated. With so many different files showing, it was difficult to determine which files actually needed to be copied from one side to the other.

I already knew WinMerge had the ability to filter various types of file, but what I didn’t know was that WinMerge can filter lines within a file as well. So, let’s say a text file in the left folder contains a line like:
Build : spf_12208
and the matching text file in the right folder has a similar line:
Build : spf_12230

Without a line filter, this would be highlighted as a difference. To remove this sort of difference, add a line filter as follows:

  1. In WinMerge, click Tools -> Filters.
  2. Click on the Linefilters tab.
  3. Make sure Enable Line Filters is ticked.
  4. Click New
  5. In the edit box, enter a regular expression: spf19_[\d]{5}.
  6. Click OK.

Depending on the exact filter (and whether there are other differences in the file), you should now see a dialog indicating that the files are identical. Identical files can be hidden by unchecking Show Identical Items on the View menu.

Custom SQL in Crystal Reports XI

I’ve been ‘lucky’ enough to spend some time generating reports using Crystal Reports XI. One of the things I wanted to do was customise the SQL used to generate the report. Initially, it wasn’t obvious how to do this and Google couldn’t find any hints.

Happily, I found out how to customise the SQL used in Crystal Reports!

Open your report and open the Database Expert.

  1. Select “Current Connection”
  2. Click “Add Command”
  3. This will open a dialog – paste an SQL command into the left pane of the dialog.
  4. Click OK on the ‘command’ dialog.
  5. The source table for the report will now be the command, and the fields for the report will be based on the select query of the command.

It also appears that any parameters added to a report with an SQL command can be passed to the command – this can be done from the same dialog that the SQL command was added. However, I didn’t try this – I was happy enough to find out about the custom SQL! (Trust me, when you’re working on Crystal Reports, little victories are really important!) I’d recommend making sure that you’re query is right before you paste it into your report – debugging an SQL query is much easier than debugging a Crystal Report!