Academic answer to the question: Am I An Atheist Or An Agnostic?

July 25, 2008 by f241vc15

Whew. It’s been a while since my last post. School work, and especially my 2 jobs (3 actually if you include my not so demanding server admin work) have kept me really busy. Anyway, I still don’t have a lot of time to work on a really good post (either about technical stuff or about critical thinking and philosophy), but I just want to share this to people out there. So I’ll just make a few comments and give you the essential stuff.

The question (in the title of this post) is answered by none other than the great Bertrand Russell himself, who is one of my real life heroes. Russell is an outright atheist, though probably not as brutally frank as Richard Dawkins, whom I also admire. At this point in my life, as I’ve mentioned in an earlier post, I maintain my atheism but still with scientific curiosity and humility that we do not know yet (or perhaps will never know at all) or explain everything that is happening in nature. As Dawkins puts it in his book The God Delusion, understanding real academic science as well as being rational, one should be at 6 in a scale of 1 to 7, 7 being extreme atheism and 1 being extreme theism. I think we should still leave some room (however small) for error/s and other possibilities. And quoting Russell’s work (given below in this post):

Not to be absolutely certain is, I think, one of the essential things in rationality.

In this work of Russell, he beautifully argues what answer he would give to the question. He essentially says that depending on the person he is talking to, his answer will be different. He just classifies people he’ll talk to as either a layman/ordinary man or a philosopher/thinking man, and his answer is different on both accounts. I agree with him, and if you have a few minutes (roughly 5 - 10 minutes should be good enough, depending on how fast you read) I most certainly think reading this piece by Russell is a most enlightening, refreshing, revealing, or intellectually appealing/satisfying read. Without further ado, I give you the piece (you can download the pdf version at the bottom of this post):

Am I An Atheist Or An Agnostic?
A Plea For Tolerance In The Face Of New Dogmas

by Bertrand Russell (1947)

I speak as one who was intended by my father to be brought up as a Rationalist. He was quite as much of a Rationalist as I am, but he died when I was three years old, and the Court of Chancery decided that I was to have the benefits of a Christian education.

I think perhaps the Court of Chancery might have regretted that since. It does not seem to have done as much good as they hoped. Perhaps you may say that it would be rather a pity if Christian education were to cease, because you would then get no more Rationalists.

They arise chiefly out of reaction to a system of education which considers it quite right that a father should decree that his son should be brought up as a Muggletonian, we will say, or brought up on any other kind of nonsense, but he must on no account be brought up to think rationally. When I was young that was considered to be illegal.


Sin And The Bishops

Since I became a Rationalist I have found that there is still considerable scope in the world for the practical importance of a rationalist outlook, not only in matters of geology, but in all sorts of practical matters, such as divorce and birth control, and a question which has come up quite recently, artificial insemination, where bishops tell us that something is gravely sinful, but it is only gravely sinful because there is some text in the Bible about it. It is not gravely sinful because it does anybody harm, and that is not the argument. As long as you can say, and as long as you can persuade Parliament to go on saying, that a thing must not be done solely because there is some text in the Bible about it, so long obviously there is great need of Rationalism in practice.

As you may know, I got into great trouble in the United States solely because, on some practical issues, I considered that the ethical advice given in the Bible was not conclusive, and that on some points one should act differently from what the Bible says. On this ground it was decreed by a Law Court that I was not a fit person to teach in any university in the United States, so that I have some practical ground for preferring Rationalism to other outlooks.


Don’t Be Too Certain!

The question of how to define Rationalism is not altogether an easy one. I do not think that you could define it by rejection of this or that Christian dogma. It would be perfectly possible to be a complete and absolute Rationalist in the true sense of the term and yet accept this or that dogma.

The question is how to arrive at your opinions and not what your opinions are. The thing in which we believe is the supremacy of reason. If reason should lead you to orthodox conclusions, well and good; you are still a Rationalist. To my mind the essential thing is that one should base one’s arguments upon the kind of grounds that are accepted in science, and one should not regard anything that one accepts as quite certain, but only as probable in a greater or a less degree. Not to be absolutely certain is, I think, one of the essential things in rationality.


Proof of God

Here there comes a practical question which has often troubled me. Whenever I go into a foreign country or a prison or any similar place they always ask me what is my religion.

I never know whether I should say “Agnostic” or whether I should say “Atheist”. It is a very difficult question and I daresay that some of you have been troubled by it. As a philosopher, if I were speaking to a purely philosophic audience I should say that I ought to describe myself as an Agnostic, because I do not think that there is a conclusive argument by which one prove that there is not a God.

On the other hand, if I am to convey the right impression to the ordinary man in the street I think I ought to say that I am an Atheist, because when I say that I cannot prove that there is not a God, I ought to add equally that I cannot prove that there are not the Homeric gods.

None of us would seriously consider the possibility that all the gods of homer really exist, and yet if you were to set to work to give a logical demonstration that Zeus, Hera, Poseidon, and the rest of them did not exist you would find it an awful job. You could not get such proof.

Therefore, in regard to the Olympic gods, speaking to a purely philosophical audience, I would say that I am an Agnostic. But speaking popularly, I think that all of us would say in regard to those gods that we were Atheists. In regard to the Christian God, I should, I think, take exactly the same line.


Skepticism

There is exactly the same degree of possibility and likelihood of the existence of the Christian God as there is of the existence of the Homeric God. I cannot prove that either the Christian God or the Homeric gods do not exist, but I do not think that their existence is an alternative that is sufficiently probable to be worth serious consideration. Therefore, I suppose that that on these documents that they submit to me on these occasions I ought to say “Atheist”, although it has been a very difficult problem, and sometimes I have said one and sometimes the other without any clear principle by which to go.

When one admits that nothing is certain one must, I think, also admit that some things are much more nearly certain than others. It is much more nearly certain that we are assembled here tonight than it is that this or that political party is in the right. Certainly there are degrees of certainty, and one should be very careful to emphasize that fact, because otherwise one is landed in an utter skepticism, and complete skepticism would, of course, be totally barren and completely useless.


Persecution

On must remember that some things are very much more probable than others and may be so probable that it is not worth while to remember in practice that they are not wholly certain, except when it comes to questions of persecution.

If it comes to burning somebody at the stake for not believing it, then it is worth while to remember that after all he may be right, and it is not worth while to persecute him.

In general, if a man says, for instance, that the earth is flat, I am quite willing that he should propagate his opinion as hard as he likes. He may, of course, be right but I do not think he is. In practice you will, I think, do better to assume that the earth is round, although, of course, you may be mistaken. Therefore, I do not think we should go in for complete skepticism, but for a doctrine of degrees of probability.

I think that, on the whole, that is the kind of doctrine that the world needs. The world has become very full of new dogmas. he old dogmas have perhaps decayed, but new dogmas have arisen and, on the whole, I think that a dogma is harmful in proportion to its novelty. New dogmas are much worse that old ones.

Source: http://www.luminary.us/russell/atheist_agnostic.html

Downlaod the pdf file here. Now that’s taken cared of, I feel more relieved.

Comments/Questions/Suggestions are welcome as long as they come in a calm and ruly way.

svnserve the people

June 6, 2008 by f241vc15

If you consider yourself a programmer, especially one that works on a number of codes for a single project or on multiple projects which you update from time to time, then you must definitely know and use Subversion (svn) or something like it. Subversion is well-known in the open source community and is used on many open source projects such as: Apache Software Foundation, KDE, GNOME, Free Pascal, GCC, Python, Ruby, and Samba to name a few. That being said, what in the world are you waiting for? Go on using svn and get going/coding.

This post is about how to quickly use svn to get copies of codes or files from any svn repository on the web or even on your own LAN. The post also tackles how to quickly set up your own svn server or repository so you can start accessing your codes in an organized manner anywhere, as long as you have network connection. This post is by no means exhaustive and is only meant for quick do-it-yourself svn server/client setup. Resources at the end of this post are highly recommended for further or in-depth reading.

As a client

Client for svn means you are just getting files or uploading them from an already established svn repository/server. First, the most helpful svn command that one needs to learn is this line:

$svn help

which should give you this output or something very close to it:

usage: svn <subcommand> [options] [args]
Subversion command-line client, version 1.4.6.
Type ’svn help <subcommand>’ for help on a specific subcommand.
Type ’svn –version’ to see the program version and RA modules
or ’svn –version –quiet’ to see just the version number.

Most subcommands take file and/or directory arguments, recursing
on the directories. If no arguments are supplied to such a
command, it recurses on the current directory (inclusive) by default.

Available subcommands:
add
blame (praise, annotate, ann)
cat
checkout (co)
cleanup
commit (ci)
copy (cp)
delete (del, remove, rm)
diff (di)
export
help (?, h)
import
info
list (ls)
lock
log
merge
mkdir
move (mv, rename, ren)
propdel (pdel, pd)
propedit (pedit, pe)
propget (pget, pg)
proplist (plist, pl)
propset (pset, ps)
resolved
revert
status (stat, st)
switch (sw)
unlock
update (up)

Subversion is a tool for version control.
For additional information, see http://subversion.tigris.org/

Now, in order to get a copy of the code (or part of the code if you wish) in an existing svn repository (e.g. the svn for GCC) you simply enter the following (assuming of course you have svn installed, which shouldn’t be a problem in most operating systems, especially Linux distributions, nowadays):

$svn checkout svn://gcc.gnu.org/svn/gcc/trunk gcc

The previous command gets the code from the GCC trunk (the main branch/working version of a program/project) and copies it to your local storage space (hard disk etc.) under the directory gcc. From the output of svn help shown above, the option checkout or co can be used interchangeably, among others. Now if you have a working copy from an svn repository and there are updates from the repository, all you have to do to update your local copy is to go into the directory where you saved your svn copy of the codes from the repository (in this case, gcc) and enter:

$svn update

And for each updated item/code from the repository (repo) a line will start with a character reporting the action taken. These characters have the following meaning:

A - Added
D - Deleted
U - Updated
C - Conflict
G - Merged

Also, to get more information on a specific svn option such as update or checkout, you can use

$svn help command

where you substitute command for the command you want more info to. If you have your own repo or if you’re say a programmer and you have write access to an svn repo so you can upload your updated part of the code, you can simply go to the directory of your svn copy and enter:

$cp <code/s to copy> <directory where my svn copy is>

then to add the code/s to the version control management of svn:

$svn add <code/s copied>

and finally,

$svn commit -m “your message here for this specific commit”

Which commits or “uploads” your code to the svn repo, so that your changes will be reflected in the svn repo and others will get their copies of the changes you’ve made. You must have a commit message in between the two marks, since it’s required. You can also omit the -m and the message, but svn will open for you your default text editor so you can enter your commit message there. I personally prefer the second one since I can view the files I edited before committing them. Other useful svn commands where you can get useful information (and are worth looking into) include status, info, diff, and list, which can also be used if you are handling the svn server.

As a server

To quickly setup an svn server for LAN/Internet access, enter the following:

$svnadmin create myrepos

And change myrepos to your desired project directory name. Next, we create the typical svn directory layout (typical since there’s no rule from stopping you to change your directory layout, it’s just that the layout I’ll be mentioning is the usual layout convention widely used by developers):

$svn mkdir file:///home/f/temp/myrepos/trunk \

file:///home/f/temp/myrepos/branch \

file:///home/f/temp/myrepos/tags \

-m “initial layout of project codes”

(/home/f/temp/myrepos is the absolute path of my svn repo in this example) Where the trunk directory holds the main branch/version of your code/project, the branch directory holds the codes of your project wherein you considered altering a large part of it, or perhaps an extra/spin-off project from your main project/trunk. The tags directory usually holds the “snapshots” or milestones of your code/project in certain parts or history of its development, such as stable releases/versions, etc.

To check what you just did or to check any part of your svn repo, use:

$svn list file://URL

where you change URL to an absolute path in your sytem, such as /home/f/temp/myrepos/. The previous command gives the following output:

branch/
tags/
trunk/

If I have a directory named project_codes, with files

$ ls
index.php lib.h main.c

To add these codes to my svn repo under the trunk directory, and thus under svn’s version control management, I can use:

$ svn import ../project_codes/ file:///home/f/temp/myrepos/trunk \
-m “importing my project codes to svn trunk repo”

which outputs:

Adding ../project_codes/main.c
Adding ../project_codes/lib.h
Adding ../project_codes/index.php

Committed revision 2.

And to check, use list again:

$ svn list file:///home/f/temp/myrepos/trunk
index.php
lib.h
main.c

as usual, you can use the commands shown in svn help to administer your svn repo, never forgetting the syntax for the svn repo directory (svn command fiile://URL, where URL is an absolute path).

Lastly, there are 3 ways to serve your svn repo onto a network or to the Internet, but the ones I’ll be mentioning here are the easiest ones to setup, and most probably the ones in widest usage, and aren’t the least bit insecure (security-wise). But first, enter your svn repo directory, then into the conf directory to edit the file svnserve.conf. Make sure that the following lines are uncommented (without a ‘#’ at the beginning of the line):

anon-access = read
password-db = passwd

Where anon-access tells svn to let anonymous svn clients of your repo to be able to read only the files, not write over them (other valid values for this are write, and none). When you want your users to enter passwords before gaining access to your repo, password-db gets the users and their corresponding passwords from the file passwd under the conf directory. The passwd file is worth taking a look and has a very easy user management syntax. Under the [users] heading in the file passwd, it’s simply:

username = password

svnserve

svnserve (svnserve –help for some help or man svnserve for more info) is a lightweight server that allows svn clients to connect to your repo. You can use svnserve as a stand-alone background server or daemon process using:

$svnserve -d -r path

wherein path is a path to your root svn repo, in my case it’s /home/f/temp/myrepos.

svn over ssh

To include encryption (and security) into your svn repo transfers, you can tunnel svn access commands over ssh. This technique doesn’t actually need an svnserve running on the machine which houses the svn repo you want to access. The reason is that ssh first connects you to svn repo machine, then executes the svnserve command afterwords, so the process essentially logs you in via ssh and then runs svn commands for you (which of course allows you to do a lot more than just connect to the svn repo). To tunnel svn over ssh:

$svn checkout svn+ssh://user@host/path

wherein user is your user login to that svn repo machine, host is the hostname or IP address of the svn repo, and path is the absolute path to your svn repo on that host/machine. Once you manage to connect, you will be prompted with your password for that host/machine, not the password in the passwd file of the svn repo machine. Your succeeding transactions will require you to enter your password, with the benefit that your transfers to and from the svn repo machine are now encrypted.

Comments and suggestions are highly welcome, as long as they’re in a calm and ruly way (^)__(^).

References and further reading:

Help Sam Harris’ research on religious faith at the level of the brain

May 7, 2008 by f241vc15

Sam Harris, the author of New York Times best sellers The End of Faith and Letter to a Christian Nation, is asking for our help to further the first study of religious faith at the level of the brain. He has completed a bachelor of arts degree in philosophy at Stanford University. He is currently pursuing a doctorate in neuroscience at the University of California, Los Angeles, using functional magnetic resonance imaging to conduct research into the neural basis of belief, disbelief, and uncertainty. The latest (as of May 07, 2008 ) article on his website says:

“Research Volunteers Needed!

We are preparing to run another fMRI study of belief and disbelief, and we need volunteers to help us refine our experimental stimuli. This promises to be the first study of religious faith at the level of the brain. By responding to the four surveys I have posted online, you can make an enormous contribution to this work.

Please answer as many of the surveys as you can. If you only have time to answer one, please choose at random (otherwise, we will have many more responses to the first than to the others).

Feel free to post this message to your blog or to forward the relevant links to your friends. We especially need Christians to respond, as one of the goals of these surveys is to design stimuli that a majority of Christians will find doctrinally sound.

Please note: Each survey starts with the same first page of questions. “

The links to the surveys are shown below. Note that when taking any of the surveys, the following is given:

Thank you for participating in this survey. Your answers will help us design a neuroimaging experiment which will explore the difference between belief and disbelief at the level of the brain. For the purposes of our research, we ask that you take this survey ONLY IF you consider yourself to be:

1) a dedicated Christian

or

2) an atheist/nonbeliever.

This survey should take about 15 minutes to complete. At no point will you be asked to provide information that could be used to identify you in the future.

If you would like to be notified when the results of this research are published, please join the email list at www.samharris.org.

Again, thank you for your contribution to this work”

Which of course means that if you’re somewhat of an agnostic, you should probably skip the surveys. I took all 4 surveys within 10 minutes, as I’ve already taken several surveys relating to belief/disbelief such as my earlier post, and since I’m quite comfortable with my disbelief. Again as the website says, feel free to post the surveys in your blogs, or send them out to friends or mailing lists/groups.

Surveys by samharris.org:

Belief Survey A

Belief Survey B

Belief Survey C

Belief Survey D

For further reading and reference:

Sam Harris’ official website

Sam Harris’ Wikipedia page

Sam Harris’ page and links to his articles at www.machineslikeus.com, a great website on evolutionary thought, cognitive science, artificial life and artificial intelligence

New York Times review of Sam Harris’ book The End of Faith

New York Times best sellers which included Letter to a Christian Nation by Sam Harris and The God Delusion by Richard Dawkins

Reading e-books in Linux

May 6, 2008 by f241vc15

This post is about how one can read and enjoy their e-books in Linux, covering some of the more popular e-book formats and the software used to view them.

I love books. I love reading them whether they be in tangible (physical bound books) or intangible (electronic) form. Hence my increased infatuation when I discovered the joys of e-books years ago. I don’t have a portable device whose sole purpose is to let me read and view my e-books (since I refuse to carry devices which are built only for a single purpose), but I do have gadgets that do a lot of things, reading e-books included. However, I usually do my e-book reading in my PC/Linux box.

Popular e-book formats

Among the numerous e-book formats, the most prolific (in my opinion) format is PDF. There are many software and applications in Linux which can open and view PDF files, such as KPDF (the one that I use most of the time because it can be used as an embedded pdf viewer in Konqueror), XPDF, and Adobe Reader, among others. Acquiring those into your Linux distribution shouldn’t be a problem. Usually I prefer my e-books to be of PDF type since PDF stores data in vector format and at present, a lot of PDF files are coming out with OCR, which is great but which is not to say that it doesn’t have its cons, but for most reading purposes PDF files come out on top.

Another format is CHM, whose file types can be viewed in Linux using programs such as kchmviewer, and gnochm. I prefer kchmviewer at the moment, since it has a lot of useful features.

Another format which is used more recently is the DJVU format. Linux users can rest assured that DJVU file viewers are available for them, such as Djview, which can also be embedded in Konqueror. There are also browser plug-ins for opening DJVU files.

There are numerous more other e-book viewers such as fbreader which can open fb2 e-book format, Palmdoc, zTxt, TCR, RTF, OEB, OpenReader format and some other formats. One of the new book readers I’m really looking forward to is Okular, the new KDE4 PDF viewer, and also boasts of being able to open also CHM, and DJVU files among others. No need for a lot of separate book viewers.

Lastly, I’ll mention about the LIT book types, which is a proprietary file type by Microsoft. I’m not a big fan of Microsoft but some of the books I get are in .lit format. In order to view those files (or convert them into files already viewable) in Linux, small things need to be done.

Handling LIT files in Linux

A software, Calibre, can be used to open and view HTML, text, RTF, and LRF files, as well as convert LIT files to the former formats, if properly configured. Calibre is a reverse-engineered alternative reader for Sony’s e-reader. Calibre creates a library for your e-books, stored in a self-contained sqlite database format. If you’re an Ubuntu user, you simply do the following to install Calibre in your machine:

Enter the following command and make sure it returns at least a version of 2.5.1

python --version

then afterwards enter these

sudo apt-get install  python-setuptools python-imaging  libqt4-core libqt4-gui \
                      python-qt4 fonttools python-mechanize imagemagick \
                      xdg-utils python-dbus  python-lxml \
                      librsvg2-bin python-genshi help2man
sudo easy_install -U TTFQuery calibre
sudo calibre_postinstall

afterwards you install the tool convert-lit or clit by first installing the libtommath package

wget http://ace-host.stuart.id.au/russell/files/debian/sarge/libtommath/libtommath_0.37-1_i386.deb
sudo dpkg -i libtommath_0.37-1_i386.deb

then finally install clit

wget http://ace-host.stuart.id.au/russell/files/debian/sarge/clit/clit_1.8-1_i386.deb
sudo dpkg -i clit_1.8-1_i386.deb

Calibre can also be easily installed on other Linux distros such as Gentoo, Debian, and Fedora.

The Convert-lit or clit tool

Convert-lit or clit is the tool that is used by Calibre and all the succeeding software I’ll be mentioning here (in fact, it is the only tool for handling .lit files in Linux at present). Convert-lit or clit has 3 capabilities: The first of the clit command explodes (decompiles) the .lit ebook input file into its constituent HTML file and images which it places in the in an ouput directory. The output directory must already exist. To decompile a .lit e-book:

              mkdir my-ebook; clit my-ebook.lit my-ebook

The second form downconverts the .lit e-book file to a “Sealed” or DRM1 format file. This is useful for reading on handheld devices. To downconvert a .lit e-book:

clit my-ebook-drm5.lit my-ebook-drm1.lit

The third form inscribes the .lit ebook with the given label. To label a .lit e-book:

clit my-ebook-drm5.lit my-ebook-drm1.lit "Title of My-Ebook"

Now you can read your LIT e-books using any application that can open HTML files. If you have a large number of LIT e-books you want to convert, a shell script (which I modified a bit) from a fellow Ubuntu forums user, BobCFC, can be used:

#!/bin/bash
#============================================================================
# process every .lit file in the current directory
# use clit to explode each file into directory of same name minus .lit extention
# (optional pass -z argument to create gzip files and remove new directories)
# 2007 RBH
#============================================================================

if [ $1 == '-z' ]
then
        for FILENAME in *.lit
        do
                clit "$FILENAME" "${FILENAME%%.lit}"/
                tar czf "${FILENAME%%.lit}".tar.gz "${FILENAME%%.lit}"
                rm -rf "${FILENAME%%.lit}"
        done
else
        for FILENAME in *.lit
        do
                clit "$FILENAME" "${FILENAME%%.lit}"/
        done
fi

Save the shell script above in any file name you want, they make it executable by issuing chmod +x filename . The script will extract all the .lit files in the current directory into folders of the same name. Use the -z flag to create compressed gzip files instead.

Compiling clit

For those of you who’ll be needing to compile clit since their distros don’t have clit packages:

- you’ll need the “build-essential” package

- download the clit source file here: http://www.convertlit.com/download.php
- download the libtommath source code here (make sure that you get the 0.30 version since as of clit version 1.8, clit uses version 0.30 of libtommath and not the latest 0.39 version) : http://math.libtomcrypt.com/download.html
- Extract the downloaded clit and libtomath files in same directory e.g. enter the commands:

unzip clit18src.zip ; tar jxvf ltm-0.30.tar.bz2

- cd to the libtommath directory ; issue the command make
- cd to clit<version_number>/lib directory; issue again make
- cd to clit source directory, clit<version_number>, mine was clit18/

- issue again make - this should use the libtommath built above. You can check to see if you’ve successfully compiled an executable binary file which you can run as clit (assuming there were no error messages after all the make commands you entered) by issuing the command:

file clit

which returns the following in my 64 bit AMD processor:

clit: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), not stripped

or the following in my 32 bit AMD processor:

clit: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), not stripped

Now you can use the clit commands shown above by copying the compiled clit binary file to your bin directory

sudo cp -v clit /usr/bin/

clit in Firefox

If you use Firefox or any of its derivatives, there is an add-on, OpenBerg, which lets you view a number of book formats including comic book archives (.cbr, .cbz) and even .lit files, among others. However, you must have rar, zip, and lit viewer/handler programs already installed in your system/Linux box. The clit setup I mentioned above is just right for allowing OpenBerg to let you view your .lit files. What the add-on actually does is it explodes/converts your .lit books (1st command above) into a browser readable HTML fiile. You have to point OpenBerg to the directory where the clit executable binary file is located, whether you installed it as a package or if you compiled it as shown above, so it can let you view .lit files for you.

Lastly, my personal view is that we should not patronize or encourage the buying and proliferation of any Microsoft format e-books. Let’s allow those formats to be unused or completely forgotten and demand free and open format e-book types such as unencrypted or un-DRMed PDF fiiles, HTML, plain ASCII text files, and others, including Open eBooks. Demand your e-books to be in those formats, open to the scrutiny of the general public. Demand not to be treated as if you were a criminal. Demand to have ridiculous laws like the DMCA repealed. Join the EFF. Let’s not just sit and let Microsoft and other proprietary formats prevent the access of information.

Information is important. And so are books.

Other References

Calibre installation instructions on other Linux distros and OSes

Linux Journal article on converting e-books in Linux

fbreader site

Stephen Hawking, Theory of Everything, and Goedel’s Incompleteness theorem

April 13, 2008 by f241vc15

This post has the following readability test scores:

Flesch Reading Ease: 63.63
Flesch-Kincaid Grade Level: 8.00
Automated Readability Index: 9.00

For more info about readability tests, check out my post about those here.

Whew, it’s been a while since my last post. Work and a project (during and continuing till after the end of a semester) kept me really busy.

Anyway, this post is about the webpage containing prof. Stephen Hawking’s talk about his latest (AFAIK) stand on the search for the theory of everything, how Kurt Goedel’s incompleteness theorem/s influenced his opinion/view.

The speech in text format (1st reference link below), as you may immediately notice, is quite messy and seems to be unedited. I think that the speech laid out in the web page was just a speech-to-text conversion of prof. Hawking’s speech, which by the way you can download, so you can listen to his very iconic “electronic” voice. This speech-to-text conversion is quite evident I think since the starting letter of each sentence is not capitalized, and difficult words (at least for an American English speech-to-text program) such as Laplace (for the French mathematician) turn out to be spelled as Le-plass, which is what you would most probably get if you spoke into a speech-to-text synthesizer just like prof. Hawking’s.

As you may well know, a theory of everything (ToE) in physics aims to unify the four basic forces in the known universe, and which can, in theory, be used to predict anything that ever happened or will happen in the universe. My previous weblog post further clarifies this theory, or the search for it. I found the 1st reference link below when I Googled for “Stephen Hawking Theory of Everything”, hoping that I would be further enlightened about how the man labelled as “the brightest theoretical physicist since Albert Einstein” is going about searching for the ToE. I never expected that he would give up, in a sense, which for a while made me feel uncomfortable, though the feeling eventually disappeared. What made me feel uncomfortable was not because the universe is full of uncertainty and randomness we can’t explain (or at least not yet for some). What made me feel uncomfortable was that the man who so passionately sought for the ToE from his books and studies in the 70s and 80s (an example is the 2nd reference link below) has given up the search for the ToE.

But as I re-read the speech, Goedel’s incompleteness theorem hits the point in between the eyes. The great professor starts out (as he usually does) by discussing briefly the ideas that will prove to be necessary for his lecture’s whole point, including Quantum Chromodynamics (QCD), scientific determinism, Newton’s gravitational law, wave functions, etc. This is a style which I think he is famous for, and which is why his lectures are very popular and well sought after. His funny and comical inserts pop out once in a while to stir things a little bit.

Essentially, the gist of his lecture (as it would seem to me) is that there cannot be a single ToE, one which, as I’ve mentioned previously, will let us know what exactly happened at a specific point in our universe’s history, or what will happen to its future. The ToE should be able to tell you what you were thinking last night, or what you will think tomorrow night. Yes, the ToE is the theory of all theories. The problem however is that the human brain, as prof. Hawking puts it, is composed of so many parts made up of so many particles that we couldn’t possible compute what you’ll be thinking the next minute, even with the most powerful computers in the world today.

Prof. Hawking admits that until he realized the implication of Goedel’s incompleteness theorem, he implicitly assumed that a ToE will be found, probably relying on what can be referred to as “scientific intuition”. According to prof. Hawking, the positivist philosophy of science is that every good physical theory is a mathematical model, which he probably gets from Karl Popper and other positivist thinkers. And since, according to Goedel’s incompleteness theorems, there are mathematical results that cannot be proven, then so must there be physical theories that cannot be proven as well, including the ToE. Goedel’s incompleteness theorems essentially say that, as mentioned by prof. Hawkings himself, math is either inconsistent or incomplete. The professor bets his money (as he did in a previous debate with Kip Thorne decades ago) on the incomplete part of mathematics. Goedel’s theorems are proved using self-referring statements such as

“This sentence is false”

If the statement is true, then (the idea it implies) it is thus false. If the statement is false, then it is the opposite, meaning the idea the statement implies is true. Another would be to apply Bertrand Russell’s paradox on the barber paradox:

In a town which has a rule that the (only) barber shaves only all men that do not shave themselves, and doesn’t shave those who shave themselves. One can then ask, does the barber shave himself? If he does, according to the rule, he shouldn’t. If he doesn’t shave, according to the rule, he must shave himself.

Lastly, prof. Hawkings apologizes if anybody got/gets disappointed on his current view about the ToE. As I’ve said, I was initially disappointed, but considering his rationale about the search for the ToE, I turn out to be fine, though I still think he still leaves room in himself in case he makes a wrong prediction (just as he did in the 2nd reference link) that we might find the ToE in this decade. In his lecture in the 1980s regarding the discovery of the ToE, he said that we may find the ToE, and he’ll give another lecture about the ToE and where we stand 20 years later (which is now). Well, he did tell us where we stand, or at least what his view of where we stand in the search for the ToE. He also said then that once the ToE is found, physicists will lose their jobs, and physics will end. But according to his latest lecture, thanks to Goedel, mathematicians he said will always have a job, and most probably physicists too.

References:

Bourne again

March 28, 2008 by f241vc15

This post has the following readability test scores:

Flesch Reading Ease: 72.66
Flesch-Kincaid Grade Level: 6.00
Automated Readability Index: 6.00

For more info about readability tests, check out my post about those here.

This post is about my reaction and reflections on the three Bourne films (The Bourne Identity, The Bourne Supremacy, The Bourne Ultimatum).

Reactions

My initial reaction after watching the first film (The Bourne Identity) was

“Why in the world have I only watched it just now?????? This movie is pure genius!!!”. (ditto to the 2 sequels)

The movie is pure genius in terms of making the viewer guess and think things through, genius in terms of action, suspense, and thrills. Note that I’m only mentioning the film, not the novel by Robert Ludlum. And I know what you’re thinking

“What?? The Bourne Identity was back in 2002, The Bourne Supremacy was in 2004 and The Bourne Ultimatum was last year! Where have you been living? Under a rock?”

Yeah yeah I know it’s already been quite a while, and I know I should’ve watched all three (or at least the first two) years ago, but hey, I’m just 22. I had some other concerns back then, and I probably wouldn’t have been able to appreciate the movies much if I watched them 4 or so years ago. Then there’s still school of course and my other interests: programming, watching anime, gaming, reading books and so forth and so on enriching my knowledge and giving myself what I have and know today. There go my excuses and alibis for you.

The Bourne Identity garnered a massive 83% on rotten tomatoes‘ top critics (not just any critic of the site), The Bourne Supremacy got 74% on rotten tomatoes’ top critics, and finally, The Bourne Identity gets a whopping 93% from rotten tomatoes’ top critics. How’s that for starters? The 3rd movie (though this is weird since the previous 2 movies were also highly acclaimed around the world. I guess the people over at the Oscars are too damn busy watching dancing people sing) got these on the 80th Academy Awards: Christopher Rouse for Best Film Editing, Scott Millan, David Parker and Kirk Francis for Best Sound, Karen M. Baker and Per Hallberg for Best Sound Editing.

Reflections

Anyway, I haven’t read Ludlum’s 3 ‘Bourne’ novels yet, and even though the 3 movies deviate largely from the books, I still think Ludlum is a master of suspense action/thriller, as can be seen from New York Times and other reviews on his books. What’s amazing was how Doug Liman (director of ‘Identity’ and producer of the last 2) and Paul Greengrass (director of the last 2 films) were able to update Ludlum’s novels to the 21st century. Mr. Ludlum’s novels were written in the late 80s, and one would quite certainly guess that the technology present in the 3 movies would probably be barely in Ludlum’s imagination at the time of the writing of the novels ( and he certainly wouldn’t have been able to accurately pinpoint what technologies would go off at our present time). This guess could be entirely mistaken, though, since I haven’t read the novels yet, but I would certainly bet my money on my guess. The update and modernization of the films from their novel counterparts were partly due to director Liman’s father’s work in NSA (this coming from the DVD commentary).

Why the movies are so cool (translation: why I like the movies)

1) They’re not Bond films

What got my attention on the ‘Bourne’ movies was primarily their espionage/black ops type of genre/film. I’ve watched almost all James Bond movies and believe me, I was a kid (around 10 or so) when I started watching those movies with my dad, and still I said to myself that James Bond stories and ending can’t always be true (a hint of my future pessimism and partial paranoia?). First, James Bond always had the prettiest girls, always drank the best drinks around, drove the best cars etc. Then he has in his command, the latest (and usually the queerest or most impossible) selection of gadgets around. He (Bond) always saves the world, gets rid of the bad guys, and the cycle continues. That can’t be right, can it? I mean, I love comic books and all but if anybody wants me to believe in James Bond, they have to do better than have comic-book-happy ending stories (while comic book stories don’t usually have a happy ending like in ‘Bond’ films mind you). I love spy movies (probably due to my dad’s liking of Bond films), espionage and stealth genres/themes, and I think that’s why I’m also pretty interested in ninjas, among other things.

2) Very cool action

I also liked the action certainly: from the first till the 3rd movie, the action gets even more physical and makes you want to hold on to something. Car chases, hand-to-hand fights in the movies make James Bond films look like Saturday morning action cartoons. This is how an agent (at least an extremely talented and capable agent/assasin) moves.

3) Parallelism to MGS

Another thing that made me extremely like the 3 movies is their parallelism/similarities to the Metal Gear Solid game storyline. I am a huge (did I also mention big and devoted?) fan of the Metal Gear series and storyline. Metal Gear tells the story of Solid Snake (as well as his father’s) and how they manage to pull through covert, black ops missions to save the world from nuclear holocausts. I tried searching through Google for possible mentions that Hideo Kojima (brilliant creator of the Metal Gear series and franchise) had some inspirations from mr. Ludlum’s novels, particularly the ‘Bourne’ movies, but to no avail. A lot of people I read from the Internet talk about the parallelism especially of Jason Bourne and Solid Snake’s (codename) father, Snake/Big Boss (also a codename), which I think is worth noting. The 2 were both very good at what they were doing (killing, covert/black ops, stealth missions) for the sake of their country, their people, and what they believe is right. However, they were both victims of their superiors’ desires to amass illegal wealth and power. Both of them were used, then afterwards framed, by their superiors, after which they take the fight back to them (superiors). What’s great about the ‘Bourne’ films is that Jason doesn’t really have to hide in corners or in the shadows to move around stealthily (at least in the ‘watchful’ eyes of the CIA) since he knows how the CIA agents think and move, which is quite different in Solid Snake’s case, as the latter requires some hiding etc in his missions. Then again, Solid Snake’s missions are quite different from Jason’s, as Solid Snake’s mission are usually in highly secured areas like fortresses, jungles, etc. It’s also quite ‘refreshing’ to see a spy film not use flashy gadgets or out-of-this-world equipments like those from the ‘Bond’ movies just so that one can defeat the bad guys, and also a spy movie which rely mostly on brains, and some brawn of course.

4) Strong women

What I also like very much on the ‘Bourne’ films is the way they treat women: women can and will have the power as well as the strength and the brains to do what they want. That’s what I believe and the movies certainly do a great work on it (empowering women). The roles played by Joan Allen as CIA Deputy Director and Task Force Chief Pam Landy, Franka Potente as Marie Helena Kreutz (Bourne’s girlfriend), and Julia Stiles as Nicky Parsons (CIA contact and logistics officer) all play strong women. Strong in this sense means great intellectual power, morality and sense of duty, though I would certainly think some of them can also kick other men’s asses. I’m a firm believer that women, who have mostly been subjugated by self-righteous men (religious men not the least, though they may not really realize it, nor the women who willingly let the men subjugate them), and even at some places in the world women are taken into what J.R.R. Tolkien would refer to as thralldom, can leave their misery behind them. I believe that women should be treated as equals of men in terms of ability to work, hold office, etc. The ‘Bourne’ movies certainly shows this line of thinking, which I appreciated very much. Frankly, I currently prefer women like the ones in the 3 movies: strong, opinionated women. Of course, there’s still room in my view for damsels-in-distress though.

4th movie/Sequel to ‘Ultimatum’

Director Paul Greengrass and Matt Damon (Jason Bourne) have expressed that they didn’t want another movie as they think they’ve “ridden the horse as far as they can” or so Matt said. However, as of March this year, due to the financial and critical success of the 3 films, Matt and Paul are going to do a 4th movie, though the details of the new film aren’t out yet. The new film will most probably take some stories from the novel The Bourne Legacy

Finally, if you’re looking for an extremely well handled action-suspense-thriller movie that let’s you think, a movie that will make you hold on to your seats, and a movie that will touch you in many ways (physically, emotionally, psychologically etc), then this movie is definitely for you. I should say that it will not leave you unchanged after watching it.

Now, I’m off listening to the end soundtrack of the 3 movies: Moby’s Extreme Ways.

How readable are you?

March 18, 2008 by f241vc15

This post has the following scores:

Flesch Reading Ease: 60.74
Flesch-Kincaid Grade Level: 6.00
Automated Readability Index: 6.00

“What in the world are these?” you might ask? Read on.

This post is all about readability tests, some of which I recently discovered and re-discovered.

There are numerous readability tests available, some of the more familiar (at least to me and what I’ve read so far) are:

  • SMOG (Simple Measure Of Gobbledygook)
  • Flesch-Kincaid Readability Test
  • Fry Readability Formula
  • Automated Readability Index (ARI)
  • Gunning-Fog Index

And the ones which I’ll be focusing more here are Flesch-Kincaid Grade Level (FKGL), Flesch Reading ease (FRE) and ARI, since they’re the ones used by Internet search giant Google in their Google Documents. Readability tests are really mathematical in nature in that they use predetermined constants to give a readability ‘grade’ to a particular work. Note that there are differences among the 3 (FKGL, FRE, ARI) and having a very readable grade with one test doesn’t necessarily mean it will also have a good readable score on the other two. The first two tests were developed by Rudolf Flesch, an author and a readability expert. The U.S. Department of Education has the following education levels with their corresponding age brackets:

Elementary School
Pre-Kindergarten 4-5
Kindergarten 5-6
1st Grade 6–7
2nd Grade 7–8
3rd Grade 8–9
4th Grade 9–10
5th Grade 10–11
Middle school
6th Grade 11–12
7th Grade 12–13
8th Grade 13–14
High school
9th Grade (Freshman) 14-15
10th Grade (Sophomore) 15-16
11th Grade (Junior) 16-17
12th Grade (Senior) 17–18

Test Rules

In acquiring the number of words, sentences, etc. in your work, here are the rules to be followed: periods, exclamation points, question marks, colons, and semi-colons are considered end-of-sentence marks. Each group of continuous non-whitespace characters counts as a word. Each vowel in a word counts as one syllable subject to the following sub-rules: Ignore final -ES, -ED, -E (except for -LE)
Words of three letters or less count as one syllable. Consecutive vowels count as one syllable. Although there are many exceptions to these rules, it works in a remarkable number of cases.

FKGL

This test tells you what the minimum educational attainment is necessary for a reader to comprehend your work, and is based on the educational grade level of the U.S. For example, a grade of 9 means that the reader has to be at least a 9th grader (or has a 9th grader’s education/supposed intellect) in order to comprehend your work. Or if you get a grade of 9.8, the minimum educational attainment is the floor of that value, which is 9 or the 9th grade still. To calculate your work’s FKGL grade level, the formula is as follows:

FKGL = [ (.39 x ASL) + (11.8 x ASW) – 15.59 ]

where:

ASL = average sentence length (total number of words divided by total number of sentences)

ASW = average number of syllables per word (total number of syllables divided by total number of words)

FRE

For this test, the higher a score you get, the easier it is to read your work, and is based on a 100-point scale. The formula for FRE is as follows:

FRE grade = [ 206.835 – (1.015 x ASL) – (84.6 x ASW) ]

where ASL and ASW are the same as the ones above.

ARI

ARI unlike the former two, is based on the number of characters per word. ARI is also based on the U.S. grade level like the other two above. This test is usually less palatable to readability test critics, but it is the easiest one to implement on computer programs since all the program has to do is count the characters instead of syllables. The formula is:

Grade Level = (4.71 x TCW) + (0.5 x TWS) - 21.43

where

TCW = Total number of characters divided by the total number of words

TWS = Total number of words divided by total number of sentences


Implementation/Testing the Tests

For the sample sentence “Hello World!”, Google Document (when viewing your document, click File > Word count…) gives the following grades:

Counts
Words: 2
Characters (no spaces): 11
Characters (with spaces): 12
Paragraphs: 1
Sentences: 1
Pages (approximate): 1

Readability
Average sentences per paragraph: 1.00
Average words per sentence: 2.00
Average characters per word: 5.50
Average words per page: 2.00
Flesch Reading Ease: 77.91
Flesch-Kincaid Grade Level: 3.00
Automated Readability Index: 5.00

Which is what you’d get if you count the words, syllables, sentences etc. and manually solve the grade levels from the formulas given above.

Lewis Carroll’s famous poem Jabberwocky in the famous children’s story Through the Looking-Glass and what Alice found there get the following score:

Flesch Reading Ease: 91.89
Flesch-Kincaid Grade Level: 1.00
Automated Readability Index: 2.00

Very readable and highly suitable for children it would seem. What’s a bit surprising is that the poem even has a lower score than the sentence “Hello World!”, making the poem easier to read?

As for the New York Times book review of The God Delusion, the review gets these grades/scores:

Flesch Reading Ease: 57.98
Flesch-Kincaid Grade Level: 8.00
Automated Readability Index: 8.00

Pros of Readability Tests

The original reason for implementing the above mentioned tests was to give teachers, librarians, etc. an overview of the apparent reading difficulty level of a given work. The acquired test grades or scores will then allow them (teachers, librarians, etc.) to choose appropriate materials for a specific group of individual’s age/educational background/attainment. At a glance this reason would seem quite reasonable to many of us, especially if we’re not really familiar with the implications of the rules and the formulas, as well as the entire written work that is being graded or scored.

Cons of Readability Tests

Also, at a glance, especially among people familiar with the tests and their limitations, readability tests are of little or no use at all some times. This uselessness is still subjective, after all, what may be intelligible to a group of people, may be absolutely understandable to others. The obvious (and most wide-spread) criticism of readability tests is that they only test the “surface” or the physical layout of the work. Readability tests gives little (at best) to none at all (at worst) information on the meanings being conveyed by the work, the grammatical structure, as well as the different biases, nuances, and between-the-line impressions or expressions of the author. One could’ve easily written “World Hello!” and the 3 scores for that sentence are identical to the scores of the sentence “Hello World!”.

In conclusion, I think people should be wary when placing readability test results on their works, or when seeing some else’s readability test scores. These scores can easily help clarify or more often times mystify the reader about the true readability of a work. People should not immediately believe what they see, and always keep a skeptical eye on notions as a readability scores of written works. Are readability tests useless in my opinion? I don’t think so. They still have some uses such as when, assuming the writer is well versed in writing or communicating his/her thoughts on paper/documents, then these tests provide a very helpful glimpse as to what audience might be able to appreciate the work.

References:

* A computer algorithm to acquire Flesch-tests related information, including the adapted rules mentioned above, http://portal.acm.org/citation.cfm?id=10583&dl=ACM&coll=GUIDE

* free FKGL, FRE, and ARI test scores for your documents, http://docs.google.com/

* More on readability tests, http://csep.psyc.memphis.edu/cohmetrix/readabilityresearch.htm

* Flesch Reading Ease table, http://www.utexas.edu/research/accessibility/resource/readability/manual/forcast-versus-flesch-English.html

* Lewis Carroll’s poem, Jabberworcky, http://www.jabberwocky.com/carroll/jabber/jabberwocky.html

* New York Times book review of The God Delusion, http://www.nytimes.com/2006/10/22/books/review/Holt.t.html

* A concise but less precise (in terms of citation) source for readability tests, http://en.wikipedia.org/wiki/Readability_test

* More info on mr. Flesch, http://en.wikipedia.org/wiki/Rudolf_Flesch

* A concise but less precise (in terms of citation) source for mr. Flesch’s tests, http://en.wikipedia.org/wiki/Flesch-Kincaid_Readability_Test

* U.S. education levelling, http://en.wikipedia.org/wiki/U.S._grade_level#School_grades

Prof. Fidel’s take on my ‘Nobel laureate’ weblog post

March 9, 2008 by f241vc15

Readability test scores for this post are as follows:

Flesch Reading Ease: 76.24
Flesch-Kincaid Grade Level: 5.00
Automated Readability Index: 4.00

For more info about readability tests, check out my post about those here.

This post is just actually a copy-and-paste of my e-mail to Dr. (of science in mathematics) Fidel, and his reply, when I sent him the link to my post about my attendance to a Noble prize laureate presentation. I just wanted it to be placed here in my weblog before it gets buried in my inbox. Also, I just want to share our conversation to people out there who just might be interested in such things. Thanks to Dr. Fidel for allowing me to post this here in my weblog (^)___(^).

The following is my e-mail to Dr. Fidel about my weblog post I wanted him to read through/scan:

Hi sir,
I wrote a post on my weblog, and I was thinking you could consider reading
it as a reaction paper of sort (^)__(^) or even asking some of your students
or friends to check it out.
Anyway, any comment/feedback will be appreciated, that is, if you have the
time to spare (^)___(^) :
http://f241vc15.wordpress.com/2008/01/09/my-attendance-to-a-presentation-by-a-nobel-prize-laureate-in-physics/

And the next one is his reply (with my reply interspersed in between his paragraphs):

Thanks for this! Good to know that there were students in the audience
who appreciated and savored Gross’ talk. I enjoyed reading your post
and will email you my thoughts on the ideas he put forward one of
these days. Or we can discuss over coffee. It’s too bad — I
unfortunately dozed off a couple of times, and no matter how valiantly
I tried to keep awake, I couldn’t keep my eyes open. (Bad case of jet
lag and lack of sleep these last three nights.) But I enjoyed the
talk immensely. I wish I could invite him to talk in STS!

Savour would be a good term to describe it I guess (^)__(^)
It was really too bad Doc. It was too bad you weren’t awake the whole time sir. It was really cold at my seat but I endured it for the hour long or so presentation. I had little sleep too the night before, but my eyes were agape the whole time!

Just a few points, before I go to bed-

Gross is a true believer, convinced that physics is the stuff of life,
and that everything is comprehensible. But how different is this from
religion? His work rests on faith, not in some god, but on the
platonist idea that the world is orderly, governed by transcendent
laws that exists out there, independent of us. And how can it be
otherwise? Scientists like Gross cannot function without that faith.

Yes I agree. But we also need to create some distinction between religious faith and scientific faith. The main difference I would think is that the former is not based on fact or logical reasoning, unlike the latter. Would it seem then that we’re just entangled in a semantic web?

At best, the science community is a communit based on collegiality and
respect; Gross is right, the methods of science and the peer-review
system do provide some model of how democracy can work. At worst, it
is a brew of competing ideas and viewpoints; with each idea creating
tribes of adherents, renegades and heretics. The world is not as
orderly as Gross would want it to be.

which reminds me usually of Heisenberg’s uncertainty principle…and how scientists like Einstein felt repugnant that no order can seemingly be found in the quantum mechanical world.

Einstein can be excused for dreaming about a world government. After
all, the WW2 had just ended and everyone was (or appeared to be) in
the business of putting the world together again. But alas, societies
don’t follow the laws of physics, and the UN, that prototype for world
government, has failed miserably in preventing war, famine and
inequality.

Yes I agree. Perhaps I should add that to my post, about how Einstein suggested (and to which prof. Gross agreed) a supranational government for the world to solve most of our problems.

I think intelligent design is creationism in cloaked in a lab gown.
The real source of the controversy over ID is that its proponents want
it taught in the classroom as science.

Yes as what has been happening in the United States, as recent as last year (and probably still continuing till today). Different states are trying to abolish the theory of evolution in favor of ID as early as primary education, which has caused significant personalities in the academe such as prof. Richard Dawkins and Sam Harris to put out books combating this ( i.e. The God Delusion by prof. Dawkins and A Letter to a Christian Nation by prof. Harris, both New York Times best sellers).

There! Again, thanks to Dr. Fidel. I feel much relieved now (^)___(^)

Doing cool things in Bash and in Linux

February 29, 2008 by f241vc15

Finally, I’m able to cut-in one last post for this month. I’ve some little free time and the things I’ve read and learned again inspired me to write another post.

This post is concerned with the cool things you can do with the bourne again shell or bash for short. If you want more info afterwards on other cool Linux and bash commands, you can consult my earlier post here. This post would probably mean it’s an extension of that previous post of mine. Difference is that bash can be installed not only in Linux but other Unix or *nix related operating systems such as Mac OS or solaris, and of course, Unix itself.

Anyhow to start of, I recently re-learned the wonderful use of brace expansion. Brace expansion is performed by issuing a command whose arguments are strings (alphanumeric for example) enclosed in curly braces and separated only by commas such as:

$ echo {s,sd,sdf}

Which outputs the following

s sd sdf

Note that there musn’t be any spaces inside the braces. But then that alone doesn’t seem to be anything marvelous right? So we extend that further to make it a bit more interesting such as these:

$ echo {red,yellow,blue,black,pink}_mask
red_mask yellow_mask blue_mask black_mask pink_mask

$ echo {"red ","yellow ","blue ","black ","pink "}mask
red mask yellow mask blue mask black mask pink mask

$ echo {red,yellow,blue,black,pink}" mask"
red mask yellow mask blue mask black mask pink mask

Or even nest braces like so:

$ echo {{yellow,red}_color,blue,green} yellow_color red_color blue green

At this part you might be saying to yourself the big “So what???” What use would we (Linux/Bash users, administrators, shell coders etc) have for brace expansion? A lot actually. One example is if I want to rename my files (for backup for example). Instead of typing a lot of file names (even with the help of tab completion, that is a lot of work, especially if you’re working with files from another directory). If say I have a configuration file at /home/f/F/RoR/sample_config_file.conf and I want to create a back up copy of the file on the same directory, I just have to do this

$ cp -v /home/f/F/RoR/sample_config_file.conf{,.bak} `/home/f/F/RoR/sample_config_file.conf' -> `/home/f/F/RoR/sample_config_file.conf.bak'

Which is equivalent to doing this

$ cp -v /home/f/F/RoR/sample_config_file.conf /home/f/F/RoR/sample_config_file.conf.bak `/home/f/F/RoR/sample_config_file.conf' -> `/home/f/F/RoR/sample_config_file.conf.bak'

So instead of executing the last command, the command using brace expressions is much shorter (and looks better to).

Next is command substitution which is very helpful at assigning values to variables and especially at shell scripting. Substitution is made possible by enclosing strings inside a $( ) combination. An example is the following

$ uname -a Linux foxhound3 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux

Using substitution I can do it this way

$ info=$(uname -a) $ echo $info Linux foxhound3 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux

Which might seem longer but you have to realize that a lot more can be done with this technique such as the next one. Next I issue a two commands: the output of the first (which is actually two commands joined together) becomes the input of the second (outer command) like so:

$ ls -lh $(find . |grep txt)

The inner commands in the previous command lists all files with the string txt in their file names. The outer command ls -lh shows the time stamp (creation/modification date), file owner, file size etc of the files containing the string txt in their file names.

Output redirection of standard error is next. When you execute a command which you know will produce a lot of errors such as using find to look for files on the topmost / (slash root) directory knowing full well that you don’t have read access to many directories, such as this one (which assumes you’re looking for the file php.ini):

$ find / -name php.ini

find: /etc/cups/ssl: Permission denied
find: /etc/ssl/private: Permission denied
find: /tmp/gconfd-root: Permission denied
find: /tmp/orbit-root: Permission denied
find: /var/cache/system-tools-backends/backup: Permission denied
find: /var/tmp/kdecache-guest: Permission denied
find: /var/tmp/kdecache-ma3x: Permission denied
find: /var/tmp/kdecache-root: Permission denied
find: /var/spool/postfix/flush: Permission denied
find: /var/spool/postfix/deferred: Permission denied
find: /var/spool/postfix/defer: Permission denied
find: /var/spool/postfix/active: Permission denied
find: /var/spool/postfix/trace: Permission denied
find: /var/spool/postfix/hold: Permission denied
find: /var/spool/postfix/private: Permission denied
find: /var/spool/postfix/saved: Permission denied
find: /var/spool/postfix/maildrop: Permission denied
find: /var/spool/postfix/corrupt: Permission denied
find: /var/spool/postfix/bounce: Permission denied

<other output truncated>

You get the idea. What you can do is to send them to /dev/null if you’re not interested in the error messages like so

$ find / -name php.ini 2> /dev/null /etc/php5/cli/php.ini /etc/php5/apache2/php.ini /etc/php5/cgi/php.ini

Which produces a cleaner output. Or if you want to view error messages later you can issue a

$ find / -name php.ini 2> error_messagest.txt

And then view the text file later for error messages. If you want to redirect both the error and standard output messages to the same file you can do a

$find / -name php.ini >output.txt 2>&1

The important thing to note here is that the combination of the two messages (error and standard) is done at the end of the command that generates the output (in this case find).

When it comes to searching through the history of bash commands executed, the usual way would be to scroll up or down using the arrow keys or enter the command history, view the history number of that long line of commands you entered, then do a !<history number of command here> to execute the command again without typing it. For example

$history

<output truncated>

531 cat output.txt 532 find / -name php.ini >output.txt 2>&1 533 history

then to execute command number 531

$!531

which is equivalent to executing

$cat output.txt

again. But what if your history of commands is already in the hundreds or above a thousand? What you can do is press ctrl and r at the same time which gives you this

$ (reverse-i-search)`':

A command history search. You can start typing the first letter of your previous command and then bash searches for the most recent and closest command you entered.

The last trick is looping. A lot of people think that looping is only good for writing programs, but one can actually put it to good use even in system administration, or plain ‘housekeeping’ of your files etc. For example, I have the files a.txt, b.txt, and c.txt in a directory. In order to make backup copies of them instantly, I do a

$ for something in *; do cp -v $something $something.bak; done

Which gives me the output

`a.txt' -> `a.txt.bak' `b.txt' -> `b.txt.bak' `c.txt' -> `c.txt.bak'

And voila! Instant backup of my files. One story I’ve read is that a system administrator’s machine lost so much memory that even basic commands like ls failed because of insufficient memory. But the administrators know that a certain file was the one wreaking havoc on the machine. So what they apparently did was this

$ for var in *; do echo $var;done

Which actually displays the files in the current directory, and basically solved the problem (replacing ls for the meantime). This is because those commands including echo are part of bash and are already loaded in memory. “Wonderful!” I said to myself (^)__(^)

Thanks to Linux Journal’s issue 132 in April 2005 (my back issue which I actually re-read) before writing this post.

Reflections of the implications of the Pigeonhole principle in our lives

February 17, 2008 by f241vc15

Readability test scores for this post are as follows:

Flesch Reading Ease: 70.52
Flesch-Kincaid Grade Level: 7.00
Automated Readability Index: 7.00

For more info about readability tests, check out my post about those here.

Math is fun in my opinion. It has, for the longest time, including Science, been my favorite subject.

Anyway, this post is about a portion of mathematics which is more popularly known as the pigeon hole principle. The pigeonhole principle states that, given k+1 or more objects (k being any positive integer) which are to be placed on k number of holes, there is at least one hole which will contain two or more of the objects. Or to generalize the definition in a mathematical way:

if M objects are placed into j holes, M greater than or equal to j, then there is at least one hole containing at least k number of objects, where k is equal to the ceiling( M / j ) .

For example, if I have 12 pigeons to be placed into 11 pigeonholes, there will be at least one pigeonhole which will have 2 pigeons inside. This is so because the ceiling value k, the smallest integer value not less than (M / j) , is 2 since 12 divided by 11 is approximately 1.09 whose ceiling value k is equal to 2

“So what?”

you may say. What would possibly be in the pigeonhole principle that could interest me? Well, a lot actually, same as a lot of other seemingly ‘impractical’ mathematical theories for our every day lives.

1 If we take the upper limit on the average number of hair on the human head (nice alliteration) to be about 150,000, and say a given city has a population size of 500,000, there would be at least 4 people with the same number of hair on their heads. This happened because taking the population size (500,000) as the pigeons and the maximum possible number of hair on the human head (150,000) as the pigeonholes, k is found to be equal to 4. Isn’t that amazing to know? (okay sorry, I know not everyone will find that interesting).

2 Take a pizza party for example: If I were to treat four of my friends so that the five of us will eat a pizza pie of 12 slices, at least one among us will be eating 3 pizzas, while the rest only eat 2. This assumes of course that everyone eats a whole slice of pizza. Now isn’t that worth knowing at times like this? (^)__(^)

3 Another example is when you want to get say, candies from those vending machines which shows you their contents but you can’t pick any flavor in particular (i.e. the machine gives the candy to you at random). Say you can see that there are only two candy flavors left: orange and lemon, and there are 12 of each. You will know (using the pigeonhole principle) that you can get at least 2 candies of the same flavor for sure by buying (not 13 candies) at least 3 candies only! This is because in the event that the first 2 candies you get are of different flavors, you know for certain that the third one will be one of the 2 flavors, giving you at least 2 candies of the same flavor!

However, if you want at least 2 of a specific flavor, say, lemon flavor, it becomes a bit different: you need to get at least 14 candies to be sure that you get 2 lemon flavored candies.

4 Say you have a shop/store with (doesn’t have to be the exact number, since using the principle will still give you the correct answer) 50 aisles, 85 horizontal locations on each aisle, and 5 shelves. The products you sell are stored in bins on horizontal locations on the shelves of each aisle. What is the least number of products you would buy to ensure that at least 2 products are stored in the same bin? That is, based on the above definition, what should be M so that for j = 85 x 50 x 5 = 21250, k = 2 ? Surely enough, M would be equal to 21251 since taking the ceiling of 21251 / 21250 would be equal to 2.

5 If you collect/put together 13 people randomly (or even purposefully), by the pigeonhole principle, there are at least 2 people (pigeons) from that group who were born on the same month, since there are only 12 months (pigeonholes). And, much more obvious, is that among a group of 8 people (randomly/non-randomly chosen), at least two among them were born on the same day.

The important thing to remember here is to figure out which among the objects you’re dealing with is the pigeon and which is the pigeonhole.

There you go! There are tons more of examples on the daily applications of the pigeonhole principle, from computer networks, to train stations, to supermarkets, to art classes, etc. Anybody disagrees with me? (^)__(^)

Btw, comments/suggestions/questions/corrections are welcome, as long as they come in a calm and ruly way.