Category Archives: Programming

“git svn” Cheatsheet for Git Rebels in an SVN Workplace

This is my own use of git svn. No one in Google seems to have this mix listed out for a Subversion project with a proper trunk/branch/tag setup, so I decided to post what I’ve got.

Getting a repository:
git svn clone --tags <tags subfolder> --trunk <trunk subfolder> --branches <branches subfolder>
Updating SVN-tracking remote branches in git:
git svn fetch
Working on trunk:
git checkout master; git svn rebase
Working on a branch for the first time:
git checkout -b local/<branchname> <remote branchname>
Working on a branch:
git checkout local/<branchname>; git svn rebase
After committing, merging, or any other action that changed the local git repository, push to SVN:
git svn dcommit
Making a new branch in SVN:
git checkout master; git svn branch <branchname> -m "Branching for <reason or bug#>"
Making a new tag in SVN:
git checkout <tagged commit>; git svn tag -m "Tagging for <reason or release>"
Deleting a branch in SVN:
svn rm svn://host/path/to/branch; git branch -D local/<branchname>; git branch -D -r <branchname>; rm -rf .git/svn/refs/remotes/<branchname>
Deleting a tag in SVN:
svn rm svn://host/path/to/tag; git branch -D -r tags/<branchname>; rm -rf .git/svn/refs/remotes/tags/<branchname>
Merging a branch (properly):
git checkout <merge-to branch>; git merge --squash <merge-from branch>; git commit; git svn dcommit # --squash is key

Rule of Thumb for Detecting Poor Design

You know you’ve got a bad design, or at least one that could be improved, when you start copying and pasting code around. (Note: this doesn’t mean the design needs improving.)

Now, to brace myself for the rotten tomatoes I see headed my way…

Course Listing Database Project

I was just told by UMass Dartmouth that they wouldn’t be releasing publicly available data in a database format just so I, a mere student, could work on a simple project for what they deemed is likely only a personal project for my own benefit, without actually asking me what the project is about.

They then proceeded to say I was more than welcome to process the HTML-ified version of the course listing, which, they reminded, is a more ambitious project. What the…!? Are they trying to make my life difficult?

Well, you know what? I’m going to process that HTML, and then I’m going to push that database to my home directory on the UMass Dartmouth servers, so everyone can use it without bothering with talking to these people.

There shouldn’t be any problem with this, given that it’s already publicly available information. I think the real problem here is they just don’t have time for silly student ideas.

Edit: HTML processing code finished. I have an SQLite database of all UMass Dartmouth classes. 🙂

Portage Hooks

Now that school is done for the 2009-2010 year, I’m back at it in Neuvoo again. I’m finishing off a long-planned and fairly major addition to portage I call “portage hooks.” The fun thing is I’ve submitted some patches to zmedico and the response has actually been more positive than previous experiences. solar seemed to be (tentatively?) liking the idea as well.

So, here’s what portage hooks are all about. If you have portage-utils installed, you will have an /etc/portage/postsync.d/ directory. Scripts in this directory are executed after portage syncs the tree. I thought this was a great idea, and I thought it should be expanded so there are other opportunities for unofficial extensions. Continue reading

Backing up with Duplicity, Effortlessly

Duplicity has a wonderful design feature: it’s really really simple.

Duplicity has an annoying design flaw: it’s really really simple.

In case you didn’t notice, Duplicity‘s simplicity is both helpful and inefficient. It’s extremely easy to start using Duplicity because its usage is so very simple. Want to back something up? Just write “duplicity /some/directory ftp://user@host.com/some/other/directory” for FTP backup, or “duplicity /some/directory file://some/other/directory” for local backup, or any other protocol out of the 11+ protocols it supports. All it does is write files to the location of your choosing, and then it can recover and list files (either latest or at a date of your choosing) from the backup directory you give it.

This simplicity is really great for the simple use-cases, like backing up a home directory. It’s when you get into databases, exclusion and inclusion rules, and other such fine print that you have to plan a little.

I’ve got three different “things” I have to back up: my web development stage, my remote shell (mainly for irssi), and my home directory. Each one presents its own challenges, which I break down below. Continue reading

Using Gorg to Preview Gentoo Documentation

This is very handy if you’re working on Gentoo documentation, which is composed of XML that gets translated into HTML.

Alright, enough with the introductions. I’m just going to write how I got gorg to work.

  1. Install gorg. If you’re using Gentoo Prefix, and bug #281335 is not solved yet, use my Gentoo Prefix overlay to get it installed. (I only tested on OSX, though.)
  2. Copy /etc/gorg/gorg.conf.sample to gorg.conf, and begin editing it.
  3. Change the root variable to point to the directory where your copy of the Gentoo site will reside. I changed mine to:
    root = "/Users/jacob/Sites/gentoo"
  4. I’m not sure if this is required, or what this even does, but I changed the two mount variables to match root:
    mount = /cgi-bin on /Users/jacob/Sites/gentoo/xml/cgi-bin
    mount = /images on /Users/jacob/Sites/gentoo/xml/images
  5. I left everything else to defaults. Save, exit. The other sample files should/can be left as samples. It doesn’t affect gorg in any way negative, at least as far as I can tell.
  6. Now you’ll need to make a monster of a checkout:
    cvs -d :pserver:anonymous@anoncvs.gentoo.org:/var/cvsroot co gentoo/xml/htdocs
  7. When that’s done, either move the htdocs folder to the place indicated by root, or make a symlink. I opted for a symlink. This allows my gorg environment and my programming environment to remain at least organizationally (that’s a word!) separate.
  8. Run the following, replacing the “/User/jacob/Sites/gentoo” part with wherever you told root to point:
    xmlcatalog --create /Users/jacob/Sites/gentoo/index.xml >> /etc/xml/catalog
  9. You should be viewing Gentoo’s home page, albeit with images and other things missing. Congrats!

Now, to finish off the work on Gentoo Embedded’s documentation…

Narvenyl Likes Spiders

Indeed, where would I be without them? Narvenyl’s new DataSpiders create new possibilities in database abstraction that makes me “geek out”.

The problem is simple. You define what each table looks like, and you can get data from each table in a nice list of objects. However, you can’t minipulate that data, or extend beyond one table, before the results are compiled into an orderly format and returned back to the caller.

From your, the programmer’s, point of view, you ask for purchase #382 from your store’s database, and you get purcahse #382. You know what is inside that object, because you’ve defined what fields are in each object.(For example, the fields “date” and “payment type” are very predictable. However, what about a field called “purchased”? Suddenly, you no longer have a simple, easy-to-store value. Now you have a list of items with their own values!

SQL developers know exactly what I’m talking about. You SELECT data from a database, and then you SELECT more afterwards to get the related data, such as items purchased, addresses used, etc. All this is done largely by hand.

Narvenyl is supposed to automate this kind of task, but how? The fields are defined, and you query those fields and return them. It’s fairly inflexible. Continue reading

Narvenyl Progress (Summary: Slow)

The supply of time has been continually decreasing at the same time demand is increasing. I’m talking about the combination of holidays, deadlines at work, and other such nuisances revolving around a rather ingenious concept called real life.

When it comes to time restricting some of my more fun activities, I generally drop into sarcasm. But I’ve gotten it out of my system now (that’s what blogs are for, right?) so I can carry on writing the rest of this post in all due seriousness. Continue reading

Internet Explorer 8 Beta 1

Oh my gosh. IE 8 is out, and… it follows the standards. CSS 2.1. Strict XHTML. The whole works.

I’m going to give it a go today if I get a chance to test its claims, but… still… if this is true…

…that means hell finally froze over.

A Lul in Time

If I haven’t been posting often, it’s because it’s been very quiet around here. I’ve been cleaning up existing projects to make way for new ones (discussed in depth before) and that’s really not an interesting subject for most people.

However, this new project is very interesting, so I’ll be writing informal updates on development progress here. We’ll be updating the official website as we go, of course, but the posts on this blog will provide my perspective of development.

That’s all for now…