Thursday, October 11, 2007

Am I Agile?

There is a lot of discussion going around the blogosphere about the Agile methodology and ALT.Net. I was reading Billy McCafferty post titled 'Conveying Agile Processes Concisely to Clients' which gives a clear definition to clients (and a good introduction for me) about the Agile process and it dawned on me that I was more agile than I thought. Where I work we do not emphasise any methodology except get it done (gid??, giddy process??) and if a director wants it, get it done quick. As you can probably guess, this leaves no time to implement any TDD type of process and all testing is done at the end (although I would call this bug fixing). Some of the points mentioned in Bills post such as short iterations (they are always happy to see a working prototype) and prioritisation of features we are already doing. I am slowly trying to learn about agile and test first using NUnit, but it is slow going. I would get handed a small project and I think 'great, I can try out creating unit tests for this', alas I still find myself writing the code bypassing any unit tests then thinking 'oh I should of thrown in a test there...well it works'. Although I can retrospectively drop in tests as Derik Whittaker describes here. I don't want to be like that, I would like to test first and have the code covered, am I a bad developer? Well that brings me on to another thing, the ALT.Net conference in Texas. No I wasn't there, but I read a lot of the coverage from various blogs. Scott Hanselman mentioned that alt.net is a group that believe in:

1) Continuous Learning
2) Being Open to Open Source Solutions
3) Challenging the Status Quo
4) Good Software Practices
5) DRY (Don't Repeat Yourself)
6) Common Sense when possible

 

And I

1) All the time, I see myself as a continuous learner
2) I like using open source mainly because of the cost, if it cost me then I usually end up going without (I should emphasise that my latest place have been a bit more acceptable to the fact that a developer needs certain tools and they cost). But also I find they introduce new features faster.
3) Not much of a rebel, sorry
4) Again I am continuously learning about what I should be doing, here is a good guide to coding practices in c#
5) Yep
6) I think we all strive for this

So am I agile? Perhaps not, but I feel I am getting more agile every day.

When I linked from bad developer above to the alt.net conference I wasn't implying they are bad developers, no the link was less sinister; becoming a better developer means continually learning about development techniques and alt.net implies continuous learning. That's all.

Monday, September 03, 2007

Unit testing my web application

As I have recently started a new web application (actually it is going to grow in to our Intranet) I have decided to develop it along an agile path using unit tests. It has been a bit of a struggle at first, but I now have a basic framework. Writing the actual tests was never a problem as I have used NUnit before on a couple of windows based projects, this was however the first time with a web application. The easiest way I have found is by creating a web application instead of a web site in VS2005. By creating a web application, dll's are created at build time which NUnit will run against. Now that is up and running I wanted to use mock objects to basically mock session variables. I highly recommend Rhino Mocks as a mocking framework. You cannot however mock the session as it is sealed. After Googling for a while I came across this post by Phil Haack which uses an HttpSimulator. I thought I was almost there, but there was a problem with a map path interface having restricted access due to its protection level. Reading the comments lower on this page is a simple solution to comment out any reference to ConfigMapPath. So finally I can now unit test my session variables. Sorry for the long story, but it may help someone (myself included when I totally forget about it on my next web application project).

On a side note I finally took the plunge and am now using Windows Live Writer to update this blog. It is still in beta, but if you want to give it a try, go to the URL here.

Thursday, August 23, 2007

SketchPath, Draco.net and more

For anybody who regulary deal with XML and XPath in particular may be interested to try out Phil Fearon's SketchPath. It is a free utility which will easily analyse an xml document allowing you to examine the XPath query required to reach certain elements or attributes. I have only been playing arround with it for a very short time and I have come to the conclusion it could have saved me quite a lot of time on a recent project where I had to parse a large number of xml documents stripping out various bits n bobs. It is currently still in beta, but if this is anything to go by then the alpha release will be awesome.

On another note, Christopher Bennage has an excelent entry on his blog about getting up and running with Draco.Net. For the uninitiated, Draco.net is a continous integration (CI) environment that reports to have minimal set up troubles. To put it simple CI is basiclly an automated method which will check out your code from your code store (Subversion or SourceSafe for example), run any unit tests and run a build script. This is an area I am no where near knowledgable about, but am intending to look into in the near future.

For anybody getting in to WPF, there is a good getting started tutorial over at msdn.

Michèle Leroux Bustamante has a good post over on dasBlonde about getting a system setup for
.NET 3.0 and .NET 3.5 including links for downloads for VS2005.

On a more personal note, has anybody been getting tired dry eyes while working away on the computer? Apparently if you are staring at the centre of the screen then you are putting your eyes at unnecessary strain. In this blog entry the author describes how you should look at the monitor. I don't know if this is scientifically correct but if I work on my laptop which is below eye level and look down at the screen I do not feel as optically tired (is that correct???) as I do if I am looking at my flat screen.

Finally this blog entry from Sarah Ford has a quick shortcut key combination for VS2005 to help reformat code. It also works on web markup which is realy handy for me as I tend to have tags out of line and basically all over the place.

Thursday, August 09, 2007

New 22 inch widescreen

Well my old 19 inch CRT finally blew yesterday and I am now the proud owner of an iiyama 22inch widescreen (well in the office anyway). Takes a bit of getting used to, but the simple fact that there is virtually no reflection gives it the thumbs up straight away. Using VS 2005 with it is a dream.

The rewrite is going well. I have managed to implement code in different and better ways, learning new methods as I go along.

Speaking of VS 2005 here is a link to a blog entry that can help speed it up:-

Speeding up Visual Studio 2005

Reading through the transcript for Hanselminutes show 72 I came across a reference to a Justice Gray who is planning on reading and comprehending an IT related book each week. It beggers belief how he can find time to do that, but I guess it is all down to planning. I have a few books on my reading list, and I must admit it takes me quite a while to get through each one. Perhaps if I organise myself better I could wizz through these and try my best at keeping up to date with everything that is happening in the world of development.

After reading a few posts regarding mouseless computing I am trying my best to use my mouse less and rely on keyboard shortcuts instead. For one thing it may prolong the onset of RSI, but also I have found it quicker and easier to use keys for some things rather than reach out for the mouse. I do keep failing, especially when it comes to web browsing.

Happy programming

Saturday, July 07, 2007

MCSE underway

I haven't blogged for a while. That is because I have finally knuckled down to studying for the MCSE upgrade exams. I have found a wealth of info on the web, mainly webcasts, but a few podcasts as well. Ideal for listening to while down the gym. The Microsoft website has viewable webcasts for a range of subjects, I have mainly been concentrating on Active Directory, DNS and Group Policy. One light hearted resource I have come accross was ITIdiots.com, they are covering the MCSE course structure so have webcasts for DNS, DHCP and Group Policy. With watching all these, reading the course books and running through the Transcender test prep exams, there is little time left for a life.

The powers upon high have decided to make some pretty drastic changes to one of my applications where I work, so that will mean a major rewrite. The SQL upgrade has been well and truly ditched for now. Ho hum.

Wednesday, May 16, 2007

In between projects

I am in the relaxing?? period of being in between projects. The next project I will be working on is the migration of two of our SQL 2000 systems over to W2003 and SQL2005. That should be fun. Until that gets going I am brushing up on all the new technologies that are arround or soon coming out, such as LINQ, Entity Framework, VS Orcas and Longhorn (Windows Server 2008). I wonder when that's being released??

There are a few other mini projects I will be working on to get my development practises up to scratch. I work in a small IT dept and as you can proberbly guess some things we just don't do (yet). I have already implemented Source Safe 2005 and that is working out realy good. We are soon to implement a full change request/bug tracking system. I have also started using fxCop to get all code to a certain standard. The department manager is also implementing full project management using PRINCE2 techniques, so that will hopefully also improve things.

So like I said, relaxing times. Only 5 books on my current reading list:-

Sams - Microsoft SQL Server 2005 Integration Services

Apress - Beginning SQL Server 2005 for Developers From Novice to Professional

MS Press - MCSA/MCSE Self-Paced Training Kit: Upgrading Your Certification to Microsoft Windows Server 2003

Syngress - Planning, Implementing and Maintaining a Windows Server 2003 Environment for an MCSE Certified on Windows 2000

Addison Wesley - Hitchhikers Guide to Visual Studio and SQL Server

Thursday, May 10, 2007

MCSE 2003 or MCTS or both

A few years back (edit:actually it was 5, where has the time gone?) I achieved my MCSE on Windows 2000. Since then I haven't realy been involved in installing and administering Windows systems (except SQL 2000 and the odd web server). I have been getting deeper and deeper in to .net. My latest position combines administration and development, so I have decided to upgrade my qualification to MCSE 2003 and then try and get down the MCTS path. I used to think that in IT you are either on the admin side of things or the development side and it is a common term to say 'a jack of all trades is master of none'. However I have found my MCSE extremely handy when developing to know the goings on in W2000, W2003 and SQL Server. As MS have announced the retirement of the upgrade exams to W2003 I am attempting this first hopefully by the end of the summer.

RegEx

Regular expressions:

Here are a link for regular expressions, they may come in handy some time.

The absolute bare minimum every programmer should know about regular expressions

Friday, May 04, 2007

LINQ Links

Just a quick post. I found these links earlier for LINQ Videos

Tuesday, November 28, 2006

Encrypt/Decrypt web.config

To encrypt the appSettings section of web.config

aspnet_regiis -pe "appSettings" -site "YourWebsite" -app "/"

and to decrypt

aspnet_regiis -pd "appSettings" -site "YourWebsite" -app "/"

You can encrypt any portion of the web.config file.

Simple

Tag Cloud

Scott Mitchell has an article over on the 4GuysFromRolla site about creating a tag cloud, I have seen these on several sites such as weblogs.asp.net. I never new they where called tag clouds so that is something I have leant already.

Saturday, May 20, 2006

Changing default browser in VS 2005

If you want to change the default browser when developing web applications with Visual Studio 2005, then simply right click the website in Solution Explorer and choose the Browse with... option. Choose what browser you want, if it isn't listed there click on the Add button and browse for the .exe. You can then set this new browser as the default.

Thats it for now tara.

Sunday, April 23, 2006

Problem with Master Pages in ASP.Net 2.0

I have come accross a major problem in master pages in the new asp.net 2.0. Here is a section of my code.

Dim myMaster As MasterPage = Page.Master
Dim myControl As Control = myMaster.FindControl("ReportMenu")

Dim myControlType As Type = myControl.GetType
Dim mtype As Type = myControl.GetType
Dim minfo As MethodInfo = mtype.GetMethod("Populate")
Dim myparamarray() As Object = {myArray}
minfo.Invoke(myControl, myparamarray)


This code simply locates a control in my web page. This page happens to belong to a master page, so while searching for the control it has to move down through the structure - Master - Page - Control. When the control 'ReportMenu' is located, it uses reflection to invoke the Populate method in that control. Working in the VS 2005 environment this all works fine. However moving over to a pre-deployment server this error occurs.


Unable to cast object of type 'ASP.masterreporting_master' to type 'MasterPage'.

The culprit line is.

Dim myMaster As MasterPage = Page.Master


After a quick search online I came accross this link.

http://visualbasic.ittoolbox.com/blogs/featuredentry.asp?i=7878

The web.config file has an element

<compilation debug="true" strict="false" explicit="true">

By default, batch compilation is set to true, so add the attribute batch="false" to this element. There is apparently a fix for this issue according to Scott Guthrie in the post mentioned above.

Thursday, February 23, 2006

Great new job

Well I am settling in to my new job. Where I now work they have an MSDN subscription, so I have got access to lots of new MS goodies.

My main job is software development using vb.net, accessing a number of back end SQL Servers. I have just finished a project that ties in to an in house system and transfers data to and from GPRS handhelds. Pretty cool stuff. I have used and re-used lots of the same code I wrote in my previous position, some of it I have posted on thedotnetdiary. There is so much I need to update on that site. When I do I will blog about it here.

Monday, November 21, 2005

DateFormat amongst other things

I have uploaded a simple DateFormat control to thedotnetdiary website. All it really does is makes dates look nicer. For example if you have a date such as 01 September 2001, then it will format it as 1st September 2001. Simple as that. It is something I implement on a few projects I have been involved with and have finally written the control. The zip file can be found here. To implement it using c#, do the following.

using DNDDateFormat;

///
/// the rest of your aspx page code
///

DNDDateFormat.FormatDate myDate2 = new DNDDateFormat.FormatDate();
Response.Write(myDate2.SortDate(DateTime.Now));

.
.
.

Its as simple as that.

I have now secured a new job doing more vb.net and SQL development over web development (although that will be a project in itself at some point). So I am now spending most of my time documenting my systems so somebody else can come in and maintain them. Once I settle in to my new job, I will post more details of what I am getting up to.

I have been looking in to the new VS2005, so far I am very impressed, I especially like the code snippets utility and will definetly be using that to a great extent.

Wednesday, October 12, 2005

File upload max size

Have you ever developed a file upload tool? Well if you have, you will proberbly come accross a limit in the size of file you can upload. This limit can be configured in two places, the machine.config or web.config.

In machine.config, change the maxRequestLength attribute of the <httpRuntime> section. By default it is around 4Meg. The value is in kilobytes.

Alternativly if you have an admin section and you want a different limit to upload for admins, change the web.config file within the admin directory (you do have an admin directory don't you?)

Again it is the maxRequestLength attribute of <httpRuntime> and needs to be within the <system.web> section.

I hope this helps someone.

Thursday, August 04, 2005

Editing HTML on a .net web page

Recently I have been working on a project that requires editing of HTML through a content management system. Initially I used a component call EasyWebEdit, but as more and more people are switching to Firefox I needed a component that supported it. I chose a component called FCKEditor. I have just published an article on The DotNetDiary quickly explaining what you need to do to get it up and running.

I am also working on a couple of other articles for my site, so stick arround there may be something of interest to you.

Wednesday, May 11, 2005

Workgroup Diary Application...cool!!!

I have been working on a cool app just recently. Basically it reads information from Outlook, calls a webservice on our server and dumps the data in to the SQL Server back end. Then there is a calendar application which then displays the details in a neat fasion. It is the first real experiment I have done with web services and to be honest I am very pleased with it. I am still at the testing phase, but will hopefully post some code here soon. The calendar web application uses a cool control developed by Mike Ellison and can be found over at Code Project.

Still working on my DotNetDiary site, and to be honest, I am finding it difficult to find the time to do it. I am going to look in to those Microsoft starter kits to see if they are any help. I will report back any findings.

One of the projects I will be working on soon is a Virtual Learning Environment which runs on asp.net. I am not intending to build one from scratch, but perhaps implement a third party tool. Hmmm!

I am also working arround a problem I have with the CMS for my site at work. It uses a cool component called EasyWebEdit. However as I am now using Firefox as my browser, it doesn't render correctly. I cannot use IE as for some reason no matter what I do I cannot get it to access the Internet. Anyway to cut a long story short, I will be looking in to word processor type web editors and compare them to a bespoke version.

I am off on my Jollies next week, so I will not be blogging for a while. Not that I regularly do anyway.

Wednesday, March 02, 2005

Slowwwwww website

Firstly I would like to say congrats to the DotNet Rocks team on reaching their 100th show. Yeah I know I was a couple of weeks ago, but I have only just got arround to listening to it. Very funny clips from various .net people such as Don Box, Dino Esposito and others.

Have you ever had a web site up and running only to have it be slow on the first request??? Well as you probably know, first request can be slower due to the .net compiler doing its' job. I run a site which seems to have a slow response after a while from the first visit. I don't know the complexities of the processes going on, but I have tried cacheing. Well anyway I have written this small console app which gets called every now and then from the standard Windows Scheduler. It simply reads a text file storing URLs' and requests them.

This is the code.


Imports System
Imports System.IO
Imports System.Net
Imports System.Text

Module Module1

Sub Main()
Dim objReaderToCount As New StreamReader("URLFile.txt")
Dim objReader As New StreamReader("URLFile.txt")
Dim p As Integer
Dim strCount As String

p = 0

While objReaderToCount.Peek() > -1


strCount = objReaderToCount.ReadLine


p = p + 1


End While

objReaderToCount.Close()



Dim arrURL(p) As String
Dim I As Integer
Dim strReadLine As String

While objReader.Peek() > -1

For I = 1 To p

strReadLine = objReader.ReadLine

Console.WriteLine(strReadLine)

arrURL(I) = strReadLine

Next

End While



objReader.Close()

Dim intI As Integer

For intI = 1 To p


Dim Request(intI) As HttpWebRequest

Try
Request(intI) = WebRequest.Create(arrURL(intI))

Dim Response(intI) As HttpWebResponse

Response(intI) = Request(intI).GetResponse()

Dim resStream(intI) As Stream

resStream(intI) = Response(intI).GetResponseStream()

Console.WriteLine("Web Request..." + arrURL(intI))
Catch ex As Exception
Console.WriteLine("An error occurred:")

End Try
Next intI
End Sub

End Module



For this to work, you need a file called URLFile.txt in the same directory to read from.

Sorry for the lack of comments, bad habit I know. Well basically it reads each line from URLFile.txt does a web request using WebRequest.Create() and if it gets a response, writes it out to the console. The Try...Catch section handles any exceptions such as bad URL's.

You can compile this using the vbc like this:-

vbc /t:library /r:System.dll WebRequestAuto.exe

When I finally get my web site up and running, I will probs repost this code with the resulting .exe (with comments perhaps)

Friday, February 18, 2005

Where we are heading!!!

There is a good article at ITArchitect describing the next stages on the .net journey. Find it here at http://www.itarchitect.co.uk/articles/display.asp?id=108. The final outcome (???) is Windows Longhorn via .net V2.0, Avalon, Indigo and of course Whidbey (does anybody at ms get payed to think these names up?). Must admit, can't wait to get my grubby hands on VS 2005. I have been playing arround with Visual Web Dev 2005 Express, it's pretty cool, but at the moment I am of course only using 1.1 in deployment projects.

On another front, I have been using Gemini bug tracking tool to keep track of all those pesky little blighters that can hamper development. Since installing it, I have already started decreasing my bug-list. It can be downloaded from http://www.countersoft.com. For a one person liscence, it is free, yahoooo!!!