Visit I.T. Montreal's homepage by clicking here..

Drupal : Path Error

March 9th, 2010

During training at work, I came across Joomla and Drupal. Both of these are content management systems which you can get free online. These are excellent tools for you to use if you are not a web guru. Joomla and Drupal make it easy to create a websites for everyone. It is just a matter of getting used to it and playing around with it, in order to understand its many functions. For my first adventure with a CMS I chose Drupal. The installation instructions given on the drupal website are pretty easy. You just have to download the zip folder, unzip it and then upload the folder onto your local server. If you’re local server is up and running and you have installed Drupal then type in your browser’s URL: localhost/install.php You should get a Drupal installation screen.This means that everything was installed properly but there are still more configurations to be done.

Otherwise if you are using wampserver 2.0 version, this comes with PHP version 5.3.0, this will not work with Drupal . The necessary version for you to download and install on your wampserver 2.0 is PHP 5.2.9 or any other PHP5.2.X. After you have installed the correct version of PHP to use, make sure that you change the version being used. This is done as follows:

1. Click on your wampserver icon

2. Click on PHP

3. Click on Version and Select the one you’ve just installed, in my case it was 5.2.9

This should make your wampserver and drupal work together.

After this, go back to your browser and type in your URL: localhost/install.php. In this page you will be asked to choose your language of preference and then it will verify if the all necessary requirement to run Drupal are properly made. This is where I got the following error:

Requirements problem


The following error must be resolved before you can continue the installation process: The Drupal installer requires that you create a settings file as part of the installation process.

Copy the ./sites/default/default.settings.php file to ./sites/default/file/settings.php. Changes file permissions so that it is writable by the web server. If you are unsure how to grant file permissions, please consult the on-line handbook. More details about installing Drupal are available in INSTALL.txt.

So I did as instructed, the problem with this is that it is the file that has to be copied, is being set at the wrong path of the settings file. The error must say copy ./sites/default/default.settings.php to ./sites/default/settings.php and had to make sure that i had changed the permissions of the files. Et voila! This should make your requirements problem disappear.

_______________________________________________________

http://www.itmontreal.ca

Drupal 6.12 and 5.18 released

June 5th, 2009

On May 13th Drupal announced a “maintanance release” for both it’s main branches. The latest releases are Drupal 6.12 and 5.18 . Although , there are no new features in these maintenance releases upgrade to these versions is highly recommended given it contains a security fix , SA-CORE-2009-006 - Drupal core - Cross site scripting , and and multiple bug fixes.

For a complete list of all the bug fixes of on the 6.12 version please visit :

http://drupal.org/project/cvs/3060/?branch=DRUPAL-6

The complete article could be found on:  http://drupal.org/drupal-6.12

Load Testing a Website

April 23rd, 2009

When we are building a complex site such as a social networking site often we would like to know how many consecutive users the system we have built can support. What we mean to say by “support” is basically the amount of time it takes for server to respond to a requested page reasonably fast manner. The wait time is usually indicated in milliseconds (1 second = 1000 milliseconds) . The tolerance of every web user is different. But clearly in the world of high speed internet we we would like to know that when we click on a link we get a response from the site at least within the first 1000 ms. Waiting more than 1000 ms ’s without seeing anything on the screen usually pushes people to try to either refresh their screen or worst to leave your site.

Load testing is usually done before going live in order to get prepared for a scenario where many people try to make queries on your site at the same time. The findings of the load testing could indicate that one needs to use some advanced mechanisms to improve their site performance (i.e.  caching, database pooling, compression,etc.)

Here are the most common ways to do load testing:

Apache AB tool is perhaps the easiest tool to get some useful metrics .

Here is an example:  ab -n 100 -c 30 http://www.yourtesturl.com/projects.php

JMETER is a java based tool that you could use to do really complex tests. It has the capability to show you a graph of the results.

Online Testing Tools: In our tests the most useful free tool we have found  online was “Load Impact

Another site that we thought was really impresive and promising was

Browser Mobster” using this tool one can record a test scenario using

Selenium“  run this scenario consequently on many different computers/browsers

to provide you with a realistic report.

Batching Mechanism (Connection Pooling)

April 21st, 2009

What we do with applications we develop is use a batching mechanism to delay DB operations as far as possible. This permits queries to be accumulated from different software components during the processing of an HTTP request.  As late as possible, a batch containing all these queries is sent to the DB server.

Each set of results is then passed to the appropriate handler.  It’s a more asynchronous style of programming than typically done in PHP, but it makes for very efficient use of DB servers (which helps a great deal as the number of web servers using a single DB server increases).

So for example, consider a very basic set of operations required to
handle an HTTP request:

A Authenticate/authorize
B Make some DB change
C Retrieve information from the DB for the next page

Each of these is broken into two parts:

1 Do setup and generate query
2 Accept and use results from query execution

The typical sequential approach to coding this would result in execution
order:

A1 A2 B1 B2 C1 C2

DB queries execute between each 1 and 2.  Assuming no connection caching, this is most inefficient.  With connection caching, it is less bad.  But with a batched approach, the order of execution would be:

A1 B1 C1 A2 B2 C2

with the only DB communication occurring between C1 and A2.

Here are some commonly used Connection Pooling solutions:

  • SQL Relay is a persistent database connection pooling, proxying and load balancing system for Unix and Linux.
  • Apache DBD API : the mod_dbd module
  • memcached is a high-performance, distributed memory object caching system, intended for use in speeding up dynamic web applications by alleviating database load.

Make your HTML Pages Process PHP code

April 21st, 2009

Here is an easy trick to make your website, apache server, process the PHP code inside an HTML page

Create a file called .htaccess in your website’s root directory ,if it doesn’t already exist , and enter the following entry (for php5)

# Use PHP5 as default
AddHandler application/x-httpd-php5 .php

Administration of *nix based systems is not an easy task it requires one to spend significant amount of time and knowledge.We can help! Please visit http://www.itmontreal.ca/contactus.php and fill out the “contact us” form to benefit from our professional, paid services.

Drupal Blocks for a Multilingual Site

April 21st, 2009

We sometimes use “Drupal Blocks” to create a multilingual site. The logic is straight forward for every content type in question create a block element . For example for the content type news_english you will need to create a block element called news_english. Once you have created such a block element you will also need to create a logic inside the theme file for that specific block. For example if the block news_english is under block Top Left . You might have a file in your theme such as block-leftTop.tpl.php

And you can put such a code inside this file to only show a specific language of a given block

if ($language == ‘english’ && $block->subject == ‘NEWS’) { ?>
<div class=”wrapLeft” id=”news”>
<h2 class=”heading2 hide”><?php print $block->subject;?></h2>
<div class=”box” id=”video”>
<?php print $block->content; ?>
</div>
<div class=”spacer”></div>
</div>
<?php
}
?>

Programming for Drupal is not an easy task it requires one to spend significant amount of time to learn the Drupal API and how everything falls in to its perspective.We can help! Please visit www.itmontreal.ca/cms.php and fill out the “contact us” form to benefit from our professional, paid services.

Worpress

April 20th, 2009

I have recently installed “Word Press” as our blog and I must admit that I am truly impressed by its capabilities.

Installation literaly took me 2 minutes. The setup assistant simply asked me the database name, user name and password and configured everything for me with no hassle.

“Word press” comes packaged with everything you may need to create your basic blog. A nice theme , a super easy to understand GUI, a fancy WYSIWYG , auto save deature, being able to easily set up categories, a spam detector, RSS, and many many more features..

Possibilities are just endless. One could easily get lost in the large pool of wordpress features. All extremely well thought and very user friendly. For example I wanted slightly  change the theme for my needs and all I had to do was click on the design tab on the top and it gave me access to “Theme Editor” I thought that this was just fascinating. And really easy to understand. I simply love using Word press. Everything is just the  way I would have wanted it to be.

What is even more there is a huge community that supports this amazing open source project. And there are many and many plugins to help you do many fancy tricks.

If you need help with theming wordpress or creating a custom tailored software you can always count on us. Please dont hesitate to contact us via our contact us form at http://www.itmontreal.ca/contactus.php

Drupal Nodewords Module

April 20th, 2009

Drupal “Nodewords” Module simply makes it possible for you to insert meta tags (description and keywords) into the pages, or nodes in Drupal terminology, created by Drupal. This useful module which will surely help with your search engine rankings is available both for Drupal 5 and Drupal 6. And could be downloaded from http://drupal.org/project/nodewords

 

Need to install this Drupal module but you don’t know how? Perhaps, you don’t have the necessary time to figure it out. Let our experts take care of it for you. Click here to learn more or to contact us..

Google Webmaster Tools

April 20th, 2009

“Google Webmaster Tools” is a useful tool for all webmasters out there. Using this tool we are able to see the error messages returned by the googlebot, the key words that are detected automatically , words people type on google to get to your websites and much more … Also , it is “the” place to go if you would like to submit your sitemap to google .

If you don’t have an account or to sign-in please goto:

www.google.com/webmasters/tools/

Once you sign in the first thing you see is an empty “dashboard”You can add any websites you like here but you won’t be able to view details of the site until you verify that the site is managed by you. Google web master tools offer 2 ways to verify your website. You can either copy paste a js code that Google webmaster tools provide you  on index page or create an empty file in your root directory that has a unique name for all your sites.

After the verification you can easily submit your sitemap and view useful statistics. Please note that it might take a day or 2 before you see any of the statistics about your site on “Google Web Master Tools” But, it is well worth the wait ..

SEO is not an easy task it requires one to spend significant amount of time to improve rankings.We can help! Please visit www.itmontreal.ca/seo.php and fill out the “contact us” form to benefit from our professional, paid services.

Drupal template.php

April 19th, 2009

Drupal has a library of functions that could be used by programmers. Although these functions are generally very well written the end result might not look exactly like you would like to see. Template.php file is used to override these functions.

Here is an example: drupal has a function called pager. However the pager by default displays first,next,previous,next . Let’s say you have a multilingual site that requires you to change these to <<,>,<,>> .  You could add the following code to template.php to override the default Drupal implementation. Please don’t forget to modify “yourthemename” with the name of the theme that you are using. And clear your Drupal cache to see the result.

function yourthemename_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9) {
global $pager_page_array, $pager_total;

// Calculate various markers within this pager piece:
// Middle is used to “center” pages around the current page.
$pager_middle = ceil($quantity / 2);
// current is the page we are currently paged to
$pager_current = $pager_page_array[$element] + 1;
// first is the first page listed by this pager piece (re quantity)
$pager_first = $pager_current - $pager_middle + 1;
// last is the last page listed by this pager piece (re quantity)
$pager_last = $pager_current + $quantity - $pager_middle;
// max is the maximum page number
$pager_max = $pager_total[$element];
// End of marker calculations.

// Prepare for generation loop.
$i = $pager_first;
if ($pager_last > $pager_max) {
// Adjust “center” if at end of query.
$i = $i + ($pager_max - $pager_last);
$pager_last = $pager_max;
}
if ($i <= 0) {
// Adjust “center” if at start of query.
$pager_last = $pager_last + (1 - $i);
$i = 1;
}
// End of generation loop preparation.

//$li_first = theme(’pager_first’, (isset($tags[0]) ? $tags[0] : t(’« first’)), $limit, $element, $parameters);
$li_first = theme(’pager_first’, ($tags[0] ? $tags[0] : t(’ << ‘)), $limit, $element, $parameters);
//$li_previous = theme(’pager_previous’, (isset($tags[1]) ? $tags[1] : t(’‹ previous’)), $limit, $element, 1, $parameters);
$li_previous = theme(’pager_previous’, ($tags[1] ? $tags[1] : t(’ < ‘)), $limit, $element, 1, $parameters);
//$li_next = theme(’pager_next’, (isset($tags[3]) ? $tags[3] : t(’next ›’)), $limit, $element, 1, $parameters);
$li_next = theme(’pager_next’, ($tags[3] ? $tags[3] : t(’ > ‘)), $limit, $element, 1, $parameters);
//$li_last = theme(’pager_last’, (isset($tags[4]) ? $tags[4] : t(’last »’)), $limit, $element, $parameters);
$li_last = theme(’pager_last’, ($tags[4] ? $tags[4] : t(’ >> ‘)), $limit, $element, $parameters);

if ($pager_total[$element] > 1) {
if ($li_first) {
$items[] = array(
‘class’ => ‘pager-first’,
‘data’ => $li_first,
);
}
if ($li_previous) {
$items[] = array(
‘class’ => ‘pager-previous’,
‘data’ => $li_previous,
);
}

// When there is more than one page, create the pager list.
if ($i != $pager_max) {
if ($i > 1) {
$items[] = array(
‘class’ => ‘pager-ellipsis’,
‘data’ => ‘…’,
);
}
// Now generate the actual pager piece.
for (; $i <= $pager_last && $i <= $pager_max; $i++) {
if ($i < $pager_current) {
$items[] = array(
‘class’ => ‘pager-item’,
‘data’ => theme(’pager_previous’, $i, $limit, $element, ($pager_current - $i), $parameters),
);
}
if ($i == $pager_current) {
$items[] = array(
‘class’ => ‘pager-current’,
‘data’ => $i,
);
}
if ($i > $pager_current) {
$items[] = array(
‘class’ => ‘pager-item’,
‘data’ => theme(’pager_next’, $i, $limit, $element, ($i - $pager_current), $parameters),
);
}
}
if ($i < $pager_max) {
$items[] = array(
‘class’ => ‘pager-ellipsis’,
‘data’ => ‘…’,
);
}
}
// End generation.
if ($li_next) {
$items[] = array(
‘class’ => ‘pager-next’,
‘data’ => $li_next,
);
}
if ($li_last) {
$items[] = array(
‘class’ => ‘pager-last’,
‘data’ => $li_last,
);
}
return theme(’item_list’, $items, NULL, ‘ul’, array(’class’ => ‘pager’));
}
}

Programming for Drupal is not an easy task it requires one to spend significant amount of time to learn the Drupal API and how everything falls in to its perspective.We can help! Please visit www.itmontreal.ca/cms.php and fill out the “contact us” form to benefit from our professional, paid services.