Linux Outlaws inline audio - 26/10/11
Possibly the best Linux podcast, Linux Outlaws , have show notes for each episode they release and on those pages they have downloads for the mp3 and ogg files. However, I like listening to them in the browser so I cobbled together a little bit of JavaScript to add an HTML5 audio tag before the download links.
Drag me to your bookmarks bar an on a show notes page, click it. You should see an audio player with controls appear just before the download links.
Rooting the S2 - 12/10/11
I recently got myself the new-ish Samsung Galaxy S2 android phone. My first android phone and I’m really happy with it. With the release of CyangonMod 7.1 the other day though I wanted to have a go at rooting the phone and installing custom ROMs.
While reading up on things though I started confusing myself. The wiki for CM mentions things like ClockworkMod Recovery, ROM Manager and rooting. A backup tool they mention, Titanium Backup, needs root to work.
This is just a note of what I’ve gone through to get part of the way through.
The first thing that you need to do is get a custom, ‘insecure’, kernel installed. This comes in the form of codeworkx ClockworkMod Recovery
I flashed this first using Odin. It took about 30 seconds at most.
After that had completed the phone reboots with a yellow triangle. Next up is getting root access. This is needed if you just want to flash CM7.1. However, I wanted to check out Titanium Backup and ROM Manager that both need root access.
The usual way of doing this is via SuperOneClick but that kept crashing at step 6, so I used S2 Root instead and that worked first time.
That was it. The phone is now rooted. I’ve not yet checked ROM Manager or CM7.1, that’s to come after Titanium Backup.
Working with git and svn - 04/10/11
I work in an environment where all the work needs to be done on a remote host with my working folder mounted over a Samba share. All the source is stored in an SVN repo. Ideally I’d like to be able to use git but something with the samba share causes an error with git svn clone (not going to go into that now, but this is the error for reference).
git svn clone http://id-hub/master/clients/client/test/publish/trunk test-project.git Initialized empty Git repository in /Volumes/samba-share/dev/asmith/client/test.git/.git/ W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: '/master/!svn/bc/100/clients/client/test/publish/trunk' path not found W: Do not be alarmed at the above message git-svn is just searching aggressively for old history. This may take a while on large repositories r12208 = a61f1d1b6bc8b267fb2d247878697a4953e87e39 (refs/remotes/git-svn) fatal: Cannot open '.git/2IlhwN8uea': Resource temporarily unavailable hash-object -w --stdin-paths --no-filters: command returned error: 128 error closing pipe: Bad file descriptor at /usr/local/Cellar/git/1.7.7/libexec/git-core/git-svn line 0 error closing pipe: Bad file descriptor at /usr/local/Cellar/git/1.7.7/libexec/git-core/git-svn line 0
What I end up doing is working in an SVN checkout on the share and create a git clone locally. Do some work on the SVN version and then copy all the changes over to the git clone so that I can do partial commits and whatnot and then svn dcommit back. The problem lies with syncing things back to the git clone.
I’ve tried using rsync but for some reason or another it wants to copy everything all the time which is slow. Instead, I created this little one liner to check for changes and copy them over instead. It could probably be tidied up but it works well enough for me
$ pwd
/path/to/svn/checkout
$ while read line
while> do cp -v "$line" /path/to/git/clone/"$line"
while> done < <(svn status --ignore-externals |grep -e '^[MDRA!?]'|awk {'print $2,$NF'})
All it does is check the status of the svn checkout (ignoring externals) and grep the list so that only changes are shown. It then splits that with awk from the second field to the end (for folders/files with spaces in them). This list is then passed to the while loop where each line is read in and a copy from the current location to the git clone is performed.
This probably isn’t useful to anyone so this is mostly just a post as a reminder for me.
Django - fcgi paths - 19/09/11
As mentioned before, I’ve had problems setting up Django with the fcgi script. Today I came across another problem.
While going through the tutorial it walks you through the process of enabling the built in admin module. When I did this as added my module to settings.py file I got an error along the lines of
Unhandled Exception An unhandled exception was thrown by the application.
Not very helpful by itself, but tracking it down in the Apache logs it came down to it being unable to find a module that had been added to the settings file (in the tutorial it’s the ‘polls’ app that you create).
My fix for this was to add the project path to the python path in the fcgi script. In my previous post I said that the fifth line needed to point to the folder above your project folder. This works so that you can load the settings file but fails for any other module/model that you want later. Instead, line 6 should be the folder above your project and line 5 should be your project folder, i.e.
sys.path.insert(0, "/home/espadav8/Workspace/mysite") sys.path.insert(0, "/home/espadav8/Workspace")
The other fix seems a bit less elegant is to change any instance of ‘polls’ into ‘mysite.polls’.
Django... One, no wait, two more things - 16/09/11
Django has a load of admin files that need to be accessible. Rather than have the folder accessible as a standard folder I wanted to use a symlink inside the public_html folder. With the default Arch mod_userdir settings though, symlinks aren’t followed unless the dir is owned by the user. This won’t work though so a change to the Options is needed
Options FollowSymLinks
That needs to exist instead of the ‘SymLinksIfOwnerMatch’ option.
The other thing is the fcgi file. By default you won’t be able to run it within the public_html folder. To fix this add ExecCGI to the options section as well.