Category Archives: Uncategorized

What happened to the phpMyAdmin Process tab?

If you’re like me, you’ll note that the process tab from older versions of phpMyAdmin no longer exists on newer versions. I had resorted to viewing the process list in information_schema.PROCESSLIST and then grabbing the process ID and manually running a KILL on it.

Alas, the tool still exists – just look under the “Status” tab. Hooray!

How to Properly Test if jQuery is Loaded

I saw many people claiming you can test for the existence of jQuery like this:

1
2
3
4
5
if (jQuery) {
	// jQuery exists, put code here
} else {
	// jQuery not loaded, put code here
}

This is incorrect. It will work fine if jQuery is loaded, but if it's not loaded, javascript will throw an error and the code to execute if jQuery is not loaded will probably not be processed. The modification to fix this is simple:

1
2
3
4
5
if (window.jQuery) {
	// jQuery exists, put code here
} else {
	// jQuery not loaded, put code here
}
[ad]

MySQL Select Count Distinct – Counting and Identifying Duplicate Records

[ad]

Looking for a [relatively] quick way to identify duplicate records in a table and list how many records there are for each duplicate? Look no further.

In my case, I’ve got a table named Searches which tracks queries on one of my sites. I wanted to check the top queries, so I used this SQL statement:

1
2
3
4
5
SELECT COUNT(*) AS repetitions, Query
FROM Searches
GROUP BY Query
HAVING repetitions > 1
ORDER BY repetitions DESC;

There you have it. A simple, effective way to count and label duplicate records.

30 Google Wave Invites

[ad] [ad]

Google Wave logoI've got 30 more Google Wave invites to give away. Leave a comment with your email and I'll send them. First come, first serve.

This is actually a nomination and it may take a little while before you get your actual invite.

 

From now on, you must retweet the bitly URL (http://bit.ly/2rwYsG) on twitter and reply to me in order to get an invite.

Example tweet:

@xoise Free Google Wave invites: http://bit.ly/2rwYsG #GoogleWave

Then put a comment in the comment section and don't forget your email (doesn't have to be public).

How to retrive Yahoo Backlinks count with PHP

Here's a simple script to retrieve the approximate number of backlinks Yahoo has for a site. The function and how to call it follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function get_yahoo_backlinks_count($url) {
	$appid = ''; // get this from https://developer.apps.yahoo.com/wsregapp/
	$url = "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=$appid&query=site:$url&results=1";
 
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_REFERER, 'http://www.yoursite.com/');
	$response = curl_exec($ch);
	curl_close($ch);
 
	$xml = simplexml_load_string($response);
	return $xml -> attributes() -> totalResultsAvailable;
}
 
echo get_yahoo_backlinks_count('google.com');
[ad]