Multi-Dimensional Array Sorts for PHP

To sort a multi-dimensional array in PHP, you can use usort, like so:

usort($aArray,"cmp_func");

function cmp_func($a,$b)
{
  return strcasecmp($a['x'],$b['x']);
}

Finishing Projects as Fast as Possible

All tasks have a certain minimum amount of time to complete, and no amount of persuasion, management, pressure, technology, or people can change that.

Reducing development tasks to the barest minimum is to define completion as delivery of a reasonably stable component. Unit testing is simply not done. The QA department, or another person or organization becomes responsible for the vast majority of testing.

Automated testing tools can greatly speed the cycle of delivery, defect identification, and verification. This is one way to speed a project along.

Although it is likely there will be a lot of bugs, if the software has a good architecture, most will resolve quickly.

This approach does require experienced engineers, because in order to build good code fast, people need a wide skill set, good tools, and plenty of self-discipline.

Double Your Icon Set

I use an icon set that has beautiful, full color icons (http://everaldo.com/crystal_project). However, sometimes a grayscale version of an icon can be used as a subtle control, or to allow other icons and page elements to appear more prominently.

ImageMagick can be used to convert full color icons into beautiful greyscale icons, very quickly.

convert ok.png -colorspace Gray grey-ok.png

Original image: Color OK

Greyscale image: Greyscale OK

dojox Grid Select Indicator Demo

Demonstration of a selection indicator for a dojox grid.

Notes:

  • Grey checkmark serves as select all/deselect all, if no rows are selected, clicking on the checkmark will select them all, if any rows are selected, all will be deselected.
  • Row selector uses a green checkmark to indicate selection. Additional styling can be applied.
  • Add and remove rows work, but no save is performed.
  • Icons from Crystal Project (http://everaldo.com/crystal)

* Demonstration is for the design, not operation of grid.

Create a Sitemap From a b2evolution Database

If content is moved to a different domain, one way to create a sitemap for old content is to use a database query.

First, find out the blog id:

select * from evo_categories;

Next, use this query to extract all posts in the categories that are part of that blog:

select concat(’http://domain.com/’,date_format(post_datecreated,’%Y/%m/%d/’),post_urltitle) from evo_items__item join evo_categories on (evo_items__item.post_main_cat_ID=evo_categories.cat_ID) where evo_categories.cat_blog_ID=target_blog_id into outfile ’sitemap.txt’;

If you don’t have permissions to export into an outfile (.CSV file), you can just cut and pasted out of puTTY into NotePad or vi and then change the file to be a sitemap. Another option would be to pipe the MySQL output into a file and edit it.

The simplest sitemap is a list of URLs, with a different URL on each line. Remove any surrounding text or characters and then submit the sitemap to Google.