Posts Tagged ‘CodePlex’

Return of the PagedList

// June 15th, 2009 // 12 Comments » // C#, LINQ, MVC

It has been nearly a year since I posted an updated version of the PagedList<T> functionality originally created by Scott Guthrie and posted by Rob Conery. Since then I have used the class in a number of projects and find it indispensable.

A few days ago, Craig Stuntz reported an interesting observation: when the first page is returned, the class performs a Skip(0). Suprisingly, this is not free. With that in mind, I set out to correct that issue as well as incorporate a few changes I’ve made over the past year. The result is nearly identical to the last posted version, just a bit more readable. Additionally…
(more…)

Kick It on DotNetKicks.comShout It on DotNetShoutOuts.com

Help Decide Sandcastle’s Fate

// June 10th, 2008 // 11 Comments » // Tools

Sandcastle – the .Net community equivalent of RDoc/JavaDoc and the spiritual successor of the now defunct NDochas been removed from CodePlex. It’s fate is currently up in the air and Microsoft is asking you for input on what should happen next. It was pulled down after the community at-large expressed reservations about Sandcastle being hosted on CodePlex while not being published under an Open Source license or even being posted in source form at all. According to the announcement on MSDN, the possible future for Sandcastle involves two scenarios:

  1. Publish the source code for Sandcastle and revive this project in Codeplex

  2. Migrate sandcastle to MSDN Code gallery at http://code.msdn.microsoft.com

I for one would love to see Sandcastle released as an open source project on CodePlex. It seems to me that Microsoft has had a great deal of success lately with releasing the MVC Framework as an open source project and I hope that they continue the trend. If you have used Sandcastle or foresee the need to have automatic code documentation generation on a project in the future, please do not hesitate to leave a comment letting the powers that be know how you feel.

Kick It on DotNetKicks.comShout It on DotNetShoutOuts.com

CssHandler: CSS + Variables

// November 16th, 2007 // 9 Comments » // Tools

It’s been more than three and a half years since Rory Blyth said “screw standards — let’s add variable support to CSS right this minute.” In retrospect, adding variables to CSS seems obvious; everyone is asking about it. There have even been one or two other .Net solutions developed, though Rory’s solution has remained my favorite. With CSS2 barely working and CSS3 not addressing the issue, those of us who are tired of repeating ourselves throughout our CSS files have no choice but to take matters into our own hands.

With that in mind I set out to update Rory’s code. Not that there was anything wrong with it in the first place, of course (this is where I try to tactfully avoid being drawn as a jerkasaurus in one of Rory’s comics), but Rory did whip the code up for a PADNUG meeting and that was about 3.5 million years ago (give or take many orders of magnitude). It was time to bring the CssHandler into 2007! Conveniently right before 2008.

Lo and behold, someone else had beat me to it. Gabe Moothart had already uploaded the CssHandler to CodePlex, and even improved upon it. While Rory’s code originally only allowed variable declarations & references and stripped comments, Gabe’s version also resolved application-relative paths (e.g.: “~/blah/blah.gif”) into browser friendly paths. I had further goals in mind though, and Gabe was kind enough to add me onto the project.

With my updates complete, I am now proud to present…

CssHandler 1.0

Features:

  • Define variables for later reference.
  • Resolve application relative paths.
  • Only link to one CSS file from your HTML page. Let the CssHandler combine additional CSS files at runtime to limit HTTP connections and share variable definitions across files.
  • All comments are stripped before render.
  • Most white-space is stripped before render.
  • HttpHandler can be mapped to *.css or can be referenced as CssHandler.axd and passed a CSS file in the query string.

Bugs fixed:

  • The @define{…} block is no longer sent down to the client.
  • Similarly named variables no longer present a problem.

Example:

The HTML references “styles.css”, which looks like:

CssHandler_stylecss

As seen above, “styles.css” references “styles2.css” via the @import statement, which looks like:

CssHandler_style2css

The CssHandler then:

  1. Intercepts the browser’s request for “styles.css”.
  2. Resolves the two URLs that are using application relative paths.
  3. Replaces the @import directive with the text from “styles2.css”.
  4. Strips all comments from the CSS.
  5. Replaces all referenced variables with their defined values.
  6. Compresses most of the CSS’s white-space.
  7. Renders the following to the browser:

CssHandler_rendered

I hope you find it as useful as I have. Many thanks to Rory Blyth and Gabe Moothart. Hopefully CSS4 will add variables and we’ll never have to use this again!

Visit the project’s CodePlex site to download.

Update (Dec. 2, 2007): Rory has posted and given his blessing, so to speak. Thanks Rory!

Kick It on DotNetKicks.comShout It on DotNetShoutOuts.com