teleren/devto huggingface dataset:
Apache AGE - PostgreSQL extension - Quick summary
Tags: database
Published: 2023-04-17 17:48:55

**AGE** 
- Stands for **A**dvanced **G**raph **E**xtension.
- It's a Bitnine Company project. 
- It's funded by APACHE, named Apache AGE. 
- It's a PostgreSQL extension.

**But what makes it different from the already existing Graph databases ?**

- It works on the top of PostgreSQL not a fork from it.
- It helps to achieve a multimodal behavior, on an already existing relational database.
- Multimodal here means ( Relational + Graph ) models.
- This multimodal behavior on top of an already existing relational database, help to get rid of the cost of migration that usually happens in case we have a relational database and want to operate a graph model to make use of its flexible features.
- So Bitnine company come up with this solution, that gives you the ability to make use of the graph model features on top of an already existing relational database ( for now PostgreSQL )
- it also provides single storage for both models ( relational and graph ), which means no extra space is required
- it allows hybrid queries, which is Cypher inside SQL, or a SQL inside Cypher ( not until now )
- it has also AGE viewer application ( sub-project ), it provides data visualization and exploration 


**links:**
https://age.apache.org/
https://github.com/apache/age
https://github.com/apache/age-viewer

**Try it now !**
Relational and Graph Database Models - Quick Summary
Tags: database
Published: 2023-04-17 17:48:24

**Note**
If you are looking for a quick ( non-detailed ) summary of relational and graph models, you are in the right place.

**Database Model**
It’s a conceptual representation of a database, describing the structure, relationships, constraints, and rules that govern the data stored in it.


**Relational Database Model**
- It's the most popular and widely used model.
- Data organized in form of tables ( rows-columns structure ).
- Data has a fixed schema.
- Components are Tables (rows/columns), Relations ( keys ). 
- Database composed of multiple tables.
- Each table represents an entity.
- Those tables are connected by relationships ( using referring keys between them ).
- Table columns describe the properties of this entity. 
- Table rows are instances of this entity. 


**Graph Database Model**
- It's one of the most powerful models.
- It's based on the "Graph Theory".
- Data has no fixed schema, it's flexible.  
- Data organized in form of Nodes ( Vertices ) and Edges ( Relationships )
- Components are Nodes and Edges 
- Each component belongs to a specific category ( entity or relationship )
- Nodes represent instances of entities.
- Edges represent instances of relationships.
- Those nodes/entities connected by the Edges/relationships.
Python 🐍 challenge_26⚔️
Tags: python, challenge, webdev, beginners
Published: 2023-04-17 17:39:58

## Count the smiley faces

- Given an array (arr) as an argument complete the function 
    CountSmileys that should return the total number of smiling faces.

Rules for a smiling face:

- Each smiley face must contain a valid pair of eyes. Eyes can be marked as : or ;
- A smiley face can have a nose but it does not have to. Valid characters for a nose are - or ~
- Every smiling face must have a smiling mouth that should be marked with either ) or D

No additional characters are allowed except for those mentioned.

Valid smiley face examples: :) :D ;-D :~)
Invalid smiley faces: ;( :> :} :]

#### Examples:

```
countSmileys([':)', ';(', ';}', ':-D']); // should return 2;
countSmileys([';D', ':-(', ':-)', ';~)']); // should return 3;
countSmileys([';]', ':[', ';*', ':$', ';-D']); // should return 1;

```
#### Note:

- In case of an empty array return 0. 
- You will not be tested with invalid input (input will always be an array). 
- Order of the face (eyes, nose, mouth) elements will always be the same.

###### Task URL: [Link](https://www.codewars.com/kata/583203e6eb35d7980400002a)


## My Solution:

```
def count_smileys(arr):
    valid_smiley = [':)', ':D', ';-D', ':~)', ';~)', ';D', ':-D', ':-)', ';~D']
    smile = [x for x in arr if x in valid_smiley]
    return len(smile)
```




### Code Snapshot:



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



### Learn Python

######  Python top free courses from Coursera🐍💯🚀

🎥 {% youtube 2VRXU2H4q0c%}


### Connect with Me 😊

#### 🔗 Links

[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/mahmoud-el-kariouny-822719149/)

[![twitter](https://img.shields.io/badge/twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/Mahmoud42275)
My latest actions
Tags: github, osdc, programming, productivity
Published: 2023-04-17 17:37:30

Hello everyone!
After a long day at work, I wanted to checkout some of github cool repositories. The one repository that had my attention is about Deep Learning [transformers](https://github.com/huggingface/transformers).
I have decided to fork the repository and give it a try!
Also, I contributed to the [Kantoniko](https://github.com/kantoniko/ladino-diksionaryo-code/pull/39) repository (Learn Ladino) since I saw some examples that are not translated. Well, not anymore! They are now translated to english as well. 
Thank you and have a great week!

Learning more every class run by @szabgab
Global and Execution Context of Javascript.
Published: 2023-04-17 17:32:07

JavaScript is a popular programming language that is commonly used to create interactive web applications. Understanding the global and execution context of JavaScript is essential to writing efficient and effective code. In this blog, we will explain what these contexts are and how they work.

The Global Context:
The global context is the outermost context in JavaScript. It is the default context that is created when a script is loaded into a web page. In the global context, all code that is not contained within a function is executed. This includes variable declarations and function definitions. Variables declared in the global context are accessible from any other context in the script.Below is a code example to understand the global context of Javascript.

```
globalVar = "Saswat";
myFunction();
function myFunction() {
  console.log(globalVar);
}


```

The Execution Context:
The execution context is created whenever a function is called. Each function call creates a new execution context that has its own set of variables and functions. When a function is called, the execution context is added to the top of the call stack. The call stack keeps track of the order in which functions are called, and when a function returns, its execution context is removed from the stack. 

The Variable Environment:
The variable environment is a collection of all the variables and functions that are accessible in the current context. The variable environment includes function arguments, local variables, and any variables declared in outer scopes that are accessible in the current context.

The Lexical Environment:
The lexical environment is similar to the variable environment, but it also includes information about the outer environment. The outer environment is the context in which the current context was created. This is important because it allows functions to access variables that are declared in outer scopes. The lexical environment is used to resolve variable names when they are referenced in a function.

In conclusion, the global and execution context of JavaScript are essential to writing effective and efficient code. The global context is the outermost context in JavaScript, and it is where all code that is not contained within a function is executed. The execution context is created whenever a function is called, and it includes a variable environment and a lexical environment. The variable environment is a collection of all the variables and functions that are accessible in the current context, while the lexical environment includes information about the outer environment. Understanding these concepts is crucial for writing high-quality JavaScript code.
My Experience with Delphi and RAD Studio: A Beginner's Perspective
Tags: beginners, codenewbie, learning, devjournal
Published: 2023-04-17 17:30:30

I spent two weeks familiarizing myself with Delphi, Object Pascal, and RAD Studio in preparation for a potential job interview. While my experience was limited, I learned a few things that I'd like to share. I started by reading some basic guides and following along with a few tutorials. Using what I learned from the tutorials, I created two mini-projects: a number-guessing game and a library management system.

Here are some of the things I learned:

1. Delphi is one of the first 'low-code platforms', with many built-in components like labels, input fields, buttons, and select fields.

2. The GUI has an 80s-style look, and while I could change basic things like colors and borders for buttons, I couldn't create an intricate design. I suspect that there are design principles or templates for Delphi that I haven't discovered yet.
 
![GUI for number guessing game](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b33olvnmafycrlesdrjm.jpg)

3. Writing code in Delphi, particularly functions and logic, was easy and readable. I appreciated that I could easily see where a function began and ended or where a new logic within an if statement began and ended. 

4. Connecting to databases, specifically SQL Server or Access Database, was ok easy. I experimented with Access Database for some database "play" and found it nice, although it took me some time to figure out how to write SQL queries correctly. For example, I didn't realize that SQL queries needed to be written differently for Access Database.

The first project I created was a number-guessing game to familiarize myself with the components and basic functions. 

The second project, a library management system, was more complex. I exported my database from MySQL and used in Access DB. Delphi has an built-in database navigator for simple CRUD (create, read, update, delete) procedures. For custom CRUD actions like lending a book, I created custom buttons for adding, returning, and paying fines, which proved challenging as they required different queries and updates to the database table. Updating the shown tables was also tricky, as sometimes it required using DataSet.refresh, and other times it required closing and reopening the dataset using DataSet.Active. Not sure why or is this even a good approach, though. 

In conclusion, I enjoyed working with Delphi, but I know there is a lot more to learn for complex projects. It felt like learning a new language from scratch, and I would need to start from the beginning to develop a more in-depth understanding.

I'm hopeful that my experience will help me with my job interview, and I'm excited to see what the future holds.

Wish me luck!
An Introduction to Graph Databases and How Apache-age Can Help You Build Scalable Applications
Tags: apacheage, apache, graphql, postgres
Published: 2023-04-17 17:24:01

In today's data-driven world, managing complex relationships between data can be a challenge. This is where graph databases come in. Graph databases are designed to store and manage complex relationships between data in a way that is both efficient and scalable. In this post, we will provide an introduction to graph databases and explore how Apache-age can help you build scalable applications.

At their core, graph databases represent data as a graph, with nodes representing entities and edges representing relationships between them. This allows for complex queries and analysis of the relationships between data, which can be very useful in a variety of applications, such as social networks, recommendation engines, and fraud detection systems.

Apache-age is a graph database built on top of PostgreSQL, a popular open-source relational database management system. It is designed to provide a scalable, high-performance solution for managing and querying large-scale graph data.

One of the key advantages of Apache-age is its ability to leverage the power of PostgreSQL. PostgreSQL is a very powerful relational database that has been around for decades, with a large and active community of users and contributors. This means that Apache-age inherits all of the performance, scalability, and reliability benefits of PostgreSQL, while also adding graph database features like built-in graph algorithms and a SQL-like query language called Cypher.

Apache-age also provides a number of other features that make it a great choice for building scalable applications. For example, it provides support for Apache Arrow, a cross-language development platform for in-memory data, which allows for fast and efficient data transfer between different programming languages and platforms. It also provides a command-line interface and APIs for interacting with the database programmatically, making it easy to integrate with other tools and frameworks.

In conclusion, graph databases are a powerful and efficient way to manage complex relationships between data, and Apache-age is a great choice for building scalable applications that leverage the power of graph databases. Whether you're building a social network, a recommendation engine, or a fraud detection system, Apache-age has the features and capabilities you need to get the job done.
Sloan's Top 4 Newbie Memes of the Week
Tags: codenewbie, beginners
Published: 2023-04-17 17:22:15

We decided recently over at the [CodeNewbie Team](https://dev.to/codenewbieteam) that we wanted to spice things up and try something new out to involve our newbies in Meme Monday! **We landed on a Sloan's Newbie Memes of the Week!** You can find last week’s meme picks [here](https://dev.to/codenewbieteam/sloans-top-4-newbie-memes-of-the-week-3g07m).

Here are some of our favorites from this week:


![Stack Overflow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s9mf269jsaqbf3or87uy.jpg)


![How long have you been programming? Since high school. So you're a good programmer?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/djocxkt8uxm4gh9mc621.jpg)


![Code Comments Be Like](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/glrzz7cewny200zygi2e.jpg)



![When the new code works only if we don't delete the old code...](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6vkm3gtc6aysric2udu6.jpg)



**If you'd like to join in— drop your beginner-related, job-related, starting-a-new-career-related memes down below!**

Happy coding y'all!
Is technology harmful?
Tags: programming, career, community, beginners
Published: 2023-04-17 17:15:51

#No one knows how technology workers process information regarding a controversial topic. 

##Be the first to contribute to the literature if you have **any of the following**:

######• worked in a tech industry
######• have a tech job
######• have graduate level training in a tech field

Online survey estimated to take *20 minutes*, while there's no compensation, and you can receive **early access to the findings before anyone else**!

[Survey Link and info here] (https://sjsu.qualtrics.com/jfe/form/SV_56jyCXeYe8ub9gW)
Infográfico: OSI vs TCP/IP
Published: 2023-04-17 16:58:35

## Infográfico com as principais características e diferenças entre os modelos **OSI e TCP/IP**.
 Segue em anexo:

- Uma breve descrição dos modelos OSI e TCP/IP.
- Ilustrações que ajudassem a entender as diferentes camadas dos modelos.
- Uma tabela comparativa com as diferenças e semelhanças entre os modelos em termos de número de camadas, protocolos, funções, etc.


![Infográfico: OSI vs TCP/IP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cdru7moogyz1v69znwqn.jpg)

---

Fontes e referências:
https://dev.to/nfo94/qual-a-diferenca-entre-o-modelo-osi-e-o-tcp-ip-17oi
https://www.cesar.school/
https://www.canva.com/pt_br/
stars
Tags: stars
Published: 2023-04-17 16:55:15

`function randomNumber(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min
}
const STAR_COUNT = 100
let result = ""
for(let i = 0; i < STAR_COUNT; i++){
  result += `${randomNumber(-50, 50)}vw ${randomNumber(-50, 50)}vh ${randomNumber(0, 3)}px ${randomNumber(0, 3)}px #fff,`
}
console.log(result.substring(0, result.length - 1))`
🚨 Attention all blockchain developers 🚨
Tags: nft, tutorial
Published: 2023-04-17 16:52:45



👉 Check out our latest tutorial on how to build and deploy a voting smart contract.

🔗 Read the full article here: 👇
https://medium.com/buildbear/a-step-by-step-guide-to-building-and-deploying-a-voting-smart-contract-on-the-blockchain-468665034c9e
Docker
Tags: docker, begin
Published: 2023-04-17 16:14:46

---
title: Docker 
published: true
description: learn docker
tags: docker, begin, 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-04-17 13:29 +0000
---

## Config

```bash
sudo username -aG docker $USER
sudo reboot
```

## Hello World

```bash
docker image pull fernando93d/hello
docker container run fernando93d/hello
```

## Comandos basicos

```bash
docker container create <name>
docker container start <name/id>
docker container stop <name/id>
docker container rm <name/id>

docker container ls -a
```
## Modo Interactivo en Docker

```bash
docker image pull ubuntu:tag
docker run ubuntu:tag

docker run --interactive ubuntu:tag
docker run --tty ubuntu:tag
docker run --detach ubuntu:tag

docker run -itd ubuntu:tag
```

## Ejecutar comandos dentro de un contenedor

para ejecutar dentro del contenedor podemos usar `attach` pero al momento de salir se detiene el contenedor por ello podes usar `exec` para usar comandos dentro del contenedor pero sin usar el bash o tambien podemos usar el bash interactivo sin la preocupacion que al momento de cerrar se salga el contenedor y eso seria con `it` y `top` es para ver que se esta corriendo en el contenedor.

```bash
docker container attach <id>
---
docker container exec --help
docker container exec <id> <commad>
docker container exec 2342523 ls -al

docker container exec -it <id> bash

docker container top <id>
```

## Puertos

prune remueve todos los contenedores  detenidos

`-p` publica y expone los puertos donde por un lado ponemos el puerto a exponer dentro de nuestro host y exponemos el servicio de nginx en el puerto 80.

`-P` nos crea un puerto aleatorio

```bash
docker container prune 

docker container port <id>
docker container run -d -p 80:80 nginx
curl localhost
docker container port <id>
docker container run -d -P nginx
curl localhost:<port>
```

## Logs

nos muestra cual fueron sus herrores y de por que se apago el contenedor de mysql 

```bash
docker container logs <id>
docker image pull mysql
docker container run -d mysql
docker container logs <id>
```

## Commits

en este podemos crear una imagen para poder usarla varias veces
como si fuera un commit en git

```bash
docker container run -dit ubuntu
docker container exec -it <id> bash

$ touch data.txt
$ exit

docker container commit <id> <name-for-commit>
docker container commit 34253453 ubuntu-fil
docker image ls
docker container run -it ubuntu-file
```
What’s the Key to Successful Coding?
Tags: discuss, beginners, codenewbie, motivation
Published: 2023-04-17 15:58:39

When it comes to coding, what's more important: having a solid foundational knowledge or an aptitude for problem solving?

Without a strong foundation in programming concepts and theory, it's difficult to solve complex problems. Of course, you could argue that practical problem-solving skills are more important, and that knowledge can be acquired as needed.

Chris Pine says:
> Programming isn't about what you know; it's about what you can figure out.

What do you think? Share your thoughts in the comments below!
Quando não utilizar estados no React
Tags: react, renantsx
Published: 2023-04-17 15:40:07

Em determinados contextos, é importante evitar a renderização desnecessária de componentes, e um exemplo disso é uma tela de login. 

Para evitar essas renderizações desnecessárias, podemos utilizar a referência (**`ref`**) em React.

**Antes**

Sempre que os estados do componente são atualizados, a função de renderização é executada novamente, o que faz com que a interface do usuário seja atualizada. 

[Quando não utilizar estados no React - antes (codepen.io)](https://codepen.io/renan-tsx/pen/vYVKNQm)
{% codepen https://codepen.io/renan-tsx/pen/vYVKNQm %}

Nesse caso, os valores dos campos são capturados utilizando a funcionalidade "ref", mas somente quando o formulário é submetido. 

Como nenhuma atualização de estado é realizada durante esse processo, o componente é renderizado somente uma vez.


[Quando não utilizar estados no React - antes (codepen.io)](https://codepen.io/renan-tsx/pen/vYVKNQm)
{% codepen https://codepen.io/renan-tsx/pen/BaqzjWG %}
How to set up aliases for module imports in TypeScript (Angular)
Tags: angular, typescript, vscode
Published: 2023-04-17 15:30:39

Aliases can be helpful to simplify imports and make the code more readable and maintainable, especially in larger projects with many nested directories.

So, instead of importing files using relative file paths (using the sequence of characters "../../../") that could be looking something like this (or worse):

```typescript
import { environment } from "../../environment";
import { TTime } from "../../../core/models/types/TTime";
import { GetMovies } from "../../../store/movies/movies.action";
import { MoviesModule } from "../../pages/movies/movies.module"
```

We can have something more beautiful and consistent like:

```typescript
import { environment } from "@environment/environment";
import { TTime } from "@core/models/types/TTime";
import { GetMovies } from "@store/movies/movies.action";
import { MoviesModule } from "@pages/movies/movies.module"
```

We can achieve this by adding **paths** property to our tsconfig.json (usually placed in root folder of our TS projects).

tsconfig.json (Angular project example):
```typescript
{
    "compilerOptions": {
        "paths": {
            "@environment/*": [
                "./src/environments/*"
            ],
            "@pages/*": [
                "./src/app/pages/*"
            ],
            "@store/*": [
                "./src/app/store/*"
            ],
            "@core/*": [
                "./src/app/core/*"
            ],
            "@shared/*": [
                "./src/app/shared/*"
            ]
        },
} 
```

The aliases are defined using the paths option, which maps each alias to one or more file paths. 

--------

#### VSCode possible problem

If config doesn't work as expected in VSCode add

>     "typescript.preferences.importModuleSpecifier": "non-relative"

to your VSCode settings.json.
React vs Vue ⚔️
Tags: webdev, discuss
Published: 2023-04-17 15:08:37

Hey there, fellow code enthusiasts! 🌟 I've got a burning question for you today: React or Vue? Which JavaScript framework holds the key to your heart, and why? 💖

As for me, I'm a total Vue devotee! 🎉 I find it incredibly straightforward, and it makes building out sleek UIs a breeze. 🌬️ Plus, with its seamless data updating capabilities, Vue just works like magic, no extra setup required! 🧙‍♂️ It's simply a dream come true for developers craving efficiency and simplicity in their projects. ✨

Now it's your turn! Let's ignite a thrilling discussion about these two titans of the JavaScript world! 🔥 React or Vue? Share your thoughts, experiences, and insights in the comments below! And don't forget to follow me for more exciting tech debates and discussions! 🥳 Let's explore the ever-evolving world of web development together! 🌐