Posts by Yago Azedias • 1,117 points
27 posts
-
2
votes1
answer67
viewsQ: How to get all letters of the alphabet in Elixir?
I would like to get all the letters of the alphabet in a string list without having to write letter by letter. a = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",…
elixirasked Yago Azedias 1,117 -
2
votes1
answer67
viewsA: How to get all letters of the alphabet in Elixir?
With Elixir you have a way of representing characters by binary values, for example: Let’s say I want to represent the binary value of the letter: a iex(0)> <<97>> "a" Binary varies…
elixiranswered Yago Azedias 1,117 -
13
votes2
answers12902
viewsQ: What’s the difference between git pull and git pull --rebase
In git I have the possibility to make a git pull origin master and a git pull --rebase origin master. I’d like to know the difference between the two.
gitasked Yago Azedias 1,117 -
4
votes2
answers1773
viewsA: What is the Retrofit?
Retrofit is a Java library to create type-safe HTTP secure clients for Android applications How so type-safe? The safety provided by retrofit is that it originally requires the developer to develop…
-
2
votes1
answer56
viewsQ: What do the characters mean in the parameter of a function in Elixir?
For example: defmodule Math do def add(a \\ 2, b) do a + b end end What those two bars mean?
-
2
votes1
answer56
viewsA: What do the characters mean in the parameter of a function in Elixir?
This means a default value for the parameter passed, so in the example given, if no value is passed to the variable a she by default will have a match with the number 2: defmodule Math do def add(a…
-
1
votes1
answer219
viewsQ: How to make a recursive function to sum all the values of an Elixir list
I would like a function that, taking as a parameter a list, returns me the list somatic. Something like: iex(0)> Recursive.sumAll([1, 3, 5]) # => 9
elixirasked Yago Azedias 1,117 -
1
votes1
answer219
viewsA: How to make a recursive function to sum all the values of an Elixir list
Elixir has a very clever way of dealing with recursive functions, because the default lists are already chained or linked. Head and Tail (head and tail) In Elixir the lists can be separated into two…
elixiranswered Yago Azedias 1,117 -
1
votes1
answer218
viewsQ: How to pick an element from a list by index in Elixir
I tried to take it the traditional way: [:a, :b, :c, :d][2] but I get the following error: ** (ArgumentError) the Access calls for keywords expect the key to be an atom, got: 2 (elixir)…
elixirasked Yago Azedias 1,117 -
2
votes1
answer218
viewsA: How to pick an element from a list by index in Elixir
Elixir is not an object-oriented language, so the module Enum has only three functions that allow accessing an element of an array based on its index: iex > Enum.at([:a, :b, :c, :d], 2) :c iex…
elixiranswered Yago Azedias 1,117 -
4
votes1
answer155
viewsQ: What is "|>" for in Elixir?
Reading some codes from elixir I see |> be used commonly. What it means?
elixirasked Yago Azedias 1,117 -
8
votes1
answer155
viewsA: What is "|>" for in Elixir?
The symbol |> is known as the pipe operator. The pipe operator |> is something extremely useful and will certainly improve the readability of your code with Elixir. It basically takes the…
elixiranswered Yago Azedias 1,117 -
2
votes1
answer116
viewsQ: What is the difference between "===" and "==" in Elixir?
I would like to know the difference between == and === when making expressions and conditions with elixir
elixirasked Yago Azedias 1,117 -
3
votes1
answer116
viewsA: What is the difference between "===" and "==" in Elixir?
Different from most languages, === does not double check equivalence and type. As in javascript: > 1 === "1" false > 1 == "1" true In Elixir, the difference between == and === is that the…
elixiranswered Yago Azedias 1,117 -
2
votes1
answer664
viewsQ: What is a migrate?
I am a beginner in the world of Jango and one of the first things I find in tutorials is the term migrate I’d like to know what that refers to, how to use it and what it’s for.
-
6
votes2
answers38101
viewsA: Checking if value exists in an array via search field
Today there is a more current and functional alternative to find out if a given value belongs to an array. You can use the method Array.prototype.includes() of ES7. Rewriting the answer, we would…
-
0
votes1
answer411
viewsA: Use if in onPress event
Most likely in this.state.busca the this is linked to the context of its anonymous function within the onPress() try to make a bind() to pass the context of your class to the this: <Button…
-
7
votes2
answers3752
viewsA: What is the difference between Compile and Implementation in the Android Studio build.Radle file?
The configuration compile is obsolete It’s one of the big changes coming from Gradle:3.0, which Google announced in 2017 on google I/O The configuration compile is now deprecated and you must…
-
1
votes2
answers1085
viewsA: How to test whole arrays in javascript?
There is a more "functional" alternative to solving this problem. Using the method every that checks whether all values of an array respect a certain condition: const hasPair = (arr) => (…
-
0
votes2
answers88
viewsQ: How to use extensive functions in Javascript
In Javascript primitive types have native functions, such as an object of the type Number has a function toString(): (1).toString(); // "1" And an array has a includes(): [1, 3, 4].includes(1); //…
-
2
votes2
answers88
viewsA: How to use extensive functions in Javascript
What you’re looking for is the prototype: All javascript objects have ineter methods from your prototype, so if you want to use extensive functions, you can do something like this:…
-
1
votes1
answer6658
viewsQ: React - How to modify a state of the parent component from the child?
Let’s say I have a parent component: import React from 'react'; import style from './style.less'; export default class Wrapper extends Component { this.state = { active: false } render() { return (…
-
2
votes1
answer6658
viewsA: React - How to modify a state of the parent component from the child?
You can use functions of callbackParent(): There are frameworks to handle state management, such as Redux. But if the idea isn’t to add a new module to your project, maybe you can use callback…
-
5
votes1
answer1167
viewsQ: How to get a random number in Kotlin?
How can I get a random number between two values? Like ruby does with rand(0..n)
-
6
votes1
answer1167
viewsA: How to get a random number in Kotlin?
There are some ways to solve this problem: A normal method: The first and most intuitive is to create a function that returns a random number using the class java.util.Random: import…
-
21
votes3
answers4426
viewsQ: In practice, what is the use of C-pointers?
Recently I have been studying the language and so far I have not identified practical utility for the use of pointers. I understand how it works very well, but nothing more.
-
0
votes2
answers88
viewsA: Tags do not understand much
Before starting development with HTML5 and CSS3 it is good to have a general basic notion about the web development environment. 1 - There is a difference between HTML tags and CSS styling commands.…