July 2006

You are currently browsing the articles from TechToolBlog written in the month of July 2006.

Free Programming Video Tutorials

Microsoft just released a series of free c# video tutorials . It starts at a beginners level but moves to more advanced stuff like creating a RSS reader. They also have the same videos in VB in case that peaks your interest.

Some of the more interesting lessons that I’ve watched are:

The tutorials were made by http://www.learnvisualstudio.net/default.aspx, they too have more free tutorials on their site. - Enjoy!

Written by Tim on July 27th, 2006 with 4 comments.
Read more articles on asp.net.



Upload Files to MySQL using PHP Tutorial

I much prefer to upload files to mysql instead of saving them directly to the file system. I can run database backups/mirrors that are much easier to manage then if files were placed on the file system.

Here are the simple scripts I use to upload files and a script to stream the file back to the browser.

MySQL Database Script:

CREATE TABLE `UploadedFiles` (
`UploadedFileID` int(11) NOT NULL auto_increment,
`name` varchar(30) default NULL,
`type` varchar(30) default NULL,
`size` int(11) default NULL,
`content` longblob,
PRIMARY KEY (`UploadedFileID`)
) TYPE=MyISAM;


Upload Script:


'holds db constructor
include("{$_SERVER['DOCUMENT_ROOT']}/phplibrary/dbconnect.php");
###################
//Consume Post Vars
###################
if (!empty($_POST['upload']))
{
//Loop thru Post Array
foreach($_POST as $key => $value) {
$$key = $value;
}

$connect->connect_db(mydatabase)

//Insert File
if(isset($_POST[’upload’]) && $_FILES[’SpecialFile’][’size’] > 0) {
$fileName = $_FILES[’SpecialFile’][’name’];
$tmpName = $_FILES[’SpecialFile’][’tmp_name’];
$fileSize = $_FILES[’SpecialFile’][’size’];
$fileType = $_FILES[’SpecialFile’][’type’];
$fp= fopen($tmpName, ‘r’);
$content = addslashes($content);
fclose($fp);
}
if(!get_magic_quotes_gpc()) {
$fileName = addslashes($fileName);
}

$query = “INSERT INTO UploadedFiles (name, size, type, content) “.
“VALUES (’$fileName’, ‘$fileSize’, ‘$fileType’, ‘$content’)”;

$result = mysql_query($query);
if (!$result) {
dberror (mysql_error(), $_SERVER[’PHP_SELF’] );
echo mysql_error();
}

//Display Confirmation
$message = urlencode(”Your file has been uploaded.”);
header( “Location: confirmed.php?m=$message” );
exit;
}
?>


Upload File:

To download the file I prefer to push the file down as octet stream/binary data (NOTE: To display images you would need to push out the particular mime type). That way users get the “Save” dialoge instead of the browser (especially IE) automatically trying to open with what it *thinks* should. The following codes displays the file in a drop down list for users to select and have the file streamed to their web browser.

Download File Script


//holds db constructor
include("{$_SERVER['DOCUMENT_ROOT']}/phplibrary/dbconnect.php");

if (!empty($_POST['GetFile']))
{
$UploadedFileID = $_POST["UploadedFileID"];
$connect->connect_db(mydatabase)
$query = “SELECT * FROM UploadedFile WHERE UploadedFileID = $UploadedFileID”;
$result = mysql_query( $query );
if( !$result ) {
echo mysql_error();
exit;
}

$row = mysql_fetch_array( $result );
if (!empty($row[”content”]))
{
// Output the MIME header - Force as Octet Stream
// You could get this from the FileType Column
header(”Content-type: application/octet-stream”);
header(”Content-Length: ” . strlen($row[’content’]) );
header(”Content-Type: application/octet-stream”);
header(’Content-Disposition: attachment; filename=”‘.$row[’name’].’”‘);
header(”Content-Transfer-Encoding: binary\n”);
echo $row[’content’];
}

}
?>



$connect->connect_db(mydatabase)
$result = mysql_query(”SELECT UploadedFileID, name FROM UploadedFiles”);
if ($myrow = mysql_fetch_array($result)) {
do { ?>

Written by Tim on July 20th, 2006 with 16 comments.
Read more articles on php.



Google to start selling Radio Ads

In January 06 Google bought DMarc Broadcasting to help jumpstart themselves into the radio advertisement game. Since then there has not been much news from this side of the business. Today, I received a Google survey for some free adwords dollars. The entire survey was about radio advertisement. I think this is pretty good evidence that they are ramping up on this. Don’t be surprised to see Google selling radio ad spots thru their adwords center in the not to distant future. The last time I got a Google survey, it was about print advertisement, 2 weeks later they revealed it in beta form.

One of the more interesting and revealing questions was that Google was planning on putting advertisers directly in touch with production talent for creating radio advertisments. I am betting they have some sort of GUI interface were you put in copy, type of voice to be used, pause points, emphasied points etc… and Google pushes it to a production house.

Here are a few screen shots of the survey and the questions they are asking advertisers.



There are various buinesses on can do online. Providing data recovery is one of them. Another one would be selling certificate templates. Yet another would be being a part of something antivirus software affiliate marketing. Also tutorial courses can be given in various certifications such as 350-001 and 642-444. All of these are very promising businesses. Using 70-284 course one can develop the site in no time and market their skills.


Google is starting to dominate more forms of advertising, and now you may need a radio switch to hear their latest venture. They’re really reaching into the cash drawer on this one. Before you know it, they’ll be integrating into all fields and devices, like televisions, music players…even barcode scanners!

Written by Tim on July 12th, 2006 with 29 comments.
Read more articles on web 2.0 ish.