Lambda functions

I often forget the syntax and usage of lambda functions, the following examples should help as a reminder.


>>> def function(x):
... return x*3
...
>>> function(2)
6
>>> func_with_lambda = lambda x: x*2
>>> func_with_lambda(2)
4
>>> (lambda x: x*2)(2)
4
>>>

Posting from Ubuntu USB

Creating a USB distro from Ubuntu Live CD was damn easy. I have a 2GB USB-Ubuntu 7.10 key and posting this entry from a PQI USB key (which I got as a prize for a graffic design).

Here is steps to create the Ubuntu USB key.


From: Victor_Lowther at Dell.com
Sent: Friday, October 26, 2007 4:11 PM
To: linux-users at insidelists.us.dell.com
Subject: Speaking of Ubuntu..

Here is a neat little trick that makes the install process go much
faster:

1: Get a 1 gig USB memory key
2: Copy the contents of the Ubuntu live cd to to the memory key
3: Create a directory named "grub" on the memory key, and copy the
contents of the /boot/grub directory to it.
3: Install grub on the memory key. From a preexisting Linux install,
these commands should do the trick:
root at local# grub

grub> root (hd1,0) # or whatever your hard drive is. This
happens to correspond to /dev/sdb1
grub> setup (hd1)
grub> quit

4: Modify the /grub/menu.lst file on the memory key to look like this:

timeout 3
# This will be the memory key if you boot to one on every system I have
tried it on.
root (hd0,0) # first hard disk.

title Ubuntu 7.10 Live CD
kernel /casper/vmlinuz quiet splash file=/preseed/ubuntu.seed
boot=casper
initrd /casper/initrd.gz
quiet

title Ubuntu 7.10 Live CD (Safe Mode)
kernel /casper/vmlinuz quiet splash xforcevesa
file=/preseed/ubuntu.seed boot=casper
initrd /casper/initrd.gz
quiet


# if you don't have memtest86, you can omit these lines
title Memtest86
kernel /casper/memtest86+.bin
quiet

##END OF FILE

Now install should be a little faster, and using the live system will be
much faster.

Enjoy!

Victor Lowther

Firefox link navigation

I have been using vimperator firefox extension a lot and I find it very useful. However, I was wondering how can I click on links ( slashdot page links) without using Mouse. Searched the net and found something interesting that I have overlooked in firefox for quite a long time now.

Firefox has a simple trick: press ' (single quote) and you can search through the links from a page by typing a string in the small box from the bottom of the window. So you could type the first characters from the anchor and when the link you want to open has focus, press enter.

(or press CNTL + Enter for opening in a new tab).
btw, while using vimperator, you might have to Escape all keys ( i) and then do the ' to search the link using keystrokes.

This all got started when after being with mutt for some 2 hours, I got reluctant to open firefox thinking that, damn, I will have to use that mouse again.
At last, figured out a way with firefox.
Ah, mouse less existence is a bliss.

getaddrinfo error due to proxy settings



>>> import urllib2
>>>
>>> data = urllib2.urlopen('http://www.google.com')
Traceback (most recent call last):
File "", line 1, in ?
File "C:\Python24\lib\urllib2.py", line 130, in urlopen
return _opener.open(url, data)
File "C:\Python24\lib\urllib2.py", line 358, in open
response = self._open(req, data)
File "C:\Python24\lib\urllib2.py", line 376, in _open
'_open', req)
File "C:\Python24\lib\urllib2.py", line 337, in _call_chain
result = func(*args)
File "C:\Python24\lib\urllib2.py", line 1021, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Python24\lib\urllib2.py", line 996, in do_open
raise URLError(err)
URLError:
>>> import socket
>>> print socket.gethostname()
WXP-GQ86K1S
>>> print socket.gethostbyname(socket.gethostname())
121.241.134.194




This was really weird. I was thinking if that was a problem with the network or my machine. Tried on a different Linux machine and found it worked properly.

See the documentation for urllib.urlopen:

"""
In a Windows environment, if no proxy environment variables are set,
proxy settings are obtained from the registry's Internet Settings
section.
"""
Remove Proxy configuration under IE and try again
(don't use Ie anymore ;0)

Yes, that was the issue. Reset the proxy settings in the IE and found it working again. Is it a good idea to take the environment settings from the registry?
- If we are taking the settings from the registry, Should not the active browser ( firefox) update the registry settings? should it depend on IE only?

Guido and Bruce Eckel discuss Python 3000

Leading author and programmer, Bruce Eckel, posted some of his concerns on Python 3000 stating that python community is missing to address some of the important issues with this major, backward incompatible release. Problems he mentions are concurrency support on multi-core cpus, easy deployment support, a standardized user interface amongst others. He expresses his dissatisfaction at the post titled "Python 3K or Python 2.9?. Guido van Rossum, in a very pragmatic way addresses the concerns with his response to Bruce Eckel and calling out more for developers to contribute to Python to improve it further. Bruce Eckel concludes with his thoughts that he wants his favorite language to be better with his reply to Guido's reply.

vim howto - write and save to RO only

While working as a normal user, many a times need comes to edit a system file and save it. Instead of closing and redoing it.
the following can help.

:w !sudo tee % > /dev/null

Programming related thought

While reading through Mark Pilgrim's Dive into Python, stumbled upon this
interesting thought, wherein he says that, when you 'plan' to develop a full
-fledged feature for a software which will help in certain tasks, and if you
end up coding a small version, make it just work rather than a completed polished 'as-per-plan' thing, then you are not only being inefficient, but you are
being rude (to your customers).

That's a very good thought. Most of times, I think of designing a software and
when it reaches to level where it works, I stop there and move to next. The
working thing, sometimes never goes past my computer.

Patch Howto

1) diff -ruP original modified > patch
2) patch -p0 < patch

M x viper-mode

This is a emacs, viper mode. If vim fans are threathened and forced to user
emacs, then they might find this M x viper-mode as a consolation somewhat akin to a family photo a prisoner has in jail. He will be missing his family for sure though.

:-)

Yet another Ubuntu Fan

I was almost about to give up on Ubuntu, because after I installed the Fiesty, I was not able to download the packages from Repositories due to some proxy authentication issue. Tried various things for a week and when could not go any step further, I had thought let me get back to Fedora and was thinking about how new users of Linux will be feeling when they dont get support on what they need to get wishes satisfied with Linux. In my case, it was a particular distribution.
After a week, I setup my box again and wanted to give a final try. Instead of going to Synaptic and meddling with Repository sources, I thought let me try Add/Remove application to Install software and see what happens.
The basic install of ubuntu (from the CD) did not have things which a regular Linux user would desire. Well, what the heck, gvim was not there! Browsing through the software list I checked Emacs 21 for Installation and pressed Apply. Something interesting started to happen. It started downloading automatically from http://archive.ubuntu.com/ubuntu/dists/feisty/main/
I felt a kind of relief that I will be able to spend more time with ubuntu now.

There is a tricky bug with Ubuntu package manager, I think. The following was my setup with package installation from repos worked.
1) Firefox configured with proxy and proxy authentication details.
2) Gnome Network Preferences, Proxy NOT configured.
3) Without adding any repos, archive.ubuntu.com which is kind of a default repo is only working thing.

If I configure, Gnome Network Preferences with proxy details, the package manager fails with Proxy Authentication message.

The following tests might help.
1) Without Firefox Proxy, try with package manager.
2) Test Gnome Network Preferences for other applications. Epiphany can be used.
3) Try other repositories.
I shall try that and figure out the exact issue.

Now that I was able to configure the package manager, I got a wealth of neatly arranged package to choose from and Install. The Installation procedure was totally homogeneous. Neat, easy is what I can say of Ubuntu. Hey, you might hear those two words from many of the Ubuntu users, but you will appreciate only when you "feel" it.
Even Picassa download in deb format was handled properly by gnome deb package installer. I had never used deb and always thought deb format is difficult than rpm.

I had transfered my camera shot movies of Bungee jump to Ubuntu machine, first surprised to see the thumbnail of avi file and next totem player played that avi file. I felt wow!. Because, its first time Totem player had worked for me (apart from the live cd demo)

Then I spent looking at all the interesting programs that default, multiverse, and universe repositories could offer. There are tons of python language packages to install directly from the repos.

But the sweetest of all surprises came, when I thought let me search for rapple and nanoblogger. I know, there were debian maintainers for these to two projects. But it was really nice, to see a the project I have contributed to as being listed from the repository and choosing them to install it!

Why settle for..

Python - why settle for snake oil when you can have the whole snake? —From Usenet posting by Mark Jackson, June 1998
Mentioned at the Python Development page :- http://www.python.org/dev/. Its a good fun! :-)

Random C Stuff.

While browing through comp.lang.c found this interesting discussion.



/* Without using /, % or * operator, write a function to divide a number by 3.
* */
#include

int divideby3(int);

int main(int argc,char **argv)
{
int res;
res = divideby3(9);
printf("%d",res);
return 0;
}

int divideby3(int aNumber)
{
div_t d = div(aNumber, 3);
return d.quot;
}



Never have explored the capablities of stdlib. Infact, with C Programming
Language out of touch for so many months, I was thinking this program will
seriously fail, thinking kind of how come div_t datatype, d.quote
(object.property ?) etc. gcc will crib saying dont using c++. But it worked
perfectly fine.

N-Puzzle Problem solver using Python

Completed and submitted my project "N-Puzzle problem solver". Wrote it in Python programming language and it was good fun. Learned about the similarities of lisp and python. Why lisp is so powerful and how easy things will become once you get a hang of the language called Python.
Solving the N-Puzzle problem, I had tried without any base algorithms and it was damn hard to derive any solution. Once I saw the problem solving strategy using Manhattan Distances at norvig 's site. Coding the solution was enjoyable. You get a feel of what AI problems are when trying these Toy-AI problems.

vimplugin for eclipse

vimplugin for eclipse.

  • Install it using the eclipse plugin installer, pointing the location to http://vimplugin.sf.net/update
  • In the Window Preferences, the vimplugin preferences should be available. Point the vimplugin to your vim install location (not gvim). Did not work for me. Set the General | Editor | File associations preferences also the kind of files you wish to open in vim.
  • Open the file, and focus on it using the mouse to use it. ( Yeah, I found this in the known issues)

Random Wikipedia page as the HomePage of your Browser

Set http://en.wikipedia.org/wiki/Special:Random page as the homepage of your browser and every time you load up your browser, you will be greeted with a random wikipedia page.

Firefox with vim keys

Vimperator extension sets the firefox to a modal vim style. People used to vim will find it just very useful.
Like, over the command mode:
gg - goes to the top of page. No Separate Page Up/Home Keys number of times, which one rarely uses.
G - goes to the bottom of the page.
: open url opens the url.

The only problem I faced was,I had gmail on and it uses vim style navigation, ( j for down, k for up) and when press j for gmail, vimperator understood for itself and it was scrolling.
I thought, it must have been designed as window mode, so let me switch to the gmail window. and did CTRL-W-W.
Well, firefox tookover and closed the window!
It was fun tough.
Here is the list of commands supported.

using ptags.py for tag file

1) put the ptags.py file to your $PATH.
2) From the project directory containing your python project run the command.

$find . - name \*.py -print |xargs ptags.py

I was doing it previously in various different ( not so efficient ways)

credits

Soc application accepted

wow! my Google Soc application to Python Software Foundation got accepted. My mentor will be George D. Montana. Thank you G-SOC and PSF.

Norvig on Spell Corrector

Peter Norvig has written a very interesting article on Spell Correction and 20 line Spellchecker in python, which is way just cool.

vi name game

Open a random file in vi and you have to find what will your Name do? For e.g. my name 'Senthil', replaces the current line with 'enthil'. Got to know about 'S' command. 'kumaran' did something more interesting.
k - go up.
u - undo insert. Nothing happens.
m - set mark and with next letter being register.
a - register for the mark.
r - replace the character under the cursor.
a - with a
n - repeat the previous search whichever you might have performed.

Google Earth under Linux

At last, I was able to play with Google Earth under Linux.
Previously, whenever I used to connect, got this response:
"Google Earth detected an error when trying to authenticate"
- Check if you are able to connect to http://www.google.com
- Check your firewall settings, if you are not blocking /opt/google-earth/googleearth-bin

Readme.linux provided the way, I have explained the complete trials I went through here.
But in short:
From Shell:
1) export http_proxy=http://proxy_ip:proxy_port
2) googleearth
Now it worked.

NOTE: Start google earth from command line only as it was able to recognize http_proxy, dont use Gui Interface option as it could not recognize http_proxy.

PCL : Syntax and Semantics

Syntax and Semantics

What's with All the Parentheses?
* extensive use of parentheses and prefix notation.
* when John McCarthy first invented Lisp, he intended to implement a more Algol-like syntax, which he called M-expressions.
* The project of defining M-expressions precisely and compiling them or at least translating them into S-expressions was neither finalized nor explicitly abandoned. It just receded into the indefinite future, and a new generation of programmers appeared who preferred [S-expressions] to any FORTRAN-like or ALGOL-like notation that could be devised.

Breaking Open the Black Box
* In most programming languages, the language processor--whether an interpreter or a compiler--operates as a black box.
* Language processor is divided into three subsystems.
1) a lexical analyzer breaks up the stream of characters into tokens.
2) and feeds them to a parser that builds a tree representing the expressions in the program, according to the language's grammar.
3) This tree--called an abstract syntax tree--is then fed to an evaluator that either interprets it directly or compiles it into some other language such as machine code.

* Common Lisp defines two black boxes, one that translates text into Lisp objects and another that implements the semantics of the language in terms of those objects. The first box is called the reader, and the second is called the evaluator

* Each black box defines one level of syntax. The reader defines how strings
of characters can be translated into Lisp objects called s-expressions.



* (foo 1 2) is legal s-expression whereas ("foo" 1 2) is not, because a list
starting with string has no meaning.

* This split of Black Box into two has a couple of consequences:
* One is that you can use s-expressions, as an externalizable data format (
remember the file database example) for data other than source code, using READ to read it and PRINT to print it.

* The other consequence is that since the semantics of the language are defined in terms of trees of objects rather than strings of characters, it's easier to generate code within the language than it would be if you had to generate code as text.

* Generating code completely from scratch is only marginally easier--building
up lists vs. building up strings is about the same amount of work. The real
win, however, is that you can generate code by manipulating existing data. (
This is the basis of macros in lisp)


S-expressions

* Elements of s-expressions are lists and atoms
* Lists are delimited by parentheses and can contain any number of
whitespace-separated elements. ( Recursion here)
* Atoms are everything else.
* Comments--which aren't, technically speaking, s-expressions--start with a semicolon, extend to the end of a line, and are treated essentially like whitespace.

* Since lists are syntactically so trivial, the only remaining syntactic rules
you need to know are those governing the form of different kinds of atoms (
numbers, strings and names)

* Numbers are fairly straightforward: any sequence of digits--possibly prefaced with a sign (+ or -), containing a decimal point (.) or a solidus (/), or ending with an exponent marker--is read as a number.
E.g: 123, 3/7, 1.0,1.0e0, 1.0d0, 1.0e-4,+42,-42

* All rationals are internally represented in a simplified form.
* On the other hand, 1.0, 1.0d0, and 1 can all denote different objects
because the different floating-point representations and integers are
different types.

* Strings are enclosed in double quotes.Within a string a backslash (\) escapes the next character, causing it to be included in the string regardless of what it is. The only two characters that must be escaped within a string are double quotes and the backslash itself.

* Names used in Lisp programs, such as FORMAT and hello-world, and *db* are represented by objects called symbols.

* Almost any character can appear in a name. Whitespace characters cannot
appear, because the elements of the list are separated by whitespace.
* No periods only name.
* open and close parentheses, double and single quotes, backtick, comma,
colon, semicolon, backslash, and vertical bar are for syntactic purposes in
lisp. if wish to include them in name, precede with backslash or two vertical
bars.

* While reading names, the reader converts all unescaped characters in a name
to their uppercase equivalents. Thats why REPL prints the upper case name
* Standard style, these days, is to write code in all lowercase and let the reader change names to uppercase

* the reader interns symbols--after it has read the name and converted it to
all uppercase, the reader looks in a table called a package for an existing
symbol with the same name. If cant find one, create a new symbol and add it
to the table or return the symbol as already in the table.

* hyphenated names is a convention.
* Global variables are given names that start and end with *
* Constants are given names, starting and ending with +.
* Few programmers, define name starting with % and %%.

* The syntax of list, number,strings and symbols represent a good amount of
lisp programs.

x ; the symbol X
() ; the empty list
(1 2 3) ; a list of three numbers
("foo" "bar") ; a list of two strings
(x y z) ; a list of three symbols
(x 1 "foo") ; a list of a symbol, a number, and a string
(+ (* 2 3) 4) ; a list of a symbol, a list, and a number.

An only slightly more complex example is the following four-item list that contains two symbols, the empty list, and another list, itself containing two symbols and a string:

(defun hello-world ()
(format t "hello, world"))


S-expressions as Lisp Forms.

* Common Lisp's evaluation rule defines a second level of syntax that
determines which s-expressions can be treated as Lisp forms.
* Any atom--any nonlist or the empty list--is a legal Lisp form as is any list that has a symbol as its first element.
* For purposes of discussion, you can think of the evaluator as a function that takes as an argument a syntactically well-formed Lisp form and returns a value, which we can call the value of the form.
* The simplest Lisp forms, atoms, can be divided into two categories: symbols and everything else.
* symbol, evaluated as a form, is considered the name of a variable and
evaluates to the current value of the variable.
* For instance, the symbol PI names a constant variable whose value is the best possible floating-point approximation to the mathematical constant pi.
* All other atoms--numbers and strings are the kinds you've seen so far--are
self-evaluating objects.
* It's also possible for symbols to be self-evaluating in the sense that the variables they name can be assigned the value of the symbol itself. Two important constants that are defined this way are T and NIL, the canonical true and false values.
* Another class of self-evaluating symbols are the keyword symbols--symbols whose names start with :.
* To determine what kind of form a given list is, the evaluator must determine whether the symbol that starts the list is the name of a function, a macro, or a special operator.

Function Calls
* The evaluation rule for function call forms is simple: evaluate the remaining elements of the list as Lisp forms and pass the resulting values to the named function.
(function-name argument*)
* Thus, the following expression is evaluated by first evaluating 1, then evaluating 2, and then passing the resulting values to the + function, which returns 3:
(+ 1 2)

Special Operators
* Because all the arguments to a function are evaluated before the function is called, there's no way to write a function that behaves like the IF operator
* To solve this problem, Common Lisp defines a couple dozen so-called special operators, IF being one, that do things that functions can't do. There are 25 in all, but only a small handful are used directly in day-to-day programming.
* The rule for IF is pretty easy: evaluate the first expression. If it evaluates to non-NIL, then evaluate the next expression and return its value. Otherwise, return the value of evaluating the third expression or NIL if the third expression is omitted.
* An even simpler special operator is QUOTE, which takes a single expression as its "argument" and simply returns it, unevaluated.
* QUOTE is used commonly enough that a special syntax for it is built into the reader. Instead of writing the following:

(quote (+ 1 2))

you can write this:

'(+ 1 2)

This syntax is a small extension of the s-expression syntax understood by the reader. From the point of view of the evaluator, both those expressions will look the same: a list whose first element is the symbol QUOTE and whose second element is the list (+ 1 2).15

Macros:
* While special operators extend the syntax of Common Lisp beyond what can be expressed with just function calls, the set of special operators is fixed by the language standard. Macros, on the other hand, give users of the language a way to extend its syntax
* The evaluation of a macro form proceeds in two phases: First, the elements of the macro form are passed, unevaluated, to the macro function. Second, the form returned by the macro function--called its expansion--is evaluated according to the normal evaluation rules.

* For instance, when you compile a whole file of source code with the
function COMPILE-FILE, all the macro forms in the file are recursively
expanded until the code consists of nothing but function call forms and
special forms. This macroless code is then compiled into a FASL file that
the LOAD function knows how to load.

* Since the evaluator doesn't evaluate the elements of the macro form before
passing them to the macro function, they don't need to be well-formed Lisp
forms.

* In other words, each macro defines its own local syntax. For instance, the backwards macro from Chapter 3 defines a syntax in which an expression is a legal backwards form if it's a list that's the reverse of a legal Lisp form.

* macros (while syntantically similar to functions) provide an exciting hook
into the compiler.

Truth, Falsehood and Equality.
* T for True, NIL for False value and everything else is True.
* tricky thing about NIL is that it's the only object that's both an atom and a list: in addition to falsehood, it's also used to represent the empty list.
* nil, (), 'nil, '() evaluate to NIL.
* t, 't evaluate to T.
* Common Lisp provides a number of type-specific equality predicates: = is used to compare numbers, CHAR= to compare characters, and so on.
* EQ tests for "object identity"--two objects are EQ if they're
identical.(Dont use as they are implementation dependent)
* Thus, Common Lisp defines EQL to behave like EQ except that it also is guaranteed to consider two objects of the same class representing the same numeric or character value to be equivalent.
*EQUAL loosens the discrimination of EQL to consider lists equivalent if they
have the same structure and contents, recursively, according to EQUAL. EQUAL
also considers strings equivalent if they contain the same characters.
* EQUALP is similar to EQUAL except it's even less discriminating. It considers two strings equivalent if they contain the same characters, ignoring differences in case.

Formatting Lisp Code.
* The indentation should reflect the structure of the code.
* Macro and special forms that implement control constructs are typically indented a little differently: the "body" elements are indented two spaces relative to the opening parenthesis of the form.
(defun print-list (list)
(dolist (i list)
(format t "item: ~a~%" i)))
* re-indent a whole expression by positioning the cursor on the opening parenthesis and typing C-M-q.
* Or you can re-indent the whole body of a function from anywhere within it by typing C-c M-q.
* Finally, comments should be prefaced with one to four semicolons depending on the scope of the comment as follows:
*;;;; four colon comments for file header. ;;; three colon for paragraph.
;; for the code following, which is indented along with code.

SoC proposal : Clean up Urllib in python

I submitted my proposal on clean up urllib in python to PSF. Was read the mails in the list and interacting with few mentors and found that folks are very helpful.
It kind of amazes me to know about these wonderful developers. It will be very inspiring indeed to work along with them ( be it SoC or not).

PCL: A Practical Database

Practical: A Simple Database

* In this chapter you'll write a simple database for keeping track of CDs.
* Common Lisp provides three distinct kinds of operators: functions, macros, and special operators.

CDs and Records
* To keep track of CDs that need to be ripped to MP3s and which CDs should be
ripped first, each record in the database will contain the title and artist
of the CD, a rating of how much the user likes it, and a flag saying whether
it has been ripped.

* need a way to represent a single database record.
* user defined class - CLOS ( Common Lisp Object System)

CL-USER> (list 1 2 3)
(1 2 3)

* A plist is a list where every other element, starting with the first, is a
symbol that describes what the next element in the list is. Symbol can be
thought of as a name.

* For the symbols that name the fields in the CD database, you can use a particular kind of symbol, called a keyword symbol.

CL-USER> (list :a 1 :b 2 :c 3)
(:A 1 :B 2 :C 3)

* function GETF, which takes a plist and a symbol and returns the value in the
plist following the symbol.

CL-USER> (getf (list :a 1 :b 2 :c 3) :c)
3

* make-cd that will take the four fields as arguments and return a plist
representing that CD.

CL-USER> (defun make-cd(title artist rating ripped)
(list :title title :artist artist :rating rating :ripped ripped))
MAKE-CD
CL-USER>
* DEFUN tells us that this form is defining a new function.
* When make-cd is called, the arguments passed to the call will be bound to the variables in the parameter list. For instance, to make a record for the CD Roses by Kathy Mattea, you might call make-cd like this:

CL-USER> (make-cd "Roses" "Kathy Mattea" 7 t)
(:TITLE "Roses" :ARTIST "Kathy Mattea" :RATING 7 :RIPPED T)
CL-USER>




Filling CDs.
* Larger Constructs to hold records.
* Also for simplicity you can use a global variable, *db*, which you can
define with the DEFVAR macro. The asterisks (*) in the name are a Lisp
naming convention for global variables.

* You can use the PUSH macro to add items to *db*. But it's probably a good idea to abstract things a tiny bit, so you should define a function add-record that adds a record to the database.

CL-USER> (defun add-record (cd) (push cd *db*))
ADD-RECORD

* add-record and make-cd together to add CDs to the database.

CL-USER> (add-record (make-cd "Fly" "Dixie Chicks" 8 t))
((:TITLE "Fly" :ARTIST "Dixie Chicks" :RATING 8 :RIPPED T))
CL-USER> (add-record (make-cd "Roses" "Kathy Mattea" 7 t))
((:TITLE "Roses" :ARTIST "Kathy Mattea" :RATING 7 :RIPPED T)
(:TITLE "Fly" :ARTIST "Dixie Chicks" :RATING 8 :RIPPED T))
CL-USER> (add-record (make-cd "Home" "Dixie Chicks" 9 t))
((:TITLE "Home" :ARTIST "Dixie Chicks" :RATING 9 :RIPPED T)
(:TITLE "Roses" :ARTIST "Kathy Mattea" :RATING 7 :RIPPED T)
(:TITLE "Fly" :ARTIST "Dixie Chicks" :RATING 8 :RIPPED T))
CL-USER>

* Current value of *db* by typing *db*

CL-USER> *db*

* dump-db function that dumps out the database in a more human-readable
format.

CL-USER> (defun dump-db()
(dolist (cd *db*)
(format t "~{~a:~10t~a~%~}~%" cd)))
DUMP-DB
CL-USER>

* looping over all the elements of *db* with the DOLIST macro, binding each element to the variable cd in turn. For each value of cd, you use the FORMAT function to print it.
* In format, t is shorthand for the stream *standard-output*.
* Format directives start with ~ (much the way printf's directives start with %).
-----
One of the coolest FORMAT directives is the ~R directive. Ever want to know
how to say a really big number in English words? Lisp knows.
CL-USER> (format nil "~R" 42424242424242424242424242424242424242424242424242)
"forty-two quindecillion, four hundred and twenty-four quattuordecillion, two hundred and forty-two tredecillion, four hundred and twenty-four duodecillion, two hundred and forty-two undecillion, four hundred and twenty-four decillion, two hundred and forty-two nonillion, four hundred and twenty-four octillion, two hundred and forty-two septillion, four hundred and twenty-four sextillion, two hundred and forty-two quintillion, four hundred and twenty-four quadrillion, two hundred and forty-two trillion, four hundred and twenty-four billion, two hundred and forty-two million, four hundred and twenty-four thousand, two hundred and forty-two"
CL-USER>
----
* ~a directive is the aesthetic directive; it means to consume one argument
and output it in a human-readable form. This will render keywords without
the leading : and strings without quotation marks.

CL-USER> (format t "~a" "Dixie Chicks")
Dixie Chicks
NIL
CL-USER> (format t "~a" :title)
TITLE
NIL
CL-USER>

* The ~t directive is for tabulating. The ~10t tells FORMAT to emit enough spaces to move to the tenth column before processing the next ~a. A ~t doesn't consume any arguments.
CL-USER> (format t "~a:~10t~a" :artist "Dixie Chicks")
ARTIST: Dixie Chicks
NIL
CL-USER>

* When FORMAT sees ~{ the next argument to be consumed must be a list. FORMAT loops over that list, processing the directives between the ~{ and ~}.
* The ~% directive doesn't consume any arguments but tells FORMAT to emit a newline.

* we could have removed dolist macro call and used the format directive
itself:

CL-USER> (defun dump-db()
(format t "~{~{~a:~10t~a~%~}~%~}" *db*))
DUMP-DB
CL-USER>

Improving User Interaction.
* need some way to prompt the user for a piece of information and read it.

CL-USER> (defun prompt-read(prompt)
(format *query-io* "~a: " prompt)
(force-output *query-io*)
(read-line *query-io*))
PROMPT-READ
CL-USER>
* format to emit the prompt.
* FORCE-OUTPUT is necessary in some implementations to ensure that Lisp doesn't wait for a newline.
* read a single line of text with the aptly named READ-LINE function
* query-io is a global variable, can be recognized by the *query-io* naming.

combing make-cd with prompt-read

CL-USER> (defun prompt-for-cd()
(make-cd
(prompt-read "Title")
(prompt-read "Artist")
(prompt-read "Rating")
(prompt-read "Ripped [y/n]")))
PROMPT-FOR-CD
CL-USER>

* prompt-read returns a string, for converting the value to integer, lets use
lisp's parse-integer function.
* parse-integer takes an optional argument :junk-allowed which tells to relax
the conversion, if there is any exception.
* junk-allowed returns nill, if that cannot find the integer, to get over and
set it as 0, we use the or macro.

CL-USER> (parse-integer (prompt-read "Rating"))
Rating: 10

10
2
CL-USER> (parse-integer(prompt-read "Rating"):junk-allowed t)
Rating: 10

10
2
CL-USER> (parse-integer(prompt-read "Rating"):junk-allowed t)
Rating: Senthil

NIL
0
CL-USER> (or(parse-integer(prompt-read "Rating"):junk-allowed t)0)
Rating: Senthil

0
CL-USER>

* For y or n prompt, we can use common lisp function Y-OR-N-P, that will
reprompt the user till something starting with Y,y,N,n is entered.


So, the final prompt-for-cd will be:

CL-USER> (defun prompt-for-cd ()
(make-cd
(prompt-read "Title")
(prompt-read "Artist")
(or (parse-integer (prompt-read "Rating"):junk-allowd t)0)
(y-or-n-p "Ripped [y/n]")))
PROMPT-FOR-CD

* lets go for adding a bunch of CDs.
* You can use the simple form of the LOOP macro, which repeatedly executes a body of expressions until it's exited by a call to RETURN.

CL-USER> (defun add-cds()
(loop (add-record (prompt-for-cd))
(if (not (y-or-n-p "Another? [y/n]"))(return))))
ADD-CDS
CL-USER>

Saving and Loading the Database

*save-db function that takes a filename as an argument and saves the current state of the database.

CL-USER> (defun save-db (filename)
(with-open-file (out filename
:direction :output
:if-exists :supersede)
(with-standard-io-syntax
(print *db* out))))
SAVE-DB
CL-USER>

* WITH-OPEN-FILE macro opens a file, binds the stream to a variable, executes a set of expressions, and then closes the file. The list following WITH-OPEN-FILE is not function,but list of parameters to WITH-OPEN-FILE, defines the file to open to out stream, direction, output and if the file exists, then supersede.
After opening the file, we need to print the content using print command, which is different from formant, it prints in lisp recognizable objects which be read back by lisp-reader.
* WITH-STANDARD-IO-SYNTAX ensures that certain variables that affect the behavior of PRINT are set to their standard values.

CL-USER> (save-db "~/my-cds.db")

If open my-cds.db, we will find the output as in *db* at CL-USER> prompt.

The function to load the database back is similar.

CL-USER> (defun load-db(filename)
(with-open-file (in filename)
(with-standard-io-syntax
(setf *db* (read in)))))
LOAD-DB
CL-USER>

* The SETF macro is Common Lisp's main assignment operator. It sets its first argument to the result of evaluating its second argument.

Querying the Database
* query database.
Something LIKE (select :artist "Dixie Chicks")
* REMOVE-IF-NOT takes a predicate and a list and returns a copy of the list,
containing only the predicate.
* The predicate argument can be any function that accepts a single argument
* and returns a boolean value--NIL for false and anything else for true.

CL-USER> (remove-if-not #'evenp '(1 2 3 4 5 6 7 8 9 10))
(2 4 6 8 10)
CL-USER>

* The funny notation #' is shorthand for "Get me the function with the following name." Without the #', Lisp would treat evenp as the name of a variable and look up the value of the variable, not the function.

* We can also pass, remove-if-not, an anonymous function.

CL-USER> (remove-if-not #'(lambda (x)(= 0(mod x 2)))' (1 2 3 4 5 6 7 8 9 10))
(2 4 6 8 10)
CL-USER>

* The anonymous function here is (lambda (x) (=0 (mod x 2))) which returns
true when x is even, else false.

* Note that lambda isn't the name of the function--it's the indicator you're defining an anonymous function.

* To select record using artist, we use the property of plist, getf, and equal
to compare and put them all together in a lambda expression.

CL-USER> (remove-if-not
#'(lambda (cd) (equal (getf cd :artist) "Dixie Chicks")) *db*)
((:TITLE "Home" :ARTIST "Dixie Chicks" :RATING 9 :RIPPED T)
(:TITLE "Fly" :ARTIST "Dixie Chicks" :RATING 8 :RIPPED T))
CL-USER>

* To wrap the whole expression in a function.
CL-USER> (defun select-by-artist (artist)
(remove-if-not
#'(lambda (cd) (equal (getf cd :artist)artist)) *db*))
SELECT-BY-ARTIST
CL-USER>
* Anonymous functions, embeds the required details like artist.

* More general select function, with Anonymous function at the next stage.

CL-USER> (defun select (selector-fn)
(remove-if-not selector-fn *db*))
SELECT
CL-USER> (select #'(lambda (cd) (equal (getf cd :artist) "Dixie Chicks")))
((:TITLE "Home" :ARTIST "Dixie Chicks" :RATING 9 :RIPPED T)
(:TITLE "Fly" :ARTIST "Dixie Chicks" :RATING 8 :RIPPED T))
CL-USER>

* Anonymous function creation can be wrapped up.

CL-USER> (defun artist-selector (artist)
#'(lambda (cd) (equal (getf cd :artist) artist)))
ARTIST-SELECTOR
CL-USER> (select (artist-selector "Dixie Chicks"))
((:TITLE "Home" :ARTIST "Dixie Chicks" :RATING 9 :RIPPED T)
(:TITLE "Fly" :ARTIST "Dixie Chicks" :RATING 8 :RIPPED T))
CL-USER>


* Write a general purpose, selector function generator, a function that,
depending upon what arguments is getting passed, will generate a selector
function for different fields, or different combination of fields.

*Keyword parameters
*Write functions with varying number of parameters, which are bound to the
corresponding arguments to the call to the function.

(defun foo (&key a b c) (list a b c))

The only difference is the &key at the beginning of the argument list. However, the calls to this new foo will look quite different. These are all legal calls with the result to the right of the ==>:

(foo :a 1 :b 2 :c 3) ==> (1 2 3)
(foo :c 3 :b 2 :a 1) ==> (1 2 3)
(foo :a 1 :c 3) ==> (1 NIL 3)
(foo) ==> (NIL NIL NIL)

* Need to differentiate between NIL assigned when no value passed vs
explicitly assigned NIL.

* To allow this, when you specify a keyword parameter you can replace the simple name with a list consisting of the name of the parameter, a default value, and another parameter name, called a supplied-p parameter.
* supplied-p parameter will set to true or false if an arugment was passed to
the function call.

(defun foo (&key a (b 20) (c 30 c-p)) (list a b c c-p))

Now the same calls from earlier yield these results:

(foo :a 1 :b 2 :c 3) ==> (1 2 3 T)
(foo :c 3 :b 2 :a 1) ==> (1 2 3 T)
(foo :a 1 :c 3) ==> (1 20 3 T)
(foo) ==> (NIL 20 30 NIL)

* A general selector function, based on the above discussions will be:

(defun where (&key title artist rating (ripped nil ripped-p))
#'(lambda (cd)
(and
(if title (equal (getf cd :title) title) t)
(if artist (equal (getf cd :artist) artist) t)
(if rating (equal (getf cd :rating) rating) t)
(if ripped-p (equal (getf cd :ripped) ripped) t))))

* Updating Existing Records--Another Use for WHERE

(defun update (selector-fn &key title artist rating (ripped nil ripped-p))
(setf *db*
(mapcar
#'(lambda (row)
(when (funcall selector-fn row)
(if title (setf (getf row :title) title))
(if artist (setf (getf row :artist) artist))
(if rating (setf (getf row :rating) rating))
(if ripped-p (setf (getf row :ripped) ripped)))
row) *db*)))

* CL-USER> (update (where :artist "Dixie Chicks") :rating 11)
NIL

* Function to delete rows.

(defun delete-rows (selector-fn)
(setf *db* (remove-if selector-fn *db*)))


* Remove Duplication and winning Big
* When a Lisp expression contains a call to a macro, instead of evaluating the arguments and passing them to the function, the Lisp compiler passes the arguments, unevaluated, to the macro code, which returns a new Lisp expression that is then evaluated in place of the original macro call.
* The main syntactic difference between a function and a macro is that you
* define a macro with DEFMACRO instead of DEFUN.

CL-USER>(defmacro backwards (expr) (reverse expr))
CL-USER> (backwards ("hello, world" t format))
hello, world
NIL
When the REPL started to evaluate the backwards expression, it recognized that backwards is the name of a macro. So it left the expression ("hello, world" t format) unevaluated, which is good because it isn't a legal Lisp form. It then passed that list to the backwards code. The code in backwards passed the list to REVERSE, which returned the list (format t "hello, world").



print and softspace in python

In python, whenever you use >>>print statement it will append a newline by default. If you don't want newline to be appended, you got use a comma at the end (>>>print 10,)
When, you have a list of characters and want them to be printed together a string using a for loop, there was observation that no matter what there was space coming between the characters. No split or  join methods helped.
>>>list1=['a','b','c']
>>>for e in list1:
           print e,
a b c
>>># Without whitespace it will look like.
>>>print "abc"
abc

The language reference says that print is designed to output a space before any object. And some search goes to find and that is controlled by softspace attribute of sys.stdout.
Way to print without leading space is using sys.stdout.write()

>>>import sys
>>>for e in list1:
          sys.stdout.write(e)
abc


Reference manual says:
A space is written before each object is (converted and) written, unless the output system believes it is positioned at the beginning of a line. This is the case (1) when no characters have yet been written to standard output, (2) when the last character written to standard output is "\n", or (3) when the last write operation on standard output was not a print statement. (In some cases it may be functional to write an empty string to standard output for this reason.)
Not getting the last part as how you will write  a empty string and use print  not appending  blank space in a single line

Sending SMS Messages Using Windows XP

I wanted this facility to send SMS via laptop keyboard connected via bluetooth to my mobile. It was very easy to setup. You got to use the Microsoft SMS sender software.

ngwallpaper

Got started with using code.google.com project hosting for ngwallpaper project. When you execute this python script, it fetches the wallpaper of the day from National Geographic site and sets it up as your Desktop Wallpaper.
Currently works on Windows platform with python windows extensions installs ( it uses SETDESTOPWALLPAPER attribute of a particular windows call).
Desirable features for ngwallpaper is 1) Platform agnostic (Windows, Linux, Mac) 2)More structure code. One present is just a start version 3)the program as a service or scheduled service which will run a particular time everyday. 4) Fix the windows set wallpaper issue where after few hours the wallpaper gets reset.

scrapbook extention for firefox

At times I read the Netspeak column in The Hindu. A particular weekly issue, mentioned about Offline Browsing Tool for Firefox called Scrapbook. This solved my much desired feature of having pages offline in firefox. Internet explorer provides this feature wherein it cache the visited pages and when the user goes offline and try to browse, it loads up the page from the internal cache. This is a useful feature when Internet connection is costly and slow, and u want to visit the pages you browsed at your work place, to be browsed( usually good long articles to read) at home without connecting to internet.

Scrapbook extension for firefox, solves this limitation. Its sits a title bar, and on page am on, I can scrap it, so that will be available offline.
In the offline reading mode, I can add comments, highlight text, and search the pages as well.
Quite a good firefox extension.

Using Windows Modem Troubleshooter

I connect to internet using my laptop running Windows XP from home, using the BSNL dial-up connection over the Internal Conexant D110 MDC V.92 Modem. Past few days, I was unable to dial up, the dial up died with in few seconds, and I could not figure out the reason as well.
Followed the Windows Troubleshooter tool today, which asked me to check for correct protocol set at Internet Connection settings (TCP/IP), and suggested  a step called "Show Terminal Window" in the Security tab of the Network Connections settings for the Modem Connection.
When Enabled and Dialed again, I am able to connect now. The problem is solved, but I am not yet to bottom of it.
Let me enjoy it now.

RSS Feeds with Syndication Icon

I have enabled RSS Feeds using Feedburner and set the standard syndication icon to my journal as well. Tip from mannu

Subscribe

Lisp Notes -2. On REPL

Subsequent to Lisp Notes 1;these are my notes for the Chapter 2 "Lather, Rinse, Repeat: A Tour of the REPL" in the Practical Common Lisp Book

* Lisp provides an interactive read-eval-print loop.
* Lisp can be used in Automated Theorem proving, planning and scheduling and computer vision. Large scale battlefield simulation, automated planning and natural language interfaces.
* Help in EMACS, Press CTRL Key, type h, release CTRL key and press t. This key combination called key-chord is represented like this. C-t h
* Info system is available by C-h i
* C-h ? brings complete list.
* C-h k lets us type any key combination and lets us know the command which will be invoked.
* C-h w lets us enter the command and returns the corresponding key combination.



Crucial bit of emacs terminology is a Buffer. While working with EMACS, each file you edit will be represented by a different buffer, only one of which is current in any way.

Buffers:
* C-x b is command to switch to buffer.
Some key combinations may be available for switches to certain buffer.
For e.g. to switch to lisp source file.
* C-c C-z switch to buffer where you interact with lisp ( REPL)

CL-USER>
This is the lisp command prompt. Lisp reads the lines of lisp expressions evaluates them according to the rules of lisp and prints the result.
The endless cycle of reading, evaluating and printing is why it is called read-eval-print loop or REPL for short.
Its also refered to as top level, top level listner, lisp listner.

From REPL we can:
- Define or redefine variables, functions, classes and methods.
- Evaluate any lisp expression.
- Load files containing lisp source code or compiled code.
- compile other files or individual functions.
- Enter Debugger.
- Step through the code.
- Inspect the state of the individual lisp command.

CL-USER>10
10
R - Reads "10" and coverts to lisp object "10"
E - Evaluates to itself.
P - Prints "10"

CL-USER>(+ 2 3)

+ symbol is coverted to + function which takes 2 and 3 as parameters.

CL-USER>"hello,world"
"hello,world"
That was a "hello,world" value.

Format function:
Format takes a variable number of arguments, but the only two required to send the output a string.

CL-USER>(format t "hello,world")
"hello,world"
NIL

* t sends the output to stdout.
* NIL is the return value of the function.

CL-USER>(defun hello-world() (format t "hello,world"))
HELLO-WORLD
CL-USER>(hello-world)
hello,world
NIL

Saving the file:
* C-x C-f type the file name with extension as .lisp or .cl
* Inside the SLIME mode, C-c C-q invokes the command slime-close-parens-at-point which will insert as many closing paranthesis as necessary to match all the open paranthesis.
* To get the source file to lisp enviroment:
* C-c C-c ( slime-compile-defun)
Or switch the REPL Buffer:
* C-c C-z (directly from SLIME to REPL)
Or
* C-x b and all the buffer.

Make some changes and type again.
(defun hello-world()
(format t "Hello,World!"))

* C-c C-c
Or
* C-c C-z
(hello,world)
Hello,World!
NIL

Save the changes to hello.lisp by typing C-x C-s in EMACS which invokes (save-buffer)
Exit SLIME, which is in REPL type ',' -a comma.
Invoke again:
M-x slime
CL-USER>(hello-world)
Will got get invoke because REPL is not aware and it will put you in the debugger mode. pressing 'q' will exit the debugger.
CL-USER>(hello-world)
;Evaluation aborted
CL-USER>

Letting the REPL Know.
1) C-x b hello.lisp and then compling using C-c C-c
2) Load the whole file:
(load "hello.lisp")
; Loading file
T
T- means loaded correctly.
FASL - Fast Load file
(load(compile-file("hello.lisp"))

From the SLIME enviroment itself, the following features are available:
* C-c C-l (slime-load-file)
* C-c C-k to compile and load the file represented by the current buffer.

AI Class Notes - 2

Notes from AI Class

Any solution goes from (0,0) state to (goal state).
- Reasoning.
- AI stands for positive thinking.*
- Chess playing, alternative choices, multiple choices.
- Humans can think simultaneously different things.
- Machine intelligence revolution.

What is A.I?
Artificial: Produced by art. Not genuine or natural, not pertaining to
the sense of matter.
Synonymous: Synthetic, fictitious, pretend, simulated, spurious,
unnatural.
Antonyms: Actual, genuine, honest, real, natural, truthful and
unaffected.
Intelligence: Endowed with a faculty of reasoning, quick of mind, well
informed and communicative.

* Marvin Minsky's initial writings provide a very good introduction.
* Do plants think?

Objectives of AI?

Primary Goal: To Make the computers smart. (CS)
Secondary Goal: To understand the nature of human intelligence.(psychologist)
Entreprenuers" To make machines more useful and economical (eventually
replace humans)

Japanese tried to create machines that will help humans when they fail.

* Fuzzy Logic in washing machines.
* Inacessible to humans? Machines with intelligence needed.
Normal missiles will be shot, but missiles with intelligence have chances of
hitting the target.

Virtual reality system help in designing the A.I system.

What is an A.I problem today may not be same 20 years down.

Definition:
AI is the study of how to make computers do things at which at the moment,
human beings are better.
(2) AI is the study of mental faculties through the use of computational
methods.

Questions:
1) What are our own underlying assumptions about intelligence?
2) At what level of details are we going to model and mimic intelligence?
3) What kind of tools and techniques we have at present for study of AI?
4) How will we know that we have succeeded in building an intelligent system?
5) What computers can and cannot do?
6) Can machines think?
7) Can a machine fool a human being into thinking that (s)he chatting with
another human being?

Computational methods:
- Number crunching.
- Huristic programming.
- Automatic programming.

8) Why we think that machines cannot?
9) For that matter, do humans think? and How do we think?

Chart:
A Modern AI Lab.
* Reasoning about objects.
* Programming [ lisp, prolog ]
* Architecture [ fifth generation, parallel]
* Design and Analysis Systems [ knowledge based expert AI
systems, decision support systems]
* Speech and Language
* Learning.
* Vision and Speech
* Robotics

Intelligent Behaviour:
Use of huristics: using some rules of thumb for deciding any of the several
alternative choices.

Huristic:
Best first search, breadth first search and depth first search.

- Huristic should help us in dramatically reducing the search for solution in
the large problem spaces.
- No guarantee of optimal solution.


Two approaches to Designing AI Based Computers.


Top-Down Approach
A.I. Application
*
* Predicate Logic
* Frames
* Semantic Nets.
* Knowledge Representation

A.I. Languages
* Lisp
* Prolog
* Smalltalk

Bottom Up Approach
Computing Model
* Control Flow
* Data Structure
* Data

A.I Architecture


Assignment:
To Reach IISc from your Home.
Parameters: Vehicle, Mode of transport, Map.
Time and shortest path constraints.
Between own vehicle and public transport, which one is preferable?


Knowledge:
Search Engine, algorithm is intelligence and database is knowledge.
Human information processing.
All knowledge structures are Tree Structures.

Reasoing:

Reasoning refers to the different kinds of activities:
- Drawing conclusions from different set of facts.
- Diagnosing possible cause of conditions.
- Making assumption about a situation.
- Analysis of organizing facts and data about problem
- Solving a problem or a puzzle.
- Arguing with a person with a particular point of view.

Classification of Reasoning activities:
Based on Degree of perception
* Deductive reasoning.
* Inductive reasoning.
* Default reasoning.

Based on level of reasoning.
* Problem level reasoning.
* Meta level reasning.

Based on generality
* Casual
* Common Sense.
* von monotonic
* Plausible
* special
* Temporal
* Reasoning systems involve the representation of information and word.

Marvin Minsky on AI

Found this post at /. which references the podcasts of Marvin Minsky on AI, but I am unable to locate them.
Found two comments which are very insightful and written by people whose thoughts were along the same direction as our discussions in proficience course over the weekends.

Quotes:

While much of the "traditional AI" hype could be considered dead, robotics is continuing to advance, and much symbolic AI research has evolved into data-driven statistical techniques. So while the top-down ideas that the older AI researches didn't pan out yet, bottom-up techniques will still help close the gap.

Also, you have to remember that AI is pretty much defined as "the stuff we don't know how to do yet". Once we know how to do it, then people stop calling it AI, and then wonder "why can't we do AI?" Machine vision is doing everything from factory inspections to face recognition, we have voice recognition on our cell phones, and context-sensitive web search is common. All those things were considered AI not long ago. Calculators were once even called mechanical brains.
by SnowZero.

----

Personally I don't think it's quantum computers that will be the breakthrough, but simply a different architecture for conventional computers. Let me go on a little tangent here.

Now that we've reached the limits of the Von Neumann architecture [wikipedia.org], we're starting to see a new wave of innovation in CPU design. The Cell is part of that, but also the stuff ATI [amd.com] and NVIDIA [nvidia.com] are doing is also very interesting. Instead of one monolithic processor connected to a giant memory through a tiny bottleneck, processors of the future will be a grid of processing elements interleaved with embedded memory in a network structure. Almost like a Beowulf cluster on a chip.

People are worried about how conventional programs will scale to these new architectures, but I believe they won't have to. Code monkeys won't be writing code to spawn thousands of cooperating threads to run the logic of a C++ application faster. Instead, PhDs will write specialized libraries to leverage all that parallel processing power for specific algorithms. You'll have a raytracing library, an image processing library, an FFT library, etc. These specialized libraries will have no problem sponging up all the excess computing resources, while your traditional software continues to run on just two or three traditional cores.

Back on the subject of AI, my theory is that these highly parallel architectures will be much more suited to simulating the highly parallel human brain. They will excel at the kinds pattern matching tasks our brains eat for breakfast. Computer vision, speech recognition, natural language processing; all of these will be highly amenable to parallelization. And it is these applications which will eventually prove the worth of non-traditional architectures like Intel's 80-core chip. It may still be a long time before the sentient computer is unveiled, but I think we will soon finally start seeing real-world AI applications like decent automated translation, image labeling, and usable stereo vision for robot navigation. Furthermore, I predict that Google will be on the forefront of this new AI revolution, developing new algorithms to truly understand web content to reject spam and improve rankings.
by Modeless

Lisp Notes - 1

The nearest thing Common Lisp has to a motto is the koan-like description, "the programmable programming language." While cryptic,that description gets at the root of the biggest advantage Common Lisp still has over other languages.

Ideas first introduced in Lisp include the if/then/else construct,recursive function calls, dynamic memory allocation, garbage collection,first-class functions, lexical closures, interactive programming, incremental compilation and dynamic typing.

vi notes

http://www.vim.org/tips/tip.php?tip_id=1465

The above vim article has some notes to accompany to tutorial, "An
Introdution to display editing using vi" written by Bill Joy and Mark
Horton.Might be helpful to get started with editing using vim or to read the tutorial.

Using cdrecord HOWTO

When any GUI based CD Burning utility is not present in your Linux box,
you might end up using cdrecord. This is a two step HOW TO to use
cdrecord to burn an iso image.


1) /usr/bin/cdrecord --scanbus

will give you the device to which your CDRW is attached.
It will be in the format:
0,0,0
0,0,1
etc
Mine was 0,0,0


2)/usr/bin/cdrecord -v gracetime=2 dev= speed=32 -dao driveropts=burnfree -eject -data


Thats it and its working for me now.