Go back in time with Oracle

Today, I was needing to change the system date of a Linux server hosting and Oracle database.

It seems that Oracle has some king of internal epoch. Restarting the database with a date to far in the past will end into and internal error.

In my case, 2000 is the limit. Any date before that and Oracle won't start. Cute. 

Solve the (no author) issue when migrating from Git to SVN

These days, I'm migrating Subversion repositories to Git.

I've followed this blog post that hasn't failed my so far.

However, today, this command
git svn clone https://svn.mysite.com/repo --authors-file=users.txt --no-metadata --stdlayout repofailed because of a mysterious "(no author)".

The explanation is that Subversion seems allow a check-in by no one. Classically, the first check-in on Google Code for instance.

To solve it, just add
(no author) = Joe Smith <joe.smith@gmail.com>
at the end of your user file. The person should obviously be a meaningful one (like the guy who has created the project on Google Code).

EasyMock 3.2 is out!

EasyMock 3.2 was just released.

Two main features:

Android support

Is it now possible to use EasyMock on Android. Thanks to Jesse Wilson for his help on this topic.

@Mock and @TestSubject annotations

A long awaited feature allowing to do code like this:

@RunWith(EasyMockRunner.class)
public class AnnotatedMockTest extends EasyMockSupport {
  @TestSubject
  private final ClassTested classUnderTest = new ClassTested();

  @Mock
  private Collaborator collaborator;

  @Test
  public void addDocument() {
    collaborator.documentAdded("New Document");
    replayAll();
    classUnderTest.addDocument("New Document", new byte[0]);
    verifyAll();
  }
}

instead of

public class AnnotatedMockTest extends EasyMockSupport {
  private final ClassTested classUnderTest = new ClassTested();
  private Collaborator collaborator = createMock(Collaborator.class);
  
  @Before
  public void before() {
    classUnderTest.setCollaborator(collaborator);
  }
  
  @Test
  public void addDocument() {
    collaborator.documentAdded("New Document");
    replayAll();
    classUnderTest.addDocument("New Document", new byte[0]);
    verifyAll();
  }
}

The complete release notes: http://jira.codehaus.org/secure/ReleaseNote.jspa?projectId=12103&version=17851

Save a part of the URL with Gatling

I really like Gatling. Mainly because the scenario are coded in Scala. Don't get me wrong. I don't like Scala. It's way too complicated for its own good. But I do like to have scenarios written in a real programming language and a nice DSL.

So today, my goal was to retrieve a magic token that was appearing in my response URL to be able to reuse it for other URL.

Here's how to do it:

exec(http("home")
  .get("/")
  .headers(headers)
  .check(currentLocation.transform(s => {
    val pattern = """.*/beforemytoken/(.*)/.*""".r
    val pattern(temp) = s
    temp
  }).saveAs("magictoken"))
)
.exec(http("query")
  .get("/${magictoken}/stuff")
  .headers(headers)
)

Delete a Git remote tag

Easy when you know it. But almost impossible to guess.

git tag -d my_tag_name
git push origin :refs/tags/my_tag_name

Thanks to Nathan Hoad for this tip.

How to change the language of an entire Powerpoint

I tend to do a bit more Powerpoint that I would like to.

Today, I had to translate one. So to get correct spelling checks, I wanted to modify the Proofing language.

That’s how to do it:

  1. Open the Outline view
  2. Select all the text in the view
  3. Go to the Review tab
  4. Select Language -> Set Proofing Language
  5. Now select any language you like. It will be applied to the entire document

Yes, I promesse, the next entry will be more technical.