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 November, 2016

openSuSE Tumbleweed: solution for `ImportError: No module named pkg_resources`

Posted by jpluimers on 2016/11/11

If ever on openSuSE Tumbleweed you get an error ImportError: No module named pkg_resources then check you have the installed the python-setuptools package it is different from python3-setuptools which was installed by default but is not the default python used.

This is how to install it:

zypper install python-setuptools

Tools like speedtest-cli require it.

The odd thing: on a Mac, the homebrew speedtest-cli installed and ran with no additional packages needed:

retinambpro1tb:tmp jeroenp$ brew install speedtest-cli
==> Downloading https://github.com/sivel/speedtest-cli/archive/v0.3.2.tar.gz
==> Downloading from https://codeload.github.com/sivel/speedtest-cli/tar.gz/v0.3.2
######################################################################## 100.0%
🍺 /usr/local/Cellar/speedtest_cli/0.3.2: 5 files, 52K, built in 2 seconds
retinambpro1tb:tmp jeroenp$ speedtest-cli
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from Routit BV (37.153.243.246)...
Selecting best server based on latency...
Hosted by ExtraIP (Amersfoort) [3.99 km]: 6.488 ms
Testing download speed........................................
Download: 49.89 Mbit/s
Testing upload speed..................................................
Upload: 47.81 Mbit/s

(this is on one of my fiber connections back when it was 50/50 megabit).

Note that for both the web interface of speedtest.net and command-line versions (like Python based speedtest-cli) sometimes needs some fiddling with chosen servers and repeated measurements to get a consistent average as quite some factors can influence the measurements.

For my home location, this one gives me the most consistent results for my fiber connections (they’re so good and reliable that I don’t have ADSL or cable any more):

speedtest-cli --server 3629

You can get the list of servers ordered by increasing distance using this command:

speedtest-cli --list | head -n 20

–jeroen

Posted in *nix, *nix-tools, Internet, Linux, openSuSE, Power User, SpeedTest, SuSE Linux | 2 Comments »

Fixing `Unable to create ModelMaker Tools Shared Directory` and `Cannot create file “C:\HungarianTypeLookup.txt”. Access is denied.`

Posted by jpluimers on 2016/11/10

Like many Delphi 3rd party product, new ModelMaker Code Explorer (often abbreviated as MMX) releases have not been as thick as in the heydays (look at the history for versions 7, 8 , 9, 10, 11 and 12).

Unlike a lot of products it is still there, still very stable and hasn’t been acquired which it means it is available for a wide range of Delphi versions. So I still use it, but know certain issues will likely be never solved.

One of these issues is running ModelMaker Code Explorer as a different user than the installing user. In the authors words:

You need to install MMX as the same user that will run MMX.
MMX does not support running as a different user than the one installed.

This requirement becomes increasingly difficult to satisfy. This especially happens in more security conscious organisations where there is a clear distinction in rights between users that can install software and the ones that use the software. But it can also happen when you switch users because of infrastructure changes (new Windows domain, no Windows domain, etc).

Delphi itself copes reasonably well with that, as does GExperts, but MMX doesn’t. Despite the writeup on How to verify a Code Explorer installation? it lacks two things:

  1. explaining the below kinds of error messages when you run MMX with a different user than you installed MMX
  2. explaining some easy steps to fix this

As I roam a lot, I’ve spent about a day fiddling and writing up the below information:

Read the rest of this entry »

Posted in Delphi, Development, ModelMaker Code Explorer, Software Development | Leave a Comment »

Old Google Charting API: tools for still using them

Posted by jpluimers on 2016/11/10

While mocking the ScaleMM documentation, I bumped into a chart that I thought was an image, but is in fact generated by the (now deprecated) Image Charts API from Google.

In fact it is generated on the fly from a URL: http://chart.apis.google.com/chart?chxr=0,0,16|1,0,14682…&nonsense=something_that_ends_with.png

Compare the two below. They are identical (:

Static ScaleMM1 comparison chart

Static ScaleMM1 comparison chart

URL based ScaleMM1 comparison chart

URL based ScaleMM1 comparison chart

Even though the API is deprecated Google has no plans to turn it of, so it still works and is the easiest way to get charts into a Markdown or reStructuredText document.

In practice, it doesn’t matter if you use the chart.apis.google.com or chart.googleapis.com domain: they give the same results the same.

As I wanted to convert the results.txt to a chart, I dissected the above URL, looked up the definitions of the URL parameters (the trickiest: cds for lxy graphs and the combination of chds and chxr, easier: chls) and created a new URL for the chart below.

Read the rest of this entry »

Posted in Delphi, Development, Google, Power User, Software Development | Leave a Comment »

Locking Is there a good open source MREW lock object out there that – Supports…

Posted by jpluimers on 2016/11/09

Summary of the  Locking Is there a good open source MREW lock object out there thread:

Don’t use MREW. Too many bugs in any implementation, and too easy to make deadlocks.

Use other locking mechanisms that are lighter, easier to understand and therefor less prone to mistakes.

–jeroen

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

The SelectiveDebugging plug-in now supports Delphi 10.1 Berlin.

Posted by jpluimers on 2016/11/08

This post is a reminder to myself that this plugin exists at all.

Hopefully by this time it supports more recent Delphi versions as well; when scheduling this post, it supported from XE to 10.1:

My SelectiveDebugging plug-in now supports Delphi 10.1 Berlin. The updated download can be found at the end of the corresponding blog post:… – Uwe Raabe – Google+ [WayBack]

–jeroen

via:

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »

Delphi Continuous Integration: When you get E2202 “Required package ‘rtl’ not found” or F1027 “Unit not found: ‘System.pas'”

Posted by jpluimers on 2016/11/08

If when setting up Continuous Integration (CI) with Delphi and you get errors like E2202 "Required package 'rtl' not found" or F1027 "Unit not found: 'System.pas'", then something is wrong with your library path on the CI server.

Before going into the details of why, the quick solution is to set either of these environment variables in your build script

  • Delphi 2007, 2010: Win32LibraryPath
  • Delphi XE and up: DelphiLibraryPath

Now back to the details of why these might not be set, most information is from my Delphi build automation workshop.

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 1 Comment »

parted “Error: Can’t have a partition outside the disk!” sometimes means you’ve a bogus DVD inserted

Posted by jpluimers on 2016/11/07

At first sight I thought I had a damaged partition table on the HDD, but then I realised it was a bogus DVD.

parted -l would give me this:

Error: Can't have a partition outside the disk!
Ignore/Cancel? i                                                          
Error: Can't have a partition outside the disk!
Ignore/Cancel? i                                                          
Model: NECVMWar VMware IDE CDR10 (scsi)
Disk /dev/sr0: 4647MB
Sector size (logical/physical): 2048B/2048B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      7340kB  23.9MB  16.5MB  primary               esp, type=ef
 2      23.9MB  18.6GB  18.6GB  primary               boot, hidden, type=17

A simple eject /dev/sr0 solved the issue.

Too bad there is no way to force parted to ignore errors (or specify a default answer).

–jeroen

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

Kerlink IoT station page | LoRa | Semtech

Posted by jpluimers on 2016/11/07

This can be used for TheThingsNetwork.org.

Some downloads:

Attachments
File Last modified Size
Kerlink_gateway_channel_setup_v0.2.pdf 2015-05-18 17:20 838Kb
Kerlink_gateway_installation_R7.pdf 2015-08-13 14:32 805Kb
Python_gateway_spectrum_display.zip 2015-04-09 15:54 10Kb
kerlink_IoT_LoRa_update.zip 2015-08-13 14:27 63Kb
kerlink_IoT_LoRa_update_DHCP.zip 2015-08-13 14:27 64Kb

Source: Kerlink IoT station page | LoRa | Semtech

Posted in *nix, IoT Internet of Things, LoRa - Long Range wireless communications network, Network-and-equipment, Power User, Uncategorized | Leave a Comment »

How to use curl command with http/2 on MacOS X

Posted by jpluimers on 2016/11/04

Skip the built-in curl and directly go to the homebrew one:

$ brew update
$ brew upgrade
$ brew install curl --with-nghttp2

Source: How to use curl command with http/2 on MacOS X [WayBack]

via: Using cURL with HTTP/2 on Mac OS X #sysadmin #unix #apple #macos – Joe C. Hecht – Google+ [WayBack]

–jeroen

Posted in Apple, Home brew / homebrew, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, macOS 10.12 Sierra, OS X 10.9 Mavericks, Power User | Leave a Comment »

What runs logrotate in OpenSUSE 13.2?

Posted by jpluimers on 2016/11/04

Historically, on many systems, logrotate is being ran from a daily cron job. Many tutorials still presume that, for instance HowTo: The Ultimate Logrotate Command Tutorial with 10 Examples.

I still thought it would and after writing On OpenSuSE, when adding Apache vhosts with their own log files don’t forget to update your logrotate configuration I was anxious to see when logrotate would run the second time.

So I tried finding it in the cron.daily and it wasn’t there.

OpenSuSE 13.2 changed how logrotate is inficated: from there on (including both Tumbleweed and LEAP) logrotate is ran from the systemd service:

logrotate is a systemd service in 13.2 (/usr/lib/systemd/system/logrotate.service) and it is run periodically by a systemd timer (not cron).

Have a look at /usr/lib/systemd/system/logrotate.timer and “man systemd.timer”.

You can view the status of the logrotate.timer that fires it every day:

systemctl status logrotate.timer

It triggers logrotate and reads the config in /etc/logrotate.conf for basic global settings and then files in /etc/logrotate.d/* for custom settings for specific files.

Which means you should not mess around with files in /etc/logrotate.d/ as each file there will be processed. So don’t leave around backup files ending in a tilde (~) or DEADJOE as it causes trouble:

Jul 07 00:00:02 revue logrotate[16121]: error: DEADJOE:5 lines must begin with a keyword or a filename (possibly in double quotes)
Jul 07 00:00:02 revue logrotate[16121]: error: DEADJOE:6 missing '{' after log files definition
Jul 07 00:00:02 revue logrotate[16121]: error: found error in file DEADJOE, skipping

There’s more you can do do debug logrotate behaviour

The below tips are all based on this thread: [Bug 913421] logrotate not running after update from 13.1 to 13.2

Show if the timer is there and counting:

# systemctl list-timers --all
NEXT                          LEFT          LAST                          PASSED    UNIT                         ACTIVATES
Fri 2016-07-08 00:00:00 CEST  5h 24min left Thu 2016-07-07 00:00:02 CEST  18h ago   logrotate.timer              logrotate.service
Fri 2016-07-08 17:51:53 CEST  23h left      Thu 2016-07-07 17:51:53 CEST  43min ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service

2 timers listed.

Show the status of the logrotate service itself:

# systemctl status logrotate.service --full
● logrotate.service - Rotate log files
   Loaded: loaded (/usr/lib/systemd/system/logrotate.service; static; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2016-07-07 00:00:02 CEST; 18h ago
     Docs: man:logrotate(8)
           man:logrotate.conf(5)
  Process: 16121 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=1/FAILURE)
 Main PID: 16121 (code=exited, status=1/FAILURE)

Jul 07 00:00:02 revue logrotate[16121]: error: DEADJOE:5 lines must begin with a keyword or a filename (possibly in double quotes)
Jul 07 00:00:02 revue logrotate[16121]: error: DEADJOE:6 missing '{' after log files definition
Jul 07 00:00:02 revue logrotate[16121]: error: found error in file DEADJOE, skipping
Jul 07 00:00:02 revue logrotate[16121]: error: skipping "/var/log/squidGuard/squidGuard.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
Jul 07 00:00:02 revue logrotate[16121]: compress_ext is /usr/bin/xz
Jul 07 00:00:02 revue logrotate[16121]: compress_ext was changed to .xz
Jul 07 00:00:02 revue systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
Jul 07 00:00:02 revue systemd[1]: Failed to start Rotate log files.
Jul 07 00:00:02 revue systemd[1]: logrotate.service: Unit entered failed state.
Jul 07 00:00:02 revue systemd[1]: logrotate.service: Failed with result 'exit-code'.

The bottom lines are from journalctl -u logrotate which can show more information.

In this case, fixing both issues was easy: remove DEADJOE and correct the permissions on this empty directory:

# ls -al /var/log/squidGuard/
total 0
drwxrwx--- 1 squid squid   0 Jun 16 21:08 .
drwxr-xr-x 1 root  root  962 Jul  6 17:36 ..
# chmod 750 /var/log/squidGuard/
# ls -al /var/log/squidGuard/
total 0
drwxr-x--- 1 squid squid   0 Jun 16 21:08 .
drwxr-xr-x 1 root  root  962 Jul  6 17:36 ..

If you can’t wait for the timer to fire at midnight, you can invoke the logrotate service manually (after that wait until it is finished then do something like du -csh /var/log/* or list the files):

# systemctl start logrotate.service

–jeroen

via:

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