Posts

Partial declarations of must not specify different base classes

I wanted to use a common base class for a set of UserControls in my WPF application, but when I changed the class’s ancestor in the code file and compiled I would get the error “Partial declarations of must not specify different base classes” This is because when you compile a WPF application Visual Studio generates a partial class in a code-behind file automatically, the base type specified is always “UserControl”.  To solve this problem change your XAML from this   < UserControl x:Class ="MyApp.MyControl" /> To this < local:SomeBaseTypeYouWantToUse x:Class ="MyApp.MyControl" xmlns:local ="clr-namespace:NameSpace.To.Your.BaseClass" />

A WebServer for MonoTouch that also parses posted form data (HttpListenerRequest)

I found a few examples of web servers for MonoTouch but none of them parsed the data sent in a POST request.  I looked around the web and was unable to find any examples of how to achieve this.  So now that I’ve written it myself I’ve decided to share my own implementation.  This includes not only the code for processing the form post data but also for registering request handlers etc. Here is an example of how you would use the web server public BookUploadViewController() : base ( " BookUploadViewController " , null ) { RequestHandler = new DefaultRequestHandler(); var defaultActionHandlerFactory = new DefaultActionHandlerFactory(); RegisterActionHandlers(defaultActionHandlerFactory); RequestHandler.AddActionHandlerFactory(defaultActionHandlerFactory); WebServer = new EmbeddedWebServer(RequestHandler); } void RegisterActionHandlers(DefaultActionHandlerFactory factory) { fact

Embarcadero should revive Bold for Delphi

I've recently been doing some work on a Bold for Delphi application. I am really quite surprised how much I am still impressed with this framework, it really was (and still is) so much ahead of its time. Embarcadero really should revive this product and put it back into Delphi. They could make it a free addition to Delphi, or maybe even ship it with Delphi as an open source project. Embarcadero! You have a great tool here, don't hide it away, use it!

Free: One year TechNet Plus subscription

http://arstechnica.com/microsoft/news/2009/06/free-one-year-technet-plus-subscription.ars Update: The UK link from this site has been taken down :-)

Bing

I searched for "mrpmorris" on bing.com recently.  Now on Google it would show the address of my blog as the first result, which is very relevant.  On Bing it showed a page from a web chat from over 3 years ago, not very impressive. Not sure how long this photo will remain on the web for, but I found it quite interesting... http://farm4.static.flickr.com/3604/3585051300_d23a37a32e_o.png

Generation gap - update

Martin wrote to me and explained something I wasn't aware of. He doesn't catalogue best practises or only the ones he likes, he is cataloguing all patterns he can find. He said he would rather someone made an informed bad decision than an uninformed good one. Not quite sure I agree with that either :-)

Generation gap

I have just read this blog by Martin Fowler. I like a lot of what Martin writes, but this is not one of them. The article suggests using inheritance to separate code-generated classes and manually written classes. You would descend from a code-generated class instead of trying to modify the code-generated source. The problems I see with this are Attributes If I have a descendant of a code-generated class how do I attach .NET attributes to members? I’d have to override them and add the attribute in the descendant which would mean all of my members need to be virtual. Obviously this wouldn’t work for Private members. I expect you’d have to attach all of your attributes in the tool which generates the source code, but I don’t like this idea. I will explain why later. Sealed / final What if we want to create a sealed/final class? We can’t. What if we want a specific member to be sealed/final? Then we couldn’t add attributes to the members. Partial Microsoft introduced Partial clas