Holiday Photos: Find The River

As is my wont, I flew back to Ottawa to visit withe the family over the holidays. As is becoming my wont I took photos of the landscape from the plane, both coming and going. On the way over, the weather was completely overcast from Calgary to around Sudbury, but what I got was top-notch; Little towns like Temagami, Lumsden’s Mill, Fort-Coulonge, and Ste-Cécile-de-Masham, towns that I’d never heard of but suddenly became amazingly interesting places I might like to visit someday; islands and lakes like Lac La Pêche and Rapides-des-Joachims; and completely random places like some farm out near Russel, ON.

As is my wont, I flew back to Ottawa to visit withe the family over the holidays. As is becoming my wont I took photos of the landscape from the plane, both coming and going. On the way over, the weather was completely overcast from Calgary to around Sudbury, but what I got was top-notch; Little towns like Temagami, Lumsden’s Mill, Fort-Coulonge, and Ste-Cécile-de-Masham, towns that I’d never heard of but suddenly became amazingly interesting places I might like to visit someday; islands and lakes like Lac La Pêche and Rapides-des-Joachims; and completely random places like some farm out near Russel, ON.

Temagami, ON

Lac La Peche

A little farm, corner of Frontier Road and Burton Road

Shooting all these remote locations was great fun. I felt like a pioneer, exploring the Ottawa River… except going backward.

A couple days after landing, I took a walk up Rideau Canal from Hog’s Back Falls. I hadn’t planned on keeping up the “exploring waterways” theme, it sort of happened. Plus, I know the Rideau Canal like the back of my hand, though it was a long time since I’d gone as far as Hog’s Back. They’re small, but really really nice-looking falls.

Hog's Back Falls

Then, a day trip to Montreal with my parents, specifically tooling around Vieux-Montréal. That was great; I don’t think I ever visited that particular bit before; plus I got to see the inside of Notre-Dame-de-Montréal, which was phenomenal. Well worth the $5 tourists had to pay (yes, even to look around and take pictures. They must really be hard up for money).

Vieux-Montreal

Chapelle Bonsecours bell tower

Notre-Dame-de-Montreal

The flight back was just as interesting. The cloud cover came and went over the prairies (sadly, Ontario was completely out), and I managed to get some good shots of Lake Manitoba (frozen), various rivers, and any number of tiny-ass towns in the middle of nowhere. Plus the Drumheller Badlands, famous for their dinosaurs.

Western edge of Lake Manitoba

Smiley, SK

Drumheller, AB

I enjoyed the by-now familiar chore of going over Google Maps and an online atlas of Canada to identify these places; post-processing to remove atmospheric haze, that was less fun. It took me several tries per photos until I got something I was satisfied with. But even then, sometimes I had my doubts. For instance, are the Badlands that yellow? (Google Images says that yeah, they pretty much are). Or some photos were too red, or too yellow… It didn’t help that the Ottawa River pictures took place around sundown, which made everything yellower. Well, I did my best, no use worrying too much about it now.

The first gay-positive movie ever

I’d read a bit about the very early homosexual rights movements in Europe, about Magnus Hirschfeld and some of the organisations that operated in the 1910’s and 1920’s. But I didn’t know anything about what they published, or how they made their case to the general population. Well, now I know a little bit more, thanks to Anders als die Andem (Different from the Others), a German silent film released in 1919. Banned a year afterwards, most copies were destroyed when the Nazis took over. Only fragments of this fascinating piece of gay history exist.

I’d read a bit about the very early homosexual rights movements in Europe, about Magnus Hirschfeld and some of the organisations that operated in the 1910’s and 1920’s. But I didn’t know anything about what they published, or how they made their case to the general population. Well, now I know a little bit more, thanks to Anders als die Andem (Different from the Others), a German silent film released in 1919. Banned a year afterwards, most copies were destroyed when the Nazis took over. Only fragments of this fascinating piece of gay history exist.

What’s striking about this film is how modern its message and presentation are. The characters (including Hirschfeld, appearing as himself) argue for gay rights and dignity in a way that wouldn’t be too out of place in the 50’s or 60’s. Sure, Hirschfeld’s “third sex” scientific theories seem a bit silly now, but emotionally it wasn’t a bad narrative, and the bottom line—that we are all part of one big sexual continuum—is as true now as 100 years ago. It really makes you think: if Fascism hadn’t reared its ugly head then and set civil rights back a generation, how much further along would we be now?

The story revolves Paul Körner, a famous violinist who starts a relationship with Kurt, a student of his. It’s totally consensual and shown in a very positive light, but unfortunately Paul is also being blackmailed; if he doesn’t cough up money on a regular basis, his secret will come out—and in those days, that could mean jail time.

Finally Paul can’t take any more, and takes his blackmailer to court—hey, extortion is a crime too. Though the blackmailer is sentenced to jail, so is Paul. And after his very brief sentence is over, he finds his career is in shambles, his lover is gone, and his family won’t speak to him. Unable to take it anymore, Paul commits suicide.

And here again we see how Anders als die Andem is way ahead of its time, because unlike so many Hollywood films, it places the blame right where it belongs: senseless laws like Paragraph 175, a squeamish and bigoted society, heartless extortionists taking advantage of the system. And, it ends with a passionate call to action:

If you want to honor the memory of your friend, then you mustn’t take your own life, but instead keep on living to change the prejudices whose victim—one of countless many—this dead man has become.

This is the life task I assign to you. Just as Zola struggled on behalf of one man who innocently languished in prison, what matters now is to restore honor and justice to the many thousands before us, with us, and after us.

Through knowledge to justice!

—Magnus Hirschfeld to Kurt, Paul’s lover

Watch it here

(via Slap Upside the Head)

VGVA.com redesign: the frontend

Layout-wise, I made a few changes to VGVA.com. First, a much wider default width (from 800 to 1024 pixels) allowed me a second sidebar. After a lot of experimentation and feedback from the VGVA board, I displayed our sponsors in two cycling blocks (thank you, jQuery Cycle Plugin!), plus a separate block for new “official supplier sponsor” volleyballstuff.net. Team sponsors should be pleased, at least; their logos had previously been stuck below the footer.

(Part 2 of my recap of the VGVA.com redesign. Part 1 is here)

Layout-wise, I made a few changes to VGVA.com. First, a much wider default width (from 800 to 1024 pixels) allowed me a second sidebar. After a lot of experimentation and feedback from the VGVA board, I displayed our sponsors in two cycling blocks (thank you, jQuery Cycle Plugin!), plus a separate block for new “official supplier sponsor” volleyballstuff.net. Team sponsors should be pleased, at least; their logos had previously been stuck below the footer.

The left sidebar displays news and matchmaker listings, two things previously confined to a couple pages each, as well as section sub-menus where appropriate, for easier navigation. Speaking of News, I decided to scrap the news archive page from the previous design. I’d gotten the idea from the Out on Screen site, but after a while archiving past events felt pretty useless (especially since almost all these events recur every year). I don’t have the numbers to back up my guts, but it makes for a simpler architecture and nobody’s complained yet, so there you are.

The matchmaker section hasn’t changed much, as far as the user would tell, except I did implement an AJAX-based login/signup process (which falls back to plain synchronous forms if the browser isn’t running JavaScript).

Lastly, I tried my hand at this responsive design thing I’ve heard so much about. Nothing too fancy, just narrowing or removing the width of the left sidebar for smaller screens, plus taking out some stylistic frills (e.g.: rounded corners) for mobile browsers.

So there you have it! This redesign consumed so much of my free time for months, but now I can finally relax a bit…

VGVA.com redesign: the backend

The first and most obvious aspect of this redesign was moving from a few homebrewed PHP scripts to a proper CMS, namely WordPress. The advantages are obvious—revision history, a full text editor, taxonomies, etc… etc…—are obvious. But I needed a lot more than just a basic CMS for this site, and WordPress was ready:

The first and most obvious aspect of this redesign was moving from a few homebrewed PHP scripts to a proper CMS, namely WordPress. The advantages—revision history, a full text editor, taxonomies, etc… etc…—are obvious. But I needed a lot more than just a basic CMS for this site, and WordPress was ready:

Multiple custom post types

I’ve got 2 now, and will be implementing a third in the near future. News display on the front page and the left sidebar, and require not just a start date but an expiry date. Newsletters have no custom fields but are mailed out to our membership upon publication. Last comes Skills, a series of tutorials sent out every couple of weeks by one of the mentors to the intermediate players. Right now they’re only implemented as static pages with hard-coded dates—bit of a rush job, I admit.

Control panel

Some pages, such as tournaments and registration pages, have time-sensitive content. Previously I kept the different versions of these pages in separate files, swapping them out via crontabs. This worked well enough, but it was definitely not friendly to non-techy people. My solution was to keep different versions in separate private sub-pages (tidier that way), with the master (public) page’s content consisting only of a banner and a shortcode.

This shortcode would output the content of one of the sub-pages, based on the current time and whatever deadlines apply.

add_shortcode( 'vgva_summerfling_body', 'vgva_summerfling_body_func' );

function vgva_summerfling_body_func($atts) {
  $now = time();
  $fling_over = get_option('vgva_fling_date') + 86400; //the day after it ends
  if($now < $fling_over) {
    if(($now >= get_option('vgva_fling_upcoming') && $now < get_option('vgva_fling_reg_open')) || get_option('vgva_fling_upcoming') > get_option('vgva_fling_reg_open')) {
      //summer fling upcoming
      $pageId = 788;
    } else {
      //summer fling registration open
      $pageId = 790;
    }
  } else {
    //summer fling inactive/over
    $pageId = 786;
  }
  $page = get_page($pageId);
  return apply_filters('the_content', $page->post_content);
}

How are these deadlines set? Through a “control panel” consisting of several pages, each setting one aspect of the site’s configuration. Registration, board members, tournaments, etc… Basically, if it influences the site’s behaviour, or appears on more than one place on the site, it goes in the control panel.

So, non-techy people can easily update the pages and the configuration. The logic tying everything together is still my domain, but once I’ve ironed out all the bugs that’ll never needs to change unless new features are required.

Speaking of shortcodes, the sub-pages (and hell, almost every page on the site) makes generous use of them. It was a pain to set up, but now I can sit back and relax. No more global search-and-replace to update board membership and contact info (the chair’s name and email, especially, shows up on many different pages.)

add_shortcode( 'vgva_fling_reg_fee', 'vgva_fling_reg_fee_func' );

function vgva_fling_reg_fee_func($atts) {
  setlocale(LC_MONETARY, 'en_US');
  return money_format('%n',get_option('vgva_fling_fee'));
}

One pet peeve I have is that, unlike Drupal, WordPress does not have built-in logic to generate the markup for configuration pages, so not only do I have to do the hard work, there’s no accepted standard. Hmph. Oh well.

The Matchmaker

The matchmaker logic didn’t change a whole lot: I tweaked the data structure here and there, but nothing substantial. The real pain was making custom forms work in WordPress, with the custom templates that feel very… hacky and awkward. Again, Drupal is way easier for heavy custom development. But hey, I knew what I was getting into.

One last thing: all this custom logic (custom post types, matchmaker) was implemented as plugins, not part of the active theme. It’s just common sense, right?

So there you have it, a peek into the back-end development of VGVA.com. It was by far my most involved project, and I enjoyed every minute of it. I learned so much about WordPress’s guts, and got some excellent hands-on experience.

(Next up: a bit about the redesigned front-end)

The VGVA.com redesign

For several months, I’ve been hard at work redesigning the Vancouver Gay Volleyball Association website. Longtime readers will remember previous posts wherein I expressed my insecurities, then my excitement at tackling its redesign in 2008. Now in 2011 comes another redesign, even more extensive.

For several months, I’ve been hard at work redesigning the Vancouver Gay Volleyball Association website. Longtime readers will remember previous posts wherein I expressed my insecurities, then my excitement at tackling its redesign in 2008.

Now in 2011 comes another redesign, even more extensive. I moved the site to WordPress instead of homebrewed PHP scripts, jiggered the layout and structure, and made extensive under-the-hood changes to allow non-techy people to update content, announcements, and time-sensitive information (tournaments, registration) without mucking about with HTML and SQL.

In the next couple of posts I’ll go into more detail about the changes I’ve made, and what I’ve learned along the way.

Content type descriptions in node/add

Most of my Drupal experience in the last year has been either purely back-end development, or superficial front-end stuff: JavaScript, AJAX, tweaking templates and styles, that sort of thing. But in the last couple of weeks, in two different projects, I’ve been digging more into theme development, menu management, and various other issues.

Most of my Drupal experience in the last year has been either purely back-end development, or superficial front-end stuff: JavaScript, AJAX, tweaking templates and styles, that sort of thing. But in the last couple of weeks, in two different small-scale projects, I’ve been digging more into theme development, menu management, and various other issues site admin issues. It’s fascinating stuff, though hard to wrap my head around. Plain old development on the Drupal platform was a lot more straightforward, at least to me. Still, it’s good to get out of my comfort zone, right?

Here’s one particular problem I dealt with, which I had a hell of a time googling for: the client wanted to change the content type descriptions on the “Add Content” (/node/add). It took me some trial and error and googling to find out that’s taken from two places:

  1. The content type description, as set in each Content Type.
  2. Overriding that if they exist, the descriptions of the “Add Content” menu item’s children.

There are still a lot of things I’m figuring out, like how to change the text on top of the Add Content page. Seems a simple thing, right? Maybe it is if you know how, but I don’t. It’s definitely not the menu system, though interestingly the menu item description does display as expected on its parent menu page…

Walking Lions’ Gate Bridge

On Tuesday I did something I’d been thinking about for a while: walking over Lions’ Gate Bridge. I didn’t really plann it, I just got impatient waiting for the bus after work, then started walking along Marine Dr. The bus drove past as I was between stops, so I thought, fuck it. It was a nice evening, not too warm and not too cold, I had my camera with me and the light looked right for some good sunset shots. Why not?

On Tuesday I did something I’d been thinking about for a while: walking over Lions’ Gate Bridge. I didn’t really plann it, I just got impatient waiting for the bus after work, then started walking along Marine Dr. The bus drove past as I was between stops, so I thought, fuck it. It was a nice evening, not too warm and not too cold, I had my camera with me and the light looked right for some good sunset shots. Why not?

Lions' Gate Bridge

Traffic on Lions' Gate Bridge

Here are a few things you don’t notice when you’re driving over the bridge:

  • Those factories, or whatever the hell they are, just west of the bridge between Capilano Indian Reserve and the sea… they stink. It’s a weird smell I couldn’t quite identify. Kind of seafoodish, I guess. What are they making or processing there?
  • The bridge vibrates from the constant traffic. By itself not a big deal, but it was kicking up my fear of heights quite a bit.

North Vancouver

Funny thing, though: until I actually set foot on the bridge, I didn’t think acrophobia would be a problem. I get nary a twinge from Burrard or Granville Bridges, but Lions’ Gate is a whole other beast. I kept angling away from the outer railing, even though that’d put me in the way of bicycles (unless there was a really good shot). To turn around I shifted my feet around carefully, as though I were walking on thin ice. In fact I didn’t trust my balance unless I was steadily walking straight ahead, preferably with one hand touching something solid.

Lions' Gate Bridge, sun going down

Of course, even after I got back on terra firma my journey was far from over, because still had to cross Stanley Park, and then downtown. I was tired, starving and I needed to pee really badly, but it was totally worth it! Though next time, I’ll go on the east sidewalk, to get a better view of downtown…

The Harbour and Canada Place

How to disable individual fields in the node edit screen

Consider this problem: you want to disable a few fields on the node edit screen for particular node types. Let’s say the body, although this could apply to any and all fields. The reason for this is that for our client’s e-commerce system, the products are synched from an external POS system, and most fields should not be touched AT ALL… and certainly shouldn’t be overwritten with content copy-pasted from MS Word, which has happened a few times and prompted us to take preventative measures.

Consider this problem: you want to disable a few fields on the node edit screen for particular node types. Let’s say the body, although this could apply to any and all fields. The reason for this is that for our client’s e-commerce system, the products are synched from an external POS system, and most fields should not be touched AT ALL… and certainly shouldn’t be overwritten with content copy-pasted from MS Word, which has happened a few times and prompted us to take preventative measures.

I should clarify that at least one field (images) does still need to be editable, which is why we’re not just taking away edit permissions altogether.

Okay, so I’m not saying what follows is the best solution, just what I came up with, inspired by a Stack Overflow thread I can’t seem to find right now. It uses hook_form_alter() to (a) hide the body edit field group, and (b) replace it with static markup displaying the body content. I thought about replacing it with a disabled textarea, but in Firefox, for instance that’ll show up with a medium grey background that really doesn’t look very good.

$CONTENT_TYPE = 'product'; 
function MODULE_form_alter(&$form, $form_state, $form_id) {
  if(isset($form['#node']) && $form_id == $CONTENT_TYPE . '_node_form') {
    $form['displaybody'] = array(
      '#value' => '' . $form['body_field']['body']['#title'] . ':
' . $form['body_field']['body']['#default_value'] . '
', '#weight' => $form['body_field']['#weight'], ); $form['body_field']['#access'] = FALSE; } }

A few notes:

Line 3: I’m not really sure what the first condition is for. At first I thought it was to cover only editing existing nodes, but that doesn’t appear to be the case. The second condition is to cover only certain node types

Lines 4–10: we insert a new form element, ‘display body’. It will show the body field label and content, and will be have the same weight as the existing body field, so it shows up in the same position on the screen.

Line 11: This hides the body field, unconditionally.

But what if we wanted to allow some users to edit that field? That’s certainly doable, but it gets a bit awkward. I could use hook_perm() to create a special permission—call it ‘edit body’—and replace line 3 above with:

if(isset($form['#node']) && $form_id == $CONTENT_TYPE . '_node_form' && !user_access('edit body')) {

However, that permission would show up in my own module’s section, not with the other uc_product permissions, so that’s a bit annoying. I could hack uc_product.module, but that’s not really a good solution. If there were a way to add to a third party module’s permissions, that would be very awesome!

Sunset, Kits, Sunset on Kits

Last week I did something I hadn’t done in a while: bring my camera to work and take pictures from the SeaBus. Now that the days are getting shorter I can get some fine sunset pics—when the weather’s cooperating, as it was that day.

Last week I did something I hadn’t done in a while: bring my camera to work and take pictures from the SeaBus. Now that the days are getting shorter I can get some fine sunset pics—when the weather’s cooperating, as it was that day.

Sunset and Clouds

Sunset

On Thanksgiving Sunday I went to see a play at the Jericho Arts Centre—lovely little place between Jericho and Locarno Beaches—and then a few of us went for dinner at a veggie restaurant in Kits, where I took one last shot of the sun going down on 4th Ave.

Belmont Ave

4th Avenue near MacDonald

Snail’s Pace

It’s the little things, y’know?

On the way to work this morning I saw a snail crossing the sidewalk. It had a very pretty shell, pale yellow with a sharp black stripe. Right in the middle of the sidewalk it was, halfway between the bushes by the McD parking lot and the cool shady bushes by the side of the road.

It’s the little things, y’know?

On the way to work this morning I saw a snail crossing the sidewalk. It had a very pretty shell, pale yellow with a sharp black stripe. Right in the middle of the sidewalk it was, halfway between the bushes by the McD parking lot and the cool shady bushes by the side of the road.

Well, this was new and interesting, so I stayed and snapped a few pictures. And then I stayed some more, because I was afraid this little guy* would get squished by some oblivious lumbering biped. It was taking its sweet time, as snails do; after a couple minutes I tried to gently pick it up, but it retreated inside its shell and just hung on to the sidewalk. So I left it alone.

It took the snail about 10 minutes to complete its journey. I stayed with it all that time, not minding how I looked to passersby, not minding that I’d be a little late for work. The snail was teaching me patience, teaching me one needs to slow down every once in a while.

(* I know snails are hermaphrodites)

Made it!