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

Archive for 2020

find – display only files starting with . (hidden) – Unix & Linux Stack Exchange

Posted by jpluimers on 2020/08/21

find . -type f -name '\.*' -print

Must work if you want list every hidden file down in the directory hierarchy.

This sort of works on Linux, but fails on VMware ESXi (on Linux it only works when applying -maxdepth 1, deeper levels fails because they list all files where the top directory starts with a .):

If you want hidden files and hidden directories, without . and .. :

find -regex '\./\..+' -print

This works on both Linux and VMware ESXi:

If you want hidden files and hidden directories, without . and .. :

find . \( -type f -o -type d \) -name '\.*' -print

Based on:

–jeroen

Posted in *nix, *nix-tools, bash, bash, Development, Power User, Scripting, Software Development | Leave a Comment »

Santa Cruz County fire evacuations

Posted by jpluimers on 2020/08/21

Tweeps to follow:

Packing list for evacuation:

Maps

https://storymaps.arcgis.com/stories/f0121f7f2f0941afb3ed70529b2cee75

https://smco.community.zonehaven.com

https://www.sfchronicle.com/projects/california-fire-map/2020-czu-august-lightning-complex

https://caltopo.com/map.html#

https://twitter.com/erin_bergren/status/1296816829772582918

Finding your zone by address

Marking yourself safe:

https://m.facebook.com/crisisresponse/781051566056232/friends

Drinking water likely unsafe for a long time:

https://twitter.com/erin_bergren/status/1299971292922368000

https://twitter.com/erin_bergren/status/1299770836333756418

https://twitter.com/erin_bergren/status/1299774051234316291

https://twitter.com/erin_bergren/status/1299971292922368000

Updates:

Damaged properties map

https://twitter.com/StillSnarky/status/1298416060643729408

http://www.santacruzcounty.us/firerecovery/damageassessmentmap.aspx

Ben Lomond library on Alba Road is gone:

https://twitter.com/S68004838/status/1296922483359014912

https://twitter.com/erin_bergren/status/1296905259906764800

Our friends house burned down, but their animals seem OK:

[Wayback] CZU Lightning Complex Fire Upper Alba Road – Danny Thorpe

 

First picture of the smoke

https://twitter.com/JalapenoMan1/status/1296892763787554816

Cleaning up the ashes

Safe Ash Clean-Up During and After a Fire

Containment calculation

https://twitter.com/erin_bergren/status/1298471414845112323

Via

Rough map

View the CZU Lightning Complex fires on Google Maps
https://maps.app.goo.gl/QuasoWw8nbQBtr5o7

Posted in Uncategorized | Leave a Comment »

Tracing a packet journey using Linux tracepoints, perf and eBPF | Yet another enthusiast blog!

Posted by jpluimers on 2020/08/21

As I need this one day: [WayBackTracing a packet journey using Linux tracepoints, perf and eBPF | Yet another enthusiast blog!

Via: [WayBack] Great read about bpf – Kristian Köhntopp – Google+

–jeroen

Posted in Linux, Power User | Leave a Comment »

Delphi unit aliases: multiple ones can point to the same unit

Posted by jpluimers on 2020/08/20

A while ago, I had to figure out how to get some GExperts stuff cross-compile to older Delphi versions, because of UITypes usage that is not available in Delphi XE and lower (but much of what it contains is in the Types unit).

So I went down memory lane, as I remember in Delphi 2, the Delphi 1 WinTypes and WinProcs units were merged into the Windows unit.

A quick search revealed the stackoverflow entry mentioned here:

for the Delphi 1 -> Delphi 2 migrations, these aliases were used where multiple units pointed to the same one:

WinTypes=Windows;WinProcs=Windows;DbiProcs=BDE;DbiTypes=BDE;DbiErrs=BDE

See [WayBack] delphi – wintypes.dcu not found and code completion stops working – Stack Overflow

A longer search found this in my own archives:

File D2-CS-2.0\DEMOS\DOC\AUTOPROJ\AUTOPROJ.DOF

Has this line:

UnitAliases=WinTypes=Windows;WinProcs=Windows

Source: [WayBack] GX_GenericUtils.pas fails to build in Delphi 2007 because it uses unit UITypes · Issue #22 · jpluimers/GExperts · GitHub

(Ab)using unit aliases to fail on VCL

You can use unit aliases so your applications cannot use the VCL any more.

The trick is to alias Forms or VCL.Forms into something that does not exists, like Forms=__no_VCL_Forms__. The reason this works is that any VCL application uses the Forms unit because of the Forms.Application variable.

Reference:

–jeroen

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

Don’t use the TPL as it still has rough edges in unsuspected places

Posted by jpluimers on 2020/08/20

A few posts on why not to use the TPL and be very careful with regular RTL threading code:

In my opinion, threading code needs to be written and maintained by people that live and breath multi-threading. Over the years, RTL and TPL have not lived up to that, but a library like [WayBack] OmniThreadLibrary has.

If you still insist on the TPL, or want to break it, start with these posts: [WayBack] Parallel Programming Archives • Stephen Ball’s Technical Blog

–jeroen

Posted in Delphi, Development, Software Development | 1 Comment »

Happy birthday UDP!

Posted by jpluimers on 2020/08/20

Today it’s the 40th birthday of UDP. Or more precise: 40 years after [WayBackRFC 768 – User Datagram Protocol got submitted.

It is still used a lot today, so be sure to read more background on [WayBackUser Datagram Protocol – Wikipedia.

And of course on a birthday, it is nice to have few good jokes. So here we go:

[WayBack“I would tell you a joke about UDP, but you probably wouldn’t get it.” | Hacker News

[WayBack] I would tell you a joke about UDP, but you probably wouldn’t get it. So here’s a TCP joke | reddit.

[Archive.is]:

  • UDP packet bar walks into
  • The best thing about UDP jokes is that I don’t care if you get it. #sysadmin #networking #IT

You can generate more yourself: udpjoke.py

–jeroen

Read the rest of this entry »

Posted in Communications Development, Conference Topics, Conferences, Development, Event, History, Internet protocol suite, UDP | Leave a Comment »

windows – Batch-file: undocumented wild card characters to check for file pattern existence – Stack Overflow

Posted by jpluimers on 2020/08/19

I wish I had known these undocumented wildcards exists like two decades ago: [WayBackwindows – Batch-file: Check if file with pattern exist – Stack Overflow, thanks Squashman:

There are undocumented wildcards that you can use to achieve this as well.

IF EXIST "D:\*Backup*.<" (
   ECHO "file exist"
) ELSE (
   ECHO "file not exist"
)

This wildcard option and other were discussed in length at the following two links.

From those links:

The following wildcard characters can be used in the pattern string.

Wildcard character  Meaning

* (asterisk)
Matches zero or more characters

? (question mark)
Matches a single character

" 
Matches either a period or zero characters beyond the name string

>
Matches any single character or, upon encountering a period or end of name string, advances the expression to the end of the set of contiguous >

<
Matches zero or more characters until encountering and matching the final . in the name

–jeroen

Posted in Batch-Files, Development, Scripting, Software Development | Leave a Comment »

TMonitor versus Critical sections revisited: when possible, use SRWL over TMonitor, then TCritical section

Posted by jpluimers on 2020/08/19

Via [WayBack] TMonitor vrs Critical sections revisited. Back then (https://www.delphitools.info/2013/06/06/tmonitor-vs-trtlcriticalsection/), it was found that critic… – Kiriakos Vlahos – Google+ as he re-did the measurements that DelphiTools did before Delphi XE5 came out:

Slim Reader/Writer Lock (SWRL) is even faster than TMonitor:

  • CriticalSection 0.035
  • TMonitor 0.019
  • SWRL 0.012

Of course if you have a speedy lock-free solution, that is always favourable, but few people know how to write lock free data structures or how to find the libraries (despite Julian Bucknall covering quite a few of them in Delphi back in the days).

Related:

–jeroen

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

Nick Hodges on SOLID in TypeScript using Angular

Posted by jpluimers on 2020/08/18

For my link archive: after a long history of Delphi programming, Nick Hodges did a

SOLID series with TypeScript using Angular

They explain these SOLID – Wikipedia concepts:

  1. Single responsibility principle – Wikipedia
  2. Open–closed principle – Wikipedia
  3. Liskov substitution principle – Wikipedia
  4. Interface segregation principle – Wikipedia
  5. Dependency inversion principle – Wikipedia

After that, he did a series on:

[WayBack] Angular 101 – Angles and Types

More Angular and TypeScript

Since Nick likes that combination so much:

and his TypeScript series start:

and what started as a trilogy in 5 parts of his [WayBack] Angular 101 – Angles and Types became much longer:

Related:

DIID update

Nick also updated the public repository with the changes that did make it in his Dependency injection in Delphi book earlier:

–jeroen

Read the rest of this entry »

Posted in Design Patterns, Development, Scripting, Software Development, TypeScript | Leave a Comment »

In the series “avoid Variants when coding in Delphi”: the comparison operator

Posted by jpluimers on 2020/08/18

For Variant types, the = comparison operator in Delphi maps to the VarCompareValue in the Variants unit.

That function fails to handle various comparisons and for some it knows it can handle raises a VarInvalidOp through various code paths (like CheckType) to VarInvalidOp because the implementation limits itself to varEmpty..varUInt64, which I think means that these are unsupported:

  • varRecord
  • varStrArg
  • varObject
  • varUStrArg
  • varString
  • varAny
  • varUString
  • varArray
  • varByRef

This fails when using the = operator:

What is this code supposed to do, if v1 and v2 are variant arrays with the same content?

if v1 = v2 then
  WriteLn('equal')
else
  WriteLn('not equal');

Spring4d has a function SameValue in the Spring.pas unit which handles more cases, at least the case when both operands are arrays having the same content.

Source: [WayBack] I think I may have mentioned that I hate Variants: What is this code supposed to do, if v1 and v2 are variant arrays with the same content? if v1 = v2… – Thomas Mueller (dummzeuch) – Google+

Thanks to Thomas Mueller and Stefan Glienke for this.

–jeroen

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