Drupal and LAMP for the Windows Developer

January 21, 2009

A friend of mine has started his own company which specialises in recruitment campaign management and advert trafficking.  He asked me to build him a corporate website. Ordinarily when I create websites I use my tried and trusted .NET and SQL technologies however I was conscious that the cost of running a .NET solution for a small start-up would be excessive when open source technologies are comparatively cheap. Also, as I try to have a life outside of coding, I didn’t want to spend my evenings supporting his website. Ideally I wanted to use a Content Management System (CMS) that, after I configured it, could be maintained by a non-coder. So the requirements were: 

1) Cheap to run
2) Easy to manage
3) zero code to write
4) Content Managed

After a bit of digging around the internet for reviews of CMSs I had a shortlist of Joomla and Drupal. As far as I can tell there is much of a muchness between them with regard to managing content of a simple site. I think Joomla is easier on the get go as Drupal can be a bit overwhelming at first. In the end I chose Drupal for no other reason then a friend of mine is working with them at the moment and there are a lot of free custom modules. These CMSs are free. Free!

The only trouble for me was they used technologies I have zero exposure too – the LAMP stack (Linux, Apache, MySql, PHP). For the past 8 years I have used nothing but the WISA stack (Windows, IIS, SQL Server, ASP or ASP.NET). Broadening my exposure to other technologies other than Microsoft has been something I’ve been meaning to do of late. Open source technologies have been gaining ground for sometime now and are ‘almost’ a viable solution for the average company.

So with a mug of tea in my hand I bravely set out to get to grips with this open source malarkey. The first thing to do was to get a WAMP (Windows, Apache, MySql, PHP) stack on my PC. The best way to do this is to install xampp. XAMPP is a preconfigured WAMP stack for development purposes. It was straight forward to install. It did complain about port 443 being in use which I found out was Skype had got hold of it first. Rather than solving this problem I just kill Skype whenever I need to use XAMPP. As there is nothing to register or install for XAMPP then there is nothing stopping you from copying all the files onto a USB stick for your own portable development environment. Ideal for WAMPing during your lunch break. Very nice.So I now had my stack configured ready to install Drupal. This didn’t prove to be an issue. I would say though for all of the above you must read and re-read all the installation instructions. The instructions are easy enough to follow but for a newbie like myself it can feel a bit alien. Make sure you are happy with MS-DOS as you don’t get your nice Windows dialogs for configuration settings. There’s a bit of hacking about with config files

Getting Drupal to look and function as you want takes a bit of time to get used to. The paradigms are similar regardless of what technology you use so most of the time its just working out what Drupal calls something that you may call something else.

As for hosting, after reading some good reviews about Clook on the Drupal forums I decided to use them to host the CMS. They were (as of writing) £5 a month or £50 for the year for the basic package which included the LAMP stack. Also as part of the control panel there is a one click deployment of Drupal (and Joomla and other CMSs). I was very dubious of how ‘one-click’ it would really be. In the end it was quite remarkable – it creates and sets up the MySql database and then installs Drupal into it. Web Hosting is really getting quite sophisticated these days.

I haven’t needed to use any MySql or php coding yet and I don’t think I’ll need to. There are plenty of free custom modules for Drupal which will do everything you need and if they don’t then you are probably doing something wrong – or very customized.

So to sum up a very successful project. It took me less then 20 hours to learn enough about LAMP/WAMP and Drupal in order to set up a simple working content managed website which we can build upon in a structured way.

Advertisements

Error trying to deploy a feature to SharePoint

December 1, 2008

Using VS2005 to deploy a solution that I have been been working on previously without issues.  One day it decided to play silly buggers.

“This solution contains two assemblies with the same name, or the SharePoint server already has an assembly with the specified name”

I went into the GAC and deleted all the assemblies related to my deployment.  Deployment still errored but with another error (assuming this is progress).

“The solution can not be deployed.  Directory associated with feature XXX in the solution is used by feature YYY installed in the farm. All features must have unique directories to avoid overwriting files”

I deleted my feature from \12\template\FEATURES and tried again (another error, but different this time).

“The feature name XXX already exists in SharePoint. You need to rename the feature before solution deployment can succeed”

To fix this you need to completely remove the feature from SharePoint.

go to the administration SharePoint site > Operations > Solution Managagement.  Then retract AND THEN uninstall the feature from the same screen.

Deploying then worked.  Unsure as to why this started to misbehave and if it happens again I’m just going to uninstall the feature straight away and try again.


programmatically add a My Link.

November 7, 2008

This is how you add a My Link (aka QuickLink) in code.

Add a Reference to Microsoft.Office.Server

Import/using
Microsoft.Office.Server
Microsoft.Office.Server.UserProfiles 

Dim context As ServerContext = ServerContext.Current
Dim profilmanager As UserProfileManager = New UserProfileManager(context)
Dim profile As UserProfile = profilmanager.GetUserProfile(SPContext.Current.Web.CurrentUser.LoginName)
Dim qlmanager As QuickLinkManager = New QuickLinkManager(profile)
Dim ql As QuickLink = qlmanager.Create(pTitle, pUrl, pQuickLinkGroupType, pGroup, pPrivacy)


Get SPItems for a SPFolder

September 3, 2008

I have SPItems in a various sub folders in a custom list.  I have the subfolder however there didn’t seem to be any easy way of getting the SPList items for this folder.  The best/only way I’ve found to do this is by using a SPQuery as demonstrated at winsmarts.com.

Dim query As New SPQuery
query.Folder = mySubFolder
Dim list As SPList = SPContext.Current.Web.Lists(mySubFolder.ParentListId)
Dim items As  SPListItemCollection = list.GetItems(query)


Style Library – Where is it?

August 8, 2008
Took me ages to find this – feel like I’m floundering!
Site Actions > Site Settings > Content and Structure
 

SharePoint Styles

August 2, 2008
A great series of articles explaining how to style SharePoint from http://www.cleverworkarounds.com which in itself looks like a useful place for all things SharePointy.
 
 
Remember to visit the other parts of the article. 
 
Turns out that getting the CSS heirarchy right is a bit of a pain as you have little control over the position of CORE.CSS which will always gets rendered last so blows all your custom styling out of the water.  So have soldiered on with the proposed solution in Part 3.  Essentially using:

<
SharePoint:CssLink runat=”server”/>
<SharePoint:CssRegistration name=”<%$SPUrl:~sitecollection/Style Library/zzzGlobalMaster.css%> runat=”server”/>
 
Where zzzGlobalMaster.css is my firm’s generic web styling.  I’ve created a custom masterpage which makes us of the styles in this css.  Note:  This is using my own styles classes, I am not overwriting anything in CORE.CSS at this time. Then using the ‘master page settings’ inside SharePoint to specify another CSS stylesheet that handles specific styling for the particular site (which will include CORE.CSS overrides).

Activating ‘Server Publishing Infrastructure’ – Access denied

August 1, 2008
Change the AppPool the virtual directory runs under to ‘SharePoint Central Administration’. Good tip from blog.thekid.me.uk who has some other useful blog postings too.