A day in the life...

public class GeekEarth : Earth { }
posts - 26, comments - 7961, trackbacks - 0

Code

Code
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 1 public BookUploadViewController() 2 ...

posted @ Saturday, April 02, 2011 6:58 PM | Feedback (333) | Filed Under [ Code ]

Additional visualisations in ECO

My model needs to take snapshots of certain data and to do this I have various snapshot classes. Sometimes you might snapshot an aggregate root such as PurchaseOrder and expect all PurchaseOrderLines to be snapshotted along with it. Sometimes though the Parent/Child relationship is not part of an aggregate root and you want the child snapshot to create the parent snapshot, for example when snapshotting an Address you might want to snapshot the Country. So when I was looking at my snapshot diagrams it wasn't immediately obviously which behaviour you get. Hans showed me this article: http://theblog.capableobjects.com/2009/12/catching-more-information-in-your-model.html Now I have added...

posted @ Thursday, February 10, 2011 11:01 AM | Feedback (267) | Filed Under [ Code ]

How many unique pizza combinations does Domino’s Pizza have?

Okay, a weird topic I know but I saw a question asked in NewScientist querying whether the Domino’s Pizza claim of 1.8 billion combinations is possible.  Here is the answer I am submitting: If we have 4 options on the menu (ABCD) and choose 1 topping we have 4 unique combinations. If however we choose 2 toppings we have 6 unique combinations.  As toppings in a different order are considered the same combination this means that when choosing the second topping we must choose from a sub-set of the entire menu. For example, when working out how many combinations...

posted @ Monday, January 10, 2011 11:10 AM | Feedback (290) | Filed Under [ Code ]

Unity child containers + ASP MVC = Memory leak

I was making some speed improvements to my current ASP MVC application.  One of the things I did was to change from creating a completely new IUnityContainer for each request over to creating one master (template) container with all the services registered with HierarchicalLifetimeManager.  Then whenever a controller is required my ControllerFactory does this 1 if (controllerType == null) 2 return null; 3 var requestContainer = Container.CreateChildContainer(); 4 return (IController) requestContainer.Resolve(controllerType); That’s all nice and simple, however it causes a memory leak.  The reason is that the parent container holds a reference to all of its children.  The only way to...

posted @ Sunday, December 19, 2010 1:33 PM | Feedback (287) | Filed Under [ Code ]

ASP MVC CheckListBox

I needed to present the user with a list of objects from which they could select multiple items.  There is a MultiSelectList class in ASP MVC so I looked into how to use that.  It would seem that to use this class we need to use Html.ListBox.  I think this is a poor choice because it requires the user to hold down the Control key to select additional options, and it is too easy to deselect all of your values accidentally by clicking the control accidentally without the Control key held down. What I really wanted was something like a CheckListBox,...

posted @ Friday, November 26, 2010 2:56 PM | Feedback (297) | Filed Under [ Code ]

ASP MVC encoding route values

I’ve recently been using ASP MVC 2 to develop a business application.  As you may already know the ASP MVC routing system works with URLs which look like this http://localhost/Client/Details/IBM In standard ASPX apps the URL would look more like this http://localhost/Client/Details.aspx?code=IBM The first URL obviously looks much nicer than the 2nd, however it comes at a cost.  What if the “code” of your object is something like “N/A” for “Not applicable”?  You end up with a URL that looks like this http://localhost/AbsenceCode/Details/N/A What we really need is to have ASP...

posted @ Saturday, November 20, 2010 9:30 PM | Feedback (264) | Filed Under [ Code ]

Delphi Audio Compression components updated to Delphi 2009

Diego has upgraded my deACM source to work with Delphi 2009. http://unitonedev.blogspot.com/2009/08/deaudio-convertido-para-delphi-2009.html

posted @ Tuesday, September 01, 2009 1:04 PM | Feedback (230) | Filed Under [ Code ]

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 1: <UserControl 2: ...

posted @ Thursday, July 23, 2009 12:08 PM | Feedback (966) | Filed Under [ Code ]

Models, views, controllers

I’m working on a new app which will have WPF as its user interface.  With the slight nag in the back of my mind that someone might say “No, we want WinForms” (I hope not) I decided there should be as little code in the UI as possible so I opted for a view/controller approach where my controller will perform all of the logic and the view will only do “viewy” things. One of the features of this app is that some of the views should appear as modal windows (such as a splash window during start-up) but others...

posted @ Friday, July 17, 2009 4:38 PM | Feedback (201) | Filed Under [ Code ]

TaskSmart

Carlo Kok from RemObjects suggested a book to me “Getting things done” a while back (I’d recommend it too) – since then I have been using Get On Tracks, which is a web based app based on the suggestions in the book.  It’s a pretty good app but I find it is very slow, painfully slow.  So, due to the relentless part of my personality which compels me to constantly learn new things I have started an open source project on sourceforge.net – TaskSmart.  This will be a web app I can use as a replacement for Get On Tracks,...

posted @ Saturday, June 27, 2009 5:56 PM | Feedback (145) | Filed Under [ Code ]

Full Code Archive

Powered by: