Angela  Dickens

Angela Dickens

1594517700

Three Reasons why UTF-8 is awful

Nearly every website, and every web page on those sites, is encoded in UTF-8. It stands for “Unicode transformation format, 8-bit”. It was designed to be the universal text encoding, one that can work for any character set and any language. It pretty much accomplishes that. However, despite achieving that goal, there are several reasons why UTF-8 is a horrible encoding. We will go over them and why those reasons make UTF-8 a terrible choice for many programming applications.

It’s not uniform ally sized

UTF-8 characters can be either 1, 2, 3, or 4 bytes long. That means, you can have a UTF-8 string with a 1 byte character, followed by a 3 byte character, followed by a 2 byte character, and ended with another 2 byte character. Since a string is only a sequence of characters, there is no way to infer what sizes of characters compose the string without iterating through the entire string. This trait of UTF-8 makes string processing quite slow. This forces a program to check the value of the first byte of each character before advancing to the next character.

  • If the first byte is < 128, it’s essentially an ASCII character and only one byte long.
  • If the first byte is < 192, it’s two bytes long.
  • If the first byte is < 224, it’s three bytes long.
  • If the first byte is <= 240, it’s four bytes long.

Additionally, for characters of a length 2 or greater, every byte after the first byte will be greater than 128, or in hexadecimal format, 0x80.

This makes UTF-8 particular slower to iterate. For example, to count the characters in a regular ASCII string, one could use a function like this.

size_t count_chars(const char* s)
	{
	   size_t total = 0;
	   while (*s++)
	         ++total;
	   return total;
	}
view raw
asciicount.c hosted with ❤ by GitHub

But a function to count characters in a UTF-8 string would look like this:

size_t count_utf8(const unsigned char* s)
	{
	  size_t total = 0;
	  while(*s) {
	      ++total;
	      if (*s < 128)
	          ++s;
	      else if (*s < 192)
	        s += 2;
	      else if (*s < 224)
	        s += 3;
	      else if (*s <= 240)
	        s += 4;
	      else
	        // this is invalid utf-8
	        return 0;
	  }
	  return total;
	}
view raw
utf8count.c hosted with ❤ by GitHub

Not only does UTF-8 take up four potential different character sizes, it has invalid bytes that are not mapped to any Unicode character yet.

#data #web-development #utf-8 #language #programming #data analysis

What is GEEK

Buddha Community

Three Reasons why UTF-8 is awful
Rory  West

Rory West

1620872502

Top 8 Exciting AWS Projects & Ideas For Beginners [2021]

AWS Projects & Topics

Looking for AWS project ideas? Then you’ve come to the right place because, in this article, we’ve shared multiple AWS projects. The projects are of various sectors and skill-levels so you can choose according to your expertise and interests. The more projects you have in your portfolio, the better. Companies are always on the lookout for skilled AWS Developers who can develop innovative AWS projects. So, if you are a beginner, the best thing you can do is work on some top AWS projects.

We, here at upGrad, believe in a practical approach as theoretical knowledge alone won’t be of help in a real-time work environment. In this article, we will be exploring some interesting AWS projects which beginners can work on to put their knowledge to test. In this article, you will find top AWS projects for beginners to get hands-on experience on Java.

Amid the cut-throat competition, aspiring AWS Developers must have hands-on experience with real-world AWS projects. In fact, this is one of the primary recruitment criteria for most employers today. As you start working on AWS projects, you will not only be able to test your strengths and weaknesses, but you will also gain exposure that can be immensely helpful to boost your career.

#aws #aws developer #aws project ideas #aws projects #aws

Seamus  Quitzon

Seamus Quitzon

1601341562

AWS Cost Allocation Tags and Cost Reduction

Bob had just arrived in the office for his first day of work as the newly hired chief technical officer when he was called into a conference room by the president, Martha, who immediately introduced him to the head of accounting, Amanda. They exchanged pleasantries, and then Martha got right down to business:

“Bob, we have several teams here developing software applications on Amazon and our bill is very high. We think it’s unnecessarily high, and we’d like you to look into it and bring it under control.”

Martha placed a screenshot of the Amazon Web Services (AWS) billing report on the table and pointed to it.

“This is a problem for us: We don’t know what we’re spending this money on, and we need to see more detail.”

Amanda chimed in, “Bob, look, we have financial dimensions that we use for reporting purposes, and I can provide you with some guidance regarding some information we’d really like to see such that the reports that are ultimately produced mirror these dimensions — if you can do this, it would really help us internally.”

“Bob, we can’t stress how important this is right now. These projects are becoming very expensive for our business,” Martha reiterated.

“How many projects do we have?” Bob inquired.

“We have four projects in total: two in the aviation division and two in the energy division. If it matters, the aviation division has 75 developers and the energy division has 25 developers,” the CEO responded.

Bob understood the problem and responded, “I’ll see what I can do and have some ideas. I might not be able to give you retrospective insight, but going forward, we should be able to get a better idea of what’s going on and start to bring the cost down.”

The meeting ended with Bob heading to find his desk. Cost allocation tags should help us, he thought to himself as he looked for someone who might know where his office is.

#aws #aws cloud #node js #cost optimization #aws cli #well architected framework #aws cost report #cost control #aws cost #aws tags

Hire AWS Developer

Looking to Hire Professional AWS Developers?

The technology inventions have demanded all businesses to use and manage cloud-based computing services and Amazon is dominating the cloud computing services provider in the world.

Hire AWS Developer from HourlyDeveloper.io & Get the best amazon web services development. Take your business to excellence with our best AWS developer that will serve you the benefit of different cloud computing tools.

Consult with experts: https://bit.ly/2CWJgHyAWS Development services

#hire aws developer #aws developers #aws development company #aws development services #aws development #aws

Christa  Stehr

Christa Stehr

1598408880

How To Unite AWS KMS with Serverless Application Model (SAM)

The Basics

AWS KMS is a Key Management Service that let you create Cryptographic keys that you can use to encrypt and decrypt data and also other keys. You can read more about it here.

Important points about Keys

Please note that the customer master keys(CMK) generated can only be used to encrypt small amount of data like passwords, RSA key. You can use AWS KMS CMKs to generate, encrypt, and decrypt data keys. However, AWS KMS does not store, manage, or track your data keys, or perform cryptographic operations with data keys.

You must use and manage data keys outside of AWS KMS. KMS API uses AWS KMS CMK in the encryption operations and they cannot accept more than 4 KB (4096 bytes) of data. To encrypt application data, use the server-side encryption features of an AWS service, or a client-side encryption library, such as the AWS Encryption SDK or the Amazon S3 encryption client.

Scenario

We want to create signup and login forms for a website.

Passwords should be encrypted and stored in DynamoDB database.

What do we need?

  1. KMS key to encrypt and decrypt data
  2. DynamoDB table to store password.
  3. Lambda functions & APIs to process Login and Sign up forms.
  4. Sign up/ Login forms in HTML.

Lets Implement it as Serverless Application Model (SAM)!

Lets first create the Key that we will use to encrypt and decrypt password.

KmsKey:
    Type: AWS::KMS::Key
    Properties: 
      Description: CMK for encrypting and decrypting
      KeyPolicy:
        Version: '2012-10-17'
        Id: key-default-1
        Statement:
        - Sid: Enable IAM User Permissions
          Effect: Allow
          Principal:
            AWS: !Sub arn:aws:iam::${AWS::AccountId}:root
          Action: kms:*
          Resource: '*'
        - Sid: Allow administration of the key
          Effect: Allow
          Principal:
            AWS: !Sub arn:aws:iam::${AWS::AccountId}:user/${KeyAdmin}
          Action:
          - kms:Create*
          - kms:Describe*
          - kms:Enable*
          - kms:List*
          - kms:Put*
          - kms:Update*
          - kms:Revoke*
          - kms:Disable*
          - kms:Get*
          - kms:Delete*
          - kms:ScheduleKeyDeletion
          - kms:CancelKeyDeletion
          Resource: '*'
        - Sid: Allow use of the key
          Effect: Allow
          Principal:
            AWS: !Sub arn:aws:iam::${AWS::AccountId}:user/${KeyUser}
          Action:
          - kms:DescribeKey
          - kms:Encrypt
          - kms:Decrypt
          - kms:ReEncrypt*
          - kms:GenerateDataKey
          - kms:GenerateDataKeyWithoutPlaintext
          Resource: '*'

The important thing in above snippet is the KeyPolicy. KMS requires a Key Administrator and Key User. As a best practice your Key Administrator and Key User should be 2 separate user in your Organisation. We are allowing all permissions to the root users.

So if your key Administrator leaves the organisation, the root user will be able to delete this key. As you can see **KeyAdmin **can manage the key but not use it and KeyUser can only use the key. ${KeyAdmin} and **${KeyUser} **are parameters in the SAM template.

You would be asked to provide values for these parameters during SAM Deploy.

#aws #serverless #aws-sam #aws-key-management-service #aws-certification #aws-api-gateway #tutorial-for-beginners #aws-blogs

Hire Dedicated AWS Developer

Want to Hire AWS Developer for cloud computing services?

At HourlyDeveloper.io, we leverage maximum benefits from the AWS platform ensuring prominent Solutions for business requirements. Hire Dedicated AWS Developer and make business solutions truly global and accessible through the power of cloud environment and AWS with an extensive set of on-demand global functionality.

Consult with experts:- https://bit.ly/2C5M6cz

#aws development company #hire dedicated aws developer #aws development services #aws development #aws developer #aws