Selenium WebDriver annotations and firefox connection trouble

I needed to run some selenium tests written by a Java team using maven

I ran into a couple of errors

 

Annotations are not supported in -source 1.3

This error is because by default maven comples code to be compatible with an older version of Java

To fix I had to add the foloowing to then pom.xml file

Read more

Device eth0 does not seem to be present, delaying initialization.

I had a centos VM that I hadn't used in a while, I think I cloned it from another version.

When I came to use it again I had no network andtrying to start the network I got the error message in the title.

There seem to be a few issues

Firstly netowrking isn't endabled by default

http://wiki.centos.org/FAQ/CentOS6#head-b67e85d98f0e9f1b599358105c551632c6ff7c90

Read more

Can't login to Drupal (404)

I've been working on a project for a while on my main dev machine, but needed to run it on my laptop too.

Usually copying a sitre across is quick but this time I re-installed the OS too, everything wnet OK except for some reason I couldn't log in to my drupal site.

Eventually I noticed that while the site appeared to be working, every page was being served with a 404 header.

What happpend is that I hadn't enabled mod_rewrite

Read more

jMeter cookies and redirects

This just took me a while to figure out

I have a jmeter test plan which POSTs to a url, resulting in cookies being set and a redirect

I was not seeing the cookies retained.

The solution was to

enable "Follow redirects" and disable "Auto redirect" on the HTTP request sampler.

Tree view now shows the POST and subsequent GET separately - and the cookies are retained (I am using an HTTP cookie manager)

Another solution if you know what the redirect will be is to disable both redirects and add another sampler for the subsequent GET

Read more

verbose remote ssh (with echo)

I usually manage website deployment with bash scripts that run remote commands on the servers

In order that I can see what is going on and debug any errors verbose output is useful.

Running "bash -ex" causes each line to be output as it progresses and halt on any error so that you don't miss it.

within the remote command "set -x" cuase bash to echo all commands

#!/bin/bash -ex
ssh -T user@server << EOF
set -x
echo foo > /dev/null
EOF

Read more

Export from Git for Drupal site releases

I'm used to how svn export works, and have used this in a number of release scripts.

Git doesn't quite have an equivalent

There is

git archive

Which creates a tarball rather than a set of files, and while you can export a subset of the repository you still get the full path in the tarball.

and

git checkout-index

Which creates a set of files (these can be locate outside the working copy) but requires a local repository.

Read more

Instance parameter for drupal field_create_instance($instance)

The code in chapter 7 of pro Drupal development has a bug.

The $instance array that you need to pass to field_create_instance() needs to be as below.

Note that the display array has the keyword, 'default' for the default display - ie a node on it's own page 'teaser' looks like the right value for teaser. Other view modes are possible too.

Read more

node_save tags by term name with auto addition of new tags

Drupal lets you add a taxonomy term to a node and if you use the GUI you can have a nice auto-complete widget that takes term name - and iof the term doesn't exist yet you get a new term created when you save the node.

I wanted to access the same functionality on node I am generating from external data.

The key is to create the term array with tid = 'autocreate' - this and the vocabulary ID are enough to trigger the taxonomy module to lookup the tid for you - and adda new term is required.

<?php
$node = new stdClass();
$node->type='mytype';
$node-title='foo';

Read more

Using PHP and curl with http PUT on string data

This wasn't obvious

There are various other posts on this - but mostly assuming you will put a file.

In my case I want to put the contents of a string so I needed to craete a temporary filehandle.

<?php

function put_it($url, $string) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PUT, TRUE);
// create tempoary file handle
$oneMB = 1024 * 1024;
$fp = fopen("php://temp/maxmemory:$oneMB", 'r+');
fputs($fp, $string);
rewind($fp);
curl_setopt($ch, CURLOPT_INFILE, $fp);

Read more

RAID ext4 disk problems

One of those posts for myself in case I need to come back to this later

I have a new PC which is very fast apart from problems with disc access seeming slow (and the disks being physically noisy)

The following related links led me to try a solution

http://forums.gentoo.org/viewtopic-t-843292.html

http://marc.info/?l=linux-raid&m=128506852210452&w=2

/etc/fstab

UUID=317f7912-9956-41f1-9855-7bee69c950b3 / ext4 errors=remount-ro,barrier=0 0 1

NB adding barrier=0 here seems to have solved the problem

Read more