The Wiert Corner – irregular stream of stuff

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

  • My badges

  • Twitter Updates

  • 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

Delphi intrinsic functions that evaluate to consts

Posted by jpluimers on 2021/02/23

A long time ago, I wondered Are these really Windows compiler unsupported Delphi Intrinsic Routines about [WayBack/Archive.is] Delphi Intrinsic Routines – RAD Studio.

Today, I limited the documented intrinsic list to the constant intrinsic functions:

const
  _Abs = System.Abs(1);
  _Chr = System.Chr(1);
  _Concat = System.Concat(1);
  _Hi = System.Hi(1);
  _High = System.High(1);
  _Length = System.Length('');
  _Lo = System.Lo(1);
  _Low = System.Low(1);
  _Odd = System.Odd(1);
  _Ord = System.Ord(1);
  _Pi = System.Pi();
  _Pred = System.Pred(1);
  _Ptr = System.Ptr(1);
  _Round = System.Round(1);
  _SizeOf = System.SizeOf(1);
  _Sqr = System.Sqr(1);
  _Succ = System.Succ(1);
  _Swap = System.Swap(1);
  _Trunc = System.Trunc(1);

The limited table is below the fold.

There is also a set of undocumented generic intrinsics that I wrote about in Source: Delphi Compiler Intrinsics can help you collapse generated code for generics a lot.

Of the those undocumented functions, these are constant intrinsic functions:

const // undocumented compiler intrinsics
  _Default = Default(Integer);
  _IsManagedType = IsManagedType(1);
  _GetTypeKind = GetTypeKind(1);
  _IsConstValue = IsConstValue(1);

–jeroen

Read the rest of this entry »

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

Redux: Mac OS X – Spotlight not finding many files: force a rescan solved it

Posted by jpluimers on 2021/02/22

I bumped into a case where none of the steps in Mac OS X – Spotlight not finding many files: force a rescan solved it helped.

The problem was that my SD card at  /Volumes/SanDisk400GB/ was not indexed any more, but the SSD was.

These steps solved it:

$ sudo mdutil -i off /Volumes/SanDisk400GB/
2019-02-25 16:32:47.097 mdutil[14810:3728038] mdutil disabling Spotlight: /Volumes/SanDisk400GB -> kMDConfigSearchLevelFSSearchOnly
    Indexing disabled.
$ sudo mdutil -i on /Volumes/SanDisk400GB/
/Volumes/SanDisk400GB:
    Indexing enabled. 
$ sudo mdutil -E /Volumes/SanDisk400GB/
/Volumes/SanDisk400GB:
    Indexing enabled. 
$ sudo mdutil -E /
/:
    Indexing enabled. 
$ sudo mdutil -p

I am not sure if any of these can be omitted.

An odd thing: sudo mdutil -s does not show any output on progress. It is too late now, but I suspect it requires a volume parameter, just like -i and -E require.

–jeroen

Posted in Apple, Mac OS X / OS X / MacOS, Power User | Leave a Comment »

Why you should critically review how often and why you use various spaces in your home

Posted by jpluimers on 2021/02/22

Below is a great thread on why and how often you use spaces in your home.

It is time to critically review these, especially as the enduring covid crisis in many countries means you will spend a lot more time together for quite some time to come.

Rooms often hardly used, but usually being over-dimensioned or overly invested in:

  • living rooms
  • dining rooms
  • master bed rooms

Rooms under-estimated:

  • kitchens
  • bathrooms
  • family rooms (which seem to be the real living rooms)
  • office / work spaces (too often in small bed rooms)

It helps figuring out the hotspots in your home, and think about why you use them often or seldom, then redo the layout of the house so often used spaces get big enough to efficiently use.

A great video with a study done some 5 years ago is below the fold showing those hotspots for a typical USA home. The same idea applies outside in other countries as well, though they might not have all the rooms a typical USA house has.

Thread: [Archive.is] Kristian Köhntopp on Twitter: “For me, “Working from Home” started at 2020-02-23 due to a fire in the office. A month later, when the building was about to be reopened, Corona struck and forced the entire company into working from home. We will be keeping this up until at least October. This is my desk.… “

–jeroen

Read the rest of this entry »

Posted in LifeHacker, Power User | Leave a Comment »

Downloading Facebook videos as mp4 files in both mobile and HD quality for offline viewing

Posted by jpluimers on 2021/02/22

Videos from the above links below the sig.

–jeroen

Read the rest of this entry »

Posted in Facebook, Power User, SocialMedia | Leave a Comment »

Python: saving a web page to a jpeg image file by using the Google base64url encoded screenshot of it

Posted by jpluimers on 2021/02/19

As a follow-up on Still looking for base64url decoding tools, both on-line and for MacOS homebrew: this is in Python, works on MacOS, Linux and Windows, and can be integrated in a web page.

It is based on the ideas in [WayBack] Python-Twitter-Hacks/websiteScreenshot.py at master · edent/Python-Twitter-Hacks · GitHub, which was more like a code snippet with hard coded literals.

It downloads a jpeg web-site screenshot using the Google PageSpeed API V1, which generates the screenshot as a base64url encoded blob inside a JSON structure.

Python does not have native Python base64url support, but the concept of it is fairly straightforward: [WayBack] RFC 4648 – The Base16, Base32, and Base64 Data Encodings: Base 64 Encoding with URL and Filename Safe Alphabet, which allows data to be passed inside URLs without reverting to [WayBack] Percent-encoding – Wikipedia.

My changes work, but are by no means in canonical form or Idiomatic Python. I have a long way to go to reach that level of Python.

So I forked the repository, and fixed the script basing it on Python 3.

I might make it V2 compatible in the future. More information on V2 in [WayBack] Google APIs Explorer: Services > PageSpeed Insights API v2 > pagespeedonline.pagespeedapi.runpagespeed

Content is in the below gist.

–jeroen

Read the rest of this entry »

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

ColumnCopy – Chrome Web Store

Posted by jpluimers on 2021/02/19

[Archive.is] ColumnCopy – Chrome Web Store: Enables copying columns from tables.

It can read anything on any web page, and it uses modifier keys, so I usually have it disabled until I need it.

You can disable/enable it on this page:

chrome://extensions/?id=lapbbfoohlcmlbdaakldmmallcbcbpjb

Via [WayBack] Select column from a table with Google Chrome – Super User

Sorry to dig up an old thread, but this might help someone in the future. I wrote a Chrome extension called ColumnCopy which accomplishes this task.

–jeroen

Posted in Chrome, LifeHacker, Power User, Web Browsers | Leave a Comment »

Quooker links en afmetingen

Posted by jpluimers on 2021/02/19

(Dutch as that’s where I found the information)

NB: Prijzen waren van begin 2019

  • PDF: Installatiehandleiding COMBI+
  • PDF:  Vervanging HiTAC®-waterfilter bij COMBI(+) (E)
  • PDF: Installatiehandleiding CUBE
  • PDF: Afmetingen Flex kraan
  • [Archive.is] Installateurs

    Klik op het plaatje voor een grotere versie.

  • [WayBack] PDF: Afmetingen reservoirs

    LET OP! Houd rekening met 3 cm extra ruimte in uw keukenkastje boven de COMBI(+) en 8 cm extra boven de COMBI(+) E i.v.m. de slang

  • [Archive.is] Wat zijn de afmetingen van de Quooker-reservoirs? Installatie

    PRO3-reservoir (3L kokendwaterreservoir):

    Reservoir hoogte: 40 cm

    Reservoir diameter: 15 cm

    COMBI(+)-reservoir (7L kokendwaterreservoir):

    Reservoir hoogte: 47 cm

    Reservoir diameter: 20 cm

    CUBE (gekoeld waterreservoir):

    Reservoir hoogte: 43 cm incl. CO2 cilinder

    Reservoir breedte: 30 cm incl. CO2 cilinder

    Reservoir diepte: 44 cm

    Een overzicht van alle specificaties van onze kokendwaterreservoirs vind je hier. Een overzicht van alle specificaties van de Quooker CUBE vind je hier.

    Benieuwd naar de afmetingen van de kranen? Deze vind je op de pagina van de kraan naar jouw keuze.

  • [Archive.is] Onze collectie reservoirs
    • Kokendwaterreservoir COMBI+

      • Samenvatting

        Inhoud 7 liter
        Afmetingen (hoogte x breedte x diepte) 47 x 20 x 20 cm
        Hoeveelheid 40° – 60° Onbeperkte
      • Algemeen

        Reservoir Hoogte 47 cm
        Reservoir Diameter 20 cm
        Opwarmtijd 20 minuten
        Benodigde Werkhoogte 50 cm
      • Vermogen

        Vermogen 2200 W
        Spanning 230 V
        Stand-By Verbruik * 10 W
        Jaarlijks Elektriciteitsverbruik 511 kWh/A
      • Waterdruk

        Minimale Waterleidingdruk 200 kPa (2 bar)
        Maximale Waterleidingdruk 600 kPa (6 bar)
        Max. Werkdruk 800 kPa (8 bar)
      • Beveiliging

        Overdrukventiel 800 KPa (8 Bar)
        Maximaal Temperatuur
      • Specificaties

        Hoeveelheid 40°C Onbeperkt
        Hoeveelheid 60°C Onbeperkt
        Temperatuurregeling Thermostatisch
        Filter High Temperature Activated Carbon
      • Energielabel

        Opgegeven Capaciteitsprofiel XXS
        Energie-Effieciëntieklasse Voor Waterverwarming A
        Energie-Effieciëntie Voor Waterverwarming 36%
        Warmwatertemperatuurinstelling Van Waterverwarmingstoestel 40°C – 60°C
        Geluidsniveau – dB
    • Gekoeldwaterreservoir CUBE

      • Specificaties

        Spanning 230 V
        Vermogen 100 W
        Stand-By Verbruik 12 W
        Reservoir Hoogte 43 cm
        Reservoir Breedte 30 cm
        Reservoir Diepte 44 cm
        Minimale Waterleidingdruk 200 kPa (2 bar)
        Maximale Waterleidingdruk 400 kPa (4 bar)
        Type Waterfilter Hollow Fiber filter
  • [Archive.is] Koel bruisend en gefilterd water met de CUBE [Archive.is image]

Posted in DIY, LifeHacker, Power User | Leave a Comment »

PowerShell: avoid Write-Output, use Return only for ending execution, use $Output variable for returning additional output

Posted by jpluimers on 2021/02/18

Recently, I bumped into [WayBack] Write-Output confusion for the upteenth time.

Luckily I had the below links archived, basically invalidating the use of Write-Output, and invalidating the answer at [WayBack] powershell – What’s the difference between “Write-Host”, “Write-Output”, or “[console]::WriteLine”? – Stack Overflow.

Read the rest of this entry »

Posted in CommandLine, Development, PowerShell, PowerShell, Scripting, Software Development | Leave a Comment »

showthedocs

Posted by jpluimers on 2021/02/18

[WayBack] showthedocs

is a documentation browser that finds the relevant docs for your code. It works by parsing the code and connecting parts of it to their explanation in the docs

, and supports these languages:

  • SQL
    • postgresql
    • mysql
  • Configuration
    • nginx
    • gitconfig

You can enter any language text, then click the language, followed by clicking the “SHOW ME THE DOCS!” button, for which an example is further below.

The site has an open architecture, allowing to plug in more languages and documentation:

 

gitconfig example

So for instance the below ./git/config file leads to this result [WayBack] where you can click on all the coloured areas for easy navigation through the documentation:

Read the rest of this entry »

Posted in *nix, *nix-tools, Database Development, Development, DVCS - Distributed Version Control, git, MySQL, nginx, PostgreSQL, Power User, Software Development | Leave a Comment »

Delphi: not all lists need to be generic

Posted by jpluimers on 2021/02/18

Lots of Delphi programmers made, or are making the move, of classic Delphi based containers like TObjectList into generic containers like TList<T>.

A while ago, I got into a project that needed to extend lifetime of some objects. Virtually all of them were interface based, and most of the code was from the non-Unicode era, and most of the developers there had a strong background in that era, so they started fiddling with TList, found it hard, then thought “maybe TList<IInterface>” where will help.

The problem however, is that Delphi has no IList<T>. For that, you have to go to the Spring4D library.

Then I sat down with them, and proposed to use an instance good old TInterfacedList of which the context was maintained in an IInterfacedList field.

Back in the days where Delphi did not support non-generic types, TInterfacedList was the only built-in way to store interface references, and the Collection Classes framework by Ray Lischner were the only ways to do that in a more structured way (as they were based on interfaces, an idiom that Embarcadero should have used for their generic collections as well; Spring4D did, so use those collection classes and interfaces whenever possible as they are way more versatile than the Delphi built-in ones)

Back to using TInferfacedList, as it can still be useful today in:

unit InterfacesHolderUnit;

interface

uses
  DebuggableInterfacedObjectUnit, System.Classes;

type
  IInterfacesHolder = interface
    procedure Add(const aReference: IInterface);
  end;

  TInterfacesHolder = class(TInterfacedObject, IInterfacesHolder)
  strict private
    FInterfaces: IInterfaceList;
  public
    constructor Create();
    procedure Add(const aReference: IInterface);
  end;

implementation

{ TInterfacesHolder }

procedure TInterfacesHolder.Add(const aReference: IInterface);
begin
   FInterfaces.Add(aReference);
end;

constructor TInterfacesHolder.Create();
begin
   inherited Create();
   FInterfaces := TInterfaceList.Create();
end;

end.

and some tests:

Read the rest of this entry »

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