25 Oct, 16

Add reCaptcha to your Drupal 7 forms programatically

If you want to add Google's reCaptcha (https://www.google.com/recaptcha/intro/index.html) to your Drupal 7 forms programmatically you need to follow these two steps:

1) Install and enable captcha (https://www.drupal.org/project/captcha) and recaptcha (https://www.drupal.org/project/recaptcha) modules. The best ...

Read now
07 Oct, 16

"Error loading MySQLdb module Reason: image not found" error fix in El Capitan Mac OS

If you use mysql database in your Django project and when you run runserver command and get an error message similar to this: "Error loading MySQLdb module Reason: image not found" that means your El Capitan struggles to find necessary libraries. 

The issue can be fixed with these two ...

Read now
16 Sep, 16

Installing cryptography (part of Scrapy) on Mac OS X

I'm leaving this tip as a note for myself, but I hope someone will find it useful too.

If you try to install Scrapy or cryptography on Mac OS X, your pip install will likely fail with the message similar to this:

1
2
3
4
5
6
7
8
9 ...
Read now
01 Aug, 16

Creating content blocks programmatically in Drupal 8

Let's picture this: you've created a custom content block type (let's say, Ad block) in your shiny new Drupal 8 installation and you want to automaticaly create a fresh new block of that type each time you create a taxonomy term (Ad group), so that every ad group has a ...

Read now
15 Apr, 16

JQuery.cookie in Drupal 7

A quick tip for all Drupalistas outhere: if you want to use jQuery.cookie in your project, you actually don't have to download and install the library. jQuery.cookie is a part of Drupal 7 and can be included as easy as typing: 

1
  1. drupal_add_library('system', 'jquery.cookie');

Wondering ...

Read now
09 Nov, 15

Default Search API Sorts Per View in Drupal 7

It's been a while since I've written a post here (especially, Drupal-related). But today I have something interesting to share.

There's a module called Search API sorts (https://drupal.org/project/search_api_sorts) that provides custom sorts and a global sort block for Search API. The module itself is ok, but ...

Read now
30 Jun, 15

Creating Custom Template Filter That Injects Adsense Ad Code After N Paragraph in Django

Injecting ads inside content is a very effective technique. Let's say you want to inject Adsense ad after the first paragraph of text. To add such capability to our Django-based website we need to create a custom filter for that. I'll tell you how to implement such a filter.

1 ...

Read now
04 Jun, 15

Elasticsearch fails with error "This can result in part of the JVM being swapped out. Increase RLIMIT_MEMLOCK (ulimit)". What to do?

Well, basically, that means you have too low memlock limit setting in your OS. This can be easily fixed in two steps:

1) Edit /etc/security/limits.conf file and add to the end:

1
2
  1. * hard memlock unlimited
  2. * soft memlock unlimited

2) Add a line in the /etc/pam ...

Read now
06 May, 15

Running Django manage.py commands from anywhere

One of the most annoying aspects of developing in Django for me is running manage.py commands: you need to be in the same directory with manage.py file in order to run a command. This is not convenient. I thought it would be cool to be able to run ...

Read now
01 May, 15

Installing libsass (django_libsass) on Mac OS Yosemite

I started playing with wagtail recently (a very promisiing Django CMS) and they use django_libsass to compile their sass into css. Unfortunatelly, if you'll try to install django libsass via PIP on Mac you'll get a compile error message. I tried lots of approaches to fix this and it didn't ...

Read now