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

Archive for 2023

I learned about the “YAML-NOrway Law.”

Posted by jpluimers on 2023/06/15

Every time I use YAML, I bump into things even I copy paste from exact working configurations.

Today I learned I’m not just alone, but there is even a term for it: “YAML-NOrway Law.”

[Wayback/Archive] I’d like to propose the “YAML-NOrway Law.” “Anyone who uses YAML long enough wil… | Hacker News

I’d like to propose the “YAML-NOrway Law.”

“Anyone who uses YAML long enough will eventually get burned when attempting to abbreviate Norway.”

Example:

  NI: Nicaragua
  NL: Netherlands
  NO: Norway # boom!

`NO` is parsed as a boolean type, which with the YAML 1.1 spec, there are 22 options to write “true” or “false.”[1] For that example, you have wrap “NO” in quotes to get the expected result.

This, along with many of the design decisions in YAML strike me as a simple vs. easy[2] tradeoff, where the authors opted for “easy,” at the expense of simplicity. I (and I assume others) mostly use YAML for configuration. I need my config files to be dead simple, explicit, and predictable. Easy can take a back seat.

[1]: [Wayback/Archive] http://yaml.org/type/bool.html [2]: [Wayback/Archive] https://www.infoq.com/presentations/Simple-Made-Easy

Even a key Ansible author seems to regret using YAML: [Archive] Kevin Honka on Twitter: “@hikhvar @isotopp jap :) Muss da immer an den Spruch des entwicklers von Ansible denken: Hätte ich gewusst, wie einfach es ist in Python eine DSL zu bauen, hätte ich nie YAML verwendet” / Twitter

Somewhere in the tread, Kris mentioned [Wayback/Archive] Code rant: The Configuration Complexity Clock:

It seems to be a recurring issue in both Kris’ and my life: One needs to actually fail in order to get a feel for reality.

Via [Archive] Kris on Twitter: “Die YAML Spezifikation gelesen. yaml-dox-url Jetzt habe ich Alpträume. “Erkläre Node Tags, Complex Keys mit ?, resolved und unresolved tags, und partial representation.”” / Twitter

[Wayback/Archive] YAML Ain’t Markup Language (YAML™) revision 1.2.2

–jeroen

Read the rest of this entry »

Posted in Configuration Management, Infrastructure, YAML | Leave a Comment »

For my link archive: ISO links to openSUSE Leap 15.5 – Get openSUSE

Posted by jpluimers on 2023/06/15

For my link archive some ISO links via [Wayback/Archive] openSUSE Leap 15.5 – Get openSUSE as I am steadily working my way back into IT and Software Development so I was anxious to see what has changed on this front. In the past I usually ran OpenSuSE Tumbleweed, but now I am going for OpenSuSE Leap versions that are stable for a longer period of time as per [Wayback/Archive] Lifetime – openSUSE Wiki

Leap Major Release (15.x) extends maintenance and support until a successor. At present, a successor has not been declared; Leap 15’s lifecycle fully aligns with SUSE Linux Enterprise. There is a projection as of March 2021 that Leap 15 will extend to Leap 15.5. The previous major version of Leap, 42, was supported for more than 36 months, while the current major version of Leap, 15, would then have up to 72 months of support (12×6).

Full DVD download for off-line installation:

Read the rest of this entry »

Posted in *nix, LEAP, Linux, openSuSE, Power User, SuSE Linux | Leave a Comment »

JavaScript – how to refresh an iframe automatically – Stack Overflow

Posted by jpluimers on 2023/06/14

Based on [Wayback/Archive] javascript – how to refresh an iframe automatically – Stack Overflow and help from [Archive] Roderick Gadellaa (@RGadellaa) / Twitter, I used this JavaScript code right after the body in the html page to reload part of the iframes every 3 minutes and another part every 3 hours:

<script>
  var iframes3minuteInterval = setInterval( () => {
    const ids3minutes = [ 'agenda_iframe', 'month_iframe' ];
    ids3minutes.forEach( id => {
      element = document.getElementById( id );
      element.src = element.src;
    });
  }, 1000 * 60 * 3);
  var iframes3hourInterval = setInterval( () => {
    const ids3hours = [ 'weerplaza_nederland_iframe', 'weerplaza_radar_iframe', 'buienradar_iframe' ];
    ids3hours.forEach( id => {
      element = document.getElementById( id );
      element.src = element.src;
    });
  }, 1000 * 60 * 60 * 3);
</script>

The iframes are widgets for:

This was to workaround GitLab pages on a custom domain are nice, but be aware of intermittent 502 and certificate errors. Now the page only gets loaded once, and the widgets at intervals that are needed.

jeroen

Posted in CSS, Development, HTML, JavaScript/ECMAScript, Scripting, Software Development, Web Development | Leave a Comment »

Dutch thread: improving a cheap T-962 reflow-oven to have more sensors, be earthed, and become more robust

Posted by jpluimers on 2023/06/13

Nice Dutch thread: [Archive] Dinsdale. – D💉ane Blijf thuis ⭕️ on Twitter: “Morgen een leuk projectje. Ik heb dit goedkope reflow-oventje. Heb uitgevogeld hoe ik de firmware kan flashen. De interface kan ik op Chinees of Engels zetten. Tevens heeft de nieuwe firmware meer mogelijkheden. ” / Twitter

It is similar to [Wayback/Archive] Improving The T-962 Reflow Oven | Hackaday.

Saved at [Wayback/Archive] Thread by @Dinsdal85174312 on Thread Reader App – Thread Reader App:

Read the rest of this entry »

Posted in Development, Hardware Development, Soldering | Leave a Comment »

Shortcut to open specific bookmark / URL in Chrome – Super User

Posted by jpluimers on 2023/06/12

I need to give the various solutions here some thought: [Wayback/Archive] Shortcut to open specific bookmark / URL in Chrome – Super User

–jeroen

Posted in Chrome, Firefox, Power User, Web Browsers | Leave a Comment »

There is always an XKCD: «xkcd: Is It Worth the Time?»

Posted by jpluimers on 2023/06/09

The Bookmarklets posts have mostly reached past the front of the blog queue, so here goes a tweet from last year:

[Archive] Jeroen Wiert Pluimers on Twitter: “The past week, I learned a ton of HTML, JavaScript and (Shadow) DOM oddities while writing browser bookmarklets to speed up my blogging and @waybackmachine / @archiveis archiving. There is always an XKCD: «xkcd: Is It Worth the Time?» …” / Twitter

–jeroen

Posted in Bookmarklet, Fun, LifeHacker, Power User, Web Browsers, xkcd | Leave a Comment »

How to encourage phishing: send email to users from a different domain than they are subscribed to

Posted by jpluimers on 2023/06/08

Many organisations train their personell with phishing attempts from domains that are different from the one the organisation uses.

The mantra is: only respond to emails (or clicking links in them) from domains you know.

Microsoft sent (still sends?) account expiration emails for various *.microsoft.com, *.visualstudio.com and other Microsoft domains like this:

[Wayback/Archive] 232840055-2ccfdb9b-2a13-4a34-92f5-f27f337825f8.png (766×653) email from Microsoft account team <account-security-noreply@mail.msa.msidentity.com>

Read the rest of this entry »

Posted in Pen Testing, Phishing, Power User, Red team, Security | Leave a Comment »

Side effect-free bookmarklets: wrap them in an IIFE (Immediately Invoked Function Expression)

Posted by jpluimers on 2023/06/08

In Bookmarklets for Archive.is and the WayBack Machine to go to the original page, I wrote about how the Shadow DOM is used to prevent side effects between the code of the WayBack machine and the archived page.

In a similar manner, Bookmarklets can also interfere with code on the page and vice versa, for instance by using global variables.

That is why the [Wayback/Archive] A simple bookmarklet to tweet the current page – DEV Community is wrapped in a special kind of function:

javascript:(function(){
  n=getSelection().anchorNode;
  t=n.nodeType===3?n.data:n.innerText;t=''+t+'\\n\\n';
  window.open(`https://twitter.com/intent/tweet?
  text=${encodeURIComponent(t)}${document.location.href}`)
})()

This is an [Wayback/Archive] IIFE – MDN Web Docs Glossary: Definitions of Web-related terms | MDN or “Immediately Invoked Function Expression”, a mechanism coined by [Archive] Ben Alman (@cowboy) / Twitter at [Wayback/Archive] Ben Alman » Immediately-Invoked Function Expression (IIFE).

Since the variables are inside the function body, they won’t interfere with the page. The body will be immediately executed.

Related:

–jeroen

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

Bookmarklets for Archive.is and the WayBack Machine to go to the original page

Posted by jpluimers on 2023/06/07

Quite often, when browsing an archived page on Archive.is or the WayBack Machine, I want to check the current status of the original page.

So I wrote a few Bookmarklets.

Archive.is

Default field

Any Archive.is page has a Saved from field which is an input html element having a name attribute with value q and a value property containing the URL, which is navigated to by assigning the location in the above code.

So my goto Bookmarklet is this one:

javascript:open(document.getElementsByName("q")[0]?.value)

It uses [0]? as there is no getElementsByName, but there is [Wayback/Archive] Document.getElementsByName() – Web APIs | MDN as name values need not to be unique but id values have to be.

Other Archive.is fields

The above works on all types of Archive.is page types:

  1. search pages like https://archive.is/https://example.org
  2. actual archived pages like https://archive.is/LkpeZ and https://archive.ph/2022.01.22-165646/https://example.org/
    • these only have a Saved from field.
  3. redirected archived pages like https://archive.ph/UEQeg and https://archive.ph/2013.01.03-111457/http://www.iana.org/domains/example/
    • these both have Saved from and Redirected from fields.
  4. complex pages like https://archive.ph/5iVVH and https://archive.ph/2015.11.14-044109/http://www.example.org/
    • those have even more fields: in addition to fields Saved from and Redirected from, the fields Via and Original also are added.

To get the additional fields from the other fields, we need to figure out a way to access them.

Read the rest of this entry »

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

What is the difference between <p>, <div> and <span> in HTML&XHTML?

Posted by jpluimers on 2023/06/06

I write most of my documentation in Markdown or reStructuredText, so I don’t bump into html questions as often as in the past. But recently, I had to document in html as markdown was impossible, bumped in the choice between using div or p tags for paragraphs, and remembered there was a p problem not present with div but forgot which problem.

So I found [Wayback/Archive] What is the difference between <p>, <div> and <span> in HTML&XHTML? where the red bit explained what I forgot:

As others have answered… div and p are “block elements” (now redefined as Flow Content) and span is an “inline element” (Phrasing Content). Yes, you may change the default presentation of these elements, but there is a difference between “flow” versus “block”, and “phrasing” versus “inline”.

An element classified as flow content can only be used where flow content is expected, and an element classified as phrasing content can be used where phrasing content is expected. Since all phrasing content is flow content, a phrasing element can also be used anywhere flow content is expected. [Wayback/Archive] The specs provide more detailed info.

All phrasing elements, such as strong and em, can only contain other phrasing elements: you can’t put a table inside a cite for instance. Most flow content such as div and li can contain all types of flow content (as well as phrasing content), but there are a few exceptions: ppre, and th are examples of non-phrasing flow content (“block elements”) that can only contain phrasing content (“inline elements”). And of course there are the normal element restrictions such as dl and table only being allowed to contain certain elements.

While both div and p are non-phrasing flow content, the div can contain other flow content children (including more divs and ps). On the other hand, p may only contain phrasing content children. That means you can’t put a div inside a p, even though both are non-phrasing flow elements.

Now here’s the kicker. These semantic specifications are unrelated to how the element is displayed. Thus, if you have a div inside a span, you will get a validation error even if you have span {display: block;} and div {display: inline;} in your CSS.

Thanks [Wayback/Archive] Dhamu for asking that question and [Wayback/Archive] chharvey for explaining these details!

The [Wayback/Archive] HTML Standard: 3.2.5.2 Kinds of content has a cool diagram too:

Read the rest of this entry »

Posted in Development, HTML, HTML5, Software Development, Web Development | Leave a Comment »