MathJax

SyntaxHighlighter

Highlight

Custom CSS

Friday, September 15, 2006

MySQL 5 Data Truncation Errors

When migrating from MySQL 4 to 5, a lot of code broke for me. I got errors like:
Data too long for column 'xxx'
This is because MySQL is a lot stricter than MySQL4. You can turn off the strictness by modifying the my.ini file in your MySQL installation directory and modifying this line:
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
And changing it to...
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Additionally, you may want to append ?jdbcCompliantTruncation=false to any JDBC connnection URLs you have.

Friday, September 8, 2006

Gotchas with Selenium WAT Framework

Lately, I've been doing some research on WAT frameworks such as Selenium. You can use Selenium to record or script automated tests that will be executed directly in the browser of your choice. Note that Selenium IDE only works with Firefox (as it's a Firefox extension), and that Selenium RC works with most browsers but does not support the HTTPS protocol.

The reason for this is that Selenium RC must inject some HTML and Javascript into your site for it to do its testing work. Rather than including the Selenium Core HTML and Javascript in each page you want tested, Selenium RC runs a proxy server you access, and this proxy server injects the code on each request. You need the client libraries (included in the Selenium RC jars) if you want to write test cases. The side effect is that if the proxy server doesn't support HTTPS, you are out of luck. As of the version I tested (0.8.1), this seems to be the case.

Also, if you happen to write form submission HTML like so, with an empty string as the action (so the page posts to the same URL, a common pattern), your acceptance tests will fail:

<form name="myForm" method="post" action="${action}">...</form>

Instead, you must give the absolute URL for Selenium RC to be able to post properly. Don't ask me why =P