teleren/devto huggingface dataset:
Matt's Tidbits #57 - Improving RxJava stack traces
Tags: mattstidbits, android, rxjava, tidbittuesday
Published: 2020-02-25 14:41:46

[Last week I wrote a cautionary post about using @JvmOverloads on constructors of View-derived classes in Kotlin.](https://medium.com/@matthew.b.groves/matts-tidbits-56-be-careful-with-jvmoverloads-165d87581820) This time, I have a quick tidbit to share about improving RxJava stack traces.

But first, a quick update on last week's post - I have filed an official Android Studio bug report asking them to improve the way "quick fix" works for generating view constructors (based on my last tidbit) - please ⭐️ this issue if it's something you'd like to see fixed as well! https://issuetracker.google.com/issues/149986188

If you've ever worked with RxJava, you may have encountered crashes due to null items or other issues, and seen a cryptic stack trace that due to the asynchronous nature of Rx, doesn't really give you any clues as to which observable instance actually emitted the error - only showing you that RxJava threw some kind of internal exception.

Well, I have good news for you - there's a library that can help make it easier to identify the source of these issues, and it's called RxDogTag!
https://github.com/uber/RxDogTag

This library works by making use of an RxJavaPlugin to help generate more helpful stack traces that identify the observable that was responsible for the crash!

There's just one thing to note - this only works if that subscription doesn't have its own custom `onError()` handler. In my experience, I've found that it's generally good practice to always implement an `onError()` handler to avoid exceptions bubbling all the way up to the top of your application, but there may be some cases where that's not a desired behavior/paradigm.

Either way, if you're frustrated/stuck trying to figure out a non-descriptive Rx crash stack trace, consider giving RxDogTag a try!

And, check out this other article which was how I learned about it initially: https://www.bugsnag.com/blog/improving-rxjava-stack-traces-with-rxdogtag

I hope you learned something that helps you more quickly identify RxJava crashes in the future! What strategies does your team use for handling RxJava errors? Let me know in the comments below! And, please follow me on Medium if you're interested in being notified of future tidbits.

Interested in joining the awesome team here at Intrepid? [We're hiring!](https://www.intrepid.io/careers)

*This tidbit was originally discovered on December 20, 2019.*
My first week as a (paid internship) dev
Tags: beginners, codenewbie, motivation
Published: 2020-02-21 23:30:02

*I should have posted this text last Friday. But here I am (finished my second week now).*

I started learning programming (for real) in September of 2019. In October I decided it would be my career so I tried my first job. Of course things went very badly with the technical tests and everything. I didn’t deliver all the requisites, etc. But it was a company I really liked and where I wanted to work. The refusal without any kind of feedback CRUSHED me.

I was studying to get a job at that company. I saw their job description and studied the techs they wanted. But they didn’t want me. Well… I don’t blame them, I was naive to try it so soon.

But the lack of feedback even after I asked for one was very frustrating and that frustration made me slow down my studies very much. It took some weeks to get back on track. But I never returned as hungry as before.

Few months later, I sent two more resumès. This time for mobile development. Then I spent the week of the reveillon (my favorite time of the year) working on the job interview test using Android Studio for the first time, melting my brain, doing my best.

In January, I did my last interview. The CTO asked me what I had learned so far. I was sincere in my answers and, for my surprise, even with a lack of basic knowledge (I recognize it) I GOT A PAID INTERNSHIP! And the icing on the cake: in an even better company! I feel like they want me there. This is such a good feeling.

This was my first week. And I am loving it all. The process, the learning, the journey.

A dev career seems like a journey that never ends.

I couldn’t be happier and grateful. I can’t wait to learn more.
CSV lezen met Python (Dutch)
Tags: python, dutch, beginners
Published: 2020-02-22 12:24:42

Een CSV-bestand (Comma Separated Values) is een bestand met platte tekst waarin elke waarde wordt gescheiden door een komma. 

Excel kan CSV-bestanden openen. Dit is erg handig omdat het betekent dat je je gegevens vanuit Python in csv kunt opslaan en vervolgens in Excel kunt openen.

In dit artikel leert u hoe u een CSV-bestand in Python kunt inlezen.

Voordat u met csv-gegevens gaat werken, is het nodig om <a href="https://pythonbasics.org">Python te leren</a>.

## Inleiding

Elke regel van het CSV-bestand wordt een record genoemd, elk record heeft waarden die door komma's worden gescheiden. 

De waarden worden gescheiden door een zogenaamde *delimiter*, de standaard waarde is de komma. U kunt kiezen voor een ander scheidingsteken, zoals een puntkomma (;) of een pipe (|).

Hieronder ziet u de structuur van een gewoon CSV-bestand.

    1,Alice,Cook,32
    2,Bob,Portier,34
    3,Chris,Elektricien,24
    4,Dave,Veldwerker,44

Kopieer de gegevens en sla ze op als `voorbeeld.csv`.

## Waarom CSV?

CSV-indeling is eenvoudigweg een gewoon tekstbestand. Dat betekent dat u het kunt openen met elke tekstverwerker, maar ook dat het kan worden geopend door elke softwaretoepassing.

U kunt zonder problemen een csv in een spreadsheet of databaseopslag importeren. Het is data-uitwisselbaar.

Elke programmeertaal die met bestanden en strings kan werken, kan met csv-bestandgegevens werken. 

## CSV-module

U hoeft zelf geen csv lezer te coderen, want om de zoveel tijd heeft Python een module beschikbaar.

De module waar we het over hebben is de `csv` module. Deze is al geïnstalleerd, omdat hij deel uitmaakt van de standaardbibliotheek van Python.

U kunt <a href="https://pythonspot.com/reading-csv-files-in-python/">csv-bestanden</a> lezen met de `csv`-module, maar ook schrijven.

Om de module te laden typ je:

```python
import csv
```

Maak dan uw programma aan (read.py)

```python
import csv

# Open het csv-bestand in leesmodus 'r'                                                                                                                                              
with open('voorbeeld.csv', 'r') als f:
    # lees het bestand                                                                                                                                                               
    csvReader = csv.reader(f)

    # elke lijn in een lus uitlezen                                                                                                                                               
    for regel in csvReader:
        print(regel)
```

Als je het programma uitvoert, zul je zien dat elke regel een Python list is geworden:

    ➜ ~ python3 read.py 
    ['1', 'Alice', 'Cook', '32']
    ['2', 'Bob', 'Portier', '34']...
    3', 'Chris', 'Elektricien', '24'.
    ['4', 'Dave', 'Veldwerker', '44'].
    ➜ ~ 

Succesvol ingelezen!


**Gerelateerde links:**
* <a href="https://docs.python.org/3.8/library/csv.html">Pythons csv-module documentatie</a>
* <a href="https://pythonprogramminglanguage.com/read-csv/">Lees CSV met Python Pandas</a>
How I Got Into Tech
Tags: webdev, beginners, discuss, codenewbie
Published: 2020-02-22 17:11:44

---
title: How I Got Into Tech
published: true
description: Today I share a video where I talk about how I made my way into tech, enjoy!
tags: webdev, beginners, discuss, codenewbie
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/cx2hf00qjiwe7i1cvn78.png
---

Hi everyone!

Today I uploaded a video talking about how I got into tech. My main goal with this video was to show that if a degree-less, uncertain, unfocused, mid-twenty-year-old can figure things out and carve a path into tech, you can too. As long as you're genuinely curious and put in the work, I have no doubts you can get your foot in the door. 

I hope you enjoy the video and please reach out if you have any suggestions on future content you'd like to see, one nice thing of currently having a low sub count is that I can read all the comments haha.

Happy coding!

{% youtube 9-m4CIOEecA %}
Visual Studio Summit 2020
Tags: vssummit, eventos, mvpbr, mvpbuzz
Published: 2020-02-23 00:43:20


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

# O evento
O Visual Studio Summit, é a maior conferência independente para desenvolvedores, que utilizam a plataforma Visual Studio na América Latina.

O evento está em sua nona edição, e conta com um espaço ainda maior que os últimos anos. Se você já achava o evento grande antes, imagine agora! 

# O local
A edição de 2020, será realizada no Centro de Convenções do Senac Santo Amaro, em São Paulo. 
É um grande espaço, ainda mais se compararmos com as edições anteriores. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/m3c59au0doa2bzsf8qr4.jpeg)
Contaremos esse ano com 4 auditórios, sendo o principal, esse da imagem acima.

#O formato
Em todas as edições, o Visual Studio Summit segue um formato interessante, que diferente de outros eventos com palestras longas, aqui temos curtas apresentações de 30 minutos, onde o foco são insights para que os participantes possam utilizar para direcionar seu aprendizado ou mesmo soluções no trabalho. Outra coisa interessante, é que cada apresentação é realizada duas vezes, então, se você perdeu um tema, tem a chance de ver em outro momento.

#A data
Nessa edição, o evento será realizado em dois dias, que serão 05 e 06 de junho de 2020.

# Minha participação
Este ano, mais uma vez estou participando na organização, e também como palestrante, e o tema da minha palestra será: CI/CD com GitHub Actions. Eu também vou ficar por lá durante o evento, então, podemos bater um papo lá sobre DevOps.

# Como participar
Quer participar? Então compre seu ingresso, acessando http://vssummit.com.br
Ah, não se esqueça de utilizar meu cupom de desconto, é só colocar o código **julioarruda** no sympla.

Ah, eu também gravei um vídeo falando sobre o evento, não deixe de assistir
{% youtube owAmovUF4c0 %}
PowerShell Readability For Others
Tags: powershell, python, readability, firstpost
Published: 2020-02-23 15:09:08

#Intro

I've been meaning to start some sort of online blog to jot down snippets, ideas, and solutions to begin giving back to the online community I regularly benefit from.  Here is my first short post to begin that journey!

# The Great Debate

I work on a team of 6 developers that write automated solutions.  We are currently a little divided in our preferred languages with a heavier focus on Python.  Unfortunately, I'm the PowerShell guy that has been slowly learning Python to support different projects and our overall code base.

I've been having a debate with myself over the past couple weeks.  Do I go out of my way to make my PowerShell more readable or stick to the syntax I've learned and are more comfortable writing?

#Can You Read This Now?

Here is a quick example with a method used very frequently: piping to Where-Object to perform operations based on an object property value.

This is the way I'm used to writing my code:

```powershell
Get-NetworkAdapter | Where-Object {$_.NetConnectionID -eq "NIC1"}
```

For anyone familiar with PowerShell, this probably makes perfect sense.  However, on my team this presents an initial roadblock concerning readability.  

Based on a poll I sent out, they seemed more familiar/comfortable when the same command was presented this way:

```powershell
Get-NetworkAdapter | Where NetConnectionID -eq "NIC1"
```

#Final Thoughts

Overall, I think our decision is going to come down to what works best for our team.  I'm fine to give a little, as some of the syntax of PowerShell is quite different than Python.  However, I will also be challenging them to invest some time learning PowerShell as I learn Python :)

Let me know what you think in the comments.  I may later turn this into a series about our team adventure to being a multi-language group.

Thanks for reading!
PyQT5 ile sistem tepsisine ikon ekleme
Tags: python, pyqt, sistemtepsisi, gui
Published: 2020-02-23 17:33:29

PyQT5 kullanarak basit bir sistem tepsisi uygulaması geliştirebilmek için aşağıdaki gibi bir kod yazmak gerekmektedir:

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


```python
import sys
from PyQt5 import QtCore, QtGui, QtWidgets

# code source: https://stackoverflow.com/questions/893984/pyqt-show-menu-in-a-system-tray-application  - add answer PyQt5
#PyQt4 to PyQt5 version: https://stackoverflow.com/questions/20749819/pyqt5-failing-import-of-qtgui

class SystemTrayIcon(QtWidgets.QSystemTrayIcon):

    def __init__(self, icon, parent=None):
        QtWidgets.QSystemTrayIcon.__init__(self, icon, parent)
        menu = QtWidgets.QMenu(parent)
        exitAction = menu.addAction("Exit")
        self.setContextMenu(menu)
        menu.triggered.connect(self.exit)

    def exit(self):
        QtCore.QCoreApplication.exit()
        
        
def main(image):
    app = QtWidgets.QApplication(sys.argv)

    w = QtWidgets.QWidget()
    trayIcon = SystemTrayIcon(QtGui.QIcon(image), w)

    trayIcon.show()
    sys.exit(app.exec_())

if __name__ == '__main__':
    on=r'/usr/share/ornekuygulama/deneme.png' # ADD PATH OF YOUR ICON HERE .png works
    main(on)

```
Code Indirection
Tags: codereadability, readability, programming
Published: 2020-02-23 17:58:05

---
title: Code Indirection
published: true
date: 2020-02-23 15:11:20 UTC
tags: codereadability,readability, programming
canonical_url: https://stereobooster.com/posts/code-indirection/
---

# Code indirection

## Code readability

> Readability is the ease with which a reader can understand a written text.
>
> -- [Wikipedia](https://en.wikipedia.org/wiki/Readability)

<!--more-->

> Readability is what makes some texts easier to read than others.
>
> -- [The Principles of Readability](https://files.eric.ed.gov/fulltext/ED490073.pdf)

Many factors play into the readability of text. For example, contrast, font, choice of words and many more. (See: [readability for natural languages](https://www.bdadyslexia.org.uk/advice/employers/creating-a-dyslexia-friendly-workplace/dyslexia-friendly-style-guide))

Some factors are **subjective** e.g. depends on the reader - if the reader knows given programming language, if the reader knows the context if the reader familiar with the jargon, etc. There is a great talk on the subject: [Laura Savino - Talk Session: Readable Code](https://www.youtube.com/watch?v=IbOp_e9yh0k). She says that "readability needs a reader".

Some factors are **objective** e.g. doesn't depend on the reader - length of the text, indirection in code, etc.

## Code indirection

In this post, I want to talk about one specific readability metric - code indirection. At some point of reading code, you will find yourself asking the question: "where does this variable (or function) come from?". Then you can go to definition of the variable (<kbd>Cmd</kbd>/<kbd>Ctrl</kbd>-click) and trace variable to the origin. For example:

```ts
import a from "./a.ts";

const b = a();

function c() {
  b;
}
```

- from `b;` to `const b = a();`
- from `const b = a();` to `import a from "./a.ts";`
- from `import a from "./a.ts"` to file `a.ts`
- etc.

In the given example you can easily "trip" from start to end. But there are cases when the trip is not so trivial, for example:

```ts
let b = a();

// ...

b;
```

<kbd>Cmd</kbd>/<kbd>Ctrl</kbd>-click on `b` will bring you to `let b = a();`, but you can't be sure this is the actual value of `b`, because let allows reassignment, so you need to use search of `"b"` (which could match more than the desired variable) to find first previous occurrence of `b`.

Or the second example:

```ts
function c(b) {
  b;
}
```

to find a source of `b` you will need to find where `c` is called and where it gets arguments.

**The more code indirections you have the harder it is navigating through the code base, the less readable code**.

Direct code:

```txt
e ← d ← c ← b ← a
```

Indirect code:

```txt
e → d ← c ← b ← a
```

## PS

More about readability:

- [Too DRY - The Grep Test](http://jamie-wong.com/2013/07/12/grep-test/)
- [Clear is better than clever](https://dave.cheney.net/paste/clear-is-better-than-clever.pdf)
- [I am a puts debuggerer](https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html)
Configurama - Building SaaS #36
Tags: python, django, saas, configuration
Published: 2020-04-16 18:03:54

{% youtube LoNdFiMwH8M %}

In this episode, we turned our attention to handling settings and configuration.  We discussed different techniques for handling settings, looked at available tools, and started integrating one of the tools into the project.

The initial discussion in the stream focused on different ways of doing settings.  I talked about what I view as a difference between configuration (mostly static stuff) and settings (dynamic parts of the app).

I also discussed where to get settings from.  We talked about the [12 Factor App](https://12factor.net) style with environment variables, and secret management tools like [HashiCorp Vault](https://www.vaultproject.io/) and [AWS KMS](https://aws.amazon.com/kms/).  Ironically, I blanked out on [AWS Secrets Manager](https://aws.amazon.com/secrets-manager/) as an option.  Additionally, we considered the alternative of reading settings from a file instead of environment variables and the security implications of environment variables.

After digging into strategies, I showed the documentation of popular tools in the Django space.  We found some of these tools listed on the new [Django Forum](https://forum.djangoproject.com/t/top-5-3rd-party-packages/391)!

[django-environ](https://django-environ.readthedocs.io/en/latest/) was the first tool that we looked into.  The package supports the 12 Factor pattern and is designed to work with environment variables.  It also has the ability to use an `.env` file for reading from a file if desired.  One nice thing about this tool is that it can translate some conventional environment variables into standard Django settings patterns.  For instance, by defining `DATABASE_URL`, the tool can produce the entire dictionary of database settings by calling `env.db()`.  That's pretty neat.

The next tool was [django-configurations](https://django-configurations.readthedocs.io/en/stable/).  django-configurations seemed more about handling different environment types using an inheritence scheme.  The idea is interesting.

Lastly, we looked at [Goodconf](https://github.com/lincolnloop/goodconf).  Goodconf lets you define a configuration class that describes all the dynamic settings.  From that definition, Goodconf can read from a settings file defined in JSON or YAML format, or it can read from environment variables.  I like a lot of aspects about Goodconf.  The package lets us define help text to go with the setting.  For large projects, this is super useful so that anyone can inspect what a setting is for.  Conveniently, a Goodconf config instance can generate the settings file which can then be updated or act as a template.

After evaluating these tools, I concluded that Goodconf was the best fit for College Conductor.  We spent the remainder of the stream integrating the tool into the project.

On the next stream, we will flesh out the rest of the configuration and test out the changes on different environments.

This article first appeared on [mattlayman.com](https://www.mattlayman.com/building-saas/configurama/).
List users in SQL Server database
Tags: sqlserver
Published: 2020-02-23 19:12:35

The image below shows how. (on Microsoft SQL Server Management Studio).

![List users in sql server database on SSMS](https://dev-to-uploads.s3.amazonaws.com/i/zbc8x2y354wetu2oj788.jpg)

__Query__

```sql
use [database_name]
select name as username,
       create_date,
       modify_date,
       type_desc as type,
       authentication_type_desc as authentication_type
from sys.database_principals
where type not in ('A', 'G', 'R', 'X')
      and sid is not null
      and name != 'guest'
order by username;
```
DEV Questions 3: Immediate and retained mode GUI models
Tags: design
Published: 2020-02-24 00:50:59

After doing some reading on this subject, I concluded that immediate mode is best within a game engine, whereas retained mode is the developers' favorite everywhere else. I have tried both - I have far more retained mode experience than immediate - but both clearly have their uses. Have you tried both modes?

Finally, a point of personal curiosity: is it, or will it be possible to make immediate mode Web user interfaces with WebAssembly (or other bits of Web tech)?
Rest API with Flask
Tags: python, beginners
Published: 2020-02-24 11:46:28

The Python <a href="https://palletsprojects.com/p/flask/">Flask</a> module is great for building a Rest API. A Rest API uses the <a href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol">HTTP</a> protocol as it was originally designed. 

The HTTP protocol has many requests like **GET, PUT, POST, and DELETE** requests. These requests should be used for mutation, creation, and deletion respectively.

This is great for making your web app backend. Because it decouples your backend (logic) from your frontend (presentation). 

This means you can update your frontend without having to recode your backend all over again.

You can put <a href="https://pythonbasics.org/python-to-web/">your Python apps online</a> easily.


## Get request

A get request is the most basic. This is when you use your browser to open a url. The underlying HTTP protocol then does the GET request on which the server returns the data.

Lest return <a href="https://pythonprogramminglanguage.com/python-json/">JSON</a> data from our **Flask Rest API**, you can do that like this:

```python
from flask import Flask, jsonify, request

app = Flask(__name__)

incomes = [
  { 'name': 'Alice', 'amount': 2000 },
  { 'name': 'Abbey', 'amount': 2200 },
]

@app.route('/incomes')
def get_incomes():
  return jsonify(incomes)

app.run(host='0.0.0.0', port=8080)
```

Then open the url *localhost:8080/incomes* to see the JSON data presented. The front-end (Javascript) is great at parsing and creating JSON data.

![json data](https://dev-to-uploads.s3.amazonaws.com/i/emcxcqhlfamydf81vrjz.png)

## Post requests

Post requests are used to insert data. The user normally doesn't make a post request, the front-end does this. However, you can mimick this using a tool called `curl` or use an extension.

Add a new request for a post request

```python
@app.route('/incomes', methods=['POST'])
def add_income():
  incomes.append(request.get_json())
  return '', 204
```

Then you can make a post request. To make a post request, you can use curl.

    curl -X POST -H "Content-Type: application/json" -d '{"name":"Aaron","amount":5000}' http://localhost:8080/incomes 

Normally your web app will do the web request. If you don't feel comfortable with the terminal, you can use the postman extension.

![http post](https://dev-to-uploads.s3.amazonaws.com/i/rsxuuiw2u8ybjvcnakm6.png)

For an online app, you'll want to add authentication, input validation and a lot more. If you are new to Flask, I recommend this <a href="https://gumroad.com/l/IMzBy">Flask course</a>.