Posts by Daniel • 3,168 points
87 posts
-
6
votes3
answers982
viewsA: Concatenation in Ruby and . object_id
How did you find out yourself: The method += generates and makes the variable point to a new String: # exemplo mostra id mudando para uma mesma variável irb(main):010:0> minha_var = "hello"…
-
4
votes2
answers355
viewsA: While loop in PYTHON
Your loop while: while opcoes == 0 or 1 or 2 or 9: Could be written as: while opcoes == 0 or True or True or True: If opcoes is not 0, the expression will remain: while False or True: which in the…
python-3.xanswered Daniel 3,168 -
2
votes1
answer99
viewsA: Runtime Error in Problem Using Recursion
I believe the problem is that the site expects the answers all together at the end of the program execution, and not each "enter". To solve this, a possible solution is to read all the data:…
-
0
votes1
answer299
viewsA: How do I use the break command within two loops in Ruby?
I believe the simplest solution in your case is to satisfy the condition of while: if(palavra1[i]==palavra2[i2]) iguais = palavra1[i2] posicao = i i = maior # sairemos dos laços aqui! end That said,…
-
1
votes0
answers40
viewsQ: Audio Error in Android Virtual Machine
I’m studying a tutorial of Xamarin, and I’m trying to run every step of it on two different machines, only in one of them the emulator closes with the following error: Device error: audio: Failed to…
-
0
votes1
answer379
viewsA: Error "bash: ruby: command not found"
Most likely the program is not listed in your PATH. You need to check the folder where the Ruby was installed, for example: C: Ruby22-x64 Discovered this, you need to add the folder bin in his path.…
-
2
votes1
answer968
viewsA: Python chart does not display all desired values
Solution for the shaft x: xticks defines the location of ticks and of Labels on the axis x, then just pass x1 for him: plt.xticks(x1) Solution for the shaft y: To the y, the numbers were very close…
-
0
votes1
answer335
viewsA: Canvas painting
An easy way to do this, taking into account that your program is still quite simple, is to paint with the background color. So in the code where the painting takes place: context.beginPath();…
-
3
votes1
answer278
viewsQ: How to call a script with arguments?
I’m a little overweight, and researching on Physical Fitness, I figured out how to calculate my caloric expenditure, through the heartbeat. So I created the following script: bpm = 150 massa = 70…
-
0
votes1
answer863
viewsA: Button to enable drawing and clear canvas
The "painting" itself, happens here: if (mouse.down) { /*...*/ } If we put a new parole, can control when the mouse draws or not: if (mouse.down && mouse.pinta) { /*...*/ } pinta, I added in…
-
0
votes1
answer1742
viewsA: Generating graph from an HTML Txt
You can create your file as a .csv (comma-separated values), similar to this: 0,1,3,7,10,10,9,7,7,6 5,4,3,3,4,4,5,6,7,10 8,8,7,8,7,7,6,4,3,2 Separate it into lines using . split: linhas =…
-
1
votes1
answer44
viewsA: Calculate several fields
You can use document.getElementsByClassName() to catch all the Fields at once, and assign to a array. To make sure that the field is not null, just one if: if (valorPrimeiroProduto) { } // só passa…
javascriptanswered Daniel 3,168 -
7
votes1
answer162
viewsA: Compiling code on Ubuntu and running on windows
You can create executables for windows using mingw-W64. By typing the following command, we can see the list of available packages: apt-cache search mingw- Among them: mingw-w64 - Development…
-
2
votes3
answers67
viewsA: How to define the value of a variable from a function?
What is happening is that the function setVariableValue() receives only the value of the variables test, test2 and test3. Then within the function, its operation is executed successfully, but on top…
-
12
votes1
answer5807
viewsA: How to create a new. M3U file correctly? (Since I already have streaming .TS)
TL;DR Use the Ffmpeg. To recreate m3u8 from only one file . ts: ffmpeg -i arquivo_original.ts -codec copy -hls_flags single_file -hls_list_size 0 nova_playlist.m3u8 The command for multiple files…
-
0
votes1
answer189
viewsA: How to interrupt the animation of a carousel
One way to resolve your issue is by calling the stop() and start() function straight from the buttons: <button id='start' onclick="start()">Start</button> <button id='stop'…
-
3
votes1
answer744
viewsA: How to make an image and text appear when clicking on an option?
You set the location where you want to show the image this way: <div id="imagem"> But in your code, you ask him to take the element imagem-harry (which does not seem to exist): var harry=…
-
4
votes1
answer397
viewsA: How to make a sample space using 4.6 and 8-sided data?
If what you seek is to get the combination of the results of the three data (all 192), a simple for loop would suffice: lista = [] for i in range(1, 5): for j in range(1, 7): for k in range(1, 9):…
-
0
votes1
answer345
viewsA: Metaprogramming with ruby, methods with SELF
Let’s say you’re writing a show about cars, and knowing that we’re in 2017, only two years before the cars fly. Your show would look something like this: class Carro @@voa = false # carros não podem…
-
24
votes5
answers1202
viewsQ: How to perform a task at a precise time in time?
A style question Code Golf I made a console program to show the time, only it’s different times than the ones we know - and involves a very simple account. It checks the system time, and upon…
-
0
votes2
answers196
viewsA: modal appears when entering the page instead of waiting to be clicked
One way to do this is to load the page with the attribute visibility of modal in CSS defined as hidden: .modal-box{ visibility: hidden; } And change this property later as a result of clicking:…
javascriptanswered Daniel 3,168 -
2
votes1
answer41
viewsA: Error using file-type
In the little documentation, it is indicated that if the URL does not have an image with compatible format, it returns null: filetype(input) Returns an Object with: •ext - One of the supported file…
-
1
votes1
answer782
viewsA: Data overlapping on the x-axis of the graph
I believe you can rotate this text using: plt.xticks(rotation=20) Upshot:…
-
3
votes1
answer112
viewsA: Check if the given URL is an image
You can use the file-type: npm install file-type Sample code: const http = require('http'); const fileType = require('file-type'); const url =…
-
1
votes1
answer608
viewsA: Button does not call function correctly
In this passage: self.nao.bind("<Button-2>", self.Verificar) <Button-2> refers to the middle mouse button (try your program as is by clicking the middle mouse button). Without touching…
-
2
votes1
answer10442
viewsA: How do I import Python image with the Tkinter GUI?
The 'hello world' image on Tkinter is something like the following code: import tkinter as tk root = tk.Tk() imagem = tk.PhotoImage(file="stack-overflow.png") w = tk.Label(root, image=imagem)…
-
7
votes6
answers49406
viewsA: how to search for an element in a list that is inside another list?
For a more concise and pitonic solution, see this response. You can iterate through the entire list, element by element, looking for the item you want - when you find it, we save the element index…
-
1
votes2
answers1123
viewsA: Removing elements from a list
I believe what you seek is str.split(sep=None, maxsplit=-1), same. Given a string, this method will create a list with each of the items in this string, which can be accessed by an index. See the…
-
3
votes3
answers21057
viewsA: read text file and generate lists for each line with element separation
The file name you want to read is CSV (comma-separated values), meaning "comma separated values. Picking up a file called meu.csv, with exactly this content: 1,julian,0,5,6,7,8,9 2,ana,01,9,5,6,8,1…
-
1
votes1
answer77
viewsA: Input buttons and <a> class buttons do not work
I believe whatever’s keeping your buttons from working, in fact, is e.preventDefault();. I would suggest, since the functionality of the buttons is "disabled", that you return the functionality to…
-
2
votes1
answer608
viewsA: Change encoding in pd.to_datetime
The .to_datetime pandas seems to accept dates in various formats, so I believe you could read both the date of your TXT and any other, and compare them after that: import pandas as pd minha_data =…
-
1
votes2
answers3159
viewsA: Python Taylor series with no angle and error margin
I’d like to understand what it means k in the statement, and also on the error (I’m terrible at math). If you haven’t solved this question yet, I’ll keep your comments here. That said, you can make…
-
0
votes1
answer63
viewsA: solve programming
I believe the problem is that you are using two different Ivs for each element. If the intention is to show or the video or the photo, you can use the same div, and exchange their content for…
javascriptanswered Daniel 3,168 -
3
votes1
answer375
viewsA: create dynamic subdominios in the br registry
To enable the use of a subdomain in Node.js, you can use the module vhost along with the express: npm install vhost Include it in your code, and put its routes before all others: var vhost =…
-
0
votes1
answer234
viewsA: How to change maximum limit of simultaneous connections to db
In the Cloud SQL FAQ, is written: "There are no limitations of queries per second (QPS) for Google Cloud SQL instances. However, there are limits to the number of connections, size and for…
postgresqlanswered Daniel 3,168 -
1
votes1
answer750
viewsA: Typeerror: Uri.indexof is not a Function
I need to take a closer look at the code, but test this change: var request = require('request'); var cheerio = require('cheerio'); var save = require('./savedb.js'); var URL = require('url-parse');…
-
1
votes1
answer2246
viewsA: Is there a way to change a default program by java, cmd or regedit?
This site shows something not very encouraging. It seems that since Windows 10, this functionality has been removed: "We know that standard programs are important to you. In Windows 10, all…
-
1
votes1
answer706
views -
1
votes2
answers80
viewsA: Doubt about JS function
In your code, besides doing an assignment here: if (p1=10) // deveria ser if (p1==10) You are defining a after calling the function: document.getElementById("demo").innerHTML = myFunction(10, 3);…
-
0
votes2
answers319
viewsA: I can’t connect Mongodb to Node
There are some problems with your code, I tried to solve the ones that generate errors... ;) You are statically serving the folder /app/views, which should in principle be used only by engine…
-
1
votes2
answers324
viewsA: How do I use the same argument/parameter in two different functions?
I think it’s best to follow @jsbueno’s suggestion (this is an add-on). By leveraging your code, you can use global variables (not indicated): def seno1(x = int(input("Entre com x:…
-
0
votes2
answers90
viewsA: Logic problem in Javascript
In the statement, he asks to create one room, and four students, and these with four notes. Only, by creating your variables, you create one student only: var sala = []; var aluno = []; // <-…
javascriptanswered Daniel 3,168 -
10
votes4
answers2076
viewsA: How to check if IP exists with bat
dark way kkk I don’t know how obscure this is, but everything indicates that by RFC, packages TCP ACK unsolicited should be answered with TCP RST (connection refused), which can be "abused" (and is)…
-
3
votes1
answer408
viewsA: Div to loading ajax in full screen?
Have you tried with position: fixed? $(".overlay").mouseover(function(){ $(".overlay").css("background-image", "url(https://i.stack.imgur.com/8t6P3.gif)", ); }); $( ".overlay" ).click(function() {…
-
1
votes3
answers2538
viewsA: How to install nodemon globally?
To complement the @Luc response, in Windows 10, the above configuration did not persist - and I decided to manually put in Path of variáveis de usuário (not in the system): In the Path, i included…
-
2
votes1
answer225
viewsA: Error in client-server connection via socket
When testing your code, the compiler gives the following error: program.cpp:23:16: warning: character constant too long for its type char meuHost = '127.0.0.1'; All indicates that you are trying to…
-
0
votes1
answer591
viewsA: Accessing a file using Properties
Properties, are configuration files that work with pairs of chave and valor - these keys and values are always Strings. You use the chave to recover the valor that you save in this configuration…
-
1
votes2
answers452
viewsA: Body NULL Nodejs
At Postman, change your Headers for Content-Type: application/json: Change in Body for raw: And, doing the Post, the answer came: Here’s the code I used for testing - server.js: var express =…
-
5
votes2
answers1028
viewsQ: Create object with internal object array
I would like to create an object "mold" (maybe a class, maybe a function), with possibly other objects inside it, and arrays. The structure I imagine is like this: postagem: { titulo: "", autor: "",…
javascriptasked Daniel 3,168 -
2
votes3
answers414
viewsA: Algorithm for distributing entries from an encyclopedia based on number of characters per day
I haven’t read the other answers, and I don’t know any "smart" way to resolve your question. Having said that, I found the problem interesting, and I tried to solve "in my own way" (under the nail).…