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

Perl: checking if makedepend is available without using File::Which

Posted by jpluimers on 2016/08/25

Long lasting open source projects often use makedepend to amend Makefiles with C header dependencies.

However, makedepend is old, not available on some systems (like Mac OS X or Windows) and can have different behaviour than the C compiler on those systems. The alternative usually is the -M switch on the C compiler.

In practice, either makedepend, or the alternative is available, so when prepping for a build you have to choose which one to use.

Some of those open source projects use Perl as a bootstrapper. I’ll write more about those boots trappers in the future, but first lets go back to the post title:

First detecting the availability of makedepend from Perl without relying on File::Which which isn’t installed by default on systems having Perl so a gated check-in build like this Travis build fails.

The trick I use is Perl backticks (aka qx) to try and execute makedepend merging the output of both stdout and stderr (using 2>&1 which is available on most shells). If there is no output, then the result is undef which means makedepend is not available.


# http://perldoc.perl.org/perlop.html#Quote-Like-Operators
# ensure to take the stdout and stderror so we get output like this:
# 'makedepend: error: cannot open "Makefile.makedepend"
#'.
my $makedepend_output = `makedepend -f Makefile.makedepend 2>&1`;
if (!$makedepend_output)
{
print "No makedepend executable found on your path.\n";
}
else
{
print "Output of makedepend: '$makedepend_output'.\n";
}

–jeroen

via:

Posted in Development, Perl, Scripting, Software Development | 1 Comment »

Update to List-Delphi-Installed-Packages.ps1 shows HKCU/HKLM keys and doesn’t truncated fields any more

Posted by jpluimers on 2016/08/24

I’ve posted an update to List-Delphi-Installed-Packages.ps1 that:

  • added HKCU/HKLM registry key values for each BDS version
  • doesn’t truncate fields any more when your console has limited width
  • is now in UTF-8 format so the BitBucket web-interface can show it

For the first two: Phry for helping me to force Format-Table to show more than 10 columns and pointing me how find out how to do this with Out-String so it doesn’t truncate fields; blog post about it will follow.

Now – as I can display more than 10 columns- I can start working in integrating all the other info about various BDS versions.

Source is at https://bitbucket.org/jeroenp/besharp.net/src/tip/Native/Delphi/Scripts/List-Delphi-Installed-Packages.ps1?fileviewer=file-view-default

A text dump of the current output is below with the Delphi versions including CompilerVersion, RTLVersion, VERXXX Define, DllSuffix and more.

–jeroen

via: If you need to know underlying information on Delphi versions « The Wiert Corner – irregular stream of stuff

Read the rest of this entry »

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

APC: getting ftp://ftp.apc.com/apc/public/software/pnetmib/mib/417/powernet417.mib turned out to be tricky

Posted by jpluimers on 2016/08/24

I tried updating my downloads for my APC7920 and APC7921 PDUs.

I knew the APC download site http://www.apc.com/nl/en/tools/download/index.cfm was slow and navigation unfriendly (lots of ERR_CACHE_MISS as you cannot ctrl-click on downloads), but it’s also buggy: Some of the ftp download URLs do not contain the authentication and one file would not download at all.

The solution for that is to prepend the credentials as username:password@ like these URLs where each first one is generated by the download site and each second one works:

  • ftp://ftp.apcc.com/restricted/hardware/nmcard/firmware/devipcfg_wiz/502/Device%20IP%20Configuration%20Wizard.exe
  • ftp://restrict:Kop$74!@ftp.apcc.com/restricted/hardware/nmcard/firmware/devipcfg_wiz/502/Device%20IP%20Configuration%20Wizard.exe
  • ftp://ftp.apc.com/restricted/hardware/nmcard/firmware/sec_wiz/104/SecWiz%201.04%20Install.exe
  • ftp://restrict:Kop$74!@ftp.apc.com/restricted/hardware/nmcard/firmware/sec_wiz/104/SecWiz%201.04%20Install.exe

The username is restrict and the password Kop$74! which requires single quotes on the command-line to prevent parameter and event expansion.

Otherwise you will get bash errors like these: event not found for the part starting with an exclamation mark and Login incorrect. for the parts having a dollar.

One file would not download at all: ftp://ftp.apc.com/apc/public/software/pnetmib/mib/417/powernet417 as all download attempts would time out:

  • Chrome with and without username:password@ (you will get a ERR_FTP_FAILED)
  • wget with and without username:password@ (it will result in a )
  • plain curl with and without username:password@ (it will result in a curl: (28) Timeout was reached)

The only command that would work was this:

curl -G ftp://ftp.apc.com/apc/public/software/pnetmib/mib/417/powernet417.mib > powernet417.mib

via: SimplicityGuy/pynoc – Travis CI

The trick is to:

  1. leave username and password away
  2. specify the -G (or –get) parameter forcing GET behaviour (which should be the default).

I’m not sure why it works, but it does.

–jeroen

Posted in *nix, APC Smart-UPS, cURL, Power User, UPS | Leave a Comment »

List goals/targets in GNU make that contain variables in their definition – Stack Overflow

Posted by jpluimers on 2016/08/24

*nix systems tools often are have write-only maintenance tricks:

alias make-list-target='make -qp | awk -F":" "/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split(\$1,A,/ /);for(i in A)print A[i]}"'

Like usual, I have only a vague idea what the regex expressions do.
–jeroen

via List goals/targets in GNU make that contain variables in their definition – Stack Overflow.

Posted in Awk, bash, Development, Scripting, Software Development | Leave a Comment »

When “git mv” on a directory gives you en error starting with “fatal: bad source”

Posted by jpluimers on 2016/08/23

I use “git mv” a lot because somehow it works a lot better than having git automagically find out about renames.

The problem with “git mv” is that the “fatal: bad source” errors are a catch-all for many causes. Just look at the

Searching for “git mv” directory “fatal: bad source” didn’t get me much further. The one link that did get me towards the right track is version control – Getting Git to follow renamed and edited files – Stack Overflow.

What happened was that I had manually deleted and edited some files as part of a mass script (the repository had a lot of files in it that didn’t belong there compile targets and user specific settings or didn’t adhere to the naming conventions) before executing the “git mv”.

Since “git mv” tries to administer all the files that it thinks originally were in the directory, it complains about those files.

Lesson learned: first “git mv” then perform other changes.

–jeroen

Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management | Leave a Comment »

ORACLE-BASE – DDL With the WAIT Option (DDL_LOCK_TIMEOUT) in Oracle Database 11g Release 1

Posted by jpluimers on 2016/08/23

To work around this error:

ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

ensure your DDL does wait a bit longer than the default of NOWAIT seconds:

alter session set ddl_lock_timeout=30
;
alter table TABLE_NAME
modify constraint CONSTRAINT_NAME enable
;
commit
;

via ORACLE-BASE – DDL With the WAIT Option (DDL_LOCK_TIMEOUT) in Oracle Database 11g Release 1.

Posted in Database Development, Development, OracleDB | Leave a Comment »

co2-adapter.de – Sodastream Zylinder selbst nachfüllen

Posted by jpluimers on 2016/08/22

co2-adapter.de – Sodastream Zylinder selbst nachfüllen – refill sodastream CO2 cartridges from a regular CO2 gas tank.

via:

+Jeroen Wiert Pluimers  just reminded me of something. We do have one of these things. Is this a thing in the Netherlands, and if so, where to get CO2 for… – Kristian Köhntopp – Google+

Posted in LifeHacker, Power User | Leave a Comment »

Beyond Compare 4.1.7.21529 – AUGUST 19, 2016

Posted by jpluimers on 2016/08/22

via Download Beyond Compare I found out about this new update:

4.1.7.21529 – AUGUST 19, 2016

Notable Changes

  • Text Merge output files will now be written using file format external conversion settings.
  • Various fixes and improvements.

Archives

  • Upgraded 7-zip libraries to 16.02 to fix code execution vulnerability in UDF (.img, .iso) decoder (CVE-2016-2334 and CVE-2016-2335).
  • Windows: Added support for PKZip v1 legacy compression algorithms (Implode, Reduce, Shrink).

Cloud Services

  • Fixed support for Unicode paths and filenames on SharePoint WebDAV servers.
  • Fixed support for connecting to Amazon S3 buckets in the eu-west-1 region that were created in 2013 and earlier.
  • Fixed resource leak when uploading/downloading from Microsoft OneDrive.
  • Windows: “Open With” for WebDAV profiles now passes http:// URLs to the requested application instead of BC-specific profile: ones.
  • Improved error message if an S3 bucket is stored in an unrecognized AWS region.
  • Fixed loading WebDAV folder listings that include empty getcontentlength entries.

Command Line

  • Fixed /fileviewer= switch to use fixed English phrases instead of translated strings.

File Formats

  • OS X/Linux: Fixed importing file formats with external helper executables.
  • Fixed loading .docx files that have been modified using MiniZip.

File Views

  • “Save File Using Profile” now handles “Editing disabled” just like “Save File on File System As” does.
  • Changed button caption in “Save Changes?” confirmation dialog from “Save None” to “Discard All”.

Installer

  • .msi packages now use SHA-256 code signing signatures instead of SHA-1 ones.

Misc

  • Fixed support for scrolling using laptops/tablets with precision touchpads (.e.g, Surface Pro).
  • OS X: Fixed support for Beyond Compare “Services” menu extensions in apps other than Finder.
  • Added Japanese as an official language.
  • Time limited license keys now show a warning on the Home view when close to the expiration, and show the expiration date in the About dialog.

Options

  • Improved appearance of Options dialog and Home view for themes with dark backgrounds.

Reports

  • Fixed Picture Compare Report to use printer DPI instead of screen DPI.
  • Fixed Picture Compare Report handling of empty comparison.
  • Fixed plain text output of right justified text.
  • Fixed plain text output handling of gap lines.
  • Fixed Table Compare plain text output of interleaved headers.

Table Compare

  • Fixed performance regression introduced in 4.1.4.

Text Views

  • Windows: Fixed displaying emoji characters when “Enable font linking in editors” is enabled.
  • Linux: Fixed slow performance when long lines are visible.

Text Merge

  • Output files will now be written using file format external conversion settings.

Crashes

  • Windows: Fixed crash when opening a file on 64-bit Windows.
  • Windows: Fixed crash when opening Options dialog to Tweaks panel while DisableCheckForUpdates registry tweak is active.

–jeroen

Posted in Beyond Compare, Power User | Leave a Comment »

Some notes on apcupsd, a SUA3000XLI and a SUA48XLBP battery pack

Posted by jpluimers on 2016/08/22

I’ve had a SUA3000XLI for years using the USB cable and default Windows support as PowerChute Personal Edition would fail to recognise it and abort installation (so I could not use APC drivers as described on youtube).

A while ago, Liander – the energy distribution company – wanted to replace both the gas and electricity meters to become “smart” during day time. The server configuration load was heavy enough for Windows to indicate the UPS would last about 30 minutes. At night that’s not much of a problem but during 1 hour replacement day-time it would be a problem.

So I bought a SUA48XLBP battery pack (and a SUA039 cable as the cable wasn’t long enough to keep an inch or so air space between UPS and battery pack) so the battery would last about 3 times as long.

Windows would still show it would last about 30 minutes. Strange. So I started looking around and it appeared the SUA3000XLI needed calibration which requires PowerChute. Since PowerChute won’t work, I was almost back at square 1. Almost, as I know knew it required calibration.

In the past I had come across apcupcd but that was a long time ago when it supported a limited set of operating systems and a limited set of features so I never installed it.

But when searching how to calibrate the without using PowerChute, it quickly appeared that the apctest part of apcupsd can do just that: soft calibrate the UPS/battery combo. There are some steps and prerequisites (the most important ones are to turn off the apcupsd and provide enough load and 100% battery charge at start).

Spoiler: the combined UPS/battery-pack now lasts for almost 2 hours which is long enough.

Installing apcupsd

I’m describing this from a Windows perspective and it’s dead easy:

  1. download the latest release
  2. run the installer
  3. allow the driver to be installed
    1. indicate it’s OK to install an unsigned driver
    2. now Windows won’t recognise the UPS any more, but in a few steps the apcupsd and helper program will
  4. update the configuration file (no changes needed when it’s a USB connected one)
  5. wait for the service to start
  6. wait for the apctray helper program to start
  7. look in the “system tray” for apctray helper program icon 
  8. optionally configure your system to auto-start apctray after logon

The USB connection to the UPS delivers slightly less options than using a serial cable

Using a serial cable instead of a USB one

Read the rest of this entry »

Posted in APC Smart-UPS, apcupsd, ESXi5, ESXi5.1, ESXi5.5, ESXi6, Liander, Power User, UPS, Virtualization, VMware, VMware ESXi, Windows, Windows 10, Windows 7, Windows 8, Windows 8.1, Windows 9, Windows Server 2003, Windows Server 2003 R2, Windows XP | 1 Comment »

ThinkPad ‘Ultra Classic’ 780ZXL+

Posted by jpluimers on 2016/08/22

LOL: ThinkPad ‘Ultra Classic’ 780ZXL+ BZ4hQZi.png (1920×1080).

I lost my interest in ThinkPads long ago a while after Lenovo took over. But I could not resist posting this picture (:

–jeroen

via Peter VonesThinkpadders Rejoice (LARGE PICS) – Page 10.

Posted in Fun | Leave a Comment »