ZeptoBlog

My tech playground

February 2nd, 2012

2012 AVC – Autonomous Vehicle Competition

Well I’ve done it. I signed up for the Sparkfun AVC. So what is it? The competitors have to build an autonomous vehicle that can circumnavigate the Sparkfun building. The fastest time wins. Sounds easy enough, right?

Here is my entry so far:

So far all it is using is a compass and a multiplexer so I can switch it back and forth from manual to compass driven steering.

Keep watching for more information.

March 3rd, 2011

Model Rocketry

For a while now I have been shooting rockets with my kids down at the park. It’s fun and we get the bug once or twice a year to go out and shoot some more. I have a friend who has taken it to the next level and joined a model rocket club and gotten his Level 1 certification for high power rockets. This is getting serious. So I am getting the bug to step up my game. I went out to my local club launch the other day and I got more excited. My problem is that it gets expensive quick and I don’t really want to spend $20 or more for each rocket engine that I use. So I am in the research stage right now. It turns out that there are a lot of different angles when it comes to rocketry. I am going to use this post as a way to store links to sites that I find useful or at least interesting. If these links are useful to you then let me know.

general rocketry information
Rocketry Planet
Rocket Reviews

rocketry parts
Red Arrow Hobbies
Estes Rocketry
learningthings.com
HobbyLinc seem to have good discounts on rockets
Apogee Rockets

rocket motors / rocket fuels / rocket chemicals
RCS
Musketeer (black powder)
making charcoal
Sky Lighter
ODA (ignition)
Aerocon (nichrome)
Quickburst (ematch)
Quickburst (pyrogen)
shock cords
Firefox FX
Pyro Creations

build your own rocket motor
James Yawn
black powder motor

local rocketry club
Superstition Spacemodeling Society
rocket doc

July 7th, 2009

URL Shortening Code in PHP

Someone suggested that I use tr.im to create short urls when sending tweets to twitter from my other web site. I was a little annoyed that they will only allow 10 urls per hour. I didn’t feel like figuring out their API and then asking for higher limits. I said to myself. It’s probably just as easy to write my own. So I did.

First, I needed to store the URL with a key so I could resolve the url when someone clicks on my link. Here is the class that I created for that
class ShortUrl {
var $database;
function ShortUrl($database) {
$this->database = $database;
}
function next() {
$sequence = $this->database."/sequence";
touch($sequence);
$handle = fopen($sequence, "r+") or die("can't open sequence file");
$last = fgets($handle);
if(empty($last) && $last != "0") {
$last = chr(47);
}
$next = substr_replace($last, $this->nextASCII(substr($last, -1)), -1);
rewind($handle);
fwrite($handle, $next);
fclose($handle);
return $next;
}
// 48-57,65-90,97-122
function nextASCII($char) {
$ascii = ord($char);
if ($ascii < 48) {
return chr(48);
} else if ($ascii > 56 && $ascii < 65) {
return chr(65);
} else if ($ascii > 89 && $ascii < 97) {
return chr(97);
} else if ($ascii > 121) {
return chr(122).chr(48);
}
$ascii += 1;
return chr($ascii);
}
function createShorty($URL) {
$shorty = $this->next();
$path = $this->database ."/". substr($shorty, 0, 1) . ".db";
touch($path);
$fp = fopen($path, "a");
fwrite($fp, $shorty . ":" . $URL . PHP_EOL);
return $shorty;
}
function resolveShorty($shorty) {
$path = $this->database ."/". substr($shorty, 0, 1) . ".db";
touch($path);
$fp = fopen($path, "r");
while (!feof($fp)) {
$line = trim(fgets($fp));
if(strcmp($shorty, substr($line, 0, strpos($line, ":"))) == 0) {
$url = substr($line, strpos($line, ":") + 1);
}
}
fclose($fp);
return $url;
}
}

The $database parameter in the constructor is a subdirectory where the files will be stored. The two functions that will be called are createShorty() and resolveShorty(). createShorty() reads the value that it stored in the file “sequence” and increments it by one to be used as the key. Then it saves that value back into the file “sequence” and stores it in a .db file along with the URL that is passed in. The generated key is passed back to the calling program to be used in the short url. I will talk about resolveShorty() later.

The key is used to create a short url here:
$shortObj = new ShortUrl("urldb");
$shorty = $shortObj->createShorty($item->link);
$shortUrl = "http://".$_SERVER["HTTP_HOST"]."/.$shorty";

The resulting URL looks something like this: http://www.zeptoworld.com/.0A. The key for the URL is “0A”. The “.” in front of it is what your code will use to recognize this as a short URL that needs to be resolved.

You will need to put something like this in your .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . redirect.php [L]

This tells the apache server that if it sees a URL that starts with a “.” then run the code in redirect.php. Here is what redirect.php looks like:
$uri = $_SERVER['REQUEST_URI'];
$shorty = substr($uri, 2);
$shortObj = new ShortUrl("urldb");
$url = $shortObj->resolveShorty($shorty);
header("http/1.1 307 temporary redirect");
header("Location: $url");

resolveShorty() will find the original URL that was stored in the file. Then you do a redirect to the intended page and you are done.

August 3rd, 2008

The 12th War

Overview

You will be given the name of someone in the war that you must eliminate by getting them wet. You may get him/her wet by any, non harmful, means you choose – squirt gun, water balloon, hose, cup of water, etc. Elimination means that you are out of the game. When you eliminate your target, he/she must give you the name of his/her target and that person becomes your next target. When you eliminate your target, you will get credit for all of that person’s eliminations. At the Ward Party on August 23rd, a prize will be given for the last player standing or the player with the most eliminations if not all players are eliminated. The game will start on August 4th at 12:00 AM and end August 23rd at 12:00 AM.

Rules of the game

1) You cannot eliminate your target on Sunday.

3) You cannot eliminate your target in any church building.

4) You cannot eliminate your target at any church sponsored activity nor on the way to or from the activity.

5) You cannot eliminate your target while the person is at work or at school. (Please don’t soak your target right before work or school.)

6) You cannot eliminate your target in his/her house or garage.

7) If there is a questionable elimination Russ J is the judge.

Please report eliminations to Russ J, russ@staceyshouse.com or 774-8271, within 24 hours of the deed.

If you would like to share a good story about eliminating someone, add a comment below.

October 20th, 2006

Troubadork?

I have been a fan of the genious of Weird Al since the 80′s. Here is an exellent article on the subject
Troubadork

September 22nd, 2006

Pure Nerd

Here are my results from The Nerd? Geek? or Dork? Test. Yes, apparently I am a Pure Nerd. Why else would I have a Tech blog. Click on the link below to find out how you rate.

Pure Nerd

73 % Nerd, 43% Geek, 39% Dork

For The Record:A Nerd is someone who is passionate about learning/being smart/academia.A Geek is someone who is passionate about some particular area or subject, often an obscure or difficult one.

A Dork is someone who has difficulty with common social expectations/interactions.

You scored better than half in Nerd, earning you the title of: Pure Nerd.

The times, they are a-changing. It used to be that being exceptionally smart led to being unpopular, which would ultimately lead to picking up all of the traits and tendences associated with the “dork.” No-longer. Being smart isn’t as socially crippling as it once was, and even more so as you get older: eventually being a Pure Nerd will likely be replaced with the following label: Purely Successful.

Congratulations!

Thanks Again! — THE NERD? GEEK? OR DORK? TEST

Link: The Nerd? Geek? or Dork? Test written by donathos on OkCupid Free Online Dating, home of the 32-Type Dating Test
September 18th, 2006

Cheap Web Hosting

Now here is a real geek thing to do. So my Mom has this web site that that I have been helping her with but the hosting service that she signed up for is charging her an arm and a leg for the webspace and they provide very little in the way of configuration tools and service. So, what do I do? Of course I go out and sign up as a webspace reseller and buy web space in bulk. So let’s think about this, my mom’s site needs about 2 megs of web space and a database. So, of course, I buy 10GB of web space. Now, I’m not going to charge my mom for all of that web space. I have a plan.

I will sell the extra web space for cheap. That’s right, if you want cheap web space with all the configuration tools you can stand, this is the place to get it. $5 per 100MB (1GB bandwidth) per year. This includes apache, php, mysql, perl, cpanel, 100 email addresses, and more running an a linux server.

If you are interested, email me at zeptoblog at zeptoworld dot com.

|