Mark Rogers
  • Json Pretty Printer/Beautifier Library For .Net

    Friday, April 16, 2010

    In the current project I'm working on, I need to create a lot of configuration/data files for when the application builds the database (Fluent-Nhibernate). This appears necessary because the application must populate the database with some default mostly static domain objects that are required for the application to begin working normally.

    The two main .net json Beautifiers were Jayrock, and the C# source code of a "quick and dirty" json pretty printer by Raymond Glover . I actually like Raymond's a little better, because Jayrock is more of a general purpose Json library rather than being focused on pretty printing.

    Raymond's was cool, but I wanted one that would conform exactly to a specific json beautifier JsonLint . Seeing how short and easy it was for Raymond, I decided to write my own json beautifier/pretty printer and wire it up to my blog. I think I mostly wanted an excuse to use the strategy pattern in a situation where it appeared to be needed.

    You can download the DLL here (using .net framework 3.5). [10k] or the source code here. [223k, zip]

    You can use the pretty printer object or just the extension methods I've provided. I've included json and/or beautifing extension methods, for ease of use.

  • jqGrid missing search codes

    Wednesday, November 18, 2009

    One thing in particular I found missing, was that when you are implementing searching you have to be able to translate the search operator codes sent by the grid to the server into something you can use on the server side. One mildly frustrating problem was that the documentation only lists 9 of the 14 total search operator codes that you have to translate.

    I'll list the rest of the codes here:
    bn - not begins with ( !(LIKE val%) )
    in - is in ( checks if the searchField is in the searchString )
    ni - is not in (checks if the searchField is not in the searchString )
    en - does not end with (!(LIKE %val) )
    nc - does not contain (!(LIKE %val%))
  • Random Name Generator .Net Library

    Thursday, November 05, 2009

    While I was working on my current project, I found I needed the ability to generate a name randomly. Pretty simple task, but I have been unable to google a free .net random name generating library that I could use. After reading this question, I came to the conclusion that no such library exists. So I decided to make one myself, and give it out for free in the hopes that it might generate a few hits.

    You can try it out right here:

    : Click To Generate
    : Click To Generate
  • There Can Be Only One!

    Wednesday, October 07, 2009

    One of the main reasons I setup my own custom site, was to begin experimenting with SEO. Search engine optimization is one of the primary ways to get new surfers to your website.

  • SchemaUpdate for NHibernate

    Monday, October 05, 2009

    I was looking into how SchemaExport and SchemaUpdate work for NHibernate.Tool.hbm2ddl. I'm about to put another website up and I wanted to be able to generate the database schema for the new site, instead of creating the tables by hand. I've done this for a couple applications before, but I have to admit to only vaguely understanding how hbm2ddl works. This is probably do to the almost total lack of documentation on these features, outside of a quick run-down in the nhibernate docs .

    At first glance it looks like Export generates SQL create table statements, and SchemaUpdate generates a bunch of update statements. But one thing I was curious about was whether or not SchemaUpdate would create new tables if they didn't exist. After looking at the current nhibernate source code, it appears that SchemaUpdate iterates through each table and if the table exists in the destination database then it generates an update script, otherwise it generates a create script.

  • Encryption Blues

    Thursday, October 01, 2009
    Currently I'm trying to create a single-sign on solution, and I was having trouble because sometimes (but not always) the encrypted text would fail to decrypt. I found out that the later .net versions have stricter checking for valid characters. So when the encrypted byte array was converted to a string, the encoding process would create characters that the stricter decoding process did not like. This article on msdn's .net security blog finally helped me out.
    Filed under | 0 comments »
  • First Post

    Friday, September 04, 2009
    I Just set this thing up, now lets see if I can get it to do what I want!
    Filed under | 0 comments »