Mar 10

Ugly code of the week 1

Ugly code of the week #1

As I'm in the process of working out what to write for my first weeknote I thought I'd start another weekly posting schedule - hence Ugly Code Of The Week.

I thought it would be quite useful, or at least interesting historically, to occassionally post a line of code that I am particularly ashamed of and in the process of cleaning up. I'm hoping that I can use this as a record of what I want to avoid. It won't always be Python, and I should point out that not all of my code is like this - I just tend to write code before going back to clean it up once it works - a habit I am trying to reduce by getting it right first time.

results = [ add_fields(show_fields,x) for x in model_cls.objects.filter( Q(**{qf:q}) ).order_by(field).all() ]

Yes, I know. Sorry, I won't do it again. Part of the problem with this is that the naming is not very clear, and another problem is that there is far too much going on in one line for a reasonable amount of readability. On the other hand, list comprehensions rock.

Mar 10

Technorati claim

H4STECXXFGCK

Dec 20

Rich textarea editing with jQuery

Just thought I’d share something I got pointed to from twitter (via usejquery ).

wkrte is a rich text editor written in Javascript and using jQuery, which has a pretty nice feature where the button bar doesn’t appear until you focus the text area – nice way to save screen space I think.

There is a demo of wrkret which is probably worth looking at if you are in the market for a new rich text editor in the browser – I have a feeling that rich text editing in the browser is something that I’m never really going to be happy with, but at least this is a step in the right direction.

Dec 13

Introduction to FluidDB

Repost of Introduction to FluidDB MP3

This is just a repost of Terry Jones' Introduction to FluidDB Talk (in MP3 format).

You can get it here

About

This is the official blog of Servercode Ltd where we will be posting our weeknotes and other things of interest that we may have found from time to time.

Subscribe

Categories

Recent Posts

Archive

BlogRoll

Popular Posts