teleren/devto huggingface dataset:
Classmethod vs Staticmethod in Python's OOP
Tags: python, oop, programming
Published: 2021-08-26 19:19:09


# A little code written to understand classmethod and staticmethod 

```
class Area: #defining an area class
    def __init__(self,wt,ht):
        self.ht= ht
        self.wt= wt
    def area(self): #defining a simple rect area method
        return self.wt*self.ht
        
    @classmethod
    def sqr(cls,sd): #defining a square method to take advantage of the rect area method
        return cls(sd,sd)
        
class Tri(Area): #defining a triangle class to inherit from the area class
    def area(self): 
        super().area() #calling the rect area method from the super_class "Area"
        return int(0.5*self.wt*self.ht) #using the super_class's argument to output the triangle's area
    @staticmethod
    def check(var): #defining a regular function
        if var>=20:
            print("This triangle has a large area")
        else:
            print("Small area detected")

rect= Area(4,5)
sqr= Area.sqr(7) #initiating the square's area
tri= Tri(30,100)

Tri.check(tri.area()) #calling the regular function (initiating the staticmethod). This takes the format: class.method()

#tri.check(tri.area()) the above can also be written this way. This takes the format: object.method()

print(rect.area(),sqr.area(),tri.area())
```

---

#Note 01: To initiate a classmethod or call a staticmethod; the format is as follows "class.method()"
---
#Note 02: To initiate / call other methods or staticmethod, the format is as follows; "object.method()"
---
#Note 03: Note that staticmethods can be called in 2 ways; 
#By class e.g class.method()
#By object e.g object.method()
Apple Pay Transparency Survey and the Battle Against Twitch Hate Raids — on DevNews!
Tags: news, podcast
Published: 2021-08-26 19:11:29

---
title: Apple Pay Transparency Survey and the Battle Against Twitch Hate Raids —  on DevNews!
published: true
description: Listen to S5E6 of the DevNews pod!
tags: news, podcast
series: DevNews Season 5
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/zoxvbu0494gq3sxtjp4v.png
---

Listen to S5E6 of the DevNews podcast today!

{% podcast https://dev.to/devnews/s5-e6-apple-pay-transparency-survey-and-the-battle-against-twitch-hate-raids %}

**Hosts:** @saronyitbarek & @coffeecraftcode 

**Guests:** 
- Cher Scarlett(@cher), Software Engineer @ Apple
- [JustMeEmilyP](http://twitter.com/@justmeemilyp), Twitch streamer and moderator
- [NLA](http://twitter.com/@n_lasouris.), Twitch moderator  

In our show this week, we discussed Cher's endeavor for salary transparency at Apple to battle pay disparity and the challenges she’s faced during this undertaking. We also talked about the proliferation of Twitch Hate Raids and the tools and resources they and others have built to fight against it with JustMeEmilyP and NLA. 

We hope you enjoy this episode of [DevNews](dev.to/devnews)!


---

_You can [follow DevNews](dev.to/devnews) to get episode notifications and listen right in your feed_ _— or subscribe on your platform of choice! Plus, if you leave us a review, we'll send you a free pack of thank-you stickers. Details [here](https://airtable.com/shr8oKAIMZgdYnBxx)._ 

## **Quick Listening Links**
- [Apple Podcasts](https://podcasts.apple.com/us/podcast/s5-e6-apple-pay-transparency-survey-and-the/id1525581923?i=1000533178037)
- [Spotify](https://open.spotify.com/episode/4amWoUba9Gml8GKfABTycT)
- [Google](https://podcasts.google.com/feed/aHR0cDovL2ZlZWRzLmNvZGVuZXdiaWUub3JnL2Rldm5ld3NfcG9kY2FzdC54bWw/episode/aHR0cHM6Ly9kZXZwb2RzLmRldi9wb2RjYXN0cy9kZXZuZXdzLzM4?sa=X&ved=0CAQQkfYCahcKEwiQy622sc_yAhUAAAAAHQAAAAAQCg)
- [Stitcher](https://www.stitcher.com/show/devnews/episode/s5-e6-apple-pay-transparency-survey-and-the-battle-against-twitch-hate-raids-86358356)
- [Listen Notes](https://www.listennotes.com/podcasts/devnews/s5e6-apple-pay-transparency-Sel9sLAIcfW/)
- [TuneIn](https://tunein.com/podcasts/Technology-Podcasts/DevNews-p1352512/?topicId=165373522)
- [RSS Feed](http://feeds.codenewbie.org/devnews_podcast.xml)
- [DEV Pods website](https://devpods.herokuapp.com/podcasts/devnews/episodes/186)

#### _Acknowledgements_ 
- _@levisharpe for producing & mixing the show_
- Our season five sponsor, [Scout APM](https://scoutapm.com/devnews) ❤️ 


We hope you enjoy this episode of DevNews!
Cara membuat project baru react native menggunakan Expo
Published: 2021-08-26 18:56:28

Untuk memulai membuat project baru react native caranya mudah sekali,

1. install npm

2. install yarn

3. install expo

setelah 3 tahap instalasi dilakukan, buka command prompt

ketikan syntak dibawah ini

<pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"><code style="color:#000000;word-wrap:normal;"> expo init namaprojectbebas  

</code></pre>

note: nama project bebas ya, bisa diganti sesuai dengan yang kita inginkan

setelah itu akan muncul opsi seperti dibawah, untuk mulai codingan awal saya biasanya memilih blank, setelah memilih blank maka proses instalasi dimulai

<a href="https://ibb.co/FxBY5Rr"><img src="https://i.ibb.co/7YGpnsf/Screenshot-2.png" alt="Screenshot-2" border="0"></a>

tunggu proses instalasi project baru selesai

setelah selesai maka akan terbentuk sebuah folder baru yang berisi aplikasi react native yang baru saja kita buat, untuk masuk ke direktori tersebut, pada command prompt ketikan

<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code>expo init namaprojectbebas  

</code></pre>



kemudian ketikan perintah dibawah, untuk menjalankan apps tersebut

<pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"><code style="color:#000000;word-wrap:normal;"> yarn start

</code></pre>

setelah itu akan muncul pop up browser, pada menu sidebar pilih open project in web browser, selesai

untuk editing kode bisa menggunakan atom, dengan open folder project yang baru saja kita buat. Ketika ada perubahan dan di save , otomatis tampilan di browser akan berubah.
Weekend Hack: Patreon Pledges Calculator
Tags: showdev, vue, cypress
Published: 2021-08-26 18:28:10

---
description: Last weekend I coded a simple web app. It lets users visualize how much money they've pledged to Patreon creators
---

Last weekend I coded a simple web app. It lets users visualize how much money they've pledged to each creator they've supported on Patreon.com

![Patreon Pledges Calculator](https://user-images.githubusercontent.com/1411843/130349351-a2145b0d-ae0f-4693-bda9-0aca4388c568.PNG)

link: https://patreon-pledges-calculator.netlify.app
repo: https://github.com/mornir/patreon-pledges-calculator

Surprisingly, it is not possible to get that information from the official website. One can only view its billing history. However, from that history data, it's possible to calculate the total amounts of pledges per Patreon creator.

The data is delivered through a `/bills` endpoint in the JSON format. My first thought was to the Patreon API and have the users authenticate with their Patreon account. For that I needed create a Creator account, which I did. But then I realized that I could only get access to bills/payments made to my account. 

This actually makes sense: billing data are private and sensitive and shouldn't be exposed to all Patreon creators. My guess is that the main purpose of the Patreon API is to let creators manage their supporters (for example for gated content).

So I decided to just let users dump their JSON payload in a `textarea` 😆
It does the job and users don't need to worry about privacy (btw I should probably mention on the web page that all data are processed by the browser).

## Tech Stack

I used Vue 3 with Vite. I kept to the good ol' Options API, as I'm not a fan of the new Composition API. Anyway, [in the Vue 3 docs](https://v3.vuejs.org/guide/composition-api-introduction.html), the Options is still taught first and the Composition is said to be reserved to big and complex application 🤷‍♂️

Since it's just a one page website, I thought that this time I could just go with Vanilla CSS, but it seems that I've already developed a severe addiction to [tailwindcss](https://tailwindcss.com/) to the point that I use it anywhere and anytime. 🍹 
I especially love how easy it was to create a nice list animation using [Vue List Move Transitions](https://v3.vuejs.org/guide/transitions-list.html#list-move-transitions) and Tailwind utilities classes while still caring about the user's motion settings (`prefers-reduced-motion`).

```html
<transition-group
  move-class="motion-safe:duration-1000 motion-safe:ease-in-out">
</transition-group>
```

What else? Well I just love playing with [Cypress](https://www.cypress.io/). Seeing those tests passing just feels me with joy. So I added a few test cases for good measure. 🧪

And that's it! Try it out here if you have a Patreon account: https://patreon-pledges-calculator.netlify.app/
How to start a project with SolidJS
Tags: javascript, solidjs
Published: 2021-08-26 18:27:06

In this article, I'll show how to start a new project with [Solid](https://www.solidjs.com/).

# Code generator
The easiest way to start development with Solid is on the project page in [Get Started](https://www.solidjs.com/guide):
```shell
$ npx degit solidjs/templates/js solidjs-hello-world
npx: installed 1 in 0.874s
> cloned solidjs/templates#HEAD to solidjs-hello-world
```

It's coming with working [vitejs](https://vitejs.dev/) configuration - so we can save all the troubles needed to set up the bundling infrastructure.

# Instalation 
First, we need to install all the dependencies:
```shell
$ npm install

> esbuild@0.12.23 postinstall /home/marcin/workspace/github/solidjs-hello-world/node_modules/esbuild
> node install.js

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/vite/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN vite-template-solid@0.0.0 No repository field.

added 75 packages from 74 contributors and audited 76 packages in 6.435s

6 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
```
# Dev server
We can start the server with:
```shell
$ npm run start
  vite v2.5.1 dev server running at:

  > Local: http://localhost:3001/
  > Network: use `--host` to expose

  ready in 353ms.
```

The generated application looks like this:
![default-app.png](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qvxfuby8emthbnviha8p.png)

# Hello world
To simplify the example, we can replace `src/App.jsx`:
```JSX
import styles from "./App.module.css";

function App() {
  return (
    <div class={styles.App}>
      <header class={styles.header}>
        <p>Hello World!</p>
      </header>
    </div>
  );
}

export default App;
```

The dev server updates automatically on the change, and we can see the following page:

![hello-world.png](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fhu828e0nilt88hhc5q0.png)

# Links
* [repository](https://github.com/marcin-wosinek/solidjs-hello-world)
* [working page](https://marcin-wosinek.github.io/solidjs-hello-world/)
* [free course pre-registration](https://www.subscribepage.com/freesolidjscourse)

# Summary
In this article, we have seen how to start a SolidJS project using the recommend code generator.
A strange man in a trenchcoat handed me an unmarked manila envelope...
Tags: jokes, podcast
Published: 2021-08-26 18:25:32

Inside, there was a single sheet of white paper, on which was typed a sentence, in fresh typewriter ink:

"A new episode of COUNCIL OF THE WISE DEVELOPERS drops tomorrow morning!"

https://rss.com/podcasts/councilofthewisedevelopers/
Negotiation Tip: Stop Rounding Up 
Tags: negotiation, career, interview, job
Published: 2021-08-26 18:12:54

When you're negotiating your salary at a new job or asking for a raise, do your homework and ask for a specific number.

Candidates who research their market value before negotiating for more money have been shown to fare better in negotiation. 

According to [research done at Columbia University](https://www0.gsb.columbia.edu/mygsb/faculty/research/pubfiles/5957/precise_offers.pdf) and published in [The Journal of Experimental Psychology](https://www.sciencedirect.com/science/article/abs/pii/S0022103113000401?via%3Dihub), _even if you haven't done your homework_, it's always a better idea to give an exact number vs rounding to the nearest thousand.

Here are some of their findings:   

1. Recipients of precise opening offers made more conciliatory counter-offers.

2. This effect carried through to final settlements.

3. Precise first offers were seen as more informed, prompting smaller adjustments.

A number like $109,750 rather than $110,000 will give employers the perception that _you must know something they don't_, and they will assume the number is based on your actual worth. 

If you're having trouble coming up with your market value, comment below 🤑
Leading 650 Engineers with Microsoft's Brendan Burns
Tags: techtalks, leadership, podcast, devops
Published: 2021-08-26 18:12:23


Brendan Burns is famous in engineering circles as one of the co-founders of Kubernetes, but he’s more than just a talented developer — he leads a team of 650 engineers at Microsoft.

In the first episode of a two-part series, Brendan joins the Dev Interrupted podcast to talk all things engineering leadership and management. After joining Microsoft and being given a team of 30 people, he has seen his teams double each year. Adopting a leadership style that he jokingly refers to as “my form of punishment is micromanagement,” Brendan discusses how to be intentional about employee interactions in a remote world, the importance of delivering a concise message and why saying “yes” to as many opportunities as possible has led to career success.

#**Listen to the full episode**
{% spotify spotify:episode:3XmNoCbN4Yxut30Fy1KO4R %}

## Episode Highlights Include:

* Learning to program on a Commodore 64

* Saying “yes” to as many opportunities as possible

* The “meet them where they are” philosophy of employee interaction

* How to run distributed engineering teams

* Being intentional about meeting employees in a remote world

* Why missing deadlines creates opportunity

{% youtube qCKRMK1Uk1c %}

**If you haven't already heard**, Dev Interrupted is partnering with Dzone to host **INTERACT**: An interactive, community-driven, digital conference on September 30th - by engineering leaders, for engineering leaders. 1 day, 10 speakers, 100s of engineers and engineering leaders, all free.

![](https://cdn-images-1.medium.com/max/2400/0*nHzak-kDc0MzrG55.gif)

# [Register Now](https://devinterrupted.com/event/interact/)
______________________________________________________________

## Join the Dev Interrupted Community

If you haven’t already joined the best developer discord out there, WYD?

Look, I know we talk about it a lot but we love our developer discord community. With over 1500 members, the Dev Interrupted Discord Community is the best place for Engineering Leaders to engage in daily conversation. No salespeople allowed. [Join the community >>](https://discord.gg/tpkmwM6c3g)

![](https://cdn-images-1.medium.com/max/2048/0*xR_ViPMd2T8ljTzt.png)

________________________________________________________

*Originally published at [https://devinterrupted.com](https://devinterrupted.com/podcast/leading-650-engineers/).*
I just started my new blog about accessibility
Tags: html, css, javascript, a11y
Published: 2021-08-26 17:38:28

Hey!

I just started my new blog about web accessibility. I try to update it as often as possible, so if you’re interested in the topic, feel free to **add it to your bookmarks**. Every feedback is welcome and appreciated. :)

https://uselessdivs.com/
How to Read XML File in Laravel 6,7,8
Tags: laravel, php, webdev, programming
Published: 2021-08-26 17:14:08

Let’s have a look at an example of how to read an xml file in Laravel. I’ll show you an example of laravel reading an xml file. We’ll discuss about how to read an xml file in Laravel. In this tutorial, I’ll show you how to read an xml file in Laravel.

In Laravel 6, Laravel 7, and Laravel 8, you can easily read xml files.
Create Controller

Now let’s create XMLReaderController:
```
php artisan make:controller XMLReaderController 
```
App\Http\Controllers

```
<?php 
   
namespace App\Http\Controllers; 
    
use Illuminate\Http\Request; 
   
class XMLReaderController extends Controller 
{ 
    /** 
     * Write code on Method 
     * 
     * @return response() 
     */ 
    public function index() 
    { 
        $xmlString = file_get_contents(public_path('put-the-xml-file-path')); 
        $xmlObject = simplexml_load_string($xmlString); 
                    
        $json = json_encode($xmlObject); 
        $phpArray = json_decode($json, true);  
    
        dd($phpArray); 
    } 
}

```
Hope it helps!
How to Access JavaScript Arrays in Objects
Published: 2021-08-26 17:08:01

Have an Object that contains an array, Then How to Access Arrays in Object,

Here is the simple Solution

Here's  my Object
```
const myobj = {
"name":"John",
"age":30,
"cars":["Ford", "BMW", "Fiat"],
"PetName":"Dogee"
}
```

Think if you need to access value in `cars` array. Just Code Like this 
 ```
myobj.cars[value_index]
```

So simple, isn't it? So Keep Following for tips like this.
Why do you need an explanatory video for an insurance company?
Published: 2021-08-26 17:05:27

An Explainer Video is an informative video, usually less than 5 minutes in length, describing what the company is doing or how the product works. This is not a tutorial, but rather a persuasive marketing message. It draws attention to the viewer's pain points and explains how a product / process can become a solution. Sometimes these are animated videos, but a simple form is also possible where a person speaks to the camera.
For an insurance company, such videos will be very useful because in 60 seconds or a few minutes you can illustrate a situation that will show that insurance is needed (help in creating https://explain.ninja/video-for-insurance/  )

Usually, promo videos are posted on a company's home page or landing page, but they can also be shared on social media as advertising or as part of crowdfunding campaigns.
Easy local tunnel with docker environment
Tags: localtunnel, devenv, docker
Published: 2021-08-26 16:58:24

## Why?

- You can provide demo for your web application from development environment
- You can use domain and https connection for test purposes
- It is pretty easy to setup

## How?

Try to use tunnel services like [ngrok](https://ngrok.com/), [localtunnel](https://localtunnel.me/), etc...

You can check it with docker-compose. Setup `docker-compose.yml`, for example:

```yaml
# docker-compose.yml
version: '3.8'

services:
  server:
    image: nginxdemos/hello
    ports: 
      - 80
    
  localtunnel:
    image: efrecon/localtunnel
    restart: on-failure
    command:
      --local-host server --port 80 --subdomain $SUBDOMAIN
    environment: 
      - SUBDOMAIN=megauniquedomain
    links:
      - server
    depends_on:
      - server
```

Run this config with `docker-compose up -d`
Then check https://megauniquedomain.loca.lt/ you will meet your server root page.

## How does it work?

I found [great answer on stackoverflow](https://stackoverflow.com/a/53180742/4636729) for you!
Brief History Of Bootstrap
Published: 2021-08-26 16:53:54

Free and open source, Bootstrap is a framework for creating websites and online applications. It is designed on CSS and JavaScript (JS) to make it easier to create responsive, mobile-first websites and apps using the Bootstrap framework. As a result of responsive design, a website or app can recognise the size and orientation of a visitor's screen and dynamically adjust its presentation appropriately. Employers rely on mobile applications as their primary means of completing tasks, therefore it's important that designers take into account the technology's requirements.

In addition to the framework, Bootstrap contains user interface components, layouts and JS tools. Source code and precompiled applications are also available. Bootstrap was created in mid-2010 by Mark Otto and Jacob Thornton at Twitter to improve the uniformity of tools used on the site and reduce maintenance costs for the site. Previous versions of the programme were referred to as Twitter Blueprint and Twitter Bootstrap.

 After a few months of development, Twitter conducted its inaugural Hack Week, and the project expanded as developers of various skill levels stepped in without any external supervision from the company. As of today, it still serves as a style guide for internal tool development.
There have been almost twenty releases since the first on August 19, 2011, including two significant rewrites with v2 and 3. To make the entire framework more responsive, we included a responsive stylesheet in Bootstrap 2. By using Bootstrap 3, we made it responsive by default, with a mobile-first focus.
###Share Your Thoughts Below
Creative Coding Greyscale Circle Texture
Tags: canvas, javascript, creativecoding
Published: 2021-08-26 16:44:56

{% codepen https://codepen.io/ZevanRosser/pen/jOwPMVV default-tab=js,result %}

I learned how to code making things like this in <a href="https://en.wikipedia.org/wiki/Adobe_Director" target="blank">Director Lingo</a>. This speed coded snippet draws some shaky circles and lines. (Make sure to view it in fullscreen).

_See more stuff like this over @ [Snippet Zone](https://snippet.zone/)_