teleren/devto huggingface dataset:
[NEED HELP] Screen orientation lock for a website JS/CSS
Tags: help, webdev, javascript, beginners
Published: 2022-08-30 12:38:07

Need some help on a website I am working on. Basically I wish to implement a orientation lock when the website is viewed on a mobile device and the website would be locked on a portrait mode. 

I found this implementation method on mdn web docs: [Link to the article](https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation)

Does anyone here have experience on making a screen orientation lock for websites? If you have any tips or trick or any resources to share thank you in advance!

Thanks for reading :)
Set Environment Variables Programmatically in Postman
Tags: api, testing, javascript, webdev
Published: 2022-08-30 12:19:15

Working with APIs, particularly those that use the JWT model for authentication, can be challenging because it requires copying and pasting the Bearer token into the Authorization headers. 

The blog post explains how to reuse JSON web tokens in Postman, which will speed up your API Testing experience.  


#### Prerequisite
Basic HTTP and RestAPI Understanding 

---


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

---
##### Let's create an environment that allows us to change the context of our requests. 

🎯 Select the Environment quick look option. 

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

---

##### Click on the add button

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

---

🎯 Set the name of the Environment [green], the base URL, and click the save button

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

---

🎯 Change the Environment to the newly set one and also the baseUrl in two curly brackets

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

---

🎯 Hover over the `baseUrl` to see the URL referenced from the environment variables. 

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

---


🎯 Following that, we set our `JWT` against the response token.

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

---

🎯 Try the request again, everything should still work

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/372tb4f2vp4rudjq5iuf.PNG)

---

If you open the environment quick look section, the new JWT token should be listed as one of the variables. 

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


---

🎯 To use the JWT on protected routes, follow the highlighted points. 

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

---

Finally, if you open the headers tab, you will notice that the Authorization values are automatically prefilled. 

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



---

#### Conclusion
I hope this post was useful and has shortened your API testing time. Thank you for reading.
Концепции APTOS | События
Tags: blockchain, aptos, tutorial, webdev
Published: 2022-08-30 12:16:16

События генерируются во время выполнения транзакции. Каждый модуль Move может определять свои собственные события и выбирать, когда генерировать эти события при выполнении модуля. Например, во время [перевода coin](https://github.com/aptos-labs/aptos-core/blob/bdd0a7fe82cd6aab4b47250e5eb6298986777cf7/aptos-move/framework/aptos-framework/sources/coin.move#L412) учетные записи отправителя и получателя будут выдавать `SentEvent` и `ReceivedEvent` соответственно. Эти данные хранятся в реестре и могут быть запрошены через функцию [Get events by event handle](https://fullnode.devnet.aptoslabs.com/v1/spec#/operations/get_events_by_event_handle) интерфейса REST.

Если предположить, что учетная запись `0xc40f1c9b9fdc204cf77f68c9bb7029b0abbe8ad9e5561f7794964076a4f`bdcfd отправила coins на другую учетную запись, можно сделать следующий запрос к REST-интерфейсу: `https://fullnode.devnet.aptoslabs.com/accounts/c40f1c9b9fdc204cf77f68c9bb7029b0abbe8ad9e5561f7794964076a4fbdcfd/events/0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>/withdraw_events`. В результате будут получены все `WithdrawEvents` средств, хранящиеся на этой учетной записи, это будет выглядеть следующим образом

```javascript 
[{
  "key":"0x0000000000000000caa60eb4a01756955ab9b2d1caca52ed",
  "sequence_number":"0",
  "type":"0x1::coin::WithdrawEvent",
  "data":{
    "amount":"1000"
  }
}]
```
Каждое зарегистрированное событие имеет уникальный ключ. Ключ `0x0000000000000000c40f1c9b9fdc204cf77f68c9bb7029b0abbe8ad9e5561f7794964076a4fbdcfd` отображает событие `0x1::coin::CoinStore<0x1: :aptos_coin::AptosCoin>/sent_events` зарегистрированный на учетной записи  `0xc40f1c9b9fdc204cf77f68c9bb7029b0abbe8ad9e5561f7794964076a4fbdcfd`. Затем этот ключ можно использовать для прямого запроса событий, например, `https://fullnode.devnet.aptoslabs.com/events/0000000000000000c40f1c9b9fdc204cf77f68c9bb7029b0abbe8ad9e5561f7794964076a4fbdcfd`.

Они представляют собой потоки событий, или список событий, каждая запись которого содержит последовательно возрастающий номер `sequence_number`, начинающийся с `0`, `type` и `data`. Каждое событие должно быть определено каким-либо `type`. Может быть несколько событий, определенных одним и тем же или похожими `type`, особенно при использовании generics. События имеют ассоциированные `data`. Общий принцип заключается в том, чтобы включать все `data`, необходимые для понимания изменений в базовых ресурсах до и после выполнения транзакции, которая изменила данные и вызвала событие.
Implementing TimetableJs in Ruby On Rails
Tags: rails, ruby, javascript, tutorial
Published: 2022-08-30 12:03:09

Timetablejs is a vanilla javascript plugin for building nice responsive timetables. Provides a simple javascript interface to add events and locations which can be rendered to nice HTML. Works on mobile devices as well. We will learn how to implement it in Ruby on Rails.
{% youtube gJ9upo8lhc8 %} 
Github: https://github.com/railsdrill/episode-24-timetable-js
Query Params Bracket Angular
Tags: angular
Published: 2022-08-30 11:58:41

Is there any less declarative way to pass variables by get in brackets style?

```
const params = new HttpParams()
        .set("filter[nome]", keyword);

return this.http.get<Response>('/api/cidade', {params: params}).pipe(map(resp => {
      return resp.data;
    }));
```

/api/cidade?filter[nome]=rio preto
How does JavaScript Works?
Published: 2022-08-30 11:55:23

In JavaScript,

The JavaScript Engine is made up of two primary parts:

Memory Block – this is the location where memory is allocated.
The Code Execution Block - this is where your code runs.

For better Visualization👇


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



In Example

➖ In 1st phase (Inside the Memory Block):-

➖ The variable 'num' will be initialized with an undefined value and the function 'multi' will be initialized with the entire function description and the variable 'num1' will also be initialized with an undefined value.

In 2nd Phase:-

➖ The default value which is 5 will be assigned to the variable 'num',and the multi-function with the value of 5 will be assigned to the variable 'num1'.

➖ The JavaScript Engine will create a "Memory Block" and a "Code Execution Block" for the 'multi-function.

Inside the memory block, variables 'n' and 'result' will be initialized with undefined and the code execution block will perform the function's operation and assign that value to variable 'result' .Finally, the control will return to the location where the function was called.

For More Download our free JavaScript Resources ebook Here: [Click Here] (https://codemarch.gumroad.com/l/udhhj)
PICC officially joined the openGauss community
Published: 2022-08-30 11:46:45

On August 24th, PICC Information Technology Co., Ltd. signed CLA (Contribution License Agreement) and officially joined the openGauss community.

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

PICC Information Technology Co., Ltd. (hereinafter referred to as "PICC Technology") is the first technology company approved after the issuance of the new regulations of the "Measures for the Supervision and Administration of Insurance Group Companies" by the China Banking and Insurance Regulatory Commission. Co., Ltd. is wholly-owned and its strategic positioning is PICC Group's technology resource integration management platform, technology service capability support platform, technology operation sharing service platform, and technology service value creation platform. Energy Group's main business.

This time, PICC Technology, together with the openGauss community, will build on the characteristics of the openGauss database, such as powerful high availability, high performance, scalability, ease of maintenance, and compatibility with native PostgreSQL and various hardware devices, to build properties suitable for property insurance and personal insurance. And data support capabilities in the investment field, while empowering traditional relational databases.
Yunhe Enmo Lecture Hall x openGauss Meetup x Kunpeng Ecological Incubation Camp (Chengdu Station) ended successfully
Published: 2022-08-30 11:49:59

On August 25, 2022, Yunhe Enmo Lecture Hall X openGauss Meetup X Kunpeng Ecological Incubation Camp hosted by Yunhe Enmo, openGauss community and Sichuan Kunpeng Ecological Innovation Center was successfully held in Chengdu. 
This event focuses on openGauss community ecological construction, core architecture innovation, business application practice, optimization and practice based on Kunpeng's full-stack domestic environment, and database talent training as the core to fully demonstrate that "industry-university-research-use" is working together to build a mainstream database root community. .

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8yorze7tac3a36d7i0zj.png)
The event attracted people from the Chengdu area, including PetroChina, Sichuan Provincial Taxation Bureau, Sichuan Big Data Center, Chengdu Railway Bureau, Tianfutong, Xinwang Bank, SphereEx, Digital China, Shanghai Zhuyun Information Technology, Dongfangtong, Bentong Hundreds of experts, developers, users and college teachers and students from 30+ units including Yuanda, Sichuan Xunfang, Beijing Chaotu, Xugu Weiye, Sichuan University, University of Electronic Science and Technology of China, China Civil Aviation Flight Academy, and Sichuan Vocational and Technical College The active participation is another successful check-in of the "openGauss Ecological National Tour", and the Chengdu User Group was officially established in this event.

This event can be described as a gathering of big names. Du Junping, general manager of Huawei's open source computing business and TOC chairman of the Open Atom Open Source Foundation, Xian Yifu, general manager of Yunhe Enmexi Business Department, Huang Kaiyao, chief architect of openGauss open source database and member of the technical committee, Yunhe Enmo MogDB Database CTO Zhang Chengwei, China Telecom Group Senior Technical Expert Zhang Ming, Xugu Weiye Product Director Ming Yuzhuo, Yunhe Enmo Database Ecological Product Group General Manager Xiong Jun, University of Electronic Science and Technology of China Associate Professor, Computer Engineering and Leaders and experts including Sun Ming, director of the Application Department and Smart City Research Center, attended the event and conducted a round table discussion on the theme.
Image Animation in CSS - 2
Tags: codepen, webdev, css, html
Published: 2022-08-30 11:39:49

Hello Guys today i will show you another animation related to images.

{% codepen https://codepen.io/shubhamtiwari909/pen/rNdXpdv %}

THANK YOU FOR CHECKING THIS POST

You can contact me on -
Instagram - https://www.instagram.com/supremacism__shubh/
LinkedIn - https://www.linkedin.com/in/shubham-tiwari-b7544b193/
Email - shubhmtiwri00@gmail.com

^^You can help me by some donation at the link below Thank you👇👇 ^^
☕ --> https://www.buymeacoffee.com/waaduheck <--

Also check these posts as well
https://dev.to/shubhamtiwari909/js-push-and-pop-with-arrays-33a2/edit

https://dev.to/shubhamtiwari909/tostring-in-js-27b

https://dev.to/shubhamtiwari909/join-in-javascript-4050

https://dev.to/shubhamtiwari909/going-deep-in-array-sort-js-2n90
Form Input Fields | Selenide Tutorial Series
Tags: java, testing, tutorial, beginners
Published: 2022-08-30 11:37:38

In this post, we will cover how to work with various input fields such as Text input, Dropdown input, Checkbox input as well as Date input fields in Selenide.

### Text Input Fields
With Text input field, you can add in the text using the `.val` command in Selenide - 

```
$(".support-name input").val("Luffy");
$(".support-email input").val("luffy@onepiece.com");
```

### Dropdown Input Fields
With Dropdown input field, you need to provide the dropdown option you need to select either the `text` value or the `int` value - 

```
$(".support-dropdown select").selectOption("Technical Team");
$(".support-dropdown select").selectOption(2);
```

### Checkbox Input Fields
Checkbox input fields are pretty straightforward as you can just the checkbox element you need to interact with and just do a `.click` on it -

```
$(".support-checkboxes ul li:nth-child(2) input").click();
```

### Date Input Fields
Date input fields are usually the trickiest to work with as the implementation differs from website to website - 

```
$(".support-date input").click();
$(".flatpickr-day.nextMonthDay").click();
```
In this example, we are first clicking on the date input field and then selecting the next month day using the className. Typically, you will need to find different ways to select the date you want such as using `aria-label` or `className`.

---

**To learn more about working with form input fields in Selenide, check out the video below –**

{% youtube WiRtmHs-V8c %}

---

📧 Subscribe to my [mailing list] (https://automationbro.com/mailing-list) to get access to more content like this as well as be part of amazing free giveaways.

👍 You can follow my content here as well - 
- [Twitter](https://twitter.com/automationbro)
- [LinkedIn](https://www.linkedin.com/company/automation-bro)

...

I love coffees! And, if this post helped you out and you would like to support my work, you can do that by clicking on the button below and buying me a cup of coffee -

<a href="https://www.buymeacoffee.com/automationbro">![Buy me a coffee](https://dev-to-uploads.s3.amazonaws.com/i/4aw2ub3f4qkyjk0ivwt4.png)</a>
Restore IP Addresses
Tags: leetcode, python, problemsolving
Published: 2022-08-30 11:28:18

A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclusive) and cannot have leading zeros.

For example, "0.1.2.201" and "192.168.1.1" are valid IP addresses, but "0.011.255.245", "192.168.1.312" and "192.168@1.1" are invalid IP addresses.
Given a string s containing only digits, return all possible valid IP addresses that can be formed by inserting dots into s. You are not allowed to reorder or remove any digits in s. You may return the valid IP addresses in any order.


```py

class Solution(object):
    def restoreIpAddresses(self, s):
        res = []
        if len(s) > 12:
            return res
        
        def backtrack(i, dots, curIP):
            if dots == 4 and i == len(s):
                res.append(curIP[:-1])
                return
            
            if dots > 4:
                return
            
            for j in range(i, min(i+3, len(s))):
                if (int(s[i: j + 1]) < 256) and (i == j or s[i] != "0"):
                    backtrack(j + 1, dots + 1, curIP + s[i: j+1] + ".")
                
        
        backtrack(0, 0, "")
        return res
    
    

```
What is String.raw() in JavaScript?
Tags: javascript, webdev, programming, tutorial
Published: 2022-08-30 11:22:59

A video of this article is available below:
{% embed https://www.youtube.com/watch?v=lFhMQSfIVms %}
## Introduction
In this article, I will be introducing raw strings in JavaScript.

Sometimes when we work with template literals we use them to convert characters. Let’s clarify this with an example.

```
console.log(`Monday\nTuesday\nWednesday`);
//Returns --->
Monday
Tuesday
Wednesday
```
In the above example we console log a template literal or a template string which contains Monday, Tuesday and Wednesday each separated with the newline character. When this runs each of the words is printed on a new line.

## String.raw()

JavaScript provides us with the String.raw() tag function which enables us to access the raw string from a template literal. This means we are able to access the string where the escape characters are not processed. Let’s expand on the above example with this.

```
String.raw`Monday\nTuesday\nWednesday`;
//Returns ---> 'Monday\nTuesday\nWednesday'
```

In the above example we use the String.raw() method and pass the template literal as the parameter. We get the same string returned without the newline characters processed.

## Interpolation

When you use the raw method anything interpolated into the string will be processed. Let’s look at an example of this.

```

console.log(`Sum: ${4+5}`);
//Returns ---> Sum: 9
```

In the above example inside of a console log we use string interpolation to sum 4 and 5. We get the string with the sum returned. Now let’s try doing this with the raw method.

```
String.raw`Sum: ${4+5}`;
//Returns ---> 'Sum: 9'
```
In the above example we use the raw method and pass in the template literal with the interpolated sum. We get the returned string with the completed sum because anything we pass in to be interpolated does get processed by the method.

## Unicode
Another time that the raw string method is useful is if you are using unicode characters.

```
console.log(`\u2605`);
//Returns ---> ★
```
In the above example, we use the Unicode character to access a star symbol and this is returned to us. Now let's use the raw method on this template literal.

```
String.raw`\u2605`;
//Returns ---> '\\u2605'
```
We go on to use the raw method passing in the Unicode character. Nothing is processed and we get the raw string returned.

I hope you enjoyed this article. Please feel free to post any comments, questions, or feedback, and follow me for more content!
Koala Engine Update #2
Tags: programming, typescript, javascript, webdev
Published: 2022-08-30 11:15:57

Hi, welcome to the second update of the Koala Engine.
Today I want to introduce you to the main changes since the last [koala-engine](https://github.com/lorenzo774/koala-engine) update.

- Entities selectable
- Now you can load the settings into the editor
- Each component is displayed in the inspector with HTML fields

[Video](https://twitter.com/774Lorenzo/status/1564568848568881153)

----

github: https://github.com/lorenzo774/koala-engine
twitter: https://twitter.com/774Lorenzo
How to reset root password on gitlab-ce (self-managed) using gitlab-rake
Tags: gitlab, root, gitlabce, password
Published: 2022-08-30 10:51:43

In this article we'll see how to reset root password on `gitlab-ce` (community edition) self-managed using the embedded tool `gitlab-rake`.

First we need access the container of gitlab-ce (you can see [How to run gitlab-ce (self-managed) on docker container](https://dev.to/henriqueholtz/how-to-run-gitlab-ce-self-managed-on-docker-container-part-1-68d)), we'll access it by container name, in my case is `gitlab_ce`, let's entry with this command:

```
docker exec -it gitlab_ce bin/bash
```

Then, into the container we'll reset the root password directly using the command bellow:

```
gitlab-rake "gitlab:password:reset[root]"
```

The above command will request for you the new password and your confirm password. After you should see some message successfully as the image below:

![Image Password successfully updated for user with username root](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrbvus15l7u0ngvlncvc.png)

It's ready! Now, you can make your login with your new password and the `root` login:


![Example of login using root user](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qprg5he5b3aj5fyb7d9t.png)

Thanks for reading!
🏆Quick-win : Fix erreur NETSDK1045 avec .net 7 preview
Tags: net, devops, errors, preview
Published: 2022-08-30 11:15:00

## Comment résoudre l'erreur : _error NETSDK1045 The current .NET SDK does not support targeting .NET 7.0._ 

Dans un pipeline Azure DevOps, en utilisant le sdk .net6 dans une task de CI, aucun problème, tout fonctionne sans accroc, jusque là rien d'anormal.
L'extrait ci-dessous présente une task simple, issue d'un fichier yaml:
 
```yaml
- task: UseDotNet@2
  displayName: 'Use .NET Core sdk'
  inputs:
    packageType: sdk
    version: 6.x
    installationPath: $(Agent.ToolsDirectory)/dotnet
```
Lorsque vous utilisez le **sdk .net7** (à l'heure actuelle en état de **preview**), celui-ci causera une belle erreur :
_error NETSDK1045: The current .NET SDK does not support targeting .NET 7.0._

Pour résoudre ce problème, **c'est très simple**: ajoutez le paramètre _includePreviewVersions: true_, comme détaillé ci-dessous: 
```yaml
- task: UseDotNet@2
  displayName: 'Use .NET Core sdk'
  inputs:
    packageType: sdk
    version: 7.x
    includePreviewVersions: true
    installationPath: $(Agent.ToolsDirectory)/dotnet
```
C'est gagné !
[Dica rápida de CDI] - Observando o início
Tags: java, cdi, javaee, jakartaee
Published: 2022-08-30 11:11:00

As vezes precisamos executar alguns comandos quando nossa aplicação é iniciada, portanto quem usa algum framework moderno consegue saber quando sua app subiu e com o CDI não é diferente.

CDI contém uma funcionalidade de ajuda na implementação do padrão de projeto Observer.

A Própria especificação usa esse padrão em suas rotinas internas, vamos usar umas dessas chamadas para observarmos quando o CDI for carregado ao levantar o servidor de aplicação, com o código abaixo fica fácil:

```java
@ApplicationScoped
public class StartSchedule {

	public void init(@Observes @Initialized(ApplicationScoped.class) Object init) {
		
		System.out.println("CDI Iniciado");
	}
 
    public void destroy(@Observes @Destroyed(ApplicationScoped.class) Object init) {

    	System.out.println("CDI Finalizado");
    }
}
```

Pronto agora podemos fazer alguma ação pois o contexto do CDI foi levantado e podemos usar todo o seu poder.

### Cuidados

Quando usamos o método acima para observar a inicialização do CDI outros passos da inicialização só iram continuar após a conclusão deste ou seja o uso errado pode atrapalhar a inicialização completa da sua APP.

Podemos diminuir um pouco esse efeito se colocarmos toda a implementação de negócio para ser executada em outra thread, como no exemplo abaixo:

```java
....

public void init(@Observes @Initialized(ApplicationScoped.class) Object init) {

		new Thread(new Runnable() {
		    @Override
		    public void run(){
		        System.out.println("CDI Iniciado");
		    }
		}).start();
		
	}
...
```

### Conclusão
CDI é uma poderosa ferramenta para ajudar na produtividade do desenvolvimento de soluções usando JavaEE/[JarkataEE](https://jakarta.ee/) , essa é apenas uma das diversas funcionalidades que o CDI pode oferecer.