May 25, 2010
I recently updated to Ubuntu Lucid and immediately noticed UI performance degradation after using it for a short while. The sluggish performance affected window switching and scrolling in Firefox/Chrome/Evince etc. Nothing on my system indicated a memory leak or chewed-up processor.
I searched Ubuntu's bug tracking system and came across this post, which indicated the using the latest kernel version fix the problem. After following the steps here to update my kernel, my system runs as fast as ever. Hopefully other users experience my situation will stumble across this post and find it helpful.
May 22, 2010
The Selfish Gene does a marvelous job explaining the core concepts of
evolution for the lay person. It begins with the predominate theory of
how life began in the primordial soup. It then explains how the first
replicators became the genes that make up our DNA and how the natural
environment shapes evolution by pruning the most adaptive and
advantageous of those genes.
Genes are responsible for manufacturing organisms to help them
replicate. They affect not only its own organism, but the surrounding
environment and other organisms. The book explains how the genes
affect the organisms behavior, and how the behavior of a population of
species follows an Evolutionary Stable Strategy (ESS). The book's
title refers to the concept that genes are really looking after
themselves first, but it also explains how altruistic behavior can
arise from the gene's selfishness. The author adamantly proposes that
we are the first species that can defy our genes and oppose the
ruthless nature of natural selection to make the world a better,
friendlier place.
It worries me that many people are ignorant of evolution. Never once
did my high school offer a class on the topic. In my opinion, everyone
should be familiar with the concepts because I believe it's important
to know how we came to be. I recommend this book to everybody.
May 8, 2010
Practical Common Lisp has turned into the de facto standard for beginners who want to learn Common Lisp, and deservingly so. The opening chapters delve right into the development style of Common Lisp and show how it differs from more mainstream languages. It covers all the basics and more, eventually leading into chapters explaining how to parse MP3 files and create and create an MP3 Shoutcast server from scratch.
Common Lisp is my favorite language to develop in, but most people I talk to dismiss it as being too old and irrelevant for today's computer applications. I highly disagree. The fact that the language is old is actually one of it's strengths: every design decision seems so well thought out. I've had numerous moments where I commented to myself "you know, it would be nice if this function could do this," and then discovered that it could after reading the documentation. And the development environment is the best out there. The Slime/Emacs/Lisp combination is way ahead of Visual Studio in terms of interactivity, customization, jumping through source files and debugging.
I recommend this book to all developers out there, as learning Common Lisp helped me in my day job as well. At least read through the chapter on creating a unit test framework to get a feel of what software development should be like.
April 24, 2010
I never have done much reading about psychology before so I thought this book would be a good change of pace for me. The book was easy to read and covered the general ideas about how evolution cause major deficiencies in our brains. Most people don't realize how imperfect we actually are, but just by learning about it we can avoid certain downfalls that all people are prone too.
It was a quick and enjoyable read, but I didn't learn a whole lot from it, probably because I read much about evolution before. Still, I recommend this book for all non-psychology students so they can better understand who they are.
April 11, 2010
Set in the 1800s, the Piano Tuner is a well written novel about an ordinary man who journey's to the remote jungles of Burma on an odd mission from the British military. There he experiences sights and sounds that he had never seen before, met many interesting people and discovered a source of excitement that was missing from his bland life.
Without revealing any spoils, I found the ending of this book highly engaging, but it still served as a poor penance for the uneventful, unexciting story leading up to it. I found the main character lacking any charm or personality whatsoever. In a sense, I found him distasteful and selfish for leaving his wife behind while seeking adventure. And all through his journey, he did nothing to change his attitude, nothing to prove his worth as a character who deserved respect and admiration.
Though I dislike giving negative reviews, I cannot recommend this book to anyone, but I'm sure others will have different opinions.
March 21, 2010
SQL Prompt is a great add-on tool for SQL Server Management Studio that I use at work extensively. One of the features it has is "Snippets", which allow you to type a piece of code that expands into other code. For example, typing "ssf" and hitting Tab expands into "SELECT * FROM".
Users can customize snippets, which are saved in a file and can be shared with others (more info here). The database schema I use at work contains hundreds of tables, each named accoring to their abbreviated primary keys. Since some names are very long and cumbersome to type even with SQL Prompt, I created a Lisp script to auto generate snippets for each of the tables.
For example, lets say our database models baseball statistics. We have tables for players and teams. Since we want to tract statistics for multiple years, we have a year table and tables relating the three. So, our very simple database may look like this:
- Teams
- Players
- Years
- PlayersYears
- TeamsYears
- PlayersTeamsYears
My simple Lisp program created snippets for each of the tables, expanding "pty" to "PlayersTeamsYears" and such for each of the tables.
After saving my new SQL Prompt snippets file and starting Management Studio, SQL Prompt generated a run-time error because I had duplicate shortcut keys. Unfortuately, the error message didn't say which keys were duplicates, so I used the s-xml package and parsed the SQL Prompt file looking for duplicate shortcuts.
s-xml works by parsing the xml file sequentially. For each new element, it calls a new-element hook function, and for each new piece of text it calls a new-text hook. The new-element hook takes as pararmenters the name of the element and the attributes. The new-text hook takes the string of text. Each hook also accepts a seed element, which can be any object and is passed along while parsing the file.
I wanted to find duplicate shortcuts, so I decided to keep a hash-table with shortcuts as the key and the number of occurances as values. The shortcuts live inside of the "Shortcut" element, so my seed also needed to know the name of current element it was working on. I created the following class for my seed:
(defclass dup-shortcut-seed () ((name :accessor name) (hash :initform (make-hash-table :test 'equalp) :accessor hash)))
I created a method to easily increment the class's hash table:
(defgeneric inc-hash (dup-shortcut-seed key)) (defmethod inc-hash ((dup-shortcut-seed dup-shortcut-seed) key) (incf (gethash key (hash dup-shortcut-seed) 0)))
Now that I have my seed, I created the element and text hooks that use the seed to keep track of duplicate shortcuts:
(defun dup-shortcut-xml-new-element-hook (name attributes seed)
(declare (ignore attributes))
(let ((name (print-xml-string name)))
(setf (name seed) name)
(format t "New element: ~s~%" name))
seed)
(defun dup-shortcut-xml-text-hook (string seed)
(when (equalp (name seed) "Shortcut")
(format t "Modifying hash~%")
(inc-hash seed string))
seed)Next I created a function to call the parser on a stream:
(defun dup-shortcut-xml (in)
(start-parse-xml
in
(make-instance 'xml-parser-state
:seed (make-instance 'dup-shortcut-seed)
:new-element-hook #'dup-shortcut-xml-new-element-hook
:text-hook #'dup-shortcut-xml-text-hook)))Finally, I created the main function, which parses the xml file and diplays any duplicate shortcuts:
(defun find-dup-shortcuts-in-xml (&optional (file *output-file*))
(with-open-file (in file)
(let ((hash (hash (dup-shortcut-xml in))))
(maphash (lambda (key value)
(when (> value 1)
(format t "~s:~s" key value)))
hash))))After finding the shortcuts, I modified my snippet file and it worked beautifully!
March 14, 2010
Anybody who loves science and technology will love this book. The book is about how technology will involve during the next one hundred years, not at a constant, linear rate, but as a double exponential rate. Ray provides many data and examples of this theory, and explains how the current research done by todays scientists and engineers will change the world more quickly than most people realize.
The book focuses on three areas of science and technology: genetics, nanotechnology, and artificial intelligence. Advancements in each this century will bring major changes, including augmented our intelligence and replacing all of our organs so we could essentially live forever. Machines will become more intelligent than us, for when we create the first machine that can produce a machine smarter than itself, the cycle will iterate at an astonishing rate and machine intelligence will skyrocket past human intelligence. All of these future technologies he describes may seem bizarre, but keep in mind the progress of each one has already begun today.
This book also contains a wealth of online references which I find very interesting and useful. As with any book, it should be regarded with great skepticism. For one thing, we may discover fundamental limits that stop our progressions in a particular area of research, or Ray Kurzweil may underestimate the complexities and challenges of the technologies he wrote about. This book was entertaining. The advancements mentioned are possible but not definite. I recommend this book for every technology lover and for those who are interested in the current research areas of science and technology companies and universities.