Posts by luislhl • 928 points
23 posts
-
1
votes1
answer343
viewsA: Difficulty updating global variable. c
The Fork function duplicates all data in memory of the parent process, including global variables. So if you change one variable in one of the processes, the change will not be reflected in the…
-
2
votes1
answer1294
viewsA: Is it possible to collect html source code using python?
Python 2: import urllib url = "https://answall.com" f = urllib.urlopen(url) print f.read() Python 3: import urllib.request url = "https://answall.com" f = urllib.request.urlopen(url) print(f.read())…
-
2
votes3
answers784
viewsA: How to return an object using the object name as a function parameter?
Using obj.bookName you are trying to access the property bookName of obj, that does not exist and therefore returns Undefined. You need to use instead obj[bookName]. Thus, it will try to access the…
-
1
votes2
answers517
viewsA: Fielderror: Relation Fields do not support nested lookups
It seems to me that your problem arises from inheritance among models Tagand Entity. I think, given this model structure, Django derives the following table structure: That is, the legacy among…
-
1
votes1
answer244
viewsA: Array and Mimetext - Python
You need to pass a string as the first Mimetext parameter, not an array. You could concatenate all the strings contained in your array to form a single string, as follows: msg = MIMEText('…
-
18
votes1
answer298
viewsA: How do distributed applications (bitcoin, torrents...) find each other?
In the case of the Bitcoin protocol, specifically, there is no intermediary for a network client to find others to connect to. A Bitcoin client, when starting, will try to use some methods, in…
software-architectureanswered luislhl 928 -
0
votes1
answer4206
viewsA: Error while running npm start
It seems to me that the problem is that you’re trying to give a npm start at home. When rotating a npm start, npm tries to find a package.json file, with the definition of what start should do. What…
-
2
votes2
answers44
viewsA: Show textarea corresponding to href
You have several Ivs with the class ". answers", and are creating an eventListener for all elements with the class ". answers", then whenever you click any of these Ivs, the function will be…
-
1
votes1
answer55
viewsA: Relationship between ORM tables
From the UML all we can know is that it is not a Manytomany relationship, because each query has only one animal, since it keeps the animal ID. The difference between Onetomany and Manytoone occurs…
-
0
votes2
answers842
viewsA: Average per hour Mysql
You can use the AVG aggregation function: SELECT timestamp, AVG(valor) -> FROM tabela -> GROUP BY timestamp; For more details about aggregation functions (in English):…
-
0
votes2
answers140
viewsA: How to Not Accumulate Effects in Hide and Show
The $("body"). click(...) in your code makes no sense, mainly being inside another click. What your code was doing was, every time you clicked the button, you appended a new Vent Handler to the body…
-
3
votes1
answer470
viewsA: Check if subdomain exists with Python 3
You can use the gethostbyname function of the socket library to perform a DNS Lookup. Example: import socket try: ip = socket.gethostbyname('blah.google.com') except socket.gaierror: print('Domínio…
-
1
votes1
answer63
viewsA: How to print a message saying that the searched element was not found in the list? Python 3
You could do everything in a much more succinct way, see: senhas_comuns = ['qwerty', 'password', 'google', 'starwars', 'mrrobot', 'anonymous', 'mypassword', 'minhasenha', 'senha', 'admin', 'abcd',…
-
0
votes2
answers81
viewsA: Pointer returning memory value
I think your problem comes from the fact that you didn’t initialize the numcomp variable of the struct, you should initialize it as 0, as you did with nums. Also, I noticed 2 strange things in your…
-
1
votes1
answer363
viewsA: How to save a hash to a file?
You cannot save Dict(hash) to a file because it is a data structure in memory. You need a way to represent this data structure so that you can write it on disk, this is called serialization. There…
-
1
votes2
answers941
viewsA: How to turn a String list into a Float list?
In Python3, when you use the input function to ask for a user input, it always returns a string. If you want you can turn the string into a float, as follows: vet_nota1 = [0]*2 for k in range(2):…
-
0
votes2
answers1580
viewsA: How to call one javascript inside another?
You can user the library Requirejs. To use it, simply download it and include it in your index.html, replacing Static/js with the folder where your Avascripts are: <script…
javascriptanswered luislhl 928 -
3
votes2
answers323
viewsA: Syntax error in file . py
You can use 2to3 library to automatically convert a python2 code to python3, so you wouldn’t need to downgrade python. It should already be installed with your python. On Linux, simply type the…
-
0
votes2
answers99
viewsA: Problem with CSS Filter in some browsers
According to the website Can I use, the css filter property is only supported in edge, not Internet Explorer. Also, there is an error second line of your file. A 1000% that should be 100%.…
-
3
votes1
answer72
viewsA: How to hide blocks for a route when going to a sub-route
You could have the following template structure: Hbs consultations. queries/index.Hbs consultations/reservations.Hbs In the Hbs consultations. there would be a {{outlet}}. When you were on route…
-
0
votes3
answers396
viewsA: Doubt: dynamic list chained inside another, in C
Apparently there’s an error in your library. Where there is "struct casa" it should be "struct musica". This error occurs in 3 different places.
-
8
votes3
answers7156
viewsA: generate a json file with java
Yes, using the library json-simple, for example: import java.io.FileWriter; import java.io.IOException; import org.json.simple.JSONArray; import org.json.simple.JSONObject; public class JsonExample…
-
3
votes3
answers1664
viewsA: How to Display SQL Query in an Array
You can do it this way: $arr = array(); $sql=mysql_query("select country, count(*) as quantidade from customer group by country"); while ($row = mysql_fetch_array($sql)) { $arr [$row ["country"]] =…