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 June, 2013

AAC – DivX encoder information

Posted by jpluimers on 2013/06/14

There are a lot of encoders around that encode audio into AAC and often support many of the possible AAC feature extensions.

One of those encoders is the DivX AAC encoder called DivXAACEnc.

It’s not only interesting because it is free, but also because they provide some very readable information on what kind of parameters it accepts, and what they do on the DivX AAC Encoder (Beta) | DivX Labs page.

So they talk about:

  • input types (WAV, RAW PCM, bits per sample)
  • rate control (CBR/VBR) and magnitude
  • modes (LC, HE1, HE2) and what they do
  • ADTS protection
  • Low-pass filter
  • Audio processing tips

Highly recommended information!

One big drawback: it is file based only, so it does not support streams.

Note: this is Windows only. Sorry.

–jeroen

via:

Posted in Media Streaming, Power User | Leave a Comment »

Thinstuff Remote Application – NLDelphi

Posted by jpluimers on 2013/06/13

Interesting thread: Thinstuff Remote Application – NLDelphi.

Allows remote application access from Windows 7 / Vista / XP and Windows SBS, and it looks like you don’t need special CAL for it.

–jeroen

Posted in Power User, Windows, Windows 7, Windows Vista, Windows XP | Leave a Comment »

Reminder to self: 3 months ago “all mine!: openSUSE 12.3 is out!”

Posted by jpluimers on 2013/06/13

Time to try out the 3 months old release and see how much got fixed in the mean time.

–jeroen

via: all mine!: openSUSE 12.3 is out!.

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

.NET/C# – CreateTemporaryRandomDirectory (via: Stack Overflow)

Posted by jpluimers on 2013/06/13

A while ago I needed unique temporary directories. This appears not to be standard functionality in the .NET System.IO.Path or System.IO.Directory class.

Josh Kelley asked a question about it before, and I adapted the example by Scott-Dorman based on GetTempPath and GetRandomFileName  and comments by Chris into a more robust CreateTemporaryRandomDirectory one that works in .NET 2.0 and higher:

using System.IO;

namespace BeSharp.IO
{
    public class DirectoryHelper
    {
        public static string GetTemporaryDirectory()
        {
            do
            {
                try
                {
                    string tempPath = Path.GetTempPath();
                    string randomFileName = Path.GetRandomFileName();
                    string tempDirectory = Path.Combine(tempPath, randomFileName);
                    Directory.CreateDirectory(tempDirectory);
                    return tempDirectory;
                }
                catch (IOException /* ex */)
                {
                    // continue
                }
            } while (true);
        }
    }
}

You can call it like this: Read the rest of this entry »

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | 2 Comments »

Delphi XE4 Update 1 is out (via: Installing the Platform Assistant on a Mac – RAD Studio)

Posted by jpluimers on 2013/06/12

Over the last couple of days, I was asking myself

“wow, the docwiki has been updated for the Delphi XE4 update 1 version of the Mac edition of the Platform Assistant, how long until the official update is out?”

These URLs from Installing the Platform Assistant on a Mac – RAD Studio didn’t work for a couple of days:

Now they do!

The reason is that yesterday Embarcadero released 29446 Update 1 for Delphi, C++Builder and RAD Studio XE4 that fixes lots of stuff: Fix list for Update 1 for RAD Studio XE4, Delphi XE4 and C++Builder XE4.

Note it is not referring to Readme – Help Update 1 for Delphi and C++Builder XE4 – RAD Studio which got released last week as 29436 Help Update 1 for Delphi, C++Builder and RAD Studio XE4. It is the real Delphi XE4 Update 1.

The cool thing: finally it is a binary patch. Not fast about as fast as a full uninstall/reinstall), but at 336 megabytes a much smaller download than the 3.7 gigabytes of 29451 Delphi XE4 and C++Builder XE4 ISO (including Update 1).

Patched update versus full uninstall/install is a trade off:

  • Patch can take a couple of hours, and is CPU bound (too bad most of it is bound to a single CPU core)
  • Uninstall/reinstall is disk-speed and disk-size bound (make sure you have 15+ gigabytes free; an SSD improves this process a lot)

altd, ftpd, keeping off-line downloads Read the rest of this entry »

Posted in Delphi, Delphi XE4, Development, Software Development | Tagged: , | 2 Comments »

Delphi XE4: installer batch file for “experimental GExperts + code formatter for Delphi XE4”

Posted by jpluimers on 2013/06/12

Slightly more than a month ago, Thomas Müller release the experimental GExperts + code formatter for Delphi XE4.

Since there is no official GExperts for Delphi XE4 build yet, his installation instructions include this:

Use the ExpertManager tool to register GExperts to Delphi XE4.

The thing is: ExpertManager is part of GExperts, so this introduces a “chichen-and-egg” situation.

So I wrote a small batch file and a bit of documentation to install it.

Just in case you cannot download that SVN changeset easily, here are the documentation and batch-file:

Documentation

Steps to install:
0- Quit Delphi XE4
1- Download the GExperts XE4 experimental from http://blog.dummzeuch.de/2013/04/28/experimental-gexperts-code-formatter-for-delphi-xe4/
2- Recursively unpack that download
3- Copy the batch file Install-GExperts-XE4-experimental–run-as-administrator-from-ExpertManager.exe-directory.bat into that directory
4- From that directory, run the copied Install-GExperts-XE4-experimental–run-as-administrator-from-ExpertManager.exe-directory.bat
5- Run Delphi XE4
6- Check if GExperts is installed

Batch file

:: check if user is administrator

  "C:\Windows\system32\cacls.exe" "C:\Windows\system32\config\system" 1>nul 2>&1  && (goto :isAdmin)
:isNoAdmin
  echo you need to be Administrator, and (when under Vista or higher) run this using using UAC
  goto :exit

:isAdmin

:: Gets the right link for x86 (32-bit) program files
IF /I %PROCESSOR_ARCHITECTURE% == amd64 goto :x64
IF /I %PROCESSOR_ARCHITEW6432% == amd64 goto :x64
goto :x86
:x64
   :: OS is 64bit
   set ProgramFilesX86=%ProgramFiles(x86)%
  goto :continue
:x86
   :: OS is 32bit
  set ProgramFilesX86=%ProgramFiles%
  goto :continue

:continue

:: create the right directory and copy the files

  setlocal

  set TargetDirectory=%ProgramFilesX86%\GExperts for RAD Studio XE4

  mkdir "%TargetDirectory%"
::  set FilesToCopy=DbugIntf.pas ExpertManager.exe GExperts.chm GExpertsDebugWindow.exe GExpertsGrep.exe regularexpert\GExpertsRSXE4.dll Readme.txt preview.pas
  set FilesToCopy=ExpertManager.exe GExperts.chm regularexpert\GExpertsRSXE4.dll preview.pas

  for %%f in (%FilesToCopy%) do copy /y %%f "%TargetDirectory%\"
  set RegFile="%TargetDirectory%\ExpertsXE4.reg"
::  explorer /select,"%TargetDirectory%\GExpertsRSXE4.dll"

:: expand backslash into double backslash for .REG file
  set ExpertTarget="%TargetDirectory%\GExpertsRSXE4.dll"
  set ExpertTarget=%ExpertTarget:\=\\%

::Windows Registry Editor Version 5.00
::
::[HKEY_CURRENT_USER\Software\Embarcadero\BDS\11.0\Experts]
::"GExperts"="C:\\Program Files (x86)\\GExperts for RAD Studio XE4\\GExpertsRSXE4.dll"
::
  echo Windows Registry Editor Version 5.00 >%RegFile%
  echo. >>%RegFile%
  echo [HKEY_CURRENT_USER\Software\Embarcadero\BDS\11.0\Experts] >>%RegFile%
  echo "GExperts"=%ExpertTarget% >>%RegFile%
  echo. >>%RegFile%
::  explorer /select,%RegFile%
  regedit /S %RegFile%

  endlocal

  goto :exit

:exit

–jeroen

via: experimental GExperts + code formatter for Delphi XE4 « twm’s blog.

Posted in Batch-Files, Delphi, Delphi XE4, Development, Scripting, Software Development | 2 Comments »

Crap: the outsourcing party of the client wrote C-code like this in 2005, and nobody scrutinized it

Posted by jpluimers on 2013/06/12

I was involved in a big project migrating a complex stack from Windows XP to Windows 7 x86, and got scared this !@#$ out of me.

The stack communicated to WebSphere MQ on AS/400 from Windows, and on the Windows side of things consisted of a UI developed in in Cool:Gen, a C interface to a Delphi DLL, which takes care of the communication to WebSphere MQ.

Digression:

This all was histerically grown. In the beginning (early to mid 90s last century) it was a big Borland Pascal/Turbo Pascal application – running on DOS, Windows 3.1x, Windows 95 and OS/2 2.x/3.0 – that talked over a propriatary layer over SNA to AS/400.
The vendor of that layer didn’t respond to a request for Windows NT 4.x compatibility, and meanwhile some client applications were about to be developed in Delphi.

So in 1997/1998 – together with a great AS/400 software developer – I wrote a SNA based APPC/CPI-C communication layer in Delphi 3 that could be accessed from both Turbo Pascal (using a file based interface) and Delphi (using an object interface).
The DOS interface was an executable around the Delphi interface, which was a set of classes.

Delphi part

The Delphi part of the DOS interface was centered around FindFirstChangeNotification/CreateProcess combined with MsgWaitForMultipleObjects/WaitForSingleObject to make the waiting as efficient as possible.

DOS part

DOS part

The DOS part of the Delphi interface was centered around this piece to make waiting efficient:

asm
  int $28
  mov ax, $1000
  int $15 { DESQview/TopView give up time slice }
  mov ax, $1680
  int $2F
end;

Thanks to the RBIL: Ralf Brown’s Interrupt List (there are now multiple HTML versions of it), it makes use of these tricks so DOS applications can efficiently wait : Read the rest of this entry »

Posted in C, CVS, Delphi, Delphi 2006, Delphi 3, Delphi 5, Delphi XE2, Development, Dimensions CM by Serena, MKS Integrity, Software Development, Source Code Management | 3 Comments »

ASUS RT N66U did not update DDNS with changed IP addres

Posted by jpluimers on 2013/06/11

Today my router had an IP-address change, but didn’t update the DynDNS.org information in my My Host Services | My Dyn Account. Which meant I could not “phone home”, as I didn’t know the new IP-address**.

Lesson re-learned:

During initial router configuration, watch the router logs, as you might have accidentally updated the DynDNS.org by hand, not by your router

Had this in the ASUS Wireless Router RT-N66U – General Log:

Jun 11 08:01:53 notify_rc : restart_ddns
Jun 11 08:01:53 ddns: clear ddns cache file for server setting change
Jun 11 08:01:53 ddns update: connected to members.dyndns.org (204.13.248.111) on port 80.
Jun 11 08:01:53 ddns update: server output: HTTP/1.1 200 OK^M Date: Tue, 11 Jun 2013 06:01:53 GMT^M Server: Apache^M X-UpdateCode: X^M Content-Length: 7^M Connection: close^M ^M notfqdn
Jun 11 08:01:53 ddns update: malformed hostname: myhostname

The problem: hostname should not only be the name of the host, but the FQDN of the host. Read the rest of this entry »

Posted in ASUS RT-N66U, Network-and-equipment, openSuSE, Power User, SuSE Linux | Tagged: , , , , | 2 Comments »

.NET/C#: from Unicode to ASCII (yes, this is one-way): converting Diacritics to “regular” ASCII characters.

Posted by jpluimers on 2013/06/11

A while ago, I needed to export pure ASCII text from a .NET app.

An important step there is to convert the diacritics to “normal” ASCII characters. That turned out to be enough for this case.

This is the code I used which is based on Extension Methods and this trick from Blair Conrad:

The approach uses String.Normalize to split the input string into constituent glyphs (basically separating the “base” characters from the diacritics) and then scans the result and retains only the base characters. It’s just a little complicated, but really you’re looking at a complicated problem.

Example code:

using System;
using System.Text;
using System.Globalization;

namespace StringToAsciiConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string unicode = "áìôüç";
            string ascii = unicode.ToAscii();
            Console.WriteLine("Unicode\t{0}", unicode);
            Console.WriteLine("ASCII\t{0}", ascii);
        }
    }

    public static class StringExtensions
    {
        public static string ToAscii(this string value)
        {
            return RemoveDiacritics(value);
        }

        // http://stackoverflow.com/questions/249087/how-do-i-remove-diacritics-accents-from-a-string-in-net
        private static string RemoveDiacritics(this string value)
        {
            string valueFormD = value.Normalize(NormalizationForm.FormD);
            StringBuilder stringBuilder = new StringBuilder();

            foreach (System.Char item in valueFormD)
            {
                UnicodeCategory unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(item);
                if (unicodeCategory != UnicodeCategory.NonSpacingMark)
                {
                    stringBuilder.Append(item);
                }
            }

            return (stringBuilder.ToString().Normalize(NormalizationForm.FormC));
        }
    }
}

–jeroen

Posted in .NET, .NET 3.5, .NET 4.0, .NET 4.5, ASCII, C#, C# 3.0, C# 4.0, C# 5.0, Development, Encoding, Software Development, Unicode | Leave a Comment »

More ESXi5 installation steps

Posted by jpluimers on 2013/06/10

(note: part of this post is unfinished, but I wanted to make sure all the links are publicly accessible, so I posted earlier and incomplete)

I already did a few ESXi5 postings (they apply to 5.1 as well) of which the most important are:

Time to finish up some additional installation steps (with a big thanks to Matthijs ter Woord):

Read the rest of this entry »

Posted in BIOS, Boot, ESXi5, ESXi5.1, Hardware, HP XW6600, Keyboards and Keyboard Shortcuts, Power User, PowerCLI, Virtualization, VMware, VMware ESXi, Wake-on-LAN (WoL), Windows, Windows 7, Windows 8, Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP | Leave a Comment »