Tuesday, January 17, 2012

This tab has been recovered

Ran into a strange issue where Internet Explorer would load the page fine then on reload would die and complain about the page not rendering properly and it would choke and refuse to load the page again.

Anyway, after some time of messing around I found that a 5 second delay loading the javascript fixed it...but it didn't seem right. So I kept digging.

Turned out it is a jquery bug. Basically if you have a background image on your body tag and you load your css before your jquery lib it fails.

Internet Explorer Browser, did I mention that I hate it? I was using IE8 I'm sure 9 is fine.

Tuesday, February 8, 2011

Integration testing a mvn java spring jdbc app

Basically all you really need is to make sure that the spring resources are on the build path when you're tests run.

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<!-- <exclude>**/*.java</exclude> -->
</excludes>
</testResource>
<testResource>
<directory>../consultantreg-config/references/default</directory>
</testResource>
</testResources>
</build>

Then, in your actual junit test, make sure you have it properly annotated:
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/applicationContext-common.xml"})
public class IntegrationTestsSomeJdbcDao {

Wednesday, January 19, 2011

Inluding multiple javascript files via javascript

The problem is typical: How can I include a javascript library or multiple .js files with only 1 javascript include.


Basically, here's a quick sample using jquery, though obviously it can be done without it.


js1.js {
$('head').ready(function() {
$('head').append('<script language="JavaScript"
type="text/javascript" src="http://javascriptFile2.js"></script>');
});
$('head').ready(function() {
$('head').append('<script language="JavaScript"
type="text/javascript" src="javascriptFile3"></script>');
});
}

That's all there is to it. Now javascriptFile3 can access the methods of javasriptFile2.