teleren/devto huggingface dataset:
npm i -g firebase-tools leads to …firebase.ps1 cannot be loaded because running scripts is disabled on this system
Tags: firebase
Published: 2023-08-30 18:54:02

---
title: npm i -g firebase-tools leads to …firebase.ps1 cannot be loaded because running scripts is disabled on this system
published: true
date: 2023-06-17 18:30:00 UTC
tags: Firebase
canonical_url: http://www.codetolive.in//firebase/npm-i-g-firebase-tools-leads-to-firebase-ps1-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system/
---

The error is due to Windows blocking access to run the firebase.ps1 powershell scripts. You can try the below commands to solve the issue,

**_Code:_**

```
Solution 1:
Set-ExecutionPolicy RemoteSigned

For current users,
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Solution 2:
npm cache clean --force

Solution 3:
C:\Users{username}\AppData\Roaming\npm\firebase.ps1
You can delete this file and try again.

```

RemoteSigned: This requires that all scripts and configuration files downloaded from the Internet are signed by a trusted publisher. The default execution policy for Windows server computers.
Serial DispatchQueue | sync & async explained | Swift
Tags: ios, swift, mobile, deadlock
Published: 2023-06-17 16:46:52

Doc: [DispatchQueue](https://developer.apple.com/documentation/dispatch/dispatchqueue)

The serial queue process a block of object one at a time. There will be an order of execution for serial queues.

## Case 1
```swift
let serial = DispatchQueue(label: "first")

serial.sync {
    print("1")
    
    serial.sync {
        print("2")
    }
    
    print("3")
}
```

Output: Error
Explanation: When we execute a block of code in serial queue with `sync` function the queue will be suspended till the block completes execution. Here in between we are trying to add new block with sync function will throw an error.
![Error Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jhib57gyd9g0rwtzub57.png)

## Case 2
```swift
let serial = DispatchQueue(label: "first")

serial.sync { // First block
    print("1")
    
    serial.async { // Second block
        print("2")
    }
    
    print("3")
}
```

Output: 1 3 2
Explanation: The after executing the first block then it will take the second block which prints the number 2. The second block is async function so it will not crash.

## Case 3

```swift
let serial = DispatchQueue(label: "first")

serial.async {
    print("1")
    
    serial.sync {
        print("2")
    }
    
    print("3")
}
```
Output: 1
Explanation: The reason for this behaviour is a deadlock that occurs due to a circular dependency between the async and sync calls on the same serial queue.

Let's break down the execution step by step:

- The async block is dispatched to the serial queue, and "1" is printed.
- Inside the async block, there is a sync block dispatched to the same serial queue.
- The sync block waits for the async block to complete before executing.
- However, the async block cannot complete because it is waiting for the sync block to complete.

This creates a circular dependency, resulting in a deadlock, where both blocks are waiting for each other to finish.

## Case 4

```swift
let serial = DispatchQueue(label: "first")

serial.async {
    print("1")
    
    serial.async {
        print("2")
    }
    
    print("3")
}
```
Output: 1 3 2
Explanation: Using the async function will not suspend the serial queue from adding new blocks. The will complete execution on the order of inserting it. There will be an order for the code to execute.
Trabalhando com Datas no Pandas
Tags: python, datascience, beginners, tutorial
Published: 2023-06-17 16:45:48

Saudações, cientistas de dados!

A biblioteca Pandas do Python facilita a manipulação de datas em análises de dados. Com o Pandas, você pode transformar datas em formatos legíveis e extrair informações úteis. 

Vejamos alguns exemplos:

Transformar data e hora para data:

```
import pandas as pd

data_hora = '2022-05-15 14:30:00'
data = pd.to_datetime(data_hora).date()

print(data)
```

Extração de ano, mês e trimestre:

```
ano = data.year
mes = data.month
trimestre = data.quarter

print(f"Ano: {ano}, Mês: {mes}, Trimestre: {trimestre}")
```

Conversão de formato personalizado:

```
data_formatada = data.strftime('%d/%m/%Y')

print(data_formatada)
```

Avançando uma data:

```
data = pd.to_datetime('2022-05-15')
data_avancada = data + pd.DateOffset(days=2)

print(data_avancada.date())
```

Retrocedendo uma data:

```
data = pd.to_datetime('2022-05-15')
data_retrocida = data - pd.DateOffset(days=2)

print(data_retrocida.date())
```

Encontrando a diferença entre duas datas:

```
data1 = pd.to_datetime('2022-05-15')
data2 = pd.to_datetime('2022-05-20')

diferenca = (data2 - data1).days

print(diferenca)
```

Com a biblioteca Pandas, você pode realizar diversas outras operações com datas, como cálculos de diferenças entre datas, filtragem por período e agrupamento por intervalos de tempo.

Se você tiver mais dúvidas ou precisar de mais informações, estou aqui para ajudar!
Generate better response from AI Language Models (ChatGPT, Google BARD) as a Web3 or Blockchain Developer. Step by step guide.
Published: 2023-06-17 16:31:11

The 6 Steps we have to keep in mind.
```
1. Context
2. A Specific goal 
3. A specific format 
4. Breaking down into smaller parts 
5. Assign smaller tasks 
6. Providing 
```
Explaining them in a step-by-step way:
`Context:` Giving the AI model clear and pertinent context aids in its understanding of the particular issue or subject you want assistance with. The model can better personalise its answer to your needs the more background information you offer.

`A Specific Goal:` Clearly state your goal for the talk or what you hope to accomplish. Having a clear objective aids the AI model in producing solutions that are pertinent and laser-focused.

`A Specific Format:` Indicate the structure or format you like for the response. Mentioning the preferred style, for instance, if you want a step-by-step tutorial, a concise summary, or a comparison of several possibilities, aids the model in producing a more appropriate response.

`Breaking Down into Smaller Parts:` Consider dividing a big activity or topic into smaller, more manageable components. This enables the model to address each component independently and offer more thorough and precise replies.

`Assigning Smaller Tasks:` Divide the task into tiny sub-tasks rather than giving the model a massive request. The model can handle each sub-task well and deliver more precise and focused replies with the aid of this strategy.

`Providing Examples:` Giving particular examples that are connected to your question might help the model grasp it better. The model may provide replies that match the patterns and features given by using examples as reference points.

Follow for more. Feel free to [connect](https://linktr.ee/heysourin) :)
SvelteKit + Tailwindcss : Starter Template
Tags: svelte, sveltekit, typescript, tailwindcss
Published: 2023-06-17 16:18:12

Commands to create basic project structure 
```bash
npm create svelte
#Type Name of your App
#Select Svelte Kit
#Select Typescript
#Select Skeleton Project
```

```ts
// file : src/routes/+layout.ts
export const prerender = true;
```
Introduction To OOP
Tags: python, oop, programming, tutorial
Published: 2023-06-17 16:15:17

### **Object Oriented Programming (OOP)**
💡 Object Oriented Programming (OOP) is a programming paradigm that structures software design around objects, hence the name 'object oriented'. The term 'programming paradigm' refers to an approach or style used to solve problems and write solutions in code. Other paradigms include imperative, functional, declarative, and logic programming. In OOP, code is written based on objects that respond to messages by performing actions, and these objects have their own state or attributes. This differs from the line-by-line command style of imperative programming. A 'class' in OOP is a blueprint for creating objects. It defines the state and behavior of an object, and the same blueprint can be used to create multiple instances of the object. Objects in OOP can be thought of as Legos that interact with each other to perform complex functionalities, providing a structure for the program. Programming paradigms are not mutually exclusive. It is possible, and often beneficial, to use a combination of paradigms, such as OOP and imperative programming, within the same program.

## **Advantages of OOP**
OOP allows for the creation of 'blueprints' or classes that function as modules, independent from other parts of the program. This isolation enables easy changes to specific code sections without impacting the overall program.

🔄 The **reusability** of these blueprints or classes across different projects allows for faster and lower cost development, saving resources and time that would otherwise be spent rewriting code.
➕ **Extensibility** is another advantage of OOP; objects can be extended to include new attributes and behaviors, enabling easy addition of new functionalities.
💼 **Modularity** in OOP helps in easier maintenance of the code, as changes can be made to specific modules without requiring large-scale alterations.

OOP helps in creating higher quality software as more resources can be allocated for testing. Each class or 'blueprint' has its own components, making it easier to find and fix bugs by adjusting the blueprint itself. Consider the impacts of these advantages (modularity, extensibility, and reusability) on large-scale projects, you can highlight how they result in improved software development productivity.
NAT GATEWAY IMPLEMENTATION ON AWS CLOUD
Tags: aws, awsnetworking, networkspeciality
Published: 2023-06-17 16:13:03

NAT GATEWAY 
A NAT gateway is a Network Address Translation (NAT) service in AWS that allows instances in a private subnet to access the internet but prevents inbound traffic from accessing the internal instance.

ADVANTAGES OF NAT-GW 
1. It enhances security for private networks by keeping internal addressing private from the external network.
2. A NAT gateway supports 5 Gbps of bandwidth and automatically scales up to 45 Gbps.
3. It is AWS managed service that has higher bandwidth, better availability, and no admin work required.

Conditions for NAT-GW Implementation
 
a. NAT is created in a specific availability zone using an elastic IP address (EIP). Note that NAT GW does not support inter-AZ. That is , you cannot create instances in different AZs communicating with each other via NAT GW.
 
b. For a NAT GW to be created, there must be an existing internet gateway attached to the public VPC where you want to create your NAT GW.
 
c. NAT GW only works within the VPC; separate subnets should be created for private and public subnets within the same VPC.

d. A NAT GW is created inside the public subnet, but the default route is added on the private network using the NAT GW to access the internet.

 STEPS TO SET UP NAT GW
a. Create the NAT GW in the public subnet.

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

b. Add a default route pointing to the NAT-GW on the private subnet.

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


c. SSH into the public EC2 instance and import key pairs for the private EC2 instance created.

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

d. Give permission to  the private EC2 keypair.

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




e. SSH from the public instance to the private instance.

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

f. login Successfully to the private instance and ping any websites on internet

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


Thanks for your time
Criando consultas SQL no Jupyter Notebook
Tags: python, tutorial, sql, datascience
Published: 2023-06-17 16:05:04

Saudações, cientistas de dados!

Com a biblioteca JupySQL podemos executar consultas diretamente no Jupyter Notebook, facilitando a análise de dados utilizando a linguagem SQL. 

Neste artigo, vamos explorar como utilizar a biblioteca JupySQL para criar consultas de maneira simples e eficiente.

**Instalação:**

O JupySQL é compatível com diversos bancos de dados e data warehouses. No nosso exemplo vamos usar o DuckDB. 

Instale a biblioteca executando o seguinte comando:

```
!pip install jupysql duckdb-engine
```
**Importando:**

Após a instalação, importe a biblioteca JupySQL em seu Jupyter Notebook:

```
%load_ext sql
```
**Baixando dados de exemplo:**

```
from pathlib import Path
from urllib.request import urlretrieve

if not Path("penguins.csv").is_file():
    urlretrieve(
        "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/penguins.csv",
        "penguins.csv",
    )
```

Iniciando o banco de dados na memória do DuckDB:

```
%sql duckdb://
```

**Executando Consultas**

Para uma consulta curta e simples, inicie o código com: _%sql_

```
%sql SELECT * FROM penguins.csv LIMIT 3
```
Para consultas mais longas use: _%%sql_

```
%%sql
SELECT *
FROM penguins.csv
WHERE bill_length_mm > 40
LIMIT 3
```
**Integrando com o Pandas**

```
resultado = %sql SELECT * FROM penguins.csv
```

```
*  duckdb://
Done.
```

```
df = resultado.DataFrame()
```

```
df.head()
```

Experimente e explore mais recursos dessa biblioteca para aprimorar suas habilidades em SQL e análise de dados.

**Referências:**

- https://jupysql.ploomber.io/en/latest/quick-start.html
PROJETO ROBÓTICA - Piano Arduino
Tags: robotics, arduino, ti, ctrlplay
Published: 2023-06-17 15:45:16

```
void setup()
{
  pinMode(3, OUTPUT);
  
  pinMode(4, INPUT);
  pinMode(5, INPUT);
  pinMode(6, INPUT);
  pinMode(7, INPUT);
  pinMode(8, INPUT);
  pinMode(9, INPUT);
  pinMode(12, INPUT);
  
  Serial.begin(9600);
}

void loop()
{
  if (digitalRead(4) == HIGH) {
    tone(3, 523, 200); // play tone 131 (B10 = 31609 Hz)
    Serial.println("Si");
  }
  else if (digitalRead(5) == HIGH) {
    tone(3, 440, 200); // play tone 129 (A10 = 28160 Hz)
    Serial.println("La");
  }
  else if (digitalRead(6) == HIGH) {
    tone(3, 392, 200); // play tone 127 (G10 = 25088 Hz)
    Serial.println("Sol");
  }
  else if (digitalRead(7) == HIGH) {
    tone(3, 349, 200); // play tone 125 (F10 = 22351 Hz)
    Serial.println("Fa");
  }
  else if (digitalRead(8) == HIGH) {
    tone(3, 329, 200); // play tone 124 (E10 = 21096 Hz)
    Serial.println("Mi");
  }
  else if (digitalRead(9) == HIGH) {
    tone(3, 294, 200); // play tone 122 (D10 = 18795 Hz)
    Serial.println("Re");
  }
  else if (digitalRead(12) == HIGH) {
    tone(3, 261, 200); // play tone 120 (C10 = 16744 Hz)
    Serial.println("Do");
  }
  else{
    noTone(3);
  }
  
}

```
Projeto de robótica realizado pela turma da escola Ctrl Play. A ideia é fazer um piano (semelhante ao real) so que utilizando arduino + alguns componentes como: botões, buzzer e resistores;

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3q4oetgximdo9y85tpcc.png)
DEV Showcase v5
Tags: showdev, codenewbie, watercooler, discuss
Published: 2023-06-17 15:45:00

Welcome back to the DEV Showcase - a weekly thread where you can share what you've been working on and get feedback and encouragement from the DEV community.

This is your chance to show off your latest project, share a cool hack or technique you've learned, or ask for advice and feedback from other developers. Whether you're a seasoned developer or just starting out, this is the place to connect with others and get inspired.

Here are a few questions to think about if you're stuck:

- What have you been working on lately?
- What tools or resources have you found helpful?
- Have you learned any new skills or techniques recently?
- What challenges have you faced, and how can the community help you overcome them?
- What are your goals for your project or your career moving forward?

Remember, this isn't a competition or a challenge - it's just a space to share and connect with others. So don't be shy! Share your work and get feedback and encouragement from the DEV community.

We're excited to see what you've been working on, and to support you as you continue to grow and develop your skills.
Weekly AI News and Discussion Thread
Tags: ai, discuss, news
Published: 2023-06-17 15:30:00

Hey everyone, the past few months have been pretty electric in terms of advancements in AI and actual/imagined changes to our workflow and industry.

This is a new regular open thread everyone is encouraged to share...

* Notable news in the field of AI
* Personal experiences and insights
* Concerns and fears
* Success stories and demos
* And any other related discussions you'd like to bring to the table

This thread will go out every week.
Simplifying Web Application Middleware with Flowcharts
Tags: webdev, node, api, javascript
Published: 2023-06-17 15:28:56






Web application middleware plays a crucial role in enhancing security and enabling various functionalities. Two commonly used middleware components are authentication and Cross-Origin Resource Sharing (CORS) middleware. In this blog post, we will explore how to visualize the flow of these middleware components using flowcharts, providing a clear understanding of the process. We will use the popular Mermaid syntax to create the flowcharts.

Understanding the Flowchart Components:




Start: The starting point of the flowchart.

Nodes: Represent specific steps or actions in the middleware process.

Arrows: Indicate the flow of the process from one step to another.
Decision Points: Represent conditional branches in the flow.

End: The final point of the flowchart.

![Middleware Flowchart](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9fzr117mubzj7wabgday.png)

Step 1: Receiving the Request:
At the start of the flowchart, the web server receives a request from the client.
This step serves as the entry point for the middleware process.


Step 2: Applying Authentication Middleware:

The received request is passed through the authentication middleware.
The authentication middleware validates the user's credentials and determines if the request is authenticated.
If the request is authenticated, the flow continues to the next step. Otherwise, an error response may be sent back to the client.
Step 3: Applying CORS Middleware:

After authentication, the request proceeds to the CORS middleware component.
The CORS middleware checks the request headers for CORS-related information.
Based on the CORS headers, the middleware determines whether the request is valid or not.

Step 4: Checking CORS Headers:

If the CORS headers are valid, the flow proceeds to respond with the requested resource.
However, if the CORS headers are invalid, an error response indicating a CORS issue is sent back to the client.

Step 5: Handling Error (Optional):

If an error occurs during the middleware process, such as a CORS error, an error-handling step is triggered.
The error-handling step determines whether to report the error or handle it internally.
If the error is reported, the client can send an error report to the server.
The server responds with an error handling response, which may provide additional information or guidance.

Step 6: Finalizing the Process:

After error handling or responding with the requested resource, the flow reaches its end.
The middleware process is completed, and the server can proceed with further actions, if necessary.
Blog Application Nodejs
Tags: node, javascript, mysql, express
Published: 2023-06-17 15:10:21

The Blogging Platform is a web application that allows users to create, manage, and publish their own blog posts. It provides a user-friendly interface for writing and organizing blog content, as well as features for user authentication, comment management, and blog customization.

**Key Features**
- User Registration and Login Authentication
- Blog Creation and Management
- Blog List and Sorting
- Blog Comment Management
- Dashboard

**User Registration and Login Authentication**
Users can sign up for an account and log in to the platform using their credentials.

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



**Blog Creation and Management**
Authenticated users can create new blog posts, edit existing posts, and delete unwanted posts. The platform provides a rich text editor for easy content creation, allowing users to format text, add images, and include other media.

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



**Blog List and Sorting**
The platform displays a list of blog posts, ordered by the latest date. Users can browse through the blog list to discover and read the most recent posts.

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



**Blog Comment Management**
Users can leave comments on blog posts to engage in discussions. They can also edit and delete their own comments. The comments are displayed below each blog post, showing the user's name, comment content, and the timestamp of the comment.

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



**Dashboard**
Authenticated users have access to a dashboard that provides an overview of their blog activity. The dashboard includes statistics on blog views, comments, and engagement.

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



Check out the full project here on Github: https://github.com/erajamanickam/blog-application-nodejs

Watch on video : https://youtu.be/VwKQA4Bs6P0
Introducing PromptAppGPT: A rapid prompt app development framework based on GPT
Tags: openai, chatgpt, lowcode, ai
Published: 2023-06-17 14:56:09

Hi all! We're rolling out **a rapid prompt app development framework - PromptAppGPT.**

PromptAppGPT is a low-code prompt-based rapid app development framework. PromptAppGPT contains features such as low-code prompt-based development, GPT text generation, DALLE image generation, online prompt editer+compiler+runer, automatic user interface generation, support for plug-in extensions, etc. PromptAppGPT aims to enable natural language app development based on GPT.

**PromptAppGPT significantly lowers the barrier to GPT application development, allowing anyone to implement their own AutoGPT-like application with 70 lines of low code.**


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

**You are wellcome to:**
1. Join us to collaboratively develop the framework: https://github.com/mleoking/PromptAppGPT/
2. Visit the website to try the framework: https://promptappgpt.wangzhishi.net/
3. See the example apps including the 70-line low-code implementation of the AutoGPT-like AI auto-assistant: https://github.com/mleoking/PromptAppGPT/blob/main/PagApps.md#my-autogpt

Here is the running results of the My AutoGPT app based on the PromptAppGPT framework:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j9j22sqiubsemlu29yyw.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ocb3z2yf8i8l2umekdmb.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6mbssicfkrt8xakjnraj.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uctizb78aibbqjo3qgxl.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qdhnm6nbo0jwurbzxuq5.png)