Feb 20

coolani

This is an updated to the "NGif, animated GIF Encoder for .NET" article on the The Code Project web site. NGif is a set of C# classes which can create animated GIF images. Microsoft's native GDI library does not support the creation of animated GIFs.

My update supports returning the animated GIF as a MemoryStream object instead of a file. This is helpful on webservers where saving temporary files are not allowed.

Download: NGif_src2.zip (361.62 kb)

Update: If you are looking for more information on animated GIFs using C#, check out HOWTO: create an animated GIF using .Net (C#) by Rick van den Bosch.

Tags: |
Dec 26

The Photo Gallery addition for BlogEngine.NET is moving forward. We are in the final stages of wrapping up the first release and hope to release it in early January 2008. Here is our list of remaining items:

1. Move all photo settings to the Photo Gallery Control Panel.

2. Write web interface for the Photo Effect extensions.

3. Add option to delete a photo album.

4. Document the use of Cascading Style Sheets (CSS).

5. Add photo gallery web pages to the themes that ship with BlogEngine.NET.

6. Create new theme to highlight the features of the Photo Gallery.

7. Invalid the photo cache when Photo Effects are added or changed.

8. And finally, find and fix any remaining bugs.

If you wish to help out, download the latest source code from CodePlex and try it out. The more developers and testers that participate, the better the release will be.

Dec 24

SnapShotI wrote a small SnapShots extension for BlogEngine.NET 1.3.

To install it, download and copy the SnapShots.cs file to the App_Code\Extensions directory.

To set your SnapShots Key, go into the Extension section of the Control Panel and click the edit hyperlink for the SnapShots extension. Enter SnapShot Key on the next page.

You can download the extension from the link below.  

Download: SnapShots.cs (2.00 kb) Updated 12/25/07

Update: There are two bugs in the BlogEngine 1.3 release related to Scalar Values in Extensions. I have submitted the patches to the BlogEngine.NET team. In the mean time, you can download the fixed files below:

Download: ExtensionParameter.cs (2.97 kb)
Download: Settings.ascx.cs (10.76 kb)

Tags:
Dec 23

This is an upgrade to the Odiogo Extension by Mads Kistensen that uses the new ExtensionManager in the BlogEngine.NET 1.3 release. You can download it by clicking the link below.

Odiogo is a service that reads your RSS feed and creates an mp3 file for each of your blogs. This extension adds the Odigo's Listen now icon to the top of your blog posts.

For more information see Mad's Make your blog talk post.

Download: Odiogo.cs (2.89 kb) Updated 12/25/07

Update: There are two bugs in the BlogEngine 1.3 release related to Scalar Values in Extensions. I have submitted the patches to the BlogEngine.NET team. In the mean time, you can download the fixed files below:

Download: ExtensionParameter.cs (2.97 kb)
Download: Settings.ascx.cs (10.76 kb)

Nov 14

Lately, I have written a lot of multithreaded code in C#. I use the ThreadPool class object to launch and manage many parallel threads - mostly for TCP communications with clients application. It automatically throttles the numbers of active threads by the number of processors. Unfortunately, the ThreadPool class was written before .NET 2 and therefore it does not take advantage of generics and you end up casting function methods and callback parameters back and forth. It can be a bit messy.

However, you can simply things with the following helper class:

static class ThreadPoolHelper
{
  public delegate void Function();

  public static void Execute(Function function)
  {
    ThreadPool.QueueUserWorkItem(new WaitCallback(Call), (object)function);
  }

  private static void Call(object o)
  {
    ((Function)o)();
  }
}

 

With this code, to create a thread in the pool, you simple use:

TheadPoolHelper.Execute(someFunction);

 

Where someFunction is the name of a function method which does not have any parameters. 

If you need to pass a parameter, here's the helper class for that too:

static class ThreadPoolHelperWithParam<T>
{
  public delegate void Function(T param);

  public static void Execute(Function function, T param)
  {
    ThreadPool.QueueUserWorkItem(new WaitCallback(Call), new KeyValuePair<object, T>((object)function, param));
  }

  private static void Call(object o)
  {
    KeyValuePair<object, T> lObject = (KeyValuePair<object, T>)o;

    ((Function)lObject.Key)(lObject.Value);
  }
}

 

Now you can also pass an object of any type, like this:

ThreadPoolHelperWithParam<someObjectType>.Execute(someMethod, someObject);

Where the someObjectType is the type of object you are passing, and someObject with actual object you wish to pass as a parameter. Simple!

 

Tags: