teleren/devto huggingface dataset:
C++ intro for starter 3
Tags: cpp, tutorial, programming, beginners
Published: 2022-11-07 06:55:15

#Assalomu alaykum!

###Bugungi darsda biz `variable`,`data_type` va `input` haqida gaplashamiz:)

> Variable- bu o'zgaruvchi degan ma'noni bildiradi , buni biz qachon ishlatamiz degan fikr kelishi mumkin va bunga javoban biz variableni biror bir statementni belgilayotga ishlatamiz ;

Masalan 
```cpp
Name=Abror;
Surname=Musulmonov;
``` bunda bizda proekt qilayotgan paytimiz ko'p marta Abror so'zini ishlatishimiz kerak bo'ladi va biz agar bu so'z o'rniga 
boshqa bir jumlaga alishtirmoqchi bo'lsak ,biz barcha Abror so'zlarini alishtirishimiz kerak va bu juda ko'p vaqt oladi ,shu sababli biz faqat `name` variabledagi berilgan so'zni alishtirsak,qolgani shart emas va bu biz uchun juda samarali yechim bo'ladi. 

> Data_type nima ?

Bu o`zbek tilida ma'lumot turi deb tarjima qilinadi va o'zgaruvchini qanaqa turga mos kelishini anglatadi va sizni quyidagi rasmda batafsilroq ko'rishingiz mumkin ! 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1978vmhgmn7sxo8jtvwl.png)
bizda keyingi turda  variablani biz data_type key wordlari bilan belgilay olmaymiz buni yodda tuting.

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/70ggj9ee4ezx1kxn269l.png)
va siz bularni yodda tutishingiz kerak bo'ladi.

Bugungi kunimizning eng kerakli va o'ta muhim qismi `input` haqida gaplashamiz;

> Input - bu kiritish operatori `cin` bu "console input" ma'nosini bildiradi va quyidagi belgilanadi `cin>>` shu shaklda belgilaymiz.
Siz bu haqida quyidagi rasmda to'liq ma'lumot olasiz.

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

Bugun shu mavzular haqida gaplashdik.@dawroun 

> _E'tiboringiz uchun rahmat!___
Delivery Acceleration: Parallel Changes Strategy
Tags: softwaredevelopment, programming, devops, productivity
Published: 2022-11-07 06:43:11

As we develop a product over time, changes need to be made as we need to accommodate new functionality. As most of our systems don't run isolated, and we have clients that used them (ex. public API), We have to keep compatibility at least on a temporary basis. How do we achieve this?

## Versions

A common practice is to have different versions for the multiple clients. While simple, it also requires significant effort to maintain as whenever an issue or bug is spotted, multiple places are affected, meaning there are more possibility of side effects.  
It also makes it more difficult to make a case for clients to migrate from one to the other due to the contract changes.

![](https://www.kanekotic.com/img/version.png)

This affect mostly negatively the next DORA 4 metrics:

* ❌ **Lead Time for change**

## Versionless: Expand & Contract

As the name says, this strategy intents to have only one state of truth and not a multitude of them. Versionless has been heavily adopted as a principle by GraphQL, for example.  
We can achieve this in any code base by implementing a strategy for parallel changes called **Expand & Contract**, it's call this way due to the phases code goes through. Let's see for example we want to migrate from using one field value to a similar field with a more complex representation.

* **Expand**: We add the new 'field' to the existing contract, and add the code to support this strategy on the existing code.
* **Contract**: We monitor the usage of the old 'field' to understand when it is possible to deprecate, at that point we remove the old code.

![](https://www.kanekotic.com/img/expand_contract.jpeg)

With this, we have a clean source code that we can evolve indefinitely as required by the business.

This affect the next DORA 4 metrics:

* ✔️ **Lead Time for change**
Firebase Hosting Setup Complete Issue
Tags: firebase, netlify, deploy
Published: 2022-11-07 06:34:34

**A possible reason of issue:** 
When we give commands of hosting, by mistake we write **y** and press enter for the following question:
    **What do you want to use as your public directory?  y**

**Solution:**
**Step-1:** For this, the **index.html** file inside your root folder is being changed. So, replace the contents of **index.html** file with code below. **I am providing the code for index.html file here.**

```
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>My-react-app</title>
  </head>
  <body>
    <div id="root"></div>
    <script type="module" src="/src/main.jsx"></script>
  </body>
</html>

```


**Step-2:** At first delete **dist folder**, **.firebase** , **.firebaserc** , **firebase.json**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4mbzo28gspaflu6gvo4j.JPG)

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

**Step-3:** Open powershell & give the commands. If any of the following commands give error in your powershell then, open your **gitbash terminal**.

command-1: **npm install firebase** 
command-2: **npm install -g firebase-tools** (This is a one time process. If you have already done it for any of your previous project. Now skip it.)
command-3: **firebase login**
command-4: **firebase init**

Then follow the steps perfectly:

- Are you ready to proceed? Yes
- Now from the options of screen select (by pressing keyboard up , arrow buttons, spacebar and enter) **Hosting: Configure files for Firebase Hosting and (optionally)** 
- Now from the options of screen, select: **use an existing project** and enter
- Now select the app which you have already made for this project.
- What do you want to use as your public directory?   **dist**     
- Configure as a single-page app (rewrite all urls to /index.html)?  **Yes**
- Set up automatic builds and deploys with GitHub?   **No**
- File dist/index.html already exists. Overwrite?   **Yes** (This question may not be asked to you.)

command-5: **npm run build**
command-6: **firebase deploy**

**Step-4:** After 3 minutes, go to your chrome browser & check your live link is working or not. Open your browser console tab. Then right click of your mouse in the refresh button and do **empy cache and hard reload** for 3/4 times.

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

**Now your live link is working perfectly. right?**


===================================
**If you are still having a lot of issues to deploy in firebase you can also deploy to netlify.** Netlify deploy for a react project is far easy for you.** Right? ** 

[Follow this link to deploy a react project in netlify](https://dev.to/chayti/if-you-have-issues-to-deploy-a-react-project-in-firebase-then-deploy-to-netlify-22gg)

**Bingo!! That's all!!!**
Create a Sound Board in 3 lines of code
Tags: html, css, javascript, showdev
Published: 2022-11-07 06:30:00

In this article, I'll show you how to create a Sound Board in JavaScript with only 3 simple lines of code.

Before that, create a bunch of buttons and style those quickly.

I have added 5 buttons for 5 different kinds of sounds.

```javascript
  <div class="container">
    <div class="center">
      <button id="applause">applause</button>
      <button id="boo">boo</button>
      <button id="victory">victory</button>
      <button id="nope">nope</button>
      <button id="gasp">gasp</button>
    </div>
  </div>
```

```javascript
.container {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -50px;
  margin-left: -50px;
  width: 100px;
  height: 100px;
}
.center {
  display: flex;
  justify-content: center;
  align-items: center;
}
button {
  min-width: 80px;
  height: 40px;
  margin-left: 10px;
  border-radius: 4px;
  border: 1px solid plum;
  cursor: pointer;
  color: purple;
  font-weight: 600;
}
```
Now, I added the function to play the sound when a specific button is pressed.
```javascript
  function play_sound(clicked_id) {
    var audio = new Audio(clicked_id + ".mp3");
    audio.play();
  }
```
and call this function to a button onClick method
```javascript
...
  <button id="applause" onClick="play_sound(this.id)">applause</button>
...
```
That's it. You get a sound board with just 3 lines of code 🔊

{% codesandbox sound-board-hny3s2 %}

Thank you for reading!
Feel free to connect on [Twitter](https://twitter.com/Aneeqa_Khan25)
Create-react-app problem
Tags: npm, vscode, errors
Published: 2022-11-07 06:21:14

Hi all when using create-react-app in my vs-code I have this error: 
**_npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed._**
I've almost checked everything but couldn't help. 
please help...
tnx in advance.
1323. Leetcode Solution in Python3
Tags: python
Published: 2022-11-07 06:18:38

```python
class Solution:
  def maximum69Number(self, num: int) -> int:
    return int(str(num).replace('6', '9', 1)
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/maximum-69-number/
DevFest Nairobi 2022
Tags: devfestnairobi, codetoinfinityandbeyond, devfest2022
Published: 2022-11-07 06:18:02

The Annual Google devfest Nairobi happened over the weekend on Saturday and what an amazing event it was.This was my first devfest i have attended.met old friends,new like-minded people and also learnt new things in the process.

Here are some of the notes that i was able to take during the different session:

**Starting a Startup**

some of the steps that one needs to take while starting a startup

1. create a team- create a team that understand and believe in your idea

2.MVP - Having a minimum viable product

3. make decisions on tech and infrastructure that will be used to create your product

4.acquire customers - you should also consider getting customers and not only focusing on developing your product

5.scaling up- this is the next step after your product has started getting traction.Also joining an accelerator program helps Google offering one

**Everything APIs**

_types of API endpoints_

1. Soap
2. XML
3. REST
4. Grpc

_tips on naming conventions_

1. use nouns and not verbs
2. consistency is key in naming your endpoints
3. use lowercase
4. don't use method name in URL
5. the name should try to be self explanatory

_some of the ways to secure endpoints_

1. Basic auth (username & password)
2. JWT
3. OpenID and Oauth

_what is throttling ?_ limiting the number of request made by a user in a certain period

_tools used for creating, testing and documenting API endpoints_

1. Swagger UI
2. Swagger Hub
3. Postman
4. Redocly

_types of test that can be done on API endpoints_

1. Unit test
2. Integration test
3. Load / performance test
4. security test

_tools used to test API endpoints_

1. JMeter
2. Soup UI
3. CuCumber
4. Rest-Assured (the person how named this needs a pay raise)

**Serverless Backend infrastructure with AWS Lambdas**

- AWS lambda more like Google cloud Function
- Api Gateway replaces Web server hence acts as point of contact  when the the client sends a request

AWS Lambdas has:
1. Handlers
2. Events


The events was really enjoy-full and looking forward to attending to more of such events
Chrome 107: Keyboard shortcuts
Tags: webdev, beginners
Published: 2022-11-07 05:58:30

I always look at the Chrome updates to see what cool new features the team added.
In version 107 I spotted a lot of cool things around keyboard shortcuts!

Let's take a look at them.

## Customize keyboard shortcuts in DevTools

We first stumbled upon the new customized shortcuts in the DevTools option.

You can now open your DevTools and navigate to settings. There you'll find "Shortcuts".
Here you'll see the list of shortcuts available for us.

![Shortcuts in DevTools](https://cdn.hashnode.com/res/hashnode/image/upload/v1667025602261/IiUUcZYdc.png)

You'll also be able to adjust each shortcut to map to a different key if you prefer that.
Hover the line and click the edit button.

![Edit shortcuts](https://cdn.hashnode.com/res/hashnode/image/upload/v1667026049174/bpWohLj_e.png)

It's super convenient to adjust shortcuts to whatever works best for us.

## Toggle light and dark themes with a shortcut

Besides the option to modify any existing shortcuts, we get a new shortcut for toggling the preferred color scheme media query.
This can be used to switch between light and dark themes quickly.

![Toggle CSS color scheme shortcut](https://cdn.hashnode.com/res/hashnode/image/upload/v1667026503186/pq6tces9N.png)

By default, the shortcut is empty. You can type and critical binding if you want to be active here.

Once you set something, you can use this shortcut to switch between the themes quickly.

## Future shortcuts?

What are some shortcuts you hope to see being added in the future?

I'm personally thrilled with the preferred color scheme and hope to see more rendering shortcuts being added as we go.

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Laravel 9 AJAX CRUD Operation Example
Tags: laravel, laravel9, ajax, crud
Published: 2022-11-07 05:30:00

In this article, we will see laravel 9 AJAX CRUD Operation. here, we will learn how to create AJAX CRUD Operation in Laravel 9 without page refresh. 

In this post, we will use different CDN of bootstrap for designing purposes, and also we will use the data table CDN for ajax crud example in laravel 9.

So, let's see the laravel 9 crud example with AJAX and the laravel 9 crud example with AJAX.

```
Step 1: Install Laravel 9 For Laravel 9 AJAX CRUD Operation

Step 2: Setup Database Configuration

Step 3: Create New Migration Table

Step 4: Create Resource Route

Step 5: Add Controller and Model For CRUD Operation

Step 6: Add Blade Files

Step 7: Run AJAX CRUD Operation
```
Tech Vocabulary
Tags: storybytes, business, tech, developmen
Published: 2022-11-07 05:27:32


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

Like most of you, we’re also shocked by the latest political development leading to war and many deaths. Web and App Studio is not a political company, but this is not a political matter. As an international company, we feel and understand the different cultures and mindsets. But where can we be as an organization, ensuring that the cultures and perspectives are equally respected? How about we double-check our Tech vocabulary again, which is still used in many IT organizations as a standard norm? Our responsibility is to take of these words because words do matter. These changes remove harmful associations, promote inclusion, and help us break down walls of unconscious bias.

generally-refers-to-profession-and-trade/
Coding Standards
Tags: storybytes, qualityassurance, coding, people
Published: 2022-11-07 05:21:58


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

While it is essential to follow a coding standard and best industry practices, it isn't always straightforward. There are significant long term benefits to be gained. But the hurdles of additional time and human resistance to change must first be overcome. Developers do maintain a relationship with their Code. Because of this uncertain relationship with their Code, there are two types of developers: those that strictly adhere to coding standards and those who don't. Some people understand the importance of following a standard style, while others believe it's perfectly OK to ship Code with their fingerprints all over it. Of course, it's tough to define and maintain the perfect coding style - that's why we at Web and App Studio have a Peer Review in our Workflow. It's important to note that consistency is always more important than following the rules. Apart from our Human Peer Review, we use Automation to inspect the Code. These actions give us the confidence that we deliver a well-written code indeed.

For more details please visit:
https://storybytes.webandappstudio.com/en/what-is-coding-standard
Uniswap Deep Dive 1:
Tags: uniswap, blockchain, web3, solidity
Published: 2022-11-07 01:38:35

#Before we start
For introduction, please read 
[Uniswap V2 Overview by Uniswap](https://uniswap.org/blog/uniswap-v2)
[Uniswap V2 Contract Walk-through]
(https://ethereum.org/en/developers/tutorials/uniswap-v2-annotated-code/#main-content)

For source code,
[Uniswap V2 Core](https://github.com/Uniswap/v2-core) and [Uniswap V2 Peripheral](https://github.com/Uniswap/v2-periphery)
 
#Overview
Uniswap V2 Core has 3 contracts: Factory, Pair, WETH and Uniswap V2 Periphery has 1 contract: Router.

##Factory contract (UniswapV2Factory.sol)
It is responsible for creating trading pairs and saving the addresses of all trading pairs.
##Pair contract (UniswapV2Pair.sol)
It saves the pool information of a single trading pair, including the addresses of the two ERC20 tokens in each trading pair, and their respective reserve. 
It handles mint, burn and swap operations. 
UniswapV2Pair **itself** is also an unique ERC20 token. Whenever liquidity is deposited into a pool, unique tokens known as liquidity tokens are minted and sent to the provider's address. These tokens represent a given liquidity provider's contribution to a pool. The proportion of the pool's liquidity provided determines the number of liquidity tokens the provider receives. If the provider is minting a new pool, the number of liquidity tokens they will receive will equal sqrt(x * y), where x and y represent the amount of each token provided.
totalSupply of pair token === sqrt(reserve1 * reserve2) [not sure] 
##WETH contract
This contract is a special ERC20, for the sole purpose to facilitate users to directly trade between ETH and ERC20. Think of WETH as a fully guaranteed bond: the ETH stored in this contract is always equal to the WETH it issued (unless someone sent ETH to it directly using WETH_address.transfer ). 
WETH is created because the trading pair of the Pair contract are always ERC20 tokens and it does not support trading between ETH and ERC20.
It has 2 methods, deposit() and withdraw(). The former is to deposit ETH to get WETH, and the latter is to destroy WETH to get ETH. But these two methods are usually called by the Router, such as the swapExactETHForTokens function in the Router
```
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
                external
                virtual
                override
                payable
                ensure(deadline)
                returns (uint[] memory amounts)
            {
                require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
                amounts = UniswapV2Library.getAmountsOut(factory, msg.value, path);
                require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
                IWETH(WETH).deposit{value: amounts[0]}();
                assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));
                _swap(amounts, path, to);
            }
```
REST vs SOAP: why we recommend REST APIs for A2P messaging
Tags: api, backend, restapi
Published: 2022-11-07 05:09:59

Many businesses use messaging APIs to simplify communications with stakeholders and customers. Business short message service (SMS) tools enable organizations to implement one-time password (OTP) verification, alerts, reminders, and other types of customer support as well as marketing campaigns. They also enable organizations to centrally manage invoicing, human resources, and other internal activities.

Though many applications continue to rely on the SOAP API standard for SMS functionality, the newer REST API standard is actually the better choice. REST offers greater flexibility and speed, while SOAP is more rigid and can be more challenging to learn. This article will explain why we recommend you should choose the REST API standard for your business SMS.

Read the full blog on [Clicksend](https://blog.clicksend.com/soap-vs-rest-api/).

Thanks for reading 💜

---

I publish a [monthly newsletter](https://www.ravsam.in/newsletter/) in which I share personal stories, things that I am working on, what is happening in the world of tech, and some interesting dev-related posts which I come across while surfing the web.

Connect with me through [Twitter](https://twitter.com/ravgeetdhillon) • [LinkedIn](https://linkedin.com/in/ravgeetdhillon) • [GitHub](https://github.com/ravgeetdhillon) or send me an [Email](mailto:ravgeetdhillon@gmail.com).

— [Ravgeet](https://www.ravgeet.in/), *Full Stack Developer and Technical Content Writer*
Docker Cheatsheet
Tags: docker
Published: 2022-11-07 05:08:17

Check Docker Version :

```bash
docker version
```

Login into Docker :

```bash
docker login
or
docker login -u <username>
```

Search Hub for an image

```bash
docker search <image_name>
```

Publish an image to Docker Hub

```bash
docker push <username>/<image_name>
```

List all images :

```bash
docker image ls
```

Build an Image :

```bash
docker build -t <image-name> .
```

Run an Image :

```bash
docker run <image-name>
```

Start or stop an existing container  :

```bash
docker start|stop <container_name> (or <container-id>)
```

To inspect a running container :

```bash
docker inspect <container_name> (or <container_id>)
```

Pull Image :

```bash
docker pull manthanank/<image-name>
```

List all containers :

```bash
docker ps -a
or
docker ps -all
```

Running containers :

```bash
docker ps
```

Stop an image :

```bash
docker stop <container-id>
```

Delete container :

```bash
docker rm <container-id>
```

Delete an Image :

```bash
docker rmi <image-name>
```

Remove all unused images :

```bash
docker image prune
```