March 2003 - Posts

Completely online email clients

I'm been trying to find the best completely online email client such as oddPost and fastmail.  I like oddPost's GUI but it doesn't have all the features, I like fastmail's features but it doesn't have a very good GUI.  Does anyone else use a completely browser based email client online that has a nice GUI and has a nice set of feature, especially the ability to check other pop/imap accounts?

Over write text in a window's console application

Today I had a need to display a counter on a Console application and I was trying to think of a way to over write the existing number with the new number in the console window, using C#.  So after thinking about it for a minute it came to me, just write backspace characters.  Well anyways just incase anyone would ever need this here is a simple example: 

for(int i = 0; i < 1000; i++)
{
  if(i > 0)
    Console.WriteLine(new string('\b', (i-1).ToString().Length));

  Console.WriteLine(i.ToString());
}

Free ASP.Net Web hosting

FREE .NET webhosting for ASP.NET at .net playground it is not a commerical hosting site but it is good for testing asp.net web applications.

NiftyPortal

I stumbled upon this pretty cool online news reader a while ago and I just happened to stumble upon it again and I figured that I would pass it along.  NiftyPortal
Posted by puzzlehacker | with no comments

CodeProject WebService

I just learned that CodeProject has a web service that will allow you to get the lastest article headlines http://www.codeproject.com/webservices/latest.asmx.  I once tried to see if they had an RSS feed but I never found one.  I guess someone could very easily use the webservice and create an RSS feed from it.

Using Embedded Images in ASP.Net V2

Thanks to Yves and Peter for the advise I utilized your advise to create a new version my embedded Image example. I did switch to an ashx file, I didn't even know about this file type until now. I'm no longer passing in the assembly as a parameter but I didn't want to put the assembly in the config file either, so I figured that I would just test for the image by the passed in name in all the assemblies loaded into that AppDomain. There shouldn't be to many right? But you do have to make sure that embedded image has a unique name, that shouldn't be to hard though because you can prefix it by your namespace.
<% @ webhandler language="C#" class="ImageHandler" %> 

public class ImageHandler : System.Web.IHttpHandler 
{ 
  public void ProcessRequest(System.Web.HttpContext context) 
  { 
    string image = string.Empty;
    System.IO.Stream stream = null;
      
    try
    {
      context.Response.Clear();

      // Get Image Name from request
      image = context.Request["img"].Replace("/"".");   
  
      // Find image in loaded assemblies
      foreach(System.Reflection.Assembly asm in System.AppDomain.CurrentDomain.GetAssemblies())
      {
        stream = asm.GetManifestResourceStream(image);
        if(stream != null)
          break;
      }
      
      // Throw exception if image is not found
      if(stream == null)
        throw new System.Exception("Image not found in loaded assemblies");
            
      // Create an Image object from the stream
      System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
      
      // Save the Image stream to the output stream
      img.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
    }
    catch(System.Exception ex)
    {
      context.Response.Write("Exception: <BR>image = " + image + "<BR>" +
        ex.Message + "<BR>" + ex.StackTrace.Replace("\n""<BR>"));  
    }
    finally
    {     
      context.Response.End(); 
    }; 
  } 
   
  public bool IsReusable 
  { 
    get { return true; } 
  } 
}

So what do you guys think about revision 2?

Using Embedded Images in ASP.Net

I have been working on an asp.net application where I want to use a treeview which is calling for quite a number of images and I didn't want to worry about copying all the images with my assembly, so I embedded the images into my assembly.  But I could not figure out any way to directly output the images so I wrote another aspx file that will display the image. 
<%@ Page Language="C#" %>
<%
  string image = string.Empty;
  string asmName = string.Empty;
  
  try
  {
    Response.Clear();

    // Get Image Name from request
    image = Request["img"].Replace("/"".");   
    
    // Get Assembly Name from request
    asmName = Request["asm"];

    // Default the Assembly Name to the current assembly
    if(asmName == null || asmName == string.Empty)
      asmName = this.GetType().Assembly.FullName;

    // Load the Assembly
    System.Reflection.Assembly asm = System.Reflection.Assembly.Load(asmName);
    
    // Get the Image stream from the embedded image
    System.IO.Stream stream = asm.GetManifestResourceStream(image);
    
    // Create an Image object from the stream
    System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
    
    // Save the Image stream to the output stream
    img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
  }
  catch(Exception ex)
  {
    Response.Write("Exception: <BR>image = " + image + 
      "<BR>asmName = " + asmName + "<BR>" + 
      ex.Message + "<BR>" + ex.StackTrace.Replace("\n""<BR>"));  
  }
  finally
  {     
    Response.End(); 
  }
%>


This seems to work pretty well. Here is an example of how to use it
<IMG src="image.aspx?asm=<AssemblyName>&img=<namespace>.testimage.gif" />

This will prevent me from having to copy all the images; all I would need to copy is the Assembly and the image.aspx file.  What do you guys think?  Does anyone see any potential problems with this?

Memobook and DevBuddy

I ran across this free service for organizing notes from any where(with IE internet access).  It is called The Notes Bar. I was thinking that this is a good idea and maybe something along this idea can be developed for DevBuddy To where we can access todo lists, code snippets, articles, and alerts from anywhere.

.Net Tools

Tools tools tools for .NET

I've started to put together a categorized list of various .NET tools.
This list is not complete of course, but can be useful if you search a tool for a specific need.

This list will be accessible from my main page using the ".NET Tools" link.

[Fabrice's weblog]

This is a cool list of .net tools, thanks Fabrices.

Posted by puzzlehacker | with no comments
More Posts Next page »