Ever wondered why OpenSource projects, pet projects have been surprisingly successful? Yes, I know there are quite a lot which weren't quite sucessful. But what draws people to the successful ones?
Part of the answer, I believe, is in this talk by Dan Pink.
The crux is Intrinsic motivation trumps Extrinsic motivation for a number of problems and challenges.
Saturday, September 26, 2009
Motivation
Monday, October 27, 2008
Boot with reduced memory
It is fun to boot with less memory, set performance counters analyze them and ofcourse be surprised by the results. Interestingly, it is quite straight forward to do this on Linux and Windows.
In Linux: boot-time parameter mem=X, where X is the amount of memory[MB] you want Linux to recognize. You could alter it in grub as well.
In windows: bcdedit /set removememory X, where X is the amount of memory[MB] to be deducted from total available memory.
One reason to embark on such an activity is to estimate how much RAM would be optimal for your regular workloads.
Here are some references:
Linux
Windows.
Friday, July 11, 2008
Blunder
Came across an article on Hindu, snippet presented below:
Genuine software has become more of an essential need. Users cannot do without original versions of operating systems such as Windows XP, Vista and Linux which are most sought after and are expensive.While I agree that users cannot do without original versions of operating systems [Well, not completely. However for argument sake, lets assume I do], how is Linux expensive?
It hardly costs anything to download a 50MB "genuine" version of Damn Small Linux, or order a free CD of "genuine" Ubuntu!
This is just one of many recent blunders spotted in The Hindu. What is wrong with these people?
Sunday, July 6, 2008
Terminally Consolable
Ladies and Gentlemen, Boys and girls.
This post, after a long gap, comes from Goltwanaland.
Due to some explicable reasons I have begun using Windows lately. Being a not-much-mouse-liker [read despise it] - MouseRatPoizon, Ion, Screen were/are my preferred "Window" managers - I have since begun looking for ways to manage the system through cmd.exe.
Fortunately, the last entry of "help more" -- WMIC turned out to be of great help.
Here are some references for those who feel -- "terminally inconsolable" -- in Windows.
Technet
MSDN
Labels: Computers
Tuesday, May 20, 2008
Treasure Hunt Solution
Official Google Blog: Google Treasure Hunt update
The second question in the series is a small exercise in Unix.
The template of the question is thus:
Unzip the archive, then process the resulting files to obtain a numeric result. You'll be taking the sum of lines from files matching a certain description, and multiplying those sums together to obtain a final result. Note that files have many different extensions, like '.pdf' and '.js', but all are plain text files containing a small number of lines of text.
Sum of line L1 for all files with path or name containing W1 and ending in .EXT1
Sum of line L2 for all files with path or name containing W2 and ending in .EXT2
Hint: If the requested line does not exist, do not increment the sum.Multiply all the above sums together and enter the product below.
(Note: Answer must be an exact, decimal representation of the number.)
Here's a dirty little script to do the job:
local sum=0
for file in `unzip -l $ZIP_FILE|sed -nre "/.*$1.*$2/p"|tr -s " "|cut -f5 -d" "`
do
val=`sed -n $3p ../$file`
if [ ! -z $val ];
then sum=$(($val+$sum));
fi
done
let sum_${4}=$sum
}
ZIP_FILE=$1
#TH $W $EXT $L
TH $2 $3 $4 1
TH $5 $6 $7 2
echo $sum_1*$sum_2 |bc
Wednesday, April 30, 2008
VMWoes
Its been a while since I last posted. So here I am, cribbing ... about VMware on Linux
Woe 1: Patch your vm- modules for each new kernel you experiment with.
Notwithstanding the publicity about Hardy Heron, I decided to update my home PC from 7.04. While the upgrade in itself was a breeze, reconfiguring VMware, put me through enough to want to repent it.
Patented as it is, the aforementioned upgrade must strictly happen as 7.04 -> 7.10 -> 8.04. Understandably, the implicit kernel version changes, can will break your VMware installation. This would be solved by recompiling the vmmon, vmblock and vmnet modules. However changes in the kernel like
- Renaming of certain structure members [in the networking stack] for readability,
- reassigning of typedefs,
- relocation of declarations
So if you don't want to patch the VMware code yourself, here's what you could do:
Download the any-any patch from here.
Run the perl script and just do what it says.
If you just upgraded to Heron, don't forget to install the c++ compiler, preferably using
sudo apt-get install build-essential
Woe 2: Reconfigure vmware for an old kernel after you boot out of a new kernel.
This was too troublesome, until I figured out the following:
- The vm- modules are located in /usr/lib/modules/`uname -r`/misc/
- The vmware init script loads these modules using insmod path_to_module.
- Each time you boot into a kernel for which vmware is not configured, a file no_configured is created in /etc/vmware. And it dutifully remains there,preventing vm- modules from loading, until you run vmware-config with success.
- Push the vmware init script to a higher than default run-level.
- Before any reboot do : rm /etc/vmware/not_configured
Despite having these workarounds, I am not really satisfied with using vmware. Its probably time to reconsider qemu. The qemu-manual has been reassuring in the sense that VMware images can be imported to what-ever-format-qemu-requires.
But before that its time to experiment with vmware and cgroups - the hottest feature in 2.6.24.
As an aside, the build-essential package information is quite entertaining. Excerpt:
"If you do not plan to build Debian packages, you don't need this package. Moreover this package is not required for building Debian packages. .... " :)
Sunday, February 3, 2008
CONCRETE
Prior to January's "stab of the month", I was trying to figure a way for limiting bot movement in KodeKombat - without the if-elif-else constructs. This class of program control constructs like if-elif-else, switch case, translate to branch instructions in machine language which can, in theory and in practice, slow down your code.
Pipelining, a feature responsible for modern processors' high throughput, is achieved by instruction prefetch. Knowing the branch that must be taken apriori is handled by inferences drawn from statistical observation and other techniques. However guessing can only take thus far.
Is there any alternative? More importantly, can there be one?
Well, consider the task of generating random numbers in the range [0-49]. Straightforward way to do it:
Method 1:
GEN: var=rand()
if(var E [0-49] )
return var
goto GEN
An alternative way to do the same, sans if-elif-else:
Method 2:
return rand()%50
There are 2 glaringly obvious issues in the alternative, that need immediate attention.
- Is the %(modulus) operator faster than the overhead from a wrong branch? Don't know and don't care. The objective of this endeavor is to figure out whether or not _if_ can be eliminated. So lets chuck complexity away, at least for a while.
- Side-effects. The modulus operator classifies the entire set of integers into one of 50 equivalence classes. Result your (pseudo-)random number generator may not behave all that randomly!
ceiling[x/(1+x^2)] + floor[x/(1+x^2)]
How the deuce should the floor and ceiling functions be implemented w/o if-else construct?
To state the problem differently(as Mr. Thm 8.3 put it): We want to express a discontinuous function as a continuous one. Now there we have a problem.
Fourier transform of a square wave from time domain to frequency domain does something along those lines. May be one could adapt it to this problem, but it is an infinite series.
But tell me something, to put a 32 bit number into one of 2 or 3 buckets characterized by 2/4 bits do we need an infinite series?
I would like to hear your opinion on this and any mistakes I have made.
Labels: Computers, Mathematics
Sunday, January 20, 2008
Mozhi and Synchronization
Recently I saw Mozhi.: a Tamil movie. It has a critically acclaimed storyline and had a respectable box-office presence according to Wikipedia. The comedy is well scripted and appropriately acted out on screen -- result an enjoyable movie. Aside from the comedy, a noticeable aspect is the message conveyed -- Silence is a language. Well, the lead female protagonist does make this statement, and I think the movie is centered around it.
Lets have a computational - communication perspective of this idea. In a world of silence, there is only __silence__ :). WLOG it can be assigned to the bit 0. So this language would have only one alphabet and strings of arbitrary length. Think of the fate of an FA that accepts such a language. Technically its a regular language represented by : 0*.
What is however more interesting is parsing/recognizing the words of the language during a conversation. From a communication perspective, it translates to the following: Sender S with clock C1 transmits a string of 0s to receiver R with clock C2. C1 <> C2, in a general setup. Additionally,
It would however be nice to prove/disprove [rigorously] the existence of a coding mechanism that can work with the above restrictions.
Monday, January 14, 2008
Man-Eater|MONITOR
This post is on monitoring bandwidth usage under Linux, the importance of which I until recently,had more than neglected.
One stop solution : IPTABLES
Your 2.6 kernel must have the following kernel modules, [I guess]: ip_tables,iptable_filter
The following script sets-up counter for various protocols.
#!/bin/bash
. bwusage.conf
foo() {
local VAR_NAME=\$"$1"
local VAL_VAR_NAME=`eval "expr \"$VAR_NAME\""`
if [ -z "$VAL_VAR_NAME" ]
then
eval "$1=\"\""
else
eval "$1=\" $2 $VAL_VAR_NAME\""
fi
}
foo INPUT_IFACE -i
foo OUTPUT_IFACE -o
foo DESTINATION -d
foo SOURCE -s
foot() {
echo $SHA_BANG$SHELL
for PROTOCOL in `sed -ne "s/^\([a-z]\+\)\t\([0-9]\)\+.*$/\1/p" $PROTOCOLS_FILE`
do
CMD="iptables -v -A $MODE $IFACE $SOURCE $DESTINATION -p $PROTOCOL"
echo $CMD
# CMD="iptables -v -A $MODE $OUTPUT_IFACE $SOURCE $DESTINATION -p $PROTOCOL"
# echo $CMD
done
}> $CMDLST
if [ $MODE == "INPUT" ]
then
IFACE=$INPUT_IFACE
else
IFACE=$OUTPUT_IFACE
fi
chmod +x $CMDLST
This is the variables declaration file.
#bwusage.conf
# This file is sourced by bwusage
#
PROTOCOLS_FILE=/etc/protocols
INPUT_IFACE=eth1
OUTPUT_IFACE=eth1
SOURCE="172.16.54.54"
DESTINATION="172.16.54.54/16"
MODE=OUTPUT
SHA_BANG=#!
CMDLST=cmdlist
The result is a file called cmdlist [or whatever $CMDLST equals] which needs to be executed to setup the rules. I found it useful to save the rules in text, as it can be utilized when you want to mass delete some/all of these rules. Replace -A by -D in $CMDLST
Although this serves the purpose, the following thought is worth considering:
Except the protocol=ip rule in any chain, upon matching one rule, it will not successfully match against another, yet it goes on to match it against the next. A TCP packet cannot be a RDP or UDP packet as well. So is it possible to specify rules in a way that further scanning is avoided.
If you do know how to do it please leave a comment detailing the same.
Wednesday, January 2, 2008
Natural Refrigerator
While it is more than heartening and exhilarating to see a White Christmas and a Whiter New Year, it is an altogether different feeling to see the mercury plummet to -15 C with wind chill intensifying it to -26 C. The bright side to all this: Clear sky and a bright sun making the snow glow all the more.
Was tough driving outside...... Tougher to cross a signal.......on foot.