kenny.nohttp://kenny.no/Posts from Kenneth Solbergs blogen-us40OUUG January 2011 MeetupLast Thursday we arranged the first official Oslo Umbraco User Group (OUUG) 
meetup. This is an independent user group and a local arena for people interested in Umbraco, that be newcomers or seasoned developers. Meetups will be arranged every second month, next due in March. Keep an eye on our Meetup.com page for further details.

Our first meetup was arranged at Xeed who sponsored pizza, snacks and beverages. The topics for the evening was a closer look at the news in 4.6, status of 5.0 and help on how to contribute. We also discussed OUUG in general and the way forward.

Download Powerpoint slides.

]]>
20.1.2011 http://kenny.no/archive/2011/1/20/ouug-january-2011-meetup http://kenny.no/archive/2011/1/20/ouug-january-2011-meetup
XML views in UmbracoIn Umbraco you both can and should cache macros. However at some point the cache will time out and the next visitor will get "hit" with a real macro execution. Even worse, what if the app pool just got recycled and the next visitor gets it all? As your content grows your XSLTs will become slower, especially if you need to do broad XPath queries. How should you deal with this this? Say hello to XML views.

A XML view is a highly specific XML fragment with data extracted from your published content XML that is stored in a separate file. You can achieve this without even one line of code by using Darren Fergusons excellent Feed Cache package. This package lets you specify one or more XML feeds to download and store as a flat files. The URL can point to any internal or external URL returning XML. If the target URL is unavailable the previously downloaded file will be left untouched. The package adds a task in config/UmbracoSettings.config so that feeds will be downloaded periodically.

Example scenario:

Let's say you have a fragment in your published content XML that contains 5000 rich content nodes that needs to be queried with a broad and complex XPath. This is an expensive operation and you'll see the CPU hit the roof every time the XPath is executed.

latestArticles.xslt:

<xsl:for-each select="$someContext//article [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:sort select="@createDate" order="descending" />
<xsl:if test="position() &lt;= 10">
<h1><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="Header" /></a></h1>
:
</xsl:if>
</xsl:for-each>

Now let's recreate this with a XML view!

First off create a XSLT and call it xmlViews.xslt and copy the logic from latestArticles.xslt

xmlViews.xslt:

<xmlViews>
<latestArticles>
<xsl:for-each select="$someContext//Article [string(umbracoNaviHide) != '1']">
<xsl:sort select="@createDate" order="descending" />
<xsl:if test="position() &lt;= 10">
<article url="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="Header" /><article>
:
</xsl:if>
</xsl:for-each>
</latestArticles>
:
</xmlViews>

Ps. Add any additional XML views needed inside the xmlViews node.

Next create a template and name it xmlViews and place the xmlViews macro in it.

Next install the Feed Cache package ( download here). When the package is installed open \config\feedcache2.config and add a new feed:

 :
<Feed>
<Url>http://yourdomain/xmlViews</Url>
<LocalFile>xmlViews.xml</LocalFile>
</Feed>
:

Now hit this URL to make it run immediately instead of waiting for the Umbraco scheduled task to execute. This will generate a physical file named xmlViews.xml found under \App_Data\FeedCache:

http://yourdomain/umbraco/plugins/FergusonMoriyama/FeedCache2/FmFeedCache.aspx

Now update your latestArticles.xslt:

<xsl:variable
name="xmlViews"
select="document('../App_Data/FeedCache/xmlViews.xml')/xmlViews" />
<xsl:for-each select="$xmlViews/latestArticles/Article">
<h1><a href="{@url}"><xsl:value-of select="." /></a></h1>
:
</xsl:for-each>

What you got here is in fact a file based caching mechanism that won't "hit" your visitors and that will live even if the app pool is recycled.

In a load balanced farm setup you could let the editor instance do the XML generation and with a SAN/NAS file system have the one or more front instances pick up the generated XML file(s).

I'm using this simple technique a lot and it's really fun to optimize existing sites with it as well and see cold page loads drop from ~1sec to ~0.1sec in matter of minutes of optimization. Recently I've also commented out the feed cache task in umbracoSettings.config and instead used Pingdom to ping that URL to keep the site nice and warm at any time.

]]>
8.12.2010 http://kenny.no/archive/2010/12/8/xml-views-in-umbraco http://kenny.no/archive/2010/12/8/xml-views-in-umbraco
Umbraco Developer Chrome ExtensionchromeextensionFor those of you not on twitter or our.umbraco.org - here's a Chrome Extension for Umbraco Developers. This extension will let you switch between different debug modes and the Umbraco UI. It also sports two search boxes for directly searching the Umbraco custom Google search and our.umbraco.org.

If you have ideas for improvements, please let me know! 

]]>
12.12.2009 http://kenny.no/archive/2009/12/12/umbraco-developer-chrome-extension http://kenny.no/archive/2009/12/12/umbraco-developer-chrome-extension
Image Cropper 0.95Just a small update with some minor bugfixes:

  • New datatypes defaults to the last one created and because of a bug in the initialization process of this component you couldn't change rendertype. This has now been fixed. Thanks to Bob Baty-Barr for extensive testing and useful feedback.
  • Refactoring

I've also implemented functionality to generate crops for all content nodes using any given datatype with this rendercontrol. However, I've disabled this until It's been tested a bit more ;-)

Things I'd like to implement in the next version:

I'd also like to thank Douglas Robar for giving me a pro license so I can play with the Image Cropper together with ImageGen, the excellent and de-facto component in every Umbraco developers toolbox. Blog post coming up!

This datatype will be part of Umbraco v4.1.

Download Image Cropper v0.95 for Umbraco

]]>
26.5.2009 http://kenny.no/archive/2009/5/26/image-cropper-095 http://kenny.no/archive/2009/5/26/image-cropper-095
Image Cropper v0.9I’ve just updated the Image Cropper datatype with some adjustments, bugfixes and new features:

  • Ability to configure what quality you want the crops in
  • Default positioning of crops (Left/Center/Right and Top/Middle/Bottom)
  • Fixed an interpolation issue when resizing that would produce a soft border around the crop
  • Fixed an issue when saving/publishing after a postback

I’ve changed the location where crops are stored from an underlying /crops folder to the original image location as well as changed the name of the generated crops to /media/(propertyid)/filename_(cropname).jpg. I did this because it will let you override the default image thumbnail in the Media section by naming at least one of the crop presets ‘thumb’.

media

PS! Insert image dialog in RTE will still show a rectangular vertically centered view of the thumb, so you are warned ;-). I’ll add a configuration option for this in the next version.

Thanks to all for your feedback on the first release. Lots of great ideas that I’ll try to implement at some point such as max viewsize (Thanks Thomas) and more.

Download Image Cropper v0.9 for Umbraco

]]>
10.5.2009 http://kenny.no/archive/2009/5/10/image-cropper-v09 http://kenny.no/archive/2009/5/10/image-cropper-v09
Image Cropper datatype for UmbracoHere's a new datatype for Umbraco that lets you crop images. Available crops are configured in the datatype prevalue editor. The datatype can be used on both Media and Content nodes and stores data in plain XML format. You can also configure it to create physical crops for you. The cropping UI is based on jCrop from Deep Liquid. I've recorded a short screencast that shows the datatype in action.

Please let me know what you think and if you got ideas for additional features or tweaks.

Download Image Cropper Package

]]>
3.5.2009 http://kenny.no/archive/2009/5/3/image-cropper-datatype-for-umbraco http://kenny.no/archive/2009/5/3/image-cropper-datatype-for-umbraco
Umbraco release dates Umbraco v4 is on track and here are some dates from twitter.com/umbraco:

  • RC2: Jan 16th
  • RC3: Jan 23rd
  • Release: 30th

I highly recommend subscribing to the Umbraco RSS feed at Codeplex to get an insight of what gets implemented / fixed:

The core team usually add a comment describing the work that is checked in. As an example, here are some updates made yesterday:

  • 45581: New section icons, UI tweaks, translations, sort dialog bug fixes. Reverts the "page shouldn't save if validation fails" feature..

    icons
    Here’s a screenshot of the new icons =)
  • 45549: Improves en.xml ui translation, improved sorting, content picker overflow,fixed: regex form, fixed: tree padding/margins, fixed: content editor validators doesn't stop it from saving. Deletes old V2 ui graphic files.

    sort
    Click name to sort all nodes.
  • 44976: Fixes 20223, Adds full Safari support for tinymce

Now, go subscribe and get involved by testing and report issues you encounter!

]]>
8.1.2009 http://kenny.no/archive/2009/1/8/umbraco-release-dates http://kenny.no/archive/2009/1/8/umbraco-release-dates
Blog updated to Umbraco v4Blog finally upgraded from v2 (!) to v4. Not much new to the blog except some minor details such as Gravatars, comments RSS, upgraded XSLTSearch from Percipient Studios, design polish and more.

However, under the hood there are some enhancements such as Darren Fergusons excellent Feed Cache Package to speed up Last.FM, Twitter and Google shared RSS listings, and last but not least MetaWeblogAPI integration via Umbraco Content Channels. Man, I love blogging from Windows Live Writer!

]]>
14.12.2008 http://kenny.no/archive/2008/12/14/blog-updated-to-umbraco-v4 http://kenny.no/archive/2008/12/14/blog-updated-to-umbraco-v4
Microsoft Search Server Express 2008 and UmbracoIntroduction

Earlier this year Microsoft released Search Server Express 2008. This product is based on technology from Sharepoint and can compare to Google Mini Search Appliance, however MSSE is free with very few limitations (only one I know of is Clustering). Via it's really userfriendly Sharepoint like interface you get full control over sources to crawl and index - both local files and external websites.

1_msse_admin_640 2_msse_admin_sources_640

Microsoft Search Server Express (MSSE)

First lets install:

  • Grab a host operating system, either Windows 2003 or 2008. I chose 2003.
  • From 'Configure your server' in Windows add the 'IIS' role and enable ASP.NET only.
  • Download ASP.NET 3.0 runtime and install.
  • Download Windows Search Server Express 2008 and start the installation.
    • Do NOT install Windows Sharepoint Services first.
    • Run the 'Search Server Preparation Tool'.
    • Run the 'Install Search Server' and follow the instructions.
  • (Optional) Download Acrobat Reader v8.x for PDF IFilter and install for PDF indexing.
    • Download and save the 17x17 PDF icon/gif from here and save as:
      C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Images\icpdf.gif
    • Edit the 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Xml\DocIcon.xml' file and insert the following line in the '' section in the appropriate place alphabetically for PDF:
    • Add the following registry key and set its value to 'pdf':
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Applications\\Gather\Search\Extensions\ExtensionList\38
    • Check the following GUID values are correct in the registry (default values should be {E8978DA6-047F-4E3D-9C78-CDBE46041603}):
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office server\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf
    • Add "C:\Program Files\Adobe\Reader 8.0\Reader" to the system path.
    • Add PDF document type in the search server by opening up the administration console (http://MYSERVER:48560/ssp/admin/_layouts/managefiletypes.aspx), and add an entry for 'pdf' (no dot).
    • Restart the Search Server Service (from the command line):
      net stop osearch
      net start osearch

 

Now that we have installed MSSE, let's index something:

  • Go to 'Content Sources' and click 'New Content Source'.

    3_msse_admin_add_640
    Check the last checkbox to start full index directly.
    When indexing is done, you can get crawl results in the log:

    4_msse_admin_log_640
  • (Optional) Add crawler rules for authentication, url's to include/exclude, etc.

    5_msse_admin_rule_640
Of course, there's a lot of different configuration options, but I'll cover more of this in a later post. As you've probably noticed from the screenshots above I indexed the Umbraco forum. The final index consist of about 14.000 records. Of course, MSSE also provides a search interface that you can query your indexed sources and it looks like this:

 

6_msse_search_640
PS! Be sure to add a user on this site via the 'Site Actions -> Site Settings -> People and Groups -> Add User'. I created one called 'searchuser' as you'll see further down in the post.

A search for 'macro' returns 1972 records in ~0.5 sec on a Windows 2003 VMWare instance with 1GB of RAM and no spesific optimization for background services and such. Relevance sort is also extremely good and I believe it's even better than a 'site:forum.umbraco.org macro' search on Google!

Now, let's create some querying controls for Umbraco...

Search Community Toolkit

A really nice set of controls to query MSSE can be found at Codeplex. The project is called Search Community Toolkit and consist of two controls:

  • SearchInput which allows customisation of input controls including input box, search button and optionally a listbox with available scopes.
  • SearchResults to present the results of the query. The format of the query is defined in an xml file, and the results are transformed via an Xslt file.

Out-of-the-box these two controls isn't all that "Umbraco-friendly" (read: Public propery controllable), so I created a usercontrol wrapper for each with some extra candy and wrapped it in a Umbraco Package.

MSSE UserControls for Umbraco

Both UserControls expose all members from the underlying Controls from Codeplex and defaults to web.config settings with same name if not specified. Further ResultUrl defaults to currentPage and XSLT is performed in Umbraco context, yes - with umbraco.library, $currentPage and the whole schabong.

Download

Here's download links for the Visual Studio 2008 project files and binary build:

You should also define default values for all Macro parameters in web.config:


    "SearchServiceUrl" value="http://msse/_vti_bin/search.asmx" />
    "SearchServiceCredentialDomain" value="test01" />
    "SearchServiceCredentialUser" value="SearchUser" />
    "SearchServiceCredentialPassword" value="abc123" />
    "SearchTemplates" value="/xml/LiveSearchTemplates.xml" />
    "DefaultScope" value="All sites" />
    "ExcludedScopes" value="Rank Demoted Sites,Global Query Exclusion" />
    "XsltName" value="/xslt/Live.xslt" />
    :

Now, copy the /bin files and the two usercontrols to your site and create the macro with it's properties automatically fetched from the referenced usercontrols. Insert it in a tempalte and try it out! Here's a screenshot from my testsite:

7_umbraco_search 
In part 2 I'll discuss more advanced topics covering tighter integration with Umbraco with 'custom attribute mapping', searching other filetypes such as PDF files, customising the search result XSLT and more. Stay tuned!

]]>
25.9.2008 http://kenny.no/archive/2008/9/25/microsoft-search-server-express-2008-and-umbraco http://kenny.no/archive/2008/9/25/microsoft-search-server-express-2008-and-umbraco
Umbraco meetup in OsloIntroduction
On Friday, 29. august Xeed arranged the first Umbraco meetup in Norway. Inspired by the recent meetups in Belgium and the UK, we wanted to achieve something similar in Norway. Our goal was to gather Umbraco interested and start a national network for the exchange of experiences and more.

We had participants from both Trondheim, Bergen, Hamar and Kristiansand. They were:

  • Nicolas Van Etten
  • Siw Ørnhaug Nylund
  • Terje Dahl
  • Ståle Engen
  • Christian Melbye
  • Fredrik Kvivesen
  • Jørgen Tonvang
  • Fredrik Skarderud
  • Kenneth Solberg
  • Andre Brynhildsen
  • Frederik Vig

We started out by having each participant answer four questions: Who are you? What are you doing? Why Umbraco? Goals for the evening? The participants were roughly divided 50/50 between the relatively new and the experienced so the goals for the evening were many.

Presentation
The first hour we highlighted the core concepts of Umbraco as well as the advantages of the different user roles. Download presentation.

umbraco-(1-of-3) umbraco-(2-of-3)

Demos
v3 was used to demonstrate basic concept. In the other half we demonstrated v4 and covered Database Provider, Membership Provider, Master Pages, Umbraco and Visual Studio, Package Repository with Boosts and Nitro, and more. The use of Windows Live Writer was also demonstrated. At the end Umbraco based sites were presented.

Discussions and QA
 umbraco-(3-of-3) The participants were encouraged to ask questions along the way:

  • How multilingual sites are handle in Umbraco. It's common practise to use separate structures and map host headers to root nodes and link to a language so that the culture settings follow each site. There are other ways as well, but this is what we recommend. Translator role was also discussed and explained with reference to the umbraco.tv service coming 15th September with among other things, a video that explains the translation process in detail.
  • Umbraco does not use Windows Workflow Foundation. It has a pragmatic implementation of admin, editor and translator roles. Backend workflow where Umbraco acts as a participant in a workflow can be implemented in many ways, but we recommend looking into Base and ActionHandlers.
  • Umbraco has no GUI for a scheduler services such as in EpiServer. However, you can configure scheduled tasks in UmbracoSettings.Config.
  • Cross publishing is possible in Umbraco. We recommend taking a closer look at Christian Palms MultiplePagePicker and Tim Geyssens Ultimate Picker.
  • Experiences with several editors. Not much experience with several simultaneous editors, but is expected to work like charm :-) Training of editors was really easy compared to other systems due to Umbraco's very simple user interface and the ability to set a starting content/media node, and removing access to sections.
  • There is no whitepaper on Umbraco and security. But a good selling point is that anyone can look into Umbraco source code as it is Open Source. A good infrastructure and routines for security patch installation is also really important.

We also discussed the benefits of establishing a national network of Umbraco expertise:

  • Give confidence to potential customers by referencing national players using Umbraco.
  • Exchange knowledge and experience.
  • Recruitment to the Umbraco community.

Tips and Tricks
We ended the session with Umbraco tips and tricks:

  • Tabs pr. section
  • Empty tags in XSLT, best practice
  • Debugging bookmarklet
  • HTTP compression
  • umbracoNaviHide gives 404
  • Firebug og Yslow extensions i FF
  • mm.

Summary
First and foremost, it was very fun to say hello to the other Umbraco interested in Norway and I hope we can arrange more sessions in the future. Niels also made a video from Belgium where he along with Tim and Ruben worked with Live Edit feature. The video wasn't available during the meetup, but it is. So for those of you who participated (and others if curious), you can see the video by clicking the link below.

]]>
4.9.2008 http://kenny.no/archive/2008/9/4/umbraco-meetup-in-oslo http://kenny.no/archive/2008/9/4/umbraco-meetup-in-oslo