Mysterious.e's profileMysteriousE's spacePhotosBlogLists Tools Help

Blog


    July 25

    asp.net GridView Header tooltips with firefox

    I was looking for a solution to get ToolTips on the ASP.net gridview header links.
     
    Couldn't find what I wanted, so here is the solution:
     
     
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                foreach (DataControlFieldHeaderCell Cell in e.Row.Cells)
                {
                    if (Cell.Controls.Count == 1)
                    {
                        //get the containing field
                       
    
    
                        LinkButton LinkButton = Cell.Controls[0] as LinkButton;
    
                        if (LinkButton != null)
                        {
                            LinkButton.ToolTip = Cell.ContainingField.HeaderText;
    
                           
                        }
    
                        ImageButton ImageButton = Cell.Controls[0] as ImageButton;
    
                        if (ImageButton != null)
                        {
    
                            ImageButton.ToolTip = Cell.ContainingField.HeaderText;
                            
                        }
                    }
                }
            }
        }
    

    Here is what the code does:

    1. The method is called on the 'RowDataBound' even of the gridview
    2. Check to make sure we are only checking the header
    3. Loops thru all Row.Cell as DataControlFieldHeaderCell. The 'DataControlFieldHeaderCell' object contains a reference to 'ContainingField' - which has all of the information such as HeaderText, FooterText, etc.
    4. Cast the first child control as ImageButton. If successful, then set the tooltip to Cell.ContainingField.HeaderText.
    5. Cast the first child control as ImageButton. If successful, then set the tooltip to Cell.ContainingField.HeaderText.
    October 02

    Galactica

    Just wanted to let you guys in hollywood know that for the first time in 18 years I am planning to follow as weekly television show this season. 
     
    The last show: Cheers
    This next show: Battlestar Galactica
     
    I like good science fiction - but good science fiction is 'Stranger in a Strange World' (despite my personal objections), or '2001', or the exceptional 'Wrath of Kahn". The first two are literrary classics - but 'Kahn' is a personal favorite. They all challenged what I belive in, and still do to this day. Through in AI and Minority Report for good measure - that's what I like.  
     
    Why Galactica? That's a good question. I knew it was being revived, but it was on the SCI-FI channel. I saw a few episodes on the 1 am rerun and couldn't quite figure it out. The first expisode I noticed was this tough blond people kept referring to as 'Starbuck' and then as Kara and I was truly confused. I know 'Starbuck', 'Apollo', 'Adama' - but now this Starbuck was Kara, and later I found out this 'Apollo' was Lee.  I remember seeing this episode where this glstening blond - no sweating - is walking down a corridor with her hand on her side arm - looking just a bit confused. As it turns out she was assigned to kill another officer, but that didn't come to pass.  The first full episode I saw was Black Market. It was okay, was wondering about why some characters with long hair walked around in suits and others in military uniform. But after that I saw what I now know as 'Scar' and I was rivited. And through out the course of seeing these episodes I kept watching Adama. The actor was familiar, but I couldn't quite place him. Then it clicked - that's Edward James Olmos. I was sold immediately. If this was good enough for him to appear it then it was good enough for me to watch. But there was only one problem - this was march of this year and Galactica season two had just wrapped up. Then I found it on iTunes ... and I consumed the miniseries and 33 episiodes in under two weeks.
     
    At the end of the day it's very good, highly relevant story telling.
     
     
     
    August 08

    Lost in Space

    I watched the Apple WWDC this evening.
     
    On the whole, only a few neat things to look at: TimeMachine and Core Animation.
     
    Time Machine is fantastic. It the first time I've seen a next gen desktop/shell feature that will have an impact. And knowing Apple, it'll will ship. (WinFS. ERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR!) Why do I call it next gen? Look at the UI. It't totaly associative. You point at your finder window or time machine-enabled, click the 'Time Machine' icon and your in a 3d time line space that has simple controls that follow the 'Don't make me think' paradigm. Wow! That's cool. Sure, people say ... oh yeah, Vista has that feature. Ah ... no. Sure it, it has volume shadow copy turned on and snaps backup. Then there is the ever so snappy Previous Versions button - which opens up the tab. And there is absolutely NO predicatability for when a file is backed up. Nothing attractive or intuitve about it.
     
    Time machine works on Core Animiation - which looks like the WPF 3d animation parts. But look, they've follwed an itterative path. Core Audio, Core Image, Core Video and now Core Animation. All delivered iteratively. And to top it off, Time Machine is a a poster boy. Is there any poster-boy app that every one can touch for WPF? Nope. Seen lot of demons on Channel 9. Seen some neat ideas. Does Vista have any thing that runs on WPF. Not sure, but my guess is no. Sure DWM uses it. Does anything else?
     
    Windows Live. Nice if it makes Windows more valuable. Hey look, the have a deskotp app that plugs into Live Mail. Does it run on .Net 2.0. Nope.
     
    And then there is Vista. The Microsft nightmare project. The Microsoft moon shot. Lost in space thus far. With all of the nice things, and some of the things are very nice. It's twice late and half there. WPF and WCF are there, but does the end user know that. No. Shadow copy is there. The interface to it sucks, but it's there. Search is there. It's slow and nothing that WinFS could have been, but atleast putting the search in the sart panel makes since. And I'll admit, the Vista start menu is actually useful - go figure.
     
    Here's the point and it's something I'm trying to learn: itterative developement and feature condensation are paramount if you want to expand abilities of the end user. Vista has some of these things and flirts with a few of these with Apple knock-off apps, but the Core serives in OS X and Time Machince illustrate this the best. Ship it as simple and useful, make it more powerful as you go.  
     
     
     
     
    July 18

    Remove PC-cillin 14 for Better Vista Performace

    I noticed a few weeks ago that MS shipped a shim for AVG. That's interesting. We'll, today PC-cillin was running SO BAD that I banished it from my Beta 2 installation.
     
    And what a savings.
     
    Vista has become useful again with out it. Not only is my processor usage down but memory usage is down to. IT was that when using Vista with PC-cillin memory with no windows open was about 1050 MB. Without PC-cillin and AVG it rests with no windows open at about 780 mb.
     
    Looks to me that we a another instance of bad software making the users life miserable and making MS look bad. I don't think I'll try Trend Micro anytime soon. 
    July 09

    SchemaImporterExtension and Typed DataSet - ASMX 2.0

    It's kind of late and I spent a better part of the evening (I have not life ... yet) working on getting this figured out, but I wanted to share this becasue I cannot find it out there. And I'm assuming if you've gotten this far you know what you are looking for as this is more of a specialty subject.
     
    How to use SchemaImporterExtension to map  Typed DataSet to a custom web service client proxy in ASMX 2.0?
     
    It's acutally not to hard. We'll assume a typed dataset with the following parameters:
     
    1) Namespace = http//tempuri.org/typeddataset.xsd
    2) The CLR fully qualified type name= MyNamespace.TypedDataSet
     
    And here's the code (in lazy word html):
     
    public override string ImportSchemaType(System.Xml.Schema.XmlSchemaType type, System.Xml.Schema.XmlSchemaObject context, System.Xml.Serialization.XmlSchemas schemas, System.Xml.Serialization.XmlSchemaImporter importer, System.CodeDom.CodeCompileUnit compileUnit, System.CodeDom.CodeNamespace mainNamespace, System.Xml.Serialization.CodeGenerationOptions options, System.CodeDom.Compiler.CodeDomProvider codeProvider)

            { //reference the assembly

                compileUnit.ReferencedAssemblies.Add("MyAssembly.dll");

                //register the namespace

                mainNamespace.Imports.Add(new System.CodeDom.CodeNamespaceImport("MyNamespace"));

                //verify the xmlschematype exists

                if (type != null)

                {

                    //create clrtypename placeholder

                    String ClrTypeName = null;

                    //loop through the schemas in the schema type

                    foreach (XmlSchema Schema in schemas)

                    {

                        //verify targetnamespace matches the typed dataset namespace

                        if (Schema.TargetNamespace == "http//tempuri.org/typeddataset.xsd")

                        { //set the ClrTypeName to the fully qualified name of the dataset class

                            ClrTypeName = "MyNamespace.TypedDataSet";

                        }

                    }

                    //verify ClrTypeName exists

                    if (ClrTypeName != null)

                    {

                        //return the ClrTypeName

                        return ClrTypeName;

                    }

                }

                //call the base method

                return base.ImportSchemaType(type, context, schemas, importer, compileUnit, mainNamespace, options, codeProvider);

            }

        } 

     
    And a few pointers:
     
    1) Don't be overwhelmed by the strangeness of the code. The job of the SchemaImporterExtension is to map Xml Schema Names to CLR Type Names. That's it.
     
    2) You must over oad the  method that has the 'XmlSchemaType'  as the first parameter as the dataset will be a complex type and will be mapped using this method.
     
    3) You identify the typed dataset by looking for its namespace (http//tempuri.org/typeddataset.xsd) as you floop through the schemas  in the schemas ( a collection of schemas) parameter. If it's contained, it's needed by the proxy generator. It may be called for by the proxy generator several times during creation of the proxy.
     
    4) If a namespace match is found return a valid  CLR type name for the dataset. In this case it is typed dataset and the clr  type name = 'MyNamespace.TypedDataSet'. If not you can return null or call the base method.
     
    5) You'll want to reference the assembly and import the name space using the codedom parameters as well.
     
    Well that's it. It's late and today is my birthday so I'll be with the family this afternoon - so I need some sleep.
     
    I hope to write a more complete entry at somepoint, but I dont' know when I'll get to it.
     
    I hope this helps.
    July 07

    Fun with Pipelines and Biochemistry

    I rembmer in late 20004 reading about EDRA (nee 'shadow fax') and remarking how elegant the pipeline/handler solution was. What was remarkable was how simlar it is to mechanism you see in biochem, such as the inner workings the ribosome. Essentially, at the pipeline does is provide an exexution 'assembly line' where you have an object and it passes through a series of 'handlers' or 'filters' that can verify or perform work on the object. At the end of the pipeline there can be often times a 'targe' which is usually an object that executes another routine. When using a pipeline with a target, the handers usually act to do validation and/or transformation. Also in this senario the object being passed along is called a 'context', as it contains the object along with error traning and other members. Anyway, using a context object allows the target to test for errors and if they exist, then execution of the target is prevented.
     
    I've fooled around with them before but have never quite got them down becasue OOP is such a hard discipline to master. And as with learing any discipline, it get's harder before it gets easier. We'll. it because I'm turing the corner and things are starting to get easier. It actually fun to start programming again, only the kinds of programming you can do with OOP are much more interesting.
     
    Anyway, I digress. I have been working on a project, a secret plan, to destroy!... okay, to do something xml/object transformation using a database. At the heart of the storage system is a pipleine system that will allow me to 'bolt on' security and validation handlers as needed without disrupting the database access logic. Nice, very nice. Okay, it's nice if your a computer geek that has an M.S. in chemistry, or maybe just a geek an general.
     
    Currently the project is codenamed 'Reflection'.
     
     
     
    June 27

    Meet me half way ...

    A project I have been working on requires a fair amount of asp.net caching  to make it perform smoothly as the data will be called from a central web service. However, it's my understanding that if you put something in the cache that has anything IEnumerable it will be subject to threading 'issues'. Well, I think I have a solution: caching the serialized binary array and deserializing per thread. This porvides each thread reqest with it's own unique copy.
     
    Will it work? I'm thinking that with a basic lok per deserizliation it just might. I'll sitll have to look for racing conditions but I've tried it and it seems to work so far. 
    June 24

    WinFS ends ...

    The inevitable has come and Microsoft has ended the WinFS project. And although that doesn't mean that Microsofts goal of creating Integrated Storage in Windows has been shelved permanantly, it will most likely be a while before Microsoft wants to discuss any new direction.
     
    Here is the link on the WinFS blog:
     
     
    I cannot get over my initial disapointment, though I must admit that I only thought it logical for the WinFS tech to makes it's way into SQL Server. But there won't be a beta 2, and that means it's gone. Done. Over.
     
    I am reminded of ObjectSpaces however. It advanced to nearly beta 2 status and was then discarded, er ... 'folded' into WinFS. And then a few months later came LINQ and the rest is history. LINQ became the direction Microsoft wanted to go because of it's abstract nature.
     
    So might there be another take on integrated storage lurking out there Microsoft? Perhaps.
    June 20

    "Vista Hurt Me!" or "The Not Ready for Prime Time Players"

    Well, for all its quaint charm easy-on-the-eye good looks, Vista finaly bit me. I installed some active X control and IE won'twork. It'll start, but it never loads pages and gobbles up processor time. I'm on the third reinstall. Yes, I do take my key files - put them on an external hard drive. But it's annoying. Haven't had this much 'fun' since Windows 95. The 98' beta was smooth, the NT 5.0 beta was smooth, and XP was smooth - but this is something else. Hopefully Microsoft is done adding features underneath the hood. But there is a concern. WinXP was a 'fit-finish' release on top of 2000, it's NT 5.1. Vista on the other hand is NT 6.0. The biggest conern has got to be drivers and stability. It isn't stable. ANd it uses just a bit too much ram.
    June 11

    "Vista Performance is Better" or "I don't miss XP SP2"

    Last thought for today.
     
    Vista does consume too much memory. If I load up a WPF-based game it downs about 300 MB per copy. That would be smaller if I could run at lower resolution, but Explorer would need to be WPF-based for it to look decent, and that's not going to happen in this release.
     
    But, tangible performance takes XP SP2 and 'wipes the floor with' it as one could say. Yes it's a hog. Yes, it uses a lot of processor time and I'm on a single core Inspiron 9300 (that old computer had to die in Oct. 2005 instead of Feb. 2006 - so no Core Duo. Next time ....) But the system stays very responsive. Windows are at my command. I can do Flip 3D. And yet it was pegged at 100% for a while doing a background task. What ever the core OS guys did to make this possible, man - you guys should be applauded. Under XP the same load had me diving into the task manager kill processes or lowering their priority. Not any more.
     
    This is nice, and since it's an 'as it should be' feature many people wont notice.
     
    One thing I am thinking about doing is getting me a decent 512MB to 1GB Flash drive and see if I can use SuperFetcha and ReadyBoost with it. It'll just blug it into my USB 2.0 up. That will have to wait a week or so. One thing I have read on the web is that you will ned a performant one for it to work. My hope is that I can atleast get some memory back becasue of SuperFetch.
     

    "Windows Vista R1" or "On the Road to Cario"

     
    Yes everybody, we're still on that road. I know, I know "Cario was a set of object technologies that became part of Windows 2000.' And that's all true. But in reality, it's some sort of Grail Quest that some of the upper eschelon folks at MS have. I cannot say that I don't blame them. For thiose that want to disagree, look at the PDC 2003 WinFX, now known as .Net 3.0, poster. (Well, as it turns out the fancy MSN spaces phot browser doesn't really work with Vista. Let's see if we can find it online.) Here you go, it's one of the first slides of Don Box's Indigo (WCF) ppt from 2003.
     
     
    What do we have:
    • Avalon - advanced object presentation sytem using GPU rendering and vectors. Flash on steroids for the desktop!
    • Indigo - advanced network protcol designed as next gen WSDL service plus just about most everything else. Kind of a 'There can be only one!' model for network rpc.
    • WinFS - object based files sytem for local storage. Take a file sytems and a database, put them in a blender, that's what you get.

    Two out of three are shipping in Vista, and while these Avalon and Indigo are new technolgies (managed-coded based and thank God for that!) they are just the next in a line of existing technologies. Avalon replaces GDI and GDI plus and the Win32 control model. Indigo replaces dcom, and .net asmx and remoting as tne network rpc of choice. But WinFS is new and that I know of not been done before in a consumer oriented OS. (If so, tell me about it.) WinFS is the actualization of the OFS concept. Here's the history in brief. They have been at this for a while and I think the time is right for it to be done. Processors are scaling up to multicore designs that are mainstream. Dual Core is 2006, Quad Core is 2008. Hard drives are scaling up towards a 1TB on the high end and over 100G for notebooks. Database technologies are being commoditized thanks to MySQL and other players, and XML is becoming the best way to represent objects as text. Put all of these things in a blender and you have the right environment to build WinFS. 

    It's what's missing from Vista and part of the reason that Vista is so sparse on new features that are tangible. Perhaps Project Orange will change that. But the basic seach features are there and there have been signifigant upgrades to NTFS to allow for WinFS. If you want to couple a file and database system together and you want them to be in sync, you need transactions. Thus, transactional NTFS.

    And that brings us to "Windows Vista R1". While the PDC 2003 vision was grand, it wasn't really doable. Just as you cannot build a house on a concreatre foundation that is wet, you cannot build an OS on technolgies that are unstable. At one point before the Reset the Explorer was being rewritten in managed code and based on Avalon. When Avalon changed, Explorer broke. Repeat cycle. So the Reset happened and Vista became about getting the new technogies in place for MS to build on. What you actually see in Vista is just a courtesty from MS in my opinion, as there are many new changes to come in the visual department down the road. So hopefull the Vista R2 in 2009 (est.) will complete the journey by adding WinFS and hopefully, and this is just a hope, an Avalon rendered shell that actuallys look great at high dpi.

     

     

     

     

     

    "Vista Beta2: The New Finder" or "The 'up' button is dead. Long live the bread crumbs."

    I know. It's explorer.exe, but when Microsoft put in triangles instead of the usual +/- graphics for expanding folders, I just had to start calling it 'Finder'.
     
    Anyway, this has some really nice features. Let's list them ...
     
    1. Favorite Links - Yep, I'm pretty sure that this is in OSX, but it's nice to have anyway. All you have to do is drag a folder under the 'Favorite Links' panel - basically the whole left panel of the Finder, and Vista will make a short cut for you to that folder. As hard as XP wanted to be helpful, it never did this one simple thing. This is a life saver. I wont have to build out a quick launch toolbar anymore to links such as the ASp.net compilation directory, or  Inetpub, or VS Project folder. I can just put it in the Finder and it rembmers. Links to 'Document', 'Pictures', 'Music' and "Recently Changed' are included.
    2. Folders - Here is where the 'Finder' thing comes into play. See it there at the bottom of the 'Favorite Links' panel. Well, that the Explorer tree navigation in all it's glory and it's one of those expandable panels. Except for the triangles, and that makes it the whole application now referred to by me as  Finder. But you know what to do here.

      Now I have got to admit MS did their homework here and just made this combination work of Favorite Links and Folders work. But that's not the cool part. Read on.
    3. The 'up' button is dead. This is causing hysterics by some on the the Channel 9 forum. Well, the new Finder breadcrumbs are VERY COOL. Once you get the concept, you wont miss the 'up' button at all. And in my opinion, this is better than the MacOS Fidner becasue it doesn't eat up the screen. The addres bar is now a bread crumb of folders. And you can click on each one to go back, just link in a web page. And since it's anchored to a sort of 'MyComputer' view, you can go back all the way to the top. But, you can view subfolders for each bread crumb by clicking on the triangle on the right of the bread crumb. You can navigate from this list accordingly.

      This is elegant and fast. The 'up' button and the explorer tree were never this easy to work with, and that's the best that XP has to offer. The only thing you cannot do is drag/drop to bread crumbs. Now that would be nice.

    So that's it. The new Finder rocks! It easier to work with and simplier. MS has cut out the task panes and some people will miss them, but after an adjustment I don't think most people will in the long run. The Finder's job is to navigate files, not to help you print out that lovely photo of all you favorite Battlestar Galactica characters.

    Update: Some of the Task Pane like actions can now be found at the top, just below the address bar.

     

    "Windows Vista B2: The Adventure Begins" or "Man, That's a Lot of RAM Used!"

    Hum ... Never really blogged before. Mainly because at the age of 30 I decided to to a massive career change and go into web development, thus programming and all things ASP.net and related. While that may not answer any important questions or even raise any - needless to say if you want to change careers at 30 and you don't want to go back to school - I have an Masters so I can read a book - then you have to read and program recursively. So I haven't left the Bat Cave very often except to do some detective work, and the Mysterious E out fit is still in design (should I choose Black or Dark Gray?), but seeing the sunshine is a good thing and relating ones experiences can be cathartic (one of the definiations at Dictionary.com is 'laxative'). Ergo, why not.
     
    So let us dispense with the sophosticated rehtoric (but not the poor spelling)  and "talk down to earth in a language that everyone here can easily understand".
     
    Windows Vista Beta 2 - it uses a LOT of RAM!
     
    Down and Distance:
     
    I have 2 GB of ram. I have only this IE window open as I write. My memory usage is 1090 MB of ram! Okay, I am running IIS 7 in the background. Let's see if we turn ofF IIS ...  well, it's the same. So 1090 it is. Now I've been booting to 890. Most of the time I'm at 1200.
     
    Now lets contrast that with XP.  An XP media center edition will boot to about 400 and normally run at about 500. So unless this beta is chock full of debug code and some overly eager services, were looking at a just over 50% increase in memory usage. 
     
    Probably the biggest user of RAM is dwm.exe - the 'miracle' of a pretty desktop comes at a price. It's using  132 MB at 1920 by 1200 on my machine. Life at 1920 is a whole other entry. Explorer chimes in at 50 MB. But there are a LOT of other services consuming in the 5-10 MB range. Infact there are more services 'than you could shake a stick at' so to speak. Ther are over 140 services in my install and between 70-80 are running. I wonder, is this were all the programs that were evicted from kernel mode finding a new home?
     
    So if you want to try Vista B2 you need 2 GB of ram.