Tuesday, June 26, 2012

In an RDLC formatting the date to shortDate sometimes fails and s#Error, even when the data looks perfectly good.

Change this:

=Format(Fields!SurveyCompDt.Value,"dd.MM.yyyy HH:mm:ss")

To This:

=IIf(CDate(Fields!SurveyCompDt.Value)=CDate("1/1/0001"),Nothing,CDate(Fields!SurveyCompDt.Value).ToShortDateString())
and it should go away.

The bug appears to have to do with the conversion of the dates.


Thursday, June 14, 2012

A quick and dirty way to diagnose a thread collision problem in c#

If you are having a problem that looks like it might be a rcing condition or other threading type issue, here is a quick and dirty test to determine if it's threading or not. Set up a scenerio that reproduces the error (say running it in several (10) threads in a constant loop overnight) Apply this attribute to your class [Synchronization] That forces all the instances of the class to run on a single thread (way slower). Re run your test. If your problem goes away, you have a threading issue. If speed is a concern, you need to go back and do all the locking around the code that touches that object. If you convert everything to use properties for the objects in question you can just lock the getter and setter. If the quick and dirty test fails to fix the issue, it's probabaly something else. For instance if you're using unsafe code or unsafe dlls (ie stuff written in non .Net c++), it might be a memory corruption problem.

Wednesday, January 18, 2012

Nuget Commands to remember

Get packagge by Verison
Install-Package JCDCHelper.BLL -Version 3.2.2.2

Uninstall all dependances
Uninstall-Package JCDCHelper. –RemoveDependencies –Force


Try to re-install the packages. Fixes bad references
At the NuGet console say:


Update-Package -Reinstall -ProjectName Your.Project.Name

Omit '-Project' parameter if you want to re-install packages and restore references for the whole solution.

Thursday, November 3, 2011

NHibernate.MappingException: No persister for Fluent

if you get this in Jcdc

NHibernate.MappingException: No persister for

First check to be sure your EO And MAP are both public.
Also look for a spelling error in you MAP file
Verify the namespaces are correct.
Make sure you have 1 Eo to each EOMap

If your EO is in JcdcHelper, or some other assembly here is the issue

jcdcFactory.BuildFactoryByConfigFile( "~/JcdcDb.config" );

ONLY loads from the assembly of Student EO and EOMAP which is ususally YOUR apps assembly.

Here are the guts

public void BuildFactoryByConfigFile(string rawFilePathToGetMapPath)
{
// Build local fluentConfig
NHibernate.Cfg.Configuration localConfiguration = new NHibernate.Cfg.Configuration();
localConfiguration = localConfiguration.Configure(GetMapPath(rawFilePathToGetMapPath));
FluentConfiguration localFluent = Fluently.Configure(localConfiguration);
localFluent.Mappings(
m =>
{
// this step scans your assembly for EO and maps in Cis3G
// you would have to add two more lines to scan
// your JCDCHelper EO and Maps

m.HbmMappings.AddFromAssemblyOf();
m.FluentMappings.AddFromAssemblyOf()
.AddFromAssemblyOf();
}
)
.ExposeConfiguration(
cfg =>
{
cfg.SetListener(ListenerType.PreInsert, new AuditEventListener());
cfg.SetListener(ListenerType.PreUpdate, new AuditEventListener());
}
);
// build session from FluentConfiguration
localFactory = localFluent.BuildSessionFactory();

}


As you can see you woudl need to make your own copy and modify
these lines

m.HbmMappings.AddFromAssemblyOf();
m.FluentMappings.AddFromAssemblyOf()
.AddFromAssemblyOf();


to call from JcdcHelper.EO and .EOMap as well, (or whatever assembly you are using)

Thursday, September 1, 2011

StackOverflow



God I love stack overflow for Programming problems.

Just felt the need to put that out there, if you're not using it,
and you're a programmer. Start.

Tuesday, August 16, 2011

Converting to IIs 7, MVC 3 issues


I’m currently working on IIS7 for the Student Portal Project, if and when you move to it, here are a couple important issues of which to be aware.

Elmah & iis7
http://groups.google.com/group/elmah/browse_thread/thread/4bbef2f26e0c5fd1

First Request Initialization and IIS 7 with integrated mode.
http://mvolo.com/blogs/serverside/archive/2007/11/10/Integrated-mode-Request-is-not-available-in-this-context-in-Application_5F00_Start.aspx

So far these are the only big issues. Both of which have workarounds addressed in the links above.