Stumbled across something that goes well with jq (the sed for JSON of which I wrote about before), [Wayback/Archive] Jan-Piet Mens :: A shell command to create JSON: jo:
Archive for the ‘Software Development’ Category
Jan-Piet Mens :: A shell command to create JSON: jo
Posted by jpluimers on 2023/08/30
Posted in Development, JavaScript/ECMAScript, jo, jq, JSON, Scripting, Software Development | Leave a Comment »
.NET/C#: Small command-line tool to query REST JSON results from a batch file.
Posted by jpluimers on 2023/08/29
Often the power is in the combinations of tools.
Read until the epilogue…
Prologue
In this case, I needed to be able to query the JSON results of calls to REST services from the command-line so I could process them in Batch files.
Since I could not find anything readily available, I originally Originally I opted for the PowerShell command-line scripting tool, as that ships with recent Windows versions and can re-use anything that .NET brings. But though [Wayback/Archive] .NET has built in JSON serialization support, there is [Wayback/Archive] no querying support in it.
Then I thought about Delphi, as it [Wayback/Archive] too has a built-in JSON parser, but even the well known [Wayback/Archive] JSON SuperObject library has no query support.
Back to .NET, which – like Delphi – has a well known and respected third party JSON library as well: [Wayback/Archive] NewtonSoft JSON aka JSON.net and that one [Wayback/Archive] does have support for querying JSON with the SelectToken function.
That’s the fundament of the rest of this article, with the potential to be used in a cross-platform as well.
So no need for a plan B.
Posted in *nix, *nix-tools, .NET, Batch-Files, Conference Topics, Conferences, Development, Event, JavaScript/ECMAScript, jq, JSON, Power User, Scripting, Software Development, Windows, Windows Development | Leave a Comment »
Only 2 weeks left to enable 2FA for your GitHub account
Posted by jpluimers on 2023/08/29
If you haven’t done so already, then enable 2FA for your GitHub account now: This will be a requirement in 2 weeks time.
The 2FA/MFA possibility started about half a year ago with [Wayback/Archive] Raising the bar for software security: GitHub 2FA begins March 13 – The GitHub Blog
You can have various means of 2FA, which al start with a choice between:
- An OTP app (pick your choice, for instance from for instanceComparison of OTP applications – Wikipedia)
- SMS/text (not really recommended due to SIM swap scam – Wikipedia)
After completing either of those those, you can view/download a set of backup codes, and you can add more factors to your Multi-factor authentication setup up to these:
Posted in 2FA/MFA, Authentication, Development, DVCS - Distributed Version Control, git, GitHub, Power User, Security, Software Development, Source Code Management | Leave a Comment »
Bruce Tate on Twitter: “What’s the most unique feature of your favorite programming language?”
Posted by jpluimers on 2023/08/24
For my link archive: [Wayback/Archive] Bruce Tate on Twitter: “What’s the most unique feature of your favorite programming language?” / Twitter
From the languages that I have been using most:
- [Wayback/Archive] Jeroen Wiert Pluimers on Twitter: “@redrapids Delphi having had virtual constructors since version 1. Wrote a blog post only years after it was introduced as too few developers (still!) realise the power of it: …” / Twitter
- [Wayback/Archive] Marco Wobben on Twitter: “@redrapids @jpluimers Perhaps not terribly unique, but definitely my favorite: Strong typing in Delphi/Pascal.” / Twitter
- [Archive] Jeroen Wiert Pluimers on Twitter: “@redrapids C#: extension methods on interfaces. Without this, things like LINQ would have been impossible. ” / Twitter
- [Wayback/Archive] c# – Can extension methods be applied to interfaces? – Stack Overflow (thanks [Wayback/Archive] Greg and [Wayback/Archive] Aaronaught):
Of course they can; most of Linq is built around interface extension methods.Interfaces were actually one of the driving forces for the development of extension methods; since they can’t implement any of their own functionality, extension methods are the easiest way of associating actual code with interface definitions.See the Enumerable class for a whole collection of extension methods built aroundIEnumerable<T>. To implement one, it’s the same as implementing one for a class
- [Wayback/Archive] c# – Can extension methods be applied to interfaces? – Stack Overflow (thanks [Wayback/Archive] Greg and [Wayback/Archive] Aaronaught):
It was a kind of follow-up on his earlier tweet that also sparked nice responses at [Archive] Bruce Tate on Twitter: “What is a #programming technique or construct that other people like but you think is overused?” / Twitter.
In my respons I phrased my decades long pet peeve [Archive] Jeroen Wiert Pluimers on Twitter: “@redrapids OOP: inheritance over composition. This leads to deep hierarchies that eventually nobody understands.” / Twitter.
Whereas with OOP (object-oriented programming) one should use composition over inheritance, often the reverse is true.
Actually my take can be generalised into two directions as these hierarchies:
- often crowd a single namespace, so: crowding namespaces is bad.
One does see this outside the Object Oriented realm a well.
JavaScript for instance takes the crowded global namespace one step further by many libraries taking
$q,$_or$x, which is part of my take[Wayback/Archive] Jeroen Wiert Pluimers on Twitter: “@redrapids Mutation of global state followed by an overly crowded global namespace. Example on the JavaScript side: too many libraries and projects using the global `$` and `_` symbols.”.
- often have many levels of indirection, so: overdoing indirection is bad
One does see this outside the Object Oriented realm a well, just not as pronounced.
[Wayback/Archive] joao on Twitter: “@redrapids But to be more specific, I think sometimes there’s too much indirection with very deep class hierarchies. In the same vein those rules of “functions should have at most 6 arguments and 5/10/20 lines” can lead to a ton of indirection chasing the subfunctions being called”.
–jeroen
Posted in .NET, C#, Conference Topics, Conferences, Delphi, Development, Event, JavaScript/ECMAScript, Pascal, Scripting, Software Development | Leave a Comment »
Bookmarklet to save a page both in the WayBack machine and Archive.is (ending on the latter to solve a reCAPTCHA)
Posted by jpluimers on 2023/08/22
TL;DR:
javascript:{h=location.href;open('https://archive.is/?run=1&url='+encodeURIComponent(h));location.href='https://web.archive.org/save/'+(h)}
Posted in Bookmarklet, Development, JavaScript/ECMAScript, Power User, Scripting, Software Development, Web Browsers, Web Development | Leave a Comment »
SignalR and Design Patterns for .NET developers
Posted by jpluimers on 2023/08/22
Posted in .NET, Design Patterns, Development, R (statistics/graphics), Software Development | Leave a Comment »
Figuring out the threads for processes ran by python
Posted by jpluimers on 2023/08/17
A while ago I wrote about Figuring out the open network connections for processes ran by python, which explained the TL;DR:
pidof python | tr " " "\n" | xargs -r -n 1 lsof -i -a -e /run/user/1001/gvfs -p
Now I needed thread information as well, so below two examples using ps and pstree. I won’t explain the pidof and xargs stuff here as that was already covered in the above blog-post and I found out that ps already has a built-in way to filter on process name.
The ps solution uses the H, -L or -T argument to show the threads:
Posted in *nix, *nix-tools, bash, Development, lsof, Power User, ps, Scripting, Software Development | Leave a Comment »





