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 2015

Breaking Out of Citrix and other Restricted Desktop Environments Pen Test Partners

Posted by jpluimers on 2015/09/04

(:

Breaking Out of Citrix and other Restricted Desktop Environments Pen Test Partners.

Posted in Power User, Remote Desktop Protocol/MSTSC/Terminal Services, Windows | Leave a Comment »

TFS: sometimes “Object reference not set to an instance of an object” means “out of disk space”

Posted by jpluimers on 2015/09/03

A while ago, we encountered this error when doing merges in TFS (non-GIT ones):

---------------------------
Microsoft Visual Studio
---------------------------
Source Control Merge Wizard
Merge encountered 1 error(s) and 0 warning(s).
First error/warning encountered:
    Server was unable to process request. ---> Object reference not set to an instance of an object.
See output tool window for information on any other errors.
---------------------------
OK   Help
---------------------------

In the end this was caused by an out of disk space on the volume containing the TFS datastore.

–jeroen

Posted in Development, Software Development, Source Code Management, TFS (Team Foundation System) | 2 Comments »

Rudy’s Delphi Corner – Pitfalls of converting, on converting from C/C++ to Delphi

Posted by jpluimers on 2015/09/02

If ever in need to translate C/C++ headers or code to Delphi, this refernece by Rudy Velthuis – a dentist with a strong interest in programming – is the best I could find: Rudy’s Delphi Corner – Pitfalls of converting.

It is written in a pretty version agnostic way, and covers the vast majority of conversion topics.

And it has been updated over time numerous times.

–jeroen

Posted in Borland C++, C, C++, C++ Builder, Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 10 Comments »

Convert List/Enumerable of Enums to CSV – via Stack Overflow

Posted by jpluimers on 2015/09/01

I like simple solutions, thanks vcsjones for answering this:

Perhaps this:

var str = String.Join(", ", SupportedNotificationMethods.Select(s => s.ToString()));

You can read more about the String.Join method at MSDN. Older versions of String.Join don’t have an overload that takes an IEnumerable. In that case just call ToArray() after select.

–jeroen

via: c# – Convert List<Enum> to List – Stack Overflow.

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

Android NDK Beginner’s Guide – Free Learning | PACKT Books

Posted by jpluimers on 2015/08/31

For Delphi and Android developers that want a deeper insight in the NDAK: only free today

https://www.packtpub.com/packt/offers/free-learning

Android NDK Beginner’s Guide

Get deep insight into the Android Native Development Kit for building complex apps. Using this practical step-by-step tutorial, highlighted with comments and tricks, discover how to run C/C++ code embedded in a Java application or in a standalone application. You will create a real native application starting from project creation through to full implementation of native API and the porting of existing third-party libraries. Grab this eBook whilst it’s free today!

–jeroen

Posted in Delphi, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 2 Comments »

OSX: Log shell script events to the OS X system consolemacissues.com (If you are familiar with the Unix command line)

Posted by jpluimers on 2015/08/31

Interesting: Log shell script events to the OS X system consolemacissues.com.

–jeroen

via: If you are familiar with the Unix command line and shell scripting, then you….

Posted in Apple, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User | Leave a Comment »

New Delphi product version: will it be Seattle or 10? It might be both! radstudiodemos/code/…/branches now has RADStudio_Seattle branch, docwiki URLs with Seattle exists and nice YouTube preview image!

Posted by jpluimers on 2015/08/30

Two recent observations: that lead me into thinking Embarcadero is changing the Delphi and RAD Studio version suffix to Seattle.

Thanks to Achim Kalwa for getting that to my attention in Looks like Delphi XE9 will have support for Windows 10 RT: …

It led me to my observation that until now, sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches always had the real product name as banch name.

On 20150817 this branch got added:

http://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RADStudio_Seattle/

Today, Horacio Filho who observed the Seattle part in the new documentation URL http://docwiki.embarcadero.com/Libraries/Seattle/en/Main_page which currently is only accessible only for the groups writer, l10n, RADBeta, ConnectBeta, Employee.

The docwiki URLs historically also use the real product names in the URL.

In fact there is a little trick: removing the product name portion of a docwiki URL usually brings you to the most recent documentation (which might be more up to date and provide more information even for older products). So removing the XE7/ part of http://docwiki.embarcadero.com/Libraries/XE7/en/Main_Page will usually bring you to the most recent documentation http://docwiki.embarcadero.com/Libraries/en/Main_Page.

If they both Seattle URLs still use product names, then the new Delphi version is called Seattle is added.

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Development, Software Development | 1 Comment »

Changing a TextBox annotation in an MDI file

Posted by jpluimers on 2015/08/28

Even though MDI files have been abandoned for a while (you can only install it for Office XP, 2003 and 2007), sometimes I need to do some editing of TextBox annotations.

This is not intuitive: you have to right-click the textbox in order to edit it.

Printing in Office 2003 also was non-intuitive: Ctrl-P would crash the Microsoft Office Document Imaging MDI editor with a Microsoft Crash Report. But mouse-clicking the print-icon works. I remember having sending dozens of these reports to Microsoft around 10 years ago, but it never got fixed.

–jeroen

Posted in Microsoft Document Imaging, Office, Office 2000, Office 2003, Office 2007, Power User | Leave a Comment »

Excel: get content of a cell given the row and column numbers (ADDRESS, INDIRECT, ROW, COLUMN)

Posted by jpluimers on 2015/08/28

A while ago, I needed to do calculations on partially absolute cell references: for some number of rows, the cells needed to be fixed to the top row of each row group.

For a pure absolute cell reference, you’d prepend a dollar sign to the row or column of a cell. So A1 would become $A1 (to make column A absolute), A$1 (to make row 1 absolute) or $A$1 (to make both column A and row 1 absolute).

There is a nice short cut function key F4 to do this.

Excel does not have a built-in partially absolute cell reference solution.

To solve this, I used these addressing functions: ADDRESSINDIRECTCOLUMNROW.

For all these functions, the ROW and COLUMN numbering starts at 1 (one) not 0 (zero).

The way I solved it was to added the below columns (first the reference:heading, then the formula).

The values in the formulas are for ROW 2 (cells A2..XFD2).

  1. AF: Calculation
    • =IF(D2=”*”;INDIRECT(AG2)&X2;””)
  2. AG: ZLookup
    • =ADDRESS($AH2;COLUMN(Z2))
  3. AH: Row
    • =2+12*TRUNC((ROW()-2)/12)

Column AH

Calculates the fixed row of the row group. There are 12 rows per group. ROW numbers start at 1, and there is one heading row, hence the 2+ and the -2.

Without TRUNC, the ROW result would be rounded (that is the default floating point to integer conversion that Excel uses).

There is no need to reference a specific row when calling ROW: if you leave it out, it will return the number of the current row.

Column AG

returns the address of the calculated ROW (from AH) combined with the

Column AF

Depending on the value of the D column, it calculates the outcome by combining

–jeroen

via:

Posted in Algorithms, Development, Excel, Floating point handling, Office, Office 2003, Office 2007, Office 2010, Office 2013, Power User, Software Development | 2 Comments »

anoymyous type trick: Check if KeyValuePair exists with LINQ’s FirstOrDefault – via Stack Overflow

Posted by jpluimers on 2015/08/27

When you have a Dictionary<TKey, TValue>, then LINQ results will get you a enumerables of KeyValuePair<TKey, TValue>.

Since KeyValuePair is a struct, selecting FirstOrDefault will not get you a null, but a default(KeyValuePair<TKey, TValue>) which is a lot harder to handle than null.

Sometimes, being able to get a null out of FirstOrDefault is very useful, so a bit thank you to Marc Gravell for answering this very neat trick:

If you just care about existence, you could use ContainsValue(0) or Any(p => p.Value == 0) instead? Searching by value is unusual for a Dictionary<,>; if you were searching by key, you could use TryGetValue.

One other approach:

       var record = data.Where(p => p.Value == 1)
            .Select(p => new { Key = p.Key, Value = p.Value })
            .FirstOrDefault();

This returns a class – so will be null if not found.

The trick is this portion:

p => new { Key = p.Key, Value = p.Value }

It introduces an anonymous type with two fields: Key and Value. (Note you can introduce any anonymous type here). Since these are classes, FirstOrDefault will return null if nothing was found.

–jeroen

via:

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