Archives

Archives / 2004 / July
  • ASCII Art with variable pixel squares...

    private static string grayscalepalette=" `.~:;I=i+oO08#M";

    public static
     string GetGrayScaleHtml(Bitmap bm,int pixelsquare)
    {
     
    StringBuilder sb = new StringBuilder();
     
    for(int y=0;y<bm.Height-pixelsquare;y+=pixelsquare)
     
    {
       
    for(int x=0;x<bm.Width-pixelsquare;x+=pixelsquare)
       
    {
         
    int luminationtotal=0;
         
    int lumination=0;
         
    for (int i=0;i<pixelsquare;i++)
          
    {
           
    for (int j=0;j<pixelsquare;j++)
           
    {
             
    Color c = bm.GetPixel(x+i,y+j);
             
    lumination = (int)(c.R*0.3 + c.G*0.59+ c.B*0.11);
             
    luminationtotal+=lumination;
           
    }
          
    }
         
    sb.Append(GetGrayScaleChar((int)(luminationtotal/(pixelsquare*pixelsquare))));
        
    }
        
    sb.Append(Environment.NewLine);
     
    }
      
    return sb.ToString();
    }

  • SQL 2005 XML WebServices? Yuck...

    At this years TechEd 2004 in Amsterdam, I went to a session regarding XML Web Services, which are basically now embedded into SQL 2005, provided it runs on Windows Server 2003 with the HTTP.SYS kernel. All I heard was how great all this stuff is for interoperability, Java clients connecting to your HTTP SOAP endpoint blah, blah etc...

    I have some reservations about this. In fact, I won't be exposing HTTP endpoints from within SQL Server 2005 (when I get to use it in 2008 sometime ;-) ) to the Internet. Why? Simply because of the fact that I wouldn't want to expose a database server to the Internet. Sure, you configure a firewall and allow only the minimum ports and protocols required, but any network engineer would rather see a database server sitting in a DMZ, and rightly so.

    So, how would you use these cool XML web services features when your SQL Server 2005 box is sitting in its own DMZ? Well, simple, as the presenter of the session told me afterwards - you use ISA server to route the HTTP requests through. Great. Sounds like an extra product that needs to be purchased and a lot of hassle to maintain all these mappings. I'll code my own web service, thanks very much.

    Bottom line (all IMHO): use SQL 2005 XML web services if you require basic interoperability between apps on your local network, otherwise if you want to expose this to external, global apps, just don't go there.

  • Skype's SkypeOut (PC -> Phone) Service now in public beta!

    The P2P telephony service Skype has now officially launched a public beta version of its SkypeOut - PC to Phone service.

    PC-to-PC telephony will remain free of charge. The international rates for SkypeOut can be found at https://secure.skype.com/store/help.pricelist.html . To use the SkypeOut feature, make sure you have downloaded the latest Skype version. When you login to the Skype store, you can now buy credit for your SkypeOut calls.

    These Skype guys are doing a marvellous job!

  • Win32 API InternetGetConnectedState

    [DllImport("wininet.dll")]
    private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);

    public
    static bool
    IsConnected()
    {
     
    int connectionDescription = 0;
     
    return InternetGetConnectedState(out connectionDescription, 0);
    }

  • ASP.NET Impersonation on Windows 2000 - update

    A while ago, I posted about some problems I ran into when using ASP.NET code impersonation on a Windows 2000 Server (SP4). We even logged a Microsoft Support call for it.

    Anyway, as with most time consuming issues, it turned out there was a very simple solution. As it states in the Knowlegde Base article, the local ASPNET account should be granted the 'Act as part of the operating system' privilege (this does not seem to be required on Windows Server 2003). The KB article 306158 forgets to add that this will require an IIS reset for it to have effect.

    Logical if you think about it maybe...in hindsight.

  • About the VS.NET Express beta products

    Having watched Scott Guthrie's presentation at TechEd in Amsterdam last week about the VS.NET 2005 roadmap, and after having toyed around with some of the Express products, I do have to make some comments - and where better to vent them than a blog?