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

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 »

for %n = 1 to 100 step 1 do: windows – Batch script loop – Stack Overflow

Posted by jpluimers on 2015/08/26

Thanks Jon for answering this:

for /l is your friend:

for /l %x in (1, 1, 100) do echo %x

Starts at 1, steps by one, and finishes at 100.

Use two %s if it’s in a batch file

for /l %%x in (1, 1, 100) do echo %%x

–jeroen

via: windows – Batch script loop – Stack Overflow.

Posted in Batch-Files, Development, Scripting, Software Development | Leave a Comment »

Cool: Vysor screen sharing by Koush

Posted by jpluimers on 2015/08/25

Esc: Back button; F1: Menu button; Home: Home button.

Esc: Back button; F1: Menu button; Home: Home button.

Really really cool!

Vysor (by Koushik Dutta aka Koush) lets you not only share and control your Android device screen from your local Chrome browser, but also remotely to others having a Chrome browser with Vysor installed. And Vysor gives you full ADB access to your Android device.

Some links to get started:

To get started:

  1. Enable ADB on your Android phone.
  2. Connect your Android phone over USB to your computer.
  3. Start Vysor.
  4. Connect.
  5. Enjoy.

After connecting over ADB, Vysor sideloads the Android code to share both screen and input. So besides viewing your screen, you can then control it.

Of course your mouse works, including scrolling. And the keyboard for entering text.

There are also some special keys:

  • Esc: Back button;
  • F1: Menu button;
  • Home: Home button.

Read the rest of this entry »

Posted in Android Devices, Chrome, Google, Power User, Vysor | 1 Comment »

Programmers’ hardest tasks

Posted by jpluimers on 2015/08/25

It took me a while to find the original illustration (especially as it was copied so often in low quality), but below it is.

Martin Wienold made a great joke based on it last year:

There are only two hard problems

  1. naming things
  2. cache invalidation
  3. off-by-one errors

–jeroen

via: G+; Programmers’ hardest tasks.

Original (October 2013): Don’t go into programming if you don’t have a good thesaurus | ITworld.

Programmer's Hardest Tasks

Programmer’s Hardest Tasks

 

Posted in Development, Software Development | Leave a Comment »

http://169.254.1.1 trick for Opening UI of the FRITZ!WLAN Repeater 1750E – via: AVM International

Posted by jpluimers on 2015/08/24

Because http://fritz.box points to my Fritz!BOX router, it cannot be used to get to my Fritz!WLAN Repeater. I just learned about the http://169.254.1.1 trick does.

Which saves me from remembering the repeater IP-address or name.

–jeroen

via: Opening the FRITZ!Box user interface | FRITZ!WLAN Repeater 1750E | AVM International.

Posted in Fritz!, Fritz!Box, Fritz!WLAN, Internet, Power User, routers | Leave a Comment »

Zypper or YaST locked: System management is locked by the application with pid ##### (/usr/lib/YaST2/bin/y2base).

Posted by jpluimers on 2015/08/24

A while ago, I got this error:

Accessing the Software Management Failed
System management is locked by the application with pid 17730 (/usr/lib/YaST2/bin/y2base).
Close this application before trying again.

Would you like to abort or try again?

[Retry] [Abort]

What happened is that a terminal session that had YaST open got disconnected (don’t you love WiFi) while checking for updates.

I tried to re-login and re-check for updates and got this error.

Looking for process 17730 indeed revealed it was YaST:

snap:~ # ps 17730
  PID TTY      STAT   TIME COMMAND
17730 pts/0    Sl+    0:11 /usr/lib/YaST2/bin/y2base online_update ncurses

A simple kill would get rid of that process:

sudo kill 17730

–jeroen

via: yast locked.

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

Was ist Cloud? Great presentation including transcript by Kristian Köhntopp.

Posted by jpluimers on 2015/08/23

When one of my DevOps friends asks: Was ist Cloud?.

Kristian Köhntopp even published it as a SlideShare deck with transcript: Was ist Cloud?.

There is even a video: Froscon “Was ist Cloud?” – Video.

Thanks a million, Kris, this is very much worth reading for anybody doing Ops, Dev or DevOps.

There is even a

If you can’t read German: tough luck (;

–jeroen

Read the rest of this entry »

Posted in Cloud, Development, Firewall, Infrastructure, Software Development | Leave a Comment »

Are these universal for any ceiling fan/light? (the IR receivers of our BULLIT one broke) – via: Home Theater Discussions And Reviews

Posted by jpluimers on 2015/08/22

Bullit ceiling fan with light.

Bullit ceiling fan with light.

We have two “Bullit” ceiling fans with built-in dimmable lights. Both of them started to malfunction after about 10 years of usage, about a year apart.

They are really nice, both in looks and build quality (heavy duty electric motor, cast aluminium block, screws nicely hidden away).

So this weekend, I took the canopy apart and found out that the receiver device that processes the infra-red signal has broken: it does not pass on the incoming current to either the light or the fan engine.

That receiver part looks like this (handheld is on the right):

  • bottom: 3 incoming wires (Phase, Earth, Neutral),
  • top: 3 outgoing wires (Phase Fan, Phase Light, Neutral),
  • connector for IR sensor
  • Connector to wire Earth to aluminium body

    Handheld infra-red transmitter (required 9-volt battery).

    Handheld infra-red transmitter (required 9-volt battery).

Bullit ceiling fan/light infra red receiver.

Bullit ceiling fan/light infra red receiver.

I came across a Westinghouse GS–26-78095-WH08 model. The image is below

Is that a universal replacement for many ceiling fan/light devices?

 

via Does an infrared ceiling fan exist? – AVS Forum | Home Theater Discussions And Reviews.

–jeroen   Read the rest of this entry »

Posted in LifeHacker, Power User | Leave a Comment »