A lot of us loose focus quickly. This is exactly what I don't want to be. Even after my dearest family member has either succeeded or succumbed to cancer, I want to keep fighting and supporting all means of eradicating this killer disease. Need to keep my focus. I pray to continue the good deeds that I involuntarily needed to support.
Monday, September 10, 2012
Monday, July 23, 2012
Lighter version of loading fields on an entity
If you know the entity id, type and 'bundle', then this could reduce load time:
How do you call this function?
For nodes:
For taxonomy terms:
Caveats:
- Does not call hook_entity_load() hooks.
- You can implement a caching strategy based on the modules used. For e.g. when entity cache is used, field_attach_load() does not cache data in 'cache_field'
Wednesday, April 11, 2012
Fivestar float rating module - Drupal
This module adds a field widget to the Fivestar field, which is a textfield that will take a float value as rating input. The display is unaffected and uses the default Fivestar theme functions. Users can override the theme functions to make use of better floating point precision by affecting the round() function there. See more description in the project page.
Awaiting comments, thoughts and reviews before I decide on the further course of action.
Do read this fivestar feature request first, as to what is missing and why I created this module.
Monday, March 05, 2012
Cache expiration module Alpha1 version released
Varnish, arguable the most common reverse proxy caching mechanism used with Drupal sites has integration with the Cache expiration module. With this module, it was not possible to selectively expire (purge) urls from Varnish. But now we can (atleast for some most commonly used cases).
Basic testing
Some basic testing gave very good expected results. First your Drupal setup to cache pages for anonymous users at admin/config/development/performance. Then by merely enabling the expire module, and using the default options enabled in its config page (snugged away in admin/config/development/performance/expire), you can see the benefits already:
For e.g:
Assume you have you home page cached by varnish (min cache liftime 5mins). Which means any edit to the homepage in that time will not show up to the anon user, who still sees the cached version. Unless you purge Varnish manually.
Not anymore, with the expire module enabled.
Cache expiration will purge the url of the homepage immediately, because you edited your homepage.
Good stuff already! That is not all. Here is a look at its optional features in the alpha1 release:
Optional features
- When a node is expired their nodereferences and parent nodes where it is referenced can be expired.
- When a 'promoted to homepage' node has been expired, the homepage can be expired.
- Expire the menu(tree) when a node expires
- Expire the term pages of those terms tagged to an expired node.
Now, the wait for http://drupal.org/project/views_content_cache just got more exciting!
Thursday, November 24, 2011
JW Player module now supports plugins
![]() |
| JW Player plugins |
There is also a Drupal preset plugin created for Google Analytics Pro2 JW player available in my sandbox. Custom modules can implement plugins by using the newly introduced hook_jw_player_plugin_info() in the JW Player module. The format to use this hook as described in jw_player.api.php is:
* Implements hook_jw_player_plugin_info()
*
* @return array Associative array of plugins keyed by actual plugin id
*/
function hook_jw_player_plugin_info($preset) {
// Create a plugin keyed by its actual plugin id
$plugins['foo'] = array(
As described above, the plugin is an associative array keyed by its actual plugin name as required by the player. The data basically consists of a friendly name and description, followed by configurable options that the site-administrator/editor can set per preset, which would look something like:
![]() |
| JW Player preset settings |
Wednesday, November 09, 2011
How to use hook_query_alter() to alter Views in Drupal 7
Luckily, when the Views query is built in
views_plugin_query_default::query a unique tag is added to each view of the form 'view_<view_name>':// Go ahead and build the query.
So, in your hook_query_alter(), you could identify the view based on its tag and modify the query like any other SelectQuery. I found this easier than using hook_views_query_alter() many times.
Example to group by a specific field:
function hook_query_alter(QueryAlterableInterface $query){
if ($query->hasTag('view_my_custom_view')) {
$query->groupBy('n.type');
}
}
Tuesday, November 08, 2011
Themeing EVA views using custom templates [patch]
But due to the way the views plugin was written, it was not possible to use custom templates for EVA views. If you tried to, you would end up with a lot of 'underfined variable' notices for all the variables in your custom template.
E.g.
Notice: Undefined variable: title in include() (line 31 of /../sites/all/themes/../templates/eva-display-entity-view--gallery--entity-view-1.tpl.php).
There is a hard dependency on eva.theme.inc even when overriding eva-display-entity-view.tpl.php to a custom tpl. Due to this, template_preprocess_views_view() is not run.
The patch in http://drupal.org/node/1205008#comment-5130160 fixes the above limitation by removing the dependency from hook_views_plugins().
Sunday, November 06, 2011
Its all a dream they say
Where did all those characters go? The events in the dream seemed real, even though the colours were not as vibrant and vivid as the non-dream state. We have always pondered about what happens to the soul after death. Life is energy, so it has to transform from one form to another?
I believe the answer to the question of where one 'goes' after death is also similar to what happens to the characters of a dream on waking up.
Hinduism suggests the whole world is Maya (an illusion). Do illusions change form? What if we do not involve the perceptor?
Wednesday, November 02, 2011
Varnish simple purge
So whats a Drupal 7 developer to do if he needs to launch a highly dynamic anonymous site and needs to plan caching strategies? Use Varnish cache of course.
But if your site is as dynamic as mine, Varnish will display stale entries unless its TTL is set to something like 1 hour. For a dynamic news site then, surely you need automatic rules to purge pages from Varnish on new or updated content? For e.g. the homepage is changing constantly! The index pages will also change often.
There are currently two modules in the pipeline that should offer the ability to purge pages (cache ids) from Varnish, instead of the whole Varnish cache (oh God, no!):
While waiting for these more suited modules to have a stable, usable release on Drupal 7 production sites, I had to create a very simple module -Varnish Simple Purge - that allows site admins/editors to purge individual urls from Varnish.
We don't want to give them too many options, cos by experience we know they will use all :) Finally Varnish will more often be empty - not a good state to be in.
Hence with a Varnish TTL of 1hour and a simple purge mechanism to purge pages immediately if needed, my news site is working way faster than its non Drupal predecessor. Oh did I forget to mention that this site is a port from a bespoke CMS to Drupal?
Other cache clearing mechanisms we use are time based views cache (in-built in views). What we would really love is this port of Views Content cache.
Wednesday, August 03, 2011
Managing optional features in a Drupal Distro
Problems:
- 20% of the sites would want additional fields
In your distro, say content type 'article' has 10 fields and needs 2 optional fields. All sites will use the 10 'core' fields and the 2 optional fields may or may not be used. - Some sites want to alter field labels and change display settings on content types
Solutions:
- Separate overridable feature for extra fields per content type
Export the main content with 10 fields into one feature and the optional fields into another feature. Site builders can leave the main feature alone and modify the extra feature only (change field permissions, usage, labels etc.)
Perhaps its not easy to export the content type with the extra fields left out. In that case, manually remove the field's references from the export files. Usually those will be in *.features.field.inc & *.info files.
Then export the extra fields in a separate content type and manually add a dependency to the main feature. - template_preprocess hooks.
Consider encouraging site-builders to place all field alterations in appropriate hooks such as hook_form_alter() and hook_template_preprocess_page() - Override field display settings
This module is still in its infancy but its possible to export field display settings separately into a feature. A comprehensive guide can be found here - http://www.agileapproach.com/blog-entry/new-paradigm-overriding-drupal-features
Monday, July 11, 2011
Space shuttle cockpit
And now I am as thrilled to get this link for the Space shuttle cockpit
Friday, April 01, 2011
Google's April fool 2011 - Google motion
Wonder if anybody would really start doing the 'motion's! Good exercise anyway!
Friday, November 05, 2010
The thing about documentation
Then our manager left. We got a lot of new recruits, many who had never worked in a core agile environment. Our teams got shaken up. Ultimately, the loudest voices got heard. 6 months into it, we have sort of become a mess. To sort of patch up the mess, somebody suggested documenting processes, because to some people, agile meant chaos. Of course agile methodology minimises documentation. Its not that we hate documentation. But I hate certain kinds of documentation. Documentation of processes.
How can you encapsulate all the nuances about human activities - interactive communicative and effective procedures - into words? Documenting processes is like making humans machines. Without creativity or without thought. Processes always are evolving and no two situations can be asked to follow the same text. People need to think on their feet each time. Agreed - some process documentation come with a disclaimer that these are just guidelines and to use proper judgement before following them. Now a poor new recruit new to the agile world would ask - where is that documented?
I believe in mentor-ship and process mentor-ship that encourages and teaches the ideology behind thought. Perhaps putting this ideology into text would not be bad since it does just that - captures ideology.
Anyway, I do like documentation on one important aspect - requirements. Although requirements may change in the real world, they still need to be documented. Because requirements need to be translated into code, which a machine needs to understand. Quite unlike process documentation which a human needs to understand, assimilate and generate an effective action out of.
Friday, October 22, 2010
Are we doing enough, or are we sinners?
In fact, the British powered over so many other peaceful regions and these innocent people paid the price for.. being innocent? The British in this case can of course be seen as barbarous and used their technological advantage to power over other (weaker) human beings. Nothing too different from Hitler and others who abused powers and got blinded by greed, possession and sense of omnipotence.
Question is: why did the peace-loving, God loving people have to pay the price for not having destructive weapons? They did not waste time polluting their minds thinking about exploitation, murder, destruction and such evil thoughts. Was it their fault that they were abiding by God's teachings?
I could not come up with a good answer to this easily. After pondering for quite a while, the most reasonable explanation I could come up was:
'The good' & the 'innocent' did not do enough to take over the world and spread their goodness. Evil took over the world quite easily. Why? Because the good was dormant. They perhaps did not do enough and did not think for other people in other lands so as to spread the wealth of their knowledge and values to other cultures. It is the duty of every 'good' person to spread the message about their ideologies. If they think its not worth spreading, then they probably are vagabonds without a purpose in life and in doing so, are committing a sin.
So it all boils down to each one of us. Are we doing enough to spread our message of our view of the world? Are we doing enough to share our thoughts and beliefs in the hope that it will help humanity? What are we doing for mankind? Are we doing enough?
Thursday, October 21, 2010
Autocomplete paths and themes in Drupal
$form['book']['submit_book'] = array(
'#type' => 'submit',
'#value' => t('Select book'),
'#weight' => -4,
'#attributes' => array('class' => 'book-title-select'),
'#ahah' => array(
'path' => 'mybooks/js',
'wrapper' => 'edit-book-plid-wrapper',
'effect' => 'slide',
),
);
This will cause the Garland theme to be loaded to the current page when the AHAH callback 'mybooks/js' executes. If the callback happened to add new elements into the form, then they would be rendered in Garland. Not what you would really want! You could go around in circles with your UI team over this and waste a lot of time like I did!
Wednesday, September 29, 2010
Eclipse crashing & workspace in use?
Tuesday, October 20, 2009
Google new home page (A/B testing I think)
I happened to hit a Google A/B testing page from UK today.
They seem to be loading just the Google logo and the search bar first. Then once you move your mouse onto the page, the top header and footers appear. Some javascript funkiness to a simple page. ~Why?
Also if you notice, the "Search" and "I'm feeling lucky" buttons have disappeared.
The live search suggestions work from the search bar still.
I'm feeling this may be one of the new Google home pages we may be seeing in the near future.
Thursday, March 19, 2009
Changing the scenario of global development: The great economic crisis of modern times
Economic trends of money generation and consumer satisfaction are based on unforeseen habits that can quickly catch up. Like in art and architecture, they are parts of the current age. They are born, live a span of life (based on various acceptance and factors of chance) and also face death. I am analysing the impending of the current Information Technology age advancements in niche areas. True, the Internet was a revolutionary invention. People are so dependent on it. But not all its seedlings are going to be properly nourished or going to have a market in the future. The economic crisis has forced us to look inwards on the basic needs of life and sustenance.
Humanity is going to reinvent its business-space. Looking inwards, we are going to realize the basic necessities of sustenance in Food, agriculture, and its related areas. People will be less concerned about technology except for the most widely used areas (like e-commerce). The basis of business is going to be reshaped. Organic farming is going to be the most popular choice. Service based industries will pop up their heads but will be difficult to survive for long as customers are less cash-rich.
Thursday, February 26, 2009
Non iodized salt in Kerala
Those who require non-iodized salt can buy "induppu" from any ration shop or place where you buy whole sale dals, grams, rice etc. If you do not get induppu, crystal salt can also be bought. This does not contain iodine as well.
Tuesday, October 07, 2008
Osama has achieved total annihilation
And thats just the way it is.



