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

Archive for December 19th, 2018

Spring4D How to correctly assign NULL to a Nullable type?

Posted by jpluimers on 2018/12/19

Since I tend to forget this: [WayBack] Spring4D How to correctly assign NULL to a Nullable type? this is correct? fDateTime = Null; or this? fDateTime := nil; – Jacek Laskowski – Google+

The preferred way is fDateTime := nil.

This is possible because of [WayBack] Delphi sorcery: How to create an operator overload that only accepts nil using a reference type (in this case interface) so no non-nil pointers can be passed:

type
  Nullable<T> = record
  strict private type
    Null = interface end;
  public
    class operator Implicit(const value: Null): Nullable<T>;
  end;

–jeroen

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

“I tyically ask recruiters to point out which of these are pokemon” – via “my linkedin profile : ProgrammerHumor”

Posted by jpluimers on 2018/12/19

[Archive.is] Vincent D. Warmerdam (also known as koaning; D is for Damian) put Start-up or Pokémon? Big-data or Pokémon? into practice a while back:

my linkedin profile: “I tyically ask recruiters to point out which of these are pokemon”

Source: [WayBack] “my linkedin profile : ProgrammerHumor

He’s a very interesting person to follow:

I also discovered https://bl.ocks.org because of Vincent. More on that later.

–jeroen

Read the rest of this entry »

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

Python threading: logging exceptions during the `run`

Posted by jpluimers on 2018/12/19

In A few observations on Python while I made my first steps into it, I mentioned the standard threading idiom in Python by wrapping the thread in a function. This has the drawback of having to catch and handle any exceptions in that function.

The higher level [WayBack] threading module has a [WayBack] Thread class with a [WayBack] run() method does not handle exceptions either.

For investigation of threading issues, it’s very convenient to know about the exceptions in a thread and their context.

So I’ve made a small base class that automagically logs any exceptions during a run:

import threading

from log import Log

class ExceptionLoggingThread(threading.Thread):

    def __init__(self):
        threading.Thread.__init__(self)
        self.logger = Log().getLogger()
        self.logger.debug("ExceptionLoggingThread().")

    def run_logic(self):
        self.logger.debug("Thread started.")

    def run(self):
        try:
            self.run_logic()
        except:
            self.logger.exception('Exception in `run`')
            raise

–jeroen

Posted in Development, Python, Scripting, Software Development | Leave a Comment »

Spring4D Conference

Posted by jpluimers on 2018/12/19

Do not forget the early bird sales ends soon for the Spring4D European Conference 2018 – Bergamo Italy, right before Easter 2019.

Both the original author and the current maintainer will be there, and it will be a great place to socialize with fellow Spring4D users.

Buy tickets: [WayBack] Spring4D Conference

Via:

–jeroen

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

 
%d bloggers like this: