November 2003 - Posts
Oh, this is just SO satisfying. I have finished refactoring my app and it's so cool to see this working just the way I had dreamt it up. I was only able to do this from a lot of ideas I have collected from many of the presentations at Vermont.NET over the last six months - most notably for this particular solution: Ken Getz on Visual Inheritance in Windows Forms (April 2003), Carl Franklin on Objects (August 2003) (this really got me thinking about taking my use of inheritence to a whole new level) and Billy Hollis on Dynamically Loading Forms and other Advanced Object Techniques (October 2003). Hey whad'ya know - all three are INETA speakers, too!
I also had some prior education with reflection with a previous app that dynamically loaded ActiveX User Controls into a .net windows form application.
I am going to attempt to explain the basic setup here in case anyone might be able to learn from it. If you look at this in a browser (not your aggregator) you will see that I have color coded some of the objects to make it a little easier to explain.
I am creating a pluggable framework of test entry forms. These are a variety of different tests that are performed on building sites - making sure a factory doesn't sink into the ground or a road doesn't buckle or a bridge doesn't collapse.
Every test will have a few things in common - not just data entry, but functionality as well. So I have built those things into a base form and an associated base class. The base form lives is in its own DLL. The base class is in my Business Layer.
Then for each new test, I create a new form inherited from the base form and add to it additional controls that are specific to that test. I also create a new class that inherits from the base class. This new class also has it's own explicit functionality.
This is the whole point behind inheriting classes. So why did I find it so challenging? Combining the derived forms AND derived classes was a little daunting and took some experimentation before I understood how everything worked together. It felt to me something like that now famous “cog“ ad that Honda did.
When the user chooses to work with TestA, an instance of “FormTestA” is created. It gets what it needs from the base form. The base form creates the base class, then FormTestA creates IT's derived class and get's what it needs from the base class that the base form created. (Are you with me so far?) It is really fun to step through the code and watch the debugger go back and forth between the two classes and the two forms. Some of that coolness I think I may have had something to do with -- but most of it feels like magic.
Then the last trick was to make this really pluggable because we plan to add tests over time and all I want to do is throw another dll into the mix. This is where reflection comes in. Each test will has it's own dll containing a derived form and a derived class. That dll references the business layer and the BaseForm.dll. In the ParentMDI form, when the user selects which test to work with, I instantiate the specific test's derived form via reflection and then it does all of it's own work from there. THere is heavy interaction from the parentMDI form which calls functions that reside in the derived forms and classes. And it all just works!
It is just so much fun to finally have the tools (i.e comprehension) to create a solution that uses some of the techniques that used to make me dizzy. So Ken, Billy, Carl and a HOST of others - THANKS!! Oh, and always -- Deborah Kurata who dragged me into the world of Objects many years ago and continues to enlighten many on OOP. Thanks Deborah!!
From Gina Trepani over on misbehaving.net
The Pew Internet and American Life Project issued a report on the Consumption of Information Goods and Services in the United States yesterday. The report concludes that "There is a trendsetting technology elite in the U.S. who chart the course for the use of information goods and services." Within this elite group of techies, "wired women like tools to communicate, not gadgets to show off."
Check out at least this one section of the report for some interesting statistics.
I (and many other user group leaders) have been very fortunate to have publishers like Addison-Wesley, SAMS/Que, Prentice-Hall, O'Reilly, APress (oh am I forgetting anyone??) donate books to the user group. My husband refers to this as “the daily book delivery” though that is quite an exaggeration!
Today was a box from A-W. With some hot off the presses books. One I fear may never leave my office: A First Lookat ADO.NET and System.Xml v2.0. Well, maybe “A First Look at ASP.NET 2.0” might stick around for a while, too!
I was also happy to see the Jon Box/Dan Fox collaboration : Building Solutions with the Microsoft .NET Compact Framework: Architecture and Best Practices for Mobile Development
At PDC I made a new friend, Olga Londer , and the recent book that she collaborated on was in the box too! Microsoft Content Management Server 2002: A Complete Guide. This is the same book that Owen Allen was happily shocked to discover a few weeks ago.
So to my friends at A-W (and all of the others including Amy Sorokas (now blogging!) and to all of those brainy people who give up a good part of their normal lives to write these books: THANK YOU!
I had this problem when I installed vs.net 1.0 on my remote webserver. In fact, I wrote about it 1 1/2 years ago here (see 2nd entry) and detailed the fix here .
Somewhere along the way, I was led to believe that the first Service Pack on .NET Framework 1.0 fixed this problem. But I think not. I just finally updated my intranet webserver (exists for testing purposes only) and opened up the first website in vs.net 2003 and could NOT debug it. After going over the obvious (did I remember to install the remote components? Was I in the Debugger Users group?) I finally tried editing machine.config (according to the above link) and finally had success.
Damn! Why didn't I think of that first?!
READ Mark Pearce's comment. And please note I (Julie) am not a system admin! Purely a hacker when it comes to having to deal with that stupid server machine in the corner over there.
Update#2: Reset the processmodel in machine.config BACK to “machine”. I have always been an administrator - so that was not the issue either. What I finally did (thanks to a hint in Mark's comment) was look at the Temporary ASP.NET files folder on the webserver (c:\winnt\.net framework\xxxxxversion\) and added the ASPNET user into the permissions for this folder. I wonder why this was not done as part of the installation?
Last week a friend of mine called. She also happens to be the woman who was my very first ever consulting client 18 years ago and the relationship has evolved into a good friendship. She could not start up Windows XP. By the time I was able to return her call she was in the midst of what became a 4 hour phone call with Dell who was helping her out. This was a Dell laptop that was 8 months past its warranty. After these 4 hours and many more with further assistance, it became apparent that the system could not be restored at all or even reinstalled. My friend has since then lost so many days of work that she has decided to buy a new laptop and have that other one overhauled, if possible, and used as a secondary machine. She was so desparate that she couldn't even wait the week that Dell was quoting her for a new laptop and chose from one of the refurbished available machines she could order for overnight delivery.
The post mortem is that this irreconcilable problem was caused by a virus. This is a woman who I taught many years ago the importance of good backups and constant virus protection. Luckily the good backups are saving her butt today. And I know that she generally IS very good about updating her virus protection. However I learned that when she had the [now dead] box upgraded to Windows XP, the version of Anti-Virus that she had was “not compatible” with XP and her virus protection was left to the wind and then forgotten. I think that the information that is given by Symantec and other vendors is confusing to the faint-of-heart sometimes and they are scared into always buying new versions of the software when an older version most often works just fine on a newer O/S. So I'm upset that this is the main reason for this happening to my friend - to the tune of about $2500 and a little dismayed with whomever was entrusted to take care of her original upgrade to XP, leaving her so vulnerable.
Today is going to be refactoring day. (This has nothing to do with Whidbey - rather real refactoring)
My app that I am writing is going to have pluggable pieces. We are doing data entry and reporting for a variety of tests done out in the field.
So I have written this so that there is a base form and a base test class that each test's data entry form and associated class derive from. Currently everything is in one project - so that I could work through all of the logic. I only have one test created so that it's not a nightmare. Now it is time to break everything up.
I will be putting the base class and base form into one dll.
Then the derived class and derived form into it's own dll.
Then the main UI will be able to use reflection to grab the appropriate form dynamically out of it's dll and that form will call out to the base dll to define itself.
The [believe that] challenge ahead of me really is just getting all of the references set up properly.
It will be exciting (yes from a geek perspective) when it all works again after I have separated all of the pieces. It becomes, in my mind, something a George Rhoads kinetic sculpture (e.g. the one at the Logan Airport).
I generally try to avoid duplicating posts from others in the main feed of weblogs.asp.net, but this is important. Christian Weyer points out the MSDN article demonstrating how to host web services via Compact Framework.
I work out of my home office. I have a true network with a server setup so that I can emulate my client's environment - programming against a remote SQL Server and a remote IIS. I'd rather not get tangled up in the administration, but it's the price I have to pay. My biggest client is still using SQL7 and will wait for Yukon before upgrading and therefore I have stuck with SQL7 on my server all of this time, even using SQL2K client tools to access it (for a variety of reasons). I finally am giving in and upgrading my own SQL so that I can use SourceGear Vault (”Lonely Coder Edition”). The other thing I was holding out on was, though all of my windows forms apps are written in vs2003 against .NET 1.1, I hadn't touched my webservices or asp.net apps which are still against 1.0. So I just finally put .netfx 1.1 on the server, too, and will port all of the web apps as well. Then I get to move all of my online webapps over to Alentus' 1.1 boxes and also port all of my clients webstuff to 1.1 (which is already running SxS on their webserver). The only thing that I still really want to do but can't yet is get moved up to Win2K3 server. There has not been any real need to but I figure it's time. But my poor 4Gig SCSI hard drive is just about maxed out. I thought - aww heck, I'll just buy a new server box. Dell's got free shipping and all kinds of deals, but I just looked at how much I spent already christmas shopping and don't feel like forking over another $600 (that's after choosing 512MB Ram instead of 128MB). And I'd rather hold out for a longhorn box anyway. I even have a spare 40 GIG hard drive in my development box but it's not SCSI so I can't flip it into the other box. I'll probably just buy a new drive and start it fresh with win2k3 and then move everything over to that. These things only seem to be able to happen on Sunday nights. I can hardly find the time to set aside otherwise.
update: Planning to upgrade from SQL7 to SQL2000? Better read this FIRST! There is a known problem with the upgrade process and that link will enable you to download a fix.
This is for my friend Joy who seems to think that November is the ugliest time of the year in Vermont. (Besides she must be forgetting about mudseason!
I want to point out three problems that I got stuck on in a Windows Forms application. I kept thinking I was doing something wrong. But in fact, they are real issues. I will find time to check into this in Whidbey.
All three problems were solved by people who stopped banging their head on the wall (like me), and went a different route.
1) I could NOT get anchored controls from a base form to behave properly in a visually inherited form. Roland Wiegelt explains why this problem exists and how to get around it. Thanks Roland! [anchor, child, mdi, inherit]
2) A very useful feature in VB6, determining what action caused a form to begin closing (code directives, vs. application is shutting down vs. user clicked on the close (X) control on the form) was completely deprecated (i.e. gone - no replacement) in .NET. I found a nice solution written by Kourosh Derakhan on CodeProject that taps into the stacktrace to provide the same features. It's written in VB.NET but it's just CLR code, so just add a coupla “;”s and you've got the C# solution. There is also an article by VB MVP Bill McCarthy [that I missed] that he published during the Beta with a solution based on capturing a WndProc event on the form. [queryunload, unloadmode]
3) I spent hours and hours and hours fighting with the damned control box and forced RESTORE (sizing) on a maximized child window. My solution has NO NEED for a menu nor any need for the child window to be anything but maximized, but this control box (believe me every single propery related to it was set to false) forced itself into the spot where a menu might have been, causing constant vertical shifts in my MDI application. I found a newsgroup post where someone from Microsoft agreed that it was a problem and there was no workaround. So I finally gave in and added a menu that duplicates the functionality of my toolbar. It's completely redundant and will never be used. But it was the only way around the problem and nobody will ever really notice it's there. So it's not in the way. [mdi, child, restore, maximize]
More Posts Next page »