Older blog entries for mchirico (starting at number 66)

19 Jan 2008 (updated 19 Jan 2008 at 15:27 UTC) »
"The Mathematics of Poker", by Bill Chen and Jerrod Ankenman. (2006)
An excellent book on poker especially if you're into programming poker bots. The book explains the math, leaving no missing steps; yet, these guys know their math (Chen has a a PhD in Mathematics from Berkeley, and works at a well known Susquehanna International Group, that specializes in financial analysis). These guys know their poker too. Chen has 2 world series bracelets in a subdivision of hold'em.

Programming Texas Hold'em Bots

If you're interested in programming Java poker bots, you may want to checkout Poker Academy. You can plug in your Java coded bots and use these bots to play against other players on line for PAX (poker play money).

A quick note, don't be fooled by the term play money - you'll have to earn that money with hard work against other good players. Time is money. It takes time to earn PAX; therefore, PAX is equivalent to money.

11 Jan 2008 (updated 11 Jan 2008 at 17:02 UTC) »
Recommended Books:

"Introduction to GCC for GNU Compilers gcc and g++", by Brian Gough, Foreword by Richard M. Stallman. (2004).

This book is a good read with an emphasis on simple but relevant content. The book is published under the GNU Free Documentation License, and copy can be found here.

Information on purchasing a copy can be found at http://www.network-theory.co.uk/gcc/intro/. Since part of the purchase price goes to raise money to improve and create more free software and documentation, I purchased a copy to read on the train. The book is small enough to fit inside any cargo pants side pockets.

You may also be interested in the following book:

"Comparing and Merging Files with GNU diff and patch; for Diffutils 2.8.1 and patch 2.54", by David MacKenzie, Paul Eggert, Richard Stallman. Edited for publication by Brian Gough. (2002).

If the above free download doesn't work, since I'm not sure it will work outside the United States, try the following Souptonuts downloads

Robert Morris of the NSA proposed the following problem:

What is the next series of numbers?

1 11 21 1211 111221 ...

Fedora Core yum Updates Disabled

It appears that Fedora core yum updating has been disabled. Perhaps this was done to try and minimize the impact on the servers, while users download the new release of Fedora Core 6?


# yum -y update
Loading "installonlyn" plugin
Setting up Update Process
Setting up repositories
Cannot find a valid baseurl for repo: core
Error: Cannot find a valid baseurl for repo: core


Uncomment the baseurl setting. The following was done on my FC5 systems. It makes backups, using the extension .backup.

cd /etc/yum.repos.d/
perl -pi.backup -e "s/#baseurl/baseurl/" *

Now you should be good to go.

4 Oct 2006 (updated 4 Oct 2006 at 01:17 UTC) »
nconway's problem

Well, my guess is S1(w) > S2(w), since with the simple string "aaaa" there are two occurrences of the substring "aaa". The first is from position 0 to position 2. The second is from position 1 to position 3. There is overlap.

Note it is impossible to have two occurrences of substring "abc" using any 4 characters. Therefore, more substrings of "aaa" can also be found in the 10 character string.

The mark of an immature man is that he wants to die nobly for a cause, while the mark of the mature man is that he wants to live humbly for one.

--W. Stekel

6 Mar 2006 (updated 19 Feb 2007 at 02:33 UTC) »
How to Trade in Stocks

It's been said that Jesse Lauriston Livermore was the greatest stock market operator in history - the only operator who ever made and lost four stock market fortunes. He did it all on a ``small bankroll, a stock ticker and a telephone.''[1]

Jesse Livermore stock picking techniques are still applicable today. In fact, if you do a careful read, you'll see that some well-know authors have actually stolen his techniques. Livermore's techniques worked well for him, when he followed them. Unfortunately, he got emotionally wrapped up in the marketed and departed from his rules. He died by suicide in 1940.

    ``It is the human frailty with we all possess in some degree that becomes the investor's and speculator's greatest enemy and will eventually, if not safeguarded, bring about his downfall.''[1]

Livermore had a number of rules: Never by on a tip alone; Stocks reaching new highs tend to go higher; Never trade in stocks under $15. Have an exit strategy before you buy, etc.

Stock Prices

There's a program stock.tar.gz that grabs current stock price data from yahoo finance. Below is an example usage getting the stock price for Redhat. By the way take a look at this price. It's starting to hit new highs, and it volume follows through on the new high it could be a good buy. Oh, first rule: Never buy on a tip alone.

            $ stock rhat

This program[1] can do multiple stocks and or indexes as well. See the man page on the program for more help. The source is very simple using socket, bind, connect. It can easily be adjusted for scraping other pages, sending mail (you'll have to change the port), or other desired tasks.

Email Alerts

I use Gmail; but, but it's a custom setup with the local MTA (Postfix) and Fetchmail. The advantage here is being able to run any standard shell scripts for sending out mail, on your home system, where you might not have a dedicated IP address.


    [1] How to Trade in Stocks: the Livermore Formula for Combining Time Element and Price. By Jesse L. Livermore. Copyright 1940. ISBN: 0-934380-20-1
    [4] stock.tar.gz Direct download. This is a simple GPL socket, bind, connect, C program.
4 Mar 2006 (updated 5 Mar 2006 at 04:54 UTC) »
Xen and FC5

Xen is cooking up nice on Fedora Core 5. I didn't have any problem installing this on a Dell OptiPlex GX520, Pentium 4 (3.00 GHz), with 1G of RAM, Broadcom NetXtreme BCM5751 Gigabit Ethernet PCI Express, Linksys Gigabit Network Adapter (Model No. EG1032,rev 10).

It was actually only a matter of minutes before I had everything running, which I think is the best way to learn about Xen. That is, first have a running system with multiple guest systems. And, for each guest account have networking functional. One quick note, it certainly helps if you have 1G of RAM, so that each guest account can use the minimum default of 256MB. Take a look at the FC5 Xen Quick Start Instructions for how it's all done.

What's missing in these instructions is how to ssh into a guest xm and run kde remotely. I'll detail here what worked for me.

Xen and remote KDE

From the computer you are sitting at, with a monitor,keyboard and KDE or Gnome loaded and running, you'll connect via ssh to the Xen guest system. But before you can do this, walk through the step 1, with the computer in front of you.

    Step 1. Allow magic cookies; otherwise, you may get the following error:
               Xlib: connection to ":1.0" refused by server
               Xlib: No protocol specified

To enable magic cookies from the shell, issue the following commands.

   $ MCOOKIE=$(mcookie)
   $ xauth add $(hostname)/unix:1 MIT-MAGIC-COOKIE-1 $MCOOKIE
   $ xauth add localhost/unix:1 MIT-MAGIC-COOKIE-1 $MCOOKIE

    Step 2. Create a new xterm. This will immediate take you to vt12. To get back to your main KDE session type ctl-alt-F7. To go back, again, to vt12 type ctl-alt-F12.

    $ xinit -- :1 vt12

    Step 3. From vg12 type in the user and domain. The example below assumes the guest vm is vm0.domain.com, and the user to login in with is root.
    $ ssh -Y -l root vm0.domain.com

    Step 4. Once you're logged into the guest system, all you have to do is start KDE.
    $ startkde

I didn't have to change anything for KDE, but Gnome takes a few tweaks.


You may want to reference Linux Tips (TIP 195)

Now, in my opinion, it's instructive to look at the FC4 Xen Quick Start, and hack away the working Xen configuration. The FC4 documentation goes into the mechanics of the process.

Recommended Reading

"Higher Order Perl: transforming Programs with Programs", by Mark Jason Dominus.

Mark put a lot of time into this book, and it shows. It was 5 years in the making, with free versions passed out for review. Examples can be found here (scroll down the page) .

Mark plans to take the book public, in Wiki form.

I would agree that "writing functions that modify other functions" is a very powerful programming technique found in Lisp, Mathematica, Java, and C++ to name a few languages, but it's not generally associated with Perl. Well, Mark will open your eyes here. The book is fun to read. It has depth; however, it is not written like a text book. Compare it to hacking with friends rather than sitting in a CS class.

Leap Second Log Entries

That's it. The leap second was added. You'll see it in your logs.

Dec 31 18:59:59 squeezel kernel: Clock: inserting leap second 23:59:60 UTC
Dec 31 18:59:59 livingroom kernel: Clock: inserting leap second 23:59:60 UTC

57 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!