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

Archive for 2016

The Default magic function in Delphi

Posted by jpluimers on 2016/03/17

Stefan Glienke worded it perfectly: Default(typeIdentifier) is a “magic” function that is implemented into the compiler and causes it to generate the correct code – like for records with managed fields it generates a call to FinalizeRecord and some instructions to zero the remaining fields.

Source: I know I can write MyRecordVar := Default(TMyRecordType) because I asked a qu…

–jeroen

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

Reminder to self: app.config and “ORA-12154: TNS:could not resolve the connect identifier specified”

Posted by jpluimers on 2016/03/17

When you have one app.config for your whole set of DTAP environments (develop/test/acceptance production), every once in a while you get this error:

ORA-12154: TNS:could not resolve the connect identifier specified

For this particular setup, it means the replacement of parameters in the app.config with actual values from the DTAP went wrong (or was missing). For that we’ve some steps in both the PreBuildEvent and PostBuildEvent of the .csproj file:

PreBuildEvent:

del "$(ProjectDir)$(TargetFileName).config"
copy "$(ProjectDir)app.config" "$(ProjectDir)$(TargetFileName).config"

PostBuildEvent:

powershell -noprofile -file Replace-Parameter.ps1 -Path "$(TargetDir)$(TargetFileName).config"

The PreBuildEvent looks like it is not needed, but sometimes Visual Studio forgets to perform the copy action.

–jeroen

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, .NET ORM, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Database Development, Development, NHibernate, OracleDB, Software Development | Leave a Comment »

assembly:InternalsVisibleTo: .net – C# “internal” access modifier when doing unit testing – Stack Overflow

Posted by jpluimers on 2016/03/16

It seems I always forget about the InternalsVisibleTo attribute which allows you to specify which external assembly can see your internal types and type members:

Internal classes need to be tested and there is an assembly attribute:

using System.Runtime.CompilerServices;
[assembly:InternalsVisibleTo("MyTests")]

Add this to the project info file, e.g. Properties\AssemblyInfo.cs.

Thanks Eric Schaefer for that answer.

–jeroen

via .net – C# “internal” access modifier when doing unit testing – Stack Overflow.

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Software Development | Leave a Comment »

Bug squasing: A heisenbug is not your average bug.

Posted by jpluimers on 2016/03/15

I took the liberty to make an English translation of this very interesting German story about squasing an Heisenbug from Kristian KöhntoppHeisenbugsquashing bei +SysEleven: Sechs Monate Kernels crashen, aber jetzt isser tot….

Don’t forget to read (translated) comments in the original thread. Very interesting read!

I agree it’s in the Heisenbug category given “Time can also be a factor in heisenbugs, particularly with multi-threaded applications.”.

Anyway, the translation and original:

English:

Read the rest of this entry »

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

Fritz!Box 7360 and 7490: static routes over VPN don’t work

Posted by jpluimers on 2016/03/15

I’ve tried the below on a Fritz!Box 7490 configuration and it fails as well.

The case is that I’ve a VPN (see Getting Fritz!Box LAN-LAN VPN to work) between a Fritz!Box 7360 (having internal IP 192.168.24.1) and a Fritz!Box 7490 (having internal IP 192.168.71.1). This is how it looks from the Fritz!Box 7360 side:

Name Address in the Internet local network remote network
80.100.143.119 80.100.143.119 192.168.24.0/24 192.168.171.0/24

On the 192.168.171.0/24 side of things, the internal IP of the 80.100.143.119 router is 192.168.171.1. Inside the 192.168.171.0/24 network is is another router (192.168.171.22) having an internal 192.168.71.0/24 network.

Basically I want to tell the Fritz!Box 7360 (at IP 192.168.24.1) that there is an internal route to 192.168.71.0/24 via 192.168.171.22.

I found and read Accessing multiple IP networks behind a FRITZ!Box over VPN connection between two FRITZ!Boxes | FRITZ!Box 7360 | AVM International.

Based on it, I wanted to add this route on the 192.168.24.1:

Static IPv4 Route

IPv4 network 192.168.71.0
Subnet mask 255.255.255.0
Gateway 192.168.171.22
Enabled X

When you do that, you get this error message:

An error occurred.
Error description: The route is illegal.
Please enter your data again. If the error occurs again, please consult AVM Support.

How can I get this route to work?

–jeroen

Posted in Fritz!, Fritz!Box, Internet, Power User | 1 Comment »

git-extras/Commands.md at master · tj/git-extras

Posted by jpluimers on 2016/03/15

[WayBack] git-extras is awesome: it adds many [WayBack] useful commands to git. Like [WayBack] git ignore and [WayBack] git-info.

For instance, this adds README.md~ to the .gitignore file:

git ignore README.md~

It makes command-line git much more usable, even so much that it lessens the needs of SourceTree and other UIs tools.

You can get it at the GitHub repository [WayBack] tj/git-extras.

Lots of help is at [WayBack] git-extras/Commands.md: it explains all the commands that git-extras adds.

Thanks [WayBack] nifr for posting about git-extras at [WayBack] Is there an ignore command for git like there is for svn? – Stack Overflow.

–jeroen

 

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

Delphi: disable or change your welcome page to not use the Embarcadero site (as that site has been hacked twice this weekend)

Posted by jpluimers on 2016/03/14

Initial hack

Initial hack – image via the forums server.

This weekend, the Embarcadero web site was hacked by AnonCoders. Not once (see also [WayBack] G+ link and [WayBackDelphiPraxis link and [WayBackimage) but at least twice (see also [WayBackG+ link and [WayBackimage and [WayBackDelphi Praxis link and [WayBackimage) where the initial hacked simple text “Hacked By AnonCoders ~ Cyber Caliphate” after having been reverted back to the site – hopefully by Embarcadero staff – was replaced with [WayBack] more graphical content later on.

Hack presenting itself in the IDE

Hack presenting itself in the IDE – image via the forums server.

The Welcome Page inside the Delphi IDE uses the Embarcadero web site, so the Delphi IDE Welcome Page was also affected (see also [WayBackthis G+ link).

Because the IDE uses this on-line content, potentially any code could be executed inside the IDE (apart from that page being loaded over http, so any man-in-the-middle could abuse this, but I digress). This imposes a security risk as many developers run the IDE from accounts having more rights than the average user.

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, QC, Software Development | 13 Comments »

Free Online Picture Resizer – Crop and Resize photos, images, or pictures online for FREE!

Posted by jpluimers on 2016/03/14

Resize, shrink, and crop your pictures online for free at [WayBackPicResize.com. Resize photos before posting them on Facebook, Twitter, Pinterest, Reddit, Tumblr, or blog!

Source: [WayBackFree Online Picture Resizer – Crop and Resize photos, images, or pictures online for FREE!

–jeroen

PS: note there is no  TLS available, so https://picresize.com/ fails. I have notified them about that.

Posted in LifeHacker, Power User | Leave a Comment »

Upgrading from OpenSuSE 13.1 to 13.2

Posted by jpluimers on 2016/03/14

As etckeeper wasn’t available in the “normal” OpeenSuSE 13.1 package, I used the steps below to upgrade to 13.2 after reading SDB:System upgrade – openSUSE and How To Upgrade To openSUSE 13.2 From openSUSE 13.1 | Unixmen.

Note I installed inside tmux (to prevent any ssh disconnects from screwing the upgrade process):

Read the rest of this entry »

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

TeamViewer Portable on Windows without UAC breaking it

Posted by jpluimers on 2016/03/14

TeamViewer Portable (and its cousin TeamViewer QuickSupport) is a great tool for the occasional helping out of friends, but both Portable and QS don’t play well with UAC:

Your partner’s desktop is no longer accessible.

Probably you used a program that requires additional permissions.
Please wait until your partner has granted these permissions.

Many suggest to install the full TeamViewer client, but that is a bit against the point of occasional helping.

A practical solution is much easier: start either Portable or QS with using Run As Administrator once, and it works perfectly fine.

–jeroen

Read the rest of this entry »

Posted in Power User, Windows | 2 Comments »