VerySimple Developer Blog
Technical Tips, Tricks and Rants.

Archive for March, 2006

 
Mar
30
Filed Under (.NET) by Jason on 30-03-2006

This error indicates that the class could not be found when NHibernate is initializing. The key here is “from assembly NHibernate” The reason I was getting this error is because I didn’t realize that you have to specify not only the name of the class (including the namespace prefix), but also the assembly name after the class. I would have thought that NHibernate would have known the assembly name since I was giving it the full namespace, but apparently this is not the case.

For example:

[code:1:441355f572]
<class name=”myassembly.model.Foo” table=”foo”>
[/code:1:441355f572]

This is not enough information. You must also specify the assembly name, or else NHibernate uses the default assembly name of “NHibernate” It should really look like this:

[code:1:441355f572]
<class name=”myassembly.model.Foo,myassembly” table=”foo”>
[/code:1:441355f572]

myassembly would typically being the name of your .NET project. In this case, all objects are being organized in the namespace myassembly.model.

this also applies when mapping relationships:

[code:1:441355f572]
<many-to-one name=”child” column=”child_id” class=”myassembly.model.Child” not-null=”true”/>
[/code:1:441355f572]

should be:

[code:1:441355f572]
<many-to-one name=”child” column=”child_id” class=”myassembly.model.Child, myassembly” not-null=”true”/>
[/code:1:441355f572]

 

 
Mar
30
Filed Under (.NET) by Jason on 30-03-2006

If you’re writing .NET applications, when you test them in FireFox, they may look totally different than in IE. The first thing you probably notice is that input boxes are all the default width. Anything that you’ve resized in the designer doesn’t display in FireFox. If you use the Visual Studio designer to resize controls, when you look at the source, you’ll see that this is all done with the style attribute and not using width/height attributes.

The reason that this is happening it turns out is that .NET doesn’t recognize FireFox as a modern browser and is “dumbing down” the html output. It’s removing all the style attributes because it doesn’t know if FireFox can handle them.

Luckily, this is one of those problems that has a quick fix, as it turns out. All you have to do is tell .NET how to identify FireFox. In the old days of classic ASP, there was a file on the server called browscap.ini that contained all of this information. For .NET apps, there’s a couple of places to configure the info. machine.config has settings using for the entire server. If you don’t have access to this file, you can even put it in your web.config file just for your app.

Today is really your lucky day because Rob Eberhardt has already created the browser identification code and you can just copy/paste it. The code is found at his site [url]http://slingfive.com/pages/code/browserCaps/[/url]

Rob’s page explains it all but in brief, just download his BrowseCap code and copy/paste it in your web.config file just above the </system.web> tag.

 

 
Mar
30
Filed Under (MySQL) by Jason on 30-03-2006

If you ever get this error when trying to connect your application to a MySQL server, it’s because as of 4.1 MySQL made changes to the authentication method used. Most hosts are still running PHP that does not support this new authentication and so any application (PHPBB, etc) that you try to install won’t work.

A workaround for this is that you can configure MySQL to use the old password format for a specific account. You do that with the following SQL command:

[code:1:cb08e73675]
SET PASSWORD FOR ’some_user’@’some_host’ = OLD_PASSWORD(’newpwd’);
[/code:1:cb08e73675]

(Obviously use your own username/password.) This will instruct MySQL to use the older password format for the specified account. Once you do this, clients that don’t support the new password format will be able to login using this account.

More information can be found at [url]http://dev.mysql.com/doc/mysql/en/common-errors.html[/url]

 

« Previous Entries Next Entries »
Close
  • Social Web

NOTE: Email is disabled

E-mail It