teleren/devto huggingface dataset:
TIL
Published: 2023-02-01 16:09:44

1-30-23
Today I learned about database designs, how to fit only one value per cell and and think deeper on how we can simplify these database designs. 

1-31-23
I Learned that there can be many answers on if you know how to code, and theres never an ending to learning new things because code languages update very often. Which means theres always room to learn more. 

2-1-22
TIL Selectors < style > 
.a {color: teal;} 
</ style >
I learned that the "a" applies to all elements in style when its inside < style > </ style >

2-2-22
TIL Some simple things to know in CSS
Margin: space outside of box
Border: How thick the box or line will be 
Padding: Space inside the border 
and you can put multiple classes on the same element

2-3-22
TIL i learned that < footer >< / footer> arent only at the bottom of an HTML page but they can also can in the body at the end of a paragraph. 

2-6-22 Today I learned that about arrays EX.
grocery_list = ["milk", "eggs", "bread", "carrots"]
grocery_list.unshift("celery")

2-8-22 TIL about loops, in general english a loop on ruby could be a question that loops around and asks the question until its told to stop 

2-9-22 TIL some things to keep in mind 
string=String.new 
=> ""
array=Array.new
=>[]
hash=Hash.new
=>{}

2-13-23 TIL 
You can write a comment two ways on ruby the first way is the the classic way using the # symbol, but the other was is using 
=begin 
this is the comment i am writing down 
=end 
using begging and end with the = symbol lets you write a comment in between.

2-15-23 TIL
command K clear the scroll back and the screen in the terminal and control L only clears the screen in the terminal on mac.

2-17-23 TIL
The block variable |Could_be_any_name| it just has to be something descriptive that relates to an element in your list.

2-20-23 TIL 
Some thing to remember when using rails is 
Route 
Controller 
Action 
View 
"RCAV" 

2-23-23 TIL
An active record relation: A special array, an array full or rows in the database 

2-28-23 TIL 
CRUD 
Create 
Read 
Update 
Delete

3-1-23 TIL 
I learned that the ideas first draft has a co pilot feature that makes it easier to input your tables and schema 

3-6-23 TIL 
I learned a new command shortcut when you highlight a word or number and want to delete or change all of them you keep selecting command D if you want to keep selecting them to delete
Paracetamol.ts💊| #01: Explica este código TypeScript
Tags: typescript, webdev, spanish, programming
Published: 2023-02-01 16:05:10

## **<center>Explica este código TypeScript</center>**
#### <center>**Dificultad:** <mark>Básico</mark> </center>


```js
// ¿Cuál de las siguientes variables estan bien declaradas?
let x: number;
let y = 0; 
let z: number = 123.456; 
let big: bigint = 100n; 
```

- A. `x` y `y`
- B. `Todas menos big`
- C. `x` y `z`
- D. `Todas`

Respuesta en el primer comentario.

---
Paracetalmol.ts💊, preguntas de entrevistas laborales para TypeScript en Español
Tags: typescript, spanish, webdev, programming
Published: 2023-02-01 16:03:24

Desde el día de hoy empezaré este pequeño segmento del blog donde compartiré preguntas frecuentes que se hacen en entrevistas laborales para TypeScript. Como devs de este lenguaje existe un mínimo de conocimientos que deberíamos saber expresar y responder sin muchas complicaciones. 

Trataré de explicar de la forma más sencilla y concisa términos como:

* Tipos de datos
* Arreglos y objetos
* Tuplas
* Uniones e intersecciones
* Interfaces
* POO
* Funciones
* Asincronía 
* Genericos
* Omit y Pick
* Narrowing, etc.

Las entregas serán de 1 a 2 por semana, espero que sea de su agrado y les sirva para mejorar como devs.

También publique un tweet donde pueden hacerme lelgar que temas más les gustaría que estudiemos en este nuevo proyecto:

{% twitter 1620179763708182532 %}

Y también te dejo el repo donde ire subiendo todos los retos:

{% github https://github.com/crisdux/paracetamol.ts %}

Cualquier comentario o sugerencia será bien recibida. 

Saludos.
Book Review: Learning Go Programming
Tags: go, books, beginners
Published: 2023-02-01 16:00:01

If you follow me, you've likely noticed that I've been publishing a bunch of book reviews.  Here's number 5, in my quest for the best book to learn Go in 2023!  Be sure to follow me on dev.to, and subscribe on YouTube, to see the others as they come out!

{% youtube https://youtu.be/DQ_Xefhkej0 %}
Artia : Neo's Adventures first game intro
Tags: indiegame, madewithunity, manga, anime
Published: 2023-02-01 15:52:41

---
title: Artia : Neo's Adventures first game intro
published: true
description: Artia - Neo's Adventures is a Adventure RPG in a fantasy world populated by dragons and mystical creatures. Follow Neo on his journey and discover the secrets of this world bordering on the fantastic. Go in search of your father and capture the spirits of the legendary dragons
tags: #indiegame #madewithunity #manga #anime

cover_image: https://media.indiedb.com/images/games/1/76/75832/104.JPG
# Use a ratio of 100:42 for best results.
# published_at: 2023-02-01 15:48 +0000
---
Artia : Neo's Adventures first game intro
{% embed https://www.youtube.com/watch?v=Bf1aoLNHzNo %}
Welcome Thread - v211
Tags: welcome
Published: 2023-02-01 15:50:23

---
title: Welcome Thread - v211
published: true
description: Welcome to DEV! A thread of hellos and intros.
tags: welcome
canonical_url: 
---

![A person pops up from below with a dog in their arms. They're puppeteering the pooch and manipulating its paws to wave at us.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vj3xe9nrguog3h61l0z8.gif)

### Welcome to DEV!

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

**Great to have you in the community!**
#Rust 🦀 – Learning HTTP GET and POST requests in Rust, and yes this is a “🌐What’s my IP” demo 😄
Tags: englishpost, findmyip, httprequest
Published: 2023-02-07 15:18:21

---
title: #Rust 🦀 – Learning HTTP GET and POST requests in Rust, and yes this is a “🌐What’s my IP” demo 😄
published: true
date: 2023-02-01 15:47:29 UTC
tags: EnglishPost,EnglishPost,FindmyIP,HttpRequest
canonical_url: 
---

Hi !

Yes, I’m starting to use OpenAI services in with Rust. However, before getting here, I spent some time learning how to work with HTTP Requests in Rust.

There seems to be several libraries that can help. I found several examples using [[https://docs.rs/reqwest/0.6.2/reqwest/](https://docs.rs/reqwest/0.6.2/reqwest/)], so I decided to use this one.

A classic example to do this, is to perform an HTTP GET request to the following url, to get our public IP Address.

```

https://httpbin.org/ip

```

And hey, the code is super simple

{% gist https://gist.github.com/elbruno/ca2daaef303b33eb8788596dde2763bd %}

With a more simple output

```

    Finished dev [unoptimized + debuginfo] target(s) in 3.99s
     Running `target\debug\result02.exe`
{
    "origin": "111.111.111.111",
}

```

More about http calls in next posts!

Happy coding!

Greetings

El Bruno

More posts in my blog [ElBruno.com](https://www.elbruno.com).

* * *
How do you add authentication to a Django project?
Tags: django, python, authentication
Published: 2023-02-01 15:44:04

There are several options to add authentication in Django projects:

**1. Django's built-in authentication views and models:** This includes authentication views such as _LoginView, LogoutView_ and authentication models such as User, Permission and Group. This is a simple and easy to use option.

**2. Django Allauth:** A third-party package for Django that provides authentication and authorization for various social media platforms like Google, Facebook, and Twitter.

**3. Django Rest Framework (DRF) authentication classes:** If you're building a REST API, DRF provides a variety of authentication classes that can be used to authenticate users.

**4. Custom authentication:** You can build your own authentication system from scratch or build upon Django's built-in authentication system to meet your specific requirements.

The best option depends on the requirements of your project. If you're building a simple website and just need standard authentication functionality, Django's built-in authentication views and models may be sufficient. If you're building a REST API and need advanced authentication options, DRF authentication classes may be the best choice.

Here's an example of using Django's built-in authentication views to add a login page:

```
from django.contrib.auth.views import LoginView


urlpatterns = [
    path('login/', LoginView.as_view(), name='login'),
]
```
Customer Retention Strategies to Keep Your Business Growing
Tags: startup
Published: 2023-02-01 15:36:15

The process of retaining two or more customers is much easier than acquiring one new one. Keep your current customers along, as they can provide you with a greater ROI, saving you five to twenty-five percent.

What are your methods for retaining existing customers?

The answer is simple; you need to focus on two points. The first step is to learn why your customers are unhappy with your product and services, and the second is to develop a successful customer retention strategy to get them back.

Here, we have outlined some important points to make the best customer attention strategies that brands throughout the world are utilizing to inspire loyalty among their customers.

What are your methods for retaining existing customers?
✔️ Create a strong onboarding experience
✔️ Provide a personalized customer experience
✔️ Build trust with your customers
✔️ Implement a customer feedback loop
✔️ Maintain a customer communication calendar
✔️ Send a company newsletter
✔️ Start a customer education program
✔️ Offer unique services

Read in-depth about these [customer retention strategies to keep your business growing](https://churnfree.com/blog/8-effective-customer-retention-strategies/)
Const keyword in C++
Tags: cpp, beginners
Published: 2023-02-01 15:33:54

When i was reading A Tour of C++ (Author: Bjarne Stroustrup), in 49th page i came across a code like this.

```
class Vector {
private:
    double∗ elem; 
    int sz;
public:
    Vector(int s); 
    ˜Vector() { delete[] elem; } 

    Vector(const Vector& a); 
    Vector& operator=(const Vector& a); 

    double& operator[](int i);
    const double& operator[](int i) const;

    int size() const;
};
```
These two lines came a bit weird to me when i first saw them. Why using **const** to overload **operator[]** ?

```
double& operator[](int i);
const double& operator[](int i) const;
```
Ofcourse somebody asked this question before.

{% stackoverflow 19237411 %}

One of the answer is 

> When both versions are available, the logic is pretty straightforward: `const` version is called for `const` objects, non-`const` version is called for non-`const` objects. That's all.
> The point of having two versions is to implement "read/write" access for non-`const`objects and only "read" access for `const` objects. For `const`objects `const`version of `operator []` is called, which returns a `const double &` reference. You can read data through that const reference, but your can't write through it.

---

in the comments of the question somebody add this video

{% embed https://www.youtube.com/watch?v=4fJBrditnJU&t=628s %}

In the second part of the video Cherno show the case how to use const in **getter** function. It really explains well the answer above.

---

But in the first part of the video there is a part which i don't understand quite well about using **const** keyword in pointers. 

```
const int* a       = new int;
int* const a       = new int;
int const* a       = new int;
const int* const a = new int;
```

Somebody ofcourse asked it before too and i found a beautiful answer.

{% stackoverflow 162615 %}


after reading that trick  in the answer it becomes more easy to understand. 

---

Lets check those 4 lines one by one using the trick.

```
const int* val = new int;
```

**val is a pointer, to integer which is constant.**
*val -> dereference of val(integer) can not be change.
val  -> memory address of val can be change.

```
int* const val = new int;
```
**val is a constant pointer to integer.**
*val  -> dereference of val(integer) can be change.
val   -> memory address of val can not be change.

```
int const* val = new int;
```
**val is a pointer to a constant integer.**
*val -> dereference of val(integer) can not be change.
val  -> memory address of val can be change.

```
const int* const val = new int;
```
**val is a constant pointer to an integer which is constant.**
*val -> dereference of val(integer) can not be change.
val  -> memory address of val can not be change.

---

Here is a song for you
https://soundcloud.com/nocontent/dj-planet-express-ft-augustix-angel
Have a good day!
Getting Error Responses from Axios
Tags: node, tutorial, api
Published: 2023-02-01 14:56:17

If you search for libraries to make API calls from Node.js, chances are you'll run into the [Axios package](https://axios-http.com/). It's easy to use, well documented, uses promises, and it works in browsers too.

## When things go wrong

The main complaint from other developers is that when they make a request and an error response is returned, it's not obvious how to get information about the error. Usually, this happens when they don't catch the exception and expect the response to include the status code.

```typescript
const response = await axios.get(SOME_URL);

if(response.status === 404) {
    console.error(`${SOME_URL} not found!`);
}
```

This approach won't work because Axios, by default, throws an exception for [any status code that isn't 2xx](https://github.com/axios/axios/blob/d032edda08948f3f613ff34f32af49cad3aa74db/lib/defaults/index.js#L148). There is a workaround though.

## Making it more responsive

You can tell Axios that you want to see every response regardless of if it's an error or not using the request options. You need to provide a `validateStatus` method that always returns `true`. This method is passed to Axios in the request options.

```typescript
const response = await axios.get(SOME_URL, {
    validateStatus: () => true,
});

if(response.status === 404) {
    console.error(`${SOME_URL} not found!`);
}
```

Now you'll reach the if statement as expected.

## There's a `.catch()`

If you look at the [Axios documentation on error handling](https://axios-http.com/docs/handling_errors), you're supposed to catch the exception that it throws. You can use the `response` property on the exception to determine what status was returned. Finally, you can gracefully return some value and continue work.

```typescript
const contents = await axios.get(SOME_URL)
    .then((response) => response.data)
    .catch((error) => {
        if(error.response?.status === 404) {
            console.error(`Could not find ${SOME_URL}`, response.data);
            return undefined;
        }

        // Something unexpected
        throw error;
    });

if(!contents) return;
```

## Summary

You've seen a couple of ways to deal with error responses when making HTTP calls with Axios. The important thing to remember is that it will throw an error for non-2xx responses and the `response` property on the thrown exception will contain all of the data that you would normally get back (status, body, etc).
ECMAScript decorators with Vite
Tags: javascript, vite, babel
Published: 2023-02-01 14:46:11

I felt very happy when i saw the progress on bringing typescript decorators to vanillajs. I thought to give it a try in my vanillajs + vite application and bammmmm :boom: it broke :exploding_head: :bowing_man:. 

ESbuild, which comes with OOB of vite, doesn't support decorators yet :roll_eyes: :shrug:

That only left me the option to go for babel but i don't want to get away from my love, vite :pleading_face:

Then i found the [vite-plugin-babel](https://www.npmjs.com/package/vite-plugin-babel) package and made few changes to vite config. It worked wohooooo :star_struck:

Here's the config:

```javascript
import { defineConfig } from 'vite';
import babel from 'vite-plugin-babel';

export default defineConfig({
  base: "./",
  plugins: [
    babel({
      babelConfig: {
        babelrc: false,
        configFile: false,
        plugins: [
          [
            "@babel/plugin-proposal-decorators",
            { loose: true, version: "2022-03" },
          ],
        ],
      },
    }),
  ],
  server: {
    host: true,
    port: 3001,
    open: "/",
  },
});
```

That's it. This resolved my issue and i happily went on using decorators in javascript.

FYI, decorator proposal is in stage3 and one step behind of getting finalized.

Thanks for the read,
Kiran :wave: :wave:
Need elite eng talent?
Tags: webdev, web3, web2, uiux
Published: 2023-02-01 14:28:23

Lazer is an engineering and design studio, run by past YC founders, where we help fast growing companies build and ship world-class products. We help a number of companies on engineering and design needs, across various industries such as FinTech, HealthTech, Crypto, etc.. backed by incredible investors such as Soma Capital, YCombinator, A16Z, and more. Some clients include Dapper Labs, 100 Thieves & NFLAllDay. Feel free to reach out if you want to chat or learn more :)
Code Smells In ReactJS: What They Are and Why They Matter
Tags: react, javascript, html, webdev
Published: 2023-02-01 13:18:14

## What is code smell?

A code smell is a surface indication in the source code of a program that suggests there may be a deeper problem. It's a symptom that the code is not as maintainable, scalable or efficient as it should be.

![meme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/89nkccq2g22amuqbrx4d.png)

Code smells are often subjective and can indicate a violation of fundamental design principles, such as separation of concerns, or a suboptimal use of language constructs. Addressing code smells can help to improve the quality of the code and prevent future problems.


## Here are some common code smells in React.js:


**1. Unnecessary state updates**
Unnecessary state updates in React can lead to performance issues and potential bugs. Here are some causes and solutions for this code smell:

Causes:
🙀 Updating state unnecessarily in response to non-relevant events
🙀 Not using the correct comparison operator when checking for state updates
🙀 Not using memoization for computed values


**2. Inefficient re-renders**
Inefficient re-renders in React.js can lead to slow performance and decreased user experience. Here are some causes and solutions for this code smell:

Causes:
🙀 Updating state unnecessarily
🙀 Not using PureComponent or shouldComponentUpdate
🙀 Overusing the setState method
🙀 Incorrect use of key props


**3. Overuse of HOCs and render props**
The overuse of Higher-Order Components (HOCs) and render props in React.js can lead to complex and hard-to-maintain code. Here are some causes and solutions for this code smell:

Causes:
🙀 Using HOCs or render props to add logic that could be achieved with simpler techniques
🙀 Overcomplicating component structures with multiple nested HOCs or render props
🙀 Using HOCs or render props as a way to share non-visual logic between components



**Solutions**
✅ Use the **useMemo** or **useCallback** hooks to memoize expensive computations.
✅ Use the **useEffect** hook to avoid updating state in response to non-relevant events.
✅ Double-check your comparison logic to ensure that state updates only occur when necessary.
✅ Use **React.memo** or PureComponent instead of Component to optimize re-renders.
✅ Use the key prop correctly to ensure that only the minimum number of components are re-rendered.
✅ Use useEffect with a dependency array to control re-renders.
✅ Consider using the useReducer hook for complex state updates.
✅ Avoid nesting HOCs and render props too deeply to keep the component structure simple and manageable.

[The original article](https://zealoq.me/10518a72)
Discovering the Hidden Apps That Are Not Available on Playstore
Tags: apps, opensource, android, playstore
Published: 2023-02-01 14:09:41

You’re undoubtedly already familiar with the Google Play Store, which serves as an all-in-one app store for Android users. You might be surprised to learn that there are many apps accessible that are not listed on the Play Store.

We’ll expose you to some of the top unappreciated apps that are not on the Play Store in this article. We’ll also explain why you should try out these apps and how to download them for use on an Android device.
[Click Here to Check Full Post....](https://tecroxy.com/secret-apps-not-available-on-playstore)
The C Function to Iterate Over a PyList (PyObject) and Print Each Item (Python C API: PyObject_GetIter)
Tags: c, programming, blog, python
Published: 2023-02-01 14:07:15

We can call Python code in C via the <a href="https://docs.python.org/3/c-api/" rel="noopener nofollow" target="_blank">Python C API</a>. And we want to be able to go over the items for a PyList that is type of PyObject, for example, the following "path" variable is type of PyObject, and we can insert/append item(s) to it via <a href="https://docs.python.org/3/c-api/list.html" rel="noopener nofollow" target="_blank">PyList_Append</a>.

<pre lang=c>
PyObject* path = PySys_GetObject((char*)"path");
PyList_Append(path, PyUnicode_FromString("."));
</pre>

And, we can use the PyObject_GetIter and PyIter_Next method to go over each item and print them. Each element could be dynamic typed such as integer, float numbers, and unicode strings. These can be checked via PyLong_Check, PyFloat_Check and PyUnicode_Check accordingly.

<pre lang=c>
bool printPyList(PyObject* arr) {
  PyObject *iter;
  PyObject *item;
  if ((iter = PyObject_GetIter(arr)) == NULL) {
    printf("List is Empty.\n");
    return false;
  }
  while ((item = PyIter_Next(iter)) != NULL) {
    if (PyLong_Check(item)) {
      long long_item = PyLong_AsLong(item);
      printf("%ld\n", long_item);
    }
    if (PyFloat_Check(item)) {
      float float_item = PyFloat_AsDouble(item);
      printf("%f\n", float_item);
    }
    if (PyUnicode_Check(item)) {
      const char *unicode_item = PyUnicode_AsUTF8(item);
      printf("%s\n", unicode_item);
    }
    Py_DECREF(item);
  }
  Py_DECREF(iter);  
  return true;
}
</pre>

If the list is empty, the above <a href="https://helloacm.com/how-to-map-or-transform-a-vector-in-c-template-function/" title="How to Map or Transform a Vector in C++ (Template Function)?">function</a> will return false. Otherwise, each element will be printed to console line by line and the function returns true.

--EOF (<a title='The Ultimate Computing & Technology Blog' href='https://helloacm.com'>The Ultimate Computing & Technology Blog</a>) -- 

Reposted to [Blog](https://helloacm.com/the-c-function-to-iterate-over-a-pylist-pyobject-and-print-each-item-python-c-api-pyobject_getiter/)
How Did You Get Your First Client?
Tags: discuss, webdev, tutorial
Published: 2023-02-01 14:01:46

I am so thrilled to have acquired my first client! It can be quite a funny and awkward situation when you're either approached by a customer or when you're the one making the initial contact. Reflection on this experience may be helpful – I encourage you to share your own experiences with your client in a friendly manner. Don't be afraid to express yourself!