<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>Morten Bock</title><link>http://www.mortenbock.dk/</link><description>A feed of new content on my website</description><item><author>Morten Bock</author><category>photography</category><category>canon</category><category>olympus</category><description>
&lt;p&gt;For a while now, I have been thinking of changing my camera
system. As I know that a lot of you out there on the different
social networks who are into photography, I thought i would gather
a small blogpost with my thoughts, and see if any of you would
enlighten me with your inputs :-)&lt;/p&gt;

&lt;h2&gt;Why change?&lt;/h2&gt;

&lt;p&gt;My current camera system is an Olympus E-520 with the standard
14-42mm and 40-150mm lenses. My main issue with this equipment is
that it does not seem to perform too well under indoor and other
low light conditions. This seems to be confirmed by the review ad
dpreview.com. So instead of spending meoney on new lenses for this
system, I thought I would try to do a complete swap to improve the
performance.&lt;/p&gt;

&lt;h2&gt;The candidate&lt;/h2&gt;

&lt;p&gt;The items that I am looking at currently are the following,
which fall within the total budget of about DKK 7.500.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Canon EOS 600D&lt;/strong&gt;&lt;br /&gt;
 Price DKK &amp;nbsp;~4.700&lt;br /&gt;
 &lt;a
href="http://www.dpreview.com/products/canon/slrs/canon_eos600d"&gt;http://www.dpreview.com/products/canon/slrs/canon_eos600d&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I want to stay at the entry level houses for now, and i looked
at the 500D, 550D and 600D. I would be tempted to go with the 500D
which is available at a bargain price currently, but I really would
like to get the flip-out screen that comes with the 600D, and which
I have been missing quite a few times on my current Olympus.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Canon 18-135mm f3.5-5.6&lt;/strong&gt;&lt;br /&gt;
 Price DKK ~2.200&lt;br /&gt;
 &lt;a
href="http://www.dpreview.com/products/canon/lenses/canon_18-135_3p5-5p6_is"&gt;
http://www.dpreview.com/products/canon/lenses/canon_18-135_3p5-5p6_is&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Canon 18-200mm f3.5-5.6&lt;/strong&gt;&lt;br /&gt;
 Price DKK ~3.500&lt;br /&gt;
 &lt;a
href="http://www.dpreview.com/products/canon/lenses/canon_18-200_3p5-5p6_is"&gt;
http://www.dpreview.com/products/canon/lenses/canon_18-200_3p5-5p6_is&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I want an all purpose lens for a certain degree of flexiility
when travelling. With my current system, I seem to be changing lens
constantly, where these two lenses would each covere the combined
range of the Olympus lenses. I am considering the 135mm lens
because it should give a better quality image, but still maintain a
fair amount of flexibility and at a lower price.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Canon 50mm F1.8&lt;/strong&gt;&lt;br /&gt;
 Price DKK ~800&lt;br /&gt;
 &lt;a
href="http://www.dpreview.com/products/canon/lenses/canon_50_1p8_ii"&gt;
http://www.dpreview.com/products/canon/lenses/canon_50_1p8_ii&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this price I really like the idea of a fixed fast lens, and
this one seems to have gotten a lot of nice reviews. it should be
able to handle the low light scenarios really well, and should
provide some interresting options for depth of field
experiments.&lt;/p&gt;

&lt;h2&gt;Feedback&lt;/h2&gt;

&lt;p&gt;That concludes my findings so far. I would love to get your
feedback and experiences with this or similar equipment, and any
other advice you might offer in the search for my new kit :-)&lt;/p&gt;
</description><guid isPermaLink="false">3860</guid><link>http://www.mortenbock.dk/blog/2011/11/05/deciding-on-a-new-camera.aspx</link><pubDate>Sat, 05 Nov 2011 01:22:19 +0100</pubDate><title>Deciding on a new camera</title></item><item><author>Morten Bock</author><category>umbraco</category><description>
&lt;p&gt;I've seen the question asked a lot of times on the forum, and
it's not always easy to give a good answer to it. "How do I create
a macro that works inline in the editor". By default when inserting
Macros in the editor, it will force a &amp;lt;p&amp;gt; ir &amp;lt;div&amp;gt; tag
to be created around it, which means that the macro will always be
a block of content.&lt;/p&gt;

&lt;p&gt;In some cases however, it is nice to be able to insert a macro
that just creates a single word or phrase inside a sentence. It
could be a price of a product, a user specific property, or
whatever you might need.&lt;/p&gt;

&lt;p&gt;So I came up with the below solution. Of course it has benefits
and drawbacks. In short:&lt;br /&gt;
 Benefit:&lt;br /&gt;
 - Inline macros&lt;/p&gt;

&lt;p&gt;Drawbacks:&lt;br /&gt;
 - You do not get a nice way of entering data for macro
parameters&lt;br /&gt;
 - The preview snippet is static from the moment you insert it in
the editor&lt;/p&gt;

&lt;p&gt;At the bottom you will find a link to a complete zipped umbraco
install that has been set up with this, so you can have a play with
it. It's using SQL CE, so should be easy to get up and running.&lt;/p&gt;

&lt;p&gt;If you can live with this, then read on :-). First let's take a
look at what the result will look like. When you insert a snippet
in the editor it will look like this:&lt;br /&gt;
 &lt;img src="/media/16323/12-sampleusage.png" width="767" height="154" alt="12-sample"/&gt;&lt;/p&gt;

&lt;p&gt;In this case my snippet will write the name of the page, and
when rendered in the frontend it will look like this:&lt;br /&gt;
 &lt;img src="/media/16328/13-samplefrontend.png" width="805" height="294" alt="13-sample"/&gt;&lt;/p&gt;

&lt;p&gt;So, how does this work? There a three parts that we need to set
up&lt;br /&gt;
 1. Create a previewable macro&lt;br /&gt;
 2. Create an aspx page that renders the preview snippet for the
editor&lt;br /&gt;
 3. Configure the TinyMCE editor to use the snippets with the
Templates module&lt;/p&gt;

&lt;h2&gt;Step 1: Previewable macro&lt;/h2&gt;

&lt;p&gt;Create a macro with a "preview" parameter. In this case I'm
creating an xslt macro, but works just fine with razor or
usercontrols as well.&lt;br /&gt;
 &lt;img src="/media/16273/2-macroproperties.png" width="822" height="138" alt="2-macroprops"/&gt;&lt;/p&gt;

&lt;p&gt;Make the macro aware of a preview state&lt;br /&gt;
 &lt;img src="/media/16268/1-xslt.png" width="538" height="211" alt="1-xslt"/&gt;&lt;/p&gt;

&lt;h2&gt;Step 2: Snippet page&lt;/h2&gt;

&lt;p&gt;Create an aspx page that will render the macro snippet as well
as the macro in preview mode.&lt;br /&gt;
 &lt;img src="/media/16278/3-snippetaspx.png" width="242" height="290" alt="3-snippetaspx"/&gt;&lt;/p&gt;

&lt;p&gt;My snippet page looks like this. I added the snippet class to a
span to make it appear green in the editor. Be aware that this is
all in one line to avoid too many spaces in the output when
rendered.&lt;br /&gt;
 &lt;img src="/media/16283/4-snippetaspxcontent.png" width="506" height="221" alt="4-snippetcontent"/&gt;&lt;/p&gt;

&lt;p&gt;Now, for the TinyMCE to be able to reach the page, we need to
exclude it from the urls that Umbraco handles. We do this is by
adding the folder to the web.config:&lt;br /&gt;
 &lt;img src="/media/16288/5-webconfig.png"/&gt;&lt;/p&gt;

&lt;h2&gt;Step 3: Enable the templates module in TinyMCE&lt;/h2&gt;

&lt;p&gt;First we add a few thing to the tinyMceConfig.config file.&lt;/p&gt;

&lt;p&gt;The command&lt;br /&gt;
 &lt;img src="/media/16293/6-tinycommand.png" width="735" height="102" alt="6-tinycommand"/&gt;&lt;/p&gt;

&lt;p&gt;The plugin&lt;br /&gt;
 &lt;img src="/media/16298/7-tinyplugin.png" width="344" height="19" alt="7-tinyplugin"/&gt;&lt;/p&gt;

&lt;p&gt;Allow the umbraco:macro tag as valid html&lt;br /&gt;
 &lt;img src="/media/16303/8-tinytags.png" width="224" height="19" alt="8-tinytags"/&gt;&lt;/p&gt;

&lt;p&gt;And add configuration for the templates, so the editor knows
which snippets it can get and from which urls.&lt;br /&gt;
 &lt;img src="/media/16308/9-tinyconfig.png" width="795" height="274" alt="9-tinycfg"/&gt;&lt;/p&gt;

&lt;p&gt;Then we disable the tidy function in umbracoSettings.config,
because that will throw an error when it sees the umbraco macro
tag.&lt;br /&gt;
 &lt;img src="/media/16313/10-tidyoff.png" width="336" height="39" alt="10-tidyoff"/&gt;&lt;/p&gt;

&lt;p&gt;Now, go to the Richtext Editor datatype, and enable the newly
added templates module.&lt;br /&gt;
 &lt;img src="/media/16318/11-rteconfig.png" width="522" height="354" alt="11-rtecfg"/&gt;&lt;/p&gt;

&lt;p&gt;I also added my own editorStyles stylesheet, but that is
standard umbraco stuff :-)&lt;/p&gt;

&lt;p&gt;And that is it. Now the macro can be inserted to your text
without having to be in a &amp;lt;p&amp;gt; tag. Neato.&lt;/p&gt;

&lt;p&gt;I hope this is useful for you. Let me know if you can see any
other drawbacks than the ones that I mentioned at the
beginning.&lt;/p&gt;

&lt;p&gt;Get the demosite here: &lt;a
href="/media/16333/inlinemacrodemo.zip"&gt;InlineMacroDemo.zip&lt;/a&gt;&lt;/p&gt;
</description><guid isPermaLink="false">3695</guid><link>http://www.mortenbock.dk/blog/2011/07/28/using-inline-macros-in-the-umbraco-editor.aspx</link><pubDate>Thu, 28 Jul 2011 20:16:53 +0100</pubDate><title>Using inline macros in the Umbraco editor</title></item><item><author>Morten Bock</author><category>VS2010</category><category>Shortcuts</category><category>tips</category><description>
&lt;p&gt;I just had a small problem when working on a web project in
Visual Studio 2010. It seems that the F7 shortcut by default will
only switch you from MarkupView =&amp;gt; CodeView. But not the other
way. The only way to get back is SHIFT+F7, which will take you to
DesignView instead of Markup, and let's face it, no one wants to go
there.&lt;/p&gt;

&lt;p&gt;So, the solution is:&lt;/p&gt;

&lt;p&gt;1. Go to Tools -&amp;gt; Options -&amp;gt; Environment -&amp;gt;
Keyboard&lt;br /&gt;
 2. In the "Show Commands Containing" box, write
"View.ToggleDesigner"&lt;br /&gt;
 3. In the "Press Shourtcut Keys" box, press F7.&lt;br /&gt;
 4. Click "Assign"&lt;br /&gt;
 5. Click "OK"&lt;/p&gt;

&lt;p&gt;Now it should all be back to normal, or at least the way that I
like it.&lt;/p&gt;

&lt;p&gt;&lt;img src="/media/12963/shortcuts.png" width="747" height="430" alt="Shortcuts dialog"/&gt;&lt;/p&gt;
</description><guid isPermaLink="false">3036</guid><link>http://www.mortenbock.dk/blog/2010/11/12/f7-broken-in-vs2010.aspx</link><pubDate>Fri, 12 Nov 2010 18:14:21 +0100</pubDate><title>F7 broken in VS2010</title></item><item><author>Morten Bock</author><category>umbraco</category><category>blog</category><category>design</category><description>
&lt;p&gt;Last week I helped launch a new blog based on Umbraco. I used
the excellent ImageGen package to generate the images for the
galleries and it is working perfectly :-)&lt;/p&gt;

&lt;p&gt;Tech wise, it is not feature complete yet, but it is already
filled with nice tips about nice design, art and furniture for your
home (in danish...)&lt;/p&gt;

&lt;p&gt;Go visit &lt;a
href="http://livingsweetliving.dk/"&gt;http://livingsweetliving.dk/&lt;/a&gt;
to check it out.&lt;/p&gt;
</description><guid isPermaLink="false">2194</guid><link>http://www.mortenbock.dk/blog/2010/02/13/launched-new-blog.aspx</link><pubDate>Sat, 13 Feb 2010 23:09:56 +0100</pubDate><title>Launced new blog</title></item><item><author>Morten Bock</author><category>chrome</category><category>google</category><category>browser</category><description>
&lt;p&gt;I just wanted to shared this tip, if anyone else wants a bit of
control over the thumbnails that show up in the "New tab" page of
Chrome.&lt;/p&gt;

&lt;p&gt;For me, it was annoying that it had saved the
http://twitter.com/ url, because the front page has the stupid
login box where you have to get your mouse going. Instead, I want
it to go to http://twitter.com/home which has a much better login
box.&lt;/p&gt;

&lt;p&gt;This is not supported by chrome, as far as I can tell, so I went
digging. And I found a small file that contains the tabs. In my
case (On XP in danish) it is here:&lt;/p&gt;

&lt;p&gt;C:\Documents and Settings\Morten Bock Sørensen\Lokale
indstillinger\Application Data\Google\Chrome\User
Data\Default\Preferences&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UPDATE:&amp;nbsp;&lt;br /&gt;
 &lt;span&gt;&lt;em&gt;I now upgraded to Windows 7, and here the file is found
in:&lt;br /&gt;
&lt;span&gt;&lt;em&gt;C:\Users\Morten Bock
Sørensen\AppData\Local\Google\Chrome\User
Data\Default\Preferences&lt;/em&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open it with your favorite text editor, and look near the
bottom. There is a list of "pinned_urls" in what looks like Json to
me. I just changed the link I needed from:&lt;/p&gt;

&lt;div id="_mcePaste"
style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"&gt;
"1cc089548931c4fe0463e7a98ec6078e": {&lt;/div&gt;

&lt;div id="_mcePaste"
style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"&gt;
"direction": "ltr",&lt;/div&gt;

&lt;div id="_mcePaste"
style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"&gt;
"index": 2,&lt;/div&gt;

&lt;div id="_mcePaste"
style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"&gt;
"title": "Twitter / Home",&lt;/div&gt;

&lt;div id="_mcePaste"
style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"&gt;
"url": "http://twitter.com/home"&lt;/div&gt;

&lt;p&gt;"1cc089548931c4fe0463e7a98ec6078e": {&lt;br /&gt;
 "direction": "ltr",&lt;br /&gt;
 "index": 2,&lt;br /&gt;
 "title": "Twitter / Home",&lt;br /&gt;
 "url": "http://twitter.com/"&lt;br /&gt;
 },&lt;/p&gt;

&lt;p&gt;to&lt;/p&gt;

&lt;p&gt;"1cc089548931c4fe0463e7a98ec6078e": {&lt;br /&gt;
 "direction": "ltr",&lt;br /&gt;
 "index": 2,&lt;br /&gt;
 "title": "Twitter / Home",&lt;br /&gt;
 "url": "http://twitter.com/home"&lt;br /&gt;
 },&lt;/p&gt;

&lt;p&gt;And off we go :-)&lt;/p&gt;

&lt;p&gt;Just remember to do this while Chrome is closed, otherwise it
will overwrite your changes.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
</description><guid isPermaLink="false">1755</guid><link>http://www.mortenbock.dk/blog/2009/11/24/editing-chrome-thumbnails.aspx</link><pubDate>Tue, 24 Nov 2009 19:52:25 +0100</pubDate><title>How to edit Chrome thumbnails</title></item><item><author>Morten Bock</author><category>umbraco</category><category>wordpress</category><category>blog</category><category>linq2xml</category><description>
&lt;p&gt;As you may have noticed, my blog has changed a bit this week. I
finally got around to porting it to Umbraco. I did this for several
reasons, but mainly because I feel at home with Umbraco, and I can
tweak it to do just about anything I want. Wordpress on the other
hand is PHP, and I just suck at that. So there you go...&lt;/p&gt;

&lt;p&gt;Anyhow, after setting up my document types in Umbraco I needed
to figure out how to get all my old content into the new site.
Wordpress offers to export the entire content as xml, so that part
was easy. The exported file was 3Mb, mainly because of some sort of
screwed up tags back from when I was using the Ultimate Tag Warrior
(I will miss the cool plugin names from Wordpress), which spit out
a whole lot of empty tags.&lt;/p&gt;

&lt;p&gt;The exported format is basically an RSS feed, but with some
extra elements added by wordpress. One of those is an
&amp;lt;excerpts:encoded&amp;gt; element, which does not have a namespace
declaration at the top, thus making it invalid xml. So I needed to
fix this before handling the file in my import routine. I just
added it to the rss element:&lt;/p&gt;

&lt;pre&gt;
&amp;lt;rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:excerpt="http://purl.org/rss/1.0/modules/excerpt/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:wp="http://wordpress.org/export/1.0/"&amp;gt;
   
&lt;/pre&gt;

&lt;p&gt;Sweet, now the xml is all nice and tidy and ready to be
imported. So, how to do the import? Well, I decided to do it
through the Umbraco API using a dashboard usercontrol. To get the
content from the XML file, I chose to go with Linq2Xml which is
pretty neat for navigating through the XML file.&lt;/p&gt;

&lt;p&gt;First thing I did was to disable some Lucene lock, because it
made my import fail due to the number of operations done. I also
set the script timeout value a bit high just to be sure:&lt;/p&gt;

&lt;pre&gt;
Server.ScriptTimeout = 300;
Lucene.Net.Store.FSDirectory.SetDisableLocks(true);
   
&lt;/pre&gt;

&lt;p&gt;Now, to load the Xml file. Pretty easy. I later added the
possibility to enter the XML in a textarea instead, thus the
commented out line:&lt;/p&gt;

&lt;pre&gt;
XDocument loaded = XDocument.Load(Server.MapPath("~/usercontrols/wordpress.2009-08-01.xml"));
//XDocument loaded = XDocument.Parse(wpxmltextbox.Text);

XNamespace wpns = XNamespace.Get("http://wordpress.org/export/1.0/");
XNamespace contentns = XNamespace.Get("http://purl.org/rss/1.0/modules/content/");
var q = from c in loaded.Descendants("item")
        where (string)c.Element(wpns + "post_type") == "post"
        select c;
&lt;/pre&gt;

&lt;p&gt;So now I got all my blogposts in the variable "q". time to feed
them into Umbraco. It's not too nicely structured, but it does the
job, and it's a one time deal, so no need to go crazy here.&lt;/p&gt;

&lt;pre&gt;
DocumentType dt = DocumentType.GetByAlias("BlogPost");
User author = User.GetUser(0);

foreach (XElement item in q)
{
    string posttitle = (string)item.Element("title");
    string legacyurl = ((string)item.Element("link")).Replace("", string.Empty);
    string legacyid = (string)item.Element(wpns + "post_id");
    string posturlnodename = Server.UrlDecode((string)item.Element(wpns + "post_name"));
    string postbody = (string)item.Element(contentns + "encoded");
    string posttags = string.Empty;
    DateTime createdate = DateTime.Parse((string)item.Element(wpns + "post_date"));

    int i = 0;
    foreach (XElement tag in item.Elements("category"))
    {
        if ((string)tag.Attribute("domain") == "tag" &amp;amp;&amp;amp; !string.IsNullOrEmpty((string)tag.Attribute("nicename")))
        {
            if (i &amp;gt; 0)
            {
                posttags += ",";
            }
            posttags += (string)tag.Attribute("nicename");
            i++;
        }
    }

    Document doc = Document.MakeNew(posturlnodename, dt, author, 1049);
    doc.getProperty("blogPostTitle").Value = posttitle;
    doc.getProperty("blogPostBody").Value = WordpressPostParser.ParseCodeBlocks(WordpressPostParser.ChangeImageUrls(WordpressPostParser.CreateParagraphTags(postbody)));
    doc.getProperty("blogPostLegacyUrl").Value = legacyurl;
    doc.getProperty("blogPostLegacyID").Value = legacyid;
    doc.CreateDateTime = createdate;

    if (!string.IsNullOrEmpty(posttags))
    {
        umbraco.editorControls.tags.library.addTagsToNode(doc.Id, posttags, "default");
        doc.getProperty("blogPostTags").Value = posttags;
    }

    doc.Publish(author);
    umbraco.library.UpdateDocumentCache(doc.Id);


    //comments here...
    foreach (XElement comment in item.Elements(wpns + "comment"))
    {
        if ((string)comment.Element(wpns + "comment_approved") == "1")
        {

            string commentAuthor = (string)comment.Element(wpns + "comment_author");
            string commentEmail = (string)comment.Element(wpns + "comment_author_email");
            string commentUrl = (string)comment.Element(wpns + "comment_author_url");
            string commentIP = (string)comment.Element(wpns + "comment_author_IP");
            string commentBody = (string)comment.Element(wpns + "comment_content");
            DateTime commentDate = DateTime.Parse((string)comment.Element(wpns + "comment_date"));
            
            Document commentdoc = Document.MakeNew(commentAuthor, DocumentType.GetByAlias("BlogComment"), author, doc.Id);
            commentdoc.getProperty("blogCommentAuthor").Value = commentAuthor;
            commentdoc.getProperty("blogCommentAuthorEmail").Value = commentEmail;
            commentdoc.getProperty("blogCommentAuthorURL").Value = commentUrl;
            commentdoc.getProperty("blogCommentAuthorIP").Value = commentIP;
            commentdoc.getProperty("blogCommentBody").Value = commentBody;
            commentdoc.CreateDateTime = commentDate;

            commentdoc.Publish(author);
            umbraco.library.UpdateDocumentCache(commentdoc.Id);
        }

    }

}
   
&lt;/pre&gt;

&lt;p&gt;I am using some external methods to parse the body text of the
posts. This is because Wordpress doesn't save html, but puts in
linebreaks and renders paragraph tags at render time... brrrr...
There are also some [source] tags leftover from the syntax
highlighter plugin that I need to change:&lt;/p&gt;

&lt;p&gt;These are the three methods I am using to parse the text:&lt;/p&gt;

&lt;pre&gt;
public static string CreateParagraphTags(string postbody)
{
    StringBuilder sb = new StringBuilder();
    sb.Append("&amp;lt;p&amp;gt;");
    sb.Append(postbody.Replace("\n\n", "&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;"));
    sb.Append("&amp;lt;/p&amp;gt;");
    return sb.ToString();
}

public static string ChangeImageUrls(string postbody)
{
    string parsedstring = Regex.Replace(postbody, "src=\"/wp-content", "src=\"/media/images", RegexOptions.Singleline);
    return Regex.Replace(parsedstring, "href=\"/wp-content", "href=\"/media/images", RegexOptions.Singleline);
}

public static string ParseCodeBlocks(string postbody)
{
    Regex regPattern = new Regex(@"(\[source(.*?)\])(.*?)(\[/source\])", RegexOptions.Singleline);
    Dictionary&amp;lt;string, string&amp;gt; replaceValues = new Dictionary&amp;lt;string, string&amp;gt;();

    int i = 0;
    foreach (Match match in regPattern.Matches(postbody))
    {
        string code = match.Groups[3].Value;
        if (code.Contains("&amp;lt;"))
        {
            code = code.Replace("&amp;lt;", "&amp;amp;lt;").Replace("&amp;gt;", "&amp;amp;gt;");
        }
        postbody = postbody.Replace(match.Value, string.Format("[[[replacecode{0}]]]", i));
        replaceValues.Add(string.Format("[[[replacecode{0}]]]", i), "&amp;lt;pre&amp;gt;" + code + "&amp;lt;/pre&amp;gt;");
        i++;
    }

    foreach (KeyValuePair&amp;lt;string, string&amp;gt; replaceValue in replaceValues)
    {
        postbody = postbody.Replace(replaceValue.Key, replaceValue.Value);
    }

    return postbody;
}
   
&lt;/pre&gt;

&lt;p&gt;It's not perfect. For example it added some strange &amp;lt;p&amp;gt;
tags inside my code blocks, but no more than I could handle by
doing manual updates. For these methods I added some unit tests. It
is just so much nicer to work with RegEx when you have tests to see
if you are breaking existing matches while changing this stuff.&lt;/p&gt;

&lt;p&gt;So there you have it. Posts imported and ready to go. It's so
easy I don't know why I didn't get around to it before :-)&lt;/p&gt;
</description><guid isPermaLink="false">1506</guid><link>http://www.mortenbock.dk/blog/2009/10/13/importing-wordpress-posts-to-umbraco.aspx</link><pubDate>Tue, 13 Oct 2009 19:58:33 +0100</pubDate><title>Importing Wordpress posts to Umbraco</title></item><item><author>Morten Bock</author><category>energi</category><category>natur</category><category>svindel</category><description>
&lt;p&gt;Jeg vil gerne lige gøre mit til at advare mod selskabet
Natur-Energi der tilsyneladende ikke har meget respekt for
forbrugernes rettigheder. Flere andre har også have uheldige
oplevelser med dem, som f.eks. Tonni, der blev svindlet med nog bil
streamer værk: &lt;a
href="http://ekstrabladet.dk/kup/vagthundene/article1195722.ece"&gt;http://ekstrabladet.dk/kup/vagthundene/article1195722.ece&lt;/a&gt;
og John der åbenbart skulle skifte selskab fordi han var med i en
spørgeskemaundersøgelse: &lt;a
href="http://24.dk/user/johnsmedehus/perma/2009/07/19/det_er_da_halvfarligt_at_deltage_i_sprgeskemaer_p_netet"&gt;
http://24.dk/user/johnsmedehus/perma/2009/07/19/det_er_da_halvfarligt_at_deltage_i_sprgeskemaer_p_netet&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Og Mogens har her på facebook beskrevet noget der meget godt
ligner den situation vi også er i: &lt;a
href="http://www.facebook.com/wall.php?id=59887513919"&gt;http://www.facebook.com/wall.php?id=59887513919&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Humlen i det hele er at Natur-Energi synes det er helt OK at de
hijacker dit el-abonnement uden at fortælle det til dig. Det eneste
du skal gøre er bare lige at gøre dit og dat for at vise at du
"støtter grøn energi", og hvem gør ikke det? Det glemmer bare helt
at fortælle at de selv er et el-selskab der har tænkt sig at
overtage leverancen af strøm til dig. Og vupti, så får du en
faktura. Hvis du prøver at ringe til dem, ja så får du lov at vente
i 10 minutter til noget musik før linjen bare bliver tavs.
Fedt...&lt;/p&gt;

&lt;p&gt;Så hvis du støder ind i en Natur-Energi mand på gaden eller i
dit storcenter, så stik ham lige en på kassen fra mig, og så skynd
dig videre inden de får fat i din adresse!&lt;/p&gt;

&lt;p&gt;Jeg har i hvert fald tænkt mig at sende et anbefalet brev med en
opsigelse, og så kan de ellers stikke deres faktura et sted hen
hvor solen aldrig skinner. &lt;a
href="http://natur-energi.dk/"&gt;Lorteselskab&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: Fandt lige et link der beskriver at det
alligevel ikke nytter at købe skidtet: &lt;a
href="http://www.elsparefonden.dk/presse/arkiv/presseklip_archive/ni.2008-11-07.4088459089"&gt;
http://www.elsparefonden.dk/presse/arkiv/presseklip_archive/ni.2008-11-07.4088459089&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 2&lt;/strong&gt;: Jeg kan se der stadig er en del
trafik på denne artikel. Hvis du har erfaringer med Natur Energi
osm du har lyst til at dele, eller hvis du har lyst til at læse
mere, så kig in på Trustpilot hvor du kan se andre brugeres mening
om selskabet, og skrive din egen anmeldelse: &lt;a
href="http://www.trustpilot.dk/review/www.natur-energi.dk"&gt;http://www.trustpilot.dk/review/www.natur-energi.dk&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 3 (November 2011)&lt;/strong&gt;:&amp;nbsp;&lt;br /&gt;
Det ser ud til at Natur-Energi har taget feedback til sig, og de
har som resultat af det tilsyneladende lukket deres gadesalg ned.
Du kan læse mere om deres tiltag her: &lt;a
href="http://blog.natur-energi.dk/presse/svar-paa-natur-energi-bruger-ufine-metoder"&gt;
http://blog.natur-energi.dk/presse/svar-paa-natur-energi-bruger-ufine-metoder&lt;/a&gt;
. Det er godt at se at det rent faktisk nytter noget at gøre
opmærksom på problemerne, og håber ikke at der er flere der ryger i
samme situation som vi gjorde.&lt;/p&gt;
</description><guid isPermaLink="false">1424</guid><link>http://www.mortenbock.dk/blog/2009/08/10/natur-energi.aspx</link><pubDate>Mon, 10 Aug 2009 19:26:52 +0100</pubDate><title>Natur-Energi bruger ufine metoder</title></item><item><author>Morten Bock</author><category>adsl</category><category>router</category><category>telnet</category><category>zyxel</category><description>
&lt;p&gt;This is mainly just a "note to self" about how to solve this
problem if I come across it again.&lt;/p&gt;

&lt;p&gt;Problem is that somehow the web interface for the router allowed
me to enter the same ip/mac address to the "client list" table.
This of course is not great, and for some reason there is no
"delete" button on there. It just gave me an "ERROR: Duplicate MAC
Address!" message. So I had to do a lot of digging to find a way to
delete it.&lt;/p&gt;

&lt;p&gt;In short:&lt;/p&gt;

&lt;p&gt;1. Telnet to the router&lt;br /&gt;
 2. Go to the Command Line if you are not already there&lt;br /&gt;
 3. Type this command: "ip dhcp enif0 static delete all"&lt;/p&gt;

&lt;p&gt;I found this in a &lt;a
href="ftp://ftp2.zyxel.com/ftp/pub/downloadlibrary/P-660HN-F1/cli_reference_guide/P-660HN-F1_1.pdf"&gt;
CLI reference for another zyxel router&lt;/a&gt; (PDF).&lt;/p&gt;

&lt;p&gt;I hope this might help out others in the same situation :-)&lt;/p&gt;
</description><guid isPermaLink="false">1421</guid><link>http://www.mortenbock.dk/blog/2009/07/29/zyxel-p-660r-d1-client-list-duplicate-entries.aspx</link><pubDate>Wed, 29 Jul 2009 23:36:02 +0100</pubDate><title>Zyxel P-660R-D1 client list duplicate entries</title></item><item><author>Morten Bock</author><category>english</category><description>
&lt;p&gt;Umbraco is the friendly CMS. At least when you are a developer
or an editor. It's just one of those things that grow on you when
you get into the mindset of using the ultra flexible framework that
it is. Still, once in a while, a new user comes by and &lt;a
href="http://forum.umbraco.org/yaf_postst9074_I-am-really-not-liking-umbraco-so-far-Nothing-like-the-LAMPWAMP-CMS-out-there.aspx"&gt;
can not understand why it is so hard&lt;/a&gt; to create a site using the
existing packages. That makes me wonder. Because as time goes by,
the new users seem to &lt;a
href="http://forum.umbraco.org/yaf_postst9075_I-am-warming-up-to-umbraco-Nothing-like-the-LAMPWAMP-CMS-out-there.aspx"&gt;
warm up to the concepts&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;When I have been in positions where I recommended Umbraco to
companies, they always ask if there are a lot of
plugins/addons/modules (take your pick), and I have always answered
that Umbraco is not as such a modular CMS. Not because it is not
possible, but because it is often really fast to build the
functionality that you want, instead of installing a module that
might not fit your needs 100%, and then spend time trying to
squeeze your ideas into that module.&lt;/p&gt;

&lt;p&gt;With V4 of Umbraco a lot of effort has been but into making it
easier for the new users by giving them the Runway site that
supports Modules. This is cool, and probably will get some to hang
in a bit longer than otherwise, which again gives them time to warm
up to the concepts of Umbraco. But I am wondering if plug'n'play
modules on a larger scale would be the way to go?&lt;/p&gt;

&lt;p&gt;The upside would probably be a wider adaption in small site
installations, and maybe a more active marketplace for commercial
modules through the package repo. But is it the right way to
go?&lt;/p&gt;

&lt;p&gt;Personally I hope that Umbraco remains on the current balance
between flexibility and availability of modules. I like the concept
of starter sites which gives a great foundation on a blank Umbraco
install. But I am not a big fan of packages that hook directly into
the existing site. I do love the packages that simply supply some
new functionality, that you then have to spend a little time
configuring, which in turn gives you lots of control.&lt;/p&gt;

&lt;p&gt;So the question remains: How much of an Umbraco enthusiast
should you need to be, in order to be able to extend your site with
existing packages?&lt;/p&gt;

&lt;p&gt;I do not have the answer to that, but I am really looking
forward do discussing this and much more at the Core/MVP retreat
and Codegarden in June. See you all there!&lt;/p&gt;
</description><guid isPermaLink="false">1409</guid><link>http://www.mortenbock.dk/blog/2009/04/05/thoughts-about-umbraco-as-a-modular-cms.aspx</link><pubDate>Sun, 05 Apr 2009 12:03:52 +0100</pubDate><title>Thoughts about Umbraco as a modular CMS</title></item><item><author>Morten Bock</author><category>english</category><category>umbraco</category><category>aspnet</category><category>membership</category><category>runway</category><description>
&lt;p&gt;I played around with the membership features of Umbraco tonight,
and I thought I would share my findings. Mostly because it is just
incredibly easy to do without even compiling any code. Just pure
templates and a single entry in the web.config file is all it
takes.&lt;/p&gt;

&lt;p&gt;I started by installing the Runway package, to get a basic
website.&lt;/p&gt;

&lt;p&gt;First of all, I set up my members area with a member type and a
member group:&lt;/p&gt;

&lt;p&gt;&lt;a href="/media/images/image.png"&gt;&lt;img src="/media/images/image-thumb.png" width="170" height="172" alt="image" border="0" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now I need to tell asp.net which Member Type I want to use when
creating new users. Find this line in the web.config file:&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;pre&gt;
&amp;lt;add name="UmbracoMembershipProvider"
  type="umbraco.providers.members.UmbracoMembershipProvider"
  enablePasswordRetrieval="false"
  enablePasswordReset="false"
  requiresQuestionAndAnswer="false"
  defaultMemberTypeAlias="WebsiteUser"
  passwordFormat="Hashed" /&amp;gt;
&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Edit the attribute "defaultMemberTypeAlias" to the Member Type
you want. In my case it is "WebsiteUser".&lt;/p&gt;

&lt;p&gt;Now we are ready to create the Sign Up form. I do this in a new
template, which is just a copy of the Runway Textpage, but I add
the following after the body text:&lt;/p&gt;

&lt;pre&gt;
&amp;lt;script runat="server"&amp;gt;

protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
    Roles.AddUserToRole(CreateUserWizard1.UserName, "BasicUsers");
}

protected void CreateUserWizard1_ContinueButtonClick(object sender, EventArgs e)
{
    Response.Redirect("/member-area.aspx");
}

&amp;lt;/script&amp;gt;

&amp;lt;asp:CreateUserWizard ID="CreateUserWizard1" OnContinueButtonClick="CreateUserWizard1_ContinueButtonClick" OnCreatedUser="CreateUserWizard1_CreatedUser" runat="server"&amp;gt;
    &amp;lt;WizardSteps&amp;gt;
        &amp;lt;asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server"&amp;gt;&amp;lt;/asp:CreateUserWizardStep&amp;gt;
        &amp;lt;asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server"&amp;gt;&amp;lt;/asp:CompleteWizardStep&amp;gt;
    &amp;lt;/WizardSteps&amp;gt;
&amp;lt;/asp:CreateUserWizard&amp;gt;
&lt;/pre&gt;

&lt;p&gt;Inside the script block I react to two events. When the user is
created, I add him to the "BasicUsers" group, which is the one I
will give access to my members area. The other method simply
redirects the user to the member area when he finishes the signup
wizard. (&lt;strong&gt;EDIT:&lt;/strong&gt; Petr suggested that you use
ContinueDestinationPageUrl="/member-area.aspx" instead of the
redirect method, which I agree with)&lt;/p&gt;

&lt;p&gt;Now users can sign up for membership, but we also want them to
be able to log in. So we add this to the subNavigation div in the
Runway Textpage template:&lt;/p&gt;

&lt;pre&gt;
&amp;lt;asp:LoginView ID="UmbracoLoginView" runat="server"&amp;gt;
    &amp;lt;AnonymousTemplate&amp;gt;
        &amp;lt;asp:Login ID="Login1" runat="server"&amp;gt;&amp;lt;/asp:Login&amp;gt;
    &amp;lt;/AnonymousTemplate&amp;gt;
    &amp;lt;LoggedInTemplate&amp;gt;
        Welcome
        &amp;lt;asp:LoginName ID="LoginName1" runat="server" /&amp;gt;
        &amp;lt;asp:LoginStatus ID="LoginStatus1" runat="server" /&amp;gt;
    &amp;lt;/LoggedInTemplate&amp;gt;
&amp;lt;/asp:LoginView&amp;gt;
&lt;/pre&gt;

&lt;p&gt;That is all the code that is needed. All that is left is
creating content:&lt;/p&gt;

&lt;p&gt;&lt;a href="/media/images/image1.png"&gt;&lt;img src="/media/images/image-thumb1.png" width="232" height="226" alt="image" border="0" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The login page is just a textpage with some text about logging
in. The Sign Up page is using my new template with the
CreateUserWizard control on it. The Member Area page has Public
Access set like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="/media/images/image2.png"&gt;&lt;img src="/media/images/image-thumb2.png" width="244" height="223" alt="image" border="0" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is all there is to it. Pretty easy huh? Feel free to post
any questions in the comments, and I will try and answer to the
best of my ability.&lt;/p&gt;
</description><guid isPermaLink="false">1394</guid><link>http://www.mortenbock.dk/blog/2009/04/01/setting-up-membership-in-umbraco.aspx</link><pubDate>Wed, 01 Apr 2009 00:33:43 +0100</pubDate><title>Setting up membership in Umbraco</title></item></channel></rss>
