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 April, 2019

InterBase/Firebird divisions: use E0 syntax to force floating point calculations

Posted by jpluimers on 2019/04/23

I was a bit baffled at the below results because in other other databases.

You need to use this kind of notation ####.0E0 to force an integer to be evaluated as floating point, which is an extra .0 than explained by [WayBacksql – Why does Firebird truncate decimal places when dividing? – Stack Overflow

I’m not the only person confused by this: [WayBack] [#CORE-2849] Simple mathematics gone wrong – Firebird RDBMS Issue Tracker.

I know that as of Firebird 2.1 you can use the [WayBackdateadd() function for calculations on timestamps, date or time values (hence the confusing name dateadd), but you don’t always have the delta readily available in one unit (second, minutes, etc) and for a mixed Firebird/InterBase deployment having one kind of logic is often preferred.

select 
        cast('now' as timestamp) as NowTimeStamp 
      , (15.0*(1.0/24.0/60.0)) as A15MinutesInDays 
      , (15.0/24.0/60.0) as B15MinutesInDays 
      , (15.0E0/24/60) as C15MinutesInDays 
      , cast('now' as timestamp) + (15.0*(1.0/24.0/60.0)) as AIn15MinutesTimeStamp 
      , cast('now' as timestamp) - (cast('now' as timestamp) + (15.0*(1.0/24.0/60.0))) as ADifferenceInDays 
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0*(1.0/24.0/60.0)))) * 24 as ADifferenceHours 
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0*(1.0/24.0/60.0)))) * 24*60 as ADifferenceMinutes 
      , cast('now' as timestamp) + (15.0/24.0/60.0) as BIn15MinutesTimeStamp  
      , cast('now' as timestamp) - (cast('now' as timestamp) + (15.0/24.0/60.0)) as BDifferenceDays  
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0/24.0/60.0))) * 24 as BDifferenceHours  
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0/24.0/60.0))) * 24*60 as BDifferenceMinutes  
      , cast('now' as timestamp) + (15.0E0/24/60) as CIn15MinutesTimeStamp  
      , cast('now' as timestamp) - (cast('now' as timestamp) + (15.0E0/24/60)) as CDifferenceDays  
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0E0/24/60))) * 24 as CDifferenceHours  
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0E0/24/60))) * 24*60 as CDifferenceMinutes  
      -- Firebird 2.1 and up: use dateadd , dateadd(minute, 15, cast('now' as timestamp)) as DIn15MinutesTimeStamp , cast('now' as timestamp) - dateadd(minute, 15, cast('now' as timestamp)) as DDifferenceInDays , (cast('now' as timestamp) - dateadd(minute, 15, cast('now' as timestamp))) * 24 as DDifferenceHours , (cast('now' as timestamp) - dateadd(minute, 15, cast('now' as timestamp))) * 24*60 as DDifferenceMinutes from rdb$database /* Transposed results are below. Excected values for: A15MINUTESINDAYS 0.0104166666666667 B15MINUTESINDAYS 0.0104166666666667 Transposed results: NOWTIMESTAMP 20-9-2017 20:31:40 A15MINUTESINDAYS 0 B15MINUTESINDAYS 0.01 C15MINUTESINDAYS 0.0104166666666667 AIN15MINUTESTIMESTAMP 20-9-2017 20:31:40 ADIFFERENCEINDAYS 0 ADIFFERENCEHOURS 0 ADIFFERENCEMINUTES 0 BIN15MINUTESTIMESTAMP 20-9-2017 20:46:04 BDIFFERENCEDAYS -0.01 BDIFFERENCEHOURS -0.24 BDIFFERENCEMINUTES -14.4 CIN15MINUTESTIMESTAMP 20-9-2017 20:46:40 CDIFFERENCEDAYS -0.010416667 CDIFFERENCEHOURS -0.250000008 CDIFFERENCEMINUTES -15.00000048 DIN15MINUTESTIMESTAMP 20-9-2017 20:46:40 DDIFFERENCEDAYS -0.010416667 DDIFFERENCEHOURS -0.250000008 DDIFFERENCEMINUTES -15.00000048 */

–jeroen

Posted in Database Development, Development, Firebird, Software Development | Leave a Comment »

ScanSnap ix500: it only supports 2.4GHz WiFi

Posted by jpluimers on 2019/04/22

I had my ScanSnap ix500 – on which I wrote before – connected to a WiFi network that supported 2.4GHz and 5GHz.

Since there is too much trouble on the 2.4GHz band (too many access points around me running at too much power, and having even more trouble around meal times, so likely one or more badly shielded Microwave devices in the neighbourhood) I turned it off in my WiFi access points.

Now the ScanSnap ix500 would not scan any more (:

These links confirm my finding:

Now I have a separate access point indicating it is 2.4Ghz, so I had to use the Wireless Configuration Tool (which requires a USB connection to the ix500) to reconfigure it.

–jeroen

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

OpenSuSE: multi-megabyte binary blob `/etc/udev/hwdb.bin` does not need to be versioned with `etckeeper` – via Unix & Linux Stack Exchange

Posted by jpluimers on 2019/04/22

I wondered [WayBacklinux – Why is this a binary multi-megabyte blob /etc/udev/hwdb.bin under /etc? – Unix & Linux Stack Exchange.

All my OpenSuSE systems had the /etc/udev/hwdb.bin file with sizes varying between 7.5 and 10 megabytes with many of the zypper dist-upgrade causing updates.

Luckily the system also contains these files which had valid unit definitions, so the file was generated/updated during boot:

  • /usr/bin/systemd-hwdb
  • /usr/lib/systemd/system/sysinit.target.wants/systemd-hwdb-up‌​date.service
  • /usr/lib/systemd/system/systemd-hwdb-update.service

Thanks [WayBacknwildner for answering that question!

So after installing etckeeper and performing etckeeper init you can immediately remove it from the git repository:

# cd /etc
# git rm --cached /etc/udev/hwdb.bin
rm 'udev/hwdb.bin'
# git commit -m "no need for /etc/udev/hwdb.bin to be under revision control as systemd-hwdb maintains it"

For more background, see [WayBack] How to make Git “forget” about a file that was tracked but is now in .gitignore? – Stack Overflow.

–jeroen

 

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

Research list ESXi 6.5 and up vSphere Web Client: change Guest OS Version to the recommended one

Posted by jpluimers on 2019/04/22

There is a very odd thing in the “new” vSphere Web Client that’s mandatory as of ESXi 6.5: when you want to change the Guest OS Version to the recommended one, it’s not in the list.

Recommended:


“The configured guest OS (SUSE Linux Enterprise 11 (64-bit)) for this virtual machine does not match the guest that is currently running (SUSE openSUSE (64-bit)). You should specify the correct guest OS to allow for guest-specific optimizations.”

List:

Hopefully it is related to [WayBackESXi Embedded Host Client – Bugs: #12 Getting Warning that client OS does not match what is running.

–jeroen

Posted in ESXi6.5, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

Do not use, even if you are a Level 3 customer – 4.2.2.2: The Story Behind a DNS Legend – tummy.com, ltd.

Posted by jpluimers on 2019/04/19

Interesting bit of history: [WayBack] 4.2.2.2: The Story Behind a DNS Legend – tummy.com, ltd.

–jeroen

Posted in Development, History, Internet, Power User | Leave a Comment »

“ESXi 6.5” “vSphere Web Client” “VMware Tools” – how to install/upgrade

Posted by jpluimers on 2019/04/19

This got me zero good hits in the top 10: “ESXi 6.5” “vSphere Web Client” “VMware Tools” – Google Search

Since how to install/upgrade moved, here is a screenshot how to install or upgrade the VMware Tools using the “new” vSphere Web Client that standard in ESXi 6.5 and up:

It would be much more intuitive if the blue bar just linked to that action.

–jeroen

Posted in ESXi6.5, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

Postfix and blacklists

Posted by jpluimers on 2019/04/19

Still learning postfix configuration, below are some links on how to enable various blacklists that use the RBL DNS (aka [WayBack] DNSBL) way of operations.

They are centered around using the of the [WayBack] Postfix Documentation entry reject_rbl_client listings:

Basically reject_rbl_client is part of smtpd_client_restrictions.

TODO:

I need to dig further into some other blacklist options than reject_rbl_clientreject_rhsbl_client, reject_rhsbl_reverse_client, reject_rhsbl_sender or reject_rhsbl_recipient restriction.

Then I need to go through these links:

Some blacklist checking links:

–jeroen

Posted in *nix, *nix-tools, postfix, Power User | Leave a Comment »

Where do you place your unit uses?

Posted by jpluimers on 2019/04/18

Over the years, I have had the question of where to put uses list entries a lot.

Last year, there was one again from a very experienced developer: [WayBack] Where do you place your unit uses? Over the years, I’ve come to preferring to place my uses in the Interface section only, even if its types, constants… – Lars Fosdal – Google+

The answer is really simple, and comes down to this:

  • use only the units you need (Law of Demeter)
  • use the units as close as possible to where you need them (this helps Minimizing Scope which is related to Information Hiding and the Proximity Principle)

Besides these Clean Code and Code Complete arguments, there is another very important argument:

The larger the scope of a unit, the more resources it takes to compile your project.

This gets worse when you have cycles in your unit dependencies.

I think it gets more than progressively worse; I have seen ~5 million line projects use close to 2 gigabytes of RAM during compilation when they had deep/long cyclic dependencies, forcing a full project build with DDevExtensions configured correctly in order to avoid out-of-memory at all.

For the above question, the poll seems to indicate the public at large gets it right:

References

A few tips from the thread:

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »

When +Google Nederland maps only fills one or part of the map tiles…

Posted by jpluimers on 2019/04/18

I still have to do this every few weeks on all my desktop machines: [WayBack] When +Google Nederland maps only fills none or part of the map tiles… – Jeroen Wiert Pluimers – Google+

When +Google Nederland maps only fills none or part of the map tiles at https://maps.google.nl, but https://maps.google.com works fine, then remove any gsScrollPos cookies from www.google.nl.

I need to do this every couple of days to keep maps.google.nl working.

Later I also found it can happen for YouTube, then did more digging for gsScrollPos and found a better workaround: [WayBackAwesome Cookie Manager where you can just delete the gsScrollPos cookies from all sites in one go.

Even later I found out that this can be one of the causes for the WayBack machine giving an error 400 when archiving. A more common reason however is that many archived web-pages try to create cookies in the web.archive.com subdomain resulting in the same problem.

The cause seems to be the Great Suspender plugin which should be fixed by now, but might not automatically update to the latest version. See:

Pending a new Great Suspender release, below is a quick way to manually remove them if you are into SQL scripting for sqlite. It basically comes down to executing the below statement when Chrome is closed:

delete from cookies where name like 'gsScrollPos-%'

Edit 20231230: Awesome Cookie Manager source repository at [Wayback/Archive] Phatsuo/awesome-cookie-manager: Awesome Cookie Manager.

--jeroen

Posted in Chrome, Google, GoogleMaps, Internet, InternetArchive, Power User, WayBack machine | Leave a Comment »

The Fallacy of DRY – Entropy Wins

Posted by jpluimers on 2019/04/18

A must read post on why “Do Repeat Yourself” can be a good thing [WayBack/Archive.isThe Fallacy of DRY – Entropy Wins by Jeroen de Dauw (of WikiMedia Germany fame).

Ultimately, you want code to be easy to understand. This that when you apply the “Don’t Repeat Yourself” principle you need to ask yourself if the resulting code is still easy to understand.

He did some great talks too, for instance bit.ly/econ-cleancode, aan almost half our talk with open source slides which he [WayBackpresented during Source Code Berlin 2016

–jeroen

Read the rest of this entry »

Posted in Design Patterns, Development, DRY - Don't Repeat Yourself, Software Development | Leave a Comment »