Featured Content

Apache access control the Agaric way

Key words and phrases: 
require password authentication Apache authorization limiting access to test server control who can view development sites
Description & Info: 

Clients don't like their test site competing with their live, production site for Google results. Therefore, we have put our entire set of test sites behind a pop-up requiring basic Apache authentication.

For ongoing maintenance — adding new people to access the test environment behind the authorization wall — the operative command is:

Roughly following the instructions here:
http://httpd.apache.org/docs/2.2/howto/auth.html


sudo mkdir /etc/apache2/passwd

sudo htpasswd -c /etc/apache2/passwd/passwords dan
New password:
Re-type new password:
Adding password for user dan

sudo htpasswd /etc/apache2/passwd/passwords benjamin
New password:
Re-type new password:
Adding password for user benjamin

I love that no matter how many times I do it

I love that no matter how many times I do it – leave off a semicolon, have more opening than closing parentheses, or have an extra curly brace – the PHP parser still finds my error unexpected.

It's that kind of unconditional confidence that a coder needs to get through the day... and the night.

by Benjamin Melançon
Posted on Wed, 2008-07-02 23:26
in

With XAMPP, permission denied for MySQL user with % (all) host access but works for localhost

Key words and phrases: 
Drupal development environment localhost User 'jonasconstructio'@'localhost' : Edit Privileges @% @localhost at percent all hosts
Description & Info: 

For reasons not known to man nor beast, on XAMPP on Mac OS X (and not XAMP but another all in one WAMP stack, but not that name either) will not work with the wildcard availability host name (%). It will work (or anyhow may work for you, it worked for Agaric!) with the @localhost for host name.

Too-true Typo of the Week: the wanders of unit testing

Description & Info: 

The too-true typo of the week, from Kyle Mathews' Unit Testing Success Story:

The Lullabot crew had a recent podcast on the wanders of unit testing.

The wanders, indeed.

by Benjamin Melançon
Posted on Tue, 2008-07-01 23:44
in

In a shell script, create a database if it does not exist

Key words and phrases: 
mysql create database from bash script mysql if database exists automate creation of database if it doesn't already exist PHP script bash script if mysql database does not exist create
Description & Info: 

Use the MySQL: SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database_name'

<?php
if (mysql_num_rows(mysql_query("SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '". $dbname ."'"))) {
echo "Database $dbname already exists.";
}
else {
// go on and create the user, database, etc.
// create the user

by Benjamin Melançon
Posted on Tue, 2008-07-01 08:16
in

Update or commit: See what's changed in a version-controlled file with svn diff

Key words and phrases: 
identifying changes svn diff differences in versions
Description & Info: 

When you run
sudo svn status -u
and see

M 6549 www/.htaccess

you can see exactly what's up with those changes with
svn diff www/.htaccess
Showing something like:
Index: www/.htaccess

===================================================================
--- www/.htaccess (revision 6549)

by Benjamin Melançon
Posted on Tue, 2008-07-01 08:01
in

RSA host key changed, requires validation: what to do

Description & Info: 

RSA host key for example.com has changed and you have requested strict checking.
Host key verification failed.

In the line above it will actually tell you where the bad key is, with known_hosts being the file and 2 being the position of the problem key:

Offending key in /home/you/.ssh/known_hosts:2

by Benjamin Melançon
Posted on Tue, 2008-07-01 07:24
in

Drupal is a Do-ocracy

Key words and phrases: 
doocracy, do-ocracy
Description & Info: 

In response to (and crossposted from my comment on) Drupal Community Philosophies by Angie Byron:

One matter of terminology:

by Benjamin Melançon
Posted on Mon, 2008-06-30 07:54
in

Getting out of the local permissions / server login catch 22

Key words and phrases: 
authorized keys
Description & Info: 

The first step to getting out of the local permissions / server login catch-22 is to know you're in it.

Perhaps you found this page searching for "Permission denied on publickey even though I can log into the server with a public key it doesn't make any sense grrr argh how dare it deny me i created it why won't it work permissions are correct this isn't right" or something like that.

by Benjamin Melançon
Posted on Sun, 2008-06-29 19:09
in

Most people are fools...

Why do most people go around and say that they think Microsoft is evil and Apple is awesome?

On a daily basis, I find myself wondering why they've been fooled by the hype and the trendiness of Apple. These people in question go on diatribes about how the windows model has made people slaves to the OS, Microsoft is evil, Vista sucks, blah blah blah.

by Dan
Posted on Sat, 2008-06-28 11:08
in

Agaric Utility function: set default values in an array

Key words and phrases: 
array defaults
Description & Info: 

the original line is almost as short as the function, but if we want to add checking on "empty()" or need to change anything else, it's all in one place

/**
* Set a default value for an array key if that key does not exist.
*
* The _au_ namespace stands for agaric utility, and are things
* we may reuse in so many modules we'll want to put in a helper

Forward Drupal path to an external URL

Key words and phrases: 
drupal module page titles drupal automatically forward url redirect all of address path to another domain
Description & Info: 

UPDATE: A better, universal approach which should be all you need is immediately here--

Simply provide the internal path that really belongs to the old site (in 'path', and the URL you want to send things with this path to, in the 'url' value of 'callback arguments').

How to change your mysql root password using command line

Key words and phrases: 
Change MySQL root user password using mysql sql command
Description & Info: 

So you wanna change your root password for mysql, huh?

Follow these instructions and know in your heart that you did it, the Agaric Way....

MySQL stores username and passwords in user table inside MySQL database.

You can directly update password using the following method to update or change password for user root:

1) Login to mysql server, type following command at shell prompt:

$ mysql -u root -p

2) Use mysql database (type command at mysql> prompt):

by Dan
Posted on Tue, 2008-06-24 01:36
in

Print a form, such as a search form, anywhere in Drupal

Key words and phrases: 
form anywhere print form print search form drupal print the searchform
search_form_in_page.png
Description & Info: 

Resolved error:

Missing argument 1 for search_box(), called in /sites/example/www/includes/common.inc(1352) : eval()'d code on line 5 and defined in /sites/example/www/modules/search/search.module on line 1037.

This was from code added to a page's content by a client or possibly even the previous developer. We completely redid the site but did copy-paste in some pages.

Get Linux running on your Linksys Router

Key words and phrases: 
Linksys WRT54 Gv8 flashing instructions WRT54G version8 ver8 ver.8 version 8.0 8 dd-wrt dd wrt linux router v8 v.8 linux
Description & Info: 

Recently my router was giving me some problems, the worst type, dropped signal!

After hours of searching around in forums and such, I concluded that it must (hopefully) have something to do with Linksys's generally bad router software, you know, the page you goto to make all your settings and stuff... usually found at 192.168.1.1

On to the good stuff...

It's all actually quite simple, and I've taken the liberty to get all you need and make it available for you right here... so, feel free to send me some beer money, or better yet, BEER! (keep in mind, I only drink quality micro and craft brews...)

by Dan
Posted on Mon, 2008-06-02 16:00
in