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 the ‘Software Development’ Category

In the WordPress classic editor, avoid the SyntaxHighlighter Code Block

Posted by jpluimers on 2023/10/25

When you use the WordPress classic editor (which for me still works far better than the Gutenberg one), avoid at all cost the use of the [Wayback/Archive] SyntaxHighlighter Code Block – Page 2 – WordPress.com Support.

Each time you switch between from Text View back to Visual, some characters are html-encoded, like:

  • & becomes &
  • > becomes >

Switching twice makes & into &&gt.

Switching three times makes & into &&&gt.

I already explained why to avoid the Gutenberg editor in Bookmarklet to force WordPress classic-editor.

Via:

–jeroen

Posted in Classic editor, Development, Gutenberg editor, SocialMedia, Software Development, Web Development, WordPress, WordPress | Leave a Comment »

Delete (very) old tweets obtained from a twitter archive

Posted by jpluimers on 2023/10/24

[Wayback/Archive] Delete (very) old tweets obtained from a twitter archive comments:

# Largely copied from http://www.mathewinkson.com/2015/03/delete-old-tweets-selectively-using-python-and-tweepy
# However, Mathew's script cannot delete tweets older than something like a year (these tweets are not available from the twitter API)
# This script is a complement on first use, to delete old tweets. It uses your twitter archive to find tweets' ids to delete
# How to use it :
#     - download and extract your twitter archive (tweet.js will contain all your tweets with dates and ids)
#     - put this script in the extracted directory
#     - complete the secrets to access twitter's API on your behalf and, possibly, modify days_to_keep
#     - delete the few junk characters at the beginning of tweet.js, until the first '['   (it crashed my json parser)
#     - review the script !!!! It has not been thoroughly tested, it may have some unexpected behaviors...
#     - run this script
#     - forget this script, you can now use Mathew's script for your future deletions
#
#  License : Unlicense http://unlicense.org/

It is by [Wayback/Archive] Anil (@TheOtherAnil), who also wrote [Wayback/Archive] @captions_please (mentioned in my earlier post Two more Twitter bots that help with inclusion and accessibility (a11y): @get_altText and @captions_please), see:

[Wayback/Archive] Anil on Twitter: “@captions_please @jazzthefraz ah sorry the bot didn’t run earlier because of a bug. Should be fixed now.”

–jeroen

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

Remember Excel import issues causing a change in Guidelines for human gene nomenclature | Nature Genetics

Posted by jpluimers on 2023/10/23

Remember [Wayback/Archive] Guidelines for human gene nomenclature | Nature Genetics?**

You might not, but this was what pointed me to it back in 2020: [Wayback/Archive] Scientists rename human genes to stop Microsoft Excel from misreading them as dates – The Verge.

The article was a result of Excel mangling import data for decades. Somehow finally it did get Microsoft’s attention and more than 3 years later, they issued options (with mangling still being the default) to help workaround the problems.

The 2004 article [Wayback/Archive] Mistaken Identifiers: Gene name errors can be introduced inadvertently when using Excel in bioinformatics | BMC Bioinformatics | Full Text demonstrated this import problem which had been present for quite a while already (it even has a csh Script to scan for SymbolMutation error).

The gene nomenclature people by now have moved to a different naming scheme, but maybe other people can benefit from the Excel updates of which you can find more through these links:

Read the rest of this entry »

Posted in CSV, Development, Excel, Office, Power User, Software Development | Leave a Comment »

Forgot to blog: on Windows, use Certutil to Get File Hashes

Posted by jpluimers on 2023/10/19

I have had these two batch files on my system forever:

  • sha1.bat:
    :: https://superuser.com/questions/245775/is-there-a-built-in-checksum-utility-on-windows-7
    :: https://www.mcbsys.com/blog/2017/03/use-certutil-to-get-file-hash/
    :: Windows 7 has case sensitive Hash algorithms: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512
    certUtil -hashfile %* SHA1
  • sha256.bat:
    :: https://superuser.com/questions/245775/is-there-a-built-in-checksum-utility-on-windows-7
    :: https://www.mcbsys.com/blog/2017/03/use-certutil-to-get-file-hash/
    :: Windows 7 has case sensitive Hash algorithms: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512
    certUtil -hashfile %* SHA256

But I forgot to blog about [Wayback/Archive] Use Certutil to Get File Hash | MCB Systems mentioning:

on Windows 7, the hash algorithms are case-sensitive. Be sure to type, for example, “MD5”, not “md5”. On Windows 8.1 and 10, case doesn’t matter

I did mention the first link in “error: invalid object 100644” “git svn”, though only in a by-line. So thanks [Wayback/Archive] user64996 for asking and:

–jeroen

Posted in Batch-Files, CertUtil, Development, Power User, PowerShell, Scripting, Software Development, Windows | Leave a Comment »

Chrome (likely also Firefox/Edge/Safari): no non-global way to workaround Bookmarklets failing on GitHub raw code with “Blocked script execution…”

Posted by jpluimers on 2023/10/18

Last year, I answered [Wayback/Archive] javascript – Bookmarklet to append a string to a URL – Stack Overflow (asked by [Wayback/Archive] Karlo Guidoni Martins, thanks!).

It is about not being able to run bookmarklets on pages hosted by for instance:

  • gist.githubusercontent.com
  • raw.githubusercontent.com

GitHub is an exception, as RAW files from these services do work fine:

At first sight, when running a Bookmarklet on those RAW GitHub served pages, you do not see an error: it just looks like the Bookmarklet does not work at all. The last part is right, but in the Chrome console you can actually see the error.

That error lead me to my answer:

Read the rest of this entry »

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

GitHub – kellyjonbrazil/jc: CLI tool and python library that converts the output of popular command-line tools and file-types to JSON or Dictionaries. This allows piping of output to tools like jq and simplifying automation scripts.

Posted by jpluimers on 2023/10/17

I already knew about jq and jo (output: the echo for JSON), but not yet about jc for JSON.

Like jq is for querying (the sed for JSON), jc tries to be the universal parser of common command-line tools into JSON:

[Wayback/Archive] kellyjonbrazil/jc: CLI tool and python library that converts the output of popular command-line tools and file-types to JSON or Dictionaries. This allows piping of output to tools like jq and simplifying automation scripts.

Via [Wayback/ArchiveKris on Twitter: ““Jc” verwandelt den Output von üblichen Linux Kommandozeilen Tools in JSON. “Jc” kann auch als Import in Python Programmen verwendet werden und mit subprocess kombiniert werden. Danke, ⁦@janwalzer⁩ und ⁦@the_mutax⁩ für den Tip. “

A few weeks later though, Kris discovered that command-line tools aren’t that portable in their output format: [Wayback/Archive] Kris on Twitter: “As much as I love the idea of @kellyjonbrazil’s jc, this is not a winnable game. sigh Probably still better than a self-cooked parser, but the slightest bit of extra makes it catch fire in multiple possible ways …”

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, bash, Development, JavaScript/ECMAScript, jo, jq, JSON, man/manual pages, mankier, Power User, Python, Scripting, Software Development | Leave a Comment »

When reg.exe gives you “ERROR: Invalid key name.”

Posted by jpluimers on 2023/10/16

Be careful phrasing reg.exe commands.

Sometimes it gives you the error ERROR: Invalid key name.

The reason is that the reg.exe is really sensitive on the order of the command-line: the first argument must be a full key, optionally prepended by a computername.

Any other optional command-line option (like /f to force execution without asking) needs to go after that.

See:

–jeroen

Posted in Batch-Files, Power User, Registry Files, Scripting, Windows | Leave a Comment »

C#/.NET: for personally identifiable information, use Gaev.Blog.Examples/PiiString.cs at 3.1.1 · gaevoy/Gaev.Blog.Examples

Posted by jpluimers on 2023/10/12

A while ago [Wayback/Archive] Vladimir Gaevoy wrote a great blog post which I bumped into through his tweet [Wayback/Archive] “Blogged: .NET type for personally identifiable information (PII). Working with PII with the help of .NET String is painful. Let’s see the benefits of PiiString as explicit .NET type instead of .NET String  #pii #dotnet #gdpr #security “

The tweet does not fully do justice to his blog post [Wayback/Archive] .NET type for personally identifiable information (PII), as the post not only discusses the background (GDPR and other requirements, for instance the [Wayback/Archive] GDPR compliance checklist – GDPR.eu) and the class, but also with examples how to use it for:

  • conversion to/from user interface plain text
  • hashing to pseudonymized/anonymized form
  • encryption for more secure storage

In addition, more examples cover JSON, Entity Framework, [Wayback/Archive] NLog, and [Wayback/Archive] Serilog — simple .NET logging with fully-structured events.

Read the rest of this entry »

Posted in .NET, C#, Development, Power User, Privacy, Security, Software Development | Leave a Comment »

Ookla speedtest CLI for Windows has some undocumented arguments to accept license and GDPR

Posted by jpluimers on 2023/10/11

I had speedtest-cli running on MacOS and various Linux machines, but not yet on Windows (see for instance my post Ubuntu: Fixing the myserious “Failed to stop apt-daily.timer: Connection timed out”).

[Wayback/Archive] Install and Test Internet Speed with Speedtest CLI Command Line – NEXTOFWINDOWS.COM reminded me there is a Speedtest CLI for Windows download at at [Wayback/Archive] Speedtest CLI: Internet speed test for the command line, but I am a an automation/scripting/devops person, so luckily there are also [Wayback/Archive] Chocolatey Software | Speedtest by Ookla (don’t get [Wayback/Archive] Ookla.Speedtest download, as that is the GUI version).

Both the Chocolatey and winget packages are named the same, so that is quite confusing. This is how I have set them apart:

Read the rest of this entry »

Posted in *nix, *nix-tools, Batch-Files, Chocolatey, DevOps, GDPR/DS-GVO/AVG, Internet, ISP, KPN, Notepad++, Power User, Privacy, Scripting, SpeedTest, Windows, xs4all | 2 Comments »

Getting the Chocolatey shimgen generated shim target

Posted by jpluimers on 2023/10/10

For tomorrow’s post Ookla speedtest CLI for Windows has some undocumented arguments to accept license and GDPR I neede the full path to the speedtest.exe which I had installed using Chocolatey.

I know chocolatey uses a shim that redirects to the actual executable, so a simple where speedtest.exe would not cut it.

My guess would be that the generated shim allowed to either get the target pathname out, or have the target pathname encoded in it.

Luckily the first applies: a few of the shim command-line parameters are in [Wayback/Archive] Chocolatey Software Docs | Executable shimming (like symlinks but better):

You pass these arguments to an executable that is a shim (e.g. executables in the bin directory of your Chocolatey install, not choco.exe):

  • --shimgen-help – shows this help menu and exits without running the target
  • --shimgen-log – logging is shown on command line
  • --shimgen-waitforexit – explicitly tell the shim to wait for target to exit – useful when something is calling a gui and wanting to block – command line programs explicitly have waitforexit already set.
  • --shimgen-exit – explicitly tell the shim to exit immediately.
  • --shimgen-gui – explicitly behave as if the target is a GUI application. This is helpful in situations where the package did not have a proper .gui file.
  • --shimgen-usetargetworkingdirectory – set the working directory to the target path. Useful when programs need to be running from where they are located (usually indicates programs that have issues being run globally).
  • --shimgen-noop – Do not actually call the target. Useful to see what would happen if you ran the command.

But the below dumps show more more (using [Wayback/Archive] Strings – Windows Sysinternals | Microsoft Docs, [Wayback/Archive] clip | Microsoft Docs and post-processing in [Wayback/Archive] Notepad++).

Back to the second solution,

strings C:\ProgramData\chocolatey\bin\speedtest.exe | findstr speedtest.exe

showed

speedtest.exe
..\\lib\speedtest\tools\speedtest.exe
Cannot find file at '..\\lib\speedtest\tools\speedtest.exe' (
speedtest.exe
speedtest.exe

And towards the first,

strings C:\ProgramData\chocolatey\bin\speedtest.exe | clip

resulted in this fragment:

Read the rest of this entry »

Posted in Batch-Files, Chocolatey, CommandLine, Development, Power User, PowerShell, PowerShell, Scripting, Software Development, Windows | Leave a Comment »