Jan 122014
 

First run of the brand spanking new Intellij 13 – and I get createComponent() returns null for: class com.intellij.execution.RunManager – it turns out to be an issue with plugins, so remove your .IdeaIC13\config\plugins directory and restart you’ll be good to go (sans plugins) – no more createComponent() returns null for: class com.intellij.execution.RunManager issues on Intellij 13!

Nov 182013
 

As much as a note to self as anything else, for some reason it proved hard to find out how I could use html in the auto validation messages generated by models in CakePHP.  Now it’s totally arguable that the use of html is not best practice in this case, the right or wrong of that on a technical level is entirely up to you however assuming you do need/want to use html in the validation messages just make sure that on forms that are applicable you either use a custom form error trap:

e.g.

$this->Form->input(‘yourfield’,array(‘error’=>false);

$this->Form->error(‘yourfield’,array(‘escape’=>false);

OR the simpler mechanism is:

$this->Form->input(‘yourfield’,array(‘error’=>array(‘escape’=false);

As an added benefit assuming you’re wanting to wrap your html validation message in a custom div simply add a class attribute:

$this->Form->input(‘yourfield’,array(‘error’=>array(‘escape’=false,’class’=>’alert alert-error’);

So this is how you put html in CakePhp validation messages!

 

 

Oct 152013
 

Visual Studio has come a long way since I used it last, and the Git integration is a powerful new addition.  While the interface is a bit tricky to navigate, Linux command line makes you think in keywords not mouse clicks, overall it’s a great new feature that introduces an amazing source control system to the VS range.  I’ve muddled my way through it for a while until this evening when out of the blue I received an error:

“The origin remote is set to fetch tags only (tagopt = –tags). This may be due to a bug in a previous version of Visual Studio Tools for Git. Fix my configuration or don’t prompt again.”

Clicking “fix my configuration” did nothing and there was no solution to be found.  So going back to Git basics I took a look at the git config file – this will be in:

/.git/ folder (in your solution root folder)

and in the “config” (no extension) file.

Make a backup of the file (after closing VS) and scan down the file for:

tagopt = –tags

Remove this line (and this line only)

Restart VS and try again – you should nolonger receive “The origin remote is set to fetch tags only (tagopt = –tags). ” and your commits/pulls/merges should work just fine.

There’s no visual editor in Visual Studio Tools for the config file that I can see (please add a comment if this isn’t true) – so going back to core Git config is the way to go.

If there’s a better more VS way to resolve the The origin remote is set to fetch tags only (tagopt = –tags). Please comment below!

 

 

 

May 232013
 

I’ve never learned French properly. I love the sound of the language and can hack my way around a cafe menu when visiting France but really don’t know how to speak it at all! It’s a little ironic (though only a little) therefore that my most recent project is all about testing your French! I am very embarrased I’ve never learned French properly. I love the sound of the language and can hack my way around a cafe menu when visiting France but really don’t know how to speak it at all! It’s a little ironic (though only a little) therefore that my most recent project is all about testing your French! I am very fortunately the CTO of a company called Kwiziq which has just released French-test.com – an application aiming to help you improve your French through targeted testing and then personalised learning recommendations.

We call this approach Test Driven Learning, meaning that tests are no longer something you do to evaluate how much you fortunately the CTO of a company called Kwiziq which has just released French-test.com – an application aiming to help you improve your French through targeted testing and then personalised learning recommendations.

We call this approach Test Driven Learning, meaning that tests are no longer something you do to simply evaluate your progress they’re tools to use to actively improve. French-test.com uses a terribly clever (if I do say so myself) set of algorithms to analyse your capabilities. It does this through simple French tests and quizzes, detailed CEFR based exams, personalised assessments (based on gap analysis and your specific need) as well as several soon to be released Kwiziq based language games, that interpret your game play and responses to help further evaluate your level. We’re gathering all sorts of interesting group data too – helping us identify common problems amongst similar profiles of user and will soon be releasing a set of teacher led testing tools so teachers can incorporate additional testing and learning material into their curriculum easily.

So if you want to know how good your French really is, take a French test now!

May 092013
 

Following on from a post I wrote a long time ago entitled “What does “__n()” do in cakephp?” I thought I’d follow up with an example of how to actually use the __n() with i18n in cakephp as it’s not obvious and also hard to find examples of use and or documentation.

If you’re using __(n) in version 2.0 or above Cake the documentation is here.  After a brief look around I couldn’t find the 1.3 version please comment if you have the link!  The documentation says this:

 __n(string $singularstring $pluralinteger $countmixed $args = null)
Returns correct plural form of message identified by $singular and $plural for count $count. Some languages have more than one form for plural messages dependent on the count.

This is fine but it doesn’t result in a translation that includes the actual numbers in translated context so here as a note to self more than anything is an example of how to actually use the __n() with i18n in cakephp:

echo sprintf(__n('%s Singularname', '%s Pluralname',$number,true),$number);

e.g. how to show “x dog/s”

echo sprintf(__n('%s dog', '%s dogs',$number,true),$number);

 

Hope that’s useful!

 

Jan 212013
 

For some reason wp_redirect/wp_safe_redirect in WordPress can be a total pain, whether it be when writing custom front end code, plugins or widgets I seem to come across an issue with redirects periodically, with the utterly frustrating “Cannot modify header information – headers already sent” error.  As a heads up, this is caused as the name suggests by  content in a header being pushed down before the redirect is called, this is a generic issue not one that is specific to WordPress.  More often than not it is simple to identify, if any of the involved PHP files have leading or trailing white space, and or there’s some hidden debug output you have forgotten.  Occasionally the issue is WordPress however, in my case the issue of wp_redirect not working on a custom admin page, was caused by a function in

/wp-admin/includes/template.php:1636 or so, whereby headers/html, quite a lot of them are indeed sent as part of the page load process.

Having ensured all of my files were trimmed and there was nothing wrong with my plugin code, I discovered here that there’s a little workaround for forms being called in custom admin pages, that is simply to append:

&noheader=true

To your action, e.g.

<form method=”POST” action=”?page=your-plugin-page&noheader=true”>

This resolved my problem instantly – understandably given it suppressed the content being produced in template.php!

Hope it helps anyone having problems with wp_redirect and wp_safe_redirect on custom admin pages in WordPress.

 

 

Oct 232012
 

CSS on your drupal site not loading properly in IE (though working in FireFox)?  Loading sometimes and not others?  This comes down to an extremely annoying bug in IE (all versions) which is described here:

http://support.microsoft.com/kb/262161

Essentially after the inclusion of 30 css scripts i.e. stops loaidng any more, this is not uncommon in the development (non cached) mode of drupal so can be a real pain when you’re working with lots of modules and need to make changes to the css.

Along comes the “unlimited css” project on the drupal main site

http://drupal.org/project/unlimited_css

“Unlimited CSS” needs no configuration just install it and it will change the way that drupal (6 only for now) loads CSS to avoid this issue with IE.  Another great module that has saved me lots of head scratching.

Mar 092012
 

I just started using mod_pagespeed from google, an Apache module that aims to speed up page serving by eking out a load of small improvements that can be made to rendered html.  So far I’ve certainly noticed some improvement, though not as much as some have claimed.  I had already spent a load of time with the pagespeed plugin for chrome speeding up the site before installing it, so there’s perhaps not much to do, but we’ll see. Almost immediately I had a problem with one of the default filters, you can read about default mod_pagespeed filters here, the one I was having issues with in particular was trim_urls, which “This filter trims URLs by resolving them by making them relative to the base URL for the page”.  This was all working fine on the main site, but as soon as I started working with ajax, the receiving pages would start screwing up, urls would be randomly cut off (or perhaps not randomly but with no apparent explanation).  Anyway I removed this setting, by editing:

pagespeed.conf

under mods_available in the apache2 folder (sorry cannot do direct path, server rejects it!)

and adding (or uncommenting) the line: ModPagespeedDisableFilters trim_urls This removes the filter from the default settings, which comprise of

 add_head
   combine_css
   convert_meta_tags
   extend_cache
   inline_css
   inline_import_to_link
   inline_javascript
   rewrite_css
   rewrite_images
   rewrite_javascript
   rewrite_style_attributes_with_url
   trim_urls
Mar 092012
 

Aptana for Eclipse is brilliant, an amazing plugin, that for the most part really gives a productivity boost.   Something that I’ve never quite understood however is why they keep messing with their FTP integration.  I’ll  be honest this was one of the main reasons I started using it instead of the older eclipse PHP tools.  For some reason though whenever I do an update it seems to work slightly differently – either location in the context menu, or what can be uploaded from where or whatever.  So in the latest version it’s known as “deployment” – ok that makes sense, but it’s also broken.    For ages I was living with “Opening file for write failed” errors, just switching to Filezilla when I needed to do FTP, this however is such a pain and really slows you down when you’re making small regular changes to test or whatever.   After yet another “Opening file for write failed”, I decided to sort it out, I found a few references to it, none of which really helped, so I resorted to the age old process of just trying different settings until I found one that worked.  Form me, the resolution of the Eclipse Aptana Studio 3 – FTP “Opening file for write failed” error was just to change to SFTP rather than non SFTP.  Nothing exciting in this, but worth noting simply because a number of references I found suggested the opposite also worked.  So the tip, if you’re getting “Opening file for write failed” in Aptana FTP, is just experiment with variations in your SFTP settings, one of them should work!

Jan 092012
 

I’ve just spent tow frustrating hours going around the houses, trying to work out how to link my brand new Facebook I-frame app to my fan page.  I’ve done this successfully before, but it was a while ago so this is a note to self.  I’m constantly amazed at how despite such comprehensive documentation it can be so difficult to find things that are so fundamental to how a Facebook app works.  So, in case it helps, to link a  Facebook app to a fan page (other than the page you create for the app) you need to use this url:

https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL

Obviously replacing the capitalised details.  The app ID is easy – found here in your app settings, the url as far as I can tell can be anything, just cut and paste your app url here and it will redirect you to it afterwards.  When linking your Facebook app to the fan page, the link above will allow you to select which page you want to link to, submit this.

From here, go to your fan page > edit page > apps (in the left nav) and the new app should be listed, from which point you can choose to “link to this tab” and it will appear in your menu on the left.

The information for this was sourced from https://developers.facebook.com/docs/appsonfacebook/pagetabs/ hopefully it will help you with how to link a Facebook app to a fan page.