Is Anybody There?

The simple answer is “yes”, the long answer is the purpose of this post 🙂

I really hadn’t realised it had been so long since my last post, some 20 months it would seem.  So, why the lack of content? What have I been up to? I guess the main reason for the lack of posts, is simply lack of time.  I now have 2 children so family life is pretty hectic these days so I rarely get the chance to sit down and write. If I’m honest, I guess I’ve taken my eye off the ball as well, so to some extent I’ve not written anything because I really haven’t thought too much about doing it!

So, my family has grown, that’s the main reason, and for that I’m truly pleased as punch as my family means the world to me.  It does mean that I have less time for things like this, but that’s a sacrifice worth making. Work has also changed a lot over the last couple of years, we’ve downsized our operation and moved premises. We’ve also been working on a new project for the last year which has taken us in a different direction, which I’ll say more about in an upcoming post.

That’s that really, things have changed, I’ve no doubt changed, but I promise to make the effort to get back in to this.

(It also didn’t help that this domain has been suspended for the last 8 months due to some stupid ICANN verification which was sent via email to an email address from 15 years… but that’s a whole different story)

For more timely updates, please follow me on Twitter (@osblues).

Adam

Jetpack could not connect: SSL certificate problem

Earlier today I stumbled across the popular Jetpack plugin for WordPress while configuring a self hosted installation for a client. Installing the plugin went fine, but once installed it then asks you to connect your site with wordpress.com to enable the features of the plugin. Unfortunately, clicking on the “connect to wordpress.com” button brought up the error message below –

Wordpress Jetpack SSL error

Jetpack could not contact WordPress.com: token_http_request_failed. This usually means something is incorrectly configured on you web host. SSL certificate problem: self signed certificate in certificate chain

Now that error message isn’t particularly helpful, particularly if, as in this instance, the site wasn’t using SSL at all. I googled the error and found this support page on the wordpress forums, only to then discover it’s not resolved.

After more googling I found this post which indicated it might be something to with the jetpack/wordpress SSL certificate rather than that of the wordpress install we’re using.

So, between those two posts I decided to try hacking jetpack.php as mentioned in the wordpress forum post, which as the poster suggests, seems to fix the problem. While wordpress are silent on what the actual resolution is for this, I can confirm that changing –

defined( 'JETPACK__API_BASE' ) or define( 'JETPACK__API_BASE', 'https://jetpack.wordpress.com/jetpack.' );

to

defined( 'JETPACK__API_BASE' ) or define( 'JETPACK__API_BASE', 'http://jetpack.wordpress.com/jetpack.' );

in jetpack.php does indeed seem to fix things.

I wouldn’t claim to be an expert on SSL, but I think this may be down to how WordPress have decided to use Jetpack.me in place of jetpack.wordpress.com, but not updated the SSL certificate to reflect this. I may, of course be barking up the wrong tree there.

Only time will tell if that causes any issues further down the road.

Javascript error: $.browser is undefined

I’ve had to fix a couple of our sites today due to the javascript error “$.browser is undefined”, If you’re using Google’s CDN to deliver your minified jQuery, you may well be seeing the same thing.

It looks like Google has updated their main 1.0 branch of jQuery to serve version 1.9 of the popular javascript library.  Unfortunately some plugins haven’t been updated (or site owners haven’t updated the plugin) to stop using $.browser which is now deprecated.

Fortunately, fixing this is just a case of hardcoding the CDN call to use version 1.8, so in this case change –

http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js

to

http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js

And that should fix it.

So far I’ve seen problems with jQuery.autocomplete and jCrop plugins, feel free to add more in the comments.

Windows IIS phpBB3 500 internal server errors

Just in case anyone else has a similar problem, I’ll post my experiences.

I’ve just upgraded the local biker forum that I look after, the upgrade was from an old version 2 phpbb to the current version (3.0.11).

The actual upgrade went fairly smoothly and everything seemed to be working fine so I renamed the old folder and changed the the new phpbb3 folder to phpbb2 (I know that’s kinda silly but I don’t want to break links).

Over the next 24 hours or so, I got a few 500 internal server errors with no idea what was causing the issue.  Googling gave me very little to go on, apart from a StackOverflow thread which reminded me how to get error logging working properly in PHP for windows.  So, I changed a couple things in php.ini (c:/php in my case); set “error_reporting  =  E_ALL”, I couldn’t seem to get “display_errors = On” to work correctly so left that to “Off” and instead went for “log_errors = On” and “error_log = c:/php/php_errors.log”.  One thing to point out here is, I’m pretty sure the ini file gets cached by php so make sure restart the website and recycle the app pool (I’m not sure if both are necessary, but worth doing anyway).

After changing the appropriate error bits (temporarily), I reproduced my error (simply trying to send a PM would throw it) and checked the log which showed –

[21-Nov-2012 20:24:06] PHP Fatal error:  Allowed memory size of 8388608 bytes exhausted (tried to allocate 1572864 bytes) in D:\….\includes\utf\data\confusables.php on line 1

Ah! A memory issue.  I headed back to php.ini and changed the default “memory_limit = 8M” to “memory_limit = 16M” (and restarted/recycled the site) and the random gremlins went away.

So, everything seems to be working well now.  Generally I’m pretty impressed with version 3 but have really struggled to get any kind of “spambot countermeasures” providing adequate protection.  All the various captcha options seem easily breakable by the bots (even though I can hardly read some of them myself).  In the end I’ve settled on the simple “Q & A” option which I guess is much harder to programmatically break.

Hope it helps!

Ajax.Autocompleter is not a constructor

Just before Xmas I spent ages struggling with the “Ajax.Autocompleter is not a constructor” error while trying to add a script.aculo.us autocompleter to a textbox.  I’ve done them loads of times before and never had an issue so unsurprisingly this infuriated me!

I checked online and found suggestions to do with referencing prototype more than once, and not including the right bits of script.aculo.us (effects.js, I think it’s in).  But none of those were the case.

In the end I found the answer myself… I’d followed the generally good practice of placing all my javascript references and code at the bottom of my page (just before /body) which is how I always do things nowadays.  This works absolutely great when working with prototype as it means the page doesn’t have to wait for the library to load and things therefore aren’t unnecessarily delayed.  Now, I say it works great for prototype, it doesn’t however work for script.aculo.us, THIS HAS TO GO IN THE HEAD!

So, there we have it, if you hit this problem and you’re doing “the right thing” by including your javascript goodies at the bottom of your page, I’m afraid that won’t work here.  Move your JS references to your head and things work dandy again.  You can still do your actual javascript code before /body (which I would suggest you do), just include the references to prototype and scriptaculous in the head.

I hope this helps…. and saves some hair pulling.

Update: 15/03/2010 – Just had another instance of this (well, a colleague did) and we’ve uncovered another area that can throw this same error! Everything looked exactly right, so we were scratching our heads for quite a while… until I looked at the HTML source and noticed a random <br/> at the top of the page. Looking at the code I noticed that my colleague had been outputting some debug type info before the start of the document (in this case the debug info was empty, but it was outputting a “br” after it. This, by the looks of it, throws out the DOM, such that Script.aculo.us can’t do it’s thing and rather usefully gives us this same standard “Ajax.Autocompeter is not a constructor” error. So, if you’re still having issues… check your source! Commenting the debug line out (and this the “br”), fixed it.

add to del.icio.us :: Bookmark Post in Technorati :: Add to Blinkslist :: add to furl :: Digg it :: add to ma.gnolia :: Stumble It! :: add to simpy :: seed the vine :: :: :: TailRank :: post to facebook :: Bookmark on Google :: Add to Netscape :: Share on Yahoo :: Add this to Live