teleren/devto huggingface dataset:
Create an Audio Transcript with Amazon Transcribe
Published: 2024-05-24 20:15:09

**Amazon Transcribe** is an automatic speech recognition (ASR) service offered by AWS

It enables developers to add speech-to-text capability to their applications. It uses machine learning models to convert audio to text. 

**Amazon Transcribe** is a pay-as-you-go service; pricing is based on seconds of transcribed audio, billed on a monthly basis.

**Step 1**

- Launch the AWS Management console
- Launch S3 from the console
- Provide a unique name for the bucket
- Choose a region
- Disable bucket versioning (We don't need it for this project)
- Disable server side encryption
- Block all public access for the bucket  
- Click on the **create bucket**
See below images as guide

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


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


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


**Step 2**

- Upload your audio file to the bucket

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

- Select the audio file and copy the object URL

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


Let's create a transcript job that will handle the audio transcription

**Step 3**

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


- Launch **Amazon Transcribe**
- Create a **transcript**


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

**Step 4**

- Specify job name
- Select **specific language** under the language settings
- Leave language as **default**
- Leave model as **default**


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



**Step 5**

- Paste the object URL in the input field
- Leave the default output location
- Leave the subtitle file format (Optional)
- click **Next**


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


- Leave everything else as **default**
- Click **create job**

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

Our transcription job is done. Be sure the status reads complete


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



- Click on the completed job 
- Scroll down to see the transcription preview


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



**Congratulation!** We have successfully transcribed our audio to text

In our next project we will learn how to translate our result into a different language
BFE- Backend for Front-End
Tags: backenddevelopment, systemdesign, architecture
Published: 2024-05-24 20:09:41

Let's say you are designing some web application, and your main role is develop all Backend API's. As a good backend developer your aim is to write generic API's for any other applications also like Android App, IOS App, etc. etc.. 

Take a example that you are building an E-commerce Web and Mobile Application. And as per the size of screen UI designer made below like pattern - 
For Desktop view of specific product - 
1. Image of product, price
2. Rating in terms of stars 
3. Reviews
4. FAQ's 

For Mobile Application view of specific product - 
1. Image, price
2. Rating

FAQ's also there in mobile app but these things are in different tabs and UI/UX Developer made UI according to screen size.
So the main part is that for a different type of screen we are sending different kind of data. 

To Desktop -

```
Product1= {
 "Image": "IMG_1",
 "Rating": "5",
 "Reviews": ["R1", "R2"],
 "FAQ": ["Q1A1", "Q2A2"]
}
```

To Mobile App-

```
Product1 = { 
 "Image": "IMG_1", 
 "Rating": "5"
}
```

So the problem is if you are as a Backend Developer made generic API for Product data and Different Screen Size Device need different data then how these things works ?

**Answer from Noob - **
As a fresher or beginner backend developer you would say that send all these data and render only those data which is needed at that time from frontend. 

But as a good backend developer this is wrong. It's like user can access Reviews and FAQ's on same page where we don't want to show on that page. Yes, it is not bad for security but I think it's more of **EGO of Backend Developer** 😅😅. (Joking)

**Actual Answer - **
As I said it is not good practice for backend developer to send all data and use only required data, if developer do that then anyone can go to inspect and call that object and view all JSON of that data. (Still EGO of developer reason is at top).

To send data according to device type - 

**Noob Advice:** Check device properties every time before sending data - 
**Cons of it-** It will fucked up in between our Business Logic
Then **BFE- Backend for Front-End came in picture** to help these kind of scenarios. 

BFE is basically a additional layer we add, whenever any request goes, it will first come to BFE in which BFE identifies that Device type/ Screen Size/ Desktop/ Mobile/ Tab and send request to our generalized Backend, and Backend will send our generalized request to BFE and according to Device type BFE modifies data (BFE make new object of required entities and render that object instead of Generalized response).
Beware of Mutable Default Arguments in Python
Tags: python, problem
Published: 2024-05-24 20:00:36

# Beware of Mutable Default Arguments in Python

As Python developers, we often enjoy the flexibility and simplicity that the language offers. However, some features can lead to unexpected behavior if not used carefully. One such feature is mutable default arguments.

## The Problem

Consider the following function:

```python
def test_func(newList, myList=[]):
    for t in newList:
        for f in t:
            myList.append(f)
    return myList

print(test_func([[3, 4, 5], [6, 7, 8]]))  # Outputs: [3, 4, 5, 6, 7, 8]
print(test_func([[9, 10, 11], [12, 13, 14]]))  # Outputs: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]

At first glance, everything seems fine. But notice what happens when the function is called a second time. Instead of getting a fresh list, myList retains the values from the previous call. This is because the default list is created once and shared across all calls to the function.

The Solution:
To avoid this issue, we can use None as the default value and initialize the list inside the function:

def test_func(newList, myList=None):
    if myList is None:
        myList = []
    for t in newList:
        for f in t:
            myList.append(f)
    return myList

print(test_func([[3, 4, 5], [6, 7, 8]]))  # Outputs: [3, 4, 5, 6, 7, 8]
print(test_func([[9, 10, 11], [12, 13, 14]]))  # Outputs: [9, 10, 11, 12, 13, 14]


By doing this, each call to test_func starts with a fresh list, avoiding the unintended side effect of sharing state across function calls.

Conclusion:

Mutable default arguments can lead to subtle bugs that are hard to track down. Always use immutable default arguments or initialize mutable ones inside the function. Happy coding!Feel free to share your thoughts or any other tips you have encountered on this topic!
1255. Maximum Score Words Formed by Letters
Published: 2024-05-24 19:39:26

https://leetcode.com/problems/maximum-score-words-formed-by-letters/?envType=daily-question&envId=2024-05-24

```js
var maxScoreWords = function(words, letters, score) {
    let n = words.length;
    let res = 0;

    let letters_count = new Array(26).fill(0);
    for (let letter of letters) {
        letters_count[letter.charCodeAt(0) - 97]++;
    }

    let words_scores = {};
    for (let word of words) {
        let s = 0;
        for (let ch of word) {
            s += score[ch.charCodeAt(0) - 97];
        }
        words_scores[word] = s;
    }

    function recursion(cur_ind, cur_score) {
        if (cur_ind === n) {
            res = Math.max(res, cur_score);
            return;
        }

        let can_add_this_word = true;
        let word = words[cur_ind];
        let word_count = new Array(26).fill(0);

        for (let ch of word) {
            word_count[ch.charCodeAt(0) - 97]++;
            if (word_count[ch.charCodeAt(0) - 97] > letters_count[ch.charCodeAt(0) - 97]) {
                can_add_this_word = false;
                break;
            }
        }

        if (can_add_this_word) {
            for (let i = 0; i < 26; i++) {
                letters_count[i] -= word_count[i];
            }
            recursion(cur_ind + 1, cur_score + words_scores[word]);
            for (let i = 0; i < 26; i++) {
                letters_count[i] += word_count[i];
            }
        }
        recursion(cur_ind + 1, cur_score);
    }

    recursion(0, 0);
    return res;
};

```
Full Stack Deployment with Ansible
Tags: webdev, ansible, javascript, development
Published: 2024-05-24 18:31:02


A few months ago I started practicing ansible and some Javascript with React and NodeJs. 
As a playground im using some EC2 instances in AWS, and I did not want to re configure everything everytime that I test the site . For this I wrote an Ansible playbook that performs all the required actions to get the app online.

High level overview of what it does:

- Extracts the repository names from the frontend_git_repo and backend_git_repo variables.
- Updates the system packages and reboots the machine if updates were installed.
- Installs gnupg and curl, which are required for MongoDB.
- Sets up the NodeSource repository and installs Node.js.
- Checks if the MongoDB GPG key is already set up, and if not, it sets it up.
- Creates a list file for MongoDB and updates the package list.
- Installs MongoDB and starts the mongod service.
- Installs pm2 globally, which is a process manager for Node.js applications.
- Installs the Nginx web server and configures it.
- Copies the SSH key to the EC2 instance.
- Clones the frontend and backend repositories from GitHub.
- Creates a new folder in the backend directory.
- Deletes the copied SSH key from the EC2 instance.
- Builds the frontend application and moves it to the appropriate directory.
- Configures pm2 for the backend application and starts it.
- Restarts the Nginx service.

All the actions above described , are handled by Ansible and a UI called Ansible Semaphore.

Everything is in this repo where you can find the "Mean Stack playbook" and the Ansible Semaphore Docker comppose file to build the controller. 

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


I really recommend to use Ansible or any tool you want to avoid spending lot of time installing and configuring test  services. 

For sure there is lot of room for improvements, but it saves a lot of time.
My humble collaboration:


https://github.com/imaerials/ansible-home-lab
What was your win this week?
Tags: discuss, weeklyretro
Published: 2024-05-24 19:19:03

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: 
---

👋👋👋👋

Looking back on your week -- what was something you're proud of?

All wins count -- big or small 🎉

Examples of 'wins' include:

- Starting a new project
- Fixing a tricky bug
- Cleaning your house...or whatever else that may spark joy 😄


![tom and jerry cleaning](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExMG5zMTRkandlNTk0aG1rdHg1bHBqcWFrb2pjdDh3cnpxeGh3djFmaSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/NV4cSrRYXXwfUcYnua/giphy.gif)
Desmistificando: Entendendo interações entre navegador e usuário #1
Tags: beginners, learning, webdev, programming
Published: 2024-05-24 18:52:46

### _Desmistificar_
_Anular a natureza mística, misteriosa_
_Destituir o caráter místico ou misterioso de._

Entender o que o mecanismo faz é algo que eu faço com certa facilidade, mas eu sempre esbarro em dificuldades posteriores por não entender **como** o mecanismo opera.

Tô iniciando essa série de posts **Desmistificando** exatamente para chegar nas conclusões de como algo que estou interessado é feito de fato, e esse primeiro da série vai abordar um questionamento: **o que acontece quando digitamos um endereço na barra de pesquisa do navegador?** Vamos lá.

## A barra de pesquisa


O principal componente de um navegador é a sua barra de pesquisa. Hoje, vamos limitar o cenário do uso do navegador a isso, para que possamos sermos direto no estudo. O navegador possui muitas funcionalidades de configuração: plugins, papel de parede, etc, mas o que vai nos interessar nessa série é a barra de pesquisa e o que acontece quando você digita um conteúdo nela e aperta enter.

Temos algumas possibilidades: hoje em dia, você consegue utilizar seu buscador configurado (Google, Bing, etc) diretamente da barra de pesquisa, mas a possibilidade que interessa ao estudo é quando digitado uma **URI/URL**: `dev.to`, `facebook.com`, `google.com`, etc. Falando nisso, sabemos a diferença entre uma URI e uma URL?

É importante esclarecer a diferença entre essas siglas pois, essencialmente, são importantes para entender o "raciocínio" que o navegador seguirá. Quando falamos de uma URI, nos referimos ao `dev.to`, mas o navegador precisa entender **que recurso** estamos tentando acessar da URI `dev.to` e melhor ainda, **como** e **quão seguro** é o acesso a esses recursos?

Em suma, a URI é o identificador dos recursos, mas a URL define informações importantes do acesso e interação a este recurso. Mais detalhes podem ser obtidos na [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986), a RFC oficial definindo URIs. Se você não sabe o que são RFCs, bem resumidamente, são documentos feito por pesquisadores, cientistas de computação e outros desenvolvedores que colaboram em conjunto para chegar em um padrão utilizado na internet.

Recapitulando com todas as peças apresentadas aqui até então, podemos começar digitando a URI no navegador `facebook.com`, mas ele vai fazer o trabalho de interpretar esse URI e transformá-lo numa URL, e o primeiro passo dessa transformação, é utilizar o protocolo HTTPS, resultando em: `https://facebook.com` (Nota-se, que na maioria dos navegadores, o `https` fica ocultado). Vamos entender o protocolo HTTPS e a escolha dele na transformação de um URI.

## O Protocolo HTTPS
2024 Ford Ranger Review
Tags: ai
Published: 2024-05-24 18:20:16

The 2024 Ford Ranger is the perfect midsize truck designed to command attention on the road. With its advanced technology, safety features, and added performance, the Ford Ranger is a great option for drivers looking for a midsize truck that can deliver excellent power.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6cl0dls455rsm061vsq6.jpeg)


**Walkthrough Review**

Inside the cabin, the Ford Ranger features a new digital instrument cluster that helps you stay informed. The Lariat and Raptor models can also find memory seats and a heated steering wheel. The New fold-flat rear seatbacks provide the perfect space for loading and unloading your stuff.

**CONTACT US**

**[Contact Oakridge Ford](https://www.oakridgeford.com/contact/)** today to learn more about the 2024 Ford Ranger available in our vehicle lineup. Our team is ready to answer your questions and help you discover the perfect Ford Ranger.


**Source- [https://www.oakridgeford.com/2024-ford-ranger-review/](https://www.oakridgeford.com/2024-ford-ranger-review/)**
MONGODB
Tags: javascript, beginners, tutorial, database
Published: 2024-05-24 17:57:36


#### Create An Express Server Using Mongodb
#### Mongo db :
MongoDB is built on a scale-out architecture that has become popular with developers of all kinds for developing scalable applications with evolving data schemas. As a document database, MongoDB makes it easy for developers to store structured or unstructured data. It uses a JSON-like format to store documents.

#### Download Mongodb And Mongodb Compass: 
Click [here](https://www.mongodb.com/) to download mongodb 
Click [here](https://www.mongodb.com/products/tools/compass) to download mongodb compass

#### Check Your Terminal If Mongodb Is Install Perfectly:
Check by typing **mongosh** on your terminal
![alt text](Mongosh.png)

#### Install MongoDb:
<mark>npm install mongodb</mark> on your vscode terminal

#### Create a database server
```javascript
//call express and mongodb function
const express = require ("express");
const { MongoClient } = require ("mongodb");

const app = express();
// mongodb url
const url = "mongodb://localhost:27017";
const client = MongoClient(url);

// Create a database folder
const dataName = "Folder";

// Create a database collection
let dbCollection;
async function dbConnect() {
  await client.connect();
  console.log("connected to db successfully");
  const db = client.db(dataName);
  dbCollection = db.collection("Staff");
  return "done .";
}

// Create a port number
const port = 3000;

app.listen(port, () => {
  console.log(`Server is running on port http://localhost:${port}`);
})
```
#### RUN YOUR TERMINAL
Learn SwiftUI (Day 1/100)
Tags: swift
Published: 2024-04-30 19:55:23

## Swift

* Variable
* Constants
* String and multiple-line string
* Integer
* Double

```swift
import Cocoa

// "var" means make a new variable
var greeting = "Hello, playground"
print(greeting)
var name = "hello"
print(name)
name = "world"
print(name)

// let: Declares a constant that cannot be changed once it has been set, i.e., an immutable variable
let lang = "python"
print(lang)
// lang = "java" // Error: cannot assign to value
// print(lang)

/*
 Best practice suggests that you should default to using let to define a variable and only use var when you explicitly need the variable’s value to change. This helps lead to cleaner, more predictable code.
 */

// ## Create strings

let quote = "Then he tapped a sign \"Believe\" and walked away"
// multiple line string
let movie = """
hello
世界
"""
print(movie)
print(movie.count) // 8 -> count returnes unicode count
let trimmed = movie.trimmingCharacters(in: .whitespacesAndNewlines)
print(trimmed.count)

// define integers
let score = 10
print(score / 3) // 3
var points = 10
points += 1
print(points)

// define floating number
let number = 0.1 + 0.2
print(number)

let a = 1
let b = 2.0
// int and double cannot sum, must cast first
let c = Double(a) + b
let d = a + Int(b)
```
Scraper compania Olinio
Tags: peviitor, scraper, olinio
Published: 2024-05-24 17:53:28

## Scraper 

Orice scraper există datorită unei echipe de scraper și tester. Scraper-ul companiei **_Olinio_** este scris de [Iurie Chigai](https://www.linkedin.com/in/iurie-chigai/) în limbajul Python și testat de [Claudia Rusu](https://www.linkedin.com/in/claudia-rusu/), drept muncă voluntară, și poate fi găsit pe GitHub, fiind un proiect open source.

{% github https://github.com/peviitor-ro/scrapers_python_iurie %}

---

## Te interesează să scrii un scraper sau să testezi unul?
Poți să te alături proiectului chiar de aici!

[Link Discord peviitor.ro](https://discord.gg/t2aEdmR52a)

---
Create a chatbot with just eight lines of code v.2
Tags: ai, generativeai
Published: 2024-05-24 17:09:26

**Translation and Grammar Correction:**

I am updating a post that showed how to create a chatbot with Hugging Face in eight lines.

The update is due to the fact that `pip install langchain` is no longer valid; the correct command is `pip install langchain_community`.

```python
%%capture
!pip install langchain_community
!pip install huggingface_hub

import os
os.environ["HUGGINGFACEHUB_API_TOKEN"] = "YOUR_TOKEN"

%%capture
from langchain import HuggingFaceHub

# Instantiate model
llm = HuggingFaceHub(repo_id="tiiuae/falcon-7b-instruct", model_kwargs={"temperature": 0.6})

response = llm.invoke("write a poem about AI?")
print(response)
```

_AI, the cosmic force,
A dream we've sought for years,
A power so immense, so wise,
Our hopes, our dreams, they find a place.

In the future, so bright and grand,
AI will lead us, through galaxies in hand,
To places unimagined, to worlds unknown,
Unleashing powers, we've never shown._

Unleash the power of AI, and behold the future.
Superalignment and Timeline of Broken Promises on The Way to Superintelligence
Tags: learning, ai, news, chatgpt
Published: 2024-05-24 17:20:35

Today you will know everything about Superalignment and the race to ASI! 

_Insights from a former OpenAI employee: "Whoever controls ASI will have access to a spread of powerful skills/abilities and will be able to build and wield technologies that seem like magic to us, just as modern tech would seem like magic to medievals."_

Explore the concept of Superalignment and uncover the hidden truth about AGI and ASI. Dive into the ethical challenges, secret experiments, and the pressing need for transparency in AI development.

👉 [**What is Superalignment?**](https://iwooky.substack.com/p/superalignment-and-superintelligence)

[![Superalignment and Timeline of Broken Promises on The Way to Superintelligence](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/drbdw1f48899s878eu4n.jpg)](https://iwooky.substack.com/p/superalignment-and-superintelligence)
How to Create a Solar Panel Calculator Using Programming?
Tags: webdev, javascript, programming, softwaredevelopment
Published: 2024-05-24 17:10:16

A solar panel calculator is a tool that helps estimate the potential benefits and feasibility of installing solar panels on a particular property or location. It takes into account factors such as geographical location, roof size, sunlight exposure, energy usage, cost of **[solar panels](https://openread.net/)**, and electricity rates.

## How to Create a Solar Panel Calculator Using Programming?

Creating a solar panel calculator involves several steps, and you can implement it using **[programming languages](https://programmingscript.com/)** like Python, JavaScript, or any other language you're comfortable with. Here's a basic outline of how you can approach it:

Define Input Parameters: Decide which parameters you want to take as input from the user. These may include:

- Location (latitude, longitude)
- Roof size available for solar panels
- Average daily sunlight hours
- Cost per watt of solar panels
- Electricity usage (daily, monthly, or yearly)
- Current electricity cost per kWh

Calculate Solar Potential: Based on the location, you'll need to calculate the solar potential, which involves estimating the average solar irradiance (sunlight intensity) for the location. You can use various APIs or libraries to fetch this data.

Estimate Energy Production: Use the solar potential and roof size to estimate the energy production capacity of the solar panels. This involves calculating the total energy output per day, month, or year based on sunlight hours and panel efficiency.

Calculate Cost and Savings: Estimate the cost of installing solar panels based on the cost per watt and roof size. Then calculate the savings over time compared to the current electricity cost.

Output Results: Display the calculated results to the user, including estimated energy production, cost of installation, savings over time, payback period, etc.
Here's a simple Python example to get you started:

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

This is a basic example, and you can expand upon it by adding more features like tax incentives, different panel efficiencies, battery storage, etc., depending on your requirements.