drupal

Took me long enough

Blog

I really hate when a simple task, something that I think should take an hour tops, not only takes me longer than that hour, but takes me longer than that hour because I want to do it correctly. Sometimes I wonder if my level of "Good enough" is too high. Eh, probably.

Today's example: yesterday a post came through on the Drupal support mailing list:

Does anybody know of an existing module which will extract tags from
the body of a post (i.e. a line like "Tags: tag1 tag2 tag3") and pass
them to the taxonomy system to tag that node?

I've had a skim through the Taxonomy related module list on drupal.org
and didn't spot anything...

Looking at this request, writing such a module should have taken an hour, maybe, right? Well, as I started working on the module, there were features I wanted, details that, well, would bug the crap out of me if they didn't work right. They were small things (is the trigger word "tags" or "tag" or "tagaroo", or is the tag line removed from the post after processing), but ones that, well, if someone gave me the module, I'd want.

So, in they went.

And my hour "give back to the community" turned into a retarded 4 hour project.

Four hours.

Four hours not spent on client work. Four hours not spent on my big projects. Four hours that I really could have used better elsewhere.

Gah.

I'm so annoyed at myself.

At least I managed two posts from it. :\

Vicious cycle, this

Blog

Back when I worked at PDI, my group was in constant battle with the production engineering team. There were never more than four of us in the lighting TD group, and at least five in the PE group. It seemed we were always butting heads with half the group.

The fundamental difference between the two groups was that my group was trying to get work done, while the PE group was trying to build an infrastructure "the right way." The Right Way™ often meant "don't do anything until we build it and say it's okay to use," which inevitably took two weeks longer than my group had time. We were in production and production had schedules and we didn't have time to wait. If the tools weren't coming, we built the tools. If the problems weren't being solved, we solved them. Seems simple on paper.

Despite the near constant head-butting, I, thankfully, became good friends with Kevin Cureton who worked in that group. I miss Kevin a lot. I miss talking to him. I miss solving problems with him. I miss his stories and adventures and expertise and laughter. He has moved on from PDI to EA and I think from there, too. I don't know exactly where, as I've lost touch with him. I'm deeply saddened by this fact.

Kevin often went to bat for me when there was some conflict, and defending me when I was doing something totally bizarre but effective.

Thinking of the group, of the five people in it who I recall, I butted heads with 3 of them. One was a dick, one was an idiot and one was just clueless. Of the other two, one was Kevin, and therefore awesome, the other was Mitch Amino, who I liked very much, even though he was quiet and I think sometimes thought of me as near insane.

During one particular incident, I had wandered up to the PE group's area and told them I had implemented some feature that I no longer recall what it was. One of the PE group's people whose name I don't recall, waited until I left, then exploded about how dare I do this or that or something, that I didn't know what I was doing, what the frack did I think I would accomplish?

Kevin listened to his coworker rant. After he had calmed down, Kevin politely pointed out that I and my group keep about forty lighters from asking the five of them question after question after inane and clueless question. If the four of us weren't there, the five of them would have to provide support for the forty lighters that sat downstairs and have considerably less knowledge than I or my group did. Kevin then asked, did his coworker want to support forty lighters, because he sure as heck didn't want to.

The ranting coworker shut up.

And was pleasant to me after that.

I noticed the change and asked Kevin about it. He told me what happened, and I was grateful that I went from head-butting 60% of the group to head-butting 40% of the group. Very grateful. As grateful as Kevin's coworker was, because I was saving this guy many, many hours of work.

I think of this story as I sit on the other side. I know I should be grateful when I look at the modules being written in Drupal and see the modules that I have on my to-do list already written, just there for me to download. The modules that have been on my to-do list for over a year, sometimes more. I should be glad that someone else has put forth the effort so that I no longer have to.

And eventually I'm sure I will be happy and grateful for the modules and the completed work. But right now, I'm a little bitter that I wasn't able to actually write them. That my to-do list is a mile long and never seems to get shorter. And when I realize I finally have the time to these projects, I don't have the motivation.

Vicious cycle, this.

Warm fuzzies

Blog

Across the Drupal developer list, an email came across two days ago:

> ...
> The current Module Developers Guide is a great start.  But misses some
> of the details that make everything "click" for a new Drupal coder.

In the Drupal handbook, there is a great resource called "Creating
modules - a tutorial":

http://drupal.org/node/17914

Needs to be updated in places (was written for 4.5), but despite this,
it still does an excellent job of teaching you the basics of Drupal
module development. Grokking the menu callback system, and its central
role as the foundation of almost any page request in Drupal, is
probably the biggest challenge for new developers. Also a challenge is
getting your head around the "hook magic", and how all of that
actually works, and then understanding a few of the more important
hooks in detail (e.g. hook_block, hook_help, hook_nodeapi). This
tutorial will help you to at least begin to overcome these challenges.

Given that I wrote that tutorial, the email gave me warm fuzzies.

Crepes and cars

Blog

Drove up to the City for dinner tonight. I was meeting up with Roland from Bryght, who was down from Vancouver for a conference.

Every time I drive up to the City, I feel guilty. Guilty that I'm not using the mass transportation system that (nominally) works. Guilty that I'm spending over $5 in gas to get there, only to spend another $3 driving around looking for a parking space, and another $5 to drive back.

And yet...

I met Will Pate of Flock, Sarah, Steve, Paul, Roland, Ivan, and Dimitri at the dinner. Tantek, Messina and Tara were all there, too (YAY!). Tara's leaving Riya this Friday, nominally because the new Marketing VP is going to be a suit guy, and because the engineers developing the social software don't actually use the social aspects of the software, and hence have no clue how to build it. Neil showed up later, as did James Walker (having spent over an hour cumulative waiting for connections from BART to MUNI).

I had offered to drive Roland back to Sunnyvale, where he was staying with a friend for the conference. After James showed up, said hello, and socialized for a bit, we started gathering to leave. "Hey, you have a car? Can you drive me to ...?" By the time we actually left the restaurant, I had 5 people in my car, ranging from a quick Haight dropoff, to Palo Alto, Mountain View and Sunnyvale (all of a mile from my house for the last two).

Sure, the car is expensive, non-environment friendly, big and sometimes annoying.

But it sure is convenient at 11:30 at night when you need to be 40 miles away from your current location.

HBD Drupal

Blog

Note to self: when you say happy birthday to a software product more often than you wish happy birthday to your family, either your priorities are wrong, or you're really really paranoid about your family's privacy.

Advice? Claim it's the latter and pat yourself on the back.

Ungrateful

Blog

An email came across the development list today (in the digest anyway), that, in a round about way, complained of the lack of instructions for some part of the system:

...
not only of external documention but of that oh-so-loved embedded in  
the code instructions for the image galleries settings --or should I  
say the NON-EXISTENT instructions.

There was another developer who started sending emails to the development list in a very aggressive manner, complaining that no one had instantly answered her questions, what kind of a support forum is this, she's not an idiot but she couldn't figure her problem out, why the hell isn't anyone answering questions, this product is crap.

Another organizer was at various developer meetups, talking about how great the project was, but it didn't have enough documentation. Someone needed to write documentation. Someone need to fix the bugs. Someone needed to help the new people. Someone should do it an do it now.

What is in common among the three of these people, aside from the fact they've complained about the project instead of (except for the first one) contributing to the project, is that they are all female. I'm not terribly sure why they're so aggressive in the community, it's entirely possible I'm just sensitive to the gender issue.

Personally, I find it annoying. I'm terribly less likely to help out someone who attacks what I'm working on as an introduction. I know I'm not the only one, either. A couple years ago at VA, when we were arranging desks and things, Mark commented to me he's more likely to seat Dom and Ariel in the good seats because they were very accomodating about seat preferences, versus some non-developers who were terribly insistent about where they "absolutely would not sit." I think Mark actually sat those people where they said they wouldn't sit. They sat there just fine.

Hey, so, check out my first contribution to the project. A better self-introduction to the development community than a rant or a you-should-do-this or a COMPLAINT about something being missing - do it yourself and stop complaining.

I crack myself up

Blog

Every since I had spent who-knows-how-long fighting with my original theme, I've been tempted to adjust my current theme regularly. I didn't until last month, and now I'm almost tempted to change them to match the upcoming holiday.

This one, for example, is so girly that I almost want to puke. Totally cracks me up! Ah, laughing about one's own website. The best!

Yay, CSS!

I'll probably leave this theme up until Valentine's Day, or until I actually do wretch from all the pink.

Pink! Mom tells me how, when I was a small person, I cried when she painted my room pink. I didn't want pink! Pink! PINK! PINK! The story cracks me up, because the first bedroom color I can be sure of is the white top, dark blue bottom colors of my room with the fan and the east facing window on Washington Street. Oooo! And the striped carpeting. And the Raggety Ann and Raggety Andy curtains!

I also slept in the front room at one point, but I can't tell you if the walls were green or grey or white or what.

Maybe if Mom logs in, she can tell me what colors those rooms were.

Yo! Gallery people!

Blog
Hi!

You're probably looking for my other site, which actually has some Drupal related stuff on it. I'll be writing up details of the whole PostNuke to Drupal conversion (including some of the pain Bharat went through with it), which is probably more of what you're interested in than my dogs, my ultimate game or my transistion from emacs to vi.

If you're a PostNuke person looking to transistion to Drupal, well, yeah, I'll get those details up, too.

You can contact me in the mean time, if you have specific Drupal/PostNuke/Gallery questions that I can answer.

I'm a night owl. Wanna see?

Blog
I think I'm a night owl. Actually, yeah, I am. Given that I hit my stride at 10pm, go to bed at 2am, and can't stand getting up before 10 am, I'd have to say yeah. And now I have the graphical proof to prove it!

At the bottom of the pages of Photo Matt, there's an image showing the post times on Matt's site.

Cool!

So, I searched for a bit to find the source to generate the image and the originator's site (Sanjay's Coding Tips - thanks, Sanjay!). Of course, the code is written for WordPress (i.e. not Drupal), so a little rewrite was needed. Well, that and installing GD. A couple hours and a bit of fudging later, and I now have a blog post time image. Whoo!

I haven't made the code robust enough for general consumption yet. If you want a copy, drop me a line and I'll send you the Drupal module.

Postnuke to Drupal Conversions: phpbb2.0 forums

Book page

Converting forums for phpbb2.0 to Drupal 4.5 forums. This is in a comment from http://drupal.org/node/12311.

# Forums
# Add the phpbb forum topics
#Replace XXX with the vid of the vocabularly you want to create, e.g., on a fresh drupal install, you can use "1" - otherwise, check your sequences table for the next available number
INSERT INTO vocabulary
VALUES (XXX, "Forum", "Topics for forums", "", 0, 1, 0, 1, "forum", -10);
# add the forum head topics by forum categories
#Replace YYY with the next available term data TID from your sequences table.
#For a fresh install, you can just delete "+ YYY". Replace XXX with the number you used above.
INSERT INTO term_data (tid, vid, name, description, weight)
SELECT cat_id + YYY, XXX, cat_title, cat_title, 0 FROM phpbb_categories;
#YYY same number as above or delete
INSERT INTO term_hierarchy (tid, parent)
SELECT cat_id + YYY, 0 FROM phpbb_categories;
# add the forum specific topics.
#Check your term_data table and find the highest TID number
#and replace ZZZ with a higher number.
#Use same XXX as above.
INSERT INTO term_data (tid, vid, name, description, weight)
SELECT forum_id + ZZZ, XXX, forum_name, forum_desc, 0 FROM phpbb_forums;
INSERT INTO term_hierarchy (tid, parent)
SELECT forum_id + ZZZ, cat_id + YYY FROM phpbb_forums;
#
# Create temporary tables for sorting topics and comments.
#
DROP TABLE IF EXISTS temp_posts;
CREATE TABLE temp_posts (
post_id mediumint(8) UNSIGNED NOT NULL auto_increment,
topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
poster_id mediumint(8) DEFAULT '0' NOT NULL,
post_time int(11) DEFAULT '0' NOT NULL,
post_edit_time int(11),
post_subject char(120),
post_text text,
PRIMARY KEY (post_id),
KEY forum_id (forum_id),
KEY topic_id (topic_id),
KEY poster_id (poster_id),
KEY post_time (post_time)
);
DROP TABLE IF EXISTS temp_node;
CREATE TABLE temp_node (
post_id mediumint(8) UNSIGNED NOT NULL auto_increment,
topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (post_id),
KEY topic_id (topic_id)
);
#
# Copy into temporary table topics without comments
#
INSERT INTO temp_node (post_id,topic_id)
SELECT MIN(post_id), topic_id
FROM phpbb_posts
GROUP BY topic_id;
INSERT INTO temp_posts (post_id, topic_id,forum_id,poster_id, post_time,post_edit_time,post_subject,post_text)
SELECT c.post_id, c.topic_id, a.forum_id, IF(a.poster_id='-1','0',a.poster_id), a.post_time, a.post_edit_time, REPLACE(b.post_subject, CONCAT(':',b.bbcode_uid),''), REPLACE(b.post_text, CONCAT(':',b.bbcode_uid),'')
FROM phpbb_posts AS a, phpbb_posts_text AS b, temp_node AS c
WHERE c.post_id=a.post_id AND c.post_id=b.post_id;
#
# Insert nid and tid from temp_posts into term_node
#
#check your node table and find the highest NID
#and replace WWW with a higher number.
#USe same ZZZ as above
INSERT INTO term_node (nid,tid)
SELECT WWW+topic_id,ZZZ+forum_id
FROM temp_posts;
ALTER TABLE term_node ORDER BY nid;
#
# Insert forum topics from temp_posts into node
#USe same WWW as above
INSERT INTO node (nid,type,title,uid,created,comment,body,changed)
SELECT WWW+topic_id,'forum',post_subject,poster_id,post_time,'2',post_text,IF(post_edit_time<>'NULL',post_edit_time,post_time)
FROM temp_posts;
ALTER TABLE node ORDER BY nid;
#
# Insert nid into forum
#Use same WWW and ZZZ as above
DELETE FROM forum;
INSERT INTO forum (nid,tid)
SELECT WWW+topic_id,ZZZ+forum_id
FROM temp_posts;
#
# Insert comments into comments for topics from temp_posts
#Use same WWW as above
INSERT INTO comments (nid,uid,subject,comment,hostname,timestamp,users)
SELECT WWW+a.topic_id,
CASE WHEN a.poster_id='-1' THEN '0' ELSE a.poster_id END,
REPLACE(c.post_subject, CONCAT(':',c.bbcode_uid),''),
REPLACE(c.post_text, CONCAT(':',c.bbcode_uid),''),
CONCAT_WS('.',CONV(SUBSTRING(a.poster_ip,1,2),16,10),CONV(SUBSTRING(a.poster_ip,3,2),16,10),CONV(SUBSTRING(a.poster_ip,5,2),16,10),CONV(SUBSTRING(a.poster_ip,7,2),16,10)),
a.post_time,'a:1:{i:0;i:0;}'
FROM phpbb_posts AS a LEFT JOIN temp_posts AS b ON a.post_id=b.post_id,phpbb_posts_text AS c
WHERE b.post_id IS NULL AND a.post_id=c.post_id;
ALTER TABLE comments ORDER BY cid;
UPDATE comments,node
SET comments.subject=IF(comments.subject='',CONCAT('Re:',node.title),comments.subject)
WHERE comments.nid=node.nid;
DROP TABLE IF EXISTS temp_posts;
DROP TABLE IF EXISTS temp_node;
#replace UUU with number higher than your highest current UID,
#or delete +UUU if this is fresh install
INSERT INTO users (uid+UUU,name,pass,mail,signature,timestamp,status,init,rid)
SELECT user_id,username,user_password,user_email,user_sig,IF(user_session_time='0',user_regdate,user_session_time),'1',user_email,'2'
FROM phpbb_users;
WHERE user_id>1
#replace WWW
INSERT INTO node_comment_statistics(
nid,
cid,
last_comment_timestamp,
last_comment_name,
last_comment_uid,
comment_count
)
SELECT
t.topic_id + WWW,
0,
t.topic_time,
p.username,
t.topic_poster,
t.topic_replies
FROM phpbb_topics t, users p
WHERE t.topic_poster = p.pn_uid;
#replace WWW
UPDATE node_comment_statistics n, phpbb_topics z SET
n.last_comment_timestamp = z.topic_last_post_id
WHERE n.nid = z.topic_id + WWW AND z.topic_last_post_id != 0;
UPDATE node_comment_statistics n, users z, phpbb_posts p SET
n.last_comment_name = z.username, n.last_comment_uid = z.uid
WHERE p.post_id = n.last_comment_timestamp and p.poster_id = z.uid;
UPDATE node_comment_statistics n, phpbb_posts p SET
n.last_comment_timestamp = p.post_time
WHERE p.post_id = n.last_comment_timestamp AND n.last_comment_timestamp != 0 ;
#
# Update Drupal variables
# This may not work and you ahve to update sequnces manually
SELECT @term_data_tid:=MAX(tid) FROM term_data;
SELECT @comments_cid:=MAX(cid) FROM comments;
SELECT @node_nid:=MAX(nid) FROM node WHERE type = 'forum';
SELECT @users_uid:=MAX(uid) FROM users;
UPDATE sequences SET id=@term_data_tid WHERE name='term_data_tid';
UPDATE sequences SET id=@comments_cid WHERE name = 'comments_cid';
UPDATE sequences SET id=@node_nid WHERE name = 'node_nid';
UPDATE sequences SET id=@users_uid WHERE name = 'users_uid';
#Now you have to install the Drupal BB code module AND the Drupal Quote Module, and you have to hack them:
#In the quote module replace function _quote_filter_process($text) with this:
function _quote_filter_process($text) {
// Quoting with or without specifying the source (code borrowed from bbcode.module)
// Thanks: function based on code from punbb.org
if (strpos($text, '[quote') !== false) {
$text = preg_replace('#\[quote=(?:"|"|\')?(.*?)["\']?(?:"|"|\')?\]#si', '
'.'\\1'." ".t("wrote:").'
', $text); $text = str_replace('[quote]', '
'.t("Quote:").'
', $text); $text = str_replace('[/quote]', '
', $text); $text = preg_replace('#\[quote:(.*?)=(?:"|"|\')?(.*?)["\']?(?:"|"|\')?\]#si', '
'.'\\2'." ".t("wrote:").'
', $text); $text = str_replace('[quote]', '
'.t("Quote:").'
', $text); $text = preg_replace('#\[/quote:(.*?)\]#', '
', $text); } return $text; } #In the BB code module, file bb-code-filter.inc, comment out the following lines: Quoting with or without specifying the source '#\[quote(?::\w+)?\](?:[\r\n])*(.*?)\[/quote(?::\w+)?\]#si' => '
'.$quote_text.':
\\1
', '#\[quote:(.*?)=(?:"|"|\')?(.*?)["\']?(?:"|"|\')?\](?:[\r\n])*(.*?)\[/quote(?::\w+)?\]#si' => '
'.$quote_user.':
\\2
',

Pages