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


Fixed problem of search index stucked with EntityMalformedException

08 Sep 2014 - 12:46 pm

Drupal 7 comes with internal search function to list out all content based on keywords or phrase out of the box. Drupal will conduct a frequent indexing of words in body content during cron running.

However this process maybe or have tendency to stuck at certain percentage due to migration from major Drupal version, slow or interruption of connection during posting new content or database corrupted.

Usually error found in Logs:

Notice: Trying to get property of non-object in _node_index_node() (line 2632 of /home/public_html/modules/node/node.module).

EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7405 of /home/public_html/includes/

Notice: Undefined property: stdClass::$type in _node_extract_type() (line 370 of /home/public_html/modules/node/node.module).

The root of cause you will getting EntityMalformedException is because in Drupal 7 all content must have at least one node revision. To check either the data in search index was corrupted or not, just run these script in your phpMyAdmin.

SELECT n.nid FROM node n LEFT JOIN search_dataset d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC LIMIT 0,1;

Result return as nid number, which either you need to recheck for that node or just delete it.

Sometimes only one node which cause this search index halted. Or you can just run these SQL to detect either all nodes has revision ID.

SELECT nid FROM node WHERE nid NOT IN (SELECT nid FROM node_revision);

If results shows multiple nid, means a lot of "bad" node that need to be clean up. It can be re-edit each one of nodes or either you can directly delete all of them through database.

After that, run cron and check either there is an increase percentage of search index progress.

However, please make sure you do a backup before doing anything to database structure.

Fixed problem with loop infinite Redirect module

05 Sep 2014 - 08:34 am

Combine two powerful module, PathAuto and Redirects in Drupal 7 preventing from error of "Page not found" when any changes done for content title. This is one step on how to make Drupal really powerful in handling SEO method.

PathAuto responsible in creating human readable for URL creation instead of default Drupal path "node/*" pattern based on token replacement. While Redirects functioning to create an URL alias and redirect to new path when there is a changes in old alias.

However the big problem of infinite loop may occur if old alias being used again in same content. This might cause content not able to be access by user or generate fatal error because Redirects keep loop redirect at the same content.

I already patched from development version Redirects which fixed these problem. This patched search any duplicate redirect alias, delete it and return HTTP code instead 301 into 202.

Kindly to download it below since today (5 Sept 2014), there is no latest stable version release.

Classic animation in Facebook with CSS3 make it look fantastic

20 Aug 2014 - 08:38 pm

Have you ever notice that Facebook has a temporary nice shimmer animation before the real status fully appear? Did you know that Facebook do not use flash or GIF image for this animation? What's going on actually they only use CSS3 to make it.

CSS3 render much more faster, even faster compare to download and play any animated GIF. This design will to put all the processing and rendering part to user browser instead consuming time for downloading the images.

The idea is really easy. But in this post I just show the CSS part only. The full concept are using both Javascript and CSS. The temporary shimmer box will load as default. After a background query done and trigger by JavaScript, it will replace the whole box with actual status content.

CSS box design with gradient

First of all, we design a box with gradient shading. I put this box shading inside another box with 12px padding. The CSS code would be written like these:

<style type="text/css">
.box {
    background: #fff;
    border-color: #e5e6e9 #dfe0e4 #d0d1d5;
    border-radius: 3px;
    border-style: solid;
    border-width: 1px;
    padding: 12px;
.box-inside  {
    background: -webkit-linear-gradient(left center , #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%) no-repeat scroll 0 0 / 800px 104px #f6f7f8;
    background: -moz-linear-gradient(left center , #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%) no-repeat scroll 0 0 / 800px 104px #f6f7f8;
    background: linear-gradient(left center , #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%) no-repeat scroll 0 0 / 800px 104px #f6f7f8;
    height: 104px;
    position: relative;

While below are the HTML code that will render the CSS code above. Take note for extra line which define for -webkit- and -moz- each of them specifically for Safari and Firefox browser compatibility.

<div class="box"><div class="box-inside"></div></div>

And the result would display like this:


Define CSS animation

Now we define the animation for .box-inside. We need a keyframe which define the path of animation to be guided. This keyframe action will make the gradient colour to move from current position at 0% to new the position at 100%.

If you look again at gradient position in first CSS definition, the background size were set at size of 800px x 104px which is overflow the .box-inside size. When keyframe took over, the gradient will flow from 0px to 468px from left to right to glide more nicer.

@-moz-keyframes placeHolderShimmer {
  0% {background-position:-468px 0}
  100% {background-position:468px 0}
@-webkit-keyframes placeHolderShimmer {
  0% {background-position:-468px 0}
  100% {background-position:468px 0}
@keyframes placeHolderShimmer {
  0% {background-position:-468px 0}
  100% {background-position:468px 0}

As usual, in CSS3 we need to specify additional attributes for Safari and Mozilla prefix. Lastly we create .animation class which include the keyframe name with additional attributes for animation to loop infinite.

.animation  {
  -webkit-animation: placeHolderShimmer 1s linear infinite forwards;
  -moz-animation: placeHolderShimmer 1s linear infinite forwards;
  animation: placeHolderShimmer 1s linear infinite forwards;

Blending all CSS with HTML

Next, we put additional class in .box-inside with .animation class to make it animate as you seen in Facebook site. We will get the result as below:


Masking with white overlay

Here is the complicated part. We must define at least 12 div items with unique attribute each of them. This to make a masking layer over the .box-inside with animation as the background.

Before that, we need to make sure that all div inside .box-inside applied default CSS attributes of positioning as absolute, start rendering from right and background of white via these definition:

.box-inside div {
  background: #fff;
  position: absolute;
  right: 0

For ease to recall, I will use class name using this pattern: mask01 until mask12. Let's try with first three div definition first.

.mask01 { height: 40px; width: 8px; right: auto; top: 0; left: 40px }
.mask02 { height: 8px; left: 48px; top: 0 }
.mask03 { height: 6px; left: 136px; top: 8px }

Later on, we put all this HTML code for rendering masking overlay layer with CSS class.

<div class="box">
  <div class="box-inside animation">
    <div class="mask01"></div>
    <div class="mask02"></div>
    <div class="mask03"></div>

So, how it would be look like to be? Well you need to observe it by yourself.


Continue to define the rest of div tag until finish. Or you can just copy the code I already wrote:

.mask04 { height: 12px; left: 48px;  top: 14px }
.mask05 { height: 6px;  left: 100px; top: 26px }
.mask06 { height: 10px; left: 48px;  top: 32px }
.mask07 { height: 20px; left: 0;     top: 40px }
.mask08 { height: 6px;  left: 410px; top: 60px }
.mask09 { height: 13px; left: 0;     top: 66px }
.mask10 { height: 6px;  left: 440px; top: 79px }
.mask11 { height: 13px; left: 0;     top: 85px }
.mask12 { height: 6px;  left: 178px; top: 98px }

What actually overlay do?

Overlaying div tags inside .box-inside will end up with the shape of "draft layout" look-a-like before actual status content fully load and pull from database. I put a temporary borders to all masking div tag to be campare with actual display without borders.


If I pull out the border, the result will totally look exactly you see in Facebook. Classic animation without any gif animation, just CSS3.


Have fun!

The making of Drupal syllabus

16 Aug 2014 - 09:49 pm

the making of drupal syllabus

Almost three years I have been conducted various Drupal training classes for government and private agencies, without a proper and conprehensive syllabus on how to use Drupal in the efficient and easy to understand.

The major problem about Drupal is it not easy to make people with zero knowledge in web development understand the concept through tutorial class. Most of people think Drupal will do out of the box in just a single click.

All this time, I already revising almost five times what I just call a "guideline". Yet it still can not consider as "Drupal Syllabus".

meditation spa musics

As a preparation for my mind, I already bought an album call "Meditation Spa", special music arragement for mind theraphy. This album cost me about $70 (~RM210). Some people may thought it expensive but for me it really worth each of cents.

It has been a while

06 Jul 2014 - 08:19 am

Last time I updating my blog was somewhere in May. And today it's already reach in July which almost 2 month without new post. Time is very consume when we needed it. And thats happen to me. Lately I was too busy finished one of my product that already turn in beta phase. That product was name as "Project Management System", which responsible to take over manual process to manage any project, task assigning, bugs management and reporting.

Thanks God that this product smoothly run on low server specification. The objective of this product just to provide high quality yet cheap project management system without need to spend a lot of money and environment to run it. That's is the main reason this product was tested for alpha version on shared hosting with very minimal specification. If there is no critical bugs and any continous fixed need to be done, release candidate version should be appear in December this year.

Besides, I also received three task jobs which consist of one development system and two web development. Both of this task is powered by Drupal. Hoyeah! Drupal rocks. Actually in Malaysia its still in very slow of awareness about Drupal. Most of people knowing Wordpress and Joomla!. As usually because it is easy to learn, used and built. However, lately I manage to receive callers, not to said a lot but quite impressive, from private and government sector regarding for revamping their website.

What so surprise, they are contacting me because to switch into Drupal. I don't know what the main reason but most of callers said they really interested in using Drupal as a new platform. Some of them get quite frustrated with the current CMS system which lack in hard to maintain.

Hopefully Drupal, one day, in Malaysia will powered more portal and website which actually growth really fast in outside country.

ps: this post was written using MacBook Air.. oh man, really? yes!