developing smarter web applications...

Welcome...

I use this site mainly to document things that I find useful.
Contact me if you have any questions about what you see on here.

If any of this interests you, then where I work may also interest you. I am the lead developer at CloudOps.

Git branches to manage third party app customization

Preface:

I have been using this technique to customize different types of third party projects for years. I originally wrote about it back in 2009 in this popular post regarding the management of customizations on top of the ever changing Drupal code base. That post is very long winded and overly technical for most people, this post will serve as an abridged version covering only the branching concept.

Redirect traffic from a wordpress site

The Problem:

A wordpress site has depreciated and you want to redirect all of its traffic to a landing page on a new site.

Deploy node.js on cloudfoundry.com

Instructions to create a simple node.js app called node_app and then upload and run it on cloudfoundry.com.

In order to use cloudfoundry.com, you need to sign up and have your account approved. Do that now because approval does not happen immediately.

---

We will first get our node.js app working locally.

Download and install the latest node.js.

Change directory to where your code lives and then do:

Using a 1and1 git repository

On the 1and1 business accounts you can now use Git via SSH. Here is how...

Setup your master FTP password (which will be used for SSH).

SSH into your 1and1 account with (assuming example.com is on this account):
ssh username@example.com
mkdir repositories
cd repositories
git init --bare my_repo.git

Now on your local machine you can clone this repository with:
git clone ssh://username@example.com/~/repositories/my_repo.git

Or to add 1and1 as a remote location for an existing repository do:

Secure push and pull with git-http-backend

I am setting up a new repository machine for my code. I will be setting it up with Active Directory later on, but I figured my basic setup would be a good starting point for most people.

My new repo box is on CentOS. I installed Git on my server from the EPEL repository. All the commands in this tutorial will be done from sudo.

I created a simple password file on my server using this command.
htpasswd -c path/to/file/passwords user-name

To add a user to the existing password file do:

Delete a remote branch in Git

I run into this all the time. I am typing too fast when I push code to my remote repository and I make a typo that creates a new branch in my remote repository.

Correct: git push origin production:refs/heads/production

Mistake: git push origin production:ref/heads/production
Result: * [new branch]    production -> ref/heads/production

Obviously I do not want this new branch on my remote server, so I want to remove it. You can remove this newly created branch with.

Editing your hosts file on a Mac

This is a relatively common thing that I have to explain to clients.

It is often difficult to walk someone through changing their hosts file on a Mac, so I figured I would share the way I do it.

Open the Terminal:
Applications > Utilities > Terminial

Type the following and hit Enter:
sudo open -e /etc/hosts

This will open the hosts file in TextEdit. Make your changes and save...

Apache, MySQL and PHP on Snow Leopard

Snow Leopard comes with PHP 5.3 installed by default. Since I do a lot of Drupal development, I can't actually use that version of PHP and I needed to downgrade to PHP 5.2.x. I personally do not like the way that Apple has setup their AMP stack, so this is how I was able to get an acceptable one setup.

Note: This method uses MacPorts, so you will need to install that first.

sudo port clean php52
sudo port -f uninstall installed
sudo port installed
sudo port install grep
sudo port install apache2

Setting up a new UTF8 MySQL Database

Create a UTF8 database:
> CREATE DATABASE db_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

Create a user for the database:
> CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'user_pass';

Grant all privileges to the user:
> GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'localhost' WITH GRANT OPTION;
> FLUSH PRIVILEGES;
You should probably not give him all privileges on all databases, but you can change that as needed.

 
Syndicate content