Why CAB? A business manager’s perspective on [Microsoft] ’s CAB
As I’ve been working with CAB I really like this initiative. I’ve seen that it’s hard to convince managers higher up the chain of this new way of working because they can’t see anything different. In the end it’s still an application that runs like another, but it’s the way you application runs that is very different. Maybe this will help to get you some valid arguments and win the conquest.
http://www.ideablade.com/CAB_Webcast.htm?reffer=CodeProject
Free education you just can’t say no to!
UPDATE: Added the presentation to download below.
I found through a blog post of Greg Duncan a site (Research channel) that has a video of 3 hours on how to design class libraries in .net.
“Produced: January 22, 2007
Description:
This class presents best practices for designing frameworks that are reusable
object-oriented libraries. The guidelines are applicable to frameworks
ranging in size and in their scale of reuse from large system
frameworks to small components shared among several applications. They
started as a small set of naming and design conventions, but have been
enhanced, scrutinized, and refined to a point where they are generally
considered the canonical way to design frameworks at Microsoft. They
carry the experience and cumulative wisdom of thousands of developer
hours, over three versions of the .NET Framework.
Speaker(s):
Krzysztof Cwalina, program manager, .NET Framework Team, Microsoft
Runtime:03:40:56″ [Description leached in full]
Sadly enough I didn’t see any possibility to download the video so I could watch on the train on my way home…
Download here: http://suddenelfilio.net/cwalina/14050.asf [461 MB] (I hope I’m not braeaking any copyright rules)
Source: The ResearchChannel - http://www.researchchannel.org/prog/displayevent.aspx?rID=11087&fID=2740
Running an Ajax ModalPopup from code behind
The ajax control toolkit contains a control called ModalPopupExtender. This extender allows you to create a dialog-like interface for webpages.When you use it like it is meant to use you would set a TargetControlID and a PopupControlID. The first is the control that will trigger the popup to show while the latter is the control that will be shown. That’s already nice, but what I needed recently was to show the result of a certain query in such a popup. This means that when I click the control that is pointed as TargetControl it would do a postback, execute some serverside code and then show that result in the browser. This is logical you might think but the problem is that when you click the control assigned to the extender as TargetControl you’ll see the popup immediately and only then the postback occurs.Okay how to solve this? Well add an additional linkbutton for example and make sure it is visible but has not text. You can then set the TargetControlID to this “no-text” linkbutton. Since there is no text, you can’t see it and since you can’t see it the user won’t click it. Nifty
Next you can have a second linkbutton the performs a callback to the server and executes some serverside code. If you put this linklabel in an asp.net ajax updatepanel you won’t notice the callback and you can use the ProgressIndicator functionality in asp.net ajax.At serverside you can perform some code execution and for example set a Label’s text proeprty to the result. Finally you can access the ModalPopupExtender and call the Show method that’s available this will cause the popup to appear.I really like this way of working because it allows for a nice userinterface experience and interaction with user.
*** UPDATE: I am sorry for all of you that wanted the sample code, with moving to this blog I lost it when my old blog went offline. I cannot provide you with the code anymore ***
DesignMode + UserControls = HELL!!!
Today I had to work with some usercontrols in our project. The problem was that we do some database access from within the constructor. For all this to work well everything needs to be in the right place and configured correctly which is not the case in design mode. So when I tried to open a user control at design time I got various errors because there were exceptions accessing the database and so on… You get the point.
I wanted to solve this by adding the if Not Me.DesignMode then statement so the database code would not be called at design time. I started replacing all the code in the user controls only to discover that it doesn’t work.
What was the problem? Well it seems that when you have a user control the DesignMode property is not reliable. First off all its always false in a constructor or any code called from within the constructor. The false or true value for the DesignMode property is set when the control is sited (ISite interface) the only problem is that this happens after construction.
An other problem is nested controls. When you have a user control in an other user control or form and you debug it at design time the nested control will always indicate that it is not in DesignMode. Pretty annoying,no?
After some searching on the web and having viewed multiple solutions I found a solution that will solve in my case both problems mentioned above.
It has nothing to do with the control or it’s DesignMode property. I found that in the namespace System.ComponentModel there is a class called LicenseManager that has a property UsageMode. This property has got 2 possible values Runtime and Designtime. You can use this instead of the DesignMode property to check if you are running in design or at runtime because it will return you the correct state already in constructor code. An other advantage is that it can be used in nested user controls because it is not dependent on the control to set the correct value this way you can also use it correctly there.
Nice isn’t it? For me it does the trick, it might be still possible that there are some issues with this way of working, but I haven’t experienced any problems yet…
ISBNDB API Wrapper: First Result
Hello,
I’ve been working on and off on the isbndb api wrapper. It’s a managed component that wraps around the api of isbndb.com.
I’ve created a small website that will demonstrate the functionalities of the wrapper. It is still very basic and there are already more functionalities completed that can not be tested on the website yet.
Here is the site: http://suddenelfilio.net/isbn/
Which way? OneWay! (Web Services)
I’m currently studying for my next microsoft exam (70-529) that gets you certified for distributed development. I was reading in the training guide when someone asked me what the use was of the OneWay attribute.
So I explained to him that you can mark a web method with the OneWay attribute which indicates that this method can be called without the need to wait for a result. It’s the “Fire & Forget” principle. Sort of like the americans do in Iraq ![]()
So his first reaction was that it sounded the same like calling a procedure (sub in vb.net or void in C#) without it returning a result. Well yes and no. Yes because it has the same effect and no is in the difference that when you do a synchronous call to a web method that is a procedure the client will still wait for the acknowledgement of the webserver. So you make the call while the code on the server executes the client waits and when the code is finished the client is notified. While when you call a OneWay decorated method this doesn’t happen. The client just launches the call and continues working, it doesn’t wait for anything. So if your code takes a long time to execute in procedure the client will need to wait that long which it does not need to do with a OneWay method.
Okay this was clear, but he had another remark that was: “Why not mark all your procedures with OneWay as apparently it improves performance for the client ?”
Well that depends wether you want your client to be aware of certain exceptions that might occur on the server when the code there is executed. If you want this then you can’t use the OneWay method because of it’s nature the exception will never reach the client. You can test by just throwing any exception in the server code and decorating the erroneous method with the OneWay attribute. Then you call that method and you will see the nothing happens. The client just continues processing.
I already anticipated his next question that would be: “Is there an intermediate alternative than that I can use ?”. Well yes actually there is. Asynchronous method invocation.
There are several ways you can invoke web methods asynchronous:
- Create a new thread and execute the code synchronous on the separate thread.
- Create a new delegate with the same signature, instantiate it and then use the BeginInvoke and EndInvoke methods in collaboration with the IASyncResult interface.
- Just add a web reference to your project in vs.net and the asynchronous methods will be created for you.
If we take the last option you’ll see that when there is a synchronous method called “GetStockQuote” you can find the asynchronous counterpart as “GetStockQuouteAsync”. Calling this last method will execute the method asynchronously and you can continue processing other things. When you need to process a result you can attach to the Complete handler of the asynchronous method and in there process any results. This will only work of course when your method you are calling is a function. Also the important part is that when there is an exception it will be returned to the client.
These are certainly not all the possible solutions to work asynchronous but it demonstrates that you can simulate the effect of a OneWay method with the advantage of noticing any exceptions on the server.
.Net Reflector 5.0 Released
Lutz Roeder has released a new version of the popular .net reflector tool. At the same time there is also a codeplex project available that gives you a nice overview of the different relfector add-ins.
Some new features in the 5.0 version are:
•C# 3.0: LINQ query expressions, Lambda expressions
•Code URL: code://mscorlib/System.Object
•Assembly Browser: Multiple windows
•Disassembler: Expand Methods
•Analyzer: Exposed By, Instantiated By, Assigned By
•Search: String and Constant search
•New Options dialog
•Improved Shell integration
Ok here are the download links:
- A powerpoint presentation with an overview of the new features: http://www.aisto.com/roeder/paper/reflector5.ppt
- .net reflector 5.0: http://www.aisto.com/roeder/dotnet/Download.aspx?File=Reflector
- The codeplex project with all add-ins for reflector: http://www.codeplex.com/reflectoraddins
UPDATE #3: TFSProxy
As promised I’ve put the first release for the TFSProxy add-in online at the codeplex project (http://www.codeplex.com/tfsproxy).
UPDATE #2: TFSProxy
I’ve been busy with cleaning out the code and working on a graphics improvement so that it also looks nice (this is a personal view ofcourse).
When all this is done I will also be rebuilding the setup project and then upload it to the codeplex for download.
So what’s included in this version:
- Autoconfiguration using the webservice (not included in the setup, download seperately)
- Switching between locations retrieved from the autoconfig
- Turning off the TFS Proxy
- Enable/disable the behaviour for the dialog to appear at vs.net startup.
The big thing that is missing is the ability to add/edit/remove locations. Although this is not available using a GUI you can edit the xml by hand.More details on how to do this will be published later on.
TFSProxy Visual Studio .net 2005 Add-in
I’m currently developing an add-in for visual studio that allows you to switch fast between different Team Foundation Proxy Servers or disable the proxy servers without the need of going in the options of visual studio .net.
In the first release the user will be able to switch and disable proxy servers. It will also be possible to add new configurations, edit and delete existing configurations.
As a plus I also developed a web service through which the user can get predefined configurations. The user will not be able to change or remove these settings directly. This might be handy in an enterprise scenario where different proxy servers are used and they are controlled by System Operations.
For more information go to my Codeplex Project
