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,839 other subscribers

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 »

git – I ran into a merge conflict. How can I abort the merge? – Stack Overflow

Posted by jpluimers on 2018/12/18

I need this one day: [WayBackgit – I ran into a merge conflict. How can I abort the merge? – Stack Overflow

–jeroen

Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management | Leave a Comment »

Links to help me monitor my Zeverlution PV converter locally

Posted by jpluimers on 2018/12/18

Since it’s my data, I’d rather be in control myself, so here are some links that will help me going around the Zevercloud solution I posted about yesterday.

Some other interesting links of software supporting Zeversolar devices:

Note that PVoutput.org does have native ZeverCloud updating using the ZeverSolar API key:

But these might help me:

–jeroen

Read the rest of this entry »

Posted in Development, Hardware Interfacing, LifeHacker, Power User, Software Development, Solar Power, Zeverlution, Zeversolar | Leave a Comment »

Reminder to self: make a list of URL suffixes to show branch diagrams of repositories

Posted by jpluimers on 2018/12/18

One of the BitBucket features I like a lot is that in the commit history, you see the branches involved in a nice diagram on the left side of the commits: https://bitbucket.org/pypy/pypy/commits

BitBucket used to be popular to host public repositories, but from a public perspective, they are on the decline for that (they even removed the [once popularbitbucket.org/explore page and [WayBack] will not re-introduce it).

Right now, only major git based hosters still have explore pages:

So it makes sense to see where they provide diagrams of branches, so here are some examples to go from a project to the graph:

–jeroen

Posted in BitBucket, Development, DVCS - Distributed Version Control, git, GitHub, GitLab, Mercurial/Hg, Software Development, Source Code Management | Leave a Comment »

Never ever put OutpugDebugString in code that is meant to run on production systems

Posted by jpluimers on 2018/12/18

I just saw this code in the Delphi RTL enabled for RELEASE builds of the procedure TThreadPool.TQueueWorkerThread.Execute; code:

{$IFDEF MSWINDOWS}
    OutputDebugString(PChar(Format('Thread Exiting: %d', [ThreadId])));
{$ENDIF}

Never, ever do this.

If you code review code that contains it: ensure it has some kind of compile time DEBUG conditional around it.

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 12 Comments »

linux – Is there a way to remove “Last message repeated x times” from logs? – Server Fault

Posted by jpluimers on 2018/12/17

One day I will need to enable repeating those messages: [WayBack] linux – Is there a way to remove “Last message repeated x times” from logs? – Server Fault

–jeroen

Posted in *nix, *nix-tools, Linux, Power User | Leave a Comment »

Registering your Zeverlution device in the Zeversolar cloud

Posted by jpluimers on 2018/12/17

If you have a Zeverlution PV converter, the easiest to get at the data is through the Zeversolar cloud.

The included documentation does not contain web browser registration instructions, only Android/iOS app.

So here we go:

  1. Create an account at [WayBackZeverCloud – Login: click CREATE AN ACCOUNT, then
    1. Fill in these fields:
      • Email
      • Password
      • Re-type Your Password
    2. Check the I agree to the Terms of Service & Privacy Policy box
    3. Press SUBMIT button
    4. Wait for your confirmation email to arrive
    5. Confirm your account
    6. Logon
  2. Follow the https://www.zevercloud.com/station/create link, then
    1. Fill in these fields:
      1. Monitor SN (this is actually the MAC address without seperator; it starts with EAB961 which is an unknown OUI)
      2. Registry Key
    2. Press the Continue button
    3. Fill in these fields:
      1. Plant Name
      2. Installed Capacity (note the unit is not Wp, but KWp, so multiply the # of panels by the Wp of the panels, then devide by 1000)
      3. Commissioning (date in YYYY-MM-DD format)
      4. Company/Organization
    4. Press the Continue button
    5. Fill in these fields:
      1. CO2 Avoided Factor (the unit is Kg/KWh; For The Netherlands get it from [Archive.isLijst emissiefactoren | CO2 emissiefactoren under ELEKTRICITEIT)
      2. Yield Factor (the unit is Currency/KWh where Currency is from field 3; get this from your local energy supplier)
      3. Currency
      4. Timezone *
    6. Check the Automatically adjust clock for Daylight Saving Time box
    7. Press the Continue button
    8. Fill in these fields:
      1. Country
      2. State
        1. Since this field could not be filled in for The Netherlands, I changed it using the Chrome Developer Tools having one option value: <option value="0">N/A</option>
      3. City
      4. Street/No.
      5. Zip Code
      6. Longitude
      7. Latitude
    9. Press the Save button

Note that the 2.0.2 version of [WayBack] ZeverCloud – Apps on Google Play does not work on Android Oreo.

Via internal Zeversolar channels, I got 2.0.2 development version Android works on Oreo – ZeverCloud.apk.zip which despite the same version number, does work.

–jeroen

Read the rest of this entry »

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