merging directories with the magic of python

We finally got the last projects out of that monstrosity ‘Final Cut Server’, but one project at the end was a nightmare to export, and we weren’t sure which files from the end actually were in a different version of the project that we already had.

We essentially needed to merge two different versions of projects directories, making sure not to lose any files, and we didn’t want to lose the organization of the files.

Here’s a quick python script I wipped up to make it quicker.

With the 4000 odd files in the project, it took under a second to run, and it turned out we only had about 20 files which hadn’t already been merged. Much simpler to sort out.

The script took about 10 minutes to write and test. This is why you should learn to program. Hacking stuff like this up is easy, and saves so much time.

(Yes, you probably could do this with a couple of lines of perl or BASH, but what the heck.)

Ergonomic things.

I get wrist pain in … well, obviously, my wrists.

Man, that was a bit of a daft start to a post.

Especially when using a mouse, but also when I have to do a lot of typing.  I do touch type, but not ‘formally’, with perfect  full-hand position, and so on.

Anyway, to try and make things better, here are some of the things I’m using

Microsoft Natural 4000 Keyboard

One of the weird things about keyboards is that essentially, we still use the exact same design that was needed for swinging arm typewriters. Stuffing all the keys as close together as we can, in orderly rows, so that the arm can hit the paper in the same place every time.
Actually, though, our hands would be a lot happier somewhat spaced apart, and at an angle, rather than trying to line up next to each other.

I have been using one of these Microsoft Keyboards for over a year now at work, and although it’s not perfect, it is a lot nicer than regular cheap and nasty keyboards, and a lot cheaper than some other Ergonomic Keyboards.

I currently have it at home, as, since this is a bit of a quiet time at OMNIvision, I thought I should finally get around to learning a more sane keyboard layout than QWERTY.  I’m learning Workman, which is a little obscure at the moment, but to me makes sense.  We’ll see if it takes off at all in the future…

Kensington Trackball

The thing which makes my wrists hurt the most is using a mouse, so I’ve been playing for a while with using the popular alternative to mice: trackballs.  This one is really cool, in that it has a built in scroll wheel.  That’s normal on mice, but for no apparent reason, is kind of unusual on trackballs.

I’m not 100% sold on trackballs as the answer, I think probably as big a part of it as anything is having to reach way over to the side and grip at an angle.  So I try to keep the trackball in the middle of the desk, and I have it also on an angle using an old empty CD spool.

Wowpen Joy

At home, I tried for a while using another trackball I got on ebay, as it was cheap, as it was second-hand.  It also wasn’t very reliable, so it ended up being more frustrating than helpful.  I then looked at Vertical Mice - mice which are designed to keep your hand in the ‘handshake position’ more naturally than the twisted flat position of normal mice.

A lot of vertical mice, like ergonomic keyboards, are pretty expensive.  However, on ebay there were a lot of these incredibly named ‘WowPen Joy’ mice.  The name itself is enough to put you off.  Anyway, I thought I’d try and see how one was.  It’s actually very nice.  It is kind of small, but still works fine with my big hands, I just use my middle and ring fingers to click, not index and middle.

Read more...

Super fast review of the past few months.

Foolishly, perhaps, we thought this year would be a quiet one.
A couple months on the ship at the start, then back in the UK until August, Teenstreet in Germany, and then back home for the rest of the year.

There’s a quote regarding the fallibility of apparently structurally sound plans of humans and rodents which might be appropriate around here.

When we finished our time on Logos Hope, we were in Bangkok.  Our organisation was holding a conference there at that time, so we helped out with the A/V techie arrangements for that.  When that was over, Becky headed home to Carlisle, and I went North for a week or so as cameraman, filming and visiting with one of our teams in the region.

After I got back two weeks later to the UK, We had a couple of weeks ’normal work’, before I had to go to Ireland to run sound for an Event in Cork, as one of our other Sound Engineers needed to go back to Korea for surgery.

After getting back to Carlisle, we had about two weeks before we’d scheduled a couple of weeks in Cyprus, to take the Christmas break we’d missed on the ship, and take some time off, in lieu.

Two days before we were due to leave Cyprus, my Grandmother in Birmingham passed away, quite suddenly - although not totally unexpectedly - and so we returned to the UK with my parents and brother for her funeral.

We were then in back to Carlisle for a few weeks, before travelling over to Germany for Teenstreet.

While we were at Teenstreet, the arrangments came together for a filming project my Dad has been planning for a while in Cyprus, so instead of coming back to the UK, we headed over to Cyprus again to help with that, myself doing the sound recording and Becky the shoot documenting and general assisting.

We’ve since been back in the UK for just about three weeks, and so wondering what’s going to happen next.

Right now we have our friend Ant, staying with us, and he inspired me to start blogging again.  This may not be the most exciting post in the world, but it at least starts to cover the great gap of the last several months.

You should check Ant’s Thoughts About Job.

Labels

With a post title like that, I kind of want to write a long piece about how we put people in boxes, or false expectations, or something.  But alas, the subject is somewhat more prosaic.  Actually, it’s not prosaic at all.  It’s kind of boring, actually.  Prose rather implies some kind of textual content, I feel, which this post doesn’t really have.

Anyway.

I’ve been making labels for things.
Perhaps it will make them feel more judged and unloved.
Perhaps it will simply make things easier for new AV operators to understand…

Documentation, and how balanced audio cables work.

I finally had a bit more time this morning to write a bit more in the A/V manual.  There’s lots of bits and pieces of documentation on board, but no comprehensive single getting started manual.  So I’m writing one, bring together bits and pieces from all over the place, sorting out what documentation there is, updating schematics, etc.

Anyway, here’s the rough version on the article I just wrote about how balanced sound cables work.  It’s pretty much my standard explanation of Balanced Audio, and aimed at people coming to A/V from a non-techy musical background, rather than for Electronics Engineers.
You may find it interesting.  Then again, you may not.

---–

Sound is basically vibrations in the air.

TODO: more details, pingpong ball analogy?

Inside an (SM57) Microphone head.
That is the bit of plastic and the coils!This translates really easily into an analogue electrical signal: you simply turn the air vibrations into voltage vibrations.A Dynamic microphone does this by having a small bit of paper (or plastic) which vibrates with the air around it, and pushes against a very small copper coil which, moving inside a magnetic coil itself, generates a very-very-very small amount of electrical current.

TODO: more pictures.

This gets dumped down a wire, which gets amplified by (you guessed it) an amplifier into a very big amount of electrical current, which then drives a big electromagnet inside a speaker, which pushes another copper coil around, which is attached to another big bit of paper (the speaker cone), which causes the air around the speaker to vibrate – with the same vibrations that the microphone vibrated with, just bigger.

Simple, isn’t it? (well. Kind of.)

Balanced Audio Cabling

The trouble with simply dumping an audio signal down a cable, and picking it up at the other end is that your signal line, and return (usually ground) will pick up noise (say from A/C mains electricity, fluorescent lights, dimmers, mobile phones, etc)  along the way.

Here’s an original signal:

And here’s some noise:

And the result:

This is a Bad Thing™.

So some clever engineers, back in the deep recesses of time figured out the following:You could take a signal, and before sending down the wire where it could pick up noise, invert it:

If we add the signal to the inverse, you get a grand result of nothing (e.g. -3 + 3 = 0).

Now, if we throw these two signals down a pair of very similar cables twisted round and round each other like crazy, then they’ll both pick up noise pretty much the same as each other:

Note that 3 (the original) + 1 noise = 4,
while -3 (the inverse) + 1 noise = -2. NOT -4!

This is really cool, because if we add these two signals together, we don’t get 0 anymore, we get no original signal, but you do get the noise (doubled).

So we’ll use our amazing maths skills again, and divide this doubled noise in half. (2/2 = 1).

Read more...

A random side story.

HK-SITREP-042.2013.01.10:

An individual with an extremely large head has been seen, dressed in a captains uniform walking around the vicinity of the Hong Kong International Airport.  He seems reasonably calm, although the fixed smile on his face is somewhat disturbing.  We believe he is waiting for some one, or ones, to arrive from destinations unknown.

Please advise.

Plenty of people coming off the plane were very confused.  Still, pretty fun for us.  I was the one with the camera, not the one in the suit, in case you’re wondering.
I think we may have slightly freaked out the bus driver on the way as well…

(Yes, we were picking up friends from the airport.  No, they didn’t know we were going to bring the Captain.  Yes, it was funny.)

So we’ve been on board the Logos Hope for just over a week now.

Kind of hard to believe.  I really should have blogged earlier, saying we’ve arrived, etc.

As well as jet-lag, I picked up a cold, I guess on the plane, so have been totally energyless and wanting to just crash in the evenings rather than do something productive like write.

Sorry.

Anyway.  Logos Hope is a much bigger ship than Doulos.  I’ll try an post comparison pictures at some point.

The A/V systems on board are also quite a bit more complex and bigger.  Similar concepts, and designed by OMNIvision guys, so using equipment I’m either familiar with, or familiar with cousins of.  (I’d never mixed with an LS9, for instance, which is the digital sound desk they have on board - but I know the O1V96, which is kind of similar, and other digital sound desks).

So, we hadn’t quite realised that the ship is still in ‘drydock’ mode, so not really open to the public, wooden boards and paper over much of the carpeting, etc.

The Hope Theatre, the amazing on board venue which they have (*so* much bigger and cooler than Doulos tiny ‘Main Lounge’ had been converted into a mess for the deckies and engine guys, as well as workshop, storage area, dressing room, and general chaos zone. 

Because the Dry-dock had been extended so many times, and they’d thought that initially it would be very short, much of the equipment (lights, sound desk, projectors, etc) didn’t get taken down and covered properly pre-drydock.  So one job we’ve been doing over the last week is cleaning out the lights and projectors as much as we can, and covering them all with plastic bags so that during the cleaning of the rest of the theatre they don’t get any more dusty and dirty.

(We expect a lot more dust to come up when they lift up the floor covering boards and clean up the mess).

It’s pretty funny, seeing so many little bits of Doulos scattered around, like this ‘world’ guitar.

A lot of the equipment is slightly damaged, or very confused.

Like these poor headphones.  A lot of the settings of equipment are set to really weird settings, some of which seem to have been reset to factory settings.  Apparently over drydock a lot of equipment has been un airconditioned for 6 months or so, some of which has been off for that long, some of which has actually been used in that humid dirty state.  I guess that accounts for some of it.

But there are also jobs which have been listed as ‘fixed’ by the previous A/V manager but are obviously done wrong.  It’s kind of irritating.  Apparently there has been very little hand over between managers for a while.  Very little sensible training, and huge amounts of knowledge have been lost.

There really is a vast ammount of work to be done, just to get the systems operational and ready for normal ministry again.  Let alone the teaching side of things.

Read more...

Déjà vu

So Becky and I have been trying to go back to the ship for a while now.

Not the Doulos, but the Logos Hope.

Somehow, I just don’t seem to have got it out of our blood yet.

We though about going out late January time, perhaps flying with the new recruits from the January Conference.

So, the Déjà vu thing…

We spoke to some people in August at the GO conference, sent some emails around, waited a bit.

Waited some more.  As one does.

Anyway, we got an email last week from our friend Mark, who’s one of the big manager types.

“I’ve spoken to the guys on board. I don’t suppose you could come at the end of the month, could you? I know it’s a bit short notice…”

!!

(Those previous two exclamation points without corresponding lexical complication are in fact, grammatically correct. ‘Self-explanatory punctuation’ I call it.)

So it looks like we may be back on board in 3 weeks!  Quite exciting, and a perfect excuse to start up this blog again.

Why the ‘deja vu’ comment? Well, it seems awfully reminiscent of my first short term ship back in 2005.  Feel free to find the archive entries if you wish!

The Logos Hope is just coming out of a very long (9 months odd) layup/drydock, and so they’d really like a couple of extra pairs of hands to help in the programmes/events/Audio-Visual stuff sooner rather than later.

More details to come later. :-)

sqlite dates and django

I was getting very confused with my django DB quite happily setting the date in SQLite, but displaying a '' when loading it back from SQLite.

The SQLite field was a DATETIME, and in Django a DateField, which I would have thought should work.

Alas, no.

Apparently the SQLite field must be a varchar(20) (or similar) for a date w/o time.

Strange.

Duel Booting, mapping UIDs for different filesystems

I’m dual booting Debian & OSX on my work machine.

In OSX, users are created starting with UIDs 1000.  So the admin user is 502, I’m 501, and so on.  Also, the ‘staff’ group ID is 20.

On Debian, users are created starting with UIDs 1000.  So I’m 1000, my testing blank account is 1001, and so on.  The ‘staff’ group ID is 50.

This is a bit of a problem when I want to share files.  Since it’s just me on the computer,
technically I could just mount the drive with full read/write permission to me.  But I don’t want that.  I don’t want to be able to muck around with stuff outside my /home (or /Users/) directory without really trying hard.

The way to do it is using FUSE and bindfs.

Debian squeeze comes with FUSE installed, and has bindfs, but the version of bindfs that comes in the repo wasn’t up to date enough, so you may need to compile your own.

sudo aptitude install bindfs libfuse-dev

 Download, compile and install a new bindfs:

http://code.google.com/p/bindfs/

tar -zxvf whicheverfileversion.tar.gz
cd whicheverfileversion
./configure
make
sudo make install

Should now leave you with an up to date /usr/local/bin/bindfs

For the sake of example, I’ll show my set up.  /media/OSX is the original.

sudo /usr/local/bin/bindfs –map=501/1000:@20/@50 OSX OSX

Sweet! It works!

There will be quite a big performance hit from using bindfs.  Some benchmarks (linked from the bindfs page) reckon about 80%.  Not a problem for me here, since it’s fast enough.  But to be aware of.

Here’s a script which I put in /etc/init.d/osxfixperms.sh to run this on bootup.

#! /bin/sh
### BEGIN INIT INFO
# Provides:          osxfixperms 
# Required-Start:    fuse
# Required-Stop:
# Default-Start:     S
# Default-Stop:      0 6
# Short-Description: remount OSX drive with correct permissions.
# Description:
### END INIT INFO
do_start() {
    /usr/local/bin/bindfs –map=501/1000:@20/@50 /media/OSX /media/OSX
}
case “$1” in
  start|"")
    do_start
    ;;
  restart|reload|force-reload)
    echo “Error: argument ‘$1’ not supported” >&2
    exit 3
    ;;
  stop)
    umount /media/OSX
    ;;
  *)
    echo “Usage: osxfixperms.sh [start|stop]” >&2
    exit 3
    ;;
esac
:

Which I’ve then installed (on debian) with (as root)

update-rc.d osxfixperms.sh defaults

You’ll need to be mounting the OSX drive *BEFORE* this happens.  Generally, that means stuffing it in /etc/fstab in the appropriate way.  You can ask google / debian docs.  It’s fairly well documented.  Unlike using bindfs.

There.
Easy. (ish).