Resources from greenman

scrapbook iconSchool of Everything - Scrapbook Bookmarklets

These are some handy tools that will help with the Scrapbook.
Bookmark the links below, and ideally get the bookmark to show up on your toolbar.

Both of the bookmarklets are aware of the page you are on when you click them. They will immediately set the title, and use any selected text as the body.

scrapbook iconTask Tracking with Mantis, Eclipse and Mylyn

Task management is not an easy thing. For software projects, it can get extreme. We don't really have a big programming dept here at EverythingHQ, but there is still enough noise around to need a plan.

We are using Eclipse as a development IDE, and Mantis as our issue tracking tool. Both tools are far from perfect, but they do help us get the job done. Today, I made them a little nicer by linking the two together.

Mantis and Eclipse are connected by using a pretty handy Eclipse plugin called Mylyn ( Mylyn is a pretty handy task management tool on it's own, but being able to connect it with Mantis is exciting (for a geek).

To do the connecting you need to install a slightly older version of mylyn, as of this moment, Mantis seems to work with 3.02. Download this from the Mylyn pages (, extract it, and then install. (You will need to add a new local repository location - I was confused a while.)

Once this version of Mylyn is installed, you can install the mantis connector. (
With these pieces in place, you can now connect the Eclipse to your issue tracker.

First you need to set up a saved filter on Mantis. At the moment these seem to have to be public, and work on all projects (but you can make the filter do whatever you want it to). Once you have saved a filter via the Mantis web interface, you can create a new "Task Query" from eclipse.

When you create the new query, you will need to create a new Repository. This is pretty easy, just select the appropriate version from the label field, and your server url will be pre-populated with a template url. With your repository in place, you can define your task query and link it to a mantis filter. A few minutes later, you'll be able to open a new Tasks window, and all your issues are magically part of your IDE.

Then you can start to discover all the funky extras you get with Mylyn.

scrapbook iconTesting Drupal's Notifications - delete your entry from notifications_sent

Drupal's notifications module is pretty darn useful, but, you need to have some methods for testing it otherwise you will wait days for updates.

One of the simplest little tricks is making sure that you receive an update immediately, just delete your user's entry from the notifications_sent table. This means that you have no history of updates, and the system will think you are due an email.

mysql> delete from notifications_sent where uid = 128499 limit 1;
Query OK, 1 row affected (0.00 sec)

scrapbook iconSchool of Everything Amazon EC2 Server Architecture

The School of Everything presentation on how we are using Amazon's Cloud is now availble online, along with a few other presenations from the Amazon Startup Sessions.

scrapbook iconBash variable scope, pipe and cat

Here is a nice little bit of bash snagging for you. You need to grab lines from a file, process each in turn, and then at the very end report whether or not there was a problem for any of them. Simple ? Not quite.

The following scripts are mangled to show how this works, so don't expect them to operate as-is.



cat $CONF | grep backup | grep @ |
while IFS=$TAB read var1 var2 var3 var4

No matter what happens - PROBLEM ends up as 0. This is because of the pipe that creates a subprocess for the while loop. The while loop and the rest of th script are actually independent.

It turnsd out there is another syntax:

while read LINE
done <$FILE

instead of :

cat $FILE |while read LINE

However, this assumes that you have a file to pipe to read. If you need to parse your input, things don't quite work. Turns out, you can use parenthesis "()" to group commands together. The following syntax works - just don't add any unnecessary spaces,especially after the "<".

while read LINE
done <($FILE | grep test)


scrapbook iconThe difference between $page and $teaser for node theming

I have always been a bit confused by this one. Why does theme_node have both $page and $teaser as parameters ? Surely, if it's not a page then it is a teaser ? Not quite.

function theme_node($node, $teaser = 0, $page = 0) {

The docs don't quite spell it out clearly, but once you know the difference, you can see what they are saying. However, if you have not quite understood the difference, the docs don't help one bit. Here is my attempt to clarify.

$teaser - the easy one
When you are displaying the teaser view of a node, then $teaser will be true, and, in every situation I have come across, $page will be false. This is simple, you know that you are rendering a node teaser, just go ahead and do your thing.

$page - a little more complex
When $page is true, you are on a node page ( arg(0) == 'node' ). In this case, like the docs say, we don't generally display th node title because that will be rendered by the page template.

When $page and $teaser is false
This is the special one. If you use views, you may hit this rather often. This scenario will occur when you are rendering a view with a set of full nodes. So, you are not on a node page ( arg(0) != 'node' ) and you are not displaying teasers.

So, there is nothing too complex, and once you know the difference, it's worth the occasional pause to think which variables to check, but, most of the time, it;s easy.


scrapbook iconDrupal, urls, the difference between things and filters, and keeping urls constant

Disclaimer: The worst bit about this lesson is that, as I have written this note, I have realised that what I had planned to be the lesson was incorrect! Anyway, I will post this anyway because I may need to remember all this next time.

Todays Drupal lesson: Keeping things and filters seperate. It's going to apply to any kind of social media site, but this is a little Drupal specific note.

When you create a url structure for a "thing", in Drupal it's a node of a specific type, be it an article, a profile, an image - any stand-alone entity on a site, it's good to make sure that the URL makes sense. Today we turned on our School of Everything scrapbook. It's simple right now, just letting you create one element, a "note", but how we decide to assign a url to each note has a significant impact on how we can add more types in the future.

After various back and forth, we chose to make assign each note it's own url within a top level "/notes". For a long while we were planning to put the notes below a scrapbook in the url structure, but, not only did this end up creating really complex urls, it also added some kind of complexity in that our scrapbooks are filters. Ok, that is not too clear, lets explain a bit more.

Each of our users now has a "scrapbook", a kind of blog. The url for each scrapbook is /person/[username]/scrapbook , so mine is at http://schoolofeverything/person/greenman/scrapbook. If you want to look at the scrapbook for a subject, you can add the subject on the end, /person/[username]/scrapbook/[subject], so my Drupal notes are at http://schoolofeverything/person/greenman/scrapbook/drupal. It's a filter, in Drupal, it's build with a view. That is the easy bit (well, actually there were a few iterations to that one), the real issue came up with where do the notes "go".

Notes are not actually the best example. They are very simple and could have fitted in in many places. They are however the first of many content types for the Scrapbook, so we needed to get this right. Plan one was to put them at /person/[username]/scrapbook/entry/[nid] . I thought this worked, but Andy felt the "entry" was unnecessary. We looked at /person/[username]/scrapbook/[nid] , but I avoided this because the [id] slot is a wildcard, and it could clash with our [subject] filter. I was afraid that we would run into trouble with subjects and node ids. Eventually I realised I was wrong, and that this did not matter - last week I wrote a module that aliased our taxonomy terms, which meant that we could assume that a numeric id was not a subject. (This is the point where I went back and entered the first paragraph.)

Anyway, eventually we moved notes to a top level /note url because this sets the tone for future scrapbook types. When we add things like events and classes, they will not really fit below a person, and may even change owner. In this case, we don't want to change urls.

The eventual lessons: Know how to differentiate between a thing and a filter in your urls. Don't fix urls with information that might change.

Damn, that was a long way to say all that.

scrapbook iconLearning to start an internet company

We don't really have a clue, but so far, it looks like it might be ok.

Add the first review

Write a review

Don't be shy, say hello. We'd love to hear from you.

[email protected]