Posts

Showing posts from 2012

Selenium 2 Java Quick Setup

I had a seemingly random issue with a website where it would fail one out of x times. Since I haven't used Selenium 2 yet I thought I would run a Selenium test. To get started in Selenium 2 and Java the quickest way is to use Selenium IDE and generate some tests. Then use the File -> Export Test Case As -> Java / JUnit 4 WebDriver Backend. After the test is created then just drop it into Netbeans or Eclipse. The first stumbling block I ran into was that I needed Both Selenium Client and Selenium Server Jars added. Without the Selenium Server Jar, I saw an unhelpful error that stated: "com/google/common/base/Function". After adding those 2 Jars, if you don't use the Eclipse or Netbeans test runners, make sure to add the JUnit Jar. Then you can run your test. Here is a shell that does nothing but run a test that was outputted from Selenium IDE. package webdriversample; import com.thoughtworks.selenium.Selenium; import org.junit.After; import org.junit.Asser...

Setting up Apache To Work with PHP and Zend Framework in Fedora for Development

To get started the first thing we need to do is install Apache and PHP. yum install httpd php You can setup Apache to run in any users public_html directory but I am the only one using my computer and I like to name my websites directory whatever I want so we have to create the folder and give Apache permissions to it: mkdir ~/websites chmod 711 /home/accessrichard chmod 755 /home/accessrichard/websites After that we have to set Apache to redirect our localhost traffic to the above website directory. Create your own Apache config file in /etc/httpd/conf.d touch /etc/httpd/conf.d/accessrichard.conf Add something similar to the following in the file we just created replacing your home directory name and your website folder name as appropriate. In the below example I am setting up 2 different websites, demo.dev and demo2.dev. NameVirtualHost *:80 < VirtualHost *:80 > ServerName demo.dev DocumentRoot /home/accessrichard/websites/demo/public SetEnv APPLICATION...

Set MySql Timezone information on Linux

In order to use the MySQL CONVERT_TZ() function on Linux which converts a datetime from one timezone to another, MySql needs timezone definitions and offsets which is dependent on the operating system in use. Otherwise CONVERT_TZ() returns NULL values. To do this on Linux, use MySQL's utility script, " mysql_tzinfo_to_sql ". Example usage: mysql_tzinfo_to_sql /usr/share/zoneinfo This returns a sql script to run to setup the timezone information. The following will setup the timezone information directly: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql Now you can view your timestamps in local timezone: SELECT CONVERT_TZ('2010-01-02 00:00:00', 'UTC', 'America/Chicago' );