teleren/devto huggingface dataset:
Understanding Binary numbers: Binary representation: 2-based system~10-based system.
Published: 2023-09-13 18:01:34

Hello world!

I'm Lilia living on another planet full of adventures and fantasies. While living on Earth I believe that there are 10 digits because we have 10 fingers, therefore we can count all single digits from 0-9. And after 9 why do we write 10?


 **Similarity 1**: Here 1 in 10 represents how many times we use all our fingers in the example of 21 we use them twice and so on. The same happens on the planet where I used to live, but because here all creatures have 2 fingers they use only 0s and 1s to count. 0=0, 1=1, 2=10 ( here again 1 represents the time they use their fingers), 3=11... and how to represent 300 in a two-based system. Every time we need to divide it by 2 and write the remainder, the same process with the quotient till the quotient will be 1. So the 300 in 10 based system will be equal to 100101100 in 2 based system. 


**Similarity 2**: The formula (base)^n-1 represents the greatest number, where n is the number of digits. In a 10-based system, 9 is the biggest digit 99 is the biggest 2-digit number .... each of them can be represented as 10^n -1. The same is true for numbers in two-based systems 1, 11, 111.... the formula is 2^n -1 which gives the value of these numbers in 10 based system. 


**Similarity 3**: We can do the same operations ( sum, difference, multiplication, division)in a two-based system as we used to in decimal (10-based system) ones.
_1. Addition (+)_
   We have 2 numbers 15 and 4. 
   15+4=19 
15 in 2 based system will be (1111)
15:2=7( r.1)
7:2=3(r.1)
3:2=1(r.1)
1:2=0(r.1)
(Read the remainders from bottom to top)
So 15 is 1111 in a two-based system
4:2=2(r.0)
2:2=1(r.0)
1:2=0(r.1)
|=>4(10)=100(2)
(10). 15+4 <=> (2).      1111
                        + 100
                      ________
                         10011

_2. Subtraction (-)_
  We have two numbers 20 and 5.
20:2=10( r.0)    
10:2=5(r.0)
5:2=2(r.1)
2:2=1(r.0)
1:2=0(r.1)
(10) 20 <=> (2) 10100
5:2=2(r.1)
2:2=1(r.0)
1:2=0(r.1)
(10) 5 <=> (2) 101
(10) 20-5=15 <=> (2)   10100
                     -   101
                     _______
                        1111
_3. Multiplication (*)_

(10) 20*5=100  <=> (2)  10100
                       *  101
                       ______
                        10100
                    +  00000
                   +  10100
                   __________
                      1100100

Checking:  1  1  0  0  1  0  0 
          (6)(5)(4)(3)(2)(1)(0)

(2^0)*0+(2^1)*0+(2^2)*1+(2^3)*0+(2^4)*0+(2^5)*1+(2^6)*1= 0+0+4+0+0+32+64= 100 

I hope it was helpful:)
SQL Syntax (Part 02)
Tags: apacheage, postgres, bitnine, devcommunity
Published: 2023-09-13 17:58:20

## Constants
In PostgreSQL, there are three categories of implicitly-typed constants: strings, bit strings, and numbers. Additionally, explicit types may be used to specify constants, allowing for a more precise representation and more effective system management. The subsections that follow cover these options.

## String Constants
An arbitrary string of characters enclosed in single quotes (') is referred to as a string constant in SQL. Write two adjacent single quotes, such as 'Dianne's horse,' to include a single-quote character in a string constant. Keep in mind that this differs from a double-quote character (").

## String Constants with C-Style Escapes
Additionally, PostgreSQL permits "escape" string constants, an addition to the SQL standard. Just before the first single quotation, write the letter E (in upper- or lowercase), for example, E'foo', to specify an escape string constant. (If you want to continue an escape string constant over many lines, only use E.) A backslash character () starts a backslash escape sequence that looks like C within an escape string.

You are accountable for ensuring that the byte sequences you generate, particularly when employing the octal or hexadecimal escapes, encode legitimate characters according to the server character set. Use of Unicode escapes or an alternate Unicode escape syntax is a good substitute.

## String Constants with Unicode Escapes
Another form of escape syntax for strings is also supported by PostgreSQL and allows for the specification of any Unicode characters by code point. Before the starting quotation, without any spaces in between, a Unicode escape string constant begins with U& (an upper- or lower-case letter U followed by an ampersand), for instance, U&'foo'. (Remember that the operator & becomes ambiguous because of this. To get around this issue, use spaces around the operator.) A backslash, a four-digit hexadecimal code point number, or, alternatively, a backslash, a plus sign, and a six-digit hexadecimal code point number can be used to specify Unicode characters in escaped form inside of quotations. 

Although the existence of the 6-digit form technically negates the need for this, it is possible to specify UTF-16 surrogate pairs to assemble characters with code points bigger than U+FFFF using either the 4-digit or 6-digit escape form. Surrogate pairs are concatenated into a single code point rather than being stored separately (directly).
The Unicode code point identified by one of these escape sequences is translated to the actual server encoding if the server's encoding is not UTF-8; if that is not feasible, an error is returned.

Additionally, the standard_conforming_strings configuration parameter must be enabled in order for the Unicode escape syntax for string constants to function. This is necessary because, in the absence of it, the syntax may mislead clients that interpret SQL statements, which may result in SQL injections and other security problems. This syntax will be denied with an error notice if the argument is set to off.
Dom Manipulation in JavaScript for Beginners
Tags: javascript, tutorial, html, css
Published: 2023-09-13 17:51:00

Dom Manipulation in JavaScript for Beginners

hey guys today we are going to learn Dom Manipulation in JavaScript for Beginners. DOM stand for Document Object Modal which use to manipulate the HTML elements.  It's very important for create a application using JavaScript.

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

So, I've designed the complete course for you, inside that you will learn step by step how to use DOM to creating a different type of projects. So, after watching the complete course, you are able to make a many applications or games using JS.

{% embed https://www.youtube.com/watch?v=KFhIJtywvhs %}

I hope this tutorial is helpful and beneficial for you.
IF e FOR (JavaScript)
Tags: if, javascript, community, learning
Published: 2023-09-13 17:16:12

Em JavaScript, o if e o for são duas estruturas de controle fundamentais para criar lógica condicional e loops, respectivamente. Aqui está um resumo sobre cada um deles:

**_IF (SE):_**
O if é usado para criar condicionais em JavaScript. Ele permite que você execute um bloco de código se uma determinada condição for avaliada como verdadeira (true). Aqui está a sintaxe básica:

```
if (condicao) {
    // Código a ser executado se a condição for verdadeira
} else {
    // Código a ser executado se a condição for falsa (opcional)
}
```

Exemplo:

```
var idade = 18;
if (idade >= 18) {
    console.log("Você é maior de idade.");
} else {
    console.log("Você é menor de idade.");
}
```

**_FOR (PARA):_**
O for é usado para criar loops em JavaScript, permitindo que você execute um bloco de código várias vezes. Ele é frequentemente usado para iterar sobre arrays ou executar uma tarefa repetitiva por um número específico de vezes. Aqui está a sintaxe básica:

```
for (inicialização; condição; expressão de iteração) {
    // Código a ser repetido enquanto a condição for verdadeira
}
```

Exemplo de um loop for que conta de 1 a 5:

```
for (var i = 1; i <= 5; i++) {
    console.log(i);
}
```

Este loop começa com i igual a 1, continua enquanto i for menor ou igual a 5 e incrementa i em 1 a cada iteração.

Ambas as estruturas, if e for, são fundamentais para a programação em JavaScript, pois permitem que você controle o fluxo do seu código e realize tarefas repetitivas de maneira eficiente. Eles são blocos de construção essenciais para o desenvolvimento de programas e aplicativos JavaScript.
Solkie - Grow through asking
Tags: hrm, surveys, tools, engagement
Published: 2023-09-13 17:44:15

Solkie stands for effective digital employee surveys that inspire managers and that employees enjoy participating. Our platform ensures effective leadership and a pleasant work environment by making organizational changes and growth visible through online and mobile surveys, contributing to the overall health of organizations in both financial and human terms.

[https://solkie.nl](https://solkie.nl)
"Mastering Leadership": CodeNewbie Podcast S25E5
Tags: podcast, discuss, codenewbie, career
Published: 2023-09-13 17:36:28

In our fifth episode of Season 25 of the CodeNewbie Podcast, @saronyitbarek talks about overcoming addiction, evolving as a leader, and finding your pathway to your best self with [Brian Jenney](https://twitter.com/yourCodeCoach), Senior Software Engineering Manager at Clorox.

{% embed https://www.codenewbie.org/podcast/mastering-leadership %}

Brian is a software engineering manager who transitioned into tech at 30. He is a JavaScript enthusiast who enjoys teaching and mentoring others and runs a business teaching others how to code and accelerate their developer careers.

- [Listen on Apple Podcasts](https://podcasts.apple.com/us/podcast/codenewbie/id919219256?i=1000627711000)

- [Listen on Spotify](https://open.spotify.com/episode/1mshmSLfjyWJmVZRnKkjLg?si=cf44d1bf06ce4984)

Or find the episode wherever you find your podcasts. 

***

### We will see you next week, happy coding y'all! Love you!

PS: Make sure to follow the CodeNewbie podcast on your chosen platform and leave us a review!
:wq cheat/12factor
Tags: awesome, cheatsheet, commons
Published: 2023-09-13 17:33:29

## [The Twelve-Factor App][1]

> _"A methodology for building modern, scalable, maintainable software-as-a-service apps."_

1. **Codebase** 
   One codebase tracked in revision control, many deploys

2. **Dependencies** 
   Explicitly declare and isolate dependencies

3. **Config** 
   Store config in the environment

4. **Backing services** 
   Treat backing services as attached resources

5. **Build, release, run**
   Strictly separate build and run stages

6. **Processes** 
   Execute the app as one or more stateless processes

7. **Port binding**
   Export services via port binding

8. **Concurrency**
   Scale out via the process model

9. **Disposability**
    Maximize robustness with fast startup and graceful shutdown

10. **Dev/prod parity**
   Keep development, staging, and production as similar as possible

11. **Logs**
   Treat logs as event streams

12. **Admin Processes**
   Run admin/management tasks as one-off processes

## References

- [The Twelve-Factor App: A methodology for building modern, scalable, maintainable software-as-a-service apps][1]

[1]: https://12factor.net "The Twelve-Factor App"
Hello World in Go
Tags: go, beginners, programming, tutorial
Published: 2023-09-13 17:30:20

13 Sep,2023 10:42 PM

* Installed Go to my Macbook with `brew install go`
    
* To check whether Go is installed or not use `go` in the terminal and if it returns some commands that can be combined with go
    

### Hello, World

* wrote the first `Hello World` program in Go
    

```go
package main
import 'fmt'
func main() {
     fmt.Println("Hello, World")
}
```

* compiled the helloworld.go with `go build helloworld.go` which created an executable.
    
* executed with `./helloworld`
    
* We can compile and execute with a single command `go run helloworld.go` which didn't create any executable file.
    

### Variables

variables in go can be declared in the following ways

```go
var a int
var b bool
a = 15 
b = true


var (
x int
y bool
)
x=100
y=false

m:=100
n:="New N"

var i,j int
i=1
j=2
```

[GitHub commit link](https://github.com/vasanth9/LearningGo/commit/49101957287939ccb33ff9c15040d73bb3620a80)

### Resources

* [Learning Go](https://www.miek.nl/go/#learning-go)
    
* [Go Lang Tutorial for beginners](https://www.youtube.com/watch?v=yyUHQIec83I)
Classes e Objetos (JavaScript)
Tags: javascript, classes, objetos, learning
Published: 2023-09-13 17:29:59

Em JavaScript, objetos e classes são conceitos fundamentais da programação orientada a objetos. Eles permitem que você modele e organize seu código de uma maneira mais eficiente e reutilizável. Vou explicar os dois conceitos separadamente:

**_Objetos:_**

Um objeto em JavaScript é uma estrutura de dados que armazena um conjunto de propriedades (também conhecidas como campos ou atributos) e métodos (funções associadas a esse objeto). As propriedades são pares chave-valor, onde a chave é uma string (ou símbolo) que identifica a propriedade e o valor é qualquer tipo de dado válido em JavaScript (números, strings, outros objetos, etc.).

Aqui está um exemplo simples de criação de um objeto JavaScript:

```
const pessoa = { 
  nome: "João",
  idade: 30,
  saudacao: function() {
    console.log(`Olá, meu nome é ${this.nome} e tenho ${this.idade} anos.`);
  }
};

console.log(pessoa.nome); // Acessando uma propriedade
pessoa.saudacao(); // Chamando um método
```

Neste exemplo, '**pessoa**' é um objeto que tem três propriedades: '**nome**', '**idade**' e '**saudacao**'. A última propriedade é um método que pode ser chamado para exibir uma saudação.

_**Classes:**_

Uma classe em JavaScript é uma forma de definir um modelo ou uma estrutura para criar objetos. É como um plano ou um molde para objetos. Classes geralmente têm um construtor para inicializar propriedades quando um novo objeto é criado, além de métodos que podem ser compartilhados por todos os objetos criados com base nessa classe.

Aqui está um exemplo de uma classe em JavaScript:

```
class Pessoa {
  constructor(nome, idade) {
    this.nome = nome;
    this.idade = idade;
  }

  saudacao() {
    console.log(`Olá, meu nome é ${this.nome} e tenho ${this.idade} anos.`);
  }
}

const pessoa1 = new Pessoa("Maria", 25); // Criando um objeto usando a classe
console.log(pessoa1.nome);
pessoa1.saudacao();
```

Neste exemplo, a classe '**Pessoa**' define um modelo para objetos que têm propriedades '**nome**' e '**idade**', bem como um método '**saudacao**'.

Você pode criar múltiplos objetos a partir da mesma classe, cada um com seus próprios valores de propriedade, mantendo o mesmo conjunto de métodos. Isso torna a programação mais organizada e reutilizável, pois você pode criar objetos semelhantes de forma eficiente.

Estas são as bases de objetos e classes em JavaScript. Eles são essenciais para a programação orientada a objetos e ajudam a organizar seu código de forma mais modular e fácil de entender.
How to take Screenshot using Python
Tags: python, programming, tutorial, codenewbie
Published: 2023-09-13 17:27:49

We will see how to take screenshot using python in desktop with the help of [pyautogui package](https://github.com/asweigart/pyautogui) this package is used of GUI automation.

First lets install the package by running the command
```shell
pip install pyautogui
```

### Take screenshot using python
To [take screenshot using python in desktop](https://www.programdoc.com/blog/how-to-take-a-screenshot-using-python), for this import the pyautogui module, this comes with many features, but in this will be using the screenshot method.
```py
import pyautogui

screen = pyautogui.screenshot()
screen.save("my_image.png")
```

This will take a screenshot of the entire screen and save it to the current working directory, to save the image in different directory change the path in save function.

### Saving screenshot to folder 
```py
import pyautogui

screen = pyautogui.screenshot()
screen.save("test/image/my_image.png")
```
11mliveEPLtintuc - Tin tức bóng đá trực tuyến
Tags: news
Published: 2023-09-13 17:15:26

[11mliveEPLtintuc - Tin tức bóng đá trực tuyến
](https://11mliveepltintuc.com/)
[11mliveEPLtintuc](https://11mliveepltintuc.com/) là một website tin tức bóng đá trực tuyến đỉnh cao tại Việt Nam. Tại đây, người xem có cơ hội cập nhật những diễn biến mới nhất trong làng túc cầu, từ những tin tức thú vị về cầu thủ và HLV. Không chỉ vậy, trang web còn liên tục cập nhật các thay đổi trong đội hình, những chuyển nhượng quan trọng và cả các sự kiện đáng chú ý xảy ra trong cộng đồng bóng đá quốc tế.

tin tức tại đây bạn sẽ có được cho mình nhiều kiến thức hấp dẫn. "
Offline auth with Electron + SQLite + React
Published: 2023-09-13 17:08:23

In an increasingly digital world, the need for secure and robust authentication systems is paramount. Whether you're building a desktop application, a mobile app, or a web platform, the ability to authenticate users reliably and securely is a fundamental requirement. While online authentication methods are well-established and widely adopted, there are situations where offline authentication becomes essential. This is particularly true for desktop applications, where internet connectivity is not always guaranteed.
In this article, we dive into the world of "Offline Authentication" and explore a powerful combination of technologies to achieve this goal: Electron, SQLite, and React. By leveraging the capabilities of Electron, a framework for building cross-platform desktop applications, and harnessing the flexibility of SQLite, a lightweight and embedded database engine, we'll create a robust offline authentication system. To top it off, we'll enhance the user experience by incorporating the user-friendly React library for building the application's front end.
Offline authentication isn't just about enabling access when the internet is down; it's about providing users with a seamless and secure experience, even when disconnected. Whether you're developing a stand-alone desktop application or a part of a broader software ecosystem, the techniques and principles we'll explore here will empower you to create reliable offline authentication solutions that protect user data and ensure a smooth user experience.
Let's embark on this journey to learn how to implement offline authentication with Electron, SQLite, and React, and unlock new possibilities for your desktop applications.Login and Signup pages


First, we will use the last Electron post to start this new one. You can clone the repository on Github:GitHub - tuliocll/electron-react-sqlite-todo: A TODO app with Auth built with Electron, ReactJS and SQLite
A TODO app with Auth built with Electron, ReactJS and SQLite - GitHub - tuliocll/electron-react-sqlite-todo: A TODO app with Auth built with Electron, ReactJS and SQLite
https://github.com/tuliocll/electron-react-sqlite-todo


[Check the full post here](https://tuliocalil.com/offline-auth-with-electron-sqlite-react/)
Tagged Logging vs Structured Logging
Tags: ruby
Published: 2023-09-13 17:07:58

## Understanding Tagged vs. Structured Logging

### What's Tagged Logging?
Tagged logging allows you to prepend tags to your log messages. For instance, using [ActiveSupport::TaggedLogging](https://api.rubyonrails.org/classes/ActiveSupport/TaggedLogging.html), you can tag logs with "Auth API" or user IDs.

```ruby
class Permissions
  def get(user)
    logger.tagged("Auth API") do
      uri = URI("https://auth.example.com/permissions/?user=#{user}")

      logger.info { "Fetching #{uri}" }
      permissions = Permissions.parse(Net::HTTP.get(uri))
      logger.info { "Got permissions #{permissions.to_s}" }
    end
  end
end

# Log Output
#[Auth API] Fetching https://auth.example.com/permissions/?user=bob
#[Auth API] Got permissions admin, writer, reader
```
**Pros:**
- Enhances log readability.
- Avoids repetition by tagging once for multiple log lines.

**Cons:**
- Not machine-friendly. While the text version looks good, the JSON format can be confusing, especially when searching for specific tags.

### Structured Logging: A Better Alternative?
Structured logging provides a more organized way to log messages. Instead of tagging, you structure your logs with key-value pairs.

**Example:**
```ruby
log.info "hello", user: "1", team: "The best team"
```
**Output:**
```
Text Log:
INFO hello user=1, team=The Best Team

JSON Log:
{severity: INFO, message: "hello", user: 1, team: "The Best Team"}
```

This approach is more machine-readable and fits better with modern log aggregators.

### Libraries Supporting Structured Logging:
- [logcraft](https://github.com/zormandi/logcraft)
- [ougai](https://github.com/tilfin/ougai)
- [semantic_logger](https://github.com/reidmorrison/semantic_logger)

Note: [Lograge](https://github.com/roidrage/lograge) offers structured logs for Rails requests but lacks custom structuring.

### Why I Wrote This
I'm building a [dynamic log library](https://prefab.cloud/features/log-levels/) and wanted to understand the best approaches to structured and tagged logging. 

### In Summary:
- Tagged logging is user-friendly but not machine-friendly.
- Structured logging offers a more organized and machine-readable approach.
- Tagged logging does have nice nesting behavior, though you can achieve that with the semantic logger gem as well.
How to authenticate and register GitHub Runners hosted in Azure Container Apps with GitHub App via Azure Key Vault
Tags: containerapps, managedidentity
Published: 2023-09-13 16:57:28

Recently I have been working on designing and automating the deployment of GitHub Runners hosted by an Azure container Apps via Pulumi. One of the challenges is to authenticate with GitHub without the use of a long lived PAT token.

The more secure solution is to authenticate with GitHub App’s private key. The challenge is how to handle the private key in the form of a PEM securely.

Azure Key Vault offers a way:
1. The PEM file is uploaded manually to the Key Vault as a Key
2. Once in the Key Vault, the PEM file is not downloadable or visible to anyone
3. The Key in the Vault can used to sign JWT tokens with the Key

The next challenge is how to access the Key Vault securely from the runners running inside the Container Apps.

Azure Managed Identity comes to the rescue.

During the bootstrap of the runners, we can sign in with Azure Cli with the Managed Identity of the Container App via `DefaultAzureCredential`, which has the RBAC role of CryptoUser permission, and request the Key Vault to sign a short-lived JWT token. Then we can request an access token from the installation of the GitHub App and finally use the access token to register our runner.

The big Gotcha is that only the System Managed Identity can be used this way, not the User Assigned Identity.
Happy Programmers' Day 🎉🎉
Tags: webdev, programming, beginners, codenewbie
Published: 2023-09-13 16:56:28

Today is September 13, also known as the 256th day of the year. 

The number 256 was chosen because it is the number of distinct values that can be represented with 1 byte 🤓


Happy day to us! 👩‍💻 👨‍💻

Being a dev is not easy, you have to work hard and keep learning stuff forever, but in the end, it is fun and I cannot see myself being anything else!

Not long ago I made a [post ](https://dev.to/vanessatelles/neopets-meu-inicio-nao-tao-convencional-na-area-da-tecnologia-1560)talking about my first experience ever with coding (which was kind of...unusual). 

So let in the comments,  how did you get into tech?