CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Brendan Tompkins [MVP]

Blog First. Ask Questions Later.

February 2004 - Posts

  • We've GOT to Start a Company...

    So I went to a seminar this morning that was all about SQL Reporting Services.  It was, surprisingly, very informative and at a really good technical level.  Hats of to MS for choosing a knowledgeable vendor/partner who can actually give a good presentation. 

    Anyhow, the presenter was asked if there are any tools out there for converting a Crystal .RPT file into an .RDL file (RDL is an open, xml format for reports within SQL Reporting Services).  His response was that there are most likely companies working on such things, and that his company is looking at the problem of converting crystal to rdl.  His words were that such a tool would be the “Silver Bullet” for the reporting market.  I'll leave you to ponder connection between Crystal and scary half-man/half beast monsters that you can only kill with silver bullets, but the general consensus is that a simple tool to convert, or at least assist in the conversion of Crystal to RDL would be a killer app.

    I'm no longer interested in starting companies, but this is the kind of opportunity that tempts me.  Sure there are many many issues here, legal issues among the biggest. Is it legal to create such a file format conversion tool?  If not, is there some intermediate format that the conversion tool could work from?  How many skunk works projects/companies are out there doing this currently?  How far along are they?

    Like I said, I'm not really interested in starting up companies anymore, having been down that road a few times before. But I am interested in having such a tool at my disposal.  How about an open source project?  Anyone interested in working on something like that? 

    -Brendan

  • A Simple Web Progress Bar...

    Looking for a BusyBox control? Use this one here.
     

  • .NET Custom Config Sections

    .NET .config files are a nice but limited way to configure all kinds of .NET applications.  They're especially good for configuring stuff that can be boiled down into simple name/value pairs, like database connection strings, directory locations, etc.  I've found that when you need to configure an application with more complex data, like categories of arrayed name/value pairs for example, config files become a bit unwieldy. Often, this kind of thing gets put into the backend data store, or in some other persistent storage, such as XML.  But I recently had a need to store some more complex configuration data, and because of its nature, I couldn't store it in the Database and I went looking for a way to customize .config files.

    Thanks to my friend Brandon Boyd's example, I ended up adding a custom configuration section to my .config file.   This approach let me define a new section in my config file, which I could use to add multiple configuration items.  I could then treat these as an array in code. 

    The specific task at hand was to store a list of address to send notifications when the database has certain problems, like timeouts, etc.. Obviously storing this in the database wouldn't work.  So to make this really simple, you only have to do two things:

    1) First you have to declare your new section's group and name.  Add a Section Group and Section Name to the <configSections> element of your config file to do this.  The Group and Section “Name“ property will become the XML Element you use in your config file.

     <configSections>
      <sectionGroup name="ExceptionRouting">
       <section name="RoutingList" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
      </sectionGroup>
     </configSections>

    2) Add the configuration section using the named elements.  Within your innermost section, you can have name/value pairs.  Here's mine:

    <ExceptionRouting>
      <RoutingList>
       <add key="OLE DB provider 'MSDASQL' reported an error." value=“btompkins@vit.org,bboyd@vit.org"/>
       <add key="The timeout period elapsed prior to completion of the operation or the server is not responding." value="btompkins@vit.org"/>
       <add key="General network error. Check your network documentation." value="btompkins@vit.org“/>
      </RoutingList>
     </ExceptionRouting> 

    Once this is set up, you can use the GetConfig method to get back your name/value pairs.  As you can see, I've keyed my routing list based on the Exception.Message text that I'm interested in routing. Now, I can run all Exceptions through a method like the one below, which will determine if the given exception needs to be routed to someone's inbox.

    public static void RouteException(System.Exception ex)
    {
       NameValueCollection nvc =  (NameValueCollection) 
           
    System.Configuration.ConfigurationSettings.GetConfig("ExceptionRouting/RoutingList");

       if(nvc[key] != null)
       {
        
    string [] routes = nvc[key].Split(new char[] {','});
        
    foreach(string strRoute in routes)
         { 
              // .. Send Message Here 
         }
       }
    }

    -Brendan

  • How Bad are SQL Server Locks?

    We've got a SQL Server 2000 box that keeps crashing every night, when the DBA group runs a job.  Now, this same SQL Server is being used from Crystal Reports, running from our public web site.  Add one more bug to your list for Crystal for .NET:  it seems to leave (hundreds of) locked  processes in “sleeping“ status.  We think this is happening when the Crustal engine “Cannot obtain a free license.”  My wild guess is that Crustal is not properly closing the connection when this happens.  Anyhow, I've never been too worried about this, since in my experience locked processes in SQL are an everyday thing, and although certainly bad, not something that should crash a server. 

    Well, the DBA came in today pointing the finger at these locked processes.  Her reasoning was that when the server crashes, she gets an "out of memory" error, and all these locks must certainly be taking up memory so the problem must be the locks. 

    Now, I'm not so hasty pointing fingers, but her explanation seems unlikely.  If these hundred or so locks could be taking up the lionsshare of the 2G of memory this server, SQL Server 2000 would have some serious problems. 

    Anyhow, my question is this: How bad are locked processes anyhow?  Are they something to worry about?  Could they possibly crash SQL?

    -B

  • Calagari TrueSpace 3.2 For Free

    It's circa 1997, but what do you want for free?

    “trueSpace3 is a 3D authoring tool which Computer Graphics Magazine described as: "a remarkable program that stands out for its modeless interface and price-performance accomplishments....there's no question that at a suggested retail price of $795, this program delivers value that is tough to beat." Now you can have this remarkable 3D authoring tool for free!“

    http://www.caligari.com/products/truespace/ts3/

  • SQL Server Reporting Services - Second Impression

    Thanks to Scott and Derick who helped me understand SQL Reporting Services a bit more.  I didn't install the samples, until today.  Scott pointed out that there is a WebControl that will allow you to use a rdl report from a Web app.  The WebControl just renders an IFrame which pulls the URL from the reports server.   That's fine, and I managed to get it to work fairly easily, except that I had to use the other sample, RSExplorer to find out my report server path to the report and get it correctly entered.  

    Anyhow, I'm pretty excited about the Potential for the tool, but I'm not going to convince anyone here to switch from Crystal with what I've seen so far.  As a matter of fact, I hate to say it, but Crystal still has one big advantage over SQL Reporting Services, and that is that a developer like me can deploy a report without worrying about setting up an additional server environment to do the report rendering.  Now, there's a caveat to this, because Crystal for .NET does in fact set up an additional virtual server for you when you run a setup and add the Crystal .msm files.  And this process is so buggy, and hard to work with that developers might opt for the manual setup of SQL Reporting Services anyway.  Add to that all of the other Crystal bugs, like temp files filling up, strange permission problems, etc, and it may be a no-brainer. 

    What I think we need is a stand alone runtime for the simple deployment of a report.  All it would need would be to render a .rdl report at runtime.  No scheduling, etc.  What would be really cool is if this could be an optional component of the .NET framework that I could simply add to a web project...  Another thing that would help would be a conversion tool for Crystal reports to .rdl files.  Anyone know of anything in the works? 

    -Brendan

  • SQL Server 2000 Reporting Services - First Impression

    I installed Reporting Services today... The media part of the install is a slightly confusing, because one setup app is used to install the clients for Visual Studio AND the server components for SQL Server 2003.  When I installed the server components, it barked at me for not having Visual Studio on my server machine.  I ended up not having to install it there, but this wasn't entirely clear from the setup.  Of course, I never read the readme doc, so I'd imagine this is all covered there.  The architecture seems pretty cool.  It looks to be very scalable, by putting bits and pieces on different servers.

    Once the server was up, I installed the clients on my dev machine, and quickly created and published a report to the report server.  It's very straightforward, and intuitive to use. Especially if you've had any experience with Crustal. I was able to get to the reports, schedule them to run, and notify me by email when they finished, ala Crustal Enterprise.

    What I expected to find, but didn't, was a way for me to bring a report into an existing web project.  I thought I'd see a user control to allow me to pop my report onto an web form.   I also expected a way to use the report without having to publish it to the reports sever.  I'm not done looking, but if there is such a thing, it's not entirely obvious where it is or how to use it...  Am I thinking about this thing the wrong way?  Am I missing something?

    Brendan

     

  • Dynamically Adding <HEAD> Content with ASP.NET

    I recently came across a situation where I needed to dynamically add HTML content to the <HEAD> section of every page on our site.  I needed this, for a couple of reasons. 1) I wanted to allow users to dynamically specify different style sheets to apply to the entire site.  2) I had to import some .HTC references whenever a control on a page needed to use a sticky draggable div control.

    The first thing I tried was to simply give my <head> tag an id and the runat=server attribute.  This way, I could include a method to my site PageBase class that pops content into the <head> tag.  By the way, PageBase is simply a class that inherits from System.Web.UI.Page, from which I base all of my aspx classes.  If you're not already sub-classing a page base for your app, you may want to look into this.  Anyhow, this worked, but had one MAJOR drawback...  The Visual Studio IDE would remove the runat=server attribute from my <head> tag, whenever the view was switched to HTML or when the page was saved.. Well, I couldn't deal with having to remember to add it back every time I saved, so I went looking for a new approach. 

    The approach I came up with involves adding a couple of methods to my PageBase Class to register any content I want to have appear in my HEAD section:

    private Hashtable m_registeredHeadContent;

    public void RegisterHeadContent(string key, string content)
    {
       
    if(this.m_registeredHeadContent == null) {
           
    this.m_registeredHeadContent = new System.Collections.Hashtable();
        }

       
    if(!m_registeredHeadContent.ContainsKey(key)){
           
    this.m_registeredHeadContent.Add(key, content);
        }
    }

    public string RegisteredHeadContent
    {
        
    get
        
    {
            
    string strReturn = null;
            
    if(m_registeredHeadContent != null)
            {
                
    foreach(string s in m_registeredHeadContent.Values) strReturn += s;
            }
            
    return strReturn;
        }
    }

    So, now whenever I want to add something, like an HTC import, I just add a call to the “RegisterHeadContent” method from my ascx controls or WebControl.  Now how to get this content into the HEAD section of my page.  You really have two options, add a classic style server tag, like so to your <HEAD> section:

    <%=RegisteredHeadContent%>

    or you could create a control deriving from System.Web.UI.HtmlControls.HtmlGeneric control, drop on your form in your <HEAD> section.  This control needs to retrieve the RegisteredHeadContent from your PageBase class.  I created one, which my friend Brandon Boyd aptly named for me “HtmlHeadContentInjector“ ;)

    public class HtmlHeadContentInjector : System.Web.UI.HtmlControls.HtmlGenericControl
    {
        // Needs this constructor
        public HtmlHeadContentInjector(string tagname){}

        protected override void Render(HtmlTextWriter writer)
        {
            string headContent = ((PageBase)this.Page).RegisteredHeadContent;
            writer.Write(headContent);
        }

        // Override, don't render atts
        protected override void RenderAttributes(HtmlTextWriter writer){}

        // Override, don't render end
        protected override void RenderEndTag(HtmlTextWriter writer){}
    }

    Which option you choose is up to you.  Personally, I don't like poking too many holes in my ASPX pages using the <%=%> syntax, but don't have any hard evidence against this method..

    -Brendan

  • Cool AD Browser Posted on Code Project

    Sibster, who doesn't give his real name, wrote a cool article and sample code for an Active Directory Tree browser in C#.  Very simple, but handy and has some good example coding for AD access...

    -Brendan

More Posts