Posted on

OSX Mapping Control F To Find

After using Windows for more than 20 years I have found the switch to OS/X to have been a move that should have happened years ago. I cannot count the thousands of hours of lost productivity. To be fair, it is likely a few hundred hours as OS/X was not a true alternative to the power of Windows until the latest OS/X iterations over the past 5 years. After spending more than EIGHT HOURS trying to get Minecraft working on a 3-year-old PC (windows updates, driver updates, incompatible graphics drivers for Java… the usual Windows debacle) I decided I will rarely-if-ever recommend ANYONE every buy a Windows PC from this point forward.

However the move to OS/X has not been completely pain free. I am heavily trained on Windows and Linux keyboard shortcuts. One of the BIGGEST FAILINGS of OS/X was their decision to create a proprietary keyboard system for OS/X. They introduced things like the command key and the “apple key” along the way when the rest of the OS world standardized on keyboard mappings using the more-than-adequate 100+ keys including control, alt, shift, and the thousands of combinations therein.

After 6 months of using OS/X I still find myself pressing things like control-SOMETHING to perform an action. Control (^) C for copy. ^f for find. ^x for cut. ^v for paste. To perpetuate the keyboard training, I use a Linux virtual machine in GUI mode for my daily WordPress development. Linux adopted the defacto standards of the industry in the early 80s and uses the same key presses defined by , not Microsoft, but IBM.

Today I find the control-key training to slow me down significantly when using native OS/X apps. I found a “fix” for mapping the edit operations fairly quickly. You can do so without using Karabiner (which causes some odd side effects). You can edit the DefaultKeyBinding.dict file in your Users directory on OS/X. Create or edit the file:

You can assign keys like this:

/* Remap Home / End to PC Edition */
"\UF729"  = "moveToBeginningOfLine:";                   /* Home         */
"\UF72B"  = "moveToEndOfLine:";                         /* End          */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:";       /* Shift + End  */

    "^x" = cut:;
    "^c" = copy:;
    "^v" = paste:;

That remaps the oft-used ^c, ^x, and ^v commands to their OS/X equivalents of Command (@) X, @-c, and @-v respectively.

But mapping ^f is a whole other kettle of fish. Mapping the action for find is NOT quite as simple. I tried mapping ^f to @f, which executes a “find action” in most OS/X apps. I tried using the action code “find:”, to no avail.

However there is an easy way to map ^f to find in most apps. MOST apps. Not OS/X Firefox, which appears to not like changing the default keyboard mapping utility. More on that later.

For most apps, let’s take Google Chrome as an example, you can change the ^f to be the find key by using OS/X System Preferences.

OSX Keyboard Shortcuts
OSX Keyboard Shortcuts interface.
  • Go to System Preferences
  • Select Keyboard
  • Select Shortcuts
  • Select App Shortcuts
  • Then click the + to add a new app shortcut.
  • Pick your app, Google Chrome in this case.
  • Now you need to find the EXACT menu text for the find command.  On Google Chrome it is “Find…”.  The … is important.
  • Press the Control-F key combination to set that as the new find command.
  • Exit the app, i.e. Google Chrome, if you had it running (which you did because you had to look at  the Find menu entry text).
  • Restart the app.
  • Your menu should now show the Find shortcut code is ^f
Chrome ^f as Find
Chrome ^f as Find

What about Firefox?   It turns out the mapping shows up but does not work.   The menu shows ^f is the new find key, but it does not activate.  I had to install the Customizable Shortcuts add-on for Firefox and set the find key to be ^f instead of modifier-F (the system-set default).     For some reason Firefox has hard-bound to the modifier key internally instead of using standard OS/X keyboard mapping system calls.   The menu rendering is apparently a separate piece of code.


Posted on

Automated Virtual Box Creation V1.0 Notes

PuPHPet Banner

If you read my previous article,  WordPress Workflow : Automated Virtual Box Creation , you have an idea of what I am trying to accomplish with improving my WordPress development work flow.    The short version, I want to be able to create a fresh install of a virtual machine that has my entire development system intact with minimal input on my part.    The idea is to run a few commands, wait for the installs and updates, and be coding on a “clean” machine shortly after.    Once I get my own work flow updated I will also be able to share my scripts and tools via a git repository with the remote developers that are now working on Store Locator Plus add-on packs and hopefully simplify their development efforts or at least get all of us on a similar baseline of tools to improve efficiency in our efforts.

Here are my notes from the first virtual development box efforts via PuPHPet, Vagrant, and Puppet.    This build was done with recent “off-the-shelf” versions of each of these tools and using a base configuration with a handful of options from the PuPHPet site.

Headless Configuration

The VirtualBox machine appears to be created as a “headless” box, meaning no monitor or other display device is active.   I will need to tweak that as I work “on the box” with GUI development tools.    I know that I can install all of my development tools on my host system and read/write from a shared directory to get all of my work onto the virtual machine, but that is not my methodology.    Having worked with a team of developers I know all too well that eventually the host hardware will die.   A laptop will need to be sent off for repair.   Guess what happens?   You lose half-a-day, or more, setting up a new host with a whole new install of development tools.

The better solution, for my work flow, is to keep as much of the development environment “self contained” within the virtual box as possible.   This way when I backup my virtual disk image I get EVERYTHING I need in an all-in-one restore point.   I can also replicate and share my EXACT environment to any location in the world and be fully  “up and running” in the time it takes to pull down a 20GB install file.  In today’s world of super-fast Internet that is less of an issue than individually pulling down and installing a half-dozen working tools and hoping they are all configured properly.

What does this all mean?    I need to figure out how to get the PuPHPet base configuration tweaked so I can start up right from the VirtualBox console with a full Linux console available.  I’ll likely need to update Puppet as well to make sure it pulls down the Desktop package on CentOS.

I wonder if I can submit a build profile via a git pull request to PuPHPet.

Out-Of-Box Video Memory Too Low

The first hurdle with configuring a “login box” with monitor support will be adjusting the video RAM.   My laptop has 4GB of dedicated video RAM on a Quadro K3100M GPU.   It can handle a few virtual monitors and has PLENTY of room for more video RAM.   Tweaking the default video configuration is in order.

Since Vagrant “spins up” the box when running the vagrant up command the initial fix starts by sending an ACPI shutdown request to the system.     Testing the video RAM concept is easy.   Get to the VirtualBox GUI, right-click the box and select properties.   Adjust the video RAM to 32MB and turn on 3D accelerator (it makes the GUI desktop happy) and restart.

Looks like I can now get direct console login.  Nice!

PuPHPet Virtual Box with Active Console
PuPHPet Virtual Box with Active Console

Access Credentials

The second issue, which I realized after seeing the login prompt, is that I have NO IDEA what the login credentials are for the system.   This doesn’t matter much when you read/write the shared folders on your host to update the server and only “surf to” the box on port 8080 or SSH in with a pre-shared key, but for console login a username and password are kind of important.   And I have no clue what the default is configured as.  Time for some research.   First stop?  The vagrantfile that built the beast.

Buried within that vagrantfile, which looks just like Ruby syntax (I’m fairly certain it is Ruby code), is a user name “vagrant”.    My first guess?  Username: vagrant, password: vagrant.     Looks like that worked just fine.    Now I have a console login that “gets me around”, but it is not an elevated permissions user level such as root.   However, a simple sudo su – resolves that issue granting me full “keys to the kingdom”.

[box type=”info” size=”large” style=”rounded”]Vagrant Boxes Credentials are username vagrant, password vagrant[/box]

A good start.   Now to wreak some havoc to see what is on this box and where so I can start crafting some Puppet rule changes.   Before I get started I want to get a GUI desktop on here.

GUI Desktop

To get a GUI desktop on CentOS you typically run the yum package installer with yum groupinstall Desktop.    A visit under sudo su and executing that command gets yum going and pulling down the full X11/Gnome desktop environment.

A quick reboot with shutdown -r now from the root command line should bring up the desktop this time around… but clearly I missed a step as I still have a console login.  Most likely a missing startx command or something similar in the boot sequence of init.d.

A basic startx & from the command line after logging back in as vagrant/vagrant and my GUI desktop is in place, so clearly I need to turn on the GUI login/boot loader.

Tweaking PuPHPet Box Parameters

Now that I know what needs to change I need to go and create that environment via the PuPHPet/Vagrant/Puppet files so I can skip the manual tweaking process.   After some digging I found the config.yaml file.    When you use PuPHPet this file will be put in the .zip download you receive at the end of the PuPHPet process.   It is in the <boxid>/puphpet/ directory.

PuPHPet config.yaml
PuPHPet config.yaml

While some of the box parameters can be adjusted in these files, it appears much of the hardware cannot be manipulated.  There is a site called “Vagrant Cloud” that has multiple boxes that can be configured.   To switch boxes you can edit the config.yaml file and replace the box_url line to point to one of the other variants that may be closer to your configuration.  Since I don’t see one that is close to my needs it looks like I will have to build my own box profile to be hosted in the cloud.   That is content for another article.


Posted on

WordPress Workflow : Automated Virtual Box Creation

I am into my first full day back after WordCamp Atlanta (#wcatl) and have caught up on most of my inbox, Twitter, and Facebook communications.   As I head into a new week of WordPress plugin production I decided now is as good a time as any to update my work flow.

I learned a lot of new things at WordCamp and if there is one thing I’ve learned from past experience it is DO NOT WAIT.   I find the longer I take to start implementing an idea the less chance I have of executing.

My first WordCamp Atlanta 2014 work flow improvement starts right at the base level.   Setting up a clean local development box.   I had started this process last week by manually configuring a baseline CentOS box and was about to setup MySQL, PHP, and all the other goodies by hand.  That was before I learned more about exactly what Vagrant can do.   I had heard of Vagrant but did not fully internalize how it can help me.  Not until this past weekend, that is.

My Work Environment

Before I outline my experience with the process I will share my plugin development work environment.

  • Host System: Windows 8.1 64-bit on an HP Zbook laptop with 16GB of RAM with a 600GB SATA drive
  • Guest System: CentOS 6.5 (latest build) with 8GB RAM on an Oracle VirtualBox virtual machine
    • Linux Kernel 2.6.32-431
    • PHP v5.4.23
    • MySQL v 14.14 dist 5.5.35
  • Dev Took Kit: NetBeans, SmartGit, Apigen and phpDoc, MySQL command line, vim
HP Zbook Windows 411
My Development System laptop config.

While that is my TYPICAL development environment, every-so-often I swap something out such as the MySQL version or PHP version and it is a HUGE PAIN.    This is where Vagrant should help.  I can spin up different virtual boxes such as a single-monitor versus three-monitor configuration when I am on the road or a box with a different version of PHP.     At least that is the theory anyway.   For now I want to focus on getting a “clean” CentOS 6.5 build with my core applications running so I can get back to releasing the Store Locator Plus Enhanced Results add-on pack this week.

Getting Started With Vagrant

The Rockin’ Local Development With Vagrant talk that Russel Fair gave on Saturday had me a bit worried as he was clearly on the OS/X host and the examples looked great from a command line standpoint.  Being a Linux geek I love command line, but I am not about to run virtual development boxes in in a VirtualBox guest.   Seems like a Pandora’s box to me… or at least a Russian doll that will surely slow down performance.   Instead I want to make sure I have Vagrant running on my Windows 8.1 bare metal host.    That is very much against my “full dev environment in a self-contained and portable virtual environment” standard, but one “helper tool” with configurations backed up to my remote Bitbucket repository shouldn’t be too bad, as long as I don’t make it a habit to put dev workflow tools on my host box. Yes, Vagrant does have a Windows installer and I’m fairly certain I won’t need to be running command-line windows to make stuff work.   If I’m running Windows I expect native apps to be fully configurable via the GUI.  Worst case I may need to open a text editor to tweak some files, but no command line please.

Here is the process for a Windows 8.1 install.

  • Download Vagrant.
  • Install needs to be run as admin and requires a system reboot.
  • Ok… it did something… but what?   No icons on the desktop or task bar or … well… anywhere that I can find!

Well… sadly it turns out that Vagrant appears to be a command line only port of the Linux/OSX variants.    No desktop icons, no GUI interface.   I get it.  Doing that is the fast and easy process, but to engage people on the Microsoft desktop you really do need a GUI.    Yes, I’m geek enough to do this and figure it out.   I can also run git command line with no problem but I am FAR more efficient with things like the SmartGit GUI interface.

Maybe I’m not a real geek, but I don’t think using command line and keyboard interaction as the ONLY method for interacting with a computer makes you a real techie.    There is a reason I use a graphical IDE instead of vim these days.    I can do a majority of my work with vim, but it is FAR more efficient to use the GUI elements of my code editor.

Note to Vagrant: if you are doing a windows port at least drop a shortcut icon on the desktop and/or task bar and setup a Windows installer.   Phase 2: consider building a GUI interface on top of the command line system.

It looks like Vagrant is a lower-level command line tool.   It will definitely still have its place, but much like git, this is a too on which other “helpers” need to be added to make my workflow truly efficient.  Time to see what other tools are out there.

Kinda GUI Vagrant : PuPHPet

Luckily some other code geeks seem to like the idea of  GUI configuration system and guess what?   Someone created a tool called PuPHPet (which I also saw referenced at WordCamp so it must be cool)  and even wrote an article about Vagrant and Puppet.   Puppet is a “add on”, called a provisioner,  to setup the guest software environment.

PuPHPet is an online form-based system that builds the text-file configuration scripts that are needed by Vagrant to build and configure your Virtualbox (or VMWare) servers.   It is fairly solid for building a WordPress development environment, but it does mean reverting back to CentOS 6.4 as CentOS 6.5 build scripts are not online.     Though I am sure I can tweak that line of the config files and fix that, but that takes me one-step away from the “point and click” operation I am looking for.

Either way, PuPHPet, is very cool and definitely worth playing with if you are going to be doing any WordPress-centric Vagrant work.

PuPHPet Intro Page
The PuPHPet online configuration tool for creating Vagrant + Puppet config files.


Puppet Makes Vagrant and PuPHPet Smarter

Now that I have Vagrant installed and I discovered PuPHPet I feel like I am getting closer to a “spin me up a new virtual dev box, destroy-as-desired, repeat” configuration.  The first part of my workflow improvement process.   BUT…. I need one more thing to take care of it seems… get Puppet installed.   I managed to wade through the documentation (and a few videos) to find the Windows installers.

Based on what is coming up in the install window it looks like the installer will roll out some Apache libs, ruby, and the windows kits that help ruby run on a windows box.

Puppet Install Licenses
The Puppet installer on Windows.

Again, much like Vagrant, Puppet completes the installation with little hint of what it has done.    Puppet is another command line utility that runs at a lower-level to configure the server environments.   It will need some of the “special sauce” to facilitate its use.     A little bit of digging has shown that the Puppet files are all installed under the C:\Program Files (x86)\Puppet Labs folder.    On Windows 8.1 the “Start Menu” is MIA, so the documentation about finding shortcuts there won’t help you.    Apparently those shortcuts are links to HTML doc pages and some basic Windows shell scripts (aka Batch Files) so nothing critical appears to have gone missing.

The two files that are referenced most often are the puppet and facter scripts, so we’ll want to keep track of those.   I’ll create a new folder under My Documents called “WP Development Kit” where I can start dumping things that will help me managed my Windows hosted virtual development environment for WordPress. While I’m at it I will put some links in there for Vagrant and get my PuPHPet files all into a single reference point.

WP Dev Kit Directory
The start of my WP Dev Kit directory. Makes finding my PuPHPet, Vagrant, and Puppet files easier.

Now to get all these command line programs to do my bidding.

Getting It Up

After a few hours or reading, downloading, installing, reading some more, and chasing my son around the house as the “brain eating dad-zombie”, I am ready to try to make it all do something for me.    Apparently I need to use something called a “command line”.  On Windows 8.1.

I’m giving in with the hopes that this small foray into the 1980’s world of command line system administration will yield great benefits that will soon make me forget that DOS still exists under all these fancy icons and windows.   Off to the “black screen of despair”, on of the lesser-known Windows brethren of the “blue screen of death”.     Though Windows 8 tries very hard to hide the underpinnings of the operating system, a recent Windows 8 patch and part of Windows 8.1 since “birth” is the ever-useful Windows-x keyboard shortcut.   If you don’t know this one, you should.   Hold down the Windows key and press x.   You will get a Windows pop-up menu that will allow you to select, among many other things, the Command Prompt application.

If you right-click on the “do you really want to go down this rabbit hole” confirmation box that comes up with the Command Prompt (admin) program you will see that it is running C:\Windows\system32\cmd.exe.     This will be useful for creating a shortcut link that will allow me to not only be in command mode but also to be in the “source” directory of my PuPHPet file set.    I’m going to create a shortcut to that application in my new WP Development Kit directory along with some new parameters:

  • Search for cmd.exe and find the one in the Windows\system32 directory.
  • Right-click and drag the file over to my WP Development Kit folder, selecting “create shortcuts here” when I drop it.
  • My shortcut to cmd.exe is put in place, but needs tweaking…
  • Right-click the shortcut and set the “Start in” to my full WP Development Kit folder.

Now I can double-click the command prompt shortcut in my WP Development Kit folder and not need to change directory to a full path or “up and down the directory tree” to get to my configuration environment.

Running Vagrant andn Puppet via PuPHPet Scripts
Running Vagrant andn Puppet via PuPHPet Scripts

A few key presses later and I’ve managed to change to my downloaded PuPHPet directory and execute the “vagrant up” command.   Gears starting whirring, download counters started ticking, and it appears the PuPHPet/Vagrant/Puppet trio are working together to make something happen.  At the very least it is downloading a bunch of stuff from far away lands and filling up my hard drive.   Hopefully with useful Virtualbox disk images and applications required to get things fired up for my new WordPress dev box.

We’ll see…

Link Summary

Posted on

Forcing Display Resolution on VirtualBox and CentOS 6.5

VirtualBox Display Resolution

Last evening my Oracle VM VirtualBox development system stopped auto-detecting my guest display resolution when I re-connected my laptop to the docking station.   The maximum resolution I could get was 1600 x 1200 instead of the native display resolution of 1920 x 1200.   After literally hours of research this morning with many dead-ends I found the proper solution.  Here is my “cheat sheet” on how I got it working in my dev environment.

For CentOS 6.x systems the system-config-display command is obsolete.  The replacement, for today anyway, is xrandr.

VBoxManage is useless unless you are running the virtual box management service, which is not a typical default setup for VirtualBox on a Windows host.

Updating VirtualBox guest additions does not help if you already have a current version.  You WILL need VirtualBox guest additions for the display driver interface on the guest operating system to function properly.   If you don’t have that installed you can use the GUI interface and finding the “machine / install guest additions” option.   It should drop a CD image on your CentOS 6.5 desktop that you can run with autoprompt.  Run it as a priv’ed user such as root.

Once you have VirtualBox guest additions installed login to your system and get to the command prompt.    Switch to a priv’ed user.  I login as my standard account and execute the command:

# sudo su -

To setup xrandr and add a manual resolution to your list you need to get the configuration setting line.   Use the utility cvt to get the right command line.  Here is the command to find the xrandr mode for a 1920 x 1200 resolution:

# cvt 1920 1200

It returns the line:

Modeline "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync

Those are the parameters for my particular monitor configuration.  It is a basic reference label, a configuration tag, and monitor timing, resolution, and sync timings.  This will be specific to your monitor so run the cvt command, don’t just copy the line here.

For xrandr you will need everything AFTER the Modeline portion.

Find out what monitors your system thinks it has.  I have 3 monitors so this is my output:

# xrandr
Screen 0: minimum 64 x 64, current 4800 x 1200, maximum 16384 x 16384
VBOX0 connected 1600x1200+0+0 0mm x 0mm
   1600x1200      60.0*+
   1440x1050      60.0  
   1280x960       60.0  
   1024x768       60.0  
   800x600        60.0  
   640x480        60.0  
VBOX1 connected 1600x1200+1600+0 0mm x 0mm
   1600x1200      60.0*+
   1440x1050      60.0  
   1280x960       60.0  
   1024x768       60.0  
   800x600        60.0  
   640x480        60.0  
VBOX2 connected 1600x1200+3200+0 0mm x 0mm
   1600x1200      60.0*+
   1440x1050      60.0  
   1280x960       60.0  
   1024x768       60.0  
   800x600        60.0  
   640x480        60.0  
  1920x1200_60.00 (0x10c)  193.2MHz
        h: width  1920 start 2056 end 2256 total 2592 skew    0 clock   74.6KHz
        v: height 1200 start 1203 end 1209 total 1245           clock   59.9Hz

Now to add the manual entry so I can later use the CentOS 6.5 GUI display manager to set the resolution:

# xrandr --addmode VBOX0 "1920x1200_60.00"
# xrandr --addmode VBOX1 "1920x1200_60.00"
# xrandr --addmode VBOX2 "1920x1200_60.00"

Now I can go to System / Preferences / Display on the system admin menu.

CentOS 6.5 Forced Display Resolution
CentOS 6.5 Forced Display Resolution
Posted on

Skip Obtaining Drivers From Windows Update

For the past month I’ve been annoyed by the amount of time it takes for my new bluetooth headset to pair itself with windows.  The problem is not the bluetooth pairing but the actual device “coming online” and Windows 7 subsequently deciding it need to locate and install a new driver EVERY SINGLE TIME the device is connected.    The problem is that Windows 7 always searches the online directory first for any new drivers or updates.  That takes FOREVER.

Slight diversion into my theory of Windows 7 Driver Search technology.  I swear they are sending the driver request to a computer that has electrodes hooked up to trained baby squirrels.  The squirrels then go out into the forest looking for a nut they buried at some point in the past.  This process takes approximately 10 minutes 37.23 seconds to complete.   The special Microsoft Squirrel Automatron (the MSA) then retrieves said nut from the trained baby squirrel and scans it for a bar code that indicates which driver should be downloaded to your PC.    Most of the time the squirrels eat the nut on the way and you get “no driver found”.   Every now-and-then a squirrel gets hit by a car which is the real reason why your PC locks up randomly or throws a blue screen of death.     Either way the process is slow and it sucks.

So in an effort to save the lives of baby squirrels I finally decided to take 3 minutes to turn of that damned “Searching Windows Update For Drivers” process that happens EVERY SINGLE TIME I turn on my bluetooth headset.   It only took about 33 different times of either waiting for Windows to finally get a nut from the squirrel or for me to abort the process early and click the “skip obtaining drivers from windows update” link before I did this. Hopefully you found this post after the 3rd or 4th day of dealing with that driver installation delay.

Here is how you turn off the automatic “Searching Windows Update for drivers”.   This is especially useful for devices you’ve installed previously and know you have a driver that works already on your system.   It will also keep the Windows Update driver search intact for those times when you install a new piece of hardware and do not have a driver already available locally.

  • Go to the Windows Start Menu.
  • Right-click on Computer.
  • Select Properties.
Windows 7 Computer Properties
Windows 7 Computer Properties


  • Click Advanced System Settings.
Windows 7 Advanced System Settings
Windows 7 Advanced System Settings


  • Click on the Hardware tab.
  • Click the Device Installation Settings button.
Windows 7 Device Installation Settings
Windows 7 Device Installation Settings
  • Click the No, let me choose what to do radio button.
  • Click the Install driver software from Windows Update if it is not found on my computer radio button. (the Save The Squirrels button).
  • Click Save Changes.
Windows 7 No Let Me
Windows 7 No Let Me

Click OK or the close window box back through the stack of windows until you are back to your starting point.


Posted on

Back Up Google Drive with CrashPlan

Today, as I put another spreadsheet with Store Locator Plus and Enhanced Results features onto Google Drive, I realized something.   If Google Drive crashes, very unlikely but stranger things have happened, I don’t have a backup copy of ANY of my Google Drive documents.  There are a lot of things I have out there that I really don’t want to re-create.   It is even more important now that I am using Google Drive to store spreadsheets that are an integral part of my WordPress plugin documentation.

While I’m thinking of it, let’s go down that road for a moment.

Using Google for WordPress Tables

A few days ago I wanted to start building an “add on pack comparison” to the site.   It helps me organize my thoughts on what features belong in which plugins, reminds me of where I put those features, and also educates the consumer on what plugin they may be interested in.    I decided a wide table with side-by-side columns for each plugin was the best option.   Since it is not a true price comparison I needed a flexible grid display.

I tried a number of table plugins that are out there in the WordPress extensions directory.   Unfortunately a large number of those plugins were defunct, many not updated in years.   The few that were updated were adequate but too hard to man-handle to look  just the way I wanted, requiring extensive CSS updates and HTML man-handling to behave as I desired.  Sure, some of those, like TablePress, had options to make those efforts easier but still not effortless.

Then I stumbled across a post that discussed inserting a Google spreadsheet in the middle of a page.   You create a spreadsheet, format it how you like, and then publish to web.   Select the “embed code” and get the unique iframe tag to put on your site.  While I was leary of the iframe idea, it worked beautifully.   Now I can format the colors, fonts, and column data exactly how I want with the ease of updating the Google spreadsheet.  It is far easier to click a cell and the color box and see the background change than tweak CSS all day.

If you are trying to put tables in WordPress you may want to check that out.     Create the spreadsheet in Google, go to “publish to web”, publish, go to “get embed code”, copy the iframe HTML snippet, and paste into your page or post (in text mode).   Tweak the width and height parameter to fit your site.  Done.

embedded google spreadsheet
embedded google spreadsheet

Check off “auto-republish” and every time you make a change it will reflect on the website within a few hours (or you can force a manual republish if you need if faster).


Backing Up Google Drive

So back to the backup issue.   I have a lot of doc, some integral to my public site, on Google Drive.   I NEED to back those up.    How did I do it?  Turns out easier than I thought.

First, I run CrashPlan as my backup service.  MUCH better than Mozy which is over-priced, IMO.   A MILLION TIMES better than Carbonite, which is slow as heck, throttles the computer, has horrible restore times, and worse support response times.   In fact if you are considering backup my only key recommendation is do NOT use Carbonite.  There is a reason you hear about them all the time, they are hiding a poor design and poor service with a huge marketing budget.

Second, getting the Google Drive content to the CrashPlan backup.   Easy.   Install Google PC Drive.   When you log into Google Drive there is a subtle link in the left sidebar for this app.    It is an program that will be installed on your local computer.   It creates a folder on your computer which is the “local sync” for the Google Drive content.  You can select which folder you want to keep in sync.   I just let it do the whole thing since I have plenty of space on the 1TB drive in my notebook computer.

Now I have a local copy (first stage backup) of everything on Google Drive.   Even better, if I create something in that folder OR on Google Drive it will be auto-replicated on both sides.   That makes for a good first stage backup strategy.

Second, since this folder goes under your user directory by default CrashPlan should automatically note the new content and mark it for backup, which it did on my system.  If it does not do this you can manually add the Google sync folder to the backup plan.

crash plan and google drive
crash plan and google drive


I like easy.


Henry Houh contact me last week about an issue with this type of backup.     It turns out Crash Plan will not back up ANYTHING by default when using this configuration.  Why?    Crash Plan runs as the user “SYSTEM” not as your normal login user.     Google Drive runs as you.

In my case the Google Drive folder was created with “Full Control” permission for me but NO permissions for the system user “System”.

The fix?

Go to the Google Drive folder, not the shortcut.

Right-click and select properties.

Select the security tab.

Click the Edit button.

google drive properties

Type “System” in the add user box.

Click “Check Names”.

Click OK.

Click on System in the list of users.

Check off “Full Control” under the allow column.

Click OK.

Click OK.

google drive with system properties

Now your Google Drive content will be backed up to Crash Plan.

Posted on

Custom Ubuntu Keyboard Layouts

Sometimes a programmer just has to have certain keys in certain places.

For instance, I like my number keys and symbol key switched, so I don’t have

to press shift to type symbols.

Here’s how I created a custom keyboard layout in Ubuntu:

In the file /usr/share/X11/xkb/symbols/us, I added the following section, thus modifying my default layout:

partial alphanumeric_keys modifier_keys
xkb_symbols "basic" {
name[Group1]= "USA";

// Alphanumeric section
key <TLDE> {        [asciitilde,        grave            ]        };
key <AE01> {        [    exclam,        1                ]        };
key <AE02> {        [        at,        2                ]        };
key <AE03> {        [ numbersign,       3                ]        };
key <AE04> {        [    dollar,        4                ]        };
key <AE05> {        [   percent,        5                ]        };
key <AE06> {        [ asciicircum,      6                ]        };
key <AE07> {        [ ampersand,        7                ]        };
key <AE08> {        [  asterisk,        8                ]        };
key <AE09> {        [ parenleft,        9                ]        };
key <AE10> {        [ parenright,       0                ]        };
key <AE11> {        [     minus,        underscore       ]        };
key <AE12> {        [     equal,        plus             ]        };
key <AD01> {        [         q,        Q                ]        };
key <AD02> {        [         w,        W                ]        };
key <AD03> {        [         e,        E                ]        };
key <AD04> {        [         r,        R                ]        };
key <AD05> {        [         t,        T                ]        };
key <AD06> {        [         y,        Y                ]        };
key <AD07> {        [         u,        U                ]        };
key <AD08> {        [         i,        I                ]        };
key <AD09> {        [         o,        O                ]        };
key <AD10> {        [         p,        P                ]        };
key <AD11> {        [ bracketleft,      braceleft        ]        };
key <AD12> {        [ bracketright,     braceright       ]        };
key <AC01> {        [         a,        A                ]        };
key <AC02> {        [         s,        S                ]        };
key <AC03> {        [         d,        D                ]        };
key <AC04> {        [         f,        F                ]        };
key <AC05> {        [         g,        G                ]        };
key <AC06> {        [         h,        H                ]        };
key <AC07> {        [         j,        J                ]        };
key <AC08> {        [         k,        K                ]        };
key <AC09> {        [         l,        L                ]        };
key <AC10> {        [ semicolon,        colon            ]        };
key <AC11> {        [ apostrophe,       quotedbl         ]        };
key <AB01> {        [         z,        Z                ]        };
key <AB02> {        [         x,        X                ]        };
key <AB03> {        [         c,        C                ]        };
key <AB04> {        [         v,        V                ]        };
key <AB05> {        [         b,        B                ]        };
key <AB06> {        [         n,        N                ]        };
key <AB07> {        [         m,        M                ]        };
key <AB08> {        [     comma,        less             ]        };
key <AB09> {        [    period,        greater          ]        };
key <AB10> {        [     slash,        question         ]        };
key <BKSL> {        [ backslash,        bar              ]        };
// End alphanumeric section

Each line in this file tells Ubuntu what character to type when a particular key is pressed. For instance, in a line like

key  {        [ numbersign,       3                ]        };

…we can see that key “AE03” will produce the number sign by default, and “3” when shift is held down. This is reverse of the normal layout, since it reflects my customization. The original line would read:

key  {        [ 3,        numbersign                ]        };

All the spaces being used to line everything up are just to help make things look nice and neat, and could just as easily be left out.

After modifying this file, I went to “System > Preferences > Keyboard” and clicked the “Layouts” tab. I added the layout, which was found under the United States country. I had some problems with the layout switching arbitrarily, or applying in one program but not others, so I disabled all other layouts.

It’s as easy as that. Remember to make a backup of your original /usr/share/X11/xkb/symbols/us file, and hack away!

Posted on

Linux mdadm tips & tricks

RAID arrays are an important part of any mission critical enterprise architecture. When we talk RAID here we are talking mirrored RAID, or mirrored and striped RAID, not simply striping which gives you a larger drive from several smaller drives. While that may be great for some home or desktop applications, for a enterprise application that simply doubles your changes of a failed system.

We often spec out RAID 1 or higher mirrored systems with RAID 1+0 being the most common (mirrored and striped) so that you increase access performance AND keep the system up if a single drive fails (on a 3 drive RAID 1+0 configuration). Along the way we’ve learned some tips & tricks that may help you out. To start with we’ll post some info on Linux RAID and eventually expand this article to include Windows information.

Fake v. Real Raid

One thing we’ve learned recently is that in the flood of new low cost servers there has also been a flood of those servers coming with on board RAID controllers. Unfortunately these new RAID controllers use a low cost solution that basically pretends to be a RAID controller by modifying the BIOS software. In essence they are software RAID controllers posing a hardware RAID controllers. This means you have all of the BAD features of both systems.

One easy way to tell if you have a server with “fake raid” is to configure the drives in RAID mode from the BIOS. Then boot and install Linux. If the Linux install sees both drives versus a single drive then the “on board RAID” is a poser. Skip it. Configure the BIOS in standard drive mode & use the software RAID.

Most current Linux distros have RAID setup and configuration built into the setup and installation process.   We’ll leave the details to other web articles.

MDADM – Linux RAID Utility

mdadm is the Linux utility used to manage and monitor RAID arrays.   After configuration a pair of drives, typically denoted with sda0, sdb0 etc. show up in your standard Linux command as md0.   They are “paired up” to make up the single RAID drive that most of your applications care about.

Status Report

mdadm is how you look “inside” the single RAID array and see what is going on.   Here is an example of a simple “show me the status” command on the RAID array.  In this case we have a failed secondary drive in a 2-disk RAID1 array:

[root@dev:log]# mdadm --detail /dev/md0
 Version : 00.90.03
 Creation Time : Thu Jan  8 12:20:13 2009
 Raid Level : raid1
 Array Size : 104320 (101.89 MiB 106.82 MB)
 Used Dev Size : 104320 (101.89 MiB 106.82 MB)
 Raid Devices : 2
 Total Devices : 1
Preferred Minor : 0
 Persistence : Superblock is persistent
 Update Time : Wed Jul 28 07:27:08 2010
 State : clean, degraded
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
 Spare Devices : 0
 UUID : a6ef9671:2a98f9e9:d1146f90:29b5d7da
 Events : 0.826
 Number   Major   Minor   RaidDevice State
 0       8        1        0      active sync   /dev/sda1
 1       0        0        1      removed

[root@dev:~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb[1] sda1[0]
 104320 blocks [2/2] [UU]

md1 : active raid1 sda2[0]
 1020032 blocks [2/1] [U_]

md2 : active raid1 sda5[0]
 482431808 blocks [2/1] [U_]

unused devices: <none>

Rebuild An Array

Shut down the system with the failed drive, unless you have a hot-swap drive setup. Pull the bad drive, partition it if necessary, and tell MDADM to rebuild the array.

[root@dev:~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[0]
 104320 blocks [2/1] [U_]

md1 : active raid1 sda2[0]
 1020032 blocks [2/1] [U_]

md2 : active raid1 sda5[0]
 482431808 blocks [2/1] [U_]

unused devices: <none>
[root@dev:~]# mdadm --add /dev/md0 /dev/sdb1
mdadm: added /dev/sdb1
[root@dev:~]# mdadm --add /dev/md1 /dev/sdb2
mdadm: added /dev/sdb2
[root@dev:~]# mdadm --add /dev/md2 /dev/sdb5
mdadm: added /dev/sdb5

This command adds the replaced drive, /dev/sdb in our case for our second SATA drive, to the first RAID array named md0.

Remove A Drive

To remove a drive it must be marked faulty, then removed.

[root@dev:~]# mdadm --fail /dev/md0 /dev/sdb
[root@dev:~]# mdadm --remove /dev/md0 /dev/sdb

We had to do this on our drive because we forgot to partition it into a boot and data (/ and /boot and /dev/shm) partition.  Thus the /dev/sdb instead of /dev/sdb1, etc. as it the norm for a partitioned drive.

Checking Rebuild Progress

[root@dev:~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
 104320 blocks [2/2] [UU]
md1 : active raid1 sdb2[1] sda2[0]
 1020032 blocks [2/2] [UU]
md2 : active raid1 sdb5[2] sda5[0]
 482431808 blocks [2/1] [U_]
 [>....................]  recovery =  0.8% (4050176/482431808) finish=114.5min speed=69592K/sec
unused devices: <none>

FDISK – Drive Partitioning

To properly re-add a drive to an array you will need to set the partitions correctly.  You do this with fdisk.  First, look at the partitions on the valid drive then copy that to the new drive that is to replace the failed drive.

[root@dev:~]# fdisk /dev/sda

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
 (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

 Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   fd  Linux raid autodetect
/dev/sda2              14         140     1020127+  fd  Linux raid autodetect
/dev/sda3             141         741     4827532+  8e  Linux LVM
/dev/sda4             742       60801   482431950    5  Extended
/dev/sda5             742       60801   482431918+  fd  Linux raid autodetect

[root@dev:~]# fdisk /dev/sda

Use "n" to create the new partitions, and "t" to set the type to match above.
That should get you started.  Google & Linux man commands are your friend.  As we have time we’ll publish more Linux RAID tricks here.

Posted on

Ubuntu – No Audio When Playing Videos

I recently tried to play a video on Ubuntu 10.04, but got no audio because of missing a Windows Media Audio codec. My video player tried to automatically find a suitable plugin and failed. So here’s how I fixed it by hand.

Step One: Update mplayer

The version of mplayer that comes with Ubuntu is behind the times.
But that’s easy to fix.

    $ sudo add-apt-repository ppa:rvm/mplayer
    $ sudo apt-get update
    $ sudo apt-get upgrade mplayer

Bam. Done. Also why not install smplayer while you’re at it—has a much better interface in my opinion.

*Note:* If you prefer to use something else like vlc then upgrading may not be necessary. Check the documentation for your preferred movie player to see about its WMA support.

Step Two: Discover the DLL You Need

This is easy: just try playing the file from the command line.

Something like

    $ smplayer legitimate_copy_of_a_movie_i_totally_own.wmv

If you see a ton of output, and hear no audio, then you are missing a library. Thankfully (s)mplayer will tell you exactly what this library is called; just look in the output for the name of a `.dll` file mentioned in conjunction with audio.

Step Three: Add the DLL

Get on your favorite search engine, enter the DLL, and find a copy to download.

Whatever DLL you need, take it and put it in the directory `/usr/lib/codecs`. The directory probably does not exist, so create it first, of course. Video players will automatically look there for the DLLs they need.

After that, you should all be set. That’s how I was able to get audio out of Windows Media Player 9 files. Hope it helps you too.

Posted on

Changing Network Device Priorities In Vista

My Windows Vista laptop has a strong desire to always connect to the wireless network, even when I’m connected-by-wire at the office.   This is due to the fact that most Windows laptops are setup to use the wireless connection first if there is a wireless signal available.   While I was always able to quickly find this setting in Windows/XP, on Windows Vista it is hidden away in a “advanced menu”.   For some reason I always forget how to find it, thus this blog post serves as my own memory kit.

How To Change Network Priorities In Vista

  • Go to your mange networks settings.
    I like to get there by right-clicking the network icon in the systray & selecting “manage networks”.
    You can also go to the start menu, control panel, network connections
  • Hold down the ALT key, release then click “Advanced Settings…” within a  few seconds.
    This is the “secret sauce” that gets you to the advanced menu.
  • Move around the entries under Adapaters and Bindings (first tab) / Connections (first list box).
    This changes which connection will be served first.

That’s it. Hope these tricks helped you as well.

Posted on

Windows XP – Resolving Aquiring Network Address Problems

We need your help!

Cyber Sprocket is looking to qualify for a small business grant so we can continue our development efforts. We are working on a custom application builder platform so you can build custom mobile apps for your business. If we reach our 250-person goal have a better chance of being selected.

It is free and takes less than 2 minutes!

Go to
Click on the “Login and Vote” button.
Put “Cyber Sprocket” in the search box and click search.
When our name comes up click on the vote button.


And now on to our article…

After spending nearly a week on & off removing a virus from a notebook computer, we are down to one last task… getting the network services back online.   Here are some notes about how to get around this problem and the ever-present “acquiring network address” that never is acquired.

Resetting Windows Network Stacks

  • To reset the Windows/XP TCP/IP stack use this command from the command shell:
    netsh int ip reset reset.log
  • To reset the Windows/XP Socket layer, use this command from the command shell:
    netsh winsock reset catalog

Check For Rootkits

Turns out the virus installed a rootkit.  These are special files hidden by the operating system that change how the base OS works.  That makes them hard to detect & remove with normal spyware.  TDSS rootkit by Kapersky Labs helps fix that:

In our case the file c:\WINDOWS\system32\DRIVERS\isapnp.sys was compromised.  You can repair this with a Windows XP recovery (sometimes) by following these instructions :

In our case Combo-Fix also found problems with:

  • c:\windows\bootstat.ocx
  • c:\windows\Copy of notepad.exe
  • c:\windows\system32\drivers
  • c:\windows\system32\drivers\Packet.dll
  • c:\windows\system32\drivers\Thumbs.db
  • c:\windows\system32\drivers\wpcap.dll