Chris Thomas: The blog (18)

Chris Thomas: The blog (18)

Action, Excitement and really wild things!!

Chris Thomas: The blog (18) RSS Feed
 
 
 
 

Facebook -> Wordpress: fotobook, automatic update

Hi guys,

another modification for the fotobook plugin for facebook is the ability to automatically update albums based on a timer, which is great if you casually add photos to the facebook albums, but don’t remember to update them in wordpress, you can actually get the system to update itself.

Firstly, it’ll only work on albums you have already selected to show in the wordpress blog, so if you add a new album, you’ll still have to manually add that through the wordpress blog administration panel.

Secondly, open the fotobook.php file from the fotobook plugin in your favourite text editor and search for the this function

“function fb_display_main”

You’ll find it around line 930.

above it, add the following NEW function

function fb_periodic_update()
{
@session_start();

$current = time();
$timeout = 300;

if(!isset($_SESSION["fb_update_timeout"]))
{
$_SESSION["fb_update_timeout"] = $current - $timeout;
}

if(isset($_SESSION["fb_update_timeout"]))
{
if(($_SESSION["fb_update_timeout"] + $timeout) <= $current) { $_SESSION["fb_update_timeout"] = $current; $facebook = new FacebookAPI; if($facebook->link_active()) $facebook->update_albums();
}
}
}

Then at the top of the function fb_display_main(), do this



function fb_display_main($content) {
remove_filter('the_content','wpautop');
fb_periodic_update();

....the rest of the function don't touch it......

now whenever you open the fotobook albums page, every 500 seconds, it’ll refresh from facebook the photos you have in all the albums.  I tried it myself and it works beautifully!

So, I hope you have fun modifying wordpress plugins! Keep the flame burning!

Facebook -> Wordpress integration: fotobook

Recently I started to keep a fotoblog of my puppy Zora, the reason is that sadly, zora doesn’t live with me anymore because she lives with Cecilia now, who moved back to Amposta.

So I was feeling sad and thought that to cheer me up, or depress me more, I could start a fotoblog of all the happy memories I had and I could share with others who don’t have facebook.

The one thing I wanted to do was to import facebook albums, because I have a lot of cool pictures on it and I came across fotobook, which is really cool, you install it, connect it to your fb account, give permissions to access the albums and then import the album information which then lets you put that up on your wordpress blog.

One modification that I wanted to do to it though was that I wanted to import pictures from a fan page and also from my user account, which with the default, was not possible.

What follows below is a method to obtain albums from your account and any number of fan pages you want, here is how to do it

==========================

you will need to open the ftp of your wordpress and using your favourite editor, open the fotobook.php file from the plugin after it’s been installed, around line: 290, you’ll find a foreach() statemen and just below it $uid = $session["uid"]; that is where all this starts.

the idea that someone had was to replace this with $uid = “123123123″; where the 123123 number is the id of the fan page, this works, but the problem is that you also lose the ability to import albums from your account, so I was thinking of a way to do both, import from fan pages AND your user account AND any number of other fan pages (because you can just repeat the function call multiple times as many fan pages as you want)

I posted this to the help forum, I copypasta it here also

==========================

I have an extension for this idea grabbing the fan pages.

as mentioned above, you can use the following code

//$uid = $session["uid"];
$uid = “12312312312″; <— fan page id

but a muuuch better idea is to refactor the code that grabs the albums, so you can call it multiple times, with any fan page id you could want, I explain.

just above the line where you comment out the session uid and put the fan page id, you find a foreach() statement, which loops through and grabs albums associated with that session uid, the modification basically says, screw the session uid, choose the fan page id instead

my idea is this, create a new method like this:

function get_multiple_album(&$fb_albums,&$fb_photos,$page_uid=false){

}

inside that method, copy and paste the ENTIRE foreach statement, just above it, if you are not a developer, this will be hard, find someone to help you understand how to program, then try it.

paste the code into the new method you’ve called and where the foreach was before, replace it with something like this

if($this->get_multiple_album($fb_albums,$fb_photos) == false) return false;
if($this->get_multiple_album($fb_albums,$fb_photos,”123123123123″) == false) return false;

where 1231231231 is obviously the fan page.

you also notice the first call to get_multiple_albums doesnt have a number like, 123123, it’s because that we are going to use a DEFAULT PARAMETER, to define that in this case, use your account, there is no fan page number, so use the account number instead

the benefit of this is now you can call it multiple times for any number of fan pages you might want to import from, you are not just limiting yourself to only one fan page, now you can import your accounts albums, plus any number of facebook fan pages.

inside the method, you will have to make a modification

where it USED TO SAY

$uid = $session["uid"];

replace it with

$uid = ($page_uid !== false) ? $page_uid : $session["uid"];

now go back to wordpress, import all your albums, hide the ones you want to keep private and you’re all set to go.

I hope it helps you

Bob Ainsworth: defence secretary

you are DOING IT WRONG!

ainsworth_glasses_doing_it_wrong

The glasses go on the eyes man! jees, these labour guys can’t do anything right!

British Scientists claim: There is no G-Spot

Hey guys,

over at the times, there is an article about some british scientists who can’t find the G-Spot, so basically summarise that it doesn’t exist!

http://www.timesonline.co.uk/tol/news/science/article6973971.ece

So basically, let me get this straight, some scientist with very little sexual experience can’t find the G-Spot and therefore says it doesn’t exist to make him NOT look sexually inadequate?!?!?!

I found it, more than once, if you can’t find it, the reason is NOT because it doesn’t exist, it’s because

YOU ARE DOING IT WRONG!

how to kill your project

I am a follower of the naturaldocs project, it’s great,I love it, the syntax is simple, it can document almost any language, it’s an amazing piece of work.

Unfortunately he seems intent on destroying his user base and making someone else take the glory of pushing his project forward without him…..it’s his choice. He has decided that the next version of his amazing project will be released in a language most linux users hates: .NET/Mono.

So in one bold move, he plans to make everyone choose to use a different software, but it’s amazing software, I don’t want to change, so I will start a project to rewrite in a language I can use, whilst keeping the same cross platform benefits that greg has so espoused.

Greg, the second you release naturaldocs 2.0, it’ll be amazing, but I can never use it, I hereby promise to open a simultaneous project on sourceforge and rewrite your code in java or python. You remember what happened to TomBoy right?

You want to know why Apple didnt base OSX on top of linux?

Cause it’s a fucking shithole, thats why, it never words, it hasnt got ANY configuration tools, the protocol is a mess, ICCM? Shoot the bastards who wrote that piece of shit, it’s always crashing, the basic gnome desktop? 200MB of working memory, compiz almost always crashes, or eats memory, ubuntu removes functionality without creating any alternatives (therefore leaving you stranded with no way to configure things), fedora is just as bad, the on screen keyboard can’t be used when you are being asked for a password (like on vista where the screen goes black), nautilus (gnome file manager) sometimes just doesnt do what it’s told, or it’s too slow, for some reason, copying 50,000 files from one directory to another requires nautilus to go through a list of 50,000 files before even copying the first one (retarded!), kde is just as bad, it’s slow, eats memory, constantly crashes, lxde? what a piece of shit, I can’t even create links on the taskbar or desktop by default, xfce? can’t use network shares without some convoluted scheme of installing and configuring something called fusesmb, which never works in the first place, can’t even replace thunar with nautilus because it doesnt work (thunar is so awesome btw!!! it has almost no functionality!!! /sarcasm)

Oh please, you say you dont know why people prefer macs over linux? the more I use linux, the more time goes by and the more I expect it’ll get better, but it doesnt, it’s the same pile of shit it was 5 years ago, only now we have pretty buttons and compiz.

whoopy fucking doo, someone tell these fools that nobody gives a fuck and thats why it’ll never be the year of linux

HTC Hero: Things good and bad.

Hi,

I got my HTC Hero the other day, I bought it free without a contract because I would have to change to orange, at the same cost price of just buying the device and keeping my superior service at vodafone.

Orange>

if you are listening, please dont try and tell me I have a choice of two plans, one with unlimited internet, but only free calls during the night, or 100MB of internet a month, but 700 minutes of calls during the day.  This is 2009, we use phones AND internet, DURING the day.  You’re fucking hilariously stupid phone plans cost you a customer the other day, Vodafone, are laughing all the way to the bank.  Even if they are not perfect, they are better than you.

Well.  Anyway, the device itself is great, I love the application selection I can use, lots of tiny apps which dont cost anything (cause most of them are repackaged GPL code from linux), I think the device works really well, I like having multiple screens and the social network interaction is GREAT! No more crappy apps for my crappy nokia N85, which btw, is about 6 months old and fucked, it’s so broken, I havent a clue how to fix it, nor can I take it to nokia, so then they tell me it’s “water damaged” lol.

This list might update over time, I will datestamp each entry, so you know if it’s new or old.

THE GOOD BITS>

(13/09/2009): Facebook and twitter integration is FANTASTIC, I now dont have to open lots of tiny tools to do the same job, they are built in

(13/09/2009): I can browse facebook albums from my phone, as if they were local albums, this is cool

(13/09/2009): The email application is FAR superior to the nokia messaging app, which never really worked very well, it was ok, but didnt kill me, the hero’s application is great, it displays all my email correctly, it’s fast too.

(13/09/2009): SSH TERMINAL APPLICATION!!! ZOMG ZOMG ZOMG, this is great, because I sometimes need to access these things in order to make some quick fixes whilst I am not near my computer, having this, can sometimes save my day!

THE BAD BITS>

(13/09/2009): No bluetooth file transfer, I cannot export the contacts from my macbook agenda into a vcard, then push it to the device, noooo, for some reason they decided to launch a device with no bluetooth file transfer.

(13/09/2009): No contact sync across bluetooth either, nor have I been successful at importing my contacts by putting them onto the sdcard and then using that vcardio tool, it doesnt work, no matter what options I use and what settings I seem to try, vcardio just keeps saying, file not found.

THE END>

if I think of something else, I will return to say it.  Thanks for coming, have your say on this device below! KTHXBYE

Mastercard’s securecode is more like retardcode

It must be my lucky day.  I wanted to buy a great piece of software called “Remote Buddy” which lets me use my Wiimotes as a remote control for my Mac when it’s plugged into the tv to play movies, it’s very handy for lazy internet browsing, you can find the software here:

http://www.iospirit.com/products/remotebuddy

It’s fantastic and well worth the 20 euros is costs to buy, you can configure all sorts of functionalities.

Anyway, I couldn’t buy it because MasterCard, before buying something, requires you to enter a password setup with your bank that authenticates you are who you say you are, which is a great idea, except the programmers they hired to write the website, obviously were descended from monkeys.  Which might be seen as a insult to our monkey friends.

The reason is quite simple, at my online banking, I can access the system and set the password, so I went there and entered my super secret password.  So I entered it, went back to the website, tried to purchase, it didnt work.  So obviously, the first thing you think is that you made a typo, retry, nope, doesn’t work.

ok, sssooooo, ok, maybe the typo was whilst setting the password at the online banking site.  So I go back and make 100% sure what I typed was what I wanted to type (cause entering a password into a site where you can only see ***** is a fantastic usability feature!!!, especially when SETTING a password, it’s ok for when you are entering it, but when I am setting it, perhaps the “show password” button is a good idea.  I go back to the website to buy again.

FAILED.

WTF WTF WTF????? Then I think, hmmmm, my password is almost 30 characters long, it’s not a password, it’s a passPHRASE, which is far easier to remember and far more secure.  I get all programmery and decide to open the website HTML and look.

<input type="password" name="Pwd" maxlength="20" />

Words fail me.  I go back to the online banking site and look for the same.  In the banking site, there is no limit on the length, but when you are typing back to authenticate, there is a limit.  So lets get this straight, I can enter a 100 character password to SET my password, but I can only use 20 of those characters when I am authenticating myself.

So no wonder it doesnt match, right??

Words fail me, some programmers are fucking retarded.

Eclipse refuses to start (AGAIN!)

Hi guys,

this story has a happy ending, after I tracked down the reason, I am not sure why this happens, but if someone knows, I would love to hear it.

I cloned a git repo to my computer, then opened a brand new eclipse workspace for the project, it opened a tiny grey blank window, eclipse would refuse to open.

I opened another project, it opened fine, no problems or hiccups, so then of course I tried to intersect the projects to find out what the differences was.  I found the exact problem, although I am unable to find out why the problem occurs in the first place, since it was on the same machine I created the workspace which was ok and the workspace which was broken.

So perhaps eclipse in fedora has a bug, meh, I dont know, also, dont really care, cause I know how to fix it.

The problem was tracked down to a single file, it is:

.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs

by default, my eclipse was not creating this file, but if you create it and then add the options

showIntro=false

eclipse will then start normally, as if nothing had happened, so something is going wrong with eclipse when this flag is not present and I have no idea why and nor google, cause I’ve tried hunting for specific information without any success.

So, if you ever, have this problem, create the missing file, put the missing parameter and try to see whether it starts or not.  below are some screenshots to provide some visual record of what happened.

See the blue highlighted, missing file

try to start eclipse

it fails with this little blank grey dialog

copy/create file with attribute, eclipse opens successfully

I hope this helps someone out.

Man who pushed woman through shop window on Regent Street dies

There is a God, ahhahahaha.  Some guy, who wasnt identified (not that it matters cause the son of a bitch is dead), tried to push a woman into a window, succeeded on the third attempt (try, try and try again???) Then got himself killed when the window he pushed her through, collapsed on him also, killing him.  You can read about it here!!

http://www.timesonline.co.uk/tol/news/uk/crime/article6791242.ece

Now, lets just stop right there for a second and do this together.

HAHAHAHAHHAHAHAHAHHAHAHAHAHHAHAHAHAHHAHAHAHAHHAHAHAHAHHAHAHAHAH HAHAHAHAHHAHAHAHAHHAHAHAHAHHAHAHAHAHHAHAHAHAH HAHAHAHAHHAHAHAHAHHAHAHAHAHHAHAHAHAHHAHAHAHAHHAHAHAHAH HAHAHAHAHHAHAHAHAHHAHAHAHAH

Serves the woman beater right, perhaps next time, he won’t oh wait a sec….he’s dead…so well, I guess he won’t be able to learn that lesson :D

Wow, just when you think life is against you, something good happens.  Oh well, time to sign off with a good hearty: BURN IN HELL SCUMBAG

Blogroll

Meta