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,730 other followers

Far less active on blog on social media: some personal things that need to be done.

Posted by jpluimers on 2019/04/03

Some people already noticed me being far less active on social media including this blog.

This will continue for a while, as I am supporting two people that are very dear to me.

  • One needs to get some MRI scans very soon, with past results not being promising, so consequences not clear yet.
  • Another I am protecting from mental abuse by somebody close, something which is very hard to prove, but has very real consequences. Recognising the – initially very subtle – behavioral changes, and convincing other people up the supporting and medical tree they were indeed true and related, took several years, so I recon the recovery process will take long too.

Luckily, my blog queue has been filled with about 2 years of content, so that will run automatically.

Social media response from me will be on a “when I feel like it” base until further notice, focussing on things that give me energy and bring me joy.

–jeroen

 

Posted in About, Personal | Leave a Comment »

The biggest lie I tell myself is not about new years resolutions.

Posted by jpluimers on 2019/01/01

The biggest lie I tell myself is “I don’t need to write that down, I’ll remember it”

It’s likely older, but the oldest reference I could find was 2012¬†[WayBack].

So before I forget:

Happy New Year everyone!

With the above quote, it is no coincidence I started my blog even earlier (in 2009): it’s my off-line memory, way better readable than my hand-writing and indexed by various search engines.

Read the rest of this entry »

Posted in About, LifeHacker, Personal, Power User | Leave a Comment »

My code of conduct – Marcin Juszkiewicz

Posted by jpluimers on 2019/10/17

There are many “code of conduct” documents. Often they differ a lot. I have my own: Do not be an asshole. Respect the others.

Source: [WayBack] My code of conduct РMarcin Juszkiewicz

Via: [WayBack] I like this code of conduct and general remarks. РJean-Luc Aufranc РGoogle+

–jeroen

Posted in LifeHacker, Power User | Leave a Comment »

The Delphi System.Exit “Function”

Posted by jpluimers on 2019/10/17

Still wrongly documented as System.Exit Function [WayBack], most people think it is a statement.

However, it is a compiler intrinsic procedure in the System unit that Рwhen called inside a real function Рoptionally accepts a parameter with the same type as the encompassing function because it is a compiler intrinsic. It kind of acts as an overloaded procedure, but in fact translate to machine code via an intermediate parse tree.

The parameterless version has been there since at least Turbo Pascal 3.0, but the parameterised version is more recent: I think it was introduced around Delphi 7.

It then stops executing that function after first executing any explicit or implicit finally blocks.

I’ve seen various projects that used their own Exit¬†procedure. This is a very bad habit: Since the System unit is always further away in scope, the introduced one is called which can severely confuse programmers not being aware of this.

The code generation for the parameterless and parameterised¬† “overloads” of System.Exit is slightly different:

  • The parameterless one can often be optimised away, for instance folding multiple calls to them into one, or rearranging code execution so a jump isn’t needed any more. This means you cannot always put a breakpoint on them.
  • The parameterised one always needs code to load the function result, so you can always put a breakpoint on them.

Stefan Glienke explained the above in [WayBack] The advantage of using Exit() instead of a plain Exit? You can place a breakpoint! РUwe Raabe РGoogle+

–jeroen

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

How to debug small programs

Posted by jpluimers on 2019/10/17

As a follow up of SSCCE, MWE and MCVE are basically the same: provide code people can use to reproduce a problem, I found [WayBack] How to debug small programs which is starts as

One of the most frequent categories of bad questions I see on StackOverflow is: I wrote this program for my assignment and it doesn’t work. [20 lines of code]. And… that’s it.

Then it goes on how to debug those pieces of code, trim them into an SSCCE/MWE/MCVW to form the base of a question which you can ask on StackOverflow/SuperUser/ServerFault/StackExchange, forum, group/community or even your co-worker.

The really cool thing about the techniques used there are that they also apply to bigger pieces of code, heck even large code bases.

They force you to trim down your problem in to manageable pieces that are easy to explain and write concise documentation and tests around them to assist you in the process.

Below are the steps in a short list. Be sure to read the original article How to debug small programs | Fabulous adventures in coding after going through the list.

  1. Turn on compiler warnings, inspect all of them, resolve or explain them
  2. Rubber duck to an imaginary person or even a live one explaining each part in simple terms
  3. If the bug is still there, break up the code into pieces
  4. Write technical specifications for all the pieces
  5. Verify the pieces against the specifications, for instance by adding pre- and postconditions to them
  6. Add assertions in the pieces for all the specifications
  7. Write test cases for the pieces
  8. Write down on paper the expected behaviour for all the lines of code
  9. Use a debugger to step through all the lines of code and verify the expected behaviour you wrote down
  10. While debugging, listen to all your doubts (gut feeling is a good thing!)

This sounds like a lot of work. It is. All good programming is.

If you apply these before writing any logic code, then your life becomes easier because you will spot bugs sooner:

  • specification
  • test cases
  • preconditions
  • postconditions
  • assertions

Does this again sound like a lot of work?

Then remember: taking a shortcut will make the actual work longer. The reason is that hunting for bugs is a tedious and time consuming process scaling very badly with complexity.

–jeroen

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

delphi – How to set form height larger than 1096 pixels? (or width > 1620 pixels)- Stack Overflow

Posted by jpluimers on 2019/10/16

Delphi will limit [WayBack] Height or [WayBack] Width of a form in the designer based on the current Windows limitations, not on what your target users might.

See [WayBack] delphi РHow to set form height larger than 1096 pixels? РStack Overflow:

The reason for this behavior is that when you do not set constraints for the form size, Delphi will automatically get constraints at system level via the [WayBack]¬†WM_GETMINMAXINFO message, which is fired when…

Solution is to configure the [WayBack] Constraints property by setting either [WayBack] Constraints.MaxHeight or [WayBack] Constraints.MaxWidth.

Via:¬†[WayBack] Since I put up 10.2, I cannot get a form width >1620. Whenever I enter a greater value, the system changes it back! As I have some programmes with comp… – erik wilson – Google+

–jeroen

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

Some Delphi settings require you to run with an Administrative UAC token

Posted by jpluimers on 2019/10/16

Though user-defined Code Templates live under %UserProfile%\Documents\Embarcadero\Studio\code_templates\Delphi, the stock ones (standard ones shipping with Delphi) ones do not: they live under %ProgramFiles(x86)%\x\Studio\y.0\ObjRepos\en\Code_Templates.

Above, x usually is Embarcadero, and y is your Galileo version number; see for instance Update to List-Delphi-Installed-Packages.ps1 shows HKCU/HKLM keys and doesn’t truncated fields any more.

Unlike user registry settings, which are copied from HKEY_LOCAL_MACHINE to HKEY_CURRENT_USER, the stock Code Templates are not.

This means that if you want to change the stock Live Templates (for instance disable them) from the IDE, or from the Windows Explorer, you need to run them with an UAC token to elevate them to Administrator level permissions.

Oh, did you notice the consistency between code_templates and Code_Templates? Delphi is full of these consistency surprises**

via:¬†[WayBack] EDIT…..ANSWER: Right-click and run Delphi IDE as “Run as Admin”.. remove the template. Start IDE normally. .. IMHO, you shouldn’t have to do this… – Vin Colgin – Google+¬†who commented:

Vin Colgin:
+Uwe Raabe yes. Imho. Delphi should use a UAC helper app to change things that need elevated permissions… just like we all have been doing with shipping software since Windows Vista. But nobody asked me. Imho.

as a response to

Uwe Raabe:
Usually you don’t have access rights to Program Files where the standard code templates live. Therefore you cannot remove any of these from inside the IDE. Either adjust the behavior to your needs (that will make a copy) or remove it from $(BDS) with admin rights.

** Some more consistency examples:

Just pick a few functions from these or more recent Delphi versions:

For example (there are many more):

Read the rest of this entry »

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

 
%d bloggers like this: