Facebook’s URL sharing is the bane of the internet.

Friday December 26th, 2014

Sharing a link. It sounds so fucking easy, doesn’t it?

I’ve been dicking with this for over a year now. If you try and fight me on this, I will end you.

Problem.

Adding the Share code to your page causes Facebook to prematurely hit your page and cache it even if nobody ever actually clicks share.

Why is this a problem?

Because when a profile is created it has no images. My og:image tag is telling to use the sites logo, but of course Facebook ignores this shit and instead pulls a random image from the web page, usually the QR Code, which is not even visible by default. This is fine, whatever, nobody has even shared that page yet anyway because its brand new.

Oh wait, but, just the act of loading the share button causes Facebook to cache it. Now when the user uploads their own images to the profile header and icon, the share dialog is still using the old cached copy instead of with the new images. This means the first time they actually try and share their nice and completed profile, Facebook is all like “here is the shitty looking one from 4 hours ago”

Solutions

[Fail] Call the Graph API to tell them to scrape your shit when someone changes something on the profile. It works, they hit your shit. It almost never actually updates the cache though – at least not nearly instant enough to make it work right. I can confirm every time the user changes their images now Facebook is hitting the page with curl "https://graph.facebook.com" -d "scrape=1&id=URLENCODEDURL" tail -f access.log .. and the JSON it returns even says “HEY I FOUND YOUR UPDATED OG:IMAGE” – except here we are, still seeing stale cache in both the share dialog and the final feed post if we decide to be bold and click share anyway.

[Fail] Use version’d URLs. I now have pending=RANDOMNUMBERRRRR on the front of any profile which does not yet have images. It doesn’t work, Facebook seems to be ignoring the query component. There are lots of suggestions of using fbrefresh=rando too, but that is also defunct.

[Fail] Use the FB.UI (from the JS SDK) manually instead of their prefab share code. This calls a newer version of the popup than Facebook’s Share Button generator which seems to be better about showing the latest cache. This button refuses to work except on the domain your app is configured for. It will toss a giant red error to the user.

Ok, that is fine, Facebook allows you to set multiple domains in the App control panel. WRONG. IF YOU TRY, THEY TELL YOU TO FUCK OFF BECAUSE THE DOMAIN MUST MATCH THE CANVAS URL, WHICH NOBODY FUCKING USES FOR SHARING EITHER.

fb-fuckoff-multidomain

[Fail] Do not include the Facebook JS SDK and Share button until the profile has images. This fails because now my users think they can’t share their page ever because they can’t see the share button from step one. Users need to see all their shit from the moment they open the account or they think it is broken.

[Fail] Wait 24 hours. Screw you.

It actually gets a little worse.

When using the prefab Facebook share button, it uses an older version of the share popup, and this popup seems to have its own cache which is separate from the Graph API cache. This means it is possible to click share, see the QR code, be unable to change it, hit share, and then some totally different image… sometimes random, sometimes og:image, is actually what is displayed on the Facebook feed.

Stop Composer from caching the Packagist index (on Windows)

Friday May 30th, 2014

If you are actually trying to develop a package for Composer and you manage to do it without getting yourself into a bloodrage, then you are a much more zen person than me. One of the things that pisses me off the most is that it caches the Packagist index on my local machine, and when I am pushing tweaks to Github several times an hour, that is super annoying.

  1. Find your AppData\Local\Composer folder. For me, C:\Users\bob\AppData\Local\Composer.
  2. Delete all the crap in it.
  3. Right click the empty space you just made, choose Properties. Security tab, Hit Edit.
  4. Select your user, put a checkmark in the Deny box for Write. Hit Apply and accept its warning that you know you are denying yourself.
  5. Enjoy Composer being unable to cache.

deny

I assume on Linux you can find wherever it hides it in your home directory and chmod 000 it.

Unadultered LibreOffice bashing – because I earned it

Thursday February 13th, 2014

Version 4.2.0.4 on Windows 8

How to delete Icons from the new Android 4.4 desktop

Friday January 24th, 2014

Certainly it cannot be that difficult… right? Just like before… long press… drag to… wait… what? I spent about 15 minutes trying different things before figuring this one out.

Finally the option to hide the Google Search bar is an option in the default launcher. But wait, did you hide it? It turns out the Google Search bar is what turns into “x Remove” when you long press an icon. If you get rid of the search bar, you cannot delete any icons. To get the bar back, long press an empty spot on the desktop, and then choose settings.

Screenshot_2014-01-24-02-21-26 Screenshot_2014-01-24-12-36-20 Screenshot_2014-01-24-02-21-14

Of course, this will not be an issue for you if you are using a different launcher.

Google Chrome taking a long time to load on Windows 8.1

Monday January 20th, 2014

I came across this “fix” completely by accident. About two weeks ago my Google Chrome started taking 7+ seconds to launch, which made it as slow as both Firefox and Internet Explorer, while Opera launches in less than 1 second.

Hit up your about:flags page. At first I thought it was this option “Enable Instant Extended API”:

 

chrome-tab

 

If you do not set that to disabled, the act of creating a new tab takes for-fucking-ever, and you have to sit there and wait for your search box and most visited sites. This fixed slow tabs, but did not fix slow launch. It ended up being this option “Enable D3D11″:

 

chrome-d3d

 

As soon as I enabled that, Chrome was launching in under 1 second again. I assume just like games, the “Default” option is using D3D9, and perchance may be buggy on modern computers. No idea.

 

PHPony

Wednesday October 23rd, 2013

Don’t get me wrong, I love PHP. But I also don’t have delusions about it. IMHO she fits it perfectly, lol.

hiResPony

Constructors, Factories, and Typecasts… oh my.

Friday October 18th, 2013

Or – why I prefer a factory style object management system. For the duration of this post we shall assume I have a class called App\User, of which represents a user account in our database.

I am rather used to having unpopular views, so this post will probably be flamed or ignored. Does that at least peak your interest a little to wonder what in the world I could be talking about in here? Lowercase lol.

TL:DR – leveraging all three of these to work together for you is pretty awesome.

Continue to full post…

Reacting with ReactPHP

Wednesday August 14th, 2013

The slides from the presentation I gave at DallasPHP about ReactPHP and Ratchet.

Code that I demoed during the presentation is on Github.

Windows 8 on Macbook keeps having the wrong time

Wednesday July 31st, 2013

The Problem

Even if the timezone is properly set, if you set the time to the correct value eventually at some point the clock gets many hours off again at seemingly random times. You are going to need regedit to fix this.

The Cause

The internal hardware can be either set or not set for UTC and whichever that is, Windows is expecting the opposite.

Continue to full post…

Brightness unchangeable in Windows 8 on a Macbook with Nvidia

Tuesday July 30th, 2013

The Problem

You may notice one or more of these issues:

  • On the charm bar options the brightness button is disabled or says unavailable.
  • The keyboard keys for adjusting screen brightness do nothing.
  • The keyboard keys for adjusting screen brightness, or the charm bar brightness sliders think they are working when really they are not.

This happens every time I update the video drivers, apparently Nvidia forgot to include this option for enabling. In order to fix this you are going to have to open up regedit. (Win/Command+R, regedit)

Continue to full post…

Twitter

 
Coderwall