DIY: Focus 2005 clutch pedal return spring replacement

Summary: this post describes how to install a new clutch pedal return spring for a Ford Focus 2005. Horrible job, but doable, and saves you approx. 80€ (in Finland).

  1. Buy a new spring from your Ford dealer, should be around 5€.
  2. Buy some washers that have approx. the same diameter as the spring (~1cm).
  3. Fit approx. 23 washers to each coil (on both sides) of the spring, to stretch it.
  4. Move the driver’s seat to its rearmost position to improve working conditions.
  5. Lift the steering wheel column to its upmost position to improve working conditions.
  6. Grab a flashlight, lay on your back, place your head next to the pedals and look up. Twist your arm to an akward position to be able to work.
  7. Fit the shorter hook of the spring to the metal plate on the chassis behind the pedal. The hole is barely visible. See rightmost arrow in Picture 2.
  8. Fit the longer hook of the spring to the top of the pedal (it has a small notch to keep the hook in place). See leftmost arrow in Picture 2.
  9. Depress the clutch pedal all the way down to remove the washers, then pull/push out any remaining ones that did not fall off.

Picture 1: Spring with washers (some have already fallen off at this point):
Hooks
Picture 2: Spring hooks in place (longer hook on the left, shorter hook on the right):
Hooks
Picture 3: Finished (with washers removed):
Done

Reference: http://www.fordownersclub.com/forums/topic/6944-clutch-pedal-return-spring/.

HTH,
Jukka

Yet another JUnit test pattern

Testing document templates: generate PDFs in a JUnit test and open them up in Acrobat for immediate visual feedback. Use a random temporary file to avoid file locking.

protected final void renderDocument(String template, Object model)
        throws IOException {
    File folder = new File("target/pdf"); folder.mkdir();
    File pdf = File.createTempFile("test", ".pdf", folder);
    FileOutputStream fos = new FileOutputStream(pdf);
    try {
        new Document()
            .model(model)
            .template(template)
            .renderer(Renderer.FO_TO_PDF)
            .renderTo(fos);
    } finally {
        IOUtils.closeQuietly(fos);
    }
    Assert.assertTrue(pdf.length() > 0);
    if (Desktop.isDesktopSupported()) {
        Desktop.getDesktop().open(pdf);
    }
}

Document uses a Freemarker template and the passed-in model to generate XSL-FO, which in turn is passed to Apache FOP for PDF generation.

-Jukka

Simple email form dialog

Though I’m generally more aligned to writing backend code, sometimes it’s nice to write code that you can actually click. Here’s a simple email form template with attachment support. The form uses JQuery, which is referenced via Google’s CDN.

Feel free to use and/or modify the template as you see fit.

Regards,
Jukka

JRebel = Cool

If you’re doing Java web application development and are sick and tired of restarting your app server whenever making changes to classes / configuration, check out JRebel.

JRebel reloads modified classes and resources automatically upon save. It also works nicely with Spring, among other things. And it’s really easy to use (through an Eclipse plugin).

- Jukka

Spring Security 3.0.x HTTP digest authentication configuration sample

Here’s a sample configuration file for HTTP digest authentication with Spring Security 3.0.x. Have a look at the xml comments for details.

The configuration was produced following the guidance given in Luke Taylor’s recent blog entry.

UPDATE: Apparently this can also be done using the security namespace like so:

<http entry-point-ref="digestAuthenticationEntryPoint">
    <intercept-url pattern="/**" access="ROLE_USER" />
    <custom-filter ref="digestAuthenticationFilter" position="BASIC_AUTH_FILTER" />
</http>

HTH,
Jukka