teleren/devto huggingface dataset:
Building Backends with Node.js and MongoDB
Tags: beginners, javascript, webdev, node
Published: 2023-08-18 16:52:01


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t9lgsj45pfxo2fztreun.jpg)
As a seasoned backend Node.js developer, I understand the importance of creating robust and efficient applications. In this blog post, we will delve into the world of Node.js and MongoDB, exploring best practices and techniques that can help you build powerful and scalable backend systems.

To develop a Robust project the foundation needs to be strong, for that the general practice of creating a node project is shared below step-by-step

- Create a project folder like "nodeBasic" and cd into the directory.
- Run "npm init" and setup the project.
- Now type "npm i express" to add express in your dependency
- In the directory create index.js file and follow along with the code below.

```
const express = require('express');
const app = express();

app.get('/api/users', (req, res) => {
  const users = ['User 1', 'User 2', 'User 3'];
  res.json(users);
});

const PORT = 3000;
app.listen(PORT, () => {
  console.log(`Server listening on port ${PORT}`);
});

```
Express.js, a minimal and flexible web application framework for Node.js, simplifies the process of building APIs. Its middleware architecture, routing capabilities, and extensibility make it a go-to choice for backend developers.

- Now to connect the Mongo db we are going to use the most famous ODM "Mongoose" 
- To install it type "npm i mongoose"
- Then follow along the code in the index.js file to connect the mongo db
```
const mongoose = require('mongoose');

mongoose.connect('mongodb://{localhost:PORT}/nodeBasic')
  .then(() => console.log('Connected to MongoDB'))
  .catch(error => console.error('Error connecting to MongoDB:', error));

```

Node.js and MongoDB form a powerful duo for backend development. With Node.js's event-driven architecture and MongoDB's flexibility, you can create highly responsive and scalable applications. By utilizing frameworks like Express.js, you can design elegant APIs that cater to your application's needs. As you embark on your backend journey, remember to prioritize code quality, security, and performance to build a foundation that stands the test of time.

Thank you for joining me on this exploration of backend development with Node.js and MongoDB. If you found this blog post helpful, stay tuned for more insights and tips in the future!
Journey of completing Oracle Java Certification OCA 1Z0-808 exam
Tags: oracle, associate, java, certification
Published: 2023-08-18 16:50:06

I started preparing by reading Oracle Certified Associate Java SE 8 Programmer text book. 

I read couple of times and started taking mock exams on Enthuware and exam topics. For questions I couldn't answer, I typed each one into my IDE or a text editor. 

I was able to understand each concept very well thanks to Sean Kennedy's Let's Get Certified YouTube channel, where he provides excellent visual explanations.

## Challenges that I faced:

- Fear of failing the exam.

- Tricking the simple question to test the foundation concepts.

- cost of the exam.

## Advice for individuals preparing to take the exam:

- Set a time frame.

- Buy the voucher and schedule the exam date.

- Read the book once or twice.

- Start giving mock question papers using Enthuware, exam topics [Each day up to 25 questions, solve the problems either using console or IDE]

- Practice makes us behave like a compiler so type the mock questions and understand the flow.

- Never memorize the concepts.

## Below are the books and mock exams I used for my preparation:

- https://learning.oreilly.com/library/view/oca-oracle-certified/9781118957424/

- https://www.youtube.com/watch?v=QOTMbM5erSI&t=2689s

- https://enthuware.com/java-certification-mock-exams/oracle-certified-associate/ocajp-1z0-808

- https://www.examtopics.com/exams/oracle/1z0-808/view/

All the best for your exam! Go for it :)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wyrtulu6hh2swx0r3fpu.PNG)
Software Testing
Published: 2023-08-18 16:34:32

Software testing is the process of testing an application or a software product to make sure that it is error free.
Testing can be done manually by checking the functionality of the application, or writing a piece of automation code.
Testing is not only finding the defects, but it also helps the application to be reliable and secure.
Due to this, the performance of the application can be improved.

Typically testing is classified into three types:
1.Functional testing, 2.Non-functional testing, 3.Maintenance 

Under functional testing there is unit testing, Integration testing and system testing.
Unit testing: It helps the developer to test the unit of code 
is working properly or not.
integration testing: It focuses on the construction and design of the software.

Under non-functional testing it checks for the performance, load, scalability, volume, and usability.

Under maintenance, regression testing will be done.
React-snap and onClick does not work
Published: 2023-08-18 16:28:03

I have a website https://treeoart.pl/. After building, using react-snap and deploying, my onClick events does not work. Everything else is correct - Links, routing etc. I need help quickly, what else can I do. This is link to my repo https://github.com/KarolinaaStoklosa/TREEO_static
Generate Html code using python
Tags: python, webdev, coding
Published: 2023-08-18 16:25:47

In this post, I will share with you how to generate HTML code using Python. I will use a library called yattag. Install it from here: 
`pip install yattag`

**code**

```python

from yattag import Doc

doc, tag, text = Doc().tagtext()

with doc.tag('body') as body:
    with doc.tag('h1') as h1:
        text('this is h1')
        
    with doc.tag('h2') as h2:
        text('this is h2')
        

html = doc.getvalue()
print(html)

```

**result**
```
<body><h1>this is h1</h1><h2>this is h2</h2></body>
```

As you can see, the result is HTML code. You can open this page in your web browser.

I will save it and display this page in my browser.
using the **webbrowser** module

```python

with open('index.html', 'a+') as f:
    f.write(html)
    f.close()

webbrowser.open('index.html')

```

**result**

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


**Now we're done 🤗**

**Don't forget to like and follow 🙂**
Dạng toàn phương – Bài tập đưa về dạng chính tắc
Published: 2023-08-18 16:13:55


Bài viết dưới đây sẽ giúp chúng ta tìm hiểu về định nghĩa, phân loại, xét dấu kèm một số dạng bài tập dạng toàn phương có lời giải giúp các bạn ôn tập dễ dàng. Chiến thôi!!!

>>>>Tham khảo: [https://ttnguyen.net/dang-toan-phuong/](https://ttnguyen.net/dang-toan-phuong/)

#ttnguyen #ttnguyenblog #daisotuyentinh #daisovahinhhocgiaitich #dangtoanphuong
Customtkinter how to disable window resize
Tags: python, coding, ui
Published: 2023-08-18 15:59:50

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

```python
import customtkinter as ctk

win = ctk.CTk()
win.geometry('520x300')
win.resizable(width = False, height = False)


win.mainloop()
```
React & ADHD
Tags: react, beginners
Published: 2023-08-18 15:42:13

As someone with Attention Deficit Disorder, working with React components was difficult. I struggle with working memory, which is essentially the brain’s version of RAM. If someone gives me a list of three items, I will usually only be able to remember two. This made learning React difficult for me because I often rely on being able to see parts of code or variables to jog my memory in terms of next steps. However, I did find certain steps to be helpful to mitigate these memory issues. 

1. Draw out your component hierarchy. 

I realize teachers are going to also recommend this, but I just want to emphasize how important this is for me. If I just started on a project without drawing out how each component was connected, I would inevitably have to move code around and it would take much longer than necessary. 

2. Write out or talk through the code logic. 

I sometimes struggle to think through code steps in an ordered way. If I’m given something to solve, my brain tends to jump between all the different parts I have to do and I get overwhelmed. When I start to do this, I try to stop and write down each step, no matter how small, to have a clear path to move forward instead of all jumbled inside my head. 

3. Make meaningful variable names, even if it feels excessive. 

Particularly with React, I need to use variable names that clearly show what the variable does or represents. I spent more time than I would like to admit putting the wrong variable in the wrong component because I didn't make a useful variable name. For example, using `formName` isn't as specific as `updatedNameFromForm`.
How to add hard breaks to your Astro Blog
Published: 2023-08-18 15:12:07

In my opinion, soft breaks are absolutely useless, would you write your content in markdown and not add space between paragraphs?

Besides that some content has to be displayed with hard breaks and it's annoying to add a `<br>` or other escape character.

Astro uses `remark` to render markdown so if you want to add hard breaks you have to install the `remark-breaks` plugin.

```bash
npm install remark-breaks
```

Then modify `astro.config.mjs` and enable the plugin.

```js
import remarkBreaks from 'remark-breaks';

export default defineConfig({
  markdown: { remarkPlugins: [remarkBreaks] },
});
```
TMDB Watch Providers Android
Tags: java, android, tmdb, watch
Published: 2023-08-18 15:05:55

The TMDB Watch Providers Android app is a must-have for movie and TV show enthusiasts. This app provides users with a convenient way to find where their favorite movies and TV shows are available for streaming or purchase. With a user-friendly interface and a vast database of content, TMDB Watch Providers Android is the ultimate tool for discovering new movies and shows to watch.

One of the standout features of TMDB Watch Providers Android is its extensive database. The app pulls data from TMDB (The Movie Database), which is one of the most comprehensive movie and TV show databases available. This means that users can easily find information about their favorite movies and shows, including cast and crew details, release dates, ratings, and more.

But the real magic of TMDB Watch Providers Android lies in its watch provider integration. The app allows users to search for a specific movie or show and instantly see where it is available for streaming or purchase. Whether you prefer Netflix, Amazon Prime Video, Hulu, or any other popular streaming service, TMDB Watch Providers Android has got you covered. It even provides links to the respective platforms, so you can start watching with just a few taps.

Another great feature of TMDB Watch Providers Android is its personalized recommendations. The app uses your watch history and preferences to suggest new movies and shows that you might enjoy. It's like having your own personal movie curator, always ready to recommend the next big hit.

TMDB Watch Providers Android also offers a handy watchlist feature. If you come across a movie or show that you want to watch later, simply add it to your watchlist. The app will keep track of all your saved content, making it easy to find and access whenever you're ready to watch.

And let's not forget about the app's sleek and intuitive design. TMDB Watch Providers Android is a pleasure to navigate, with a clean layout and easy-to-use interface. Finding your favorite movies and shows has never been easier.

In conclusion, TMDB Watch Providers Android is a must-have app for any movie and TV show lover. With its extensive database, watch provider integration, personalized recommendations, and convenient watchlist feature, this app is a game-changer. So why wait? Download TMDB Watch Providers Android today and start discovering your next favorite movie or show!

### References:

*   TMDB Watch Providers Android: [https://play.google.com/store/apps/details?id=com.tmdb.watch.provider](https://play.google.com/store/apps/details?id=com.tmdb.watch.provider)
*   The Movie Database: [https://www.themoviedb.org/](https://www.themoviedb.org/)
Leet code — 1221. Split a String in Balanced Strings
Published: 2023-08-18 14:52:20

Easy [problem](https://leetcode.com/problems/split-a-string-in-balanced-strings/) with String on leet code, the description being:

> Balanced strings are those that have an equal quantity of 'L' and 'R' characters.

> Given a balanced string s, split it into some number of substrings such that:

> Each substring is balanced.

> Return the maximum number of balanced strings you can obtain.

> Constraints:

> 2 <= s.length <= 1000

> s[i] is either 'L' or 'R'.

> s is a balanced string.

The good thing is that the string is balanced, makes it much easier for you to find the maximum amount of balanced strings.

My thought process was iterating the string, gathering each char and checking if it was R, if it was I would add on a balance integer plus one, otherwise I would reduce one and every time balance goes zero I would add one to the output.

```java
class Solution {
    public int balancedStringSplit(String s) {
        int output = 0;
        int balance = 0;
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='R'){
                balance++;
            } else {
                balance--;
            }
            if(balance ==0){
                output++;
            }
        }
        return output;
    }
}
```

Seems pretty straight forward, if you want you can reduce boilerplate, but the idea is still the same:

```java
class Solution {
    public int balancedStringSplit(String s) {
        int output = 0;
        int balance = 0;
        
        for(int i=0;i<s.length();i++){
            balance += s.charAt(i)=='R' ? 1 : -1;
            if(balance == 0) output++;
        }
        
        return output;
    }
}
```

> Runtime: 0 ms, faster than 100.00% of Java online submissions for Split a String in Balanced Strings.

> Memory Usage: 40.2 MB, less than 79.61% of Java online submissions for Split a String in Balanced Strings.

If I’m missing something or there is anything thing else to discuss feel free to drop a comment.
Настройка глобального постбека в Keitaro
Published: 2023-08-18 14:41:37

## Настройка глобального постбека в PlayCash <a name="chapter-1"></a>
- Откройте админку своего трекера. Перейдите во вкладку "_Партнерские сети_" (_Affiliate Networks_).
- Откроется поп-ап окно добавления новой ПП. В поле "_Из шаблона_" (_From Template_) введите "**Playcash**". Значения в выпадающем списке отфильтруются и в нем появится название нашей ПП. Выберите в списке нашу ПП. Нажмите на кнопку "_Создать_" (_Create_) в поп-апе. Трекер при добавлении ПП сгенерирует Postback URL для отправки вам ПБ. Скопируйте полученную ссылку в буфер обмена.
- Далее перейдите по [ссылке](https://my.playcash.network/v2/) в вашу Партнерскую панель. Кликните на правый верхний угол и выпадающем меню кликните на кнопку "_Настройки_" (_Settings_). На странице настроек перейдите во вкладку "_Глобальные постбеки_" (_Global Postbacks_). В этой вкладке в левом правом углу вы найдете кнопку "Добавить постбек" (_Add Postback_). Кликните на нее, откроется поп-ап окно. В поле _URL_ вставьте ссылку глобального постбека, которую трекер сгенерировал вам ранее. Статус указывайте _Any_, метод интеграции (_integration method_) _All_. Ниже приведены скриншоты настройки глобального постбека в Партнерской панели. 

![Настройка глобального постбека 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zuapwuaboor3ndaj7t9v.png)

![Настройка глобального постбека 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6oc2yye4fnwattfshxoz.png)

![Настройка глобального постбека 3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f6o7k3zfw3d9dogph511.png)
- На этом настройка глобального постбека завершена. После того вы получили офферы от вашего персонального менеджера, заведите их в трекер и отправьте тестовую трекинг ссылку в рабочий чат. Мы сделаем тестовую регистрацию, чтоб убедиться что все настройки выполнены корректно.
PayPal through Stripe
Tags: stripe, paypal
Published: 2023-08-18 14:28:17

If you want to accept payments and subscriptions with PayPal and many other payment methods through Stripe, check out [https://easypie.shop](https://easypie.shop) | **EasyPie** | _Ecommerce with Stripe as Easy as Pie_ | Shopping, Payment and Subscription Terminal
Find the K-Beauty of a Number
Tags: leetcode, javascript
Published: 2023-08-18 14:26:35

[Find the K-Beauty of a Number](https://leetcode.com/problems/find-the-k-beauty-of-a-number/description/)
```js
/**
 * @param {number} num
 * @param {number} k
 * @return {number}
 */
var divisorSubstrings = function(num, k) {
  let strNum = num.toString();
  let beautyCount = 0;

  for (let i = 0; i < strNum.length; i++) {
    let divisor = strNum.substring(i, k + i);
    if (divisor.length === k && num % parseInt(divisor) === 0) {
      beautyCount++;
    }
  }
  return beautyCount;
};
```
MySQL ROUND Function Examples
Published: 2023-08-18 14:25:51

Within MySQL, an array of pre-built functions facilitates data manipulation. Earlier, we explored COUNT, DATEDIFF, and CONCAT functions. Our next tutorial shifts the spotlight to the ROUND function, integral for precision and accuracy in rounding numeric values. Precision in rounding holds paramount importance within databases, especially when dealing with scientific and financial data, as it circumvents inconsistencies in calculations. This forthcoming article is tailored to offer pragmatic examples and adept guidance in harnessing the ROUND function within dbForge Studio for MySQL, ensuring dependable outcomes.

Learn more: https://blog.devart.com/mysql-round.html

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jicntpkya5x1ceknlo2y.png)
How to Configure MySQL Deployment Automation: A Practical Guide
Published: 2023-08-18 14:17:01

Automation takes on a pivotal role within Continuous Integration and Continuous Development. This pivotal role revolves around expediting and optimizing database development and deployment through the automated execution of tasks such as building, testing, and implementing database modifications. Beyond this, the domain of automation can extend to encompass regular database activities, encompassing tasks like backups, consequently fostering a seamless and dependable workflow.

In the forthcoming article, our focus will be directed towards comprehending the significance of MySQL database deployment while delving into the potential of automation to enhance this process. Furthermore, our exploration will encompass the intricacies of deploying database alterations by employing Database Projects. We will also delve into synchronizing the said project with the actual database utilizing the Schema Comparison/Synchronization features offered by dbForge Studio for MySQL.

Learn more: https://blog.devart.com/mysql-deployment-automation.html 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wo6c6l6s5seik9gxorq.jpg)
Linux tutorial: bulk files rename shell bash script
Tags: shell, script
Published: 2023-08-18 14:15:20

So, here is the tutorial on how to make bulk file rename on Linux Terminal using Bash scripting:
 
[Bulk files rename shell script for Linux](https://www.shkodenko.com/bulk-files-rename-shell-script-for-linux/)

[Example code Gist used for tutorial: bulk files rename shell script for Linux](https://gist.github.com/podlom/30ce9f2af87ca1d8013944c31d0edc2f)
IDK: Local Scope vs Global Scope
Tags: frontend, webdev, javascript, community
Published: 2023-08-18 14:05:12




   In order to discuss the differences between **Local** scope and **Global** scope, we first need to know what scope even means. So, What is scope?  Basically, scope describes where a variable was declared and where it can be accessed.

Great! now that you have an idea of what the scope of a variable is referencing. Let’s move on to figure out the difference between **Local** vs **Global** scopes.

###What are Local scope variables? 

**Local** variables refer to those declared inside of a function block. This means the variable can only be used and accessed within that particular block of code.

Example: 

```

function localScopeBlock() {  
let x = 5;  
return x
}

console.log(localScopeBlock()) //this will return the number 5 in the console

//Next, try to log the x variable, along with the function call 

console.log(localScopeBlock(), x) //this will cause an error in the console 

```
The error occurred because x was                                declared inside of the code block and can not be accessed.

                                           

###What are Global scope variables?

**Global** variables refer to those that are declared outside of a function block. This means the variable can be accessed and used from anywhere in the javaScript document, because it is at the highest level in the scope tree.

Example:

```
let x = 3;

function globalScopeBlock() {  
let x = 5;
return x;
}

console.log(globalScopeBlock(), x) //this will show the numbers 5 and 3 in the console

```
Unlike the previous example, the console doesn’t throw an error. 
The function call returned 5 (**local** scope variable), then the number 3 was logged to the console from our **global** variable located outside of the function.    

**Side-note**

  When declaring variables, you should use _let_ and _const_ to be more precise in your javascript code. When you use  _var_ to declare variables they are automatically move to the **global** scope. This is not best practice and can ultimately create unintended errors in your code.