One of the best PHP tutorials I’ve ever read

Vikram Vaswani‘s language is clear and his humour is right on cue. Topics ranging from absolute beginner to slightly experienced. Highly recommended.


Author: (16)


There is an (in)famous error message in DWR which usually troubles newcomers. When you do a remote call, you get:

ERROR [DefaultConverterManager] No converter found for 'java.lang.Class'

It basically tells you that you have some member of type Class in the return type of your remote method, or in one of his child members’ fields.
It’s up to the author of that class to convert that field or not. But if you do not intend to convert Class field, and you’re sure that none of your parameter types or return values do contain a Class field, check for a enum in one of these. Having an enum raises (naturally) the same exception, and it’s easily overlooked. If so just add an enum converter and it’s done:

<convert converter="enum" match="your.full.package.EnumName"/>

PS: I assume this is also valid not just for return types but also parameters which tries to set a class name from javascript

Author: (8)


Need large-scale high-performance implementations of Drupal?

Pressflow might be your answer.

Via launchpad.net/pressflow:

Pressflow is designed for large-scale high-performance implementations of Drupal. It abandons support for out-dated versions of PHP and required MySQL version 5.x. It is also designed to take advantage of more advanced caching systems (e.g. memcached and APC) which are typically only available in dedicated hosting environments.

If you are using a typical “shared” hosting account (e.g. not dedicated or VPS), you will have a hard time taking advantage of much of what Pressflow has to offer. Similarly, if your traffic is modest, you may find it easier to stick with vanilla Drupal.

However, if you have a VPS or dedicated hosting, have 10s of thousands (to 10s of millions) of pageviews, are interested in using advanced caching systems like Varnish, and are concerned with growing traffic or traffic spikes, Pressflow is designed for you.

Author: (16)


Two tips about taxonomy in Drupal

When you hear the word “taxonomy” for the first time while trying to grasp what Drupal is about, it might look like a problem impossible to tackle. A major in science might help with the meaning of the word but nothing more. However, soon afterwards, you realize that it is not so difficult, you just need to use it properly and sometimes intelligently.

Sometimes when you get comfortable with the notion, it is easy to forget some easy tricks. Here is two of them that are related to parent/child relationship of taxonomy terms.

  • To show a term AND its children you can use Taxonomy: Term ID (with depth) option in the arguments section of the view that you are building.

To show the nodes belonging to a term you use:
taxonomy/term/x — where x is the term id to show, a number.

However, to show children nodes you need to add a depth variable. The syntax is:
taxonomy/term/x/y — where x is the term id to show, and y is the depth to go below x.

An example will explain this better. Let’s assume you have a structure such as this:

America (tid=1)
–Canada (tid=3)
–United States (tid=4)
—-Texas (tid=9)
——Amarillo (tid=11)
——Austin (tid=12)
—-California (tid=10)
——Los Angeles (tid=14)

If you use taxonomy/term/1, you’ll see only entries catalogued only under America (tid=1), but not its children.

If you use taxonomy/term/4/1, you’ll see entries for United States (tid=4) and its children to a depth of one; that is, you’ll see entries catalogued under Texas (tid=9) and California (tid=10).

If you use taxonomy/term/4/2, you’ll see entries for United States (tid=4) and its children to a depth of two; that is, you’ll see entries catalogued under Texas (tid=9) and California (tid=10) [this is the first level of depth], but also entries catalogued under Amarillo (tid=11), Austin(tid=12) and Los Angeles(tid=14).

Author: (16)


Content Profile is highly useful if you want to extend the default profile module with e.g. Content Construction Kit (CCK). While implementing I ran into a small problem. When I search for a username the results were directing me to the profile node but not the account page that I had created with Panels. Here are two simple solutions.

The first one uses the rules but might be a little less effective than the second as the rule is called whenever any users would request any node. This might make you loose 50ms per view. The second one might scare non-coders but is really easy to do actually.

1. via Rules:
import and use this rule and tweak it as you like.

2. via node-uprofile.tpl.php, source Michelle:

// We don't ever want to go to the nodeprofile itself.
// Always redirect to the user page.
if (arg(0) == "node") {
drupal_goto("user/$node->uid", NULL, NULL, 301);

Author: (16)


Search Lucene API

Even though the core search module is quite powerful, it is not that easy to find another module that would add Solr-like search functionality (faceted search, fielded sorting of search results, finer-grained content bias) to Drupal. The best search engine available, Apache Solr Search Integration, requires a separate search server or at least Java 5 or higher. These requirements are not always easy to satisfy by small or start-up websites.

Search Lucene API, intervenes right at this point. It has almost all the functionality of Apache Solr (not the same performance of course however quite satisfying) and it is much easier to implement. The following modules that depend on Search Lucene API make it even more powerful.

  • Search Lucene DidYouMean – Provides Google-like “did you mean” recommendations by detecting and correcting spelling errors based on the site’s content.
  • Search Lucene MoreLikeThis – Adds a block that displays content recommendations based on the text in the node being viewed.
  • Search Lucene CCK – Indexes CCK data as separate Lucene fields and adds options to expose them as bias fields.
  • Search Lucene Tagcloud – Adds a facet realm that displays facets as tagadelic-like links.

Author: (16)


Disabling all contributed modules at one go in Drupal

Sometimes -especially before version upgrades-, disabling all contributed modules can become quite frustrating. And inter-dependency of modules do not help at all.

The following method which allows you to update the system table in Drupal, works like a charm for me. You can use phpMyAdmin and/or shell access -> mysql.

UPDATE system SET STATUS = 0 WHERE filename LIKE "sites%"

Author: (16)


Multiple Internet Explorer versions side by side

I found this cool collection which install every single IE version (I mean it, there is even Internet Explorer 1.0), and you can use them simultaneously to test your web apps easily.


Author: (8)



Via snook.ca
clearfix:after is better than overflow:hidden

because overflow:hidden affects printing and text selection in Firefox.

Author: (16)


How to target non IE browsers

Internet Explorer allows us to target its different versions with conditional comments:

<!--[if IE 6]>
Special instructions for IE 6 here

But how to target non-IE browsers is a little bit more tricky:

<!--[if !IE]><!-->
<h1>You are NOT using Internet Explorer</h1>

Mind the two extra <!-- That’s all!..

Source: http://www.cssplay.co.uk/menu/conditional.html

Author: (8)