Archive for the 'Computing' Category

-image-Creating workflow diagrams

I haven’t seen any good examples recently of workflow diagrams, at least not more technical ones based around software, services and workflow.

Creating a diagram like this its always nice to see other examples of how people have approached the problem but in this scenario I have yet to see anything. Even Edward Tufte came short on this, though the diagrams and illustrations he provides examples for are excellent.

So this is what I came up with to illustrate a workflow with our software in a newsroom environment.


-image-My top ten OS X applications

Its been a year with this Mac Book Pro that I am using so I thought that I would round up with my top ten Mac software - the software that I would install first of all after a crash.

1. Quicksilver. This is a must have on the Mac. I find out something new about it every week if not everyday and it makes using OS X even easier and more streamlined. For instance, finding a contact and then sending an SMS through Skype can be achieved in a few keystrokes, far faster than clicking around in the GUI.

2. NetNewsWire Pro. Now free to download, I had a paid version of this and its the best way to read newsfeeds that I have come across. It syncs with a web version so I can still access the my newsfeeds when I am away, and there are clients for other platforms including Windows Mobile.

3. Knox. I use this to keep all my important documents and things that I don’t want to go missing. It backups to my USB thumbdrive everyday, and its easy to backup online.

4. SSHFS and MacFuse. Easy easy way to mount external SSH shares onto the desktop.

5. Address book, Apple Mail and iPhoto. At first I stayed away from the integrated applications, but they are REALLY integrated, and work so well together the extra functionality that you get from using them together is well worth the switch.

6. Adium. The best chat client that I have found for instant messaging on OS X. It doesn’t have all the features that individual applications might have (voice and webcam for one). But sometimes you just don’t need that, and really Skype running along side is better for this. If it had all the features of Skype it would be really the true all rounder.

7. Unison. I use Usenet alot. Its a great news client. Perhaps the best on any platform at the moment.

8. Textmate. Perhaps the best editor on OS X - I tried many until I paid up and bought Textmate. Its strong bundles and integration with SVN plus the nice support for Django wins for me.

9. MarsEdit. Great blog posting tool.

10. Versions. This is quite new but it makes working with SVN just a little easier.


-image-django one form, two models

This post is a work in progress is now working I am glad to say. I have been working on a django site which needs two models updated for one post. It is actually using models very close to that on django-forums and I have created a forms.py file:


class ThreadForm(forms.ModelForm):
class Meta:
model = Thread
exclude = ('forum', 'sticky', 'closed', 'posts', 'views', 'latest_post_time')

def clean_title(self):
title = self.cleaned_data['title']
if not alnum_re.search(title):
raise forms.ValidationError(ugettext("Titles can only contain letters, numbers and underscores"))

if len(title) < 1:
raise forms.ValidationError(ugettext("Please enter a title"))
return title

class PostForm(forms.ModelForm):
class Meta:
model = Post
exclude = ('thread', 'author', 'time', 'related_item')

def clean_body(self):
body = self.cleaned_data['body']
if len(body) < 1:
raise forms.ValidationError(ugettext("Please enter some body text"))
return body

And then in my views (after importing in the correct models):

@login_required
def groupnewthread(request, slug):
thegroup = get_object_or_404(GroupsOfUser, slug=slug)
if request.method == 'POST':
f = request.POST.copy()
tdata = {
'title': f['title'],
}
pdata = {
'body': f['body'],
}
t = ThreadForm(tdata)
p = PostForm(pdata)
if t.is_valid():
newthread = t.save(commit=False)
newthread.forum = thegroup

if p.is_valid():
newthread.save()
newpost = p.save(commit=False)
newpost.thread = newthread
newpost.author = request.user
newpost.save()

strmessage = 'has created a thread %s‘ % (newthread.get_absolute_url(), newthread.title)
usm = UserStatus(user = newpost.author, message = strmessage)
usm.save()

return HttpResponseRedirect(reverse(’groupdetail’, args=[thegroup.slug]))

else:

t = ThreadForm()
p = PostForm()

objContext = RequestContext(request, {’threadform’: t, ‘postform’: p})
return render_to_response(’groups/group_thread_add.html’, objContext)

Now the bit that is in progress is the returning part of dealing with the form data being bound, but I am going to write a custom handler. This is obviously going to be much easier to handle than an update, which I will have to deal with at a point.

The form HTML looks like this btw:

{% extends "base.html" %}
{% load i18n %}
{% block title %}
	{% trans 'Add a new group thread' %}
{% endblock %}
{% block body %}

{% trans ‘Create a new group thread’ %}

{% if t.errors %}

{% blocktrans count t.errors|length as count %}Please correct the following error:{% plural %}Please correct the following errors:{% endblocktrans %}

{% endif %} {% if p.errors %}

{% blocktrans count p.errors|length as count %}Please correct the following error:{% plural %}Please correct the following errors:{% endblocktrans %}

{% endif %} {{ threadform.as_table }} {{ postform.as_table }}
{% endblock %}

-image-Looks like Django is really taking off

Since the introduction of Google’s appengine which includes support for some of Django’s code, and the template system there has been an incredible amount of press for Django.

At the moment there is no backend support for AppEngine in Django (and DB2 support is still lacking - there was a blog post about a year ago but nothing seems to have happened since, and I would love to be proved wrong on that one) but it must only be a matter of time before this happens so for the moment you have to disable the ORM support. Pity, but I can see why.

But I am glad that Django is getting the attention that it deserves, I have long know that Python is well used in Google (and Yahoo for that matter), and now we should see even more people using Django which can only be a good thing for the ever-growing community.

Here is an excellent write-up on Google App Engine http://www.dougma.com/archives/81


-image-Installing ffmpeg on OS X

This is a work in progress for installing ffmpeg on OSX by a custom compile

This is another thing that I have needed to do and decided to put what I am doing in a blog post, I might need it in the future or it might be helpful for others.

So firstly download LAME - this is needed for supporting MP3 audio files, such as those in FLV and also for vorbis support. LAME src can be located on sourceforge.

Unarchive the file (lame-3.98b6 at the time of writing )

CD lame-3.98b6
./configure --with-vorbis
make
sudo make install

The first time I did this I noticed a problem running make so I “make clean” and then went through the process again.

Next up we want support for AAC audio, and you can get packages called FAAD2 and FAAC from www.audiocoding.com/downloads.html for these and then unarchive them ( FAAD 2.6.1 and FAAC 1.26 at the time of writing).

CD faad2
autoreconf -vif
./configure --without-bmp --without-xmms --without-drm --without-mpeg4ip
make
sudo make install

Then faac

CD faac
./bootstrap
./configure --with-libmp4v2
make
sudo make install

x264 ( http://www.videolan.org/developers/x264.html )

CD x264
./configure --enable-pthread --enable-pic
make
make install

liba52

wget http://liba52.sourceforge.net/files/a52dec-snapshot.tar.gz
tar -xzvf a52dec-snapshot.tar.gz
CD a52dec-0.7.5-CVS/
./configure
./configure --enable-libmp3lame --enable-x264 --enable-liba52 --enable-GPL

And for amr_wb and amr_nb go into their directories and do the following:

./configure
make clean
make -j2 > /dev/null
sudo make install

Basically the -j2 switch is for enabling dual cores when compiling.

Now we get around to compiling ffmpeg itself:

./configure --enable-shared --disable-mmx --enable-libmp3lame --enable-libamr-wb --enable-libamr-nb --enable-nonfree --disable-vhook
make clean
make -j2 > /dev/null
sudo make install

And that should be it though I am currently trying this configuration and it seems to work well:

./configure --enable-shared --disable-mmx --enable-libmp3lame --enable-libamr-wb --enable-libamr-nb --enable-nonfree --enable-libx264 --enable-libfaad --enable-GPL --disable-vhook

-image-Django and URLS naming

Django URLs naming can be a pain sometimes, unless it is just me but an easy way to debug is to use Django’s shell and import urlresolvers:

[sourcecode language=’Python’]python manage.py shell

>> from django.core.urlresolvers import reverse
>> reverse(’nameofurl’)
[/sourcecode]

If there are arguments in the URLS field (for instance passing in the slug):

[sourcecode language=’python’] >> reverse(’nameofurl’, ’slug’) [/sourcecode]

Then it should resolve the name to the URL path needed. If it doesn’t, well something is wrong. We got a weird Traceback when using Python 2.5 though:

[sourcecode language=’python’]Traceback (most recent call last):
File ““, line 1, in
File “/Library/Python/2.5/site-packages/django/core/urlresolvers.py”, line 297, in reverse
return iri_to_uri(u’/’ + get_resolver(urlconf).reverse(viewname, *args, **kwargs))
File “/Library/Python/2.5/site-packages/django/core/urlresolvers.py”, line 282, in reverse
if lookup_view in self.reverse_dict:
File “/Library/Python/2.5/site-packages/django/core/urlresolvers.py”, line 221, in _get_reverse_dict
self._reverse_dict[pattern.callback] = (pattern,)
File “/Library/Python/2.5/site-packages/django/core/urlresolvers.py”, line 178, in _get_callback
self._callback = get_callable(self._callback_str)
File “/Users/azimi/Code/Python/Django/django-trunk/django/utils/functional.py”, line 130, in wrapper
result = func(*args)
File “/Library/Python/2.5/site-packages/django/core/urlresolvers.py”, line 47, in get_callable
lookup_view = getattr(__import__(mod_name, {}, {}, [”]), func_name)
File “/website/xmlrpc.py”, line 8, in

dispatcher = SimpleXMLRPCDispatcher() # Python 2.4
TypeError: __init__() takes exactly 3 arguments (1 given)
>>> reverse(’homepage’)
Traceback (most recent call last):
File ““, line 1, in
File “/Library/Python/2.5/site-packages/django/core/urlresolvers.py”, line 297, in reverse
return iri_to_uri(u’/’ + get_resolver(urlconf).reverse(viewname, *args, **kwargs))
File “/Library/Python/2.5/site-packages/django/core/urlresolvers.py”, line 284, in reverse
raise NoReverseMatch
NoReverseMatch
[/sourcecode]

Looks like something is broken in support for python 2.5 on OS X with django, but I wonder if it is just us thats found this.


-image-Microsofts WorldWide Telescope

This looks really awesome, Microsoft research have combined the feeds from satellites and telescopes all over to create a window into the universe. The Ted video will show more:

There is more information on their website http://wwtelescope.com/ and release should be in spring time sometime.


-image-Johnny Chung Lee - Projects - Wii

I really like what Johnny Chung Lee Wii is doing with his projects on the Wii and the Wii controller.

There are many good examples on his website with YouTube movies of tracking fingers, multipoint interactive whiteboard, head tracking and more…

Discussion forums are over at WiimoteProject.com .


-image-Address book abbu backup import

Well it appears that Address book in Leopard has got a pretty nasty bug/feature with importing archived address book items.

Address Book Leopard.png

When I make large changes to my Address Book I have got into the habit of backing up, and with Plaxo and several other services and devices syncing off it I can often need it.

Today somehow my address book contacts got really messed up and I thought “well lucky me I have backups from when it was last in good shape, so no problem, I will just import the backup”. Unfortunately it appears that the import of Address Book archives is broken.

Address Book archives the address book items into a abbu file. This appears to be a special file format that is in reality a folder containing Metadata, images and other files quite like the location:

~/Library/Application Support/AddressBook/ (hidden on my mac for some reason).

When I went to use the import facility it asked whether I wanted to overwrite the existing contacts (I did) but then nothing. There was information in the console, but it was different everytime and not one import. Looking on the web, I could see that I wasn’t the only one with the problem, and there was no solution. So I looked to myself to find out how to get it back.

Now please understand that this isn’t a recommended solution and I don’t know how it could possibly effect someone else if they tried this, so do so at your own risk, but I had nothing to lose.

Firstly, I deleted all the files under ~/Library/Application Support/AddressBook/ with Address Book closed. Then I opened Address Book, I created a new contact, then I imported the abbu file. I got all my contacts back and they all look intact from the last backup.

Then I used Plaxo to sync them back to the service…


-image-Low Key Stand

This looks like a really nice stand for Apple computers with an integral 4 port USB hub. Raising the display might also help usability because I feel the default position is slightly too low.

lowkeystand.jpg

You can get them from Macessity.


Bad Behavior has blocked 369 access attempts in the last 7 days.