Friday, May 28, 2010

Tax for holding intellectual properties

There are a few parallelisms between intellectual properties and real estate properties: They last indefinitely. They exclude public access. They cost law enforcement.

However, real estate properties are localized and the effect of any single property on general public is limited. (There could be exceptions, for example, the property of the only water source within a large area of land.) However, intellectual properties are generally universal since new knowledge is build on old. The effect of their restriction can grow and propagate to all aspects of public lives. (Imagine patent on wheels, clocks, or electricity; Copyrights on all classical texts or musics; Or, trademarks on commonly used words.)

So, under a necessary condition that such an intellectual property is to be granted to a private holder, proper tax should be assessed to recover the cost to the public. This can include loss of free access, blockage of innovation, and cost of property right enforcement. It is easy to imagine the growth of such cost will generally speed up in time. Thus, the tax rate should increase with the time that such a right is held.

Alternatively, the creation of intellectual properties can be compensated and rewarded up front and their access should be made free to the public. The only difficulty is in determining the value of these properties. As naive this may sound, it has been practiced since the incipiency of science, where scientific knowledge gained is open to the public and scientists are rewarded by fame and status for the impact they made. Similar difficulty exists in judging the value of a research, but the current system based on consensus appears to be working.

Friday, May 7, 2010

Processing command-line arguments in C++

I just released arg as a standalone library under LGPL. It's a command-line parser for C++ programs. The aim is to keep the programming effort in adding command-line processing to C++ programs at a minimum. There are several considerations in this direction:
  1. simple and intuitive syntax
  2. requiring no redundancy
  3. localized codes
  4. extensibility
  5. completeness
The simple example as given on the arg homepage,
#include <arg.hh>
#include <iostream>
int main(int argc, char ** argv)
{
        arg::Parser p;
        int n;
        p.add_opt('n').stow(n);
        p.parse(argc, argv);
        std::cout << n << '\n';
        return 0;
}
should be very close to the minimum as far as 1. goes.

Programming is for a programmer to describe what he wants the computer to do. Per point 2., he should not be asked to provide the same information multiple times. (Well, maybe except in situations where multiple confirmations are required: "Launch the missile. Please have the missile launched. Yes, I really want you to launch the missile! Launch the *&^%$ missile!!!"; Computer: "Aborted on Error: missile != *&^%$ missile".)

When working on an item, e.g., adding a new command-line option, the programmer won't be asked to go to multiple places in the codes if 3. is observed. While common and frequent usages should be supported and simplified in the library, new and novel applications will ask for 4. Finally, some rare, special, and/or tricky applications will demand 5. in the arsenal.

Thursday, May 6, 2010

Push forward

As an organic matter, one requires constant exertion to maintain tension. The process ends when tension is out.

Sunday, October 4, 2009

OpenSync with Nokia 2730 Classic

My Nokia 2730 classic is found to work with the following configuration file for the SyncML plugin for OpenSync:
<?xml version="1.0"?>
<config>
<bluetooth_address>XX:XX:XX:XX:XX:XX</bluetooth_address>
<bluetooth_channel>11</bluetooth_channel>
<interface>0</interface>
<identifier>PC Suite</identifier>
<version>1</version>
<wbxml>1</wbxml>
<username></username>
<password></password>
<type>2</type>
<usestringtable>0</usestringtable>
<onlyreplace>0</onlyreplace>
<onlyLocaltime>0</onlyLocaltime>
<recvLimit>0</recvLimit>
<maxObjSize>0</maxObjSize>
<contact_db>Contacts</contact_db>
<calendar_db>Calendar</calendar_db>
<note_db>Notes</note_db>
</config>
For more details see this guide and this HOWTO.

Thursday, February 26, 2009

synchronize work spaces on different machines

While working on a set of files on different machines, it's a common problem to keep things in sync. A real solution is to use a revision control system (with git being my current favorite). However, a quick fix is to use rsync. Following script tries to figure out which copy of the work space is newer and invokes rsync accordingly.
#!/bin/bash
if (( $# != 3 )); then
        echo "Usage: `basename $0` <local file> <remote host> <remote file>"
        exit 1;
fi
LOCAL_FILE="$1"
REMOTE_HOST="$2"
REMOTE_FILE="$3"

# make sure directories end with '/'
if [ -d "${LOCAL_FILE}" ]; then
        LOCAL_FILE=${LOCAL_FILE%/}/
        REMOTE_FILE=${REMOTE_FILE%/}/
        echo "sync directory: '`basename ${LOCAL_FILE}`' with ${REMOTE_HOST}"
else
        echo "sync file: '`basename ${LOCAL_FILE}`' with ${REMOTE_HOST}"
fi

# find out the last modification time in the entire directory
TM_LOCAL=`if [ -e "${LOCAL_FILE}" ]; then find $LOCAL_FILE -printf "%Ts %P\n"|sort|tail -n1; else echo 0; fi`
TM_REMOTE=`ssh ${REMOTE_HOST} "if [ -e \"${REMOTE_FILE}\" ]; then find $REMOTE_FILE -printf \"%Ts %P\n\"|sort|tail -n1; else echo 0; fi" < /dev/null`

echo Local Newest: $TM_LOCAL
echo Remote Newest: $TM_REMOTE
if [[ $TM_LOCAL < $TM_REMOTE ]]; then
        echo -n "remote => local"
        rsync -auz -e ssh --delete ${REMOTE_HOST}:"\"${REMOTE_FILE}\"" "${LOCAL_FILE}"
        echo ",  Done!"
elif [[ $TM_LOCAL > $TM_REMOTE ]]; then
        echo -n "local => remote"
        rsync -auz -e ssh --delete "${LOCAL_FILE}" ${REMOTE_HOST}:"\"${REMOTE_FILE}\""
        echo ",  Done!"
else
        echo "Nothing to do!"
fi

Wednesday, December 24, 2008

fox2html: foxmarks.json to HTML converter

This script converts "foxmarks.json" saved by the Firefox plugin, Foxmarks, on a self hosted server to a styled HTML file with interactive folders. An example output is here.

Thursday, September 25, 2008

Duplication elimination

In engineering a computation project, one desires a single point of information entry. It's elegant to come up with coding structures that will facilitate this requirement, that is, a single place in the codes pertinent to the to-be-computed problems. However, while the programming language is an interface between human and machine. It's not generally friendly to the users. The ultimate way of choice is to have human readable/editable files and make programs to generate corresponding codes when needed.