teleren/devto huggingface dataset:
Unleashing the Power of React: Why It's the Ultimate Choice for Modern Web Development
Published: 2023-08-07 08:15:19

In the world of web development, React emerges as a dominant force due to its compelling attributes. It revolves around a component-based architecture, which enables developers to create modular and reusable UI components, facilitating cleaner code and quicker development. React's unique Virtual DOM implementation optimizes performance by efficiently managing updates, resulting in lightning-fast user experiences and reduced resource consumption. The emphasis on reusable components streamlines development, allowing for consistent and efficient design across projects. The extensive ecosystem and robust community support grant access to an array of resources and libraries, catering to various needs. React's declarative syntax, real-time feedback through tools like React DevTools, and features like hot reloading enhance the developer experience. Moreover, React seamlessly integrates with other technologies, promoting versatility in designing custom tech stacks. Overall, React's prowess lies in its component-centric philosophy, optimized performance, reusability, community backing, and developer-friendly environment, making it an unparalleled choice for modern web development. Embracing React is a pathway to unleashing innovation and creativity, leading to exceptional web applications that transcend expectations
I've copied a rate limiting snippet and now my colleagues are laughing at me
Published: 2023-08-07 08:10:10

Problem I wanted to solve: Implement rate limiting for my Ruby on Rails application based on User ID. Example: 1000 requests per 5 minutes per User. Only fully legit, authenticated requests should count. Limit should be customisable per User<sup>1</sup>. 

Here are 3 solutions I've found with Google:
- https://medium.com/@pebneter/fast-and-simple-rate-limiting-with-ruby-on-rails-and-redis-68e76ba38ca4
- https://sadique.io/blog/2013/10/12/implementing-rate-limiting-in-rails-part-1/
- https://blog.kiprosh.com/rate-limiting-using-redis/

All of them have the same mistake. Here is how Chat GPT kindly explained this to me: 

Assuming 1200 req / 10 min limit, consider the following scenario:
1. A client makes their first request at 00:00. This initializes the rate limit counter to 1 and sets the expiration time to 00:10.
1. The client makes 1199 more requests between 00:00 and 00:09, for a total of 1200 requests.
1. At 00:10, the rate limit counter expires and is reset on the next request.
1. The client makes 1200 more requests between 00:10 and 00:19.
In this scenario, the client is able to make 2400 requests in a 20-minute window, which averages to 1200 requests in a 10-minute window, but they are able to make twice the number of requests in the first 10-minute period due to the way the counter is reset. This could potentially be exploited if a client times their requests right.

My face when ~~my colleagues~~ I've realised this:

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

Because... if I can't trust the Internet, then, I don't know, man. I'd have to verify stuff by myself?

<sup>1</sup> <small>That's why I didn't want to use `Rack::Attack` - rack middlewares generally should not be aware of stuff like values from `users.requests_quota` db column.</small>
A Comprehensive Road Map to Learning Python and AI
Published: 2023-08-07 07:44:29



**Title: A Comprehensive Road Map to Learning Python and AI**

**Introduction:**
Introduce the importance of Python and AI in today's technological landscape. Highlight the potential for innovation and problem-solving that comes with mastering these skills.

**Step 1: Getting Started with Python:**
- Introduce Python as a beginner-friendly programming language.
- Set up a development environment (IDEs, text editors).
- Cover basic syntax, variables, data types, and control structures.

**Step 2: Python Data Structures and Functions:**
- Explore lists, tuples, dictionaries, and sets.
- Dive into functions, parameters, and return values.
- Discuss object-oriented programming concepts.

**Step 3: Python Libraries for AI:**
- Introduce libraries like NumPy and pandas for data manipulation.
- Explore data visualization with Matplotlib and Seaborn.

**Step 4: Introduction to AI:**
- Define artificial intelligence and its subfields (machine learning, deep learning, etc.).
- Explain the role of AI in various industries.

**Step 5: Foundations of Machine Learning:**
- Understand supervised, unsupervised, and reinforcement learning.
- Cover key concepts like training and testing, overfitting, and bias-variance trade-off.

**Step 6: Machine Learning Libraries:**
- Introduce scikit-learn for machine learning algorithms.
- Discuss how to preprocess data and train models.

**Step 7: Deep Learning and Neural Networks:**
- Explain neural networks and their components.
- Introduce frameworks like TensorFlow and PyTorch.
- Cover basics of building and training neural networks.

**Step 8: Advanced AI Topics:**
- Discuss natural language processing (NLP) and computer vision.
- Explore applications like recommendation systems and autonomous vehicles.

**Step 9: Real-world Projects:**
- Emphasize the importance of hands-on projects.
- Suggest projects like image classification, sentiment analysis, or chatbots.

**Step 10: Continuous Learning and Resources:**
- Provide resources for staying updated on AI trends and advancements.
- Suggest online courses, blogs, and communities for learning and networking.

**Conclusion:**
Summarize the journey from learning Python to diving into AI concepts. Encourage readers to embrace continuous learning and experimentation as they embark on their AI journey.

Remember, this is just an outline to help you structure your article. Feel free to expand on each step and provide more detailed information for your readers. Happy writing!
5 Javascript coding interview questions - Part 1
Tags: javascript, interviewquestion, coding, technicalquestion
Published: 2023-08-07 07:37:07

**Question 1: Reverse a String
Write a function that takes a string as input and returns its reverse.**

```
function reverseString(str) {
  return str.split('').reverse().join('');
}

// Test
console.log(reverseString('hello')); // Output: "olleh"

```

**Question 2: Check for Palindrome
Write a function that checks if a given string is a palindrome (reads the same forwards and backward).**

```
function isPalindrome(str) {
  const reversedStr = str.split('').reverse().join('');
  return str === reversedStr;
}

// Test
console.log(isPalindrome('racecar')); // Output: true
console.log(isPalindrome('hello'));   // Output: false

```

**Question 3: Find the First Non-Repeated Character
Write a function that takes a string as input and returns the first non-repeated character in the string.**

```
function firstNonRepeatedChar(str) {
  const charCount = {};
  
  for (const char of str) {
    charCount[char] = (charCount[char] || 0) + 1;
  }
  
  for (const char of str) {
    if (charCount[char] === 1) {
      return char;
    }
  }
  
  return null; // If all characters are repeated
}

// Test
console.log(firstNonRepeatedChar('abacdbe')); // Output: "c"

```

**Question 4: FizzBuzz
Write a function that prints the numbers from 1 to n. For multiples of 3, print "Fizz" instead of the number. For multiples of 5, print "Buzz" instead of the number. For numbers that are multiples of both 3 and 5, print "FizzBuzz".**

```
function fizzBuzz(n) {
  for (let i = 1; i <= n; i++) {
    let output = '';
    if (i % 3 === 0) {
      output += 'Fizz';
    }
    if (i % 5 === 0) {
      output += 'Buzz';
    }
    console.log(output || i);
  }
}

// Test
fizzBuzz(15); // Output: 1, 2, "Fizz", 4, "Buzz", "Fizz", 7, 8, "Fizz", "Buzz", 11, "Fizz", 13, 14, "FizzBuzz"

```

**Question 5: Remove Duplicates from an Array
Write a function that takes an array as input and returns a new array with duplicates removed.**

```
function removeDuplicates(arr) {
  return [...new Set(arr)];
}

// Test
console.log(removeDuplicates([1, 2, 2, 3, 4, 4, 5])); // Output: [1, 2, 3, 4, 5]

```


These are just a few examples of JavaScript coding interview questions. Remember to practice and understand the concepts thoroughly to perform well in technical interviews.

[Javascript coding interview questions part 2](https://dev.to/saqibjamil7866/5-javascript-coding-interview-questions-part-2-5h1m)
Online JSON Viewer
Tags: json, showdev, webdev, opensource
Published: 2023-08-07 07:36:34

[Web App](https://json-viewer.delphic.top)
[Code](https://github.com/diogenesofweb/json-in-details)
[NPM](https://www.npmjs.com/package/json-in-details)

### Elegant UI:

- Foldable & filterable & focusable nodes
- Show node path on focus & hover
- Configurable clickable links
- Light & dark theme

### Functionality:

- Filter nodes
- Collapse all nodes
- Expand all nodes
- Save JSON
- Copy JSON
- Copy node
- Copy node path
- Switch between formatted & raw data

- Sticky panels
- Converting JSON
- (Shift-)Tab navigation
- Keymaps (Vim inspired)
- History
- Screenshot (JSON to image .jpeg)
- New JSON entry via file upload, fetch URL or insert JSON string

### Convert JSON to:

- JSON schema
- Typescript interfaces (.d.ts)
- Golang structs (.go)

### Keymaps:

- h | ArrowLeft - move focus left (parent node)
- j | ArrowDown - move focus down (next sibling)
- k | ArrowUp - move focus up (previous sibling)
- l | ArrowRight - move focus right (child node)
- c - collapse all child nodes
- e - expand all child nodes
- y - copy node
- p - copy node path

Available as a [Chrome extension](https://chrome.google.com/webstore/detail/functional-json-viewer/cokkmplppnaigoodkkjopoblfaelibab)
C++ - Basic Tree Traversal(Recursive vs Queue)
Tags: tree, queue, recursive
Published: 2023-08-07 07:16:55

LeetCode question :
 **102. Binary Tree Level Order Traversal**
Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level)

Definition for a binary tree node

```cpp
struct TreeNode {
    int val;
    TreeNode* left;
    TreeNode* right;
    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode* left, TreeNode* right) : val(x), left(left), right(right) {}
};
```
Recursive Solution

```cpp
class Solution {
public:
    void visit(TreeNode* root, vector<vector<int>>& ret, int level) {
        if (!root) return;
        while (ret.size() < level + 1) {
            vector<int> v;
            ret.push_back(v);
        }
        ret[level].push_back(root->val);
        visit(root->left, ret, level + 1);
        visit(root->right, ret, level + 1);
    }
    vector<vector<int>> levelOrder(TreeNode* root) {
        vector<vector<int>> tree;
        visit(root, tree, 0);
        return tree;
    }
};
```
Using Queue

```cpp
class Solution_non_recursive {
public:

    vector<vector<int>> levelOrder(TreeNode* root) {
        vector<vector<int>> retVec;
        if (!root)
            return retVec;
        queue<TreeNode*> q;
        q.push(root);
        int i, size;
        TreeNode* tN;
        while (!q.empty())
        {
            vector<int> tv;
            size = q.size();
            for (i = 0; i < size; ++i)
            {
                tN = q.front();
                q.pop();
                tv.push_back(tN->val);
                if (tN->left) q.push(tN->left);
                if (tN->right) q.push(tN->right);
            }
            retVec.push_back(tv);
        }
        return retVec;
    }
};
```
Leetcode Question:
**104. Maximum Depth of Binary Tree**
Given the root of a binary tree, return its maximum depth.
A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

Recursive Solution:

```cpp
class Solution_recursive {
public:
    int getmax(TreeNode* root, int cur){        
        if(!root) return cur;
        return max(getmax(root->left,cur+1),getmax(root->right,cur+1));
    }
    int maxDepth(TreeNode* root) {
        if(!root) return 0;
        return getmax(root,1) -1 ;
    }
};
```
Using queue

```cpp
class Solution_queue {
public:    
    int maxDepth(TreeNode* root) {
        int depth = 0;
        if(!root) return depth;
        queue<TreeNode*> mq;
        mq.push(root);
        int size,i;
        TreeNode* tn;
        while(!mq.empty()){
            size = mq.size();
            depth++;
            for(i = 0; i<size;i++){
                tn = mq.front();
                mq.pop();
                if(tn->left) mq.push(tn->left);
                if(tn->right) mq.push(tn->right);
            }
        }     
       return depth;
    }
};
```
How to Choose the Best Mobile App Development Company
Tags: webdev, mobile, appsync
Published: 2023-08-07 07:07:05

**Introduction**

In today's digital age, mobile apps have become a necessity for businesses to stay ahead of the competition. A well-designed mobile app can help businesses increase customer engagement, improve brand recognition, and boost revenue. However, choosing the right mobile app development company can be a daunting task. In this blog post, we will discuss the factors to consider when selecting the [best mobile app development company](https://www.sciflare.com/mobile-app-development/) for your business.

**Experience and Expertise**

One of the most crucial factors to consider when choosing a mobile app development company is their experience and expertise. It is essential to choose a company that has a proven track record of delivering successful mobile apps. Look for companies that have a portfolio of their previous work and check if they have experience in developing apps in your industry. Sciflare Technologies is a mobile app development company that has years of experience and expertise in developing innovative and user-friendly mobile apps. You can check out their website at sciflare.com to learn more about their services and portfolio.

**Development Process**

The development process plays a vital role in the success of your mobile app. Before choosing a mobile app development company, ensure that they follow a systematic and structured development process. Ask for their development process and check if they involve you in the process. A reliable mobile app development company will keep you informed and engaged throughout the development process. At Sciflare Technologies, we follow a well-defined development process that ensures timely delivery of high-quality mobile apps.

**Cost and Quality**

When choosing a mobile app development company, it is essential to consider the cost and quality of their services. However, do not compromise on quality for cost. Look for companies that offer a balance between quality and cost. Sciflare Technologies offers cost-effective mobile app development services without compromising on quality. We provide customized mobile app development services tailored to meet your business requirements.

**Conclusion**

Choosing the right mobile app development company is crucial for the success of your business. Consider the factors discussed in this blog post, such as experience and expertise, development process, and cost and quality, when selecting a mobile app development company. Sciflare Technologies is a reliable and experienced mobile app development company that offers cost-effective and high-quality mobile app development services. You can visit their website at sciflare.com to learn more about their services.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gu2xcqnyw15vj2kzkw3s.jpeg)
Designing Your Coding Canvas: Who Inspires Your Developer Vision?
Tags: codenewbie, beginners, discuss, career
Published: 2023-08-07 07:00:00

_Welcome to "Discover Your Code," guided by our official DEV moderator, Sloan the Sloth 🦥. This series is designed to help aspiring coders and students explore the coding universe, ignite their passion, and find their ideal career paths._

Today's question is:

> Are you drawn to working for established corporations, innovative startups, or exploring the freelance realm?

Responses from newbies and experienced devs alike are encouraged in order to broaden our horizons and showcase different POVs.

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!

*{% embed* https://dev.to/codenewbieteam *%}*
Mentoring Others: How Did It Impact Your Growth?
Tags: discuss, carreer, learning
Published: 2023-08-07 07:00:00

_Discover diverse career growth stories and coding journeys in "Mentors & Mentorships" on The Daily Byte. Get inspired! 💻🌟_

> Discuss a mentorship experience where _you_ were the mentor, guiding someone in their developer journey. How did this role influence your own growth as a developer and leader?


Follow the DEVteam for more discussions and online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
Road to DevOps.....
Tags: devops, beginners, webdev, programming
Published: 2023-08-07 06:55:47

**1. Learn Basic Programming:**

Start with a programming language like Python, Ruby, or Go. Understand the basics of variables, loops, functions, and data structures.

**2. Understand Version Control:**

Learn how to use Git for version control. Understand branching, merging, and collaboration using platforms like GitHub or GitLab.

**3. Learn Linux:**

Familiarize yourself with the Linux command line, basic system administration, and shell scripting.

**4. Master Cloud Platforms:**

Learn cloud platforms like AWS, Azure, or Google Cloud. Understand services, networking, security, and deployment.

**5. Automation and Infrastructure as Code (IaC):**

Learn tools like Ansible, Terraform, or Puppet for automating infrastructure provisioning and configuration management.

**6. Continuous Integration and Continuous Deployment (CI/CD):**

Understand CI/CD pipelines and tools like Jenkins, Travis CI, GitLab CI/CD, or CircleCI for automating software delivery.

**7. Containerization and Orchestration:**

Learn Docker for containerization and Kubernetes for container orchestration. Understand concepts like pods, services, deployments, and scaling.

**8. Monitoring and Logging:**

Learn monitoring tools like Prometheus and Grafana. Understand logging using tools like ELK Stack (Elasticsearch, Logstash, Kibana).


Understand security best practices for cloud environments, infrastructure, and applications. Learn about Identity and Access Management (IAM), encryption, and vulnerability assessment.

**10. Collaboration and Communication:**

Develop soft skills for effective communication and collaboration with development and operations teams. Understand Agile and DevOps culture.

**11. Gain Hands-On Experience:**

Work on real-world projects to apply your knowledge. Building your own projects or contributing to open-source projects can help you gain practical experience.

**12. Continuous Learning:**

The field of DevOps is constantly evolving. Stay updated with new tools, technologies, and best practices by reading blogs, attending webinars, and participating in conferences.

**13. Certification:**

Consider getting certified in relevant areas like AWS Certified DevOps Engineer, Certified Kubernetes Administrator (CKA), or Certified Jenkins Engineer.

**14. Build Your Online Presence:**

Create a professional online presence through LinkedIn, GitHub, and personal blog to showcase your skills and projects.

Remember, becoming a DevOps engineer is a journey, and it's important to continuously learn, adapt, and experiment. Tailor this roadmap based on your interests and career goals, and don't hesitate to seek guidance from mentors or online communities.
Help me solve this challenge
Published: 2023-08-07 06:47:57

How good are you at solving challenges/puzzles?

Do you like a challenge from time to time?

When was the last time you did a software testing challenge?

If I made you even a little bit curious then join me in solving a web testing challenge.

_**These are the rules for the challenge**_

1. Visit http://testingchallenges.thetestingmap.org/index.php
2. Read the instructions
3. You have 10 minutes to finish
4. All the answers are in the linked video
5. Comment what tools/techniques you used.

**What to do**
Identify all the test required for the scenario below. Based on the data you input in the First Name field the tests will be evaluated.

**What not to test for**
Different browsers, extremely big requests, “nasty words”, browser zoom in and out. Do not use automation tools. The server will cut access at over 30 requests per second per IP.

**Specification**
The user has to fill in the required data in order to get access, as a standard user in a forum.

Only the First Name field can be tested right now. The field has a max length of 30.

There are **18 **checks that you need to find.

https://www.youtube.com/watch?v=EZURXRhCwP4&ab_channel=ResterTest
AntDB Installation and Deployment Documentation - P9
Tags: database
Published: 2023-08-07 06:46:22

## Parameter problem

_**LOG: invalid value for parameter "max_stack_depth": 16384**_

Cause explanation: The maximum security depth occupied by a database process at runtime STACK. If it is found that a complex recursive operation or a complex function cannot be run properly, it is recommended to increase the value of this configuration appropriately. Solution: Log in to the server and modify /etc/security/limits.conf to increase the user's stack depth size (using the antdb user as an example).

```
antdb soft stack unlimited 
antdb hard stack unlimited 
```
**_ERROR: unrecognized configuration parameter "shared_buffers"_**

Cause explanation: In some scenarios, since the param information of adbmgr is not initialized, manually execute the above command to initialize it and then set the parameters. Solution: Log in to adbmgr and execute the following command.

```
flush param; 
```
_**FATAL: could not create shared memory segment: Cannot allocate memory**_

Cause explanation: The shared_buffer setting is not reasonable and exceeds the system configuration of kernel.shmmax. Solution: It is recommended to reduce the shared_buffer value, or increase the kernel parameters, such as shmall, shmmax values. If the shared_buffer is set too large, it will be reported as Invalid argument.

```
FATAL: invalid value for parameter "shared_buffers": "222222GB" HINT: Value exceeds integer range. 
```
**_FATAL: could not create semaphores: No space left on device_**

Cause explanation: The max_connections setting is not reasonable and exceeds the system configuration of kernel.sem. max_connections is the maximum number of connections, that is, the maximum number of connections allowed for clients to connect, increasing connections can allow more clients to access, but setting too large will also cause DB startup failure semget is a function to get signals, that is, get semaphore. The above-mentioned space does not mean that the disk space is not enough, but the space parameter is not enough when creating semaphores, and the system call parameter semget reports an error. Solution: Decrease max_connections, or increase kernel parameters, such as semmni, semmns, etc. 5.3 Login error

**_error while loading shared libraries: http://libpq.so.5: cannot open shared object file: No such file or directory_**

Cause explanation: Some special software or plugins only recognize .bashrc but not .bash_profile, so after adding it, log out of the terminal and log in again.

Solution: In the .bashrc environment variable, is the following environment variable LD_LIBRARY_PATH set.

```
export LD_LIBRARY_PATH=$ADB_HOME/lib:$LD_LIBRARY_PATH 
```
##