It is a useful reference to quickly see how the different flavours perform some common operations.
Monday, 23 November 2009
SQL info for oracle/sqlserver/mysql
While performing some testing to ensure my app was compliant with multiple db flavours I came across this site.
Friday, 6 November 2009
humax PVRs and the digital switch over
I have two Humax PVR freeview recorders that have been running quite happily for several years.
The 4th November was our official DSO date for the north west and suddenly most of my BBC channels had gone.
My two PVRs are a new 9300T and an aging 8000T.
A retune on the 9300 brought BBC back but with BBC1 on channel 800. The 8000T could not find BBC anywhere.
The fix for the 9300 was to go to the Installation Menu, select the 'Default Setting' menu, enter the pin code and reset the box. Low and behold BBC1 was back on channel 1.
However the 8000 was proving more awkward. For this box I performed a software update request from tyhe system menu. Despite not saying that any of the versions had changed this fixed the problem and BBC1 is now back on channel 1.
In parrallel I did email humax on UKSupport@humax-digital.co.uk and congratulations to them I did get a very prompt reply but I had fixed the problem by the time I had read the email. For interest they said to do the following:
Please follow the steps below to perform a Default reset;
1. Power OFF the receiver
2. Disconnect the Aerial cable
3. Power On the receiver
4. Press MENU
5. Select Installation
6. Enter your password (default = 0000)
7. Select Default Setting
8. Select YES
9. Enter your password (Default = 0000)
10. When the receiver restarts, power off
11. Connect the Aerial Cable
12. Power ON - the receiver will then search for the channels.
Thursday, 23 July 2009
Eclipse, workspaces and JREs
Be aware that installed JREs are workspace specific.
IE. Your default JRE might be the MyEclipse 6.0.
You install and add Java 1.5 JRE and make this your default.
Then three months later you create a new workspace.
Low and behold this new workspace does not know about the 1.5 JRE.
Sunday, 12 July 2009
Manchester to Blackpool bike ride
Just a quiet shout out for my eldest son Ben who rode and completed the Manchester to Blackpool bike ride today, all 60 miles at the ge of 11, raising money for Marie Curie, £150 so far.
He is feeling a tad tired tonight.
Awesome Ben - well done.
If you happen to read this please donate.
He is feeling a tad tired tonight.
Awesome Ben - well done.
If you happen to read this please donate.
Friday, 10 July 2009
EasyMock - Reason to update to the latest version
I have recently started working on a new project that consisted of three dependant Java projects.
These three projects were using two different versions of EasyMock so first off I decided to bring them into line. The projects are all Java5 but one project had EasyMock 2.4 and the other two had EasyMock 1.3
Following on from Andrew Beacock's article on using easy mock's class extensions I decided to give that a go.
Strangely after upgrading some of the tests were failing. Why ?
Well it looks to me like a bug in the old version of EasyMock 1.3,
so the easy answer is upgrade. The bug appears to be that you can not call MockControl.expectAndDefaultReturn() more than once.
Here is the test using the old code, and below that a test class using 2.4.
EasyMock 1.3 version:
EasyMock 2.4 version, using the class extensions jar:
These three projects were using two different versions of EasyMock so first off I decided to bring them into line. The projects are all Java5 but one project had EasyMock 2.4 and the other two had EasyMock 1.3
Following on from Andrew Beacock's article on using easy mock's class extensions I decided to give that a go.
Strangely after upgrading some of the tests were failing. Why ?
Well it looks to me like a bug in the old version of EasyMock 1.3,
so the easy answer is upgrade. The bug appears to be that you can not call MockControl.expectAndDefaultReturn() more than once.
Here is the test using the old code, and below that a test class using 2.4.
EasyMock 1.3 version:
package uk.co.utilisoft.entrecaweb.web.validators;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
import org.easymock.MockControl;
public class TryOldEasyMock extends TestCase{
public void testSingleCall(){
List<String> list = new ArrayList<String>();
list.add("hello");
MockControl control = MockControl.createControl(TestMock1.class);
TestMock1 mock = (TestMock1)control.getMock();
ClassUnderTest1 classUnderTest = new ClassUnderTest1();
classUnderTest.setService(mock);
control.expectAndDefaultReturn(mock.getLength("hello"), 5);
control.replay();
assertEquals(5, classUnderTest.getLength(list));
control.verify();
}
public void testTwoCalls(){
List<String> list = new ArrayList<String>();
list.add("hello");
list.add("bye");
MockControl control = MockControl.createControl(TestMock1.class);
TestMock1 mock = (TestMock1)control.getMock();
ClassUnderTest1 classUnderTest = new ClassUnderTest1();
classUnderTest.setService(mock);
control.expectAndDefaultReturn(mock.getLength("hello"), 5);
control.expectAndDefaultReturn(mock.getLength("bye"), 95);
control.replay();
assertEquals("this is the wrong value & should fail.", 190, classUnderTest.getLength(list));
assertEquals("this is the correct value & should pass.", 100, classUnderTest.getLength(list));
control.verify();
}
}
class ClassUnderTest1{
private TestMock1 service;
public void setService(TestMock1 service) {
this.service = service;
}
public int getLength(List<String> someText)
{
int total = 0;
for (String value : someText) {
total += service.getLength(value);
}
return total;
}
}
interface TestMock1
{
public int getLength(String someText);
}
EasyMock 2.4 version, using the class extensions jar:
package uk.co.utilisoft.entrecaweb.web.validators;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
import static org.easymock.classextension.EasyMock.*;
public class TryEasyMockTest extends TestCase {
public void testSingleCall()
{
List<String> list = new ArrayList<String>();
list.add("hello");
TestMock mock = createMock(TestMock.class);
expect(mock.getLength("hello")).andReturn(5);
ClassUnderTest classUnderTest = new ClassUnderTest();
classUnderTest.setService(mock);
replay(mock);
assertEquals(5, classUnderTest.getLength(list));
verify(mock);
}
public void testTwoCalls()
{
List<String> list = new ArrayList<String>();
list.add("hello");
list.add("bye");
TestMock mock = createMock(TestMock.class);
expect(mock.getLength("hello")).andReturn(5);
expect(mock.getLength("bye")).andReturn(95);
ClassUnderTest classUnderTest = new ClassUnderTest();
classUnderTest.setService(mock);
replay(mock);
assertEquals(100, classUnderTest.getLength(list));
verify(mock);
}
}
class ClassUnderTest{
private TestMock service;
public void setService(TestMock service) {
this.service = service;
}
public int getLength(List<String> someText)
{
int total = 0;
for (String value : someText) {
total += service.getLength(value);
}
return total;
}
}
class TestMock
{
public int getLength(String someText){
return someText.length();
}
}
Wednesday, 8 July 2009
Testing Times - Freezing Times
I have found many tests that want to set a time in a class and then test that that object has the correct time set.
Often these tests will pass when run locally as unit tests but either fail as integration tests which tend to be slower or fail when run on a heavily loaded build server.
I came across the solution on Mark Needham's Blog making use of a joda-time.
There appears to be may other usefull classes such as LocalDate, a class that just holds the date, yep the bit that says 25/12/2009 with no time representation, ie just a date !!!
Often these tests will pass when run locally as unit tests but either fail as integration tests which tend to be slower or fail when run on a heavily loaded build server.
I came across the solution on Mark Needham's Blog making use of a joda-time.
There appears to be may other usefull classes such as LocalDate, a class that just holds the date, yep the bit that says 25/12/2009 with no time representation, ie just a date !!!
Monday, 15 June 2009
Eclipse - java.lang.RuntimeException unable to get class information for @throws tag for SomeException
Working in Eclipse, I had a previously working project that I had closed.
After reopening it I found it was littered with apparent errors,
that were not there before.
Somehow checkstyle had got confused. Simply turning checkstyle off and back on again removed all the errors.
After reopening it I found it was littered with apparent errors,
that were not there before.
Somehow checkstyle had got confused. Simply turning checkstyle off and back on again removed all the errors.
Subscribe to:
Posts (Atom)