Wednesday, December 2, 2009

The Kingdom of Bhutan - video

Found unprocessed video fragments from the Bhutan trip and pieced them together. Got the 6m30s video as the result. Shared on YouTube. Will annotate it later - time permitting. Also, here are the links to our photos from that Bhutan trip:

Wednesday, October 28, 2009

Snow Leopard changes "tar" parameters

Turns out that the "tar" utility in Snow Leopard now does not have the "--owner" and "--group" parameters - bummer for backward compatibility. Not sure, if anything else is missing.

Tuesday, October 27, 2009


I needed to plot distribution of timed events today and ended up with the following Ruby script to prepare the csv data:

#!/usr/bin/env ruby
# (c) 2009 Vlad Didenko
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    GNU General Public License for more details.
#    See the GNU General Public License at
#    for the detailed text of the license.

data = {}

while gets() do
  $_.split().each do |item|
    inum = item.to_i
    if data[inum]; then data[inum] += 1; else data[inum] = 1 end

data.keys().sort().each do |key|
  puts "#{key}, #{data[key]}"

Here is the usage example when this script saved as distr executable:

$ echo "1 4 235 3 2 3 1 4 2 3 4 1 2 45 6 3 2" | distr 
1, 3
2, 4
3, 4
4, 3
6, 1
45, 1
235, 1

As with any gets-based script, it takes filenames as parameters as well.

read more ...

Tuesday, September 22, 2009


We have been discussing the values and patterns of a happy family living for a while. It turned out that we can use a house planning tool as a great conversation enabler. A few things bond better than dreaming together. As the result we got the retirement house plan, and offer you the "open house" video tour.

Sunday, August 2, 2009

Recent Files

As I get back to my projects after a break, I often struggle to remember which files I worked on last.

Here is the utility (ruby script) to show just a few recent files (click to download). After downloading the recent script, run chmod to set executable permission and put it on search path. Running the script with -h parameter prints additional usage information.

I use it on OS X - another OS mileage may vary.

#!/usr/bin/env ruby
# (c) 2009 Vlad Didenko
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    GNU General Public License for more details.
#    See the GNU General Public License at <> 
#    for the detailed text of the license.

require 'optparse'

$limit  = 10
$target = "."
$dirs = false

optparse = do |opts|
  opts.banner = "Usage: recent [ -n LIMIT ]  [ -d ] [ -t DIRECTORY ]

    The utility traverses regular files and directories to find which ones are most
    recently modified. Symbolic links and special files (pipes, device files, etc.)
    are ignored. It does not detect hard link loops and filesystem boundaries.

  opts.on( '-n',
           '--limit LIMIT',
           'Only output this number of files. Default is 10.'
  ) { |limit| $limit = limit.to_i }

  opts.on( '-d',
           'Include directories in the results. Default is false.'
  ) { $dirs = true }

  opts.on( '-t',
                '--target DIR',
                'Scan the specified directory.'
  ) { |dir| $target = dir }

  opts.on( '-h', '--help', 'Display this screen' ) do
    puts opts

class RctFile
  attr_reader :mtime, :path
  def initialize( name )
    @path = name
    @mtime = File.mtime( name )
  def <=>( other )
    - ( @mtime <=> other.mtime )
  def recents(limit, dirs)
    r = ( dirs ? [ self ] : [] )
    return r unless File.executable?( @path ) and File.readable?( @path )
    Dir.foreach( @path ) do |file|
      next if file[0..0] == '.'
      fname = @path + '/' + file
        r = r + fname ).recents( limit, dirs )
      elsif File.file?(fname)
        r << fname )
    r.sort()[ 0..( limit - 1 ) ]
end $target ).recents($limit, $dirs).each do |recent|
  puts "#{recent.mtime}\t#{recent.path}\n"

Monday, June 29, 2009

Thank you to PragProg

Hey just thought to drop a quick thank you to the «Pragmatic» guys at Not only they made all their titles available in e-book formats from now on. They also went back and re-rendered almost all books in PDF format and made them available as e-books to the previous customers at no cost. That is what taking care of the customer supposed to be! Thank you!

Sunday, June 28, 2009


These are the organizations driven by generating maximum profit for their stakeholders. One part of what they are doing to achieve that, is to use the innovation and creativity of others at the lowest cost possible. Another part relevant to the topic is that most corporations are also authors and are incenticized by the copyright law to create and innovate, as they have means to sustain revenue from their innovation and creativity by controlling price and distribution of the use of their works.

Saturday, June 27, 2009

Society at large

Notice, how loose is the relationship between the societal benefit and implementing author's will. Society's goal in by itself is not to make authors happy. The goal is for the society to benefit in a long term from all the innovations and the creativity. Authors' will enforcement process is secondary and is to serve that goal through created incentives. The enforcement process is also expensive and society needs to somehow balance the short term enforcement expenses versus the long term benefits. Which mean, that if society finds another, cheaper, way to bolster creativity and innovation, then copyright protections may get thrown out of the door.

Friday, June 26, 2009


Museums are chartered with creating preservation environment, in which past achievements of humanity are made available to general public for further advancement of the society. They are mostly governed by boards of established and respected individuals, who act on their perception of what is good for the society and how to best fulfill their museum’s charter. Often collaborating (or merged) with museums and other repositories are research organizations, which are chartered with making sense out of the mass of collected artifacts, building links and answering «why?» and alike questions.

Thursday, June 25, 2009

Individual authors

Individual authors' creativity drivers vary depending on their personal believes, social position and accessible wealth. Depending on these and other factors, authors might have three main drivers: survival needs, quality of life, and self-realization (which includes a greater societal good for many authors). Society's copyright infrastructure aids fulfillment of all three drivers through the availability of commercial and free (in many senses) licenses, allowing them (in theory) to control creative works distribution and charge for their use.

Wednesday, June 24, 2009

Back to basics

The «Orphan Works» issue is clearly linked to the notion of copyright, so I have been thinking about the orphan works in the context of that link and it's original purpose.

From my perspective, the copyright concept is to encourage individual and collective authors to innovate so that society may benefit from it. To facilitate this, the copyright law is designed for one basic thing: to respect will of authors regarding how their work should be treated in the society.

The rest in the copyright domain should be a derivative from the main objective. An author’s will is usually expressed in a license. Authors may decide to charge for the use of their work which should be respected. Authors may decide to publish their work under Creative Commons License, and that spirit should be respected as well. The notion of copyright should not be considered good or evil in by itself: it is value neutral.

Many more developments happened in the copyright domain and quite a few groups injected their special interests into the copyright laws. To untangle the mess, however, one needs to have the original intentions clear.

Friday, April 3, 2009

"Industry standard" baggage

Headaches of the modern Internet technology include outdated non-standard "industry standards". Those are extra features, or additional functionality, which was at some time popular, but then went out of favor and never made it to a formal standard specification. Obvious examples are miscellaneous Internet Explorer 6 behaviors. Once popular and almost the only way to do cool stuff on the Internet, now it is an annoying and expensive piece of software, yet hard to replace and impossible to ignore.

Situations like that create some sort of societal cognitive dissonance. Some people fully understand that the technology is outdated and can be replaced with new, better standard-compliant options, which are more effective in a long run. The long-run effectiveness is hard to justify and, as any future prediction, faces scrutiny from business side of organization, which is against spending money on a technology update with an uncertain benefit, of may potentially phase itself out with new hardware or environment alike.

That is the situation, when both sides benefited from the initial popularity if the non-standard "industry standard". Yet only one side - the user organizations, and completely innocent third party developers are left in the dust or eat the transition cost. Which leads me to a question: Should a vendor have a societal responsibility to aid the transition in some way? What might it look like? Some companies provide conversion scripts to aid code transition. Should it be at least expected to have transition guides downloadable? You know, in IE6 case, those guides which would not only include transition of documented IE 6 behaviors, but also the undocumented ones, which are widely used because they were the only way to get things done? How about pushing businesses to understand the outdated technolody limitations? What else may be relevant?

read more ...

Thursday, January 29, 2009

Application memory footprint logging

I needed to figure out an nginx memory footprint and it is inconvenient given it is one master and 64 children processes. So, here is the shell script (runs on Centos), which collects the data based on the pid file:


if [ -f "$1" ]
  export THE_FILE=$1
  export THE_PID=`cat $1`
  read -ep "pid: "
  export THE_PID=$REPLY

ps o rss,vsz p ${THE_PID} --ppid ${THE_PID} h |
awk -v OFS=', ' '{
  rss += $1;
  vsz +=$2;
} END {
  print strftime( "%Y.%m.%d %H:%M:%S %z", systime()), ENVIRON["THE_PID"], rss, vsz, ENVIRON["THE_FILE"];

One can run multiple of those adding output to the same log file for late processing. For example, my crontab looks lile this:

1,16,31,46 * * * * /usr/local/bin/pm /serv1/logs/ >> /var/log/mem_usage
6,21,36,51 * * * * /usr/local/bin/pm /serv2/logs/ >> /var/log/mem_usage

The pm is the script from above. It produces output similar to this:

2009.01.29 14:31:01 -0600, 27354, 10068, 150716, /serv1/logs/
2009.01.29 14:36:01 -0600, 27296, 96708, 821224, /serv2/logs/
2009.01.29 14:46:01 -0600, 27354, 10068, 150716, /serv1/logs/
2009.01.29 14:51:01 -0600, 27296, 96708, 821224, /serv2/logs/
2009.01.29 15:01:01 -0600, 27354, 10068, 150716, /serv1/logs/
2009.01.29 15:06:01 -0600, 27296, 96708, 821224, /serv2/logs/

The fields are: timestamp, process ID, resident memory, virtual memory, pid source file (if any). I think there should be a better way to do it. Please, comment, if you find one.

read more ...

Monday, January 12, 2009

Corellating happiness with..

... the use of entertainment industry.

From my completely unscientific observations it seems, that the happier a person is, then (s)he is less reliant on an entertainment industry. Either happier people:

  1. do not need entertainment,
  2. entertain themselves without an external help, or
  3. entertainment industries target the less happy part of the population and so miss the mark with happier people.

What kind of metric could prove or break the hypothesis?