MySQL Error: Can’t get hostname for your address

This error is thrown by MySQL because it tries to do a DNS lookup on the address connecting to the server and it fails due to the IP not being able to be resolved back to a name or some-other deeper DNS bust problem. The easiest way to fix this is to edit your my.ini or my.cnf (/etc/my.cnf) and in the [mysqld] section add the “skip-name-resolve” option. Near the top of the file this will look similar to the below:

Adobe drops flash for mobiles!

..and it’s official – so says Adobe’s blog (read it here). Adobe will be dropping support for Flash on future devices due to performance and a few other things, pushing the future more towards the HTML5 route, which isn’t neccessarily a bad thing, I just find it quite ironic and somewhat comical that they waited for Steve Jobs (Apple) to die before giving up their long time fight with Apple about Flash being or not being supported on mobile devices, namely the iPhone.

jQuery Colorbox not showing but background shows

I was using Colorbox for some lightbox type effects to show larger images when clicking on thumbnails, but for some reason the background was showing up but the pretty little box in the middle where the larger image is supposed to show never showed up, so this is how I made it finally appear after many failed attempts! 1 2 3 $("document").ready(function(){ $(".theCssClass a[rel='forGroupingRelCodeGoesHere']").colorbox({ onLoad: function () { $("#colorbox").show(); } }); }); So the “real” code that fixed it was the:

Get Value of Checkbox using jQuery

This one is quite an easy one, but a good one to mention non-the-less as it does definitely come in really handy. If you would like to get a checkbox’s value to send to the backend using jQuery you can always do the following: Firstly let’s draw some HTML to illustrate our example. 1 <input id="chkOurCheckbox" type="checkbox" /> Now we need some jQuery to do the real work. 1 var ourCheckboxValue = ($("#chkOurCheckbox:checked").

Everybody’s a web host

To cut straight to the point, “we’re living in the age where everybody’s a web host”. Whether it be small and quite pathetic or just another reseller of a larger service trying to get their cut of things, everybody truly is spamming the world with more and more web hosting packages. Just a few short years ago this problem didn’t exist and getting web hosting was quite expensive, unless you went with free services such as the good ol’ “geocities” and co, but then larger companies started up their shared hosting and reseller hosting packages which immediately led to everybody thinking all it took to become a web host was to get themselves a reseller account and start trading.

CSS Background Default

If you would like to override an already attached class containing a background then you can use the following: 1 background:transparent none 0 repeat !important;

Restrict PHPMyAdmin to IP Address

Would you like to restrict PHPMyAdmin from being accessible to the whole world? Firstly you need to SSH into your box if you are not on the local machine where PHPMyAdmin is installed along with Apache. 1 2 cd /etc/phpmyadmin/ vi apache.conf You will need to look for the following text “<Directory /usr/share/phpmyadmin>” and add in the below code: Remember that you need to press “i” in order to start editting text if using VI.

2014 – Commands out of sync; you can’t run this command now

#2014 – Commands out of sync; you can’t run this command now Now that can be a really annoying error! It happens when querying stored procedures in phpMyAdmin as mysqli seems to return 2 sets of results opposed to the usual 1 that mysql returns. You cannot call anything else until you have “flushed” or “cleared” the second result. You can try using COMMIT to resolve this.

Image corrupt or truncated: “unknown”

What is “Image corrupt or truncated: ” and what does it mean? This can often be seen while using Firebug in Firefox, but it actually has nothing to do with either and is just the error being reprinted in in firebug in most cases. It comes from an image that has had it’s extension changed from say .gif to .png or .png to .ico. Eventhough .png and .ico file types are very similar, they are not the same, so an error occurs.

WordPress wp-admin use different language for user

I needed to do some work on a WordPress site a little while ago and all the admins were French – and I cannot speak French other than the popular swear words – so had no idea what was going on in the /wp-admin/ so needed some way of enabling my newly created user account to be in english while letting everybody else use french as they had been up til that point.

Replace all spaces in HTML with   except in HTML tags using PHP

If you would like to replace all the spaces in an HTML string with so that you can render it out to the browser but you also want to retain current spaces in HTML tags you can use the below method: 1 2 3 4 $inputString = '<span class="color:red">1</span> 2 3'; $outputString = preg_replace_callback("#>[^<]+<#","relSpaces",$inputString); function relSpaces($match){return str_replace(" ","�",$match[0]);} This will replace: <span>1</span> 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 ..to look like this: <span>1</span> 2������� 3

Using PHP to validate an IP address

You can use the PHP code below to check if an IP address is valid or not. 1 2 3 4 5 6 $ip = ""; //enter a valid or invalid ip address here if(filter_var($ip, FILTER_VALIDATE_IP)) { // The IP Address is valid } else { // The IP Address is not valid } Wasn’t that easy!?!

What is the difference between is_home() and is_front_page()

Call me ignorant, or call me an ignorant geek, but I used to think is_home() and is_front_page() was the same thing, until I experimented with them the other day and noticed they did quite different things. Let me break them down: is_home() This actually is the page where all your recent posts are shown. Which means if your “home” page is set to “static” then it will be false, otherwise it will be true.

..near 'option o ON (po.option_id = o.option_id) LEFT JOIN option_description od ON (o.o' at line 1

So you’ve just installed Opencart 1.5.0 and when attempting to edit a product or category or etc you get the following error: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘option o ON (po.option_id = o.option_id) LEFT JOIN option_description od ON (o.o’ at line 1 Error No: 1064 SELECT * FROM product_option po LEFT JOIN option o ON (po.

What is 1e100.net?

So you are probably reading this because you are not sure what 1e100.net is or why you are being redirected via it when performing Google searches or using products such as youtube etc. Perform a SiteWhois lookup 1e100.net is owned by Google and has been in use since October 2009, if you perform a whois on the domain you can see it’s registration details linked back to Google. Perform an SiteInfo lookup

Hide all error messages PHP

PHP Error messages showing up in your web applications are a dangerous thing. Not only does it look unprofessional, but it is also a serious security concern! Once you have completed debugging your website or web application you can place the following one liner at the beginning of your code, this will turn off error reporting and therefore make sure that no application details are spilled to your users. 1 error_reporting(0); If a single line of code is causing the problems it is safer to use the at symbol (@) to suppress any errors it may cause.

What is xmlrpc.php?

It is a script which allows clients to make procedural calls over the net. As it says in the name, the encoding is XML and because it is used on websites we can make the fair assessment that it uses the HTTP protocol. If we break the name down we get: XML transmition via Remote Procedure Calls. So you are still not sure what this is all about? Read on..

Windows Genuine Advantage Notifications in a VM

Windows Genuine Advantage Notifications I am running a Windows XP SP3 VM used for testing multiple versions of InternetExplorer through Virtualbox. Running this wizard should be avoided if Windows is in a VirtualMachine.

Force HTTP using htaccess

1 2 3 RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

Stop That Referrer in PHP!

Today I will show you a method to stop the traffic that a referrer site is sending your way, you may wonder why you would want to ignore traffic, after all, isn’t inbound traffic to your site fantastic no matter what? The simple answer is “NO!” Let me explain it in a real life situation so that you can better understand where to use this. Understanding where to use it