DrupalCamp NJ

I haven’t blogged in a couple of weeks, so I thought I’d throw a quick post up. I’ve been busy with some personal stuff, listing my parents’ old house with a new real estate agent and lowering the price. I did some cleaning too, but there’s still a lot I could do to make the place look nicer and hopefully more attractive to potential buyers. We’ll see how much of that I manage to get done.

I’m still working on learning Drupal. I’ve worked my way through most of the Drupal 7 book that I started a couple of weeks ago. I want to finish that, and then maybe start into learning module development. And I just registered for DrupalCamp NJ, on Feb 4, at Princeton. That should be interesting.

1&1 Linux

In anticipation of installing Drupal on my 1&1 account soon, I went into my control panel and poked around a bit. First, I found that my account was set to use PHP 4. It was pretty easy to switch it to PHP 5. A call to phpinfo() shows that I’m now at 5.2.17. That’s not quite up to date, but it’s probably close enough.
I also looked into the MySQL setup. Several years ago, I set up a MySQL database on my account. That database is still there, at MySQL 4, with a 100 MB limit. Just for the heck of it, I created a new database. The new one is MySQL 5, and has a 1 GB limit. So, that’s nice. (There doesn’t seem to be any way to upgrade the old MySQL 4 db to MySQL 5, but that’s fine, since it’s empty.)
I even went as far as uploading the Drupal 7 tar.gz file today, but the 1&1 web file browser can’t unzip tar.gz files, so I’m going to need to get to a command prompt to do that, and it’s a little late to get into that tonight.

Drupal 7

This is one of the books I bought in ebook format from Packt last week. It’s a beginner/intermediate level book on Drupal 7, covering installation, configuration, and administration. It covers all of the basics (as far as I can tell) along with some of the more interesting parts. I’m about halfway through it. I find that I’m skimming over parts of it, since some aspects of Drupal are pretty obvious, if you’ve ever used a CMS before.
The formatting of the epub file, which I’m reading on my iPad, leaves a bit to be desired. I’m pretty sure that some special characters were lost in translation somewhere. There are a lot of places where there should probably have been an em-dash, and there is no em-dash, for instance. And I just came across a table that got screwed up so the text that should have been in the second column is instead just superimposed over the text that should have been in the first column. (The PDF file for the book looks fine though.)
I think I’ve been spoiled by O’Reilly’s ebooks. They generally have accurate and reasonable formatting for their PDF, epub, and mobi files.

messing around with the blog a bit

I just spent a little time cleaning up the files on my 1&1 account, moving anything that I think might be referenced by the blog into a ./blogfiles folder, then changing my files.andrewhuey.com address to point there, instead of at the root. I think it worked out OK.
I now have nothing pointing at the root, which frees me up a bit to experiment with setting up different sites in different subdirectories, and not having to worry about them being accessible in unexpected ways. For instance, I’m probably going to be setting up a test Drupal site soon.  I can put it in a ./drupal folder, and set drupal.andrewhuey.com to point there.

Happy New Year

I went to bed at 11pm last night, and got up at 6:30 today, so I can’t say I had a wild & crazy New Year’s Eve. That’s OK though.
Early in the year, I often find a few things that I’ve been putting off for too long, and try to take care of them. This morning’s project has been getting redirects in place on this web site, so that links to my old blog entries, from back when I was using Blogger’s old FTP publishing, to andrewhuey.org, will do 301 redirects to the appropriate pages at blog.andrewhuey.com, where the pages are now dynamically generated by Blogger.
I switched from FTP to “custom domain” back in Feb 2010, so I’ve put off the redirect stuff for long enough that it probably doesn’t matter anymore. But it seems like a good idea anyway.
I don’t know that much about .htaccess files and ModRewrite, but I know just enough to be dangerous. I picked up some hints on what I need to do here and here.
The part of my .htaccess file that handles redirection now looks like this:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST}   !^files.andrewhuey.com [NC]
RewriteRule (.*) http://blog.andrewhuey.com/$1 [R=301,L]

I use files.andrewhuey.com to reference various files on my web server. Everything else should just get redirected to blog.andrewhuey.com. So, pretty simple.

Drupal 7 clean URLs

I have today off from work, so I’ve been sitting around at home, messing with Drupal.
I couldn’t quite figure out how to get clean URLs to work, until I stumbled across this article. (See the “post-installation tips” section at the end.) Pretty simple really, and I should have been able to figure it out on my own, if I’d read as far as the RewriteBase section of the main clean URLs article on drupal.org.

I also went a bit nuts at www.packtpub.com today. They are running a special, 5 ebooks for $60, so I bought four Drupal books and one PHP book. I’m building up a bit of a library of ebooks that I’ve bought on sale, mostly from O’Reilly.  I never seem to have time to read them though!

Drupal 7

After staying out too late Tuesday night, then going to bed at 8:30pm last night, I finally had some free time after work tonight to play around with Drupal. I installed Drupal 7 on my MacBook, following these instructions. The only real trouble I had was in making sure that every host reference was set to 127.0.0.1 rather than localhost, or anything else.

Most of the obvious stuff seems to be working.  I haven’t figured out clean URLs yet though.

xAMP on the Mac

I’ve been trying to learn a bit about Drupal recently. It looks like we might be getting some Drupal projects at work, so it seemed like a good idea.

To get a working setup for Drupal on my Mac, I wanted to get all the pieces in place — Apache, PHP, and MySQL, basically. Apache is, of course, already there, and I already had that turned on, so no problem.

PHP was already installed, but apparently got turned off during the 10.7 upgrade. All you need to do to turn it on is edit httpd.conf, and uncomment one line, per this SO page.

For MySQL, there’s an installer that works pretty smoothly, per this page. One odd thing I stumbled across at one point is that you usually need to refer to your local server as ‘127.0.0.1’ rather than ‘localhost’. Long story, but something worth noting. Also, if you’re not sure how to set the root password, take a look at this SO page.

I tested to make sure that MySQL was working from PHP using this little test script:

<?php

$db = mysql_connect("127.0.0.1:3306", "root", "password");

if (!$db) {
    die('Could not connect' . mysql_error());
}
    echo 'Connected successfully';
?>

I can’t remember exactly where I found that, but it’s a pretty basic script.

I then got a little ambitious and decided to try to get phpMyAdmin working. I made a couple of simple mistakes here, including not quite understanding that config.inc.php needed to be in the root phpMyAdmin folder and not in the config subfolder.

Also, the warning from phpMyAdmin about mcrypt not being installed was bugging me, so I decided to try and fix that. That turned out to be kind of complicated. I followed these instructions, and they worked, but only on my second try. I must have gotten something wrong on the first try. Also, I found another page with similar instructions, so referencing that may help if anything on the first page seems confusing.

In the end, I think I really should have just gone with MAMP, but of course I was doing this as a learning exercise, so it was valuable to go through all this, even if it took a lot longer than was probably necessary.

And I still don’t have Drupal installed. Maybe tomorrow!

digital comics

I just spend $38 on $76 worth of digital comics from Dark Horse.  I had a 50% off coupon, good even on stuff that was already on sale. I now have nearly all the Hellboy and BPRD comics that came out since i stopped buying them regularly in 2009. Plus the first 16 issues of The Goon, which I’ve wanted to read, but never got around to buying. A little over 50 comics total.  Digital comics never seem worthwhile to me when they’re priced at close to the regular print cover price, but for less than $1 each, they’re not a bad deal.

fun with modal popups

At work, we frequently use the ModalPopupExtender from the Ajax Control Toolkit in our projects. I’ve got mixed feelings about this control, and about the ACT in general, but for better or worse, I do use it a lot. I discovered some functionality in the control this week that I was previously unaware of, so I thought I’d write up a blog entry on it, along with some related stuff that I stumbled across.

I needed to attach some JavaScript to the show and hide events for the popup, but wasn’t sure how to do that. It turns out that there are add_shown() and add_hiding() events that you can hook into, as described here. I initially found out about add_shown() at this StackOverflow page.

I then tried to hook up the event in the pageLoad() routine as shown in an example there. What I didn’t realize was that you can only have one pageLoad() function, and there was another one in a master page that was in my hierarchy, so my version didn’t get called. I then found out that I should change both of those to use Sys.Application.add_load() via this SO page.

Then, I followed up by learning a bit about the differences between pageLoad() and $(document).ready() at Encosia, which is one of the best sites out there for figuring out some of the trickier stuff when working with ASP.NET and JavaScript.

P.S. I just noticed that this is post # 1500 on my blog. There’s no real importance to that, but it’s always nice to hit a milestone.