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 the ‘Delphi’ Category

Does anyone have the source from the book: The Tomes of Delphi: Algorithms and Data Structures…

Posted by jpluimers on 2019/04/25

Since I need this one day: [WayBack] Does anyone have the source from the book: The Tomes of Delphi: Algorithms and Data Structures by Julian Bucknall? – John Kouraklis – Google+

–jeroen

Read the rest of this entry »

Posted in Delphi, Development, Software Development | Leave a Comment »

Getting rid of bugs: mark them as “new feature” – as cancelling a  THTTPClient.BeginGet() does not work as intended

Posted by jpluimers on 2019/04/24

I have seen this happen before, but it seems to be a habit on the Quality Portal: getting rid of bugs by marking them as “new feature”:

[WayBack] I’m using THTTPClient.BeginGet() to create an async get request to a webservice that holds a connection open until it has data to return (sort of like a… – Brian Ford – Google+. which basically was another person finding out about [RSP-20827] THTTPClient request can not be canceld – Embarcadero Technologies, which got marked (a month after submission!) as “Issue is reclassified as ‘New Feature'”.

I get why it happens (there was something exposed, but some of the functionality is missing a feature which needs to be added).

Marking it as such however sends the wrong signal to your users: we do not see bugs as bugs, so they get on the “new feature” pile with no estimate on when the feature will be done.

–jeroen

Posted in Delphi, Development, Issue/Bug tracking, Software Development | Leave a Comment »

Where do you place your unit uses?

Posted by jpluimers on 2019/04/18

Over the years, I have had the question of where to put uses list entries a lot.

Last year, there was one again from a very experienced developer: [WayBack] Where do you place your unit uses? Over the years, I’ve come to preferring to place my uses in the Interface section only, even if its types, constants… – Lars Fosdal – Google+

The answer is really simple, and comes down to this:

  • use only the units you need (Law of Demeter)
  • use the units as close as possible to where you need them (this helps Minimizing Scope which is related to Information Hiding and the Proximity Principle)

Besides these Clean Code and Code Complete arguments, there is another very important argument:

The larger the scope of a unit, the more resources it takes to compile your project.

This gets worse when you have cycles in your unit dependencies.

I think it gets more than progressively worse; I have seen ~5 million line projects use close to 2 gigabytes of RAM during compilation when they had deep/long cyclic dependencies, forcing a full project build with DDevExtensions configured correctly in order to avoid out-of-memory at all.

For the above question, the poll seems to indicate the public at large gets it right:

References

A few tips from the thread:

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »

Just found out about the SysUtils.FindCmdLineSwitch Function

Posted by jpluimers on 2019/04/17

I learn new things every day. So today I learned about [WayBackSysUtils.FindCmdLineSwitch Function, which was introduced in Delphi 4, but I was still messing with ParamCount/ParamStr loops.

It as not changed over time. The above docs are Delphi 2007, and these are some of the newer:

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »

Debugging RTL/VCL Code with CodeSite – Dave’s Development Blog

Posted by jpluimers on 2019/04/17

This is so cool! [WayBackDebugging RTL/VCL Code with CodeSite – Dave’s Development Blog.

It comes down to performing CodeSite.Send(...) calls as evaluation expressions in non-breaking breakpoints.

Ensure you have the CodeSite.Logging unit in your uses lists and you’re good to go.

Thanks David for pointing me to this!

This is even more useful than the breakpoint Log Message itself (which is only a string) or plain Eval Expression (which puts just one item into the Delphi event log) despite them being there since Delphi <= 5:[WayBackDebugging code in Delphi XE – Stack Overflow.

–jeroen

via: [WayBack] Debugging RTL/VCL Code with CodeSite – David Hoyle – Google+

 

Posted in Delphi, Development, Software Development | 2 Comments »

Delphi annoyance: in debug mode, no breakpoints are being adhered to, no blue bullets

Posted by jpluimers on 2019/04/16

For all Delphi Galileo versions (the BDS based Delphi versions: 8 until now), I have bumped into this annoyance:

Over time, while working on an application, running it in DEBUG mode in the debugger, wil not fire any breakpoints and all blue bullets (meaning the lines have code generated) are gone.

There are no warnings or (error) dialogs leading to this situation.

The only remedy is to quit Delphi, start it again, then do a full rebuild of the application.

Of course this happens more often with large applications than with small ones.

Is there anyone who has a reliable method to:

  • signal this before it happens
  • workaround it in a better way

–jeroen

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

delphi – IfThen(Assigned(Widget), Widget.Description, ‘No Widget’) doesn’t crash. Should it? – Stack Overflow

Posted by jpluimers on 2019/04/16

Very interesting question [WayBackdelphi – IfThen(Assigned(Widget), Widget.Description, ‘No Widget’) doesn’t crash. Should it? – Stack Overflow.

Three important things here:

  • depending on inlining and kind of arguments, function calls can evaluate their arguments one or multiple times
  • lacking formal language specification, you never know if a method will be inlined or not
  • function calls should not have side effects

Via another interesting discussion at [WayBack] Inline functions are not guaranteed to evaluate their arguments exactly once… – David Heffernan – Google+

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

including enumerations and JPEG compression examples for wPDF 4 Manual: Compression related properties

Posted by jpluimers on 2019/04/11

Since I was tracking down an issue having to to with generating DIB in a compressed PDF: [Archive.is] wPDF 4 Manual: Compression related properties

Property CompressStreamMethod

By modifying this property you can let the PDF engine compress (deflate) text. By using compression the file will be reasonable smaller. On the other had compression will create binary data rather than ASCII data. While “deflate” produces the smallest files, “run-length” compression is compatible even to very old PDF reader programs.

Property JPEGQuality

wPDF can compress bitmaps using JPEG. This will work only for true color bitmaps (24 bits/pixel) and if you have set the desired quality in this property.

Property EncodeStreamMethod

If data in the PDF file is binary it can be encoded to be ASCII again. Binary data can be either compressed text or graphics. You can select HEX encoding or ASCII95 which is more effective then HEX.

Property ConvertJPEGData

Note: Only applies to TWPDFExport.

If this property is true JPEG data found in the TWPRichText editor will not be embedded as JPEG data. Instead the bitmap will be compressed using deflate or run length compression. It is necessary to set this property to TRUE if the PDF files must be compatible to older PDF reader programs which are incapable to read JPEG data.

Note that EncodeStreamMethod does not do compression, but it does belong here because the encodings result in different PDF sizes.

The settings are not documented in more detail, so here are the enumerations explaining them in a bit more depth:

–jeroen

Posted in ASCII95, Delphi, Development, Encoding, HEX encoding, Software Development | Leave a Comment »

Some notes on Testinsight Issues

Posted by jpluimers on 2019/04/10

So I won’t forget:

Note to self:

Read the rest of this entry »

Posted in Delphi, Development, Software Development, TestInsight | Leave a Comment »

ILockable/TLockable/Lockable. Similar to IManaged in Spring4D, but provides a Locked interface.

Posted by jpluimers on 2019/04/10

Had to use this to start solving threading issues in a project I inherited a while ago in a temporary way before doing a huge refactoring. Will likely need it in the future as well: ILockable/TLockable/Lockable. Similar to IManaged in Spring4D, but provides a Locked interface..

ILockable/TLockable/Lockable. Similar to IManaged(now IShared) in Spring4D, but provides a Locked interface.

Note this is very inefficient, but can be practical as a shotgun approach to start solving the mess when you inherit a project that has the “I know, I’ll use threads!” approach in it.

Replace the resource typed TNeedsLock that needs protection with a ILockable<TNeedsLock>, then route all references via a call to the Locked()() call to it.

If you need a simpler approach, then use [WayBack] Interfaced monitor lock — Bitbucket by Stefan Glienke.

–jeroen

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, Multi-Threading / Concurrency, Software Development | Leave a Comment »