Chris Jean
Linux, WordPress, programming, anime, and other stuff
  • Home
  • Linux
  • Development
  • Random Ramblings

Author Archive for Chris Jean – Page 2

Links to Named Anchors or Element IDs Fail in Internet Explorer 8

by Chris Jean
October 20th, 2010

I recently ran into an interesting situation where clicking a link to a named anchor (a link such as “#top” linking to “<a name="top">” or “<div id="top">“) failed in Internet Explorer 8. Strangely, it worked properly in every other browser I tested (Firefox, Chrome, Opera, and Safari) and it worked properly on other tested versions of IE (6,7, and 9). It was just Internet Explorer 8 that was broken.

I created a very simple example page that shows this bug. The important elements are the empty named A tag and the container with the “overflow:hidden” rule. The rest of the content and the width is simply to allow enough height to show the functionality or lack thereof of the link.

So the key elements of this bug are:

  1. An empty named A tag or any empty element with an ID. Adding text inside the element allows for the link to work properly.
  2. A container with “overflow:hidden” around the link, element that is linked to, or both. I tested removing either the link or the element linked to from the div in the example, and IE 8 still failed to allow the link to function in both cases.

Given that the “overflow: hidden” rule could be very important or useful for the design, the solution to this issue is very simple. Either you add text to the empty element or remove the empty element and add the removed name/id to an element that does have content. Since adding text is probably not what you want, simply moving the anchor point to another element will probably do what you want and have very little impact on the functionality.

For example, if you have the following:

<a name="purchase"></a>
<h3>Purchase</h3>

Change it to:

<h3 id="purchase">Purchase</h3>

It will do the same thing and avoid this annoying IE 8 issue.

For those interested, the filler content was generated with the great Gangsta Lorem Ipsum.

Categories Development
Comments (8)

Fix “WordPress database error Table … is marked as crashed and should be repaired”

by Chris Jean
August 30th, 2010

All the content on my site was gone. When I went to investigate, I found my error log was filled with the following error:

WordPress database error Table ‘./database_name/prefix_posts’ is marked as crashed and should be repaired for query SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM prefix_posts  WHERE post_type = ‘post’ AND post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC  made by require, require_once, include, do_action, call_user_func_array, flexx_after_content, get_sidebar, locate_template, load_template, require_once, dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, WP_Widget_Archives->widget, wp_get_archives

A very scary looking error, but it was easy to fix.

My Preferred Repair Method

[user@server ~/public_html]$ mysql -u user -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1120449
Server version: 5.1.48 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> connect database
Connection id:    1120477
Current database: database

mysql> select * from prefix_posts limit 1;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1120568
Current database: database

ERROR 145 (HY000): Table './database/prefix_posts' is marked as crashed and should be repaired
mysql> repair table prefix_posts;
+-----------------------+--------+----------+----------+
| Table                 | Op     | Msg_type | Msg_text |
+-----------------------+--------+----------+----------+
| database.prefix_posts | repair | status   | OK       |
+-----------------------+--------+----------+----------+
1 row in set (3.56 sec)

mysql> select * from prefix_posts limit 1;
+----+-------------+---------------------+---------------------+--------------+------------+---------------+--------------+-------------+----------------+-------------+---------------+-----------+---------+--------+---------------------+---------------------+-----------------------+-------------+------------------------------------------------------------+------------+------------+----------------+---------------+
| ID | post_author | post_date           | post_date_gmt       | post_content | post_title | post_category | post_excerpt | post_status | comment_status | ping_status | post_password | post_name | to_ping | pinged | post_modified       | post_modified_gmt   | post_content_filtered | post_parent | guid                                                       | menu_order | post_type  | post_mime_type | comment_count |
+----+-------------+---------------------+---------------------+--------------+------------+---------------+--------------+-------------+----------------+-------------+---------------+-----------+---------+--------+---------------------+---------------------+-----------------------+-------------+------------------------------------------------------------+------------+------------+----------------+---------------+
| 12 |           8 | 2008-05-20 10:09:49 | 2008-05-20 15:09:49 |              | 308image1  |             0 |              | inherit     | open           | open        |               | 308image1 |         |        | 2008-05-20 10:09:49 | 2008-05-20 15:09:49 |                       |           0 | http://gaarai.com/wp-content/uploads/2008/05/308image1.gif |          0 | attachment | image/gif      |             0 |
+----+-------------+---------------------+---------------------+--------------+------------+---------------+--------------+-------------+----------------+-------------+---------------+-----------+---------+--------+---------------------+---------------------+-----------------------+-------------+------------------------------------------------------------+------------+------------+----------------+---------------+
1 row in set (0.00 sec)

mysql> exit
Bye
[user@server ~/public_html]$ 

For me, this was the easiest and quickest way to repair the table.

Repairing Tables with phpMyAdmin

For you, you might prefer to use phpMyAdmin. Fortunately, repairing a table with phpMyAdmin is easy.

  1. Log in to your phpMyAdmin or connect to it via your cPanel back-end.
  2. Select the database with the crashed table.
  3. Put a checkmark next to each crashed table.
  4. Select “Repair table” from the “With selected:” drop down at the bottom of the list.
  5. Let phpMyAdmin do its thing.
Categories Linux, Tips 'n Tricks, WordPress
Comments (2)

Fix PHP 4 “Client does not support authentication protocol requested by server”

by Chris Jean
May 25th, 2010

I’m working on building an ideal server setup that allows for both PHP 4 and PHP 5 on Apache with suPHP (I’ll blog about this later). While testing my PHP 4 build, I got the following error:

Warning: mysql_connect() [function.mysql-connect]: Client does not support authentication protocol requested by server; consider upgrading MySQL client in /var/www/test-php.php on line 3
Couldn’t authenticate with MySQL

The code I used to test this is quite simple:

<?php

if ( false === ( $db = mysql_connect( 'localhost', 'username', 'password' ) ) )
    die( "Couldn't authenticate with MySQL" );

if ( false === mysql_select_db( 'database' ) )
    die( "Couldn't connect to database" );

echo "Yay!";

?>

After digging around for a bit, I found that mixing PHP 4 with a MySQL version greater than or equal to 4.1 causes this problem. MySQL 4.1 introduced a new password caching scheme that PHP 4 can’t work with.

The solution is to update the database user’s password using the OLD_PASSWORD function of MySQL. For example:

[chris@office ~]$ mysql -u root -p mysql
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 267
Server version: 5.1.41-3ubuntu12.1 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> update user set Password=OLD_PASSWORD('password') WHERE User='username';
Query OK, 0 rows affected (0.02 sec)
Rows matched: 0  Changed: 0  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>

Note the underlined areas. That is where you’ll want to provide your own username and password.

Once you’ve followed these steps, both PHP 4 and PHP 5 will be able to communite with the database.

Thanks to digitalpeer for providing the answer to my issue.

Categories Linux
Comments (2)

MySQL ERROR 1018: Unable to Follow Symlink in Ubuntu

by Chris Jean
May 21st, 2010

I recently had a issue getting MySQL to read a specific database. Each time I tried to manually query a table in the database, I received the following error message:

ERROR 1018 (HY000): Can't read dir of './default/' (errno: 13)

I’ve seen this message before as it means that there is a permissions issue. I checked the ownerships and permissions, and everything seemed to be in order.

The only thing special about this database is that I have it symlinked to another partition. This has always worked in the past, so I was stumped.

The problem turned out to be that Ubuntu has AppArmor. This software sets up rules that prevent software from gaining access to different areas of the file system. In my case, AppArmor was preventing read and write access to the actual location of my database files.

The solution was quite easy: First, I added the path that I wanted MySQL to have access to in the AppArmor configuration file for MySQL. Second, I restarted the apparmor service. Here’s the technical details:

  1. On my system, the configuration file that controls MySQL permissions through AppArmor are located at /etc/apparmor.d/usr.sbin.mysqld. The following shows the contents of the file as it now exists:
    # vim:syntax=apparmor
    # Last Modified: Tue Jun 19 17:37:30 2007
    #include 
    
    /usr/sbin/mysqld {
      #include
      #include
      #include
      #include
      #include 
    
      capability dac_override,
      capability sys_resource,
      capability setgid,
      capability setuid,
    
      network tcp,
    
      /etc/hosts.allow r,
      /etc/hosts.deny r,
    
      /etc/mysql/*.pem r,
      /etc/mysql/conf.d/ r,
      /etc/mysql/conf.d/* r,
      /etc/mysql/my.cnf r,
      /usr/sbin/mysqld mr,
      /usr/share/mysql/** r,
      /var/log/mysql.log rw,
      /var/log/mysql.err rw,
      /var/lib/mysql/ r,
      /var/lib/mysql/** rwk,
      /var/log/mysql/ r,
      /var/log/mysql/* rw,
      /var/run/mysqld/mysqld.pid w,
      /var/run/mysqld/mysqld.sock w,
      /home/sites/default/mysql/ rw,
      /home/sites/default/mysql/* rw,
    
      /sys/devices/system/cpu/ r,
    }

    The two lines in bold show what I added to the configuation. The first line gives read and write access to the directory itself while the second gives read and write access to the files contained in the directory.

  2. After saving the configuration changes, I simply needed to restart the AppArmor daemon. I did this with the following command:
    [chris@rommie ~]$ sudo service apparmor restart
     * Reloading AppArmor profiles
    Skipping profile in /etc/apparmor.d/disable: usr.bin.firefox
Categories Development, Linux, Tips 'n Tricks
Comments (6)

ColorZilla, CSSViewer, and Live HTTP Headers: Updated for Firefox 3.6

by Chris Jean
January 27th, 2010

When newer versions of Firefox come out, there are always a few add-ons that fail to update quickly enough. After about a week of waiting, I’ve become tired of waiting for some of my add-ons to update themselves. These add-ons are ColorZilla (white reports 3.6.* compatibility, but it won’t install/update on 3.6), CSSViewer, and Live HTTP Headers.

Fortunately, updating is a simple matter. Just do the following:

  • Download the xpi file for the add-on
  • Open up the downloaded xpi file as a zip file
  • Open the install.rdf file inside the xpi file
  • Search for the targetApplication section with an id of {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
  • Change that section’s maxVersion to the version number to whatever Firefox version you want to be supported
  • Update the xpi file with the modified install.rdf file
  • Install the add-on by dragging the xpi file onto the Firefox window and clicking the Install button (this works for upgrades as well)

Here are the modified xpi files for each of the add-ons:

  • ColorZilla
  • CSSViewer
  • Live HTTP Headers

Note: All of these add-ons were updated to work with 3.6.*. Of course, they may not be compatible with future versions of 3.6, so use at your own risk.

Keep in mind that if you manually upgrade an older add-on, you do so at your own risk. I tested these add-ons, and they all work properly with 3.6.

Categories Tips 'n Tricks
Comments (2)

Upgrade to Firefox 3.6 on Ubuntu 9.10

by Chris Jean
January 21st, 2010

One of my all-time most popular posts was how to upgrade to Firefox 3.5 in Ubuntu 9.04. Now it’s Firefox 3.6′s turn to be installed on my system that is now running Ubuntu 9.10.

The team working on Firefox have put a ton of effort into this release and, in order to make our browsing lives safer and faster, rolled a number of features scheduled for 3.7 into this release. Thanks for all the hard work guys.

Read the 3.6 release announcement for details about what is new with this release.

So now onto the installation. Here are the commands that I ran in terminal to install 3.6.

[chris@rommie ~]$ cd /tmp/
[chris@rommie /tmp]$ wget "http://download.mozilla.org/?product=firefox-3.6&os=linux&lang=en-US"
--2010-01-21 11:41:08--  http://download.mozilla.org/?product=firefox-3.6&os=linux&lang=en-US
Resolving download.mozilla.org... 63.245.209.58
Connecting to download.mozilla.org|63.245.209.58|:80... connected.
...

100%[=============================>] 10,161,471   924K/s   in 11s     

2010-01-21 11:41:20 (899 KB/s) - `firefox-3.6.tar.bz2' saved [10161471/10161471]

[chris@rommie /tmp]$ tar xvjf firefox-*.bz2
tar: Record size = 8 blocks
firefox/
firefox/update.locale
firefox/plugins/
firefox/plugins/libnullplugin.so
...
firefox/defaults/autoconfig/platform.js
firefox/defaults/autoconfig/prefcalls.js
firefox/libmozjs.so
[chris@rommie /tmp]$ sudo cp -r firefox /usr/lib/firefox-3.6
[sudo] password for chris:
[chris@rommie /tmp]$ sudo mv /usr/bin/firefox /usr/bin/firefox.old
[chris@rommie /tmp]$ sudo ln -s /usr/lib/firefox-3.6/firefox /usr/bin/firefox-3.6
[chris@rommie /tmp]$ sudo ln -s /usr/bin/firefox-3.6 /usr/bin/firefox

Simply run each command listed in white in your terminal to upgrade your system with the latest release version of Firefox.

After running these commands, close out Firefox, wait a few seconds to let everything shut down properly, and run Firefox again. If all the steps were executed properly and without error, you should be running 3.6. You can click Help > About Mozilla Firefox to confirm.

Happy browsing.

Categories Linux, Tips 'n Tricks
Comments (4)

Great Tutorial on Merging with Git

by Chris Jean
November 12th, 2009

One of the functions of Git that I still struggle with is merging. Recently, I found a post that shows a number of very helpful merging examples. If you work with Git and don’t fully understand merging, I recommend that you check it out.

Git merging by example

My thanks to Jonathan Rockway on providing this great guide.

Originally, I wanted to duplicate the content on my site in case the content on the linked to site ceased to exist. Ironically, just days after publishing this, the site has crashed. So, I’ve recovered the content from the crash and have duplicated it here. The remaining content is from the site I linked to and not my own. If the content stays down for long, I’ll clean up my duplicate of it.

Read More→

Categories Tips 'n Tricks
Comments (0)

VirtualBox Audio Driver for Windows 7

by Chris Jean
November 12th, 2009

I recently installed Windows 7 in VirtualBox, and unlike other OSes I’ve installed in VirtualBox, the sound driver wasn’t automatically recognized. I found a driver that works with both 32-bit and 64-bit versions.

VirtualBox Windows 7 Driver

I installed this both before and after installing the Guest Additions, but it didn’t matter what order the driver and Guest Additions were installed in.

Enjoy. :)

Categories Tips 'n Tricks
Comments (5)

Sony VAIO Laptop BIOS and System Restore

by Chris Jean
November 11th, 2009

Earlier tonight I had to work on a friends new Sony VAIO system. The model is VGN-NS330J, but the information I found seems to apply to all Sony VAIO laptops.

Anyways, this machine was seriously messed up, and he just bought it. Since the system doesn’t ship with disks for recovering the Windows installation, I figured that there had to be a hotkey combination that brought up the appropriate menu. Interestingly, this was put into the F8 Advanced Boot Options screen that is built into Windows.

If you want to recover the system back to factory defaults, reboot the system, wait for the VAIO logo to appear, and then start pressing F8. The Advanced Boot Options screen will appear shortly. Use the arrow keys to highlight the “Repair Your Computer” option and press Enter. From here, follow the instructions to accomplish what you want.

I did this, but it seems that even the recovery partition was hosed. This meant that his system was essentially worthless at this point. Fortunately, I had some Vista installation disks that could be used to reinstall the OS with the Windows serial key found on the bottom of the laptop.

When I rebooted with the installation disk, the disk didn’t boot. Come to find out, the primary boot option was the harddrive, which, frankly, is the worst boot option to be set as the primary boot method since there’s no way to bypass the hard disk boot without modifying the BIOS. How many computer users would know how to modify the boot priorities in BIOS? A better question: How many computer users even know what the BIOS is?

Unfortunately, Sony decided that having a pretty boot splash screen was more important than providing information on how to access the BIOS. Pressing the usual suspects of Esc and Del did nothing. At least they could have the courtesy of removing the splash screen when I hit a button so that I could see the options, but no.

After much too much searching around, I found out that F2 is the magic key. As soon as you boot, start pressing F2 about once a second until the BIOS screen shows.

I hope this helps you, the random person who found this information, and I hope that system developers see this and realize the following:

  1. Here’s the smart boot order to set up in the BIOS defaults of new systems: optical drive, external media, internal hard drive(s). This way, any bootable media works as expected without requiring users to go through BIOS first.
  2. Sacrificing screens that instruct users on how to use basic functionality of the machine for aesthetics is not the right decision, it simply makes your hardware a pain to use. If you must have the pretty splash screens, have them go away when a key is pressed so that the user can see valuable information, such as keys to access BIOS and the POST information. Having a splash screen that requires a change in the BIOS to make it go away in order to see the information on how to access the BIOS is self-defeating.
  3. Please bring back installation media or make a way for people to easily and cheaply acquire it. It would be fantastic if OEM system manufacturers would offer the ability to download the appropriate installation media directly from the manufacturer website. You could require a registered system complete with the serial information of the system in order to authenticate the download. This way there isn’t the increased cost of disk inventory and shipping. It would also allow customers to have quick resolution of problems since the customer could go to any location with internet access to quickly and easily get the necessary disk to use for recovery.

    This has the added benefit of ending the ridiculous permanent waste of space on computers in order to have a long-term storage of data that may never be used and may be corrupt by the time it is needed.

Categories Tips 'n Tricks
Comments (11)

Move Gnome Panels to a Different Monitor in Ubuntu

by Chris Jean
November 3rd, 2009

My dual monitor setup didn’t work properly in Ubuntu 9.04, Jaunty Jackalope. Fortunately, it does work properly in 9.10, Karmic Kaola. However, this newfound dual monitor setup has given me a new problem: how do I move my panels to the secondary monitor?

My office machine is a laptop. When I get in the office, I hook it up to a 24″ LCD. I’d like to use this external monitor as the primary, which means that I definitely want to have my panels display on it. However, as much as I tried to drag the panels around or play around with settings, there just didn’t seem to be a way to get them over there. However, I just figured it out.

By default, panels are set to expand. This means that the panels will span the entire width or height of the section of the window they occupy. If the expand option is disabled, they turn into self-sizing bar that can be dragged to different edges or centered.

Having the expand option disabled also allows you to grab and edge of the panel and drag it to another screen. Once on the screen you want it on, simply re-enable the expand option and you now have the panel on another screen.

Here’s a step-by-step way of moving a panel to another screen:

  1. Right-click the panel you wish to move and select “Properties”.
  2. Uncheck the “Expand” option under the “General” tab.
  3. Grab one of the edges of the panel by clicking on the left or right end (top or bottom end for vertical panels).
  4. Drag the bar to the desired screen and position.
  5. Check the “Expand” option in the “Panel Properties” window and click “Close”.
Categories Linux, Tips 'n Tricks
Comments (48)
« Previous Page
Next Page »
Chris Jean
Copyright © 2012 All Rights Reserved
iThemes Builder by iThemes
Powered by WordPress