Archive for the ‘Business’ Category

MySQL limitations - triggers and subqueries - and solution!

Friday, September 21st, 2007

A comment on my blog just prompted me to write a new post that hopefully helps someone out.

I have just started using triggers to improve the performance of Blog Friends. It appears that MySQL’s support of triggers is rather annoying…

One fault it has is that it will not let you update a table that the trigger was called from - you get the following error:

"#1442 - Can’t update table ‘users_users’ in stored function/trigger because it is already used by statement which invoked this stored function/trigger. "

Now, as it happens, I was not actually updating that table, I was updating a different table, just using that as a JOIN:

UPDATE othertable JOIN users_users ON (conditions) SET othertable.value = value+27 WHERE conditions;

See - no writing to users_users at all! But still mysql blocked it.

Now, I thought, no problem, I will re-write it as a subquery:

UPDATE othertable SET value=value+27 WHERE id IN (SELECT id FROM users_users WHERE conditions) AND moreconditions;

But MySQL detects this as a DEPENDENT SUBQUERY even though it was not (my one wasn’t, at least… it only referenced NEW.values and not anything from othertable). It seems MySQL has many issues with SUBQUERYs. Well; it worked, but OMG was it slow?!! I almost had time to go and make lunch before it finished just working on 10 users… This was not good.

After a lot of moaning and no answers on #mysql on irc.freenode.net (which is unusual - normally there is people in there who know the answers to my questions!) a thought suddenly struck me…

INSERT INTO othertable(id,value) SELECT id, 27 FROM users_users WHERE conditions ON DUPLICATE KEY UPDATE value=value+27;

Now in my application, the row should already exist, so there is no problem (and even if it didn’t the INSERT would do no harm), but if you intend to use it I suggest that you ensure that this INSERT INTO does no damage.

I hope this helps you! If it does, please leave a comment, and I will put more help!

Bookmark and Share

Facebook Applications not working properly? Wont submit forms?

Wednesday, August 29th, 2007

This is due to a recent change (this morning) to FBML using the new login procedures. However, they appear to be broken. Simple fix: add requirelogin="0" to your <form> tags.

Hopefully facebook will fix this issue soon.

(For more info, see here: http://soton.facebook.com/developers/message.php#msg_60)

Benjie.

Bookmark and Share

Blog Friends reaches 100 users!

Wednesday, July 18th, 2007

Less than 24 hours after release, Blog Friends has reached 100 users!

Blognation have done a review of Blog Friends here.

If you haven’t already, why not read my previous article: Blog Friends RELEASED!

Bookmark and Share

Blog Friends RELEASED!

Tuesday, July 17th, 2007

Brain Bakery Ltd. have been working for the last two weeks on a facebook application called Blog Friends, and finally it has been released! I have been logging the hours I spent on the project and it appears that in the last 14 days I have worked the equivalent of almost 4 standard 40-hour weeks - and that’s just me, the others at Brain Bakery have also worked quite a bit! Thats pretty hardcore, I think, so I will be chilling out a bit now…

Anyway - if you have a blog, and you would like your friends blog posts filtered for you according to a list of your interests/dislikes, why not give Blog Friends a try? If you have problems with the software, please leave a comment or email me and I will get back to you ASAP. Also, if you have suggestions for version two, feel free to post them here, though Blog Friends has absolutely loads of features in the pipeline…

Hope you enjoy it!

Bookmark and Share

Chinwag

Saturday, July 7th, 2007

On Thursday night, I went to a networking event in London called "Chinwag." The idea of this was to get to know some of the people "in the business" and make some links that later we could form a kind of symbiotic business relationship. It also gives us a better feel for the scope of technology, and we get to talk about what’s hot and whats not in the tech/design/media world.

It was a good event, with around 2,000 attendees. There was free booze (well, for a long while there was…) and free food. I met many interesting people, though I must admit it was Jof who did most of the forging ahead and meeting new people, I opted to follow a short while later and talk specifics.

As I already said - it was a good event. It would have been brilliant if it wasn’t for the poor organisation of the door. We queued to get in for the best part of a hour! They were checking people off against their registered email addresses, which were printed onto paper (yes you heard me - dead trees!), which they had to flick through to check, at around 50 email addresses per sheet. The sheets were in mostly alphabetical order, but it still took a while to look through - I think part of the reason might have been the time taken to actually understand what the visitor was saying their email address was. One pile of paper was email addresses starting A-M and the other N-Z. For some reason the N-Z queue seemed to move a lot later, I wonder if that says something about English email addresses/first names.

We finally got back to Jof’s house in Kent at around 1am, and I slept in the latest that I had in a good while - 9:30am!

Bookmark and Share

Facebook Applications - Feeds and SMS

Tuesday, June 26th, 2007

I wrote two facebook applications yesterday. Yes, you heard me - two, yesterday. Admittedly I did work for 12 hours almost solid yesterday.

One is an application that lists new posts on blog feeds that you are interested in, and the other allows you to SMS your facebook page to tell your mates "I’m down the pub, why don’t you join me?" They are both, obviously, in their infancy, and the SMS one took me another days coding a few weeks ago (by day, I mean 10-12 hours…) to get SMSs sent to my phone to hook up to my computer well… but it works very well now, tested it last night!

So… watch this space. When they get a little more professional I will consider releasing them. Before then, I need a new phone that I can dedicate to the purpose, or a Nokia usb data cable for my 3310.

Bookmark and Share

WebDAV on Windows XP SP2

Thursday, June 21st, 2007

When Microsoft released Windows XP’s SP2, they broke a lot of stuff. Amongst it was WebDAV Basic Authentication. They "disabled it by default" because it is a "security risk." Well, that is true, but there is no option in menus anywhere to re-enable it. You have to do a registry edit! Well… I have just had to write the following excerpt for BrainBakery’s CMS product:

If you are using Windows XP SP2, and you cannot connect to WebDAV, then you need to enable "Basic Authentication" by running this command (all one line) from Start -> Run:

REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters" /v UseBasicAuth /t REG_DWORD /d 2

And then restart your computer. More information can be found here: http://support.microsoft.com/kb/841215.

Now, this is not live yet, as I have not tested it. I will test it as soon as Jem stops playing The Sims 2, so I can use her Windows XP machine. Here’s hoping it doesn’t break anything.

Incidentally, if you are wondering why I used "2" and not "1", the reason is that 2 enables Basic Authentication over plain HTTP (not HTTPS) under Windows Vista. I don’t know if the same command will work for Vista though.

This post could be useful for users of the PEAR module HTTP_WebDAV_Server, as that only currently supports Basic Authentication, I think.

If you find this useful, please leave me a comment! Thanks.

Bookmark and Share