Wednesday, January 27, 2010

SMTP server for development purposes

Needed to test some code sending emails, but did not find the local SMTP sever on Windows 7.

Did a quick search and found this one.. sweet..

http://smtp4dev.codeplex.com/

Dummy SMTP server that sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected. Useful for testing/debugging software that generates email.
Share:

Tuesday, January 19, 2010

WCF Client wrapper

The using statment and WCF are a bad combo.. Instead use the following class. With some lambda together with this class it's almost like a using statement.

 using System;
    using System;
    using System.ServiceModel;

    /// 
    /// Helper class for WCF clients
    /// 
    public class WcfClientUtils
    {
        /// 
        /// Execute actions against the client and aborts the client on a faulted state
        /// 
        /// Client type
        /// Client instance
        /// Actions to perform on instance
        /// 
        /// WcfClientUtils.Execute(new ServiceReference1.Service1Client(),
        ///     client =>
        ///     {
        ///         var returnData = client.HelloWorld());
        ///     });
        /// 
        public static void Execute(T client, Action action) where T : ICommunicationObject
        {
            try
            {
                //client.Open();
                action(client);
                client.Close();
            }
            catch (CommunicationException)
            {
                client.Abort();
                throw;
            }
            catch (TimeoutException)
            {
                client.Abort();
                throw;
            }
            catch (Exception)
            {
                if (client.State == CommunicationState.Faulted)
                {
                    client.Abort();
                }

                throw;
            }
        }
    }

And this is how you could use this class

WcfClientUtils.Execute(new ServiceReference1.Service1Client(),
    client =>
        {
            var returnData = client.HelloWorld());
});
Share:

Monday, December 14, 2009

Show/hide GuiPlugin in EPiServer

To make a plugin only show on specific pages follow these steps.

1. Create your plugin as usual.
2. Implement the ICustomPluginLoader interface.
3. Return a empty PluginDescriptor[] in the List() function for all pages that you don’t want the plugin to be visible.

In the example below the plugin is only visible for the startpage.

[GuiPlugIn(DisplayName = "Rates & Indexes", 
 Description = "Edit rates and indexes", 
 Area = PlugInArea.EditPanel, 
 Url = "~/RatesAndIndexes/RatesAndIndexes.ascx")]
public partial class RatesAndIndexes : System.Web.UI.UserControl, ICustomPlugInLoader
{
 public PlugInDescriptor[] List()
 {
  EPiServer.UI.Edit.EditPanel editPanel = (EPiServer.UI.Edit.EditPanel) System.Web.HttpContext.Current.Handler;    
  if (EPiServer.Core.PageReference.StartPage.ID != editPanel.CurrentPage.PageLink.ID)
  {
   return new PlugInDescriptor[] { };
  }
  else
  {
   return new PlugInDescriptor[] {  PlugInDescriptor.Load(this.GetType()) }; }
  }
 }
}
Share:

Tuesday, December 8, 2009

Testing Internet explorer

IETester is a free WebBrowser that allows you to have the rendering and javascript engines of IE8, IE7 IE 6 and IE5.5 on Windows 7, Vista and XP, as well as the installed IE in the same process.

Great tool for testing websites in different versions of Internet Explorer
Share:

Monday, December 7, 2009

Convert old harddrive to VHD

I recently upgraded to Win7 on my laptop, but I still needed my old environment (WinXP).

So I installed Win7 on a fresh new disk that was bigger and better than my old. That way I always could swap disk if I needed my old environment. But I also was hoping for a solution where I could run my old system inside Virtual PC, and now it is.

I used the tool Disk2vhd from Microsoft Sysinternals.

For WinXP remember to set “Fix up HAL for Virtual pc”.

When its finished, you need to create a new Virtual PC and used the newly created vhd file as its harddrive. You also will need to activate windows once more when you startup. At least I had to.
Share:

Wednesday, December 2, 2009

Remote Desktop Manager

Remote Desktop Manager is a small application used to manage all your remote connections and virtual machines. Add, edit, delete, shared, organize and find your remote connection quickly. Compatible with Microsoft Remote Desktop, Terminal Services, VNC, LogMeIn, Team Viewer, Ftp, SSH, Telnet, Dameware, X Window, VMWare, Virtual PC, PC Anywhere, Hyper-V, Citrix, Radmin, Microsoft Remote Assistance, Sun Virtual Box and more.


http://remotedesktopmanager.com
Share: