Tuesday, May 17, 2005

VS 2005 Beta 2 has arrived!

I walked in my office today and opened the yellow envelope on the floor by the door to find:

  • Visual Studio 2005 Beta 2 - Team Suite CD
  • Visual Studio 2005 Beta 2 - Team Foundation Server
  • SQL Server 2005 Developer Edition - 365 day trial
Now I have to find the time to reformat my machine because there is no way I am installing anything heavy on it right now... it's running too slow.

Why in the world does VS2003 start moving like molasses after a couple months of use? When I add a new item to my solution I have to wait 3 full minutes before I regain control of the computer... how ghey.
Tuesday, May 03, 2005

ASP.NET 1.1 Master Pages

I was too impatient to wait for .NET 2.0's Master Pages, so I started to look at some of the (many) implementations for master pages in ASP.NET 1.1 ...


I ran across this article at CodeProject and I started to implement it in my new project. The basic idea behind it is to parse a child page (Context Page) and before Viewstate is even loaded, it does a Server.Execute to execute the desired master page, and the master page just loads its controls into the HttpContext (it makes sure not to render itself). The execution resumes at the Context page and the entire control collection of <form> is copied into a specifically named control and finishes execution!



The master page looks like this:


<html>
...
//header & navigation
<div id="masterContextContainer"> </div>

//footer
</html>




That's it! Mark the class with the [MasterPage()] attribute and it's ready to go!



The Context Page is just a normal aspx page that has the class marked as [ContextPage(masterPageAlias)] and it's done.



There are a number of different methods to accomplish this, but I found this one to be very nice because A) I can inherit my PageBase class from this MasterContextPage and start using it on existing web forms... B) it's very clever!


The only thing I found that is a little iffy is the Tracing. If you have both pages enabled it messes up, so make sure and set the Master Page to trace="false" so that you don't get any conflicts with control id's.
Sunday, May 01, 2005

Hear my email on .NET Rocks!

Carl Franklin from .NET Rocks! chose my email to read on the next show. Tune in and listen...

For my prize I got to pick from their section of "useless crap", and I chose the big-ass coffee mug... because I can always use more coffee! (I guess I am not dorky enough to wear a skin tight baseball shirt or truckers hat that says ".NET Rocks!" on it... )

If you aren't a regular listener, you should really try it out, most of the time you'll learn a thing or two new, and it's sometimes pretty funny. My favorite shows were with Scott Hanselman & Rory Blyth and Bill Vaughn & Rocky Lohtka. Here's a hilarious quote from the show:

"I'm done with objects."

- Rocky Lohtka on .NET Rocks at Dev Connections 2005

Thursday, April 28, 2005

NHibernate and ASP.NET - Part 2

After some toying around, I have my first object Saving/Updating/Deleting and using a GetAll method to bind to a Datagrid. All of this with about 5 or 6 lines of UI code! Yummy!

I still have some design concerns to wrinkle out, though. Here's how I have mine set up:

public class NHManager
{
public NHManager()
{
//load config

//create session factory
}
}


public abstract class BusinessBase
{
private static NHManager _mgr = null;
[ThreadStatic()]
protected static NHManager Manager
{
get
{
if( _mgr == null)
_mgr = new NHManager();
return _mgr;
}
}

private ISession _session = null;
protected ISession CurrentSession
{
get
{
if( _session == null )
{
//see if context contains it
if( HttpContext.Current[NHSESSION] == null )
//key is a constant
{

//this is the first access for this request,
//load the object

_session = Manager.OpenSession();
HttpContext.Current[NHSESSION] = _session;
}
else
{
//it exists in this request
_session = HttpContext.Current[NHSESSION]
as ISession;
}
}
//make sure it's connected
if(! _session.IsConnected)
_session.ReConnect();
return _session;
}
}
}


Is there anything glaringly wrong about the above sample? I am expecting a little flaming due to the [ThreadStatic()] in my ASP.NET Application, but is it really that bad since my manager object is WORM (Write Once Read Many) ???

I welcome suggestions and comments (now that they will actually work :P )

New template

Well I gave up on the old template because I recently was told that nobody can reply to any of my posts! I wonder what this has to do with the template that I was using, but I think that was the culprit. Maybe people actually do read this after all. :)
Wednesday, April 27, 2005

NHibernate and ASP.NET

If you haven't seen Nhibernate yet, you should really check it out. There are a lot of free ORM tools out there, but this one seems to be the most liked, as far as I've read. I am implementing it in a new project at work and so far I am liking it. A lot.

What I like best is that my Base business object can implement all of the details in Saving, Updating, and deleting objects... all I have to do is make sure and create the xml mapping file and all is taken care of for me.

I do have some design concerns though, as I don't want my front-end coupled to NHibernate at all. The UI developer shouldn't even have to know the workings of the object persistance, he/she should just call BusinessObject.Save() and let the Data Layer handle it.

So, following some advice on TSS and Code Project I decided to abstract the nitty-gritty into a static class.

Ooh, did I just say static? That must be wrong... Static classes are not very reliable in a web application, as you don't control it's lifetime at all. So I have some basic code that generates the necessary configuration, loads my persistant classes into NHibernate, and builds the session factory, and this is all static. As far as the application goes, we won't be able to tell it isn't working because the static members will just be recreated once they are lost. I'm concerned about the performance hit that we will suffer because of this.

I also want to avoid tying it to the Application bag, because that introduces a coupling between the UI and the Class library.

I'm sort of stumped at this point, and I haven't read anything yet that gives me a better alternative. Can someone recommend a solution?
Monday, April 11, 2005

img Border0 Styleborder1


interior 2 Posted by Hello

img Border0 Styleborder1


yet another Posted by Hello

img Border0 Styleborder1


here's another angle Posted by Hello

img Border0 Styleborder1


I'm selling my car... anyone interested? Posted by Hello
Monday, March 21, 2005

IE / Firefox and Javascript

I'm pretty sure all web developers have been annoyed a time or two (thousand) at the differences in the way Firefox and IE perform with the same HTML / Javascript. I am forced to use IE primarily at work because half of the legacy code is only IE compliant, which is kind of sad.

One recent annoyance I had was a simple one: opening a pop-up window. Here was the code:


<a onclick="window.open('url.html', 'some page', 'toolbar=no, location=no, scrollable=no');" href="#" > link < /a > 


This worked fine in Firefox, but not in IE. IE complained about "invalid argument" ... after about 3 hours of googling I found out that the page title (what I had put as "some page") has to be 1 word for IE to function properly. How retarded is that?

On a side note, checkout these cool extensions for firefox! ... Tidy is my new favorite...

Tuesday, March 08, 2005

Free books from Apress

Thanks to a link from Mykre , I now have some new books to read! Apress is giving out some eBooks for free, and they might just be worth the download! Enjoy!
Personal Loan - New York Hotel - Savings Accounts - Phoenix Pools