ReadyNAS Duo, NV+ and wireless networking problems

readynas-nv

The ReadyNAS network attached storage devices sets an aggressive networking for optimum throughput. But many wireless adapters can’t handle these aggressive settings. (now I’ve learned) If affected you’ll experience very slow networking to and from the ReadyNAS. Fix is you need to change the MTU setting to 1430 on the laptop’s or other affected device’s wireless networking interface. A story and how-to follows,

Continue reading ReadyNAS Duo, NV+ and wireless networking problems

jQuery: Build Select List From All Selected Values in Multiple Select List

jquery_icon80I was recently working on a form where I needed to build a dropdown select list from the values a user would select within a different multi-select listbox.  The select list would be disabled by default and would be enabled and populated based on user selections. Took me some research over at jQuery as I’m far from any kind of expert on jQuery but this is code I came up with and it appears to be working,

var currSelected; 
currSelected = $("#ddl_org :selected").val(); 
$("#ddl_org").empty(); 
$("#ddl_org").append($("<option></option>").val("0").html("selection required")); 
$("#multi_ID :selected").each(function (i, item) { 
   $("#ddl_org").append($("<option></option>").val($(item).val()).html($(item).html())); 
}); 
$("#ddl_org").attr("selected","selected").val(currSelected);

The dropdown list to be built is referenced by id=’ddl_org’ and the multi-select is referenced by id=’multi_ID’.

So the code basically follows this logic:

  • Save the currently selected value of the dropdown since it might already be enabled.
  • empty all the values from the dropdown.
  • append the first option to the select list that lets the user know a selection is required
  • go to our multi-select and for each selected item append the value and label to the select option list to build the dropdown.
  • set the selected value if one was previously selected.

WordPress Post Revisions – Delete and Limit

re: WordPress 3.2.1, phpMyAdmin 3.3.10, MySQL 5.1.54

WordPress by default will store an unlimited number of revisions made to a post and allow you to restore any of these versions. The revision history and the ability to restore these is a great feature of WordPress – but – it can create database-bloat. The extra space taken up by a lot of revisions may be a concern to some as well as there may be minor performance improvements when reducing the size of your WordPress database.  I’ll follow with some steps to do some maintenance on your WP database but first there is a nice WP constant you can define to control revisions.

I’ll not suggest turning off revisions but you can limit the number of revisions created where older ones will automatically be deleted when you reach the limit.  To limit revisions to 2 edit your wp-config.php file and add:

define(‘WP_POST_REVISIONS’,2);

Turn off revisions by setting the constant to false or 0 (not recommended). 

Just in case you aren’t 100% familiar with WP’s revisions you can see these when editing a post in admin, scroll down to the bottom, and you’ll see a “Revisions” section. Clicking on the link provided will allow you to view and restore that revision. Note that revisions are not created from WP’s auto-save feature.

wp_revisions_screen_shot02

If you aren’t seeing this then the post doesn’t have a revision or this Revisions section isn’t visible – to turn on scroll up to the top and over on the right you’ll see Screen Options which you can drop-down and make sure Revisions is checked.

wp_revisions_screen_shot01

Now be warned to go much further you’ll need some experience with phpMyAdmin and/or the shell prompt. And I’m a bit leery of the WP plugins that state to take care of this level of database maintenance but maybe there are some good ones out there. Oh and I’d always suggest backing up your database before doing this level of maintenance.

The example WP site I’m using has about 12,900 posts and from phpMyAdmin select the  WP database and before removing the revisions and optimizing we see the size: 77.3MB,

wp_revisions_screen_shot03a

Now lets get a count of the total number of revisions – run this SQL query,

SELECT COUNT( DISTINCT a.ID )
FROM wp_posts a
LEFT JOIN wp_postmeta b ON ( a.ID = b.post_id )
LEFT JOIN wp_term_relationships c ON ( a.ID = c.object_id )
WHERE a.post_type = ‘revision’

wp_revisions_screen_shot03b

Not a small number of revisions and since we’ve decided we no longer need any of the revisions we’ll delete them all.  Note that while you can just query wp_posts for your total revisions, we’re joining on the meta data also since when we delete the revisions this is the query we needed. Otherwise you’ll end up with orphaned records in wp_postmeta & wp_term_relationships,

DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_postmeta b ON ( a.ID = b.post_id )
LEFT JOIN wp_term_relationships c ON ( a.ID = c.object_id )
WHERE a.post_type = ‘revision’

wp_revisions_screen_shot03c

Since we’re removing the needed rows from all three tables the number deleted is higher than our post revision count.  Now after doing this the database size won’t change so we need to optimize it,

To optimize your database you can do this from a command/shell prompt using the myslqcheck command like:

mysqlcheck -o –u user_name –u database_name

Replace user_name and database_name with your values.

You can also do this from within phpMyAdmin – select your WP database, click the Structure tab and click Check All to check all the tables, then from the With selected: dropdown select Optimize table,

wp_revisions_screen_shot03

The screen shot is post optimize where we’re down to 50.9MB – and nice 1/3 smaller. Of course we’ve lost all revision history in the process.

Virtual Server 2005 R2–Yes some of us still use it….

Just a quick post about trying to manage Virtual Server 2005 R2 these days. Tribulations follow but the bottom line I found is the VSWebApp.exe web-based management interface is NOT Internet Explorer 9 compatible. Many of the action command fail to execute when clicked. Attempts to do a “Shutdown Guest OS” or subsequently “Remove” resulted in no actions happening. Put IE9 into IE7 compatibility mode which does the trick – all commands worked correctly now.

I had a disk full issue on the host server that put one of the virtual servers into a paused state. The host server is running Server 2003/Virtual Server 2005 R2 and hosting 4 virtual servers.

Should I be migrated to Server 2008/Hyper-V, probably, but that’s somewhere on the to-do list.

To freeing up space on the full drive (E:) the quickest solution was to move one of the vservers to a different drive (F:) on the same host. I shutdown the host and moved the virtual drive files over to F: and deleted from E:. I quickly learned this wasn’t the best when the vserver disappeared from the master list so I copied back the *.vmc configuration file and it re-appeared. Documentation says to “Remove” the vserver before making this type of change – then you can add it back from the new location.

At the administration website go to the navigation pane and click Master Status. If the vserver you want to remove is still running it needs to be shutdown. Mouse over the virtual machine name and from the pop-out menu select “Shutdown Guest OS”  – click – and nothing happened. Ugh! Login to the vserver and do normal Shutdown. Back to the Master Status page, mouse over vserver name again and now you’ll see “Remove” – click – and nothing happened again!

About 10 minutes of troubleshooting the light bulb went off and it was a browser compatibility issue with the old application and new IE9. Put IE9 into IE7 mode and all the commands worked!

Removed the vserver and then added it back in from the new location. Once added back you’ll need to re-input the password for the run account.

Internet Explorer v8 and Opacity Issues

A great WordPress plugin jQuery-lightbox (JQLB), used to provide animated slideshow-like viewing of images in a post seemed to be having some undesired behavior on sites viewed with Internet Explorer (IE) v8 – the plugin’s jQuery based javascript was unable to successfully set the opacity of an “overlay” <div> it created in process of showing images. All worked fine in Firefox (FF) and IE v9 but would fail (though not all the time) in IE v8 (unable to test IE v7 but it may also have similar issue). Some more testing seemed to confirm that all versions of the JQLB plugin were affect as were all versions of jQuery, but the issue only affected Windows 7/IE v8. 

Some background: When invoked JQLB’s jQuery javascript will create a <div class=’overlay’>, set its height and width equal to the page size, set the background color to black, and absolutely position it to top:0, left:0 so it covers the entire page. It also sets the <div> opacity to 80% to give a transparent affect so the underlying page is still partly visible.  On some pages and using IE v8 the affect failed and there would be no opacity with only a completely black background.

Continue reading Internet Explorer v8 and Opacity Issues

onClick Event and Javascript Confirm() to Control Postback That Works in All Browsers (that I tested)

Ok, using an onClick event to call a function which uses a confirm() alert to control posting a form has been around for a long time.  Something similar to this:

<input name=’submit’ type=’submit’ value=’Delete’ onClick=’return confdel();’>

One bug that was plaguing us for some time and due to low usage/priority had not been addressed, was that on many of the forms when a user selected Cancel to halt the submit the form was still posting! It was only in Internet Explorer (IE) that showed this bug – Firefox would correctly halt the form.

Long overdue to be corrected and the fix seemed to be elusive. But after numerous Google searches and reading other posts about similar issues and possible solutions I pieced together a fairly straightforward fix that seems to work correctly in browser: FF 4.0, IE8/9, Chrome.  Code sample is just for a simple confirm true/false: 

/* confirm delete */
function confdelappt() { 
        var msg = "\nYou have requested to delete this thing. By deleting this thing you will actually delete it. Are you sure?\n";
        if (confirm(msg)){
            return true;
        }
        else{
                    if (window.event) { //will be true with IE, false with other browsers
                    window.event.returnValue=false; } //IE specific, seems to work
                else {
                    return false; } 
            }
        }
    }

I found (with the help of other posts) that setting “window.event.returnValue=false;” would get IE the recognize that the onClick= event had returned false to then halt processing of the form submit. You could also include similar code for the “true” case but even if IE doesn’t see that the return is “true” the form still submits. Its usually the “false” case that matters most.

Definitely needed is the check that (window.event) is something otherwise the “window.event.returnValue=false;” code will error in browsers like Firefox – when it errors your form most likely will continue processing.

Allow MS Access *.mdb Files for Upload and Download

This will take a surprising number of steps to accomplish. With SharePoint on top of IIS 7, Access files (MDB) get blocked at all three layers of the service stack: IIS, ASP.NET, and SharePoint.  So simply removing them from the blocked file list in the SharePoint Central Administrator isn’t enough — both IIS and ASP.NET still have mechanisms that get in the way.

Step 1) Sharepoint MDB Blocking

There is a list of blocked filetypes in Sharepoint Central Administration –> Operations –> Security Configuration –> Blocked file types. Find *.mdb and delete from list. When you do this an entry will be automatically created in the Sharepoint site’s web.config file,

<system.webServer>
   ….
   <security>
     <requestFiltering>
       …
       <verbs>
         …
       </verbs>
       <fileExtensions>
             <remove fileExtension=".mdb" />
       </fileExtensions>
     </requestFiltering>
   </security>
  ……
</system.webServer>

{Step 2 & 3 after jump}

Continue reading Allow MS Access *.mdb Files for Upload and Download

Sharepoint and Office Integration: Lets Remove It!

Sharepoint’s ability to work seamlessly with Office 2007 and newer can be a great feature – when it works. Click to download and open a Word document, edit then save directly back to the Sharepoint site or using the Explorer View to bulk move files are both examples of integration features that can boost productivity.

The problem is that it requires that the site and all users connecting are within the same domain, the Sharepoint site is added to Internet Properties –> Intranet Sites (Security group),  and all users access the site with Internet Explorer…oh and as noted above Office is 2007 or newer. Otherwise client integration just doesn’t work well or fails completely greatly reducing productivity and frustrating users (as well as those supporting them).

Our Sharepoint site needed to work similarly for a range of browsers (Firefox,Chrome,Safari) and the majority of our user are outside the local Intranet in a trusted domain(s).

Here are the steps I used to remove the integration features to get a more consistent experience for our users. Collaboration on documents requires a few more steps (add saving locally and then uploading) but it works…

Change #1:

Sharepoint Central Management –> Application Management –> Authentication Providers –> Enable Client Integration (No) edit client integration

Continue reading Sharepoint and Office Integration: Lets Remove It!

RPX Plug-in Setup for OpenID Sign-on

[note this post is under going revisions and will be updated]

Some tips on Adding FaceBook sign-on authorization – it takes a number of steps not all of which are well documented on http://rpxnow.com. This post assumes you’ve already installed the plug-in to your site (WordPress in my case) and have it working with the default installed 3rd-party providers (Google, etc…). I’d never created a Facebook App before so I had to allow the Developers App in my account. It then took a while figure out what an API key was and how to get one. After that then finish up the steps for adding Facebook as a sign-on provider back on the rpxnow page.

Continue reading RPX Plug-in Setup for OpenID Sign-on