teleren/devto huggingface dataset:
Dependency Injection | Writing loosely coupled code
Tags: ruby, oops, codequality, cleancode
Published: 2020-02-18 16:56:50

---
title: Dependency Injection | Writing loosely coupled code
published: true
description: 
tags: ruby, OOPs, code-quality, clean-code
---

In life, we depend on a lot of things to survive. And object-oriented languages that are used to simulate real-world entities in terms of the objects also have dependencies. They have it in terms of one object depending on others. We say that this object is dependent on others when any change in later will force a change in the previous one.

One object depends on other means it knows about it. The former one knows the name of the other object, it's properties and it's behavior. We call such objects tightly coupled i.e two objects are tightly coupled if they know a lot about each other and neither of them can't be reused without using the other one. 

Such type of codebase is not good in terms of the reusability of code. One such issue which causes tightly coupled code is referring to other classes directly in methods of a class. This makes the class to work with only that particular class which we have mentioned in the method. We can solve this by *dependency injection* 

*Dependency Injection means we explicitly inject dependencies into the new object we are creating.*

Always inject your dependencies and never explicitly mention them inside methods. 
Consider the following code:

```ruby
class Bill
  def amount
    total_price(list_product) + Restaurant.new.standard_service_tax
  end

  def total_price(list_product)
    # Return total amount by adding the price of each product
  end
end

```

The problem with this code is that the Bill class object will only respond to amount behavior if there is a Restaurant class present and implements `standard_service_tax` behavior. We are not able to reuse this Bill class with another class even though if that has `standard_service_tax` behavior implemented.

The correct code could be:
```ruby
class Bill
  attr_reader :service
  def initialize(service: Restraunt.new)
    @service = service
  end

  def amount
    total_price(list_product) + service.standard_service_tax
  end

  def total_price(list_product)
    # Return total amount by adding the price of each product
  end
end
```

Now we can pass any object to the constructor of Bill, and the amount will work if they have the `standard_service_tax` behavior implemented.

Summary

> Injecting dependencies will make the class loosely coupled and thus increases it's reusability. 


Happy Coding 🎉
hello world
Tags: beginners, launchschool, codenewbie
Published: 2020-02-18 16:45:12


Hey, I'm here!

It's 2020, time for a new blog. This time, I'm going "as free as possible" by joining up with the dev.to community and seeing what all this site has to offer!

This year, I evaluated a number of web developer bootcamps and free resources and I've decided to go down the route of learning software engineering through [Launch School](http://www.launchschool.com). There were a few reasons why I feel strongly that Launch School's core curriculum is for me.  In order to understand these motivations, it's important to know why I'm learning to code.

### Why I'm learning to code

* **I want to learn the foundations of software engineering** - I don't want a "learn coding quick" scheme. I want to truly understand the hows and whys behind why code is executed the way it is. I want a real base in order to continue foundational learning upon.
* **I want to be a better game producer** - Even if I never write a line of code at work, having a true understanding of the way the web works can only benefit me in my work in game development. I want to speak all the same language, understand engineer's motivations. 
* **I'm not looking for a career switch** - At least in the short term, I'm looking to learn software engineering on my own time with no immediate intentions to switch careers/roles into an engineering position. I just want to learn for learnings sake.

### Why Launch School works for me

* **It's self-paced** - Launch School is fully remote & self-paced. With a full time job and a 4 year old son, I can't devote 40 hours a week to coding. I have to learn slowly, which means I'm not able to devote to a 12 week FT bootcamp onsite.
* **It's a monthly fee** - Instead of being $8,000 - 30,000 like web development bootcamps, I'm going to be paying $199/month. I can pause or stop at any time. I can structure this around my life and my availability. 
* **Mastery-based learning** - Launch School isn't a dev bootcamp. It's a [mastery-based learning](https://launchschool.com/mastery) platform. It gives a very strong foundation that takes people anywhere from 9mo to YEARS to complete their curriculum. It's in-depth, it's detailed, it's mixed-media (though mostly text). It's the kind of program where I'm assessed when I'm ready and have support from TAs and the community, but I will truly understand everything before I am allowed to progress. As a person who is always looking for the "quick fix", this kind of slow, intentional learning is exactly what I need to learn a new way to learn.

I have just started the free prep course part of Launch School and I'm excited to document my learnings and experience here.
Discussion
Tags: html
Published: 2020-02-18 16:27:44

Frontend development was separated into two eras, before Bootstrap and after Bootstrap. In 2011, frontend framework ever was released. Also, in the same year, the adoption of the framework grew in great numbers.The reason of this is as follows: imagine how painful it was to create a simple, nice button, for instance. You had to declare a lot of classes and styles in your code. This was the foresee of Bootstrap, created by some developers from Twitter. The framework was a paradigm change for developing a fast-paced web page frontend.
DEV logo on Boxicons
Tags: design, meta, showdev
Published: 2020-02-18 16:12:32

{% link https://dev.to/devteam/the-dev-badge-is-available-on-font-awesome-2ihe %}

The Dev.to logo is now available on https://boxicons.com/. Nothing against Fontawesome, but the Boxicons license ([CC 4.0](https://creativecommons.org/licenses/by/4.0/)) allows both commercial reuse and *requires no attribution*.

By creating the issue and related pull request, I learned how easy open-source contribution can be. All it takes is time, patience, and ideas. The hardest part, to be honest, was waiting for the PR to be accepted.

{% github atisawd/boxicons no-readme %}
Ara fundraiser computer sale
Tags: showdev, machinelearning, android
Published: 2020-02-18 15:58:46

I am looking for support for ara voice assistant to do this I am selling a couple of dell precision t3610s (desktop computers) on ebay. The first one https://www.ebay.com/itm/153834406902 is 400 USD, has 32 GB of ram a 6 core 3.5ghz intel xeon e5, 2x nvdia quadro k600s, and is in very good shape. the other one https://www.ebay.com/itm/153834910618 is 300 usd and has the same specs as the last one except 16 gigs of ram and some scratching on the chassis.

### so what is ara?

well here is ara's github 

 {% github fultonbrowne/ara-android %} 

 {% github fultonbrowne/ara-server %} 

in brief ara is an open source voice assistant designed with privacy and productivity in mind. ara is currently at beta 8 and the 1.0 will be after beta 10. 


purchasing these machines will also help me start up 4 other project I am currently planning



you can also support ara with a coffee here: https://www.buymeacoffee.com/28EcqNL
To cd or not to cd...in a shell script?
Tags: bash, discuss
Published: 2020-02-18 15:55:57

In a few cases, I've noticed the use of `cd` in shell scripts, and this practice never really made sense to me. It seems so broken to change the current working directory to perform a command in a given context, such as another directory. I think using `cd` seems broken to me because it opens up the door that you might forget to `cd` back to the original directory if needed.

What do you think?

## Bad?
```shell
#!/usr/bin/env bash

set -euo pipefail

EASYRSA_PATH='/etc/openvpn/easy-rsa'

cd $EASYRSA_PATH

./easyrsa init-pki

# other commands unrelated to EASYRSA_PATH

```

## Good?
```shell
#!/usr/bin/env bash

set -euo pipefail

EASYRSA_PATH='/etc/openvpn/easy-rsa'

"${EASYRSA_PATH}/easyrsa" init-pki

# other commands unrelated to EASYRSA_PATH

```
Looking for a JS job in LA?
Tags: node, react, reactnative, la
Published: 2020-02-18 15:50:07

---
title: Looking for a JS job in LA?
published: true
description: Are you looking for a JS job in LA?
tags: nodejs, react, react-native, LA
---

Hi Everyone, 

I'm Andrew, CTO of a computer vision startup in LA. I've been helping a few friends source great JS devs for their companies and am now looking to help a few others outside my network. 


If you're great at React, Vue, React Native, or Nodejs and are looking for a job in LA, I'd love to speak to you.

https://airtable.com/shrNyhuFLfsC0pSaU


Thanks,

Andrew
Connecting to db with nodejs
Tags: javascript, node, help
Published: 2020-02-18 15:37:08

Hi everyone, I have a question about backend with node js. I am trying to connect to a server with ssh and after that connect to the db with login pass in another server. SSH part is successful however I can not connect to the db, the error is connect ETIMEDOUT. I am using sequelize ORM and ssh2, net packages. Can someone pls come up with ideas why this can happen?
Auto Generate requirements.txt from Your Python Code
Tags: python, dephell
Published: 2020-02-18 15:36:09

---
title: Auto Generate requirements.txt from Your Python Code
published: true
description: If you only have your code, you can make the package dependencies list.
canonical_url: https://515hikaru.dev/posts/2020-02-19-use-dephell/
tags: ["Python", "DepHell"]
---

## Introduction

If you are working with a data scientist, he might not make requirements.txt when he writes code in "notebook". And you often need to run the program on your PC, even though the program only ran on his machine. In this case, you may have to create python virtual environment without requirements.txt(or other dependencies list).

Of course, if he who writes the program could make it, it would be the easiest solution. But when it is impossible, there is the following solution: you are a programmer, so you can use the program. It's DepHell.

## DepHell

[dephell/dephell: Python project management\. Manage packages: convert between formats, lock, install, resolve, isolate, test, build graph, show outdated, audit\. Manage venvs, build package, bump version\.](https://github.com/dephell/dephell)

DepHell has many features. One of them is converting between formats, e.g. requirements.txt, Pipfile, setup.py and so on. Especially, you can convert from your code: that is, it can be generated requirements.txt from import statements.

### Installation

```
curl -L dephell.org/install | python3
```

If you need more detail, see [installation documentation](https://dephell.readthedocs.io/installation.html).

### How To Use

I'll show a simple example. If you have a python package like this:

```
.
└── my_package
    ├── __init__.py
    └── main.py
```

and `main.py` is like the following.

```python
import numpy as np
import pandas as pd
from sklearn.svm import SVC
import matplotlib.pyplot as plt
import seaborn as sns

def main():
    ...  # write something

if __name__ == '__main__':
    main()
```

In this situation, all you need is running this.

```sh
dephell deps convert --from=imports --to=requirements.txt
```

You will have requirements.txt. It will have all the packages you need.

```
$ cat requirements.txt 
matplotlib
numpy
pandas
scikit-learn
seaborn
```
Looking for projects to work on.
Tags: help, opensource
Published: 2020-02-18 15:31:10

Heyy, I currently have some time to spare in life so I'm looking for open source maintainers or product owners who need help.

I'm working as a back end developer before that I was front end developer for a year. Stack is node.js (typescript), postgreSql, and for frontend I prefer Vue or React.

Also if you have any ideas and need some help implementing them or anything feel free to reach out. :smiley:
Learn React in a new approach
Tags: react, javascript, es6
Published: 2020-02-18 15:17:13

I have been teaching react for the last two years and thinking for so long to create a react material which can help people learn the basics of react and also advanced concepts and it seems now is the time. 

So far, I have created 30DaysOfJavaScript and 30DaysOfPython challenge material. These materials helped quite a lot of people to understand the technologies better and now I decided also to create react learning material. I hope this material will also help quite a lots of people to really understand react and to be comfortable with it. Now, it is just the beginning and you may have a look at and if you are just getting started react I would recommend to give it a try.

This is the github repo for the material

💻 React for Everyone: https://github.com/Asabeneh/React-For-Everyone

Other materials

💻 JavaScript for Everyone: https://github.com/Asabeneh/JavaScript-for-Everyone
💻 30DaysOfJavaScript Github: https://lnkd.in/efqy_df
💻 30DaysOfPython Github: https://lnkd.in/epW6d_U

👥 Join the 30DaysOfJavaScript group: https://lnkd.in/er7kdTE
👥 Join the 30DaysOfPython group: https://lnkd.in/eE5Qgqd

For more contents follow me on LinkedIn:
https://www.linkedin.com/in/asabeneh/
Dom Selector – JavaScript Series – Part 24
Tags: javascript, tutorial, codenewbie, beginners
Published: 2020-02-18 15:13:05

In last tutorial we started the magic dom manipulation. Today we are going to learn about the dom selector so that we can select a dom part and change it as we want. Let’s start

I made a new html for us to edit. Have a look, code available in github 

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

Now go to console and type document.get it will bring the autocomplete other options

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

So there is lot of different selector write ? We can use them to select something and edit that. We’re going to start from the tag select.

Now by just writing `document.getElementsByTagName("h1")` we can grab the h1. see

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

We got and HTMLCollection and in 0 we can see see the classname also. So how can get the value ?

Just using `document.getElementsByTagName("h1")[0]`

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

To avoid writing this big thing we can just write document.querySelector("h1") which is going to give the same thing for use

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

So can you select the elements you have in your html ?

Other posts of this series can be found here – https://blog.nerdjfpb.com/tag/javascript/

You can see the graphical version here
{% instagram B8s-mhCAfFK %}

Source Codes - { Check commits }
{% github nerdjfpb/javaScript-Series %}

Originally it published on [nerdjfpbblog](https://blog.nerdjfpb.com/javascript-part-24/). You can connect with me in [twitter](https://twitter.com/nerdjfpb) or [linkedin](https://www.linkedin.com/in/nerdjfpb/)!
How to: "warm up" an environment using PowerShell and TeamCity
Tags: ci, cd, powershell, teamcity
Published: 2020-02-19 13:49:51

---
title: How to: "warm up" an environment using PowerShell and TeamCity
published: true
date: 2020-02-18 15:00:00 UTC
tags: ci,cd,powershell,teamcity
canonical_url: https://seankilleen.com/2020/02/how-to-warm-up-an-environment-using-powershell-and-teamcity/
---

Prior to running some tests on a .NET web application, we wanted to send a request to the environment to “warm it up” – so that the initial start of the application pool would be completed before the tests started running.

## Solution

- Select a URL that you can reasonably expect to hit as a smoke test
- Create a TeamCity build configuration
- Add a build step to the configuration of type “Powershell Script”
- Select an in-line script
- Add the following powershell:

```powershell
Invoke-WebRequest -Uri http://theURLToHit -UseDefaultCredentials

```

Now the build step will hit the URI using the build agent’s credentials, and the command will return when the result does (with a 200 after the app pool has started up).

Happy deployments!
Do you want to learn Next.js?
Tags: javascript, react
Published: 2020-02-18 14:59:20

For you, I launched the first video of a Next.js series on my youtube channel.
In this first video, you'll learn the basics about the Next.js Routing.

This is a good video for beginners and intermediate developers.

I hope it's helpful and you enjoy it! :)

{% youtube 7J4iL1HDshQ %}
¿Por qué elegir GitKraken para el control de versiones?
Tags: gitkraken, git, devops
Published: 2020-02-18 14:45:25

Como desarrolladores de software, ya sea profesionales hasta incluso estudiantes con proyectos pequeños lo más recomendable es hacer uso de un sistema de "Control de Versiones" (Como por ejemplo GitHub).

En este artículo planeo hablar sobre mi experiencia como desarrollador usando GitKraken y porqué elegirlo.

GitKraken es una herramienta potente, además de poseer una interfaz elegante y amigable con el usuario. no hay que dejarnos llevar simplemente por el aspecto visual que, si bien es cierto no conozco a ninguno de sus competidores que esté en capacidad de igualarlo, sino que tiene absolutamente todas las funcionalidades que necesitamos y podemos imaginarnos en una herramienta para control de versiones con un rendimiento que deja en muy mal lugar al resto de competidores.

Podemos dejar a un lado el precio ya que solo la necesitarás si vas a hacer uso profesional y comercial de tus proyectos, pero en mi caso, solo hago uso de esta herramienta como estudiante y me parece más que suficiente con su licencia gratuita.

Una de las funcionalidades que me encanta de GitKraken es el GLO Boards que permite gestionar todas las tablas de tareas que creamos.

¡Te tengo un dato curioso!, si eres estudiante como en mi caso y haces uso de GitHub puedes acceder al paquete de GitKraken Pro de forma gratuita en el GitHub Student Developer Pack: https://education.github.com/

Para finalizar te dejo el link de descarga de GitKraken y unas de sus carácterísticas que lo hacen especial:

https://www.gitkraken.com/

*Mejor estética que su competencia.

*Puedes manejar diferentes perfiles a la vez.

*Puedes deshacer tu última acción con un click (Algunas no te lo permiten).

*Los merges son sencillos, podremos seleccionar qué lineas de qué código queremos quedarnos en cada momento.

*Podremos ejecutar acciones con sencillos “drag-and-drop”.

*Árbol con el histórico de commits muy funcional, permite administrar las ramas con gran comodidad.

*Está MUY bien optimizada.

*Seguramente prefieras la estética oscura, pero permite también poner una blanca.

*Disponible en Windows, Mac y Linux.

*Tiene App móvil.
Popularity != Quality
Tags: watercooler
Published: 2020-02-18 14:38:48

---
title: Popularity != Quality
published: true
description: Why technology popularity has no relation to technology quality
tags: #watercooler
---

It is a quite common belief among developers that technical properties of some solution (tools, libraries, frameworks, OS, clouds, etc.) are the main driving factors when some solution is chosen for particular project/application/etc. If to assume that this belief is correct then it's quite logical to make assumption that popularity of some solution is directly related to its technical quality/properties.

Nevertheless, it always worth to keep in mind that behind every single significant technology we can see a company or group of companies. For these company/companies popularity (aka "market share") of this particular technology directly affects their money. Needless to say that these company/companies use all necessary marketing tools to increase popularity of their products, including all forms of direct and indirect advertising.

Once we realize this naked truth, it gets quite simple to understand why quality of particular technology has quite low relation to popularity. If technology is outdated, poorly designed and even worse implemented - just put more money into advertising, sponsor more articles, provide more free training courses, etc., etc. After all, if technology causes harm and/or expensive in long run, this is not your problem anymore.

Some developers to whom I explain things above, arguing that "we're smart enough to filter out marketing stuff". This is true, but only partially. We're really smart, after all this is our job. But this does not mean that marketing stuff does not affect us. Popularity creates dead cycle: technology is popular -> most developers are familiar with it -> teams tend to choose technologies with which most people have experience -> technology is popular. As a consequence we have popular technologies which killing innovation, preserving bad practices and design approaches, spawning whole generations of developers which accept this as a norm.
can data be beautiful ?
Tags: discuss, visualisation, archiveorg, java
Published: 2020-02-18 14:29:58

is it just me or can data be beautiful ? i love maps, heatmaps, mobile coverage maps and even data visualisations !

https://web.archive.org/web/20170815000000*/java.com

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3g8gev4os11nfkebe2jt.png)
Configure Tower to use the new Windows Terminal
Tags: git, tower, wsl, productivity
Published: 2020-03-10 22:41:46

---
title: Configure Tower to use the new Windows Terminal
published: true
date: 2020-02-18 14:24:58 UTC
tags: git,tower,wsl,Productivity
canonical_url: https://jessehouwing.net/configure-tower-to-use-the-new-windows-terminal/
---

The new Windows Terminal is almost done and the most recent build fixes the one bug that kept me from using it.

 ![Configure Tower to use the new Windows Terminal](https://jessehouwing.net/content/images/2020/02/19340354430_4329b4584e_k-1--1-.jpg)

[Windows Terminal now supports command-line arguments to open specific terminals and in specific directories](https://devblogs.microsoft.com/commandline/windows-terminal-preview-v0-9-release/). Which means you can now configure other tools to launch specific terminals in the directory you're in.

To configure Tower to launch the Windows Terminal is now simple:

```
Title: Windows Terminal
Path: C:\Users\{username}\AppData\Local\Microsoft\WindowsApps\wt.exe
Arguments: -d . 
```

![Configure Tower to use the new Windows Terminal](https://jessehouwing.net/content/images/2020/02/image.png)<figcaption>Adds Windows Terminal to Tower</figcaption>

To launch specific profiles, add: `-p {profile name}`.

To easily find the location of Windows Terminal, run `where wt` from a command line:

![Configure Tower to use the new Windows Terminal](https://jessehouwing.net/content/images/2020/02/image-1.png)<figcaption>Find the path to your <code>wt</code> executable.</figcaption>

![Configure Tower to use the new Windows Terminal](https://jessehouwing.net/content/images/2020/02/2020-02-18_15-23-54.gif)<figcaption>It worky-worky!</figcaption>
Oracle v Google
Tags: watercooler, java, copyleft, copyright
Published: 2020-02-18 14:17:47

Oracle v Google in the US supreme court !

Oracle have *submitted our response brief before the United States Supreme Court in Oracle v. Google. Over the next few weeks, we will post short blogs regarding our decade-long litigation against Google’s theft of Java software. We will make our legal arguments before the Supreme Court in March. Here, we will try to set the record straight on the facts and policy, which have been wildly distorted by Google and its PR machine led by Google’s head of Global Affairs and Chief Legal Officer, Kent Walker.*

https://www.oracle.com/corporate/blog/oracle-vs-google-021220.html

whos side are you on ?