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

Archive for September, 2022

Add AirPlay to Your Classic Stereo with an Old Apple TV – TidBITS

Posted by jpluimers on 2022/09/19

[Wayback/Archive.is] Add AirPlay to Your Classic Stereo with an Old Apple TV – TidBITS which has a good description including a list of needed parts:

  • Second- or third-generation Apple TV
  • Power cable
  • TOSLINK Digital-to-Analog (D/A) Converter
  • Pair of RCA Cables

These are only needed the first time to setup the Apple TV 2nd or 3rd generation:

  • HDMI Cable
  • Remote

Note that the Apple TV 4th generation or Apple TV 4K devices won’t work: they lack a TOSLINK interface.

You can work around this by using an HDMI audio extractor [Wayback/Archive.is]. Some can provide S/PDIF / TOSLINK output, others can directly do line out (so you do not need the above TOSLINK D/A converter):

Usually the Apple TV 2nd or 3rd generation solution is way cheaper, as they go for very little money on second hand sites.

–jeroen

Posted in Apple, Apple TV, Hardware, Home Audio/Video, iOS, Power User | Leave a Comment »

Rust is jet another language allowing assigning to _ for discarding assignment results (like function calls)

Posted by jpluimers on 2022/09/16

Rust is a programming language that very much emphasises safety.

One of the cornerstones is that it warns on constructs that might lose information or make object lifetime unclear.

An example is discarding function results: historically you will get a warning like warning: unused `std::result::Result` that must be used that you can resolve by applying a let statement assigning to the _ underscore pattern which will be discarded at the end of the statement like this:

Read the rest of this entry »

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

Visual Studio Code: blazingly fast text expansion with Emmet

Posted by jpluimers on 2022/09/15

I come from a background of Delphi, Visual Studio and Notepad++ editors that historically have expanded their functionality over decades of releases.

When switching much of my development to Visual Studio Code, which out of the box aims at basic support (which has grown remarkably over the years so it’s way beyond basic now), I decided to review my editing behaviours see if plugins (in vscode speak “extensions marketplace“) would assist me with that.

One of my behaviours I wanted to get rid of is heavily use of keyboard macros, so when doing more web-stuff, I bumped into Emmet (that in the past was called Zen Code).

I bumped into Emmet because I wanted to refactor quite a few bits of html, and embed many sections of text in tags. Normally I would have written a macro for that, but now I did a quick [Wayback/Archive.is] vscode html embed text in element – Google Search and bumped into [Wayback/Archive.is] html – How to do tag wrapping in VS code? – Stack Overflow (thanks [Wayback/Archive.is] Alex!)

Since Visual Studio Code has built-in support for Emmet, here are some links so I can quickly find them back:

Hopefully I will now also less rely on user-defined snippets, though they are still available: [Wayback/Archive.is] Snippets in Visual Studio Code

Using Emmet eventually might help me in my blog-writing too, which still is heavily WordPress.com, known for its limited editor, based.

Apparently, my Google Search fu still is good enough to find these kinds of gems (:

–jeroen

Posted in .NET, CSS, Development, HTML, HTML5, Software Development, Visual Studio and tools, vscode Visual Studio Code, Web Development | Leave a Comment »

Converting an html dl (delimited list) on a page to a table from the Chrome console

Posted by jpluimers on 2022/09/14

A while ago, I wanted to convert the dl delimited list html element on a web page into a regular table so I could more easily reorder the data into cells.

So I ran the below bit of code in the Chrome Console after first putting the mentioned table with id here_table in the place where I wanted the table to be included:


<table id="here_table"></table>

view raw

_table.html

hosted with ❤ by GitHub


var arr = $("#delimitedList").children().map(function () {
return $(this).html();
}).get();
for (var i = 0; i < arr.length; i += 2) {
$('#here_table').append('<tr><td>' + arr[i] + '</td><td>' + arr[i + 1] + '</td></tr>');
}

For this script to work, you need jQuery, so yesterday I wrote Better, Stronger, Safer jQuerify Bookmarklet | Learning jQuery.

The code is based on [Wayback/Archive.is] Rebuild each definition list () as a table using JQuery – Stack Overflow (thanks [Wayback/Archive.is] easy!) with an important adoption instead of calling text() to get the textual dt and dd information, it uses html() so the original innerHTML is being preserved.

Some similar JavaScript pieces of code are at [Wayback/Archive.is] Turning HTML into a nested JavaScript array with jQuery – Stack Overflow.

Related:

–jeroen

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

Happy Day of the Programmer!

Posted by jpluimers on 2022/09/13

Enjoy Day of the Programmer and [WayBack] Good Questions — Geek&Poke

–jeroen

Related: Happy Day of the Programmer! 2018

via [WayBack] Steema Software on Twitter: “Happy #ProgrammersDay ! Feliç #DiaDelProgramador ! ¡Feliz #DíaDelProgramador !… ” .

 

Posted in Development, Software Development | Leave a Comment »

On my list of things to try: chrome flag: global-media-controls (older article, it’s live in stable now)

Posted by jpluimers on 2022/09/12

[WayBack] Roderick Gadellaa on Twitter: “My new favorite chrome flag: global-media-controls (older article, it’s live in stable now)… “

[WayBack ]Chrome is testing new media playback controls that can even work with background tabs

To enable to controls, head to chrome://flags/#global-media-controlsAfter a browser restart, you’ll see a play button in your toolbar next to the extensions whenever you have media playing in Chrome. Clicking it will show the title of what’s playing, where it’s playing from, and provide play/pause and skip buttons.

–jeroen

Posted in Chrome, Google, Power User | Leave a Comment »

Kristian Köhntopp on Twitter: “The point being: If you work the other way around, and make Remote First work, if you read and follow @xahteiwi’s reasoning, then it is also really easy to make hybrid work.”

Posted by jpluimers on 2022/09/09

By now, it should be quite clear which companies who’s work is suitable for remote work, have adopted a Remote First plan, and taken the employees from the companies that do not have, or have a bad Remote First plan.

Succeeding in setting up an hybrid remote/local situation highly depends on your definition of hybrid, so the whole thread is relevant including these two:

Initiated by [Wayback/Archive.is] Amazon will allow many employees to work remotely indefinitely | Hacker News and [Wayback/Archive.is] Amazon will allow many employees to work remotely indefinitely | The Seattle Times

Basically hybrid you not only need to get Remote First done, but also ensure that Remote First does not give those any better or worse chance for promotion.

–jeroen

Read the rest of this entry »

Posted in LifeHacker, Power User | Leave a Comment »

Avoid writing the deep security layers of your software yourself, as it is hard, even for seasoned security software developers (see CVE-2021-41117 | GitHub Security Lab)

Posted by jpluimers on 2022/09/08

I’ve mentioned this in the past, but not sure I did that on my blog yet, so here it goes:

Avoid writing the deep security layers of your software yourself, as it is hard, even for seasoned security software developers.

Push as much as you can to well tested external libraries.

See for instance [Wayback/Archive.is] GHSL-2021-1012: Poor random number generation in keypair – CVE-2021-41117 | GitHub Security Lab

Three went wrong, leading to easy to guess RSA security keys:

  1. The library has an insecure random number fallback path. Ideally the library would require a strong CSPRNG instead of attempting to use a LCG and Math.random.
  2. The library does not correctly use a strong random number generator when run in NodeJS, even though a strong CSPRNG is available.
  3. The fallback path has an issue in the implementation where a majority of the seed data is going to effectively be zero.

The most important thing that went wrong was seeding the random number generator, cascading

Via:

–jeroen

Posted in Development, Encryption, Hashing, Power User, Security, Software Development | Leave a Comment »

Is aanmelden van energieopslag voor particulieren bij energieleveren.nl echt nodig?

Posted by jpluimers on 2022/09/07

Begin van de zomer waren er een aantal korte artikelen in de tech/energie niche over aanmelden van particulieren bij energieleveren.nl wanneer die thuis een mogelijkheid hebben voor energieopslag vanaf 0,8 kWh.

Ik vraag me af of dat terecht is, want:

  • nergens op energieleveren.nl of in hun FAQ staat iets vermeld over opslag, batterij of accu (wel over opwekken)
  • de gerefereerde Netcode Elektriciteit schrijft alleen over bedrijfsmiddelen (en gaat daarmee over ondernemingen in plaats van particulieren)

De overeenkomst tussen de artikelen was dat ze er allemaal – met uitzondering van Solar Magazine – uitzagen alsof ze eenzelfde oorspronkelijk bericht (wellicht een persbericht?) een kein beetje hadden aangepast en er niet dieper op in gingen.

Voorlopig wacht ik daarom bredere en duidelijker communicatie hierover af, want als de overheid dit wil dan is er betere draagvlakcommunicatie nodig. Daarom een bekende quote van Andrea Walraven-Thissen:

Read the rest of this entry »

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

Better, Stronger, Safer jQuerify Bookmarklet | Learning jQuery

Posted by jpluimers on 2022/09/06

For my link archive, the [Wayback] Better, Stronger, Safer jQuerify Bookmarklet | Learning jQuery

Via: [Wayback/Archive.is] Include jQuery in the JavaScript Console – Stack Overflow (thanks [Wayback/Archive.is] brichins!)

When you do not have jQuery installed, then the Chrome console will give you the error [Wayback/Archive.is] javascript – TypeError: $(...).children is not a function – Stack Overflow which has code to load jQuery in this gist: [Wayback/Archive.is] use jQuery in Chrome javascript console.

If this bookmarklet ever starts to fail, then I need to check out these links:

The content of the JQueryfi bookmarklet is in the below gist:


javascript:(function(){var%20el=document.createElement(%22div%22),b=document.getElementsByTagName(%22body%22)[0],otherlib=!1,msg=%22%22;el.style.position=%22fixed%22,el.style.height=%2232px%22,el.style.width=%22220px%22,el.style.marginLeft=%22-110px%22,el.style.top=%220%22,el.style.left=%2250%25%22,el.style.padding=%225px%2010px%22,el.style.zIndex=1001,el.style.fontSize=%2212px%22,el.style.color=%22#222%22,el.style.backgroundColor=%22#f99%22;function%20showMsg(){var%20txt=document.createTextNode(msg);el.appendChild(txt),b.appendChild(el),window.setTimeout(function(){txt=null,typeof%20jQuery==%22undefined%22?b.removeChild(el):(jQuery(el).fadeOut(%22slow%22,function(){jQuery(this).remove()}),otherlib&&(window.$jq=jQuery.noConflict()))},2500)}if(typeof%20jQuery!=%22undefined%22)return%20msg=%22This%20page%20already%20using%20jQuery%20v%22+jQuery.fn.jquery,showMsg();typeof%20$==%22function%22&&(otherlib=!0);function%20getScript(url,success){var%20script=document.createElement(%22script%22);script.src=url;var%20head=document.getElementsByTagName(%22head%22)[0],done=!1;script.onload=script.onreadystatechange=function(){!done&&(!this.readyState||this.readyState==%22loaded%22||this.readyState==%22complete%22)&&(done=!0,success(),script.onload=script.onreadystatechange=null,head.removeChild(script))},head.appendChild(script)}getScript(%22http://code.jquery.com/jquery.min.js%22,function(){return%20typeof%20jQuery==%22undefined%22?msg=%22Sorry,%20but%20jQuery%20was%20not%20able%20to%20load%22:(msg=%22This%20page%20is%20now%20jQuerified%20with%20v%22+jQuery.fn.jquery,otherlib&&(msg+=%22%20and%20noConflict().%20Use%20$jq(),%20not%20$().%22)),showMsg()})})();

view raw

jQuerify.url

hosted with ❤ by GitHub


javascript:(function(){var el=document.createElement("div"),b=document.getElementsByTagName("body")[0],otherlib=!1,msg="";el.style.position="fixed",el.style.height="32px",el.style.width="220px",el.style.marginLeft="-110px",el.style.top="0",el.style.left="50%",el.style.padding="5px 10px",el.style.zIndex=1001,el.style.fontSize="12px",el.style.color="#222",el.style.backgroundColor="#f99";function showMsg(){var txt=document.createTextNode(msg);el.appendChild(txt),b.appendChild(el),window.setTimeout(function(){txt=null,typeof jQuery=="undefined"?b.removeChild(el):(jQuery(el).fadeOut("slow",function(){jQuery(this).remove()}),otherlib&&(window.$jq=jQuery.noConflict()))},2500)}if(typeof jQuery!="undefined")return msg="This page already using jQuery v"+jQuery.fn.jquery,showMsg();typeof $=="function"&&(otherlib=!0);function getScript(url,success){var script=document.createElement("script");script.src=url;var head=document.getElementsByTagName("head")[0],done=!1;script.onload=script.onreadystatechange=function(){!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")&&(done=!0,success(),script.onload=script.onreadystatechange=null,head.removeChild(script))},head.appendChild(script)}getScript("http://code.jquery.com/jquery.min.js&quot;,function(){return typeof jQuery=="undefined"?msg="Sorry, but jQuery was not able to load":(msg="This page is now jQuerified with v"+jQuery.fn.jquery,otherlib&&(msg+=" and noConflict(). Use $jq(), not $().")),showMsg()})})();

view raw

UrlDecoded.js

hosted with ❤ by GitHub

–jeroen

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