teleren/devto huggingface dataset:
What is Apache AGE
Published: 2023-09-13 21:49:39



In this blog I will demonstrate What is Apache Age.What is Grapgh Database.

PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.PostgreSQL is an advanced, enterprise class open source relational database that supports both SQL (relational) and JSON (non-relational) querying. It is a highly stable database management system, backed by more than 20 years of community development which has contributed to its high levels of resilience, integrity, and correctness. PostgreSQL is used as the primary data store or data warehouse for many web, mobile, geospatial, and analytics applications.
If You want to study more about Postgres here

Grapgh Database
A graph database stores nodes and relationships instead of tables, or documents. As we know that in relational Database data is stored in rows and column Data is stored just like you might sketch ideas on a whiteboard. Your data is stored without restricting it to a pre-defined model, allowing a very flexible way of thinking about and using it.

We live in a connected world, and understanding most domains requires processing rich sets of connections to understand what’s really happening. Often, we find that the connections between items are as important as the items themselves.

Grapgh database Example

    Graph databases provide a much faster and more intuitive way to model and query your data.

Modeling Data in Grapgh vs SQL

In Grapgh:
Grapgh
In SQL

SQL

Now come to Point What is Apache AGE?
Apache AGE® is a PostgreSQL extension that provides graph database functionality.

The goal of Apache AGE® is to provide graph data processing and analytics capability to all relational databases.

Through Apache AGE, PostgreSQL users will gain access to graph query modeling within the existing relational database.

Users can read and write graph data in nodes and edges. They can also use various algorithms such as variable length and edge traversal when analyzing data.

What Is Apache AGE® Viewer ?
Apache AGE® Viewer is a web user interface for Apache AGE that provides data visualization and exploration.

Users can enter complex graph queries and explore the results expressed in graph and table data.

Apache AGE® Viewer handles large graph data. Users will be able to discover meaningful insights with the help of various graph algorithms.

Apache AGE® Viewer will serve as a central graph data management & development platform for Apache AGE, a graph extension which will support all relational databases in the future.



Key Features:

    Graph Database Plugin for PostgreSQL
    Hybrid Queries (OpenCypher And SQL)
    Fast Graph QueryProcessing
    Graph Visualizationand Analytics

Source code:
The source code can be found at https://github.com/apache/age
Root level logger middleware should be active
Published: 2023-09-13 21:22:01

If you're doing the Backend-Dev freeCodeCamp course like myself there's a possibility that you came across the error "Root level logger middleware should be active" on the Basic Node and Express track. 

This error got me scratching for hours and I just want to help someone experiencing it only because the hint is missing spaces in the string formatting example. 

Make sure to have spaces between the dash and req.path and req.ip in your root-level request logger middleware, like this  **console.log(req.method + " " + req.path + " " + "-" + " " +req.ip)**

I hope this helps.
What Makes A Great Software Engineer?
Tags: webdev, motivation, conference, confoo
Published: 2023-09-13 21:03:53

Is it your technical skills, your expertise, your social soft skills or your teamwork that make you a great software engineer? The next decade might completely change the perspective, considering all significant progress that has been made in the machine learning field. So will the future of software engineers depend on our ability to describe a problem for a machine? Does it mean that we need to think differently about our team and expertise? 

Watch Alexis Agahi [keynote](https://www.youtube.com/watch?v=cCvZpOudjyw) as he explains what makes a great software developer.
Modal window without JS
Tags: webdev, tutorial, css, beginners
Published: 2023-09-13 21:02:43

Recently, I noticed the <dialog> tag, which allows you to make a modal window.

It is also quite easy to style. But the most important thing is that you don't have to write JS.

I created a post about this on my Instagram, if you are interested, you can check it out - [POST](https://www.instagram.com/p/CxIvLBYt9_E/?utm_source=ig_web_copy_link&igshid=MzRlODBiNWFlZA==)

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

What do you think of this tag?
Скопировать список с ссылкой на случайный элемент
Published: 2023-09-13 20:39:48

## Задача. 
Дан связный список, в котором каждый элемент списка имеет ссылку на следующий элемент списка и ссылку на случайный элемент из этого же списка. Нужно сделать **deep copy** этого списка. Копия должна содержать в точности n полностью новых элементов списка, где n это размер исходного списка. Каждый новый элемент должен содержать соответствующее значение из элемента старого списка, а также иметь ссылки на следующий и случайный элемент в новом списке. Элементы нового списка не должны содержать ссылки на элементы из старого списка.

## Решение.
Класс элемента списка:
```java
class Node {
    int val;
    Node next;
    Node random;

    public Node(int val) {
        this.val = val;
        this.next = null;
        this.random = null;
    }
}
```

Пример такого списка:

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

Если бы не было этого усложнения со ссылкой на случайный элемент списка, то можно было бы просто пройтись циклом по списку, на каждом шаге делать копию элемента, а также хранить предыдущий скопированный элемент, чтобы выставить ему ссылку на следующий новый элемент. 

Но т.к. даже самый первый элемент может иметь ссылку на элемент из середины или конца списка, а у нас еще нет ее копии, то такой алгоритм не подойдет. 

Поэтому мы может разбить алгоритм на два этапа. Вначале, пройдем циклом по списку, для каждого элемента будем делать копию, но не будем высталять ссылки на следующий и случайный элемент. Но при этом сохраним маппинг старого элемента на новый.
На втором этапе снова пройдем по старому списку и уже имея все копии и маппинг выставим ссылки на следующий и случайный элемент списка.

После первого цикла:


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

После второго выставим ссылки:


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


```java
public Node copyRandomList(Node head) {
    //Маппинг старых элементов списка на новые (копии)
    Map<Node, Node> oldToNew = new HashMap<>();
    //Проходим циклом по списку и создаем копии,
    //но без ссылок на следующий и случайный элементы списка
    //Также сохраняем маппинг старых вершин на новые
    Node current = head;
    while (current != null) {
        Node copy = new Node(current.val);
        oldToNew.put(current, copy);
        current = current.next;
    }
    //Во втором цикле проставляем ссылки на следующий и случайный 
    //элемент списка
    current = head;
    while (current != null) {
        Node copy = oldToNew.get(current);
        copy.next = oldToNew.get(current.next);
        copy.random = oldToNew.get(current.random);
        current = current.next;
    }
    return oldToNew.get(head);
}

```

Time Complexity O(n), Space Complexity O(n).
Types of scans in database
Tags: database, postgres
Published: 2023-09-13 20:23:14

Here is a micro blog on types of scans in database, this is something which stays under the hood for most of us but it's a good idea to know what happens.

So whenever we fetch something from our db there are three ways for db engine to search the data based on few conditions.

Let's consider an example,

`CREATE TABLE Employees(
   id int primary key not null,
   name text not null,
   department text,
   age int not null
);
`

I have a employees table and there are lets say there are 1 million rows and I decided to get those employees whose age is between 28 to 41. 

`select * from employees where age>=28 and age<=41;`

As in this case db has to go through each row one by one and check if the row satisfies the condition.

**TOO SLOWW**

What if I have an index on age.

`CREATE INDEX age_idx on Employees(age);`

Now I have a structure apart from actual db data where I can lookup from and then retrieve those data which satisfies the condition. This is index scan.



Easy and fast? What if 90% of my data satisfies this condition or maybe I want those employees who belong to IT department.💀

```
select * from employees where age>=28 and age<=41 and department='IT';`
```

It'll be very slow to retrieve from heap(actual data) one by one.

Here comes bitmap scan, in this case db engine creates a bitmap, it's an array where indices refers to row and the values can be `0` or `1`. `1` means this row needs to be fetched and `0` means nope.

The bitmap gets created first and then all data gets fetched at once. It's fast!

So whats the difference between bitmap and index scan.

Index scan is very efficient when the filtered data is very small and specific so we can quickly fetch from index one by one.

Bitmap scan can be helpful when we have more conditions and there are too many rows which needs to be fetched. 
A great example here is let's say we have index on department and age column.

```
create index age_idx on Employees(age);
create index dept_idx on Employees(department);
```

Now we need to fetch those rows where age is between `28` and `41` and also the department is `IT`. 

Here we can create bitmaps on the both indexes and run an AND operation over both bitmaps to get those rows which satisfies both of the conditions.


**Thats it!** 

Sorry for such long post, wanted to keep it a micro blog but I failed :P
Docker Unleashed: Power Tricks and Lean Images for Production-Grade Deployments
Published: 2023-09-13 20:02:44

Hey You, the Docker Maestro!
So, you've got Docker up and running—cool beans! But let's be real: managing Docker images for production is a whole different ballgame. If you've ever thought, "There has to be a better way," well, guess what? There is! Buckle up for some Docker tricks and tips that'll make your images leaner, your deployments faster, and your life better. Let's roll!

Docker Tricks That'll Blow Your Mind
1. Docker Build Caching
Frustrated with slow build times? Use Docker’s build cache! Simply put, it reuses previously built layers if no changes are detected in the Dockerfile, making the build process a breeze.

2. Multi-Stage Builds: Two for the Price of One
Instead of having a bulky image that does everything, use multi-stage builds. You can compile your code in one image, and then copy just the artifacts to another, smaller base image. Slim and fast!

3. docker system prune: The Cleanup Crew
Old, unused images and containers can hog your disk space like nobody's business. Run docker system prune to sweep them off the floor.

Reducing Image Size: The Art of the Slim Build
1. Base Image: Choose Wisely
Starting with a minimal base image can save you a ton of space. Consider using Alpine Linux-based images—they're lightweight and secure.

2. One Task, One Container
Don't bloat your image with unnecessary tools and libraries. Stick to the Unix philosophy: one task, one container.

3. The RUN Command: Less is More
Combine multiple RUN commands into a single one to reduce the number of layers. Just be careful not to make it too complex.

4. The .dockerignore File: Keep It Out!
Much like .gitignore, a .dockerignore file ensures that unwanted files don't sneak into your Docker image. It's like a bouncer, but for your build context.

Production-Savvy Tips
1. Non-Root User: A Safety Net
Always run processes as a non-root user in your containers. It's a good security practice and could save you from potential headaches.

2. Use Labels: The Metadata Maestros
Labels can help you manage your images better. They're like sticky notes for your images—useful for adding metadata or notes for your future self or teammates.

3. Health Checks: The Heartbeat
Implement health checks using HEALTHCHECK in your Dockerfile. This lets Docker know if your container is alive and kicking, or needs a restart.

The Final Scoop
Docker is a powerful tool, but like any tool, its effectiveness depends on the skill of the craftsman—that's you! With these tricks and best practices, you’ll not only reduce your Docker image sizes but also make your production environment more efficient and secure.

So go ahead, put these tips to the test and watch your Docker game level up!
Binary system and subtraction
Published: 2023-09-13 20:00:21

Number systems are ways of representing numbers by writing some symbols and digits in a consistent order. There are various systems to represent numbers and they’re all interconnected, that is, we can convert from one system to another. There are a lot of systems and each is used in its own way. Here are some of the most commonly used ones:

Decimal System (base 10)- The system we are all familiar with and use in our everyday life. “Why decimal?” you may ask. The answer is very simple! The prefix ‘deci’ means one-tenth, for instance, there are 10 DECImeters on 1 meter. Another example, there are 10 years in a DECade, and so on. The decimal system is also called “base 10” as it has 10 digits: 0-9.

Binary system (base 2)- The language of computers. The computer’s main memory is made of transistors or so-called switches that switch from 0 to 1 with electrical voltage, allowing the computer to process, store information, and conduct other operations. This system is called binary as the prefix “bi” means two, like bicycle, and it contains two digits, 0 and 1.

Octal system (base 8)- Although this system has been replaced with the hexadecimal system, it was used in the early days of computing for addressing and data storage. This system has not entirely disappeared as it is sometimes used in some programming environments. The prefix octa means eight, take for example an octopus, and it contains eight digits, from 0 to 7.

Hexadecimal system (base 16)- After replacing the octal system, this system is widely used for representing memory addresses, colors, Unicode character codes, and so on. The name hexadecimal comes from prefixes “hexa”, which means six, and “deci”. Unlike the previous systems, this system also uses letters, from A to F, along with digits from base 10. 

Let’s move on to operations with binary numbers. Subtraction and division, to be exact.
Subtraction
In one way, we can convert the binary number to a decimal, do the subtraction then convert it back to a binary number. But let’s try it with binary numbers.

![subtraction example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zihnc44d4fpr99xat3sj.jpg)

- we know that 1-0=0
- we need to borrow 1 from 1, which leaves us with two 1s on the next column
- borrow one of the ones for the next subtraction, again leaving us with two 1s in the next column
- 1-1=0
- write down the other 1s
- we get 111

We can check it by converting binary numbers into decimals:
(1):2^0*1=1
(0):2^1*0=0
(0):2^2*0=0
(1):2^3*1=8
8+0+0+1=9
1001=9

(0):2^0*0=0
(1):2^1*1=2
0+2=2
10=2

9-2=7

convert back to binary
7|1
3|1
1|1

7=111

Hence, our subtraction is right.

Thank you for your time.
Store Encrypted Data on Database Without Any Package in Laravel
Tags: laravel, encryption, webdev, armanrahman
Published: 2023-09-13 19:41:40

In some situations, we need to store some protected data on the database. so we can use the `$casts` property on a model for encrypted specific data. Just like this -

```
 protected $casts = [
        'yourColumnName' => 'encrypted',
 ];
```
Just like this add this to your model where you are storing secure data. this will encrypt data while storing and decrypt while you using. you don't need to worry about that.
React Native Error: A navigator cannot contain multiple 'Screen' components with the same name ...
Tags: mobile, reactnative, javascript, codereview
Published: 2023-09-13 19:32:42

Have you ever come across this error in the React Native journey? Here's a quick explanation and a resolution concept, then a basic approach with this concept to resolve this error.


![React Native duplicate screen error on iOS emulator](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s0emqkej76exq3ha1f56.png)

#1 understanding the error message and the source of the error...
Interestingly, this error logs a vivid description of what the problem is and a list of possible locations that caused this problem. It's like a nested tree to the path for this very error.
![React Native duplicate screen error](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxr728fp58at9dp37neu.png)

_**Notice the error message in the terminal and see the explicit message.**_

```
 ERROR  Error: A navigator cannot contain multiple 'Screen' components with the same name (found duplicate screen named 'Message')
```


![React Native duplicate screen error](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/en731qoatq6m4l62qg7w.png)


For my own case study, the screen duplicated is the "Message" screen. Follow the texts marked with red

And the source is the _BottomTabNavigation_. Follow the text marked with blue.

This is the same approach to understanding the errors you find, just read the error messages a little more, and this is the case with a ton of other errors.

#2 What is this error saying?
Simply, that a particular screen is created twice in the navigation.

#3 Investigating
search through your root cause, for me, you've guessed it right, the **BottomTabNavigation** component.


![code snippet for BottomTabNavigation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/808cp108c4no9f3b3o8q.png)

#4 Fixing
At this point, ** _remove the duplicate_ **  and hurrah!!!.
You're done.
Problem solved.

Stay tuned for more articles like this, as we go through and debug some bugs and some errors in our day to day development. Both simple and complex bugs.
Cheers!!😊
Come creare una AZURE FUNCTION APP (in Python) da ZERO per i primi passi nel CLOUD!
Tags: azure, azurefunctions, cloud, serverless
Published: 2023-09-13 19:23:20

Se desideri muovere i primi passi nel **CLOUD AZURE** ti consiglio di cominciare con le **AZURE FUNCTION APP** in modalità **SERVERLESS**. Nel corso di questo video ti spiegherò come crearne una da zero e sfruttare un trigger HTTP scritto in **PYTHON**.

{% youtube wfvFSHpA-yw %}

Ed ora dimmi: hai già cominciato a muovere i tuoi primi passi nel mondo del cloud? Oppure da dove pensi di cominciare?
Base-16, Base-10, base-2 in 3226.
Published: 2023-09-13 19:22:16

Numbers can be represented in different systems, but I bet you didn't even know about it, as currently, in 3226, any other representations of numbers are prohibited from study. Binary, for example, uses just 0 and 1. We can create any other system, but the urgency lies in understanding binary and hexadecimal conversions. Hexadecimal uses 16 symbols: digits and letters A to F. So, why the rush? 
This new number-based identification system might be handy for the government, but not us, as it’s a significant threat. Only one virus can turn us into nameless brats for sale just by messing with our identity code. 
Because of the virus, our identity has become a puzzle, five sets of numbers, each a problem we must crack. My grandmother was a revolt scientist, so I found her notes about different number systems, and I'm ready to spill the beans. We’ll learn the practical usage of these numbers, as our time is limited, and we need to solve the puzzle and regain our identities. I'll also leave some practice for you so you're prepared to deal with the virus yourself.
Watch this [video](https://youtu.be/hZiOURxdx0c?si=c9GD2TJTcPYWFReB) and learn how to convert different number representations to decimals (base 10) and do the operations. Good luck. I'll need it, too; I'm about to be arrested for messing with the government. And remember, Big Bade is watching you.

Hurry and share this before it's too late.

Your good friend,
12.21.19.25.1.
DEEP FAKE CAN BE BIGGEST THREAT IN FUTURE
Published: 2023-09-13 19:21:44

Deepfake technology is a type of artificial intelligence (AI) technology that can create highly convincing and often deceptive fake videos, audio recordings, or images. It leverages deep learning techniques, particularly generative adversarial networks (GANs), to generate content that appears to be genuine but is actually manipulated or synthesized.

Here are some key points about deepfake technology:

1. **Generative Adversarial Networks (GANs):** GANs are a class of machine learning algorithms consisting of two neural networks – a generator and a discriminator. The generator creates content, and the discriminator tries to distinguish between real and fake content. Through a process of continuous improvement and competition, GANs can produce highly realistic fake media.

2. **Applications:** Deepfake technology can be used for various purposes, including:

   - **Entertainment:** Creating deepfake videos for movies, TV shows, or social media content.
   - **Political Manipulation:** Spreading misinformation or altering videos of political figures.
   - **Identity Theft:** Generating fake images or videos to impersonate someone.
   - **Adult Content:** Creating explicit content featuring non-consenting individuals.
   - **Education and Training:** Simulating real-world scenarios for training and education.

3. **Ethical and Legal Concerns:** Deepfakes raise significant ethical and legal concerns, as they can be used to deceive and manipulate people. They can damage reputations, incite violence, and spread false information. Many countries have started to enact laws and regulations to combat the malicious use of deepfake technology.

4. **Detection and Countermeasures:** Researchers and tech companies are actively working on developing tools and methods to detect and mitigate deepfake content. This includes analyzing inconsistencies in facial expressions, audio anomalies, and other telltale signs of manipulation.

5. **Legitimate Uses:** Not all applications of deepfake technology are malicious. It can be used for legitimate purposes, such as in the entertainment industry for special effects or dubbing. However, ethical considerations and consent are crucial in such cases.

6. **Media Literacy:** Given the potential harm caused by deepfake technology, it's essential for individuals to be media literate. Being able to critically assess the authenticity of content and verify its source is crucial in the age of deepfakes.

7. **Ongoing Development:** Deepfake technology continues to advance, making it increasingly difficult to distinguish between real and fake content. As a result, staying informed about the latest developments in detection and prevention is important.

In summary, deepfake technology is a double-edged sword with both legitimate and harmful applications. Its rapid advancement necessitates vigilance, regulation, and the development of countermeasures to mitigate its negative impacts on society.