Sold!

* Praise the Lord! With a total of thirteen days on the market, our house has sold! There were about six different showings yesterday, and we received a total of four different bids! The winning bid actually came in over our asking price! Now we just have to finish up with all of the various inspections. The local fire department came by last week for a safety inspection. We failed that one because we didn’t have our address numbers on the house itself. (the numbers have always been on the mailbox) No big deal there, I put up the numbers next to the door and the safety inspector came by, noticed that the numbers were up and presented us with our safety certificate! I still need to finish up painting Logan’s room. Yep, the wild dark blue ceiling is gone, replaced with a more neutral white. We told our real estate agent to ask the buyers what color they would like in that bedroom. I figure, if I’m painting anyway, I might as well put in the color that they want, and maybe save them from having to paint over whatever arbitrary color I would put in there on my own. We have a lot of stuff already packed up, but there is a great deal left before we can move. We just might hire a moving company this time to make things go a bit easier. Especially since Faith is pregnant, and with the three boys, it’ll probably be a good idea to let someone else handle as much of the move as we can afford.

In a way, it’s a bit sad to be saying goodbye to this house… There are so many memories here. Getting remarried on the back porch the day we moved in… All the different projects, from remodeling the bathrooms, the landscaping, building and then re-building Logan’s fort in the back yard… Good times were had here, that’s for sure.

Magic Kingdom for Sale..

* (with apologies to Terry Brooks) With the coming addition to our family this fall, we decided that our wonderful home is just too small for us anymore. We’ve been spending the last month getting the house cleaned up and much of the clutter either thrown out our packed up. And as of yesterday, our house in now on the market and available to purchase! (C’mon, you know you always wanted to live in beautiful Ballwin!) Of course, we didn’t want to sell our house before we found a new one, (or rather, a ‘newer’ one) so on the weekends (almost all day on saturday and sundays after church) we have been looking for something that we can fit into. Last week, we found a really nice four bedroom home with an unfinished basement out in O’Fallon. After a bit of negotiating, the seller accepted our bid! So it looks to be a rather big year for us between finally finding a church we like, the new baby on the way and a new home! We intend to remain at the same church in Kirkwood (after all, my brother drives twice the distance to his, so we can surely make it to Kirkwood!) Although the commute is twenty miles further each day, the drive time is just about the same, maybe even a little less!

For by Him all things were created

* “For by Him all things were created, in the heavens and on the earth, things visible and things invisible, whether thrones or dominions or principalities or powers; all things have been created through him, and for him.” Colossians, 1:16 (W.E.B.)

Here begins an interesting journey. Well, not really. It doesn’t actually begin here. It began a very long time ago, but I digress.

Astute readers will notice that a new category has been added: Christianity. Today’s entry marks the first use of this category. Although I am not nearly as well versed in Theology as some, I do hope to chronicle my particular journey and its experiences.

It began about a year ago. I am an avid reader of Charlie’s journal and try to follow the twists and turns through the maze of lexicological interweavings. I’ve noticed on several occassions that there seem to be issues with which translation of the Bible is more correct than others. Indeed, each translation seems to have its own spin, its own flavor. Comparing two of the same verses from different translations can yield surprising and often confusing results. For instance, the verse from Colossians, 1:16 (quoted above from the Word English Bible) differs significantly from the Message (MSG) translation which reads: “Everything got started in His name and finds its purpose in Him” So, why the difference? More importantly, is the difference really significant?

If we take the Bible as God’s word, then the message should come through regardless of the translation, right? I think the answer is: It depends. It depends on intent. When I was younger, I read the King James Version and occasionally others as well (NIV, NASB) and reading it didn’t affect my spirituality. Was it because these translations had missed something vital? Or was it my intentions? I read the Bible (parts of it, anyway… I have yet to make it cover to cover) because I had heard that it had some good bits of wisdom in it. I had seen Charlton Heston as Moses many times, and enjoyed reading about him as well. But my intent was not to better know the Word, or to seek His guidance, I read the Bible as I read a multitude of other philosophical books. To me, at that time in my life, it was just another book.

Last march, I decided to read the Bible once again. I was spurred on by the debates of which version was “better” than another. It was (and still is) my contention that if your intent is correct, the message will come through. I chose a version that was freely available for my handheld palm device (if you’re curious, it’s the ISV version available from Olive Tree) so that I could easily carry it with me and read whenever the opportunity presented itself. But first, I had to define my intent. I had to realize that this could be an opportunity for transformation and I had to be willing to accept whatever was in store for me. Let me be clear on this point: I did not consider myself a christian when I began reading. The last religious group that I was affiliated with was Buddhist. I’m not sure that I consider myself a christian yet. But that may be changing, and I am willing to accept that.

So nearly a year has passed. I’ve only read the first two books of the Old Testament and parts of Mathew. Has anything changed? Well, as I mentioned in my last post, we are once again expecting a child. Several things in Faith’s life have happened that have pointed her towards christianity. (I won’t go into those here, she’ll tell her story when she’s ready) About a month ago, we started attending Community Covenant Church. This past weekend Faith and I started on the “40 Days of Purpose” with some neighbors. Yeah, definitely some changes. As we work our way through the 40 days, I will be adding entries when appropriate so that you may follow along, or add your own thoughts in the comments below. (Please be respectful, I have yet to censor any comments, but if things get out of hand, I will not hesitate to remove an inflammatory post)

I attended the opening service for 40 Days at a much larger church than my own. My initial impressions were not great. After watching the simulcast of Rick Warren (the author of “A Purpose Driven Life”) I have to say that I found it to be way over the top, so to speak. It was rather like a sales meeting, albeit some very good points were made, and the music was wonderful. It came across to me as a carefully orchestrated event calculated to pull at the old heartstrings (oh yeah, and the pocketbooks, cause you know, there selling the book and the study guides in the lobby!) I borrowed a copy of the book from a friend at church, but I did buy the study guides (for a donation of three bucks, it didn’t tug at the pocketbooks all that much).

That night (Saturday) I was quite disappointed in the whole recruitment-drive feel and wondered if this really is the right thing for us to be doing. I’ve never really felt like I truly belonged in a church to begin with and this overwhelming experience was nearly enough for me to think this really wasn’t a good idea. As I went to bed, I half thought to myself, half prayed for some sort of sign that this was where we need to be. I figured I wasn’t asking for much, maybe just a significant dream while I slept, that’s all. I woke the next morning with no such sign. Well, it was sunday morning, so we loaded up the van and headed off to church. I was still agitated from the night before and tried to relax as I drove. Walking into the narthex of the church, amidst a small throng of people, was a small table that held the church-goers’ nametags (most everyone at this church wears them). Three tags stood out. They were for Faith, Logan and me. Three signs that we belonged there.

Can’t ask for a better sign than that.

Blessing from above

So I’ve been holding my breathe for a little bit, and holding back on the entries here as well. Once again Faith and I are expecting a child! Our first visit to the doctor yesterday confirmed that we are having a single child, not twins like last time! Needless to say we are very excited about this blessing from above! Of course this also means that we will be moving soon. Technically, we outgrew our house two and a half years ago when our twins were born (we currently live in a three-bedroom house with three children) The twins can easily share a room for quite a while longer, but with another child on the way, another bedroom becomes much more necessary. Happy Happy, Joy Joy!

2003- The year that was…

Logan took second place in the Regional Spelling Bee… (on a whim, no less!)

Logan memorized the number pi to one hundred decimal places…

We abandoned the public school system in favor of homeschooling our children…

Xionic Technologies was founded as a Computer Security firm with a local focus…

CrazyAces Media Productions was formed as a graphics design outlet specializing in internet presence, logo generation and the promotion of local artists.

My six month contract with a downtown firm has turned into an ongoing commitment…

In march, we finally replaced our water heater (not by choice)…

We also replaced our washing machine. (also not by choice)

March 19 President Bush announced that the U.S. has begun its military campaign against the Iraqi government.

My computer collection saw the addition of a NeXTstation (complete w’ monitor and laser printer), a couple of Sun Ultrasparc I machines, a couple of old macintosh powerbooks and a beige G3 (happily running 10.2)

My niece Shannon and her husband Ryan welcomed Aiden into the world (and boy, he is growing like a weed!)

I spent a day with Rebuilding Together to help ‘rehabilitate’ a local family’s house. (this was definitely one of the more rewarding highlights of the year)

Ronan and Keenan celebrated their second birthday (and oh yes, the terrible two with twins is twice as bad as you would think!)

We went to our first Renaissance Faire which was quite interesting, and we’ll probably go again.

Faith and I did our first (her second) Body for Life competition. The results were not as good as we hoped, so Monday we start again!

In July, three transformers exploded at the Arch, causing a loss of power for my office and the surrounding buildings for most of the day. With all of the terrorist alerts, this was a bit more alarming than it usually would have been.

I had my first foray into mass transit. I spent two and half months riding the bus to and from work. Except for the extra time needed, it worked out quite well.

Logan and I went on our annual camping/canoe trip in august. This time we floated on the Gasconade river instead of the Meramec or its tributaries.

We took the family to Chicago for a weekend in November to visit relatives that we hadn’t seen in many years. December was the month of mishaps: A close-call with a fire (check those smoke alarms!), a water main break, ::ahem:: diaper artwork, Keenan falling off the chair.
It’s been an interesting year, and a good one at that.

More Elbow Grease

So the code from my previous journal entry parses my xml file and builds a page that contains the last ten entries. What happens when you request a specific entry? In other words, if some kind soul were to use the perma-link for this entry ( http://www.xionic.net/~jkp/index.php?weblog=20031120) on his/her site to reference this entry, what happens when they click on the link? It all happens in the index.php file. Last time I stated that if $dd was not set, then go ahead and parse the xml file and build the page. When using the permalink, $dd gets set to the permalink number field which is 20031120 for this entry. That number is in fact the date of the entry, which gets broken down like this:

$year=$dd[0].$dd[1].$dd[2].$dd[3];
$month=$dd[4].$dd[5];
if (isset($dd[6])){
$day=$dd[6].$dd[7];
}

$M = $months[$month-1];
$dir = "weblog/" . $year . "/" . $month;

if (isset($day)){
$date="$M $day, $year";
$loc = $year . "/" . $month . "/" . $day;
$permalink="http://www.xionic.net/~jkp/index.php?weblog=$year$month$day";
echo "<div id=entry class=status>";
echo "<div id=title class=status>$date</div>";
echo "<a href=$permalink>$date</a><ul>";
require($loc);
echo "</ul><br>";
if (file_exists($comments)) {
echo "<p class=status>Comments...";
require ($comments);
}
echo "<a href=\"weblog/comments.php?dn=$val\" class=status>add a comment</a></div>";
}

So my journal entries are filed in a date-tree. With the the year and month being subdirectories and a single file for each day. If you look through the code you will also note that the comments for a single day are kept in their own file for each day. This tree structure has been quite simple to maintain, and has been very stable. How well does it scale? Hmmmm… Good question. I am sure that it scales much better than several solutions that I have seen that use a flat file style database to store the information, but perhaps not quite as well as a SQL driven data store would. As long as I am not trying to do any advanced queries or searches and just display a subset of entries this system has been quite responsive and easy to maintain.

PHP + Elbow Grease…

Although I do use PHP and MySQL (as well as any other tool that fits) in many of my other projects, I have not implemented that style of solution for this website. (although the idea is quite tempting and will most likely happen in the coming months) I have tried some of the ‘canned’ blogging packages that have come out such as Movable Type, and while these packages surely fill a niche, and are very good at what they do, they do not do what this site requires. To know what this site requires, we must examine its purpose. Although ‘Intuition & Elbow Grease’ does serve as my blog and as a repository for a couple of other pieces of information, its primary reason for existence has been that of a proving ground for new code (sometimes for old code) To that end, I have tried to stay away from anyone else’s complete solution. I have surely borrowed bits and pieces along the way in order to aide in my understanding of one nuance or another, but hopefully the resulting concept is unique.

So how does this site really work? The basic building blocks are comprised of the Apache web server, PHP and of course a good smattering of Perl. No database backend has been necessary as of yet, but since I have been having quite a bit of fun designing databases and their associated web-based interfaces, one will probably arrive here soon.

To begin with, let’s look at some of the code that builds this page each time it is loaded:

if (empty($dd)) {
$data_file = "/my_home_dir/index.xml";
$list = file($data_file);

reset($list);
foreach ($list as $key => $val){
if ($key>12 && $key < 23){
$title_start=(strpos($val, "<title>")+7);
$title_end=(strpos($val, "</title>"));
$title=substr($val, $title_start, $title_end);
$link_start=(strpos($val, "<link>")+6);
$link_end=(strpos($val, "</link>"));
$permalink=substr($val, $link_start, 52);
$year=substr($permalink, -8, 4);
$month=substr($permalink, -4, 2);
$day=substr($permalink, -2);
$date=substr($permalink, -8);
$m=$month-1;

if ($title == $date){
$title="$months[$m] $day, $year";
}else{
$title="$title</a> <div id=\"date\">$months[$m] $day, $year</div>";
}

echo "<div id=entry><div id=title>";
echo "<a href=$permalink class=status>$title</a>";
echo "</div><ul>";
require ("/my_home_dir/weblog/$year/$month/$day");
echo "</ul><br>";
$comments= "weblog/" . $year . "/" . $month . "/" . $day . "-comments";
if (file_exists($comments)) {
echo "<p class=\"status\">Comments...";
require ($comments);
}
echo "<a href=\"weblog/comments.php?dn=$day&mo=$month\"";
echo "class=status>add a comment</a><br>";
echo "</div>";
}
}
}

Remember this is just part of the code, not all of it. At the beginning I check to see if the viewer is looking for a specific entry, noted as $dd. If you aren’t then I load an xml file (index.xml) to parse for the current ten entries. From the information in the xml file, I read in each of the specific entry files (and that’s what each entry is, a file in a structured hierachy to represent year, month and day) and format each entry with its permalink, date and any associated comments. When I wrote this code, php did not have any built in support for parsing xml files like it does now, so I hastily wrote the list section with all the ‘title_end’, ‘title_begin’ stuff. (This section is next on the list for a re-write) These variables help to parse the xml file into usable sections for display as this page.

There is a great deal more that goes on in displaying this page that I would like to discuss in greater detail over the next several days. Questions? Comments? Suggested improvements? Please post them below in the comments section or e-mail me directly.

Hindsight is 20/20

* As Charlie pointed out in yesterday’s comment, it has been a full year since I was ’surplussed’ by Cingular. I had spent nearly ten years there, and if it weren’t for the downsizing, I probably would have stayed there for another ten years.

Thank God for small miracles!

At first, life was quite hectic. Between wondering where my next paycheck was going to come from to worries about insurance, life was a fast-dance for a while. I struggled to work at anything I could, mostly small consulting jobs. The state of the economy was pretty much at its worst… Every company was downsizing, there were hiring freezes everywhere, and every dot-com dropout was after any job that could be had. Eventually, I decided to incorporate (see Xionic Technologies) and see where that would take me. I managed to land a very nice long-term assignment (although it was through another consulting company and not my own) and started back to the 8-5 work week in mid March. The contract was for six months, which seemed quite palatable at the time since I had been doing small one-time gigs previously. (Mostly web design, firewall implementations, basic security type stuff) I was hired as a Security/System Admin at a large company headquartered in downtown St. Louis. The people are fantastic to work with, the work I am doing is challenging and rewarding ( intrusion detection/prevention, vulnerability assessments, VPN security, etc…) and, yes the pay is notably better than before. It looks as if the contract will go through the end of the year, with a significant possibility of it turning permanent.

I still manage to take on small consulting jobs during my off hours, and continue to pursue my studies (I just finished a twelve week GIAC/SANS training class to prepare for a Security certification) I am happier with the work that I am producing than I have been in a long time. I knew I was unhappy at Cingular, but I didn’t realize just how miserable it was until I got away from there. As the memories of Cingular begin to fade, I am only now able to remember the great times that were had there.

As for the future?

The future’s so bright… I gotta wear shades!

General — entered at 22:38PM

Comments…
I am very happy that you have moved on from your last job to something better. I wish I could say the same but I can’t. Funny thing is that right after you went I was soon ‘released’ from my place of employment. Also heard over the summer about a friend in NYC who was put on probation at his high profile company. Remember how good I thought he had it before the dot-com bust. Looks like the worse may be over but still can’t say that ‘the future’s so bright…’ or as we would say out here ‘the future’s so bright I gotta wear prescription sunglasses baby!’Posted Thu Nov 13 01:21:19 CST 2003
From: P. Brahler http://paulbrahler.bravehost.com

Displaying an HTML table from MySQL data

Displaying an HTML table from MySQL data

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("nessus", $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>";

}
?>

Comments…
I assumed that this page was driven by PHP+MySQL. Hm. In other news, I noticed that it was one year ago today that you were told you were being downsized. Any retrospective on that?Posted Tue Nov 11 18:21:41 CST 2003
From: Charles Sebold http://www.livingtorah.org/journal/

IP Conversion code

* While automating some reporting functions recently, I came across an IP address notated as a ten digit number instead of the more standard ‘dotted-quad’ notation (aaa.bbb.ccc.ddd) While technically correct, the ten digit representation wasn’t as descriptive as I would have liked it, so it needed to be converted to ‘dotted-quad’. In dotted-quad notation each octet or section represents a power of 256. The first octet represents 256 raised to the third power, the second octet is 256 raised to the second power and so on. This is important when decoding the ten-digit number. To convert the ten-digit number to dotted-quad start by dividing the ten-digit number by 256^3 (256*256*256 or 16777216) The first three digits represent the first octet. Subtract the product of 256^3 and the first octet from the original ten digit number and then divide that by 256^2. The first three digits are the second octet. Repeat the procedure for the remaining octets. Confused? Here’s some sample code:

$addr=3236053395;
$o1=substr($addr/16777216,0,3);
$addr=$addr-($o1*16777216);
$o2=substr($addr/65536,0,3);
$addr=$addr-($o2*65536);
$o3=substr($addr/256,0,3);
$o4=$addr-($o3*256);
print("$o1.".".$o2.".".$o3.".".$o4."\n");

WordPress Themes