Installing GeoIP for Apache2

Installing GeoIP for Apache2

Coding, Guide
From time to time I need to install a way to accurately determine where users are located based on their header information. Thankfully there is a wonderful free database from MaxMind that gives you this ability when you install it with Apache2. Here are the steps to get it all setup on your Ubuntu (or other Linux) server. Let's get started! There are two different databases. One for country and one for local. From the terminal: cd /tmp/ wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz gunzip ** Now we've got a folder /tmp/ with two dat files - GeoIP.dat and GeoLiteCity.dat. Copy those over to this shared folder: mkdir /usr/local/share/GeoIP/ cp ** /usr/local/share/GeoIP/ Next we need to install the Apache2 Module for using these databases. sudo apt-get install libapache2-mod-geoip And then we need to configure apache2 to…
Read More
How to Clean Up Microsoft Word HTML Special Characters with PHP

How to Clean Up Microsoft Word HTML Special Characters with PHP

Coding
If you're like everyone else in programming you've learned to HATE Microsoft's implementation of HTML and how badly they've screwed up the web. Here is a quick function to use to clear out a few common special characters and replace them with standard ones. This is quick and dirty, but it works great. If you have extra resources you know of or more characters that I should include, post a comment down below. Go from this: There’s a “Problem” with Microsoft Word… it posts a – bunch of crap into the text. To this: There's a "Problem" with Microsoft Word... it posts a - bunch of crap into the text.   function SanitizeFromWord($src = '') { $src = str_replace("‘", "'", $src); $src = str_replace("’", "'", $src); $src = str_replace("”", '"',…
Read More
Key PHP Developer’s Tools

Key PHP Developer’s Tools

Coding, Guide
Development Tools Netbeans - http://www.netbeans.org Dreamweaver for UI http://www.adobe.com Flux is good too and much cheaper (OSX Only) http://www.theescapers.com/flux/ TextWrangler for just simple text stuff (OSX Only) http://www.barebones.com/products/textwrangler/ or if you're a PC person go with Notepad++ http://notepad-plus-plus.org/ Filezilla FTP for uploading and downloading to servers http://filezilla-project.org Google Chrome's built in developer tools rock http://chrome.google.com or Firefox with Web Developer and Firebug Addons installed Frameworks The most important thing is, use a framework. Not only does it allow you to work faster, but it also gives you access to a community, as well as forces you to use best coding practices. Kohana - http://kohanaframework.org (Unofficial Wiki for Samples) optionally CakePHP is excellent http://www.cakephp.org optionally CodeIgniter is good - http://codeigniter.com as is the Zend Framework - http://framework.zend.com/download/current/ JQuery - http://jquery.com JQuery UI - http://jqueryui.com Key thing with JQuery…
Read More
Install Apache and PHP to do Secure h264 Pseudo Streaming

Install Apache and PHP to do Secure h264 Pseudo Streaming

Guide
If you've ever wanted to stream MP4s securely over the internet while preventing hotlinking and stealing of your content, hopefully this helps. 1. Install Ubuntu Download and install Ubuntu from here 2. Install LAMPP settings Quick and dirty, just install MySQL Server: sudo apt-get install mysql-server Then install PHPMyAdmin - make sure to choose Apache2 when it asks for the server sudo apt-get install phpmyadmin 3. Install H264 Module By now you should be able to go to your server (http://localhost/phpmyadmin) and login with PHP. This is the very very first key part to get this all working. We need to install the APache eXtenSion tool, to build and install the module for the Apache server. sudo apt-get install apache2-threaded-dev Then download the latest H264 Streaming Module for Apache and…
Read More
Determining Distance With Latitude and Longitude in MySQL

Determining Distance With Latitude and Longitude in MySQL

Coding
When I was programming an application for a marketing company trying to determine where the greatest concentration of registrars where, it made sense to compare the distance from our home base, and with, at the time, release of the Google Maps API, we where able to plot those locations on the map and at the same time sort them by distance (from closest to farthest). System Requirements To get things started, here is what we need: A server with PHP (5 or newer, but not necessary) and MySQL (again newer the better). A zip code database with both latitude and longitude attached to the zip codes Optional: A Google Maps key. We have the server. The zip code database we purchased from http://www.zipcodedownload.com/ with the premium or better having the…
Read More
Installing a Virtual LAMPP Server with VirtualBox and Ubuntu

Installing a Virtual LAMPP Server with VirtualBox and Ubuntu

Guide
Part 1 Install Virtual Box Download it free from virtualbox.org and run through the installer. Part 2 Download the latest Ubuntu software. I like the desktop version as I can do other things besides just run a server. Download the ISO here: http://www.ubuntu.com/getubuntu/download Part 3 Install Ubuntu on VirtualBox Launch VirtualBox and create an new virtual machine. When creating the machine, Virtual box will ask what type. Name your machine: Ubuntu Server Operating System: Linux Version: Ubuntu All the other settings are fine as they are setup by default. Once you are back at the Virtual Box select a machine screen, double click on your new Ubuntu Server. The first run Wizard appears. Follow the questions and when prompted to select the installation media, browse to the newly downloaded ISO you downloaded…
Read More