Archive for the 'misc' Category

Displaying an HTML table from MySQL data

Wednesday, July 23rd, 2008

Here’s one from the 2003 archives:

Did you know that PHP could interface with a MySQL database? Well it can, and here’s how! The code below illustrates just how easy it is to produce a nice table with headers populated with data culled from a database. One little trick I like to use (and have used for a very long time) when displaying table data is to alternate the background color. This makes it a bit easier to read the data (at least it does for me) Notice that when the table is initialized (<table><tr bgcolor=\”#afafaf\”>), I define the background color. Later as the code iterates through the lines of data, I test to see what the current backgound color is, and then reverse it. Not rocket science, but it spruces things up just a bit. I have been using a heavily modified version of this code in several places, whether it is for displaying log files or pulling intrusion reports from a Snort database and it has worked quite well. Any comments or improvements are always welcome!

<?php
$link = mysql_connect("database_host", "user", "password");

mysql_select_db("database_name", $link);

$qry = mysql_query("SELECT * FROM table_name", $link);
echo <table><tr bgcolor=\"#afafaf\">;
if (mysql_num_rows($qry) > 0) {

for ($i = 0; $i<mysql_num_fields($qry); $i++) {

echo "<td><b>" . mysql_field_name($qry, $i) . "</b></td>";

}

}else{

echo "<td>No entries found in the database</td>";

}
echo "</tr>\n";
if (mysql_num_rows($qry) > 0) {

for ($j = 0; $j<mysql_num_rows($qry); $j++) {

if ($bgcolor == "#ffffff"){

$bgcolor="#cccccc";

}else{

$bgcolor="#ffffff";

}

echo "<tr bgcolor=\"$bgcolor\">";

for ($k = 0; $k<mysql_num_fields($qry); $k++) {

echo "<td>" . mysql_result($qry,$j, $k) . "</td>";

}

echo "</tr>\n";

}

echo "</table>";

}
?>

Gmail IMAP missing

Wednesday, April 16th, 2008

UPDATE:  Looks like it’s been re-enabled.  Hopefully for good.  Maybe they were upgrading the service.

Looks like Google may be having some issues w/their IMAP services.  I noticed earlier that my palm pilot couldn’t access my gmail account via IMAP, producing a connection error.  When I log into my gmail settings, the IMAP section from the ‘Forwarding and Pop’ tab is now missing:

No IMAP settings in gmail


NaNoWriMo

Friday, November 2nd, 2007

Well, I actually did it this year! I signed myself up for NaNoWriMo (National Novel Writing Month) It’s kind of a pledge to write a 50,000 word novel in thirty days. I tend to write in spurts (just look at the frequency of my blog posts!) and lack the discipline to write daily. If I gain anything from this experience, I’m hoping to scrape just a bit of discipline out of the process and continue to write in a more consistent manner.

I’m trying something quite a bit different with my writing. I essentially have two modes of writing: First there’s the “Train-of-thought” mode where I have a simple subject and just sit down and let it spill out all in a single sitting (such as this blog-post). Second is the “Hyper-Analytical” mode which requires years of research, outlining, brainstorming and generally enough pre-work to prevent the “Great Work” from ever achieving fruition.

So for my NaNoWriMo novel, I’m taking a whole new approach. No plans. No outlines. Not even enough of a thought to attempt to “Train-of-thought” it.

So far, I’ve got about 600 words. And, I think, it’s the start of something that’s at least better than my average as far as story-telling goes.

I’m doing my best to stay out of the story’s way and just let it write itself. So I’m discovering the characters and the story as if I were reading an already published story. It’s kind of a weird feeling, and liberating as well. I’m quite eager to see just how far I can take this and what the finished product looks like.

And it looks like I’m quite good company this… Charlie has signed up, as has Marty. I’ve read fiction from both of them and have been begging for more, so hopefully this is the little nudge that we each need to finally crank out a bit of fiction!

Really, I shouldn’t be taking these things…

Tuesday, October 9th, 2007


NerdTests.com says I'm a Nerd God.  What are you?  Click here!

From the Nerd King himself!

I’ve been tagged!

Tuesday, March 7th, 2006

Charlie (or should I say ‘Steve’) tagged me with the following:

  1. What time did you get up this morning? 7:15am
  2. Diamonds or pearls? Diamonds, but this is a close call… Diamonds are forever, but pearls just reek of sophistication!
  3. What was the last film you saw at the cinema? The Lion, the Witch, and the Wardrobe. I got so wrapped up in the story at one that it was quite comforting to know that I know how this story ends!
  4. What is your favorite TV Show? I’m gonna second Charlie with Doctor Who (rumour has it that the new seasons are going to be broadcast on BBC America starting in March!) although I’ve only been truly fond of the the fourth Doctor (Tom Baker- long scarf, sonic screwdriver and man’s best friend at his side!)
  5. What did you have for breakfast? Protein shake and a granola bar.
  6. What is your middle name? Kent.
  7. What is your favorite cuisine? Chinese.
  8. What foods do you dislike? Chicken that’s still on the bone.
  9. Favorite Potato Chip? Dill Pickle flavored (no, really!)
  10. What is your favorite CD at the moment? The Legend of Johhny Cash
  11. What kind of car do you drive? 02 Dodge Durango (hurray for third row seating!)
  12. Favorite sandwich? Pastrami and Rye, hot with a side of chips and a dill pickle as made by Kent’s Deli in Chesterfield mall (which has unfortunately been gone for several years now)
  13. What characteristics do you despise? Presumptuousness.
  14. What are your favorite clothes? My old, worn out Wrangler jeans and my black Chicago Police Dept. sweatshirt.
  15. If you could go anywhere in the world on vacation where would you go? Back to Hawaii or southern Germany.
  16. What color are your eyes? Blue.
  17. Favorite Brand of Clothes? Cheap.
  18. Where do you want to retire to? Someplace warm where I can continue to work.
  19. Favorite time of day? Late night.
  20. . Where were you born? Chicago, IL.
  21. Favorite sport to watch? Kickboxing… but not the UFC kind of stuff, I much prefer traditional styles: Sumo, Muay Thai, etc.
  22. Whom do you least expect to respond to your tag? Christopher (he’s too busy with his new baby!)
  23. Person you expect to send it back first? Kevin or Faith
  24. Coke or Pepsi? Neither… If I’m craving soda, it’s gotta be a Mountain Dew
  25. Are you a morning person or night owl? Absolutely a night owl.
  26. Any new and exciting news you’d like to share with everyone? “Be strong and courageous. Do not be terrified; do not be discouraged, for the LORD your God will be with wherever you go” Joshua 1:9
  27. What did you want to be when you were little? Astronaut, Science Officer on the U.S.S. Enterprise.
  28. What is your best childhood memory? Christmas in Chicago with ALL of my relatives!
  29. What are the different jobs you have had in your life? Bookstore manager, Data entry, Computer Sales & Repair, Mobile phone installer, Telephone switch technician, systems admistrator, security administrator, entrepreneur!
  30. Nicknames: Pickle.
  31. Piercings? Two. One ear has no piercings…
  32. Ever been to Africa? No.
  33. Ever been toilet papering? No.
  34. Been in a car accident? Just a small fender bender many years ago.
  35. Favorite day of the week? Sunday.
  36. Favorite restaurants? Culpepper’s (try the Teriyaki chicken!)
  37. Favorite flower? American Beauty Rose.
  38. Favorite flavor of ice cream? Plain chocolate, or vanilla with loads of Hershey’s chocolate syrup!
  39. How many times did you fail your driver’s license? Just once, but only because I scared the officer that was in the car with me!
  40. Before this one, from whom did you get your last e-mail? Mark.
  41. Which store would you choose to max out your credit card? Newegg, Geeks.com or of course Apple
  42. Bedtime? between 11:00pm and 1:00am.
  43. Who are you most curious about their responses to this questionnaire? Mark or Kevin.
  44. Last person you went to dinner with? My beautiful wife!
  45. What are you listening to right now? The hum of my Powermac.
  46. What is your favorite color? Blue
  47. How many tattoos do you have? None yet.
  48. How many people are you sending this e-mail to? blogged +four.
  49. What time did you finish this? Around 11:10pm.

And I am tagging:

* Faith
* Mark
* Kevin
* Christopher
* Kristen

It’s Official, I am now a Cincinnati Reds Fan

Friday, August 5th, 2005

http://www.kentucky.com/mld/kentucky/sports/12311591.htm

Microcasting: A History

Friday, July 15th, 2005

Microcasting (cross-posted from CrazyAces)

Throughout history, the creation of new technologies quickly introduces new frontiers ripe for exploration. Brave explorers set out in their sailing vessels in search of better trade routes. The advent of the covered wagon opened the Wild West for the pioneers. Rocket ships led to the exploration of outer space. So it is with the Internet.

Originally, there were no “websites” on the Internet. HTML and XML had not been invented. It was simply a refuel for the “Command Line Cowboy,” bravely exploring each node, each piece of code, and each path just to see what was out there. Soon the graphical interface allowed us to better visualize this electronic superhighway as it coalesced and formed into the World Wide Web.

Just as the early settlers staked out and established their homesteads, the first digirati were equally quick to leave an impression on the world. They created home pages, filling each nook and cranny with their personal collections or trinkets. As these homepages evolved, people began to use the space for journaling. They would share their day’s events, thoughts or feelings on a particular subject, for the rest of the online community to read and enjoy. Over time, these journals became know as weblogs, or “blogs,” as they are commonly referred to today.

As personal computers and connections to the Internet became increasingly faster, a richer, more intimate experience began to emerge. Animations, Sound, Personalized News! Eventually, people began recording their blog entries in a downloadable audio format that was suitable for listening on Apple Computer’s iPod. Hence, the term “podcasting” came about, as a way to better define “broadcasting for the iPod.”

Podcasting usually refers to a personal, commercial or syndicated site with regular, specialized content. Typically, each podcast will roughly follow the same genre and format as the site that it originates from.

Another branch of podcasting has begun to take shape as well, called MicroCasting. Although the term “microcasting” has been around for a while, it wasn’t until the pioneers at CrazyAces started to MicroCast that the medium was truly defined. A MicroCast is a specific form of the audio blog wherein the content of each piece is wholly separate from the next. It is limited in time and scope and -most importantly - consists of only two to four people all contributing equally to the MicroCast.