teleren/devto huggingface dataset:
5 Of The Most Helpful Python List Methods
Tags: python, beginners, codenewbie, programming
Published: 2021-07-28 23:40:19

Hello everybody, 
Today we'll discuss *5 helpful Python list methods*.

## clear()

**clear()**: This method helps you to delete all list elements.

```python
cities = ['azemmour', 'tanger', 'casablanca']
print(len(cities)) # 3
cities.clear()
print(cities) # []
print(len(cities)) # 0
```

## reverse()

**reverse()**: reverse the order of the list's elements.

```python
cities = ['azemmour', 'tanger', 'casablanca']
cities.reverse()

print(cities)  # ['casablanca', 'tanger', 'azemmour']
```

## copy()

**copy()**: returns a copy of the specified list.

```python
cities = ['azemmour', 'tanger', 'casablanca']
moroccan_cities = cities.copy()
cities[0] = 'madrid'

print(cities) # ['madrid', 'tanger', 'casablanca']
print(moroccan_cities) # ['azemmour', 'tanger', 'casablanca']
```

## count(value)

**count()**: returns the number of repeated items with the given value in a specified list.

```python
product_prices = [12, 227, 0, 54, 0, 20]
free_products_number = product_prices.count(0)

print(free_products_number) # 2
print(product_prices.count(224578)) # 0
```

## index(value)

**index(value)**: this list method returns the position at the first occurrence of the given value in the specified list.in addition, this method raises an error if the given value does not exist in the specified list.
```python
admins = ['John Doe', 'Aya Bouchiha', 'Simon Heebo']

print(admins.index('Aya Bouchiha')) # 1
print(admins.index('this is not an admin')) # error
```

## summary

+ **clear()**: deletes all list's elements.
+ **reverse()**: reverse the order of the list's elements.
+ **copy()**: returns a copy of the specified list.
+ **count(*value*)**: returns the number of repeated items with the given value in a specified list.
+ **index(*value*)**: returns the position at the first occurrence of the given value in the specified list, and raises an error if the given value is not found.

## References & useful Resources

+ [https://www.w3schools.com/python/python_lists_methods.asp](https://www.w3schools.com/python/python_lists_methods.asp)

+ [https://www.youtube.com/watch?v=lFzHFUvGL7I](https://www.youtube.com/watch?v=lFzHFUvGL7I)

+ [https://www.youtube.com/watch?v=chIRRLxdNVI](https://www.youtube.com/watch?v=chIRRLxdNVI)

+ [https://www.youtube.com/watch?v=rrGmQbmTfiA](https://www.youtube.com/watch?v=rrGmQbmTfiA)

To Contact Me:

+ email: developer.aya.b@gmail.com
+ telegram: [Aya Bouchiha](https://t.me/AyaBouchiha)

Have a great day!
Help ;-; 
Tags: swift, help
Published: 2021-07-28 23:39:57

import UIKit

class ItemTableViewCell: UITableViewCell {
    
    @IBOutlet weak var stepperText: UILabel!
    
    @IBOutlet weak var priceLabel: UILabel!
    
    var item : Item! // this is a view controller class that have the item data .. price as a double (var price: Double! )
    
    
    override func awakeFromNib() {
        
        super.awakeFromNib()
        
    }
    
    
    IBAction func stepper(_ sender: UIStepper) {
        
        var item : Item! // I called it again bc it didn’t connect in the stepper func ;-;
        
        stepperText.text = String(Int(sender.value))
        
        priceLabel.text = String(Int(sender.value))
        
        let n = item.price // HERE is the error (Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value)
        
        let nn = Double(Double(stepperText.text! ?? “0”) ?? 0)
        
        priceLabel.text = “\(n! * nn )”
        
        // i made this code to take the item price and when I use the stepper it multiple the step number with the price ;0; help plz
    }
}
This is Vidi, a programming language
Tags: computerscience, compiler
Published: 2021-07-28 22:02:34

https://vidi.dev

Ended up with a very simple syntax borrowing the "best" features most used from common programming languages like Java, C#, Pascal / Delphi, JavaScript, Python and others.

The difficult part is to provide modern functionality using the minimum possible set of keywords and symbols.

Getting closer to a beta state, right now 200+ of aprox automated 230 tests compile and run fine.

Pending to fix some bugs in the runtime interpreter mostly for generic types and exception  handling.
Conditional Classes Blade Directives in Laravel
Tags: laravel, php
Published: 2021-07-28 21:49:03

New in Laravel 8.51: @class Blade directive to add true/false conditions on whether some CSS class should be added.

The @class directive conditionally compiles a CSS class string. The directive accepts an array of classes where the array key contains the class or classes you wish to add, while the value is a boolean expression. If the array element has a numeric key, it will always be included in the rendered class list:

```
@php
    $hasError = true;
@endphp

<span @class([
    'p-4',
    'bg-red' => $hasError,
])></span>
```

Thank you for reading this blog.
the voxel syndrome
Tags: remote
Published: 2021-07-28 21:46:09

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

For the first time in two years I met a man, and I felt like I am talking to a fellow man. A man that is not my self.

When two psyches interact, the poet said, the consequences are infinite, as each psyche is total.

And here we are, talking pictures, ghosts as Derrida would say, talking to each other, day after day, discussing the new feature we will ship.

But when two pictures talk, so much is lost.

This will be studied for decades to come, the ghosts talking phenomenon. I wonder what name they would give it, I kind of hope its 'the voxel syndrome' or something cool.

This is not a post about remote work or office work. It is a post about us, about my team, and my company. 

The engineering community has pushed the 'I am more effective from home' thing for a while, and I absolutely support it, I am absolutely more effective from home. No distractions, no commute, no drama, no 20$ for coffee per day. I am confident we can deliver way more features like that, but it feels like I am alone in a multi player game.

I don't know if you ever had this experience, everything is there, and the world is working, you can do quests, and slay dragons, but its just not fun. I think there are people who enjoy that kind of work, just as there are people who enjoy playing solo games, and people who don't.

We are building a 0 to 1 product, it is difficult as fuck, its not "ship a bunch of features" thing or "move those tasks from in-progress to complete". Fuck the tasks. New ground we have to conquer.

People say "managers want people to go to the office because they want to control" and I say to those people, fuck you. Why are you working somewhere where the managers control you? Quit and stop bitching.

We need to cook together, we need to eat together, to share ideas and ship.

I hope we can go back to the office for 1 day a week, and I promise you, this day we will have a feast every week! And we will eat like Monkey D. Luffy after his adventures.

-b
ZeroTier makes running private cloud storage more accessible and easier to use
Tags: zerotier, networking, zerotrust, cloud
Published: 2021-07-28 21:42:13

Today we’re going to replace our cloud storage on our mobile and desktop devices with Seafile, inside of docker-compose, to run at home.

Read More: https://www.zerotier.com/2021/07/20/zerotier-makes-running-private-cloud-storage-more-accessible-and-easier-to-use/
Day 418 : Waiting for the Rain
Tags: hiphop, code, coding, lifelongdev
Published: 2021-07-28 21:26:56

_liner notes_:
- Professional : Today flew by quick. I think it was because I was talking with people through out the day. Feels like I didn't really get much done. haha. Plus it was cloudy all day and it was like waiting for the rain. I always get sleepy in that kind of weather.

- Personal : Last night, I got the data that comes back from the video analysis API stored in the database and showing up in both the admin dashboard and the video details page on the site. Watched an episode of "Fire Force". Checked out some tracks for the radio show. Then I went down a rabbit hole researching some technology for another project I'm looking to start.

![View of some trunks of trees in Botanic Gardens, Singapore](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5y59q7y9q2zs5m6x2i8.jpg)

Going to start uploading video recordings to another backup site and work on the functions to create thumbnails, highlight clips and the video analytics of previous videos. Then watch another episode of "Fire Force". Getting close to catching up. Maybe go through some tracks for the radio show. We'll see.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube Vg9j2QNl50g %}
Create a Netflix clone from Scratch: JavaScript PHP + MySQL Day 3
Tags: javascript, webdev, tutorial, mysql
Published: 2021-07-28 21:18:52

In this video we create the structure for our page


{% youtube QkmgJ9s448o %}


In this video,we will create the style sheet

{% youtube qPeQtBv9YXg %}


In this video,we will style the index page
{% youtube 02DN0aYo88k  %}

In this video,we will style the input
{% youtube Eo60uUTBB70  %}


If you like my work, please consider
[![Buy me a coffee](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jm11knj7d8zwcvo150q2.png)](https://www.buymeacoffee.com/cglikpo)
so that I can bring more projects, more articles for you

If you want to learn more about Web Development, feel free to [follow me on Youtube!](https://www.youtube.com/c/ChristopherGlikpo)
The "This" Keyword in JavaScript Simplified (Short & Concise Article)
Tags: javascript
Published: 2021-07-28 21:14:25

Hey guys. The "this" keyword in JavaScript can be very confusing because the creators of JavaScript made that keyword play multiple roles which could confuse a developer. In this article, I'll summarize the usages of the "this" keyword.

###[1] "This" in a Method
A method is just a normal function but which is a part of an object. Any usage of "this" in a method refers to the object it is in. For example, take a look at this key-value pair: 
```javascript
const person = {
  name: "Ishak",
  birthYear: 1831,         
  age: function() {
    return 2021 - this.birthYear;
  }
}
```

###[2] "This" as a Standalone Keyword
If you find any "this" keyword lying around in your JavaScript file, it refers to the global object (window object in browser and global in Node). 
```javascript
this.isALineOfCode;
```

###[3] "This" in a Function
While methods are functions that is part of an object, a function is a standalone code. Since it is not attached to any object/parent, "this" in a function refers to global object (window object in browser and global in Node).
```javascript
function doSomething() {
  return this;
}
```

###[4] "This" in Function in Strict Mode
While developers would usually prefer to use TypeScript if they want to be strict, strict mode is a great option for starters. In strict mode, if you write "this" in a function, you'll get undefined.
```javascript
"use strict";

function doSomething() {
  return this;
} 
```
Now... Let's learn Apollo!!!
Tags: apollo, graphql
Published: 2021-07-28 21:04:39

So... good morning???? Okey, I don't know. UwU

## What is Apollo? <a name="what-is-apollo"></a>
The official definition is:
> Apollo is the industry-standard GraphQL implementation, providing the data graph layer that connects modern apps to the cloud.

What does it mean?
<img width="100%" style="width:100%" src="https://media.giphy.com/media/bPTXcJiIzzWz6/giphy.gif" />
JEJEJEJEJEJJEE

Let's try and resume this definition... is a way of using GraphQL in every place, in Front and Back. I guess this is right.

We have:
- **Apollo client**, to use in the Front (something like, fetching data)
- **Apollo server** for the Back
- **Apollo Federation**, which I kind of like it because is a way of segregation of a monolithic graph, which is cool, because you don't have just one graph.
- **Apollo Studio** a place to build graphs and be more secure and some good stuff if you really need it.

### » What will we use? <a name="what-will-use"></a>
Of course!!! Apollo client 😁. Why?
Because is what we need, the Back is done, we just need to make a good website.

---

## Follow me!
(I liked more the red bird :_()
🐦 [Twitter](https://twitter.com/blit12_)
🐙 [GitHub](https://github.com/blitty-codes)
👥 [LinkdIn](https://www.linkedin.com/in/blitty/)

---
Getting started with Svelte
Tags: svelte, webdev, tutorial
Published: 2021-07-28 20:59:02

### What is Svelte?

 According to the [official website](https://svelte.dev/); 
> "Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue do the bulk of their work in the browser, Svelte shifts that work into a compile step that happens when you build your app."

In simple terms, Svelte is a tool for building JavaScript-based web applications like React, Angular or Vue.
> Technically, Svelte acts as a compiler.

Enough of the bells and whistle, there are many articles about how good and powerful Svelte really is, let's get right into our first project.

### Our first Svelte Project.

_TLDR: Use the online [REPL] (https://svelte.dev/tutorial/basics) to learn without installing anything locally._

#### Requirements
- Install 
  - Node
  - Git
- Basics of:
  - HTML
  - CSS
  - JavaScript
  - Navigating the Command Line

```bash
// download the official svelte template
npx degit sveltejs/template project-name

// enter into project
cd project-name

// install dependencies to run svelte
npm install

// run the development server
npm run dev
```

Open browser and type `localhost:5000`, you should see something like this.
![svelte-hello](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19fv44r7f8kjt8gqh8zd.png)

#### Conclusion
Thanks for reading. Next up will be about the file structure in [Svelte](https://svelte.dev/).

### External Resources
- [Official Tutorials](https://svelte.dev/tutorial/basics)
- [Official Docs](https://svelte.dev/docs)
- [Why choose Svelte](https://dev.to/demonicious_/why-you-should-choose-svelte-for-your-application-a-basic-introduction-275f)
- [All you need to know before learning Svelte](https://dev.to/dailydotdev/building-with-svelte-all-you-need-to-know-before-you-start-2knj)
- [10 Reasons to use Svelte](https://dev.to/mhatvan/10-reasons-why-i-recommend-svelte-to-every-new-web-developer-nh3)
10 simple VS code shortcuts that help me be more productive
Tags: vscode, productivity, dev, shortcuts
Published: 2021-07-28 20:31:42

In VS Code there exist bunch of keyboard shortcuts, which help programmers not use GUI or mouse, while they are writing code. Probably, its not possible to remember every shortcut. That's why we have keyboard shortcuts sheet, here is a [link] (https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf) or open it via VS Code with Ctrl + K Ctrl + R (it's a bonus one). Important thing at beginning is start to use at least some of them.
If you are successful with using it, you should carry on with adding another ones. With everyday using, you will you use it automatically, and your writing will be less interrupted with using mouse or GUI, which makes you more productive.

I choose some useful shortcuts which was really easy to adapt and I use them on daily basis. 

###Ctrl + B
Open/Close left sidebar.
###Ctrl + F
Find occurrences of keyword in a current file
###Ctrl + Shift + F
Find occurrences of keyword in whole project
###Alt + Left/Right Arrow
Return to previous / following position of cursor.
###Ctrl + P
Search files by name. Hint: Don't have to write whole names just part of them.
###Ctrl + Shift + P
Search in command palette
###Ctrl + \ 
Split screen. Current file is opened in new split window
###Alt + Shift + Up/Down Arrow
Copy whole current line up or down
### Alt + Up/Down Arrow
Move line up or down
###Ctrl + / 
Comment whole line


If you know any simple helpful shortcut, feel free to comment.

Follow me on [Twitter](https://twitter.com/smetankajakub_)

######Picture by Daniel Agrelo from Pixabay
usr bin env bash r no such file or directory on wsl ubuntu on windows
Published: 2021-07-28 19:49:15

I was trying to use npm and get this message on my terminal ubuntu on windows: usr bin env bash r no such file or directory

To solve this problem:

1) Create a file: sudo vi /etc/wsl.conf
2) write this on it:

[automount]
enabled = true
mountFsTab = true
root = "/mnt/"
options =

[network]
generateHosts = true
generateResolvConf = true

[interop]
enabled = true
appendWindowsPath = true

3) Save and exit no VI press ESC and : and x ( save and exit )
Welcome Thread - v135
Tags: welcome
Published: 2021-07-28 19:43:56

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

![Angela from the office chewing on straw and saying "hay"](https://media.giphy.com/media/gVnqn7XhCUKYg8A4yI/giphy.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!**
Try..catch..finally in JavaScript
Tags: javascript
Published: 2021-07-28 19:39:43

Too often I find myself writing this type of code:

```js
function cleanup(){ 
  // Doesn't matter what this does, it just needs 
  // to be run after the function is done doing the thing
}

function doTheThing(){
  try {
    // do something that could throw an error
    cleanup();
    return results;
  } catch(error) {
    // handle the error
    cleanup();
    return error;
  }
}

const result = doTheThing();
```

Essentially, `cleanup()` needs to be ran regardless if our function was successful or not. Luckily, JS provides a nice way to do that for us 🥳


```js
function cleanup(){ 
  // Doesn't matter what this does, it just needs 
  // to be run after the function is done doing the thing
}

function doTheThing(){
  try {
    // do something that could throw an error
    return results;
  } catch(error) {
    // handle the error
    return error;
  } finally {
    // the finally block gets run regardless of 
    // whether we had an error or not
    cleanup();
  }
}

const result = doTheThing();
```

So using `finally` can clean up our code quite a bit!
Primeiros passos com Machine Learning
Tags: python, datascience, machinelearning
Published: 2021-07-28 18:22:00

Criei o repositório em meu gitHub, aonde irei salvar os arquivos que utilizaremos para implemebntar nossos exemplos.

https://github.com/LeonardoVieiraNeto/PrimeirosPassosMachineLearning

![repositório criado em meu GitHub para armazenar os arquivos que iremos produzir](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7p9av02k6v0lwuwkfv50.png)

Para implementar nossos exemplos, iremos usar uma ferramenta 0800 e fácil, o Google CoLab
https://research.google.com/colaboratory/

Irei salvar os arquivos .ipynb do GoLab no repositório criado em meu GitHub.

![Salvar cópia do arquivo no GitHub](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fma8krdmkvbqrsu7i4pz.png)

Para começar, vamos pensar no senguinte cenário:

Moro fora da cidade grande, estou no inteioro de MG, a vida fora da cidade é diferente. Os custos das coisas do dia a dia também são diferentes. Os preços aqui com certeza são diferentes dos da cidade! Preciso começar a prestar mais atenção às finanças se e me sair bem aqui. Você pode ajudar a descobrir quanto vai custar a minha compra ?

Tenho algumas listas que irei usar como referência. Nelas, tenho o itens que costumo comprar, com o preço que eu pagava em BH e o valor que pago aqui, em Abaeté!

Criei uma lista, com 17 itens, seu valor em BH e o valor aqui em Abaeté.

![Código implementado em Python, para mostrar o uso de listas](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qih8draobl2wlxlkzdw8.png)

Shopping_list - Guarda os itens da minha compra.
BH_price - Guarda os valores pagos nos produtos em BH.
abaete_price - Guarda os valores pagos nos produtos aqui em Abaeté.

total_produtos_em_abaete - Armazena a soma dos produtos em BH.
t_abaete

Com esses dados, conseguimos colocar um primeiro simples exemplo. Calculei o percentual de diferença, entre os preços de BH e os preços aqui de Abaeté.

Nos próximos dias, vou continuar postando artigos, incrementando os exemplos, aumentando o nível de dificuldade.
Some useful CSS Short Code Snippets
Tags: html, css, webdev, beginners
Published: 2021-07-28 18:14:36

### 4 Ways to to center content with CSS
1. Flexbox
2. Grid
3. Transform
4. Table

https://www.30secondsofcode.org/articles/s/css-centering


## Typewriter effect
![Typewriter Effect](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/whyksu3ueoe6fud4grxo.gif) https://www.30secondsofcode.org/css/s/typewriter-effect


## Pulse loader
![Pulse Loader](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6l2hs8h1qrbxyxqtnsix.gif)https://www.30secondsofcode.org/css/s/pulse-loader


## Truncate Text with CSS
![Truncate Text with CSS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/50dm4zajaih7eu43k8hq.PNG)https://www.30secondsofcode.org/css/s/truncate-text

Want to read More, [Click Here](https://beginners-developer.blogspot.com/2021/07/some-useful-css-short-code-snippets.html)
301 reditect a domain with exception
Published: 2021-07-28 18:03:14

Here is the simple mod_rewrite rule that will help you redirect your site URL to another domain with exception. Assuming we have a domain named "foo.example.com" and we want to redirect all our site traffic to an external domain "bar.example.com" with an exception that our /admin/ directory should not redirect, we can use the following in htaccess :

<pre>
RewriteEngine on

RewriteRule !admin https://bar.example.com [L,R=301]
</pre>
See the full article on this page : https://helponnet.com/2021/05/01/redirect-domain-with-exception/
ReactJS widget on JSP page containing an other React application
Tags: react, webpack
Published: 2021-07-28 17:47:47

There is a JSP page on which we have a react application loading on a div element at present. I want to build an independent widget with React (kind of a chatbot) and add it to the same JSP. However, I do not want the react libraries of the existing app and widget to interfere each other. They might be of using different versions of react as well. Is there any way to embed entire react library and css with the widget bundle?