Professional in Drupal web development, theme designing, consultation and training


Check embedded Views return empty or not

21 Dec 2015 - 12:39 pm

Views providing alternative to embed into any template using hook of views_embed_view(). However, it produce still produce a bunch of division HTML tag although the return result is zero or empty. To make sure there should be no rendering for empty Views by using this snippet:

$view = views_get_view_result($name, $display, $args);
$result = count($view);
if ($result) {
//do something here


Project d.Note

19 Apr 2015 - 01:32 am

Project D.Note is a new idea from successor  of Kripkorn Studios. It is a revamping project that focus on new objective and target.

Not like previous KS site, project d.Note now will serve more tutorials, notes and guidelines for Drupal development, designing and consultations. It is solely own under Hadafi Solution & Resources company.

As for maintenance planning to keep this project running in subsequence five years, I will introduce premium content which only can be read by valid subscribers. Subscriptions may undergoes annually.

Currently we are working in organising for managing current content to make it ease for learning process. Meanwhile pushing all non-Drupal related articles to be put under Archive categories which can be access freely by readers.

Working on designing theme, it already take about four months to come out with fresh and simplified design. The more important is to introduce new learning guidance that can help readers to understand and learn about Drupal more clearly. Previous project already set a benchmark that we hope the same in this project.

As for now, we are targeted project d.Note can be go live in around May 2015. But its all depend on time consuming and resources availability. This project right now touched 65% development progress. We might undergoes various and lots of testing before totally released into live server.

Fail updating database structure Drupal 7.34

15 Dec 2014 - 12:56 am

In version Drupal 7.33 there is an updating database structure to lengthing the block title from 64 characters to maximum length which is 255. This update can be apply without any error if site was built fresh from Drupal 7. However for those experience migrating from Drupal 5 or Drupal 6, its may or may not display an error during this process.

You may encounter this error during updating process:

Update #7009

  • Failed: PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'title' at row 192: ALTER TABLE {block} CHANGE `title` `title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Custom title for the block. (Empty string will use block default title, <none> will remove the title, text will cause block to use specified title.)'; Array ( ) in db_change_field() (line 3020 of /home/parasolx/public_html/includes/database/

If you look at error, it comes from the data in the tables that block the scripts to update the table structures. After drill down into database, I found that row 192 contain "NULL" in title field which is should not happen. This is because title is mandatory when creating a new block.

However, previous framework Drupal may bypass this validation which cause the block to create without a title. To counter this problem, I run this script:

UPDATE block SET title = '' WHERE title IS NULL;

You can use this SQL within your database management programme such as phpMyAdmin. After that try running to update the database again. Mine works perfectly after troubleshoot this error.

Fix error "No such interface supported" in Windows 8

30 Oct 2014 - 01:12 am

No such interface supported

Right click on Command Prompt and click  "Run as administrator"

Copy and paste the following command

FOR /R C:\ %G IN (*.dll) DO "%systemroot%\system32\regsvr32.exe" /s "%G

Take some time, you may want to go get yourself a nice cup of organic green tea… and please don’t close the command prompt. Wait until the process finished

processing via command prompt

Creating patch file in Mac OS

30 Sep 2014 - 11:51 am

If you don't want to use VCS for creating patch then you can use diff tool. You can create patch for one file using

diff -u original.c new.c > original.patch


diff -rupN original/ new/ > original.patch

For entire folder

Apply patch

If you are patching  from the root directory and use the -p0 parameter to patch. This will stop patch from asking you which file you wish to patch:

$ patch -p0 < example.patch

If your patch is patching files that mention a & b directories in the patch, you can use the -p1 parameter to get rid of the a/b directories.

$ patch -p1 < example.patch

To fix code style issues in the patch, you can use tab2space like so:

tab2space -unix -t2 foo.patch | patch -p0