I got this page when I looked at the logs of an application that was running for about four hours...

Somehow I don't think that the logs will be very useful in this form...
I got this page when I looked at the logs of an application that was running for about four hours...

Somehow I don't think that the logs will be very useful in this form...

This is what an interface looks like after about two week of work and seventeen refactoring. At one point, it looked like this:
interface IHaveMultipleOccurrences<T> : IHaveNameAndId, IHaveValidityRange<T> where T : IHaveValidityRange<T>
But the fear of the compiler puking on me kept the design a little simpler.
<httpModules>
<add name="UnitOfWorkModule"
type="Rhino.Commons.HttpModules.UnitOfWorkModule,
Rhino.Commons"/>
</httpModules>

I run into some very strange issues latelt with regard to Http Modules. I am using Http Modules to setup the environment for my application. In particular, I am using Unit Of Work Module to mange my Unit Of Work and the life time of application wide resources (like the Inversion Of Control container instnace).
The problem that I run into was that I began to get errors from the application, saying that the container was missing. That, of course, was not possible, since I registered the HttpModule correctly, and it certainly did it job, for a time.
The issue was mainly that after a while, never determenisticly, the application start throwing errors. But at first, it was smooth sailing. I butt my head against many walls, but I finally manage to get a stack trace of the issue.
Here is the call to Dispose(), which releases the resources required to my application:
The next request after this call, no call to Init() was made, and the application, predictably, crashed.
I googled and search and reflected for quite a while, but I can't figure out the reason for this. I'm pretty certain that if Dispose() is called on the HttpModule, the next request should call Init(), or create a whole new instnace (preferable), but in this circumstance, it looks like Dispose() is called just because it feels like it.
The server is Windows Server 2003, Enterprise, SP1, using ASP.Net 2.0. I have seen this behavior across several machines, including XP one, so I guess it is not the environment that is causing this issue.
At the moment, the only work around is to not use Dispose(), and let resource be cleaned by the Finalizer thread if neccecary.
Any thoughts?
In response for my DDD in Hebrew, I was asked why it is not recommended to code in Hebrew. I decided to question my initial response, and give it a shot. I quickly gave it a try and created the following domain model. I don't expect you to be able to read it (although if you can, you'll find it hilarious).
Here is my DDD in Hebrew, the classes are Employee (right, top), Report (Left, Top), HoursReport (Middle, Bottom), WontBeHereReport (Left, Bottom) and Repository<T> (Right, Bottom):

I run into a couple of issues just with designing this diagram:
Let us move to more serious issues, take a look at this simple program:

Main issues:
That is even beside the nice point of the enconding hell that you get yourself into. It is very easy to save this as ASCII (if you open it in an editor that doesn't support unicode, or simple use a tool to go over it) and lose all the hebrew characters.
Sorry Eliezer, but you will have to write Hebrew# and language pack, and write a translation layer for the framework if you really want me to use it.
CREATE TABLE [dbo].[NHibernatePerPageQueries](
[Id]
[int] IDENTITY(1,1) PRIMARY KEY NOT NULL,
[RequestId]
[int] NOT NULL,
[Date]
[datetime] NOT NULL,
[Message]
[nvarchar](max) NOT NULL,
[PageURL]
[nvarchar](max) NOT NULL
)
<appender name="NHibernatePerPageAppender"
type="log4net.Appender.AdoNetAppender">
<bufferSize value="10" />
<connectionType value="System.Data.SqlClient.SqlConnection,
System.Data,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
<connectionString value="Data Source=localhost;Initial
Catalog=Logs;User
ID=logger;Password=logger;" />
<commandText value="INSERT INTO dbo.[NHibernatePerPageQueries]
([Date],[Message],[PageUrl],[RequestId]) VALUES (@log_date, @message,
@pageUrl,@currentRequestId)" />
<parameter>
<parameterName value="@log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.RawTimeStampLayout" />
</parameter>
<parameter>
<parameterName value="@message" />
<dbType value="String" />
<size value="4000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%message" />
</layout>
</parameter>
<parameter>
<parameterName value="@pageUrl" />
<dbType value="String" />
<size value="2000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{nhibernate_page_url}" />
</layout>
</parameter>
<parameter>
<parameterName value="@currentRequestId"
/>
<dbType value="String" />
<size value="2000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{current_request_id}" />
</layout>
</parameter>
</appender>
<logger name="NHibernate.SQL">
<level value="DEBUG" />
<appender-ref ref="NHibernatePerPageAppender" />
</logger>
GlobalContext.Properties["nhibernate_page_url"]
= WebLoggingHelper.CurrentPage;
GlobalContext.Properties["current_request_id"]
= WebLoggingHelper.CurrentRequestId;
-- Get pages ordered by number of
total queries made from them
SELECT COUNT(*) [Number Of Queries In Page], PageUrl
FROM NHibernatePerPageQueries
WHERE substring(Message,1,1) != '@' -- remove parameters
logs
GROUP BY
PageUrl ORDER BY
COUNT(*)
-- Get pages ordered by number of
queries per page
SELECT AVG(countOfQueries)
[Number Of Queries In Page Per Request],
PageUrl FROM (
SELECT COUNT(*) countOfQueries,
PageUrl
FROM NHibernatePerPageQueries
WHERE substring(Message,1,1) != '@' -- remove parameters
logs
GROUP BY PageUrl, RequestId )
innerQuery
GROUP BY
PageUrl ORDER BY
AVG(countOfQueries)
CREATE TABLE [dbo].[PagePerformance](
[Id]
[int] PRIMARY KEY
IDENTITY(1,1) NOT NULL,
[Date]
[datetime] NOT NULL,
[Message]
[nvarchar](max) NOT NULL,
[PageURL]
[nvarchar](max) NOT NULL,
[Duration]
[nvarchar](50) NOT NULL,
[StartRequest]
[datetime] NOT NULL
)
<httpModules>
<add name="PagePerformanceModule"
type="Rhino.Commons.HttpModules.PagePerformanceModule"/>
</httpModules>
<appender name="PagePerfAppender"
type="log4net.Appender.AdoNetAppender">
<bufferSize value="10" />
<connectionType value="System.Data.SqlClient.SqlConnection,
System.Data,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<connectionString value="Data Source=localhost;Initial
Catalog=Logs;User
ID=logger;Password=logger;" />
<commandText value="INSERT INTO dbo.PagePerformance
([Date],[Message],[PageUrl],[Duration],[StartRequest]) VALUES (@log_date,
@message, @pageUrl, @duration, @startRequest)" />
<parameter>
<parameterName value="@log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.RawTimeStampLayout" />
</parameter>
<parameter>
<parameterName value="@message" />
<dbType value="String" />
<size value="4000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%message" />
</layout>
</parameter>
<parameter>
<parameterName value="@pageUrl" />
<dbType value="String" />
<size value="2000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{page_url}"
/>
</layout>
</parameter>
<parameter>
<parameterName value="@duration" />
<dbType value="String" />
<size value="50" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{page_duration}" />
</layout>
</parameter>
<parameter>
<parameterName value="@StartRequest" />
<dbType value="DateTime" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{start_request}" />
</layout>
</parameter>
</appender>
<logger name="Rhino.Commons.HttpModules.PagePerformanceModule">
<level value="DEBUG" />
<appender-ref ref="PagePerfAppender" />
</logger>
After reading Evan's Domain Driven Design book, I tried to develop software using the concepts describe in the book.
The problem is that the langauge that the client / spec talks and the langauge that I have to use to write the product are radically different. It is not just technical vs. business jargon. It is a different language with concepts that often cannot be directly translated.
Transliterating is a Bad Thing to do, and I speak from a lot of very painful experiance.
It gets to be more interesting when the business guys are using terms that has a direct technical meaning in English but not in Hebrew. One of the entities in the domain would be directly translated to EmployeeBase, and it is not the base class for the Employee class, the concept is actually very different
I managed to find reasonable alternative for most of the names (in the case above, EmployeeTemplate), but any question / talk about the code / model means that we are using both terms (in both langauges, actually) in order to talk about the same thing. Talk about confusing.
Hebrew (and Arabic) has the unique characteristic of being written right to left, so trying to write code in Hebrew is not practical (Although I would like to see anyone who can come up with a coherent system in Hebrew beyond the Hello World samples).
It seems that every time I turn around I hear programming being compared to construction, engineering, precise sciences, etc. My view on the subject is quite different. I think that most of the industry is fooled to think that there are some hard rules about computers, than the field is something that belongs to engineering. (And it is probably better to say, I'm a software engineer than a software artist).
Nevertheless, art is just as precise and methodolical as programming, not for nothing a high precentage of programmers are musicians, and just ask your common painter just how mush science goes into making a good painting. I see a lot humane things that affect software projects than a technical ones. And the final result isn't some cold and metallic thing. It's something that you put quite a bit of creativity in.
No future posts left, oh my!