home | contact us
» » March


Just got a heads up about a bug with PHP 5.3 and windows.

I don’t actually use windows but on the off chance that I might in the future for some reason I thought I would make a note of the solution here.

The problem can be spotted by getting this error message:

PHP Warning: mysqli::mysqli(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in xxx.php on line 2
PHP Warning: mysqli::mysqli(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
in xxx.php on line 2

The solution is this:

Edit your hosts file and comment out the Ipv6 line

#::1 localhost

 

If you are struggling to understand the Batch Import file layout from the exceptionally sparse details supplied in the “Getting Started” document’s Appendix B which supposedly details the file layout, then this is the solution you need.

It looks very much like there are simply some pages missing from this document. There is another document called “Interfacing With Your System” which has these missing pages.

You won’t get anywhere without it!


 

If you underscores are not displaying properly in Netbeans, there is a very simple solution.

Just change your default font by going to Tools-Options and then Fonts and Colours.

In there, select default and change the font to a different one and it should work fine.


 

Just discovered this site – some handy little command line snippets there

http://www.commandlinefu.com/commands/browse/sort-by-votes

for example some SCP goodness.

Definitely one I will be using again :)


 

If you are tearing your hair out trying to figure out why empty($object-property) = true when var_dump($object-property) outputs a value – this might be the problem.

It arises if you are using the magic __get() method to serve up object properties.

Apparently PHP’s empty() function actually uses isset() to determine if the property is empty or not. To get this to work properly, you also need to declare a magic __isset() method.

This is how I got around this problem:

public function __get($key){
	if(/* some condition to return your key */){
		return $this->$key;
	}
	return null;
}

public function __isset($key){
	if(null===$this->__get($key)){
		return false;
	}
	return true;
}

thanks to Janci’s comment here, I’m not sure how long that would have taken me to figure out on my own, but for sure you saved me a LOT of time. I hope this blog post helps out someone else who hits this same issue.


 

We just ran our Magento training course last week and despite some technical issues at the start of the day I think it was a great success. By the end of the day the delegates all knew their Attribute Sets from their Attribute Groups, could set up layered navigation, create configurable products the fastest way possible without using spreadsheets and generally had a good grounding to go and make the most out of their Magento web shops.

If you are interested in doing some Magento training, we have more course coming up all the time, just give us a call on 0844 357 0201 or drop as a line via our contact form.


 
rss icon