teleren/devto huggingface dataset:
AWS - Lambda Hands On
Tags: aws, cloud, devops, tutorial
Published: 2021-09-01 13:30:15

To start a new lambda function follow the instructions below:

* On the dashboard in the search bar search for AWS lambda and then click on lambda
![Lambda search](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k730y9s02ada45zz6z9u.png)

* You will see a dashboard on that dashboard click on create function.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ssmc9tlprgg9bspmepll.png)

* You will see some options on how to create a function. Use the option to `Use a blueprint`
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x2l2k3eo98nec5glhqlz.png)

*  In the search type hello world and select the `hello-world-python` option.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n96oinpbzwe3zbqc1od9.png)

* The screen will appear like this and select it and click configure
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/csfspxd55fqd41zmwt1f.png)

* Give a function name and let the execution role remain the same because we don't want to use this function to access other services. 
 ![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wub60d7119e7jo79f0c.png)

* Click on create function 
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/okqexhwqxu6qo6uf146d.png)

* You wills see a first function with   a code editor 
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dtoc4ndyl3akxyii5suc.png)


* Click on test in the editor. And give it an event name
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pz096ykfsxu6zl5g21i0.png)

* Click on create after that click on test again
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nxqv6zw9gvrobek6koal.png)

 As you can see in the logs there is our event name and response as expected from the function as its returning `key1` and details of all the computation used

* We have deployed our first lambda function. Now let us see how to change the  lambda function.

* In the new function uncomment the 
`raise Exception('Something went wrong')` line and comment out `return event['key1']  # Echo back the first key value` and click on deploy
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v2cqmyixy0oebyrifo1x.png)

* Click on test again and we will see that an exception occurred and it fails.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7vnaw47u3jp4n653vzwy.png)

* If you want to change the configuration of this function you can do this in the configuration tab 
 ![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/izauwd5io4qqam354fgh.png)

* After that click on edit now you can change the memory timeout as you require for this function
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ss8jx0ugsq79e64rdkmf.png)

Let me know if anyone has any questions
🐍 Best Practices for Flask API Development
Tags: python, programming, flask
Published: 2021-09-01 13:25:49

#### 📗 Learn how to design and build #REST #APIs with #Python and #Flask following best practices.

### <br>

Python is my favorite programming language. Its adaptability, readability, and coding speed are unique and make [python a powerful choice in various projects](https://livecodestream.dev/post/what-is-python-best-for/), from data science projects to scripting and, of course, APIs.

Python is a popular choice for API development, not only because it is one of the [most loved programming languages](https://insights.stackoverflow.com/survey/2020#technology-most-loved-dreaded-and-wanted-languages), but also because of its rich ecosystem of libraries and frameworks that serve that goal, libraries with immense popularity such as [Django](https://www.djangoproject.com/), [Flask](https://flask.palletsprojects.com/), and [FastAPI](https://fastapi.tiangolo.com/).

But which framework should you use to build your APIs with Python? It’s 100% up to you, but there are important considerations to keep in mind. After all, some of these frameworks are different, even from the ideology.

- Django is an all-inclusive framework. It provides tools and modules for handling API requests, serialization, database connections, automatic admin UI generation, and so much more.
- Flask, on the contrary, is a minimalist framework, it provides only the necessary tools, but it extends its functionality with additional libraries and frameworks. The great part is, you decide exactly what you need for your project, nothing more.
- FastAPI is a relatively new framework. It makes use of newer python features such as type-hints, concurrency handling (with async), and it’s super fast.

I work a lot with Flask and FastAPI, and I love both. I love the flexibility and adaptability of these frameworks, and for today's article, we will be focusing on Flask.

The following tips and practices are the result of research and more than eight years of experience building and shipping production-grade APIs with Python:

- Design your API endpoints with proper names and HTTP verbs
- How to properly structure your application
- Build your documentation from the code
- Testing


**Let’s get started!** 🚀

[Read more...](https://auth0.com/blog/best-practices-for-flask-api-development/?utm_source=content_synd&utm_medium=sc&utm_campaign=flask)
SQL Query into Pandas DataFrame - Part 2
Tags: sql, python, datascience, sqlite
Published: 2021-09-01 12:15:31

Continuing the [last part](https://dev.to/dendihandian/sql-query-into-pandas-dataframe-part-1-1a3j), we are going deep into intermediate SQL translated into Pandas DataFrame.

## The Playground Database

We will be using the same SQLite database from the previous post, but now we will use the `invoice` table and the [csv file](https://gist.github.com/dendihandian/653d16b314c2e51be9e0062df3e2fe2b#file-invoices-csv) of the table.

## Preparing the DataFrame

```py
import pandas as pd

invoices_df = pd.read_csv("invoices.csv")
```

## Aggregation Queries into Pandas DataFrame

We will cover some aggregation function and groupby function in both sql and pandas.

### Basic Aggregation

`SUM`:

```sql
SELECT SUM(Total)
FROM invoices
```

```py
invoices_df['Total'].sum()
```

`COUNT()`:

```sql
SELECT COUNT(BillingState)
FROM invoices
```

```py
invoices_df['BillingState'].count()
```

`AVG()`:

```sql
SELECT AVG(Total)
FROM invoices
```

```py
invoices_df['Total'].mean()
```

`MAX()`:

```sql
SELECT MAX(Total)
FROM invoices
```

```py
invoices_df['Total'].max()
```

`MIN()`:

```sql
SELECT MIN(Total)
FROM invoices
```

```py
invoices_df['Total'].min()
```

### GROUP BY

```sql
SELECT 
    CustomerId,
    SUM(Total) AS Total
FROM invoices
GROUP BY CustomerId
```

```py
## grouping with all (number) columns aggregated
invoices_df.groupby(['CustomerId']).sum()

## the same as the sql result
invoices_df.groupby(['CustomerId']).sum().reset_index()[['CustomerId', 'Total']]
```

_______________

[Next Part](https://dev.to/dendihandian/sql-query-into-pandas-dataframe-part-3-fj0)
Is dev.to good for asking dev questions?
Tags: meta, discuss
Published: 2021-09-01 12:14:04

When I browse dev.to, most posts are just articles. I rarely see that questions are being asked here.

If dev.to is not good for asking questions, what is a good place to ask questions?

Of course there is StackOverflow. But that is only good for questions which have simple, clear, non-opinionated answers. I use StackOverflow quite extensively and it is great for questions which are "allowed". However, I often also have questions about recommendations and opinions, which are strictly not allowed there. But where can I ask such questions?
How to use Python to sum a list?
Tags: python, programming, beginners, tutorial
Published: 2021-09-01 12:01:51

In this short tutorial, we look at how we can use Python to find the `sum()` of a list. We look at the various methods to do this along with their limitations. 

This tutorial is a part of our initiative at [Flexiple](https://flexiple.com/), to write short curated tutorials around often used or interesting concepts.

### Table of Contents - Python Sum List
- [Using Sum to find the sum of a List](#python-sum-list)
- [How to use the sum() function?](#how-to-use-the-raw-sum-endraw-function) 
- [Limitation and Caverts - Python Sum List](#limitation-and-caveats-python-sum-list)

## Python Sum List:
While using Python, there are sure to be numerous use cases where you might have to calculate the sum of an iterable. For the purpose of this blog, we mainly focus on lists; however, the same method can be applied to other iterables as well.

An example of a use case is the use of `sum()` to return the sum of a list that contains the weekly income of employees to calculate monthly income.
  
## How to use the `sum()` function? 
The `sum()` function returns the sum of an iterable. `Sum()` takes a list (iterable) and returns the sum of the numbers within the list. 

### The syntax is as follows:
```python
sum(iterable, start) 
```

### Parameters:
- `Iterable` - Required, iterable can be a list, tuples, and dictionary
- `Start` - Optional, if passed it the value will be added returned sum

### Code and Explanation:
```python
#Using range to create list of numbers
numbers = list(range(0,10))

sum_numbers = sum(numbers)
print(sum_numbers)
#Output - 45

#Passing an argument as start
sum_numbers = sum(numbers, 10)
print(sum_numbers)
#Output - 55
```

As seen in the above code snippet, the `sum()` function is used to add the values in the range that has been specified. You can similarly use the function for various operations.

## Limitation and Caveats - Python Sum List
A common error that arises while using the `sum()` function, is when the list contains a string. Since it is not possible to add int values in strings, Python returns a `TypeError`. Let us look at such an instance.  

```python
#Creating a list of number and a string
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "10"]

sum_numbers = sum(numbers)
print(sum_numbers)
```
 
Python returns this output:
```python
Traceback (most recent call last):
  File "C:\Users\Python\Using_sum.py", line 4, in <module>
    sum_numbers = sum(numbers)
TypeError: unsupported operand type(s) for +: 'int' and 'str'
```

As explained, the int value in the string causes the `TypeError`. Other than this limitation, you can make use of the `sum()` function in Python with ease for all summing operations.
Create a Simple Linked List Using Python
Tags: beginners, python, algorithms, codenewbie
Published: 2021-09-01 12:01:28


## Step 1: Create a Node Class

Every linked list has nodes that are linked together to form a linked list. A node contains a **data** and a **link**. The link is used to store the address of the next element in the list.

Let's create a Node class in python:

```python
class Node:
    def __init__(self, data):
        self.data = data 
        self.next = None
```


## Step 2: Create a Linked List Class

A linked list class will contain the head of the linked lists and other methods like insert, delete and search.

Let's create a LinkedList class in python:

```python
class LinkedList:
    def __init__(self):
        self.head = None
```


## Step 3: Create a Linked List

In order to create a linked list, we need to create an object from the LinkedList class.

```python
LL = LinkedList()
```

Now let's create 3 nodes with values 10, 11 and 12. The first node is the head.

```python
LL.head = Node(10)
second = Node(11)
third = Node(12)
```

Link all the nodes together: **head** will point to **second** and **second** will point to **third**. The third node points to **None** which is already set.

```python
LL.head.next = second
second.next = third
```


## Step 4: Create a Method to Print the list

Let's add a printList() method to the LinkedList class. This method will take the head node and print the values while traversing the node until it reaches the end.

```python
class LinkedList:
    def __init__(self):
        self.head = None
    
    def printList(self):
        temp = self.head
        while temp:
            print(temp.data)
            temp = temp.next
```

We have to call the printList() method in order to print the linked list.

```python
LL.printList()
```


This is how the output will look:

```python
10
11
12
```

The complete python program:

```python
class Node:
    def __init__(self, data):
        self.data = data 
        self.next = None

class LinkedList:
    def __init__(self):
        self.head = None
    
    def printList(self):
        temp = self.head
        while temp:
            print(temp.data)
            temp = temp.next


LL = LinkedList()

LL.head = Node(1)
second = Node(2)
third = Node(3)

LL.head.next = second
second.next = third

LL.printList()
```


## Thanks for reading the post :smile:

---
References:
1. https://www.geeksforgeeks.org/linked-list-set-1-introduction/
A Quick 10-Second Programming Joke For Today
Tags: jokes, dailydeveloperjokes
Published: 2021-09-01 12:00:24

---
title: "A Quick 10-Second Programming Joke For Today"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1259a6b60d2.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
What's the best tool for automatically ignoring long email threads about tech buzzwords?

"Block-chain"
 -->
The Perfect Journey to Becoming a Full-stack Developer
Tags: django, developer
Published: 2021-09-01 11:58:46

The first advice I ever got from my mentor was, "never rush into frameworks". Yes, I took the advice but messed up on my first coding year. I was running from AI, mobile development to web development. I came to realize at the end that I could not create something up to the deployment process. Then, I opted to become a full-stack web developer to be a freelancer within two years.

Throughout my journey, here is the knowledge I have gathered being in the technology field. Web development grows daily, with new technologies evolving within a short period. To be a full-stack developer, you need many tools in your toolbox. Remember, it's like you are the only developer in the field, you develop the backend, frontend, database, and final deployment.

Front-end

This is exactly for beginners. Master these basics correctly. HTML5, CSS3 and JavaScript. For anyone in this category, you won’t create a full website/e-Commerce without any of the three languages. Make them your friends. Study them in-depth. Participate in open source projects to gain more knowledge from other people.

Then, jump to one frontend framework. I suggest you learn react, but it will depend on you. Choose among react, vuejs, and angular. Start working on minor projects as you move forward. Remember, we all start with small things.

Backend

Let me start with what I go to be easier. I learned Django within two months. But this was because I had recently done python to the intermediary level. Therefore, opt to choose one backend from PHP, Node.js, Django, Flask, or any other. If you want to be a full-stack JavaScript, then learn Nodejs. I would suggest you look for the pros and cons of each language.

Database

I promise you that when you learn the backend language, you will have covered 30% of database terminologies. The main ones being ‘update, delete, create’. But you might decide to learn more from the database, take a single course either on MySQL, postgreSQL, MongoDB, and master the SQL syntax.

DevOps

DevOps means development and operational functioning. You have to understand your development, of which you are the one to deploy. Remember, this project is yours alone, therefore you have to ensure you deploy the site to be used by the projected audience. Master a little knowledge on how HTTP/HTTPS, AWS, and the domain names. Ensure your site is optimized. Our website is now live, and you are a full-stack developer.

Bonus.

In addition, a responsive website has to have a good logo, with UX wings icons and clear images. Be familiar with canvas and free images sites like Pixabay. Know how to use third-party APIs, though not recommended. Learn from any source. Learn!Learn!Learn!.
Travis ci with Secure Environment variable
Published: 2021-09-01 11:54:43

Install travis

```
gem install travis
travis login --pro --github-token {GITHUBTOKEN}
```

Generate GITHUBTOKEN goto:
https://github.com/settings/tokens

For private projects:

- user:email (read-only)
- read:org (read-only)
- repo

For open source projects:

- user:email (read-only)
- read:org (read-only)
- repo_deployment
- repo:status
- write:repo_hook

```
travis encrypt SENTRY_DSN="get from sentry" --add
```
Embed custom font in Rails 6
Tags: rails, wickedpdf, customfont
Published: 2021-09-01 11:52:05

Embed custom font in rails 6 is a bit tricky, below are the steps in order to embed custom font in rails 6 project especially work it works fine for wicked pdf gem

1. Include your prefer font in `app/assets/fonts/`
2. Update `app/assets/config/manifest.js`
```
...
//= link_tree ../fonts
```

3. I also create `app/assets/stylesheets/embeded_fonts.scss`
```
@font-face {
  font-family: "khmeros_battambang";
  src: font-url("khmeros_battambang.ttf") format("truetype");
}
```

4. Import to `app/assets/stylesheets/application.scss`
```
@import "embeded_fonts";
```

5. Import to `layouts/pdf.html.haml`
```
= stylesheet_link_tag "embeded_fonts"
= wicked_pdf_stylesheet_link_tag "pdf"
= wicked_pdf_javascript_pack_tag "pdf"
```
6. Call the embedded font

```
body {
  font-family: 'khmeros_battambang'
}
```
How to create confirm box using TippyJS
Tags: javascript, tippyjs
Published: 2021-09-01 11:35:31

[Tippy.js](https://atomiks.github.io/tippyjs) is the complete tooltip, popover, dropdown, and menu solution for the web, powered by Popper.

Javascript default confirm box also works well but UX matters. In this example, I am showing the easiest way to create eye pleasant confirm box with a great user experience.

You can check out the below example in [JS Fiddle](https://jsfiddle.net/milantarami/d6js83zr/138/)

In this example I'm using [TailwindCSS](https://tailwindcss.com/) (a utility-first CSS framework) to style the document

Add this code to your head tag
```
<!-- TippyJS CDN -->
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script src="https://unpkg.com/tippy.js@6"></script>

<!-- TailwindCSS CDN -->
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
```

Let's add an HTML button element, on the click event of this button a confirm box must appear.

```
<button type="button" class="bg-red-600 px-2 py-1 rounded-md text-white">
Trash
</button>
```

Let's add hidden HTML content for a custom confirm box innerHTML content.
```
<div id="template" class="hidden">
   <form action="http://myurl.domain/id" method="POST">
   </form>
   <div class="confirm__box p-3">
      <div class="confirm__text text-center mb-4">
         <strong>Are you sure ?</strong>
         <p>
            You won't able to revert this back.
         </p>
      </div>
      <div class="confirm__action flex justify-between">
         <button class="ok-btn w-10 text-white bg-green-600 px-1 rounded-sm">
         Yes
         </button>
         <button class="cancel-btn w-10 text-white bg-red-600 px-1 rouneded-sm">
         No
         </button>
      </div>
   </div>
</div>
```

initialize button with tippyJS

```
const template = document.getElementById('template');
tippy('button', {

    content: template.innerHTML,
    allowHTML: true,
    theme: 'material',
    interactive: true,
    zIndex: 99999,
    placement: 'auto',
    trigger: 'click',
});
```

adding submit or cancel functionality 

```
    onCreate(instance) {
        instance.popper.querySelector('.cancel-btn').onclick = () => {
            instance.hide();
        }

        instance.popper.querySelector('.ok-btn').onclick = () => {
            instance.hide();
            instance.popper.querySelector('form').submit();
            alert('form submitted')
        }
    }
```
You can check out the below example in [JS Fiddle](https://jsfiddle.net/milantarami/d6js83zr/138/)
Bluetooth/headphone Driver/Kernel
Tags: bluetooth, headphones, kernel, popos
Published: 2021-09-01 11:34:40

I am not a developer, but rather a user in need of help.
I recently built a desktop and decided to try PopOS instead of Ubuntu.
The disappointment hit when the audio didn’t work with my headphones(JBL TUNE700BT).

I can’t connect using the basic bluetooth software included with PopOS.
I can connect using Blueman.
When I successfully connect there’s no audio…
However when I go to the audio settings while audio files are playing I can see the volume bar jittering back and forth.

Someone else posted an article with the same issue on L1's forum.
He had found a fix, but the thread was closed, so I couldn’t ask him for help.

The article is called “Bluetooth Issue: X570 I Aorus Pro Wifi (Debian 10 - testing)”
And he wrote:
-------------------------------------------------------------
the issue has been fixed, and can easily be updated by adding the non-free to sources.list

## sources.list
deb http://ftp.fr.debian.org/debian bullseye main contrib non-free

## and manually update it, to confirm whether it's working as expected 
## try to completely shut down the computer, and turn it back on again.
sudo apt update && sudo apt install firmware-iwlwifi
-------------------------------------------------------------

I really need a step by step guide for PopOS and I have no Idea where else to get it.
Someone hold my hand, please!!!

Edit: Btw I'm using X570 which may or may not be important.
Politika ile Masaüstünde Kısayol Oluşturma
Published: 2021-09-01 11:05:44

Liman üzerinden politika kullanarak kısayol oluşturmak için aşağıdaki 3 bilgi gereklidir.

Kısayol Konumu: Kısayolunuzun nerede olmasını istiyorsanız o yolu girin.

Çalışacak Komut: Kısayolun çalıştıracağı komut.

Başlatıcı İkonu:  Kısayolun ikonu.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vjrkhzz73lvdj8sl8ksu.png)

## Nasıl Uygulanır 

Kısayol Konumu kısmına "Desktop/Kısayol" , Çalışacak Komut kısmına "mkdir Desktop/Yeni" yazın. Başlatıcı İkonu kısmını boş bırakın.

Kaydet butonuna bastıktan sonra istemci masaüstünde kısayolu görebilirsiniz. Kısayola tıkladığınızda masaüstünde Yeni isminde bir klasör oluşmalı.




## Konu Detayı
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/10a9s4f4tfib22pr42lv.png)
Launcher dosyasının içeriğine baktığımızda aşağıdaki gibi içerik görülmektedir.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/su63b8bgvcwqui01bdpk.png)


Name: Kısayolumuzun ismi

Exec: Kısayolu çalıştırdığımızda çalışacak olan komut.

Icon: Kısayolun ikonu.