teleren/devto huggingface dataset:
Python: class vs. instance vs. static methods
Tags: python, tutorial, learning, beginners
Published: 2020-11-20 22:03:47

---
title: Python: class vs. instance vs. static methods
published: true
description: Understanding class methods, instance methods, and static methods in Python
tags: #python, #tutorial, #learning, #beginners
//cover_image: https://direct_url_to_image.jpg
---
In Python, a _method_ provides functionality to a Class.

There are, broadly, three types of methods:
- *Class Methods* : Provide functionality to a class itself
- *Instance Methods* : Provide functionality to one instance of a class
- *Static Methods* : Provide functionality that can be accessed from a class _or_ from one instance of a class

Consider the following Python class, which defines a `Person` object and the methods which allow that object to say "hello":
```python
class Person():
  # (Discussing __init__ is beyond the scope of this
  # tutorial)
  def __init__(self, first_name):
    self.first_name = first_name

  # Instance methods are the default method type in a
  # class definition. They receive the class instance
  # itself as their first argument. By convention, 
  # the parameter for this argument is labeled 'self'.
  def say_hi_from_an_instance(self):
    print(f"Hello! My name is {self.first_name}.")

  # Class methods are defined using a special
  # decorator, and receive the class as the first
  # argument. By convention, the parameter for this
  # argument is labeled 'cls'.
  @classmethod
  def say_hi_from_the_class(cls):
    print(f"Hello! I am a {cls.__name__}.")

  # Static methods are defined using a special
  # decorator. They are available on the class and on
  # instances of the class.
  @staticmethod
  def say_hi_from_anywhere():
    print("Why, hello!!!")

```

Now, from the class:
```bash
# We can call the class method greeting
> Person.say_hi_from_the_class()
Hello! I am a Person.

# But we cannot call the instance method greeting
> Person.say_hi_from_an_instance()
Traceback ...
TypeError: say_hi_from_an_instance() missing 1 required positional argument: 'self'
```

While, from an instance of the class:
```bash
> a_person = Person('Louise')

# We can call the instance method greeting
> a_person.say_hi_from_an_instance()
Hello! My name is Louise.

# And we can still call the class method greeting
> a_person.say_hi_from_the_class()
Hello! I am a Person.
```

Static methods are available on both classes and class instances. They are intended to provide functionality that does not rely on the class or instance itself:
```bash
> Person.say_hi_from_anywhere()
Why, hello!!!
> a_person.say_hi_from_anywhere()
Why, hello!!!
```

---

See also: [Ruby: class methods vs. instance methods](https://dev.to/adamlombard/ruby-class-methods-vs-instance-methods-4aje)

---

Was this helpful? Did I save you some time?

## {% cta https://www.adamlombard.com/support-me %} 🫖 Buy Me A Tea! ☕️ {% endcta %}

---
Angular: HTML Events and Asynchronous Handlers
Tags: angular, typescript
Published: 2020-11-20 21:53:31



```html
//A normal regular synchronous change detection
<input
 // the ngModel traid for 2 way data binding
  #city="ngModel"
  [(ngModel)]="address.city"
  (ngModelChange)=
    "address.city = onPropertyChange(city)"
  onPropertyChange(city) {       
      return city.viewModel;    
   }
/>

```

Specification changes, we need to kick off asynchronous work. We think, no problem; we'll just make the function async.

```typescript
  async onPropertyChange(city) {
      //Kick off this async job
      let something = await getSomething();
      return city.viewModel;    
   }
 
```
**NOPE**
Can't do that, Angular throws an error.

**Correct Way**
```typescript
 onPropertyChange(city) {
   Promise.All([getSomething]).then(result=>{
        //result here
   });        
   }
  return city.viewModel;    
 }

```
Contain the async work inside the function!
How competing in hackathons helped me land my first job
Tags: hackathon, job, career, programming
Published: 2020-11-20 21:52:27

---
title: How competing in hackathons helped me land my first job
published: true
description: "Competing in Hackathons"
tags: hackathons, job, career, programming
---

![](https://dev-to-uploads.s3.amazonaws.com/i/vc0600dwyav05r6h25kn.jpeg)


I got my frontend certifications with FreeCodeCamp back in 2017. I remember how daunting it was applying to jobs and feeling ready for the workforce. Everytime I sent an application in, I felt like it went to the void, never to be heard from again.

I wanted a way to standout amongst other applicants, and coding bootcamp students. I challenged myself everyday to "level up" as quickly as possible, and ultimately I ended up competing in a lot of hackathons.

It taught me a lot of things that I wouldn't have traditionally have gotten learning on my own. I learned how to work with others in a team setting, use git, use 3rd party libraries, and had a lot of mentorship and help along the way from senior developers

When I started applying to jobs, one employer took a chance on me. I was far from qualified compared to other applicants applying to the position. But he could tell that I was eager to learn new things and picked up things rather quickly, thanks to competing in hackathons. So he took a chance, and the rest is history.

I'm hoping to give back to the community from where I started from. I recently launched a podcast with one of my really close coding friends. It's called Code Chefs.

We recently recorded a podcast about our experiences with Hackathons
[https://codechefs.dev/hackathons](https://codechefs.dev/hackathons)

Hopefully this helps anyone looking to learn more about what a hackathon is and what you can learn from it!

Also writing out what I learned along the way helped too! 
[https://vincentntang.com](https://vincentntang.com)
✅ The Business Value of Identity
Tags: identity, business, values
Published: 2020-11-20 21:33:02

🔰 IAM is either making your business money or draining resources. Here’s how.
[Read more...](https://auth0.com/blog/the-business-value-of-identity/?utm_source=content_synd&utm_medium=sc&utm_campaign=value_identity)
What I plan to learn at the Learn Together: Developing Apps for Teams event 
Tags: beginners, programming, learning, devtips
Published: 2020-11-20 21:29:02

**Currently, there are 115+ million Teams daily active users. That is millions of new users that developers can reach when they develop apps for Teams.**

[Learn Together: Developing Apps for Teams](http://aka.ms/learntogether) is happening on Dec 16 and the event experience is going to be a bit unique. It will be more of a conversation-style event. These conversations are specially curated for developers (by developers) around the opportunities and reasons to build apps for Teams.   

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kvxkat2tiag0tjfelsnz.PNG)

So what are we most excited to learn in the two hours? 

1. [*Understand Teams Apps*](https://docs.microsoft.com/en-us/learn/modules/intro-microsoft-teams-apps/?WT.mc_id=m365-9410-cxa) Learn the key concepts and terms necessary to build apps for Teams. Expand on the messaging, Tab app, extensions, Bots, and more. Learn to speak the language! 

2. [*“Hello, world! for Teams*](https://docs.microsoft.com/en-us/microsoftteams/platform/build-your-first-app/build-and-run?WT.mc_id=m365-9410-cxa) Getting started with Teams app development is as easy as click, click, hello world! Learn to build apps for Teams in minutes with the Teams Toolkit Visual Studio Code extension. 

3. [*Make your app part of your user’s day.*](https://docs.microsoft.com/en-us/microsoftteams/platform/samples/integrating-web-apps?WT.mc_id=m365-9410-cxa) Enhance the usability of your application by integrating messaging and meeting extensions, adaptive cards, and more. 

The event is closely tied around the [Teams App Dev Learning Path](https://docs.microsoft.com/en-us/microsoftteams/platform/?WT.mc_id=m365-9410-cxa) and there will even be a Teams Dev Challenge for those that want to win prizes and put their skills to the test. 

Join us live on [Learn TV](http://aka.ms/learntv) or stream on-demand from [Channel 9](https://channel9.msdn.com/Events/Microsoft-Learn/Learn-Together-Developing-Apps-for-Teams) after the event.

We are excited to **#learntogether**! 

See you there!
A nice way to "combine" bash commands...
Tags: bash, cli
Published: 2020-11-20 21:01:46

A Coworker today showed me a nice way to combine bash statements. Of course you can use a semicolon but if you use a double ampersand instead the second statement will only be executed if the first one didn't end with an error. 

An example would be to check if a directory exists and if it does to copy some files into the dir. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jui23smip9ksrf79z5ne.png)
Instalá nodemon de manera global
Tags: node, nodemon
Published: 2020-11-20 20:32:42

Buenas! Estaba felizmente dando el curso de backend, enseñando a correr <strong>[nodemon](https://www.npmjs.com/package/nodemon)</strong> en el desarrollo de node cuando surgió el siguiente error: "nodemon: El término 'nodemon' no se reconoce como cmdlet, función, archivo de script." Siendo que ya lo habíamos instalado localmente, como te muestro en esta imágen:

![Instalación y falla de nodemon](https://dev-to-uploads.s3.amazonaws.com/i/36ci02i0kyefk4l9hey8.PNG)

Por lo tanto vamos a correrlo de manera global:

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

Luego seguramente te lanzará un nuevo error: "nodemon : No se puede cargar el archivo C:\Users\Usuario\AppData\Roaming\npm\nodemon.ps1 porque la ejecución de scripts está deshabilitada en este sistema."

Y para solucionarlo andá a "windows" y buscá Windows Powershell : 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/il59tduaw9nlhyotvizc.PNG)

Ahora correlo como <strong>administrador</strong>. Para ésto hacé un click derecho sobre el ícono de arriba y seleccioná "Ejecutar como administrador".

En el powershell vas a escribir: Set-ExecutionPolicy Unrestricted
Y enter
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bu0c7wg29ujbz33jc3mb.PNG)

Ahora confirmalo con la letra "s" (sin las comillas).

Listo! Ahora te funcioan nodemon :D
Correlo desde tu app.
Which JavaScript snippets do you use for analytics?
Tags: discuss, webdev, analytics, rudderstack
Published: 2020-11-20 20:18:10

Almost everyone uses Google Analytics’ JS on their websites. What other JS snippets do you include for site analytics, and what do they give you that Google Analytics doesn’t?

<br />  
*Cover photo by [Irvan Smith](https://unsplash.com/@mr_vero?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/computer-screen?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText).*
Byte-Sized Tech Tips Round-Up: Week 7 (The Vim Edition 
💻)
Tags: vim, bash, linux
Published: 2020-11-20 20:15:03

This week's round up has a special theme, it's all about [Vim](https://en.wikipedia.org/wiki/Vim_(text_editor))! At our weekly meeting someone had mentioned using Vim, which of course turned into a conversation about all the tips and tricks for using it. Let's start!

## Tip 1: Nigel's tip

> From [Nigel](https://www.linkedin.com/in/pnigelbrown/)

One of my favorite modifiers in Vim is being able to modify certain commands with numbers. When I want to delete a line, I use `dd`, but if I needed to delete three lines, I use `d3d`. This works with several commands and I encourage you to check it out.

## Tip 2: Make learning Vim fun!

> From
> {% user jritten %} 

If you’re looking to learn Vim, or have dabbled a bit and want to become  a Vim Jedi, I’ve put together some fantastic resources to get you started! [Vim Adventures](https://vim-adventures.com/) is a comprehensive Vim online game to teach you all things Vim. [Vim Genius](http://www.vimgenius.com/) will help you flex your Vim muscle memory and build up your skills and speed. If you prefer to work through technical documentation, [Learn Vimscript the Hard Way](https://learnvimscriptthehardway.stevelosh.com/) is a great resource for manually working through all things Vim. Oh, and I did I mention they’re all FREE?!? Gotta love online resources

## Tip 3: Double Z and NERDTree

> From
> {% user stevemar %} 

I'm cheating a bit and including two tips. We've all seen a joke about being unable to quit Vim, i.e.:

{% twitter 435555976687923200 %}

The good news is that there's an *easy* way! (No, really!)

1. Slam the `ESC` key a bunch of times.
1. Press `Shift` + `Z` twice (Double Z)
1. You've exited Vim!

The second tip is that if you really want to impress folks with your Vim skills install the [NERDTree](https://github.com/preservim/nerdtree) plug-in. 

![](https://raw.githubusercontent.com/preservim/nerdtree/master/screenshot.png)

*Photo credit to the folks at NERDTree*

NERDTree will add a file system explorer for the Vim editor, allowing you to switch between editing multiple files without ever having to leave Vim.
#66daysofdata and the workload

Tags: datascience, productivity, challenge, 66daysofdata
Published: 2020-11-20 19:44:04

For a long time one idea won’t leave me alone – the flashmob #66daysofdata on Twitter!

Unfortunately, now I am under pressure in my university :c But I’m eager to try it
Well, vacation at my university will be about two months – January & February. But there are only 59 days at these months! So, it means that in December I need to spend another 10 days on this challenge. According to my calculations, I’ll  be able to do this from the 23rd of December (By the way, we’re take into account the Christmas holidays). I’m looking forward to Christmas’ coming, when my university semester ends. But in this month, in parallel with this, I want to complete the following things:

• Kaggle micro-courses: Python (https://www.kaggle.com/learn/python)
                                          Pandas(https://www.kaggle.com/learn/pandas)

There are more amazing courses such as "Data Visualization" or "Intermediate/Intro to Machine Learning", but I want to take them when my challenge will start =)

• M4ML - Linear Algebra 

Playlist on youtube link: https://www.youtube.com/watch?v=T73ldK46JqE&list=PLiiljHvN6z1_o1ztXTKWPrShrMrBLo5P3

Course link: https://www.coursera.org/learn/linear-algebra-machine-learning

Excellent & extreme super performance! At the beginning of this year I chose this specialisation, but after ending this I’d stopped my learning by reason of the workload at the university and my extra language courses :c I want to repeat some of this knowledges. My plans include repeating them on YouTube channel. Maybe I’ll redo some of the exercises in my Coursera account.

• Mathematics, and more mathematics! Although Russian is my native language it is easier for me to courses about it on English, like the ones I gave above (lol), for instance. Nevertheless, there are difficult topics, and I go through them by http://mathprofi.ru/. Reading the articles of this cool dude in Russian is more comfortable for me than watching videos in this language.

• It’s much better to make a small plan and overfill it then write a huge one, fail it, and feel frustrated after this. However, I can’t remind myself about interesting problem collections, such as https://projecteuler.net/, where the key to the solution is in a mix of mathematic and programming. 
Also I want to notice this course about python: https://stepik.org/course/67/promo. Tasks in it are quite complex, but at the same time interesting. 

Well, I have presented to you my plan for the current month. Have fun!
Job application tips - interview with tech recruiter
Tags: career, beginners, video
Published: 2020-11-22 20:32:09

---
title: Job application tips - interview with tech recruiter
published: true
date: 2020-11-20 19:39:55 UTC
tags: career,beginners,video
canonical_url: https://www.notonlycode.org/job-application-tips-for-developers/
series: Finding a new job - interview guide for developers
cover_image: https://www.notonlycode.org/content/images/2020/11/2020-11-interview-with-Angus.jpg
---

In this video I'm interviewing Angus Mackintosh, a tech recruiter working in Amsterdam. Together with Angus we discuss job application best practices: where to find job offers, how to decide when to put more effort into application and how to ensure our resume gets noticed. Angus also shares some great tips about using LinkedIn - the tool that developers love to hate, yet a tool which is used by almost all recruiters. By following a few simple practices, you can increase a chance get contacted by recruiters and finding a new job!

{% youtube qJ7qVFh48uQ %}

🎥 Video timeline:  
[0:00](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=0s) Intro  
[1:00](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=60s) How's dev jobs market in the end of 2020  
[3:40](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=220s) Where to find good job offers  
[5:00](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=300s) How to read job requirements  
[8:10](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=490s) external vs internal recruiters  
[11:10](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=670s) How to write a good resume  
[14:30](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=870s) How to write about past jobs in the resume  
[18:00](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=1080s) Old jobs, education,  hobbies in the resume  
[22:00](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=1320s) Which social profiles and side projects to include  
[23:40](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=1420s) Should I put photo and personal details in my resume  
[27:00](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=1620s) Are cover letters worth it  
[28:40](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=1720s) How to use LinkedIn efficiently  
[32:10](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=1930s) LinkedIn - best and worst practices  
[35:00](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=2100s) What to do with company that doesn't response to job application  
[37:20](https://www.youtube.com/watch?v=qJ7qVFh48uQ&t=2240s) Outro
Introduction?

Published: 2020-11-20 19:24:07

In this blog I will try to describe my educational path in one of the most difficult areas of programming for me.
Moreover, this online resource is a way to improve my knowledge of English: D (at least I hope so)

I am Belarusian & Polish by birth, now I live in Tbilisi. I am studying philology at a local university (strange choice for a future data scientist LOL).
My humanitarian skills: Russian (free), Polish (A2 to B1), Georgian and Arabic (თითქმის).
Our Journey into Tech - Testing
Tags: testing, womenintech, motivation, codequality
Published: 2020-11-20 19:20:56

I had a great conversation with Beth Marshall about our journey into testing. We talk about the different paths that we have taken to end up at the same place - passionate about quality. We also fangirl about the amazing Angie Jones and speak about how we are dealing with COVID and work from home.

Take a listen

{% youtube TEmYb7fY8WE %}
Daily Challenge #309 - Coffee Customization
Tags: challenge
Published: 2020-11-20 19:11:10

---
title: Daily Challenge #309 - Coffee Customization
published: true
series: Daily Challenge
description: Implement a class CoffeeBuilder to build your cafe's custom coffee drinks. 
tags: challenge
//cover_image: https://direct_url_to_image.jpg
---
You're an employee at a local cafe. 

You can serve 3 coffee recipes:
- Black = `Black Coffee`
- Cubano = `Cubano coffee` + `Brown sugar`
- Americano = `Americano coffee` + `Milk with 0.5% fat`

... and you can add a lot of extra sugar and milk in any coffee, for example:
- `Black coffee` + `Milk with 3.2% fat` + `Brown sugar`
- `Cubano coffee` + `Brown sugar` + `Brown sugar` + `Cane sugar`
- `Americano coffee` + `Milk with 3.2% fat` + `Cane sugar`

With the following code provided for you, can you create a `Coffee` by implementing a `CoffeeBuilder` struct/class? 

You can start from scratch or use the following code as a starting off point: 
```
C++
struct Milk {
  float fat;
};

struct Sugar {
  std::string sort;
};

struct Coffee {
  std::string sort;
  std::vector<Milk> milk;
  std::vector<Sugar> sugar;
};
```
```
Rust
#[derive(Debug)]
struct Coffee {
    sort: String,
    milk: Vec<Milk>,
    sugar: Vec<Sugar>,
}

#[derive(Debug)]
struct Milk {
    fat: f32,
}

#[derive(Debug)]
struct Sugar {
    sort: String,
}

struct CoffeeBuilder {
    sort: String,
    milk: Vec<Milk>,
    sugar: Vec<Sugar>,
}
```

###Tests
1. A Black coffee with sugar and milk with 3.2% fat, please.
2. A Cubano coffee, please.
3. An Americano with two brown sugars, please.

Good luck!

***
_This [challenge](https://www.codewars.com/kata/59f6a855bee845d3cd000046) comes from arkada38 on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Introduction to the Path Module in Node.js
Published: 2020-11-20 19:08:00

Path module is one of the most useful built-in modules in NodeJS. Be able to use this module efficiently increases the clarity and organization of our code on one hand, and shorten the time spending on maintaining it on the other hand. In this article, We're going to look at four helper functions to make path manipulation in our projects easier.

###path.dirname
The path.dirname() method returns the directory name of a path. It's helpful to know the directory that a file is in.
```javascript
let ourPath = path.dirname('c:/data/code/test.js');
console.log(ourPath) // return 'c:/data/code'
```

###path.join
The join method takes two ore more path segments and joins them into one string that can be used anywhere as file path. let's suppose that we need the file path of a jpg image (myDog.jpg) for simplicity's sake.
```javascript
let filepath = path.join(__dirname, '/images/pics/',myDog,'jpg);
console.log(filePath); //returns 'C:/...../iamges/pics/myDog.jpg'
```

###path.basename
the basename() method returns the name of the file or directory that the file path points to.
```javascript
let ourBaseName =path.basename('D:/codeNia/mySite/index.html');
console.log(ourBaseName); //returns 'index.html'
```

###path.extname
extname method allow us to know the extension of the given path.
```javascript
let myHtml = path.extname('index.html);
console.log(myhtml) // returns .html
```

That's it, but you can find more by checking out the official path [documentation](https://nodejs.org/api/path.html)
100 days of code — Dia 9
Tags: python, programming, productivity, 100daysofcode
Published: 2020-11-20 19:01:15

<h2>(19/11/2020)</h2>
[Terminei o calendario]

Finalmente terminei o calendario, cara que trabalho sensacional, dediquei cada segundo dessa semana de trabalho para desenvolver algo do zero (quem sabe eu não disponibilizo um modulo disse só no github). Porém, como dito, foi preciso dedicar cada segundo de trabalho, ontem, por exemplo, fiquei das 9hrs da manhã até as 21hrs da noite trabalhando (não se preocupe, eu sei que não é ideal).

Em segundo plano, estou estudando Emacs, pois que fazer uma integração com Emacs + python, mas esse assunto fica para um proximo artigo.

A novidade é que terminei de ler o livro sapiens que, por sinal, foi um dos melhores livros que ja li em toda a minha vida. Acrescentei mais dois livros para a lista de livros que estou lendo no momento, segue atualização abaixo:

> Sapiens: 428/428 páginas;
> O que é racismo: 40/82 páginas;
> Uma carta de amor: 0/9 capitulos;
> O Alienista: 0/13 capitulos;


- O livro "Uma carta de amor" é um romance do escritor Nicholas Sparks, é a primeira vez que leio romance;
- "O Alienista" é um classico do Machado de assis, que eu queria ler a muuuuuuuuito tempo.

![02a755fa-6075-4b2e-973a-c5aeb35bc466](https://dev-to-uploads.s3.amazonaws.com/i/olxn95prpsiyc8sn7l8g.jpeg)


*Se hidratem, comam frutas, leiam bastante, a terra não é plana, vacinas salvam vidas e bolsonaro vai tomar no cu.*