Monday, 27 April 2009
Progressive.Net Tutorials 2009
Thursday, 12 March 2009
error ASPPARSE: Could not load type 'Global'
All went well up until the point I tried to build the deployment project. The build failed with the "error ASPPARSE: Could not load type 'Global' " error. I looked for a solution on the Web and It turns out that Asp_net compiler wants a "bin" folder with all the dll references inside the project (the one you are tyring to build). After some more research I found the answer to my problem.
There is an element in the wdproj file (the MSBuild file created by the WDP) called 'SourceWebPhysicalPath'. This contained the value '..\PDR' (where PDR is the name of my Web application). Using a text editor to change this value to '..\PDR\bin' fixed the problem. The complete element is
<SourceWebPhysicalPath>..\PDR\bin</SourceWebPhysicalPath>
Thursday, 5 February 2009
Watchout, there's a Host about
I was pairing with Remco (start a blog man!) today and we came across an interesting assumption. The code we were looking at created a redirect URL using the following code.
return Redirect("http://" + Request.Url.Host + "/" + url.Trim('/'));
'Host' returns the "host component of this instance". No bad thing, until you start to test on a server using a port other than port 80. Your code may well break because the URL you are constructing doesn't contain the port number that your Web application is running on. To fix this you can use Request.Url.Authority. 'Authority' return the "DNS host name or IP address and the port number for a server".
Tuesday, 3 February 2009
ActiveRecord Configuration
The quick-start documentation that comes with ActiveRecord provides the following example configuration.
<?xml version="1.0" encoding="utf-8" ?>
<activerecord>
<config>
<add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="dialect" value="NHibernate.Dialect.MsSql2005Dialect" />
<add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="connection.connection_string" value="Data Source=.;Initial Catalog=test;Integrated Security=SSPI" />
</config>
</activerecord>
I couldn't get this to work. After a bit of fiddling I ended up with the following.
<?xml version="1.0" encoding="utf-8" ?>
<activerecord>
<config>
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2005Dialect" />
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="hibernate.connection.connection_string" value="Server=.;Initial Catalog=TestDatabase;User Id=UserNameGoesHere;Password=PasswordGoesHere " />
</config>
</activerecord>
The main differences are the 'hibernate' prefixes in the keys and the replacement of Data Source with Server in the connection string. This configuration worked against a SQL Server 2005 installation.
Monday, 2 February 2009
The Microsoft Loopback Adapter
I had a situation once where the IP address of an SMTP server had been hard-coded and I could only run the application successfully if the server was available. This meant that developing off-site was a problem. Then, from somewhere in the back of my mind, I remembered about the Microsoft Loopback Adapter (MSLA). This is a software network adapter i.e. you don't have to physically install a NIC. Installing this network adapter (add new hardware and choose the Microsoft Loopback Adapter from the list) allows me to easily route a given IP address to my local machine. For instance, if I manually assign the IP address of the MSLA to 192.168.0.100, then any requests bound for this IP address from my machine will end up at my machine. It's like saying "route any requests to 192.168.0.100 to 127.0.0.1". I installed a local SMTP server and my application sent emails to this local server via the MSLA. All I had to do was to remember to disable the network adapter when I was back on-site and wanted to use the real SMTP server.
Friday, 23 January 2009
Wednesday, 21 January 2009
Cooking Up An Application
One of the things I like to do at the weekend is cook a nice meal. I enjoy the whole process of selecting and preparing the ingredients and then putting them together to produce something that (usually) tastes good and leaves me wanting more. It occurred to me, whilst I was walking the dog this morning 1, that software development is quite a lot like cooking in many ways. I did a quick search on the Web and chuckled to myself as I read the advice given to people who wanted to cook. You could almost take the advice, word for word, and apply it to software development. Let me share some examples.
The cook's version
"Nobody likes a dirty kitchen, and a dirty kitchen is no fun to cook in either (not to mention unsanitary). With a little conscious effort, you can keep your kitchen clean while you cook. "
The developer's version
Nobody likes dirty code, and dirty code is no fun to develop either (not to mention unsanitary). With a little conscious effort, you can keep your code clean while you develop.
The cook's version
Be organized before you start cooking. It is important to have all of your ingredients and equipment assembled before you start cooking. This will help you follow the recipe more easily and prevent any messing around looking for ingredients and equipment that you didn't realise you needed—or maybe don't even have!
The developer's version
Be organized before you start developing. It is important to have all of your requirements and tools assembled before you start developing. This will help you follow the recipe more easily and prevent any messing around looking for requirements and tools that you didn't realise you needed—or maybe don't even have!
The cook's version
Stick to the recipe. When you are a beginner cook, you should follow the recipe exactly. As you cook more, you will become more at ease with making changes to a recipe and still create successful dishes.
The developer's version
Stick to the patterns. When you are a beginner developer, you should follow the patterns exactly. As you develop more, you will become more at ease with making changes to a pattern and still create successful applications.
The cook's version
Clean up. It is easier if you can clean as you go but don't worry if this doesn't come naturally at first. After a while, you'll work out that this is easier than cooking in a mess! Just make sure that you clean up after yourself when you have finished cooking, and don't forget any spills on the floor or cupboard doors.
The developer's version
Clean up. It is easier if you can clean as you go but don't worry if this doesn't come naturally at first. After a while, you'll work out that this is easier than developing in a mess! Just make sure that you clean up after yourself when you have finished coding, and don't forget any spills in the test code.
The cooks version
Enjoy your experience. Cooking is fun and a creative activity. When you feel a little more confident, start experimenting with different ingredients and come up with your own creations.
The developer's version
Enjoy your experience. Developing is fun and a creative activity. When you feel a little more confident, start experimenting with different applications and come up with your own creations.
1 : If you find yourself needing thinking time buy yourself a dog. Larger ones need lots of walking and this is an ideal time to let your brain sort stuff out.