Category Archives: Geek-Speak

Geeky spaces lie within — be careful where you step!

Of Transparency and CSS

Tonight’s fight has been with the basic CSS for the site, and the issue of transparency.

On the CSS front, the biggest fights were with the boxes displayed on MSIE versus Firefox. Firefox, as it happens, allows pre elements to “bleed” into other adjacent div containers, which meant that some of the code snippets with long lines bled over, but didn’t prevent the design from working.

MSIE, OTOH, didn’t handle this so gracefully, and resized the parent div to hold the wide pre, which prevented the design from working correctly, scrolling the menu to the bottom of the screen.

Once I finally figured out that that was working thataway, I then discovered that Firefox required a br clear=all before the close of the div container that holds both the content and menu containers. This one drove me nuts, but I finally figured it out, and have it working right.

So, on to transparency. Those of you who looked at the old site know I used MSIE’s features (unsupported by the rest of the browser community) for transparent backgrounds. I wanted to do that for Firefox, too, and began to research it. From what I could see, there were at least three cases to handle.

First was MSIE. I’d tackled that one before, so filter: alpha(opacity=80) made its way back into my CSS.

Mozilla (and, presumably Firefox) required something different for transparency though, so I added -moz-opacity:0.8 to handle those browsers.

And then there was CSS3, which theoretically supports transparency. For it, I added opacity: 0.8.

And, while Firefox performs well with transparency enabled, MSIE acts like a dog. Slow, slow, slow scrolls. I think I remember that the previous incarnation of this site, so I shouldn’t have been surprised.

So, I believe I’ll be keeping the transparency off the pages for a while. It wasn’t a critical design element in the new facelift anyway. And, it’s easy enough to add again, if desired!

New Stuff

This morning, I’ve completed a couple of changes to the deauxmayne.

First is randomly appearing images in the header space. I had those before, but I completed this morning some php code to call ImageMagick, and crop the thumbnail images generated from JAlbum. If you click them, you’ll get to see the original image, too. Enjoy.

Another improvement is getting the “today’s photos” piece working right. I finally got the perl code reworked into php, moved over the other night, and further augmented it so that it would display the number of images in that folder. This morning, I enhanced it further, to grab a random image from that folder and let it be the button for getting to the images in that folder, and used the crop code from the headers to make that happen. I know there are no titles for the folders; however, in most browsers, if you hover your cursor over the image, you’ll get the folder name and the number of images included in it.

Nice cranial exercise between last night and today!

Full Speed

One of the things that I notice — significantly! — is the difference in internet speed and reliability here at the house.

On the mountain, there’s really no high speed internet providers, and the phone system is archaic enough to make even dial-up more painful than it usually would be. Mom and Kevio invested in DirecWay, which is a two-way satellite-based internet service through Hughes. Slick system on paper, and is great for locations like hers, where there is no DSL or cable, and not likely to be for many, many years.

DirecWay worked well for a while, but has lately gone to going offline for a day at a time anytime it’s cloudy or rainy. The company says they aren’t responsible because “weather can adversely affect service”. The key here is that it didn’t used to.

Anyway, it’s been a forced fast from most things net-like over this week, and it’s nice to be wired again. I sure like the mountain, but I’d have to think about hard wiring something up the hill! 🙂

The Old Is New

$1.859

Tonight was a colossal excursion into the dark side of rewrite rules for Apache. And it’s all for you, the reader of my little blog.

Basically, the deal was this. When I converted from MovableType to WordPress, all the old links to material went missing, replaced by WP’s. This was primarily of concern for individual entries and monthly archives. This also meant that all the indexing that Yahoo had done was now busted. I’d waited a long time for one of the search engines to pick me up, so I didn’t want to break everything that was out there!

I started searching for ways to make WP see the old MT entry numbers. I tried changing the MySQL entry numbers, and that didn’t work very well — I kept getting php errors in the scripts. After doing a lot of looking, I decided a RewriteMap was probably my best bet. I only have about 275 entries that needed rewriting, so the rewrite file couldn’t be too hard to generate. And it wasn’t.

The challenge was with the RewriteRule. I’d never played with these before, and have a much better understanding of them now than I did, but I was surprised at the dearth of information on the RewriteMap piece of that. Everyone mentioned the RewriteMap part, but integrating that into the RewriteRule wasn’t well documented. Even my oracle of knowledge, O’Reilly books (in this case, Apache, The Definitive Guide), failed me, only containing about two pages of info. Wainwright’s Professional Apache didn’t help much either. However, between those two books from my bookshelf, and a bunch of searching for examples on Yahoo, I finally ended up with the correct syntax. Here’s what it all looks like.

For the VirtualHost for the blog in Apache’s httpd.conf, I added:

RewriteMap mt-to-wp txt:/www/apache/current/htdocs/wordpress/mt-to-wp-map.txt

This pointed to my map file that cross referenced the old MT entry ids to those used by WP after its import. Part of that file looks like this:

000001 002 # Dinner
000002 003 # What would you do with $300M?
000003 004 # Road Trip!

The comments for each entry are unneccesary, and were leftover from the way I created the original list of entries. I started by grabbing the archives.html file from the old MT installation. This had a list of all the entries I had at the point I cutover to WP. I stripped the HTML out of it, did some creative search and replaces, and wound up with a file that had the old MT entry number, a pound sign, and the original entry title.

Then the tedious part. I used mysqlcc to examine the database table, and typed the number that WP assigned that entry. About 20 minutes of work — not bad, and I’m sure there are better (read: programmatic) ways of matching up the entry titles between the flat file and the MySQL database, but there were so few lines to fool with, I figured I could type faster than code it. 🙂

The last piece was the RewriteRule to make it go. In the .htaccess file in the WP directory, I added:

RewriteRule ^archives/([0-9]{6}).html$ /index.php?p=${mt-to-wp:$1} [R,L]

This rule forces anything that looks like an old MT URL to be translated to a WP-centric URL.

That got me past the individual entries. What about the monthly archives? After all, they’re out in the web indexes, too. That chore was easier.

I went to Options/Permalinks as the admin, and told it I wanted links that looked like the old MT archives:

/archives/%year%_%month%.html

The interface will then create the RewriteRules necessary to handle MT-oriented URLs that come in, and make them WP-centric. Don’t save the new permalink structure, however! Simply added that to the same .htaccess file I mentioned above is sufficient to let the WP pages work correctly, and allow the old indexed URLs from MT also work.

Cool, huh?

So, I think it all works now, and I can turn my eye toward design and enhancements. Watch this space!

(BTW, it still appears that Google refuses to index my sites, despite repeatedly submitting them. I guess they are very concerned that since few — if any! — other sites have linked to mine, the information here must not be worthy of indexing. Yahoo, OTOH, has taken the high road, and indexes me all the time. It’s fun to watch. 🙂 )

The LAMP is Lit!

While in San Francisco for eWorld, I bumped into an acronym I’d not heard before — LAMP. Linux, Apache, MySQL, PHP. Of course, I’d known conceptually of that combination, but I’d never actually seen it “bundled” like that. In fact, there were even books touting the advantages of that combination. I’ve known this for a while, but haven’t had the time I thought necessary to pull off a complete migration over to a LAMP environment.

I had the Linux piece nailed, having run SuSE for a couple of years. Apache was old hat, using it at home at work for years. No database, however, aside from that which MovableType was employing, was harmed during the creation and support of my site. And perl. Yes, there was perl, and a bunch of it, even outside of MT’s use.

Today, though, I was able to change the “P” in my LAMP from perl to PHP, and insert an “M” with MySQL. It’s a cool combination, and once I took the time to RTFM, it was fairly straightforward to set up. Tomorrow, I’ll post the details of my journey.

The challenge ahead is to convert so much perl code to PHP. I’ve never coded anything in PHP, so I’m sure that will be an adventure!

Stay tuned, and avoid the dust.

Hello world!

This is the first post in the new WordPress enabled view of Phydeaux’ Deauxmayne.

The old content is still here, although it’s formatted differently, and some of the “features” don’t work yet — gas prices, photos of the day, etc.

If you have the genealogy site bookmarked, it will still work. Otherwise, you can hit it here. I suspect that leaving comments will no longer work on that site though, as it has not been converted to WP yet.

What follows are the installation notes I made as I created this new WordPress site!

The first thing I did was download, gunzip, untar WordPress 1.2, and looked at the readme.html file. When I checked the System Recommendations:

  • PHP version 4.1 or higher:

    mail:/home/colin/wordpress # php --version
    PHP 4.3.3 (cgi) (built: Sep 24 2003 00:41:05)
    Copyright (c) 1997-2003 The PHP Group
    Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

  • MySQL version 3.23.23 or higher:

    mail:/home/colin/wordpress # mysql --version
    mysql  Ver 12.21 Distrib 4.0.15, for suse-linux (i686)

  • a link to http://wordpress.org on my site…. I’ll handle this one later! 🙂

Looks like prereqs are met.

I starting looking at wp-config-sample.php for the appropriate database connection detail changes…. and realized I’ve never used MySQL on my server. I’m not really a database guy, so it never ocurred to me to get it working.

I had already selected installation of PHP and MySQL when I installed SuSE 9 Pro, so I figured I was most of the way there. I got my O’Reilly MySQL & mSQL book off the shelf and started poking around.

However, MySQL wasn’t running:

colin@mail:~/wordpress> mysqladmin status
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

Did some Google searches, and found http://www.novell.com/coolsolutions/nnlsmag/features/a_amp_linux_nls.html which inspired me to look in YaST to get MySQL running, and get it in the boot sequence of the server. (More good info on this and other topics is at http://www.topology.org/linux/mysql.html)

Opened YaST. Clicked “System” (on left). Clicked “Runlevel Editor” (on right). Clicked “Expert Mode” (top). Scrolled, and selected “mysql”. Clicked “Set/Reset” dropdown (lower-right), chose “Enable the Service”. (This picked the right runlevels for me.) Clicked “Start/Stop/Refresh” dropdown (lower-left), chose “Start now”. Got a popup with the following info:

/etc/init.d/mysql start returned 0 (success):
Creating MySQL privilege database and starting MySQL...
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
040707  8:24:57  /usr/sbin/mysqld: Shutdown Complete

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! This is done with: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h mail password 'new-password' See the manual for more instructions.
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory: cd sql-bench ; perl run-all-tests
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
..done

Clicked “Finish” (lower-right).

And it appears that it was running now:

colin@mail:~/wordpress> mysqladmin status
Uptime: 23  Threads: 1  Questions: 2  Slow queries: 0  Opens: 6  Flush tables: 1  Open tables: 0  Queries per second avg: 0.087

Per the popup (and a copy of MySQL & mSQL from O’Reilly), I changed the root password for MySQL with:

/usr/bin/mysqladmin -u root password 'new-password'

I was now ready to continue the 5-minute install from the readme.html file in the WordPress distro.

I made the changes (as best as I could guess them) for the MySQL settings, saved, and tried to launch the install.php page. It appears, however, that I don’t have Apache set up to serve php pages. Blecch.

Decided to upgrade to Apache 2.0.50 from 2.0.48 — I needed to do this anyway. So…

(Good info for apache+php at http://php.us.themoes.org/manual/en/installapache2.php)

Downloaded, gunzipped, untarred.

./configure --prefix=/www/apache/2.0.50 --with-port=81 --enable-mods-shared=all
make
make install

Decided to create custom configged php, so downloaded 4.3.7

./configure --with-apxs2=/www/apache/current/bin/apxs --with-mysql
make
make install
cp php.ini-dist /usr/local/lib/php.ini

Modified httpd.conf (per themoes.org) — LoadModule for php4_module was already there. Added AddType for php, phtml, phps.

Put simple test script in htdocs. Restarted apache. Hit test script — it worked!!!!

Moved all Apache custom configuration items from 2.0.48 to 2.0.50’s httpd.conf. Restarted…. success!

So, theoretically, I now have MySQL, Apache 2.0.50 and PHP 4.3.7 running alongside my existing MovableType installation and other server things I run.

I hit the install.php script, and it responded…. but I didn’t have the database stuff set up. I used MySQLCC to create the database and user, and aligned them with the info I put in wp-config.php.

I hit the install.php script again, and got a pretty WordPress welcome screen! I let the pages lead me through the configuration. I had to change the web address of the installation, as it was defaulting to the localhost name, rather than the public name.

Next, I changed where the public name was pointing (away from the MT install, and to the WP install). I also had to add index.php to my DirectoryIndex line in httpd.conf.

Phydeaux’ Deauxmayne was now live on WordPress!

All together, about three hours work (off and on) to get to this point. The biggest boggles were solved by getting clean Apache and PHP installations, and by actually creating the database before trying to hit it! 🙂

Bye-Bye IE

Today, I kissed off Internet Explorer.

In reading some of the crazy shenanigans lately with IIS servers (which, BTW, I don’t run), and the ability to infect every machine on the net running IE quietly and silently, I decided it was time for a change to the browser on our desktops here at the ol’ Wright Computing Farm.

I’d seen a good bit about Opera, but it’s ad-based, unless a fee is paid, and I didn’t like that answer. Truthfully, all I needed was a browser, not a mail and news reader, and that eliminated Netscape and Mozilla. That brought me to Mozilla’s little brother, Firefox.

It’s quick, was easy to install and integrate, and it was free! Functionally, it works well, and it solves one major annoyance I had with IE: the inability to use the center mouse button. It’s crazy. I have a Microsoft Bluetooth Intellimouse that I shelled out big money for, and IE can’t even figure out how to use the center button (other than the scroller function). With Firefox, the middle button is used like in every other decent *nix browser, and opens up a new tab with the site you center-clicked on. Very, very cool!

Now, the downside is that my sites don’t show up quite right with it. I’ve done a lot of IE hijinks, and while the sites look great on IE, they reek on many other browsers. Time to kick the MS specific, non-standard stuff to the curb, and bring my sites back to standards.

To that end, I now have a WinXP test suite of Netscape, Mozilla, Opera and Firefox… and yes, even IE. On Linux, I’ll be testing with Mozilla (1.4 and 1.7), Opera and Epiphany. I’ll probably add more before it’s all said and done, but at least that’s a start.

As for me and mine, it’s Firefox.

Power Down

Last night, the basement took a power hit, and the server went down — guess the UPS wasn’t up to holding power long enough! Unfortunately, that also meant the router and cablemodem died, too. When I got back today, I found them half-awake, and not doing very well. Everything seems to be working now, and that’s good news.

It’s so very nice to be home! This trip, despite being short and generally enjoyable, seemed so long. Something about travelling at the whim of a gaggle of six folks, I suppose. Perhaps I’m more of a control freak than I thought!

Upgrades, Upgrades

I’ve spent most of the night getting the Toshiba laptop up and working with Windows XP Professional. It came preloaded with the Home edition, and I’d been wanting to use the Windows UNIX tools, but they required XP Pro to run. I figured I’d be in for a short path of upgrading.

I was wrong.

I had to re-install and reconfigure all kinds of things — my Microsoft Bluetooth mouse, my wireless network card and my regular network card… waaaaay much work to get it all working again, but it does appear to be functional, and finally doing what it’s supposed to be doing.

Now, perl and all the rest of the UNIX stuff is available on the laptop — cool, cool, cool!

Tomorrow is the Brew Crew trip to Chicago……

Downtime

$1.779

Sorry for the downtime — I bought a new, larger case from someone at work, and began working to move the guts of the server into this new case last night. As I began this work, though, I had a significant interruption. More on that later.

Why a new case? Well, I had a temperature problem in the little server case, and that caused my CPU temperature to run around 40C under heavy load, which is hotter than I like. In fairness, it was running around 34C at idle.

This new case, aside from being larger, and allowing for more air movement, also has seven fans in it. Now, at idle, the server runs at 28C, with the ambient temperature inside the box at 24C. Very cool! (literally!)

The interruption I mentioned earlier? Beck’s grandmother, Agnes, died in Texas yesterday. Like the recently passed President, she was also 93. Right now, I think the plans are for services in Texas on Thursday. As you might expect, Beck was really torn up last night. I believe this is the last of her grandparents left living, and I’m sure that’s a tough thing to deal with.