May 09

SVN Syncing

So I just spent a good half of the day today trying to figure out how to sync two repositories together. We’re moving repositories, and so we had to import data from one repository to the other. However, this process took a while, so once we had imported the data into the new repository it was several revisions out of date. There didn’t seem to be a way to use SVN tools to do this. So, I went and wrote a script which would take all the changes from one repo and commit them to the other one with all the data. This was needed because we didn’t have shell access to the new SVN repo, and because of how that repo has to be set-up it would be somewhat infeasible to do another SVN dump.

There are a few limitations with this; there’s no way to add new files to the repo(though you could probably do an svn add right before you commit). There’s also no way to delete any files. In our case, this is not a problem, as there have been only file modifications.

Before you do this, you must checkout both repositories into different directories.

So, without further ado, here’s the code:

#!/bin/bash

ORIG_DIR=<original directory>
NEW_DIR=<new SVN directory>
START_REV=<start revision of original SVN>
END_REV=<end revision of original SVN>
CURRENT_DIR=`pwd`

while [ $START_REV -ne $END_REV ]
do
cd $CURRENT_DIR
cd $ORIG_DIR
svn update -r "$START_REV" #update to next revision of old directry
let "START_REV += 1"

cd $CURRENT_DIR
echo "About to diff, this may take a while..."
diff -qr --exclude=".svn" $ORIG_DIR $NEW_DIR > /tmp/svn_out_orig #figure out what files changed
cat /tmp/svn_out_orig | grep Only > /tmp/svn_diff_files
cat /tmp/svn_out_orig | grep Files > /tmp/svn_out
LINES=`wc -l /tmp/svn_out | cut -d' ' -f1` #how many files changed?
cat /tmp/svn_out | cut -d' ' -f2 > /tmp/sources
cat /tmp/svn_out | cut -d' ' -f4 > /tmp/dests
echo "LINES = $LINES"
while [ $LINES -gt 0 ]
do
    SOURCE=`sed -n "$LINES"p /tmp/sources`
    DEST=`sed -n "$LINES"p /tmp/dests`
    cp $SOURCE $DEST #copy each file that changed to the new directory
    let "LINES -= 1"
done
cd $ORIG_DIR
LOG=`svn log --xml -l 1 | grep msg | sed 's/<msg>//p' | sed 's/<\/msg>//p'` #get the log message for  that commit
cd $CURRENT_DIR
cd $NEW_DIR
echo "ABOUT TO COMMIT"
svn commit -m "$LOG" #commit with message

done
Apr 17

Without a Title

A few years ago, a friend of mine gave me a draft of a book to read, called Without a Title. Well, I read it at that point, and let me tell you, it was freaking hilarious. I told my friend to tell me when it was published; he never told me, and I never found it anytime that I searched for it online.

Until the other week.

Yes folks, published two years ago, is Without a Title. Why is this book so hilarious? Well, let me reprint the first few sentences here for your reading pleasure:

Once upon a time in a far off kingdom there lived a beautiful princess who was homicidally insane. She lived in a time that never really existed. It was a time of knights and kings and damsels who caused distress. It was not the accurate historical Middle Ages where half the population walked around with rotting teeth. No, these were the Middle Ages that are featured in animated films with singing forest creatures that appear on lunchboxes in every red brick schoolhouse in suburbia. It was a time in which knights could read, peasants would bathe and the main characters always had perfect hair.

Seriously, how could that not be a great story?

Of course, what I also really love is the large number of puns in the story. Such as Mike Rosoft’s dealings with Mr. Apple. Or perhaps the various… oddball methods of torture. Really. Trust me on this one, it’s hilarious.

All in all, I would give this 5/5 stars. It’s totally hilarious, with a great number of puns and jokes that just make you want to continue on.

Oh, before I forget, here’s the book on Amazon.

Mar 24

Stripping Katos

Alright, so I’m working on an SD40 here, a Kato unit to be exact. And I tried to strip the paint off of it. First, I tried using rubbing alcohol. That didn’t work too well. Then I put it in some brake fluid, as that seems to strip other locomotives. It didn’t get fully stripped, but what I suspect is that a few rounds alternating between the alcohol and the brake fluid would strip it fairly well. These pictures might not show it too well, but the piece underneath the cab was stripped quite well; the main shell, not so much, and the deck practically nothing.

The pictures don’t show it quite well, but the paint is cracked in several places. It’s a cool effect that I would keep if I were not re-painting it; as it is, I’m just going to paint over it. If some of it shows through, I’m not too concerned about it because it will be a cool effect.

Picture 1

Picture 2

Picture 3

Jan 19

SOPA and PIPA

By this time, you have probably heard quite a lot about SOPA and PIPA, so I won’t repeat that stuff here. I will however say that these bills must be stopped. And so, until they are stopped, we will continue to fight the good fight. Yes, we may be on the side of pirates. But it’s better to have the freedom that we have today than the totalitarianism of tomorrow.

Fight the good fight!

Oct 12

Steve Jobs

So, I realize that I haven’t posted anything new here in like four months. But since nobody reads it, who cares?

Anyway, as you know, Steve Jobs of course passed away the other day, and there was a bit of controversy surrounding a remark made by Richard Stallman. Here’s the quote:

Steve Jobs, the pioneer of the computer as a jail made cool, designed to sever fools from their freedom, has died.

As Chicago Mayor Harold Washington said of the corrupt former Mayor Daley, “I’m not glad he’s dead, but I’m glad he’s gone.” Nobody deserves to have to die – not Jobs, not Mr. Bill, not even people guilty of bigger evils than theirs. But we all deserve the end of Jobs’ malign influence on people’s computing.

Unfortunately, that influence continues despite his absence. We can only hope his successors, as they attempt to carry on his legacy, will be less effective.

Now, needless to say, this caused a bit of controversy. In some regards, Stallman has a point here – that Jobs made Apple into such a closed platform that it’s impossible to do stuff. While this is definitely true, on the flip side who needs unnecessary complications in your software? Most people don’t. In that regard, the iPhone/iPod are excellent platforms for software. They’re very simple, which on a small device is exactly what you want. You can’t use a desktop environment easily when you have scrollbars on the side. You don’t have the finesse of a mouse.

This “simplicity is key” design has been dominating Apple products ever since the first iPod. While this is good for most users, what I think that Stallman was getting at was that for the more power users, they don’t have all the options that they want. Let’s take the new Macbooks for example: there are a grand total of two USB ports, and just one button besides the keyboard on it(the batter charge button). It does look very sleek, but I have a hard time using it because the edges are very sharp and cut into my hands/wrists when I am typing. Possibly that’s a good thing, because it would promote better key typing posture, but it’s annoying.

Now, having two UBS ports is perfectly adequate for most people. However, people like me, whom (for lack of a better term) I call “power users” require more than two USB ports at a time. One of my co-worker’s USB ports on his Macbook is broken and only charges. My EEE PC has three USB ports on it, and is about half the size of a Macbook.

So, what’s my point here? I don’t disagree about any particular part of Stallman’s quote, but that perhaps what has been done is at least a step in a right direction. Too often, software has seemingly hundreds of buttons and controls – Apple realized that this was not a good way to use software, as did Microsoft when they came out with Office 2007. The biggest problem is that Apple wants complete control over everything. That’s fundamentally what the problem with Jobs is. He had a vision for simplicity – but he wanted it to be too simple. When you make it too simple, you remove the capability to do more advanced tasks.

This video, from The Onion, sums it up quite nicely.

Jun 12

Linux and Installing

So I’ve been working on a way to have C callback functions call member functions of a C++ class. To do that though, I’m upgrading to gcc 4.6, because there are some new features in c++0x that I think could help me solve this problem easily.

However, upgrading to a new version of gcc is apparently totally fucking impossible. I’m currently installing it from debian-main, because my computer runs Aurora OS, which is based off of an older version of Ubuntu. So, in order to upgrade, I first went to the gcc website and downloaded the source. However, it turns out that the source also has some dependencies. So I went and downloaded and installed those. Then I tried to actually compile the thing, and about an hour later it errored out.

Seriously.

For whatever inane reason, gcc just refuses to compile on my system. I tried reconfiguring, and I even tried going to an Ubuntu PPA, but it just did not like that.

This is one of the reasons that I find Linux so very annoying at times. There’s no easy way to install things. On Windows, you generally just download an installer, it does a few things, and then BAM! you can run the program. Linux is a lot more complicated. Especially because many programs you download and install the source. Seriously, would it be too hard to provide a nice simple way to do this? Moreover, why are there several locations for you to put binaries? You have /usr/local/bin/, /usr/bin, /bin, etc. There’s a bunch of random places that you could hide something. It’s very simple on Windows generally. It would be really nice if we could get something like this for Linux, like a more advanced RPM or something like that. Because I’m in about hour five of trying to upgrade gcc here, and this is just fucking bullshit.

Jun 12

Site Updates

Oh goody goody, I’ve updated the website! What changes do we have in store right now?

Well, we are now using NBBC to do parsing of BB code and related stuff. This means that the style of the website has changed slightly, but I find that’s acceptable.

I came across NBBC the other week when I was looking for a BBCode parser. I realized that it was rather dumb of me to write my own parser. While it would be cool, it would take a long time and potentially wouldn’t work so well. So, we took something that was already made and then slammed it into the website. So far, so good though. 🙂

May 20

Comments

Holy moley, that’s a lot of comments!

Unfortunately, they’re all spam. On the bright side, adding comments apparently works!

To prove it to you:

mysql> DELETE FROM comments;
Query OK, 311 rows affected (0.12 sec)

Yeah… we’ll be integrating a CAPTCHA system soon, possibly tomorrow.

On the bright side, this website is actually being utilized! Of course, perhaps that’s not such a great thing… Ah well, what are you going to do?