Provide Caching For Your Complex Functions

Function caching, or more specifically memoization, is a code optimization technique that can be used to speed up code that calls complex functions with the same inputs.  Let’s take a look at the classic fibonacci function: 1: private int Fib(int val) 2: { 3: return val <= 2 ? 1 : Fib(val – 2) +…

2

Extending MVC: Auto Refreshing A Partial View Using AJAX

This is something that I put together in a few minutes to provide a way to refresh a partial view on a specified time interval. Let’s create a MVC User Control that displays the current date and time called "TimeControl.ascx": 1: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TimeControl.ascx.cs" Inherits="SAWeb.UI.Views.UserControls.TimeControl" %> 2: <div> 3: <%= DateTime.Now.ToString() %> 4:…

4

Extending MVC: Returning an Image from a Controller Action

So I was thinking tonight, what if I want my MVC application to serve images that are stored in a SQL database as binary data? Or files that are stored in the database?   One of the things that I really like about MVC is that ability to add custom functionality in a fairly simple way. …

17

Autocompletion Textbox in MVC Using jQuery

Ok, I have to admit it: jQuery is awesome.  If you haven’t started looking at it, I highly recommend that you do.  It works wonders in the ASP.NET MVC world.  One of the best things about jQuery is the enormous number of plug-ins that are available for adding even more functionality to the library. The…

30

CheckBoxList Helper for MVC

The early previews of the MVC Toolkit contained a few helpers that are not available in the current MVC Beta and MVC Beta Futures.  On of the ones that was nixed was the CheckBoxList helper.  I was in need of this type of functionality lately and found myself out of luck.  I needed to add…

18

IE8 Rocks! Slicing The Web

A few days ago, I wrote a post about creating custom IE8 Accelerators.  I thought that I would stick to the same IE8 theme and talk about another new feature that I really like: Web Slices. Here is a brief introduction about what Web Slices are (taken directly from the IE8 site): How many times…

2

IE8 Rocks! Creating Custom Accelerators

Internet Explorer 8 Beta 2 is currently available.  If you haven’t downloaded it yet, you can find it here.  I have been using it for about two months now and I am really enjoying some of the new features.  One of the features that I find particularly interesting is Accelerators. Here is a brief introduction…

8

Use PowerShell To Test Code Snippets

If you are like me, then you might have multiple Console applications in your projects folder that you use for testing small chunks of code.  I think at one point recently, I was up to ConsoleApplication28 before I cleaned up the unused projects.  These are typically used for testing small snippets of code that I…

1

Seven Years Later…

Today is the first time that I looked back on September 11, 2001 and thought "Wow, I can’t believe that was x number of years ago."  Seven years have elapsed since that fateful day, and yet I can remember the events surrounding that day like it happened only yesterday.  I am going to share the…

1

Organizing A SharePoint Document Library

Let’s say that you have a document library in SharePoint where you programmatically upload log files or daily reports.  After a few weeks the document library might contain multiple pages of documents, making finding the document that you are looking for annoying.  You have to sort by date or title and then page though the…

4