teleren/devto huggingface dataset:
Day 23/366
Tags: 1percentplusplus, 100daysofcode
Published: 2024-04-23 15:47:58

🚀 **Today's Learning:**

🌟 DSA

- Check mirror in n-ary tree and Length of longest valid substring

🌟 Dev
- Git branching and merging

🔍 **Some Key Highlights:**

DSA

To check the mirror in an n-ary tree, you start by comparing each child of a node with its corresponding mirror child. If they match, continue recursively checking the subtrees of both children. If any pair doesn't match, return false indicating the tree is not a mirror. If all pairs match, return true indicating the tree is a mirror.

To find the length of the longest valid substring, iterate through the string character by character. Keep track of the current opening and closing parentheses count. When encountering an opening parenthesis, increment the count; when encountering a closing parenthesis, decrement the count. If the count is negative at any point, reset it to zero. Track the maximum valid substring length encountered so far and return it at the end.

DEV

In git branching and merging, you begin by creating a branch from the main codebase to work on a new feature or fix a bug independently. This branch allows you to make changes without affecting the main codebase. Once your changes are complete and tested, you merge the branch back into the main codebase. During merging, git automatically combines the changes from the branch with the main codebase, resolving any conflicts if they arise. This allows multiple developers to work simultaneously on different features and merge their changes seamlessly into the main project.

 #100daysofcode #1percentplusplus #coding #dsa
Don't Be Anchored Down! Break Free from the Anchoring Effect
Tags: productivity, career, learning, writing
Published: 2024-04-23 15:44:41

_Could your decisions be secretly influenced?_ 🗣 


Then you might want to break the mental chains of cognitive biases! Today's agenda exposes a hidden psychological bias called the "anchoring effect" and shows you how to fight back. 


This sneaky bias can cloud your thinking in many situations like salary negotiations or project budgeting. Learn to spot the anchoring bias and make smarter every-day decisions: 

**👉 [The Anchoring Effect](https://iwooky.substack.com/p/the-anchoring-effect)**


[![the Anchoring Effect](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1o9cav07imd3cjl90nv.jpg)](https://iwooky.substack.com/p/the-anchoring-effect)
Laravel DUSK
Tags: laravel, dusk, testing, php
Published: 2024-04-23 15:41:00

Boost Your Laravel Testing with Dusk

Ugh, manual browser testing in Laravel is getting you down? Laravel, Dusk to the rescue! This built-in package is your secret weapon for effortless browser automation. 



With Dusk, you can write expressive tests that mimic real user interactions. Say goodbye to repetitive clicking and form filling - Dusk can handle it all!  



Here's Why You'll Love Dusk:

1. Effortless Automation: Write tests that act like real users, streamlining your development workflow.
2. Expressive Tests: Clear and concise code makes tests easy to understand and maintain. 
3. Faster Feedback: Automate repetitive tasks to catch bugs quicker and improve code quality.



Imagine this Scenario:

- Testing a user registration flow can be a chore. But with Dusk, it's a breeze! You can:
- Visit the registration page.
- Fill in the form with valid data (think real user input ).
- Submit the form and assert successful registration (e.g., confirmation message).

**Sample Code Snippet:**

```
<?php
namespace Tests\Browser;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\TestCase;
class UserRegistrationTest extends TestCase
{
    use DatabaseMigrations;

    public function test_user_can_register()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/register')
                ->type('name', 'John Doe')
                ->type('email', 'john.doe@example.com')
                ->type('password', 'secret123')
                ->type('password_confirmation', 'secret123')
                ->press('Register')
                ->assertSee('You have been successfully registered!');
        });
    }
}
```
Test error handling for invalid data to ensure a robust system  

https://laravel.com/docs/11.x/dusk

#Laravel #Dusk #Testing #PHP #WebDev #PHP #TaylorOtwell  #LaravelTesting #PHPUnit #AutomatedTesting #WebDevelopment #WebAutomation #DeveloperTools #CodeQuality #ContinuousIntegration #ContinuousDelivery #LaravelDuskTesting #LaravelDuskFramework #LaravelBrowserTesting #EndToEndTesting #LaravelWebTesting #LaravelCommunity #LaravelTips #PHPDevelopment #OpenSource #DeveloperLife
React Pure Components
Published: 2024-04-23 15:37:00

**_<u>Pure Functions</u>_**

1. Same input -> Same output. Returns the same output when the same input(props) is provided to the function.
2. No changes are made to any objects or variables that were created before the function was called.

**_<u>Pure Components</u>_**
**React.Component** - Have to manually add shouldComponentUpdate
**Reat.PureComponent** - Internally calls shouldComponentUpdate
Pure component helps to improve performance.
Data Engineering - Practicing for fun
Tags: dataengineering, learning, opensource
Published: 2024-04-23 15:32:27

To find more motivation to study, I decided to do some opensource projects of data engineering. 

Initially, I am following this [project](https://medium.com/@dogukannulu/data-engineering-end-to-end-project-postgresql-airflow-docker-pandas-91c6aa529030#id_token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjkzYjQ5NTE2MmFmMGM4N2NjN2E1MTY4NjI5NDA5NzA0MGRhZjNiNDMiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhenAiOiIyMTYyOTYwMzU4MzQtazFrNnFlMDYwczJ0cDJhMmphbTRsamRjbXMwMHN0dGcuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJhdWQiOiIyMTYyOTYwMzU4MzQtazFrNnFlMDYwczJ0cDJhMmphbTRsamRjbXMwMHN0dGcuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJzdWIiOiIxMDA1MTEzNzI0MjM3MDgwMjQyNTgiLCJlbWFpbCI6Inh4aS5uZXB0dW5lQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJuYmYiOjE3MTMxODU3NjIsIm5hbWUiOiJuZXB0dW5lIHh4aSIsInBpY3R1cmUiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29udGVudC5jb20vYS9BQ2c4b2NLUlBkeG1VZ284ZXY5LVJpUkZoU0xDdkZXNU5wRmdGa1N6Z1ZfOWg0VlRZVHRsWlE9czk2LWMiLCJnaXZlbl9uYW1lIjoibmVwdHVuZSIsImZhbWlseV9uYW1lIjoieHhpIiwiaWF0IjoxNzEzMTg2MDYyLCJleHAiOjE3MTMxODk2NjIsImp0aSI6IjU2YjcyZGE3NmZkZmQ5Yzk4ZWJmMjMxNmRjNjA0Mjg2NmQ2MjY5YjYifQ.fXgK16OEDAYzo1zraJnYDTcMuHES2S77gaK6AvzBZz59Y6ECMQ6GsncbZj6SBGV1p12z5gEU3eYh9D7qDO7YUB-8zE8Hbv6_OADWH86BPyntGgoajOeNKeyxFru0-w-_YnVkXff--VwWUxlK3-TlZzpzfkpjag0FMR-1VeST2VMuDzmswUBB3r2snguhGVQTrcI9G1sAa0oW9NJ3Kla63Zn_n3vyhv-izaqZKqXse0L2328NVKeo57Eo6gwogHe4wYgPDFZEUmFDZEUrF1ZinUvG_OXj_nTBuZi2GILstGq19l8WXG0eMO50UWfEKrvUhOTd__XaPuF4DFRBJUD0Hw) in Medium.

The first phase was download the PostgreSQL and connect through Python on it. 

Challenges:
 1) I have never connected to PostgreSQL before, so I needed to download it and install;
 2) I decided to breakdown the code into many files, to understand better. Conclusion was that part of the code was missing, more specifically conn.commit() which "send the action" to PostgreSQL execute. 

The second part, we are going to retrieve data from the PostgreSQL and modify it using Pandas.
graph
Published: 2024-04-23 15:30:31

main

```
#include <iostream>
#include "graph.hpp"

int main() {

  graph G(6);

  G.set(1,3);
  G.set(1,6);
  G.set(2,3);
  G.set(2,5);
  G.set(2,4);
  G.set(3,5);
  G.set(4,5);
  G.set(4,6);
  G.set(5,6);

  G.print();
return 0;
}
```


graph.cpp

```
#include "graph.hpp"

bool graph::valid(int i, int j){

  assert(0 < i and i <= n);
  assert(0 < j and j <= n);
  //assert(i != j);
  
  return true;
}

int graph::f(int i, int j) {

  valid(i,j);

  if (i < j) {
    int k = i;
    i = j;
    j = k;
  }

  return (i - 1) * (i - 2) / 2 + j - 1;
}


graph::graph(int ord): n(ord) {

  m = n * (n - 1) / 2;
  T = new bool[m];

  for (int i = 0; i < m; i++) T[i] = false;
}

graph::~graph() {

  delete [ ] T;
}

void graph::set(int i, int j, bool e) {

 valid(i,j);

  if (i != j) T[f(i,j)] = e;
}

bool graph::get(int i, int j) {

  valid(i,j);

  return i == j ? false : T[f(i,j)];
}

void graph::print() {

  for (int i = 1; i <= n; i++) {

    for (int j = 1; j <= n; j++) {

      if (i == j) cout << false << " ";
      else cout << T[f(i,j)] << " ";
    }
    cout << endl;
  }
}

```

graph.hpp

```
#ifndef graph_hpp
#define graph_hpp

#include <iostream>
#include <cassert>
using namespace std;

class graph {

int n; // orden del grafo, cantidad de vertices
int m; // tamaño máximo del grafo, cantidad de aristas
//int s; // tamaño del grafo, cantidad de nodos

bool *T;

int f(int, int);

bool valid(int, int);

public:

graph(int);
~graph();

void set(int, int, bool = true); // vamos a quitar depende del get
bool get(int, int); // hay o no hay arista

int order() const { return n; }
//int size() const { return s; }

void print();
};


#endif /* graph_hpp */
```
React 18 updates
Published: 2024-04-23 15:20:47

https://medium.com/@ojebiyifulness/react-18-the-features-and-the-future-db3158c4a24a


**Updates in React 18**
**createRoot** 
Imported from React.DOM/client
Store element via element id ("root")
Pass element to createRoot(root) and store it. (a)
Call render method on the above store variable -> a.render(<App/>)

**Automatic Batching**

**Transition**
How to install OpenProject with Linux and Docker
Tags: programming, tutorial, productivity, linux
Published: 2024-04-23 15:15:17

Jack Wallen shares a tutorial on how to install OpenProject on his Linux server of choice, Ubuntu (version 22.04 LTS).

He shares a list of features: 

- Project planning
- Task management
- Agile, kanban and Scrum
- Time tracking
- Team collaboration
- Product roadmaps
- Workflows

And concludes the article with:

"Congratulations! You now have a powerful project management platform to help make your next project a success and avoid becoming overwhelmed, falling behind or failing outright."

[Read the full article and tutorial](https://thenewstack.io/install-openproject-with-linux-and-docker/).
Web Designing with the Help of AI: A Revolutionary Approach
Published: 2024-04-23 15:01:49

The world of [web designing](https://webdesignindubai.com/) has witnessed a significant transformation in recent years, thanks to the advent of Artificial Intelligence (AI). AI has revolutionized the way websites are designed, making it faster, more efficient, and user-friendly. In this article, we'll explore how AI is changing the landscape of web designing and what benefits it offers.

AI-Powered Web Design Tools

AI-powered web design tools use machine learning algorithms to create websites that are visually appealing and functional. These tools can help designers with tasks such as:

Layout suggestions: AI can suggest the best layout for a website based on the content and purpose of the site.

Color palette generation: 

AI can generate a color palette that suits the brand and theme of the website.
Image optimization: AI can optimize images to reduce loading time and improve website performance.

Responsive design: AI can create responsive designs that adapt to different screen sizes and devices.

Benefits of AI in Web Designing

The use of AI in web designing offers several benefits, including:
Faster design process: AI can speed up the design process, allowing designers to focus on more creative tasks.
Improved user experience: AI can help create websites that are more user-friendly and intuitive.

Increased productivity:

 AI can automate repetitive tasks, freeing up designers to focus on more complex tasks.
Better design decisions: AI can provide data-driven insights to help designers make better design decisions.

Challenges and Limitations

While AI has the potential to revolutionize web designing, there are some challenges and limitations to consider:
Lack of creativity: AI may not be able to replicate the creativity and originality of human designers.
Dependence on data: AI requires high-quality data to produce effective designs.

Ethical considerations: 
AI raises ethical concerns, such as the potential to displace human designers.

Conclusion

AI is transforming the world of web designing, offering faster, more efficient, and user-friendly designs. While there are challenges and limitations to consider, the benefits of AI in web designing are undeniable. As AI technology continues to evolve, we can expect to see even more innovative and creative web designs in the future.
Exploring the Intersection of Gaming and Gambling
Tags: gaming, hobbies, guides
Published: 2024-04-23 14:49:40

The convergence of gaming and gambling has become increasingly prevalent, sparking debates and discussions within both communities. While gaming traditionally emphasizes skill, strategy, and entertainment, gambling introduces elements of chance and risk.
 
One aspect of this intersection is the rise of in-game microtransactions and loot boxes, which some argue resemble gambling mechanics. Players purchase virtual items with real money, often without knowing the contents of the loot box beforehand, leading to concerns about addictive behavior and predatory monetization tactics.
 
Furthermore, the popularity of online casinos and gambling websites has blurred the lines between gaming and gambling even further. With the convenience of digital platforms, for example, [conquestador3.nz](https://conquestador3.nz/), players can now access a wide range of casino games, from slots to poker, with just a few clicks.
 
While some view this convergence as harmless entertainment, others raise valid concerns about the potential for addiction, especially among vulnerable populations such as minors. The immersive nature of modern gaming and the accessibility of online gambling platforms create a fertile ground for problematic behavior.
 
Regulatory bodies and lawmakers are grappling with how to address these issues, with some countries implementing stricter regulations on loot boxes and online gambling to protect consumers, particularly young players.
 
The intersection of gaming and gambling presents both opportunities and challenges for players, developers, and regulators alike. As the industry continues to evolve, it's crucial to strike a balance between innovation and responsible practices to ensure a safe and enjoyable experience for all involved.
Llama 3: The Next Generation of AI-Powered Language Models
Published: 2024-04-23 14:39:51

Artificial intelligence has come a long way in recent years, and one of the most exciting developments in this field is the rise of AI-powered language models. These models use advanced algorithms to understand and interpret natural language, enabling them to generate high-quality text that is virtually indistinguishable from that written by a human.

One of the most highly anticipated language models to be released in recent years is Llama 3, the latest iteration of the highly acclaimed Llama series. This cutting-edge language model has been designed to provide unparalleled accuracy, efficiency, and versatility in a wide range of applications, from content creation to customer service and beyond.
.....
For Read more details go to follow link
[](url)https://blog.inivac.co/2024/04/llama-3-next-generation-of-ai-powered.html
Complex types
Published: 2024-04-23 14:39:02

## Struct
`Struct` kalit so'zi orqali yaratilgan tiplarda bir necha xil ma'lumot saqlasa bo'ladi.

```
public struct Nuqta
{

}
```
Structni yuqoridagidek e'lon qilamiz.Bu yerda `struct` so'zi orqali **Nuqta** data tipi yaratildi.
Struct o'zining ichida quyidagicha ma'lumotlar saqlashi mumkin.

```
public struct Nuqta
{
   public X {get; set;}   //property
   public Y {get; set;}   //property

   public void ChopEtish() =>
     Console.WriteLine($"X:{X}, Y:{Y}");  //method
}
```
Struct bu value type ya'ni o'zgaruvchining ma'lumotlari `stack`da turadi.Reference typeda o'zgaruvchining o'zi stackda,ma'lumotlari esa `Heap`da turadi.

Class/Struct ichidagi barcha ma'lumotlar `Member` deb ataladi.

```
public struct Nuqta
{   // member
   public X {get; set;}   // auto implemented property
   public Y {get; set;}   

   public int x;      //field

   public void ChopEtish() =>
     Console.WriteLine($"X:{X}, Y:{Y}");  //method
}
```
**Property**
`Encapsulation`-murakkab tiplar ichidagi foydalanuvchiga unchalik qiziq bo'lmagan detallarni yashirish uchun ishlatiladi.

```
public struct Nuqta
{   
     //encapsulation-yashirish

     private int x = 0; 
    
     public int GetX() => return x;
     public int SetX(int value) =>x = value;   

}
```

```
var a = new Nuqta();
a.Get();
a.Set(10);
```
Bunaqangi ovoragarchilikni oldini olish maqsadida,`property`larni joriy etishdi.

```
public struct Nuqta
{   
     //encapsulation-yashirish

     private int x = 0;  //backing field
     
     public int X        //property
     {
        get => x;
        set => x = value;
     }

     public int Y {get; set;} 
     //auto-implemented property
     //yashirin backing fieldga ega
     //compiler backing field yaratib beradi
}
```
Shu tarzda propertylar yaratildi.

**Constructor**
Constructor bu `new` kalit so'zi orqali obyekt yaratilganda chaqiriladigan funksiya.

```
var a = new Nuqta();
```
lekin structureni ichida chaqirilayotgan funskiya mavjud bo'lmaydi.
_Vazifalari_:
> obyekt yaratilganda chaqiriladi
> obyekt initialize qilishi uchun ishlatiladi.

Oddiy funksiyalardan farqli o'laroq,constructorlarda return type mavjud emas.Sababi ular hech narsa qaytarmaydi.

Struct/Class ko'rinmas default parametr-less constructorga ega

> Class/Struct nomi bilan bir xil bo'ladi
> Default constructor `public` bo'lishi shart
Navigating Child Custody Laws: Expert Advice from a Charlottesville Divorce Lawyer
Tags: divorce, javascript
Published: 2024-04-23 14:32:27

**Prioritize the Child's Best Interests:**
The overarching principle in child custody cases is the best interests of the child. Parents should always make decisions with their child's well-being as the primary consideration <a href="https://charlottesvillevirginialaws.com/divorce-lawyer-charlottesville/">divorce lawyer charlottesville va</a>. This includes fostering a positive co-parenting relationship, maintaining stability for the child, and prioritizing their emotional and physical needs.

**Communicate Effectively:**
Effective communication is key to successful co-parenting. Parents should strive to communicate openly and respectfully with each other, especially regarding important decisions affecting their child. Clear and consistent communication can help prevent misunderstandings and conflicts, ultimately benefiting the child.

**Create a Detailed Parenting Plan:**
A parenting plan outlines the specific arrangements for custody, visitation schedules, and decision-making responsibilities. Working with a <a href="https://charlottesvillevirginialaws.com/divorce-lawyer-charlottesville/">divorce lawyer in charlottesville</a> to create a detailed and comprehensive parenting plan can help minimize disputes and provide clarity for both parents. The plan should be flexible enough to accommodate changes but also specific enough to avoid ambiguity.

**Consider Alternative Dispute Resolution:**
In contentious custody cases, alternative dispute resolution methods such as mediation or collaborative law can be beneficial. These approaches encourage cooperation and compromise, allowing parents to reach mutually acceptable agreements outside of court. By avoiding litigation, parents can often preserve their relationship and reduce the emotional toll on their children.

**Seek Legal Guidance:**
Navigating child custody laws can be daunting, especially without legal guidance. Consulting with a knowledgeable <a href="https://charlottesvillevirginialaws.com/charlottesville-dui-lawyer/">lawyer charlottesville va</a> is essential for understanding one's rights, obligations, and options under the law. A skilled attorney can provide personalized advice, represent their client's interests in court, and help achieve a favorable custody arrangement.
React Synthetic events and Event Binding
Published: 2024-04-23 14:31:19

**Passing Events to Handlers**: Techniques and Tips

Passing the event object to event handlers in React is straightforward, as it is automatically provided as the first argument to the handler function. However, there may be times when you need to pass additional arguments to an event handler. This can be achieved by using an arrow function to wrap the handler and include the extra parameters:

```JS
<button onClick={(e) => this.handleClick(e, additionalArgument)}>Click me</button>
```
It's important to note that using an arrow function in this way can create a new function instance on every render, which may lead to performance implications if not managed correctly.

Best Practices for Event Handlers in React

When writing event handlers in React, following best practices is important to ensure your code is efficient and easy to maintain. Some of these best practices include:

1. Using arrow functions or binding event handlers in the constructor to avoid issues with this.
2. Ensuring event handlers are properly named, following the convention of starting with handle followed by the event type, such as handleClick or handleChange.
3. Avoiding the creation of new functions within the render method, as this can lead to unnecessary re-renders and performance issues.
4. Removing event listeners in class components when the component unmounts to prevent memory leaks.
Building a Rails App from Scratch
Published: 2024-04-23 14:28:58

I'm building my first rails app from scratch right now and I've been learning a lot. I'm designing it entirely in custom CSS (I know, it sounds a little crazy) and I spoke with my mentor who is a UI/UX designer about improvements in styling. 

I also am learning a lot about my different routes and implementing authorizations so users can only access the pages they're supposed to. I am using the Pundit gem which I have a better understanding of now. 

Setting up my entity relationship diagram and my associations was the step that made me the most nervous. I did it correctly for my first version, but now that I wish to add columns to my database I'm a little anxious about breaking it. 

I feel that the most I've learned is by far in user research and feedback. As I'm developing I've been asking users about different search filters and features they might want and I'm currently working on adding those in.

If you want to see my project so far you can visit it at right2restrooms.com or my [Github Repository](https://github.com/reidaumann/right2restrooms) and feel free to send me feedback!