How to link a Facebook app to a fan page

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.

 

 

 

WordPress random 404 errors on pages that were working

WordPress is fantastic, what else can you say.  The new custom post types and taxonomies make it a super powerful system that can handle the vast majority of average web content management requirements simply and quickly.  It does have its quirks to be sure, and one of them is the tendency for it to screw up it’s permalink cache at times producing random 404 errors on pages that were working to that point.  This often happens when you change slug values in your functions.php but it can certainly happen at other times.  If this happens the quickest way to sort it (normally) is to reset your permalink structure to the default then reapply any custom paths you have defined.  Volia, old pages back on track, no more random 404s on WordPress.

Drupal: Call to undefined function zen_menu_item_link()

I’ve spent the last couple of nights working through Centos rebuilds, solr installations, and hook_blocks that just weren’t working the way I wanted them too, so this morning on booting up my newly restored system on encountering “Call to undefined function zen_menu_item_link()” I was just about ready to punch something!

After ranting a bit and the only references online to Call to undefined function zen_menu_item_link() being the error itself on unmaintained sites I took deep breaths and went through my “broken drupal” checklist.  Fortunately on this occasion the problem was fixed by flushing out all the cached variables.  In SQL paste the following:

 

update system s
set s.status=0, s.throttle=0, s.bootstrap=0
where filename = ‘modules/update/update.module’;

TRUNCATE cache;
TRUNCATE cache_block;
TRUNCATE cache_content;
TRUNCATE cache_filter;
TRUNCATE cache_form;
TRUNCATE cache_menu;
TRUNCATE cache_page;
TRUNCATE cache_update;

And the drupal issue Call to undefined function zen_menu_item_link() should be no longer!

 

Twitter – Epic Fail – Account disabled blocks that username

Having decided to get back onto the blog mission again and redefine my online thang somewhat I chose to combine and remove a few twitter accounts I had been using.  In case you’re wondering about the username change (unlikely, true, but in case you are!) I managed to skip through the clearly presented T&Cs of cancellation by twitter:

So now not only have I closed my old twitter account I’ve also, in the exuberance of changing twitter accounts blocked my original name, @spottmedia.  So two lessons learned, read the instructions and if it’s not broke don’t fix it!

 

 

 

The CHECK_POLICY and CHECK_EXPIRATION options cannot be turned OFF when MUST_CHANGE is ON.

Just one of the various niggles in the SQL Server Management Studio 2008, if by mistake you set up a user and fail to uncheck the “enforce password policy” box (you may have good reason for this, but if you’re on a dev machine as I was it’s a bit of overkill I think), you may encounter access problems when accessing the system from for example a scripting language like Coldfusion or PHP.  In the case of Coldfusion the error looks like:

[Macromedia][SQLServer JDBC Driver][SQLServer]Login failed for user ‘cf_user’. Reason: The password of the account must be changed.

At this point it’s reasonably obvious that you must go in and change the user properties under Security > Users in SSMS.  However, havign created the user when one tries to remove this check box you will encounter (always I think)

The CHECK_POLICY and CHECK_EXPIRATION options cannot be turned OFF when MUST_CHANGE is ON.

This is a bug in the software, and while it is possible to actually change the password programatically thus:

USE Master
GO
ALTER LOGIN [somelogin] WITH PASSWORD = ‘samepassword’
GO
ALTER LOGIN [somelogin] WITH
CHECK_POLICY = OFF,
CHECK_EXPIRATION = OFF;

If you want to just reset this policy the easiest way is to just delete the user and then create it again making sure to leave the enforce password policy unchecked first time around.  There will be no problem saving it initially thus.

PHP fwrite resetting file – file size zero after fwrite

Just spent an incredibly frustrating couple of hours trying to to write a simple text file in PHP.  I’m generating some files (admitedly reasonably large) for google sitemaps.  I spent hours working out why certain variables produced in a for loop weren’t being written using the standard fwrite functionality.  I experimented with the modes, the amount of data everything.  In the end I discovered the only way I could get it to work was put an exit() after the fclose which points to some sort of double execution.  Not a solution or a fix that I’d normally put in a blog post,  this is really just a chance to let of steam, but in case you’re having the problem give it a go!

Windows 7: PID 4 listening to port 8 – Apache cannot start

OK if you’ve installed Apache on Windows of any flavour you’re used to the occasional weird thing happening and preventing it from working, one of the most annoying is the ubiquitous “Cannot open logs” error in the System event log.  This invariably means that something is listening on Port 80.  To prove this for yourself you can go to your run command and enter:

netstat -o -n -a | findstr 0.0:80

The last number here is the process ID using it.  This is most often IIS or other web relates service and is easy to resolve, but every so often (very often it would seem looking around on google) it appears to be PID 4 – which according to the Windows Task Manager is the NT Kernel and System.  Not very helpful given killing this will result in a blue screen of death.  Anyway tonight after much fiddling around I discovered that the thing that was hogging port 80 was nothing to do with IIS or web anything, it was SQL server reporting services.   I turned off anything that resembled a SQL server services and voila Apache started again, no need for a reboot which had hitherto been my only solution.  So problems with PID 4 listening to port 80?  Check your SQL services and turn them off!

Addendum to  PID 4 listening to port 8 – Apache cannot start

Thanks to Tauseef  below who has also mentioned that “A new service called “Web Deployment Agent Service” (MsDepSvc) can also trigger “System” with PID=4 to listen on port 80.”

Bharat below (thanks Bharat) has also contributed “Web Deployment Agent service was triggering “System” with Port id= 4 to use Port 80. I disabled it in Services, changed back to Port 80 in Apache config and bingo, Apache started working on its default port. Then I uninstalled Microsoft Web Deploy 2.0 to permanently remove this problem.

 

Free source code line counter for Coldfusion (and most other languages)

Hopefully gone are the days when programmers work was measured in the number of lines of code they produced!  Any programmer knows this is in fact entirely the worst possible measurement of a programmers skill, the same result in half the code almost invariably means better, more easily maintained code.

Every so often howevert it’s useful to know the size of a code base you are working on so it gives you some idea of the scale of work that may be required, at this stage you need a free source code line counter,  and having looked recently the best one I found was one called CLOC – short for Count Lines of Code.

Amazingly fast, great language coverage, and awesome reporting.  With a single line of code I get a break down of all the programming languages in use, and how many lines of source code exist for each.

On Windows it’s as simple as:

cloc-1.51 --by-file-by-lang "C:\path-to-folder-requiring-count" --out="C:\path-to-ouput\count.txt"

Check it out: http://cloc.sourceforge.net

Enjoy!

Copy Vs. Design for conversion rate optimisation

Great post on Search Engine Land on the relative value of meaningful copy Vs fancy design.
http://searchengineland.com/copy-vs-design-which-is-most-important-to-conversion-42983

Boobquake: Social networks shining a light on the world’s idiots!

I’m really getting into Social Media at the moment.  OK that’s not original and yes it’s a bit behind the 8 ball, but I have of course used it a lot before; I just haven’t really dug into it to try and understand the dynamic, what people are thinking when they use it, why they put such dumb stuff on it and also more importantly how it can be used constructively to really build links between disparate communities and expose those who would seek to maintain the artificial inequalities and misunderstandings that exist in the world.

In step Boobquake!

http://www.facebook.com/#!/pages/Boobquake/115608248460905

Blag Hag: And the Boobquake results are in!.

In response to the absurd claim by Iranian Cleric Hojatoleslam Kazem Sedigh that claimed that:

“Many women who do not dress modestly … lead young men astray, corrupt their chastity and spread adultery in society, which increases earthquakes,” (ref http://www.guardian.co.uk/world/2010/apr/19/women-blame-earthquakes-iran-cleric)

Jen McCreight decided to put it to the test and Boobquake was born.  At a time when the Iranian people need all the support they can get to stand up to the increasingly outrageous antics of their leaders this not only holds a light up to the ludicrous individual it provides valuable social proof to those within the country that their “noble leaders” aren’t the font of all knowledge.

Check it out, this sort of leverage is gold!