September 2007 Archives

Sun Sep 23 15:56:09 CDT 2007

This is a test article

This article should show up at the top of the page.

Foo bar

Posted by Nesman | Permanent Link

Sat Sep 22 12:19:49 CDT 2007

command line mistakes

A computer lets you make more mistakes faster than any other invention in human history, with the possible exception of handguns and tequila. - Mitch Ratcliffe

It's well known that making mistakes on a computer is an easy task. If you want to remove all the saftey equipment, try the command line for a while. CLI computing is, well, COMPUTING TO THE EXTREME!! (I apologize for that, I couldn't help myself.)

In all seriousness, if you're not paying attention, the power of the commandline can easily be twisted into a weapon and used against your precious data. Here I will keep a running list of examples: some from personal experience, others just from my imagination.

# rm -rf / home/some/file/tmp
rm: cannot remove `home/some/file/tmp': No such file or directory

Notice the space after the first forward slash? We just told the machine to make two deletions: the first is "/" and the second is "home/some/file/tmp". After removing the first, it moved on to our tmp but couldn't find it.
Lesson? Beware of spaces. I like to use tab completion, even if I'm only a letter or two from finishing the line. That way the computer confirms my file path for me.

	$ cd /home/nesman/webfiles

work work work ... start messing around in another directory ...
	$ ls /mnt/hd/spare/iso

get the idea to save space with gz compression
	gzip /mnt/hd/spare/iso/*.iso

Hmm, I should have checked to see how big everything was. I don't know how much space I'm actually saving.
	$ mkdir iso
$ for i in *.iso.gz; do mv $i iso; done
mv: cannot stat `*.iso.gz': No such file or directory

Oh yeah, we're still in the web files directory. Hehe.
	$ cd /mnt/hd/spare/iso
$ for i in *.iso.gz; do mv $i iso; done
$ cd iso
-bash: cd: iso: Not a directory

That's odd. Shouldn't those files have gone into a directory named "iso" instead of just clobbering into a single file? Oh... That's right. I was in my web directory when I ran mkdir. My directory didn't follow me here. Well, I guess I saved a lot more space than I planned to.

Posted by nesman | Permanent Link

Thu Sep 20 12:14:03 CDT 2007

just another test. this time with vars and random tags.

this is a new entry by $USER
Lorem ipsum dolor quoed bork


Lorem ipsum dolor quoed bork


Lorem ipsum dolor quoed bork


Lorem ipsum dolor quoed bork


Lorem ipsum dolor quoed bork
this is some code a = b - c
this is 
	some pre 
		formatted text
	using tabs
and stuff
foobie blech A random fortune should appear somewhere on this page. I hope.

Posted by Nesman | Permanent Link

Thu Sep 20 08:59:20 CDT 2007

Are you ready for Linux?

Following is a list of questions to ask yourself if you are wondering if Linux is right for you. You might be surprised.
  1. Do you still use Internet Explorer™ as your web browser?
    • Use Firefox for a week to see why those that know it love it. After it's installed, select "For Internet Explorer Users" from the Help menu to help learn the new features. After you learn to middle-click links/tabs, try Adblock Plus and pre-made filters to remove all of the banner ads from the pages you visit. You'll never go back.

      Firefox is the first Free software that many people try. It's a gateway application. You start using it casually with friends and before you know it you're on other Free software like OpenOffice and the GIMP.

  2. Do you use your computer to create and read Word™, Excel™, Powerpoint™ or PDF documents?
    • These document types work fine on Linux. OpenOffice can handle all these formats and more. It runs on Windows™ and Linux, and best of all (you guessed it) it's Free. We use this on the Windows™ box, and my wife and I love it.

  3. Do you watch movies and listen to music on your computer?
    • Linux has lots of great programs for multimedia. Amarok is a great audio player, and MPlayer and VLC can pretty much handle any video you give them.

  4. Are you tired of Windows™ security?
    • Linux is designed with security in mind and, because it's Open Source, you have more than just the original programmers's opinion. With Windows™, you pretty much have to take the word of your software provider. Do you know why Best Buy's™ Geek Squad™ charges between $129 and $299 for "Security" services? Because they can. Windows™ is known for having vulnerabilities and, if you haven't protected yourself, you're looking at $249 to $349 to fix it.

      Trusting your computer with Microsoft™ is like hiring a nanny that brings a supermarket tabloid, pack of Marlboros, ball-gags, and 20 feet of rope. Your kids are much better off with Grandma.

  5. Are you worried about how hard running Linux is?
    • This is the year 2007. Linux is not as hard to work with as it used to be. Kubuntu installs from a live cd. My wife installed Kubuntu while browsing the web on the computer, and she isn't a computer person. If you can burn or borrow a cd, you can install Linux. The newest way to install Linux is even easier than this. You can now get Linux install.exe(be warned: "beta" means "mostly works but still needs testing") and install Linux while Windows™ is still running! After you're installed, you'll have the option of running Windows™ or Linux each time you reboot. Even if you run into trouble, you can always go back to Windows™ with a reboot. Over time, these reboots will be less frequent untill you stop using Windows™ completely.

  6. Do you often play PC games such as World of Warcraft™, Counterstrike™, or Halo™?
    • This used to be a problem, but it is actually very easy to install Warcraft™ on Linux with the newest versions of Wine. Not all Windows™ games will work, but the list of games that do work grows all the time. On top of that, many great games are made to run on Linux, and the best part is that they are usually Free. Besides, the best games are released on the console and you don't have to buy another $300-$600 video card every 6 months to enjoy the newest console games. If this still doesn't satisfy your gaming appetite, you can leave Windows™ on half of the hard drive and boot into it whenever you need a fix. You'll be surprised at how quickly you'll ween yourself.

  7. Do you prefer to have consumer choice over supporting a monopoly?
This might seem scary, but after you've made the switch you'll understand. Learning to walk hurt a bit, but not many people go back to crawling. Then you learned to ride a bike and found that walking for any distancce was not efficient. Eventually you learn to drive and really open up your travel options.

Learning to use Linux has the same result.

What are others saying about Linux? Take this with a grain of salt. This one is more fun, based on a similar article about switching to a Mac. (Link to original Mac article at top of page.) Reasons not to use Linux... ; ) ...and part 2.

Posted by Nesman | Permanent Link | Categories: linux

Wed Sep 19 15:37:20 CDT 2007

blank test

This is just a test

Posted by nesman | Permanent Link

Wed Sep 19 15:11:54 CDT 2007

Posted by nesman | Permanent Link

Mon Sep 3 09:18:29 CDT 2007

Blackjack - nesman64

I have a small interest in blackjack and the statistics involved with it. I worked in a casino long enough that I know better than to try and beat the house. On the other hand, if the dealer has to play to 17, you can win about 1/3 of your hands without drawing a card.

I know that it's been done before, and probably at length, but I want to investigate different strategies for blackjack. I'm working on the early stages of a blackjack program. It's still in pseudocode, but it's starting to look a lot more like a blackjack program and less like a Rube Goldberg blackjack machine.

A 2 3 4 5 6 7 8 9 T J Q K
When I started with it November 11, 2005, I had plans of making a 2 dimensional array [4x13] and randomly choosing from it for each draw. After a card was chosen, it's value in the array would change to tell the program not to choose it again. This created two problems.
  1. Broken odds
  2. Inefficient card selection

Broken odds
The first problem with this method is that the only draw with correct odds would be the first with 1/52. Using the array method, lets pretend we're choosing suit then rank. Each draw, you get a 25% chance of getting a heart. Still pretending, lets say you get 7 hearts out of the first 12 cards. Your odds of getting a heart in the next draw should be 6/40 (15%), but using the array method, you'll always get a chance at a heart 1/4 of the time. This happens on a smaller scale when you draw rank first. With my plans of running this hundreds of times to check the odds on different strategies, even a small variance will kill it.

Inefficient card selection
Also related to my wish to run this at length unattended, I needed to clean up the card selection. Your first card is always valid, but each card(x)after that, has an x/52 chance of being invalid. Invalid cards must be redrawn. Simply choosing the next higher card doesn't seem like a problem at first, but it greatly adds to the problem with skewed odds. When you're halfway through the deck, you average 2 cards per 3 draws. When you're down to the last few cards, you could easily draw 20 invalid cards before getting one you can count. I don't know how many attempted draws it would average to get through a deck, but it would easily be 500, I think.

As of November 20 or so, I "shuffle" the deck with a kind of random bubble sort. I made a system that uses a natural model to shuffle. I start with a single dimension array 52 elements long (I might skip this step in the future) and filter the values into 2 smaller arrays. Then, (and I'm still working on cleaning up the end of this) I sort the 2 smaller arrays back into the longer one, starting at the top and randomly deciding which of the smaller arrays contribute a card to the large one. I've heard that with a real deck, after the seventh shuffle the cards achieve optimal randomness. Any shuffling after the seventh is unneeded. I may adjust this after I get a working model coded and can see where the cards end up.

This next part isn't pretty, but it's my current note file. Reading it now, I don't understand what I meant by some of it.

arr deck(1-52)  0-51 really (don't forget to adjust card,suit
card = deck[x] %13 1=A, 11=J, 12=Q, 13=K
suit = deck[x] %4 1=C, 2=D, 3=H, 4=S
shuffle deck: rnd_bubbly_sort(deck[])*a bunch of times;
draw = read deck[x]; x++ draw from the top of the deck

How many decks?
Starting bet? (0 -> How many hands?)
Increase ?X

if bet
	(record ending cash / number of turns)
	(number of wins / number of turns)

Store card names seperate from values? so J=Q=K=10
Maybe figure card for display then mangle value for score

Updates on Blackjack (page 2). Turns out that the finished product will have almost nothing from the first version :)

Posted by Nesman | Permanent Link | Categories: blackjack, linux

Sat Sep 1 12:34:56 CDT 2007

Welcome to NanoBlogger 3.3!

The basic syntax is: nb [-b blog_dir] [options]

How to ...
  • create new weblog (directory) = nb -b [blog_dir] -a
  • create new entry = nb -a
  • create new category = nb -c new -a
  • create new entry with category = nb -c [cat_id] -a
  • list entries = nb -l [all|DATE|max]
  • list categories = nb -l cat
  • list entries by category = nb -c [cat_id] -l [all|DATE|max]
  • edit entry = nb -e [entry_id]
  • move entry to category = nb -c [cat_id] -m [entry_id]
  • delete entry = nb -d [entry_id]
  • delete category = nb -c [cat_id] -d cat
  • delete entry from category = nb -c [cat_id] -d [entry_id]
  • draft entry = nb -E [draft_file]
  • import draft as entry = nb -f [draft_file] -a
  • force update of weblog files = nb -u [all|DATE|main]

Thank you for trying NanoBlogger. Please direct comments and suggestions to the mailing list or submit a bug report to the project page on

Posted by n1xt3r | Permanent Link | Categories: NanoBlogger Help