InquiryLabs

Politics, Programming and Possibilities

Archive for February, 2009

Getting Started with Haskell: Cabal

Most languages have a nice package management system that helps install new software or libraries—Ruby has the “gem” system, Perl has cpan, etc. In Haskell, it’s “cabal”, and here is how you install it:

darcs get http://darcs.haskell.org/cabal-install
cd cabal-install
sh bootstrap.sh

In addition, you should occasionally use the “update” command to sync your local package listing with the centralized one:

cabal update

To install a remote package, simply use “cabal install “. For example:

cabal install happstack

Also noteworthy is that you can use cabal to install a package from the local directory. For example, if you’ve fetched something using darcs, you could procede to install it like this:

darcs get --lazy http://code.haskell.org/yi/
cd yi
cabal install

Update: To install yi above, I also had to install a package called “alex” which is outside the cabal system at this point. I used MacPorts, i.e. “sudo port install alex”.

Crisis of Credit: Visualized

Posted via email from Duane’s Quick Posts

  • 2 Comments
  • Filed under: Uncategorized
  • Can Truth and Reconciliation Begin Now?

    I am deeply touched by the stories of those who have been “disappeared” by the U.S. government over the last 8 years, and hope that what they have to tell us–those who have returned to tell us–can help guide us back to a place of responsibility and strength by example.  I wrote last year to my senator about my Canadian compatriot Maher Arar who was taken from his family during a visit to the US and later tortured in Syria.  Recently, another man who is not Canadian but suffered similarly, Mohamed Bashmilah, has published a short account of his experience.  It begins:

    From October 2003 until May 2005, I was illegally detained by the U.S. government and held in CIA-run “black sites” with no contact with the outside world … never once having faced any terrorism-related charges. Since my release, the U.S. government has never explained why I was detained and has blocked all attempts to find out more about my detention.

    It’s quite a story, and deserves our attention first and foremost because we have to acknowledge that it happened.  I feel a little ashamed that I felt “safe” while he was captive somewhere, disconnected and silenced.  I think his reasoned appeal is also something that deserves to be heard: he is not asking for a lower standard of national security, he is hoping that America will uphold its ideals of fairness, justice, and equality under the law.
    I share that ideal and hope we can begin our journey toward truth and reconciliation.  His story is available to be read here.

    Posted via email from Duane’s Quick Posts

  • 0 Comments
  • Filed under: Uncategorized
  • I’ve been thinking and reading about horizontal or “lateral gene transfer” in prokaryotes and I have a hypothesis.  I’ve been reading this article (”The tree of one percent”) which inspired in part this New Scientist article on the topic.  Basically, there is a great deal of evidence that in bacteria at least, there is a lot of genetic information being passed between species–not necessarily from parent to daughter cell, but actually from cell to living cell.
    Suppose that life “created itself” in the evolutionary sense (this does not necessarily exclude a god or anything like that, I’m just proposing we consider a universe where it is possible for non-living things to become living things without an actual “engineer” that connects molecules or plants the first “seed cell” or whatever).
    If life “created” itself, then it seems that just like it takes a long time (i.e. hundreds of thousands of years) for one species to bifurcate into one or more other species, we would expect that there is a long transition period between protolife (i.e. pre-cellular life) and cellular life.  What would protolife be like?  It would consist of complex molecules, manufacturing processes, and information transmission mechanisms, all within the earth’s “protobiosphere”, like one giant cell.  It would be very slow, and very inefficient.  Communication would be terrible.  Mechanisms would be faulty, etc.  In short, it would be an ineffective system, but if it worked, then it worked, and that was good enough.
    Now suppose that the first prokaryote (a cell without a nucleus) had formed, perhaps by the enlarging of a small container unit.  This larger container unit would be an anomaly in the One Great Cell, because it would kind of be like a little world all on its own.  But it would certainly not be immune to all of the other communication signals going on around it from which it was recently “born”.  Rather, it would be dependent on them and the physical materials produced there for its very perpetuation.  In other words, Lateral Gene Transfer (communication within the One Great Cell) would actually have been the *first* gene transfer mechanism, not a strange oddity in present-day genetics where we assume almost all gene transfer is tree-like.
    If this hypothesis is correct, then we would expect to see more LGT going on in life forms that are closer to the original One Great Cell, and less LGT going on in “higher order” organisms such as multicellular eukaryotic beings.  Still, LGT might exist even at the highest end (e.g. viral DNA transfer) but it would be much lower than the more ancient bacteria for instance.  The “tree of life” becomes real at the most advanced end of life, but it may have its roots in a proto “web of life” that didn’t distinguish species (there wouldn’t have been “individuals” at that time, so the existence of a “species” doesn’t make sense).
    Perhaps higher-order organisms have created “defense mechanisms” against LGT because of the potential that LGT has to drag down their efficiency.  ”Transmissible disease” then could be seen as leftover attempts at lateral gene transfer from each order of life.  Bacteria have viruses that they have to fend off because viruses played some important transmission role long ago.  Animals have both bacteria and viruses to fend off.  In each case, the One Great Cell is still trying to communicate between its constituent parts, but the parts have become intelligent enough on their own to know that they must defend against a permissive information transfer protocol.
    Thus, our most recent ancestors fit what Darwin correctly identified as a “tree” and microbiologists are also right in identifying something “untree-like” in the most ancient of Earth’s past.
    What do you think?
  • 0 Comments
  • Filed under: Science
  • WEKA: Way Cool Machine Learning Toolbench

    I just learned about Weka in my bioinformatics class.  We’ll be using it get our computers to “learn” patterns from amino acid sequences in order to predict secondary structures in protein (e.g. alpha helices, beta sheets, etc.).  The cool thing is that this Weka toolbench is suitable for just about anything you can imagine… my mind is already swirling with ideas :)
    There is a Quick Intro here, and a main link to the project where you can download it here.

    Posted via email from Duane’s Quick Posts

  • 0 Comments
  • Filed under: Uncategorized
  • Improvements to download-files command

    I added a few improvements to the Ubiquity “download-files” command. It now checks everything on the page, including frames and iframes. Also, it walks through all of the CSS files and downloads image assets if they match the pattern you specify.

    Visit Ubiquity Download Files on GitHub to see the code, or this gist to subscribe.

    My Most Helpful Handful of Firefox Tips

    A handful is five, so I will try to make this a short but helpful list:

    1. Command-L (⌘L) : Put focus on the location bar.  The location bar is where you type URLs.  If I want to do a (Google) search instead of a URL, I often press tab to get to the search engine text box.  ⌘K does that also, but I often find myself pressing ⌘L before I classify my question as a URL or as a search term.
    2. Command-T (⌘T) and Command-Shift-T (⇧⌘T) : The first one creates a new tab, the second one restores the most-recently-closed tab in your history.  The nice thing about restoring a tab is it comes back with its own history, so you can use the “back” button if you want to trace your steps.
    3. Apostrophe (’) : Search for a link on the page.  This is a recent discovery that has made navigation quite easy.  Instead of using using the mouse for link-clicking, I’ve begun using the apostrophe.  The slash (/) key searches links AND text.  If a link is matched, I press Enter to go there (or ⌘-Enter to open the link in a new tab).
    4. Option-Number (⌘1, ⌘2, ⌘3 … etc.) : Move directly to the first, second, third etc. tab.  I save a lot of time this way since flipping between tabs is so efficient.  I try to keep the number of open tabs below 12 or so, and the limited number of single-digits for this shortcut key is what motivates me to do so (aside from CPU and memory limitations!)
    5. Option-Space (⌥-Space) : Ubiquity!  I use this Firefox plugin more and more these days.  After pressing the key combo, I type “email this to chris” for example and it wraps up the URL of my current page and sends me off to gmail where I can email something to my brother.  Or I recently created the download-files command for Ubiquity that lets me download all of the images on a page, for example.  Or search-domain-name to see if a domain name is available… or twitter to update my status… or … you get the idea.  Ubiquity can help you leverage almost anything that’s available online.
    Note for windows users: in many cases, where you see a ⌘, you can use the “ctrl” key instead.  I’m not a windows guy though, so don’t quote me on it.

    Posted via email from Duane’s Quick Posts

  • 1 Comment
  • Filed under: Uncategorized
  • I wrote a ubiquity script that lets you download just about anything on the page you’re visiting, for example images and javascript files.  It’s called “save-all” “download-files” and it’s available as a gist on github.  One of my classes at university has a “resource page” where they provide all of the datasets for our statistics homework; however, you have to click on each one of them (stored in “.dat” format) to get them all!  What a waste of time.  So instead of clicking on each one, I wrote the following script.  Here’s how you would use it:

    download-files .*png$ ~/Desktop/Images

    Currently, only regular expressions are supported, so in the first example, the “.*png$” specifies that the script should download all urls on the current page that end in “png”.  I’d like to support shell wildcards (e.g. “*.png”) and I may do that soon.
    download-files dat$ ~/Desktop/DataFiles

    This second example shows that you can leave off the “.*” and just tell it to get things ending in “dat”.
    download-files .*

    The third example shows how you can leave off the destination folder and a pop-up window will ask you where you want the files to be saved.
    Enjoy!

    Update: Changed the name of the command from “save-all” to “download-files”.

  • 6 Comments
  • Filed under: Uncategorized
  • Tech News Roundup

    Video: Robot uses human mind tricks to navigate 

    Engineers in Germany have been studying human brain activity related to visual information to improve the way moving robots avoid obstacles.
    A new study from Northwestern University offers precise electrophysiological evidence that such decisions may sometimes not be guesswork after all.
    Mothers who receive mental training before they become pregnant can pass on its cognitive benefits to their young, Tufts University School of Medicine researchers have found. The effect was not passed on to a third generation and was only inherited if the offspring were conceived within three months of enrichment.

    Toshiba Corporation today announced the prototype of a new FeRAM — Ferroelectric Random Access Memory — that redefines industry benchmarks for density and operating speed. The new chip realizes storage of 128-megabits and read and write speeds of 1.6-gigabytes a second, the most advanced combination of performance and density yet achieved.

    Posted via email from Duane’s Quick Posts

  • 0 Comments
  • Filed under: Uncategorized
  • Disassembling the Library

    There is a fascinating change taking place in categorization due to the internet: we are no longer constrained to say that a book is about one particular thing:

    From the page Shirky: Ontology is Overrated — Categories, Links, and Tags:

    It isn’t the ideas in a book that have to be in one place — a book can be about several things at once. It is the book itself, the physical fact of the bound object, that has to be one place, and if it’s one place, it can’t also be in another place. And this in turn means that a book has to be declared to be about some main thing. A book which is equally about two things breaks the ‘be in one place’ requirement, so each book needs to be declared to about one thing more than others, regardless of its actual contents.  Just thinking out loud here… I wonder if this physical requirement of books being in one place at one time has caused us (humans) to think in categories? Do we naturally think in graphs with nodes and edges? If so, the internet is a nearly perfect medium for this new way of organizing information.

    Posted via email from Duane’s Quick Posts

  • 1 Comment
  • Filed under: Uncategorized