teleren/devto huggingface dataset:
When does understanding other programmers' code become easier?
Tags: programming, beginners, productivity, coding
Published: 2017-11-26 11:15:59

---
title: When does understanding other programmers' code become easier?
published: true
description: What it takes to better understand other programmer's code
tags: programming, beginners, productivity, coding
---

I could simplify and say, “with experience”, but that’s not the whole story.

Understanding code requires understanding the language, the paradigm, the domain, and the owners. Let’s consider each of these:

- *Language* - The programming language consists of syntax, libraries, and best practices. The more you’ve worked in a language the easier it gets to understand other code. As you excel in one language though you’ll find you slowly gain the ability to read other languages with less work.
- *Paradigm* - Above the language are the various programming paradigms used in the software. If it’s a paradigm you’ve not seen before it will be harder to understand. Fortunately there are a limited number of fundamental approaches, so you can learn them all — though there are an unlimited number of variations, but those you can glean from the project itself.
- *Domain* - Different domains have different approaches to how software is used and written. Video games are quite different than business apps and system libraries. Reading code within a domain you know is obviously easier than one you don’t. In time, as you learn more domains you’ll find it easier to pick up on new ones quickly.
- *Owners* - This is the human element to the understanding. Projects have a lot of different managerial approaches and personality types, these reflect heavily on how the code looks. As you work with more people you’ll get a better insight into why some decisions are made, and how the software is structured.

The key to understanding code is in variety. Not the amount of experience, but the breadth of your experience, will determine how easy it is to grasp new project.


_Taken from my answer to this question at [Quora](https://www.quora.com/When-does-understanding-other-programmers-code-become-easier/answer/Edaqa-Mortoray)_
what should be your career path on an Agile Team after becoming senior full stack Dev, and you have 30 years old? 
Tags: discuss, career
Published: 2017-11-26 05:17:04

---
title: what should be your career path on an Agile Team after becoming senior full stack Dev, and you have 30 years old? 
published: true
description: 
tags: #discuss #career
---

I became project manager for 1 year, but I returned to development because was what passionate me, but now I have a carrer path dilema, and in my company there is no technical lead because they believe in self organization
Using calc() in CSS responsive design
Tags: css, calc, responsivedesign
Published: 2017-11-26 00:52:22

---
title: Using calc() in CSS responsive design
published: true
description: 
tags: css, calc, responsive design
---

<h1>How to use calc() in css styling</h1>

Last time I made a post about my struggle with responsive design and adding multiple breakpoints and doing a lot of math in excel. <a href="https://dev.to/tyzia/css-and-media-queries-59g" alt="Post about struggle with css calculations" target="_blank">The post can be found here.</a> Thanks to <a href="https://dev.to/arccosine">ArcCosine's</a> comment, I learned about calc() function in CSS. I applied it in my css file and it worked like a charm!

Here is the html code:

<pre>

div id=A

    div id=B
        img
        img
        img
        img
        img
    /div

/div
</pre>

In browser this looks like this:

<img src="https://thepracticaldev.s3.amazonaws.com/i/px7l76r0ae23noat0oj9.JPG" alt="div in browser" />

To keep it short: I have 5 images of social icons, 51px fixed width each. The width of their container (div id=B) is 480px. I would like to calculate margin between icons responsive to screen size. So my css calculation is like this:

<pre>

#B img {
    margin-right: calc((100% - 255px) / 4);
}

#B img:last-child {
    margin-right:0
}

</pre>

Just a tiny explanation:

1. We take 100% of the width of the icon's container. It's 480px.
2. Then we deduct the width of all icons, which is 5*51px = 255px.
3. This gives us the remaining spacing in the container. We need to divide it by 4. Because we have 4 gaps between 5 images.
5. So we have the length of our margin-right. Last icon's margin we set to zero.

Now, if we resize the screen, container's width will be, for instance, 460px and margin-right will be recalculated based on the new container's width.

That short, that simple. Thank you ArcCosine, once again.
web-log 2017.11.25
Published: 2017-11-26 00:19:28

---
title: web-log 2017.11.25
published: true
description: 
tags: 
---
# Sweets ranking Japanese like:
![Sweet Japanese](https://thumbnail.image.rakuten.co.jp/@0_mall/v-drug/cabinet/0702/4901330573041.jpg?_ex=300x300)
(http://sugowaza.xyz/日本人が最も好きなお菓子はこれだった！お菓子/)

#Order your own black-thunder(chocolate) package:
![Order your own black thunder package](https://decoto.jp/blackthunder/galleries/image/1804/2022)
(https://decoto.jp/blackthunder/decoration/edit/0)

#matlab joke command:
why
spy
Need a Slug?
Tags: rails
Published: 2018-02-23 15:52:46

---
title: "Need a Slug?"
published: true
tags: rails
canonical_url: https://calebhearth.com/need-a-slug
---

Ever needed a URL for a title of an article, event, etc. in your Rails app? Rails provides a free method for creating this type of slug: `String#parameterize`.

You can call the method, which downcases, hyphenates, transliterates, and removes punctuation as:

```
> "Need a Slug?".parameterize
=> "need-a-slug"
```

It’s great for creating URLs, but remember that it’s not unique, so two strings can return the same parameterized output and cause issues if it’s used naïvely:

```
> "Need a Slug?".parameterize
=> "need-a-slug"
> "Need a slug.".parameterize
=> "need-a-slug"
```

It’s also useful if you need to quickly grab a slug from a string outside a Rails app. I just used it to post an event with the parameterized path of the event’s title.

```
$ heroku run console
> "Title of my Meetup, which was pretty long".parameterize
=> "title-of-my-meetup-which-was-pretty-long"
```

Use it in good health.

> Randy lay there like a slug! It was his only defense!<figcaption>
    Ralphie as an Adult, narrating in <cite>A Christmas Story</cite>
  </figcaption>
Best Alternative for Windows Command Prompt
Tags: devtools, command, linux, terminal
Published: 2020-06-04 04:13:33

---
title: Best Alternative for Windows Command Prompt
published: true
date: 2017-11-25 20:19:27 UTC
tags: Dev Tools,Command,Linux,Terminal
canonical_url: 
---

In Linux,  terminal is preinstalled but in windows we have cmd. We all know that, it is very difficult to use a command in cmd. All the Linux commands are also not executed in cmd. Then what to do in windows, how to install those node modules and gem commands for ruby or run a Python script? Also we know that cmd has its path issue.

Read Full Article here 
-https://www.codehaveli.com/blog/best-alternative-for-windows-command-prompt/
Replacing Function Calls In Python
Tags: python
Published: 2017-11-25 17:33:18

---
title: Replacing Function Calls In Python
published: true
description: 
tags: #python
---

I recently came across a handy function in Python that I would like to share with you. Consider the following piece of code:

```Python
# This code is not modifiable

# a.py
from scipy.spatial.distance import cdist

def test_function():
    coords = [(0,0), (3,4)]
    y = cdist(coords, coords, metric="euclidean")
    print(y)
```
This function uses an external [distance function](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cdist.html) called `cdist()` and calculates the euclidean distances of some (hardcoded) list of points. The resulting distance matrix between every pair of points is printed to the console. Up until now you used this function in your code, and everything was fine. 

```Python
# Your code = modifiable
from a import test_function

test_function()

# Prints
# [[ 0.  5.]
#  [ 5.  0.]]

```
However, you decide that from now on you don't want to use the euclidean distance anymore. You want to use some other function instead of `cdist()`. There is a problem: You cannot modify the above code. Your collegue wrote this above code and he is out of town. But you still have to use this function. A complete rewrite is also not possible, because you think the function is way too complex.

The solution: `mock.patch()`

```Python
# Your new code 
from a import test_function
from unittest import mock

def rogue_cdist(x1, x2, metric):
    print("rogue_cdist called")

with mock.patch('a.cdist', wraps=rogue_cdist):
    test_function()

# Prints
# rougue_cdist called
# None
```

[mock.patch()](https://docs.python.org/3/library/unittest.mock.html#where-to-patch) works by temporarily changing the object that a name points to with another one. You can use `mock.patch()` with a context manager as shown above. In the above example, your new `rogue_cdist()` function gets called, and now you are able to fill it with whatever distance metric you like.

I think this is very clever and clean and allows you to do modifications on existing code, without the need for the infamous copy-pasterino coding style.
Let's talk net neutrality
Tags: discuss
Published: 2017-11-25 15:43:28

---
title: Let's talk net neutrality
published: true
description: What do you think the results of the latest push to abolish net neutrality in the US will be?
tags: discuss
---

What do you think the results of the latest push to abolish net neutrality in the US will be? How can we have the biggest impact on the outcome? What's different _this_ time? What are the long-term stances we can take?
Why I learned Elixir Lang
Tags: elixir, ruby, programming, opinion
Published: 2017-11-25 15:12:32

---
title: Why I learned Elixir Lang
published: true
description: A recount on how I ended up loving Elixir Lang
tags: elixir, ruby, programming, opinion
---

I am always learning new things. And is not in a bragging sense that I said it. Is more a yell for help. Many times I spend my free time hook in an article about this new thing that I read mentioned on a twit.

I am getting better on not doing that, and respect my free time. I walk more, spend more time playing with my daughter or just laying face up on my bed looking for figures in the blank ceiling on my bedroom.

But 6 years ago, when in the company I work for, we decided to use CouchDB, I found amazing how it worked and I started looking for a way to better the speed on index view building. So I read that doing it on Erlang was better. And that started a chain reaction where I start learning Erlang. At the time I was experimenting with Scala, so I look for something similar, at least that was my reasoning, that compiled to BEAM, and that was more expressive to build my views. I found Elixir Lang, so I start playing with it. 5 years later, we have 1 API wrote in Elixir on production, and another Phoenix Framework project on its way. And more important, I think, my understanding of Ruby (my primary work language) has increased dramatically.

Understanding what is not Object Oriented Programming, has helped a lot un really grasp what it is. It also, allows me to understand Procs and Lambdas, and to reduce side effects on my day job coding.

Thanks Elixir, now, I will lay on my bedroom and think about it a little more.
What made you want to become a dev?
Tags: discuss, career
Published: 2017-11-25 14:04:21

---
title: What made you want to become a dev?
published: true
description: Share some nostalgia with all your favorite people
tags: #discuss #career
---

We all have those defining moments in our career or our education that made us realize that we wanted to become devs.

For me, it was in my first programming class when I wrote some Python code that added a couple of numbers together. It wasn't like a calculator or anything, it was literally:

```python
print 3 + 4
```

It sounds dumb, but when I ran that one line in Idle I said to myself "I made the computer do that... Whoa".

What was your dev-defining moment?
Last Post: Message sent to..
Tags: poetry
Published: 2017-11-24 15:23:02

---
title: "Last Post: Message sent to.."
published: true
description: The man who gave the orders
tags: poetry
---

War is a pertinent issue for all of us.  If it's not in Yemin, where Saudi's stop the docks, causing the biggest famine because aid supply was stopped by military out to sea with food and supplies and our politicians just turn there head. And look at North Korea, might be good for Americans politicians to say "We are willing to send troops" and they die, this time it's near me and I really do not understand how it is happening.  There is no logic in war, only for the ones with the weapons, money doesn't buy peace, it funds war.  

In my country, we are taught about war and told: "Lest we forget".  You are damn right, people have forgotten what war really is like.  This poem Dulce et Decorum Est by Wilfred Owen REMINDS US, REMINDS US, THAT PEOPLE DON'T NEED WAR. Enjoy

---
Bent double, like old beggars under sacks,
Knock-kneed, coughing like hags, we cursed through sludge,
Till on the haunting flares we turned our backs,
And towards our distant rest began to trudge.
Men marched asleep. Many had lost their boots,
But limped on, blood-shod. All went lame; all blind;
Drunk with fatigue; deaf even to the hoots
Of gas-shells dropping softly behind.



Gas! GAS! Quick, boys!—An ecstasy of fumbling
Fitting the clumsy helmets just in time,
But someone still was yelling out and stumbling
And flound’ring like a man in fire or lime.—
Dim through the misty panes and thick green light,
As under a green sea, I saw him drowning.

* A green gas emitted from a grenade like device producing 'mustard gas', if you didn't get your mask on in time, you'd drown in your own fluids as the gas melts your lungs.

In all my dreams before my helpless sight,
He plunges at me, guttering, choking, drowning.

If in some smothering dreams, you too could pace
Behind the wagon that we flung him in,
And watch the white eyes writhing in his face,
His hanging face, like a devil’s sick of sin;
If you could hear, at every jolt, the blood
Come gargling from the froth-corrupted lungs,
Obscene as cancer, bitter as the cud
Of vile, incurable sores on innocent tongues,—

*You must always remember, Remind people!

My friend, you would not tell with such high zest
To children ardent for some desperate glory,
The old Lie: Dulce et decorum est
Pro patria mori

* It is fitting and noble to die for one's King

War is only for King's and Queen's
I don't want your stinking war

There is a very simple logic in a person's suffering.  Over the years, weapon makers have made weapons that distance the fighter from the enemy.  Back in the trenches, they'd call break to clear the dead.  Our troops reported that they could not understand but heard laughing from the other trenches.  They weren't monsters, they played and laughed like humans.  So began the journey to horrible weapons like drones, that distance the person from death.  Remind them "Lest we forget" men like Wilfred Owen.
Setting RabbitMQ cluster via config
Published: 2018-11-18 06:24:15

---
title: Setting RabbitMQ cluster via config
published: true
tags: 
canonical_url: https://alex.dzyoba.com/blog/rabbitmq-cluster-config/
---

RabbitMQ is the most popular AMQP broker or in other simple words - queue server. People use it to queue and track heavy processing, distribute tasks among workers, buffer incoming messages to handle spikes and for many other use cases.

This sounds like a very important part of your infrastructure, so you are better off making it highly available and RabbitMQ has clustering support for this case.

Now there are 2 ways to make a RabbitMQ cluster. One is by hand with `rabbitmqctl join_cluster` as [described in the documentation](http://www.rabbitmq.com/clustering.html#transcript). And the other one is via config file.

I haven’t seen the latter case described anywhere so I’ll do it myself in this post.

Most of the things I’ll describe here is automated in my [rabbitmq-cluster Ansible role](https://github.com/dzeban/rabbitmq-cluster).

Suppose you have somehow installed RabbitMQ server on 3 nodes. It has started and now you have a 3 independent RabbitMQ instances.

To make it a cluster you first stop all of the 3 instances. You have to do this because, once set up, RabbitMQ configuration (including cluster) is persistent in mnesia files and will try to build a cluster using its own internal facilities.

Having it stopped you have to clear mnesia base dir like this `rm -rf
$MNESIA_BASE/*`. Again, you need this to clear any previous configuration (usually broken from previous failed attempts).

Now is the meat of it. On each node open the /etc/rabbitmq/rabbitmq.config and add the list of cluster nodes:

```
{cluster_nodes, {['rabbit@rabbit1', 'rabbit@rabbit2', 'rabbit@rabbit3'], disc}},
```

Next, again on each node, create file /var/lib/rabbitmq/.erlang.cookie and add some string to it. It can really be anything unless it’s identical on all nodes in the cluster. This file must have 0600 permissions and owner, group of rabbitmq server process.

Now we are ready to start the cluster. But hold on. To make it work you MUST start nodes by one, not simultaneously. Because otherwise cluster won’t be created. This is a workaround for some strange that I found in mailing list [here](http://rabbitmq.1065348.n5.nabble.com/Rabbitmq-boot-failure-with-quot-tables-not-present-quot-td24494.html#a24512).

I hit this one 2 times - one when I configured my RabbitMQ nodes via tmux in synchronized panes, and the other when I was [writing Ansible role](https://github.com/dzeban/rabbitmq-cluster/blob/master/tasks/cluster.yml#L22).

But in the end, I’ve got a very nice cluster with sane production config values that you can check out in [defaults of my role](https://github.com/dzeban/rabbitmq-cluster/blob/master/defaults/main.yml).

That’s it. Until next time!
Functions in Go.
Tags: go, programming
Published: 2017-11-24 21:38:38

---
title: Functions in Go.
published: true
description: In this part, we look at functions in Go, and how they are used.
tags: go,programming,golang
---

In this part of the series, we're going to look at Functions, and how they work in Go.

## What is a Function?
A function is a block of code that performs a specific task. A function takes an input, performs some calculations on the input and generates an output.

There are two types of functions you'd make use of in Go. 1) User-defined and 2) Standard functions.

### User-defined Functions
This type of function, we create ourselves to perform a specific task in a program.

#### Declaration
Here's the syntax to declare a function:

```go
...

func sayHello() {

  fmt.Println("Hello World!")  
}
```

In the sample code above, we declared a function `sayHello` which prints the string `Hello World` when the function is called. Every function in Go, starts with the `func` keyword followed by the function name (we'll talk about naming conventions in a later article), and parenthesis, and then a block wrapped in between curly braces (`{ }`).

```go
...

func greet(name string) {
  
  fmt.Println("Hello " + name)
}

```

The example above is another function, this time it takes in a parameter. See parameters as pieces of information that further defines a Function. In the code above, we declared a function `greet` which accepts a parameter `name` of type string. Calling this function is straight and simple:

```go
...

func main() {

 greet("Francis Sunday")
}

func greet(name string) { ... }

```

> PS: When using parameters, its required to explicitly define its type.


```go

package main 

import "fmt"

func split(number int) (int, int) {

  x := number * 4 / 9
  y := number - x

  return
}

func main() {
   
  x, y := split(100)

  fmt.Println("%d + %d = 100", x, y)
}
```

In the code above, we declare a function `split` which accepts a single integer as a parameter `number`. The function takes a parameter of type `int`, and returns two numbers of type `int` that sums up to the input parameter.

Running the program you should get the following:

```bash
$ go run functions.go

44.44 + 55.56 = 100
```

---

In this article, we've looked at Functions in Go, how they help use organize repetitive tasks into smaller blocks of code we can reuse any where in our program. In a later article in this series, we'd explore more on Functions.

Feel free to leave a comment if I've missed something important.
3 Best Ways To Initiate The Mobile App Development Process
Tags: appdevelopment, appdevprocess
Published: 2017-11-24 18:52:30

---
title: 3 Best Ways To Initiate The Mobile App Development Process
published: true
description: This blog elucidates how you should start the mobile app development process.
tags: app development, app dev process
---

Mobile App Development is quite a complex process which demands the implementation of the leading tools and techniques to make your app out of this world. But before taking the plunge it is your duty to frame the game plan. You need to make up your mind regarding what kind of app you want to develop and which operating systems will support that.

Here are the 3 effective ways that will help you to start the mobile app development process successfully:

1. Do decide the type of app you want to build. If you want to build a ‘native app’ then you may need to invest a high amount but it will be worth as the app will execute better than the other forms of apps. It gets supported by your phone’s inherent features. As native apps are a bit challenging to make you may end up learning some new languages and strategies during the app development process.

Opt for building ‘web apps’ if you are looking for a less challenging alternative. They are easily accessible as they can support technologies like CSS, JavaScript, HTML5 due to which they can be operated on almost any device. Moreover, its maintenance will also not cost you much.

By the term, only you can decipher that ‘hybrid app’ is a combination of the above-mentioned apps. It can make ultimate usage of modern technologies as well as can your mobile device’s native features. As it utilizes the same code for all platforms it makes easy to device’s native characteristics. So basically you need to clearly understand the motive behind developing your app and the level of experience you can provide to the users.


2. Mobile backend as a service (MBaas) offers the services that can act as a strong backing to the apps till they exist. It can help your app to combine with other systems and make it secured. You need to make sure that MBaas can easily mix up with the existent system and support the functional system.

3. If you want to boost up the mobile development process then you should put into useful tools like Rapid Mobile Application Development (RMAD), Mobile Application Development Platforms (MADPs), etc. They come up with high-quality software which can effectively help in development and management of apps. If you decide to use them it is a requirement to combine the apps with the existent structure.

So follow the explained strategies and [start the mobile app development](https://mobileapprental.com/) process immediately to produce an outstanding app for the target users.
Запуск встроенного PHP веб-сервера из PHPUnit
Tags: php, phpunit, webdev
Published: 2018-02-02 14:23:27

---
title: "Запуск встроенного PHP веб-сервера из PHPUnit"
published: true
tags:  php, PHPUnit, webdev
canonical_url: http://phpprofi.ru/blogs/post/81
---

![](http://phpprofi.ru//resources/img/blogs/f9f69e92-5eee-487e-b9ca-c1beac882a04.jpeg)

Иногда в PHP нам нужно написать интеграционные тесты, и иногда для этих интеграционных тестов нужен веб-сервер. Встроенный веб-сервер доступен начиная с PHP 5.4 и для этих целей можно использовать его.

----
Читать далее: http://phpprofi.ru/blogs/post/81

----
En: https://medium.com/@peter.lafferty/start-phps-built-in-web-server-from-phpunit-9571f38c5045