Thursday, 1 December 2016

Sitecore Bug - Archiving Specific Version of an Item

A colleague is trying to use the built-in Sitecore functionality to archive a specific version of the item. The way it is done is:

  1. Navigate to a content item and selected an old version of the item
  2. From the Review tab, in the ribbon, Schedule group, select the Archive Version Now menu item from the Archive dropdown.

Now the problem is that Sitecore will always select the latest version and pops up the dialog:


5 is the total number of versions I have but I want to archive version 2, which is the selected version. We have tested this in Sitecore 7.5 and 8.0 Update 3 (not tested on later versions) and they all behave the same.

The issue seems to be related to how the menu item is configured in the core database. So open Sitecore desktop and switch to core database and then in the Content Editor, navigate to the following item: 

/sitecore/content/Applications/Content Editor/Menues/Archive/Archive Version Now

Check the Message field:


The value contains the (id=$Target) parameter so it is always selecting the latest version of the item (that is clicked from content tree).

To fix the issue, just remove (id=$Target) from the field value, save.

Now go back to the master database, find the item and select version 2. Click on the Archive Version Now menu item (Review / Schedule / Archive dropdown) again and ta..la... it says:


Hit OK and the selected version is archived.

If you wish to restore the version, go to Sitecore desktop / All Applications / Archive and choose the desired item to restore.




Monday, 17 October 2016

Possible temporary solution for Windows 10 freezing after short idle

I actually cannot remember when this happened but my Windows 10 starts to freeze after I just left the computer for a very short time, probably less than 2 or 3 minutes.

Initially I thought it is my SSD where the windows is installed that has issue but sooner I noticed that as long as I keep using the computer then it does not freeze.

There are discussions, for example:

http://www.theregister.co.uk/2016/08/16/windows_10_anniversary_update_ssd_freeze/
http://www.pcworld.com/article/3107273/windows/windows-10-anniversary-update-freezing-on-you-microsofts-looking-into-it.html

More reading reveals that this could only happen to users that are booting Windows from a SSD drive (still unsure) which is my case.

And a representative from Microsoft suggested the following:
http://answers.microsoft.com/en-us/windows/forum/windows_10-performance/windows-10-may-freeze-after-installing-the/5a60d75d-120a-4502-873c-8bfec65c82d0?page=1&auth=1

To me they looks too complex and I like simple stuff so below is my temporary solution until Microsoft have a fix for it.

Copy the following code and save it in a batch file (e.g. anti-freeze.bat) on the booting SSD drive and when you think you are going to leave the computer for a while, just double click to bat file to preventing Windows from freezing.

@echo off

if "%1"=="done" goto start
start "" /min %0 done
exit

:start
cls
echo Press Ctrl + C to quit...

cmd /c start notepad
timeout /T 5 /NOBREAK
taskkill /F /IM notepad.exe
timeout /T 5 /NOBREAK

goto start

What this does is it fires a windows command prompt, make itself minimized and then open/close notepad every 5 seconds. This works for me and I have left my PC on for the whole night and it is still alive.

Let me know if it works for you too! Have a nice day.