Use a taxonomy term to filter a Drupal view

0

Posted by fred | Posted in CMS, Drupal | Posted on 13-02-2012

Tags: ,

1. Go to Views > Contextual filters.
2. Add a taxonomy filter and select parameters as follow:

 

Source: http://drupal.stackexchange.com/questions/9332/drupal-7-views-contextual-filters-taxonomy-name

VN:F [1.9.14_1148]
Rating: 0.0/5 (0 votes cast)

A quick guide to upgrade Drupal

0

Posted by fred | Posted in CMS, Drupal, tutorial | Posted on 12-02-2012

Tags: ,

 

0. Backup your installation by downloading the Drupal folder (with and FTP client like Filezilla) and backup the database with the Backup and Migrate module. [Optional step but strongly recommended]

1. Download the latest version of Drupal at http://drupal.org/project/drupal

2. Extract the downloaded archive to your desktop

3. Delete the following files and folder in the extracted archive:

  • .htaccess
  • robots.txt
  • sites (the whole folder)

4. With an FTP client (Filezilla for example) upload (overwrite) all the files to the root of your Drupal installation

5. Go to your site and access the update.php page. (e.g.: http://www.mysite.com/drupal/update.php)

Note: If you cannot open it, open the /sites/default/settings.php, look for $update_free_access = FALSE; and change it to TRUE. It is strongly advised (for security reasons) to set it back  to FALSE after the upgrade.

6. Click on Continue

7. You’re done!

VN:F [1.9.14_1148]
Rating: 0.0/5 (0 votes cast)

Bug using DATEPART function in a SQL Server Stored Procedure

0

Posted by fred | Posted in Database, tutorial | Posted on 08-02-2012

 

I had to make a weekly export of regional data. To avoid server overload, it was decided to run the stored procedure with a different parameter (region) every day.

 

Using the following stored procedure, the PROC was working fine in SQL Server management studio. When running this stored proc from a C# program on my workstation, I was getting a different resultset (i.e. REGION_C instead of REGION_B.).

 

ALTER PROC [dbo].[sp_TSV_regionalInformation] AS
DECLARE @REGION VARCHAR(8)

DECLARE @WD INT;
SET DATEFIRST 1
SET @WD = DATEPART (weekday , CURRENT_TIMESTAMP);

– Based on the day of the week, will pick up a different Region
IF @WD = 1 SET @REGION=’REGION_A’
IF @WD = 2 SET @REGION=’REGION_B’
IF @WD = 3 SET @REGION=’REGION_C’
IF @WD = 4 SET @REGION=’REGION_D’
IF @WD = 5 SET @REGION=’REGION_E’
IF @WD = 6 SET @REGION=’REGION_F’

 

SELECT x, y, z FROM table WHERE theRegion = @REGION

 

As a matter of fact, the Stored Procedure will use the weekday defined at the client level, thus having different results from my C# application and the SQL management studio (1st day of the week set up differently).

 

In order to fix that, the following statement should be added before the DATEPART function:

SET DATEFIRST 1

Once, this statement has been inserted, the first day if the week will be Monday (in this case) all the time!

VN:F [1.9.14_1148]
Rating: 0.0/5 (0 votes cast)