Home / Blog

As I didn't find a satisfactory solution to record screencasts, I decided to write a small script tailored to my needs, which were:

  • stable solution, not crashing 50% of the time
  • ability to select the window to record
  • ability to pause and restart recording the same area of the desktop
  • ability to record sound during the capture
  • work with Free/Open Source Software

That's not too much asked I guess.... Anyway, here's the solution: screencaster.rb , a 55 line ruby script using ffmpeg.

When you start, it asks you to click on the window you want to record and what's the directory name (place in /tmp) in which to store the movie(s). It then starts right away recording that region of your desktop. In the terminal where you launched screencast.rb, type p followed by Enter to pause the recording. Then to restart recording, type n followed by Enter (it records each part in separate files). To quit, enter q+Enter.

I've used it to record a screencast, and it worked flawlessly. To produce the final file, I used .Kdenlive

Note: in addition to ffmpeg, it also depends on xwininfo

In MyOwnDB , there's an CrosstabObject inheriting from ActiveRecord, but that doesn't correspond to any table in the database (actually, it is configured to map to a table in the database as this is mandated by AR, but it's never used like that). It is only used to select data with find_by_sql.

Now, some columns of the data returned by the query can be data that has been serialized to YAML, but each query has its own set of serialized columns.

I first tried to call the serialize method provided by rails, but it didn't work. I suspect the ActiveRecord model needs the column to exist when it is initialized for the serialization to be activated, which is not the case here as the CrosstabObject is mapped to an object that doesn't have the columns returned by the sql query.

In this example, the query returns a result set which has the test_attach column serialized to YAML. test_attach is not a column of the table to which CrosstabObject was mapped. As you can see, the serialization is configured, but has no effect on the returned data:

If I redefine the test_attach accessor on list[6] 's singleton class, I get the expected result though:

As each query has its own set of serialized columns, what I want to do is just pass the list of columns that contain serialized data, so that the accessors get defined, which is easily done by adding a method to CrosstabObject:

which enables me to easily configure the columns returned by the sql query that are serialized:

I'm available for hire 

If you're looking for someone to temporarily join your IT team, or if you need help to put IT to work in your company, I'm ready to help. Contact me now !

Mon Tue Wed Thu Fri Sat Sun
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31