October 8, 2013

IE10 Incompatibility with Yahoo Mail...
or Vice Versa.

A couple weeks ago, a client with a new PC complained of an error message repeatedly appearing at the bottom of a page in Internet Explorer 10.  This happened particularly when using the latest version of Yahoo's web-based email. It was a constant irritant that covered part of the box for composing an email message and would reappear shortly after being dismissed.

Message box with white background, black text, and yellow bar along its top edge.
The Offending Message

Now, I don't use IE unless absolutely necessary.  My Windows PCs all run XP or earlier with IE8 at best, and I run Fedora Linux on my main PC (which blessedly won't run IE).  So, I hadn't run into this non-Windows-standard message box before.  The client was also running Norton AntiVirus, and the message box matched Norton's color scheme.  So, naturally I assumed that Norton was somehow generating the message appearing in IE.

After much wheel-spinning, it came to light that IE itself was generating the messages.

The Compatibility Mode Button
I tried a few things suggested on the net, none of which worked. As a last resort that shouldn't have worked, I clicked IE's "Compatibility Mode" button. I say "it shouldn't have worked" since Compatibility Mode is intended to fix problems with old sites and Yahoo's site is supposedly modern. Obviously, one or the other is mucked up. You're invited to place your bets on which one. At any rate, that click solved the whole problem. (Anybody out there know of a text emoticon for rolling one's eyes?)

Here's hoping this helps someone save some time and avoid some frustration!

October 6, 2013

Reducing Image File Sizes in Blogger Posts

It was recently called to my attention (Thanks, Alan!) that Blogger has a 1MB page size limit when I was asked if there was any way to get around it, especially when including lots of pictures and video.

My first reaction was "Probably not" since Blogger likely imposed the limit to constrain server load and/or so blog viewers don't get the impression that the Blogger service is slow. I still think there's no way around the limit.  But, assuming that the size of linked content loaded with the page counts against the limit, it should be possible to fit more on a page than Blogger's simple controls sometimes directly allow.  In particular, the file size of image thumbnails can be changed.

I had originally intended to explain how one can create their own thumbnail images smaller in both dimension and file size, upload them, and change URLs in posts to point to the smaller images rather than the large ones that are just programmatically sized by the visitor's browser. However, it seems there's a much easier way.

As far as I've been able to tell, Blogger has a bug of sorts with the addition of images to a post. I don't know at this point whether it's related to the browser and/or operating system used while adding the image, to the template used, or to something else. But an easy hack will get around the problem.

The following block shows code similar to that added to a post by Blogger when an image is added to the post. The second block shows the same code reformatted to be a bit more "human readable."

<div class="separator" style="clear: both; text-align: center;"> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjirj9gGsjKWuOymg6tuZq6Fhy6rCPj7UcHdZyFX4yjRsHduqXWOluW7A3QkqQEwxG5wA-LW87cp9wArnJWSPIWSiC-JIbzY6AS18WLHBQ1G8s2VFQhVjNfa3X64K1ctKaEMC-_B-IXXFA/s1600/VL_dmesg_comparison.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjirj9gGsjKWuOymg6tuZq6Fhy6rCPj7UcHdZyFX4yjRsHduqXWOluW7A3QkqQEwxG5wA-LW87cp9wArnJWSPIWSiC-JIbzY6AS18WLHBQ1G8s2VFQhVjNfa3X64K1ctKaEMC-_B-IXXFA/s1600/VL_dmesg_comparison.png" width="200" /> </a></div>

<div class="separator" style="clear: both; text-align: center;">
<a href="http://.../8DWceGrCEqI/s1600/VL_dmesg_comparison.png" ... >
   <img border="0" height="150" src="http://.../8DWceGrCEqI/s1600/VL_dmesg_comparison.png" width="200" /> 
</a>
</div>

The URL between "<img" and ">" specifies the image to be displayed. The "height=" and "width=" attributes specify the size that the image is scaled to. But the highlighted bit can be adjusted to change the actual size of the image. This bit specifies the width of the image. The height is adjusted accordingly.

In some cases, if the a different size (e.g. "Small") is selected using Blogger's controls, the highlighted bit will be changed to s200. The actual image, and thus it's file size, will then be much smaller. In other cases, though, only the "height=" and "width=" values are changed. In the situation shown above, the full-size image happens to be 1600x1200, and the image was only scaled to be displayed smaller.

To change the actual image size while editing a post, all that's needed to to switch from "Compose" to "HTML" mode, find the code for the image of interest, find the "s" value in that code, and change it to the desired size. Assuming that a "width=" value is specified, you can use that value for the "s" value.

Incidentally, an image of the specified size is apparently generated on-the-fly. I tested for a weird size (s212) from an original 1600x1200 just to see, and it actually generated a 212x159 image! Note that the image is still scaled to whatever "height=" and "width=" values are specified.

To verify that the image actually is smaller, right click on the image on the post page after you've updated the post and select View Image Info, Image Properties, or the like.

September 5, 2013

Apache, CGI::Ajax, and UTF-8

I just spent the day figuring out why, oh why, my Apache server wouldn't do as it was told. No matter what changes were made to the httpd.conf file, it kept serving up a page in ISO-8859-1 rather than UTF-8.

I tried all sorts of stuff suggested on the net. In the end, the server was configured for UTF-8, the .html file was saved in UTF-8, that file had both an <?xml version="1.0" encoding="UTF-8"?> tag (with appropriate tags for strict xhtml) and a <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> tag. None of this made a difference. I even made a change to my installed Samba server's configuration in case that was mucking things up. But there was no joy.
If this post doesn't solve your UTF-8 problem,
check out The Mother Of All UTF-8 Checklists!

As I was falling asleep for lack of coffee, a dim light went on... The page being served was actually generated by a Perl script that sucked in the html file and used a CGI::Ajax object to spit out the page with Ajax-enabling code added. I'd put together that part of the Perl script a couple months ago and just noticed the odd encoding today, so maybe the problem was there.

Checking the CGI::Ajax page, the end of the first example is pretty clear...
print $pjx->build_html($cgi,\&Show_HTML,{-charset=>'UTF-8', -expires=>'-1d'});
After getting some more coffee, I dropped {-charset=>'UTF-8'} into my build_html method call, pulled up the page on Firefox, checked the page info, and... Voila! It's UTF-8. Finally.

The CGI::Ajax module is awesome and solving the problem is great, but I can't believe I wasted a day figuring this out. Here's hoping this post saves someone out there from the same fate.

September 4, 2013

Wrist PDA... Smartwatch... Whatever...


Fossil's Wrist PDA (2005) and Samsung's Smartwatch (2013)

What goes around, comes around...

There's nothing new under the sun...

Everything old is new again!

Any other cliché's come to mind?

May 31, 2013

WYSIWYG... NOT!

Once upon a time, in the early days of the Commercial Internet - in mid-1999, to be precise - I tried using a couple of WYSIWYG HTML editors and became totally disenchanted with them when each editor totally mucked up practically any coding done outside of the WYSIWYG interface.

Today, I tried using KompoZer to add styles to a short, hand-written XHTML 1.0 strict standard page. It promptly broke my page; wouldn't render at all in Firefox 21.0 on Linux. It took an hour or so of repeatedly overlooking the bug to discover that KompoZer had changed this...
<script src="js/sked.js" type="text/javascript"></script>
to this...
<script type="text/javascript" src="js/sked.js" />
in addition to hosing my human-readable indenting and such.

I had actually looked into the script tag a bit when writing the XHTML page, and the use of start and end tags seemed to actually be correct in this instance. The twelve-year-old “HTML & XHTML The Definitive Guide, 4th Edition” states on p. 434, “End tag: </script>; never omitted”. So I went with that and didn't think more about it.

After this problem cropped up, I found that page 514 of the same book indicates that any XHTML element with no content like <p></p> may be written like <p />, so KompoZer's change, while not necessary, should be ok. However, I also found "guidelines" from the W3C "for authors who wish their XHTML documents to render on existing HTML user agents" that indicates not to do that for “an empty instance of an element whose content model is not EMPTY”. <script>'s content model isn't EMPTY. So for compatibility, should you use a single <script ... /> tag? Fugetaboutit!

For other things, WYSIWYG editors are fine. But if a web content editor is going to make any unnecessary changes at all to anything I've written, then it's not for me.

Anybody out there in cyberspaceland know if Dreamweaver does this sort of nonsense?

May 13, 2013

Getting VectorLinux To Recognize PCMCIA Cards

Having successfully used VectorLinux 6 Light on an antique HP Pavilion laptop of unknown provenance and needing a new OS for my circa 1999 Compaq Presario laptop, I naturally turned to VectorLinux 7 Light. Unfortunately, VL 7 Light didn't recognize either of my wired or wireless PCMCIA adapter cards; didn't even power them up. In trying a VectorLinux 6 Light Live distro on the same machine, however, both worked with no problems.

My intention was to read through the previous postings on networking at the VectorLinux forum and then to post a question on the subject there if a solution wasn't unearthed. No solution was found, and I was preparing to post a question when an idea came to mind: Compare VL 6 Light Live and VL 7 Light to determine what the heck was different!

I skimmed back through various forum posts I had considered relevant and noted what info was requested in response to the various questions. This included outputs from dmesg, ifconfig -a, lsmod, lspci, lspcmcia, pccardctl info, cat /etc/rc.d/rc.pcmcia, and modinfo xxxxxxx (where xxxxxxx is the name of the driver appropriate for a particular card one was trying to get working). I saved copies of each of the outputs from each distro and then proceeded to compare them.

The problem turned out to be one of ACPI enablement. As shown in the attached picture, VL 7 Light judged my laptop unworthy and thus disabled ACPI support. On the other hand, VL 6 Light Live was more accepting and Ethernet via a PCMCIA card, requiring ACPI, worked fine.


From there, solving the problem involved figuring out how to “require” acpi=force as indicated on the line highlighted in yellow in the right-hand window in the picture above. After a bit of research and testing, I found that PCMCIA cards were properly recognized after adding acpi=force to each of the 'append' statements in /etc/lilo.conf, then issuing the command '/sbin/lilo -v' to commit the changes to the LILO bootloader, and finally rebooting*. Yea!

If you're using GRUB instead of LILO, the following ought to do it (but I haven't tested it...): add acpi=force to the 'GRUB_CMDLINE_LINUX' statement(s) in /etc/default/grub, then issue the command 'update-grub' to commit the changes to the GRUB bootloader, and finally reboot*.

And the moral of this story? I'll leave that for you to decide. :)

* Of course, all of this needs to be done from root.