www.archive-dk-2014.com » DK » M » MORTENBOCK

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

    Archived pages: 131 . Archive date: 2014-10.

  • Title: Morten Bock | .Net developer
    Descriptive info: .. Home.. Archive.. Contact.. About.. Search.. Morten Bock.. Net developer.. NAVIGATION - SEARCH.. The hasbang controversy.. 26.. September 2014 19:03.. /.. mortenbock.. Browsers.. Comments (0).. The other day I responded to a tweet about using prerendering tools to serve JS driven pages to crawlers.. If you have to use.. http://t.. co/1QPSt9cYoi.. you're doing it wrong.. David J Marland (@djmarland).. September 25, 2014.. Afterwards a twitter debate followed, and as usual, much is lost in a debate limited to 140 char chunks.. Basically the opinion was that if you use hashbang urls, you are the spawn of the devil, and you will kill all the kittens in the world.. I will try to present my argument why I think using hasbang urls can be an acceptable solution to a specific problem.. Scenario.. For the purpose of an example, consider a company, Acme Cloth Inc, which is an imaginary online retailer of clothing.. This company has a Shirts category on their website, which they want users to be able to filter in a nice manner.. That means that the following features should work:.. When a filter has been applied, then the user should be able to bookmark it and share it.. The list should update without a page refresh, when a filter is set, to improve usability and performance.. The filtered url should be crawlable by search engines.. The browser demographics statistics of the site show that 10% of the users us IE 8/9, and those users generate 20% of the revenue (these stats are from a real site at the time of writing).. Solutions.. In a modern browser, achieving the above objectives is not a problem.. Using the.. pushstate.. browser API, it is entirely possible to update the url without causing a page refresh.. For example, the url for a filtered page could look like.. /shirts/nike/green.. This is a very nice solution, which also makes the urls crawlable by default.. The problem is that IE 8/9 do not support.. Since those browsers are a big part of the revenue, we want to treat them at first class citizens in our website.. If we continue with the pushstate solution, then we will have to give up either the url history or the ajax loading of the products when filtered, but that also means that 10% of our users will get an inferior experience.. Enter the hasbang #!.. The.. hashbang.. is a convention that Google supports, where you can specify that urls containing #! are actually JS driven pages, and then ask Google (and other bots) to fetch the page in a server rendered form, be requesting the hash as a query string.. So a url like.. /shirts#!/nike/green.. would be requests by Googlebot like.. /shirts?_escaped_fragment_=%2Fnike%2Fgreen.. which would then tell you server to fetch the data directly instead of serving the Js driven page.. Why is this helpful? Well this invites IE 8/9 users to the party, since using hasbang url's like.. enables those browser to keep a history of the filter changes in the url, and bookmark those.. The downside is that when users load a page with a hasbang url, there will be a slight delay before the content is loaded, since in must be fetched by a separate ajax request.. However this can be optimised, and you can work with.. perceived performance.. to improve the experience of that first page view.. Subsequent filtering will be very snappy, because there will be no page refreshes.. Problem solved?.. The hashbang solution lives up to the 3 criteria we set out with at the beginning.. Also for the IE 8/9 users.. In the case of Acme Cloth Inc, this means that we can provide a good service to a loyal customer group, which will most likely improve the revenue stream.. You can argue that this is not the "right" way to build websites, based on the way the web *should* work.. It is a fair point, but I don't think you should build a website just to satisfy you principles, you should build it to serve your users.. Is the hashbang a hack? Sure.. Is it worth it to support user that supply 20% of your revenue? I think so! Should you use it on your website? That depends very much on your browser demographics.. The pushstate solution is much cleaner, and is the future of the web, and you can decide if you think you can supply a service that is good enough for the IE 8/9 users, without either the history or the ajax features.. What about  ...   mapping my products.. It had (conveniently for this example) a Thread.. Sleep() for each product.. So there you go.. A way to profile what i actually going on in you views and view engines.. Full Gist with the profiling code is here.. I still do not know what the heck is going on with the default profiler, and what it is actually trying to do, but it sure confused me more than it needed to.. Looking at the source of it, I still don't know what it's supposed to do?? But I thought this might be handy for others wondering why it takes so long to find their views.. b47f2c87-c1f8-4c41-ba18-4e1303e759ad|1|5.. umbraco.. mvc.. miniprofiler.. Slides from my UmbDkFest presentation.. 15.. April 2013 10:00.. I had the pleasure 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.. If you would like to take a look at.. the slides, I've uploaded the PDF here.. 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.. c3b491e5-59ac-4f6a-81e5-27e971b903ed|6|4.. 4|96d5b379-7e1d-4dac-a6ba-1e50db561b04.. umbdkfest.. The industry of heroes and dreamers.. 11.. November 2012 12:00.. 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.. 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.. 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.. 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.. 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.. 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.. 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.. 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?.. 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.. Thanks to Scott Hanselman, for sparking this thought with.. his conversation with Paul Lutus.. d5355260-5fda-4591-8a3a-ba38ab7b6f81|0|.. developers.. Older posts.. Newer posts.. 1.. 2.. 3.. 4.. My name is Morten Bock Sørensen and I am currently working as a developer at.. Vertica A/S.. where I mainly do e-commerce and Umbraco development.. Category list.. Analytics (1).. Browsers (2).. Networking (1).. Privat (1).. Umbraco (8).. Tag cloud.. adsl.. aspnet.. blog.. browser.. chrome.. codeplex.. design.. e-commerce.. energi.. english.. google-analytics.. javascript.. linktracking.. linq2xml.. membership.. natur.. router.. runway.. Shortcuts.. svindel.. telnet.. tip.. tips.. VS2010.. wordpress.. xml.. xslt.. zyxel.. |.. Subscribe.. Filter by APML.. Log in.. |.. UP.. Copyright 2014.. -.. Powered by.. BlogEngine.. NET.. 8.. 0.. 2.. Design by.. Farzin Seyfolahi..

    Original link path: /
    Open archive

  • Title: Contact
    Descriptive info: I'll answer the mail as soon as I can.. Name.. Required.. E-mail.. Please enter a valid e-mail.. Subject.. Message.. Attach a file..

    Original link path: /contact
    Open archive

  • Title: About
    Descriptive info: I have been working with.. since the beginning of 2006 and I am proud to be part of the.. community.. around it.. For more of my proffessional and educational background visit me on.. LinkedIn..

    Original link path: /page/about
    Open archive
  •  

  • Title: The hasbang controversy
    Descriptive info: Shared Google calendars on the Nokia Lumia 1020.. Add comment.. Cancel reply to comment.. Name*.. Please choose another name.. E-mail*.. Are you a bot?.. The captcha value you provided is incorrect.. b.. i.. u.. quote.. Comment.. Preview.. Notify me when new comments are added..

    Original link path: /post/the-hasbang-controversy
    Open archive

  • Title: All posts by mortenbock
    Original link path: /author/mortenbock
    (No additional info available in detailed archive for this subpage)

  • Title: Browsers
    Descriptive info: How to edit Chrome thumbnails.. 24.. November 2009 23:28.. 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.. 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.. This is not supported by chrome, as far as I can tell, so I  ...   is here:.. C:\Documents and Settings\Morten Bock Sørensen\Lokale indstillinger\Application Data\Google\Chrome\User Data\Default\Preferences.. UPDATE:.. I now upgraded to Windows 7, and here the file is found in:.. C:\Users\Morten Bock Sørensen\AppData\Local\Google\Chrome\User Data\Default\Preferences.. 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:.. "1cc089548931c4fe0463e7a98ec6078e": {.. "direction": "ltr",.. "index": 2,.. "title": "Twitter / Home",.. "url": "http://twitter.. com/home".. com/".. },.. to.. And off we go :-).. Just remember to do this while Chrome is closed, otherwise it will overwrite your changes.. 87f208be-b0fe-451a-af71-2250610d40aa|0|..

    Original link path: /category/Browsers
    Open archive

  • Title: Shared Google calendars on the Nokia Lumia 1020
    Descriptive info: Profiling MVC views in Umbraco 6.. Related posts.. Tracking all outgoing links with Google Analytics.. I wanted to try and find a way to track all of the outgoing links on my blog, without haven to modif.. I just wanted to shared this tip, if anyone else wants a bit of control over the thumbnails that sho.. The other day I responded to a tweet about using prerendering tools to serve JS driven pages to craw..

    Original link path: /post/Shared-Google-calendars-on-the-Nokia-Lumia-1020
    Open archive

  • Title: All posts tagged 'windows phone'
    Original link path: /?tag=/windows+phone
    (No additional info available in detailed archive for this subpage)

  • Title: All posts tagged 'google'
    Original link path: /?tag=/google
    (No additional info available in detailed archive for this subpage)

  • Title: Profiling MVC views in Umbraco 6
    Descriptive info: Slides from my UmbDkFest presentation.. Importing Wordpress posts to Umbraco.. As you may have noticed, my blog has changed a bit this week.. I finally got around to porting it to.. Using inline macros in the Umbraco editor.. I've seen the question asked a lot  ...   to give a good an.. Setting up membership in Umbraco.. I played around with the membership features of Umbraco tonight, and I thought I would share my find.. Comments (1).. Søren Reinke.. 9/26/2013 5:42:49 AM.. Interesting blog post, with quite a few good pointer.. Thanks.. Reply..

    Original link path: /post/Profiling-MVC-views-in-Umbraco-6
    Open archive

  • Title: Umbraco
    Descriptive info: 28.. July 2011 23:33.. 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 p or div tag to be created around it, which means that the macro will always be a block of content.. 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.. So I came up with the below solution.. Of course it has benefits and drawbacks.. In short:.. Benefit:.. - Inline macros.. Drawbacks:.. - You do not get a nice way of entering data for macro parameters.. - The preview snippet is static from the moment you insert it in the editor.. 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.. 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:.. In this case my snippet will write the name of the page, and when rendered in the frontend it will look like this:.. So, how does this work? There a three parts that we need to set up.. Create a previewable macro.. Create an aspx page that renders the preview snippet for the editor.. Configure the TinyMCE editor to use the snippets with the Templates module.. Step 1: Previewable macro.. 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.. Make the macro aware of a preview state.. Step 2: Snippet page.. Create an aspx page that will render the macro snippet as well as the macro in preview mode.. 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.. 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:.. Step 3: Enable the templates module in TinyMCE.. First we add a few thing to the tinyMceConfig.. config file.. The command.. The plugin.. Allow the umbraco:macro tag as valid html.. And add configuration for the templates, so the editor knows which snippets it can get and from which urls.. Then we disable the tidy function in umbracoSettings.. config, because that will throw an error when it sees the umbraco macro tag.. Now, go to the Richtext Editor datatype, and enable the newly added templates module.. I also added my own editorStyles stylesheet, but that is standard umbraco stuff :-).. And that is it.. Now the macro can be inserted to your text without having to be in a p tag.. Neato.. 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.. Get the demosite here:.. InlineMacroDemo.. zip.. 3cf38c57-1d01-4f32-8dfa-e5775b430341|0|.. Launched new blog.. 13.. February 2010 00:04.. 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 :-).. 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.. ).. Go visit..  ...   possibility to enter the XML in a textarea instead, thus the commented out line:.. XDocument loaded = XDocument.. Load(Server.. MapPath("~/usercontrols/wordpress.. 2009-08-01.. xml")); //XDocument loaded = XDocument.. Parse(wpxmltextbox.. Text); XNamespace wpns = XNamespace.. Get("http://wordpress.. 0/"); XNamespace contentns = XNamespace.. Get("http://purl.. 0/modules/content/"); var q = from c in loaded.. Descendants("item") where (string)c.. Element(wpns + "post_type") == "post" select c;.. 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.. 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" !string.. IsNullOrEmpty((string)tag.. Attribute("nicename"))) { if (i 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.. 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.. UpdateDocumentCache(commentdoc.. Id); } } }.. 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:.. These are the three methods I am using to parse the text:.. public static string CreateParagraphTags(string postbody) { StringBuilder sb = new StringBuilder(); sb.. Append(" p "); sb.. Append(postbody.. Replace("\n\n", " /p p ")); sb.. Append(" /p "); 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 string, string replaceValues = new Dictionary string, string (); int i = 0; foreach (Match match in regPattern.. Matches(postbody)) { string code = match.. Groups[3].. Value; if (code.. Contains(" ")) { code = code.. Replace(" ", " lt;").. Replace(" ", " gt;"); } postbody = postbody.. Replace(match.. Value, string.. Format("[[[replacecode{0}]]]", i)); replaceValues.. Add(string.. Format("[[[replacecode{0}]]]", i), " pre " + code + " /pre "); i++; } foreach (KeyValuePair string, string replaceValue in replaceValues) { postbody = postbody.. Replace(replaceValue.. Key, replaceValue.. Value); } return postbody; }.. It's not perfect.. For example it added some strange p 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.. 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 :-).. 5f240a92-f597-45fe-b4c8-2cc5ac02bec0|0|..

    Original link path: /category/Umbraco
    Open archive



  •  


    Archived pages: 131