Speech to Text on a Mac Laptop Using the Internal Mic

MacSpeech Dictate 1.5
First, get Macspeech Dictate. It’s available for sale at www.macspeech.com, and you can save 10% on MacSpeech Dictate with Microphone by using coupon MACSPEECH during checkout. Once its loaded up it will ask you to create a profile by selecting a microphone. The stock Dictate application will not let you select your internal mic to be used as an audio input source. To get around this, we have to download two applications, the latest version of Soundflower from http://code.google.com/p/soundflower/downloads/list and LineIn from http://rogueamoeba.com/freebies/.

Install Soundflower and launch both applications along with Macspeech Dictate. If we go back to Dictate we can select “Soundflower 16ch” as depicted below.

Dictate Settings

Now go to LineIn and route the internal mic to Sounflower we select “Default System Input” and Output ” Soundflower (16ch)” then click “Pass Thru”.

LineIn Settings

Keep all these applications open and go back to Dictate and create your profile. Follow the rest of the steps in Dictate and this should allow you turn speech to text using your Mac Laptop’s internal Mic.

Mess with Your Landlord

This guide contains a list of ways for you to take the upper hand over your landlord. These are little-known, legal secrets that can help you when you fell like you are being pushed around by your landlord.

Interest on Last Month’s Rent Deposit

Remember that deposit cheque you made out for your last month’s rent? Do you think it’s a little strange that the landlord just gets to use that money for 11 months? As it turns out, the landlord must pay you interest on the last month’s rent deposit. The interest rate changes annually, but currently (2010) it’s at around 1.7%. So if you pay $400 a month, your landlord is legally obligated to give you $6.23 at the beginning of that last month. If you like math… that’s $400 x 0.017 / (11/12).

The concept of paying the last month’s rent upfront seems at first like it might be a scam in favor of the landlord. As it turns out, this deposit provides protection to the tenant – the fact that you have paid this deposit makes it much harder for a landlord to kick you out prematurely.

24 Hours Notice Before Showing

In most states and provinces (Ontario for sure) your landlord is required by law to give you 24 hours notice before showing the residence that you are renting. This is especially prevalent in student housing where landlords frequently take advantage of students by giving them only a few hours notice (or none at all) before showing the residence to groups of students looking to rent the house/apartment the next year. If your landlord tries to swindle you into having your home shown without 24 hours notice, you have every right to deny him/her entry to the residence.

Eviction due to Smoking / Pets

In Ontario, renting a house always brings to mind. “Are we allowed to have pets?” The answer is YES! Unless there is a clause in your lease agreement clearly not permitting pets within the residence (which technically isn’t even enough to keep you from doing it), pets are okay to have. The only real issue that can be justified is that if the pet is causing damages or disturbing tenants, which is the only justifiable reason for eviction in this case. Same of which goes for smoking within your residence, as long as it’s not disturbing other tenants, burning the carpets, or illegal substances!

C++ Execute Shell Command

Here is how you execute a shell command from within a c++ program on Linux/Unix

Example Code: (this code creates a new directory called newFolder22 in the /home/sam/ directory);

system (“mkdir /home/sam/newFolder22”);

Install Perl Module Linux | Ubuntu

This guide explains how to install perl modules using CPAN in Linux

  1. Type: perl -MCPAN -e shell;
    • This will take you into the perl cpan shell – if you are promted to answer some questions, just answer them (typically with the default answer – just press enter)
  2. Type: install MODULENAME
    • i.e. Type: install IO::Socket
    • Answer all the questions, generally just use the default (press enter)
    • if something fails and it appears that it should not have, you can try: force install MODULENAME

Change Browser Icon

Ever wonder how to change the little browser icon of your webpage?

This guide will explain it in just a few steps (for both a traditional webpage and for a WordPress theme)

  1. Go find the image that you would like to use for your logo
  2. Scale the image down so that it is exactly 24×24 pixels
  3. Save the image as an Icon file: On windows, this is just a BMP file, on MAC you can save as Windows Icon File
  4. The filename must be: favicon.ico

For WordPress:

Save the file in your wp-content/themes/YOUR-THEME-NAME/images (overwrite the existing one)

For a Traditional HTML Page

Save the file in your website root directory

Better WordPress Rich Text Editor

  • Download this zip file and extract it to view the contents on your computer
  • Copy the advanced-wysiwyg.php file to your WordPress Plugins Directory located here: /wp-content/plugins
  • Copy all the files from the plugs folder (from the file you downloaded) to the TinyMCE Plugins folder located here: wp-includes\js\tinymce\plugins
  • Activate the new editor by opening up the administrator view of your WordPress page
    • Select Plugins (on the left)
    • Activate the Advanced WYSIWYG Editor plugin
  • That’s it! Next time you go to make a post you will have significantly more formatting options.


Extending TinyMCE, the WordPress Rich Text Editor

Change WordPress Logo

Changing the WordPress logo really just consists of overwriting the logo.gif in the theme you are using with file with your own logo.gif file – Here are the steps:

  1. Open up the image that you would like to use for your new WordPress logo
  2. Save your file as logo.gif (File->Save As)
  3. Open up your ftp client (or however it is you view the files on your WordPress site)
  4. Navigate to the themes directory (www.mysite.com/wp-content/themes)
  5. Navigate into the images directory of the theme you are using
  6. Delete the logo.gif  or logo.png file that is currently in there (the old logo you want to get rid of)
  7. Copy/upload your file (in place of the old one you just deleted) NOTE: you must have the same file extension as the file you are replacing, (png or gif)

Better WordPress URLs

The URLs that WordPress Generates by default are no good (for humans or search engines.) This guide will explain how to fix that giving you more legible URLs as well as Search Engine Friendly WordPress URLs

  1. Head into the admin section of you WordPress site
  2. Select Settings (bottom right)
  3. Select Permalinks
  4. Choose the custom option and paste this into the text field: /%postname%
  5. That’s it! from now on when you create a new post, it will be given a URL in accordance with the name of the post. For example, check out the URL you are at right now. Before I changed my settings it would have read something like “firstsearchblue.com/?p=7563” (useless…) but now! “firstsearchblue/better-wordlpress-urls” (beautiful)

Query Database with Drupal Form

The Problem

  • By default, there is no way to allow your users to query one of your databases (either internal or external) in Drupal. Additionally, there are no modules that really allow you to do this either.

The Solution

  • With a little pasting and editing, this guide will enable you to let users do a simple search of one of your databases. This information can easily be extended to allow for all kinds of user-database interaction in Drupal.
  • Use Ajax! This is by far the easiest way to get the job done.


  • Make sure that you have the PHP code Input Format enabled. To do this simply go to Administer->Site Building->Modules. Scroll Down to PHP Filter, make sure it’s enabled, click ‘Save Configuration’
  • If you have a rich text editor enabled (such as YUI) you should disable it temporarily while we create the form

The Drupal Page/Form

  • Go to Create Content and create a new page (it doesn’t have to be a page, but we’ll use a page for the sake of this guide.)
  • Call the page Database Query
  • Select PHP code from the Input Format dropdown.
  • Paste the following code into your page:


<script language=”javascript” type=”text/javascript”>
//Browser Support Code
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax possible!

// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
ajaxRequest = new ActiveXObject(“Msxml2.XMLHTTP”);
} catch (e) {
ajaxRequest = new ActiveXObject(“Microsoft.XMLHTTP”);
} catch (e){
// Something went wrong
alert(“Your browser broke!”);
return false;
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById(‘ajaxDiv’);
ajaxDisplay.innerHTML = ajaxRequest.responseText;
var lastphp = document.getElementById(‘lastphp’).value;
var queryString = “?lastphp=” + lastphp;
ajaxRequest.open(“GET”, “/php/check.php” + queryString, true);

<form name=’myForm’>
<table border=”0″>
<td width = 100>Last Name: <br /></td>
<td><input type=’text’ id=’lastphp’> </td>
<br />
<input type=’button’ onclick=’ajaxFunction()’ value=’Search’ />
<div id=’ajaxDiv’></div>

  • There is only one thing we eventually will have to change, but we’ll leave it for now: “/ajax-example.php” (just before the tag. You’ll probably want to keep your php file somewhere else, and will have to update the file location accordingly.
  • For now, just hit the save button to save your page and move onto the next step.

The PHP File

  • We now have to create the PHP file that the above ajax script refers to.
  • Open up your favorite text editor and paste in the following code:

//Connect to MySQL Server
//connect to your database ** EDIT REQUIRED HERE **
mysql_connect("localhost","MySQLUser","password") or die('Cannot connect to the database because: ' . mysql_error());

//specify database ** EDIT REQUIRED HERE **
mysql_select_db(“databaseName”) or die(“Unable to select database”); //select which database we’re using

// Retrieve data from Query String
$last = $_GET[‘lastphp’];

// Escape User Input to help prevent SQL Injection
$last = mysql_real_escape_string($last);

//Build and run a SQL Query on our MySQL tutorial
$query = “SELECT * from dataTableName”; //just grab every row from our table
$results = mysql_query($query)or die(mysql_error());

//print what the user entered (eventually I’m sure you’ll want to use this data in your query)
echo “You Entered: ” . $last . “<br><br>”;

//print the results
echo “Database Results: <br>”;
while($row = mysql_fetch_array($results)){
echo “$row[lastname]<br>”; //NOTE: Here we are printing all the data from the ‘lastname’ column of our database, either change this name, or make sure you have a lastname column with some data in it

  • You will have to make some modifications to this file! These include
    • Server: I used localhost, you might have to change this
    • MySQL User: Change this to your user
    • password: This is the user’s password
    • databaseName: This is the name of your database
    • lastname NOTE: This needs to be changed to the name of a column/field in your database (it is located at the bottom of the code)
  • Save this file as check.php
  • Upload this file to your server/hosting space in a php folder within your Drupal Installation.
    • For example, if Drupal is installed in the root of you web page (like on http://firstsearchblue.com) just create a folder called php and upload your check.php file to it.
  • That’s it! Navigate back to the form you created (we called it Database Query) and try hitting the search button.
  • I’m sure this guide is a little tough to work through PLEASE post any questions or issues below – they will be answered quickly!

drupal mysql query