The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,757 other followers

Archive for August, 2011

.NET SecureString – storing/retreiving passwords and other sensitive data

Posted by jpluimers on 2011/08/31

Let me start that you should store as little sensitive information as possible. But if you do, you should store it in a secure way. That’s why the .NET 2.0 introduced the SecureString class.

I won’t go into detail here, as the links below and the demo source do that much better than I can:

One warning: be very cautious when you convert a SecureString in a regular unsecure array of characters, string, or compare the unsecured content. To quote Fabio Pintos, everytime you do, a little village bursts on fire. When you access it in an insecure way, make sure it is pinned, clear and release the insecure memory as soon as possible.

The problem with a garbage collected environment like .NET is that strings live on the heap, and you can’t deterministically eliminate a string from memory like you could in deterministic environment like Delphi or C/C++.

Have fun with it!

–jeroen

Posted in .NET, C#, Development, Software Development | 2 Comments »

Batch file to get parent directory (not the directory of the batch file, but the parent of that directory)

Posted by jpluimers on 2011/08/30

The problem solved here is two-fold:

  1. The ~dp syntax for getting the directory/path part only works for parameters and loop indexes, not on variables.
    You can work around this by having a 1-iteration for-loop.
  2. The :~ syntax for getting the substring works only for variables, not for parameters and loop indexes.
    You can work around this by assigning to a temporary variable.

Example:

  echo batchfile=%0
  echo full=%~f0
setlocal
::http://stackoverflow.com/questions/636381/what-is-the-best-way-to-do-a-substring-in-a-batch-file
  set Directory=%~dp0
echo Directory=%Directory%
:: strip trailing backslash
  set Directory=%Directory:~0,-1%
echo %Directory%
::  ~dp does not work for regular environment variables:
::  set ParentDirectory=%Directory:~dp%  set ParentDirectory=%Directory:~dp%
::  ~dp only works for batch file parameters and loop indexes
  for %%d in (%Directory%) do set ParentDirectory=%%~dpd
  echo ParentDirectory=%ParentDirectory%
endlocal

This will show:

  1. The directory of the batch file
  2. The directory but without the trailing backslash
  3. The parent directory of the batch file

Hope you can give this some use.

–jeroen

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

RDP issue solved itself; research list to see what might be involved

Posted by jpluimers on 2011/08/29

Recently, I got the below message when trying to MSTSC into a RDP targeting a Windows 7 machine having multiple NICs.

—————————
Remote Desktop Connection
—————————
Your computer could not connect to another console session on the remote computer because you already have a console session in progress.
—————————
OK Help
—————————

I was connecting from a WAN. The Windows 7 machine is connected on two different subnets through port forwarding.

The above message was only on one on one WAN connection. When I tried the other, I could connect immediately. After that, I could connect through the other WAN connection as well.

I’m not sure what caused it, but I suspect the port forwarding, though that has worked in the past and now works without any change.

Still a couple of links, just in case it happens again:

Posted in Power User | Leave a Comment »

xs4all ONLY issues with ADSL sync and Fritz!Box 7340

Posted by jpluimers on 2011/08/26

Recently, I had big problems with my Fritz!Box 7340 losing ADSL sync on my xs4all ONLY connection.

The odd thing is: the problems started after it worked well for quite a while.

I had multiple dozens of these reconnects per day, sometimes as few as once every fre hours, but often as many as half a dozen per hour:

11.07.11 05:14:08 IPv6 Internet connection established successfully. Prefix: 12ab:34cd:56ef::/48
11.07.11 05:14:08 IPv6 Internet connection established successfully. IP address: 12ab:34cd:56ef::fe01dc23:ba45:9867
11.07.11 05:14:07 Internet connection established successfully. IP address: 172.31.120.210, DNS server: 194.109.6.66 and
194.109.9.99, Gateway: 194.109.5.205
11.07.11 05:14:01 DSL is available (DSL synchronization exists with 10007/1029 kbit/s).
11.07.11 05:13:47 DSL synchronization starting (training).
11.07.11 05:13:32 Internet connection cleared.
11.07.11 05:13:32 IPv6 Internet connection was cleared; prefix no longer valid.
11.07.11 05:13:32 Internet connection cleared.
11.07.11 05:13:31 DSL not responding (no DSL synchronization).

The xs4all helpdesk didn’t respond on my emails, and Google searches didn’t reveal much.

This is what I tried:

  1. I tried getting the FRITZ.Box_Fon_WLAN_7340.en-de-es-it-fr.99.05.04-19769.image firmware, mentioned in this thread, but could not download it any more.
  2. I also tried to set the DSL settings to “maximum stability” without any improvement, resetting to factory settings, etc.
  3. The router is already very close to the ISRA point (where DSL enters the house), and I tried both with/without splitter with no improvement whatsoever.
  4. Read the steps in this sat4all thread, but found nothing unusual in my hardware and software config.

I didn’t expect any improvement as nothing on my side has changed, and before xs4all ONLY, I ran DSL for more than 10 years with different modems and no problems whatsoever.

Finally, I downgraded to Firmware-Version 99.04.88 from Firmware-Version 99.04.90.

When downgrading, keep this in mind:

  • Fritz! does not keep old firmware versions on-line; you must regularly get the Fritz!Box 7340 part of their ftp site and keep an archive yourself
  • It will reset your router to factory state and not remember any settings
  • It cannot restore your settings if you saved them with a higher firmware version, not even when you save them with a password as the web-interface seems to suggest

Luckily, one of the things that xs4all did well, is keep an archive of firmware versions for the Fritz!Box 7340, including a Firmware-Version 99.04.88.

Perform these steps when downgrading: Read the rest of this entry »

Posted in Fritz!Box, Network-and-equipment, Power User | 1 Comment »

A world without iWords?

Posted by jpluimers on 2011/08/25

With Steve Jobs just having resigned as Apple CEO, will the world soon be without iWords?

Just Pods, Pads, Macs, Books, etc?

I don’t think so.

Though often stylized as hues of grey, Steve Jobs brought a lot of colour to Apple. Not only by himself, but by collecting a circle of really great people around him. His excellent successor already has shown a good track record, and Apple has many talented people to fill the void he leaves.

Steve will be dearly missed, so I wish him all the best (knowing from direct experience how badly sickness can affect your health).

–jeroen

Posted in Opinions | Leave a Comment »

 
%d bloggers like this: