Posts by Wilker • 1,890 points
56 posts
-
0
votes1
answer57
viewsA: How to boot Spotify API on Rails?
This is a ruby gem, a ruby package that can be an application or library. In this case, it is a library that encapsulates the logic of calling `the Spotify API, so it is not necessary to develop its…
-
0
votes2
answers241
viewsA: How I present the data that is in the other table in the view. Rails 5
The cause of the mistake is that Patient that you’re trying to show off doesn’t have a Address. I mean, he is nil and so when you try to access the attribute street of address you have the error…
ruby-on-railsanswered Wilker 1,890 -
1
votes2
answers286
viewsA: How to restore a modified file that was error from Git?
To rule out ALL what you did locally: git reset --hard To discard all changes to a specific file: git checkout -- <arquivo> To put in the pile everything you did and have possibility to…
-
1
votes1
answer168
viewsQ: Bash write output in terminal and file
I am creating a script and need the outputs to be shown in the terminal, but also saved in a file #!/bin/bash echo "Olá Mundo" and I am redirecting the output to the file as follows ./teste.sh >…
-
1
votes1
answer294
viewsA: Why does my print command not work?
You are doing an assignment on the line print = (nome,idade,peso) the correct is print(nome,idade,peso)
-
1
votes1
answer284
viewsQ: What is the difference between form_for and form_tag?
What’s the difference between form_for and form_tag in the construction of forms since the final result is apparently the same? In which situation choose one or the other?…
ruby-on-railsasked Wilker 1,890 -
11
votes2
answers160
viewsQ: Equal sign in Ruby method definition
I have come across the following definitions of methods and I would like to know the difference between the first definition and the second. This first has no equal sign in the definition: def nome…
-
1
votes2
answers299
viewsA: Exercise in C returns wrong value
Our friend @Assanges is correct. The problem is the line containing the statement char especificacao[] = ""; What happens is you’re not declaring the area size in memory reserved to keep a String,…
-
1
votes1
answer34
viewsQ: Set CLASSPATH to be accessible in Apache
How do I for the environment variable CLASSPATH be accessible by apache? I have a Django project that uses the library python-weka-wrapper that bridges the Weka Java implementation. Everything works…
-
4
votes1
answer2391
viewsQ: What is Entity Manager?
What is the Java Entity Manager? Attending a class on java the teacher mentioned that the method find() of Entity manager and that this method, when searching for a record in the database stores the…
-
1
votes1
answer702
viewsA: Rails. Uncaught Referenceerror: jQuery is not defined
The library jQuery needs to be the first to be loaded on the page. Something that wasn’t happening when the files were compiled CoffeeScript in JavaScript and served. So I changed my file…
-
2
votes2
answers372
viewsA: "Nothing to commit" after failed authentication
The message: On branch master Nothing to commit, Working directory clean says that you are in the master branch and there is nothing to commit in your working directory, because in: git commit -am…
-
0
votes1
answer702
viewsQ: Rails. Uncaught Referenceerror: jQuery is not defined
I am implementing a part of notifications in a Rails project, from a tutorial and am getting this error. Uncaught ReferenceError: jQuery is not defined at…
-
0
votes1
answer94
viewsQ: Import: No module named manages.alert.views
I am trying to use the following function defined in gerencia/alert/views.py def maLogger(level, message, node=None): aux=0 if level=='Critical_client': aux=2 date = datetime.datetime.now() log =…
-
6
votes2
answers58
viewsA: Why is the condition of j never satisfied with "||", and why is i satisfied with "&&"?
The question is the following, you are only increasing the value of the variable i. This way it will vary from 0 until 99. These are the truth tables for the logical connectives: And (&&) A…
-
0
votes1
answer103
viewsA: Greater precision in two-point distance problem
I don’t see why accuracy is incorrect, the only thing wrong seems to me the lack of a "t" in sqrt I tested the code below and it worked perfectly. #include <stdio.h> #include <math.h>…
-
1
votes2
answers3880
viewsQ: What is the unless command for in Ruby
Can anyone explain how this command works unless in Ruby? ruby_is_ugly = false puts "Ruby não é feio!" unless ruby_is_ugly Got out "Ruby não é feio!"…
-
5
votes2
answers519
viewsQ: What are checked exceptions?
While following a discussion about programming languages, I saw people arguing about checked excpetion each with its arguments for or against. They said that such language implements and such…
-
1
votes2
answers878
viewsA: Subtract shellscript input argument value
I also got it this way for i in $(seq 1 `expr $1 - 0`); do if [ $(($i % 2)) -eq 0 ] then echo "$i,\c" fi done
-
1
votes2
answers878
viewsQ: Subtract shellscript input argument value
I have the script below that prints on the screen the even numbers of 1 until the input argument. #!/bin/bash for i in $(seq 1 ($1)); do if [ $(($i % 2)) -eq 0 ] then echo "$i \c" fi done For…
-
1
votes1
answer42
viewsA: How do I set certain array values for the same value? (Java)
Somehow you will need to inform the specific positions in which you want the same value. So, a small optimization would be this way. array[2][3] = array[6][7] = array[1][9] = -1;…
-
9
votes5
answers2915
viewsA: What is actually the array?
Array is a primitive data structure about which you quoted (Listas, Tuplas) and others Objetos which store data can be built. Language-independent, array, is nothing more than a continuous space in…
-
4
votes2
answers2086
viewsQ: How to capture all exceptions in Python?
How to capture any and all Python exceptions? Are there any keywords for this? Like in Java you just make one try { } catch(Exception ex) { }
-
12
votes4
answers11601
viewsQ: Set constant in Python
How can I declare a constant in Python the same way I do in C with #Define PI 3.1415 or in java public final double PI = 3.1415…
-
1
votes3
answers92
viewsA: Manipulate String in JAVA?
You can use the Java split function to do this. String email = "[email protected];[email protected]"; String[] emails = email.split(";"); System.out.println(emails[0]); The split function divides a…
-
0
votes1
answer968
viewsA: Attributeerror: 'list' Object has no attribute 'apend'
It was just a typo. You forgot a 'p' in "append" Change self.items.apend(item) for self.items.append(item) Also, you need to move this block back to the correct scope. s = Stack() s.push(54) print…
-
7
votes2
answers721
viewsA: Error in C printf
Change printf("There are %d blank spaces",&cont); for printf("Existem %d espaços em branco",cont); When using the &, you try to print the address of the variable, therefore the mistake:…
-
5
votes1
answer21967
viewsQ: What is . in <form action="." method="post">?
I’m starting in Django and making some changes in code already written by someone. I realized that in form instead of the usual "/action page" to which the data will be submitted, such as in this…
-
1
votes1
answer2657
viewsA: I can’t Update spring project on Heroku with git
TL;DR Or vc adds remote repository url manually with the command git remote add [nomecurto] [url] in this way, git remote addheroku [url-do-app] OBS: The remote url can be found in Heroku Git URL Or…
-
0
votes2
answers174
viewsA: How do I create an alias to run multiple commands with git?
The Error cpd@INFORMATICA-01 MINGW64 /c/wamp/www/alura_git/curso_git (master) $ git upl "teste" error: switch `m' requires a value usage: git commit [<options>] [--] <pathspec>... is…
-
0
votes1
answer105
viewsQ: Django does not create admin.py file in new app
I’m following some video lessons about Django to make some changes to a project started some time by someone else. However, when starting a new app in this project with the command django-admin…
-
2
votes2
answers15955
viewsA: Print multi-dimensional matrix in Python
According to its code, its matrices will be two-dimensional, since it is requested to enter the size of two dimensions only. So you can use the code below. for linha in m: for val in linha: print…
-
7
votes3
answers809
viewsA: C program "eating" characters when executed
Change the line printf("insira a idade do aluno %d" + (i + 1)); for printf("insira a idade do aluno %d" ,i+1);
-
5
votes5
answers590
viewsA: Remove chunk from a string
You can use the function explode to do this. $str = "32137hyb8bhbhu837218nhbuhuh&3298j19j2n39"; $str = explode("&",$str); echo $str[0]; That’s the way out 32137hyb8bhbhu837218nhbuhuh…
-
4
votes2
answers592
viewsA: Better performance for few accesses: Hashmap or Treemap?
With HashMap you will have O(1) for access most of the time. It depends on the number of collisions, and that due to the low number of data will not be the case. While with Treemap for access is…
-
7
votes3
answers3123
viewsA: format ľ%d' expects argument of type ěint', but argument 2 has type ěchar *' - What is it? How to tidy up?
The %d is for printing whole numbers. To print characters use the %c As stated in the comment the intention is to print the entire value of the memory address of *caractere_ptr. As stated by…
-
20
votes3
answers17530
viewsQ: Why do we have to use the attribute self as an argument in the methods?
I watched a video class where it is said that every method is required to pass the parameter self in the method definition, as in the example below: class Complex(object): def __init__(self, real,…
-
3
votes2
answers13959
viewsQ: What is the difference between Associative Entity and the Intermediate Table of relationships N for N?
What’s the difference between Associative Entity and the Intermediate relationship table N to N? Is there any notable difference in the model translation ER to the relational model? In the ER model…
-
2
votes2
answers2419
viewsA: Primary key in associative table(Many for many)
I have the following question in relationship N to N. The keys foreign become a primary key composed of the table associative. Correct? Correct. N-to-N relationships should generate a table of their…
-
1
votes3
answers377
viewsA: Problem with array in Java
Missing you instantiate the objects in the arrays positions end[], tel[], email. On calls Endereco end[] = new Endereco[max]; Telefones tel[] = new Telefones[max]; Emails email[] = new Emails[max];…
-
4
votes1
answer139
viewsA: How to run a loop while waiting for input?
Yes it is possible, but not with a single Thread, whereas programmes are sequence of instructions. If I understand what you want, this is a simpler kind of problem Produtor/Consumidor (because I…
-
1
votes1
answer324
viewsA: Script for GIT update
Try the following Create a script like this #!/bin/bash cd /home/{user}/localDoScript/atualiza.sh /usr/bin/git add -A /usr/bin/git commit -am "Atualiza rotina`date`" /usr/bin/git push In cron add it…
-
3
votes2
answers3580
viewsA: How to sync github?
If you have not cloned your remote repository to your local machine do the following command on the terminal, in the directory where you want to save git clone <url do repositório remoto> If…
-
3
votes3
answers556
views -
5
votes2
answers14521
viewsQ: Sort dictionary by Python value
I have a dictionary with the following format dic={759147': 54, '186398060': 8, '199846203': 42, '191725321': 10, '158947719': 4} would like to know if there is how to sort it by value and print on…
-
0
votes2
answers1323
viewsA: PIP does not work in virtualenv
The problem was the space in the directory name in "Django Course". wilker@debian:~/Documentos/Git/Curso Django$ virtualenv Blog Apparently the absolute path of a virtual environment should not…
-
0
votes2
answers1323
viewsQ: PIP does not work in virtualenv
After activating the virtutalenv Pip does not work, I get the following error wilker@debian:~/Documentos/Git/Curso Django/Blog$ source bin/activate (Blog) wilker@debian:~/Documentos/Git/Curso…
-
1
votes0
answers86
viewsQ: Measure RTT in JAVA
Is there any way to measure latency between a client and a JAVA server? I intend to create a proxy server that will redirect the request of a client to one of the other two servers, and one of the…
-
1
votes2
answers1627
viewsA: Generate random name in Mysql - Stored Procedure
One way I found and not at all elegant was this:. Use the function substring() together with the Rand() to select a letter randomly from all of the alphabet I passed as argument. After that use the…
-
-1
votes1
answer101
viewsQ: Collection for stock use
What is the best implementation of the Collection interface for implementing a stock class? For example, a stock of supermarket products. My scenario is this:: A system of stock management of a…