Dan Ward Follow me on Twitter View my LinkedIn profile Subscribe to my news feed   

A self-confessed geek and web developer

 

Blog

From time-to-time, I'll have a brainwave while trying to figure out something tech-oriented; well, either that or I just want to get something off my chest. Anyhow, if I get round to typing it up, it'll wind up here in the blog.

Blog categories

 

Archive

  • A custom MongoDb/GridFS file wrapper for the Django HttpResponse object

    Created by dan on Monday 22nd February, 2010 at 4:28 PM

    Until today, I had been using Django's FileWrapper class to iterate over an open GridFS and yeild chunks to an HttpResponse object, however I noticed that files over 8 KB were being reiterated in the output. As far as I could fathom, the reason why this had been occurring is ...

  • Setting a toggler's link text to 'show' or 'hide' depending on the result of a toggle in jQuery

    Created by dan on Friday 19th February, 2010 at 11:51 AM

    Not explained very well in the title, but one thing I've found is that there's little supportive documentation on how to alter the text of a link which triggers a slideToggle() or toggle() in jQuery. To make the toggle a little easier for the user to understand what's happening, they ...

  • Loading Django template tags and filters automatically (without the {% load %} tag)

    Created by dan on Thursday 18th February, 2010 at 5:12 PM

    I'm not entirely sure of how well this is documented on Django's part, however using the {% load %} tag on each page template where tags and filters used surely break the DRY principle? Anyway, there is an easier way to load tags and filters for all templates. There's just ...

  • Removing IPython/libedit for the time being...

    Created by dan on Monday 15th February, 2010 at 10:42 AM

    Just a quick one I thought I'd share. At some point a while back I decided to install IPython, at least I assume I done it knowingly! Anyhow, I noticed that when I jumped in to the Django shell, I'd get a message along the lines of "Leopard libedit detected.", ...

  • Removing an entry from MongoDB in Python/Django using '_id' and getlist

    Created by dan on Friday 15th January, 2010 at 6:38 PM

    I've got to the point where I have a table containing all entries from a set Mongo collection. They each have a checkbox beside them with the value of '_id' where I can select them for a magical journey in to the mass deletion/modification abilities of the associated Django view. ...

  • Outputting an '_id' value from MongoDB in a Django template

    Created by dan on Friday 15th January, 2010 at 5:48 PM

    If you've not already noticed, Django's template rendering engine forbids referencing variables, which are prefixed with an underscore. Because of this, we have to faff about with a filter or alike. The below filter should do the job for the _id field. I'm not going in to any more detail on ...

  • How to create a slug field with Django forms

    Created by dan on Friday 8th January, 2010 at 3:14 PM

    A slug field is a field, which only accepts alphanumberic characters and underscores. When creating models in Django, a models.SlugField class exists, which validates against this rule. Quite frustratingly, however Django doesn't have a forms.SlugField class at the moment. It's time for drastic action! If any of you have been ...

  • Dynamically creating and destroying an instance of TinyMCE with jQuery

    Created by dan on Tuesday 8th December, 2009 at 3:29 PM

    OK, so this is a bit of a quick one, but I thought I best blog it so that I can refer back later on. I have a DIV containing one or more paragraphs, which I want to be able to edit inline with TinyMCE. Seen as I'm using jQuery, ...

  • Creating a form submission handler with jQuery to handle checked items for deletion

    Created by dan on Friday 20th November, 2009 at 3:56 PM

    Following a little research, I found there to be no set solution for my problem, so I decided to sort it out myself and post the final solution here. Simply put, I have a form with some checkboxes, which when ticked and posted, trigger deletion on the selected item. Using ...

  • Creating an inline password change for a User ModelForm

    Created by dan on Sunday 1st November, 2009 at 3:26 PM

    I've always wondered why when creating a ModelForm for a User, that by default, there's just a single password field. Furthermore, when saving the form with this field populated, the password is overwritten with the raw value, not the encrypted value. So, I set about to provide the users of ...

  • Database transactions in Django

    Created by dan on Thursday 29th October, 2009 at 3:11 PM

    I've come to the point where I really need to go down the route of using database transactions for a few operations carried out on my Django project. As always, a simple search for 'django database transactions' in Google returns a, somewhat relieving official Django page with the documentation for ...

  • Using VLC to record a multicasted transport stream with all elementary streams

    Created by dan on Tuesday 27th October, 2009 at 9:28 AM

    Well, it all started when I had the need to record a multicast DVB transport stream in to a standard transport stream file (.ts) using VLC on Ubuntu Server. After some looking around, I found a simple command which I thought done the job perfectly:   vlc -vvv udp:@239.192.4.2:5004 --sout ...

  • Updating content in-place on an Amino set-top box using Ant Fresco

    Created by dan on Thursday 15th October, 2009 at 2:28 PM

    Let me kick-start my blog by going in head-first, and posting my first nugget of information... While developing a well-involved IPTV system, I came across many, many frustrating limitations of Ant Fresco's browsing capabilities, although I'm fully aware that I'm using a dated browser, but it does handle things quite ...