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,602 other followers

Archive for April, 2009

.NET/C# – Issue with FileStream on network with transfers larger than 64 megabyte

Posted by jpluimers on 2009/04/27

Quite a while ago (2006!), I bumped into an issue when copying large chuncks of data to a network.

I posted it to Google, mentioned that breaking up the data in smaller blocks worked, but never had the time to post the solution.

So here it is :-)

First the problem:

The old code consistently fails when:

  • the FileStream is on a network
  • and the MemoryStream is 64 megabytes or larger

The old code succeeds when:

  • the MemoryStream is smaller than 64 megabytes
  • or the FileStream is not on a network

An example of the exception message you get upon failure:

System.IO.IOException: Insufficient system resources exist to complete the requested service.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)
   at System.IO.BufferedStream.Write(Byte[] array, Int32 offset, Int32 count)
...

Then the old code:

        public static void WriteMemoryStreamToFile(string filename, MemoryStream memory)
        {
            using (Stream
                file = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite),
                fileBuffer = new BufferedStream(file)
            )
            {
                byte[] memoryBuffer = memory.GetBuffer();
                int memoryLength = (int)memory.Length;
                fileBuffer.Write(memoryBuffer, 0, memoryLength); //##jpl: drawback: works only up to 2 gigabyte!
                fileBuffer.Close();
                file.Close();
            }
        }

Note that the old code already has a limitation of 2 gigabyte, back then this was not an issue (in 2006 there were not that many people having more than 2 gigabytes of memory, now that is a different story).

Read the rest of this entry »

Posted in .NET, C#, Development | 6 Comments »

Performed @ Bloemencorso Bollenstreek 2009 (Flowercorso 2009)

Posted by jpluimers on 2009/04/26

Yesterday, the Senior Band of Adest Musica (the marching band where next year I hope to celebrate my 30th membership anniversary) participated in the 62nd edition of the Flower Parade in “de Bollenstreek“.
(Actually this is should formally be called “de Duin- and Bollenstreek”, as the complete “Bollenstreek” also includes two more regions in North Holland, and a few smaller areas on the South Holland islands).

New truck for Adest Musica with "the Musketeer" theme for their WMC 2009 show

New truck for Adest Musica with “the Musketeer” theme for their WMC 2009 show

The Senior Band has brass and percussion (no woodwinds, though the Stage Band orchestra part of Adest Musica has them).

It will compete during the World Music Contest 2009 in Kerkrade, so this was a great opportunity to show the public our new marches that we are going to play at the WMC: “Moving Force” and “to Fight and Win” (sorry Dutch link only) as well as the introductory march to the show “Up is Down” that bridges our previous show “Legends of the Seas” to the new show “the Musketeer”.

At the flower corso, also our new truck themed “the Musketeer” as well, click on the picture on the right to see an enlarged version.

A few videos of the Flower Parade with us performing are already on-line:

  1. Adest Musica Sassenheim – Bloemencorso 2009 – WMC / The  – 10 minute compilation
  2. Adest Musica Sassenheim – Bloemencorso 2009 – 2.5 minute compilation showing “Up is Down”
  3. Adest Musica Sassenheim – Bloemencorso 25 april 2009 – very short fragment, but the only one showing my wife (light blue shirt) and brother (khaki jacket) having back-packs with fresh water!

So now you know what I do to balance all the keyboard work I do :-)

–jeroen

Posted in About, Adest Musica, Personal | Leave a Comment »

Conferences, seminars and other public appearances « The Wiert Corner

Posted by jpluimers on 2009/04/26

On request, I have started to maintain a page about the events I have spoken at or will be speaking at.

The page serves as a central landing spot for people wanting to download materials of past appearances, or wanting to meet me in person on future appearances.

Currently, it contains

I will extend it with more downloads and more events over time (and blog about it when it gets extended).

Drop me a message at the contact form when you need more of the past downloads (I have been speaking at conferencs since 1995, so there is quite a lot of material <g>)

Posted in About, Conferences, Delphi, Development, Event, PowerDay | Leave a Comment »

Spoken @ Delphi 2009 interactive briefing on April 1st, 2009 (no joke!) on migrating from Delphi 2007 to Delphi 2009, and from Delphi 5 to Delphi 2006/2007

Posted by jpluimers on 2009/04/26

Oosterkamp training | consultancy (the company that I used to co-own before partnering in better office benelux), together with Barnsten (the CodeGear / Embarcadero representative in the benelux) organized a Delphi 2009 interactive briefing on the evening of April 1st, 2009.

That wasn’t a joke, and we had good attendance with interesting questions.

I did a session on migrating to the most current Delphi version.

Read the rest of this entry »

Posted in Briefing, Delphi, Development, Event, Software Development | 1 Comment »

.NET/C# – obtaining information through WMI

Posted by jpluimers on 2009/04/25

WMI (Windows Management Instrumentation) is a way of obtaining information from your PC that otherwise might be hard to find.
WMI is based on Common Information Model (CIM), so you’ll see an example of that too.

There is one drawback: for a lot of the WMI, you need to have enough privileges (like: being an admin, which none of you should be, right?).
So beware!

You can use WMI from C#, but you have to generate the C# classes for the WMI classes first.

I’ll show some examples for WMI Win32 classes, as I needed some of those classes recently myself.

Before I forget:
in order to browse through the WMI Win32 object instances, you can download this nifty WMI Administrative Tools toolset from the Microsoft MSDN site. Note that these are from 2002, and they only reliably work from within Internet Explorer.
Read the rest of this entry »

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

 
%d bloggers like this: