teleren/devto huggingface dataset:
API
Tags: api, javascript, php, webdev
Published: 2022-07-29 05:50:00

WHAT IS AN API?

A lot of people use the term API without knowing exactly what it means and what it is used for. We will debunk what an API is.

An API which stands for Application Programming interface is a mechanism which enables two software components to communicate with each other using a set of definitions and protocols. For example an app in your phone like a news app at any point in time contains the data about the latest news or even old news. This data is being served to your app by an API. So your phone talks to the servers containing the data via an API and shows you the latest news.

How do API’s work. API architecture is usually explained in terms of client and server. The application sending the request is called the client, and the application sending the response is called the server. So in the news app example, the news bureau’s database is called the server and the mobile app is the client.

There are four different ways that APIs can work depending on when and why they were created.
SOAP APIs 
These APIs use Simple Object Access Protocol. Client and server exchange messages using XML. This is a less flexible API that was more popular in the past.
RPC APIs
These APIs are called Remote Procedure Calls. The client completes a function (or procedure) on the server, and the server sends the output back to the client.
Websocket APIs
Websocket API is another modern web API development that uses JSON objects to pass data. A WebSocket API supports two-way communication between client apps and the server. The server can send callback messages to connected clients, making it more efficient than REST API.
REST APIs
These are the most popular and flexible APIs found on the web today. The client sends requests to the server as data. The server uses this client input to start internal functions and returns output data back to the client.

Sign up now at orralearn.com to get started with your coding career and learn top in-demand skills like Python, android development, JavaScript and more.
890. Leetcode Solution in cpp
Tags: cpp
Published: 2022-07-29 05:43:40

```
class Solution {
 public:
  vector<string> findAndReplacePattern(vector<string>& words, string pattern) {
    vector<string> ans;

    for (const string& word : words)
      if (isIsomorphic(word, pattern))
        ans.push_back(word);

    return ans;
  }

 private:
  bool isIsomorphic(const string& w, const string& p) {
    vector<int> map_w(128);
    vector<int> map_p(128);

    for (int i = 0; i < w.length(); ++i) {
      if (map_w[w[i]] != map_p[p[i]])
        return false;
      map_w[w[i]] = i + 1;
      map_p[p[i]] = i + 1;
    }

    return true;
  }
};
```

#leetcode
#challenge
https://leetcode.com/problems/find-and-replace-pattern/
What is difference between Firebase and Google Analytics?
Tags: firebase, javascript, sql, analytics
Published: 2022-07-29 05:26:22

Google Analytics is a powerful web traffic analytics tool used by many websites to understand how users interact with the website and where they go after signing up. However, Google Analytics is not suitable for all webmasters as it has some limitations compared to other tools. Also, Google Analytics is only available in the Google platform. Therefore, some webmasters use other tools for analysis, such as Firebase and SEMRush. 

read more : **[Which One Should You Choose?](https://professional-writer0.blogspot.com/2022/07/Firebase-vs-Google-Analytics.html)**

 Firebase is a functional tool used by webmasters to analyze website traffic. It can be used in tandem with Google Analytics to improve user experience and increase conversion rates. In contrast to GA, firebase allows you to track user events in real time and access data easily via the browser or via desktop apps. It also allows you to send real-time notifications and create dynamic campaigns for marketing purposes. On the other hand, Google Analytics uses web server log files to track website traffic behavior while it collects data via cookies on a periodic basis. 

Apart from that, both services use different data collection methods—GA collects data through cookies on a periodic basis while firebase collects data directly from websites via server logs. Using firebase instead of GA can help you analyze your website’s performance in real time instead of collecting historical data over several weeks or months. In addition, using both tools together can provide deeper insights into your website’s performance and potential user behavior patterns.

Firebase and Google Analytics are complementary services used together as they both provide crucial insights into the health of your website's traffic channels. Both tools collect different types of data about users' activities on your website; however, their primary purpose is quite different. While GA aims to give you an accurate picture of your users’ behavior, firebase helps you manage this information by providing real-time insights into your websites’ performance via cloud storage platform. Furthermore, combining both services can help you identify potential problems with your website before actual users experience any issues due to poor performance or security issues.

 Firebase and Google Analytics are complementary services that help webmasters better understand how users interact with their websites and what drives user engagement on various platforms such as Facebook and Twitter. Therefore, it’s important that webmasters keep an eye on their websites using both tools so they can find any potential issues early enough for fixing them.
Coin Change 2 Leetcode
Tags: java, algorithms, dp
Published: 2022-07-29 05:25:44

You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.

Return the number of combinations that make up that amount. If that amount of money cannot be made up by any combination of the coins, return 0.

You may assume that you have an infinite number of each kind of coin.

The answer is guaranteed to fit into a signed 32-bit integer.

 

**Example 1:**

```
Input: amount = 5, coins = [1,2,5]
Output: 4
Explanation: there are four ways to make up the amount:
5=5
5=2+2+1
5=2+1+1+1
5=1+1+1+1+1
```

```java
class Solution {
    public int change(int amount, int[] coins) {
        int dp[][] = new int[coins.length][amount+1];
        for(int row[] : dp) Arrays.fill(row,-1);
        return allPossibleCombinations(coins.length-1,new ArrayList<>(),coins,dp,amount);
    }
    public int allPossibleCombinations(int index,List<Integer> list,int[] coins, int[][] dp,int amount){
        if(index==0){
            if(amount % coins[index]==0) {
                return  1;
            }
            return 0;
        }
        if(dp[index][amount]!=-1) return dp[index][amount];
        int take = 0;
        if(amount>=coins[index]){
            list.add(coins[index]);
            take = allPossibleCombinations(index,list,coins,dp,amount-coins[index]);
            list.remove(list.size()-1);
        }
       
        int dontTake = allPossibleCombinations(index-1,list,coins,dp,amount);
        return dp[index][amount] = take+dontTake;
    }
}
```
**We can remove the stack space by using tabulation approach of dp**
Git in VSCode
Published: 2022-07-29 05:22:00

I've been coding for some time now and still I find that I'm prone to forgetting even simplest of git commands (especially after moving to VSCode version control UI.)

Recently I was working on a project that required using git in terminal. So I wrote this article to remind myself how to do it 🙂

{% embed https://www.youtube.com/watch?v=OFhO1s9WAk4 %}

Git tutorial: [How to clone remote repository using git on command line](https://www.youtube.com/watch?v=OFhO1s9WAk4)

First…open your VSCode and go to View > Integrated Terminal. This will open the Terminal at the bottom of VSCode. This is exactly the same as running cmd.exe on Windows and Terminal on Mac.

Next you need to initialize the git repository. You can do this by typing git init in the terminal. This is a one time process. After this you can start staging, committing and pushing files to the repo. Now that you have initialized a git repository, you can start adding files to it.

To add a file, type "git add filename" in the terminal. You can also type "git add ." to add all changed files. By doing this you are adding a file to something called "stage." Staging is a process of creating a set of changed files you want to include in your commit. It doesn't mean changes have been committed to the GitHub repository yet.

Once you have added a file that has been changed (or multiple files) you can commit it to the repository. To do this, type `git commit -m "message"` in the terminal. The message should be something describing the changes you are making. You can skip the message by not even including -m flag.

Now that you have committed your changes, you can push them to a remote repository. To do this, type "git push" in the terminal. At this point the files will be uploaded to your GitHub repository and will appear there within a few seconds. Other developers can now pull them from the repo, run the new code and start applying their own edits.

You can also pull changes from a remote repository. To do this, type "git pull" in the terminal. If someone else on the team pushed their own files to the repo, you will be able to get latest version this way. It's generally a good idea to do a pull before applying and staging your own changes.

These are the basic git commands that you will need to know in order to use git on the command line. For more information, consult the git documentation.

Here are some other git tutorials I found on YouTube:

- [How to clone remote repo with git on command line](https://www.youtube.com/watch?v=OFhO1s9WAk4)
- [How to undo last commit (git)](https://youtu.be/Ak_FBkBQ1Ng)
- [How to commit and push changes / git add commit &push explained](https://youtu.be/Ak_FBkBQ1Ng)
- [Create New Remote Branch From Local Repository And Push to GitHub](https://youtu.be/8BxwhSrWo1s)
Diving into blockchain as a beginner: Part 2
Tags: blockchain, beginners, web3
Published: 2022-07-29 05:10:00

[First Part here!](https://dev.to/rabibsust/diving-into-blockchain-as-a-beginner-4pi2)

Hello again everyone! Previously we discussed about the new Web3 concept. But Web3 concept is standing over this blockchain technology. Now lets find out what this blockchain is...

Well, The first thing I heard that 

> Blockchain is a public list of record.

Honestly this doesn't ring a bell to me. I am going to find out what does this public list of record even means.

So from this phrase I get that 

- This is a list of record. So this can be a database.
- All the data of this database is public

![Diving into blockchain is easier!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l98w7fpe9fw7vqtjob9j.gif)

But wait! So from where the blockchain word came?

Actually in that **public database** or we can say **the public list of records** stores the informations in batches. Which is called blocks.

These blockes are linked together and sharing the informations forming a continuous line. A chain of blocks is made.

So thats why it is called Blockchain.

But yeah there's more in Blockchain technology which made it more popular.

Blockchain works as a record of transactions which are immutable.

OK what does immutable means then?
The synonyms of **immutable** are _fixed – set – unchangeable – rigid – unshakeable – irremovable_. 

And these record of transactions do not require to rely on any external authorities like governments, banks, any large corporations to validate the authenticity and integrity of the data.
Also there is no central body or single entity control managing this public database.

That's why this is called decentralized!
Through blockchain millions of users help manage and maintain these records.

![Understand Decentralization](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mfa1hs6ywc49bywxvsic.gif)

Now lets breakdown the features of Blockchain.

**Blockchain is Open:** This is a open-source software and will be accessible to the community of developers where it can be updated and executed.

**Trustless:** As there will be no third party to gather the information of the users this will be completly trustless where the users can interact publicly or privately without worrying about their identity.

**Permissionless:** Neither users nor suppliers need any authorization from a governing body for participating.

**Secure:** Blockchain is decentralized where the users don't need to show their identity, everything is encrypted which makes it secure.

Enough reading for today! Still I don't understand how blockchain works. :D
I will try to understand that in the [extended](https://dev.to/rabibsust/diving-into-blockchain-as-a-beginner-extended-part-2-8kl) part. See you there!
Debug in PHP/Laravel Docker with xDebug
Tags: docker, php, laravel, xdebug
Published: 2022-07-29 04:19:00

## Install xDebug

```sudo apt-get install php-xdebug;```
or specify the version
```sudo apt-get install php7.4-xdebug;```

## Initialize PHP with xDebug
In those same 2 directories named 7.4 and 8.0, you will find a php.ini file. Open them.
>cd /etc/php/7.4

We need ton configure xdebug. Just add the following in the php.ini file:

[XDebug]
zend_extension = xdebug.so
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.discover_client_host = true
xdebug.idekey = VSC
xdebug.client_host = host.docker.internal
xdebug.client_port = 9003

## Install PHP Debug Extension 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c1qo0jflepus1x63bw8c.png)

Click on the “Extensions” icon (or Ctrl + Shift + X),
then use the search field to find the extension (type xdebug),
and finally install it (click on the little green “Install” button).

## Configuration of a listener

##launch.json
```
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug on Docker App",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "pathMappings": {
                "/var/www/api": "${workspaceFolder}"
            },
            "hostname": "localhost",
            "xdebugSettings": {
                "max_data": 65535,
                "show_hidden": 1,
                "max_children": 100,
                "max_depth": 5
            },
        }
    ]
}
```

> Note: pathMappings should be your project path.
How to write Better User Stories
Tags: scrum, userstories, confirmations
Published: 2022-07-29 04:18:00

## User Stories

In Scrum, features are usually written in the form of User Stories. 

There are 3 parts (the 3 Cs) to a User Story. Card, Conversations and Confirmations. However what's commonly missing are the set of Confirmations that should be appended to each user story.

---

## The Card

User stories are typically written in this format:

**As a** [_Administrator_], **I want the system to** [_allow me to administer user access_], **so that** [_I can approve and reject user access requests_]. 

---

## The Confirmations

Confirmations are written during the discussions between the Product Owner and the Dev Team. They are akin to a set of Acceptance Criteria. 

Using the example above, we can create the following confirmations.

1. Email notification to be sent out to users holding onto the "Administrator" role whenever a new user request is submitted.
2. Only users holding onto the "Administrator" role can approve and reject users.
3. Email notification to be sent out to approved and rejected users.

With the set of confirmations, developers are now clearer on the requirements. There will be less ambiguity and we get closer to our ideal product at a faster rate. 

Try it today🥳
Append multiple strings to a single QLabel in PyQt5
Tags: help, python, pyqt, pyqt5
Published: 2022-07-29 03:50:19

Hello everyone!

I've been working on this project for a while now, everything is working as should be except the final piece.  

Here is my code.  The app takes a 'number of passwords' input and a 'length of passwords' input.  When you clicked the 'generate passwords' button it generates random passwords that should be appended to my app (self.textBox).  Instead of appending all the generated passwords it only appends the last password that was generated in the loop.  

Question:  If I input '10' or '20' as my desired number of passwords, how can I get it to append them all in my app?

Thank you everyone!

```
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QWidget, QInputDialog, QLineEdit, QVBoxLayout, QPushButton, QLabel
import random


class App(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle('Password Generator')
        self.setGeometry(100,100, 400, 400)
        self.intro = QLabel("Welcome to PyPass Gen 2.0")
        self.dialog1 = QInputDialog()
        self.dialog1.setOption(QInputDialog.NoButtons)
        self.dialog1.setLabelText('Number of passwords: ')
        self.dialog2 = QInputDialog()
        self.dialog2.setOption(QInputDialog.NoButtons)
        self.dialog2.setLabelText('Length of passwords: ')
        self.layout = QVBoxLayout()
        self.layout.addWidget(self.intro, alignment=Qt.AlignCenter)
        self.layout.addWidget(self.dialog1)
        self.layout.addWidget(self.dialog2)
        self.textBox = QLabel()
        self.layout.addWidget(self.textBox, alignment=Qt.AlignCenter)
        self.button1 = QPushButton("Generate Passwords")
        self.button1.clicked.connect(self.execute)
        self.layout.addWidget(self.button1)

        self.setLayout(self.layout)
        self.show()

    def execute(self):
        char = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()-_,./?'
        number_v = int(self.dialog1.textValue())
        length_v = int(self.dialog2.textValue())
        for password in range(number_v):
            self.passwords = ''
            for chars in range(length_v):
                self.passwords += random.choice(char)

                self.textBox.setText(self.passwords)

            print(self.passwords)
            # self.passwords.append(self.textBox)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = App()
    sys.exit(app.exec_())
```
Let’s deploy a Next.Js app with firebase
Tags: nextjs, firebase, react, javascript
Published: 2022-07-29 03:46:39

let’s trying hosting a web app using firebase.

1. Create a firebase account
2. Create a new project

3. Install Firebase CLI tools using the terminal
npm install -g firebase-tools

4. log in to your account
firebase login

5. Go to your project and initiate firebase
firebase init

6. Select firebase hosting and select out as the build folder

7. Update your build script and run npm run build
“build”: “next build && next export”,

8. Finally run firebase deploy — only hosting


That’s it you successfully deployed your next app in firebase.
Basic Java Cube Root Program
Tags: java, beginners, programming, tutorial
Published: 2022-07-29 03:37:00

Here is a very basic cube root finder program made using java.

Get more Code examples [here](https://xcattx.com/java-cube-root-finder/).

So, this is a very basic program, it just takes a input number and prints out its cube root using Math cbrt().

First it uses the Java Util Scanner Class to get the user input, then it converts the input to cube root using math.cbrt and prints the output.

```java
import java.util.Scanner;
public class Program
{
    public static void main(String[] args) {
        // Creates Integer num
        int num = new Scanner(System.in).nextInt();
        // Converts the Int to Cube Root using Math.cbrt
        double cbrt = Math.cbrt(num);
        // Prints the Output
        System.out.println("Input Number: " + num + " Output: " + cbrt);
    }
}
```

**Output:**

```
Input Number: 10 
Output: 2.154434690031884
```
My Favorite Resources about Malayalam Language - Tools/Techniques/Resources
Tags: malayalam, tooling
Published: 2022-07-29 03:25:00

# Intro

This is a list of links which help me to learn more about Malayalam computing. I'm planning to keep this list updated. Any suggestions are welcome [But, I keep this for my personal reference only].

# Links

- https://smc.org.in/
- https://indic.page/
- https://www.multibhashi.com/
- http://mashithantu.com/dictionary/index.php
- https://ml.wikipedia.org/wiki/പ്രധാന_താൾ
- https://charapara.in/
- https://www.easymalayalamtyping.com/
How To Get Current Date And Time In Node.js
Tags: node, javascript, date, time
Published: 2022-07-29 03:19:28

In this article, we will see how to get the current date and time in the Node.js application. In Node.js date and time are handled with the Javascript Date object. It is loaded by default and requires no import of modules. Also, you can get the current date, month, year, hour, minutes & seconds in Node.js. In Node.js you can get the current date-time formatted as YYYY-MM-DD hh:mm:ss, YYYY-MM-DD, DD-MM-YYYY, etc.

So, let's see how to get the current date and time in node.js, node.js get current date and time, node.js get current date, node.js get current date yyyy-mm-dd with time, format current date in node.js, node js date format, node js get current timestamp.

And I will share examples about how to get the current timestamp and how to get date-time from a given timestamp.

---

> **_[Read More: How To Get Current Date And Time In Node.js](https://techsolutionstuff.com/post/how-to-get-current-date-and-time-in-node-js)_**
Full-encryption Upgrade and Unaware Encryption/Decryption Principle Analysis
Tags: opengauss, database
Published: 2022-07-29 02:58:00

To implement encryption and decryption on the client, a large number of maintenance and management operations need to be performed on the client, including data key management, sensitive data encryption, and SQL statement parsing and modification. openGauss encapsulates these complex operations in the client encryption driver to implement automatic encryption and replacement of sensitive information. In addition, all encryption-related metadata is stored in the database so that the database can identify and process encrypted data. 
In addition, parameters related to sensitive information in SQL statements are encrypted to ensure that query tasks do not disclose users’ query intents, reduce complex security management and operation difficulties on the client, and ensure that users are unaware of application development. In addition, the openGauss provides a series of configuration APIs to meet users’ requirements for encrypted fields, encryption algorithms, and secure key storage. The transparency of the openGauss fully-encrypted database makes task migration very convenient for users.

https://blog.opengauss.org/en/post/2022/full-encryption-upgrade-and-unaware-encryption-decryption-principle-analysis/
SSO (Single Sign-On) for CVAT, the Open Source annotation tool
Tags: cvat, annotation, opensource, sso
Published: 2022-07-29 02:28:05

For those who are interested in using CVAT with SSO, previously we made a proof-of-concept video to demonstrate my SSO implementation for CVAT: https://www.youtube.com/watch?v=R7hBBLG5Fdc

Now we are happy to announce that we have submitted our code changes: https://github.com/AlexGaoDW/cvat/tree/feature/datawiza-sso

And we've created a PR to get it into the official repo.

You can try it out by yourself following the document here: https://docs.datawiza.com/guides/cvat.html

We also set up an instance using Google as the identity provider such that you can try SSO functionality with your Google account:
https://cvat-sso.datawiza.net/

Enjoy!