Redge's Trek through the Web

Ravings and bright ideas by a Dutch student of Artificial Intelligence, religion and faith, computers and life.

Saturday, May 30, 2009

On the microblogging bandwagon

Untill now I've always declared microbloggers (Twitter,Identi.ca) to be silly, informing the world when they leave the house or take a dump. It turns out that I had the wrong idea about microblogging. I'm happy to report that I have repented, and am now happily microblogging along with the rest of you.

I've tried Twitter and Identi.ca. The latter seems to have more options, is more stable, and it automatically double posts on Twitter for me anyway, so why bother with Twitter at all? You'll find me at http://identi.ca/redge I've also embedded a widget in this blog.

In any case, if Google Wave becomes all they promise it to be, it will be a mute question anyway as I'll be handling all my communications with the world from there anyway...

Untill then, happy (micro)blogging: hope to hear from you.

Labels: , , , ,

Sunday, May 17, 2009

Off GIT, after only a few days

After losing the entire revision history on one of my projects for no good reason earlier this evening, I've decided to stop using GIT. I'll allways remember it as the revision control system that showed me the many advantages to a distributed system (I'd been using subversion).

But truth be told, I was getting less and less enthused anyway: GIT really isn't that powerful a system, and there weren't many tools that could manage it, forcing me to the command line (I don't mind the command line, but using it constantly is a waste of time IMHO). I work with Eclipse a lot, and a tool for GIT of the same level as subclipse doesn't exist yet (there is a plugin with some integration, but it's not very easy to use and breaks a lot).

Now I'm on the hunt again, looking for the new best thing. Right now I'm giving Bazaar a try, and so far I like what I see. There's decent Eclipse integration and I'm told there are even packages to integrate it with Nautilus, although I haven't tried it yet. It also seems to be more widely supported, and it comes with nifty stuff like Trac and Launchpad.

As it is now, bzr looks like a keeper. But I don't want to sell anyone short: if someone can suggest an even better revision control system, my door is always open.

Labels: , , , , , ,

Smarty dereferencing/complex object calls

Note to self: next time I have trouble calling nested methods on an object in Smarty, use this:

http://code.google.com/p/smarty-php/issues/detail?id=3

Example:
{$object->methodReturningObject()->nestedMethod('with','complex',$arguments)}

Saturday, May 9, 2009

GIT upload script

Since I'm on a shared host (Hostmonster), I don't exactly have full freedom. Not being able to serve a GIT repo is one consequence. Fortunately, GIT is resourcefull enough that even without the GIT daemon running, uploading the files is enough for people to pull them from the server, or explore them through git-web.

So for people in a similar situation, here is a script that will upload your GIT repo's to your shared host:

#!/bin/bash

# A script to create a bare clone of a GIT repo and upload it to a server for
# archiving or public distribution.
#
# Author: Romke van der Meulen
# License: CreativeCommons Attribution Non-Commercial 3.0

# Check arguments
if [ $# -lt 1 ] || [ $# -gt 2 ]; then
echo "Usage: git-upload (SourceDir) [TargetName]"
exit 1
fi

# Define remote directory
HOST=user@host.com
REMOTEDIR=public_html/repo

# If no second argument given, the name of the uploaded repo is
# equal to the repo being copied
if [ $# -gt 1 ]; then
NAME=$2
else
NAME=$1
fi

# If the temp files already exist, remove them
rm -rf $NAME.tar.gz $NAME.git

# Begin procedure

# Create the bare clone
echo "Creating bare clone" && \
echo -n " " && \
git clone --bare $1 $NAME.git && \
# Tar and zip
echo "Zipping" && \
tar -czf $NAME.git.tar.gz $NAME.git && \
# Upload to target dir
echo "Uploading" && \
scp $NAME.git.tar.gz $HOST:$REMOTEDIR/ && \
# Unzip at target dir
echo "Unzipping" && \
ssh $HOST tar -xzf $REMOTEDIR/$NAME.git.tar.gz -C $REMOTEDIR/ && \
# Remove generated files
echo "Cleaning up" && \
ssh $HOST rm -f $REMOTEDIR/$NAME.git.tar.gz && \
rm -rf $NAME.git.tar.gz $NAME.git && \
# Done
echo "Succesfull" && exit 0

# Error encountered
echo "Unsuccesfull" && exit 2


Install it somewhere where you can get at it and change the remote config to reflect your own. Also, unless you like giving your password three times, I suggest you also upload your public key for automatic login. Once you've done this, all you need type is:

git-upload (repo dir) [remote repo name (optional)]


and you're all set.

Any questions, you know where to find me.

Labels: , ,