Because I am a techie geek

Ubuntu 13.10 -> 14.04 Upgrade failed when dual booting using the Windows Boot Manager

I upgraded my Ubuntu box from 12.10 to 13.10, and amazingly it worked flawlessly, but then I got cocky and upgraded to 14.04 to get on a LTS version.

This of course did not work.

I am dual booting, using the Windows Boot Manager, but when I chose the Ubuntu option, I would get a black screen and a fast blinking cursor. And nothing…

I had to re-do the creating to the boot bits needed for this configuration, which I did by booting to a liveDVD, and doing the following:

dd if=/dev/sdX of=/mnt/ubuntu/System/ubuntu.bin bs=512 count=1

Where sdX is the boot partition, and my Windows partition was mounted at /mnt/ubuntu/System, and I had previously configured (using bcdedit) the Windows Boot Manager to boot from the ubuntu.bin file.

Partial import from SVN to GIT with history and multiple branches

GIT comes with some nice built in functionality for importing into GIT from SVN, but when you break outside the expected, things get a little weird, a little fast.

I have been doing some migrations of some of a code base from SVN to GIT, but in keeping with the GIT best practices, each artifact gets its own repo, unlike SVN, where everything typically lives in one monolithic hierarchy.

This does not work out of the box, using the basic options. You will want to follow the bit about creating a users.txt file, and the parts for converting tags and branches to GIT branches, however for the clone itself, I found this to work better for me:

git svn clone https://your-svn-server/path/to/repo/ -T path/to/sub-tree/that/is/being/imported –authors-file=users.txt –no-metadata

Hope that helps someone, and maybe even me when I need to do it again and cannot remember how…

WordPress Thumbnails not getting created

On the latest incarnation of the blog, using WordPress, I use a theme called Portfolio Press, which dynamically generates a page based on the posts which are of the “Image” or “Gallery” post format. Except that it was not working correctly – the sizes of the images were different, causing the grid to have a weird layout (float left css anyone?).

I spent a bit of time trying to get the css to do the right thing, got it figured out so that I could cause the pictures to be truncated, but it still did not seem right – the author of the theme had obviously put too much time into the there to have overlooked this use case, what was I doing wrong?

Turns out it is a WordPress (documentation?) defect – when images are uploaded, it is supposed to be creating thumbnails, which are cropped as required, so that the images are all exactly the same size, and of course then the css float works just great. But this was not happening, and when using the Regenerate Thumbnails plugin, I was getting no errors. But the thumbnails were certainly not getting created.

The root cause is that the php-gd extension was not installed – once I installed that, regenerated the thumbnails, and everything now works great. Would have been nice if generating the thumbnails, either during upload, or during the regeneration, had given an error indicating that something was not working…

Spring Bean Identity Crisis

I recently ran into, again, a problem with Spring Beans not having an id. While using Spring XML configuration files, the id attribute is optional. However, if the Spring configuration file in question is imported from multiple places, the Bean will be created multiple times, once for each import.

For a very contrived example, say you have file A.xml:

<beans>
    <bean class=”com.example.JobScheduler”>
        <property name=”howOften” value=”10″>
    </bean>
</beans>

And file B.xml:

<beans>
    <import resource=”classpath:A.xml” />
</beans>

And file applicationContext.xml:

<beans>
    <import resource=”classpath:A.xml” />
    <import resource=”classpath:B.xml” />
</beans>

You would end up with TWO JobScheduler instances, each one happily kicking off jobs every 10 somethings.

This is of course not a problem for a Bean that does not “do” anything. But for a Bean that creates its own threads, runs in the background, etc, this can be a definite problem.

So, remember, don’t leave your Spring Beans wondering who they are, give them an ID, so they only get created once.

WordPress Simple-LDAP-Login plugin

Trying out WordPress to replace the aging installation of MovableType that this blog is run on, and ran into a few issues with the Simple-LDAP-Login plugin.

In the Advanced section, configure the LDAP Login Attribute – it claims that you only need to set it if it is something other than uid, but in practice it was not sending an attribute if I did not set the value, so the bind dn looked like “=<username>,<base_dn>”.

Unfortunately, turning on the LDAP Exclusive flag seemed to have no impact, so I will just have to create WordPress user password as very obtuse, so the fallback does not fallback to an easily hacked password.

New look for the site

Last year I put some work into moving our personal site off of a Python code base running on Apache to a Java/Wicket/Hibernate code base running on Tomcat, and I finally got around to getting it on the live site today.

I made the change for a couple of reasons. The first was that I was going to be moving to a new position at Cisco, which was using Java/Wicket/Hibernate, but the move was not going to happen for a couple of months, and I wanted to ramp up early on the technologies, so what better way than to re-write our site from the ground up – jump in the deep end as it were.

The second reason was that while I like Python, it really is more of a scripting language than something that is good for writing applications in, and it does not encourage you to maintain good code hygiene, and thus I had let the code become something of a tangled mess that was hard to make changes to unless I was in it pretty often. I think I have structured my code a bit better with the new site, so I should be able to come back to it in 6 months and make some changes without trying to figure out what moron wrote the code and why he did it the way that he did 😉

Third but not last, the newer technologies are going to make it easier to add dynamic content to the pages that do exist, without doing complete overhauls of the pages. Hence the links to current blog and twitter posts from the front page.

Hope you like the new look!