JavaScript, CRC32, MD5 and SHA-1 …
Jon Davis and I were talking and he sent me a link to this thing called “TIDE“, which is apparently a javascript IDE written entirely in … Javascript. While digging through the examples provided, I noticed that one of them was a CRC32 function written in Javascript. Jon, being the curious one that he is, decided to snoop around on Google for a bit and found a site called “Web Toolkit” which has a bunch of various code snippets for different types of things (JavaScript, CSS, DHTML and even PHP). In the JavaScript section you can find code for implementing CRC32, MD5, SHA-1, SHA-256 and a few more functions.
Jon runs a website called CacheFile.net and thought these scripts would be fairly useful to the community as a whole if he wrapped them up into a nice JavaScript class object… and so he did.
You can find this resource at: http://cachefile.net/scripts/webtoolkit.info/
You can also find Jon’s original post on this subject here: WebToolkit.info Scripts Wrapped
jExpressionist, a jQuery Expression Builder and Test Suite
Ok, so … I was thinking to myself, hey … you know those Regular Expression Helper and Test Suites out there (RegEx Buddy, etc) … well, what about a jQuery Expression Test Suite? Why not, right?
So, I started working on one … and decided to call it “jExpressionist” (yeah, I know, how original, eh?).
You can check out jExpressionist, in all of it’s ridiculously lacking glory here:
http://projects.zoulcreations.com/jquery/jexpressionist/
I’ll be tweaking it a bit here and there as time goes by, I have a few changes on my local test server already … but somehow managed to break the IFRAME based preview-pane when I did a few $.dialog() statements … when it’s fixed, I’ll upload a ‘themed’ version of jExpressionist.
jQuery-based Card Match Demo
This is a totally unfinished, and practically abandoned demo I was working on in an attempt to learn jQuery. It’s basically your standard ‘Memory’ style game, however, the cards dont flip over (I got lazy, yeah yeah).
You can try it out here: http://projects.zoulcreations.com/jquery/match/
JsonViewEngine for ASP.NET MVC Framework
I am currently tasked with a project at work that, after building out the design documents, was going to rely on ASP.NET MVC and at the same time take advantage of the URL Rewriting that comes with it 'out of the box' for 'data source urls' for AJAX requests. We decided to use the jQuery library, and the $.getJSON() function within it to request for JSON data.
Well, if you've played with ASP.NET MVC, you've probably noticed that it doesn't have any 'quick and simple' "json serialization in a view" ... or, does it?
I recently saw Scott Guthrie at a local .NET User Group event, and he mentioned that the ASP.NET MVC Framework was completely "pluggable", and you could easily replace the built-in View Engine. So, I immediately searched for examples, found one ... tossed it out and whipped together a really quick and simple 'JsonViewEngine' class.
Here's the code:
C#:
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Security.Permissions; using System.Web; using System.Web.Script.Serialization; using System.Web.UI; using System.Web.Mvc; namespace Sim.Microsite.Framework.Web.Mvc.JsonViewEngine { [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] public class JsonViewEngine: IViewEngine { #region IViewEngine Members public void RenderView(ViewContext viewContext) { if (viewContext == null) { } viewContext.HttpContext.Response.Clear(); viewContext.HttpContext.Response.ContentType = "application/json"; jsonWriter.Write(viewContext.ViewData); viewContext.HttpContext.Response.Write( jsonText.ToString() ); } #endregion } }
As you may or may not be able to tell, I am using the JsonFx serializer for this project, but you could easily replace that with the built-in System.Web.Script.Serialization.JavaScriptSerializer or any other library of your choice.
After building this, I also decided to take it and create an XmlViewEngine that simply returns XML data, as we have some use for that as well with this project ... I'll leave you to implement that on your own, it's basically the same code ... just uses XmlSerializer instead -- however, I wrote some custom code for serializing the IDictionary that the default ViewPage uses for ViewData (even though ViewData is defined as an object in the viewContext ... ViewPage defines it as generic dictionary).
So ... have fun with that.


