AWS Lambda Triggers

The GUI has changed recently and it’s not as easy to find them.

They’re now in Lambda > Functions > Configuration in the Designer pane.

Assuming you’ve added a Trigger from the list on the left, then, to Enable, click on the Trigger and change it to Enabled.

http://www.snowcrash.eu/wp-content/uploads/2018/07/Screen-Shot-2018-07-20-at-09.56.31-300x192.png 300w, http://www.snowcrash.eu/wp-content/uploads/2018/07/Screen-Shot-2018-07-20-at-09.56.31-768x493.png 768w, http://www.snowcrash.eu/wp-content/uploads/2018/07/Screen-Shot-2018-07-20-at-09.56.31-588x377.png 588w, http://www.snowcrash.eu/wp-content/uploads/2018/07/Screen-Shot-2018-07-20-at-09.56.31.png 1143w" sizes="(max-width: 474px) 100vw, 474px" />

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-add-triggers-lam-console.html

Output user, path and git branch at Mac prompt

This outputs the user, your path and the git branch:

https://stackoverflow.com/a/6086978/343204

Understanding the Mac Wifi signal

If your Mac Wifi seems to be struggling here’s how to find out more about what’s actually going on.

Signal strength:

The  Mac’s menu bar has a rudimentary set of signal strength icons. E.g.

which means practically nothing.

If it’s less than 4 bars you’re probably going to struggle. However, here’s how to find out more.

  1. Alt click the icon and look for RSSI

This is a negative dBm number which measures from 0 to -100 with 0 being perfect (and not realistic in everyday life) to -100 being no signal. Realistic values are:

-50: good

-75: reasonable

-100: no signal

So, if your WiFi is between -50 to -75 then your signal is OK.

If between -75 and -100 then you’re going to have problems.

Centre mouse cursor

I sometimes lose my mouse cursor when I have several screens and many windows.

There is the option of wiggling the mouse to find it but I’d prefer to have a shortcut that moves the cursor into the active window. BetterTouchTool does that well. See this post:

https://apple.stackexchange.com/questions/186926/is-there-a-shortcut-an-app-to-center-the-mouse-on-the-current-window

I use Alt X to move the mouse into the top left of my active window.

However, beware, I tried using Double Space and managed to break things – was unable to enter any spaces on my Mac keyboard. The solution was to delete the key sequence

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

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