Posts

Install Redis on ubuntu 14.04, 14.10, 15.04, 16.04 etc

Following are the simple sequential commands to install redis on Ubuntu. -sudo apt-get update -sudo apt-get install build-essential -wget http://download.redis.io/redis-stable.tar.gz -tar xvzf redis-stable.tar.gz -cd redis-stable -make -sudo apt-get install tcl8.5 -make test -sudo make install -cd utils -sudo ./install_server.sh -sudo apt-get install php7.1-redis/ for PHP 5.6 use php5.6-redis -sudo service apache2 restart That seats open your info.php file and see redis extension is enabled or not.

Disable Drupal 8 caching during development

Enable local development settings 1. Copy and rename the sites/example.settings.local.php to sites/default/settings.local.php: $ cp sites/example.settings.local.php sites/default/settings.local.php 2. Open settings.php file in sites/default and uncomment these lines: if (file_exists(__DIR__ . '/settings.local.php')) { include __DIR__ . '/settings.local.php'; } This will include the local settings file as part of Drupal's settings file. 3. Open settings.local.php and uncomment (or add) this line to enable the null cache service: $settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml'; By default development.services.yml contains the settings to disable Drupal caching: services: cache.backend.null: class: Drupal\Core\Cache\NullBackendFactory NOTE: Do not create development.services.yml, it exists under /sites 4. In settings.local.php change the following to be TRUE if you want to work with enabled css- and j

Install PHP 7.x on Linux Mint 18

Adding a PPA for PHP 7.1 Packages sudo add-apt-repository ppa:ondrej/php Install Language Pack sudo apt-get install -y language-pack-en-base sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php Update the local package cache sudo apt-get update Upgrading mod_php with Apache sudo apt-get install php7.1 If you are using MySQL, make sure to re-add the updated PHP MySQL bindings sudo apt-get install php7.1-mysql Upgrading PHP-FPM sudo apt-get install php7.1-fpm Testing PHP php -v   Output PHP 7.1.2-4+deb.sury.org~xenial+1 (cli) (built: Mar 2 2017 10:39:59) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.1.2-4+deb.sury.org~xenial+1, Copyright (c) 1999-2017, by Zend Technologies

Drupal solr: Update specific document directly to solr index.

Problem:   How to update specific solr index document. Requirement: Drupal 7.x Search API Solr Search Solr server should enabled and running(Version 4.9 or more) CURL Solution: $update = array( 'id' => '',// Document id "field_name" => array( 'set' => ''//Value ) ); $update = json_encode(array($update)); $ch = curl_init('http://localhost:8983/solr/collection1/update?commit=true'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $update); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); $output = json_decode(curl_exec($ch)); $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($responseCode == 200) { echo 'SOLR: Updated successfully for id:' . $doc_id . ' (query time: ' . $output->responseHeader->QTime . 'ms).<br>'; } else

Drupal Solr: How to add custom filter in solr

Image
Problem: How to add our own custom filter in drupal solr index. Requirement: Drupal 7.x Search API Solr Search Solr server should enabled and running. Solution: By default S earch API solr has very less filters like Bundle Filter, Node filter, Node Access etc. Many times we require our custom filter base on some value or field. Like in this post,my requirement is to exclude those articles which title include " Eating Fish " words. So Lets start. Step 1:   Create on custom module solr_filter and in solr_filter.module file implement  hook_search_api_alter_callback_info . /** * Implement hook_search_api_alter_callback_info * @return type */ function solr_filter_search_api_alter_callback_info() { $callbacks['exclude_article_1'] = array( 'name' => t('Exclude Article'), 'description' => t('Exclude article which title include words "Eating Fish"'), 'class' =>

Drupal Solr: How to add custom field in solr fields.

Image
This time I am going with Drupal Solr. You can know more about what is solr and how it is suitable for your web site. Problem : How to add custom field(Article Ownership Text) in solr search index. Requirement: Drupal 7.x Search API Solr Search Solr server should enabled and running. Solution: You can see in above image I have created the Article Index and in field list it shows all fields which is related to Article content type. Now I want my custom code field "show legal ownership text" for every article. Step 1: Create on custom module solr_field and in solr_field.module file implement  hook_entity_property_info_alter . /** * Implements hook_entity_property_info_alter(). */ function solr_field_entity_property_info_alter(&$info) { $info['node']['properties']['legal_text'] = array( 'type' => 'text', 'label' => t('Legal Text'), 'sanitized' =&g

How to get list of calender and events from outlook calendar.

Image
Problem: How to get list of calendar and events from outlook.com, How to import events from outlook calendar. Requirement:  Microsoft account. Create some event on outlook calendar by using outlook.com Solution: 1.  Sign up for microsoft account.  (If you have not account). 2. Log in with this url  http://msdn.microsoft.com/en-us/onedrive/dn632140 3. After login click on Dashboard Menu . 4. After that Click on MyApps Menu 5. Then create you application there     Enter you application name and click I accept button. 6. After that you will see the Apps setting window.     Click On  API Settings  and enter you redirect url .     NOTE: Here localhost, IP not allowed please use you real domain name.     E.g: http://domain.com/outlook_calendar/calendar.php 7. In APP Settings you see your Client ID and Client Secret 8. In you domain directory create new directory and one php file.    E.g: http://domain.com/outlook_calendar/calendar.php 9.