Robot can solve a Rubik's cube in less than 1.1 seconds

0 comments

2016 predictions

0 comments


I normally don't share lengthy videos, but I stumbled across this one by Joe Colantonio and I was surprised how broadly applicable it was considering the topic and title seemed very specific.  I recommend watching the whole thing even if you're not specifically interested in test automation:

Sync Minecraft worlds to multiple Windows machines/accounts using Dropbox

1 comments


My kids like playing Minecraft but we have multiple computers and laptops and they were asking how to get all their worlds regardless of the machine they're on.  We have a Dropbox subscription but unfortunately the official documentation for syncing multiple folders outside of the single Dropbox sync folder involves creating a Windows shortcut which won't work for Minecraft's Java logic (because the shortcut appends a hidden *.lnk extension so %appdata%\.minecraft\saves becomes %appdata%\.minecraft\saves.lnk and Minecraft won't see it and will create a new empty saves folder).

Fortunately, there's a fairly easy solution (which will work for syncing any number of extra folders to Dropbox):

1.  If you're on Windows 8 or older, install the Microsoft Visual C++ 2005 Redistributable Package (note: 64-bit machines should install BOTH the 32-bit AND 64-bit versions)

2.  Download and install the free Link Shell Extension program

3.  Click Start and in the run box type %appdata%/.minecraft and hit Enter

4.  Click on your Dropbox Desktop icon and click the Dropbox Folder link


5.  Create a folder in the Dropbox folder called minecraft-worlds

6.  Move the saves folder from the .minecraft directory to the new Dropbox minecraft-worlds folder

7.  Right-click the Dropbox saves folder and choose Pick Link Source


8.  In the .minecraft directory, right-click in any blank white area and choose Drop As... > Symbolic Link (accept the Security prompt if it appears)


9.  Run the Minecraft game and make sure your worlds are still available and work as expected.  Then close Minecraft.

10.  Go to another computer and repeat Steps 1-4 (or another account on the same computer do Steps 3-4).

11.  Move the contents of the .minecraft saves folder into the existing Dropbox minecraft-worlds/saves folder then delete the empty .minecraft saves folder

12.  Repeat Steps 7-9

13.  If you have any other computers or accounts, continue repeating Steps 10-12

Enjoy!

Drupal Storage API and AWS S3 tutorial

10 comments


By default, Drupal supports a local public and private file system for storing user uploaded files (images, pdfs, etc.).  While it works well for most use cases, there are disadvantages.  For example, it's nearly impossible to switch from public to private or vice versa.  Once you make your choice, you're stuck with it.  Also, it's somewhat limiting in the modern cloud era with cheap 3rd party cloud storage.  If you have disk space constraints and are considering moving your files to the cloud, the two most popular active Drupal options are S3 File System (s3fs) and Storage API (storage).

s3fs module

    Pros:

  • Active development (three main developers)
  • Uses the official AWS SDK (version 2 only, though)
  • Easy to set up and use
  • Provides a migrate mechanism
    Cons:

storage module

    Pros:
    Cons:

    After weighing the pros and cons, I eventually decided to go with Storage API.  Here's how to migrate an existing site file system to AWS S3 using that module:

    1.  Download the necessary modules: drush dl imageinfo_cache storage_api-7.x-1.x-dev storage_api_stream_wrapper-7.x-1.x-dev storage_api_populate-7.x-1.x-dev

    3.  Optionally apply this fix to suppress a false positive nag error

    4.  Enable the modules: drush en storage storage_stream_wrapper storage_api_populate imageinfo_cache

    5.  Go to /admin/config/media/file-system and change the default download method to Storage API (public or private depending on your site needs)



    6.  Now, for the somewhat labor-intensive step: update all your content type fields that rely on the file system to use Storage API.  For example, edit the Article Drupal content type (/admin/structure/types/manage/article/fields) and edit the Image field and change the upload destination to Storage API (public or private depending on your site needs)

    7.  Once all your content types are updated to use Storage API, you're ready to have your existing files managed by Storage API.  Go to /admin/structure/storage/populate and check Migrate all local files and Confirm and then click Start

    8.  After the process update completes, you can disable the populate module: drush dis storage_api_populate

    9.  Now that all your static files are managed by Storage API, you need to migrate your dynamic image styles: drush image-generate  Choose all for any prompts:


    10.  Once the image styles have been generated (which may take a while to complete), you're ready to verify the migration.  Move everything in the site's files directory except the storage folder and the .htaccess file to a temporary backup location and then run drush cc all && drush cron

    11.  Now, verify the site functions normally.

    Congratulations, you've updated your site to use Storage API!

    ...But you're probably thinking, "Okay, so what's the big deal?  The site looks the same and it just seems like all the files moved into a new folder called storage.  So what?!"

    Well, get ready to experience the awesome power of Storage API by migrating your file system to AWS S3!  (or you could just as easily move them to Rackspace, etc. using the same process...)

    1.  First, you'll need an AWS account with IAM permissions to create S3 buckets and use CloudFront:

    {
    "Statement": [{
    "Sid": "ModifyAssets",
    "Action": [
    "s3:DeleteObject",
    "s3:DeleteObjectVersion",
    "s3:GetObject",
    "s3:GetObjectAcl",
    "s3:GetObjectVersion",
    "s3:GetObjectVersionAcl",
    "s3:PutObject",
    "s3:PutObjectAcl",
    "s3:PutObjectVersionAcl"
    ],
    "Effect": "Allow",
    "Resource": [
    "arn:aws:s3:::yourbucketname/*"
    ]
    }, {
    "Sid": "BucketRights",
    "Action": [
    "s3:ListBucket",
    "s3:ListAllMyBuckets"
    ],
    "Effect": "Allow",
    "Resource": [
    "arn:aws:s3:::*"
    ]
    }]
    }


    {

        "Sid": "Stmt1450391402000",

        "Effect": "Allow",

        "Action": [

    "cloudfront:CreateDistribution",
    "cloudfront:CreateInvalidation",
    "cloudfront:DeleteDistribution",
    "cloudfront:GetDistribution",
    "cloudfront:ListDistributions",
    "cloudfront:UpdateDistribution",
    "cloudfront:ListInvalidations"
    "cloudfront:ListStreamingDistributions"
        ],
        "Resource": [
    "*"
        ]
    }

    2.  Once the account is created with the necessary IAM permissions, you'll need to create an access key:



    3.  Once you have your access key ID and Secret, go to your Drupal site and browse to /admin/structure/storage/create-container

    4.  Choose Amazon S3 from the service dropdown and click Next

    5.  Provide your access key ID, Secret, and a globally unique bucket name (I recommend a name that does NOT include a dot [.] since that's interpreted as a subdomain).  In addition, select the AWS region you want to create the bucket in.  Finally, make sure to check the Serve with CloudFront checkbox (note: streaming with CloudFront is out of scope for this tutorial).  You can optionally select the Reduced redundancy checkbox for cheaper 99.99% durability.  Then click Create.


    Note: it may take up to 20 minutes for the CloudFront processing to complete on the AWS backend but you can continue the setup process below immediately:

    6.  Go to /admin/structure/storage/create-class and give it a descriptive name like "Cloud" (keep Initial container Filesystem for performance reasons) and then click Create class


    Note: like others, I have no idea what the other checkboxes do so leave them unchecked.

    7.  On the subsequent screen, choose Amazon S3 (the container you created in the step above) from the dropdown and then click Add


    8.  Now, go to /admin/structure/storage/stream-wrappers and click edit for Public, Private, or both (depending on your use case) and change the Storage class to Cloud




    9.  Finally, run drush cron to actually push your local files to the AWS S3 bucket.  This may take a while so I strongly recommend using drush instead of the Drupal web interface to run cron.

    10.  Verify the site functions as expected.  The images should now be served from amazonaws.com or cloudfront.net

    11.  Celebrate faster page load times and more file system redundancy!  Also, now that your files are in S3, you can even set up a backup strategy for Infrequent Access or Glacier.

    Lubuntu 15.10 post-install configuration

    0 comments


    After Lubuntu 15.10 was successfully installed, there were still some tweaks I needed to make to be fully satisfied.  Feel free to use or ignore as you see fit:

    Run system update via Start > System Tools > Software Updater

    Set up video card

    Add/Remove applications:
    sudo apt-get install chromium-browser default-jdk libreoffice thunderbird keepassx audacity git xscreensaver xscreensaver-gl-extra p7zip-full shutter avidemux
    sudo apt-get remove gnumeric abiword firefox pidgin sylpheed xpad
    sudo apt-get install libdvd-pkg
    sudo dpkg-reconfigure libdvd-pkg

    Right-click time in bottom-right corner > Select Digital Clock Settings > Change clock format from %R to %l:%M %p

    Change the screen saver: Start > Preferences > Screensaver

    Change the launch bar:
    Right-click the File Manager icon in bottom left corner > Select Application Launch Bar settings > add Thunderbird, Leafpad, KeepassX and LXTerminal

    Change the desktop wallpaper:
    Search for a desired wallpaper and save it to your hard drive.  Right-click desktop and select Desktop Preferences > Appearance tab > Click button next to current Wallpaper image and browse for your new wallpaper.

    Change the default view:
    Open file manager > Edit > Preferences > General tab > set Default View to Detailed List View

    Set Thunderbird to reply to messages above quoted text:
    Open Thunderbird > Edit > Preferences > Advanced tab > General tab > Config Editor... button > search for default.reply_on_top and set the value to 1

    Add printer:
    For my HP Officejet Pro 8100, I needed the HP drivers:
    sudo apt-get install hplip printer-driver-hpijs hplip-gui && sudo hp-setup
    Start > System Tools > Printers  -->  right-click  -->  Set as Default

    Install Chromium plugins:
    https://www.eff.org/https-everywhere
    https://chrome.google.com/webstore/detail/adblock-plus/cfhdojbkjhnklbpkdaibdccddilifddb
    https://chrome.google.com/webstore/detail/wappalyzer/gppongmhjkpfnbhagpmjfkannfbllamg
    https://chrome.google.com/webstore/detail/clear-cache/cppjkneekbjaeellbfkmgnhonkkjfpdn
    https://chrome.google.com/webstore/detail/ghostery/mlomiejdfkolichcflejclcbmpeaniij
    https://chrome.google.com/webstore/detail/recent-bookmarks/olndffocioplakeilhkgenfgdincjlpn

    Edit keyboard shortcuts:  sudo leafpad ~/.config/openbox/lubuntu-rc.xml 

    after the <!-- Keybindings for desktop switching -->  line add:

    <keybind key="C-l">
         <action name="Execute">
               <command>xscreensaver-command -lock</command>
         </action>
    </keybind>

    then, replace:

       <!-- Take a screenshot of the current window with scrot when Alt+Print are pressed -->
        <keybind key="A-Print">
          <action name="Execute">
            <command>scrot -u -b</command>
          </action>
        </keybind>  

    with:

      <!-- Take a screenshot of the current window with shutter when Alt+Print are pressed -->
        <keybind key="A-Print">
          <action name="Execute">
            <command>shutter -a -e</command>
          </action>
        </keybind>

    then, replace:

      <!-- Launch scrot when Print is pressed -->
        <keybind key="Print">
          <action name="Execute">
            <command>scrot</command>
          </action>
        </keybind>  

    with:

      <!-- Launch shutter when Print is pressed -->
        <keybind key="Print">
          <action name="Execute">
            <command>shutter -f -e</command>
          </action>
        </keybind>
       

    ...then save and close the XML file

    Configure shutter:
    create a folder called screenshots in your home directory
    open Start > Accessories > Shutter
    from the menu, select Edit > Preferences
    Main side-tab:
    Filename: %Y%m%d-%NN
    Directory: screenshots
    Actions side-tab:
    Open with: place checkmark next to Built-in Editor
    Behavior side-tab:
    uncheck Display pop-up notification after taking a screenshot
    click the Close button and main shutter window to save the changes

    Logout and log back in to test your changes (Window+L will lock your screen, Print Screen will bring up the entire screen in shutter, and +Print Screen will bring up the active window in shutter)