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, 2017

delphi – Is AtomicCmpExchange reliable on all platforms? – Stack Overflow

Posted by jpluimers on 2017/09/19

TL;DR: yes it is.

Answer by Allen Bauer at delphi – Is AtomicCmpExchange reliable on all platforms? – Stack Overflow [WayBack]

On Windows, it directly translates into lock cmpxchg which is way faster than the Windows API call [WayBackInterlockedCompareExchange, as that is a jump to the actual code:

InterlockedCompareExchange:
00417CA8 FF2528E12901     jmp dword ptr [$0129e128]
KERNEL32.InterlockedCompareExchange:
75855E40 8BFF             mov edi,edi
75855E42 55               push ebp
75855E43 8BEC             mov ebp,esp
75855E45 8B550C           mov edx,[ebp+$0c]
75855E48 8B4D08           mov ecx,[ebp+$08]
75855E4B 8B4510           mov eax,[ebp+$10]
75855E4E F00FB111         lock cmpxchg [ecx],edx
75855E52 5D               pop ebp
75855E53 C20C00           ret $000c

whereas AtomicCmdExchange looks like this:

Test.pas.20: RestoreValue := AtomicCmpExchange(FieldToBeModfied, 1 {new value}, 0 {expected value}, Success {true if the expected value was found, and new value set});
0111A838 8B45FC           mov eax,[ebp-$04]
0111A83B 8D500C           lea edx,[eax+$0c]
0111A83E 33C0             xor eax,eax
0111A840 B901000000       mov ecx,$00000001
0111A845 F00FB10A         lock cmpxchg [edx],ecx
0111A849 0F9445F2         setz byte ptr [ebp-$0e]
0111A84D 8945D8           mov [ebp-$28],eax

–jeroen

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

Checking KeyPress is not the place to do your input validation

Posted by jpluimers on 2017/09/19

I have seen too many projects over the years trying to do input validation by checking KeyPress. This is not limited to Delphi projects (C#, VB and other projects suffer from this just as much). Most of these projects suffer from these::

  • Much of the KeyPress logic logic in the UI byusing half-baked copy-pasted code fragments.
  • They all fail missing important functionality (like paste, clear, Ctrl-key handling and such) either supporting or suppressing that functionality where needed

If doing Delphi, then that code should be rewritten in a generic way based on examples like like these:

–jeroen

Read the rest of this entry »

Posted in .NET, Delphi, Development, Software Development, Windows Development | Leave a Comment »

New steps for Slack on Twitter: “@thorduri 😣 You can always disable emoji conversion in Preferences > Emoji > Convert my typed emoticons to emoji. 👍”

Posted by jpluimers on 2017/09/18

After: @thorduri You can always disable emoji conversion in Preferences > Emoji > Convert my typed emoticons to emoji. [WayBack]

We live in the form-over-function era [WayBack], so of course this setting is not reachable by URL, only reachable by using these steps:

Read the rest of this entry »

Posted in Cloud, Cloud Apps, Infrastructure, Internet, Power User, SocialMedia | Leave a Comment »

USB LED Light Lamp for Computer Keyboard Reading Laptop Notebook PC 2016 | eBay

Posted by jpluimers on 2017/09/18

Putting all those old USB chargers to good use:

USB LED Light Lamp for Computer Keyboard Reading Laptop Notebook PC 2016 | eBay [WayBack]

Via:

AMAZING 77 cent LED light -including shipping Pulls about 3/4 of a watt (0.14 amp @ 5v), and rivals the light output of a $20 3 watt lamp from Amazon.… – Joe C. Hecht – Google+ [WayBack]

–jeroen

Read the rest of this entry »

Posted in Development, Hardware, Hardware Development, Hardware Interfacing, Power User, USB, USB | Leave a Comment »

Re: [opensuse-factory] dup –no-allow-vendor-change is now default

Posted by jpluimers on 2017/09/15

I totally missed this announcement 2 months ago:

after this update, zypper dup will default to –no-allow-vendor-change, whichhas been the recommended way for Tumbleweed for a long time now.

Source: Re: [opensuse-factory] dup –no-allow-vendor-change is now default

So Dominique was glad to “rub the salt” a bit (:

[WayBack/Archive.isDominique / DimStar‏ @DimStar Replying to @sysrich @jpluimers: for the record: –no-allow-vendor-change has become the default in Tumbleweed, see also http://dominique.leuenberger.net/blog/2017/06/review-of-the-week-201726/

It was documented at least on these places:

–jeroen

Read the rest of this entry »

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

Open source app to detect bluetooth gas pump credit card skimmers – Skimmer Scanner – Android Apps on Google Play

Posted by jpluimers on 2017/09/15

Before you fill up your car, check if you potentially can be skimmed: Skimmer Scanner – Android Apps on Google Play

The app is open source at sparkfunX/Skimmer_Scanner: A mobile app for detecting bluetooth gas pump credit card skimmers.

A long article about reverse engineering these skimmers is at [WayBack] Gas Pump Skimmers – learn.sparkfun.com including tools to get the data out: [WayBackMPLAB PICkit 3 – PGM-09973 – SparkFun Electronics

All via: [WayBack] Gas pump skimmers – what you need to knowIf you’re on android, there’s an app that essentially finds and pairs with the skimmer to see if it’s active… – Lars Fosdal – Google+

–jeroen

Read the rest of this entry »

Posted in Android, Development, LifeHacker, Mobile Development, Power User, Software Development | Leave a Comment »

UDP port 52217 – ScanSnap iX500 Linking to mobile devices (the iPad, iPhone, iPod touch and Android™ devices) -QA4- – Fujitsu Global

Posted by jpluimers on 2017/09/15

UDP port number assigned to Scan to Mobile (52217 by default)

Source: ScanSnap iX500 Linking to mobile devices (the iPad, iPhone, iPod touch and Android™ devices) -QA4- – Fujitsu Global [WayBack]

Other references:

–jeroen

Posted in Fujitsu ScanSnap, Hardware, ix500, Power User, Scanners | Leave a Comment »

Need to write a proper bookmarklet for the wayback archive (:

Posted by jpluimers on 2017/09/14

Some inspiration for writing a proper bookmarklet that finds or saves a WayBack machine page:

On the last link, I was hoping that the https://web.archive.org/liveweb/https://www.example.org would work but it doesn’t work for many URLs and I’m not sure yet why that is.

It has a nice tip that works though:

Read the rest of this entry »

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

youtube-dl – saving both audio and video without keeping intermediate files seems impossible

Posted by jpluimers on 2017/09/14

Just in case someone has a better alternative than youtube-dl alias:

alias youtube-dl-audio-and-video='youtube-dl --keep-video --extract-audio --audio-quality 0 --audio-format mp3'

It extracts the audio and keeps the video.

The result is that also all intermediate downloads are being kept.

So even after studying the README extensively the only alternative seems to be a double download like this:

youtube-dl-audio-and-video() { youtube-dl --extract-audio --audio-quality 0 --audio-format mp3 $1; youtube-dl $1; }

–jeroen

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

zypper errors on download.opensuse.org

Posted by jpluimers on 2017/09/13

If you see error message like below when performing zypper refresh or zypper dist-upgrade, then please inform the opensuse team (for instance Twitter or the #openSUSE-factory IRC channel) as this is part of the aftermath of the download.opensuse.org trouble that started last week.

Permission to access 'http://download.opensuse.org/ports/aarch64/tumbleweed/repo/oss/suse/setup/descr/appdata-icons.tar.gz' denied.

What happened to me with Raspberry Pi 3 and Tumbleweed is below and fixed because after I got in touch: the data restore had worked out OK, but the permissions didn’t.

I got there as the search for “Permission to access ‘http://download.opensuse.org/ports/aarch64/” got me to [WayBack] TUMBLEWEED Zypper Permission to access:

Unfortunately there was a catastrophic issue last week with the openSUSE download system (read: stuff is still broken and not all mirrors are fully functional).

–jeroen

Read the rest of this entry »

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