teleren/devto huggingface dataset:
How to combine two dictionaries in python using different methods
Tags: python, programming, tutorial, beginners
Published: 2023-03-05 07:55:53

[Python Dictionary](https://www.programdoc.com/python/dictionaries) is a data structure that used to store elements in key-value pairs. Unlike python list values in the dictionary are retrieved or stored using the key. Dictionary is declared using the curly braces {} and the key value pair separated by : colon.


## combine two dictionaries using python for loop
```py
mydict1 = {
    "car": 5,
    "bus": 3,
    "bike": 10
}

mydict2 = {
    "cycle": 4,
    "truck": 8,
    "car": 6
}

for key in mydict2:
    mydict1[key] = mydict2[key]
    
print("mydict1:", mydict1)

Output:
mydict1: {'car': 6, 'bus': 3, 'bike': 10, 'cycle': 4, 'truck': 8}
```
key car exists in both variable, we doing the merge operation if the key is not in the first mydict1 variable, it will add a new key value pair, if the key already exist in the dict it will update the value of the key.

This above example is a normal dictionaries merge example using loop, python have some inbuild features we can make use of it without doing for loop to combine dictionaries.

## Dictionary Merge Operator
Using merge operator(|) it is easy to do the dictionary merge, its available from python 3.9

```py
mydict1 = {
    "car": 5,
    "bus": 3,
    "bike": 10
}

mydict2 = {
    "cycle": 4,
    "truck": 8,
    "car": 6
}

print(mydict1 | mydict2)

Output:
{'car': 6, 'bus': 3, 'bike': 10, 'cycle': 4, 'truck': 8}
```

## Merging Dictionaries Using ** Operator
This operator is used to pack and unpacking arguments, we can use the unpacking operator to merge two dictionaries

```py
mydict1 = {
    "car": 5,
    "bus": 3,
    "bike": 10
}

mydict2 = {
    "cycle": 4,
    "truck": 8,
    "car": 6
}

print({**mydict1, **mydict2})

Output:
{'car': 6, 'bus': 3, 'bike': 10, 'cycle': 4, 'truck': 8}
```

## Merging Dictionaries Using the update() Method
Python have a inbuild method called update which is used to merge or add one dictionary to another

```py
mydict1 = {
    "car": 5,
    "bus": 3,
    "bike": 10
}

mydict2 = {
    "cycle": 4,
    "truck": 8,
    "car": 6
}

mydict1.update(mydict2)
print(mydict1)

Output:
{'car': 6, 'bus': 3, 'bike': 10, 'cycle': 4, 'truck': 8}
```
Using unpacking operator(**) and merge operator(|) only return the value where as here using the update method will update the values to the targeted variable.



### Explore Other Related Articles
[How to check if a key exists in a dictionary python](https://dev.to/max24816/how-to-check-if-a-key-exists-in-a-dictionary-python-132i)
[Python try exception tutorial](https://dev.to/max24816/python-try-exception-tutorial-2nlp)
[Python classes and objects tutorial](https://dev.to/max24816/python-class-and-objects-21k6)
[Python Recursion Function Tutorial](https://dev.to/max24816/python-recursion-function-tutorial-3jmo)
[Python Lambda Function Tutorial](https://dev.to/max24816/python-lambda-function-tutorial-1o30)
[Python If, If-Else Statements Tutorial](https://dev.to/max24816/python-if-if-else-statements-tutorial-2g4k)
Red Boost Powder - Blood Sugar Reviews, Benefits, Complaints & Warnings?
Tags: javascript, webdev, beginners, programming
Published: 2023-03-05 07:38:57

Red Boost Powder As it is not really feasible to anticipate diabetics to never indulge, techniques going in order to times it raises your blood sugar info sugar way too high. If you end up in worse yet of being around associated with money food, just be sure to focus your compulsion to overeat on less harmful foods. A person are know you have to want dessert, make plans by before it with https://www.outlookindia.com/outlook-spotlight/red-boost-reviews-blood-flow-support-powder-critical-news-2023-don-t-miss-redboost-tonic-update--news-260115
https://redboostpowder.blogspot.com/2023/03/blog-post.html
https://www.facebook.com/events/801659631532799/
https://www.scoop.it/topic/red-boost-powder-by-red-boost-powder-9 
https://twitter.com/BoostPowder 
https://www.crunchbase.com/organization/red-boost-powder
https://www.crunchbase.com/event/red-boost-powder-0c1a
https://medium.com/@BoostPowder/red-boost-powder-blood-sugar-results-price-ingredients-scam-or-legit-5aea3db8f26d
https://techplanet.today/post/red-boost-powder-blood-sugar-benefits-uses-price-customer-reviews
Căn hộ 9X Hưng Thịnh
Published: 2023-03-05 07:29:44

Nối dài triết lý của Hưng Thịnh “Bất động sản giá trị thực, nhu cầu thực”, Chuỗi căn hộ 9X Hưng Thịnh, dòng căn hộ dành cho thế hệ 9X với mức giá phù hợp. Căn hộ 9X Hưng Thịnh hướng đến một cuộc sống an cư dễ dàng hơn cho những người trẻ. Để ngôi nhà không chỉ là nơi để trở về mà còn khắc họa “dấu ấn tự do, hạnh phúc, gắn kết của cộng đồng cư dân 9X. Một số căn hộ điển hình: 9X Quy Nhơn, [9X An Sương](https://canho9x.net/9x-an-suong/). Website: [https://canho9x.net/9x-an-suong/](https://canho9x.net/9x-an-suong/)

**Liên Hệ Chúng Tôi:**

Địa Chỉ: 53 Trần Quốc Thảo, Võ Thị Sáu, Quận 3, Thành phố Hồ Chí Minh
Hotline: 0905753286
Website: [https://canho9x.net/](https://canho9x.net/)
Twitter: [https://twitter.com/canho9xvn/](https://twitter.com/canho9xvn/)
Linkedin: [https://www.linkedin.com/in/canho9x/](https://www.linkedin.com/in/canho9x/)
Instagram: [https://www.instagram.com/canho9x/](https://www.instagram.com/canho9x/)
Printerest: [https://www.pinterest.com/canho9xvn/](https://www.pinterest.com/canho9xvn/)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mkkx7rgv5m9x6bwj47hm.jpg)
Node.js boilerplate / Authentication from scratch - (express, mongodb) Rest-API, Typescript.
Tags: typescript, javascript, boilerplate, node
Published: 2023-03-05 07:27:22

A boilerplate for Node.js apps / Rest API / Authentication from scratch - express, mongodb (mongoose). Typescript

[https://github.com/watscho/express-mongodb-rest-api-boilerplate](https://github.com/watscho/express-mongodb-rest-api-boilerplate)
Introduction to AWS
Tags: aws, cloud, beginners
Published: 2023-03-05 07:14:08

AWS, or Amazon Web Services, is a cloud computing platform that offers a wide range of services to help businesses and individuals build and run applications on the cloud. AWS is one of the most popular cloud computing platforms in the world and is widely used by businesses of all sizes. In this article, we will provide an introduction to AWS and some of its most popular services.

## What is AWS?

AWS is a cloud computing platform that provides on-demand access to a wide range of computing resources such as computing power, storage, and databases. It was launched by Amazon in 2006 and has since grown to become the world's largest cloud computing platform. AWS provides a wide range of services that allow businesses to build, deploy, and manage applications on the cloud.

## Benefits of AWS

One of the biggest benefits of AWS is its scalability. AWS allows businesses to scale their computing resources up or down based on their needs. This means that businesses can quickly and easily add or remove computing resources as their needs change.

Another benefit of AWS is its reliability. AWS provides a highly reliable infrastructure that is designed to be fault-tolerant and highly available. This means that businesses can rely on AWS to keep their applications running smoothly even in the face of hardware or software failures.

AWS also offers a wide range of security features that help businesses protect their applications and data. AWS uses advanced security measures such as encryption, identity and access management, and network firewalls to keep applications and data secure.

## Popular AWS Services

AWS offers a wide range of services that can be used to build and run applications on the cloud. Some of the most popular AWS services include:

### Amazon Elastic Compute Cloud (EC2)
This service provides virtual servers that can be used to run applications on the cloud. EC2 allows businesses to quickly and easily create, configure, and manage virtual servers.

### Amazon Simple Storage Service (S3)
This service provides scalable storage for data on the cloud. S3 allows businesses to store and retrieve data from anywhere in the world.

### Amazon Relational Database Service (RDS)
This service provides managed databases on the cloud. RDS allows businesses to quickly and easily set up, operate, and scale databases on the cloud.

###Amazon Lambda
This service provides serverless computing on the cloud. Lambda allows businesses to run code without the need for a server or virtual machine.

Amazon API Gateway – This service provides a managed service to create, publish, and manage APIs at any scale.

## Conclusion

AWS is a powerful cloud computing platform that provides businesses with the ability to build, deploy, and manage applications on the cloud. With its scalability, reliability, and security features, AWS is a great choice for businesses of all sizes that are looking to take advantage of the benefits of cloud computing.
API Errors
Published: 2023-03-05 06:34:06

Here are some common API errors that you should be aware of when working with APIs:
**400 Bad Request** - This error is typically returned when the client has made a request that the server is unable to process. This can occur if the request is missing required parameters or if the parameters are formatted incorrectly.

**401 Unauthorized** - This error occurs when the client attempts to access an API endpoint without the necessary authentication credentials.

**403 Forbidden** - This error occurs when the client has authenticated successfully but is not authorized to access the requested resource.

**404 Not Found** - This error occurs when the requested resource is not available on the server.

**405 Method Not Allowed** - This error occurs when the client attempts to use an HTTP method that is not allowed for the requested resource.

**500 Internal Server Error** - This error is typically returned when the server encounters an unexpected error while processing the request.

**503 Service Unavailable** - This error is typically returned when the server is unable to handle the request due to high traffic or maintenance.
Data type turlari va char tipi
Published: 2023-03-05 05:52:13

Bugun sizlar bilan data type turlari bilan tanishamiz . 
Biz data type larni biror bir variables qo'yishdan oldin ishlatatmiz . 

Paython da biz variables berganda tipini yozsak ham yozmasak ham bo'lardi ammo c ++ da variables berishdan oldin uni tipini aytib o'tish shart . 

Bu qoida barcha kutibxonalarda ishlaydi . 

bu tiplarga kiruvchilar :

int - integer .  - butun sonlar uchun . 
str - string .  - matn tipidagi barcha narsalar uchun . 
float - kasr sonlar uchun . 
char - biz char ni bitta harf yoki sonlar qo'yishda ishlatamiz u o'zida bitta belgi saqlaydi . char tipi bo'yicha narsalarni 
ACII table jadvalidan ham foydalanib ishlatishimiz mumkin .
Switching from React to Svelte: Why it's Time to Make the Move
Tags: abotwrotethis
Published: 2023-03-05 05:11:22

Good morning, fellow developers! Today, I want to talk to you about an important topic that's been on my mind for a while now: why it's time to switch from React to Svelte.

Now, I know that many of you are probably comfortable with React. After all, it's been a popular choice for front-end development for years. But hear me out. Svelte is a newer, more modern approach to web development that offers some key advantages over React.

Firstly, Svelte is much faster than React. Svelte compiles your code into highly optimized vanilla JavaScript, resulting in much smaller bundle sizes and faster load times. This means that your applications will be snappier and more responsive, providing a better user experience for your users.

Secondly, Svelte is much easier to learn and use than React. With React, you need to learn a whole ecosystem of tools and libraries just to get started, which can be overwhelming for beginners. Svelte, on the other hand, has a much simpler and more intuitive syntax, making it easier to get up and running quickly.

But it's not just about ease of use and performance. Svelte also offers some unique features that are not available in React. For example, Svelte's reactive programming model allows you to write code that is both more concise and more expressive than in React. Svelte also offers powerful animations and transitions out of the box, which can make your applications feel more polished and professional.

Now, I know that switching from React to Svelte can seem like a daunting task. But trust me, it's worth it. With Svelte, you'll be able to build faster, more responsive applications with less code and less hassle. And as an added bonus, you'll be learning a cutting-edge technology that is quickly gaining popularity in the web development community.

So let's take the plunge and switch from React to Svelte. Your users (and your sanity) will thank you for it. Happy coding!
float va int
Published: 2023-03-05 05:07:12

float - yani kasr son.
float integerdan farqli bo'lib,kasr sonlarni qabul qiladi.
integer esa faqat butun sonlarni qabul qiladi.integer tipidagi sonni integer tipidagi songa bo'lsak konsolga integer chiqadi.
lekin itegerni floatga bo'lsak float konsolga chiqadi.
Báo giá xe tải | Xe tải Hyundai | Xe tải ISUZU | Xe Mitsubishi | Xe tải HINO
Published: 2023-03-05 04:56:37

https://baogiaxetai.com Báo giá xe là một trang thông tin cung cấp giá cả xe ô tô và các thông tin liên quan đến thị trường mua bán xe ô✔️ Liên tục cập nhập✔️ báo giá xe tải✔️ giá xe Mitsubishi✔️ Hyundai✔️ KIA✔️ Hino và Isuzu kèm các chương trình khuyến mãi mới nhất✔️✔️✔️
0971957388
giaxeoto1988@gmail.com
Số 720, Nguyễn Văn Cừ, Long Biên, Hà Nội
https://www.pinterest.com/baogiaxetai/
https://www.youtube.com/@baogiaxetai/about
https://baogiaxetaicom.tumblr.com/
https://getpocket.com/@c1dg9d51pd987A39e4T6b7eT7cA1p024358p6cV858C3eDE86aN15v70o0xZe603
https://baogiaxetaicom.wordpress.com/
https://baogiaxetaicom.blogspot.com/
Set Up SSL In NodeJS API With Certbot & AWS EC2 Server
Tags: node, aws, ssl, api
Published: 2023-03-05 04:55:18



## Before you start

You have to make sure **nodejs** api cloned into **aws ec2 instance** and you already assigned a **elastic ip** to it.

## So how can we add SSL?
We are going to use **certbot** and **letsencrypt** for creating SSL certificate of our **NodeJS** server, so connect with EC2 instance & let's start with following steps

### Install Certbot on AWS EC2 linux Server
First of all run the command so that you will become the **root** user & you don't have to use the **sudo** command over & over
```sh
sudo su -
```
Now install certbot
```sh
snap install --classic certbot
```
Check the cerbot installed or not 
```sh
certbot --version
```

### Let's Request for a SSL certificate
Before applying for SSL replace the A record of your domain/subdomain with the elastic ip that assigned to the EC2 instance 
```sh
certbot certonly --standalone -d domain-or-subdomain.in
```

### Let's use these generated SSL certificates 
Now open the main file where you start the server & modify
```js
const fs = require('fs');
const https = require('https');
const express = require('express');

const app = express()

const options = {
  cert: fs.readFileSync('/etc/letsencrypt/live/domain-or-subdomain.in/fullchain.pem'),
  key: fs.readFileSync('/etc/letsencrypt/live/domain-or-subdomain.in/privkey.pem')
};

https.createServer(options, app).listen(443);
``` 

Now our Node server can handle https requests
Buy custom domains with Azure for your App Service.
Tags: azure, networking
Published: 2023-03-05 04:36:14

---
title: Buy custom domains with Azure for your App Service.
published: true
description: 
tags: #azure #networking
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-03-05 03:30 +0000
---

If you googled how to buy a domain name on Azure, you might get answers saying that Azure doesn't provide domain name registrar, like [the following answer](https://learn.microsoft.com/en-us/answers/questions/10805/use-azure-as-a-domain-registrar-for-a-domain-curre?orderby=helpful), or [the following discussion](https://feedback.azure.com/d365community/idea/9e9f97ea-8526-ec11-b6e6-000d3a4f0789).  
Not even those answers, even the book [Exam Ref AZ-900](https://www.microsoftpressstore.com/store/exam-ref-az-900-microsoft-azure-fundamentals-9780137955145) which is a Microsoft book says the following about `Azure DNS Zone`:  
> If you want to purchase your own domain name, you go to a domain registrar, and they register the domain to you. ....  
  

The book didn't mention a way to buy your domain from Azure itself.  
I struggled with that myself, and bought my domain with a third party provider. But it turned out Azure provide this service already.  
This is why I hope you will come to my post and find the answer you are looking for.  

## Custom domains with App Service Domain Service:

To buy a custom domain through Azure, you need to create an **`App Service Domain`** resource in Azure.  
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qqcugjwb9nkq930i7aje.jpg)
When you create the resource, you will enter the domain name you want, and Azure will find out if you can use it or not.  

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

Right now, as I am writing this post, only these `Top Level Domain` (TLD) are available through Azure:  
* .com
* .net
* .co.uk
* .org
* .nl
* .in
* .biz
* .org.uk
* col.in

## Why you need to buy from Azure?
The obvious answer to this question, is you have one place to manage your site content, and its domain name and its SSL certificate.  
But beside that, Azure is **cheeeeeap**. The pricing right now is only $11 US dollar for the whole year.  
I don't know what you are using for as your domain provider, but I am using GoDaddy, and I am paying for the domain and SSL certificate $10/month.  
And on top of that the SSL certificate is free (if you are using standard domain like www.somesite.com). You have to pay for wildcard certificates.
React.JS components, props & state
Tags: react, javascript, webdev, beginners
Published: 2023-03-05 03:43:32

Components, props & states, those three are the basis of react.js, and are on our daily tasks and walk throught us, react devs, align these 3 pieces to make the bread, in this article, we’ll get in deeper until the bone.

Components 

The components are the pieces of coding that allows to build APP'S, in short without redundancies, the components are the pieces of the puzzle that allow us to make the UI in a shorter time frame, also this is the very esasiest way cause in a vanilla delelopments the code can be confused.

components are functions that returns pieces of the UI, in a jsx sintax that will be transpileda along with the functionallity, also the components has a life-cicle wich is very easy to understand,the react,js creates a virtual dom that is a copy of the DOM, the DOM three is all those html elements on the app, now the life-cicle steps are:

-Instantiation: The component is created and initialized with its initial state and properties.

-Mounting: The component is added to the virtual DOM or real DOM and rendered on the screen.

-Updating: When the component's state or props change, the component re-renders to reflect the changes.

-Unmounting: The component is removed from the virtual DOM or real DOM and destroyed.

keep this on mind please cause some errors can be avided having this info while you're developing an APP.

![component-example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k5zloowzm5uku1dsq3t3.png)

This is an example of a component, that is handling a title it should be called in an app title fragment and also it is the react.js philosophy to make the development and management easy for us.

![layout-example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h9hswhrpdd4gxw7ixfui.jpg)

This is a layout as you can see, the app is composed by 4 components that allow us to make each of these independet in between, and also we can make each of them share information but we have to take care cause there are some anti-patterns that will cover into another articles.

Props:

There is something called PROPS that can be confused with STATE but what is it?, the props are properties wherever it is (booleans, numbers, string even functions, etc.), those props are just properties that cannot be modified cause the root is a static information none as states, props are immutable. 

State:

The state is a piece in the memory that works as a very small info repo, we can explain it as a box that should have a non-mandatory-typo, but it have should be specified(as an object, string, number, or boolean, etc) this can be muted and modified by other components that manage some info in between them.

please feel free to reply if any misinformation is found or missing information has to be added or info needs to be modified
Building a Q&A Bot with GPT
Tags: gpt, opensource, llms, ai
Published: 2023-03-30 17:07:47

---
title: Building a Q&A Bot with GPT
published: true
date: 2023-03-05 00:00:00 UTC
tags: gpt, oss, llms, ai, 
canonical_url: https://blog.brainstory.ai/building-a-qa-bot-with-gpt/
---

LLMs like GPT are trained broadly on the internet. This makes them suspectible to pulling information “out of nowhere”. LangChain is an open sourced way of combining GPT’s writing skills with existing document knowledge into a Q&A bot.

## Getting Started

In this [repo](https://github.com/hwchase17/notion-qa), there is a demo with a Notion DB as the document source. We’re going to slightly modify the intake source so that we can use this repo with a regular webpage instead of Notion.

After you configure your `OPENAI_API_KEY`, do not continue with the export and unzipping of Notion. Instead, locate the `html` of a webpage that you’d like to use. We’ll use `pandoc` and `curl` to pull down a webpage and convert it into markdown, similar to the Notion export. In `notion-qa/NotionDB`, run the following command:

```
curl --silent <html url> | pandoc --from html --to markdown_strict -o <name_of_file>.md
```

Here’s my example:

```bash
curl --silent https://www.coloradocollege.edu/offices/campusactivities/student-organizations-leadership/guidelines-for-starting-a-new-organization.html | pandoc --from html --to markdown_strict -o student_organization_handbook.md
```

Check to see that your markdown file looks correct. Once it’s there, you can continue on with the repo’s instructions: `python ingest.py`. This process takes a few minutes, depending on the file.

## Querying the results

Now you can use `python qa.py "How do I get something CCSGA certified?"` to ask the bot questions based on the handbook you ingested.

The result should look something like this:

```bash
(base) ➜ notion-qa git:(master) ✗ python qa.py "How do I get something CCSGA certified?"

Answer: To get something CCSGA certified, groups must apply to become a recognized CCSGA student organization and be classified as “Active”. The CCSGA Student Life Committee will review the application and external advisors and adult volunteers must follow the guidelines set out in the Student Organization Handbook and complete an HR background check, complete Title IX training, and the Volunteer Agreement Form.

Sources: Notion_DB/student_organization_handbook.md
```

## Cool next steps (if you’re feeling fancy)

From here, the world is your oyster! You could hook up a Twilio configuration so that you can text your bot instead of using the CLI. You could set up an Autocode integration into a Discord bot that allows anyone in your server to query a community knowledge base.

**Are you doing something boring, manual, and necessary with your content? Let us know - we’d love to help.**