Audacious CSS Desktop Programming

Posted in Art and Creation, Free and Open Source Software, Multimedia Entry, Programming and Technical, Ubuntu, Video Entry on April 8th, 2012 by doctormo

Take a look at this video, here I show an awesome new technology for using Clutter/Gtk with Cascading Style Sheets.


Audacious Video

You can test this out for yourself with Ubuntu 12.04 (Beta) using the following:

sudo apt-get install gir1.2-gtk-3.0 gir1.2-clutter-1.0 gir1.2-gtkclutter-1.0 gir1.2-gconf-2.0
bzr branch lp:csslavie
cd csslavie
./netbook-launcher.py

Note: default clutter/cogl has a bug which prevents the background’s opacity setting, so you won’t get as cool an effect. But a fixed version of those libraries should be available eventually.

Please comment below what you think.

Tags: , , , , , , , , ,

Introspection Introspection

Posted in Programming and Technical, Ubuntu on March 6th, 2012 by doctormo

I’ve written a script which I can use to get information about gobject introspection modules for use in python. It’s written in python and allows you to look at actual function names, actual object names and what really is going on.

http://paste.ubuntu.com/872138/

This is mainly a problem because the documentation for Gtk with gi.repository is so poor and not clearly described that it makes it impossible to use without great force of will.

Hopefully this script can make the job easier for others, feel free to adapt it and post your remixes.

Tags: , , , , ,

Python List Inheritance Post Creation Pattern

Posted in Programming and Technical, Ubuntu on July 31st, 2011 by doctormo

One of the fun things to do with python is to use the language to bend the rules of programming. One neat way of using your resources wisely with objects is to create objects in the right places, but not generate or call costly data gathering operations until you absolutely need to.

So called ‘late data initialisation’ is useful in certain kinds of programs. I document here the best pattern I’ve found to turn a python list into a late data class:

class newList(list):
    @property
    def data(self):
        if self.populate:
            self.populate()
        return self

    def populate(self):
        print "Generating Now"
        for x in range(42):
            self.append( x )
        self.populate = None

    def __getitem__(self, key):
        return super(newList, self.data).__getitem__(key)

    def __len__(self):
        return super(newList, self.data).__len__()

    def __iter__(self):
        return super(newList, self.data).__iter__()

Basically populate can be any piece of code which calls what ever it needs in order to gather the data. It’ll only be called once and to prevent having to use an __init__ variable we just clobber the method attribute. Sneaky!

When the list is used for an iteration (for loop), or if you delve into it directly for a specific item, or need to know it’s length, then we can get the data behind our object and have it contained within the list object we’re inheriting. No need for secondary list object variables dangling off of self. Ugly! Although this pattern does require that every use you want to put the object to (i.e. string, representation, slicing, dicing, mincing or conditionalising) you’ll have to make a new super method to wrap around to make sure that the data is generated if that’s the first way the list will be used.

What are your thoughts about this pattern? Do you know how to fix the init issue with a better pattern?

Tags: , ,

Freely Fixing and Developer’s Time

Posted in Programming and Technical, Ubuntu on March 9th, 2011 by doctormo

I was reading over the ever wise Matt Zimmerman and his blog post about Listening to Users; in it he argues that user involvement is a nuanced subject and which approach the developer takes can be highly dependant on the timing, cycle and context of the developing project. Providing examples and some interesting comment.

I basically agree with these ideas, but I wanted to add something more to the economic thought.

I talk about user involvement here; I never mean users who are programmers, users who help support other users or users who turn into developers by their continued project involvement. For that subject see User to Developer evolution.

What developers want from users is fine communication on what the challenges and needs they are facing. They would like as much depth into the issues with as much detail on the specifics which cause issues. This communication is not actually in effort to help the user, but is instead a way to help the developer’s project. The user can see the bug or interaction as a way to get their immediate issue resolved, but the developer will be focused on collecting and filtering the relevant information and making tasks to push the project forwards.

Of course the user will still benefit in due course; but the user’s direct support needs are instead not met by bug reports, but by support type people who may or may not know the aims of the project. The goal for support people is to give the user instructions so that they can mitigate their issue and it isn’t about helping the developer. A wily support person will be able to turn a successful support request into a successful bug report which the developer can process and turn into a permanent solution; on the other hand a user or support person who is used to mitigation strategy, but not used to developer interaction will fail to tie the loose end of why the user needed support in the first place.

This can lead to the dreaded ‘toxic workaround’ which Tim Cole has given a talk about. This is a workaround which becomes so well documented and so ingrained in the culture of the users of a product that they fail to actually tell a developer to fix it. So the problem always remains causing issue for anyone new and causing users to go through extra steps to get usable systems. A good example of this is in Ubuntu support channels when people are asked to and expected to compile anything instead of the code being added to a PPA.

In order the listen to users, I think a developer must know the difference between supporting the user, and supporting upstream development; which may place conflicting demand on the developer’s time. The user for their part, if they get frustrated with reporting bugs that never get to be solved, can lash out at developers, ordering and demanding action should be taken and issues resolved.

Of course, if the user isn’t paying the developer to fix their issues, then the user has no right to ask any developer to work on their issue. The user’s only real power is that they can be of use to the developer’s aims in their project’s future refinement. This is because the developer is the one that holds the majority of the economic power. When a developer talks with a user, it’s clearly with an effort to solve the issues the user has brought up; but I think the developer is always thinking about what fixes will benefit the project the most and which users are the most useful to communicate with to achieve those goals.

What are your thoughts?

Tags: , , , ,

Unity and Places

Posted in Programming and Technical, Ubuntu on November 11th, 2010 by doctormo

I was excited to hear from Ted Gould ironically at the Gnome Boston summit about the Unity Places system and the opportunity to create custom places which can expose all sorts of collections and online connections to the user in interesting ways.

This is not that file system deprecation that people keep on mistakenly banging on about, but instead a way to view interesting data objects in a user session context and even perhaps search on them.

My own ideas range from exposing openclipart to integrating a list of projects from ground control. All seem like pretty interesting candidates. From the wiki the only thing that concerns me is the canonical user space, I’ll live with it but the anti-social contributors agreement makes me uncomfortable to be involved any closer than simple plugins. Hopefully there will be something similar in gnome shell or kde (although preliminary questions on the topic suggested that gnome shell would be a rigid as a board of plywood so perhaps not).

See here for more details: Unity Places Wiki

Tags: , , , ,

Why Gnome? Why.

Posted in Free and Open Source Software, Hat Talk, Programming and Technical, Ubuntu on September 22nd, 2010 by doctormo

I have a love/hate relationship with gnome. I use it, I develop for it and at the same time I dislike the way the gnome project produces functional libraires.

Take for example librsvg, an awesome library for turning svg files into pngs for display and for making thumbnails. For some unintelligent reason installing or compiling librsvg requires gtk and thus also requires avahi and hicolor-icon-theme, xrandr and libcups2. Does making a png out of an svg require us to send icons to a rotated screen connected to a networked discovered printer? No? Then why do I need all this stuff?

The problem as I see it is that librsvg should be split out more into it’s none-gtk library parts and it’s pixbuf/gdk parts. Making it a useful library to a wider audience from servers to other desktop systems. Larger audiences mean more attention and more attention means more bug fixes.

The gnome project historically I think didn’t have much of a culture of serving a wider ecosystem and saw gaps and filled those gaps with gnome-only libs. It pains me to say but as a programmer I’m disappointed by the lack of foresight even though I understand resources were always tight. A “do everything with gtk deps” culture produces inflexible libs with rare logical separation between layers and fewer opportunities to share with the wider community because of it.

I’ve always hoped that the FDO culture of sharing APIs and working towards standard consensus would help the culture along and promote a culture of making libs for everyone.

Does anyone know of any alternatives to librsvg that produce good results? imagemagik failed to meet standards as it doesn’t support most of the filter effects, but I don’t know of many others.

just my 2 cents, what are your thoughts?

Tags: , ,

Perl to Python

Posted in Free and Open Source Software, Programming and Technical, Ubuntu on July 3rd, 2010 by doctormo

I managed to port one of my libraries that I made way back from perl to python, the experience was quite interesting, although very tiring. I don’t think I can recommend perl again since the python just looks so much cleaner and there were whole sections I could remove because they were handled by python.

If your interested in data validation check out lp:~doctormo/doctormo-random/xsdvalidate and have a look at the tests, it’s basically a module similar to the existing xml.xsd but with a focus on python structures.

Because it’s a library few of you are going to know how to run the tests and have a dig around at what it can do. For those in the know, it’s got a structural error reporting mechanism which allows the code to know what failed to validate. In perl I was using this module hooked up to a django like framework which would be able to check if the form information was valid and which fields failed and how, this information was actually fed directly back to the template for human warnings so the entire process was automated to a frightening degree, you really didn’t need any code for most transactions.

I’ve already heard that I should have used DTD instead of XSD, I never really liked DTD, they seem really ugly to me. Also a nod was given to using this kind of thing for ajax validation, but I somehow think that javascript must have an existing client side validator in the browser.

I have a test suite but I could always do with more tests, if you find something it’s not covering let me know.

Tags: , , , , , ,

Example of FOSS Economics

Posted in Economics, Free and Open Source Software, Ubuntu on May 17th, 2010 by doctormo

People who read my blog regularly know I’m big on looking into discovering what it is that will allow software creators, bug fixers and all the other people involved in producing functional products with a sustainable income.

Only two weeks ago I was talking with Matt Lee of the Free Software Foundation about this problem and apparently someone he knows had sold himself online for 6 months as a free software hacker by setting levels of pledges and some rewards and products for people who invest in the project and although the FSF doesn’t consider economics important enough to be a goal (much to my disappointment) the activists there are aware of it.

Now computer world uk is reporting on the exact same system, one where the artist, programmer or team sets out to raise money for a project and does so by setting a structured list to encourage higher amounts of money to be pledged.

Just like me they’ve avoided using words such as “charity” and “donation”, which I think are really not applicable to what we’re trying to do: viz. find a way to make Free as in speech economically sustainable.

What do you think about a stepped pledge model? Do you think that the model requires far too many direct supporters and existing backers before it can be made to work? Should I conduct myself in a similar fashion by creating a set of pledges for the ground control project and advertising it very widely?

Tags: , , , , , , , , ,

Python Threading Woe

Posted in Free and Open Source Software, Programming and Technical, Ubuntu on January 12th, 2010 by doctormo

This is what python threading does to people:
My work on groundcontrol is trialling thanks to nautilus being based on gtk and the Thread class which is supposed to provide easy threading. And bzrlib, which may or may not be thread safe, but never actually functions in a thread even when self contained in one thread.

It’s turning into a real dogs breakfast and advice from other devels says to avoid threading in python… that may not be acceptable for this project. I’ve managed to solve now most problems via not having threads but instead loading at opportunistic times. but it’s ridiculous to me how badly Thread, gtk and bzrlib mix and how much time I’ve wasted trying different solutions. So desperate was I that I even tried using subprocess to fork out a separated script.

Now I know a lot of this is due to not knowing the precise operating functionality of threads in python… but the subject seems to operate on some kind of uncertainty principle where the more a person knows the less likely they are to explain how it works, conversely the less someone knows the more likely they are to try and explain it wrong.

So anyone know any _really_ good guides on python threading that explain it and demonstrate it? So far the guides I’ve found have been wrong.

Update: The community does not disappoint… a great simple guide in the form of a pygtk faq was most helpful, provided by M.K. Erlandsen below in the comments. Also useful is the multiprocessing explanation provided by Jess S.

Tags: , , , ,