If you need to optimize or find out how a MySQL query is doing, type in “EXPLAIN” before the query and you’ll get a table that shows a bunch of statistics. I’m not going to try to explain them all. It can be found on the MySQL docs site:
Diff Merge
DiffMerge is an application to visually compare and merge files within Windows, Mac OS X, and Linux. Best of all it is free! as in it’s free for you to use, you don’t need to pay anything, ever. This is a very useful tool when you are trying to find a differences between two files. You can use it as an external tool for CVS or SVN when diff-ing multiple versions. Other features include:
- Graphically shows differences between two files
- Side by side comparison between two folders
- Right click and compare two files in Windows Explorer
- Configurable
- Compatible with 42 different encodings
- Cross-platform (Windows, Mac, Linux)
The best feature that makes DiffMerge stand out against the rest of the diff tools is their Folder Diff. I work on a project I work on multiple files at a time and I loose track of what file I touched. If I ever need to see the changes I’ve made in an entire folder, DiffMerge can easily show me that.
DiffMerge can be downloaded here: http://www.sourcegear.com/diffmerge/index.html
Favicon
Problem
When the simplest things don’t work it can drive you nuts. I had a task to add a favicon to a website so that it shows in the browser. To do this all I thought I had to do was get the PNG, convert it to a .ICO file on one of the many online converters and place it in the home directory of the website. What do you do when the image shows at http://mydomain.com/favicon.ico but doesn’t show as the browser’s page icon?
Solution
- Clear the browser cache
- Make sure you have the link tag in the <head> part
<link REL="SHORTCUT ICON" HREF="/favicon.ico">
- Go here and make sure your icon is up to the standards
When I looked at Firebug I saw that there was a tag <link rel=”icon” href=”” type=”image/x-icon” >. I thought it was a little strange, but I also thought Firebug was just interpreting the icon location since it wasn’t in the source code I was looking at. (Firebug shows the real-time values of elements instead of the actual code. ie. if you use javascript to move an element, it will show the new coordinates instead of the original ones).
After a while, I found the website that validates favicons. Once I saw that extra “image/x-icon” again, I looked through my PHP code and saw that it was including that, which is why I didn’t see it in the main html code.
TrueCrypt
TrueCrypt is an amazing free open source tool that allows you to encrypt files very easily. Anyone can do it as long as you can remember your password. It acts like another drive on your computer so you can view edit and delete the files as if it’s a normal drive. Any files copied into the “drive” gets encrypted on the fly. Once you’re done with the files you can dismount the drive and that’s it. Best of all you can transfer the “drive” from a Mac to a PC without any hiccups.
Usage
I have company passwords that I share with a few other people. Some are on Macs, some are on PC. We don’t have an intranet or local server so what we do is we store all of our passwords in a TrueCrypt file which is stored on Google Docs. That way all of us have access to it and if the file were to be compromised the file would be of no use without the file’s password.
So my typical usage of this is:
- Download the TrueCrypt file from Google Docs
- Open TrueCrypt
- Select the file in TrueCrypt
- Click a button and type in the password.
- View/edit/whatever to the files within what appears as another drive.
- Click on Dismount when done.
- Reupload the TrueCrypt file to Google Docs.
Looks like a lot of steps, but I just listed out each and every button press. Anyway if you want to know more, you can head on to TrueCrypt’s website.
Creating an Instance of a PHP Class
Problem:
This works in PHP 5.3+:
$CLASS_NAME = 'TheName'; $class_instance = new $CLASS_NAME;
This doesn’t
define('CLASS_NAME', 'TheName'); $class_instance = new CLASS_NAME;
Workaround:
Use the way that works. There are other limitations with using a variable to create a class. Another way to create a class from a variable is by using:
$test = call_user_func(array($className, 'getInstance'));
Which CMS to Use?
I recently was asked the age old question “what CMS is the best?”. So I asked back “What will the CMS be used for?”, and of course that wasn’t specifically known. This post is not a complete post. It is here to jot down findings and notes about CMS’s. Wordpress and Exponent CMS are the only two CMS’ I have tried for more than 5 minutes. I tried Exponent and WordPress in 2007 and have not given Exponent another chance. Since then Joomla and Drupal have become the clear competition (in terms of popularity) for WordPress. So these three will be reviewed. At the time of this post creation, WordPress is beating both in terms of Google Searches.
In the following lists, “Users” are people who use the CMS to put out content. “Developers” are people who set up and/or customize the CMS for someone else to use. And if you haven’t noticed, these are only comparing PHP open source CMS’.
WordPress
Pros
- Very easy to pick up and learn for new users.
Cons
- Forums have many complaints from developers.
Drupal
Pros
- Easy for developers to pick up and learn
Cons
- Not user friendly. Difficult for new users to pick up and learn.
- No WYSIWYG editor.
Joomla
Pros
- Easy to use for Developers, Designers, and Users
Cons
- Not as User-Friendly as WordPress.
- Not as powerful as Drupal.
Conclusion
In conclusion from the web, it seems that WordPress is best for clients you want to impress, Drupal is best if you have a website with many features, Joomla is best if … you need something easier to use than Drupal, but more customizable than WordPress? In my own narrow opinion, WordPress has a large community creating plugins to keep you from straying to Drupal. These plugins offer calendars, embedded video, columns, galleries, etc. One thing that I think I’ve seen in Drupal that WordPress does not natively support (and did not find a plugin yet) is to edit different parts of a page. For example if you wanted to have a template where you needed to edit some text on the left sidebar, the top section, and the main content, you would have trouble doing this in WordPress. I’m still doing research on how easy it would be in Drupal or Joomla. The problem for me is that the user interface of Joomla and Drupal looks like it’s meant for IT personnel. However, the people I’m creating a CMS for are business and secretarial personnel. Decide for yourself and try a demo of each one and more at opensourcecms.com.
Update
Below are the up-to-date trends… Joomla and Drupal? what’s that?