No more then a few paragraphs of things I want to archive (instead of try to remember)

Friday, June 22, 2007

Simple DataSet (DataGrid) to Excel

Below is a very simple DataSet (using a DataGrid) to Excel. The DataGrid, when rendered, is nothing more then an HTML Table. Microsoft Excel dose a great job of translating this to a worksheet.

TABLE == Excel Worksheet
TR == Excel Row
TD == Excel Cell


    private void DisplayPrimitiveExportReport(DataSet dsDataSet)
    {
        
// clear out and set the response stream
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Charset =
"";
        Response.ClearContent();
        Response.ClearHeaders();
        Response.ContentType =
"application/vnd.ms-excel";
        Response.AddHeader(
"Content-Disposition", "attachment; filename=ExcelReport.xls");

        
// set up the in mem datagrid
        DataGrid dg = new DataGrid();
        dg.DataSource = dsDataSet.Tables[0];

        dg.DataBind();

        
// render the datagrid to HTML
        StringWriter stringWrite = new StringWriter();
        
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
        dg.RenderControl(htmlWrite);

        
// output the HTML (from datagrid)
        Response.Write(stringWrite.ToString());
        Response.End();
    }



This same method can be used with Word (using a content type of "application/word").

Monday, June 11, 2007

Great looking WBT and/or CBT tool

Recently a tech friend of mine turned me on to yet another code generator (Subsonic) to handle DAL creation. What impressed me most about the demo that he sent me was not necessarily the code generator itself, but rather the tool that was used to create the demo. This is one of the most clean looking demos I've seen. The product is BB FlashBack, and it's from a UK company. You can find out more information at: http://www.bbsoftware.co.uk/bbflashback.aspx. If you are into WBTs (Web Based Training) or CBTs (Computer Based Training), this has got to be in your bag of tools.

Tuesday, June 5, 2007

Hot Key

For you hot-key lovers, AutoHotkey seems really promising. It allows for simple, yet powerful, programmatic scripting to perform send keys, run applications, provide status, and much more. The open architecture has spawned a script showcase. Very powerful and handy.

Also, there is a great write-up and macro for obtaining a printout of all of your Visual Studio hotkeys by the author of Coding Horror.

Web 2.0 PDF conversion

There is a new Web 2.0 PDF conversion service called KoolWIRE


(From the website):
Koolwire File Conversion Services are as easy as counting 1-2-3:

  1. Choose the file format output/e-mail address from the list

  2. Attach your file

  3. Check your inbox for the incoming KOOLverted file


You can attach multiple files, no matter their size, provided their extension is allowed (see right). Should you exceed the maximum size set by your e-mail provider, try and split your attachments into multiple e-mails.

Scrolling DIV

One very handy way to scroll content of any kind in HTML is a scrolling div.



<div style="overflow:auto; position:relative; width:150px; height:50px;">
    line 1<br>
    line 2<br>
    line 3<br>
    line 4<br>
    line 5<br>
    <b>testing bold</b><br>
    <u>testing underline</u><br>
</
div>

Sunday, June 3, 2007

AppleTV - tech podcasts

I just purchased an AppleTV and canceled my DirecTV subscription. I was hesitant at first, but just after a day, I know that I made the right decision. The FREE content available for my wife, kids, and I are staggering. Some of the tech video podcasts that I'm subscribing to are:



  • CNET TV

  • commandN

  • Diggnation

  • dl.tv

  • Hak5

  • MAKE Magazine

  • PaulDotCom

  • Webnation


Please comment on other tech podcasts that you know of.