teleren/devto huggingface dataset:
AWS: Database Request Units
Tags: aws, cloud, reference, cheatsheet
Published: 2022-05-07 15:54:48

---
title: AWS: Database Request Units
published: true
description: AWS Database Request Units are one area that I always have to refer back to. I wrote this reference to make sure I understand the math needed.
tags: AWS, Cloud, Reference, Cheatsheet
series: AWS Notes
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zuiuof7b96ff4gyk5yzm.jpg
---

AWS Database Request Units are one area that I always have to refer back to. I wrote this reference to make sure I understand the math needed.

**[HERE](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.requests)** is the Amazon DynamoDB documentation.

I opted to write this article, more as a cheatsheet or reference and tried to put together enough detail to deepen and solidify my understanding of these calculations.

## Key Terms

| Unit | Definition |
|------|------------|
| Write Capacity Units (WCU) | Each API call to write data to a table is a write request. |
| Read Capacity Units (RCU) | Each API call to read data from a table is a read request. Read requests can be *strongly consistent*, *eventually consistent*, or *transactional*. |

## Write Calculations

* **WR/s** = Write Requests per Second.

| Type | WR/x | at | Size | = | WCU |
|------|------|----|------|---|-----|
| Standard | 1 WR/s | at | 1 KB | = | 1 WCU |
| Transactional | 1 WR/s | at | 1 KB | = | 2 WCUs |

### Write Examples

| Write Type | Calculation | WCUs Needed |
|------------|-------------|-------------|
| Standard | 1 WR/x handles a 1 KB Item | with 1 WCU |
| Standard | 1 WR/s handles a 3 KB Item | with 3 WCUs |
| Transactional | 1 WR/s handles a 3 KB Item | with 6 WCUs |

## Read Calculations

* **RR/s** = Read Requests per Second.

| Type | RR/s | at | Size | = | WCU |
|------|------|----|------|---|-----|
| Strongly Consistent | 1 RR/s | at | 4 KB | = | 1 RCU |
| Eventually Consistent | 2 RR/s | at | 4 KB | = | 1 RCU |
| Transactional | 1 RR/s | at | 4 KB | = | 2 RCUs |

### Read Examples

| Read Type | Calculation | RCUs Needed |
|-----------|-------------|------|
| Strongly Consistent | 1 RR/s handles an 8 KB Item | with 2 RCUs |
| Eventually Consistent | 2 RR/s handles an 8 KB Item | with 1 RCU |
| Transactional | 1 RR/s handles an 8 KB Item | with 4 RCUs |

## More Examples

**5 KB Item** ...

* 1 RCU for Eventually Consistent Read (handles 8 KB).
* 2 RCU for Strongly Consistent Read (handles 8 KB).
* 5 WCU for Standard Write.
* 10 WCU for Transactional Write.

**10 KB Item** ...

* 2 RCU for Eventually Consistent Read (handles 16 KB).
* 3 RCU for Strongly Consistent Read (handles 12 KB).
* 10 WCU for Standard Write.
* 20 WCU for Transactional Write.

**13 KB Item** ...

* 2 RCU for Eventually Consistent Read (handles 16 KB).
* 4 RCU for Strongly Consistent Read (handles 16 KB).
* 13 WCU for Standard Write.
* 26 WCU for Transactional Write.

I hope you found this information useful.
Tips to maintain clean git commit history
Tags: git, beginners, programming
Published: 2022-05-07 15:53:14

###Solution 1 :

Lets say you are working on a feature and created a feature branch F1 by checking out from master. While working on the feature branch F1 , you created multiple intermediate commits. However, when you check the commit history you find some of these commits redundant. In such case you can squash the commits i.e you can combine multiple commits and make it a one commit.

Below is the commit history of the feature branch before and after the squash.
![Squash Git Commits](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jdzmzw2dt4uuwoyef03x.png)

Command to squash the last X commits using interactive rebase is:
```js
git rebase -i HEAD~[X]
```


The squashing of commits is also useful when you want to merge your feature branch to master branch.As by squashing, all the redundant commits can be removed and after merging the feature branch to master, the git commit history is clean.

####Advantage of squashing :
  The git history remains clean
####Disadvantage of squashing : 
  The detailed branch history is no longer available.

Before going to the second solution , let's understand the difference between git merge and git rebase.

###git merge VS git rebase

Both git merge and git rebase is used to merge the code from feature branch to the main(master) branch.

#####git merge  
When we use git merge command to merge the code from feature branch to master , then git will take all the changes from my feature branch and create a special commit on top of my commit , called as merge commit that contains all the changes from my feature branch and place this merge commit on top of master branch. The git commit graph will look like this

![Git Merge](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bxc044ej3txbvnbg1pm.png)
Command to merge the fetaure_branch in master branch is:
```js
git checkout master
git merge feature_branch
```

Let's understand git rebase with Solution 2


###Solution 2 :
In order to maintain a clean commit history , instead of git merge do git rebase. What rebase will do is , it will take all the commits from the feature branch and move them on top of master commits. The graph structure of the commits looks like this 

![Git rebase](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3tthbiep1f6vqdegi7w7.png)
Command to rebase fetaure_branch with master branch is:
```js
git checkout master
git rebase feature_branch
```
####Advantage of git rebase :
  It keeps the commit history of the main branch clean and hence it becomes easy to track

####Disadvantage of git rebase : 
  The detailed branch history is no longer available.


So using squashing of commits and then rebaseing with master will keep the commit history clean and trackable.
Sparkline charts in Ruby on Rails app
Tags: rails, javascript, sparklines
Published: 2022-05-07 15:46:14

---
title: Sparkline charts in Ruby on Rails app
published: true
description: 
tags: rails, javascript, sparklines
//cover_image: https://direct_url_to_image.jpg
---
Hello, just want to present our new gem: https://github.com/railsjazz/peity_vanilla_rails

If you need something like below:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jt6m98n4pe3lbl7bnxh3.png)

You can generate it with one line of code:

```erb
<%= peity_line_chart([115,123,234,-113,-43,-223,127,332,152,233]) %>
```

It works without any 3rd party dependencies (like jQuery or React).

Give it a try and I hope to get a star from you!

If someone want's to contribute it would be great!
Anyone know, How to create a simple like button component with React.
Tags: react, button, javascript, counter
Published: 2022-05-07 15:46:12

HOW TO SOLUTION JAVASCRIPT:

How to build a "like button" component using React 16. The component should be the default export (use export default).


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/36m95r9ih99314c63tjj.png)
Min-Max Sum(30 Day Hackerrank Challenge)
Published: 2022-05-07 15:40:28

**Hackerrank Solution**
Here the problem is 
Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.

So basically we have an array which contain 5 +ve integers. And We have to summing up the integers one left each time. And after that return maximum and minimum from those summing up values.
So let's see how catch up with all possible testcases.🤔
Let's our array
arr[] = {1,2,3,4,5}
Now sum 2+3+4+5 =14 remaining element is 1. 
sum 1+3+4+5 = 13 remaining element is 2 and so on.
From there we pick maximum and minimum sum element.
Let's quickly look into this code
Here we declared  max,min variables as long (For big values)
We started with second left most element in array and add with sum.
Now check whether our arr element less than min or greater than of max, if so assign the value of it.
And at last we substract min and max value from sum.


```



void miniMaxSum(vector<int> arr) {
    
    long min=0,max=0,sum=0;
     min = arr[0];
     max = min;
    
     sum =min;
   for(int i=1;i<arr.size();i++){
     sum += arr[i];
     if(arr[i]<min){
       min = arr[i];
       
     }
     else if(arr[i]>max){
       max = arr[i];
     }
   }
    cout<<(sum-max)<<" "<<(sum-min);
    
  }

```
Platform detection in C&C++
Tags: cpp, c, gcc, clang
Published: 2022-05-07 15:29:03

sometime when writing c or c++ code you need to write a code specific to the compiler/OS. and to this job the compiler have some predefined macros to detect the compiler or the OS.

## **Checking for OS:**
to check which platform the code is compiled use these predefined macros:

```
for Windows              :  _WIN32
for Windows 64 bit       :  _WIN64 ( _WIN32 included )
for Mac OS & IOS         :  __APPLE__
for Linux & Linux-derived:  __linux__
for Android              :  __ANDROID__ ( __linux__ included )
for Akaros               :  __ros__
for NaCL                 :  __native_client__
for AsmJS                :  __asmjs__
for Fuschia              :  __Fuchsia__
```
## **Checking for Compiler:**
to check wich compiler used:

```
Visual Studio       _MSC_VER
gcc                 __GNUC__
clang               __clang__
emscripten          __EMSCRIPTEN__ (for asm.js and webassembly)
MinGW 32            __MINGW32__
MinGW-w64 32bit     __MINGW32__
MinGW-w64 64bit     __MINGW64__
```
Building a Flutter application | Day Zero
Tags: appwritehack, beginners, flutter, git
Published: 2022-05-07 15:22:50

## Introduction
Hi everyone. My name is Utkersh Rajvenshi, a final year student from National Institute of Technology, Uttarakhand majoring in Electrical and Electronics Engineering. I was recently introduced to this hackathon by Appwrite while reading a DEV post for a project I was working on recently.

## Project Motivation
I will be making a submission for this hackathon by building an application with Flutter. Recently, I came across an app on Android that lets you create a family room with 4 members and allows you to track their realtime location. I installed that app on my parents' devices but found out that it only supports more than Android 7.0 devices.

Well, I am one of the 1.6% users in the world that still use Android 5.1 on their devices. So, I wanted an app which would support my device. However, my options ran out as not a single one interested me with their bland user interfaces.

Also, none of the applications I came across on Google Play Store were open-source. Since I would be sharing such critical information with the app, I do expect some disclosure of where my data is being hosted or how it's going to be used.

With this in mind, I decided to make an app called [FindMyFamily](https://github.com/utkershrajvenshi/findmyfamily) where you could share your location among your family members in real-time. It would have support starting from Android 5.0. I will try to extend the functionality by having more than 4 members in a group and a simplistic yet clean user interface.

## Developing with Appwrite
So far, I have looked around in the [documentation](https://appwrite.io/docs/) of Appwrite and I have to say this would really make my life easier for back-end integration. The service being self-hosted means I won't have to worry about high costs if the project gains traction and the user-base increases.

I did have some issues getting it running for the first time on my machine since I am absolutely new to Docker but thankfully the good folks on [Appwrite's Discord server](https://appwrite.io/discord) made sure that my issues were fixed and I could focus on development.

## Short on time
I realise that I am late to the party, so I have to make the most of the 5 days left in the hackathon to come up with a workable solution. Here are some services that I believe my project would require:

- Appwrite's Accounts API
- Appwrite Storage
- Google Maps API
- Optimized location tracking(achievable through [sensors_plus](https://pub.dev/packages/sensors_plus) and [geolocator](https://pub.dev/packages/geolocator) packages in Flutter)

These should be enough for me to make the first iteration of the project. I will be keeping track of my progress by making such posts on [DEV.to](https://dev.to) so in case any other dependencies are required, I'll be sure to mention them in a post.

## Off to the races
This was my Day Zero of Appwrite hackathon. Onward!
Confessions Site
Tags: appwritehack
Published: 2022-05-07 15:04:43

### Overview of My Submission
I made this website with the inspiration from MIT Confessions. It's a Facebook page which MIT students can submit their confessions with the Google Forms. Then, the Facebook page admin will repost the confessions in the Facebook page timeline anonymously. The website I built has the same concept. People can submit their confessions and displayed to others. I used the AppWrite database to store all the confessions. 

### Submission Category: 
Web2 Wizards


### Link to Code
{% embed https://github.com/thetkpark/appwrite-confessions %}


### Additional Resources / Info
[Live demo](https://confessions.cscms.me)

> I hosted it in Raspberry Pi in my home and used Cloudflare Tunnel to expose to the internet. It might have some problem from time to time. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1hc5hmlctidhoupoekj1.png)
Lets connect on github
Tags: javascript, react, git
Published: 2022-05-07 14:08:10


Im looking forward to grow my  Github connections, you can find me on [github/hqshtag](https://github.com/hqshtag)

Follow me and check my profile and some of my public projects, I'll be doing the same thing and staring some projects I ll be looking forward to contribute.

I hope you have a great day.
Leap up like Phoenix: Entrepreneur who is building technology in Experiential Adventure Tourism
Tags: anand, akshaya, experiential, adventure
Published: 2022-05-07 13:56:07



Anand Bansode who is expert in organizing Transformational Adventure Tourism founded his company in 2017 after having a decade of experience in the adventure field. Recently Microsoft included 360 Explorer LLP in “Founders Hub” of “Microsoft for Startup” which will be beneficial for his company to build technology in tourism. In the last few years more than 10,000 people took part in activities organized by his company 360 Explorer LLP. Using this unique start-up’s interactive and personal-based approach to learning while on adventure—an early success that helped it to transform the lives of many people. Anand and his wife co-founder Akshaya have gone through struggles before starting their venture. Without any support or investment, they have bootstrapped their business.


           Their start wasn’t so good. Anand spent his childhood in darkness in the small town Solapur, Maharashtra in India. Despite having an inferiority complex about his physique and not being able to communicate properly, he had the dream of climbing the highest peak in the world, Mount Everest. Anand achieved his dream with his immense willpower while living in poverty and gazing into the eyes of his poor parents and emerged into the list of the people who have achieved greatest success.
           In 2015, he was on his fifth phase of the 'World Peace Seven Summit Expedition' in Alaska (USA) for climbing the highest mountain in North America when he got a message from India that his father had passed away. His father was the one who made him climb all the mountains. His father used to work as a mechanic and repaired punctured tyres his whole life. On his return to India, Anand had a cervical injury that confined him to bed for several months.

After marrying his girlfriend Akshaya both started to live a struggleful life. After several months Anand was able to walk after his cervical injury. Both started their business venture in 2017 which is an inspiration to those who are facing difficult times in their life.

360 Explorer LLP has its base in India, Tanzania, Nepal, Russia and Argentina and recently made an agreement with USA based Space Tourism company intending to enter in Space Tourism in future.

Anand has built a great team in Tanzania which is a unique model of supporting locals through business ventures. Anand is building unique technology in experiential tourism.

       “I want to build technology to spread experiential travel. This will help thousands of people to get out of negativity after a pandemic. People need this but no one really focuses on a business model. Sometimes we have to take 1st step to build something crazy”, Anand Bansode said.
Todo List App
Tags: appwritehack
Published: 2022-05-07 13:34:05

[Instructions]: # (To submit to the Appwrite Hackathon on DEV, please fill out all sections.)


### Overview of My Submission
This is a TodoList webapp. The frontend is made with tailwind CSS, Next JS. Appwrite is used for the backend


### Submission Category: 

Web2 Wizards


### Link to Code

{% embed https://github.com/UsamaKashif/appwrite-todolist %}


### Additional Resources / Info

![image](https://user-images.githubusercontent.com/49620321/167256461-77f89573-1dc0-44c8-96f3-3c11eafe8521.png)
![image](https://user-images.githubusercontent.com/49620321/167256485-15b255df-e788-4d72-957a-b89e9fd61199.png)
![image](https://user-images.githubusercontent.com/49620321/167256565-8def0233-fb5e-435e-bce6-d126f9f288e6.png)
Keyoxide Proof
Published: 2022-05-07 13:29:55

This is an OpenPGP proof that connects [my OpenPGP key](https://keyoxide.org/8CC6A08D6B07E990) to [this dev.to account](https://dev.to/benjaminwolkchen). For details check out https://docs.keyoxide.org/advanced/openpgp-proofs/

[Verifying my OpenPGP key: openpgp4fpr:7FB4736453198E93DBFFCB058CC6A08D6B07E990]
How to Create a Navbar | Creating Navbar using HTML, CSS & JavaScript
Tags: javascript, webdev, programming, beginners
Published: 2022-05-07 13:22:42

https://www.codewithrandom.com/2022/05/How-to-Create-a-Navbar.html

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9w4yelx1ysiaw46i5tcd.png)

Introduction:
Hello coders, welcome to codewithrandom. Today we'll look how to create a Navigation Bar or Navbar with the help of HTML, CSS and JavaScript. We as a Front-End Developer has a this tool named HTML, CSS & JavaScript. Through it we can make it creative and grab the attention of user interface. Before going to the code part let's see what is Navbar.

What is Navbar?
A Navigation Bar or Navbar is an element in the webpage or website. It contains links which redirect the user interface from one page to another. The <nav> tag wraps all the primary bars i.e., the main navigation of the website. It can be either vertical or horizontal.
Let us see the coding part of the Navbar.

HTML Code:
```
 <div class="navbar">  
  <div class="logo">  
   <h1>Codewithrandom</h1>  
  </div>  
  <div class="nav__links">  
   <a href="#home" class="active nav__link">Home</a>  
   <a href="#about" class="nav__link">About</a>  
   <a href="#contact" class="nav__link">Contact</a>  
  </div>  
 </div>  
 <div id="home" class="section">  
  <h1>Home</h1>  
 </div>  
 <div id="about" class="section">  
  <h1>About</h1>  
 </div>  
 <div id="contact" class="section">  
  <h1>Contact</h1>  
 </div>  
 <script src="main.js"></script>
```
In this HTML code we defined a <div> and called classes such as logo, navbar & nav_links. And describe the heading as Home, About, Contact. Let us look at the HTML output. Before writing CSS for Navbar.


HTML Output:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j3s1uacmyt0t1i6eoyws.png)

In this Output we have just code the HTML part and this how it looks like and let us write the CSS for navbar to look attractive.


CSS Code:
```
 @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@500&display=swap");  
 * {  
  padding: 0;  
  margin: 0;  
  box-sizing: border-box;  
  font-family: "Poppins", sans-serif;  
 }  
 body {  
  scr
```
[Read more](https://www.codewithrandom.com/2022/05/How-to-Create-a-Navbar.html)
100 Days of Code: The Complete Python Pro Bootcamp for 2022 - Day 13 (Debugging)
Published: 2022-05-07 13:22:22

###########DEBUGGING#####################
```python
# Describe Problem: Query is out of range, either change from 1, 20 to 1,21 or 0,21

def my_function():
    for i in range(1, 20):
        if i == 20:
        print("You got it")
 my_function()

# Reproduce the bug. List index out of range, Change randit (1, 6) to (0, 5)
 
from random import randint
 dice_imgs = ["❶", "❷", "❸", "❹", "❺", "❻"]
 dice_num = randint(1, 6)
 print(dice_imgs[dice_num])

# Play Computer. Change > and < to >= and <=
 
year = int(input("What's your year of birth?: "))
 if year > 1980 and year < 1994:
    print("You are a millenial.")
 elif year > 1994:
 print("You are a Gen Z.")

# Fix the Errors 
Add int to the input int(input("How old are you"))
Add = to if age >= 18:
change print statement indent to align with the if statement
Add f string to the print statement
 
age = input("How old are you?"))
 if age > 18:
 print(f"You can drive at age {age}.")

# Print is Your Friend. Change word_per_page == to word_per_page =

 pages = 0
 word_per_page = 0
 pages = int(input("Number of pages: "))
 word_per_page == int(input("Number of words per page: "))
 total_words = pages * word_per_page
 print(total_words)

# Debugging
# indent b_list.append(new_item)as this line is outside of the function

def mutate(a_list):
  b_list = []
  for item in a_list:
    new_item = item * 2
  b_list.append(new_item)
  print(b_list)

mutate([1,2,3,4,8,13])
```
Border Animation CSS | Quick Animation✨
Tags: webdev, html, css, beginners
Published: 2022-05-07 13:10:34

**Create a Border Animation CSS | Quick Animation, step-by-step from scratch.**

***

{% youtube 6H40lhp2bGw %}


**Markup:**

```html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Border Animation CSS</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>

<div class="box">
  <h2>CSS</h2>
</div>

</body>
</html>
```
📺 Web Dev:
https://bit.ly/3oBQbc0
[Login App with Appwrite]
Tags: appwritehack
Published: 2022-05-07 12:39:44

### Overview of My Submission 🙂

Login App with google's OAuth and custom signin and signup features. Easy to use and made possible with the use of appwrite. I'm new to appwrite and start with this little thing but want to explore more appwrite and it's features in future. 


### Submission Category: 

Wacky Wildcards


### Link to Code

https://github.com/adigoyani/Login-pp


### Screenshots/demo 

![1pe4cclvbcq1pkgrledu](https://user-images.githubusercontent.com/104979317/167254753-b2c49d6f-86aa-4d09-9bd9-eb6e229d24e1.png)

Short demo 🙂

![04w69arkt8kkc8pefnm0](https://user-images.githubusercontent.com/104979317/167254754-15b4e5cf-70ab-4d77-a3b2-e5274218bb77.gif)
Better way to make equal sized columns using flexbox?
Tags: discuss, help, webdev, css
Published: 2022-05-07 12:27:58

Is there a better way than the following to make equal sized columns no matter the content size using flexbox?

```
ul {
  display: flex;
}

li {
  flex-basis: 30%;
  flex-grow: 1;
}
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zmbo0i9fipxl7qdj6lb7.png)

Challenge link (Layout two): https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox_skills