MySQL Count Rows For Pagination

The following SQL snippet shows a neat way to do queries when implementing paged results.

I have tested the snippet on MySQL 5 only.

SELECT SQL_COUNT ROWS *, tableName.id, tableName.someCol
FROM tableName
LIMIT 0,25;

Read the rest of this entry »

PHP Boolean Rules

When converting to boolean, the following values are considered FALSE:

  • the boolean FALSE itself
  • the integer 0 (zero)
  • the float 0.0 (zero)
  • the empty string, and the string “0″
  • an array with zero elements
  • an object with zero member variables (PHP 4 only)
  • the special type NULL (including unset variables)
  • SimpleXML objects created from empty tags

Every other value is considered TRUE (including any resource).

More information here

Ext Js Get Selected ComboBox Value

Small code snippet illustrating getting the selected value from an Ext Js ComboBox.

This example has been tested with Ext Js 4

var combo = Ext.create('Ext.form.field.ComboBox', {
  ...
  listeners: {
   'select':function(selected){ alert(selected.value); }
  }
  ...
});

More information on ComboBox over at Sencha Web Site

Node cannot be inserted at the specified point in the hierarchy

If you get the following error when developing with Ext JS 4:

“Node cannot be inserted at the specified point in the hierarchy”

Make sure your Panel IDs are unique.

In my case, I had 2 form panels both with the same ID that I was trying to render.

Humans.txt? Interesting

http://humanstxt.org/

An alternative to robots.txt…