Got my copy of Applying DDD (w/C#) today

DHL said it arrived yesterday, but I never saw it. Turns out DHL used USPS and it was in the mailbox.

Anyway, the book is Applying Domain-Driven Design and Patterns: With Examples in C# and .NET. I just finished the first chapter and although a lot of it was familiar to me, I liked the author’s writing style and found it more engaging than some of the more abstract books on the patterns, architecture, and designI have Domain-Driven Design, Patterns of Enterprise Application Architecture, and Design Patterns. I really like the books and I have learned a ton from them, it’s just that they are a little dense and abstract. I don’t know that I feel comfortable giving them to someone new to the concepts.. He mentioned several tools that I use daily like NUnit and CruiseControl.net.

I’m hoping this book will be both a good introductory book that I can give to people and that it will give me with some practical examples of how to actually work with DDD in .net. I really want to read through it as quick as I can so that can try to get some other people at work interested.

We have been using some things like unit tests and continuous integration and I think it has greatly improved our process and the quality of our code. Hopefully concepts like domain models and the object-relational impedance mismatch can spur further improvements.

Posted in Software Development | Tagged , , | Leave a comment

Workaround for weird Firefox bug where the textarea cursor will dissappear

Every once in a while I run across a bug in Firefox that basically hides the blinking cursor that is supposed to be in a textbox. It’s still there and I can still type, but I just can’t tell where the next character will appear. Every time this happens, I have to Google around a bit and find the Bugzilla bug describing it.

For my own reference: here is the bug report. It will be fixed in Firefox 3.0, the workaround is to add a style="overflow: auto" to a parent element of the textbox. Apparently it is caused by placing a textbox in a position: fixed element with a height.

I also found a fix over on Bram.us that is a bit of css that should fix every input and textarea on a page.

Posted in Software Development | Tagged , | 1 Comment

So 2008 is here…

Another year came and went already. I had a lot of fun in 2007 and I’m excited about the next year.

There’s a lot of interesting things coming up in the .net world: .net 3.5 and Visual Studio 2008 are finally out, the ASP.NET MVC framework is looking good, the ALT.NET stuff is giving some attention to non-Microsoft tools. I’ve been working on some interesting stuff for a while now that should get some use soon.

I’m not really much for the resolutions and stuff. I will try to get more content up here this year. So far I’ve kept this blog running. I haven’t abandoned it yet. I have a ton more ideas that I just haven’t written down yet.

Posted in Software Development | Tagged | Leave a comment

Quick Tip: Fullscreen Window in WPF

(aka Windows Presentation Foundation aka Avalon aka XAML)

WindowState = WindowState.Normal;
WindowStyle = WindowStyle.None;
Topmost = true;
WindowState = WindowState.Maximized;

That’s it, nice and easy. Setting WindowState to normal before and then maximized after fixed an issue where it was fullscreen, but didn’t expand to cover the taskbar.

I did this in order to make a patch for Big Visible Cruise, a new app that displays CruiseControl.net statuses in a big noticeable window. (Issue 14)

I got some ideas from this forum post on the MSDN forums.

Big Visible Cruise is hosted on Google Code. I’d never used it before, but it was really easy and simple to log in, add a comment, and attach a patch.

Posted in Software Development | Tagged , | 5 Comments

Just a quick thought about Google and Microsoft:

Google is a marketing company run by engineers; Microsoft is an engineering company run by marketers.

I had this thought as I was walking to the kitchen. It’s not entirely accurate I’m sure, but a general impression from their outward appearances. Anyway, I thought it was interesting and just thought I’d share.

Posted in Software Development | Tagged , , | Leave a comment

2 Hours With Castle MonoRail

MonoRail is one of those frameworks that I’ve been watching for a while, but I’ve never spent the time to actually dig in and start messing with it. (MonoRail, if you haven’t heard, is a MVCMVC stands for Model View Presenter, a design pattern. framework for ASP.NET web applications, similar to Ruby on RailsRuby on Rails. Microsoft is also working on their own ASP.NET MVC frameworkScott Guthrie’s Post on their new MVC framework. (It seems very similar to MonoRail.), but it’s not available yet.)

A little while ago I spent a couple hours with it, just reading the tutorial and trying stuff out. I figured I could make an interesting post on my experience with it. The following is just my rough notes from that. Some might even call it live blogging.

MonoRail

I started by downloading and running the msi installer of rc3.

I created a MonoRail app through the Visual Studio wizard as the documentation suggested. It gave me some NUnit tests, they ran quickly in Resharper’s test runner. Hitting F5 started Visual Studio’s server and brought me to a nice looking page offering examples and documentation.

Urls are interesting. It redirects me to /home/index.castle. It seems to do this in the generated Default.aspx. This implies that I might be able to throw some webforms pages into a MonoRail site. *.castle is mapped to MonoRailHttpHandlerFactory in the web.config. Looks like standardish, somewhat advanced, asp.net stuff so far. I’d probably have to add the .castle mapping in IIS.

Images, stylesheets, and JavaScript are in a folder called Content; seems to load the same as files any old ASP.NET site.

I’m looking at the rendered html and trying to figure out where it came from. There’s a Views folder, inside that a Home folder and an Index.vm file. Index.vm seems to have a few snippets, but not the main bulk of the html. Ah, layouts/default.vm has a lot in it. There’s some variable replacement going on $!{title} and $siteroot, I’ll have to look up the syntax later. Hmm, there’s a $!scripts in the layout and a #capturefor(scripts) in the home view. This is all probably NVelocity stuff. Just found rescue views, nice!

On to the login controller… I can see it works and how the controller code gives the form values to the view through a PropertyBag. How’s it decide to show the form or the result? The form’s action = /Login/Authenticate.caste, the form page is /Login/index.castle. Ah, and there’s two different views.

Just noticed that Visual Studio tabs are confusing when you have three Index.vms open. I just noticed that it can build links to the various pages through $Url.Link(…).

The idea of the controllers seems familiar. I’ve taken a look at it before and I’ve tried to use the MVP pattern with webforms in a few projects. I wonder if the url is tied to the controller? Is there a way to separate it? I could live with it for an internal site, but I might want more control for a public site. For example the url of this post has a lot of info in it that I think might not be in the MonoRail urls. We’ll see.

I really like having more control over the html than webforms gives you.

OK, processing forms, passing variables back to the view and then the browser, got it. Not sure where to go now. Ooh! DataBinding… OK, so it’s different than webforms databind. It binds fields from a form to properties on a class, very nice.

The docs then go on to ActiveRecord. I’ve already used ActiveRecord, so I’m going to skip it. That’s it for the getting started documentation. I think I might move on to Windsor.

Windsor

Windsor while not part of MonoRail is related because they are both part of the Castle Project.Windsor is an inversion of control container.

Getting started part 2 & 3 are not done yet. It’d be nice if I didn’t have to click the link to find that out… Anyway I’ve tried to use IoC before, I used Spring.net to configure a project, and I thought I understood IoC, but I’m not so sure I really did.

The simple example of Windsor registering a form and getting it was neat, but doesn’t show me how or why I would want this. Separation of concerns: nice and all, but can’t I do that without a container? Just create my objects one by one, passing them into the constructor/setting properties myself. Does this get more useful as I get more classes? Where is it practical? If I only have 5 classes that interact, probably not. What about 50 classes and each takes a couple parameters? Assuming I’m not using the configuration features (yet).

When you add configuration, it seems like a handy configuration utility, but I know that isn’t the main purpose of IoC

Wrapping up

Anyway, that’s all the time I have for this. Hopefully someone will find this interesting or at least I can reread it whenever I attempt to use these libraries in a future project. They’re interesting, well documented, and appear easy to use. I don’t have a specific need for either, so I’ll wait. I don’t want to force them into an existing project just because they are cool. I’ll wait until I need them.

Returning to the site just now, I noticed a “Using” link in the header. It looks like there is a lot of good info in here. Maybe it could be linked to from some of the documentation. Maybe a see here for some other useful info?

Posted in Software Development | Tagged , , | 4 Comments

Avoiding the startup time for webservice xml serialization

The short version

In the build tab of a project’s properties is an option called “Generate serialization assembly”, turn it to “On” to theoretically improve performance.

The long version

Recently I’ve been working on speeding up a web application that depends heavily on a huge webservice: 884 “operations” are supportedFirebug + document.getElementsByTagName(“li”).length, the wsdl is 2 megabytes. Startup takes several minutes before anything happens. And it is mostly the startup time causing problems, things go smoothly after that.

While trying to improve things I found this single line causing most of the delay: _myStore = new WebServices3(); And it was only the first time that the webservice was initialized that the delay happened.

I started searching and ran across a knowledgebase article explaining how to create an XmlSerializers assembly. Apparently the XmlSerialization process usually generates code at runtime and this can take a while. The article explained how to pregenerate this code to save startup time later. I tried it, it didn’t seem to help all that much and it was a pain to fit into the build process.

I later found a page on MarkItUp about SGen.exe. It was a new feature in .net 2.0 that I remember hearing about. Then I found this post on kiwidude.com about how Visual Studio didn’t call sgen correctly for him.

I never noticed it before (maybe because I had to scroll down the properties page), but there was a simple drop down in Visual Studio for this. Switching it from Auto to On built the assembly automatically!

XmlSerialization

The end

Once enabled, build time became much longer and startup times were a little better. The change wasn’t as dramatic as I had hoped. I think from here I’m going to create a much smaller, specialized web service since I have access to the web service machine and we’re only using a handful of the 800 methods available.

Posted in Software Development | Tagged , , | Leave a comment

Points to consider when evaluating a JavaScript framework

I found How to choose a JavaScript framework » d’bug (via Ajaxian). In it the author brings up several things to consider when evaluating a framework.

It’s somewhat related to my earlier post on looking for a comparison of JavaScript frameworks, and his was posted just a day before mine.

It’s not the comparison table I was looking for, but if I ever get around to making that table I’ll certainly use some of the points mentioned in it. I think most of the article could apply to any framework developer tool, not just JavaScript frameworks.

Posted in Software Development | Tagged , | Leave a comment

JavaScript syntax hightlighters

I found some really cool code editors and syntax hightlighters written in JavaScript and I thought I’d share.

The best I’ve found so far is CodePress. It supports many languages, hightlights as you type, adds line numbers, and seems the most reliable.

CodeMirror is another one I found. While it isn’t as polished as CodePress, he describes how he went about creating it which I found helpful and interesting (especially the bit about the maniacal gnome.)

EditArea is another impressive one, but I haven’t looked into it too much.

CodeArea 2 has an example editing html, but I can’t read any of the text around it since it is not written in English. It’s a .cz domain, the Czech Republic, where the speak Czech apparently.

Also, while looking for editors, I stumbled across a vi clone in JavaScript. It is impressively complete. It’s almost as cool as DHTML Lemmings.

Edit 11/2/07 1:33PM: removed funky font tags.

Posted in Software Development | Tagged | Leave a comment

So many JavaScript libraries!

Just looking around for some JavaScript libraries to use in some new code, I came up with all these libraries:

  1. Prototype
  2. jQuery
  3. MochiKit
  4. MooTools
  5. script.aculo.us
  6. Dojo
  7. Ext JS
  8. ASP.NET AJAX Control Toolkit
  9. The Yahoo! User Interface Library (YUI)
  10. SimpleJS

I haven’t been able to find a decent comparison of the different frameworks (what they do, compatibility, download size). I might come up with my own table soon if I can’t find anything.

I have used the ASP.NET AJAX Control ToolkitASP.NET AJAX Control Toolkit with ASP.NET AJAX are two different things btw. I’ve just been calling the whole thing msajax just because the naming is so ambigous, YUI, and Prototype so far. I think those three are compatible, but I’m not sure. (What I should say is nothing has broken from using the three libraries in a single app.)

Does anyone out there have any good comparisons between all the major libraries?

Posted in Software Development | Tagged | 3 Comments