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

Archive for the ‘Software Development’ Category

.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 »

VS2012.2 ISOs for Visual Studio Updates: off-line installers the way they should be (via: The Visual Studio Blog)

Posted by jpluimers on 2013/06/07

I got a bit sick of the VS2012.2.exe on-line installer having to re-download each piece on every Visual Studio 2012 RTM machine to upgrade.

Here is the VS2012.2.iso for off-line installation.

Found it through Provide Visual Studio updates as an ISO image for offline installation – Customer Feedback for Microsoft.

–jeroen

Announcing availability of ISOs for Visual Studio Updates – The Visual Studio Blog – Site Home – MSDN Blogs.

.

Posted in .NET, .NET 4.5, Development, Software Development, Visual Studio 11, Visual Studio and tools | Leave a Comment »

Are Delphi programmers more happy than other programmers? (via: Sentiment Analysis of Github Commits)

Posted by jpluimers on 2013/06/07

Interesting graph here: Evented Github Adventure – Sentiment Analysis of Github Commits.

It seems that Delphi programmers have a much better happy/sad word rate than other programmers.

–jeroen

 

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

Ogg encoder alternatie AoTuv seems to be great

Posted by jpluimers on 2013/06/07

A while ago (actually, almost two years ago <g>), Chinese Sausage wrote the below answer; it’s on my research list to see if I can stream out my audio library:

Re: Best format to encode into?

« Reply #2 on: 2011-08-14, 14:50:18 »

When space drive IS a concern, then ogg (aoTuV version) is the best format quality-wise (to these ears), as it is more true to the original music source, and it leaves less noticeable noise artifacts than the other encoders.  However, aac is almost just as good and also more compatible with mobile phones, iPod’s and other external players, so it is probably a better choice if you want to share your music files with anybody who is not computer savvy. The main thing I do not like about aac (at least HE-AAC) is that it does not support gapless playback, which is particularly annoying if you listen to live albums, or other music which has continuous playback.

At 64kbps though, there is none better than ogg aoTuV. Here is a link to the latest version, in case you want it.
Just replace the ogg.dll and vorbis.dll files to the existing ones in your encoding program (I use MediaMonkey to encode files to ogg).

Hope this helps!

--jeroen

via: Best format to encode into?.

Posted in BASS.NET, Development, Media Streaming, Power User, Software Development, Un4seen BASS Audio Library | Tagged: | Leave a Comment »

Great video on Software Craftsmanship

Posted by jpluimers on 2013/06/06

About 3 years old (it was at Devoxx 2009), but still a great talk at Parleys.com: Craftsmanship and Policy Presentation by Robert C. Martin.

It was announced as:

Is management ready for the tsunami of professionalism that’s on the horizon?
Enjoy this inspiring and enthusiastic Devoxx keynote by Uncle Bob.

–jeroen

Posted in Development, Software Development | Leave a Comment »

WinAmp AACPlus v2 Encoder: how to encode mono

Posted by jpluimers on 2013/06/05

AACPlus allows for a many combinations of encoding flags.

Finding out whick allows to encode a mono audio stream is a bit time consuming.

Luckily, I found this post:

If you want encode in mono make this:

enc_aacPlus test.wav test.aac --br (max 256000) --mono

or for streaming:

enc_aacplus - - --br (max 256000) --silent --rawpcm 44100 2 16 --mono

Note that the various versions of enc_aacPlus.exe requires the enc_aacPlus.dll from WinAmp.

--jeroen

via: AACPlus v2 Encoder Problem..

Posted in BASS.NET, Batch-Files, Development, Media Streaming, Power User, Scripting, Software Development, Un4seen BASS Audio Library | Leave a Comment »

Things That Turbo Pascal is Smaller Than

Posted by jpluimers on 2013/06/04

Things That Turbo Pascal is Smaller Than.

Well basically anything.

About 30k was the size our complete IDE in the 80s century.

(Thanks @pstalenh and @rand)

–jeroen

Posted in Delphi, Development, Pascal, Software Development, Turbo Pascal | 4 Comments »

Run batch file from Delphi IDE (via: Stack Overflow)

Posted by jpluimers on 2013/05/29

In pre-Galileo versions of Delphi it was easy to run a .BAT or .CMD file as a main project file: just press F9.

Thanks to iManBiglary for posting how to do this in modern Delphi versions. Paraphrased:

Add the file path to cmd.exe (easieist is to add $(ComSpec) which expands the %ComSpec% environment variable) in the tools menu, with /c$EDNAME as the parameter.
In addition, you can tell the IDE to save your file before running the external tool with the $SAVE macro

One of the things you can do with this is add a project containing a batch file that starts to assemble your build results to create a deployment set.

–jeroen

via: Run batch file from Delphi IDE – Stack Overflow.

Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Leave a Comment »

Some links on Registry and LINQ

Posted by jpluimers on 2013/05/28

A few notes for my research list:

One important thing that most of the code examples miss is to close the registry keys when they are done with them.

 

–jeroen

Posted in .NET, .NET 4.0, .NET 4.5, C#, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

IBM Pascal Compiler Aug81 pdf (via: Bitsavers’ Index of /pdf/ibm/pc/dos)

Posted by jpluimers on 2013/05/26

Wow, I didn’t know that IBM had their own DOS based Pascal compiler for the PC in 1981, but they did, and BitSavers just uploaded their manual
IBM_Pascal_Compiler_Aug81.pdf

Edit:
document moved from http://bitsavers.trailing-edge.com/pdf/ibm/pc/dos/IBM_Pascal_Compiler_Aug81.pdf
to: http://bitsavers.trailing-edge.com/pdf/ibm/pc/languages/IBM_Pascal_Compiler_Aug81.pdf

It is part of their “Personal Computer Computer Language Series”

From the era of DOS Pascal compilers before Turbo Pascal.

–jeroen

via Index of /pdf/ibm/pc/dos.

Posted in BitSavers.org, Delphi, Development, History, IBM Pascal, Pascal, Software Development | 7 Comments »