Related Nodes Block In Drupal 7

In the past I have used the Similar by terms module, It provides an amazing feature to display the related content in a block view which can be placed in a node view to see similar content to that node. Here similarity is subjected to the taxonomy terms only.

Recently I came across the Similar By References module, This module is an adaptation of the Similar By Terms module, but using an entity reference field instead of just taxonomy terms to determine similarity. For instance, if the node you are viewing has a reference to an entity, other nodes that reference the same entity will be listed as ‘Similar’ content. This module uses Views to create its database queries and display its results so that you can define what fields to show, additional sorting, filters, displays, etc.

Continue reading

Find cursor position inside tinymce editor

Tags

Today I got a requirement from my client that in tinyMCE editor I have to add few predefined content at cursor current position and after that cursor should remain on the same place instead of at the end of newly added content. So it is clear that to achieve that I have store the current cursor position in a variable before appending the new predefined content.

var ed = tinyMCE.get('TXT_AREA_ID');     // get editor instance
var range = ed.selection.getRng().startOffset;     // get range

alert(range);

Continue reading

Integrating and working with multiple databases in Drupal 7.

Tags

,

Earlier after working on a scenario where multiple Drupal interfaces were running on a single database, I was wondering, what if a single Drupal interface uses multiple databases?

In answering that, I did some investigation which I had composed in this blog.

i. Firstly we create a database named as “multidb1”.

ii. We use this database as our default database during our Drupal installation.

Selection_004

Continue reading

Why we should use Google/jQuery CDN to load JS/CSS library files

Tags

, , , , ,

Here are the following reasons on behalf of Why we should use Google/jQuery  CDN to load JS/CSS library files

  1. It increases the chance of cache-hit.
    As now a days maximum sites are following this practice which implies more users already have the file ready in their browser cache. This way cache hit will increase and server call will decrease.
  2. It increases the parallelism.
    To avoid the unnecessary load from your server all browsers built on a concept so maximum number of concurrent connection to a particular server is fixed and this count is different for different browser. So loading library files from different server will increase the parallelism and it is also intelligent job.
  3. It ensures that the minimum size file will load.
    Google/jQuery CDN ensures that these files are pre-compress in a wide array of formats (like GZIP or DEFLATE) which ensures the time-to-download the file very small.
  4. It reduces the amount of bandwidth used by your own server.
    If your site loading files from Google/jQuery CDN it means you are using their server bandwidth which is free of cost.
  5. It ensures minimum time will be taken to load files.
    Google/jQuery has servers all over the world which ensures that the requested file(s) will load from the nearest CDN server.
  6. They will always keep your JS/CSS library up to date
    Google/jQuery server will up to date JS/CSS library files regularly to their latest stable version so you will be always up to date.

Working Example:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
  $(document).ready(function() {
    // Do you JOB
  });
</script>

Now I am sure that you are curious to know why I am not using http: and start with //
The reason is this trick will allow you to use a single reference that works on both HTTP and HTTPS page. So depending upon your page url jQuery file protocol will be http or https

KEEP SMILING 🙂 and don’t forget to add comment below.

How to Install unoconv in centos 6.5

Tags

, , , , , , , ,

At the time of unoconv installation if you are getting the below error message
error: Failed dependencies:
openoffice.org-pyuno >= 2.0 is needed by unoconv-0.5-1.el6.rf.noarch

Then follow the below steps:

Note:
– Before following the below steps if you already installed the libreoffice packages then remove them one-by-one using yum remove [PACKAGE NAME] command.
– libreoffice needed for centos6.4 & openoffice needed for centos6.5.

Steps to install unoconv and openoffice on centos6.5
1: Login to your server through SSH using root credential

2: Create a file named(can be any name with .repo) Archives.repo

3: Add the following snippet
####################################################
[c6-archives]
name=CentOS-6 – Archives
baseurl=http://vault.centos.org/6.2/updates/$basearch/
gpgcheck=0
enabled=1
####################################################

and save this file to /etc/yum.repos.d/ directory

4: Execute the command yum clean all.

5: execute the below command
yum install unoconv openoffice.org-headless openoffice.org-writer openoffice.org-calc openoffice.org-impress

6: Hope above helps 🙂

Working With Domain Access Module in Drupal 7.x

working-with-domain-access-module

Installation steps:

1. Download and install the Domain Access module using this link.
2. Then paste the following in your settings.php file :

/**
 * Add the domain module setup routine.
 */
include DRUPAL_ROOT . '/sites/all/modules/domain/settings.inc';

3. Then rebuild the permission.

Continue reading

Set up the site on Acquia cloud server

Tags

, , , , ,

AquiaAcquia Cloud is a Drupal development sandbox with an epic suite of powerful tools, it provides us our own Development and Staging environment and that too with a Drag-and-Drop feature to deploy code and content. Acquia cloud in its free plan provides the 500 MB space for the code storage, 500 MB for files storage and another 500 MB for database, and if we require more space than we can upgrade the plan that along with the space provides other cool features like adding custom domain and other customization too. so as we have discussed about its features now lets start with the process of setting up the site on Acquia cloud:

 

1. First we need to have the user account on Acquia, if you already have account on Acquia then please proceed to the step 2 directly, else to create an account fill up the details here: https://accounts.acquia.com/user?site=insight#action=user-register (as below).

Continue reading

OpenSSL Heartbleed Vulnerability fix for CentOS 6.X

Tags

, , , ,

openssl-vulnerability

On Monday, April 7th, 2014, a serious bug in OpenSSL was discovered that helps attackers to browse memory info from servers installed with OpenSSL. As almost 80% of the servers including (google, yahoo and facebook datacenter servers) run with OpenSSL, it’s became a headache of the server administrators to fix up the vulnerability by implementing security patches and to diligently patch the exploit on the affected systems.

What is Heartbleed Bug?

The Heartbleed Bug is a serious vulnerability in the popular OpenSSL server library. This loophole allows hackers in stealing the protected information easily, under normal conditions, by the SSL/TLS encryption used to secure the Internet. SSL/TLS provides communication security and privacy over the Internet for applications like web, email, instant messaging (IM) and some virtual private networks (VPNs). Continue reading

New features in WordPress 3.9

Tags

,

wordpress 3.9WordPress new version that is WordPress 3.9 beta version has been released and people are very excited to get a glimpse into the new features. In this article, I will show you what new features are coming in WordPress 3.9. WordPress 3.9 is still in development, so some of these features may not be present in the final release.You can also download the beta version to try your hand.

The main features to look out for :-

  • Live Widget Previews in Theme Customize tab
  • Create Audio / Video Playlists
  • New and Improved TinyMCE or Visual Editor
  • Enhanced look and feel for the Add Themes section

Now I am going to take you point by point on each of these features.

Continue reading