█ ███ ██████████ █ ████ ████████████ ██████████████████  ███████████████ ██████ ████████████████████   ███████   ██████ ████ ██████████ ███████████████████████

████████████████████ ████████ ████ ████ █████████ ███ ████ ████████ ████████████ ████ █████ ██████ ██████████ ██ ███ ████ ███████ ███ ████ ██ █████ ███ ███ █████ █████████ ███████████ █████████████████ █████ █ █ █ ████ ███ ████ ███ ██████ ████████████  ██████  ███████████ ███████ ███ ██████ ███ █████ ██ ████████████ █████ ██████ ███ █ ███████████ ███ ██ █████ ██ ████ ███ ██████ ███████████ █████ ███ ████████ █████ ███ ███████ ██████ █████ ██ ████ ████████ █████ █████ ███████ ██ ███████ ██ ████████ ████ ██████████ █████ ██████████████ █████████ ██████ █████ ███████████

████ █████ ████████ ████████████████ ███ ███████  █ █ █ ██ █████ ███████ ███████████ █████ ███ ██████ ██████████ █████████ ████████ ████████ ███ █████ ████████████

██ █████ ██████ █████████ ███████████ █████ █ ████ █████ ███ ███████ ████████ █████████████

█████ ███ ███████ █████████ ███████████ █ ███████ ██ ███████ ███ ██████  ██████ ██ ████████████

██████ ███ █ ███████ ███ ████████ ████████ █████ ██████ ██████ ███████ █████ ████ ████ ████ ██████ █████ ██ ████ ███████ ████ ██████ ███ ████ █████ ██████ ███████

██████ ██ ██ ██ ████ ███ ██████ ████ █████████ ███ █████ ███ ██████ █████ ████████ █████ ██████ █████ █████ ███ ███████ ██████ ████████████ ████████████████████████████████████████████████████████████████████████████ ███████ █████████ ██████ █ ███ ██ ██████████ ██████████ ███████████ █████████ ███████ ██████ ███ ███████ █████ █ █████ ████████████ ███████ ██████ ████ ██████████ ██████████████████ ██████████████████ ██████████████ ███████ ██████ ███ ████████ ████ ████████ ██ █████████ ██████ ████████████ ██████████████ █████████ ██████ ████ ██████

████████████ █████████████████ █████████████████████████ ███████████████ █████████████ ██████ ████████████████████████ █████████████████ █ ██████████

I feel bad I am late to the game on this, but the most important part is that I am in the game.

For more information about SOPA and PIPA please use google or these links:

I really like the writeup in the Dreamhost blog.  If these bills go through it will be the end of the Internet as we have known it. And not for the better.

And of course this blog too will be shutdown on the 18th.  Sorry to my one follower, but it all for the better.

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

A New York City subway train holds 1,200 people. This blog was viewed about 3,900 times in 2011. If it were a NYC subway train, it would take about 3 trips to carry that many people.

Click here to see the complete report.

There is noting special about this recipe, I am only recording it because it turned out awesome.  It stared with a ham shank bone left over from a ham dinner the family ate.    It was a Cook’s spiral cut ham, hickory smoked and not glazed.  I used whole cloves when warming the ham; I love cloves in ham, the wife does not, what does she know about flavor?  Can’t believe we were fighting over such a thing.  She didn’t even eat any left-over sandwiches. Anyway, I only mention the cloves because I strongly feel they add another layer of goodness to this soup.

I kept the bone and part of the ham which was not sliced by Cook’s machines.  I put it in a plastic bag right away after carving up the shank to ensure I had it for the soup.  There was a good chunk of meat and skin, oh the flavor that brings.

On soup making day I gathered the following fresh materials:

1    Lbs split peas
1    cup chopped onion
1    cup chopped carrot
1    cup chopped celery
4    cloves garlic, minced
2    Tbsp unsalted butter
4    cups of chicken stock (Used Swanson in a box)
4    cups of cold tap water
1    can Swanson vegetable broth (almost 2 cups)
2    tsp dry Thyme
2    tsp cumin
3    dry bay leaves (Loral leaves)
1    large white (baking potato)
2    red potatoes

Kosher salt
fresh ground pepper

In a 8 quart stock pot I began by melting the two table spoons of butter.  Once melted I threw in the onions, carrots and celery.  I topped them with a heavy pinch of kosher salt and a few turns of the pepper mill.  I turned down the heat to medium low, as I am just sweating the vegetables, I don’t want them to brown.

While the vegetables were doing their thing, I minced up the garlic, turned back and stirred the vegetables, and continued to mince the garlic.  Nothing like multitasking.    Once the vegetables started to soften and the onions were more translucent I through in the garlic and stirred it in.  I let that cook for a minute or so.

The pound of split peas need to be inspected for rocks and other debris (what a strange word spelling).  Once clear of crap, rinse well using a strainer.

The vegetables are looking good, so I throw in the peas and stir them in.  I remove the big chunk of ham off of the bone (the part which wasn’t sliced by Cook’s).  There is still ham on the bone, which is right next to the bone.  This meat will appear stringier.  Leave this ham on, it needs to cook in the soup.  Place the bone in the pot.

I poor the four cups of  chicken broth in along with the four cups of cold tap water.  The bone is still sticking out of the broth a bit, so I throw in a can of vegetable broth.  That looks better.  A little stir and everything is covered up.

Time for spices.  Damn, only pieces of bay leaf left.  I find six of the larger pieces (so they are easier to pick out later) and throw them in.  I am assuming it’s about three whole leafs.  Thyme, need some thyme, where the heck is it.  Can’t remember when I cooked something with Thyme.  Oh there it is, way back in the cupboard (another strange spelling for a word).  Hmmm, this stuff looks a little old.  I dump about two teaspoons in my palm and rub my hands together hoping I can get a little something out of this old stuff.  The smell is stronger, I think that will work.  Hey look, cumin, I like cumin, lets dump some in.  I dump about one-half table spoon of cumin in the pot.

Ah, now that looks like some good soup.  I turn up the heat and stir it a bit more.  Time to get this sucker up to a boil.  Once boiling, I stir again, turn the heat all the way down and put on the cover.

The soup needs to simmer like this for one hour.  There really isn’t a reason to sir it, though it can’t hurt to do it two or three time during the hour.

The hour is up, so I pull the bone out and remove all the meat from it I can.  I don’t too crazy, as I have a good chuck of meat that I saved earlier.  Once de-meated, I throw the bone back in, just in case there is any flavor it may have left to give up for us.

I cut up the meat I removed from the bone and then grab, the still cold, meat that was kept earlier (the part not cut by Cook’s spiraling equipment).  I cut this meat up into cubes, about three-eights in size.  I remove some of the larger chunks of fat, but keep some.  I also keep the skin on many of the pieces.  All good flavor.

Once the meat is cut-up, I peal and cut the potatoes into one-half inch pieces.  I just throw all thi sin the same bowl waiting to go into the pot.

It’s  been about a half hour since I took the meat off the bone.  I go fishing for it again and remove any soup stuff which may be sticking to it.  The bone goes in the trash and all the cut up meat and potatoes goes into the pot.  While stirring this in the soup seemed to have cooked down a lot.  So I throw in another two cups of water.  After doing that, one probably would have been enough, but too late now.  Still looks great, nonetheless.

I turn up the heat to get the soup back up to a boil.  There are a lot of heavy items in the soup now, all of the cooked peas and those potatoes.  If I am not careful, I could easily burn this stuff sitting on the bottom.  So it is a good idea to keep an eye on things and sir that stuff up off the bottom every once in a while.  Once the soup is getting back to a boil (just a few bubbles, I see the stuff moving) I turn the flame back down to low and stir that stuff up off the bottom.  I cover up the pot and let the potatoes cook and the ham get hot.

After about another half hour, it was done.  I took the cover off, gave it a good stir and let it sit for a while.  That soup looked tired from all that cooking.

twenty minutes later I poured a bowl, fell in love and decided to write it all down.  Boy I hope I can do this again as well.

Disclaimer: If you follow these measurements like the gospel your soup will probably suck.  There is as much gut-feeling as there are measurements into making a good soup.  Don’t keep doctoring it, and just let it do it’s thing.

By the way, I got the recipe idea for this soup from four other recipes.  I just took the pieces I wanted and used them.  Soup rules are so simple :)

After four or so years of using wordpress.com for my blog I finally figured out how to highlight code (prettify) in a blog post.

Thank you to @jasonclevine who sent me message on twitter on how to do this.

All you need to do is wrap your code with

[sourcecode language="xxxx"]

[/sourcecode]

There are a bunch of different languages supported and other options which can be defined.  You can find all the details here: http://en.support.wordpress.com/code/posting-source-code/

I ran into a styling issue last night and it is driving me nuts.  I have found a work-around, but I want to see if I can figure out how to do this way.

I have a span tag which I am using for a button.  This button calls a JavaScript function to test blog posting settings.  I am using a span because it was easy enough to style.

CSS:


#VerifyBlogClick {
/*#696969*/
color:#575757;
border:1px solid gray;
background-color:#eee;
padding:2px 5px 2px 5px;
margin:0 0 0 13px;
border-radius: 2px;
}
#VerifyBlogClick:hover {
color:Black;
background-color:#bbb;
cursor:pointer;
}
.verifierRunning {
padding-right:30px;
background-image:url(ajaxloaderBlue.gif);
background-repeat:no-repeat;
background-position:right;
}

HTML:


<span id="VerifyBlogClick" onclick="javascript:verifyBlog_click()" title="Tries to send an unpublished test post to your blog">Verify Blog</span>

JavaScript:


$('#VerifyBlogClick').addClass('verifierRunning');

// ... stuff

$('#VerifyBlogClick').removeClass('verifierRunning');

Basically what I have here is a span styled like a button.  When the button is clicked I add the class .verifierRunning to the span tag using jquery. This class changes border-right to 20px and defines a background image (a loading image).

The problem that I am running into is that any properties defined in the id selector are not overridden by the class.  It seems that id’s always have a higher precedence than a class.  I can’t believe that there isn’t a way around this, though I have not been able to find anything on the web which will work.

My work-around this is to change VerifyBlogClick to a class.  I don’t mind doing this, I would just like to find out a way to do this the other way.

I just took the long silly way around to return a json result to  a page.  I kept trying to send a json string back as just that, a string and it just wouldn’t work.  Whenever JavaScript received the string it didn’t know what to do with it, except treat it as a string of course.  I banged my head against this one for too many hours.  Though my persistence payed off.

As the night got later (I think it’s 03:00 about now) I decided to figure out how others are returning json object from ASP.NET MVC.  It isn’t as simple as it should be, but not too difficult.  The biggest issue, as with much in MVC land is the huge lack of documentation.  So looking up something like JsonResult, yields a pretty useless help page.  So more time had to go into discovering on how to actually use this cool new result type.

It turns out you can set up and action with a return type of JsonResult (it’s usually ActionResult) and have that action return a json object.  I am not even going to pretend I can do this from other objects like json.net (from James Newton-King).  I am using this to return a model as json which populates my form with on-demand instructions.  This library rocks, but I digress.

The basic structure I used is a dictionary object

public JsonResult MyAction()
{
  Dictionary<string, string> dict = new Dictionary<string, string>();
  dict.Add("keya", "valuea");
  dict.Add("keyb", "valueb");
  return Json(dict);
}

That’s pretty much it in a nutshell.  Json() is a new web helper in MVC3.  You can find it at System.Web.Helpers.

I saw one example where you can build an object on the fly, but I couldn’t get it to work.  It basically looks like this:


//....
return Json(new {keya = valuea, keyb = valueb};

The dictionary generic works for now.  If you know of a better way, please let me know.

While working on Blog by Email (http://blogbyemail.com) I came across the necessity to create my own HTML helper class.  For those who don’t know helper classes “…reduce the amount of tedious typing of HTML tags that you must perform to create a standard HTML page.”

The registration request form on the site was getting hit pretty hard by spam bots and I was getting tired of cleaning up the mess, so I decided to add a captcha.

ReCaptcha is what I decided on and started down the rabbit hole.  First of all there was only ASP.NET examples.  Since I was writing this in ASP.NET MVC, I wanted to use a more, “MVC” approach to it.  I came across an post on Devlicio.us named Using ReCaptcha with Asp.Net MVC.  The post covered exactly everything I need, what it was missing is details around its steps, specifically Step 5 – Create a Html Helper to build and render the Captcha control. It shows the current code and nothing else:

public static string GenerateCaptcha( this HtmlHelper helper )
{
  var captchaControl = new Recaptcha.RecaptchaControl
    {
      ID = "recaptcha",
      Theme = "blackglass",
      PublicKey = -- Put Public Key Here --,
      PrivateKey = -- Put Private Key Here --
    };
  var htmlWriter = new HtmlTextWriter( new StringWriter() );
  captchaControl.RenderControl(htmlWriter);
  return htmlWriter.InnerWriter.ToString();
}

My first thought, is cool, I can just add an HTML helper to the view to generate the captcha, this is a good approach.

First stumble, that is a method, that needs to go into a class–what class should it go in to?

No problem, I’ll just look up creating helper methods.  That was an easy search which rendered an ASP.Net site page, Creating Custom HTML Helpers.  Great, now I have my examples.  I matched it to an extension method; okay, I get that, I have used those before.  I learned the syntax and added it to my site.

It doesn’t come up in Inteli-sense.  What can it be.  I changed all kinds of things around, from renaming the class, to changing the method name.  I was wondering if it followed some naming scheme like controllers and models do.  I don’t recall it needing to.

I decided to browse though the comments, see if anyone else ran into this.  And there is was, someone named, ianchadwick mentioned a way to make the namespace global in the web.config.  Well, damn, that is it, the view doesn’t know about my namespace BlogByEmail.Helpers.  I added @using BlogByEmail.Helpers; to the top of the page, and everything fell into place.

To use the helper in the view simply use @Html.Raw(Html.GenerateCaptcha())

Html.Raw is needed to keep MVC from HTML Encoding the output.

Damn I feel dumb sometimes.  …back to my code!

For some time now I have wanted to post to a blog from an email account.  Some blog engines these days have this functionality, like WordPress and TypePad.  Some through plug-ins and some built in.  I have used the WordPress plug-in on a test installation, and it works pretty well.  Though WordPress is probably my most preferred blogging engine, most of the time when I am installing blogs, it’s on a Microsoft stack and I am not big on running PHP on Windows.  On the Windows stack I really like using Blogengine.NET.  I find it to be a very capable blogging engine.  The only problem is, at least to date, I have not found a plug-in for it to post by email.  What it does support though is XML-RPC.

With the Help of the XML-RPC.NET library and a few hours away from the family, I through together a rough blog posting application.

I added in OpenPop.NET, a popmail client library I have used in the past, and now have a way to collect emails.  Now all I needed to do is tie them all together.

The outcome is Blog by Email (http://blogbyemail.com).  An online service for setting up email accounts to post to blogging engines.  Besides looking like crap (I am using the generic MVC layout), it is functioning well. I am hoping my buddy will give me a hand coming up with a real design for the site.

The biggest challenge to setup posting to a blog is finguring out what XML-RPC entry point is, and what the blogging engine uses for the Blog Id.  The blog id is often the name of the blog, but I found in MovableType it uses the actual integer value assigned to that blog.  Bit of a pain to get that value.  A cool aspect of MovableType is that it generates a password to use for posting via XML-RPC.  A nice security feature.

Speaking of security, to protect the users entered credentials I am encrypting both usernames and passwords in the database.  Also, each user is given a unique key pair when the sign up with the service.  Little steps to make it harder to get this information in case someone does hack the application.

 

If you need to post to your blog from a POPMAIL email address, give Blog by Email a try.  The service is free (at least until it grows to the point where it needs a bigger web server).

While the site is getting off the ground and I get the code stable, registration is closed.  There is a form request an account.  I am looking for people to help test the system, so if you are interested please let me know.

Brett

http://blogbyemail.com

I learned something new over the last week which I not exactly sure of the benefit of.  Probably because I still not entirely sure on how it is implemented.

It seems that in IIS7 that the default functionality is that the web.config in the root website is inherited to the child webs.

Of course I found this the hard way.  I changed to a new web host and while setting up my base sites I wanted to try out a few new applications.  I setup Umbraco under a sub-domain and played around with that for a while and remembered Orchard from MVConf.  I setup a virtual directory, /orchard, and loaded up the site.

I kept receiving 500 errors when going to the site.  There was a whole round of support emails around figuring out where the errors where steaming from.  Once I found out I learned about the IIS7 inheritance.

For starters I want to list the ways I found to disable the inheritance and then move on to how this could be useful.  (Man it’s always something)

First was the instructions from the Arvixe staff (which I think they found on SO)

<location path="." inheritInChildApplications="false">     <system.web>      ...     </system.web> </location> 

There is also three examples in the IIS.NET bog: http://blogs.iis.net/steveschofield/archive/2009/09/19/control-web-config-inheritance-with-iis-7-asp-net-options.aspx

  1. You can set the enableConfigurationOverride attribute to false for an application pool
  2. allowSubDirConfig=false (as above)

    http://msdn.microsoft.com/en-us/library/ms689469.aspx

  3. inhertInChildApplications property

I haven’t tried all of these yet.  If you have leave a comment on how it well worked. It seems this functionality is enabled when the AppPool is set Integrated mode.

I just read one suggestion to use <clear /> what was inherited in certain sections.

Now for some reasoning on why this functionality was added

For now I just have this link from ASP.NET MSDN library.  It starts out with:

“You can distribute ASP.NET configuration files throughout your application directories to configure ASP.NET applications in an inheritance hierarchy. This structure allows you to achieve the level of configuration detail that your applications require at the appropriate directory levels without affecting configuration settings at higher directory levels.”

I have some reading to do…

Update (8/14/2011):
Reading an informative article on iis.net, Understanding Sites, Applications, and Virtual Directories on IIS 7

The only problem I have with the article is that there absolutely no details on any of the information provided.  Yet it’s a good overview of what they have done in the new version.

Now here are the details I have been looking for: http://learn.iis.net/page.aspx/243/aspnet-integration-with-iis-7/

 

IIS7 Configuration Reference on IIS.NET

 

Reading on…

Twitter Updates

Follow

Get every new post delivered to your Inbox.

Join 74 other followers