The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for September, 2012

What is the best Report tool for Delphi? – Stack Overflow

Posted by jpluimers on 2012/09/14

Interesting question What is the best Report tool for Delphi? – Stack Overflow that hopefully leads to a nice list of current reporting tools before it gets closed as “question will likely solicit debate, arguments, polling, or extended discussion”.

–jeroen

Posted in Delphi, Development, Software Development | 1 Comment »

Delphi, solutions for `while debugging with Environment Variable “The program can’t start because ….dll is missing”‘

Posted by jpluimers on 2012/09/14

Two days ago I ran into the bug below while porting some code from Delphi 2006 to Delphi XE2, posted on StackOverflow, and got solutions in very little time.

Thanks Andreas HausladenDavid Heffernan, Ken WhiteSertac Akyuz, Rudy Velthuis, for answering, providing solutions and verifying!

Note that this worked up until Delphi XE, and has been fixed in Delphi XE3 (which for this project I can’t use as the client upgraded to XE2 without SA).

Problem

  • I get the error mentioned further on error when debugging an executable in Delphi XE2 update 4 under these circumstances:
  • that depends on mqic.dll from WebShpere that is in C:\Program Files \IBM\WebSphere MQ\bin\mqic.dll and C:\Program Files\IBM\WebSphere MQ\bin is on the system path (not on the user path).
  • is being debugged with an override environment variable in the Run -> Parameters -> Debugger -> Environment Block -> User overrides
  • Including System Variables on the same property page is checked

This is the error (it’s a Windows DLL load error marked “System Error”).

The program can’t start because mqic.dll is missing from your computer. Try reinstalling the program to fix this problem.

Solutions

–jeroen

via delphi – while debugging with Environment Variable “The program can’t start because ….dll is missing” – Stack Overflow.

Posted in Delphi, Delphi 2006, Delphi 2007, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Tagged: , , , | Leave a Comment »

Making RoboCopy silent (via: backup – How can I make robocopy silent in the command line except for progress? – Stack Overflow)

Posted by jpluimers on 2012/09/14

A while ago, I got a question from a colleague on how to silence RoboCopy.

The RoboCopy /? help is a bit awkward to read, so there is this nice SO answer by Ruben Koene:

So together with previous answer you get the following and it’s silent:

ROBOCOPY [target] /njh /njs /ndl /nc /ns /np /nfl

And there is the FIND way where I marked the relevant options with an asterisk (*):

C:\Users\jeroenp>robocopy /? | find /i "No"
                 /S :: copy Subdirectories, but not empty ones.
            /NOCOPY :: COPY NO file info (useful with /PURGE).
             /PURGE :: delete dest files/dirs that no longer exist in source.
                /PF :: check run hours on a Per File (not per pass) basis.
                       n must be at least 1 and not greater than 128.
                /XJ :: eXclude Junction points. (normally included by default).
                 /X :: report all eXtra files, not just those selected.
*               /NS :: No Size - don't log file sizes.
*               /NC :: No Class - don't log file classes.
*              /NFL :: No File List - don't log file names.
*              /NDL :: No Directory List - don't log directory names.
*               /NP :: No Progress - don't display percentage copied.
*              /NJH :: No Job Header.
*              /NJS :: No Job Summary.
              /NOSD :: NO Source Directory is specified.
              /NODD :: NO Destination Directory is specified.

–jeroen

via: backup – How can I make robocopy silent in the command line except for progress? – Stack Overflow.

Posted in Power User, RoboCopy, Windows, Windows 7, Windows 8, Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP | 4 Comments »

Don’t spam with OutputDebugString

Posted by jpluimers on 2012/09/13

A production version of an app should not spam using OutputDebugString.

Some apps do, for instance very couple of seconds the “TAM E-SSO AccessAgent” DataProvider.exe process spams stuff like this:

[1952] GRP_StubImpl Inside
[1952] before deserializing the message
[1952] GRP_StubImpl for Policy Id = pid_desktop_inactivity_mins
...
[1952] GRP_StubImpl Inside
[1952] before deserializing the message
[1952] GRP_StubImpl for Policy Id = pid_aa_tray_menu_options_enabled
[1952] GRP_StubImpl Inside
[1952] before deserializing the message
[1952] GRP_StubImpl for Policy Id = pid_automatic_sign_up_enabled
[1952] GRP_StubImpl Inside
[1952] before deserializing the message
[1952] GRP_StubImpl for Policy Id = pid_desktop_inactivity_mins
...

It is in the chain of processes (yes, the tripple backslash is actually there, this is how IBM starts is):

  • “C:\Program Files\Encentuate\AATray.exe”
    • “C:\Program Files\Encentuate\\\DataProvider.exe”
      • “C:\Program Files\Encentuate\Sync.exe”

All of them have version 8.1.0.130 and timestamp 20-12-2010 14:32.

You’d think that IBM knows how to do this right (:

–jeroen

Posted in Debugging, Development, Software Development | Tagged: , , , | Leave a Comment »

Things I tripped over when implementing the “Elf proef”: digit check for Dutch bank account numbers and social security numbers (bankrekeningnummer, BSN/Sofinummer)

Posted by jpluimers on 2012/09/13

It was a long time ago that I ever did something with the Elf proef.

It is the algorithm that is used to calculate the check digit for Dutch bank account numbers (bankrekeningnummers) and a variation for BSNs (Social Security Numbers).

I needed it (or more exactly: a variation of it) in order to support anonymization of customer data for the DTA/OTA portions of a DTAP/OTAP environment.

So, I started reading on the Elf proef, and getting some sample data to setup some unit tests.

Wrong and wrong:

To start with the latter, they get it wrong because the check digit is modulo 11 (like the ISBN 10 check digit), but only numeric digits are valid. Their bank.js algorithm module tries to accommodate for that in the wrong way.

In addition they copy-pasted code between their other number generation algorithms which you can see form the variable SofiNr which is an abbreviation for SofiNummer,  the old name for the Dutch Social Security Number (now called Burgerservicenummer aka BSN).

Their generated sample 290594880 is wrong because the check digit should be 10, and 10 is not a digit. Their generated number 936977590 is OK as the check digit should be zero (0) which it is.

More on their fault a bit further on. First lets concentrate on getting proper test data, and the right algorithm.

I will cover code for the bankrekeningnummer here. The complete code including BSN is at BeSharp.CodePlex.com. Read the rest of this entry »

Posted in .NET, C#, C# 3.0, C# 4.0, C# 5.0, Development, JavaScript/ECMAScript, Scripting, Software Development | 4 Comments »

Pad Numbers with Leading zeros (0s) or trailing spaces – Fixed Width Number Display (via: SQL Server Journey with SQL Authority)

Posted by jpluimers on 2012/09/12

Every once in a while I need something like this, and I always forget the best way to do it: pad numbers so they start with leading zeros so they appear fixed with.

The SQLAuthority phrases it:

There is no ready made function in SQL Server which offers this solution but we can quickly write up something very simple.

SQLUSA has some more ways to do it, and all basically come down to this:

  1. Convert your number to VARCHAR (use CAST or CONVERT) .
  2. Prepend the converted number with the maximum number of zeros you require (either with a fixed length string like '00000000', or use the REPLICATE function).
  3. Take the right most characters of the required length using the RIGHT function.

You can do similar things with LEFT and padding (for instance with spaces to the right).

One example:

SELECT RIGHT('0000000000' + CAST(31415 AS VARCHAR(10)), 10) AS PaddedPiInteger
SELECT LEFT(CAST(31415 AS VARCHAR(10)) + '          ', 10) AS PaddedPiInteger

–jeroen

via SQL SERVER – Pad Ride Side of Number with 0 – Fixed Width Number Display « SQL Server Journey with SQL Authority.

Posted in Database Development, Development, SQL, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2012, SQL Server 7 | Leave a Comment »

When all you have is a Hammer^H^H^H^H^H RegEx tool, everything seems like a nail^H^H^H^H nightmare

Posted by jpluimers on 2012/09/11

For a good laugh when you are coding late at the evening: regex – Delphi PCRE – regExp string in INI section “range” – Stack Overflow.

–jeroen

Posted in Delphi, Development | 5 Comments »

Crap: VersionInfo handling broken as of Delphi XE2

Posted by jpluimers on 2012/09/11

Today I found out the hard way that you really need a build integration system for managing VersionInfo in Delphi applications: as of Delphi XE2 it is broken in the IDE.

See these links:

This is the only workable workaround so far:

–jeroen

Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Tagged: , , , , , , , , | 14 Comments »

Online C#/VB.NET code fragment conversion tools

Posted by jpluimers on 2012/09/11

A few on-line code fragment conversion tools that I have come across in the past:

–jeroen

Posted in .NET, C#, Development, Python, Ruby, Scripting, Software Development, VB.NET | Leave a Comment »

ModelMaker Code Explorer 10.0.0: Delphi XE3 compatible, Locate Type and Empty Parameter Lists with ()

Posted by jpluimers on 2012/09/10

Last week, ModelMaker Code Explorer 10.0.0 got released:

General new features

  • Delphi XE3 / RAD Studio XE3 support
    (as well as support from Delphi 5 and up)
  • Member Search list allows filtering on member type. Todo items are also displayed.
  • Pascal, new option on tab MMX | Properties | Pascal | New Entities | Methods: Empty Parameter lists. This controls how empty method, procedure and delegate parameter lists are emitted: either suppressed – pascal style, or emitted as ( ) – c-style.
  • Locate Type: displays a filtered list of previously parsed class and interface types. This is used to open the containing source file and locate a class inside the file. Default key binding Alt+Shift+T.

Solved bugs

  • Text containing line breaks and stored in XML (settings, snippets) could contain stray 0x0B (#11) characters. Solved.
  • An access violation at shutdown could occur in older Delphi IDEs if MMX was not docked. Solved.
  • If the Delphi IDE editor buffer contains a stray #0 (which is bad in itself) would cause all kinds of exception in MMX. MMX now detects stray #0’s and abort all editing operations, displaying the line:column of the bad #0 character.
  • Pascal: relative paths starting with \ (relative to root in drive) would not be handled correct. Solved

–jeroen

via: ModelMaker Code Explorer 10.0.0.

Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Tagged: , , , , , , , , , , , , , , , , , , | 2 Comments »