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.

Get the value of a single associative array element

split array into key and value

I want to do what foreach does, but without the iteration, because I know I only have one value.

Oh, maybe each()?

Side note: It appears that Drupal coding standards (at least several examples in core) call for a lowercase, not capitalized, "as" in

foreach ($array as $key => $value) {
  ...
}

I ended up using <code>$key = key($single_element_assoc_array);

And then getting the value with $value = $single_element_assoc_array[$key];

split array into key and value

I want to do what foreach does, but without the iteration, because I know I only have one value.

Oh, maybe each()?

Side note: It appears that Drupal coding standards (at least several examples in core) call for a lowercase, not capitalized, "as" in

foreach ($array as $key => $value) {
  ...
}

I ended up using <code>$key = key($single_element_assoc_array);

And then getting the value with $value = $single_element_assoc_array[$key];

Icon changing and editing in Mac OS X

You cannot drag and drop the icon to create it in Mac OS X Tiger

You have to click the upper representation of the icon in the "Get Info" pane and select Copy from the Edit menu (control click doesn't get you anything, either)

http://interfacelift.com/icons-mac/

for designing icons and anything else, see:

Domain Name Server caching on personal computers

Perusing Yahoo's rules for speeding up your web site, I came across the explanation to an interesting phenomenon.

On Dan's computer, it can take hours after the DNS resolves on our ISP, for his computer to recognize it! (I have to out my co-collective member at Agaric: He still uses Microsoft Windows.)

Yahoo explains:

Agaric Wants a way to replace a directory, have SVN just deal

So we're moving a client's site from a server that only had FTP, and find out the download wasn't complete after we already added the files to our SVN repository. So I thought, this is what Subversion does, right? You make local changes and it keeps track of them. Apparently, wrong. Not when it comes to replacing entire directories.

svn replace directory with another directory
.svn' containing working copy admin area is missing

So we're moving a client's site from a server that only had FTP, and find out the download wasn't complete after we already added the files to our SVN repository. So I thought, this is what Subversion does, right? You make local changes and it keeps track of them. Apparently, wrong. Not when it comes to replacing entire directories.

svn replace directory with another directory
.svn' containing working copy admin area is missing

<

blockquote>If it is an option, I would recommend you do a new checkout and then just copy any files you had modified over the top of your new checkout.

Drupal Indymedia setup notes from Boston volunteer Developer

ekes' Hidden module for
hiding stories. Ekes is an Indymedia developer and involved with the
larger IMC Alternatives project. It's a pretty good module save for
one issue I'll explain in a second. Here's a quick rundown of all the
modules we're using though:

- Akismet
- Captcha
- CCK (along with calendar, date, link, imagefield, and email fields)
- Hidden
- Imagecache
- MySite (installed by not active)
- Notify
- Panels
- PathAuto
- Token
- Update Status
- Views

<

blockquote>
ekes' Hidden module for
hiding stories. Ekes is an Indymedia developer and involved with the
larger IMC Alternatives project. It's a pretty good module save for
one issue I'll explain in a second. Here's a quick rundown of all the
modules we're using though:

  • Akismet
  • Captcha
  • CCK (along with calendar, date, link, imagefield, and email fields)
  • Hidden
  • Imagecache
  • MySite (installed by not active)
  • Notify
  • Panels
  • PathAuto
  • Token
  • Update Status
  • Views

I'm trying to keep things as close to out of the box as possible so
we're not locked into a heavily customized site that we can't keep

Listing of all possible ancestor paths DEFEATED!

Rube Goldberg has nothing on me.

Here it is, in its last testing phase. It'll get the comments cleaned up, but after-the-fact advice on the way the module actually works would be greatly appreciated.

Rube Goldberg has nothing on me.

Here it is, in its last testing phase. It'll get the comments cleaned up, but after-the-fact advice on the way the module actually works would be greatly appreciated.


function cmt_get_ladders($tid) {
// each level is either done, or has the tid (or count?) of the next term to trace
// ladder[0] has levels 0, 1, 2, 3
// level 2 had an extra tid (term 1 had two parents)
// level 1 had two extra tid (had three parents)
// when we reach level 3, the term given has no parents
// return to the most recent fork, level 2
// duplicate ladder [0] to ladder [1], unset everything above level

Views Exposed Filters and Range Filters Problems and Possible Solutions

First thing Agaric does of course is upgrade modules to their most recent version (Relativity 5.x-2.1 and Views 5.x-1.6). Fun, but no effect. Same return on clearing the views cache.

Two issues that seem related:

  • A relativity (parent node) filter and it doesn't seem to work.

First problem came up in the context of Views Fusion - http://drupal.org/node/147274

From my mentors own mouth: "indeed. There are a lot of problems with filters with views 1.6"

First thing Agaric does of course is upgrade modules to their most recent version (Relativity 5.x-2.1 and Views 5.x-1.6). Fun, but no effect. Same return on clearing the views cache.

Two issues that seem related:

  • A relativity (parent node) filter and it doesn't seem to work.

First problem came up in the context of Views Fusion - http://drupal.org/node/147274

From my mentors own mouth: "indeed. There are a lot of problems with filters with views 1.6"

But it applies to any view that you try to expose but uses an add_where command that works in the view but not accessed through a filter or like method. Fago provided a patch: http://drupal.org/node/150094

Delete text between and including identifying strings

Internet answered this question for Agaric, and we'll make it easier for the next person to find the answer!

remove HTML within markers
regexp strip all between two snippets
regexp delete between two keywords
php delete between strings

There's a great, informative post – just in response to a question on a forum – on how to do it with a regular expression here:

Internet answered this question for Agaric, and we'll make it easier for the next person to find the answer!

remove HTML within markers
regexp strip all between two snippets
regexp delete between two keywords
php delete between strings

There's a great, informative post – just in response to a question on a forum – on how to do it with a regular expression here:

http://www.programmingtalk.com/showthread.php?threadid=39966

With this answer:

$string = preg_replace( &apos;/\&lt;body\&gt;.*\&lt;table/Usi&apos;, &apos;&lt;body&gt;&lt;table&apos;, $string ); 

Our modification (main difference, not re-adding the search strings) worked quite nicely to remove unwanted text hardcoded into another Drupal module, the otherwise wonderful Video module in 4.7:

Scale a square's dimensions with PHP

Or determine and apply any ratio.

Agaric needed this for a Drupal module, but this is general PHP that should work for anything.

php scaling function length height
calculate a ratio

Below, Agaric's function for scaling two dimensions maintaining their aspect ratio given a limit for one or both dimensions (or a percentage, but in retrospect it is very silly to wrap multiplication in a function).

Or determine and apply any ratio.

Agaric needed this for a Drupal module, but this is general PHP that should work for anything.

php scaling function length height
calculate a ratio

Below, Agaric's function for scaling two dimensions maintaining their aspect ratio given a limit for one or both dimensions (or a percentage, but in retrospect it is very silly to wrap multiplication in a function).


/**
* Scales two dimensions based on one or two limits or a percentage value.
*
* THIS FUNCTION TAKES VARIABLES BY REFERENCE
* It does not return anything you'll find useful.

Freelance or Small Business, what about Cooperative?

The Web Design Business Kit, by Brendon Sinclair, provides good advice, at least in the free sample chapters.

It does however, set up an absolute two-choice approach: freelancing, or owning a small business.

Not a token nod to a collective, co-operative form of organization? Equality, liberty, fraternity? And this from an Sinclair, who appears to take the view that work-or-starve is its own sort of slave labor in the introduction summary: