teleren/devto huggingface dataset:
MySQL tutorial - 9 Transaction
Tags: mysql, beginners, tutorial
Published: 2021-03-25 00:06:26

In MySQL, a sequence of queries can be wrapped inside transaction. Transaction can be useful for some use cases.

## Create a transaction

This is the query structure to create a transaction. The `QUERIES_SAMPLE` can be filled with a sequence of queries. The `COMMIT` clause is used to execute or commit a transaction that already created.

```
START TRANSCATION;

QUERIES_SAMPLE;

COMMIT;
```

This is the transaction example, this transaction contains a sequence of queries:

1. Add the product into the cart.
2. Update the product's quantity that inserted into the cart.
3. Retrieve the product's data after being updated.

```sql
START TRANSACTION;
-- 1. add the product with id equals 1 into the cart
INSERT INTO cart VALUES (0,1);

-- 2. update the product's quantity that inserted into the cart
SELECT @quantity := quantity FROM shop WHERE id = 1;
UPDATE shop SET quantity = @quantity - 1 WHERE id = 1;

-- 3. retrieve the product's data after being updated
SELECT * FROM shop WHERE id = 1;

-- commit the transaction
COMMIT;
```

## Rollback a transaction

Rollback a transaction is a mechanism to undo or roll back the changes that affected by a transaction. To rollback a transaction can be done using `ROLLBACK` query.

This is the example of rollback mechanism, in this case a transaction is a created to delete all data inside shop table.

```sql
-- transaction sample
START TRANSACTION;
DELETE FROM shop;
```

Notice that the transaction is not committed so the rollback mechanism is available to use. To rollback a transaction use the `ROLLBACK` query.

```sql
ROLLBACK;
```

After the `ROLLBACK` is executed, all data inside the shop table is still exists.

## Notes

- Other MySQL transaction example can be checked [here](https://www.mysqltutorial.org/mysql-transaction.aspx/).

> This is the final part of the MySQL tutorial series, I hope this series is helpful for learning MySQL. 😀

I hope this article is helpful for learning SQL, If you have any thoughts or comments you can write in the discussion section below.
need help for webpack
Tags: javascript, webpack, help
Published: 2021-03-25 12:52:13

anyone can help me out, please 
I'm working with webpack but I get trouble while changing the HTML content it does not change the browser 
please watch the video and tell me how can I fix that

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z4xrzo0004juzu38yvtd.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e4n3rj1q1ate5m4x8jqp.png)
Get all blobs in given Azure container
Tags: csharp, azure, blob, storage
Published: 2021-03-26 12:49:12

In last article, we tried to download single blob file from azure storage using `Azure.Storage.Blobs`. This is the new library developed by `Microsoft` to replace depercated `Microsoft.WindowsAzure.Storage`. So let's get started.

## 0. Setting up the context
In this article, we will try to get all the blobs(images) stored on Azure blob storage in defined format i.e. `User_id/image.ext`.
```
john_doe/image1.jpg
john_doe/profile.png
jane_doe/profile.PNG
```
So if there are blobs with given name in Azue, we are trying to get all blobs for user id `john_doe`

## 1. Install NuGet package 
Install NuGet package `Azure.Storage.Blobs`. At the time of writing this, the latest version is 12.8.0.

## 2. Import library
`using Azure.Storage.Blobs;`

## 3. Get connection string
I assume you have Azure account and thus connection string to connect to Azure Blob Storage. Store this in a variable or constant based on your need.
```
const string CONN_STRING = <connection_string_from_azure_portal>
const string BLOB_CONTAINER = <blob_container_name>
```

## -1. Now the final thing
I will list all blobs(images) present in given container and have specified format.

```
string userId = "john_doe";
var allBlobs = container.GetBlobs(prefix: $"{userId}");
```
The above code will fetch all the blobs details present in container with given prefix(john_doe).

If you want to download the blobs as well, [this article](https://dev.to/imcmjha/download-blob-from-azure-using-azure-storage-blobs-c0m) might be helpful.

That's it. I hope this will be helpful. 🙂
Use Bitwise operator to Swap two numbers. 
Tags: java, algorithms
Published: 2021-03-28 04:02:58

Bitwise operators are always more efficient than mathematical operators. 

And reason behind this is, Bitwise operators directly work on bits that's why.

So going with Bitwise operators will be good. 

https://www.javaoneworld.com/2020/03/swap-two-numbers-using-bitwise-operator.html?m=1
The 3 ways to make an asynchronous method in JavaScript
Tags: javascript, node, learning
Published: 2021-03-28 22:51:34

Today, I decide to write my first post on Dev.to and I choose this subject thanks to my professor named [Adrien Joly](adrienjoly.com).
During my studies in the [ESGI](esgi.fr) school, he show us how to make an asynchronous method easily so, I want to share this 3 methods with you !

# The setTimeout method

The function named **setTimeout()** takes a callback in its first parameter and the second is for the timeout in milliseconds.

A callback is a function given in the parameters of another which is responsible for executing it when it needs it.

You can see an example down below :
{% gist https://gist.github.com/dd701116/bdc68c8fbd793f3b95f6fbdf3c4f276b %}


# The promise

A Promise is a JavaScript object which takes 2 callbacks. The first is for the resolving case and the second one is for the rejection.
The asynchronous functions return a Promise to let you define what to do after it executes.

The keyword here is **then**. When you get a promise, you can call the **then()** function and give it your resolve function and your rejection method.

You can see an example down below :
{% gist https://gist.github.com/dd701116/f20cf5e77fbfecda395501f635474373 %}

Another way to **catch** the rejection case is to use the **catch()** function like that :
{% gist https://gist.github.com/dd701116/e46d1757e624667d1f1771bf0d22ee13 %}

# The async-await

The **async** keyword is used to specify that a function is asynchronous and the **await** keyword is used to force the program to wait the function's response before it continue.

Be aware because the function you are waiting can throw an error so surround it with a **try-catch** block to manage the resolving case and the rejection.

Another thing, if you want to use the **await** keyword, you have to do it in an asynchronous function.

You can see an example down below :
{% gist https://gist.github.com/dd701116/8f4f2648fb0eecb3e08416aa403b9b24 %}


Personally my favorite is the **async-await** method but you have to choose the right way depending on the problem you are solving !

Thanks for your time, don't forget to smash the :heart: button, follow me to stay update and see you in the next post :smile:


# Sources

- https://adrienjoly.com/cours-nodejs/
- https://developer.mozilla.org/en-US/docs/Glossary/Callback_function
- https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
Daily Developer Jokes - Monday, Mar 29, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-03-29 12:00:21

---
title: "Daily Developer Jokes - Monday, Mar 29, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Monday%2C%20Mar%2029%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1259427b3da.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Why do all HTML emails get blocked?

___A:___ Because they are all `<span />`.
 -->
CSS Property: content-visibility
Tags: css, webdev, webperf
Published: 2021-03-29 19:19:01

👉 The CSS property `content-visibility` allows the web developer inform to the browser rendering engine which parts of the page are out of the user view.

😍 With this info, the browser can optimize the render flow time to focus on where really matters for the user.

```
content-visibility: visible;
content-visibility: hidden;
content-visibility: auto;
```

🪔  `content-visibility` using `visible` or `hidden` values show or hide respectively the content on a rendering engine level.


⚡️  `content-visibility` with value `auto` tells the browser rendering engine to render the elements based on user needs.
Machinations Primer
Tags: gamedev, design, systems
Published: 2021-03-30 16:25:35

[Machinations](https://machinations.io) is a powerful tool that you can use for game design. Let's go over some basic information to help us get productive in this tool.
***
## Nodes
Nodes are units in your Machinations diagram that affect Resources. Resources are your finite gameplay elements such as money, health points and so on. Some nodes include:

* Sources, add resources
* Drains, remove resources
* Pools, collect resources
* Gate, redistributes resources
* Convertor, changes one resource into another

Nodes can be linked to each other with Resource Connections. This allows Resources to flow to simulate various game activities. Resource Connections have Inputs and Outputs. Inputs connect into nodes while Outputs lead out of nodes. Inputs are the arrowheads. 

It is very important to note that the Label of the Resource Connection determines how many Resources can flow in and out in one step of the simulation. The default or empty value is 1 Resource. Labels include:

* Absolute numbers per step
* Random Rates such as D6, 2D20, 33%
* Intervals of resource per step such as 1|2
* Keywords like all for all Resources

If you need to add a descriptor to the label, use a semi-colon to separate the string from the formula. For example, "Pick Random: 50%"

## Properties
Nodes and Resource Connections have many properties. Let's go over some important ones.

Activations Modes define when your Node runs. There are currently 4 types:

* Automatic, runs once per step of the simulation
* Interactive, runs only when clicked when the simulation is running
* OnStart, runs only at the start of the simulation
* Passive, runs only when Triggered

As an example, Passive nodes can be triggered by other nodes based on the node's Action property.

The Action property defines how resources are moved. There's Push/Pull and Any/All.

Push means that the Node will move Resources to Outputs while Pull means that the Node will draw Resources from Inputs. 

Any means that the Node will push/pull as many Resources as the output/input allows while All means that the Node will push/pull only if the output/input can be satisfied. 

> It's important to note that one Node cannot both Push and Pull. If a Node is pulling and it needs to pass Resources, the other Node(s) need to pull as well.  

## Color Coding
Color is one of the most important concepts in Machinations because that is how Resources are differentiated! Resources can be Black, Blue, Green, Orange and Red. If you need more Resources, your diagram might be trying to do too much. 

The Resources property in Nodes lets you define what type of Resource that Node adds, remove, collects, etc.

The Color Coding property in Resource Connections lets you determine whether only Resources of a specific color can pass through.
***
 And that concludes this primer. You should now be armed with enough knowledge to be productive with this tool. To continue learning, check out Traders and State Connections.
AWS Cloud Practitioner  Certification Resources
Tags: aws, beginners, productivity, career
Published: 2021-03-30 19:56:11

<i>The AWS Certified Cloud Practitioner examination is intended for individuals who have the knowledge and skills necessary to effectively demonstrate an overall understanding of the AWS Cloud, independent of specific technical roles addressed by other AWS Certifications. The exam can be taken at a testing center or from the comfort and convenience of a home or office location as an online proctored exam.</i>

> Exam Details :
- 65 MCQ questions
- 90 minutes to complete the exam
- Testing center or online proctored exam
- 100 USD (Practice Exam: 20 USD)

### Resources:

##### LinkedIn Learning:
[Prepare for AWS certified cloud practitioner exam](https://www.linkedin.com/learning/paths/prepare-for-the-aws-certified-cloud-practitioner-exam)

##### White papers:
- [Overview of Amazon Web Services](https://docs.aws.amazon.com/whitepapers/latest/aws-overview/introduction.html?did=wp_card&trk=wp_card)
- [AWS Well-Architected Framework](https://docs.aws.amazon.com/wellarchitected/latest/framework/welcome.html?did=wp_card&trk=wp_card)
- [Compare AWS Support Plans](https://aws.amazon.com/premiumsupport/plans/)
- [AWS Storage Services Overview](https://docs.aws.amazon.com/whitepapers/latest/aws-storage-services-overview/welcome.html?did=wp_card&trk=wp_card)
- [How AWS Pricing Works: AWS Pricing Overview](https://docs.aws.amazon.com/whitepapers/latest/how-aws-pricing-works/welcome.html?did=wp_card&trk=wp_card)

##### Practice tests
- [Udemy AWS certified cloud practitioner Practice exams](https://www.udemy.com/course/aws-certified-cloud-practitioner-practice-test/)
Push :: To Multiple Repos Simultaneously
Published: 2021-07-01 19:55:00

---
title: Push :: To Multiple Repos Simultaneously
published: true
date: 2018-08-27 07:51:00 UTC
tags: 
canonical_url: https://blog.g33kzone.com/push-to-multiple-repos-simultaneously
---

This tutorial helps demonstrate the process configuration to push your source code to multiple repositories.

### Background

If a need arises to have multiple repos, then it's always better that they are in sync. Fortunately, Git allows pushing the source code to multiple repos at once.

[![Git Multi Repo](https://cdn.hashnode.com/res/hashnode/image/upload/v1623671701283/wZzwt0j9W.png)](https://2.bp.blogspot.com/-EYBE6CHprjg/W4O3ZR-1uhI/AAAAAAAAz6E/iQ-1-NXU_hIbECnTSEnIXT19AX9HHocbACLcBGAs/s1600/Multiple%2BRepo.PNG)

### Remote URL

Let's consider the following repo urls for the source code to be pushed. You can observe, the urls are almost identical except the domain name.

```
git@github.com:g33kzone/multi-repo.git
git@gitlab.com:g33kzone/multi-repo.git
```

_Note : To prevent being asked for passwords while pushing the source code, make sure to set up SSH access for each service._  
Let's have an alias created called origin to your main remote repository (i.e. Github)

```
git remote add origin git@github.com:g33kzone/multi-repo.git
```

### Configure Push Remote URLs

Following commands (over the command line) will do the trick.

```
git remote set-url --add --push origin git@github.com:g33kzone/multi-repo.git

git remote set-url --add --push origin git@gitlab.com:g33kzone/multi-repo.git
```
This can be confirmed by running the following command
```
git remote show origin
```

### Push Multiple Repos

Use the following command (over the command line - once) to set the upstream
```
git push --set-upstream origin master
```
Later only "git push" should also work.
How To Solve The Cold Storage Warehouse Monitoring Challenges With IoT
Published: 2021-03-31 07:48:28

Cold storage warehouses are critical for the preservation of perishable products. From agricultural produce, dairy products, to medicines, a huge range of products require these warehouses. With temperature-control features, these facilities help extend the shelf life of the perishable products and ensure they’re kept in top condition. 

As one can imagine, such facilities require round-the-clock monitoring for preventing loss of air or degradation to minimize waste. However, due to certain monitoring issues, many companies are unable to keep a track of the products in the warehouses. Here we’re letting you know about the monitoring issues troubling companies and the ways to overcome it. 

## Common cold storage warehouse monitoring challenges

### Product-specific requirements

When it comes to temperature-requirement for different products, one size does not fit all. The adequate temperature control for agricultural products tends to differ from the required climatic conditions for pharmaceutical items, processed food, etc. The different temperature requirement is a major contributing factor in causing monitoring problems experienced by cold storage warehouses. 

### Keeping a trace of product

Most of the [cold storage](https://coldconsult.com/) warehouses are large-sized housing numerous products. Due to the gigantic size of these facilities, keeping a track of products can be a daunting task. And, improper monitoring may lead to wastage or degradation.  

## Benefits of IoT solutions in overcoming the monitoring challenges

### Real-time access

Innovative solutions like IoT and [cloud services](https://www.erisn.com/cloud-and-cloud-services) can make a world of difference to the way you handle the products in a cold storage warehouse. It provides you to access to real-time data. This is how businesses nowadays prevent decay and minimize waste. Through notifications and other features, you can keep a track of the condition of different types of products in the warehouse. 

### Efficient stock management

By integrating the [IoT technology](https://www.erisn.com/internet-of-things), cold storage warehouses can efficiently manage stocks. Cloud services and similar systems provide relevant info about the facility and the products. From the expiration of different types of products to the empty spaces in the warehouses, the system allows efficient and organized stock management. 

### Adequate temperature monitoring

With IoT solutions, you can address the most common and damaging monitoring issue that leads to waste. The system facilitates adequate temperature monitoring for different types of perishable items in the cold storage warehouse. With this, the business can maintain the proper temperature for the product and prevent decay. 

#### At Last

With the implementation of IoT, businesses can tackle monitoring problems commonly faced by cold storage warehouses. This system is efficient and offers access to real-time data critical for proper management of the perishable products.
Creating a TypeScript tsconfig for nodejs
Tags: typescript, node
Published: 2021-03-31 13:13:03

Do you hate dealing with tsconfig files? My problem is that I just don't spend enough time with them to learn all the settings. I create the config once for a new project, usually leaving most things as default, then never touch it again.

Fortunately, I recently discovered that Microsoft has created a collection of platform-specific presets to base your tsconfig on. The preset is installed as an npm package and referenced using the `extends` property in your tsconfig.

To setup a typescript project for node 14 install the `@tsconfig/node14` preset.

```bash
npm install --save-dev @tsconfig/node14
```

Now your tsconfig can be as simple as one property, but any settings in your tsconfig will override the preset values.

```json
{
  "extends": "@tsconfig/node14/tsconfig.json"
}
```

The power behind the extends property is that you can easily get started on a project with optimized settings, and if you have multiple TypeScript projects you can create your own tsconfig preset!

## References
- [TSConfig Reference](https://www.typescriptlang.org/tsconfig#extends)
- [@tsconfig - npm search](https://www.npmjs.com/search?q=%40tsconfig)
Supporting a monolithic backend for video streaming
Tags: writing, webdev, programming, showdev
Published: 2021-03-31 14:44:11

The M3 company, which is part of the NMG, develops the More.tv and CTC online cinemas, as well as the websites of the group’s TV channels. Evrone maintains and develops the platform through which all video content enters these products — the hardware and software complex (HSC). We write the code and advise the client’s partners on the server side of the project.

The software part is needed so that videos for different broadcast channels can get there in the desired format, with specific encoding and additional service information. They can also use the administration panel to manage advertising on the channel websites. So, the HSC is vital for the holding’s business tasks, and it must run smoothly.

We partnered with M3 when they were looking for a technical team that could handle the revamping of their Videomore product into a streaming platform like Netflix. At that time, it didn’t meet the user requirements for streaming services. So, we decided to create a new More.tv service, based on their current product.
But for real, what are web components?
Tags: webcomponents, a11y, html
Published: 2021-05-04 18:46:12

If you are here, I am just going to assume that you do not know what web components are.  Otherwise, why would you be reading this?

## An easy, breezy, beautiful definition
Basically web components are a group of features that provide a standard model for the web, allowing encapsulation and interoperability of HTML elements.  Easy right?

There are four browser standards that work together to compose the model:
1. <template> elements
2. custom elements
3. shadow DOM
4. javascript modules

Read more into each of these [here](https://dev.to/bennypowers/lets-build-web-components-part-1-the-standards-3e85)

## Why utilize web components?
One of the biggest advantages of web components is that it is open source.  Open source is when the source code for a software is free and available for all.  It can from there be changed or redistributed.

Another great aspect of web components is that they are custom.  With applications using so many different environments - from JavaScript, Python, or even HTML - web components are able to be used in all due to their functionality that is separated from the specific code.

## They can make business devOps easier!
For developers when they are working on a website or framework and find themselves repeating components, web components can come in handy.  Instead of creating the component every time, the web components allow for it to be created only once, and then shared across the company.  These can include headers, footers, menus, and other web aspects that need to be continually reused.

## Examples of real life web components being used 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1yfmjr9qi7v1e6p7zfzq.png)
 This image shows the web component for the header when you inspect the twitter home page.  You can learn about that [here](https://www.webcomponents.org/element/@polymer/app-layout).

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/juf5e1p1xmlydu1r1h7d.png)
Here is an example of an svg web component being used on YouTube.  It basically lets the user define their own icons, and you can read more about it [here](https://www.webcomponents.org/element/@polymer/iron-iconset-svg).

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xniee6finv2tsn7lgg2y.png)
A great place to find out about how you can utilize web components in Adobe is right on Adobe in the first place!  [This](https://opensource.adobe.com/spectrum-web-components/) adobe site shows all of the open source code available for Adobe products.

If you would like a video to explain web components to you, check out this [video](https://youtu.be/ml6ddXNRxgs)!