Forwarding email, it just keeps breaking!

Popsicle sticks and duct tape for the win! Well, IFTTT and Firebase anyway.

I run an SMTP server so that I can get email at foo@hraban.com (well obviously not foo, but you get what I mean), but I don’t want to run a full on web mail reader that is exposed to the internet. So I just forward incoming email to specific addresses (I am not running an open relay here folks!) to an external email address at a popular free email service.

But this keeps breaking, for one reason or another, because my ISP SMTP server keeps rejecting my outgoing email, but not telling me, so we don’t find out until a friend tells us that email they sent us has bounced – less than ideal.

IFTTT and Firebase to the rescue! I setup a cron job to send an email out to IFTTT, where a recipe triggers that updates a Firebase record with the received time. The cron job also fetches the received time and checks to see that it has not been too long – if it has been, then it fires off a request to the IFTTT Maker channel, which sends a notification to my phone when triggered.

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.

Marriage != Marriage

The nation is raging about gay marriage this week, and just about everyone is all worked up over what I see as merely, ironically enough, homonyms/homographs.

Part of our society believes that marriage is a covenant before God, between a man and a woman, and was instituted at the beginning of human history. I am going to lose a bunch of you at this point when I say that I believe this, but please read on, for a little bit longer, I might just surprise you.

Another part of our society believes that marriage is a contract between two consenting adults and the government, and is defined by the government. I believe this as well. And now I have just lost the rest of my readers…

If you are still here, you are hopefully asking, “How does that work, aren’t they are conflicting opinions?!?!”

Well since you asked, I do not believe they are, and here is why…

The fundamental problem is that marriage is both of these things, or rather I should say that marriage-a is the first, and marriage-b is the second, but marriage-a is not the same as marriage-b. At some point in the past, marriage-a was always entered into at the same time as marriage-b, and the two became associated so closely that they became the same thing, for at that point in time they were compatible, and there was no issue.

The problem is that now marriage-a and marriage-b are no longer the same thing, but we have not been able to comprehend that they are not the same thing. One group is shouting that we need to change marriage to allow for the two adults to be of the same gender, and another group is shouting that marriage cannot be changed, it is defined by God as between a man and woman. If we can all understand that we are arguing about different things, and remove the association between the two things, I think we will all be able to un-wad our panties, at least about this.

I see marriage-a as defined by a religion (term used very loosely here), and as such has many definitions, including conflicting ones. However, if the marriage is only relevant within the context of the religion, it really does not matter much whether the definitions differ, since those adherents of religion-a should only really be concerned with how marriage is defined in religion-a, and how marriage is defined in religion-b only affects those who are adherents of religion-b.

Likewise, if we can limit marriage-b to the governmental realm, it is free to be defined by the government as it so desires, and since the definition only matters insofar as it affects the interactions between the government and the parties involved, and it does not have any bearing on the definitions of marriage-a, then we should not have any problem.

Thus two consenting adults are free to participate, or not, in the the governmental definition of marriage, such as the people of the governed country have determined it should be defined. Those two same people are also free to participate, or not, in the marriage as defined by the religion, or not, of their choice. The two institutions of marriage need not be entered into at the same time, and they are most definitely not entered into for the same purpose.

All those who have chosen to enter into the governmental institution of marriage should be treated equally insofar as the it affects the interactions with the government. Not an exclusive list by any means, but this should apply to tax status, ability to legally co-own property, participate in shared health care plans, be able to make decisions about their partner’s health care when that partner is not able to do so themselves, etc.

Likewise, all religions should be free to have their own definition of marriage, and it would only affect those who are adherents of that religion, and thus affects no one else. Separation of church and state is just as much, if not more so, to protect the church and religious freedom from the state, as it is to protect the state from the church.

It all comes down to words, but our society has so far been able to deal with the word “fair” meaning both a place to get ripped off by carnies, and something that is just and equitable, I think we should be able to deal with marriage having two different meanings as well.