Sea of Thieves - Couldn't install. We'll retry shortly

28 Mar 2018

If you’re getting the error "Couldn't install. We'll retry shortly" (error code 0x80070006) when trying to install Sea of Thieves through the Microsoft store, try this.

  1. Navigate to C:\Users\[your_user_name]\AppData\Local\Packages\Microsoft.WindowsStore_8wekyb3d8bbwe\LocalCache
  2. Delete all the folders & files in LocalCache - leave the LocalCache folder.
  3. Reboot and retry

If that doesn’t work, try the following:

  1. Open Windows Powershell as Admin
  2. Paste set-ExecutionPolicy RemoteSigned into the terminal and hit Enter.
  3. Press Y to accept.
  4. Paste Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppxManifest.xml"} (all one line) and hit Enter
  5. A lot of stuff will happen. Once it’s done, exit the Powershell terminal.
  6. Reboot and retry

Still not working?

  1. Open a CMD prompt as Admin
  2. Try the following commands one by one (paste + Enter)
    • dism /online /cleanup-image /startcomponentcleanup
    • sfc /scannow
  3. Reboot and retry

I haven’t tested this, but you can try creating a new user and change the new user account from standard to administrator, then login with the new user and test opening and updating store.

For Error 0x80070005 please refer here

AWS Elastic Load Balancer - Force Redirect to HTTPS

09 Feb 2018

In response to the Chrome team’s news that Chrome 68 will mark all non-HTTPS sites as “Non-Secure”, I’ve decided to get this site set up with SSL. As always, my encounters with tech were mildly frustrating, and I’ve documented my solution to an issue below.

Some reference for how this site is set up - I build my site locally, upload it to an S3 bucket. An EC2 instance copies any changes made to the S3 bucket every minute and serves the S3 content. The EC2 instance is tucked behind an Elastic Load Balancer, and it’s all managed by Route 53.

So, you have your ELB set up pointing to your EC2 instance and want to force your user into using HTTPS.

Add the following lines to your /etc/httpd/conf/http.conf (Apache only).

<Directory>
    # You may have existing parameters here. Don't touch.
    RewriteEngine on 
    RewriteCond %{HTTP:X-Forwarded-Proto} ^http$
    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    # You may have existing parameters here. Don't touch.
</Directory>

This would redirect any HTTP traffic coming to our root directory to HTTPS. Enjoy!


Dynamically Resizing Kibana iFrames with Javascript and HTML

19 Jan 2018

If you’re struggling to dynamically resize your Kibana iFrames, you will need two things: Javascript and HTML.

Below is some inline Javascript that will be run onload for each iframe. It is important to note that this script will only work on Kibana tables - not other types of visualizations.

Basically, the script checks to see if the Kibana table has loaded yet - if not, it resets the function with a recursive loop.

Once the Kibana iframe’s table has loaded, we grab that height, and resize the iframe accordingly.

<script>
/* Waits 1 second then checks the iframe again */
function wait_for_load(id) {
  return setTimeout(() => setIframeHeight(id), 1000)
}

/* 
   Called by each iframe onload. 
   Checks if the Kibana table has loaded
   And resizes the iframe when it does
*/
function setIframeHeight(id) {
  if (!id) return;
  const ifrm = document.getElementById(id); // Get our iFrame element using the id
  if (!ifrm) return;

  // If the Kibana iframe table hasn't fully loaded yet, restart this function after a wait
  if (!ifrm.contentDocument || !ifrm.contentDocument.body || 
      ifrm.contentDocument.body.getElementsByTagName('table').length === 0) {
    return wait_for_load(id)
  }

  // Finally! The table has loaded. Let's get the table height and resize the iframe
  const table_height = ifrm.contentDocument.body.getElementsByTagName('table')[0].offsetHeight + 46;
  // The extra 46px of padding helps us avoid IE and Chrome scrollbars on Windows
  ifrm.style.height = table_height + 'px';  
  console.log('We exited the loop for ' + id + ' after setting a height of ' + table_height + 'px');
}
</script>

<!-- Note that the iframes have their onload attribute set to call the above functions -->
<div>
    <iframe id="table1" style="width: 100%;" 
            src="http://your-kibana-source1" 
            frameborder="0" scrolling="no" 
            onload="setIframeHeight(this.id)">
    </iframe>
    <iframe id="table2" style="width: 100%;" 
            src="your-kibana-source2" 
            frameborder="0" scrolling="no" 
            onload="setIframeHeight(this.id)">
    </iframe>
</div>

Improved Jekyll Build Script... Using Bash

18 Jan 2018

I’ve written about my Jekyll build script before. I use this script to deploy this site among others. It is terribly overengineered and unnecessary.

Here is the new and improved version. Instructions for use are below the code itself.

Features
  • JS Minification
  • JS Babel Compiler
  • HTML Minification
  • CSS Minification
  • Thumbnail Generation
  • Intelligent Image Compression
  • Favicon Generation
  • Jekyll Build Process
  • Automatic Upload to S3
  • Setup Mode (Installs Dependencies)
  • Sane Image Names (jpeg, JPG, etc to jpg)
How to Use

Copy the script into a new text file and save the file in the root of your Jekyll directory as upload.sh.

Make sure to set up the options under # BUILD OPTIONS - EDIT THESE in upload.sh.

Install dependencies by running sh upload.sh -s. Requires homebrew.

Then, run the build script by running sh upload.sh -c.

Sample Build Output
daviseford$ sh upload.sh -c
Generated 126 thumbnails (1 new) in ./public/img/thumbnails/
Now running -o7 level compression on 1 .png files in ./public/img/
Finished image tasks
Configuration file: /Users/davisford/Documents/daviseford-jeykll/_config.yml
            Source: /Users/davisford/Documents/daviseford-jeykll
       Destination: /Users/davisford/Documents/daviseford-jeykll/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
         AutoPages: Disabled/Not configured in site.config.
        Pagination: Complete, processed 1 pagination page(s)
                    done in 3.856 seconds.
 Auto-regeneration: disabled. Use --watch to enable.
Babelified JS
Minified JS
Minified CSS
Minified HTML
upload: _site/public/img/misc/aws_cert/AWS_Certified_Logo.png to s3://daviseford-website-code/blog/public/img/misc/aws_cert/AWS_Certified_Logo.png
upload: _site/public/img/thumbnails/misc/aws_cert/AWS_Certified_Logo.png to s3://daviseford-website-code/blog/public/img/thumbnails/misc/aws_cert/AWS_Certified_Logo.png
Uploaded to S3
Created build_log.txt
Done!

Any problems, just email me.