Long Cloud Technologies
"... A Yankee in the Land of the Long White Cloud, Aotearoa ..."

Twitter: Personal vs. Professional, Informal vs. Formal, salient thoughts vs. mental drivel

So an issue came up this weekend and it had to do with my usage of Twitter. In a nutshell what is twitter for, a social media where I can let my brain droppings be sprinkled on the information super highway as I speed along for who ever cares to listen, or is it professional networking tool used to strengthen my ties to the community at large involved in my work and other serious interests, and increase my knowledge of what is happening “out there”?

For me, up to now the answer to that question was “Yes”.  I’m relatively new to twitter, only having been on it for a little more then a year.  When I started I didn’t really see the point (and snidely snickered at twidiots who tweeted like Roland Hedley), but was assured it was a good way to stay connected to the larger tech community from someone I trusted, so I decided to give it a shot.  What amazes me now is how much Twitter changed my internet habits. I realized just a couple of months ago that I had stopped checking my RSS feeds, if it wasn’t important enough for them to put it up on twitter (and I was following them) then it wasn’t worth my time to go “trolling” thru RSS feeds.

There were many other examples both subtle and big of how twitter has change my internet usage, and while I’m not up to Roland Hedley standards I do use it alot these days. So what was the issue?  Well about 6 months ago while looking on the web I came across a twitter feed that was definitely NSFW but that I was interested in following, so I started up a new twitter account specifically geared toward, let us use the euphemism “Adult Oriented” content, where no one knew I was a dog.

File:Internet dog.jpg

And no I am NOT going to tell you what my twitter handle is for that account. It’s still NSFW, and if you come across it, you won’t know its me and you will be trolling in the dark under-belly of the internet yourself of your own free will.

But on my original Twitter account @matthewhintzen I continued to post anything else, other then adult content, that popped into my mind. No Censor, no second guess, no look over, just spew my mental train of thought.  In that time I have twice had someone point out to me content that I posted that might have been inappropriate for a “general” audience that includes business contacts. And it happened again this weekend, the third time someone had felt the necessity to point out that what I had tweeted could possibly be inappropriate given the fact that my audience for Twitter contained professional colleagues.

Of course like most humans I’m loath to admit I might be in the wrong so I bristled at the gentle rebuke, and took it much stronger then it was meant, but upon reflection (and after I had taken a deep breath, and remembered my point of view is not the empirical point of view) I found myself having to totally agree with the criticism. I had addressed the tweet (though not directly) to two of my co-workers, and thus while it was a restricted audience (wasn’t quite the same as shouting it out to a filled theatre) there was still the very likely possibility that someone in our profession might have caught the tweet.  See this EXCELLENT article from Scott Hanselman’s blog about Twitter Overlapping setsto see how my tweet, since it was address to specific people, was not broadcast to the twitterverse at large.  But this is not a Rational argument that I was in the “right”, it is a rationalization that allows me to pretend there isn’t a fundamental issue.

But as I just said, leaving aside the Rationalization aside, as I have come to use Twitter more and more as a mental stream of consciousness, I have been leaving the reservation of and allowing my personal life to infringe on my professional life.  If I were just a contractor by myself, then that is my problem, but I currently work for someone else, and my tweets can reflect poorly or well on the company, which means other peoples lives and livelihoods could be affected.

So now we come to the rub.  What is twitter for?  I recognise that there is a portion of my life that I want to keep anonymous with plausible deniability, and I have an account set up for that part of me.  But now while I have no problem saying the things I say on twitter and having people read them / pass judgement on me (fuck them if they can’t take a joke), that isn’t fair to my co-workers who might be affected, however indirectly by my tweets.  So do I institute a Censor board, make a “5 minute rule” on any tweet (let it sit and review it for 5 minutes before I put it out), stop tweeting or do something else?

Giving up tweeting isn’t really an option, I like it too much, it’s part of my day now.  But I REALLY hate the thought that now I have to “watch” what I say on twitter, cause that makes it a tool, a requirement, a “job” instead of a fun way to stay connected.  5 minute rule has the same problem.  On the other hand I do understand that there are different parts of my life that I want to compartmentalize from each other (see the need I already except for my NSFW twitter account): and shouldn’t there be some sorta of separation between my private and professional life? While I have known people that have gotten in trouble for saying something bad about their employer, I’m a Free Speech Absolutist, and unless their job is as publicist for the company, what they say on their own time, on their own computer is their business. So I see only one way out of this quandary, a private and separate twitter account that can only be followed if I ALLOW someone to follow it.  I can still spew, but only those people who I invite can follow.

Does that mean I will be tweeting much on my AtWork account, well honestly, no probably not.  It will be for work related items, no snarky remarks, no “Hey here is my dog in the park” but also no “I think this person sucks…”.

So what will be my new “spew my thoughts” account be? well it will be @matthewhintzen… I’ve renamed the old @matthewhintzen to @mh_AtWork, and then reclaimed @matthewhintzen as my new private account. You are welcome to apply to follow me.

Happy Tweeting

Posted on 26 Sep 11 12:46 by matthew.hintzen |

Bookmark this post with:

E-mail | Comments(0) | Comment RSS


Working with Orchard from a Hard Programmers Prospective – Part II

Creating a Hello World Module the Orchard way

So here we are ready to do the next part in our series of Orchard Discovery… Let’s make their Hello World module in the default installation, and then let’s see about implementing the Hello World in Visual Studio 2010, using no helpers.  “Buckle Up Boys, it’s going to be a bumpy ride”

So to start with, Here is the link to the tutorial provided by Orchard website on how to do the “Hello World”.  The first thing they tell you is before you get started to download and install the Code Generation feature Command-line Code Generation . To be totally fair I’m going to use the OrchardWpi we got running in WebMatrix to do this part…  I start up WebMatrix, select Choose a Site option and Select my Orchard Site.

image

image

Now we click on the URL for the orchard website and open it up, get into Manage settings and from here on out we just follow the steps in the original article on installing the tools.

Tips for their instructions:

  • first up, there are way too many modules in the gallery if you use the Feed: Any optionimage Be sure to drop that down and select the image and click the Apply button.
  • Gee wouldn’t it be nice if there was a sort order? don’t look for it there isn’t one as of 1.0
  • Gee wouldn’t it be nice if there was a search function?  Again don’t look for it, there isn’t one as of 1.0
  • Quickest way to find your module is do a Ctrl+F (find function for your browser) and search for Code Generation
    image
  • Hey, if I install a module, how about we assume that I WANT to use it, other wise I probably wouldn’t have isntalled it. Can we make the default for installed modules as setting it to already being enabled? that would be helpful

With that done, we continue on our way with the Hello World Tutorial. And right off the bat we have our first question from their instructions: “Open the Orchard command-line”; so how do you open the command-line.  Intuitive it is not, here is a link to the instructions on using the command-line interface.  Basically you need to open a Command line in the bin directory of the Orchard website you want to work on… Hey, give them a break, this is version 1.0…  Don’t forget to make sure you start up the command line as an administrator, to save yourself some grief, and making it a Visual Studio 2010 command prompt would probably be best, although supposedly not required.

You can find the bin directory by going back to WebMatrix and clicking on the path link for the website, and navigate down from there to the bin directory.

image

Ok, now that we got the command prompt open we continue on with our exercise from the Hello World Tutorial. First you need to get the Orchard Commandline tool started.  I’ll save you the digging around in the documentation to find out how: from the command line in the bin directory run the Orchard.exe.  That will initialize the Orchard Command line tools and then we basically just run the command codegen module HelloWorld.

image

I decided to follow the editing instructions using the built in editor in WebMatrix

image

Editorial: A txt file?  you might as well have an INI file.  AND you have a warning that I should be careful to use spaces and not tabs to indent?  Come on Orchard developers, I know XML is verbose and over used, but in this case it seems a lot more intelligent, what we have now looks so VB 3 world type… (and for the record I started programming in VB3 so please don’t flame me too much).

Ok, I save my changes and move onto the next step, where they recommend that I put in a Routes.cs file in the HelloWorld Folder, let me show you how I did that in WebMatrix.  (make sure to click on the “Files” header in the Un-outlook bar), I click on the HelloWorld folder and then click on the Create a new file link on the page.

image

The model dialog that opens has Common Selected for “File Types” none of which will give you the ability to create a class, click on the Suggested Category scroll down and find the Class (C#) item, click on it and in the Name box below set it to Routes.cs and click OK

image

Copy and paste the text from the tutorial and repeat the process as instructed for the HomeController.cs, then do the same for the View file.

Then the instructions tell you to add some lines manually to the HelloWorld.csproj file ( and this tutorial is obviously not for the newbie or someone who wants to ask questions.  It tells you want to do, not so much on the how ).  Just follow thru the instructions. So I did and this is what I got…

image

OK, so I can make Orchard say hello, I have no idea how that all comes together so let’s see if I can take it apart.

First things first, I think we need to know what the CodeGen did before we know how to proceed manually.  Consequently I’m going to run CodeGen and create a new module called UMadeThis.  I’ll follow the same steps as above from the command line.

Note: if you create a module in Orchard using command line and it doesn’t show up in WebMatrix, be sure to Right Mouse on the Modules Folder and Click the Refresh, your module should now show up.

Going again in the Files group, find the UMadeThis folder and let’s “expand” every folder; Now let’s go see what got made…

image

Not a whole bunch.  The web.config for both the Scripts and the Styles is the following

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <appSettings>
    <add key="webpages:Enabled" value="false" />
  </appSettings>
  <system.web>
    <httpHandlers>
      <!-- iis6 - for any request in this location, return via managed static file handler -->
      <add path="*" verb="*" type="System.Web.StaticFileHandler" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <handlers accessPolicy="Script,Read">
      <!--
      iis7 - for any request to a file exists on disk, return it via native http module.
      accessPolicy 'Script' is to allow for a managed 404 page.
      -->
      <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
    </handlers>
  </system.webServer>
</configuration>

The web.config is in the View Directory is a little more interesting

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="webpages:Enabled" value="false" />
  </appSettings>
  <system.web>
    <httpHandlers>
    </httpHandlers>

    <!--
        Enabling request validation in view pages would cause validation to occur
        after the input has already been processed by the controller. By default
        MVC performs request validation before a controller processes the input.
        To change this behavior apply the ValidateInputAttribute to a
        controller or action.
    -->
    <pages
        validateRequest="false"
        pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
        pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
        userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <controls>
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" namespace="System.Web.Mvc" tagPrefix="mvc" />
      </controls>
    </pages>
  </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

At first glance seems pretty standard for an MVC View Web.config, but taking a closer look I noticed something else: just below the first block of code is from the code generated by the CodeGen in Orchard, the second block is from a normally generated MVC project.

<pages
        validateRequest="false"
        pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
        pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
        userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

<pages 
        validateRequest="false" 
        pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
        userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

They look almost the same but I see a minor difference in the Orchard Stuff,  The type engines for the Orchard have all had the processorArchitcture specified processorArchitecture=MSIL. basically if not specified your module would be built to what ever processorArchitecture was specified in the build settings, but this extra flag overrides that, and makes sure that your module is built to the MSIL, Microsoft Intermediate Language.  MSIL can be viewed as the assembly code of the CLR.  It means of course that your module is not optimised for the target processor architecture, but on the plus side, this means it will run correctly in CLR at run time.

Finally I noticed one other thing, the View web.config DID NOT include the section for razor web pages…

Now that was interesting, so where is that information for Razor pages located? it is located in base Orchard website web.config file.  In a normal MVC generated project, the reverse is true.  Let me do a quick comparison between the razor entry in the Orchard Web site’s base web.config

<system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Linq" />
        <add namespace="System.Collections.Generic" />
        <add namespace="Orchard.Mvc.Html" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

And the razor entry in a standard MVC projects View Web.Config file

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="RecoveryAssist.Dal" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

And if you look at the pageBaseType you see the real difference.  In Orchard they want to make sure that the Page base type is based on the Orchard.Mvc.ViewEngines.Razor.WebViewPage, whereas a standard mvc project makes System.Web.Mvc.WebViewPage the page base type.  Again, I’m not sure what impact that has, but I’d be willing to bet it isn’t insignificant.

Next time, we will do this all over again, but inside of Visual Studio 2010…

Posted on 20 Mar 11 14:38 by matthew.hintzen |

Bookmark this post with:

E-mail | Comments(0) | Comment RSS


New Code Highlighter plugin for Windows Live Writer

Just download and installed a new Syntax Highlighter Plugin for Windows Live Writer, for usage with Alex Gorbatchev’s SyntaxHighlighter jscript stuff.  The new plug in was created by Tugberk Ugurlu, you can find it here: http://tugberkugurlu.com/archive/windows-live-writer-codehighlighting-plugin-for-alex-gorbatchev-s-syntaxhighlighter

It is greatly appreciated from me, as the one I was using was created back in 2007… and nothing since then was good enough.

Now all that is left for me it so provide a Razor Plugin to go with Gorbatchev’s library.

Posted on 20 Mar 11 14:33 by matthew.hintzen |

Bookmark this post with:

E-mail | Comments(0) | Comment RSS


Working with Orchard from a Hard Programmers Prospective – Part I

Moving Orchard from WebMatrix to a “real” programming environment.

For the record, that sub-title is meant in jest. WebMatrix is a a real programming environment, but you know us professional programmers, we are just a bit on the snobbish side, and so unless it is “our” development environment (OS, Language, Tool, Etc.) we do have a tendency to sneer at the alternatives.  The truth of the matter is, that there is so much to learn out there, that there is no way we can know it all.  We are forced by necessity of not truly being the geniuses we sometimes think we are, of specializing in some way in our choice of languages and tools.  We are a lazy bunch and we will often go out of our way to avoid having to “work”, and learning something new is “work”.  Since I have no illusions that I am lazy (I know I am lazy), I will take the “hit” of work of moving out of a dev environ that I am not used too (and having to learn it) to move into a dev environment where I already know how to swim like a duck.

Historical note: as I sit here typing up this post, twitter has just informed me that it is possible that an Official with Japan’s safety agency says that a Meltdown may be under way at Fukushima Nuclear Reactor.  I hope Twitter is wrong.

So let’s start with installing Orchard using the Microsoft Web Platform Installer(WPI) Rather then repeating what is already out there I refer you to the documentation post at the Orchard web site on Installing Orchard with the WPI for the complete list of steps and recommendations. Suffice it to say I installed the WebMatrix platform, then installed the Orchard CMS application, naming the site OrchardWebMatrix.  Finishing up the install and configure steps, this is what I got. …

Whoops, wrote the above paragraph in anticipation of it working correctly… it didn’t; seems that the instructions on the Orchard website aren’t exactly complete.  I followed their steps, and Orchard didn’t install in WebMatrix and it didn’t run! DOH.  Seems that if you have a professional .Net Development machine configured (meaning Server 2008 or Windows 7 with IIS installed and configured) the WPI, doesn’t install by default into WebMatrix, you have to do an extra step they left out of the instructions.

Once you have downloaded and installed Web Platform Installer to your machine, click the Add to include Orchard CMS as an item to install.

Image

This is from the Orchard website.  If you have IIS installed, BEFORE you click the Install button as they tell you to, make sure to click the “Options” hyperlink just to the left of the Install button.

image

Make sure to select the IIS Express (required for use with WebMatrix) the option, then click ok THEN click install. At that point you can return to the instructions on Orchard and go on your way.

Wait, they left something else out from the instructions,

When the installation is complete, click the Launch link.

Image

When you launch Orchard in your browser, you will be presented with the Orchard setup screen.

They make it seem like when you click Launch that you go right into Orchard, you actually don’t..  you go into WebMatrix like this.

image

In order to Launch Orchard you need to click on the URL There at the top.  So I did and configured it to use the Compact Framework SQL.

I’ve taken a quick spin around the WebMatrix, and it’s a pretty good starting point…  I think I even know web developers who would prefer it to my “professional” Visual Studio 2010 setup…  Maybe I will take the time to learn this thing… but not today.  If you click on the Files section of the Un-Outlook bar you get an interesting Tool Ribbon button if you have VS installed.

image

Clicking on that Visual Studio launch button and you get this.

image

Orchard loaded up in Visual Studio as a Web Application.  Not too shabby.

Now let’s see how we can get Orchard setup to run correctly in IIS.  From my earlier attempts I know we can do it using the WPI, let me walk thru that method first.

Ok, this time in the WPI after we click “Add” for Orchard, and before we click install, let’s go into that options dialog again and select the other option – IIS

image

Click OK and Click Install, Accept the License, and we get a new dialog

image

I’ll leave it to go into the Default Web Site, and name it OrchardWpi.

Now you may notice that above it says Step 1 of 2… They lie, there is no step 2 of 2, Orchard just starts installing.  Once it is done you get the following..

image

Click on the Launch Orchard CMS and let’s see what happens.

image

Wow what do you know, it works.  Click Finish Setup and we are good to go.

image

Let’s see where that ended up on the Harddrive, no great surprise c:\inetpub\wwwroot\orchardWpi

image

Oh and look there is a csproj file in there… opening it in VS gets us this.

image

Not too bad, though I am sorry to see that it doesn’t get set to run against the IIS directory where it is installed. That is easily fixed.

image

OK, enough with the WPI doing our work for us, let’s manually set this thing up.

Turns out the instruction for Manually installing Orchard on the Orchard web site can’t be beat.  I followed their directions and it worked like a charm.  But I think I want to be a little more adventurous and install the whole source project to see what I get. So download the Source Code from the codeplex website

Ok, that was easy and now we have the whole system set up to really allow us to dig into the guts.

I open the solution and in Visual Studio 2010. Rebuild the entire solution, no errors that’s good.

Open the project window for Orchard, and on the web tab, select Specific page (leaving the entry blank), check the Enable Edit and Continue (because this is 2011, and I Love Edit and Continue, naysayers be damned), and hit the run with debug button

image

Site started up, ready for configuration.

image

So I click Finish Setup and (It is all a lie, there is no Pie afterwards) I have a working Orchard site with all open source available and loaded up for me in Visual Studio. 

Note, next screen shot is a “Lie”

image

Next time we see about building a module.

 

It’s all really a Lie

Ok, folks to be totally fair, the last screen shot and “TA-DA” sentence is really not exactly true.  You see I started this blog entry at home on my home dev machine and I got some REALLY strange errors in trying to get that last step from “enter configuration” to completed site, all source running Visual Studio 2010.  What I actually got on my home machine was this:

image

I worked on it for a couple of hours trying to figure it out and as of this writing, I actually still don’t know what the problem is on my home machine.  Finally I threw up my hands, it being the weekend and all, and put it aside.  Came into work this morning, and tried the EXACT same steps on my work computer, and lo and behold it worked as I detailed above.  So I decided to finish off this post, but I’m not about to give up on figuring out why it didn’t work at home.  If you go to this Post Orchard Source Install Problems I will keep a running log of my efforts to figure it out at home.

Posted on 13 Mar 11 17:09 by matthew.hintzen |

Bookmark this post with:

E-mail | Comments(0) | Comment RSS


Working with Orchard from a Hard Programmers Prospective – Prologue

So after much research and study, our intrepid group of programmers at Red Jungle decided we would attempt to settle on the Orchard CMS as our Platform of choice for clients looking for a CMS solution.  We did this for many reasons, but here are the highlights as far as I’m concerned

  • Completely open source http://orchardproject.net/
  • ASP.NET MVC 3 base (with Razor)
  • Originally built by Microsoft, but no longer owned by Microsoft
  • Funded by Microsoft (with no strings attached) for the next two years
  • Principle Developers of Oxite, Erik Porter and Nathan Heskew joined team (outside MS perspective)
  • Plug-in Architecture and extensibility built on a simplified model.

Before I go much further, I think a quick retrospective on last Microsoft Opensource CMS system is in order.  It was built in ASP.NET 1.0 using what was then considered best practices.  During internal development it was known as IBuySpy, and was meant to showcase those best recommended practices when creating a n-tiered web platform.  The Main developer they had brought in for the example site took the core of the IBuySpy example and extended it to a Full Featured CMS system that we all know better as DotNetNuke.

I’ve used DotNetNuke in the past, I’ve even wrote a tutorial about making modules for DNN and explaining what is really going on under the hood as you develop the module: Creating a DNN Module and Understanding DNN Architectural Approach.  While DNN continues to be used and does a great job, it, like so many old systems, has a bit of a legacy built in that it can’t just drop, that at times can make it feel creaky and old.

The world has moved on quite a bit since IBuySpy, and sometimes it is for the best to sell the old house and start from a fresh new foundation, we at Red Jungle feel that Orchard is just such a candidate.  If it becomes even half as successful as DNN was before it, I think we will have made a VERY good choice.

Now that doesn’t mean that I don’t have some issues with Orchard, life is beautiful, la la la.  First up, the install, extension and maintenance of Orchard was made to be easy for people with minimal technical background. By default if you use the install provided by the The Microsoft Web Platform it uses the new Microsoft WebMatrix which in itself is a free-ware and geared towards open source development (you didn’t really expect Microsoft to let AMP be the only free option out there did you)?  While I think the WebMatrix is a great tool, and the price is right (free for everything to run a website) for a hard code monkey like myself it just doesn’t have the horse power and the shade tree mechanic capabilities I want.

Also the out of the box tutorials and instructions of how to extend Orchard are VERY easy, but they “hide” too much under the covers for my taste.  I may yet end up using the shortcuts and tools, but I want to understand exactly how all those helpers fit together to make the magic work.

So I have three main goals with this set of blog posts and two sub-goals. 

  1. I want to move Orchard (and document how) to run in a more robust development environment then WebMatrix, get it to run in IIS with full customization from within Visual Studio 2010 Universal, as a Web Application.
  2. Create the Hello World module using the CodeGen capablities as explained on the Orchard website here, then recreate the Module doing everything manually.
  3. Finally Recreate my “ToDo Task List” from my original DotNetNuke tutorial on codeproject to be applicable to Orchard and deconstruct the Architecture of the system as it applies to Module Creation.
  4. Sub-goals
    1. Package the ToDo Task list as a redistributable, and document how to do so
    2. Publish the ToDo module on NuGet feed for Orchard.
Posted on 13 Mar 11 13:16 by matthew.hintzen |

Bookmark this post with:

E-mail | Comments(0) | Comment RSS


“I do not think that word means what you think it means”

Funny thing happened on the way to installing the MS Web Platform Installer; before I go any further, this is not a crack against the WPI, in my opinion, the WPI is one of the greatest things MS had recently released to help me keep my machine working in Dev Mode easily.

The download page for the web installer touts its virtues, among the list is the following

 

image

Now I don’t want to be Churlish about that statement, but my first personal computer (A Zeos 386sx) had a Whooping 256k bytes of memory.  I’m not sure you can call something “tiny” when it is 8 times the size of my original memory chip.

Posted on 17 Nov 10 17:07 by matthew.hintzen |

Bookmark this post with:

E-mail | Comments(0) | Comment RSS


Linq odd behavior and the need for a .ToList() [where I suspect there shouldn’t be any need]

Give an Entity Frameworks model that has an EmployerUsers table, in which there are two columns, Guid and Name  Consider this code…

List<SelectListItem> employerUserSelectList = new List<SelectListItem>( );

var employerUsers = dal.EmployerUsers.Where( eu => eu.EmployerGuid == SecurityHelpers.EmployerGuid );

employerUserSelectList.Add( new SelectListItem( ) { Text = " [ Select TeamMember ] " , Value = Guid.Empty.ToString( ) } );

employerUserSelectList.AddRange(
   employerUsers.ToList( ).Select(
      eu => new SelectListItem( )
      {
         Text = eu.Name ,
         Value = eu.Guid.ToString( )
      }
   )
);

The important piece of code I want you to really look at is this:

 

employerUsers.ToList( ).Select(
   eu => new SelectListItem( )
   {
      Text = eu.Name ,
      Value = eu.Guid.ToString( )
   }
)

now compare that with this…

employerUsers.Select(
   eu => new SelectListItem( )
   {
      Text = eu.Name ,
      Value = eu.Guid.ToString( )
   }
)

Would you or would you not expect these to both work exactly the same?  Well I would but if you try to run the code with the second clause you get the following error

image

System.NotSupportedException was unhandled by user code
  Message=LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.
  Source=System.Data.Entity
  StackTrace:
		...SNIP...
  InnerException: 

Yeah, pretty weird, you have to add the .ToList() to coalesce the IQueryable into an IEnumerable BEFORE you call the .Select.

I think this is a bug, either the .Select shouldn’t be allowed on the IQueryable if it can’t handle it, or it should be smart enough to do the .ToList() if necessary.

Your Thoughts?

You can reach me on Twitter at @matthewhintzen:  http://twitter.com/matthewhintzen

Posted on 26 Aug 10 22:58 by matthew.hintzen |

Bookmark this post with:

E-mail | Comments(0) | Comment RSS


Fun with WebDAV

I’m currently in the process of moving this blog from my old server (real piece of iron that was running me US$ 150 / month just to have hosted) to a new VPS from MyHosting (US$ 500 / year).

In trying to publish my new corporate website to (an ASP.NET MVC app) from Visual Studio 2010 to my server using WebDAV.

Sidenote: Microsoft has been trying to get rid of Front Page Server Extensions for a while…  They want us to move to WebDAV for all the reasons we used FPSE, and my new server is running Server 2008 R2 with IIS 7.5 which won’t allow you to install FPSE anymore.  With this cycle of product release MS has decided to force you to use WebDAV.  Configuration of WebDAV is a nightmare, either they need to allow installation / activation / configuration of WebDAV to be as easy as the former FPSE install, or they are going to have to back down (again) and allow FPSE to be run in IIS 7.5. 

So after 2 days of trying to figure out / activate / configure WebDAV it seemed that I finally got it working, so I go to publish my ASP.NET MVC 2.0 web site up to my new server using the Publish Feature in VS2010 for a solution and everything works, UNTIL we hit the “Views” folder, suddenly we get an error

405 - HTTP verb used to access this page is not allowed.

I fire up Expression 4, attach to the website using WebDAV and I can view and add and delete from any folder in the project (controllers, contents, etc) except the “View” folder.  With an MVC project that is pretty much a non starter.  So how did I fix it?  The usual way when MS doesn’t provide good management tools or error diagnostics, I use a sledge hammer (yeah I know my server isn’t a Black Box, but I don’t have time or the will to start trying the 101 different diagnostic pathways to determine what is going on).

I don’t recommend this fix, and someday when I have more time I will go in and figure out the exact necessary and sufficient minimal fix, but for now the answer was:

  1. Open IIS
  2. Select the root website that you want to publish to
  3. Click on the Handler Mappings
    image
  4. scroll down and find the WebDAV handler and click on it then in the Actions click on Editimage
    image
  5. Click on the Request Restrictions
    image
  6. Then click on the Verbs tab, and you will see something like this…
    image
    In my case the verbs in the list were: PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK
  7. Make a copy of those verbs and store them somewhere (see step 11), cause you will want to come back later and unsledge hammer this fix.
  8. Finally just click the “all verbs” radio option and click OK
    image
  9. OK and Apply your way out, and you are good to go!
  10. publish away
  11. Now go back in and PUT the verbs BACK IN, otherwise WebDAV will decided it gets to handle all request before anyone else which must mucks with your site.

As I said, this is definitely a sledge hammer solution and I only recommend it as a work around.  I’ll try to do the 101 diagnostic tests in the next couple of weeks to determine what extra verb I need to add to allow the “View” folder to be accessed / modified.

What so weird is that it only happens on the “Views” folder, I would have expected the same verbs to be used with any of the folders that are published.  What makes the Views folder so unique that it has to use special verbs that the other folders don’t?

Posted on 26 Aug 10 12:13 by matthew.hintzen |

Bookmark this post with:

E-mail | Comments(0) | Comment RSS


With Linq you too can program like C++ programmer (if a line of code doesn’t confuse, it’s not doing enough)

I don’t know if you ever had the opportunity to attend those old time geek fests where after the days conferences and presentations, the programmers would gather for drinks and a little after hours friendly competitions, but they were fun, and sometimes really scary.  One of my favorite was to attend a contest where C++ programmers would be given a programming task and the team that produced the lowest total sum of number of semi-colons plus number of programming structures won.

In case you’re not sure what that means exactly, it means who could do the most stuff on the least lines of code.  Get as much processing into a single line of code.  And in C++ you canREALLY do a lot of work in a single line of code if you know what you were about; Mind you the line could end up being 400 characters in length, and completely impossible to figure out what it was doing in retrospect, but damn it was concise!

Needless to say BASIC (and it’s variant Visual Basic) definitely DIDN’T have that capability.  I come from a VB background, and while you can get ridiculous in C#, my coding habits from my VB days means I generally don’t go for obtuse line coding.  In fact one of my mantras is “One line of code, should only do One thing.”

But then along comes Linq, which just BEGS you to do many things in one line, and before you know it you start figuring out how to combine.  And there is this urge to just “combine a little bit more” and before you know it, a C++ programmer would be willing to buy you a beer for your ability to product obtuse, obscure, confusing code.

_Events = Claim.Events
 .OfType<Wizard>( )
 .Where(
 w => w.StatusType == ( int )Enums.EventWizardStatusType.Open || w.StatusType == ( int )Enums.EventWizardStatusType.InProgress )
 .Cast<Event>( )
.Union( Claim.Events .OfType<Task>( )
 .Where( w => w.StatusType == ( int )Enums.TaskStatusType.Open || w.StatusType == ( int )Enums.TaskStatusType.InProgress )
 .Where( w => w.Tasks.Count == 0 )
 .Cast<Event>( ) ).OrderBy( e => e.DueDate ).ToList( );

Ok quick can you tell at a glance what that does?  No, neither could I, after I had finished compressing four statements into one.  It was really cool what I had achieved, but when the day comes that I need to modify that code, and trust me the day will come, I would curse myself.  So even though it means I have to hand in my Obfuscated Code Black Belt, I decided to go with instead the following (which is functionally equivalent to the preceding).

var wizards = Claim.Events
 .OfType<Wizard>( )
 .Where( w => w.StatusType == ( int )Enums.EventWizardStatusType.Open || w.StatusType == ( int )Enums.EventWizardStatusType.InProgress )
 .Cast<Event>( ); 

var tasks = Claim.Events
 .OfType<Task>( )
 .Where( w => w.StatusType == ( int )Enums.TaskStatusType.Open || w.StatusType == ( int )Enums.TaskStatusType.InProgress ) .Where( w => w.Tasks.Count == 0 )
 .Cast<Event>( ); 

var events = tasks.Union( wizards ); 

_Events = events.OrderBy( e => e.DueDate ).ToList( ); 
Posted on 11 Jun 10 22:31 by matthew.hintzen |

Bookmark this post with:

E-mail | Comments(0) | Comment RSS


How to get to modelmetadata’s additionalvalues and use them in MVC

Got a request from my new client, wanted to have Boolean values map to radio buttons, (no problem, we’ll just make a Shared Boolean.ascx partial view in the EditorsTemplates).  The real kicker came when he asked for a way to attach the labels to use for the yes and no options to the DataModel, which if you think of it makes a lot of sense, because it is a lot easier to ask a True False Question if you can make clear to the user exactly what True means and what False means.

Oh and one other thing, it is very likely that we will end up with boolean that can be Null in the database (yeah I know that maybe we should use an enum with three enumerations for that, but still if the database can do a NULL boolean value, then we should be able to somehow indicate an indeterminate state to the user for a boolean, think tri-state check box).  When you add in the need to possibly have a tri-state boolean, true, false, indeterminate, then it becomes even more clear that labels for the individual radio buttons are necessary to help the user understand clearly what they are being asked.

Of course that means I need to use the DataAnnotations, we basically want to see something like this:

[DisplayName( "NZ Tui Beer?" )]

[DisplayBooleanChoicesAttribute(DisplayChoiceFalse="No", DisplayChoiceTrue="Yes", DisplayChoiceNull="Not Sure, came in glass")]

public bool IsGoodNZBeer { get; set; }

That means I need to figure out and understand the DataAnnotation provider model… Oy Vay, someday my brain is going to explode!  I keep getting these tasks to do things that aren’t really well documented.  As I started down this path, looking behind the curtain when running the app, to see what exactly can I do with DataAnnotations I see they have an AdditionalValues column

clip_image002

That looks like it could be very helpful so it’s off to find some, and I come across the following two links

Now they both involve overriding the DataAnnotationsModelMetadataProvider with a custom class, but they look at the world a little differently.  In the end I implemented the first link’s solution because it was more complete comprehensive walk thru and required less skull sweat.  Having said that, while preparing this blog entry I really started looking closely at that second link and I think it may be a better way to go about this.  I’ll let you know how it eventually turns out.

Closing Note:

Due to loosing the fight against protecting my blog comments from the bloody spammers.  I’ve given up and just shut them off.  If you would like to comment you can reach me on twitter at @matthewhintzen.

Posted on 25 Apr 10 18:35 by matthew.hintzen |

Bookmark this post with:

E-mail | Comments(0) | Comment RSS