2010-05-18

Log in to Facebook to personalize your experience with this social plugin

I was unable to click on any FaceBook [Like] button until I enabled 3rd party cookies in FireFox.

With 3rd party cookie disabled, a FaceBook login pop-up window appeared each time asking to "Log in to Facebook to personalize your experience with this social plugin". Entering login/password wouldn't help. The pop-up appeared again and again.

(Tested on iframe version of FaceBook plugin, but I think that JavaScript version needs cookie, too...)

2010-05-10

Simply Accounting cannot connect to database / files read-only / connection timeout

Version:
SAGE Simply Accounting 2010 B

Symptoms:
"Simply" starts, opens the company selection dialog. After a company is selected, it displays an error message, which could be about "read-only" files or about "connection timeout" or "cannot connect to database".

Clarification about the error messages:
Their content changes depending on the stage of your "fight" with Windows and Simply.

What help did I get from Simply (program's "Help" and online Knowledge Base):
Simply says that the problem lies in .NET Framework (version 2! - KB looks very outdated)

Steps that were pretty useless:
  • Reinstalling .NET 3.5
  • Installing .NET 1.1
  • Attempt to install .NET 2 (does not work on Vista)
  • Reinstalling .NET 3.0 (tricky: has to be done via "OS Features" in Control Panel / Programs and Features)
  • Removing old versions of Simply
  • Attempt to install Simply over existing installation
  • Playing with read-only attributes of files and permissions
What helped:
  • Uninstall Simply completely
  • Download Simply from SAGE website (they give the latest release, so I did not need to upgrade to release "B" after installation)
  • Remove old folder containing unpacked installation files
  • Install, run and feel happy
What was the real reason:

Simply Accounting 2010 uses MySQL ODBC connector 3.51
A separate installation of MySQL, not related to Simply, was recently upgraded to 5.1, with ODBC connector 5.1. Old ODBC 3.51 was removed.......

Now both versions of ODBC are installed. Simply feels happy.

2010-05-06

PDO bug: exception caught but reappears in foreach() loop

I was experimenting with PDO/MySQL trying to see how a PHP code will behave with a single static DB connection, multiple connections but declared as "persistent", unbuffered MySQL queries and so on - and discovered a bug which I'd like to show here, because it took me a while to find any reference to it.
I tested it with PHP 5.2.13 under both UNIX and Windows.
Below is the code that demonstrates the problem, and two solutions/workarounds:

#
# PDO foreach exception bug
# Demonstration code
# Author: http://www.tiv.net
# 2010-05-06
#
# Note: same results will appear if using "while fetch()"
# instead of "foreach()" loop
#

print 'This code works OK (Exception is cleaned artificially)
';
$conn = new PDO( 'mysql:host=localhost', 'test', 'test' );
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$oRS = $conn->query( "select 'OK'" );
foreach ( $oRS as $row ) {
    try {
        $conn->query( 'Bogus SQL' );
    } catch (PDOException $e) {}
    if ( $conn->errorCode() !== '00000' ) {
        $conn->query( "select 'CLEAN_PDO_ERROR'" );
    }
print 'NO exception will be thrown.
';
}

print 'This code works OK (two separate connections)
';
$conn = new PDO( 'mysql:host=localhost', 'test', 'test' );
$conn2 = new PDO( 'mysql:host=localhost', 'test', 'test' );
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn2->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$oRS = $conn->query( "select 'OK'" );
foreach ( $oRS as $row ) {
    try {
        $conn2->query( 'Bogus SQL' );
    } catch (PDOException $e) {}
print 'NO exception will be thrown.
';
}


print 'This code throws unexpected exception in foreach
';
$conn = new PDO( 'mysql:host=localhost', 'test', 'test' );
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$oRS = $conn->query( "select 'OK'" );
foreach ( $oRS as $row ) {
    try {
        $conn->query( 'Bogus SQL' );
    } catch (PDOException $e) {}
print 'Exception will be thrown after this...
';
}
?>

My "final note" on using "article" websites for SEO

None of the test articles I submitted was recognized by Google as a link source (checked both in the "link:" search and in the Webmaster Tools).
Nobody came to the site through those links either.