teleren/devto huggingface dataset:
Stored Procedures in SQL database
Tags: database, sql, backend, mongodb
Published: 2023-04-20 09:23:39

Stored procedures are database objects that contain a set of SQL statements or code that can be executed on demand. They are used to encapsulate business logic, complex operations or calculations that can be reused by multiple applications, and also provide an additional level of security and data validation.

Here are some advantages of using stored procedures:

Improved performance: Stored procedures are compiled and stored in memory, which allows them to execute faster than ad-hoc SQL statements.

Reusability: Once created, stored procedures can be reused multiple times by different applications, which saves time and effort in development.

Centralized code: Stored procedures provide a central location to store and manage complex business logic, which makes it easier to maintain and update the code.

Security: Stored procedures can be granted permissions separately from the underlying tables, which provides an additional level of security to the data.

Data validation: Stored procedures can be used to validate input data, which helps to prevent SQL injection attacks and ensure data consistency.

However, there are also some disadvantages of using stored procedures:

Maintenance: Stored procedures can be complex and difficult to maintain, especially if they are poorly designed or documented.

Portability: Stored procedures are specific to the database system they are created on, which makes it difficult to port them to other database systems.

Debugging: Debugging stored procedures can be difficult, as they are executed on the database server and not on the application.

Versioning: Changes to stored procedures can cause compatibility issues with existing applications that rely on them, which can be difficult to manage.
Example of stored procedure:

```sql
CREATE OR ALTER PROCEDURE spAddCars( @CarId VARCHAR(50), @Model VARCHAR(50), @BodyType VARCHAR(50), @Brand VARCHAR(50), @Prices DECIMAL(10),
                @IsDeleted VARCHAR(50))
AS

BEGIN
INSERT INTO Cars
     (
    carId, 
    model , 
    bodyType , 
    brand,
    prices,
    isDeleted )
VALUES
    (@CarId ,
     @Model,
     @BodyType ,
     @Brand,
     @Prices,
     @IsDeleted 
     ) 
SELECT * FROM Cars WHERE carId= @CarId  
END; 
      
EXECUTE spAddCars
SELECT * FROM Cars
```
In summary, stored procedures can be a powerful tool for improving performance, reusability, security, and data validation in database applications. However, careful consideration should be given to their design and maintenance, as well as their impact on the overall application architecture.
Use GIT with SSH on Windows
Tags: git, github, ssh, putty
Published: 2023-04-20 09:18:49

To connect git remotes using ssh url is sometime tricky in windows machines. Try the following steps to use git with ssh on windows

- Download and Install latest [Putty Executables](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)
- Run Pageant and add private keys 
  - run pageant. It will start minimized on the task bar.
  - Double-click the pageant icon the the task bar.
  - add the private keys, whose public part is uploaded to github/gitlab
  - Need to run the pageant and add keys after every restart

  > Use `puttygen.exe` to generate the ssh key-pair
  > Pageant does not accepts the openssh private key. 
  > puttygen.exe can be used to convert the private key generated from ssh-keygen to PKCS format

- set environment variable `GIT_SSH=C:\Windows\plink.exe`
- To trust the remote host, run `plink.exe -agent -v git@github.com` one-time for each host

You are all set to clone a repo from github using ssh url. Example - `git clone git@github.com:somod-dev/somod.git`
Example 1, Automatically generate a complete gin+gorm+redis+CRUD web service project without writing a line of Go code
Tags: go, web, gin
Published: 2023-04-20 09:15:08

### Dependencies

 - Import [sql](https://github.com/zhufuyi/sponge_examples/blob/main/1_web-gin-CRUD/test/sql/user.sql) into mysql services. 
 - Installation tool [sponge](https://github.com/zhufuyi/sponge/blob/main/assets/install-en.md). 

 After installing the tool sponge, execute the command to open the UI interface: 

```bash
sponge run
```

<br>

### Quickly create a web project  

Enter the Sponge UI interface, click on the left menu bar 【SQL】→【Create web project】, fill in some parameters to generate the complete project code for the web service.  

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

The web service code is mainly composed of commonly used libraries such as [gin](https://github.com/gin-gonic/gin), [gorm](https://github.com/go-gorm/gorm), [go-redis](https://github.com/go-redis/redis), and also includes swagger documentation, test code, common service governance function code, build deployment scripts, etc.  

Switch to the web directory and run the command:  

```bash  
# Generate swagger documentation  
make docs  
  
# Compile and start the web service  
make run  
```  

Open [http://localhost:8080/swagger/index.html](http://localhost:8080/swagger/index.html) in your browser to perform CRUD operations on the table.  

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

<br>  

### Batch add CRUD code embedded in web service  

Enter the Sponge UI interface, click on the left menu bar 【Public】→【Generate handler CRUD code】, select any number of tables to generate code, then move the generated CRUD code to the web service directory to complete batch addition of CURD interfaces in the web service without changing any code. 

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

Switch to the web directory and run the command:  

```bash  
# Generate swagger documentation  
make docs  
  
# Compile and start the web service  
make run  
```  

Open [http://localhost:8080/swagger/index.html](http://localhost:8080/swagger/index.html) in your browser to see the newly added CRUD interfaces.  

<br>
<br>

**This is the complete web service code generated from the above steps** [https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)

**Click to view detailed web service development documentation** [https://go-sponge.com/web-development-mysql](https://go-sponge.com/web-development-mysql)  

<br>
async & await
Tags: javascript, beginners, programming, webdev
Published: 2023-04-20 09:09:26

Asynchronous programming in JavaScript can be a bit challenging, especially when dealing with code that depends on network requests or other long-running tasks. However, the introduction of the `async` and `await` keywords in `ES2017 (also known as ES8)` has greatly simplified asynchronous programming in JavaScript. In this article, we'll explore what `async` and `await` are, and how to use them.

**What are async and await?**
           `async` and `await` are two new keywords introduced in ES2017 that simplify asynchronous programming in JavaScript. The 

- `async` keyword is used to define an asynchronous function, which returns a promise that is resolved with the function's return value. 

- `await` keyword is used to pause the execution of an `async` function until a promise is resolved.

An async function is defined like this:

```
async function myAsyncFunction() {
  // Code here
}
```

Inside an `async` function, you can use the `await` keyword to pause the function execution until a promise is resolved. The syntax for using await looks like this:

```
let result = await myPromise;
```

`myPromise` is a promise that you want to wait for, and result is the value that the promise resolves to.

**Fetching data from an API**

Let's take a look at an example that demonstrates how to use `async` and `await` to fetch data from an API.

Suppose we have an API endpoint that returns a list of users. The endpoint is available at https://jsonplaceholder.typicode.com/users. We want to fetch this data and log the names of the users to the console.

Here's how we can do it using `async` and `await`:

```
async function getUsers() {
  try {
    const response = await fetch('https://jsonplaceholder.typicode.com/users');
    const data = await response.json();
    const names = data.map(user => user.name);
    console.log(names);
  } catch (error) {
    console.error(error);
  }
}

getUsers();
```

Here, we define an `async` function called `getUsers` that fetches the data from the API using the `fetch` function. We then use the `await` keyword to `pause` the function execution until the data is fetched and parsed as JSON using the json method of the response object.

Once we have the data as an array of user objects, we use the `map` method to extract the name property of each user, and then log the resulting array of names to the console.

In case there's an error during the fetch or parsing process, we handle it using a `try-catch` block.

Finally, we call the `getUsers` function to start the asynchronous operation.

**Repl as Example : **

1. https://replit.com/@CodeOf1/asyncawait
2. https://replit.com/@CodeOf1/asyncawait02
How GPT is Revolutionizing the Crypto Industry: 5 Key Applications
Tags: devops
Published: 2023-04-20 09:02:47

The emergence of GPT (Generative Pre-trained Transformer) has had a significant impact on various industries, including the crypto industry. GPT is a type of deep learning model that uses unsupervised learning to generate text and has revolutionized the way machines understand human language. In this article, we will explore the ways in which GPT influences the crypto industry.

1.Sentiment Analysis
Sentiment analysis is the process of using natural language processing and machine learning techniques to extract subjective information from text data. The crypto industry is a highly volatile market, and there are always varying opinions and news articles that can affect the market. GPT models can analyze social media and news articles to identify the sentiment around a particular cryptocurrency, allowing investors and traders to make more informed decisions.

2.Price Prediction
The crypto industry is known for its high volatility, and predicting the price movements of cryptocurrencies is a challenging task. GPT models can analyze large amounts of data from various sources such as social media, news articles, and forums, to predict the price movements of cryptocurrencies. This can be incredibly useful for traders who are looking to make informed decisions about when to buy or sell a particular cryptocurrency.

3.Fraud Detection
The crypto industry is vulnerable to fraud, and scammers are always looking for ways to take advantage of unsuspecting investors. GPT models can analyze text data from various sources, such as forums and social media, to identify potential fraudulent activities. This can help regulators and law enforcement agencies to take action against scammers and protect investors.

4.Customer Support
Customer support is a critical aspect of the crypto industry, and many crypto exchanges and wallet providers have started using GPT models to automate their customer support services. GPT models can understand and respond to customer queries in a natural language format, providing quick and accurate responses. This not only improves customer satisfaction but also reduces the workload of customer support staff.

5.Smart Contracts
Smart contracts are self-executing contracts with the terms of the agreement between buyer and seller being directly written into lines of code. GPT models can analyze smart contracts to ensure that they are correctly written and executed. This can help to prevent errors and ensure that the terms of the contract are fulfilled.

In conclusion, GPT has had a significant impact on the crypto industry, enabling various applications such as sentiment analysis, price prediction, fraud detection, customer support, and smart contract analysis. As GPT models continue to evolve, we can expect to see more advanced applications of this technology in the crypto industry, leading to increased efficiency and improved outcomes for investors, traders, and businesses.
Unable to download BcryptJS even through --force flag
Tags: npm, bcrypt, angular, node
Published: 2023-04-20 08:55:47

I am trying to download Bcrypt but it is giving error. Even though I have removed and installed again using --force package but it's still not downloading. I have also tried rebuilding of this package.

You can see the error below.

npm ERR! code EEXIST
npm ERR! path C:\Users\hp\Downloads\e-people\epeople-master\node_modules\.bin\mocha
npm ERR! Refusing to delete C:\Users\hp\Downloads\e-people\epeople-master\node_modules\.bin\mocha: is outside C:\Users\hp\Downloads\e-people\epeople-master\node_modules\mocha and not a link
npm ERR! File exists: C:\Users\hp\Downloads\e-people\epeople-master\node_modules\.bin\mocha
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
Top 5 Mops for Cleaning Up Dog Urine
Tags: best, spray, mop
Published: 2023-04-20 08:47:23

Cleaning up dog urine can be a challenge, especially if your furry friend has frequent accidents. However, with the right mop, tackling those stubborn stains and odors becomes much easier. Here are the top 5 mops for cleaning up dog urine:

Bissell SpinWave Powered Hardwood Floor Mop and Cleaner - This mop is ideal for hardwood floors and comes with a spray trigger that releases cleaning solution directly onto the floor. It also has a spinning mop pad that helps to loosen dirt and grime, making it easier to clean up pet stains.

Shark Genius Hard Floor Cleaning System - This mop comes with a spray nozzle that allows you to control the amount of cleaning solution you use. It also has a steam feature that helps to kill bacteria and remove tough stains. The mop pads are washable and reusable, making it an eco-friendly option.

Swiffer WetJet - A classic choice that has been a favorite for years, the Swiffer WetJet comes with a pre-mixed cleaning solution that is dispensed with the push of a button. Its disposable pads make cleaning up a breeze, and its lightweight design allows for easy maneuverability.

O-Cedar EasyWring Microfiber Spin Mop - This mop comes with a bucket that has a built-in wringer, making it easy to control the amount of water and cleaning solution you use. The mop head is made from microfiber, which helps to absorb pet stains and odors.
Being a housewife or simply a working woman, you must be in dire need of a process to make your cleaning much easier. Well, Best Spray Mops. For more info click here. **[https://topspraymop.com/best-mops-for-dog-pee/](https://topspraymop.com/best-mops-for-dog-pee/)**
Why API integrations break and how to avoid them?
Published: 2023-04-20 08:44:00

Today, our products are deeply dependent on third-party integrations to run successfully. Common integrations that we have come across in building products include payment gateways, communication APIs, CRMs, client integrations and banking APIs.

##Most common reasons for issues with integrations<a name="chapter-1"></a>

1. Poor Provisioning by Service Provider. 
While multi-tenant architectures with distributed load are the recommended way to build API products, very often we end up with issues in reaching service providers because of a lack of efficient provisioning. Peak traffic apart, sometimes even during a lean period, we have had vendor services going down due to a minor increase in the request volumes

2. Latency breaches → Timeouts
To protect existing workflows and thread pools from choking, we have pre-defined thresholds with service providers for APIs. When these latencies are breached, it leads to timeouts of requests at our end

3. Unhandled error codes
A new error code, generated due to an edge case or otherwise, which is not managed during exception handling can impact our workflows

4. Incorrect response
Changes in third-party’s APIs can lead to unexpected request responses and bodies, causing downstream APIs to reject the response, throw errors or respond unexpectedly

5. Webhook Deactivations 
Modern integrations depend on webhooks to receive data from third-party. We have seen instances where webhooks have been deactivated at the service provider’s end without appropriate notifications


##Remediation Strategies<a name="chapter-2"></a>

1. Monitoring API latencies, throughput and error rates

2. Multiple integrations in case of critical services - As you read above, a service provider’s APIs can falter due to multiple reasons. In our attempts to normalise dependency, multiple integrations should be set in place for critical services

3. Setting up fallback options in case of failures - Setup circuits with a default fallback option in case of failure

4. In case of requests consistently exceeding latency thresholds, dropping the requests would be critical to avoid queuing

5. Enable webhook monitoring and set up alerts for the sudden dip in transaction frequency

6. Store API response bodies in logs or databases to be able to retrieve and identify issues in data in case of debugging needs


##Introducing Dr Droid: Monitor third-party integrations
<a name="chapter-3"></a>

[Outsiders](https://docs.drdroid.io/docs) help you monitor 3rd party integrations - both performance and context monitoring.****


##Context Monitoring<a name="chapter-4"></a>

- Change in response body format or variables

- Data variation / sudden change for a specific parameter

- A mismatch between the status code and API response body

- Mapping between API call and webhook response

##Performance Monitoring:<a name="chapter-5"></a>

- Error rates and error codes

- API latency

- Ack to webhook delay

Chat with us[here](https://calendly.com/siddarthjain/catchup-call-clone?month=2023-04) or sign up by clicking [here](https://app.drdroid.io/signup)!
Blazor WebAssembly: A Game-Changer for Progressive Web Apps
Tags: dotnet, dotnetcore, programming, beginners
Published: 2023-04-20 08:31:47

In the world of web development, progressive web apps (PWAs) have been gaining popularity due to their ability to deliver native app-like experiences to users while being easily accessible through the web. However, developing PWAs traditionally has involved using a combination of different technologies, which can be complex and time-consuming.

Enter Blazor WebAssembly, a framework that promises to simplify PWA development using .NET and C# programming languages. Blazor WebAssembly is a client-side web development framework that runs C# code in the browser. It allows developers to create fully functional, interactive web applications using .NET, which previously was only possible through server-side development.

With Blazor WebAssembly, developers can build high-performance, offline-capable PWAs using a single language, C#. The framework provides a set of UI components that can be customized to fit the application's specific needs, allowing for rapid development. Blazor also enables easy integration with other .NET technologies, such as ASP.NET and Azure.

One of the significant advantages of using Blazor WebAssembly for PWA development is its ability to provide faster load times and better performance than traditional PWAs. This is because Blazor WebAssembly compiles the C# code into WebAssembly, which runs natively in the browser. This approach eliminates the need to download and parse JavaScript code, resulting in faster startup times and a smoother user experience.

Moreover, Blazor WebAssembly offers the benefit of code reuse, allowing developers to share code between the client and server. This results in reduced development time and better code maintainability.

Blazor WebAssembly is a game-changer for PWA development. Its use of .NET and C# programming languages allows developers to create fast, high-performance PWAs with a single language. With its ease of use, better performance, and code reuse capabilities, Blazor WebAssembly is undoubtedly worth considering for your next PWA project.
How to Create Sidebar Using React and Sass: Super Simple and Quick Tutorial
Tags: webdev, react, javascript, beginners
Published: 2023-04-20 08:24:00

In this article, we'll demonstrate how to use ReactJS to create a small, quick, and easy website. Sass will be used for the style portion. 
This is the tutorial website for you if you want to learn how to create a web application with react js! We'll walk you through every step of creating a straightforward web application and landing pages. This is a fantastic introduction to web development with React. Visit the site, then, for sure!

[Source Code](https://ziontutorial.com/how-to-make-a-sidebar-in-react-js-dashboard-sidebar-responsive-sidebar-navbar-react-router-v6/)

[Website Link](https://ziontutorial.com)
Create first app with layout
Tags: react
Published: 2023-04-20 08:17:46

Hi, I'm new to the react world and learning. I'm creating my app template, but I can't solve this problem.
I'm creating a layout component and i'm inserting inside header, sidebar, footer, main.
What I can't do is insert the button that opens and closes the sidebar inside the header.
If the button I insert it in the layout component, everything works fine, but how do I insert the button inside the header? The toggle class active button to the sidebar and the body container div.
I have to insert the button in the Header component, how do I do it?

I posted the code here, can you help me please?

https://codesandbox.io/embed/nostalgic-wildflower-w81pmq?fontsize=14&hidenavigation=1&theme=dark