Things HTML is not designed to do.

Here is yet another day in the IT biz where I have lost 4 hours trying to accomplish something that would seem very simple but turns out not do be, due to a shortcoming in how HTML works. I am working on a project where I had text in two different sizes and I needed to vertically align the top of the text in the two different font sizes.

Easy you say? You have seen it all the time. Odds are, when you see text in different font sizes aligned like that, What you are looking at is a graphic, not actual text. Or if it is actual text, as you scale the text larger or smaller the alignment breaks.

Here is the text as it normally shows up. That is aligned to the baseline, or the bottom of most letters in a font. This is the same as specifying align-text: baseline in css. I selected the text with the mouse and the highlight around the text shows us several things. Each letter has several attributes to it. The baseline, the standard height of the letter, which is where the top of the letter L goes to. There is also the descenders, where the bottom of the letter g goes to. In addition to that there is leading (or blank space) above the the top of the letters and descending bellow the bottom of the letters. That leading is a different size depending on the size of the font.

Here we are using the css vertial-align: bottom. The bottom of both fonts, where the leading ends below the font are lined up. Because the text in the smaller size has less leading, it shows up vertically aligned lower then the text in the larger font face which has more leading.

Here we are using the css vertial-align: top. The top of both fonts, where the leading ends above the font are lined up. Because the text in the smaller size has less leading, it shows up vertically aligned higher then the text in the larger font face which has more leading.

Here is a page at w3org which shows a graphic and text in two different sizes. Notice that it very easy to align text so the baselines are the same. What you will not find here is an example where the top of the letters in the fonts in different sizes are aligned.

I tried dozens of different ways to fix this. A table with each word in a different cell is no good. You still align to the top of the leading, not the tops of the letters. I found out I needed to wrap the word I want to change the location of with a <span></span> tag. I kept going back to the reference material on vertial-align. You can raise or lower the vertical alignment by percent. Positive numbers moves the text up, negative numbers move the text down. You can specify the number in pixels, percents and EMs.

If use pixels so that we can bump the text up 5 or 6 points lets say. When we zoom the page in the browser it may or may not look right. Different browsers handle that different ways. Usually in situations like this using the em is a good measurement. Since it is based on the size of the font. For the text I am working with here. .3em moves the text up from the baseline enough to make it look right.

The paragraph had the font size set to the larger text at 56 points. Here we are with the text properly aligned. the HTML for this looks like:

<span style="vertical-align: .3em;font-size: 36px;">GO</span>DEEP


x2engine on shared hosting without PDO

I have a friend who was interested in playing with a web based CRM (Contact Relational Management) on their own shared hosting webserver. I looked around and eventually arrived at x2engine. The x2engine is built on top of the YiiFramework and only requires MySQL 5 and PHP 5.1 or greater. Since he had PHP 5.2 I thought we would be all set.

I uploaded the x2engine.zip file via my friends cpanel page and installed it into his /public_html folder. Created MySQL databse via phpMyAdmin. vistited the /x2engine folder with my webbrowser and put in my database information and then got this error

include(PDO.php) [function.include]: failed to open stream: No such file or directory

The good news is it takes less than 5 minutes to fix this error. I found the solution in less than 30 minutes of Googling. However it took me almost 6 additional hours to figure out what to do. So in hopes of saving someone else this kind of grief let me explain How to install x2engine or any other YiiFramework on a shared hosting service that has disabled PDO.,

It turns out PHP 5.1 introduces something called PDO (PHP Datatbase Objects). Many hosting servies that provide shared hosting disable PDO where it is not possible to enable it. As it turns out there is a workaround for this called PHPPDO, which is a php library that provides a PHPPDO emulation layer. My problem was that I tried to install the PHPPDO library right from their SourceForge page. It turns out there is a YiiFramework extension that will plug right in to any YiiFramework based app such as x2engine.

In the case of the x2engine you have to visit the webpage and set up the database information for it to create the config/dbConfig.php. The YiiFramework says the file will be config/main.php but the x2enigne uses config/dbConfig.php.

The YiiFramework page for PHPPDO is found at http://www.yiiframework.com/extension/phppdo/ On the right hand side of the page under the search bar it says Downloads and there you will find a link to phppdoextension_1.4.tar.bz2 which links to http://www.yiiframework.com/extension/phppdo/files/phppdoextension_1.4.tar.bz2

Once you have that file in hand here is what you need to do. All of this can be done from cPanel. I will act like your website is at http://example.com

  1. Create your mysql database and user/password for accessing the database with phpMyAdmin.
  2. Upload the x2enginge.zip file to your /public_html folder then extract the x2engine.zip and you will end up with /public_html/x2engine.
  3. Vistit http://example.com/x2engine and fill out you admin user password, admin user email address and the information from step 1 for your MySQL server. When done click on the button at the bottom of the page to create the config files. This includes /public_html/x2engine/protected/config/dbConfig.php.
  4. Upload phppdoextension_1.4.tar.bz2 to the /public_html/x2engine/protected/extensions folder. Extract the phppdoexentsion_1.4.tar.bz2 file.
  5. Edit the file /public_html/x2engine/protected/config/dbConfig.php and insert after the $db=array( the following two line 'class'=>'application.extensions.PHPPDO.CPdoDbConnection', 'pdoClass' => 'PHPPDO', and save the file
  6. Visit the page http://example.com/x2engine which will now work.
The dbConfig.php file will look pretty much like this, mind you, the connection information will be specific to your site:

'class'=--> 'application.extensions.PHPPDO.CPdoDbConnection',
'pdoClass' => 'PHPPDO',
'connectionString' => 'mysql:host=localhost;dbname=database',
'emulatePrepare' => true,
'username' => 'username',
'password' => 'password',
'charset' => 'utf8',
// If removed, Gii defaults to localhost only. Edit carefully to taste.


Ubuntu is a failure

Ubuntu is a failure

You might say, "Hey, Eldergeek. Ubuntu is the most popular Linux distribution out there, how can it possibly be a failure?" Just bare with me and allow me to explain my position. By their own admission, Ubuntu creates initiatives to make Ubuntu Linux better and advance Linux. Let's took at their track record. Here are some past initiatives

* Improved audio via PulseAudio
* Seamless video from boot menu to desktop
* 10 Second Boot Times
* Create a better looking desktop than MacOS
* Desktop notification System.
* The Unity Desktop metaphor

And Future Initiatives
* Wayland Video System
* 200 million users in 2 years

What do they have have in common? Ubuntu's track record of half-backed, half-done, left-for broke "improvements". Let's take a look at this list and see where we are.

Pulse Audio is far from perfect. Ubuntu has never lived up to their promise of getting pulse audio working anywhere near seamless for most users.

Ubuntu also said they would perfect going from a graphical boot manager, into a graphical kernel booting with animation into the gdm log in screen. Well, it works for some users and vidoe cards and not for others. Some get blank screens till booting is done. Some cant even boot unless they disable all of the advanced graphic boot stuff. Did it get some love from Ubuntu? Yes it did for 2 or 3 releases. When it turned out the problem was going to take a lot of work to resolve, what did Ubuntu do? Announce another initiative.

Yes, 10 second boot times will come to us in 1 or 2 releases. 6 releases down the road? Some people can boot in 20 seconds. But 10 second boot times have never happened. Canonical/Ubuntu are not working on those issues any more either as a major thurst of where the work is going.

Desktop notifications were going to make interaction with short term status messages beautiful and seamless. It was new, fancy and needed some work. It got it for 2 or 3 releases. Is it anywhere near perfect yet. No? So has that goal been pursued till it was perfected. I think we all know the answer to that question.

Creating a better looking desktop than MacOS. Well there was talk about that. We changed the theme color from orange/brown to purple/orange. A little work in icons and notifications, and of course plenty of changes to make things look more like a mac. But even this goal has been abandoned to chase after a new desktop metaphor.

Unity is getting the love now. But it has had 2 relases to be worked on. And it will get a 3rd release with working on it as the primary focus. But watch out, that will have to stop. There are further initiatives that must be worked on.

Wayland is due for 3 releases of love.

At that point. The 2 years will have passed. Ubuntu COULD have 20 million users right now. With all the half baked work on graphics, sound, boot times, eye-candy and new desktop. Do we really think that Ubuntu is going to gain another 180 million users in the next 24 months? Only if Ubuntu becomes the most popular phone OS ever!

Take a look at this list and ask yourself. Has Ubuntu ever accomplished one of its major long term goals? So far the answer is "No". Ubuntu is a failure. Every time the announce what they are going to fix on the desktop next, I know what system will still be half-done in 2 years time.


The Irony of the New Desktop Paragdim

Recently in response to this blog post here. Somone made the remarks that shortcut keys are what makes Unity/Gnome Shell 3 usable. To quote them, "HOWEVER, without providing keyboard shortcuts, you might as well shoot the user in the head."

The fact that Gnome Shell 3 and Unity are much better with shortcuts is quite ironic.

If you look at all the classic Linux X desktop Window Managers like twm, fwm, afterstep, E16, IceWM, Blackbox, OpenBox, Fluxbox, etc, you will find a heavy reliance on shortcut keys.

Regular users complain that these environments don't work for them. Power users that champion these systems customize them the make them more effective for their own use. One of these customizations is defining and using shortcut keys. Not just the normal CTRL-F for find or CTRL-C for copy. But highly customized shortcuts like CTRL-ALT-1 is go to desktop 1, CTRL-SHIFT-1 is move window to desktop 1 while remaining on the current desktop and SHIFT-ALT-1 is move window to desktop and switchto desktop 1 at the same time.

The big drive from Desktop Environments like KDE 1, KDE 2, KDE 3, KDE 4, Gnome 1 and Gnome 2 is the desire to create a desktop that users can feel productive in without having to memorize shortcut keys. The great equalizer? Everything being quickly and easily accessible with the mouse.

So when the successors to Gnome 2 (both Gnome Shell 3 and Unity) create desktops for regular users that make using the mouse so inefficient that the only way the desktop is usable and productive again is fur the user to learn shortcut keys, I find it rather funny.

Gnome Shell needs shortcut keys and has tried to create a distraction free environment by removing all of the taskbar items and indicators. Unity needs shortcut keys and has tried to create an environment where they have a mega indicator area with custom written indications. If the app you run does not have a plugin to work with it, then it is a second class citizen.

I say try one of the lighter Window Managers and leave the Desktop Environments behind. They stick to desktop.org standards. Applications that take advantage of trays, docks and task lists will fit right in. Most of these desktop environments also have a 10 to 15 year track record of being productive and easy to use...once you learn a few shortcut keys.


The Beauty of Slax

It has been more than a year since I have written anything. I want to pick up where I pretty much left off at, working with Slax.

What is Slax? It is a modular live CD/USB Linux distro based on Slackware. The beauty of Slax is in how it is built. First you have to understand how a regular Linux live cd is built. Lets take a look at the process.

Remastering a Live CD.
  1. Space is set aside on the hard drive and a copy of the Linux that will be on the live CD is put into a folder on the hard drive.
  2. Using a special process called chroot, the computer is tricked into thinking the series of folder holding the Linux that ends up on the CD is actually a running system and commands are able to be executed on this system.
  3. Commands are then executed that download and install software. Software can be removed as well. Settings can be configured and other changed can be made.
  4. When all the changes are done a program that works very much like zip takes what is usually about 2 gigs of software and compresses it down to one file that is about 680 megs in size.
  5. The 680 meg compressed file, a copy of the Linux kernel the booted system will use and a special boot loader for starting from CD and booting Linux up are all placed together in one directory.
  6. A bootable ISO CD image file is created from those files.
  7. A CD is burned from the ISO image.
The thing to note in the above process is that after you test the CD and find anything needs to be changed you have to go back to step 2. It can be a very time consuming process.

The Beauty of Slax
With Slax the system has been broken up into a series of modules. each of these modules is mini compressed file much like the 680 meg file mentioned in the last paragraph. But instead of being 680 megs in size they are more often 10 meg or 20 meg in size. A typical slax system is made up of five or six modules like in the following example:
From left to right: Slax-Core, Xorg-Video, KDE-Desktop, KDE-Apps, KDEOffice, SlaxDev and FireFox.

The above files on a Live CD weigh in at about 210megs, so there is plenty of room for customizing and adding software to the install. At the Slax webesite there are hundreds of modules that can be added to Slax. Most Slackware software packages can be converted to Slax modules. Any package for Slackware 11 or 12 that can be found on LinuxPackages can be used.

The process for customizing a Slax CD is much simpler.
  1. The Slax CD ISO image file is opened up with an ISO editor that allows files to be added or removed from a ISO image. PowerISO or ISO Magic for Windows or ISO Master for Linux.
  2. Any slax module can be added to the /modules folder or removed from the /modules folder
  3. Any files that are not in modules can be put into the /rootcopy folder. Example: to put the file README.TXT on the desktop put it in /rootcopy/root/Desktop.
  4. Files that are to be available on the CD but not copied the the running system can be put in /extra
  5. Save the ISO image.
  6. Burn the ISO image to disk.
In less that 5 minutes you can find a Slax module on the Slax website, download it, open up the Slax CD in an ISO editor, place the module in the /modules folder, save the ISO Image and burn the CD. That is a far cry from the minute or two to get into a chroot environment, two more to download a program and then another 10 or 15 minutes to compress the 680 meg file and another 2 minutes to create a CD image.

Thus what is a 30 minute plus job for any other Live CD is a 5 minute job in Slax.

Slax is a serious tool for computer professionals. It is also serious fun to customize and work with.