Category ArchiveC#
C# & Microsoft & Software 18 Jun 2009 05:46 pm
Guji in Habanero Land #4: Using XSLT and XML to list Business Objects in a Word Document
Use cases are an important part of the communication between a client and a developer, or a user and a business analyst. That much is evident, since they are written in plain English and describe the business process in detail from the user’s point of view. All this is great except these use cases seem to create a huge administration overhead. What’s that I hear you say? “That’s the Project administrator/co-ordinators job”? No, we don’t have such a luxury! (We chose premium filter coffee and an espresso machine over having a co-ordinator).
C# & Databases 04 Mar 2009 01:05 pm
MySQL DATE_FORMAT results in System.Byte[]
This problem comes up in certain circumstances where you use DATE_FORMAT in your sql query and use the output in your C# code. The problem is that a byte array is returned and a ToString on that value will result in “System.Byte[]“.
Continue Reading »
C# 08 Jan 2009 11:57 am
Watermarks in iText PDF: Tips & Tricks
Having battled away with watermarks in iText (com.lowagie.text) for several hours, I’ve compiled a post on a few things you need to watch for. The attached C# code was compiled with .Net 2.
Continue Reading »
.NET & ASP.Net & C# 01 Aug 2008 04:49 pm
Habanero and Visual WebGUI (VWG)
A few months ago we, were commissioned to undertake a project that required what most of us in the office cringe at, an ASP project, more specifically and ASP intranet project. So after some bad and tedious experiences with ASP just a few weeks earlier but still wanting to do this project, we scoured the interwebs for any tool that could some how help our interaction with ASP. We found what can only be described as a GOD-Sent, Visual WebGUI or VWG as its known. After spending some time using the VWG framework, testing it out and convincing ourselves that it met all our requirements, we made the monumental decision of reviewing our ORM architecture, Habanero, to see how easily we could fit the two together. The task seemed simple enough, all we really needed was to use the VWG controls instead of Windows controls. However after going down this route we decided that a more elegant soultion was required.
And so it began…
Continue Reading »
.NET & C# 03 Jan 2008 01:56 pm
Deleting Objects While Enumerating Through a Collection
In writing code where I was deleting the objects in a collection, I encountered the exception:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
Simply put, I was using enumeration to walk through the collection, and the change in collection contents was messing up .Net’s counting system. My old code looked like the following:
Continue Reading »
C# & Microsoft 01 Oct 2007 07:30 am
Default Values in a New Grid Row
When you’re using an editable grid (such as the EditableGrid feature in Habanero), where a user simply adds items to the grid using the new row at the bottom, you’ll sometimes want to supply default values in some of the cells.
Continue Reading »
C# & Habanero 16 Aug 2007 07:34 am
Habanero wins round one over NHibernate
Habanero and NHibernate are rival products that both carry out object-relational mapping (ORM), meaning they map your database tables to your objects in code, and then persist data back and forth between them. They essentially can save you a lot of coding and fussing about boring details.
But how to choose between them? Well, have a look at this:
Doing the official NHibernate tutorial using Habanero instead…
Continue Reading »
.NET & C# 08 Aug 2007 05:06 am
Casting Generic Types
Recently I was looking into generics and how to cast one generic type to another generic type of the same class. Just to make sure that you know what I’m saying, I’ll use an example:
Continue Reading »
.NET & C# 27 Jun 2007 11:14 am
Coding standards
If your company (or your internal monologue) is anything like ours (or mine), you’ll find yourself going back and forth between coding standards as people try different things and debate the merits of the varying positions of a curly brace. We had a sort of defacto set of standards that people mostly followed (helped significantly by the wondrous Resharper), but what has been helpful for us is to draw up a document that everyone is (mostly) happy with and simply stick to it.
As we were doing this we discovered a document by Lance Hunt entitled C# Coding Standards for .NET which did exactly what we wanted and more. A couple of the ideas in Lance’s document were different to ours, but for uniformity’s sake we have now officially adopted his standards. What is also useful in this document is coding style guidelines which can be checked against in code inspections. The superbness of Resharper allows us then to set the formatting standards up and save them to a file which we can then apply to all solutions.
The drawback is that office conversation and debate for the timebeing has been reduced to more mundane topics, like sports.
