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 June, 2020

Cursor Movement in bash: either echo escape sequences or use tput

Posted by jpluimers on 2020/06/03

I read [WayBackCursor Movement earlier than [WayBack] Colours and Cursor Movement With tput and [WayBack] The Floating Clock Prompt.

So in one of my scripts I’ve now used an escape sequence, but I might change it to tput in a future version:

## Move one line up, then write finished scripts:
echo -e "\033[1A$finished\r"

I would probably have started with put if I had read [WayBack] bash – Set or change vertical position of the cursor – Stack Overflow first.

–jeroen

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

Are there any static code analysis tools for Delphi/Pascal? – Stack Overflow

Posted by jpluimers on 2020/06/02

Still interesting question: [WayBack] Are there any static code analysis tools for Delphi/Pascal? – Stack Overflow

The basic problem here is that there is no formal language definition for the Delphi or Object Pascal language.

[WayBack] GitHub – RomanYankovsky/DelphiAST: Abstract syntax tree builder for Delphi (which also supports FreePascal and Lazarus) comes closest, and is used by FixInsight.

All other tools have more or less problems parsing various language constructs.

This starts with the built-in tooling that is based on [WayBack] Modeling Applications with Together which basically has not been maintained since the Delphi 2007 era.

Then there is for instance [WayBack] Code Healer Group CodeHealer for Delphi, but their [WayBack] Code Healer Group Forums – Index page have no messages since 2016.

Another wrapper around DelphiAST, is [WayBack] GitHub – MikhailIzvekov/DelphiSCA: Static code analysis tools for Delphi, which has a visual way to walk that AST. But it has not been maintained for years. The cool thing however, is that the AST is in sync with the code editor.

Finally, TestInsight uses DelphiAST to go to the right source code location.

--jeroen

Read the rest of this entry »

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

SysUtils.pas Why parameters of these anonymous not const? TProc = …

Posted by jpluimers on 2020/06/02

At [WayBack] SysUtils.pas Why parameters of these anonymous not const? TProc = reference to procedure (Arg1: T1; Arg2: T2); TProc = reference … – Jacek Laskowski – Google+, Hallvard Vasbotn made this nail on the head comment:

It could have been solved if the const’ness had been seen as a implementation detail by the compiler (which it really is) and made const and non-const signatures assignment compatible.

It was changes like the above that I had hoped for when writing Source: 15 months later: what happened to Delphi Language Enhancements? « The Wiert Corner – irregular stream of stuff.

Now we are another 27 months later, so this again is a reminder to check what the compiler team (man?) has improved on the language side.

–jeroen

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

How do I delete a Bash function? – Stack Overflow

Posted by jpluimers on 2020/06/02

I hardly do this, so I tend to forget that unset -f functionname deletes a function and unset variablename or unset -v variablename deletes a variable.

From:

I have done this:bash $ z() { echo ‘hello world’; }How do I get rid of it?

Source: [WayBackHow do I delete a Bash function? – Stack Overflow

Reference: [WayBack] unset Man Page – Bash – SS64.com

–jeroen

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

GitHub – kzahel/web-server-chrome: An HTTP Web Server for Chrome (chrome.sockets API)

Posted by jpluimers on 2020/06/01

Cool: [WayBack] GitHub – kzahel/web-server-chrome: An HTTP Web Server for Chrome (chrome.sockets API)

This allows you to develop HTTP applications that live in Chrome:

[Archive.is1/Archive.is2Web Server for Chrome – Chrome Web Store: A Web Server for Chrome, serves web pages from a local folder over the network, using HTTP. Runs offline.

Of course you could to python -m SimpleHTTPServer 8888 or python -m http.server 8888, but this runs within chrome and can be used from inside JavaScript projects.

Features

  • serve local files
  • configure listening port
  • configure listening interface (e.g. localhost or all interfaces)
  • custom http handlers possible
  • websocket support available
  • works nice with chrome.runtime.onSuspend
  • options for autostart, start in background, etc etc.
  • handles range requests, HEAD, etc
  • options for CORS
  • optional PUT, DELETE request (for upload files)
  • sets MIME types
  • can render directory listing
  • See relevant options: https://github.com/kzahel/web-server-chrome/blob/master/polymer-ui/options.js

Via [WayBack] This is super useful: A# web #server that runs in #Chrome! Makes it super easy to do local web dev without the hassle of setting up a complex back end s… – Jason Mayes – Google+

–jeroen

Posted in Chrome, Development, Google, JavaScript/ECMAScript, Power User, Scripting, Software Development, Web Development | Leave a Comment »

Logitech remotes for presenting

Posted by jpluimers on 2020/06/01

A few links on Logitech remotes for presenters.

I like how the spotlight can highlight portions of the screen, but I wish it had the LCD display timer of the R800 and R700.

The big problem of the Spotlight seems to be the stability of the Logitech software, both on Windows and on MacOS.

The R series (R800/R700/R500/R400) have lasers that do not reflected well by modern big screens.

A great review of the various presenters is at [WayBack] What’s the Best Logitech Pointer? – R400 vs R700 vs R800 – Sky Tech Lasers.

More background reading at

--jeroen

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

Force NTP Time Update on Linux | KrazyWorks

Posted by jpluimers on 2020/06/01

A while ago, I had a problem that one of my Raspberry Pi machines hadn’t been turned on for a while, so after a reboot the clock was way off.

This resulted in errors like the below: SEC_ERROR_OCSP_FUTURE_RESPONSE errors indicating the TLS certificates being not yet valid (and numerous other TLS certificate issues).

The /etc/ntp.conf was OK, and rcntpd status indicated the service was running. Looking at /var/log/ntp.log I saw a few syncing issues:

11 Feb 20:04:15 ntpd[1419]: receive: Unexpected origin timestamp 0xde15bc7f.59622c55 does not match aorg 0000000000.00000000 from server@93.94.224.67 xmt 0xde2b122f.0d222048
11 Feb 20:04:15 ntpd[1419]: receive: Unexpected origin timestamp 0xde15bc7f.595fec0e does not match aorg 0000000000.00000000 from server@213.154.236.182 xmt 0xde2b122f.0dc06af7
11 Feb 20:04:15 ntpd[1419]: receive: Unexpected origin timestamp 0xde15bc7f.595d4584 does not match aorg 0000000000.00000000 from server@149.210.199.182 xmt 0xde2b122f.0df70400

My guess was that the time was so much of (more than a month) that syncing would not work, so a manual force was needed.

[Archive.is] Force NTP Time Update on Linux | KrazyWorks provides two solutions:

sntp -r pool.ntp.org
# or
ntpdate -u pool.ntp.org

Only the last one works; I’m not sure why yet:

daisy:/etc # ntpdate -u pool.ntp.org
15 Mar 19:20:59 ntpdate[2516]: step time server 131.211.8.244 offset 4140423.716209 sec

Further reading:

–jeroen

SEC_ERROR_OCSP_FUTURE_RESPONSE

SEC_ERROR_OCSP_FUTURE_RESPONSE

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

Reassembling the amazing hanger from Kickstarter

Posted by jpluimers on 2020/06/01

Just in case [Archive.is] How to Reassemble the Hangers lands in bit-heaven:

How to Reassemble the Hangers

instructions to reassemble them:

  1. Hold the two parts in your hand (as shown in Picture 1).
  2. Insert the thinner hook of the right part into the slot at the end of the left hook (Picture 2).
  3. Push the right hook into the slot counterclockwise until it’s all the way in (Picture 3).
  4. Turn the right part clockwise until the two arms meet (Picture 4).
  5. The hanger is fully reassembled (Picture 5).

–jeroen

Read the rest of this entry »

Posted in LifeHacker, Power User | Leave a Comment »