This website is composed of information connected through taxonomy. It is simultaneously a proof-of-concept and a means to allow Agaric to share and store information both within the collective and the world as part of our open documentation philosophy.

User login

This website is composed of information connected through taxonomy. It is simultaneously a proof-of-concept and a means to allow Agaric to share and store information both within the collective and the world as part of our open documentation philosophy.

CFWheels taking action on a particular error

http://cfwheels.org/docs/1-1/function/errorson

If you have more than one error on a property (aka column in a database table, as defined in your model) you need to create custom errors so you can name them

For instance, in your User.cfc model in your custom error method you have:

Firefox sets the minimum calculated width of the HTML element based on your navigation bar

I just spent a long time fruitlessly debugging work on a mobile web site because my firefox window, while itself becoming as thin as i wanted to drag it, was setting the HTML element to the minimum width my admittedly overcrowded navigation bar could crunch to-- 677px in my case.

Command line Git on Windows

A principal at Agaric regrettably uses Microsoft Windows as a primary operating system. In fact, though, everything works great for him using the open source integrated development environment Eclipse to develop, including using the eGit plugin-- except when something goes wrong, and my (limited) command line knowledge of Git is useless to help him.

Fortunately, it turns out to be pretty easy to have command-line Git on Windows with Eclipse, it just isn't well documented.

Setting up Git to Rebase on Pull Without Command Line

in

In the .gitconfig file in your home directory, ~ for Linux, and for Windows something like c:\Users\MyName, make sure there are these lines:

[branch]
  autosetuprebase = always

And in the project-specific .git/config (in the project's root directory), make sure there are lines like these, in particular of course the last one:

[branch "master"]
  remote = origin
  merge = refs/heads/master
  rebase = true

Show main menu links in the admin menu

<?php
/**
* Alter the admin menu to show main menu links there also (for admin pages).
*/
function example_admin_menu_output_alter(&$content) {
 
// Retrieve the Main menu link tree.
 
$tree = menu_build_tree('main-menu');
 
$links = admin_menu_links_menu($tree);
  if (!empty(
$links)) {
   
// Fake out a top-level main menu link.
   
$links['#title'] = t('Main menu');
   
$links['#href'] = '<front>';
   
$links['#options'] = array(
     
'alias' => true,
    );
   
$links['#weight'] = 100;
   
debug($links);
   
$content['menu']['main_menu'] = $links;
  }
}
?>

Undo Drupal's over-aggressive shortening of user names

And use a real ellipses!

Drupal's theme_username() is used many places within Drupal, and shortens any name over 20 characters, which can be a lot if you encourage people to use full names. This can be undone with a preprocess function in your module or theme, just replace EXAMPLE with your module or theme name.

Maintaining a Drupal project with Git: Vacating the master branch

If you've already been committing code to master, do this to start a new 7.x branch and kill off the code in the master branch so noone gets confused.

cd /path/to/repo
git checkout -b 7.x-1.x

git push origin 7.x-1.x

git checkout master
git rm -r *
echo "Real code is not kept on the master branch, to see the code: git checkout 7.x-1.x" > README.txt
git add README.txt
git commit -m "Add a README explaining that the master branch is empty."
git push origin master

Define and Use a JQuery Plugin as a Helper Function for Drupal JavaScript

Here's the basics of defining and using a JQuery plugin within the context of Drupal.

This is definitely not the best and highest use of a plugin, and may in fact be a downright abomination-- this isn't a plugin that really works outside the context of the code it is written for, and certainly not outside Drupal. But it was a clean way to abstract out 42 lines of code, so here it is, for the enjoyment of all.

The first part here is simply how to call JQuery from Drupal, the second part is the plugin.

How to fetch a file at a URL and set it as the default image in an image field

There's two separate cool things here that you might want to do. One, simply know how to save a file from a URL (there's a secret Drupal function for that in system module) and two, how to give an image field a default image when creating it programmatically (that part is outsourced to the fieldhelp module).

Set a git commit message in bash but also go to Vim for further editing

A colleague insists that messages abide by the 72 character limit advisory, and i want to change my habit to get the files-changed and, just as important, files-left-out information that git commit will give in the Vim editor.

I'm still a bit addicted to the git commit -m "Message here" workflow of entering messages right in the command line, and it's more than just habit: it is very useful to be able to look at the git add -p record.