24 Jun, 2009
I’ve been making more and more wordpress plugins lately and it seems to me that a vital part is getting certain variables back once a post is saved. I had a bit of trouble on this since the logical hook of save_post() was not returning my variables. After a lot of messing around I came to the conclusion that if you use the init() hook you can pull your variables and do whatever actions there, however keep in mind, on init() wordpress is not loaded so you can’t use wordpress functions.
Anyway here is an example…
function checkCheckBox()
{
global $_POST;
if($_POST['checkbox'] == 1)
{
return true; // You would more likely set an option or define a constant here instead so it can be more global
}
return false;
}
add_action('init', 'checkCheckBox');
Hope this helps someone, I know it would have saved me alot of time if I knew.
4 Jun, 2009
I was shopping for hard drives and realized that I never understood the difference between SATA and SAS. I knew enough to know that Serial Attached SCSI (SAS) is an extension of Serial ATA (SATA) intended for servers. So, SAS is to SCSI what SATA is to the retroactively named PATA.
While both are hot-swappable, SAS extends SATA by adding a unified power and data connector which looks similar but allows for a single plug. A single interface allows for hot-pluggable mounts. The main difference is this connector. This Tom’s Hardware Article has a good picture of the difference between the connectors.
Other differences include the SAS specification starts at the current max speed of SATA, 3.0 GB/s. SAS also allows for data transfer at rates of up to 12.0 GB/s. Typically you can buy SAS drives in traditional SCSI sizes and faster spin rates of up to 15,000 RPM.
3 Jun, 2009
Today I had to figure out a way to list subpages of a certain page in its wordpress content. After mulling around my options I decided I might as well make a plugin.
This plugin is very simple and straightforward. Just enter “
” on each parent page or post where you want the children listed. Put it anywhere in your content and that is where it will show.
Then in your css..
.subpage-style { Put your styles here };
Easy as pie!
You can pick the plugin up right Here
3 Jun, 2009
If (when) a Labs feature breaks, and you’re having trouble loading your inbox, there’s an escape hatch. Use http://mail.google.com/mail/?labs=0.
The same for google apps
Use http://mail.google.com/a/[domain name]/?labs=0. Replace [domain name] with your google apps domain.
2 Jun, 2009
Escaping single quotes (‘) in Transact-SQL is done by replacing the single quote with two single quotes. So:
SELECT 'I went to Kinko''s'
Returns “I went to Kinko’s”
The only case where two consecutive single quotes don’t return a single quote is when the first one also starts the string. In this case, if only two single quotes are present, the second one ends the string and the return value is the empty string. SQL Blog Casts has a good example of this.
Doing the same in MySQL
Escaping a single quote in MySQL is done by adding a backslash before it (\’)
SELECT 'I went to Kinko\'s'