drupal

Update: I have updated this tutorial to a latest release of Varnish, read here.

By default, Varnish does not work and it will never work with HTTPS requests it only understands plain HTTP. This means, that on mixed content websites, sites serving HTTPS and HTTP pages, the secure pages won't be or cannot be cached on Varnish reducing the load time compared to the non-secure version of the page for example.
There are many sites that offer lots of static content through HTTPS that can definitely be cached using Varnish and in order to do so we need to implement an extra layer before any request goes to our Varnish Server. This layer is going to be handled by a Load Balancer/Proxy Server which will take care of routing the HTTP and the HTTPS requests, by interpreting SSL and converting the…

Read more...
Friday, March 27, 2015

On this tutorial I will show you how to configure Varnish as a proxy server so you can re route you requests to any Apache or Nginx Server. 
Configuring Varnish on Ubuntu on distributed Servers is not a complex task, we just need to download some packages and then we will have to copy/paste the configurations below in order to start. Feel free to modify the provided configurations according to your needs. This post assumes there is another server Apache/Nginx listening on port 80 and running a Drupal site. 
Ok, Let's begin.

Install Varnish 3.0.5 from Ubuntu 14.04 repositories:

$sudo apt-get install varnish

Configure varnish deamon:

$sudo nano /etc/default/varnish


DAEMON_OPTS="-a :80,:…
Read more...
Tuesday, January 20, 2015

You might have crossed through this error a lot when developing web apps sharing multiple domain names for the same app and it usually triggers when app with domain name A tries to grab images/fonts/audio and somo other files from the same app with domain name B. Cross-Origin Request defines a way for browsers to share content in a secure way preventing your site of Cross Site Scripting attacks. But sometimes you do have apps that require multiple domain names and the resources must be shared between these in the same network so you know that content sharing is secure.


Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://mysite.com/sites/all/themes/mysite/js/slick/slick/fonts/slick.woff. This can be fixed by moving the resource to the same domain or enabling CORS.…
Read more...
Sunday, November 2, 2014

Update: I have update this tutorial with a latest release of Apache Solr for Drupal 7 and 8. Read here.

On this quick tutorial, I’ll show you the steps to have a quick default Apache Solr installation using Jetty on an Ubuntu Server 14.04 LTS, which is the latest Ubuntu release. These are the steps you need to set up an Apache Solr multicore on Ubuntu

Get default Java and Jetty, on a terminal window type: 

#apt-get install default-jdk jetty libjetty-extra libjetty-extra-java

dowload Apache Solr from archives: https://archive.apache.org/dist/lucene/solr/3.6.2/

#wget https://archive.apache.org/dist/…

Read more...
Sunday, October 12, 2014

On this tutorial, I will explain how to configure a Drupal site so it can display a Map (Google Map) based on coordinates taken from a GPS file (*.GPX).

Modules needed:

            Geofield
            Geocoder
            Geophp

Install these 3 modules and the Geofield Map submodule that comes bundled with Geofield as usual or using drush, once you are finished installing, create a sample…

Read more...
Friday, June 13, 2014

Content managers have to deal always with metadata provided by imagery of your website, this can be a tedious task for them and obviously it takes time to fill out all the meta data for your images so they can be  properly displayed on the site, indexed by search providers, etc.

One of the easiest ways I found to get information from an image file on Drupal is by using a module called Exif, this module uses the exif specification format to get the information used by digital cameras for example. This…

Read more...
Friday, February 14, 2014

On this tutorial we will learn how to easily install the necessary Ruby packages needed on Ubuntu 14.04 in order to run compass and let Drupal do the magic with SASS.

On a terminal window type:

$sudo apt-get install ruby ruby-dev

once ruby is installed, run:

$sudo gem install compass
$sudo gem install sass

and there you go!

run "compass watch" on the Drupal theme folder you chose for you site and that's all, Compass will start scanning all the *.scsc files and compile all the changes on your styles.

$cd /my-drupal-site/sites/all/themes/my-responsive-theme-with-sass-support/
$compass watch

Enjoy!

Wednesday, February 12, 2014

Some helpful samples that can be used to process data after a query on Drupal.


<?php
// Retrieve all records into an indexed array of stdClass objects.
$result->fetchAll();

// Retrieve all records into an associative array keyed by the field in the result specified.
$result->fetchAllAssoc($field);

// Retrieve a 2-column result set as an associative array of field 1 => field 2.
$result->fetchAllKeyed();
// You can also specify which two fields to use by specifying the column numbers for each field
$result->fetchAllKeyed(0,2); // would be field 0 => field 2
$result->fetchAllKeyed(1,0); // would be field 1 => field 0

// Retrieve a 1-column result set as one single array.
$result->fetchCol();
// Column number can be specified otherwise defaults to first column
$result->fetchCol($column_index);
?>

Friday, September 27, 2013

Interesting tutorial on how to use the jQuery UI Dialog library that comes bundled with D7.

Take a look at this tutorial

Tuesday, July 24, 2012

This is a PHP function I wrote that helps simulating a drupal get form for Views Exposed Filters, it returns the exposed form array so you can theme it or alter it:

function _get_exposed_form($view, $display_id){
  $view = views_get_view($view);
  $view->set_display($display_id);
  $view->init_handlers();
  $form_state = array(
    'view' => $view,
    'display' => $view->display_handler->display, 
    'exposed_form_plugin' => $view->display_handler->get_plugin('exposed_form'),
    'method' => 'get',
     'rerender' => TRUE,
     'no_redirect' => TRUE,
   );
   $form = drupal_build_form('views_exposed_form', $form_state);
   $form_redered = drupal_render($form);
	
   return $form_rendered;
}

I took this…

Read more...
Friday, July 20, 2012