<?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>umbraco</category><category>umbdkfest</category><description>
&lt;p&gt;I had the plasure of presenting a case about
Trollbeadsuniverse.com at the Umbraco DK Festival last week. the
talk focused on how we implemented a large site with many languages
and editors in Umbraco.&lt;/p&gt;

&lt;p&gt;If you would like to take a look at &lt;a
href="/media/32073/trollbeadsuniverse.pdf" title="Slides"&gt;the
slides, I've uploaded the PDF here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks to the Kraftvaerk guys for making a good event, and
thanks to those of you who stopped by. Let me know if you have any
questions.&lt;/p&gt;
</description><guid isPermaLink="false">6963</guid><link>http://www.mortenbock.dk/blog/2013/04/15/umbdkfest-presentation.aspx</link><pubDate>Mon, 15 Apr 2013 19:58:15 +0100</pubDate><title>Slides from my UmbDkFest presentation</title></item><item><author>Morten Bock</author><category>developers</category><description>
&lt;p&gt;When I was younger, all I wanted was to be a musician. It was a
magical thing where everyone seemed to have a common ground, and
were creating something from their heart, which would mean
something for a lot of people. Anyone can pick up an instrument,
and start practicing, and start creating. Some are great, some are
not. But anyone can do it.&lt;/p&gt;

&lt;p&gt;Everyone who plays has at some point started by plucking at a
guitar string, or playing on the piano in the living room. That is
the connection between the beginner and the superstar. The very
first notes. The only thing between them is effectively the number
of notes played.&lt;/p&gt;

&lt;p&gt;So you start by playing a note. Then trying to combine them, and
as time goes by, you will get inspired by notes that others have
combined and shared with the world. Some were played many years
ago, and others have just flowed through the ether for the first
time. But they are all there to be heard, and inspire those willing
to hear them.&lt;/p&gt;

&lt;p&gt;Music is a magical industry where some are raised to fame, for
one reason or another. Not only among listeners, but also among
fellow musicians all over the world. It is an ever evolving art
between creators sitting in the wee hours of the morning, trying to
bend the notes just right.&lt;/p&gt;

&lt;p&gt;I did never become a musician. And at times I think of what it
would have felt like to be one. But I've come to realize that being
a developer actually has many similarities to what I think a
musician experiences.&lt;/p&gt;

&lt;p&gt;We are fortunate to be in an industry that is proud to share
experience and knowledge between all levels of developers. We all
have the opportunity to learn from our peers, be they colleagues,
rising stars, heroes or dinosaurs.&lt;/p&gt;

&lt;p&gt;It would not be far fetched to find the developer equivalents to
The Beatles, Jimi Hendrix, Eminem or whatever floats your boat.
Some have set the bar, and some are pushing the limits. And because
of the culture that exists in software development, we all get to
know about it. Be inspired by it.&lt;/p&gt;

&lt;p&gt;I don't know if other industries have the same luck that we do.
Will accountants read interviews with the godfathers of accounting?
Are there ground breaking wizkids pushing the boundaries of public
transport?&lt;/p&gt;

&lt;p&gt;I do know, that I enjoy listening for inspiration no matter if
it comes from Miles Davis, Bon Iver or Hanselminutes, and I am
proud of our industry for creating that possibility.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thanks to Scott Hanselman, for sparking this thought with &lt;a
href="http://www.hanselminutes.com/342/an-interview-with-paul-lutus"&gt;
his conversation with Paul Lutus&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
</description><guid isPermaLink="false">5141</guid><link>http://www.mortenbock.dk/blog/2012/11/11/the-industry-of-heroes-and-dreamers.aspx</link><pubDate>Sun, 11 Nov 2012 02:53:05 +0100</pubDate><title>The industry of heroes and dreamers</title></item><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></channel></rss>