Go to home page mail me! RSS Feed

.Net Framework 3.5

Taking my key value store to another level

Before I start cramming code, I’ll like to know what you guys think. I’ve been working heavily on my key value store and it has been working as expected, however, the main reason for me building this store does not seem to be completely eliminated with the functionalities that I have in place so far. therefore, I’ll like to add an extra piece to the jigsaw but before I do so I’ll like to hear what you have to say. The storage engine itself is solid and it works with the minimal functionalities that it currently has. As a...

posted @ Saturday, March 06, 2010 8:40 PM | Feedback (0)

Adding “class” attribute to htmlAttributes of the HtmlHelper in MVC

I’ve seen lots of questions on how you can add a “class” attribute to any html tag such as the “a” tag while using the HtmlHelper class in ASP.NET MVC. The problem here is “class” is a reserved keyword in .NET so you just can’t use “class” in the htmlAttributes object of the HtmlHelper class. i.e. this will work perfectly. <%=Html.ActionLink("Log in","Login", null, new { id = "idforthislink" } %> but this won’t <%=Html.ActionLink("Log in","Login", null, new { id = "idforthislink", class ="red" } %> It will error out on class. Here is the proper way of doing it. <%=Html.ActionLink("Log in","Login", null, new...

posted @ Friday, November 27, 2009 1:22 PM | Feedback (0)

A simple way to resize an image

Here is a very simple way to resize an image using a bitmap as a canvas and the graphics object as a the resizing tool. Don’t forget to reference System.Drawing. /// <summary> /// Resizes an image from a source file to a destination file /// the destination file will contain the exact image at the size specified /// </summary> /// <param name="sourceImagePath">the source image file that needs to be resized</param> /// <param name="destinationImagePath">the destination path that the source /// image file needs to be resized to</param> /// <param name="width">the new width</param> /// <param name="height">the new height</param> static void ResizeImage(string sourceImagePath, ...

posted @ Tuesday, July 28, 2009 10:13 AM | Feedback (20)

Write out page load times using an HttpModule and the stopwatch class

One of the most efficient and non-intrusive ways you can implement an intercepting procedure is via an HttpModule. An HttpModule simply receives every request going to or coming from IIS and it allows you to manipulate the content as you see fit and pass it along. I wanted to spit out the time it takes from receiving a request to writing the response on one or more web pages and there was no other better way of doing it except writing an HttpModule, it toke me all but 10mins. Here is the code, feel free to blow it up. ...

posted @ Friday, July 24, 2009 1:40 PM | Feedback (0)

Get underlying type from a nullable type

As my forever quest for simple & reusable code keeps growing, I stumble across some bottlenecks once in a while. Anyway, I have a simple class that is called "PopulateObjectFromFormRequest" and as descriptive as the name is, it does one simple yet helpful task. Given an object as a generic type I.e (user) and a web form as a parameter I.e (aspnetform), it will scan through all the controls of that web form and use reflection on the object and assign values to the object properties that matches controls from within the form. How does this help me? Well if I my...

posted @ Tuesday, March 11, 2008 11:33 AM | Feedback (5)

MVC for Visual Studio Express 2008

For those of us who can't always afford to buy the ridiculously expensive VS Pro/Team 2008 - shouldn't Microsoft be giving those out for FREE. After all we are only promoting windows, without us developers the Windows operating system will be more or less like TinyOS. Anyway, lets leave that for another day. I like using express simply because its lightweight and I don't really use all the features of the Pro versions anyway, I only wish I could "attach to process" then the express editions would be 100% ideal for me. Any who, the express editions do not support MVC - actually...

posted @ Thursday, February 07, 2008 2:03 PM | Feedback (0)

Removing declaration and namespaces from XML (serialization)

Sometimes working with pure XML is our only option and we may just want it as clean as it can be. I usually use the XmlDocument object to load and/or create the XML and manipulate it and then at the end of the day, I'll use the InnerXml property to get pure XML, which I usually save to a file or do something with or I may just be serializing a Serializable object to XML. The XmlDocument object by default assigns a namespace to the XML string and also includes the declaration as the first line of the XML document....

posted @ Tuesday, January 29, 2008 10:27 AM | Feedback (9)

Re-installing .Net Framework 2.0, 3.5 broke it!

Who knew that installing 3.5 will bring me down to my knees. I can't do anything 2.0 anymore since I installed 3.5, it seems it installed SP1 for 2.0 and that broke everything that has to do with 2.0 and check out the icon, found out the icon was different after an hour of research trying to figure out what was wrong with my .NET applications.   Off course my first step was to re-install 2.0, however, I got the following message. Therefore, I had no other choice but to remove 3.0 and 3.5. I couldn't...

posted @ Monday, December 17, 2007 5:27 PM | Feedback (2)

ASP.NET MVC Framework - Is a go!

If you haven't been keeping track of the all new ASP.NET MVC then its time you start doing so. As of yesterdaty 12/9 the new ASP.NET (CTP) Extensions was made available to the public for download by Microsoft. The ASP.NET 3.5 Extensions Preview is a preview of new functionality being added to ASP.NET 3.5 and ADO.NET. The release includes an ASP.NET MVC, ASP.NET Dynamic Data, Silverlight controls for ASP.NET, ADO.NET Data Services, Entity Framework runtime, and new features for ASP.NET AJAX. If you don't know anything about MVC, I've listed a few links below that will give you a...

posted @ Monday, December 10, 2007 11:08 AM | Feedback (0)

Next entries »