Find it

Facebook time in php – Facebook uses GMT not PDT/PST?

I don’t know whether its purely related to my location when I am calling facebooks’ graph API or what, but all the talk about what timestamps facebooks API returns seems to be wrong. Perhaps they’ve changed something, perhaps they are re-adjusting them just for me. If its the latter I wonder why they are giving me GMT when I am in Belgium? Is it based on the USER?

Antique Clock Face
Clock Face by tibchris
Facebook Time in PHP, who the what where?

If you haven’t tried pulling anything time-sensitive out of the graph API yet, don’t, that’s my advice. There is not a single bit of coherent explanation as to how the API hand’s out times, when I first researched it I had written on my pad “Pacific time”…great, did my past (possibly beer holding) self not remember that Pacific time is one thing half the year and another the other half? PDT/PST? Obviously not. What’s more, now when I check (post something on a page, grab it with graph API) – its giving me GMT+00 times, WHEN I’M IN GMT+01.

 

All I can work out is facebook have either been pleasant enough to convert the time to the users original registration locale (likely, and pleasant) and not noted it down ANYWHERE publicly, or they have chosen to use GMT. Probably the former, either way – facebook developers – we need a better solution for working with facebook times.

Posted in Facebook Pages, PHP, Projects, Social Media, Web Development Tagged , , , ,

Unable to drop JQuery sortable onto empty list? Hack solution

The problem: You have a multi column (or area) JQuery UI Sortable (these are neat) which only needs to show a “drop zone” when the user has started to drag a sortable object.

The JQuery documentation for this doesn’t account for the reality of the above, its all very well if you want the empty column/div to SHOW all the time as empty, that is remain as some sort of visible placeholder, but if the empty list should show as empty, until an object is ready to be dropped on it then JQuery sortable’s don’t work. It all comes down to dimensions, if an empty list exists without a height value, you can’t drop onto it.

More specifically, if an empty jquery-sortable list exists without a specific height set at the point of [.sortable start] (that is BEFORE the event is fired) then you just cannot drop the sortable.

the JavaScript Code
Image by Dmitry Baranovskiy

I played with fixing this by adjusting each empty list (in the example belows case #col1,#col2,#col3) to have a defined height (and background, which looks nice) within the sortable “start” option, but this just creates boxes (or landing pads/zones) you can see, but not drop on.

Long and short of it – the solution to being able to drop jquery sortable’s onto invisible empty lists is to bind a function which adds a css class (or sets the height specifically) to the empty (invisible) sortable list when a user clicks one of the goal objects. This is then fired BEFORE the sortable takes hold and so creates drag-droppable landing zones for the users held sortable. It then uses the sortables “stop” property to remove the class it has added to any columns which have it.

function sortAndDrag() {

	//show BEFORE sortable starts
     $("#col1, #col2, #col3").bind('click mousedown', function(){
          $(".col").each(function (c) {
                if ($("div", this).size() == 0) {
                    $(this).addClass("colZoneEmpty")
                }
            })
     });

	//enable sortable
    $("#col1, #col2, #col3").sortable({
        revert: true,
        connectWith: ".col",
        stop: function (a, d) {
            $(".col").removeClass("colZoneEmpty");
	    //any ajax processing
        }
    });

}
//in this example 3 column div's exist with the id's 'col1','col2','col3', all of which have the class 'col'
//colZoneEmpty is a css class which makes the empty list visible

There are of course improvements you could make here, like checking the users dragging before setting any styling, but this quick hackaround works where it shouldn’t.

Posted in Javascript, Snippets, Web Development Tagged ,

Hosting facebook Apps/Applications/iFrame Pages on 1and1 (SSL)

For those who run facebook fan pages you will likely know about fan gating and the importance of adding your own content to your facebook fanpage. This used to be done with the facebook static fbml app but that’s really the old way, looking forward the best way is to make its own specific app. There’s a bunch of really good stuff out there about setting up your apps but none of it seems to deal with the middle level guys who don’t want to shell out time/capital setting up amazon hosting (probably a good idea either way) or don’t strictly have https for the domain, those that just need an interim/growth testing solution with their current hosts, specifically in this case 1and1.

You can host facebook apps on any host, but hosting somewhere unsecure (not accessible via https) will flag up the following prompt for anyone browsing to the page with secure browsing turned on (high proportion of fb users.) You CAN also use amazon cloud storage (S3) for free https file storage, up to a level, however you cannot run server side code (php/ASP.NET) without setting up a server with their EC service.


Not pretty eh? What will that do to your conversion rates? Yep nothing good.
Posted in Facebook Graph API, Facebook Pages, PHP, Social Media, Web Development, Web Technology Tagged , , , , ,

Facebook Fan Page Branding Template – Illustrator

Facebook Fan Page Branding Template – Creating a facebook fanpage branding with Adobe Illustrator

As I have been dabbling with facebook fan pages I thought I would share a few of the take-away’s, in this case purely to do with the branding of your facebook page, increasingly an important outward factor in all web developments – facebook fan pages are perhaps the building blocks of a good social sprawl. I will post later about the technicalities of using fan-gated iframe apps (hosting them on 1and1/Amazon S3 for no extra cost) and similar but for now lets focus on the looks.

!
At the bottom of this post you can get a copy of the Facebook Fan Page branding template I have made in Adobe Illustrator, it has all the artboards setup so all you have to do is add your graphics and export!

Take a look at these few examples:

Posted in Facebook Pages, Projects, Social Media, Web Development Tagged , , , ,

Why not to use big red arrows in display ads…

A masterful example of Adobe advertising, its almost as if LinkedIn placed it there knowingly!
Posted in Business Tagged ,

Remove unwanted eBay strings from A2P [Auction2post] posts with Automated Editor

Free rules file with this post!

Do you use Auction2Post [A2P]? If you don’t its a wordpress plugin which automatically implants listings from ebay as wordpress posts, including affiliate links through the ebay partner network from which you earn a commission. Its quite useful. Read my post about it here. Anyhow if you don’t use the plugin you can pretty much skip this post, unless you use a similar thing which is generating all kinds of nasty strings you don’t want in your posts ;)

This post will show you how to sanitise your auction2post posts for annoying (and contract breaking) ebay auction strings, it even has 125 rules already in a file for import!

The problem

Auction2Post is great in lots of respects, its well written and does a prescribed job. Where it caused irritation for me is arguably after its done its job, after the wordpress plugin had created its posts. You see you can create posts via templates, which is great, it allows enough customisation for most, however I wanted a bit of text processing as often you are left with irritating auction footers and garbage text which make the user hit back or close at a displeasing rate (some of these ebay strings might actually make your Auction 2 posts sites break ebay partner network terms of service, its really worth sanitising your posts as I describe below!)

For Example:

My EBAY User ID: yah00002009

welcome to Our ebay Store shop

IF YOU ARE NEW TO EBAY OR DO NOT HAVE A PAY PAL ACCOUNT PLEASE CONTACT ME SO WE CAN HELP MAKE ARRANGEMENTS WITH YOU

The Solution

This problem with Auction 2 Post and wordpress is one of the reasons Automated Editor was born, to give a bit more freedom in text processing, wordpress filters are great but I don’t think filtering hundreds of ebay phrases like that is effective.

Posted in Affiliate Marketing, PHP, Projects, Search Engine Optimisation, Snippets, Software, Web Development, Wordpress Tagged ,

Facebook Like button not working or showing 0 likes

Got a facebook like button not working showing zero? Do you wan’t to add a facebook like button to your page that points to a facebook page (fanpage) rather than the page the likebutton is actually on? It is possible but you may have come across this facebook bug that I did.

Scenario’s are either:

  • Use facebook like button generator to generate code for a like button (sometimes even this bugs out..)
  • Use some service like ShareThis to generate code for a facebook like button
And when you stick it on the webpage:
  • It shows as Zero – Facebook likes ’0′ even if you know that URL (that you installed it on, or fb page) has likes
  • It occasionally shows correct like count, but most of the time shows Zero [0] like’s
Investigate with:
After spending a few hours working out what was causing this 0 like problem on my facebook like button I narrowed it down to two problems people are experiencing:
Posted in Facebook Pages, Snippets, Social Media, Web Development Tagged ,

Automated Editor Released!

Automated Editor wordpress plugin
A nice small chunk of a project, Automated Editor is a wordpress plugin which allows you to automate some of the post editing process. Automated Editor wordpress pluginWritten to be lightweight and flexible it can do a lot with a little input. The plugin replaces a previous script/small app I had previously commissioned to offer automatic string replacement/removal from posts at point of publishing. With this public release version though it has had all the bells and whistles added to it, and will do some other useful tasks such as the following:

  • Replace one string with another (String replace) e.g. Replace ‘X’ with ‘Y’
  • Remove instances of a string (String remove) e.g. Remove all instances of ‘X’
  • Replace strings which match a regex rule with another string (Regex replace) e.g. Replace any numbers (^[0-9]{3}$) with ‘y’
  • Remove strings which match a regex rule (Regex replace) e.g. Remove any numbers (^[0-9]{3}$)
  • Prepend a string onto the front of a post (Prepend) e.g. Add ‘X’ to the top of a post
  • Append a string onto the back of a post (Append) e.g. Add ‘X’ to the bottom of a post
  • Add a post into a category (Add category) e.g. Add category ‘X’ to the post if its not already added.
  • Add a tag onto a post (Add tag) e.g. Add tag ‘X’ to the post if its not already added.
  • Change a posts date
  • Change a posts status

(Taken from here.)

If you want to read more about the plugin you can check out this post on, What is the point in Automated Editor or go right ahead and get it from wordpress.org or buy the professional version at AutomatedEditor.com.

Watch this space for a few posts on how I use the plugin, (it works fantastically well when rigged up with Auction2Post.)

Posted in Affiliate Marketing, Business, PHP, Projects, Social Media, Web Development, Web Technology, Wordpress Tagged ,
Got a Project?
A Quote..
"The purpose of life seems to be to acquaint a man with himself"
Emerson
© Woody Hayday 2012