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 November, 2018

Delphi: updating a (potentially non-existing) item in a generic TDictionary: use ExtractPair. Except in Delphi 2010/XE.

Posted by jpluimers on 2018/11/06

“Documented” in Delphi 2010, [Archive.is] Generics.Collections.TDictionary.ExtractPair – RAD Studio VCL Reference, and functioning bug-free since Delphi XE2, but still hardly documented, [Archive.is] System.Generics.Collections.TDictionary.ExtractPair – XE2 API Documentation is the easiest way to get a value out of a dictionary and updating it, even if it does not exist.

ExtractPair extracts the TPair<TKey, TValue> if it exists (and removes it from the dictionary) or returns a Default initialised one if not. Though Default is still not documented, you can find an example at [WayBack] How to properly free records that contain various types in Delphi at once? – Stack Overflow.

Example code for ExtractPair:

  FEceptionDictionary := TDictionary<TExceptionKey, Integer>.Create();

...

var
  ExceptionCountPair: TPair<TExceptionKey,Integer>;
begin
  TMonitor.Enter(FEceptionDictionary);
  try
    ExceptionCountPair := FEceptionDictionary.ExtractPair(ExceptObj.ClassType); // extracts and removed from dictionary!
    FEceptionDictionary.Add(ExceptionCountPair.Key, ExceptionCountPair.Value + 1); // use Value as count
  finally
    TMonitor.Exit(FEceptionDictionary);
  end;
end;

In Delphi 2010 and XE it was buggy (see [WayBack] QualityCentral 80947: TDictionary.ExtractPair Fails and creates memory leak via [WayBack] generics – Delphi TPair Exception – Stack Overflow), but since then it works fine, and now is properly documented:

[WayBack] System.Generics.Collections.TDictionary.ExtractPair – RAD Studio API Documentation

Returns the TPair<TKey,TValue> pair with the specified Key and [WayBackremoves the returned pair from a dictionary.

If the dictionary does not contain the specified Key, the returned pair contains a default TValue.

–jeroen

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

Validating a nested XML element with an empty namespace using XSD – Stack Overflow

Posted by jpluimers on 2018/11/06

In a quest for making Delphi Group Project XML files (with extension .groupproj) validate with XSD, I had to find out about [WayBackValidating a nested XML element with an empty namespace using XSD – Stack Overflow.

I needed the XSD so I could import it in Delphi in order to write a good .groupproj file generator.

They are here:

And some more background posts are here:

–jeren

Posted in Delphi, Development, Software Development, XML, XML/XSD, XSD | 1 Comment »

Some Computerphile videos starring Professor Brian Kernighan

Posted by jpluimers on 2018/11/06

Most you probably know [WayBackProfessor Brian Kernighan or the YouTube channel Computerphile (sister channel of Numberphile).

He stars in about half a dozen of their videos giving a nice insight in his contributions to the field and how well he can explain things.

Full videos are below; these are the titles:

BTW: If you like those youtube channels, check out [WayBackBrady Haran – Video Journalist who produces similar channels as well.

–jeroen

Read the rest of this entry »

Posted in *nix, Awk, C, Development, Power User, Scripting, Software Development | Leave a Comment »

Anyone who knows how to disable logs with “Click-To-Run General Telemetry” entries?

Posted by jpluimers on 2018/11/05

Both in %TEMP% and %Windir%\TEMP, a lot of log files named %COMPUTERNAME%-yyymmdd-hhnn.loghaving entries named Click-To-Run General Telemetry appear.

Anyone who knows how to disable this logging?

I think they are related to Office 2016 installed through Office 365.

Disabling the Click-To-Run Monitor scheduled task is not a good solution, as it will also Office disable update notification: [WayBack] MS Office 2016 – Click to run logs | MalwareTips Forums

–jeroen

Posted in Office, Office 2016, Power User, Windows | Leave a Comment »

Wieso eigentlich PPPoE, Deutschland? Ganz früher, als Ihr noch ein Joghurt im Regal war…

Posted by jpluimers on 2018/11/05

An historic view on PPPoE usage: [WayBack] Wieso eigentlich PPPoE, Deutschland? Ganz früher, als Ihr noch ein Joghurt im Regal wart und die Telekom von ISDN mit Kanalbündelung (128kBit/s) auf DSL… – Kristian Köhntopp – Google+

Note that in The Netherlands:

Actually, xs4all DSL and Fiber use PPPoE too, in large part because it makes it easer for them to do IPv6. From https://www.xs4all.nl/service/diensten/internet/installeren/modem-instellen/hoe-kan-ik-een-ander-modem-dan-fritzbox-instellen.htm

<<<
ADSL
PPPoA (vpi/vci 8/48, vc-mux). Via de PPPoA verbinding loopt zowel IPv4 als IPv6 verkeer.
PPP authenticatie: PAP
• PPP credentials moeten ingevuld zijn (de waarden zijn niet belangrijk, maar er moet er wel iets ingevuld zijn)

VDSL en FTTH
PPPoE via VLAN6 (802.1Q). Via de PPPoE verbinding loopt zowel IPv4 als IPv6 verkeer.
• PPP authenticatie: PAP
• PPP credentials moeten ingevuld zijn (de waarden zijn niet belangrijk, maar er moet er wel iets ingevuld zijn)
RFC4638 wordt ondersteund op ons netwerk. Dit betekent dat u als klant een MTU van 1500 kunt gebruiken als uw router RFC4638 ondersteunt.
>>>

–jeroen

Posted in ADSL, fiber, Internet, Power User | Leave a Comment »

Ebike battery – comprehensive page about Lithium Ion batteries and their technology

Posted by jpluimers on 2018/11/05

Very much worth reading: [WayBackEbike battery

Via: [WayBack] Nice page about LiFePO4 and other Li-ion batteries. The site has practical info about solar and microcontrollers too, the guy built a solar bicycle. – Bert Lindner – Google+

References [WayBackBattery test-review 18650 summary with sub-pages:

–jeroen

Posted in 18650, Batteries, Li-Ion, Power User | Leave a Comment »

Elektrisch gereedschap in de Pricewatch – Tweakers

Posted by jpluimers on 2018/11/05

Van enige tijd geleden:

Speciaal voor jullie hebben we de Pricewatch uitgebreid met de categorie elektrisch gereedschap. Je kunt sinds kort eenvoudig de specificaties en prijzen van elektrisch gereedschap met elkaar vergelijken.

Source: [Archive.isElektrisch gereedschap in de Pricewatch – Win een accuschroefmachine of telefoon – IT Pro – .Plans – Tweakers

Ik ben ook benieuwd of deze er inmiddels in staan:

–jeroen

Posted in LifeHacker, Power User | Leave a Comment »

It’s 2018 and USB Type-C is still a mess – Android Authority

Posted by jpluimers on 2018/11/05

Via: [WayBack] USB-C Cable Mess I just got a new smartphone, with USB-C of course. I have a mobile external SSD, which can easily be connected as an OTG device to sai… – Jürgen Christoffel – Google+

–jeroen

Posted in Hardware, Power User, USB, USB-C | Leave a Comment »

This two-year-old X.org give-me-root hole is so trivial to exploit, you can fit it in a single tweet • The Register

Posted by jpluimers on 2018/11/02

If you run X.org, then patch now because of [WayBack] This two-year-old X.org give-me-root hole is so trivial to exploit, you can fit it in a single tweet • The Register

Overwrite arbitrary files? Load arbitrary code? As setuid root? Sure, why not!

This one got introduced in 2016, which is a lot more recent than an issue discovered in 2014 that was “ancient”: [WayBack] ‘Critical’ security bugs dating back to 1987 found in X Window • The Register:

27-year-old flaw and others slain in open-source patch batch

Via eXploit X: Give Me Root” – Computerphile

–jeroen

Read the rest of this entry »

Posted in History, Power User, Security | Leave a Comment »

IPv4 to IPv6 conversion on a load balancer causing rare packet loss

Posted by jpluimers on 2018/11/02

Nice find on not so nice packet conversion: [WayBack] Fun with IPv6 We were investigating packet loss. The loss rate was very low (smaller than 1 of 1000) but as UDP was used, it caused rare but noticeab… – Martin Seeger – Google+

Basically the load balancer could not cope well converting empty IPv4 UDP checksums to IPv6 and back.

Or like Kris mentioned it: [WayBack] Null. In Zahlen: -1., causing a nice set of comments to be posted on short term solutions versus long time forgotten problems.

–jeroen

Posted in Internet, IPv4, IPv6, Network-and-equipment, Power User, routers | Leave a Comment »