Wednesday, 9 March 2011

Manual Umbraco Setup

Setup Umbraco Development Environment

Technologies used:

· Visual Studio 2010

· IIS7 (using hosts file)

· Tortoise-SVN

· Windows 7

· Umbraco 4.6.1

· SQL Server 2008 (management studio)

· .NET 4.0

Get Umbraco

1. Download the version of Umbraco you want from http://umbraco.codeplex.com/releases/view/59502

2. Create an Umbraco folder on your computer where you will extract the files to e.g. C:\Development\Umbraco\4.6.1.

3. Copy the downloaded file to C:\Development\Umbraco\4.6.1 and once there right click on the zip file and select Properties. Under the General tab click Unblock and then Ok.

4. Unzip the files here. They will be extracted into sub-folders but you need to copy the actual files under the build folder into C:\Development\Umbraco\4.6.1.

5. Delete the sub folders generated by un-zipping.

6. Add NetworkService user to C:\Development folder with full permissions.
























Hosts file

7. Click the orb in Windows 7 and type %SystemRoot%\system32\drivers\etc\ into the search textbox and open the folder.

8. Locate the hosts file. This file must not have a extension. Open this file.

9. Add a new entry with the IP 127.0.0.1 (localhost) and space and then your site name e.g. fuelcelltoday.local.

10. Save the file.

11. Click the orb in Windows 7 and type cmd. Once the command line window has opened type ping fuelcelltoday.local and hit enter. If you get a reply then you site is setup correctly.










SQL Server 2008 setup

12. Open SQL Server 2008 Management Studio.

13. Add a new database called e.g. FuelCellToday. This is the database Umbraco will use.

14. Add a new login e.g. fuelcelltoday/password

15. Add a new user e.g. fuelcelltoday/password

IIS7 setup

16. Open IIS7 and right click on Sites then select Add Web Site.

17. Add the site name e.g. FuelCellToday.

18. Point the physical path to C:\Development\Umbraco\4.6.1.

19. Add the host name you chose e.g. fuelcelltoday.local

20. Click Ok.

21. Click on the Application Pools. Right click the application pool created for your site e.g. FuelCellToday and select Advanced Settings.

22. Change the .NET Framework Version to v4.0.

23. Make sure Managed Pipeline Mode is set to Integrated.

24. Set the Identity to NetworkService.

25. Set Load User Profile to False.

26. Click Ok.

Install Umbraco

27. In your browser open the new IIS site URL e.g. http://fuelcelltoday.local.

28. Walk through the Umbraco setup and make sure you select the database we created above. You will also be able to create an admin Umbraco user login during this process. It’s very simple step-by-step process. Once this is done the Umbraco tables will be installed to the database.

29. Test you can login into the Umbraco admin section e.g. http://fuelcelltoday.local/umbraco/umbraco.aspx

30. Test you can see the Umbraco default screen e.g. http://fuelcelltoday.local.

Create SVN repository using Tortoise-SVN

31. In your SVN provider create a new repository e.g. FuelCellToday. Copy the URL created.

32. Create a new folder where the web application will live e.g. C:\Development\Websites.

33. With Tortoise-SVN Checkout the SVN repository here so a new folder is created link to SVN e.g. C:\Development\Websites\FuelCellToday.

Setup Visual Studio 2010 solution

34. Open Visual Studio 2010 and create a new ASP.NET Empty Web Application project. I keep the solution file in the root so I uncheck Create directory for solution option. It’s up to you. Select the folder location you wish to create your project e.g. C:\Development\Websites\FuelCellToday.

35. Copy all the files and folders from the Umbraco folder e.g. C:\Development\Umbraco\4.6.1 to this new website folder. Overwrite any of the files generated by the application with the files from Umbraco folder.

36. In Visual Studio click the Show all files icon in the solution explorer and then Include all the folders and files you just copied into the solution. This might take a while.

37. Build the solution to make sure everything is in order.

Add files to source control using Tortoise-SVN

38. The following files/folders must be ignored. This is so we can easily copy newer versions of Umbraco to this folder and not files that aren’t needed to be under source control:

a. App-Code

b. App-Data

c. bin

d. data

e. install

f. obj

g. python

h. umbraco

i. umbraco_client

j. *.user

k. *.sln

l. *.suo

39. Commit the folder using Tortoise-SVN.

40. Build the solution.

41. Point IIS physical folder to the new website folder e.g. C:\Development\Websites\FuelCellToday.

42. Check the site URLS work e.g. http://fuelcelltoday.local.

New developers

43. Create a checkout folder and download the SVN code e.g. C:\Dev1\Webistes\FuelCellToday.

44. Download Umbraco and unzip files, then copy them into the website folder.

45. Open Visual Studio 2010 and select Open Web Site and select the new folder e.g. C:\Dev1\Webistes\FuelCellToday.

46. Setup IIS as explained above to point to the new folder.

47. Open the site URL.

Sunday, 16 May 2010

Umbraco bug with deleting data types

In Umbraco v4.0.3 I needed to delete a data type I created. Once the data type had been deleted I tried modifying the document type which had a property using the deleted data type, and an error occurred:

Node node exists with id '1609'.

After a lot of searching it seems Umbraco did not delete a record in cmsPropertyType with the dataTypeId = 1609 - the data type I deleted. After deleting this record I could modify the document type without getting an error.

Tuesday, 12 January 2010

VSS Batch File Apply Patched Files

Below is an example of how I get a base version of my files in VSS and then apply (overwrite) any other files that are in the patch for that version.

My batch file takes 3 arguments:
1. SSDIR
2. Base label
3. Patch label

Here is an example of calling the batch file GetPatch.bat:

"C:\Documents and Settings\shane\Desktop\GetPatch.bat" \\myVSS\Sourcesafe "v0.0.1" "v0.0.1 Patch 4"

Note your label must start with a leter i.e. v0.0.1 in order for the version to be picked up.

Another thing to note is you must go into VSS and click on Tools > Options and then tick the option "Act on projects recursively".

GetPatch.bat
------------

@ECHO OFF
CLS
ECHO Arguments
ECHO =========
ECHO.
ECHO 1. SSIDR: %~1
ECHO 2. Base label: %~2
ECHO 2. Patch label: %~3
ECHO.

IF "%~1"=="" GOTO ArgumentInvalid
IF "%~2"=="" GOTO ArgumentInvalid
IF "%~3"=="" GOTO ArgumentInvalid

SET SSDIR=%~1
ECHO Getting base files for label "%~2". Please be patient this will take a few minutes.
"C:\Program Files\Microsoft Visual SourceSafe\SS.exe" GET $/VSSProject/Project1/*.* -GF -VL"%~2"
ECHO Getting patch files for label "%~3". Please be patient this will take a few minutes.
"C:\Program Files\Microsoft Visual SourceSafe\SS.exe" GET $/VSSProject/Project1/*.* -GF -VL"%~3"

ECHO.
ECHO Done
GOTO Exit

:ArgumentInvalid
ECHO Missing arguments. Not able to continue.

:Exit
ECHO.
PAUSE

Thursday, 3 December 2009

Example: Use a cursor to fetch records and update individual records

-- Only add the new column if it doesn't exist.
IF NOT EXISTS (
SELECT Object_ID FROM sys.columns
WHERE Name = N'DateTimeStamp' and Object_ID = Object_ID(N'dbo.tblLog')
)
BEGIN
-- Add a new column to store a proper datetime value.
ALTER TABLE dbo.tblLog
ADD DateTimeStamp DATETIME

-- Get the char dates for conversion into proper datetime objects.
DECLARE DateList CURSOR FOR
SELECT date, hour FROM dbo.tblLog FOR UPDATE OF DateTimeStamp

-- Loop variables
DECLARE @Date CHAR(20)
DECLARE @Hour INT

-- Loop thorugh and update the new column with the current row date string as a proper datetime.
OPEN DateList
FETCH NEXT FROM DateList
INTO @Date, @Hour
WHILE @@FETCH_STATUS = 0
BEGIN
UPDATE dbo.tblLog
SET DateTimeStamp = CONVERT(DATETIME, SUBSTRING(@Date, 7, 4) +
'-' + SUBSTRING(@Date, 4, 2) + '-' + SUBSTRING(@Date, 0, 3) +
' ' + CONVERT (CHAR(2), @Hour) + ':00:00')
WHERE CURRENT OF DateList

FETCH NEXT FROM DateList INTO @Date, @Hour
END

-- Clean up.
CLOSE DateList
DEALLOCATE DateList
END

SELECT * FROM dbo.tblLog

Tuesday, 17 November 2009

Generic method to get control from LoginView

private T GetLoginViewControl(string name) where T : Control
{
return LoginView1.FindControl(name) as T;
}

Sunday, 8 November 2009

Dual monitors not working for new install of Windows 7 on Dell M2300 laptop

I recently did a brand new install of Windows 7 Professional on my Dell Precision M2300 laptop. When I connected my monitor or TV to the laptop it was not picked up by 7.

The solution was to go onto Dell.co.uk and download the Nvidia Quadro FX 360 for Vista 32bit not Windows 7 as it is not supported.

Thursday, 5 November 2009

Browser CSS Overrides

The following is a quick reference on how to override CSS styles in different browsers.

#body
{
margin:10px; /* All browsers */
}
#body
{
margin:10px;
*margin:5px; /* IE6 Override */
}
#body, x:moz-any-link
{
margin:4px; /* Only Firefox */
}

This link is very useful: CSS Hacks