Author: fire_horse

  • Lab 2 – Build your Amazon VPC infrastructure

    This lab follows Compute Module, which focuses primarily on Amazon EC2, and Networking Part 1 Module, which focuses on Amazon VPCs, subnets, and routing.

    Task 1 : Create an Amazon VPC in a Region

    Task 2: Create public and private subnets

    Task 3 : Create an internet gateway

    Task 4 : Route internet traffic in the public subnet to the internet gateway

    Task 5 : Create a public security group

    Task 6 : Launch an Amazon EC2 instance into a public subnet

    Task 7 : Connect to a public instance via HTTP

    Task 8 : Connect to the Amazon EC2 instance in the public subnet via Session Manager

    Task 9 : Create a NAT gateway and configure routing in the private subnet

    Task 10 : Create a security group for private resources

    Task 11: Launch an Amazon EC2 instance into a private subnet

    Task 12: Connect to the Amazon EC2 instance in the private subnet

    Optional Task 1 : Test connectivity to the private instance from the public instance

    Optional Task 2 : Retrieve instance metadata

  • Lab 1 – Explore and interact with the AWS Management Console and AWS Command Line Interface

    This lab provides you with a basic overview of the AWS Management console and API

    aws s3 ls
    
    # create a new bucket
    aws s3 mb s3://labclibucket-NUMBER 
    
    aws s3 cp /home/ssm-user/HappyFace.jpg s3://labclibucket-NUMBER
    
    aws s3 ls s3://labclibucket-NUMBER
  • Palindrome Number

    Given an integer x, return true if x is a palindrome, and false otherwise.

    class Solution(object):
    
        def isPalindrome(self, x):
            rev = 0
            init_n = x
            if x < 0:
                return False
            while x != 0:
                rev = rev * 10 + x % 10
                x = x // 10
    
            if rev == init_n:
                return True
            return False
    
  • Date and Time Utilities

    https://community.appian.com/b/appmarket/posts/date-and-time-utilities

    I have a requirement that to display the month name & Year from two particular dates .

    Is there any direct function or please give any valuable suggestions on the same.

    Ex:11/2021 –10/2022

    It should display Nov2021,Dec 2021…..Oct 2022

    a!localVariables(
      local!startDate: todatetime("10/01/2021"),
      local!endDate: todatetime("12/27/2023"),
      a!forEach(
        items: enumerate(
          elapsedmonths(
            local!startDate,
            local!endDate
          )
        ),
        expression: text(
          addmonths(todatetime(local!startDate), fv!index),
          "MMMM YYYY"
        )
      )
    )
  • Bug with date field validation in Appian 22.3

    Appian 21.2

    Valid format is dd/mm/yyyy.

    Appian 22.3

    Valid format is mm/dd/yyyy.

  • Azure Active Directory (AD)

    • Using the Azure AD Connect tool
    • User and group management in Azure
    • Azure AD security features
    • Azure AD support for open standards
    • Provisioning an Azure AD tenant
    • How Azure AD may affect infrastructure costs and growth
    • How Azure AD impacts employee efficiency
  • How to handle bad web request error

    How do we properly deal with HTTP errors on the browser side? And how do we handle them correctly on the server side when the client side is at fault?

    From the browser’s point of view, the easiest thing to do is to try again and hope the error just goes away. This is a good idea in a distributed network, but we also have to be very careful not to make things worse. Here’s two general rules:

    1. For 4XX http error code, do not retry.
    2. For 5XX http error code, try again carefully.

    So which things should we do carefully in the browser? We definitely should not overwhelm the server with retried requests. An algorithm named exponential backoff might be able to help. It controls two things:

    1. The latency between two retries. The latency will increase exponentially.
    2. The number of retries is usually capped.

    Will all browsers handle their retry logic in a graceful way? Most likely not. So the server has to take care of its own safety. A common way to control the flow of HTTP requests is to set up a flow control gateway in front of the server. This provides two useful tools:

    1. Rate limiter, which limits how often a request can be made. It has two slightly different choices; the token bucket and the leaky bucket.
    2. Circuit breaker. This will stop the HTTP flow immediately when the error threshold is exceeded. After a set amount of time, it will only let a limited amount of HTTP traffic through. If everything works well, it will slowly let all HTTP traffic through.

    We should be able to handle intermittent errors effectively with exponential backoff in the browser and with a flow control gateway on the server side. Any remaining issues are real errors that need to be fixed carefully.

    Over to you: Both token bucket and leaky bucket can be used for rate limiting. How do you know which one to pick?

  • Two Sum

    https://leetcode.com/problems/two-sum/

    class Solution {
        public int[] twoSum(int[] nums, int target) {
            for (int i = 0; i < nums.length; i++) {
                for (int j = i + 1; j < nums.length; j++) {
                    if (nums[j] == target - nums[i]) {
                        return new int[] { i, j };
                    }
                }
            }
            // In case there is no solution, we'll just return null
            return null;
        }
    }
    class Solution:
        def twoSum(self, nums: List[int], target: int) -> List[int]:
            for i in range(len(nums)):
                for j in range(i + 1, len(nums)):
                    if nums[j] == target - nums[i]:
                        return [i, j]
    class Solution {
        public int[] twoSum(int[] nums, int target) {
            Map<Integer, Integer> map = new HashMap<>();
            for (int i = 0; i < nums.length; i++) {
                map.put(nums[i], i);
            }
            for (int i = 0; i < nums.length; i++) {
                int complement = target - nums[i];
                if (map.containsKey(complement) && map.get(complement) != i) {
                    return new int[] { i, map.get(complement) };
                }
            }
            // In case there is no solution, we'll just return null
            return null;
        }
    }
    class Solution:
        def twoSum(self, nums: List[int], target: int) -> List[int]:
            hashmap = {}
            for i in range(len(nums)):
                hashmap[nums[i]] = i
            for i in range(len(nums)):
                complement = target - nums[i]
                if complement in hashmap and hashmap[complement] != i:
                    return [i, hashmap[complement]] 
    class Solution {
        public int[] twoSum(int[] nums, int target) {
            Map<Integer, Integer> map = new HashMap<>();
            for (int i = 0; i < nums.length; i++) {
                int complement = target - nums[i];
                if (map.containsKey(complement)) {
                    return new int[] { map.get(complement), i };
                }
                map.put(nums[i], i);
            }
            // In case there is no solution, we'll just return null
            return null;
        }
    }
    class Solution:
        def twoSum(self, nums: List[int], target: int) -> List[int]:
            hashmap = {}
            for i in range(len(nums)):
                complement = target - nums[i]
                if complement in hashmap:
                    return [i, hashmap[complement]]
                hashmap[nums[i]] = i
  • Combine two tables

    https://leetcode.com/problems/combine-two-tables/

    SELECT
        firstname,
        lastname,
        city,
        state
    FROM person LEFT JOIN address 
    ON person.personid = address.personid;