October 6, 2009

~/research cleanup

A habit that I picked up from my job at Trolltech was to put all my experimental code in a directory called research. Each project gets its own sub-directory there. We used to also have a similarly named folder in p4 depot and it was totally unmanageable. I wonder what happened to all that code after they moved to git – there were hundreds of very interesting code samples there.

Back to me, over the years (yeah, like past 4-5 years), I have abused my research directory for examples, bug reports, writeups, screenshots/videos, blog posts and I thought it’s about time I clean it up :) . I have been cleaning up 10-15 subdirectories a day for the past week (I have ~100 more to go) and I have to admit I grossly overestimated the value of the stuff in there :) . But here’s what I found worth sharing so far (all of them are Qt examples, of course):

  • customfont – How to load and use custom fonts.
  • mplayerembed – How to embed mplayer into your app and control movie play (X11 only)
  • customnetworkreply – This lets you create custom url’s inside qt/webkit. For example, you can embed a myapp://give/me/some/stuff or a http://myapp/foo.png. Code inspired from assistant.
  • textlayoutprimer – I wrote this one when I was trying to understand how laying out text works inside QTextEdit (using QTextLayout). More didactic than an usable example.
  • translucentbackground – Translucent background example (Uses ARGB visuals, requires composition manager)
  • clipboardwatcher – Displays content of clipboard/selection as they change. Very useful to test dnd. I think I stole initial parts of the code from a similar Qt example.

I am still figuring what is a good way to maintain all this sample/throw away code. I also have ~/tmp where I have code that I can nuke without any thought. Any suggestions? What do you do? A problem I have had is I never manage to find the right code samples when I need them. I have already found many dups when cleaning up!

One Response to “~/research cleanup”

  1. Stefan Majewsky says:

    “I am still figuring what is a good way to maintain all this sample/throw away code. [...] Any suggestions? What do you do?”

    I have recently set up a Git repo [1] where I publish some smaller code bits whenever I find some. Also, I have a simple PHP webpage [2], which reads and displays the README.html from the repo.

    [1] http://github.com/majewsky/majewsky-misc
    [2] http://people.ages-skripte.org/~majewsky/majewsky-misc.php

Leave a comment

(email will not be published)