by Njål

Problems with Recycle Bin in Umbraco – No Document exists with Version '00000000-0000-0000-0000-000000000000'

I recently had some problams emptying the Recycle Bin in Umbraco 4.6.1.  I clicked Empty Recycle Bin – but after a few items got removed the progress suddenly stopped showing 201 items remaining. Crap.

Internet Explorer displayed a Javascript Error msg (with a stacktrace):

No Document exists with Version '00000000-0000-0000-0000-000000000000'

Waiting, restarting IIS and trying to empty the recycle bin again did not help. Time to Google.

I found part of the solution here:

The sql

SELECT * FROM umbracoNode, cmsContent -- return nodes
WHERE
nodeObjectType = 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972' -- that are of type 'Content'
AND
umbracoNode.id NOT IN (SELECT nodeId FROM cmsContent) -- but are not in the 'Content' table

helped me identidy orphan nodes that should be removed.

For each unique umbracoNode.Id in the result (you will get a lot of rows with the same id using the sql above) i ran the sql below to remove these nodes.

DECLARE @TEMPID INT
SET @TEMPID= 1843 -- TYPE IN ID HERE - e.g. 1843

DELETE
FROM         cmsContent
WHERE     (nodeId IN (Select id from umbracoNode where parentID = @TEMPID))

DELETE
FROM         cmsPropertyData
WHERE     (contentNodeId IN (Select Id from umbracoNode where parentID = @TEMPID))

DELETE
FROM         umbracoNode
WHERE     (id IN (Select id from umbracoNode where parentID = @TEMPID))

DELETE
FROM         umbracoNode
WHERE     (ID = @TEMPID)

Then I tried emptying the recycle bin again. Now it deleted 10 more items before it stopped.

I repeated the steps above again – first I ran the select sql to find the new orphan nodes, and then I ran the delete sql’s. I was able to remove 43 more items from the recycle bin this way.

I repeated this procedure until my Recycle Bin was empty (I had to do it 6-7 times or so).

Make sure to backup your database before trying this approach.

by Njål

ImageGen resize functionality for free!

ImageGen is a great little .NET library that basically resizes images on the fly. The typical use of it is on websides, blogs etc – where a image is resized just before sending it to the browser. It is often used in Umbraco CMS sites, but it can be used just as easily in any Asp.net site.

Here’s an example:

http://server.degree.no/media/39263/untitled-19.png (original image)

http://server.degree.no/umbraco/ImageGen.aspx?image=/media/39263/untitled-19.png&width=150 (resized by ImageGen)

It is often very useful to resize a image to a height of e.g. 60 pixels while also ensuring that the width should not be greater than e.g. 200px.
ImageGen offers this in its PRO version:

This feature is the only true useful feature of the PRO version ($199 per domain!) I have ever had use for.  Here’s a trick to achieve maxHeight / maxWidth functionality with the free version:

http://server.degree.no/umbraco/ImageGen.aspx?image=/media/39263/untitled-19.png&width=150&height=50&constrain=true

This resizes the image to a width of max 150px, height of max 50px, while preserving the aspect ratio.

Happy resizing!

by Njål

Upgrading Umbraco from 4.5.1 to 4.5.2

Umbraco is a Content Management System (CMS) developed in Microsoft .NET.

Some of its advantages is that it offers full design freedom, it’s free to use, and perhaps most importantly – you can write your own user controls using the allmighty .NET Framework. A disadvantage with Umbraco (and a lof of other open-source solutions) is the hassle with upgrading to newer versions.


When attempting to upgrade a Umbraco 4.5.1 to 4.5.2 I followed this generic upgrade guide – which basically told me to overwrite some files and folder.The first thing I did was to do a full backup of the site (files + MS SQL database). Then, I copied the files, and opened the site in my browser.


A upgrade page was displayed – so far so good. I finished the different steps in the guide – it told me the upgrade had gone perfect!I tried to enter the site again to make sure the content was being displayed ok. But I was redirected to the Upgrade page again…where I tried to log in..



Problem: Admin can not log in after upgrading Umbraco
Possible Cause:  Earlier versions of Umbraco handled password in clear text, current version uses hashing.
Possible Solution: Open web.config file – remove the passwordFormat=”Hashed”

<add name=”UsersMembershipProvider” type=”umbraco.providers.UsersMembershipProvider” enablePasswordRetrieval=”false” enablePasswordReset=”false” requiresQuestionAndAnswer=”false” passwordFormat=”Hashed” />

Problem: Site is not displayed at all after upgrade
Possible Cause:  Upgrade bug?
Possible Solution: Log into Admin and republish entire site




Problem: XSLT is not working at all/behaving weird after upgrade
Possible Cause:  New XSLT Schema! Data elements with Alias Attributes are no longer used!
Possible Solution 1: Set <UseLegacyXmlSchema>true</UseLegacyXmlSchema> in config/umbracoSettings.config
Possible Solution 2 (better): Replace XSLT code looking like this
$currentPage/descendant-or-self::node[string(data[@alias='umbracoNaviHide']) != '1']
with this
$currentPage/descendant-or-self::*[umbracoNaviHide != '1']

Tip:
If you are unsure what the data(document/node) that you are trying to process with XSLT looks like – then insert this:
<textbox><xsl:copy-of select=”$currentPage”/></textbox>



Problem: Umbraco installation contains different sites (hostnames), but only one of them works after upgrade
Possible Cause:  Wrong setting in config/umbraco.config which got owerwritten during upgrade
Possible Solution: Set <ensureUniqueNaming>True</ensureUniqueNaming> in config/umbracoSettings.config



Thats about it I think – good luck upgrading! 

by Stian

Umbraco – The Friendly CMS?

Umbraco er et open source CMS (content management system) utviklet av dansken Niels Hartvig. Det er basert på Microsofts .NET Framework, Microsoft SQL Server og XSLT, skrevet i C# og har støtter for flere typer databaser og språk,

Umbraco er designet for å være en verktøykasse for bygging av websider og fokuserer på det å integrere allerede eksisterende teknologier i stedet for å introdusere nye! Med støtte for Custom og Web User Controls tillater Umbraco at du kan jobbe akkurat slik du er vant til, med et hvilket som helst .NET språk.

Umbraco Love

En av de fantastiske tingene med Umbraco er hvordan prosjektet ditt allerede er delt inn i forskjellige deler for:

  1. Utvikler
  2. Designer
  3. Webredaktøren


Utvikleren har valget mellom å sitte og jobbe rett i Visual Studio med User Controls og Master Pages eller jobbe med XSLT, JavaScript og templates rett i Admin GUI.

Designeren har en egen fane i dette kontrollpanelet hvor han eller hun kan jobbe med HTML og CSS, enten i ren html kode eller i en visuell editor.

Akkurat denne innedelingen mellom en utvikler og en designer er jo for så vidt ikke noe nytt, den har etter hvert eksistert en stund, selv i Visual Studio. Det geniale kommer først når vi introduserer webredaktøren til det hele. Den menige mannen i gaten som setter kaffen i halsen når han ser en html tag! Det er nemlig slik at når utvikleren har gjort sin jobb, er det stort sett bare pek og klikk for redaktøren som skal vedlikeholde innholdet på websiden. Den enkle måten Umbraco gir oss dette rett ut av boksen er det som gjør produktet verdt å bruke. Det sparer utvikleren mye tid i forhold til å sitte selv og skrive et admin grensesnitt. Dette får du selvfølgelig også med Joomla eller WordPress, men ikke glem at web applikasjonen har du  skrevet i .NET og XSLT.

Vi i Degree har etterhvert utviklet en del websider med Umbraco, inkludert vår egen webside på degree.no. Den første tiden var litt forvirrende og Umbraco kan oppfattes å ha en del begrensninger (spesielt for oss som ikke var så god på XSLT), men når du har blitt bedre kjent med verktøyet ser du at her har du store muligheter og får mye gratis!

Umbraco 4.0.4 som er den siste versjonen i skrivende stund er langt fra perfekt. Det finnes ting som ikke er så logisk lagt opp som det kunne vært, men ut i fra hva jeg har lest har vi mye godt å se frem til i kommende større releases.

Se www.umbraco.org for mer informasjon.

Tags: , ,