Blogs
Updating Drupal via command line
Update: My extra steps are not necessary if you put your 3rd party themes and modules under sites/all/. Makes updating a lot simpler.
Just updated Drupal to 6.13.
I'm really hating the process of updating. It should be simple and straight forward, but no. I have to piece together suggestions from several articles, user comments, etc.
Probably the best solution is the one on this page:
http://drupal.org/node/297496
At least it gives "ok" step by step instructions, but missed a few crucial things.
1. It seems to ignore that you probably have 3rd party modules.
2. It seems to ignore that you are probably using a different theme than the default.
So the solution seems to be to change step 3 to:
mv CHANGELOG.txt COPYRIGHT.txt cron.php includes index.php INSTALL.mysql.txt INSTALL.pgsql.txt install.php INSTALL.txt LICENSE.txt MAINTAINERS.txt misc profiles scripts update.php UPGRADE.txt xmlrpc.php d-backup
So you're effectively leaving the modules and themes folders there.
In step 7, when you move the new files into place, you'll need to merge the old module and theme files with the updated ones.
mv CHANGELOG.txt COPYRIGHT.txt cron.php includes index.php INSTALL.mysql.txt INSTALL.pgsql.txt install.php INSTALL.txt LICENSE.txt MAINTAINERS.txt misc profiles scripts update.php UPGRADE.txt xmlrpc.php ../
cp -rf modules themes ../
And viola! follow the rest of the steps and you should be back in business.
Also, to avoid any potential surprises, if there are module updates available, download and extract those straight into your modules and/or themes folder. That way modules that are incompatible with newer versions of Drupal don't get disabled.
ZF Contributor
Yay, I'm now a Zend Framework contributor! I mean, I've now been accepted to become a Zend Framework contributor! Now I just need to find something to contribute...
MySQL's JOIN USING syntax
Orignally posted 2008-05-14 on my old Joomla site.
Just thought I might share a neat little join syntax that I came across recently.
Say you have two tables: orders and users
What I've seen a lot of people write a SELECT statement like this:
SELECT *
FROM order, users
WHERE order.user_id = users.user_id
AND user_id = 1;
Well, that's all fine and dandy, but I like to keep my where statements clean and only be related to actual select criteria. So lets use an explicit join:
SELECT *
FROM users
JOIN orders ON (orders.user_id = users.user_id)
WHERE users.user_id = 1;
It's a little cleaner and easier to read (IMO), but we still have a problem. In the result set, we end up with duplicate columns for the user_id. This means that we need to explicitly state which user_id column to operate on in the WHERE clause. On top of that, since database rows are often returned to a programming environment in the form of a hash/array, duplicate column names overwrite each other. For quite a while now, I've wished there was a "SELECT * EXCEPT column" syntax, but since we don't, we have to explicitly state all the columns we want to include. That's no fun. Well, there's a nice little join syntax that PostgreSQL and MySQL has implemented:
SELECT *
FROM users
JOIN orders USING (user_id)
WHERE user_id = 1;
Woot! Nice, clean, readable SQL. No duplicate columns, and the where clause doesn't have to explicitly state which user_id column to use, as the USING statement merges the columns together. It's kind of like an explicitly stated NATURAL JOIN.
Obviously this doesn't work for all queries, but it's a handy shortcut for small queries joining a couple of tables, and especially with lookup tables.
NOTE: This only works with MySQL, so if you want your queries to be cross-db compatible, you'll want to avoid this syntax.
How Google Reader helps me waste time more efficiently.
When I first learned about RSS, I never really thought it would take off or be of any real practical use. Sure it sounded good in theory, but I kind of just tossed it off to the side thinking it would be a fad that would just fade away... I thought the same about micro-blogging too, so maybe there's a pattern emerging.
Anywho, me brother, Brent is a big fan of Google Reader, so I tried it out. Cool, I thought. And then left it to die a quick quiet death as the Internet moved on to bigger and better things...
Scroll forward a year or so, and I find myself checking a whole bunch of blogs and "planet" sites like http://planet.ubuntu.com and http://www.planet-php.net. Even though it occured to me that the planet sites are based on RSS feeds, it still didn't make me think "Ah... now I see how this can be useful....". So every morning, I'd open up about 10 tabs for ascher.ca/blog, ejohn.org, planet-php.net, planet.ubuntu.com, slashdot.org, tomshardware.com, blog.jquery.com, and checking for updates for software that I use (drupal, redmine, virtualbox, mysql-workbench), and then going through the ritual several times a day... (yes, I'm a procrastinator). I finally got fed up and thought, "There has to be a better way of doing this... what if there was some central place that can keep tabs on changes to blogs and news sites. That way I don't have to open up all these sites every time I want to see if there's something new... oh... " And so yes, I went back to that thing that I left for dead oh so long ago.
So now instead of going to a gazillion sites to waste my time, I go to one. I finish reading all the news within a couple of minutes, and then I'm done... Gee, that was quick... a little too quick... Refresh... oh look, more to read... Refresh... oh look, more to read... Refresh... oh look, more to read...
April Fools
It's that time of the year again, when you no longer can trust the news... oh wait, I guess you could never trust the news... Anyway, here's a list of some April Fool's jokes that I've come across this time around:
Opera Facial Recognition
http://labs.opera.com/news/2009/04/01/
Google CADIE
http://www.google.com/intl/en/landing/cadie/index.html
http://www.google.com/intl/en/landing/chrome/cadie/
http://mail.google.com/mail/help/autopilot/index.html
Read your email in Metacity
http://blogs.gnome.org/metacity/2009/04/01/squib-of-the-day-read-your-em...
Even CNN got in on the action:
http://www.cnn.com.news.donedev.com/Chiptune-composer-to-lead-Astral-Mus...
Those of you who listen in on the Bazaar dev list would find this one funny.
http://www.python.org/dev/peps/pep-0401/
PHP on Rails Framework:
http://phails.com/
Enjoy!
Tortillas
Figured it's about time I added something here. Was going to write about my last attempt to make mozzarella, but I'll go with my home made tortillas instead. And no, it has nothing to do with the cheese turning into a block of rubber that looked suspiciously like a brain. Yeah, I'll post pictures later...
Anywho, found a recipe for tortillas in Ruthie's recipe folder.
5 cups of flour
2 tsp Baking Powder
Pinch of salt
2 tbs of shortening
1.5 cups of boiling water
No idea why it called for boiling water, and I don't like the idea of using trans-fats in my food, so shortening was replaced with canola oil. I've tried before with olive oil, but I found it gave it a slightly bitter taste. Certainly healthier, but in this case I sacrificed health for flavour. Anyway, mix it all together and kneed the dough until it's smooth and elastic. The dough I made felt maybe a little too dry, and could have included more water, but I decided to use it anyway. Form the dough into a round ball, coat it with oil, then let it stand covered for 10 minutes. Then form little golf-ball sized balls of dough and roll out your tortillas to your desired thickness. That's the hard part. It would probably help if my work bench was flat and my rolling pin a bit heavier, but oh well.
Then cook the other stuff that's going to go into your tacos, fajitas, whatever, and then about 15 minutes before you're about to eat, cook the tortillas on a frying pan on medium-ish for 30 seconds on each side. The more you cook, the crispier, the less you cook, the softer, duh. You should be able to make 20-30 tortillas. The recipe says 60, but I think somebody should tell the author they're dreaming...
Photos to come later... (once I figure out how to work with photos and Drupal)
The David Files Lives Again
What happened to my old site? Spam. That's what happened. Not your juicy pork variety.... the other kind. My old site was running on Joomla, and I had a comment module installed so people could leave comments on my many... er... couple of posts I had up on the site for the past two years. A month or two ago, I started getting comment spam. Yes, I had a CAPTCHA, but we should all know by now that they're pretty useless. At first I'd get about 6 per week. Nothing too hard to manage. Then I started getting more. 7-8 per day. And then the past couple of days, about 30. The annoying part was that I had removed the comment block from all the pages that were using them, but the spam kept coming in. Yeah, the comment system would actually accept comments for non-existing content. (it would show up with content id = 0) And then I started noticing some spam being sent via the contact form. So. I figured, it's time to start over. Move over Joomla, come over Drupal. Why Drupal? Basically because it pretty much does everything I want out of the box. Why not Wordpress or some other blog system? Because I want to learn Drupal so I can use it more effectively for work. So.. wait... did I just say blog? Me? Blog??? Never! Hmm.. but then I basically was blogging before the term existed... mind you, I was doing it in the form of regular emails. So what am I going to blog about? Anything and everything. Basically, it may or may not cover any of the following topics: Politics, Religion, Sex... the more controversial the better! Ok, maybe not so much those topics. Probably more along the lines of: PHP, Javascript, MySQL, CSS, Web Development... and to make sure it's not too IT oriented, Food. Yes, Food. I've gotten into this home-made food craze, so I'll probably write about making bread, desserts, cheese, pasta, etc. Maybe.. we'll see.
So welcome to the new David Files!

