Category Archives: Languages

.HTACCESS File Resource

Here is a nice resource for common questions regarding Apache’s .htaccess file. The file can be used for supplemental PHP and general website config settings on sites that are running on Apache web server.

Link: www.htaccesstools.com

Topics include:

  • Htpasswd Generator
  • Htaccess Authentication
  • Prevent hotlinking of images
  • Block IPs with .htaccess
  • Block hitbots with .htaccess
  • Error Document
  • Redirection by Language

Managing an Ambiguous Brand

[quotes_right]One famous example of search ambiguity is Apple – are searchers looking for the corporation that sells computers, iPhones, iPods, and iPads, or are they searching for the fruit?[/quotes_right]

This article on Search Engine Watch covers the details of managing an ambiguous brand, but it also contains some nice points that apply to any brand. What happens when a searcher is quickly glancing down through the search results pages? How do you attract clicks that are relevant to your site’s content?

Nine tips for managing an ambiguous brand … Read full article.

CSV Export Using PHP’s Output Buffer

Creating the CSV file without using adding/deleting a file on the server’s file system. This involves the use of the PHP output buffer. In the case of a CSV file, they are being created by the PHP script on the fly, adding the data that you want to export on a row-by-row basis. For this we need to:

1) create a file handle
2) fputcsv each row into the file
3) send the entire thing to the browser to be downloaded

Here is the code:

<?php
header("Content-type: text/csv");
header("Cache-Control: no-store, no-cache");
header('Content-Disposition: attachment; filename="filename.csv"');

$outstream = fopen("php://output",'w');

foreach( $myArray as $row ) {
	fputcsv($outstream, $row, ',', '"');
}

fclose($outstream);
?>

$myArray is an array of records just the same as you would find in a database (the same thing that will appear in the new, downloaded CSV file). Notice that there is no file being created on the server.

Helpful tip:

Just relying on the extension doesn’t work, even in Windows. The magic is in the third header setting, “Content-Disposition,” which informs the browser to download as a separate file
~ from ToSweetToBeSour.com

ie9-pic2

Cross-browser Testing Old Versions of IE on Mac

I run a Mac and for all of my web development work and for years had used any old PC that I could get my hands on for my cross browser / cross platform testing for my HTML, CSS, and Javascript work.

I had always been under the impression that, even though I was running IE9 on Windows 7 through my VM Ware Fusion software and could just do my IE9 testing right on my Mac, that I still had to keep that old PC around for my older versions of the browser.

One day not too long ago I stumbled across a solution that I didn’t even know was available to me.  Moreover, I already had it in place and didn’t even know it. Internet Explorer 9 has this functionality built right into it.

On any copy of IE9, click on the “Tools” icon in the upper-right corner of the browser and look for the selection that says: “F12 Developer Tools”.

When you click on that you will either get a split window in your browser that shows both your website view along with the resources available to you in the developer tools app; or, yours will show up in an entirely new window all to itself.

When the Developer Tools window appears, look through the main menu for the “Browser Mode” drop down menu.

There you have it. All the late-model IE testing that your little heart can handle right in one place.