_notebook("Kevin")

About

This is the blog of Kevin Mehall. Here you will find all sorts of randomness: Robots, the Splash programming language, code I've written, and my other attempts at insightful content in the world of technology and beyond

They [U.S. soldiers] are also building schools for the Afghan children so that there is hope and opportunity in our neighboring country of Afghanistan.
  - Sarah Palin (via)

Does this mean she can see Afghanistan from Alaska too?

Blender3D Dominoes

My brother and I made this animation of falling dominoes in Blender3D:

See the Blender3D Rigid Body animation tutorial to learn how it was made. We made 200 dominoes instead of the 7 in the tutorial!

View at Google Video

“We welcome you back to our coverage of the 2008 Olympics in Beijing, brought to you by human rights violation in China, makers of the oppression of Tibet”

New Name, New Design

Transition from bluemonkey.us to kevinmehall.net

I've been using the name 'BlueMonkey' online for several years. Favorite color, Favorite animal. Pretty simple. Unfortunately, I'm not the only one to think that way. A Google search for 'bluemonkey' finds millions of results, and I wasn't even on the first several pages. In today's Google-centric world, searchability is vital. Plus, I was looking for something a little more professional.

Time for a change: bluemonkey.us has become kevinmehall.net.

Along with the name change, I redesigned the Drupal template for the site. I dropped the traditional side navigation bar in favor of blocks on the top and bottom of the page, keeping the layout cleaner.

Now, I just need something to write...

Happy 4th of July

Happy birthday to America, Land of the Free*

* Some conditions apply. Not available in all areas. The President retains the authority to alter or terminate the agreement at any time. In the event of a terrorist attack, you agree to trade liberty for imaginary security. Freedom is a trademark of the Republican Party. Any similarity in naming to other concepts is purely coincidental. Some components of freedom are the intellectual property of George Orwell and Ray Bradbury; used without permission. Contains small parts. Keep away from children, particularly those that start wars, run up trillion dollar debts, and like to go fishin' in Texas.

Del.icio.us Hack: Share all items

Update: Delicious 2.0 still has this same issue, but changes to the site break this code. It could likely be updated to use the new version's CSS class names and Javascript. If you update the code, please post a comment.

The popular bookmarking site, del.icio.us, doesn't give users the option to share all links after an import. The FAQ contains the following, completely unhelpful, entry:

We don't have a "share all" button right now for a few reasons: to make sure you know exactly what you're sharing, to encourage you to edit your imported links, and to prevent abuse.

This frustrated me — after importing my items, it would be tedious to go through each bookmark and share them all. So, as any good programmer would do, I took their discouraging FAQ entry as a challenge.

The result: a few lines of Javascript that trick the del.icio.us code into thinking that you have gone through each item, tediously clicking "share", "yes". Just drag the following button to your bookmarks bar (You can delete it after you're done). Then, go to your del.icio.us page, and click the bookmark to share all the items on the page. You will still have to click through each page and run the bookmarklet, but it's a significant improvement.

Del.icio.us - Share all items on this page

Random Thoughts for 2008-03-09

  • People questioning Obama's experience need to take a look at Dick Cheney. Who has more experience than Cheney? Experience is not sufficient to make a good leader!

  • Facebook's changes to prevent application spam seem to be working. The spammy quiz app requests have dropped off nearly to zero. Their upcoming profile design is also a much needed improvement in my opinion.

  • I've removed the StatCounter code from this site. I noticed their response rate getting slower, and while the tracker image loads, a small StatCounter text ad is displayed. No thank you! I was also a bit uneasy with providing data on all visitors to a third party, regardless of what my privacy policy says.

  • A visitor to this site built a fiber optic Christmas tree based on my RGB LED Rainbow Fader design and uploaded a video of it. Cool!

Error: Message Text Not Found

A Windows XP machine pops up this dialog occasionally when Fast User Switching is used:

Windows XP Error Dialog

If people never read error messages, why put any text in them?

Finding Prime Numbers - Part 3

In parts 1 and 2 of this series, I explained methods of generating lists of prime numbers up to a given limit. This post is about a completely different problem: How do we determine if a huge number is prime without testing all the factors?

Algorithms for solving this problem are probabilistic, meaning that they can't guarantee that a number is prime, but there is a very good chance there is. This is good enough for many uses, including even cryptography. PGP uses a probabilistic primality test for key generation. There are many types of probabilistic primality tests, but this post focuses on the very simple Fermat Primality Test based on Fermat's little theorem.

The algorithm is as follows (translated into a programming-like syntax instead of the mathematical definition):
If (a^(p-1))%p==1 for a sufficient number of values of a in the range from 1 to p, then p is prime. "%" is the modulo operator.

For the code samples in this post, I will switch back to Python. Speed is less of an issue here, and python will make the code much simpler; it has built-in support for handling numbers much larger than the native 32-bit integers that can be used in C.

Unlike the other posts in this series, you will have to download the source file to view the code. Included is an algorithm, stolen from Wikipedia, for quickly calculating (a^b)%n.

Download: fermat_primes.py

Further reading on this topic can be found at Wikipedia and MathWorld.

©2008 Kevin Mehall
Valid XHTML/CSS