Thursday, 28 April 2011

Scripting Support in the .Net Applications

I was reviewing integrating Scripting Support into .Net Applications. In the current .Net Frameworks from version 1.0 to 4.0 Microsoft provided the following namespaces for enabling Scripting support.

  • Microsoft.JScript
  • MSScriptControl
  • Microsoft.VisualBasic.Vsa (obsolete)
  • Microsoft.Vsa (obsolete)

The last two Microsoft.VisualBasic.Vsa and Microsoft.Vsa are now obsolete as Microsoft is stopping their support for VB6.

In Visual Studio 2010 Microsoft extended their support for JScripts by adding debugging capability and making developer’s work easier.

MSScriptControl is an ActivX Windows Scripting Control can be used to handle VBScripts and JScripts by specifying ScriptControl.Language property as “VBScript" or “JScript”. For more information on the .Net Scripting Support follow references below.

References

JScript on MSDN
Windows Scripting
Script Happens .NET

Sunday, 17 April 2011

Install Joomla! 1.6 on IIS 7

In the previous post Joomla! Installing XAMPP on Vista I described installation of the XAMPP package for Windows 7 and Vista. XAMPP package installs Apache web server, MySQL database, phpMyAdmin, FileZilla FTP Server and many more. With XAMPP it is really easy to install and configure Joomla!.

In this post I will show how to install Joomla! 1.6 on IIS7 on Vista or Windows 7.  I will be performing installation on Windows 7 with no IIS installed. We will install PHP support for IIS 7, MySQL database (I will not be covering installation of Joomla! with SQL Server just yet), phpMyAdmin for maintaining databases.

In my first attempts. I tried to install Joomla! using Windows Platform installer from Microsoft/web site, which did not work completely. Installer did not install properly IIS, failed to register PHP with IIS 7, did not configure MySQL and I got mixed up with credentials for Joomla! and MySQL. My decision was to start over and  install all required components manually.

Before we begin

In my explanations of the steps below I will assume that you are familiar with installation of basic windows components. I will only note most important points of the installation. If you require detailed explanation of the some of the installs I will provide reference section with links to sites with more detailed steps.

Install IIS 7

In this step we will perform basic installation of IIS 7. Open Control Panel>Programs>Program and Features>Turn Windows Features on or off.

image

Navigate to Internet Information Services and make sure you tick it first. It will select all required modules to run IIS7. Then expand tree to navigate to Application Development Features and tick CGI. I will be also doing ASP.NET development so I ticked ASP.NET Development and this also selected .Net Extensibility and other required modules. If you do not need any of the .Net features, don’t tick it. CGI component is needed to use FastCGI module of the PHP package, which we will be installing in the step below. Click OK.

image

When installation is complete open http://localhost to see if it installed OK. You should see similar screen to one below.

image

Installing PHP support for IIS7

Now we are going to install PHP support for IIS 7. Download latest PHP windows package from php.net site.

image

Now follow installation Wizard steps.

image

In the Web Server Setup select IIS FastCGI module. Click Next.

image

I selected to install all items including Register *.php to open automatically with PHP.

image

Click Finish.

I would also suggest installing PHP Manager for IIS package. It will add PHP configuration module into IIS Console.

image

This is an example PHP configuration screen. I find it is handy when you need to do some tweaks to PHP configuration.

image

Copy Joomla! CMS files to ISS 7

In this step we are going to copy Joomla! package files into C:\inetpub\wwwroot folder and create JoomlaDev Web Application to see if we can run PHP web sites. Configuration of Joomla! site will be done after completing of the MySQL database server installation. Download Joomla! CMS package from the joomla.org site. Unzip it and copy folder to ISS7 directory C:\inetpub\wwwroot. I named folder as JoomlaDev. Open IIS Management Console. Right click Default Web Site and select Add Application.

image

Enter fields as shown above if you are using the same names. Click OK.

image

JoomlaDev Application is created. Use Browse to open the site. If everything OK you should see the screen below.

Image[46]

Install MySQL on Windows 7 or Vista

Congratulations if you got that far, but don’t get too excited as we got a little be more work to do. Now we are going to install MySQL server. I am not going to cover using Joomla! with SQL Server here. This can be a topic for future posts. We need to  download, install and configure MySQL database and phpMyAdmin package for managing databases. Get MySQL Community Server from mysql.com site. PhpMyAdmin can be downloaded from phpmyadmin.net site.

image

Run MySQL Installation Wizard.

image

Run through wizard steps and click Install at the end.

image

Leave Launch the MySQL Instance Configuration Wizard tick box on and click Finish.

image

This will open MySQL Server Instance Configuration Wizard.

image

We will go through the Detailed Configuration steps. Click Next.

image

This is a Development Machine, so this option is what we need.

image

Leave as it is on Multifunctional Database and click next.

image

Installation Path as a location for database files will be fine.

image

I do not expect a lot of connection during development work, but I like to have more options at hand so I selected Online Transaction Processing Option. You can select what is more suitable in your case.

image

All looking good. Tick Add firewall exception for this port to enable access for phpMyAdmin. phpMyAdmin uses TCP/IP connection by default. If you are worried about security you can setup phpMyAdmin to use socket connection. It is possible in our case to use socket as we are installing MySQL server on the same machine as IIS 7 web server.

image

I am developing website in English and Russian Languages so the second option is the best one for me. Click Next.

image

We will set our Database Instance Name as MySQL. I like to perform some commands in the command prompt so I also ticked Include Bin Directory in the Windows PATH.

image

Enter a password for root. This is a development database and will not be accessed outside development machine. So I did not ticked Enable root access from remote machine or Create An Anonymous Account. For build and testing servers I will use a different installation of MySQL and IIS 7. Click Next.

image

Excellent! Click Execute when you are ready.

image

We are done! Click Finish.

Install and Configure phpMyAdmin

Installation of MySQL Server is done. Now we are going to configure phpMyAdmin package, which will help us to manage MySQL Databases. If you haven’t downloaded phpMyAdmin from previous step download it from phpmyadmin.net site. Unzip package and copy it to C:\inetpub\wwwroot directory. Open IIS 7 Management Console and create new web application in a similar way how we created web application for our Joomla! install.

image

I named folder and Web Application as phpMyAdmin. After clicking OK use browse to open http://localhost/phpMyAdmin/. You will get the screen below.

image 

Enter root as username and your root password, Click Go.

image

I got in! I was really impressed that without any additional configuration phpMyAdmin detected local MySQL Server and the setup is done!

Conclusion

Congratulations ones more time on the going through this rather lengthy post. Don’t get disappointed that you do not see Joomla! configuration steps here. There are very easy and straightforward. I am planning to post Joomla! configuration steps in the future post. This and the other posts will be part of the Creating Joomla! Development Environment series. Don’t forget to check out some references for more information.

References

Configure Joomla! 1.6 in IIS 7

Recently I published a blog about installing Joomla! 1.6 on IIS 7. We installed PHP support for IIS and MySQL Server on WIndows 7 development machine. In this post I will show how to configure installed Joomla! 1.6 site.

Running Joomla! configuration wizard

If you followed the same naming for directories and site names open http://localhost/JoomlaDev.

Image

You will be presented with Choose Language step. Select your main language and click Next.

image

Configuration wizard performs checking and detected that configuration.php file is not writable. It is good idea to check permissions on the files and directories to avoid hand writing configuration settings. Browse to C:\inetpub\wwwroot directory and open properties of the JoomlaDev folder.

image

Select IIS_IUSRS and click edit. Tick Full Control and Click OK. After that click Check Again on the Joomla! Wizard. Now Wizard should display green Yes. If not, try adding Everyone and allowing Full Control. You can remove this permission once configuration is complete. If you can suggest other options of solving this, please leave a note in the comments. Click Next.

Image(1)

This is a License page. Click Next.

Image(2)

Enter Username as root, your password, Database name. Click Next.

Image(3)

This is a development machine and no remote access is needed. I skiped FTP Configuration. Click Next.

Image(4)

Enter Site name, your e-mail, admin username and password. If you like you can install sample data. Click Next.

Image(5)

In this version of Joomla! configuration Wizard lets you to click a button to remove installation folder automatically. It could be a good idea to rename this folder to keep it handy if you will ever want to run this wizard again. Click Administrator or Site to view configured Joomla! Site.

Image(6)

Congratulation. Joomla! 1.6 is installed and configured. As you can see this was pretty easy and straightforward. In the future posts I will be covering creation of the Development Environments for Joomla! Development.

Friday, 8 April 2011

Free Joomla! Extensions

These who ever worked with Content Management Systems will know about Joomla! CMS. Personally, what I like about Joomla! is availability of the vast number of extensions and templates and many of them are available for free. One of the popular sites where you can find Joomla! extensions is extensions.joomla.org. There are a lots of extensions for all sort of tasks. Here I am listing the ones I am using in my projects, which are tried and tested.

  joomla eXtplorer

extplorer

joomla eXtplorer is a File- and FTP - Manager. It allows you to edit files, delete, copy, rename, archive and unpack files/directories directly on your server. You can - Browse Directories & Files - Edit, Copy, Move and Delete files - Search, Upload and Downloading files - Create new files and directories - Change file permissions (chmod) and much more. I am mainly use this extension for changing file permissions and editing configuration files.

Linkr - The Article Linker and Link Creator

image

This extension lets you quickly link to articles in your Joomla! site when you are creating content. You can either search for your article with the search box, or find it by selecting the section and category. Finally, the link class, title, relation and url are completely customizable, making Linkr the perfect linking extension for Joomla! I like the nice user interface allowing easy article categories browsing and article preview.

Xmap

image

Xmap is a Site map generator component for Joomla, it's based on the popular Joomap component. Xmap allows you to create a map of your site using the structure of your menus. In the Preferences Page under Options there are links to html sitemap page and xml sitemap document which can be submitted to Google webmaster tools.

Commercial Extensions

sh404sef sh404SEF


image

sh404sef is one of the commercial extensions I would highly recommend if you are serious about SEO (Search Engine Optimisation). This extension make it very easy to control page titles and meta tags and automatically converts Joomla links to search engine and human friendly links.  By itself it has a lot of extensions that optimise this component for other Joomla systems like VirtueMart, Xmap, Book or Media libraries. Check these extensions at sh404SEF extensions.

I will be happy for your comments about what extension you use and would recommend to others.

Saturday, 15 January 2011

Creating project code coverage with PartCover and NUnit

Since my last posts ‘Integrating PartCover with Visual Studio 2005’ and ‘Integrating PartCover with Visual Studio 2008’ a lot of things changed and improved. PartCover project got itself a new home and now targeting .Net 4.0 Framework. NUnit testing framework also made a lot of improvements. In this post I am going to show how to run code coverage for a test project with NUnit console runner and PartCover browser. I will base it on my EnvMan project.

Getting PartCover and Nunit to run

First of all you need to download and install PartCover from Github project server. After installation you will find PartCover browser manual and PartCover console manual, which are very useful for understanding of rules creation and PartCover parameters.

Start PartCover Browser.

image

Select File>Run Target. It will open ‘Run Target Settings Window’

image

Click Browse buttons to select nunit-console.exe  and working directory for running NUnit. Working arguments should have “/noshadow” and a full path with the test project name or NUnit project name. “/noshadow” will make NUnit not to create shadow copies of the files and will allow PartCover to load source files in the browser. In EnvMan project I have NUnit project file which has two assemblies in it. In the rules window enter

+[*EnvMan*]*

which means (+) add rule where include any assembly which has EnvMan in its name and any namespace in these assemblies. After this you can click start to run tests. Don’t forget to save xml configuration file for future use.

Inspecting code coverage

Congratulations! You can now inspect the results by using Views>View Coverage Details.

image