Using GIT Properly

Using GIT Properly

Coding, Guide
Everyone needs to get into the habit of branching when they use GIT. Whether it's a new feature, a bug fix, or a small improvement to some existing code, every ticket should get its own branch. Do some work on this branch, committing early and often (for instance, whenever your tests pass). Also make sure to use the Atomic Approach to creating commits. It shouldn’t be uncommon for you to have 10-30 commits per day. Atomic Approach • Commit each fix or task as a separate change • Only commit when a block of work is complete • Commit each layout change separately • Joint commit for layout file, code behind file, and additional resources The seven rules of a great Git commit message 1. Separate subject from body with…
Read More
MySQL Best Practices

MySQL Best Practices

Coding, Guide
Database operations often tend to be the main bottleneck for most web applications today. As programmers need to do our part by structuring tables properly, writing optimized queries and better code. Table Names By convention, the "snake case" in lowercase (no PascalCase - we're not using Microsoft SQL Server here!), plural name of the class will be used as the table name unless another name is explicitly specified. Tables should also be named based on their respective contents. Try to avoid naming tables based on a single use case and think more about how that table will be expanded in the future. If you're not sure how to name the table ask your manager before creating it. eg: To find an order product we would look in the order_products table  Primary Keys The…
Read More
Connecting to Ubuntu Servers With RSA Keys

Connecting to Ubuntu Servers With RSA Keys

Coding, Guide
I manage a bunch of internal servers and for those that aren't part of the wider web I like to use key pairs to speed up my sign ins and maintenance. Key-Based SSH Logins Key-based authentication is the most secure mode of authentication usable with OpenSSH. Key-based authentication has several advantages over password authentication, for example the key values are significantly more difficult to brute-force, or guess than plain passwords, provided an ample key length. Key-based authentication uses two keys, one "public" key that anyone is allowed to see, and another "private" key that only the owner is allowed to see. To securely communicate using key-based authentication, one needs to create a key pair, securely store the private key on the computer one wants to log in from, and store the…
Read More
Simple Changes to Secure Apache

Simple Changes to Secure Apache

Coding, Guide
Keep Updated You should update your linux settings no less than once a month. This will ensure that you are not running vulnerable technology. Remove Header Details / Disable Tokens When Apache web server generates any web pages or error pages, some important information about the version and other details implemented on the system are displayed in the web site server header. ex: Server: Apache/2.0.53 (Ubuntu) PHP/4.3.10-10ubuntu4 Server at xx.xx.xx.xx Port 80 To ensure that the Apache HTTP web server does not broadcast this message to the whole world publicly and fix possible security issue, modify these two directives ServerTokens and ServerSignature in httpd.conf configuration file. Edit the /etc/apache2/httpd.conf Add the following: ServerSignature Off ServerTokens Prod Save and restart the apache web service. You server will then only identify itself as Server: apache…
Read More
Basic Linux Commands For Managing A LAMPP Server

Basic Linux Commands For Managing A LAMPP Server

Coding, Guide
Frequently I am asked by clients for details on how to manage a lampp server. While I do not recommend that clients who are not familiar with systems mess with the core system there are a few simple tasks that anyone can do to back or restart basic systems. Let's get started. First you need an account with SUDO access to the server. By SUDO you are going to SSH into the server. SSH? SUDO? Linux servers typically do not have a windows type interface to them and require that you to everything in a command line system. SSH is how we are going to connect to the server. To do this you need a terminal program, OSX on the Mac includes one out of the box. Windows users will…
Read More
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
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
Installing Nginx with PHP5 on Ubuntu 10

Installing Nginx with PHP5 on Ubuntu 10

Guide
There are a number of guide across the internet that break down how to install this setup. I had to use a couple different ones just to get it to work. Here's how I did it. Note: you should run this from the terminal - and as root (sudo -s) Step 1 - Install Ubuntu I installed it on a VM but it really doesn't matter. For the sake of this guide I downloaded Ubuntu 10.04.1 LTS version. Step 2 Install PHP FastCGI From the terminal sudo apt-get install php5-cgi Step 3 Install Nginx - latest stable The build in repo for Ubuntu is running version 7 - as of right now the latest stable is 8.54 so we need to update the repo and get the latest version. add-apt-repository ppa:nginx/stable…
Read More
Get system specs in Linux

Get system specs in Linux

Guide
I've been looked for a CPUZ type program for my Linux (Ubuntu) so I could see the bios info and what motherboard specs I have in my computer. This little scrips works great. First launch terminal Applications > Accessories > Terminal then type: sudo lshw -html > Myhardware.html The terminal will ask for your password, enter it and then it will generate a HTML file in your home folder called Myhardware.html. Launch your home folder and double click on Myhardware.html to get all of your specs.
Read More