Tuesday, September 3, 2013

Tips for upgrading Kentico CMS site from v6 to v7

Recently I upgraded one web site written in Kentico CMS v6 to v7 and would like to share my experience.

Preparation

Due to the some API changes in v7, you might need to change your code a lot if your web site is mainly using ASPX template.
To track your changes, it is better if the changes can be recorded down and can be revert any time if it is needed. This is where
source control comes in place. If you have not apply source control to your web site yet, this is the good opportunity to start
using source control.

Here are the suggestions for using SVN as the source control for this upgrading purpose:

  1. create a new repository
  2. create trunk and branches in the repository
  3. check out the trunk to a local folder
  4. copy all files and folders from your web site folder into trunk folder
  5. add all files and folders and commit to SVN repository
  6. create a branch into branch folder based on the trunk

The idea behind this is to record all changes to the branch during the upgrading. Depends on the complexity of the web site,
the changes you will make to the source code might take few days/weeks, so that I do not recommend that upgrade the
production directly, instead, you should make a copy to your development machine and upgrade this copy first. All the changes
made to the local instance will be committed into the new created branch. When the upgrade is done and has been test,
production then can be upgraded. The upgrade to the production will be as simple as following steps:

  1. copy files from the production server into trunk.
  2. commit all the modifications if there is any.
  3. merge changes from the branch
  4. copy file back to production from the trunk

Upgrade

The database upgrade script might contains changes to the views. But I have found that in Micorsoft SQL 2008 R2, after execution
of the upgrade script, the views might not be synchronized properly. In my case the error was some data conversion failures.
The root cause seemed to be the changes on base views had not propagated properly to other views which were base on the base
views.

If you need to perform the upgrade manually, it requires to delete a lot files and folders before updating files to new version’s.
The instruction has listed the files and folders, but it is very fussy if you go through the list and delete file/folder one by one.
A easier way is to copy the content of the list to a text file, then add “del “ to the beginning of the full name of the file and add
”del /s/q “ to the beginning of the full name of the path, save the text file as a .BAT file, this batch file can delete files and folders
in one go and save you a lot of time.

There is an undocumented change you need to take care if your page uses CMSForm for editing a document in the same way as
the Form tab in the CMS Desk content page, you need to assign DocumentManager.LocalMessagesPlaceHolder to the the CMSForm
element’s MessagesPlaceHolderto property, otherwise, there will be an exception when the form is submitted.

Tuesday, August 20, 2013

My Weapons (Tool set)

  1. 7-Zip.
  2. Adobe Reader
  3. EditPad and Notepad++: Advanced text editor.
  4. Fiddler Web Debugger: http/https traffic inspector.
  5. firstobject XML Editor: Formatting XML and browsing nodes in a tree view.
  6. Google Chrome: HTML/Javascript/CSS inspector/debugger.
  7. IDE:
    1. Delphi:
      components:
      1. CnPack IDE Wizards
      2. madshi’s madCollection
    2. Microsoft Visual Studio
  8. Kentico CMS.
  9. Link Shell Extension: Managing file’s hard link.
  10. Microsoft Network Monitor.
  11. Nullsoft Install System
  12. Paint.Net: Graphic tool.
  13. Pdf995.
  14. soapUI.
  15. Synergy: one set of mouse and keyboard for multiple PC.
  16. TeamViewer
  17. VisualSVN Server, TortoiseSVN and WinMerge
  18. WinDirStat: shows disk usage in colour blocks
  19. Windows Live Writer: Writing blogs.
    Plugins:
    1. Live Writer Code Prettify Plugin

Sunday, July 28, 2013

An easy to use tool for query Oracle database

LINQPad can be used for query Oracle database as well. All you need to do is download IQ Driver for Oracle.
The steps are:
1. Click “Add connection” in the connection tree.
2. Click “View more drivers …” in the “Choose Data Context” dialog
3. Click “Download & Enable Driver” under the “IQ Driver – for MySQL, SQLite, Oracle” section.

In my case, parameters in Advanced tab of IQ Connection need to be populated to be able to connect to Oracle database directly.

Wednesday, July 10, 2013

A way to validate your email address

http://verify-email.org/index.php?option=com_emailverifier&check=bochen.lin@global-health.com&view=emailverifier&layout=verify&format=raw&2f8b80496c78ca0e01ff56a06da6bc8f=1

×

bochen.lin@global-health.com - Result: Ok
MX record about global-health.com exists.
Connection succeeded to mx.global-health.com SMTP.
220 mailhub.ws.com.au ESMTP

> HELO verify-email.org
250 mailhub.ws.com.au

> MAIL FROM: <check@verify-email.org>
=250 ok

> RCPT TO: <bochen.lin@global-health.com>
=250 ok

Wednesday, June 19, 2013

Upgrade Orchard 1.3 site from MVC3 (VS2010) to MVC4 (VS2012)

  1. Uses NuGet Package to install MVC4 into the project
  2. Manually change Rozer and MVC assembly configuration in the Web.Config files from old version to version 2 and 4. Add to Web.Config in each View folder of the project.
    1. <configuration>

      <system.web.webPages.razor>
              <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
              <pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
                  <namespaces>
                      <add namespace="System.Web.Mvc" />
                      <add namespace="System.Web.Mvc.Ajax" />
                      <add namespace="System.Web.Mvc.Html" />
                      <add namespace="System.Web.Routing" />
                      <add namespace="System.Linq"/>
                      <add namespace="System.Collections.Generic"/>
                      <add namespace="Orchard.Mvc.Html"/>
                  </namespaces>
              </pages>
          </system.web.webPages.razor>

      </configuration>

  3. Remove “@” if it is in and “@{}” block.
  4. Replace “jQueryUtils_TimePicker”

Sunday, June 16, 2013

Javascript scope in HTML page which contains iframe

If a HTML page contains a “iframe”, what is the relationship between the javascripts in the two HTML pages in terms of function/variable scope?