teleren/devto huggingface dataset:
Are variables with let and const keywords hoisted in JavaScript?
Tags: programming, webdev, javascript, beginners
Published: 2023-03-03 05:44:12

> In JavaScript, all the variables declared with var, let, and const keywords are hoisted to the top. However, many think variables using let and const keywords are not hoisted because it throws an error if trying to access those variables(declared with let and const) before initialization. In this blog, I'll try to demonstrate the exact reason for the such different behavior of hoisting.

## Hoisting in JavaScript
Before we dive into the differences in hoisting behavior, let's first understand Hoisting. when JavaScript compiles the code, all variable declarations using var are lifted to the top of their functional/local scope (if declared inside a function) or to the top of their global scope (if declared outside of a function) regardless of where the actual declaration has been made. This is what we mean by **hoisting**.

```
console.log(a) // undefined
var a;
a = 'Hello';
```
In the above example, if we try to access the `a` variable it will give us `undefined`. Because the JavaScript compiler first read the variables and functions declaration and create space for them.

**Note:** The concept of hosting is not a literal process (ie, the declarations themselves do not move to the top of the file — it is simply a process of the JavaScript compiler reading them first in order to create space in memory for them).

But the problem arises when we try to access a variable (declared with let or const keywords) before initialization. In that case, it'll throw a `reference error`. 

```
console.log(b) // Uncaught ReferenceError: b is not defined
let b;
b = 'Hello';

console.log(c) // Uncaught ReferenceError: c is not defined
const c = 'Hello';
```

Here many programmers get confused and think that variable using let and const keywords doesn't hoist. However, in reality, those variables with let and const also hoist. [MDN Reference](https://developer.mozilla.org/en-US/docs/Glossary/Hoisting)

_But, why we can't access before initialization like var variable?_

## Because of Temporal Dead Zone
Variables (declared with var) are hoisted with a default initialization which is undefined. That’s why if we try to access a variable (with the var keyword), it’ll not throw an error. Rather, it’ll give us undefined.
On the other hand, variables using (let and const) also do hoist but without a default initialization. That’s why accessing before initialization a variable (with let and const) will throw a reference error. It’s also known as the `temporal dead zone` where compilers know its existence but can’t access it because it’s uninitialized.

```
var a; // Compilers Read and hoist like: var a = undefined
let b; // Compilers Read and hoist like: var b
```

If you find this blog helpful, you can follow me on [LinkedIn](https://www.linkedin.com/in/riyaad-hossain/) and [GitHub](https://github.com/RiyaadHossain). Also, if you have any feedback, please let me know in the comment section below.
GitHub - Writting commits like a boss
Published: 2023-03-03 05:40:19

Writing clear and descriptive commit messages is an important part of the software development process. Good commit messages can help you and your team members better understand the changes made to the codebase, and can also serve as a useful reference for future development work. Here are some golden rules to follow when your commit messages like a f****** boss:

**Specify the type of commit**: At the beginning of the commit, specify the type of change you are doing to easily understand what the commit is about. Every project can use their own conventions, but these works for me.
* feat:     The new feature being added to a particular application
* fix:      A bug fix
* style:    Feature and updates related to styling
* refactor: Refactoring a specific section of the codebase
* test:     Everything related to testing
* docs:     Everything related to documentation
* chore:    Regular code maintenance

**Keep it concise**: Your commit message should be brief and to the point. It should summarize the change made in the commit, but not be too lengthy.

**Use the imperative mood**: Use the imperative mood in your commit message, which means writing in the present tense and using action verbs. For example, "Fix the bug" instead of "Fixed the bug".

**If needed, provide more detail in the body**: To be completely honest, I do not do this so much, but I really do it when doing some kind of squash or a final final final final commit (you know what I mean). In this body I include why the change was necessary, any trade-offs made, and any other relevant information.

**Be consistent**: Use a consistent style and format for your commit messages throughout the project. This can help make them easier to read and understand.

If you follow these practices, your teammates will deeply love you, and you will show that are not the regular coder, but an exceptional one.
Install Chocolatey on your Windows machine
Tags: devops, chocolatey, sysadmin, windows
Published: 2023-03-03 05:30:08



"Chocolatey is a machine-level, command-line package manager and installer for software on Microsoft Windows. It uses the NuGet packaging infrastructure and Windows PowerShell to simplify the process of downloading and installing software"

https://chocolatey.org/install

After that Head to your Window search bar, select your cmd and launch it as administrator and then run the command below 

```
 Get-ExecutitionPolicy 
```
If it return " Restricted" , then  follow up with the second command bellow 
 

```
Set-ExecytionPolicy AllSigned or  Set-ExecutionPolicy Bypass -Scope Process
```
 Now, are ready to install chocolatey by running the command bellow 

```
 Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
```

 After that, run the command below to see chocolatey version
     

```
choco 
```
 you will be able to see chocolatey version 
  

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dh7bysn87oiwheyhkxn0.JPG)
Selenium 4 Features | What’s new in SELENIUM 4?
Tags: beginners, webdev, tutorial, programming
Published: 2023-03-03 05:19:40

Become a Automation Rockstar : https://thetestingacademy.com

{% embed https://youtu.be/elYZ5aGrhaI %}

The Selenium Core is obsolete.
Selenium RC APIs modified to leg-rc (legacy” package)
Selenium 4 will introduce as the most stable Selenium Grid in terms of eradicating all thread-safety bugs, and perfect support for Docker.
As part of this release, request tracing and logging with hooks will be modified and improvised in order to provide automation engineers a great hold on malicious bugs.



The W3C recommendation document for Selenium WebDriver is now available which provides a crystal clear picture of how Selenium API’s are working.
The W3C standard will encourage compatibility across different software implementations of the WebDriver API.
The test will directly communicate without any encoding and decoding of API requests (through the W3C Protocol), though Java bindings will be backward-compatible, but focusing more on the W3C Protocol. The JSON wire protocol will no longer be used.



The Selenium 4 would come up with more user-friendly UI of a grid having relevant pieces of information about sessions running, capacity etc.

Upgrading to the latest version of selenium should not require any code changes. Setting up node and hub will become smooth and the entire grid experience is going to be streamlined.

-------------------------------------------------------

👪 Join our Community - http://bit.ly/learntesting2019


✅ Automation Community - https://thetestingacademy.com


🐦Follow us on Twitter  - https://twitter.com/itstechmode


📖 Like us on Facebook - https://www.facebook.com/scrolltest


🎤  Listen to our Podcast - https://anchor.fm/thetestingacademy


-------------------------------------------------------

#automationtesting #manualtesting #testautomation #thetestingacademy #scrolltest
🚀 Tools and services I recommend:
Some of the courses that I recommend to become better Automation Tester 🙌🙌

✅Selenium Training and Certification -
https://scrolltest.com/go/edureka


✅Learn Jenkins for QA -
https://bit.ly/learnjenkins-p1


✅Programming Java -
https://bit.ly/learnjava2020-p1


✅Test Automation - 
https://bit.ly/learnautomation2020


✅API Testing - 
https://www.learnapitesting.com


✅Cypress Tutorial with LIVE Projects -
http://cypresstutorial.com
How HACKERS SNIFFING DATA FROM WIRELESS NETWORK AND CAPTURE SENSITIVE INFORMATION.
Published: 2023-03-03 04:50:25

https://blog.nathanielsecurity.com/how-hackers-Sniff-data-from-network-and-website/index.html

Learning how hackers compromise your network either as a Cyber Security expert or Public user will go along way in preventing your network being attacked or compromised
Learning to Code "Article Series"
Published: 2023-03-03 04:11:41

Before you start reading, I want to thank you for being here, for wanting to learn, grow as a person, regardless of whether you will follow this series of publications or not, just the fact that you are reading an article demonstrates your willingness to learn.

Now, I want to tell you what this "Learning to Code" is all about and give you some context.

## First, let me introduce myself:

My name is Natyari Vargas, I am a Software Engineer, passionate about technology, science, and education. I have been a teacher in institutes, a school, and a college, and I have had the pleasure of sharing what I have learned with children from 6 years old to adults who want to become programmers.

This series of articles was born with the need to continue sharing what I am still learning. Currently, I am not teaching, and this strange need to continue sharing information still exists within me, so after thinking about it for some time, I have decided to write here again on DEV. Of course, I also thought about a podcast, a YouTube channel, but for now, I will stick to writing only, and later on, I could evaluate those other projects when I have more time.

## What is "Learning to Code" about?

Well, I think the name is quite descriptive, but I want to explain a little more about what you can expect from this series of articles.

In each of these articles, I will try to cover as much as I can of what we are going to build, from the idea, design, and programming. This makes each publication quite extensive. What I hope is that you can sit down to read and follow step by step, if you need to, leave it and come back later to continue.

There is no defined language, in each project, we can use different programming languages. What I can assure you is that at the end of the article, you will have a completely functional and completed project.

So, summarizing what you will get with "Learning to Code:"

- Real, complete, and functional projects.
- You will learn more about software development, from the idea, planning to development, and deployment in production.
- Different tools that are used every day like Git, CLI, Servers, Postman, etc.
- Good software development practices.
- Unit and integration testing.
- You can add these projects to your portfolio or Github freely.
- Leave your questions in the comments.
- You will have access to the complete repository, so you can compare projects or see solutions to possible errors.

I hope you enjoy this series of publications as much as I enjoy writing them. I hope to improve in each publication to be as clear as possible, but above all, that you can learn in each one of the publications.

As the articles are published, the links will appear here.

Happy coding.
Daily UX Writing Challenge Day 3
Tags: challenge, ux, uxwriting, beginners
Published: 2023-03-03 04:03:36

[Day 1](https://dev.to/fuwa/daily-ux-writing-challenge-day-1-50la) | [Day 2](https://dev.to/fuwa/daily-ux-writing-challenge-day-2-4d6p)


![Scenario: The user entered the wrong email address to sign in to their account](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zw4usxq5sxf1rm7nb4qy.png)

I managed to lose my phone on the bus today after work, luckily a kind homeless man picked it up for me, but trying to locate him to get it back was a struggle. Luckily after almost 3 hrs in the cold I managed to get my phone back~ So I was planning to just go to sleep and skip the challenge for the day. Unfortunately my brain was like 'it's only the 3rd day and you failed the streak already?!' So here I am.

Thankfully it was a nice short one today and didn't require much 
thinking. Initially I wasn't sure what tone of voice I should use as I have no idea what the company is and made a slighter longer message with a friendly tone then noticed the character limit which didn't leave me with any options other than a super, short, clear concise message.
Setup typeorm in project structure monorepo nestjs
Tags: nestjs, monorepo, typeorm, migration
Published: 2023-03-03 03:42:49

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

Starting from the initial steps of creating a **[monorepo project structure in NestJS](https://docs.nestjs.com/cli/monorepo#monorepo-mode)**, you need to install **[TypeORM](https://orkhan.gitbook.io/typeorm/)** and necessary dependencies to use it in your project.

Next, you need to create the necessary directories and files to share code between packages in your project.

Then, you can start configuring TypeORM to use it in your project. You can use [commander](https://www.npmjs.com/package/commander) and [inquirer](https://www.npmjs.com/package/inquirer) to create a command-line interface (CLI) similar to the NestJS CLI to perform migration-related commands in TypeORM.

In this video, we will guide you on how to use commander and inquirer to create a CLI like NestJS, while configuring TypeORM to use it in your project. We will explain in detail how to use TypeORM to create migrations, create tables in the database, perform CRUD operations, and more.

This video has no sound, so we will try to present all information clearly for you to understand.

We hope this video will help you in configuring TypeORM and creating a CLI like NestJS for your project. If you have any questions or contributions, please leave a comment below.

Thank you for watching our video!

Part 1: https://www.youtube.com/watch?v=XBBgWS8GnfM
Part 2: https://www.youtube.com/watch?v=mMDcBqeipds

Github: https://github.com/nmthangdn2000/demo-setup-typeorm-in-monorepo-nestjs
O que é e para o que serve arquitetura orientada a serviços?
Published: 2023-03-03 03:27:40

SOA, ou Arquitetura Orientada a Serviços, é um modelo de arquitetura de software que tem como objetivo permitir a integração entre sistemas e aplicações de diferentes plataformas e tecnologias. Com SOA, os serviços são projetados para serem independentes do fornecedor, da linguagem de programação, do sistema operacional e do hardware. Dessa forma, é possível criar soluções mais flexíveis e escaláveis, além de permitir que os serviços possam ser reutilizados em diferentes contextos.

Na prática, SOA é um conjunto de práticas, metodologias e padrões que visam permitir a integração entre sistemas por serviços independentes. Esses serviços podem ser acessados por meio de uma rede ou por meio de uma API, que pode ser usada por diferentes sistemas. Cada serviço pode ser projetado para executar uma tarefa específica, como gerenciamento de pedidos, processamento de pagamento, geração de relatórios, entre outras.

A ideia central de SOA é que as funcionalidades dos sistemas devem ser oferecidas como serviços, que podem ser utilizados por outros sistemas. Dessa forma, as empresas podem integrar seus sistemas de forma mais fácil e eficiente, sem precisar investir em complexas integrações ponto a ponto. Além disso, SOA permite que as empresas possam criar novos serviços a partir de componentes já existentes, aumentando a produtividade e reduzindo o tempo de desenvolvimento.

Uma das principais vantagens de SOA é a possibilidade de reutilização de serviços. Ao criar serviços independentes e modulares, é possível utilizar esses serviços em diferentes aplicações e sistemas. Isso significa que os serviços podem ser desenvolvidos uma vez e utilizados em várias aplicações, reduzindo o tempo e o custo de desenvolvimento.

Outra vantagem de SOA é a flexibilidade que o modelo oferece. Com serviços independentes, é possível criar soluções mais flexíveis e escaláveis, que podem ser adaptadas a diferentes necessidades de negócio. Além disso, SOA permite que as empresas possam atualizar ou substituir serviços sem afetar o funcionamento de outros sistemas.

Em resumo, SOA é uma abordagem para a integração de sistemas que tem como objetivo criar serviços independentes, que podem ser acessados por diferentes sistemas e aplicações. Essa abordagem permite a reutilização de serviços, criação de soluções mais flexíveis e escaláveis, além de reduzir o tempo e o custo de desenvolvimento. Com SOA, as empresas podem integrar seus sistemas de forma mais fácil e eficiente, permitindo que elas possam focar em seus negócios principais.
28. Leetcode Solution in cpp
Tags: cpp
Published: 2023-03-03 03:25:43

==================================================================
#description:
Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

 

Example 1:

Input: haystack = "sadbutsad", needle = "sad"
Output: 0
Explanation: "sad" occurs at index 0 and 6.
The first occurrence is at index 0, so we return 0.
Example 2:

Input: haystack = "leetcode", needle = "leeto"
Output: -1
Explanation: "leeto" did not occur in "leetcode", so we return -1.
 

Constraints:

1 <= haystack.length, needle.length <= 104
haystack and needle consist of only lowercase English characters.

==================================================================
#solution:

```cpp
class Solution {
 public:
  int strStr(string haystack, string needle) {
    const int m = haystack.length();
    const int n = needle.length();

    for (int i = 0; i < m - n + 1; i++)
      if (haystack.substr(i, n) == needle)
        return i;

    return -1;
  }
};

```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/
Modify items in paginated list in Jetpack Compose
Published: 2023-03-03 02:45:42

When utilizing the paging library to retrieve a list and subsequently populate the user interface with the paging list, modifying individual items from the list can pose considerable challenges. This tutorial aims to present a solution to this issue by demonstrating how custom pagination can be used to accomplish the same task with ease in Jetpack Compose.

Let's get started... 

For this tutorial I have followed one of the tutorial by Philipp Lackner. [How to Implement Pagination With Jetpack Compose - Android Studio Tutorial](https://youtu.be/D6Eus3f6U9I)

So, I have replaced paging 3 library with this custom pagination. Also declared a data class for updating screen state. Also declared a  CompositionLocal key that can be provided using CompositionLocalProvider. 

{% embed https://gist.github.com/jhnaiem/782e94c63efb9ab402d0d3b9f9753f7f.js %}

After that used that screen state as a composable state in the ViewModel. Also declared a paginator of type DefaultPaginator.
{% embed https://gist.github.com/jhnaiem/9b8799773cc8a925fd7ad6fdc0fef726.js %} 

I have used `CompositionLocalProvider` and wraped the root composable function with the provider. You can learn about CompositionLocalProvider from [here..](https://medium.com/mobile-app-development-publication/android-jetpack-compose-compositionlocal-made-easy-8632b201bfcd) 

{% embed https://gist.github.com/jhnaiem/3072e5f8c5cc93eaf548261989d7f862.js %}

{% embed https://gist.github.com/jhnaiem/733d89cb50011c4c2a65ebb0b31a3904.js %}

So, whenever a clip gets played the value of the `state` declared in the ViewModel getting updated and causing Compose to recompose the screen.And the item from the list get modified.

This is it for today!
Game Android Terbaik
Tags: gamespools, android, games
Published: 2023-03-03 02:24:03

Siapa yang tidak suka bermain game online? Dari sekian banyak pilihan yang tersedia, ada beberapa game online terbaik di [slot gamespools](https://gamespools-boy.weebly.com/services.html) yang harus Anda coba. Simak artikel ini untuk mengetahui game-game apa saja yang bisa Anda mainkan!

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

Permainan online sudah menjadi bagian dari gaya hidup modern. Dengan begitu banyak game online yang tersedia, terkadang sulit untuk memilih mana yang terbaik. Tapi jangan khawatir, di sini kami telah menyusun daftar game online terbaik untuk Anda. Mari kita mulai dengan melihat game pertama pada daftar.

1. PUBG Mobile

PUBG Mobile adalah game online terbaik yang wajib Anda coba. Game ini sangat populer di seluruh dunia dan memiliki gameplay yang seru. PUBG Mobile adalah game battle royale, di mana Anda bersaing dengan pemain lain untuk menjadi yang terakhir bertahan hidup. Grafis game ini sangat memukau dan sangat halus, yang membuat Anda merasa seolah-olah sedang berada di dunia game.

2. Mobile Legends

Mobile Legends adalah game online MOBA (Multiplayer Online Battle Arena) yang populer di Indonesia. Dalam game ini, Anda bermain dengan tim Anda untuk mengalahkan tim lawan. Ada banyak karakter yang dapat Anda mainkan, masing-masing dengan kekuatan dan kemampuan yang unik. Grafis game ini sangat halus dan dinamis, yang membuat Anda merasa seolah-olah sedang berada di dalam game.

3. Game Online Terbaik: Among Us

Among Us adalah game online yang sangat populer saat ini. Game ini berfokus pada tim kerja sama dan deduksi. Anda bermain sebagai anggota kru di sebuah kapal ruang angkasa, di mana Anda harus menemukan siapa di antara Anda adalah impostor. Grafis game ini sangat lucu dan imut, yang membuat game ini sangat menghibur.

Kesimpulan

Itulah daftar game online terbaik yang bisa Anda coba. Dari game battle royale hingga game MOBA, dan game kerja sama, pilihan game online terbaik yang tersedia sangat beragam. Jangan ragu untuk mencoba game-game ini dan temukan yang paling Anda sukai. Mainkan game online terbaik dan nikmati waktu luang Anda!
Como criar fonte de ícones
Tags: css, font, icons, designsystem
Published: 2023-03-03 01:45:54

Para realizar a criação de font utilizei o site [Fontello](https://fontello.com/), mas também existem outros sites como alternativa.

Salve todas as imagens que deseja como ícone no formato SVG e arraste na seção "Custom Icons".


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

Resultado com todos os ícones importados e selecionados.

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

Na aba "Customize Names" é possível ver todos os ícones importado e verificar o nome de cada um, é importante lembrar que não são suportados caractéres especiais, além disso, podemos definir o nome da fonte.


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

Após isso, é necessário fazer o dowload da font, extrair a pasta e importar no projeto a pasta CSS e fonts.


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

No projeto é preciso importar o css gerado.

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

Agora só usar seus ícones passando eles como classe onde desejar.

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

Por fim, também é possível criar classes globais auxiliares para configurar o tamanho dos ícones utilizando a propriedade font-size.

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