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

Archive for the ‘Software Development’ Category

html – CSS Display an Image Resized and Cropped – Stack Overflow

Posted by jpluimers on 2021/08/25

[WayBack] html – CSS Display an Image Resized and Cropped – Stack Overflow (thanks [WayBack] roborourke!); see full answer link for runnable snippet and HTML (the WordPress editor keeps fucking up preformatted code blocks with html or XML in it).

You could use a combination of both methods eg.

    .crop {
        width: 200px;
        height: 150px;
        overflow: hidden;
    }

    .crop img {
        width: 400px;
        height: 300px;
        margin: -75px 0 0 -100px;
    }

You embed the img in a div with class .crop, or in-line the styles in the img and div tags.

--jeroen

 

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

linux – How can I find all hardlinked files on a filesystem? – Super User

Posted by jpluimers on 2021/08/25

[WayBack] linux – How can I find all hardlinked files on a filesystem? – Super User

use the following line (for sure you have to replace /PATH/FOR/SEARCH/ with whatever you want to search):

find /PATH/FOR/SEARCH/ -xdev -printf '%i\t%n\t%p\n' | fgrep -f <(find . -xdev -printf '%i\n' | sort -n | uniq -d) | sort -n

this scans the filesystem only once, shows inode, number of hardlinks and path of files with more than one hardlink and sorts them according to the inode.

if you are annoyed by error messages for folders you aren’t allowed to read, you can expand the line to this:

find /PATH/FOR/SEARCH/ -xdev -printf '%i\t%n\t%p\n' 2> /dev/null | fgrep -f <(find . -xdev -printf '%i\n' 2> /dev/null | sort -n | uniq -d) | sort -n

It uses these commands:

–jeroen

Posted in *nix, *nix-tools, bash, bash, Development, fgrep, find, Power User, Scripting, Software Development | 1 Comment »

Some links on Flux outside React.js

Posted by jpluimers on 2021/08/24

The Flux architecture is often used in ReactJS, but there are also implementations outside that realm.

So here are some links for my archive:

–jeroen

Posted in .NET, C#, Delphi, Development, JavaScript/ECMAScript, ReactJS, Scripting, Software Development | Leave a Comment »

Some links related to Apple’s NeuralHash algorithm, as it was reverse engineered and collisions can be generated so abuse with pictures matching sensitive hashes can be performed

Posted by jpluimers on 2021/08/24

Last week, I wrote [Archive.is] Jeroen Wiert Pluimers on Twitter: “Apple’s NeuralHash algorithm for automagically reporting sensitive images from iOS devices has not only been reverse engineered, but also collisions can now be generated. Now just wait for abuse of innocent pictures matching sensitive hashes. … “

Below, for my link archive, some relevant links on this:

–jeroen

Posted in AI and ML; Artificial Intelligence & Machine Learning, Development, Hashing, Power User, Security, Software Development | Leave a Comment »

KIX-code: informatie en downloaden | PostNL

Posted by jpluimers on 2021/08/20

PostNL maakt bij de sortering van post gebruik van een streepjescode: de KIX (KlantIndeX). Deze code voegt u toe aan de adresgegevens. De KIX bevat de gegevens die wij nodig hebben om uw post met de modernste sorteermachines te verwerken. Door de KIX bij het adres af te drukken helpt u ons om de kwaliteit van de dienstverlening te verbeteren.

Note that in order to install the KIX font on macOS/OS X/Mac OS, you

Read the rest of this entry »

Posted in Barcode, Development, Font, KIX, KIX Font PostNL, LifeHacker, Power User, Software Development | Leave a Comment »

Windows chocolatey Wireshark install: ensure you install nmap too, so you have a pcap interface for capturing!

Posted by jpluimers on 2021/08/19

Wireshark is indispensable when doing network communications development or DevOps.

This is my choco-install-network-tools.bat batch file to install Wireshark and the pcap dependency which nmap provides:

choco install --yes nmap
:: wireshark requires a pcap for capturing; nmap comes with npcap which fulfills this dependency
:: see:
:: - https://chocolatey.org/packages/wireshark
:: - https://chocolatey.org/packages/win10pcap
:: - https://chocolatey.org/packages/WinPcap
:: - https://chocolatey.org/packages/nmap
choco install --yes wireshark

Yes, I know: Windows Subsystem for Linux could have an easier installation, but the above:

See:

–jeroen

Posted in *nix, *nix-tools, Communications Development, Development, Internet protocol suite, nmap, Power User, Software Development, Windows, Windows 10, Windows 8.1, WSL Windows Subsystem for Linux | Leave a Comment »

html – How can I scale the content of an iframe? – Stack Overflow

Posted by jpluimers on 2021/08/19

I used [WayBack] html – How can I scale the content of an iframe? – Stack Overflow as starting point to scale some iframes.

In my case, I had to scale up (by a 25% so a factor 1.25) instead of scale down.

What I observed so far in recent Chrome versions is:

  1. The wrapping div is still needed, otherwise the outer size and inner size of the frame mismatches
  2. The wrapping div and the wrapped iframe need to have the same dimensions (so unlike the Stack Overflow answers, no need to scale the width/height of the div; keep the same values as the iframe)

The div uses class calendar_wrap.

The iframe uses class calendar_iframe.

This is part of my CSS:

body {
      margin: 0; /* override browser setting for body `margin: 8px;` */
      overflow: hidden; /* remove scroll bars; does not work for iframes  */
    }

    /* ... */

    iframe {
      border-width: 0; /* override browser setting for iframe `border-width: 2px; */
      height: 100vh;
      width:   50vw;
      overflow: hidden; /* remove scroll bars; does not work for iframes  */
    }

     /* wrap and iframe zoom as per https://stackoverflow.com/questions/166160/how-can-i-scale-the-content-of-an-iframe */
    .calendar_wrap {
      float: left;

      height: 70vh;
      width:  35vw; /* calc(35vw / 1.25); */

      padding: 0;
      background-color: blue;
    }

    .calendar_iframe {
      float: left;

      width:  35vw;

      -ms-transform: scale(1.25);
      -moz-transform: scale(1.25);
      -o-transform: scale(1.25);
      -webkit-transform: scale(1.25);
      transform: scale(1.25);

      -ms-transform-origin: 0 0;
      -moz-transform-origin: 0 0;
      -o-transform-origin: 0 0;
      -webkit-transform-origin: 0 0;
      transform-origin: 0 0;
    }

    /* ... */

–jeroen

Posted in Chrome, CSS, Development, HTML, Power User, Software Development, Web Browsers, Web Development | Leave a Comment »

bash – Search for a previous command with the prefix I just typed – Unix & Linux Stack Exchange

Posted by jpluimers on 2021/08/18

[WayBack] bash – Search for a previous command with the prefix I just typed – Unix & Linux Stack Exchange answered by [WayBack] John1024:

What you are looking for is Ctrl-R.

Type Ctrl-R and then type part of the command you want. Bash will display the first matching command. Keep typing CtrlR and bash will cycle through previous matching commands.

To search backwards in the history, type Ctrl-S instead. (If Ctrl-S doesn’t work that way for you, that likely means that you need to disable XON/XOFF flow control: to do that, run stty -ixon.)

This is documented under “Searching” in man bash.

Comment by [WayBack] HongboZhu:

Ctrl-Q to quit the frozen state, if you already hit Ctrl-S without turning off flow control first and got your terminal frozen.

A far more elaborate answer with many other tips is from [WayBack] Peter Cordes:

Read the rest of this entry »

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

Winbox 3.19 can connect via MAC whereas Winbox 3.17 cannot

Posted by jpluimers on 2021/08/17

Not sure why, but Winbox 3.17 could not connect to out of the box blank MikroTik equipment at all.

Winbox 3.19 complains every now and than, but usually connects fine.

This was while configuring a bunch of [WayBack] MikroTik Routers and Wireless – Products: CRS305-1G-4S+IN.

Read the rest of this entry »

Posted in Development, Internet, MikroTik, Power User, RouterOS, routers, Scripting, Software Development | Leave a Comment »

delphi – How to embed the MIDAS.DLL in the client executable – Stack Overflow

Posted by jpluimers on 2021/08/17

I hardly use the [WayBack] TClientDataSet Class any more, so every once in a while I bump into a legacy project that does.

Often that forgets provide a deployment list, so usually with deployment of the underlying DLL is forgotten.

Those moments, it slips my mind that the original name for the underlying DataSnap technology is called MIDAS, and the DLL is MIDAS.DLL. Sometimes even a wrong version of that DLL is distributed (unicode versus non-unicode still can still be a thing).

You can avoid loading it (often at a premium of reduced speed) my adding MidasLib to the uses list of any unit in your project:

When you use BPLs instead of full units, then missing this can lead to a nasty access violation like this one where the ClientDataSet cannot be created because the wrong Midas.dll (non-unicode) was loaded, see the screenshot and stack overflow below.

Lessons re-learned:

  1. Use a minimal deployment footprint
  2. Ensure your test systems are clean, so no older versions of dependencies can be loaded at any time.

OS EAccessViolation at adress 5110E007: Access violation at address 5110E007 in module 'dsnap250.bpl'. Read of address 00000000
{occured in main thread}

Stack:
[50060B13]{rtl250.bpl  } System.@HandleAnyException
[00404815]{GVS.exe     } FastMM4.CalculateHeaderCheckSum$qqrp29Fastmm4.TFullDebugBlockHeader (Line 9098, "FastMM4.pas" + 1)
[50060039]{rtl250.bpl  } System.@AfterConstruction
[00404815]{GVS.exe     } FastMM4.CalculateHeaderCheckSum$qqrp29Fastmm4.TFullDebugBlockHeader (Line 9098, "FastMM4.pas" + 1)
[00404824]{GVS.exe     } FastMM4.UpdateHeaderAndFooterCheckSums$qqrp29Fastmm4.TFullDebugBlockHeader (Line 9108, "FastMM4.pas" + 1)
[004057C6]{GVS.exe     } FastMM4.DebugGetMem$qqri (Line 9649, "FastMM4.pas" + 42)
[00405817]{GVS.exe     } FastMM4.DebugGetMem$qqri (Line 9686, "FastMM4.pas" + 79)
[5005A247]{rtl250.bpl  } System.@ReallocMem
[50065674]{rtl250.bpl  } System.DynArraySetLength
[50065715]{rtl250.bpl  } System.@DynArraySetLength
[5110D001]{dsnap250.bpl} Datasnap.Dbclient.TCustomClientDataSet.CreateDSBase
[51111571]{dsnap250.bpl} Datasnap.Dbclient.TCustomClientDataSet.CreateDataSet
[500E920D]{rtl250.bpl  } System.Rtti.TValue._op_Implicit
[00559D29]{CDSDemo.exe } MainDataModuleUnit.TMainDataModule.DataModuleCreate (Line 50, "MainDataModuleUnit.pas" + 1)
[5016E7EF]{rtl250.bpl  } System.Classes.TDataModule.DoCreate
[5016E69C]{rtl250.bpl  } System.Classes.TDataModule.AfterConstruction
[50060039]{rtl250.bpl  } System.@AfterConstruction
[5016E67A]{rtl250.bpl  } System.Classes.TDataModule
[00544941]{CDSDemo.exe } MainFormUnit.TMainForm.PageControlChange (Line 30, "MainFormUnit.pas" + 19)
[0054598B]{CDSDemo.exe } MainFormUnit.TMainForm.FormShow (Line 40, "MainFormUnit.pas" + 47)
[50C075DD]{vcl250.bpl  } Vcl.Forms.TCustomForm.DoShow
[50C0BF7D]{vcl250.bpl  } Vcl.Forms.TCustomForm.CMShowingChanged
[5005FD9F]{rtl250.bpl  } System.TObject.Dispatch
[50AC4C16]{vcl250.bpl  } Vcl.Controls.TControl.WndProc
[50AC97FB]{vcl250.bpl  } Vcl.Controls.TWinControl.WndProc
[50C080B5]{vcl250.bpl  } Vcl.Forms.TCustomForm.WndProc
[50AC4850]{vcl250.bpl  } Vcl.Controls.TControl.Perform
[50AC8B71]{vcl250.bpl  } Vcl.Controls.TWinControl.UpdateShowing
[50AC8C80]{vcl250.bpl  } Vcl.Controls.TWinControl.UpdateControlState
[50ACB9D6]{vcl250.bpl  } Vcl.Controls.TWinControl.CMVisibleChanged
[50AC4C16]{vcl250.bpl  } Vcl.Controls.TControl.WndProc
[50AC97FB]{vcl250.bpl  } Vcl.Controls.TWinControl.WndProc
[50C080B5]{vcl250.bpl  } Vcl.Forms.TCustomForm.WndProc
[50C0E597]{vcl250.bpl  } Vcl.Forms.TScreen.GetMonitor
[50C094C5]{vcl250.bpl  } Vcl.Forms.TCustomForm.SetWindowToMonitor
[50AC4850]{vcl250.bpl  } Vcl.Controls.TControl.Perform
[50AC31E6]{vcl250.bpl  } Vcl.Controls.TControl.SetVisible
[50C078C1]{vcl250.bpl  } Vcl.Forms.TCustomForm.SetVisible
[50C11DCF]{vcl250.bpl  } Vcl.Forms.TApplication.Run
[004B3B28]{CDSDemo.exe } VclApplication.TApplication.Run (Line 113, "VclApplication.pas" + 1)
(00161097){CDSDemo.exe } [00562097]

–jeroen

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