teleren/devto huggingface dataset:
Reference: JavaScript Expressions, Keywords, Statements, Syntax & Operators
Tags: javascript, learning, tutorial, node
Published: 2023-08-14 21:10:54

## Primary Expressions
> Basic keywords and general expressions in JavaScript take the highest precedence, even that of operators.

## Literals
* `null`
* `true` or `false` (Boolean)
* `1234` (Number or BigInt for larger integers)
* `string`  (Template literal syntax, using backticks)

## Keywords
### Special
* `this`
* `super`

### Regular Expression
* `/regex/`

## Initializers
* `[]`
* `{}`

## Operators
* `()` (Grouping)
* `?.` (Optional chaining)
* `new`
* `,` (Comma allows multiple expression evaluation, returning the result of the last expression)

### Increment & Decrement

* `A++`
* `A--`
* `++A`
* `--A`

### Unary
* `delete`
* `void`
* `typeof`
* `+`
* `-`
* `~`
* `!`
* `await`

### Arithmetic
* `**` (Exponentiation)
* `*`
* `/`
* `%`
* `+`
* `-`

### Relational
* `<`
* `>`
* `<=`
* `>=`
- `instanceof`
- `in`

### Equality
* `==`
* `!=`
* `===`
* `!==`

### Bitwise shift
* `<<`
* `>>`
* `>>>`

### Binary bitwise
* `&`
* `|`
* `^`

### Binary logical
* `&&`
* `||`
* `??`

### Conditional (Ternary)
* `(condition ? ifTrue : ifFalse)`

### Assignment
> [Destructuring assignment - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment)

* `=`
* `*=`
* `/=`
* `%=`
* `-=`
* `<<=`
* `>>=`
* `>>>=`
* `&=`
* `^=`
* `|=`
* `**=`
* `&&=`
* `||=`
* `??=`

### Yield
* `yield`
* `yield*`

## Notation
`=>` (arrow functions)

## Numbers
* Decimal literals can start with `0` followed by another decimal digit. If all digits after the leading `0` are smaller than `8`, the number is interpreted as an octal. To define octal values, use the prefix `0o` (e.g., `0o71`), similar to `0x` for hexadecimal and `0b` for binary.
* BigInt literals cannot start with `0` to avoid confusion with legacy octal literals.
* Octal literals always use `0o`, followed by digits (e.g., `0o777`). For octal BigInts, use `0o` followed by digits and `n` (e.g., `0o123n`).

## Statements & Declarations
* [empty - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/Empty)

### Statements
* `break`
* `continue`
* `debugger`
* `do...while`
* `for`
* `for await...of`
* `for...in`
* `for...of`
* `if...else`
* `someLabel:` 
* `return`
* `switch`
* `throw`
* `try...catch`
* `var`
* `while`

### Declarations
* `export`
* `function`
* `function*`
* `async function`
* `async function*`
* `class`
* `const`
* `let`

## Syntax
* [Spread syntax (…) - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax)
* `import()`

## Other
* [new.target - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target)
* [import.meta - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta)
Using Node.js v8 Isolate in Another Native Thread
Tags: javascript, node, v8
Published: 2023-08-14 21:03:38

Node.js is a popular runtime environment for server-side JavaScript applications. With the release of Node.js v8, a new feature called Isolate was introduced. Isolate allows you to run JavaScript code in a separate context, isolated from the main event loop. This can be particularly useful when you want to offload heavy computational tasks to another thread, improving the overall performance of your application.

In this article, we will explore how to use Node.js v8 Isolate in another native thread. But before we dive into the details, let's first understand what Isolate is and why it is important.

Isolate is a JavaScript execution context that has its own memory heap. It provides a way to run JavaScript code in a separate thread, parallel to the main event loop. This can be beneficial for tasks that require a lot of computational power, as it allows you to utilize multiple cores effectively.

To use Isolate in another native thread, you need to create an instance of the `v8::Isolate` class from the V8 JavaScript engine. This can be done using the Node.js C++ API. Once you have the Isolate instance, you can run JavaScript code within it by creating a `v8::Context` object and executing the code using the `v8::Context::Global()` function.

It is important to note that when running JavaScript code in a separate thread, you need to be careful about sharing data between the main event loop and the Isolate. Since Isolate has its own memory heap, you cannot directly access variables or objects from the main event loop. Instead, you need to use inter-thread communication techniques, such as message passing or shared memory, to exchange data between the two contexts.

In conclusion, using Node.js v8 Isolate in another native thread can greatly improve the performance of your application by offloading heavy computational tasks. By utilizing multiple cores effectively, you can achieve better scalability and responsiveness. However, it is important to handle data sharing between the main event loop and the Isolate carefully to avoid any synchronization issues.

References:
-----------

*   [Node.js v8 Documentation](https://nodejs.org/dist/latest-v8.x/docs/api/)
*   [V8 JavaScript Engine](https://v8.dev/)
Diving into the serpentine end
Tags: python, webdev, writing
Published: 2023-08-14 21:01:07

---
title: Diving into the serpentine end
published: true
description: A journey of exploration in Python
tags: #python, #webdev, #writing
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wbpp2tpi5eu2spxg4jjp.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-08-14 13:56 +0000
---

Hello friend.

If you've read my previous post, then you know what I'll be talking about.

(_And if you haven't, now is a great time to do so..._)

I didn't know when to start that project because I felt like I needed to do more prepping or finish other stuff first.

But this week looks like it's going to be the week for it. 

Particularly because I got accepted to an online course which is live. And I need to have some background knowledge about Python (for which I have absolutely none).

So, from this Monday on, you'll see my attempt at going from _absolute zero_ to knowing enough to work on AI projects.

And I don't mean this kind of absolute zero. 🥶

![Absolute zero](https://static.wikia.nocookie.net/omniversal-battlefield/images/b/bc/Absolute_Zero_start.png/revision/latest/)

## The challenge 

That's going to be from now, Monday 14 all the way to Saturday 19 of August.

It'll be a learn and build kind of thing. 

By Sunday I should have something built that I can show. Even if it's something small and not too ambitious.

Also, on that day, I'll be making another post like this with results and lessons learned from the challenge.

---

That's pretty much it.

I have a list of concepts & topics that I should learn first and a well laid out plan. All it needs now is some execution on my part.

We'll see how it goes.

Thanks for reading so far. 

I'll talk to you again on Sunday.

Bye.

![Bye](https://media.giphy.com/media/doCy6bjRnZgTw6Oh2O/giphy.gif)



Photo by <a href="https://unsplash.com/@davidclode">David Clode</a> on <a href="https://unsplash.com/photos/vb-3qEe3rg8">Unsplash</a>
Affordance nos projetos de interfaces e interações
Tags: affordance, interfaces, ui, ux
Published: 2023-08-14 21:00:00

O termo affordance foi criado pelo psicólogo James Gibson em 1977 e tem sido aplicado em áreas como design de produtos, interação humano computador e arquitetura ajudando a criar interfaces mais intuitivas e de fácil usabilidade para os usuários.

Affordance refere às características percebidas de um objeto, ambiente ou sistema que sugerem ações ou comportamentos possíveis para uma pessoa. Resumindo, é a percepção que um usuário tem de como utilizar algo com base nas características físicas ou funcionais desse objeto. 

##Como usamos isso no dia a dia?
Um exemplo clássico de affordance é um interruptor de luz. 

![Light switch](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6w68tng0091yxqvdcega.jpg)

O interruptor de luz é projetado com um botão que pode ser alternado entre duas posições ligado e desligado. A affordance desse interruptor é geralmente alcançada por meio de pistas visuais e táteis. Visuais pois geralmente o interruptor de luz possui uma cor contrastante em relação à parede. Tátil por possuir uma textura diferente ou uma sensação tátil distintiva indicando que o interruptor pode ser pressionado ou movido. Podemos incluir também uma affordance sonora onde ao pressionar o botão conseguimos ouvir um som de "click" fornecendo uma confirmação sonora da ação realizada.

##Affordance nas engenharias cognitiva e semiótica
No contexto das engenharias, o conceito tem foco em compreender os processos mentais e cognitivos dos usuários envolvidos na percepção e interpretação da affordance de um objeto ou sistema. De forma resumida, procuramos identificar as propriedades dos objetos que fornecem pistas ou sugestões para o usuário sobre como agir. 

Por exemplo, um botão com um ícone de envelope é facilmente associado à ação de enviar um e-mail. Ao projetar a interface, os designers podem criar uma correspondência clara entre o sinal visual e a ação esperada para facilitar o processamento cognitivo dos usuários.

Ambas as engenharias reconhecem que as affordances influenciam a percepção e interpretação devido aos fatores culturais, sociais e cognitivos. Portanto, é importante considerar as habilidades, conhecimentos e experiências do usuário ao projetar interfaces de usuário. Além disso, elas também enfatizam a importância do feedback, pois fornecem informações claras e úteis ao usuário sobre o que pode ser feito e o que acontecerá quando uma ação é realizada. Esse feedback pode ser visual, auditivo ou tátil, dependendo da natureza da interface de usuário.
Banco de Dados Relacional
Tags: database, sql, programming, beginners
Published: 2023-08-14 20:58:06

Nesse artigo abordaremos o banco de dados relacional. O que é, como funciona e quais são os principais sistemas gerenciadores de bancos de dados relacionais.

**Um pouco da história**

O banco de dados relacional foi criado na década de 1970 na IBM, para resolver alguns problemas que se tinham antes, como dificuldade no acesso aos dados, falta de segurança, inconsistência de informações e redundância.

**O que é?**

No banco de dados relacional, os dados são armazenados em tabelas que podem estabelecer relações entre si. Esse formato é escolhido quando a aplicação que estamos desenvolvendo requer tanto consistência, garantindo que todos compartilhem a mesma perspectiva dos dados, quanto integridade, evitando perdas ou comprometimento das informações.

As tabelas dentro de um banco de dados relacional são constituídas por colunas e linhas. Cada coluna representa um atributo associado a uma entidade, como "nome", enquanto cada linha contém uma instância específica dessa entidade, por exemplo, uma pessoa. Na figura abaixo, apresentamos um exemplo ilustrativo de uma tabela.

## 

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

## 

Nas tabelas do banco de dados relacional sempre temos uma chave primária (_primary key_), que é única, essa chave é única pois é usada para identificar uma linha.
Na imagem abaixo temos um exemplo de tabela onde o CPF é a chave primária.

## 

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

## 

Também temos a chave estrangeira (_foreign key_) que é a chave única que referencia a chave primária, e é com essas duas chaves que fazemos os relacionamentos entre as tabelas.
Aqui temos duas tabelas que se relacionam com a chave CPF.

## 

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

## 

**Características dos banco de dados relacionais**

1. Altamente estruturados; 
2. Consistem em várias entidades; 
3. Reduzem a redundância de dados; 
4. Representados usando um esquema lógico e físico; 
5. Utilizam a linguagem de consulta padrão SQL (Structured Query Language);

**O SQL**

No SQL temos a DDL (Data Definition Language), que é a linguagem integrada para criação de tabelas, e a DML (Data Manipulation Language), que é a linguagem para manipular os dados.

Abordaremos esse tópico, bem como os demais conceitos de SQL, nos próximos artigos.

**Principais sistemas gerenciadores de bancos de dados**

Para controlar o armazenamento, a segurança, garantir a integridade e manipular os dados usamos um software, o Sistema Gerenciador de Banco de Dados (SGBD). Os principais SGBDs que temos no mercado são: 

- Microsoft Azure SQL Database
- Microsoft SQL Server
- MySQL
- Oracle Database
- PostgreSQL
- SQLite
- MariaDB
- Hive
Cypher Query Language with Apache Age
Published: 2023-08-14 20:33:07

Apache Age is a powerful open-source graph database that enables efficient handling of large-scale graphs and relationships. One of the essential features of Apache Age is its support for the Cypher query language. Cypher is a declarative query language that is designed specifically for querying graph databases. It is a simple and intuitive language that enables users to express complex graph queries in a concise and understandable way.
In this blog post, we will explore the Cypher query language and how it can be used with Apache Age.

First let's understand,
What is Cypher?

Cypher is a declarative query language that was developed specifically for querying graph databases. It uses a simple and intuitive syntax that allows users to express complex graph queries in a concise and understandable way. Cypher is inspired by SQL, but it is specifically designed for querying graph databases.

Cypher has several essential features that make it an ideal language for querying graph databases:

- Graph Pattern Matching: Cypher supports graph pattern matching, which enables users to match specific patterns in the graph. Users can specify the patterns they want to match using node labels, relationships, and properties.

- Traversal: Cypher supports traversal, which enables users to traverse the graph from a specific starting point. Users can specify the direction of the traversal, the depth, and the conditions for traversing the graph.

- Aggregation: Cypher supports aggregation, which enables users to perform calculations on the graph data. Users can calculate properties such as the count, sum, and average of nodes and relationships.

- Path Finding: Cypher supports path finding, which enables users to find the shortest path between two nodes or find all the paths between two nodes.

Now, let's look at How to Use Cypher with Apache Age

To use Cypher with Apache Age, you will need to install Apache Age and PostgreSQL. Once you have installed these components, you can use the following steps to get started with Cypher:

1. Create a Graph Database: First, you need to create a graph database in Apache Age using PostgreSQL. You can use the Apache Age shell to create a graph database.

2. Load Data: Once you have created a graph database, you can load data into it. Apache Age supports several data formats, including CSV and JSON. You can use the Apache Age shell to load data into the graph database.

3. Write Cypher Queries: Once you have loaded data into the graph database, you can write Cypher queries to query the data. You can use the Apache Age shell or an API in your preferred programming language to execute Cypher queries.

Apache-Age:(https://age.apache.org/)
GitHub:-https://github.com/apache/age
Increase Graph Database Capabilities with PostgreSQL and Apache AGE
Published: 2023-08-14 20:26:24

Overview:
A leading social media company was experiencing challenges in managing the vast amount of data generated by its platform. The company's traditional relational database management system was not well-suited to handle the complex and interconnected data structures inherent in social networks. As a result, the company decided to explore graph database solutions and chose to implement PostgreSQL with the Apache AGE extension.
Challenges:
The company's existing relational database management system struggled to handle the complexity of the social network data. In particular, it was challenging to represent and query the various relationships between users, such as followers, likes, and shares. Additionally, the company needed a solution that would scale to handle the massive amount of data generated by its platform.

Solution:
To address these challenges, the company implemented PostgreSQL with the Apache AGE extension. The extension provided the company with the ability to represent social network data as a graph, making it easier to query and analyze the complex relationships between users. Furthermore, the extension's advanced indexing and querying capabilities allowed for faster and more efficient data retrieval, which was critical given the scale of the company's platform.
PostgreSQL Apache Age
Published: 2023-08-14 20:22:52

Apache Age is a PostgreSQL extension that allows users to use graph database features in PostgreSQL. It provides an efficient way to store and query graph data using SQL.

How to use Apache Age with PostgreSQL

To use Apache Age with PostgreSQL, you need to first install the extension. You can do this by following the instructions provided on the Apache Age GitHub page.

Once you have installed the extension, you can start using Apache Age to store and query graph data in PostgreSQL.

Key Features of Apache Age

Some of the key features of Apache Age include:

Graph data modeling: Apache Age allows you to model your data as a graph, with nodes and edges. You can create tables for nodes and edges, and use SQL to add, update, and delete nodes and edges.
Graph query language: Apache Age provides a powerful graph query language called PGSQL. PGSQL allows you to query your graph data using graph traversal algorithms, and to return results in a tabular format.
Graph visualization: Apache Age comes with a built-in graph visualization tool called PGAdmin. PGAdmin allows you to visualize your graph data and to explore the relationships between nodes and edges.
Conclusion

Overall, Apache Age is a powerful tool that extends the functionality of PostgreSQL to support graph data modeling and query. If you have graph data that you need to store and query, Apache Age can be a great option to consider.

Apache-Age:(https://age.apache.org/)
GitHub:-https://github.com/apache/age
#Azure Custom Vision – Local model viewer Sample in Python 🐍
Tags: englishpost, azure, azurecustomvision
Published: 2023-08-16 17:22:15

---
title: #Azure Custom Vision – Local model viewer Sample in Python 🐍
published: true
date: 2023-08-14 20:10:37 UTC
tags: EnglishPost,Azure,AzureCustomVision,EnglishPost
canonical_url: 
---

Hi!

_Create an object detection model in Azure Custom Vision and run the model locally in a desktop app in minutes._  ✨

This is a sample project to use an object detection model, created using [Azure Custom Vision](https://customvision.ai/), locally in a desktop application. The model is extracted from the “_Custom Vision Export to Docker – Linux_” feature.

To build an Object Detection project, you can follow this tutorial: [Quickstart: Build an object detector with the Custom Vision website](https://learn.microsoft.com/en-us/azure/ai-services/custom-vision-service/get-started-build-detector)

_ **Disclaimer** : This demo uses a virtual environment with Python 3.7 as is the required version to run some of the project dependencies._

Check the full repo and code here:

[https://github.com/elbruno/CustomVisionPythonLocalViewer](https://github.com/elbruno/CustomVisionPythonLocalViewer)

![demo of the app running identifying captain america shields](https://brunocapuano.files.wordpress.com/2023/08/objectdetected.png?w=650)

Happy coding!

Greetings

El Bruno

More posts in my blog [ElBruno.com](https://www.elbruno.com).

More info in [https://beacons.ai/elbruno](https://beacons.ai/elbruno)

* * *
Storing IP Addresses as Numbers in Your Database
Tags: database, mysql
Published: 2023-08-14 20:10:02

IP addresses are usually stored as strings in databases, but there are some advantages to storing them as numbers instead.

- **Numbers are more compact 🗂️**
 A string representation of an IP address can take up to 15 characters, while a number representation only takes up 4 bytes. This can save significant space in your database, especially if you're storing a large number of IP addresses.

- **Numbers are faster to compare 🚀**
 When you're searching for a specific IP address in your database, it's much faster to compare numbers than strings. This can improve the performance of your database queries.

- **Numbers are more machine-friendly 🤖**
 Algorithms and scripts can easily process numbers, making it easier to work with IP addresses in your database.

So, how do you store IP addresses as numbers in your database? It's actually pretty simple. Most databases have built-in functions for converting strings to numbers and vice versa. For example, in MySQL, you can use the `INET_ATON()` function to convert a string to an IP address number, and the `INET_NTOA()` function to convert an IP address number to a string.

Here's an example of how you would store an IP address as a number in MySQL:

```SQL
INSERT INTO `ip_addresses` ( `ip_address` ) VALUES (INET_ATON('192.168.1.1'));
```

This will insert the IP address `192.168.1.1` into the `ip_addresses` table as a number.

To retrieve the IP address as a string, you can use the `INET_NTOA()` function:

```SQL
SELECT INET_NTOA(ip_address) FROM ip_addresses WHERE ip_address = INET_ATON('192.168.1.1');
```

This will return the string `192.168.1.1`.

![String](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xni0gyc7vjdybjjbmvb3.png)

Storing IP addresses as numbers in your database can have some advantages in terms of space, performance, and flexibility. If you're not already storing your IP addresses as numbers, it's something to consider.

### Bonus Tip

If you're storing both IPv4 and IPv6 addresses in your database, you can use the `INET6_ATON()` function to convert IPv6 addresses to numbers.

I hope this blog post was helpful! Let me know if you have any questions. 🙋🏽‍♂️