October 9, 2020

Viewing Data Downloaded From USPTO PEDS

For the last several weeks, I've been working on a bit of software to enable free viewing of all results from a search on the USPTO's Patent Examination Data System. The result is XSLT_PEDS, licensed under GNU GPL-3.0 and version 2.0 of which I released earlier this week. For source and releases, see https://github.com/dfyockey/XSLT_PEDS.

February 11, 2018

Centering a Block of Text in Conky

My goal was to display a “Message of the Day”, randomly-selected at boot, in the Conky text area. A message would be a block of text having varied length lines and an undefined width, as shown below. Importantly, I wanted the selected message’s block of text to be centered rather than left-justified.

Text block with varied length lines in a text file

The ability to dynamically center a block of text in Conky is something I had assumed would be straightforward. I carefully read through the Conky man page and did a lot of online searching for info on the subject. It's likely I overlooked something, used the wrong search terms, or searched the wrong places, but in the end I couldn’t really find anything about how to do it. So, if I wanted it, I'd have to do it myself.

The result was a Lua script called from in the .conkyrc file that reads lines of text from a text file, then adds a Conky center alignment object (i.e. ${alignc}) to the beginning of each line while also equalizing the length of each line. That way, while each line of the script-processed text is independently centered, the result is an effective centering of the block of text rather than centering of each of the varied length lines of the unprocessed text.

Here’s an example…

Text block displayed in Conky at various widths

The script is available free of charge at https://github.com/dfyockey/conky-text-block-centering. Enjoy!

February 22, 2016

Stopping a Smartphone from Automatically Turning On Data

A couple weeks ago, I bought a new Samsung Galaxy Core Prime smartphone from T-Mobile because my old dumb cellphone decided to suddenly stop working. (Actually, there's reason to believe it was obsoleted without warning by Tracfone through a change in their network, but that's another story.) Like any normal guy in the modern world, I sat down as soon as I got home to play with my new device. I particularly wanted to make sure I was in control of when it used data.

It didn't take long to discover that the phone would turn on its mobile data connection itself, even after the appropriate switch in the settings had been set to turn it off. That, in my opinion, is just unacceptable.

The Core Prime phones aren't top-of-the-line Galaxy phones, of course. They're fine for people who need a phone rather than an entertainment device or a portable office, though, and shouldn't suck up data on their own accord just because they're not high-end devices.

For reasons explained later, I put off the ideas of contacting T-Mobile for help and of trying to find if some preinstalled app was responsible for the problem. Instead, after poking at settings for a while with no joy, I turned to the web.

Searching brought up a variety of possible ideas for cause and/or solution, including...
  • Set "Restrict background data" in the MORE menu within the Data Usage settings.
  • Disable automatic date and time update.
  • There is an unnecessary or "virus-type" APN installed in your smartphone.
  • There is an App called VPN *a virus that causes this.
  • Turn on Airplane Mode (which, of course, turns off the phone along with the data).
  • Choose a Network mode setting in Mobile Networks that doesn't include "auto connect".
Excluding the "virus" ideas, which I chose to disregard (they're brand new phones, after all), none of the above resolved the problem.

About contacting T-Mobile for help, I figured that most people would contact their service provider with problems connecting to the internet rather than the other way around, so it was unlikely they would have any practical advice. This opinion was bolstered by a forum post from someone having a similar problem with a Galaxy S4 on AT&T's network. The post said "We tried calling AT&T and they said that its what the phone is supposed to do and they can't disable it. When asked if we could, they said 'I don't know.'" (http://forums.androidcentral.com/t-mobile-samsung-galaxy-s4/314192-how-completely-disable-mobile-data-being-turned.html#post3066090)
Finally, I set out to determine if some preinstalled app was responsible. I was avoiding this because it meant having to determine *which* of the apps was a problem. That meant having to check the permissions of each app in the Application Manager's "All" list to...
  1. determine which apps had permission to turn mobile data on and off,
  2. determine which of those could be disabled, and
  3. determine which of those run at startup.
Then it'd be necessary to determine which of those constituted the offending app(s) by trial-and-error.

The results of 1 thru 3 were...
  1. 105 apps,
  2. 24 apps, and
  3. 22 apps.
The names of the final 22 apps follow. Do any look particularly suspect to you?
  • com.tmobile.pr.adapt
  • Contacts
  • Contacts Storage
  • demo stub
  • Download manager
  • Galaxy Apps
  • Google Account Manager
  • Google Backup Transport
  • Google Contacts Sync
  • Google Play store
  • Google Services Framework
  • Hangouts
  • LogsProvider
  • Lookout
  • Media Storage
  • Messages
  • Samsung Billing
  • Setup Wizard
  • T-Mobile Name ID
  • User Dictionary
  • Visual Voicemail
  • YouTube
Hmmm... Maybe com.tmobile.pr.adapt?

Following this suspicion, I disabled com.tmobile.pr.adapt. That did it! There've been no unauthorized data connections since, everything works as expected with the mobile data off, and everything works just fine if I choose to turn on the mobile data. So... Problem solved!

Hopefully this will save some T-Mobile users with Samsung Galaxy phones a bit of time and frustration, and give other users an idea of what to look for if their phones are insistant on wasting data.

September 8, 2014

Better Innovation Through Integration

February 20, 2016 -- I got a bit off-topic when I wrote this purely speculative post back in 2014. So, since the intent of this blog is to post useful bits of techie info, this post has been removed.

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.

October 4, 2012

Clock Option for Vulcan 3D Chess

Maybe it's just me, but I really dislike playing chess against a program where a clock is displayed showing the time I and the program each take to make a move. The clock's presence is a distraction and creates an undesirable sense of tension. On top of that, it subtly suggests the my inferiority by constantly highlighting how much faster the computer 'thinks' than I do. My inclination, thus, is to disable such a clock as quickly as possible.

Vulcan includes such a clock but unfortunately I found it to include no option to disable the clock. I was quite dismayed.

To correct this oversight, my first course of action was to find the point in the program where the clock was displayed and hack it so as to disable the display. This worked great! Problem solved! Then I thought about other people and how they might or might not want the clock displayed depending on their mood, and I started feeling guilty...

So, I went on to add an option to the Options menu to enable turning the clock on and off. This was fine for starters. But the clock defaulted to on, I wanted it to default to off, and others might still want it to default to on. Not wanting to dictate the default to anybody, I added the command line option -t (the program already has a -c command line option; '-t' stands for 'time clock'). When included on the command line when launching the program, this option starts the program with the clock off; otherwise the program starts with the clock on.

The result is all wrapped up in a free patch that's available at http://sourceforge.net/projects/vulcanchessmods/files/feature_patches/clock_option/.

September 25, 2012

Hiding Blog Post Rearrangement

Changing the order of Blogger blog posts using JavaScript, such as with the Post Reversal Script, has the drawback that the posts need to be loaded before they can be rearranged. The result is an unsightly load of posts in one order followed by a delayed apparent reload of the posts in the intended order.

The reloading effect can be masked by hacking the template to hide the widget containing the blog posts and only display it after the posts have been rearranged. The code for accomplishing this is simple but, unfortunately, must be placed at two remote positions in a blog's template.

To hide the posts, add the following to the stylesheet code toward the top of the template, such as before the line "/* Content" or some other line beginning with "/*":
/* Start Post Rearrangement Hiding CSS */
#Blog1 {visibility:hidden;}
/* End Post Rearrangement Hiding CSS */
Then to show the posts after they have been rearranged, add the following script just after whatever post reordering script you have added to your template and just before the closing BODY tag:
<!-- Start Post Rearrangement Hiding Code -->
<script type='text/javascript'>
//<![CDATA[
  document.getElementById("Blog1").style.visibility = "visible";
//]]>
</script>
<!-- End Post Rearrangement Hiding Code -->
Viewing the blog, you should initially see an empty area where the posts normally appear followed by the posts appearing in the intended order.

An alternative to the empty area is to add a background image to the container underlying the blog post widget. The image could be, for example, a TV test pattern or a "Please wait..." message. The CSS code for this is shown below, where url-to-an-image-file is the URL to an image you have uploaded to Blogger or that is located elsewhere on the net.
/* Start Post Rearrangement Hiding CSS */
#main {
  background-image: url( url-to-an-image-file );
  background-repeat: no-repeat;
}
#Blog1 {
  visibility:hidden;
}
/* End Post Rearrangement Hiding CSS */
Then to show the posts, use the following script. The background image is removed here in case the blog post container is transparent, in which case the underlying container's background image would be visible behind the blog posts.
<!-- Start Post Rearrangement Hiding Code -->
<script type='text/javascript'>
//<![CDATA[
  document.getElementById("main").style.backgroundImage = "none";
  document.getElementById("Blog1").style.visibility = "visible";
//]]>
</script>
<!-- End Post Rearrangement Hiding Code -->
Depending on the speed of a viewer's browser, the selected image will be displayed while the posts are being rearranged, followed by the posts appearing in the intended order.

September 11, 2012

King Bug Fix for Vulcan 3D Chess

While testing a prototype game save feature for Vulcan, I ran into a nasty little bug. I would move my king off of it's attack board, the program would start 'thinking', and then it would crash. The crash was at an assertion indicating that the program couldn't find my king anywhere on the board.

After much investigation, which among other things included rerunning the same move a zillion times and adding an ASCII print of the entire board at a couple of points just before the crash, the problem became apparent. I found that the program had 'imagined' that its queen had captured my king as part of it's 'thinking' process. From there, tracing back through a long chain of function calls turned up the bug. There seemed to be nothing to keep the program from considering moves where one of its pieces would capture the king. Adding an additional condition to an existing 'if' statement squashed the bug.

I've gotta say, I got lucky in the timing of finding this bug. It would have taken a lot longer to fix without having already implemented an ability to return to the game state just before the crash.

June 27, 2012

Getting Microblog-Purple to Work

Microblog-purple is an open source plug-in for Pidgin and other Libpurple-based IM clients. It enables accessing Twitter feeds through an IM client. If you're trying to compile and install microblog-purple from source and are having trouble getting it to work, you may need to change the permissions of a few of the installed files.

In my case, I had troubles getting microblog-purple working from source in Pidgin on Fedora Linux.It was necessary to change the permissions of the following files from 750 to 755, giving read and execute permission to other users:
  • /usr/lib/purple-2/libidentica.so
  • /usr/lib/purple-2/libtwitter.so
  • /usr/lib/purple-2/twitgin.so
This I figured out by reading the screen output from running make install, locating the files, and comparing the files’ permissions to those of a file corresponding to a known working Pidgin plug-in.

The microblog-purple plug-in, listed as Twitgin, showed up in Pidgin’s plug-in list once the aforementioned permissions were changed. Making sure it was checked in the list, I then set up access to my Twitter account by adding it through the Manage Accounts dialog as if it were an IM account. After that, it was up and running.

June 22, 2012

Mouse Bug Fix for Vulcan 3D Chess

Standard chess programs are easy to find, but 3D chess programs รก la Star Trek are comparatively rare. As far as I've been able to find, there's Parmen by Doug Keenan for Windows, and there's Vulcan by Mauro Persano for Linux and probably anywhere else X11 or SDL can be used*.

Parmen would have been the easiest to install and is purportedly the more mature of the two, but I really wanted a 3D chess game to play on one of my Linux machines, so I tried Vulcan first. Compilation and install went fine after installing the necessary packages and adding -Wl,-rpath,/usr/lib/tls to LDFLAGS in the Makefile to pick up one library file the compiler couldn't find.  It seemed to work...when it would recognize mouse events. Unfortunately, the length of time and number of clicks it took to get it to respond made it too awkward to use.

Disappointed, I turned to Parmen. Installation was the usual Windows simplicity: just download and run ParmenSetup exe. All looked good upon running the installed program until about the second or third move, whereat Parmen crashed. Trying again a couple more times and trying it on a different machine yielded the same results. Admittedly, the two XP SP3 machines I tried it on were both fairly low end, so you may have a better experience.

Frustrated, I turned back to Vulcan and the promise of open source software. A lot of experimenting and research helped to isolate the problem primarily to a single line of code. With that line removed... It worked! And it didn't crash!

It's just speculation, but I'm thinking the bug may have arisen due to changes in X11 which occurred since Vulcan's last update, particularly somewhere in X11R7.4 (X server 1.5.1) through X11R7.6 (X server 1.9). Regardless of the cause, I've put up a free patch to fix the bug and improve Vulcan's response to mouse events at http://sourceforge.net/projects/vulcan-mbpatch/. (UPDATE: As of 9/10/2012, this patch may now be found at http://sourceforge.net/projects/vulcanchessmods/files/cricital_patches/mouse_bug/.)

If you know of any other Star Trek style 3D chess program, please post a comment and let us all know about it.

* Mac OS X for Unix Geeks by Jepson & Rothman (O'Reilly, 2003) has a whole chapter on installing and using X11 on a Mac OS X system!

April 19, 2012

Swapping to Reverse Post Order on Blogger


Sometimes an oldest-to-newest order of blog posts would be better than Blogger's standard newest-to-oldest arrangement. A blog about a project is an example. The posts would proceed from oldest to newest so a visitor to the blog could start reading at the project introduction and proceed from there. Unfortunately, Blogger doesn't provide this as an option.

There are a number of existing approaches to this problem but, for various reasons, none of those exactly fit my needs. So I decided to roll my own.

David Merriman's script served as the starting point in locating post container nodes in Blogger's template. From there, the idea was to create a script that locates the blog's post container and then searches concurrently for posts from both the top and bottom of that container. When a post is reached at each end, those posts would be swapped. The concurrent search would then continue on toward the center of the container. The search would end once the center is reached, at which point the contained posts would have been reversed by the preceding swaps. The process is then repeated for each day of posts to reorder multiple posts within days.

The resulting drop-in hack is shown below. To use it, copy and paste the entire script into your Blogger template just before the </body> tag and then save the template. View your blog, reloading if needed, and your posts should be displayed in reverse order. Take a look at http://diyreader.blogspot.com to see it in use.

<!-- Start Post Reversal Code -->
<script type='text/javascript'>
//<![CDATA[
  // -----------------------------------------------------------------------------------------
  // Name   : PRS - Post Reversal Script for Blogger - Version 1.0
  // Author : David Yockey
  // URL    : http://techsquirrels.blogspot.com/2012/04/swapping-to-reverse-post-order-on.html
  // -----------------------------------------------------------------------------------------

  // Temp variable used to shorten classname references
  var cn;

  // This function is called as needed in the main program below.
  function ReversePosts(BlogPostContainer,PostClass) {

    // Arguments:
    //    BlogPostContainer -- The node containing the posts to be reversed.
    //    PostClass -- The className of each of the posts in the container to be reversed.
    //                 (may be a single name from among names in the class attribute of the posts)

    // Flag for checking whether any posts are found
    var found=false;

    var BlogPosts = BlogPostContainer.childNodes;  // May include text-nodes containing
                                                   // whitespace in addition to post-nodes

    // Set index variables to top and bottom of BlogPosts list
    var i=0;
    var j=BlogPosts.length-1;

    for( ; ; ) {     // Start Endless Loop

      // Find next Post from the top
      while( (i < j) && (!(cn=BlogPosts[i].className) || !(cn.match(PostClass))) )
        ++i;

      // Find next Post from the bottom
      while( (i < j) && (!(cn=BlogPosts[j].className) || !(found=cn.match(PostClass))) ) // (see Footnote 1)
        --j;

      if( found && i < j ) {
        // Swap Posts (see Footnote 2)
        var tempi = BlogPosts[i].cloneNode(true);           // Store a copy of Post i in tempi
        var tempj = BlogPosts[j].cloneNode(true);           // Store a copy of Post j in tempj
        BlogPostContainer.replaceChild(tempi,BlogPosts[j]); // Replace Post j with Post i in tempi
        BlogPostContainer.replaceChild(tempj,BlogPosts[i]); // Replace Post i with Post j in tempj
      } else {
        // Done
        break;        // Break out of Endless Loop
      }

      ++i; --j;
    }
  }
  // Footnote 1:
  //   If a post is found from one end, then a post must necessarily be found from the other.
  //   So, recording and later checking for a post from one end is sufficient to ensure that
  //   one was found from both.
  //
  // Footnote 2:
  //   At least in Firefox 11.0 on Fedora Linux, replacing a child directly with another child
  //   causes some text-nodes containing whitespace to be deleted. That node deletion messes up
  //   the positions of the posts in the BlogPosts list. This is avoided by cloning both posts
  //   rather than just one and replacing both posts from the cloned copies.


  // *** MAIN POST REVERSAL PROGRAM ***

  // Magic Words
  var BlogWidget             = 'Blog1';
  var BlogPostContainerClass = 'blog-posts';
  var BlogPostClass          = 'date-outer';
  var DatePostContainerClass = 'date-posts';
  var DatePostClass          = 'post-outer';

  var Blog1 = document.getElementById(BlogWidget);

  // Find the node containing the blog posts
  var BlogPostContainer;
  var x=0;
  do {
    BlogPostContainer = Blog1.childNodes[x++];
  } while ( !(cn=BlogPostContainer.className) || !(cn.match(BlogPostContainerClass)) );

  // Reverse different day posts
  ReversePosts(BlogPostContainer,BlogPostClass);

  // Reverse same day posts - Loop thru contents of BlogPostContainer to find each day's posts
  var BlogPosts = BlogPostContainer.childNodes;
  for ( i = 0; i < BlogPosts.length; ++i ) {

    // Check for an actual post-node rather than a text-node or such
    if ( (cn=BlogPosts[i].className) && cn.match(BlogPostClass) ) {
      var DatePostContainer;
      x=0;

      // Find the node containing the posts to be reversed for the current day being processed
      do {
        DatePostContainer = BlogPosts[i].childNodes[x++];
      } while ( !(cn=DatePostContainer.className) || !(cn.match(DatePostContainerClass)) );

      ReversePosts(DatePostContainer,DatePostClass);
    }
  }
//]]>
</script>
<!-- End Post Reversal Code -->
Code highlighting (if your browser displays it...) powered by google-code-prettify.

The script doesn't include an option to select whether or not to reverse the order. If you need this option, you might want to try MS-potilas's script, although I haven't tried it myself.

My thanks go to David Merriman and MS-potilas for their prior work on this problem and the guidance it provided.
09/25/2012 -- You may also be interested in: Hiding Blog Post Manipulation