teleren/devto huggingface dataset:
Ruthless Prioritization (aka, how to to grow without being overwhelmed)
Tags: learning, timemanagement, excellence, programming
Published: 2019-09-27 05:34:28

---
title: Ruthless Prioritization (aka, how to to grow without being overwhelmed)
published: true
description: How to prioritize what to learn in a deluge of knowledge.
tags: learning, time-management, excellence, programming
---

Tech changes constantly. Our tools evolve, our patterns are refined, and new APIs and products enable us to do more each year.

How then, do we stay on top of every new advance?

I really like [this](https://fragmentedpodcast.com/episodes/135/) episode of Fragmented, where they mentioned that while you could learn _anything_, you can't learn _everything_.

So here's what I do.
1. Stay aware of what's out there.
eg: There's a thing called GraphQL that lets you effectively deal with a few hundred params in your rest calls.
2. Learn Just In Time.
I don't have the usecase of needing to handle a wildly changing API request, therefore I don't really need to check out GraphQL.

I just need to know what exists, so that I can delve deeper into it when I find a need for it.

Then, identify what's core to your work, present and near future and go deep.
What I find useful for Android, in order of importance:
1. Architecture
2. Testing (unit first, then espresso)
3. Kotlin over Java
4. Dependency Injection (pick one framework and be aware of others)

Somewhere in there should be functional over imperative style programming.

Then go deep on every single one of those.
I promise you won't reach the end of depth on any of those for a good long time and that depth will help the quality of your work.

Go deeper until you hit the limits of what's out there.
Once you've hit the limits, it's your turn to push the limits. With everything you've learned, what's the biggest thing still slowing you down? How could your entire project work better together? Expand those boundaries and add to the collective knowledge of the tech industry by writing/giving talks about that.

This way, you have very valuable skills as your core, everyday drivers. Which you continue to hone through practise and you're aware of what's out there so you don't stick to a well honed but inappropriate tool if there's a better way!

Good luck, make time to chill and raise the standard of engineering.
Instance variables @ vs self
Tags: ruby
Published: 2019-09-27 05:32:08

In a class sometimes I see attributes with *@* or a *self*. At a quick glance they seem to do the same thing.

```ruby
class MyClass
  def initialize(arg)
    @my_attribute = arg
  end

  def my_attribute
    @my_attribute
  end

  def output_attribute
    puts @my_attribute
    puts self.my_attribute
  end
end

my_instance = MyClass.new("testing123")
my_instance.output_attribute
```

Output:
```
testing123
testing123
```

From what I learned *@* returns the instance variable, and *self* calls the getter method to return *@*. So I can see the difference if I modify the variable in the accessor method. For example for my FakeId class, self.age adds 10 years to the @age and returns that value.

```ruby
class FakeId
  def initialize(arg)
    @age = arg
  end

  def age
    @age + 10
  end

  def output_age
    puts "Real age: #{@age}"
    puts "Fake ID age: #{self.age}"
  end
end

fake_id = FakeId.new(15)
fake_id.output_age
```

Output:
```
Real age: 15
Fake ID age: 25
```
Should tech recruiters know how to read a URL?
Tags: discuss
Published: 2019-09-27 05:19:34

I recently found an ad on facebook that needed freelance developers on their team. The ad said to send a resume in a pdf file or a link to a resume.

I sent this: https://my-name-with-the-resume-word.s3.amazonaws.com/august.pdf but the Hiring Manager still asked for a pdf file or a link to my resume.

My reply was "The link I sent is a link to a pdf file. What’s wrong with you?" I hope I didn't sound rude tho.

What do you think? Should hiring managers know how to read a url?


## UPDATE:

This is the first 2 emails we've exchanged. You be the judge.

![](https://thepracticaldev.s3.amazonaws.com/i/zbqtzf846ury9p2ybi2q.png)
Ruby + jemalloc on a micro EC2 instance
Tags: ruby, jemalloc, memory, rails
Published: 2019-09-27 05:01:20

---
title: Ruby + jemalloc on a micro EC2 instance
published: true
description: Results after recompiling Ruby with jemalloc
tags: ruby, jemalloc, memory, rails
cover_image: https://thepracticaldev.s3.amazonaws.com/i/igjdapbgwfazwkwkhv9n.png
---

After reading several articles about how badly it manages ruby memory, I wanted to do a test on a small application that I run with Ruby on Rails and Sidekiq to see if there are improvements in the performance of my application on a `t2.micro` instance (only 1Gb RAM).

So I got down to work and followed the simple steps to move from a Ruby that uses `glibc` by default to Ruby with `jemalloc`

First, update and install jemalloc (instructions for Debian/Ubuntu)

```shell
$ sudo apt update
$ sudo apt install libjemalloc-dev
```

Then, reinstall Ruby with jemalloc as option. On my server, I have `Ruby 2.5.1` installed, so the command I executed was the following (works with RVM too):

```shell
$ RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 2.5.1 
```

To ensure that your Ruby uses jemalloc, run the following command:

```shell
$ ruby -r rbconfig -e "puts RbConfig::CONFIG['LIBS']"

-lpthread -ljemalloc -ldl -lcrypt -lm 
```

## And the results so far…

![Some data from grafana](https://thepracticaldev.s3.amazonaws.com/i/d5qhat2nihotsrw9659k.png)

I expected the RAM used to decrease, but instead, the swap memory decreased

![meme](https://thepracticaldev.s3.amazonaws.com/i/igjdapbgwfazwkwkhv9n.png)

## More information

[This awesome post](https://www.joyfulbikeshedding.com/blog/2019-03-14-what-causes-ruby-memory-bloat.html)

[More detailed tutorial](https://bubblin.io/blog/jemalloc)

[Another tutorial](https://www.levups.com/en/blog/2017/optimize-ruby-memory-usage-jemalloc-heroku-scalingo.html)
What Makes a Good Test?
Tags: tests, rewrite, durable, fragile
Published: 2019-09-27 04:51:27

---
title: What Makes a Good Test?
published: true
description: You've begun writing tests, great! Now what tests do you write?
tags: tests,rewrite,durable,fragile
---

You write your code, run it to go have a peek if it does what it expected, what if you wrote a test for that? The few seconds you spent checking it are now possible to do in milliseconds and available to anyone without even looking at your code! Who wouldn't want that!

Once you're a few tests deep, you might run into a problem.
As your functionality evolves, you find that you have to constantly keep re-writing your earlier tests.
Suddenly, the weight of older tests is slowing you down! 😱

Could we have avoided this?
Pretty simply actually! There's just one element of discipline you need to add.

Start by asking what you care about?
1. For a certain input, you expect a certain output.
Which means, given a public function on your presenter/viewmodel, test only that the public effects it's supposed to have, happen.
2. If it's only result is something in your repository, then you could verify that too.

As long as you test only your presenter/viewmodel, not the functions within, you're keeping your tests at the boundaries, you're free to change your internal implementation as you like.

Keep tests to the outermost layers of your architecture isn't something new, it's a part of Clean Architecture, where the author recommends that tests wrap around the outside of your app and know nothing about the inside.

There are two exceptions (that I know of) to this,
1. If the test was for some module that, if modified, can be thrown away entirely along with its tests.
For example if you're using the Room database and want to test its migrations, go ahead! If you decide to switch away from Room for Realm or such, you can throw away those tests entirely and still don't need to rewrite.
2. If you're using UseCases, it's practical to have tests that check out some internals of those, again throwing them away if the usecase is no longer needed.
In this case, you're at the boundary of one entire unit of functionality.


Happy testing! Please ask questions if something isn't clear!
If you'd like an Android example of this, take a look at my [app](https://github.com/AniketSK/Appod)
Trying to follow all best practices will not help you
Tags: discuss
Published: 2019-09-27 04:36:50

I think that best practices are overrated for a number of reasons. 

- Best practices are like standards, **they are good because there are so many you can choose from**. Like parental advice, they cover every single aspect of what you do, contradict each other and tend to get on your nerves.
- Best practices tend to make people forget that "**Rom was not built in a day**". They can easily become overwhelming. In the Android world, you have people telling you to follow their TODO-MVC app that use Dagger+Architecture-Components+Clean-Architecture+Room+AndroiX+ConstraintLayout+RxJava+SingleActivity+DeepLinks+MVI+Y+Z+A+B. This is so terrible.
- **Best practices are context-free advice**. Facebook had some problems, so clever people there found a solution for it. Now everybody is cargo-culting it. But actually most of the followers are *not* Facebook, so [They Are Not Going To Need it](https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it). 
- **Doing the right things is more important doing things right**. You can follow all best practices on earth and still produce something that brings no value to the world. Not convinced? Check out https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
- **There is an un-recognized trade-off between best practices and simplicity**. It seems a no-brainer to say "*I follow best practices*". Wouldn't it feel weird to say the contrary? But what about "*I value simplicity and solving problems when they actually occur*"? As Joel Spolsky warned us: [Don’t Let Architecture Astronauts Scare You
](https://www.joelonsoftware.com/2001/04/21/dont-let-architecture-astronauts-scare-you/)
- Note that the previous item is **not** a "best practice" that you should apply blindly. There is a reason I put on my profile: "*Weeks of programming can save hours of planning*". Security for example cannot be an afterthought. If your initial API design is bad, you are stuck with it forever, see my article [Android's billion-dollar mistake(s)](https://dev.to/jmfayard/android-s-billion-dollar-mistake-327b)
- **Best practices make us focus on the wrong thing**. Nothing waste a team time and energy better than having to argue on for example [what is *right* git flow?](https://dev.to/molly_struve/there-is-no-right-way-git-rebase-vs-merge-2hc5). Instead of focusing on the HOW, we should [start with WHY?](https://www.youtube.com/watch?v=IPYeCltXpxw). Invest time in your context. Why is this feature important? Which pain point are we trying to solve?

Best practices are shared with good intentions.
After all, we all want to produce good work, no?

So what could we replace them with?

My answer would be: **don't tell me about your solutions, tell me about your problems**. Raising the awareness of a problem I may have is really helpful. Copy/pasting your solution in another context, often not so.
Useful DEV Tools (Contributors Wanted)
Tags: contributorswanted, hacktoberfest, productivity
Published: 2019-09-27 04:16:42

# Useful DEV Tools

for a while, i posted "Useful DEV Tools" on dev.to, and i made a [repo on GitHub](https://github.com/lucasnaja/useful-dev-tools) with the use tools that i've used and the other people have used for a while (it has opened pull requests that i merged).
It has a BR version too. :)

## Github repo

{% github lucasnaja/useful-dev-tools no-readme %}

## How to contribute

- Fork the repo.
- Make the changes.
- Commit them.
- Push them.
- Open a Pull Request on the GitHub.
- Wait :)

## Post on dev.to

{% link https://dev.to/lucasnaja/useful-tools-for-developers-2c00 %}


### Remember: The hacktoberfest event starts on **October 1st**.
Good event, friends :)

{% tag contributorswanted %}

{% user lucasnaja %}
Programming Idioms
Tags: languages, algortithms
Published: 2019-09-27 02:44:05

Seems there are a lot of programming language comparison sites out there. Here's another one: [Programming-Idioms](https://www.programming-idioms.org/). The site is covered by a [Creative Commons](https://creativecommons.org/) license.

Over 30 languages are represented with example algorithms starting with (sigh) Hello World. COBOL currently has 1 entry. I should fix that. 

There's a lot of good stuff in there in JavaScript, Scala, Python etc. For example, there's '[Format a Number with Grouped Thousands](https://www.programming-idioms.org/idiom/173/format-a-number-with-grouped-thousands/3159/scala)'.

[Complete list of idioms](https://www.programming-idioms.org/about#about-block-all-idioms) -- almost 200 of them.
What’s the thing you hate the most in Python?
Tags: discuss, python
Published: 2019-09-27 02:15:07

Don’t take me wrong, I use Python in most of my projects and Python is my most loved language. But sometimes it still drives me crazy... Some of the things that I’d love to see major changes in Python:

- import system: import cycle happens to all Python devs I know and until now there’s still no solution or even an official way to organize modules to avoid this problem.

- pip/pipenv/pip-tools/setup.py/... : a Python developer doesn’t need to worry about which tool works best for managing dependencies, there should be only one official way to do it.

So what is the thing that bothers you the most in Python?
1000 ft view of React Hooks with a comic
Tags: javascript, react
Published: 2019-09-27 01:45:53

For anyone who love to visualise, I created this brief comic on react hooks and how can they be helpful. 

Hope you enjoy reading it!

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/e1kx7sehnxyt8waejzi3.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/wdxnq1upcldpi2x9ibz7.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/vn10t9xvrosgbnzzn0f6.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/egx0u8zm5ckxo9b42r8w.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/t6h4dp9ijoutsi5pcrt6.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/pikr1o41h02vd0if681z.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/mohp3c5f80eofk1vs4ah.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/k4kzcaulqwb51qaeq405.png)


[Deeksha on Twitter](https://twitter.com/deekshasharma25)
[bonsaiilabs on Twitter](https://twitter.com/bonsaiilabs)
Fission API in ipfs-deploy
Tags: ipfs, ipld, dweb, fission
Published: 2019-10-02 23:52:36

---
title: Fission API in ipfs-deploy
published: true
tags: IPFS,IPLD,dweb, fission
canonical_url: https://blog.fission.codes/fission-api-in-ipfs-deploy/
cover_image: https://images.unsplash.com/photo-1524741978410-350ba91a70d7?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjExNzczfQ
---

We've had our eye on [Agent of User's](https://agentofuser.com/) great _ipfs-deploy_ tool for a while now. It is a quick way to get a static website served up through a regular Web2 domain name. It automates both IPFS uploading / pinning as well as updating DNS.

{% github ipfs-shipyard/ipfs-deploy %}

Now that we've got our own web API that supports IPFS, we have a PR [to add Fission support to _ipfs-deploy_](https://github.com/ipfs-shipyard/ipfs-deploy/pull/100)_._ Thanks [Daniel](https://talk.fission.codes/u/dholms) for taking this on!

> "Adding support prompted us to add another feature to our web api: manipulation of InterPlanetary Linked Data (IPLD) nodes." – Daniel Holmgren

Right now we're using this ourselves for some website experiments, leaning on the Cloudflare integration in _ipfs-deploy_ to automate DNS updates. DNS Automation is something that we're building into the Fission Suite directly, as part of our "batteries included" approach.

As well, _ipfs-deploy_ specifically works without a local IPFS node. The direction we're going with the Fission tools is going to assume that we can run a local IPFS node everywhere that our CLI can be installed, so we'll be leaning into "native" IPFS protocol functionality. We'll be release an alpha of our Fission CLI shortly so you can check out our approach.

Read [Agent of User's Complete Beginner's Guide to Deploying Your First Static Website to IPFS](https://interplanetarygatsby.com/ipfs-deploy/) for the full run down on using _ipfs-deploy_.

Skipping to the end, you can use your Fission credentials & Cloudflare API keys to run this one liner:

`ipd -p fission -d cloudflare`

[Tell us about your IPFS hosted website in the Talk forum >](https://talk.fission.codes/t/show-fission-my-website-is-on-ipfs-and-heres-how-i-did-it/278)
Roundcube smtp (250) authentication failed
Tags: smtp, dovecot, roundcube, linux
Published: 2019-10-28 09:53:35

---
title: Roundcube smtp (250) authentication failed
published: true
date: 2019-09-27 00:00:00 UTC
tags: smtp,dovecot,roundcube,linux
canonical_url: https://foursixnine.io/blog/2019/09/27/Roundcube-smtp-(250)-authentication-failed.html
---

So, say you find yourself, somehow having the following error in the roundcube logs:

```
[27-Sep-2019 12:44:48 +0000]: <f930f680> PHP Error: SMTP server does not support authentication (POST /?_task=mail&_unlock=loading1569588324419&_framed=1&_lang=es&_action=send)
[27-Sep-2019 12:44:48 +0000]: <f930f680> SMTP Error: Authentication failure: SMTP server does not support authentication (Code: ) in /roundcube/program/lib/Roundcube/rcube.php on line 1674 (POST /correo/?_task=mail&_unlock=loading 1569588324419&_framed=1&_lang=es&_action=send)
```

You have tried everything, but still can’t seem to be able to send email from roundcube, you keep getting this annoying “SMTP (250) authentication failed” notification, every time you click “Send”.

Well… Make sure that your server is connecting to the right place. It took me a while to realize that roundcube was trying to connect to localhost, but somehow the authentication mechanism stopped working (it was before upgrading).

Since I don’t really want to debug too much today (it’s friday after all), and because my configuration/use case is over ssl/tls, the solution to the probem was simply:

`$config['smtp_server'] = 'tls://services.host.co';`

Et voilà, ma chérie!

![It's alive!](https://media.giphy.com/media/xT5LMDi8H2A1FtLlpC/giphy.gif)
It's a bit like BEM
Tags: css, a11y
Published: 2019-09-26 23:20:11

https://ecss.io/

I am a bit of a cult follower of the CSS style guide Enduring CSS or ECSS, it's not new I think it's quite old now. It's like BEM but I find it's guidelines to lend better to JavaScript rendered apps with components far more easily, and when you really read the docs, there are still some interesting takeaways, stuff like using aria as a styling state mechanic.

If you go to IKEA's website, the kings of flat pack and modular, not only will you find one of the best bits of useable UX and UI, you will probably be inspired too, but what's under the hood that's more to the point of this post. The CSS, just look at it, what the heck is it? 👽 Well that's what I thought when I was snooping and shopping about a year ago. Turns out friends, it's a modified version of ECSS. 

I have been using ECSS in all my personal projects and BEM at work, I'm not going to sit here and tell you X is better than Y but more, just take it for a spin. I have really enjoyed working with it. Coming up with 3 letter namespaces for my components and using that to tie together related but seperate components has been fun. cart becomes `crt` and although cart button and cart link are different components, you can in 3 letters find all the cart related stuff.

Anyway I want to do a practical post, if you are interested, comment down below and I will write something about it in the context of a modern application.
Margin vs Padding in CSS Explained
Tags: webdev, css
Published: 2019-09-26 22:44:49

---
title: Margin vs Padding in CSS Explained
published: true
description: 
tags: #webdev #css
cover_image: https://thepracticaldev.s3.amazonaws.com/i/bte89ts228bjy8j1vv4e.gif
---

# Introduction

Differentiating between `margin` and `padding` css properties can sometimes be confusing, the short description of these two properties is that padding can be considered as an internal element which helps to create space around the element (outside the border), in the opposite `margin` is used to control the space outside the container (inside the border).

This an example of what’s already said: 
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/bte89ts228bjy8j1vv4e.gif)

The image present the `box model`, this box is geometrically defined by the following properties: width, height, border, padding and margin.

# Margin

We can denote the length of the `margin` property by using `px` pixel, `em` or `%`, choosing one of these unit depends on how you’re managing the size and the positioning of your elements.

To set the size of the *margin area* we have the choice to use the suffixes `-top` (top), `-right` (right), `-bottom` (bottom) and `-left` (left) to define all four sides of an element.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ap6cpbsleg4k0jua33ee.gif)


```css
.element {
  margin-top: 10px;
  margin-right: 5px;
  margin-bottom: 0;
  margin-left: 15px;
}
```

We have also the choice to set all of the values respectively (top, right, bottom and left) in one line: 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/q34m4g3erh15d9q9k5p4.jpg)

If the top and bottom and right, left has the same values we'll have this presentation:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/whb3hrdtfwqcbdp2lssr.jpg)


# Padding

`padding` share the same principal of the `margin` property except that it creates space around the element inside the border, instead of outside the element.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/hqm653o2uo4xmcd7osdr.gif)

And this is an example that defines the sizes of the padding area on all four sides in one line, then using the direction suffix.


```css
/* One Line Presentation */
.element {
  padding: 15px 20px 13px 8px;
}

/* Direction Suffix */
.element {
  padding-top: 15px;
  padding-right: 20px;
  padding-bottom: 13px;
  padding-left: 8px;
}
```