Viewing posts for the category programming
I am making a small project with TurboGears and I am just loving the widgets and the identity framework. There are some rough spots, like the documentation, but luckily for the most pars you can just launch an ipython interpreter and use tab completion to look at what functions are available. But then I got this error:
Traceback (most recent call last):
File "./start-foo.py", line 23, in
from foo.controllers import Root
File "...Foo/foo/controllers.py", line 22, in
File "/var/lib/python-support/python2.5/turbogears/widgets/meta.py", line 169, in widget_init
validator = generate_schema(self.validator, widgets)
File "/var/lib/python-support/python2.5/turbogears/widgets/meta.py", line 277, in generate_schema
AttributeError: type object 'SettingsFields' has no attribute 'is_named'
And I could not find any help on this. Luckily I found Lucas manual and by comparing the code I found that in this part of the code:
settings_form = widgets.TableForm(
I am not a good coder. In my mind a coder is determined by how much he loves C (or, in clinical cases, assembler). I hate C and avoid it whenever I can, because I am always off-by-one, and often even in more then one place, which make debugging even more .. fun. :(
Learning TurboGears now. True MVC separation. Nice and powerful. Templates are valid XHTML documents (and not a mess of gibberish). Not much magic. I hate magic. Especially when it fails. I look forward to writing a task tracking system for a very special project in this framework. More about the project when it is launched. You're gonna love it ;)
Also I am going to visit my family - they still have no Internet, so I'll be mostly offline 'till the New Year (except for this and this). So I wish you all a Merry Christmas (note: there is absolutely nothing christian about Christmas - it existed like 2000 years before that character from Bible is born according to that book and in Latvian this day is called "Ziemassvētki" - "ziema" = winter, "svētki" = celebration) and a Happy New Year (if you are really an orthodox christian, why do you count years the new, non-christian way? you should be celebrating New Year on 13th of January like Christ did and the Orthodox church still does, because it uses Julian Calendar more then 420 years after it has been denounced)!
Oh, the fun of touting religious people ... of any religion ... :D Have fun everybody!
Footnote: in October I noted that there have been 11000 spam mails in my GMail spam box at that point (it stores only spam that has arrived in last 30 days). Today I am pleased to say that I can only see 4300 spam mails there today. It could be that GMail has implemented some procedures so that some spam does not even reach that folder, but I shall be very optimistic and say that amount of spam has declined! Maybe spammers are on holidays? If so, I wish they stay there :D
Another tiny note - why is it so that all the Python wrappers for Gnome and Freedesktop related things (GnomeVFS and DBus in my experience) have absolutely no API documentation !!! PyGTK has a nice set of documentation for GTK work, but it doesn't extend beyond that, sadly. When I was writing SBackup, I had to resort to using Python build-in function dir() to show me what names the gnomevfs module exported and guestimate my way from there. That was ugly as hell, but worked. Now I am trying to find any information about that "new" DBus thing that everyone was so excited about approximately a year ago - I can only find a few blog posts about rewrites of said API and a few simple programs that do not even work with the rewritten API. I mean - I can understand not having documentation for internal functions of a desktop program, but not having a public API document for a critical library of freedesktop.org desktop infrastructure - that is just plain dumb.
Edit: It seams that there is some kind of dbus tutorial with Python API section. I do not know, why it didn't appear on first 10 pages of Google search for "dbus python" or "dbus python API", but I hope this linking will help that a bit. Also, we will see, how useful it actually is - the rest of the document itself is quite cryptic to me.
Edit2: I am impressed, the Python chapter is definitely written by someone different from those that wrote the rest of the dbus tutorial - this part actually makes sense, is very detailed and hand-holding when it is needed. i got almost all my questions answered. Thanks to whoever wrote that!
Remote restore fixed. Full planned functionality reached.
All that I planned to do for Simple Backup is done as of version 0.7.
Now I only need to wait for the evaluation from my mentors at Ubuntu and to fix all bugs they and all other users find :D
I also did a bit of refactoring in this release oriented towards less memory usage. Results:
Ok, now the 0.5 release of my Simple Backup suite can now actually restore something from your backups! (both command-line and Gnome interfaces) It now even does automatic backups (and not just claims that it does). It even doesn't store empty folders in the backup. Oh and some usability fixes are also thrown in for no extra charge. :)
Note: due to a small, tiny bug in gnomevfs, restoring files from remote backup locations doesn't work yet. I'll have to do a lot of hacking to get that working :P
This week was a productive for me, but I did run into some unexpected
technical difficulities and thus had to work throught the weekend to
I just did the 0.3 release on freashmeat and sourceforge.
* backend daemon - ok
* GUI configurator - ok
* commandline restore - 50% (need to write a directory extraction
function that is missing from python tarfile module)
* GUI restore - 95% (depends on command line restore)
* GUI to write a backup snapshot to cd - 0%, optional
Of course extensive optimisation, testing and polishing is quite needed too.
I should be able to finish the restore tools tomorrow if no other
major problems occur.
Still writing a restore tool :(
Last two hours were spent debugging an interesting problem with TreeView in PyGTK. It was too slow to parse and add all files from a backup snapshot to the tree view at once (not to mention that it took 35 Mb of RAM :P), so I decided to load the tree as needed - I would add the children of a node only when this node gets expanded. So I happily wrote a handler to 'row-expanded' event that does just that - adds some children to the newly expanded node.
Note: as the node cannot expand if it doesn't have some children already, I also add a dummy child to all directory nodes
Then the problem came up - once I enabled my handler, the nodes would not expand anymore: the expansion handles were there, I could click on them and see the CPU being chewed away by the parsing of the 6 Mb nodelist, but nothing changed in the interface - even the dummy node didn't come up.
That confused not only me, but also #pygtk people. I wrote a 15 line simple script to replicate the problem, but everything worked fine there :O. At this point I started commenting stuff out at random and found out that breaking the link between treestore and treeview (recommended in docs to avoid excessive updates) resets the expansion state. Doh.
But it was not the end yet. After that I noticed that the nodes didn't expand on the first try, but only on the second. 8) After some mental mummbo-jummbo I came to an idea that proved to be dumb, but correct. Prepare for a gem boys and girls - if, in the process of execution of row-expanded handler, at at least one point the expanding node has no children (like when you have removed the dummy node, but still haven't added the real ones) - the expansion doesn't happen!
Two bugs^Wfeatures with the same effect. Oh, the fun of debugging never stops :D
Simple Backup Solution 0.1 is out !
With this simple and humble name my SoC project has met the first milestone - I have a fully functioning backend for my backup solution. The GUI is to be done next week.
You can get see the spec here, get the 0.1.1 version here and monitor all my development activity via my online repository. (You can access it with your web browser or with bazaar-ng.)
A Debian package will be uploaded after completion of all planned functionality, i.e. in a couple of weeks.