Read Through the Bible in a Year Calendar

By blobaugh, May 20, 2010 8:43 am

Back in the 1990s I had on my website a PDF containing a calendar that will guide the reader through the entire Bible in one year. My father created it for the church we were attending at the time when they had their big reading push. I ran across it a couple days ago and thought I'd post it again for anyone interested. It's an easy to follow plan for getting through the entire Bible in one year.

Download the Read Through the Bible in a Year PDF

First Beard Culling

By blobaugh, May 18, 2010 2:52 pm

As many of you noticed I have been growing out some facial hair. I have a rather full and thick beard. The majority of people liked the beard (mother not included) and I was thinking about letting it grow till the end of summer, but the sides were touching my ears a lot and I cannot stand hair touching my ears. So I trimmed/shaved it. Beards.org has a great compilation of styles to look through. I like the hair down the sides, but wanted to grow out the goatee a bit, so I went with a sort of strap/goatee look. I'll try it out for a few days. The sides may get shaved and the goatee may loose some width, but right now it seems ok.

Here are some before and after shots.

The Original Beard

After the trim

Side Trim Shot

Edit an hour later: The best part about these pictures is that I got a haircut right after posting them.....

Typo3: Count the number of Pages, Content, and Words in your install

By blobaugh, May 17, 2010 6:25 am

Ever wonder how many pages, words or tt_content element you have in your Typo3 install? I am working with two large Typo3 sites and I was curious so I wrote a little piece of code. It works really well and is super quick. Here is what the output looks like:

Counting Pages
SELECT COUNT(uid) AS num_pages FROM `pages`Counting Pages Not Deleted
SELECT COUNT(uid) AS num_pages FROM `pages` WHERE deleted='0'

Counting Content
SELECT COUNT(uid) AS num_content FROM `tt_content`

Counting Words
SELECT bodytext FROM `tt_content`

Totals
Num Pages: 4505
Num Pages Not Deleted: 2948
Num Content: 5152
Num Words: 28,394,588

If you would like to implement this yourself I provided the code below, instead of reinventing the wheel yourself.

(I put mine in the typo3conf folder for ease of use)

 
<?php
/* gather the db connection info from typo3 */
require_once('localconf.php');
error_reporting(E_ALL);
$mysqli = new mysqli($typo_db_host, $typo_db_username, $typo_db_password, $typo_db);
 
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}
 
/* db queries */
$sql_count_pages = "SELECT COUNT(uid) AS num_pages FROM `pages`";
$sql_count_pages_not_deleted = "SELECT COUNT(uid) AS num_pages FROM `pages` WHERE deleted='0'";
$sql_count_content = "SELECT COUNT(uid) AS num_content FROM `tt_content`";
$sql_bodytext = "SELECT bodytext FROM `tt_content`";
 
/* useful vars */
$num_pages = 0;
$num_pages_not_deleted = 0;
$num_content = 0;
$num_words = 0;
 
echo '<b>Counting Pages</b>';
echo '<br/>'.$sql_count_pages;
$result = $mysqli->query($sql_count_pages);
$result = $result->fetch_assoc();
$num_pages = $result['num_pages'];
 
echo '<b>Counting Pages Not Deleted</b>';
echo '<br/>'.$sql_count_pages_not_deleted;
$result = $mysqli->query($sql_count_pages_not_deleted);
$result = $result->fetch_assoc();
$num_pages_not_deleted = $result['num_pages'];
 
echo '<br/><br/><b>Counting Content</b>';
echo '<br/>'.$sql_count_content;
$result = $mysqli->query($sql_count_content);
$result = $result->fetch_assoc();
$num_content = $result['num_content'];
 
echo '<br/><br/><b>Counting Words</b>';
echo '<br/>'.$sql_bodytext;
$result = $mysqli->query($sql_bodytext);
while($r = $result->fetch_assoc()) {
	$num_words += str_word_count($r['bodytext']);
}
 
echo '<br/><br/><br/><b>Totals</b>';
echo '<br/>Num Pages: ' . $num_pages;
echo '<br/>Num Pages Not Deleted: ' . $num_pages_not_deleted;
echo '<br/>Num Content: ' . $num_content;
echo '<br/>Num Words: ' . number_format($num_words, 0, '.', ',');
 
$mysqli->close();
?>
 

New Website Launch: SirGecko

By blobaugh, May 3, 2010 10:55 pm

The SirGecko development group has been around for years building web-enabled projects, but up until now they have not had their own website. I was asked to build them a site and problem solved. Click the image below to visit the shiny new site.

SirGecko.com Screenshot

Bus Pilots: May Day 2010

By blobaugh, May 2, 2010 11:06 pm

This years May Day Show and Shine put on the by the Bus Pilots was fun. I have not been able to make it to any meetings or events so it was nice to catch up with the old gang and see some new faces. Last year my bus was featured on Fox News, this year a picture of me with my bus is going to be in the Nampa Life publication. Nampa Life is an annual business publication.

A few pictures to drool over

PHP: Count words in a MySQL column

By blobaugh, April 27, 2010 10:43 am

Last week I posted a query that will return the number of words in a column of a table in a MySQL database. I was looking through a huge database and the query took a really really long time. Today I decided to rewrite it in PHP and see if it was faster. Much Much Much faster. PHP has a built in function called str_word_count that is super quick at counting. If you have a huge database and access to PHP I definitely recommend this method over the query I  had before.

 
/* gather the db connection info */
$db_host = 'localhost';
$db_username = '';
$db_password = '';
$db = '';
 
$mysqli = new mysqli($db_host, $db_username, $db_password, $db);
 
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}
 
/* db queries */
$sql_text = "SELECT text_to_look_through FROM `table_containing_text`";
 
/* useful vars */
$num_words = 0;
 
echo '<br/><br/><b>Counting Words</b>';
echo '<br/>'.$sql_text;
$result = $mysqli->query($sql_text);
while($r = $result->fetch_assoc()) {
	$num_words += str_word_count($r['bodytext']);
}
 
echo '<br/><br/><br/><b>Totals</b>';
echo '<br/>Num Words: ' . number_format($num_words, 0, '.', ',');
 
$mysqli->close();
 

Bus: First Makeover

By blobaugh, April 25, 2010 2:55 pm

James McKay came over today to help me paint the nose of my 1965 VW Bus. There was a big primer gray patch that the Bus Pilots harassed me about and since it is almost time for our May Day show again I figured I should get it taken care of. Of course my solution was a rattle can job with some white Rustoleum, but it does the trick for now. As we were prepping I did find out that the original white is under the primer. No idea why all that primer was under there. I didn't feel like sanding it down so we masked it off and went with the rattle cans. It's not perfect, but if you don't look close you'll never notice. The white I got is also pretty close to the original.

Click an image to view the entire gallery

Jame Painting the Bus

WP SlimStat 2 Now Available

By blobaugh, April 22, 2010 2:49 pm

I have long used the WP SlimStat plugin on my WordPress sites to track site usage. Unfortunately the plugin was rather old. Just recently though the author updated the plugin. The new version is beautiful and incorporates a ton more usability. I highly recommend installing this new plugin.

WP SlimStat 2

C++ Convert int to char and get ASCII Value

By blobaugh, April 22, 2010 8:22 am

If you are wanting the ASCII value for an integer simply do a typecast of the int to a char.

int i = 65;
cout << (char)i;
 

Your output should be "65"

MySQL: Count Words in Column

By blobaugh, April 13, 2010 11:13 am

I have been working on a rather large database that contains mostly textual page content. Out of curiosity I decided to see how many words are contained in the column with my content. I did not find a simple MySQL solution to finding the word count, but here is what I did come up with.

SELECT SUM( LENGTH( bodytext ) -  LENGTH( REPLACE( bodytext, ' ', '' ) ) +1 )
FROM tt_content

It worked great on the one page I tried it on. There were 5864 words. It has been running for about 5 minutes on the entire set now. Not the most efficient method out there I am sure, but I found it quick and it works.

To use it replace 'bodytext' with the column you are looking in, and 'tt_content' with the table the column is in.

Update

The query ran for 40 minutes before I terminated it. If you are using a large dataset I recommend looking at an alternative method, such as using PHP to count words in a column. Use that link to see the method I implemented

Theme by Blam Designs
Based on Themocracy