Cost Allocation Tags – tracking costs of your EC2 instances

AWS provides Cost Allocation Tags to track costs of instances so you can separately track costs in different Stacks / Environments – e.g. Development and Production

https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html

See also here on Activating these Tags: https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/activate-built-in-tags.html

Jinja Templates and JSON with Python

  1. Loading up a Jinja Template and some JSON using Python then outputting that JSON in the template:

k.py

template.j2

api.json

2. Outputting the value of api when done is true

api.json

template.j2

See also:

http://jinja.pocoo.org/docs/dev/templates/#expressions

 

Slowness of Google Docs

Don’t get me wrong. I love Google Docs.

But it’s slowness drives me crazy.

When I start opening a Doc it goes through several frustrating phases (with very rough times):

  1. blank page – 5 seconds
  2. content (which can’t be edited) – another 10 seconds
  3. rendering table of contents in sidemenu – another 3 seconds

The frustrating stages are 2 and 3 where it feels as if I should be able to edit content but can’t.

In total, it’s almost 20 seconds before the content can be edited. What makes it even more frustrating is that during phase 2 it appears as if the content can be edited but can’t until various other things have loaded.

Software and cascading problems

One of my pet peeves about software is how problems seem to cascade. E.g. I have an app I built which is on the App Store. I temporarily took it off the market as a supplier who provides some of the data was experiencing problems. They resolved the issue so I decided to put the app back on the market. I have a bookmark to the iTunes Connect dashboard. The dashboard needs a password. To avoid having to remember all these passwords or write them down somewhere I store in another piece of software called 1Password.

However, I got an error saying “Browser could not be verified”.

I Google’d the problem but the page (https://discussions.agilebits.com/discussion/72074/browser-could-not-be-verified-after-updating-the-1-password-app-on-mac ) was loading extremely slowly. When the page finally loaded it suggested restarting my Mac.

Various software updates took advantage of the system restart so it was around 10 minutes before I could connect to iTunes Connect.

Now, that error had gone but clicking on the password entry didn’t fill out the email and password as usual. I had to manually copy it from 1Password and paste it in.

Finally, once in the iTunes Connect dashboard, I had to figure out how to put the app back on sale. The Dashboard looked like this:

  1.  a menu at the top:

App Store Features TestFlight Activity App AnalyticsSales and Trends

None of which seemed relevant.

2.  a sidebar with:

APP STORE INFORMATION

App Information

Pricing and Availability

iOS APP

3.6.0 Developer Removed From Sale

tvOS APP

1.0 Prepare for Submission

VERSION iOS tvOS

3. a content block with this at the top:

Developer Removed From Sale

Nothing here seemed particularly clear about how you put the app back on the market.

So, some more Google’ing.

The first link was to Apple’s documentation:

https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/ChangingAppStatus.html

The problem with this documentation is that it goes on for literally dozens of pages. I really wanted an answer that didn’t involve half an hour of wading through vast reams of unrelated text.

So I visited the second link on an iPhone development forum:

http://iphonedevsdk.com/forum/business-legal-app-store/113598-app-is-developer-removed-from-sale-can-you-put-it-back-on.html

which went something like this:

Question: Hi guys, just a quick question, when I remove the app from sale (developer removed from sale) it is still in my “menage apps screen”, how can I put it back on sale? Does it need to go through a review process again?

Answer: No, just turn it on again by selecting which country you want it in

Not terribly useful as it didn’t tell you how you select countries.

Back to the Apple docs.

Scanning through it I found, around 3/4 of the way down the document (around 11 pages of text) I finally found the information I needed, confusingly under Removing an App from Sale.

You have to go into Pricing and Availability, select “Available in all territories” and Save.

This was a pretty trivial example but shows off some of the complexity that can accumulate. A simple thing like ticking a box took around an hour to do.

What happens when a browser requests a web page like example.com?

  1. you enter example.com
  2. your browser will do a DNS look up for the IP address of this URL. This process is:
    1. check browser cache – the OS does not tell the browser the TTL for each DNS record so the browser caches DNS records itself for 2 – 30 minutes
    2. check OS cache – e.g. gethostbyname on the Mac and Windows
    3. check router cache
    4. check ISP DNS cache
    5. recursive search
      1. root nameserver
      2. .com nameserver
      3. example.com nameserver
  3. browser sends a GET HTTP request to the web server along with other headers. e.g.
    1. Host: example.com
    2. Accept: types of responses it will accept
    3. Connection: TCP connection
    4. Cookie:
  4.  server probably responds with a 301 Permanent redirect to www.example.com
  5. browser sends out another request to www.example.com
  6.  server handles the request
    1. i.e. it reads the request, any parameters and cookies
  7. server sends back an HTML response which consists of
    1. HTTP/1.1 200 OK header
    2. Cache-Control:
    3. Expires:
    4. Pragma:
    5. Content-Encoding: gzip
    6. Content-Type: text/html; charset=utf-8
    7. Date:
    8. Byte blob which the Content-Encoding section tells you is gzip’d.
    9. Decompress the blob to get the HTML
  8. Browser renders the HTML as it starts receiving it
  9. Browser sends requests for objects embedded in the HTML. E.g.
    1. images
    2. CSS
    3. JS
  10. Browser sends further AJAX

See  Hypertext Transfer Protocol — HTTP/1.1 (RFC 2616): https://tools.ietf.org/html/rfc2616

Uploading an iOS app to the iTunes Store – There are one or more issues with the following platform(s): 1 unresolved iOS issue

Issues

I had various issues updating a recent version of an app we were submitting. The app worked perfectly fine on the App Store except we had the issue:

4:00pm

There are one or more issues with the following platform(s):
1 unresolved iOS issue

which gave:

From Apple
Dear Developer,

On September 1, 2016, we announced that we’re implementing an ongoing process of evaluating and removing apps that no longer function as intended, don’t follow current review guidelines, or are outdated.

We noticed that your app has not been updated in a significant amount of time.

Next Steps
To keep your app on the App Store, submit an updated version for review and make sure it follows the latest App Review Guidelines. If you are unable to submit an update within 30 days, your app will be removed from the App Store until you submit an update and it is approved.

If Your App is Removed
Your app will remain fully functional for current users. They will experience no interruption to services, will still be able to buy in-app purchases, and can re-download the app while restoring from an iCloud or iTunes backup. However, we recommend that you update your app as soon as possible to reinstate it on the App Store and ensure that it remains functional and engaging for new and existing customers.

You can continue to use your current app name, as your app has not been deleted from your account.

Additional Information
Learn more about changes to the App Store and keeping your apps up-to-date.
App Store Improvements
App Review Resources
Debugging Your Apps

Best regards,
App Store Review

We uploaded another version of the app and immediately started running into issues. A few hours here’s where we’d got to:

7:40pm

  1. iTunes Store operation failed.
    Missing 64-bit support. iOS apps submitted to the App Store must include 64-bit support and be built with the iOS 8 SDK or later. We recommend using the default “Standard Architectures” build setting for “Architectures” in Xcode, to build a single binary with both 32-bit and 64-bit support.

Fortunately this was solved using http://stackoverflow.com/questions/32514787/xcode-missing-64-bit-support-with-standard-architectures-enabled

8:00pm

2. iTunes Store operation failed.

Missing required icon file. The bundle does not contain an app icon for iPhone / iPod Touch of exactly ‘120×120’ pixels, in .png format for iOS versions >= 7.0.

8:30pm

From http://stackoverflow.com/questions/18736954/missing-recommended-icon-file-the-bundle-does-not-contain-an-app-icon-for-iph

we made a complete set of icons using https://makeappicon.com/ but same problem.

8:45pm

Finally found the Asset Catalog section in the depths of the Settings under General > App Icons and Launch Images.

So annoying that you can’t copy and paste IDE text like “App Icons and Launch Images”.

Apparently there was already an Asset Catalog (which you can find by clicking the little grey arrow) next to the name of the Asset Catalog. However:

  1. this was empty and
  2. I couldn’t find it in the Xcode file listing

I deleted both xcassets files.

Now I had a red App Icons Source > AppIcon in the Settings. I couldn’t see how to add another Asset Catalog.

This (https://guides.codepath.com/ios/Adding-Image-Assets) suggested clicking on the xcasset file in Xcode however I couldn’t find it. The solution was File > New File and select Asset Catalog. Then click on the Asset Catalog and add the files.

9:00pm

Now the icons were working but we’d created a new error:

None of the input catalogs contained a matching launch image set named  “LaunchImage”.

I now needed to find LaunchImages from somewhere.

Checking through the repo using git but couldn’t it.

9:25pm

I’ve now spent the best chunk of a day trying to re-release a completely working app. I’ve given up and will try again tomorrow.