The Wiert Corner – irregular stream of Wiert stuff

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

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    MPS_9791

    MPS_9795

    MPS_9793

    More Photos
  • Pages

  • All categories

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

    Join 430 other followers

Archive for January, 2012

The calculators that got me into programming (via: calculators : Algorithms for the masses – julian m bucknall)

Posted by jpluimers on 2012/01/31

I hadn’t visited Julian M Bucknall’s blog for a while, so I just found out he is a calculator collector, and posted a few calculator posts.

He’s much better at writing and narrating than I am, but lets give it a try to see how his posts reminded me of my high school days, what calculators I used back then and how it got me into computing.

Back since I learned to count, math related subjects always worked better for me than for instance language related ones.

It might have to do with my dad. He was a financial economist, so in his job he was juggling with numbers. At home there were ledgers for bookkeeping, slide rules (I inherited his old slide rule, which I still have somewhere in our basement), and over time various types of calculators. He used calculators in the 70s, programmable calculators and a HP 12C programmable financial calculator in the early 80s and small handheld computers in the mid 80s. I remember teaching him both Lotus 1-2-3 and Microsoft Excel later on (at work they didn’t have Visicalc, as they had an Exidy Sorcerer at work that didn’t do spreadsheets).

I have a slightly younger brother with an IQ of almost 50, so my dad bought him a Little Professor in the early 80s to see if his counting skills improved. It didn’t work; he still cannot calculate beyond 20 most of the times and rarely beyond 100. But it was a nice experiment. And he has skills other people don’t have.

Back then, my father worked for the Dutch Ministry of Economic Affairs in working on the subject of consumer loans (he was a strong proponent of legislation protecting individuals from getting bad loans, and very much in favour of publishing netto costs for consumer credit; in fact he was among the first to notice that Dirk Scheringa was trying to lure people in way too much debt against way too high interest rates).

In his department, they standardized on Texas Instruments financial calculators. He had a Texas Instruments TI-59. It was programmable, and took him forever to program, but he was very handy at it. The TI-59 had off-line storage through magnetic cards (which was quite unique, the HP 65 - which was also programmable – had it first, but was twice as expensive). One of the cool programmability features was that it could record keystrokes like they were macros. That alone could speed up work a lot. Finally you could fit TI-59 ROM modules, including one with extra math functions. Thad one made his life a lot easier.

I found the TI-59 interesting, but my English wasn’t good enough yet to be able to learn programming with it. Back then in The Netherlands, you didn’t learn English at primary school, so the first time I got taught English was at age 12, and the first time I got German and French was at age 14.

Ever since I was a little kid, we would go to Germany on holidays (it’s a long but and nice story, maybe in a later blog), with almost yearly camping near Almensee, Bad Dürkheim. The result was that – unlike my school mates – I spoke German when going to high school, and learned that super markets – like hit.de – in Germany would sell way outside the range of grocery shops did in The Netherlands: magazines, music on LP/EP/Single/Casette, household tools, etc.

One of the things back then was that technical literature was either German or English. And tech stuff was way cheaper and abundant in Germany than in The Netherlands.

So when going to high school, I spoke German, and when entering the second class, I needed an electronic calculator. When I saw what they offered at the school and Dutch shops and the price they asked for calculators, I quickly decided I wanted to buy my own calculator during the next summary holiday in Germany.
Most kids getting their calculator from school either had calculators with VFD displays (which ate batteries like crazy) like the the Casio FX-20 or “simple” scientific LCD calculators like the Texas Instruments TI-30LCD (with an ugly hard plastic enclosure and nasty click type buttons). Both had basic scientific calculations, like Sin, Cos, Tan, Log, Ln (and their inverse), square, square root, one over, y powered by x, one memory and a few other bits. But only 8 displayable digits (which sucks when you loose 2 because of exponential notation). Lots of functionality was lacking of which I didn’t know the details back then, but I saw people in senior years struggling with them like mad working around the limitations.

I wanted something better, which was tough to get, as the best you could buy in The Netherlands were the Casio FX-82 and Casio FX-100, which were at least twice as expensive as the FX-20 and just as cluncky. So only the kids with rich parents had them. On top of the FX-20 they had some compelling features like fractions (only the FX-100), representations (scientific, fixed decimal, engineering, normal), trigonometric functions in degrees and radians, 6 levels of parentheses, statistics functions, polar to rectangular conversion and back, and a bunch more smaller things. They had either 8+2 (FX-82) or 10+2 (FX-100) digits which was neat: finally you could see the precision in which they were operating. In fact they internally operated at 12 digits which you could see by multiplying with 10, then subtracting the integer part.

I recently found out that the successors of these machines (FX-260 at CasioEducation.com) are still being sold, including a manual describing the FX-82Solar, FX-85B, FX-260Solar and FX-280 which basically says there is almost no changed functionality since the FX-82. How’s that for 30 years of progress :)

The next summer holiday, I did a price comparison. Casio calculators in Germany were at least 30 percent cheaper than in The Netherlands, and there were even more choices than the summer before especially in department stores like Karstadt (now Arcandor and in bankruptcy). I was like a kid in a candy store, just the candies were a bit more expensive.

So I used some of the money I earned the summer before (peeling flower bulbs) in Germany during our holiday to buy a Casio FX 550 (on the left), which had 10+2 digits, whereas the Casio FX 350 (on the right) had 8+2. They had almost identical functionality to the FX-82 and FX-100 with one tiny addition: hyperbolic trigonometric functions. Buth they didn’t use AAA batteries, so they were not as clunky. And both had fractions (which the FX-82 hadn’t).

In the mean time, they department where my dad worked had switched from his Texas Instruments TI-59 to a Sharp PC-1210, which was the predecessor of the Sharp PC-1211 and shared the same peripherals (casette interface – which my dad had – and printer – which my dad didn’t have). The  TRS-80 PC1 was in fact a Sharp PC-1211 with a different label. Radio Shack was very popular in the UK and US, whereas Sharp was very popular in the rest of the world. Note that the TRS-80 pocket computer is very different from the TRS-80 Model I micro computer system from 1977.

I was 13 now, and my English was slightly better than non existent, so I could help my dad program his Sharp PC 1210 pocket computer. It was fun, as I learned the BASIC programming language, and how to cram things like a small trinangle calculation program (input 3 properties of a triangle, then calculate the other 3) into 400 bytes of programmable memory.

Since it was my first experience to programming, it was also my first encounter to bugs, both of my own and of the PC-1210 itself. For instance, it could overflow its programmable memory, thereby changing some of the variables (that were somehow overlapping in storage), allowing you to display symbols that could not be entered by keyboard, nor converted by functions.

In the mean time, we were getting more advanced math (with a bit of statistics), and started with economics (both business economics and general economics), chemistry (which I later tried to study at university) and physics. That with my exposure to binary and hexadecimal got me to buy another calculator: a Casio FX-115. Next to decimal, it did binary, octal and hexadecimal including conversions between them and the operators AND, OR, XOR, NOT, XNOR and negation. The big drawback was that it was solar only, and would not work in low light conditions.

At high school we had only a few really good match teachers. One of them taught me that 22/7 and 355/113 are continuous fractions estimating pi, and how to approach problems in a structural approach (analyze, deduce, etc). Another one introduced me into the computer lab (originally meant for the 2 senior years, but they let me in anyway).

There they had Apple ][ Europlus machines: a whopping 10 of them for a school with 1000 students was magnificent in the early 80s. 2 of them had a Z80 They ran Applesoft BASIC and Integer BASIC from ROM so my BASIC knowledge from the Sharp PC-1210 came in handy. Also two of the machines had a Z-80 Softcard in it that not only allowed it to display 80 columns, but also supported 16k of bank switched memory, and a Zilog Z80 processor that ran CP/M. There was a Turbo Pascal 1.0 for it that was way better than the optional Apple Pascal (which was based on UCSD Pascal and much slower than Turbo Pascal). That really got me into programming, on which I will write later (probably much later <g>) and gave me a big Deja Vu when seeing virtual machine based programming environments like the Java VM and .NET CLR that are essentially based on the p-code systems on which UCSD Pascal was based.

After lending the Casio 115M to a school mate, it disappeared (getting the money back through insurance was a difficult thing because you could not get them in The Netherlands, and the hoopla of having them accept a Germany cash receipt in stead of a full written receipt was a pain) led me to my final calculator which I got during the autumn break: a Casio 415M dual power calculator: both solar and a battery. It was almost identical to the Casio 415, I think the only difference was the dual power. As you can see on a more elaborate Casio 415M page, it had extra keys in the cover that added many functions: all kinds of conversions (temperature, volume, weight, pressure, etc), physical constants (gravity, lightspeed, Avogadros number, etc). I only recently disposed of it, as the flat cable between the cover and the machine broke. How’s that for a 25 year old piece of equipment!

Oh while on the Casio topic: high school was also the place where I met a lot of international people that followed International Baccalaureate, and where I read The Hitchhiker’s Guide to the Galaxy just two years after I bought a neat Casio Universal Calendar digital watch. My first and last :)

–jeroen

via: calculators : Algorithms for the masses – julian m bucknall.

calculator research sources:

Posted in About, Development, Personal, Software Development | Leave a Comment »

An expedition camera backpack, the LowePro DZ100 « Stephen’s Stuff

Posted by jpluimers on 2012/01/30

Not long before our Antarctic trip about 10 weeks ago, I bought myself a waterproof expedition grade backpack: the LowePro DryZone 100 through the Kamera Express Super Store in Rotterdam.

It is a great bag, and the DryZone works really well, provided you lubricated the TIZIP watertight zipper before you use the bag a couple of times, and keep doing that regularly.

The little piece of paper that guides you through it is not that well written, but luckily there are a few on-line guides how to do this properly.

Make sure you always close the TIZIP zipper to the end, that is the only way it will be completely watertight.

There are many reviews of this bag (for instance here and here), so I will keep it short:

  • It is watertight
  • Carrying it by hand and on your back for a full day is a breeze, even when it is completely full
  • Grabbing your stuff is a bit time consuming: opening the TIZIP takes a while
  • It fits an awful lot of equipment
  • It won’t tip over when you put on the ground in the upright position

My recommendation is to buy the yellow/black color combination, not the grey/black color combination.
Yellow is easier to find when you drop it in the water.
Though on our antarctic trip, anything other than white was easy to find :)

This is what Nikon stuff I took to the Antarctic in this bag:

(Thanks Ken Rockwell for all the nice reviews of all these bodies and lenses.
Yes I know there are better lenses and better bodies, and an easier Easytag bluetooth GPS module that pairs with receivers on multiple cameras, but this is what I wanted to afford when I bought them piece by piece).

At the time I bought the DZ100 backpack, you could not get the DZ200 in The Netherlands. The DZ200 is about 30% bigger (volume wise).

–jeroen

via: An expedition camera backpack, the LowePro DZ100 « Stephen’s Stuff.

Posted in About, LifeHacker, Personal, Power User | Leave a Comment »

automatic logon in Windows 2003

Posted by jpluimers on 2012/01/27

At a client that still runs Windows Server 2003 (despite the fact that it is in the extended support phase now), I needed to enable automatic logon (one of the tools they run sometimes fails when nobody is logged on).

This was a bit more tricky than just reading How to turn on automatic logon in Windows and following these steps:

To use Registry Editor (Regedt32.exe) to turn on automatic lsogon, follow these steps:

  1. Click Start, and then click Run.
  2. In the Open box, type Regedt32.exe, and then press ENTER.
  3. Locate the following subkey in the registry:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  4. Double-click the DefaultUserName entry, type your user name, and then click OK.
  5. Double-click the DefaultPassword entry, type your password, and then click OK.NOTE: If the DefaultPasswordvalue does not exist, it must be added. To add the value, follow these steps:
    1. On the Edit menu, click New, and then point to String Value.
    2. Type DefaultPassword, and then press ENTER.
    3. Double-click DefaultPassword.
    4. In the Edit String dialog, type your password and then click OK.

    NOTE: If no DefaultPassword string is specified, Windows automatically changes the value of the AutoAdminLogon key from 1 (true) to 0 (false), disabling the AutoAdminLogon feature.

  6. On the Edit menu, click New, and then point to String Value.
  7. Type AutoAdminLogon, and then press ENTER.
  8. Double-click AutoAdminLogon.
  9. In the Edit String dialog box, type 1 and then click OK.
  10. Quit Registry Editor.
  11. Click Start, click Shutdown, and then type a reason in the Comment text box.
  12. Click OK to turn off your computer.
  13. Restart your computer. You can now log on automatically.

Since this depends on some registry settings, you need to make sure they are actually set.
And logging on as someone else will reset the DefaultUserName registry setting.

The article points to another article on “AutoAdminLogon looses DefaultUserName” to solve this using REGINI (and optionally REGDMP which can provide sample output for REGINI), but there is a much easier solution using RegEdit which – as Rob van der Woude points out – can be used unattended as well (besides: REGDMP cannot be downloaded any more, and REGINI requires an additional download).

This is how to do force the DefaultUserName to be reset after logon using RegEdit:

  1. Open an explorer Window in “%ALLUSERSPROFILE%\Start Menu\Programs\Startup”
  2. Create a batch file “run-RegEdit-DefaultUserName.bat” there with this content:
    regedit /s Administrator-DefaultUserName.bat
  3. Create a text file “Administrator-DefaultUserName.reg” in the same directory with content like this:
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
    "DefaultUserName"="Administrator"

Replace “Administrator” with the username you are acutally using.

–jeroen

Via: How to turn on automatic logon in Windows.

Posted in Power User | 2 Comments »

.NET/C#: Using IDisposable to restore temporary settrings example: TemporaryCursor class

Posted by jpluimers on 2012/01/26

This is WinForms code from a long time ago, but the concept of using an IDisposable interface to do resource cleanup and restore a temporary setting is very valid.

You use the code below like this:

        private void myMethod()
        {
            // set busy cursor
            using (IDisposable waitCursor = new TemporaryCursor(this, System.Windows.Forms.Cursors.WaitCursor))
            {
                // logic that takes a long while
            }
        }

The code below implements the TemporaryCursor class; you can assign any System.Windows.Forms.Cursors item you want.

It restores the cursor upon these three “events”:

Most often the IDispose pattern is being used to make sure that resources get cleaned up. If you think of a wait cursor as a temporary resource, this example becomes much easier to remember.

Of course this is not limited to the System.Windows.Forms realm, you can just as well use this for non-visual temporaries, and other kinds of UIs like ASP.NET, WPF or SilverLight.

using System.Windows.Forms;

namespace bo.Windows.Forms
{
    public class TemporaryCursor : IDisposable
    {
        private Control targetControl;
        private Cursor savedCursor;
        private Cursor temporaryCursor;
        private bool disposed = false;

        public TemporaryCursor(Control targetControl, Cursor temporaryCursor)
        {
            if (null == targetControl)
                throw new ArgumentNullException("targetControl");
            if (null == temporaryCursor)
                throw new ArgumentNullException("temporaryCursor");
            this.targetControl = targetControl;
            this.temporaryCursor = temporaryCursor;
            savedCursor = targetControl.Cursor;
            targetControl.Cursor = temporaryCursor;
            targetControl.HandleDestroyed += new EventHandler(targetControl_HandleDestroyed);
        }

        void targetControl_HandleDestroyed(object sender, EventArgs e)
        {
            if (null != targetControl)
                if (!targetControl.RecreatingHandle)
                    targetControl = null;
        }

        // public so you can call it on the class instance as well as through IDisposable
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (null != targetControl)
                {
                    targetControl.HandleDestroyed -= new EventHandler(targetControl_HandleDestroyed);
                    if (temporaryCursor == targetControl.Cursor)
                        targetControl.Cursor = savedCursor;
                    targetControl = null;
                }
                disposed = true;
            }
        }

        // Finalizer
        ~TemporaryCursor()
        {
            Dispose(false);
        }
    }
}

–jeroen

Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Development, Software Development, Visual Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools, WinForms | 2 Comments »

C# text file deduping based on trimmed lines (via: Stack Overflow)

Posted by jpluimers on 2012/01/25

A while ago, I needed to analyze a bunch of files based on the unique trimmed lines in them.

I based my code on the C# Tee filter and the StackOverflow example of C# deduping based on split.

It is a bit more extensive than strictly needed, as it has a few more commandline arguments that come in handy when processing files on the console:

DeDupe - Dedupes a file into unique lines (only the first occurance of a line is kept) standard output
Lines are terminated by CRLF sequences
C# implementation januari 5th, 2012 by Jeroen Wiert Pluimers (http://wiert.wordpress.com),

DeDupe [-i | --ignore] [-t | --trim] [-f | --flush] [-l | --literal] [-? | --h | --help | /?] [file0] [...]
   Example:
 DeDupe --trim file0.txt file1.txt
   Dedupes the appended content of file0.txt and file1.txt into standard output

-t | --trim                  Will trim the lines before considering duplicates
-f | --flush                 Flushes files every CRLF
                               (setting is per tee instance)
-i | --ignore                Ignore cancel Ctrl+C keypress: see UnixUtils tee
-l | --literal               Stop recognizing flags, force all following filenames literally
-? | --h  | /? | --help      Displays this message and immediately quits

Duplicate filenames are quietly ignored.
If no input filenames are specified, then standard input is used
Press Ctrl+Z (End of File character) then Enter to abort.

Here is the source code:

using System;
using System.IO;
using System.Collections.Generic;

namespace DeDupe
{
    class Program
    {
        static void help()
        {
            Console.Error.WriteLine("DeDupe - Dedupes a file into unique lines (only the first occurance of a line is kept) standard output");
            Console.Error.WriteLine("Lines are terminated by CRLF sequences");
            Console.Error.WriteLine("C# implementation januari 5th, 2012 by Jeroen Wiert Pluimers (http://wiert.wordpress.com),");
            Console.Error.WriteLine("");
            Console.Error.WriteLine("DeDupe [-i | --ignore] [-t | --trim] [-f | --flush] [-l | --literal] [-? | --h | --help | /?] [file0] [...]");
            Console.Error.WriteLine("   Example:");
            Console.Error.WriteLine(" DeDupe --trim file0.txt file1.txt");
            Console.Error.WriteLine("   Dedupes the appended content of file0.txt and file1.txt into standard output");
            Console.Error.WriteLine("");
            Console.Error.WriteLine("-t | --trim                  Will trim the lines before considering duplicates");
            Console.Error.WriteLine("-f | --flush                 Flushes files every CRLF");
            Console.Error.WriteLine("                               (setting is per tee instance)");
            Console.Error.WriteLine("-i | --ignore                Ignore cancel Ctrl+C keypress: see UnixUtils tee");
            Console.Error.WriteLine("-l | --literal               Stop recognizing flags, force all following filenames literally");
            Console.Error.WriteLine("-? | --h  | /? | --help      Displays this message and immediately quits");
            Console.Error.WriteLine("");
            Console.Error.WriteLine("Duplicate filenames are quietly ignored.");
            Console.Error.WriteLine("If no input filenames are specified, then standard input is used");
            Console.Error.WriteLine("Press Ctrl+Z (End of File character) then Enter to abort.");
        }

        static void OnCancelKeyPressed(Object sender, ConsoleCancelEventArgs args)
        {
            // Set the Cancel property to true to prevent the process from
            // terminating.
            args.Cancel = true;
        }

        static List<String> filenames = new List<String>();

        static void addFilename(string value)
        {
            if (-1 == filenames.IndexOf(value))
                filenames.Add(value);
        }

        static bool trimLines = false;
        static bool flushFiles = false;
        static bool stopInterpretingFlags = false;
        static bool ignoreCtrlC = false;

        static int Main(string[] args)
        {
            try
            {

                foreach (string arg in args)
                {
                    //Since we're already parsing.... might as well check for flags:
                    if (stopInterpretingFlags)  //Stop interpreting flags, assume is filename
                    {
                        addFilename(arg);
                    }
                    else if (arg.Equals("/?") || arg.Equals("-?") || arg.Equals("-h") || arg.Equals("--help"))
                    {
                        help();
                        return 1; //Quit immediately
                    }
                    else if (arg.Equals("-t") || arg.Equals("--trim"))
                    {
                        trimLines = true;
                    }
                    else if (arg.Equals("-f") || arg.Equals("--flush"))
                    {
                        flushFiles = true;
                    }
                    else if (arg.Equals("-i") || arg.Equals("--ignore"))
                    {
                        ignoreCtrlC = true;
                    }
                    else if (arg.Equals("-l") || arg.Equals("--literal"))
                    {
                        stopInterpretingFlags = true;
                    }
                    else
                    {	//If it isn't any of the above, it's a filename
                        addFilename(arg);
                    }
                    //Add more flags as necessary, just remember to SKIP adding them to the file processing stream!
                }

                if (ignoreCtrlC) //Implement the Ctrl+C fix selectively (mirror UnixUtils tee behavior)
                    Console.CancelKeyPress += OnCancelKeyPressed;

                HashSet<string> keys = new HashSet<string>();
                Int64 index = 0;

                using (StreamWriter writer = new StreamWriter(Console.OpenStandardOutput()))
                {
                    if (filenames.Count == 0)
                        using (StreamReader reader = new StreamReader(Console.OpenStandardInput()))
                        {
                            processInputFileReader(keys, writer, reader, ref index);
                        }
                    else
                        foreach (String filename in filenames)
                        {
                            using (StreamReader reader = new StreamReader(filename))
                            {
                                processInputFileReader(keys, writer, reader, ref index);
                            }
                        }
                    writer.Flush();
                }

            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(String.Concat("DeDupe: ", ex.Message));  // Send error messages to stderr
            }

            return 0;
        }

        private static void processInputFileReader(HashSet<string> keys, StreamWriter writer, StreamReader reader, ref Int64 index)
        {
            string line = readLine(reader);
            while (!string.IsNullOrEmpty(line))
            {
                string candidate = line;
                if (keys.Add(candidate))
                {
                    writer.WriteLine(line);
                    index += line.Length + Environment.NewLine.Length;
                    if (flushFiles)
                        writer.Flush();
                }

                line = readLine(reader);
            }
        }

        private static string readLine(StreamReader reader)
        {
            string line = reader.ReadLine();
            if (null != line)
                if (trimLines)
                    line = line.Trim();
            return line;
        }
    }
}

–jeroen

via: C# text file deduping based on split – Stack Overflow.

Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Development, Software Development | Leave a Comment »

Upgrading a Windows XP machine with Visual Studio 2005: KB2251481 Security Update for Microsoft Visual Studio 2005 Service – Microsoft Answers

Posted by jpluimers on 2012/01/24

Every once in a while you need to maintain really old stuff, and start update an old VM.

In case of Visual Studio 2005, the Windows Update and Microsoft Update will get you into a condition where it cannot install ”Security Update for Microsoft Visual Studio 2005 Service Pack 1 XML Editor (KB2251481)“. Not even the direct download will install.

The search for ”some updates were not installed” “Security Update for Microsoft Visual Studio 2005 Service Pack 1 XML Editor (KB2251481)” pointed me to the solution:

There are two versions of KB2251481 June and August. When the June version is installed, the August version refuses to install.

Uninstall the original KB2251481 from the Control Panel. Then reinstall the August version.

The KB2251481 article mentions this only for the “Microsoft Visual Studio 2005 Premier Partner Edition SP1″, but it happens with other Visual Studio 2005 editions as well.

–jeroen

via: KB2251481 Security Update for Microsoft Visual Studio 2005 Service – Microsoft Answers.

Posted in .NET, Development, Software Development, Visual Studio 2005, Visual Studio and tools | 1 Comment »

the series “Dogbert’s Tech Support: How May I Abuse You” #dilbert #fun

Posted by jpluimers on 2012/01/23

Last weekend the series “Dogberts Tech Support: How May I Abuse You“, got a new episode:

Dilbert comic 2011-01-22: Dogbert's Tech Support: How may I abuse you

Dilbert comic 2011-01-22: Dogbert's Tech Support: How may I abuse you (Image courtesey of Dilbert.com)

It is great to see that since 1998, not much has changed :)

–jeroen

via: Dilbert comic of 2011-01-22: Dogbert’s Tech Support

Posted in Comics | Leave a Comment »

ssh-keygen: password-less SSH login script (via Novell User Communities)

Posted by jpluimers on 2012/01/20

I usually get at least one step wrong when doing ssh-keygen and transferring they public key by hand, so here is a nice script that helps you install a private/public keypair for remote SSH login without having to type a remote password.

Note: it is always a good idea to have a local passphrase for protecting the private key.

–jeroen

ssh-keygen: password-less SSH login script | Novell User Communities.

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

Batch file examples – Wait using CHOICE (via: RobVanDerWoude.com)

Posted by jpluimers on 2012/01/19

Most batchfile wait examples require a functioning network connection.

Just in case you haven’t, Rob van der Woude has a nice example on his batch file Wait page using the Choice command.

The bummer is: choice is available on almost all Windows versions (actually since DOS 6.x), but not on Windows XP, and not on Windows 2000, but it is there in Windows Vista and up where you can use the timeout command :(

Alternatives can be found in the other examples on Rob’s wait page.

CHOICE – Wait.bat: Uses CHOICE to wait for a specified number of seconds.

By using REM | before the CHOICE command, the standard input to CHOICE is blocked, so the only “way out” for CHOICE is the time-out specified by the /T parameter.

The idea was borrowed from Laurence Soucy, I added the /C parameter to make it language independent.

@ECHO OFF
IF "%1"=="" GOTO Syntax
ECHO.
ECHO Waiting %1 seconds
ECHO.
REM | CHOICE /C:AB /T:A,%1 &gt; NUL
IF ERRORLEVEL 255 ECHO Invalid parameter
IF ERRORLEVEL 255 GOTO Syntax
GOTO End
:Syntax
ECHO.
ECHO WAIT for a specified number of seconds
ECHO.
ECHO Usage: WAIT n
ECHO.
ECHO Where: n = the number of seconds to wait (1 to 99)
ECHO.
:End

–jeroen

via: Batch file examples – Wait.

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

TFS 2010 login: prefix “snd\”, suffix “_cp” (via Ahmed Al-Asaad’s Blog)

Posted by jpluimers on 2012/01/18

I keep forgetting this:

When logging in to CodePlex using TFS, then you need to prefix your username with “snd\” and suffix it with “_cp“.

So if your CodePlex username is wiert, then your login becomes snd\wiert_cp.

Somehow, this used to be more prominently on the codeplex site, but it isn’t any more.

–jeroen

via: TFS2010 « Ahmed Al-Asaad’s Blog.

Posted in CodePlex, Development, Source Code Management, TFS (Team Foundation System) | Leave a Comment »

Dear Mister Jones » How to insert a carriage return with batch

Posted by jpluimers on 2012/01/17

When appending multiple text files to a big one (for instance to post-processing on the total: dedupe, sort, gather statistics, etc) you often will find one or more of the source files missing a CRLF.

So you will have to insert those carriage return line feed combo’s manually.

Well, mr Jones points out that:

there’s actually an easy way to simply echo a carriage return and line feed instead, by just issuing an echo command followed immediately by a period (no space in between), like this:

echo. >> somefile.txt

Thanks Jared!

–jeroen

via: Dear Mister Jones » How to insert a carriage return with batch.

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

Is #Trello #GTD on Steroids?

Posted by jpluimers on 2012/01/16

Will start playing with Trello checking if it is indeed GTD on steroids.

–jeroen

Via: Organize anything, together. | Trello.

Posted in LifeHacker, Power User | Leave a Comment »

15 years of xs4all internet provider membership

Posted by jpluimers on 2012/01/15

Today it is the 15th anniversary of my xs4all membership.
Even though (see some history below) xs4all was not my first provider, it has been the provider of choice ever since:

  • Technically very knowledgeable
  • Very stable connection
  • Highly much aware of privacy

Back in December 1998, when xs4all was sold sold to the Dutch Telcom (KPN), lots of people were afraid that xs4all would start scoring less points one ore more of the above points.
They didn’t, and that is the main reason I’m still client with them.

This despite the  fact that I can get faster internet where I live.
My ADSL connection is quite a long distance from the telco DSLAM, so I can’t get a very high ADSL speed.
As some of the ADSL versus distance speed graphs show, your ADSL connection needs to be close to the telco’s DSLAM.
I’m not, so my maximum ADSL1 speed is slightly less than 8 megabit, and my current ADSL2+ speed is less than 16 megabit, so xs4all light is the best I can get.

BTW: If you live in The Netherlands, here you can calculate that distance (which is called “afstand tot de centrale” in Dutch).
I wish they ran the telco cables under the canal to the neighboaring village: I’m about 500 meter away from their DSLAM, in stead of the 2700 meters I’m from my own DSLAM.
Oh well :-)

For high speed things, I now also have a cable connection.
Even though they are deregulating that part of the broadband market, currently cable internet is bound to your cable TV provider.
In my case, that is UPC, and their high speed internet is marketed as Fiber Power.
I started with a 60 over 6 megabit service, that they increased to 120 over 10 megabit about a year ago while reducing the price (because they were merging their packages and wanted to increase their competetiveness).

While writing this, I’m still searching for a good dual gigabit WAN router to combine the two connections in one.

Over time, xs4all increased the ADSL bandwidth from a meager 1 megabit over 256 kilobit to 8 megabit over 1 megabit.
They increased mailbox and storage sizes too.
And finally, they were among the first to support IPv6.

So all in all, I’m still very happy for staying with xs4all.

A bit of history

xs4all was not where the internet started for me. Read the rest of this entry »

Posted in About, Personal, Power User | 16 Comments »

Affordable MacBook Air physical USB ethernet adapter

Posted by jpluimers on 2012/01/13

DealExtreme product #34691: USB 2.0 10/100Mbps RJ45 LAN Ethernet Network Adapter Dongle

A big drawback from a MacBook Air is that it only have wireless LAN/WiFi (in the form of Integrated AirPort Extreme 802.11 a/b/n/n), no physical ethernet.

Transferring large amounts of data over any WiFi is can be a pain (being slow, suffer from signal quality) and for the MacBook Air: it makes the built-in fan swirl like crazy.

Since the MacBook Air does not have USB 3.0, I went looking for a 100 Mbps USB Ethernet dongle for it, and fone the DealExtreme product #34691: USB 2.0 10/100Mbps RJ45 LAN Ethernet Network Adapter Dongle.

At a price of about USD 7 including shipping, it comes in an Apple compatible shiny white color too, nicely fitting the 4 port USB hub (DealExtreme # 45773) on the right  :)

Even better: it works like a charm!

Note that first need to download and install the ASIX AX88772B drivers first. Choose the Apple Mac OSX 10.4 to 10.7 Driver for x86 and Power PC download package labelled “For Apple x86/Power PC, 32-bit/64-bit platforms”.

The install tells you to reboot at the end, but no need for that: as soon as the install finishes, the USB Ethernet dongle works. And it is fast too: 12 megabyte/second over a 100 megabit cable is fast!

In the readme of those drivers, it also mentions the AX88178, which is capable of gigabit (there is a separate AX88178 driver download page and Mac OS X download package).

NB: the cool thing about both these ASIX chipsets is that they are supported on a broad range of platforms (Mac, Linux, Windows CE, Windows 7/Vista/XP/2003/2000) and bit sizes (32-bit and 64-bit).

For even faster transfers, I might try the DealExtreme product #15336: Arkview USB 2.0 1000Mbs Gigabit Ethernet LAN Network Adapter.

It is slightly less than USD 20, and  user Janipro indicates it is based on the ASIX AX88178 chip at the DealExtreme forum.

On the other hand: I might not, as for more than twice the price, user cyberic mentions in the same forum thread it is only about twice as fast: 23 megabytes per second, about half the maximum USB 2.0 speed of 480 Mbps. And it is not Apple white :)

–jeroen

Via: USB 2.0 10/100Mbps RJ45 LAN Ethernet Network Adapter Dongle – Free Shipping – DealExtreme.

Posted in Apple, LifeHacker, MacBook, MacBook-Air, OS X Leopard, OS X Lion, OS X Snow Leopard, Power User | Leave a Comment »

Migrate/Transfer SQL Server 2008/2005/2000/7 Logins to SQL Server 2008

Posted by jpluimers on 2012/01/12

When moving databases across servers, you face the same problem as when upgrading servers: users are server specific, but permissions are databases specific. They are not bound by UserName, but through a SID (security identifier).

When adding the same UserName entries to a new server that already has the databases restored, you get error messages like these:

Error 21002 [SQL-DMO] User ‘account’ already exists

When adding the same UserName  entries, then restoring the databases, it won’t work, because the matching SIDs don’t exist.

There are many sites explaining the “Error 21002″ and pointing to sp_change_users_login.

But sp_change_users_login (and the ALTER USER UserName WITH LOGINI = UserName2 in SQL Server 2005 and higher) is not the actual fix to the problem: it will re-add the user with a new SID, then correct the SID in the database currently in use.

Actually you are after “Orphaned” users: users that are defined in the various databases, but not present in the user list on the SQL Server instance. Running sp_change_users_login with the “Report’ parameter on the “new” server will show a list of orphaned users.

An even better way to show Orphaned Users is by running the ShowOrphanUsers script. In my own version (sourcecode is below), I have added an extra UserSID column of type varbinary(85).

In order to transfer users to a new server, you need a sp_help_revlogin stored procedure. Depending on the version of your SQL Server (7/2000/2005/2008), you need a slightly different version of a script that creates sp_help_revlogin for you. All versions are available at NetNerds.net.

–jeroen

via: Migrate/Transfer SQL Server 2008/2005/2000/7 Logins to SQL Server 2008.

USE master;
GO
IF OBJECT_ID ('dbo.ShowOrphanUsers') IS NOT NULL
  DROP PROCEDURE dbo.ShowOrphanUsers
GO
CREATE PROC dbo.ShowOrphanUsers
AS
BEGIN
	CREATE TABLE #Results
	(
		[Database Name] sysname COLLATE Latin1_General_CI_AS,
		[Orphaned User] sysname COLLATE Latin1_General_CI_AS,
                [UserSID]  varbinary(85)
	)

	SET NOCOUNT ON

	DECLARE @DBName sysname, @Qry nvarchar(4000)

	SET @Qry = ''
	SET @DBName = ''

	WHILE @DBName IS NOT NULL
	BEGIN
		SET @DBName =
				(
					SELECT MIN(name)
					FROM master..sysdatabases
					WHERE 	name NOT IN
						(
						 'master', 'model', 'tempdb', 'msdb',
						 'distribution', 'pubs', 'northwind'
						)
						AND DATABASEPROPERTY(name, 'IsOffline') = 0
						AND DATABASEPROPERTY(name, 'IsSuspect') = 0
						AND name > @DBName
				)

		IF @DBName IS NULL BREAK

		SET @Qry = '	SELECT ''' + @DBName + ''' AS [Database Name],
				CAST(name AS sysname) COLLATE Latin1_General_CI_AS  AS [Orphaned User],
                                SID AS [UserSID]
				FROM ' + QUOTENAME(@DBName) + '..sysusers su
				WHERE su.islogin = 1
				AND su.name <> ''guest''
				AND NOT EXISTS
				(
					SELECT 1
					FROM master..sysxlogins sl
					WHERE su.sid = sl.sid
				)'

		INSERT INTO #Results EXEC (@Qry)
	END

	SELECT *
	FROM #Results
	ORDER BY [Database Name], [Orphaned User]
END
GO

Posted in Database Development, Development, SQL, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 7 | Leave a Comment »

Should watch: Dave Herman: The Future of JavaScript #ECMAScript6

Posted by jpluimers on 2012/01/11

On:

Mozilla Labs engineer and TC39 representative Dave Herman joined us at YUIConf 2011 to give this keynote talk on the future of JavaScript, covering many of the new features currently under consideration for ES6, the next edition of the ECMAScript standard.

Many wonderful new features. Now it just need some great tooling.

–jeroen

via: http://www.youtube.com/watch?v=u4IdoBU1uKE

Posted in Development, JavaScript/ECMAScript, Scripting, Software Development | Leave a Comment »

great answer by Remy Lebeau on windows – CreateProcessAsUser doesn’t work when “change user” – on Stack Overflow part of @StackExchange

Posted by jpluimers on 2012/01/10

You might wonder why I quoted two great StackOverflow answers recently. Well, it is because I absolutely love the way that StackExchange.com and StackOverflow.com changed how to find quality answers (and questions!) on topics varying from programmers through Cooking to Chines Language Usage in a community based way.

This one is by Remy Lebeau, who is part of TeamB:

You don’t need to enumerate running explorer.exe processes, you can use WTSGetActiveConsoleSessionId() instead, and then pass that SessionId to WTSQueryUserToken(). Note that WTSQueryUserToken() returns an impersonation token but CreateProcessAsUser() needs a primary token, so use DuplicateTokenEx() for that conversion.

You should also use CreateEnvironmentBlock() so the spawned process has a proper environment that is suited to the user account that is being used.

Lastly, set the STARTUPINFO.lpDesktop field to ‘WinSta0\Default’ instead of nil so the spawned UI can be made visible correctly.

I have been using this approach for several years now and have not had any problems with it. For example:

… code sample is in the answer …

–jeroen

via: windows – CreateProcessAsUser doesn’t work when “change user” – Stack Overflow.

Posted in Delphi, Development, Software Development | 2 Comments »

Resetting the SMC solved my MacBook Air Fan Noise With Lion problem

Posted by jpluimers on 2012/01/09

This might have been caused by my MacBook Air haning itself one time during resume: I manually turned it off keeping the on/off switch pressed for 5+ seconds, then rebooted.

Anyway: over time I observed that the fan was running fast without much CPU/GPU/memory/disk activity.

Resetting the SMC like the answer below, followed by resetting the PRAM and NVRAM solved my issue.

I had exactly these issues with my new Macbook Air 13.  Having read this forum I downloaded istat pro and discovered that my fan was always running at over 4000 rpm and the top left part of my case was quite warm.  I then followed the instructions here…resetting the SMC and after this the problem was fixed!

–jeroen

via MacBook Air Fan Noise With Lion: Apple Support Communities.

Posted in Apple, LifeHacker, MacBook, MacBook-Air, OS X Lion, Power User | Leave a Comment »

Alternate (offline) Google Chrome installer (Windows) – Google Help

Posted by jpluimers on 2012/01/06

Currently most software installers have a small bootstrap and during the actuall install will download only the files that are actually needed.

Often that is not convenient: slow or no network connection, repeated installs in a test environment, etc.

Luckily, a lot of software does have an offline installer (a.k.a. standalone installer).

Being no exception Google Chrome has two offline installers: one single user install, and one for all users on the same Windows machine.

It ends up at one of these download pages, each with a download link for the current version (which changes for every new version):

–jeroen

via: Alternate (offline) Google Chrome installer (Windows) – Google Help.

Posted in LifeHacker, Power User, Windows, Windows 7, Windows 8, Windows Vista, Windows XP | 1 Comment »

Great answer by Cosmin Prund: How and when are variables referenced in Delphi’s anonymous methods captured? – Stack Overflow

Posted by jpluimers on 2012/01/05

Every once in a while, by accident you stumble on a really great answer on StackOverflow.

Here is a quote from Cosmin Prund describing on how Delphi implements anonymous methods using a TInterfacedObject descendant:

When you have a function like the one in the question, where you have an anonymous method accessing a local variable, Delphi appears to create one TInterfacedObject descendant that captures all the stack based variables as it’s own public variables. Using Barry’s trick to get to the implementing TObject and a bit of RTTI we can see this whole thing in action.

Read his full answer for the complete description including sample code.

I stumbled on this great answer trough the question Is it possible for a managed local variable to transparently “travel to” another local scope? which might sound like an odd question, but it is not: StackOverflow is about learning, and some people do that by asking questions on solving problems in a very uncommon way, just to learn there are far better ways of obtaining what they want.

–jeroen

via: How and when are variables referenced in Delphi’s anonymous methods captured? – Stack Overflow.

Posted in Delphi, Development, Software Development | Leave a Comment »

Undoing TinyUrl, Goo.gl, Bitly and other URL shorteners: http://expandurl.appspot.com/

Posted by jpluimers on 2012/01/04

Great stuff: http://expandurl.appspot.com/

Especially when a shortened URL breaks, and you want to find out if the underlying URL got moved to a different place.

–jeroen

via: http://stackoverflow.com/questions/6500721/find-where-a-t-co-link-goes-to

Posted in Power User | Leave a Comment »

Introducing the for-if anti-pattern – via: The Old New Thing – Site Home – MSDN Blogs

Posted by jpluimers on 2012/01/03

I really like what Raymond Chen writes, not just the tech stuff in his Old New Thing blog, but  especially in his comments.

Here is a nice example:

You also see this anti-pattern used in real life: “What flavors do you have?” and then after the list of flavors is recited, “I was hoping you had raspberry.” -Raymond

And he is right, in real life, lots of people have stopped to actively think, expecing others (very often the government) to solve their problems.

It reminds me of one our kitchen magnets: “If it’s called common sense, then why is it so rare?”.

So: why do you think it is so rare?

–jeroen

via: Introducing the for-if anti-pattern – The Old New Thing – Site Home – MSDN Blogs.

Posted in About, Development, Opinions, Personal, Software Development | 2 Comments »

ASCII art: when old skool is modern again.

Posted by jpluimers on 2012/01/02

When old skool is modern again :)

The last few months, I observe more and more ASCII art, especially on social media like FaceBook, Twitter, etc.

The most recent was this one from our neighbours  - thanks guys – (it doesn’t do very good justice to the original, as it needs less linespacing, and works best with an Arial font):

°.˛*.˛.°★。˛°.★**Fijne Kerstdagen en *★* *˛.

˛ °_██_*。*./ ♥ \ .˛* .˛.*.★een geweldig 2012**★ 。

˛. (´• ̮•)*˛°*/.♫.♫\*˛.* ˛_Π_____. ***★toegewenst 。

.°( . • . ) ˛°./• ‘♫ ‘ •\.˛*./______/~\.˛* .。˛* *★* Some  &

*(…’•’.. ) *˛╬╬╬╬╬˛°.|田田 |門|╬╬╬╬╬*★★*★ ★ Someone

¯˜”*°••°*”˜¯`´¯˜”*°••°*”˜¯ ` ´¯˜”*°´¯˜”*°••°*”˜¯`´¯˜” *

Since many chacaters are not ASCII at all, maybe Typewriter Art fits better.

Anyway: I like the new revival of these kinds of arts.

They remind being a lot younger and playing around with characters to see what graphical information I could put in a limited space. You can use this to present information too, as this progress bar shows how busy the public traffic is.

They also remind me how much real artists can do in little space. Given the limited space especially on Twitter and Mobile Systems, and the common feature among those is still text, ASCII art makes a lot of sense again :)

Some references to give you an idea how bad I was at it, and how good others :)

Check out http://cd.textfiles.com/hackchronii/VIRUSL4/VIRUSL4.46 and search for “Pluimers” (sitenote: I was nicknamed by the chinese cook in the restaurant kitchen I worked a few years before that, though the cook pronounced “Charlie”  as “Cha-li”, and I nicked it to Charly to avoid conflicts).

A bit later I condensed it a bit (look for “rulfc1″ at http://www.nic.funet.fi/pub/msdos/Info/info-ibmpc). Others were way better at Email Art and Signature Art than I was.

Those were days where you would mostly communicate with text. And even that wasn’t a long time ago when you imagine that the oldest known form of Typewriter Art is from 1898!

–jeroen

Posted in About, Font, Personal, Power User | 2 Comments »

After restoring fresh HDD from Time Machine Backup: No results from Spotlight

Posted by jpluimers on 2012/01/02

My Mac Mini Server had its’ primary HDD failure. It got replaced by the iAmStore service center, but contrary to what they promised, they didn’t put the Snow Leopard Server image on it.

So I grabbed an external USB DVD player, booted from the Snow Leopard Server install DVD, and restored the Time Machine backup from my external USB HDD.

Somehow, after the restore, Spotlight wouldn’t work: only the search bar was visible, but nothing else.

I tried various tips all having to do with erasing Spotlight for my root volume (so it would be automatically be reindexed), or many-part steps including killing SystemUIServer, Clearing Caches and Rebooting.

In the end the most simple one worked: just “turn Spotlight indexing on”.

My assumption is that Spotlight information is not backed up, and during restore Spotlight is turned off because continuously reindexing during restore will make the restore slower.

If someone can confirm this (or deny and explain the real reason), please post a comment.

This was what user nkt00 had posted as solution on the Apple forum:

I figured it out. In the man page for “mdutil” (type: “man mdutil” at the terminal shell prompt), it describes the option “-i”, which turns indexing on or off for the specified volume. I just typed:

sudo mdutil -i on /

and away it went

This was the screen output:

Last login: Mon Oct 31 19:31:01 on ttys000
macminiserver01:~ jeroenp$ mdutil -s /
/:
No index.
macminiserver01:~ jeroenp$ sudo mdutil -i on /
Password:
/:
Indexing enabled.
macminiserver01:~ jeroenp$

Now I’m happily using my Mac Mini Server again.

–jeroen

via No results from Spotlight: Apple Support Communities.

Posted in Apple, LifeHacker, MacBook, OS X Leopard, OS X Lion, OS X Snow Leopard, Power User | Leave a Comment »

my wiert.WordPress.com blog: 2011 in review: almost 400 posts, 220k visitors, “Silverlight dead/ long live XAML” most popular.

Posted by jpluimers on 2012/01/01

Don’t you love automated tools :)

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

The Louvre Museum has 8.5 million visitors per year. This blog was viewed about 220,000 times in 2011. If it were an exhibit at the Louvre Museum, it would take about 9 days for that many people to see it.

Click here to see the complete report.

Posted in About, SocialMedia, WordPress | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 430 other followers