December 23rd, 2007 Luke
I really like SubSonic. I think out of everything that I’ve experienced with ASP.Net, SubSonic has to be the coolest thing I’ve encountered thus far(I’m not optimistic about finding anything cooler - SubSonic is pretty sweet).
However, each time that you create a new project that uses SubSonic, you have to do a few setuppy things - like creating an App_Code directory, and editing your web.config - that are virtually the same across pretty much every SubSonic project that you start.
So, to that end, I’ve created a few Visual Studio 2005 templates that should speed the process up.
They’re all ready to go, and all you need to do is fill in the $connectionstring$ in your web.config file - and then you’re good to go! They use SubSonic’s Build Provider to do all of the generating.
I made three template installers - one to install the VB template, one for the C# template, and one that installs both - just in case you want both of them.
Here are the downloads:
Enjoy!
Posted in ASP.Net, subsonic, templates | No Comments »
December 21st, 2007 Luke
This is a handy little function I whipped up that will allow you to pass in three dates, and check if one date is between two others.
function dateWithin(beginDate,endDate,checkDate) {
var b,e,c;
b = Date.parse(beginDate);
e = Date.parse(endDate);
c = Date.parse(checkDate);
if((c <= e && c >= b)) {
return true;
}
return false;
}
Enjoy!
Posted in javascript, snippet | No Comments »
December 12th, 2007 Luke
Have you ever encountered a moment where you needed to store a DataReader into a DataTable?
I seem to all the time. And after reading through many, many articles where they just loop through the rows in the DataReader and add them to the destination DataTable, I thought to myself “there has to be a better way to do this”.
And there is. It’s surprisingly simple. Take a look:
DataTable myTable = new DataTable();
myTable.TableName = "MyTable";
myTable.load(myDataReader);
And that’s all there is to it. Upon inspection, you will see that myTable now has the contents of myDataReader inside of it.
Posted in ASP.Net, snippet | No Comments »
December 3rd, 2007 Luke
Have you ever stored an image in your database, only to find that it’s not quite the type of image you’re looking for?
Maybe you’d prefer a PNG or a TIFF, when all you’ve been given is a cruddy old JPEG.
Have no fear! C#’s Image is here!
All you need to do to convert an image from one type to another type is read it into an Image object, and then save it using the mime-type you want.
Image testImg = Image.FromFile("test.jpg");
testImg.Save("test.png", ImageFormat.Png);
And you’re done! Enjoy your shiny new .png file.
Posted in ASP.Net, image | No Comments »