Posts by rodorgas • 2,880 points
78 posts
-
3
votes1
answer83
viewsA: Why is it hard to name things?
Computation is sometimes about modeling reality, which is extremely complex, in an algorithm, which in the background is arithmetic operations with control flow. Converting reality to code is a…
-
1
votes1
answer1126
viewsA: Unicode Error: 'utf-8' codec can’t Decode byte when installing rpy2 with Pip
I believe it’s about an encoding error for Pip 9.0.1, which has already been fixed and will be available on Pip 10. To not have to wait for Pip 10, you can install the development version with: pip…
-
1
votes2
answers602
viewsA: Object orientation in python
Yes, these lines are called when the class SeaofBTCapp is instantiated. self refers to the instance. As is traditional in OOP, instances have different values for the same attributes, so it is…
-
1
votes2
answers1756
viewsA: How can I automatically execute a script when creating a container?
You can do this using the command ENTRYPOINT. With it, you specify a command to execute when the container starts, so you don’t always need to specify the command on the command line as suggested in…
-
1
votes1
answer336
viewsA: Listen to messages with multiple customers(pub/sub)
The Centrifuge is a pubsub server, it "creates channels" in websocket (actually it’s an abstraction layer, it takes care of unique users and allows you to group them into channels). This without…
-
1
votes1
answer106
viewsA: Starting at Lisp
As in any language, all you need to start with is an editor and a compiler/integer (could be the clisp). For example, create a file and save with the name meu_programa.lisp, with the content: ;…
-
0
votes1
answer109
viewsA: Identify the name of the streets contained in a polygon
I believe the API does not have a method that returns addresses on a polygon. Has the containsLocation that checks if the coordinate is inside the polygon. If your intention is to extract the…
-
0
votes1
answer81
viewsA: What is the indication of using Redis with Iots?
Redis has I/O faster because it gets everything in memory, but because of this it is not suitable if you need to persist this data (but there are ways to write to disk). Usually it is not necessary…
-
5
votes1
answer2325
viewsA: Explanation about sub pub(redis)
The data stays in the server memory, eventually stored on disk according to the redis settings. When a customer receives the data, it stays in the customer’s memory until you do something with that…
-
2
votes1
answer90
viewsA: 1st becomes 1 u00aa when I enter into json
Normal. PHP uses the format \u quatro-dígitos-hex to escape special characters (non-ASCII). This is valid JSON, see json.org If you really want to avoid escape, you can use the option…
-
0
votes1
answer227
viewsA: Fire automated e-mail at a certain time with java
There are task scheduling frameworks, however to just run a daily script you can use much simpler solutions. The operating systems have a task scheduler: in linux has the cron, in windows has the…
-
9
votes3
answers726
viewsA: Why does Google recommend inline CSS?
It is not recommended to insert CSS inline indistinctly, but in a specific case: when the stylesheet is small. It’s true that the page is unstructured if you leave the CSS pro end, but if the CSS is…
-
6
votes3
answers5803
viewsA: Draw numbers without repeating in javascript
Just check if the number is in the array before adding it. You need to change the for by a while, since it is not possible to know exactly how many iterations it will take to generate 16 different…
javascriptanswered rodorgas 2,880 -
0
votes1
answer35
views -
1
votes1
answer876
viewsA: Is it possible to pass the value of a Javascript variable to a C#variable?
To pass Javascript values to Asp.net, a new request (e.g. using AJAX) is required. It is not possible to check the resolution before making the request because JS in this case is client-side, while…
-
0
votes2
answers138
viewsQ: Download multiple Curl pages at the same address without overwriting
I need to download this page several times, it returns a different result each time it is accessed: i="0" while [ $i -lt 10 ]; do curl -O http://httpbin.org/bytes/128 i=$[$i+1] done But each time…
-
0
votes1
answer934
viewsA: Pass select value to javascript
That part is wrong: window.onload = function exibir($pegavalor){ You are setting the function exibir to be executed on Event onload, which is in the page load. However, the function exibir shall be…
-
0
votes4
answers424
viewsA: Request with ajax
The problem with your approach is that the web server (e.g. Apache) or gateway (e.g. php-fpm) will kill this process due to timeout (timeout), which is by default set in less than 5 minutes. You…
-
3
votes2
answers1820
viewsA: How to configure multiple Nginx on a server?
Just add two directives server. Nginx will be able to differentiate by domain who should process the request. An example configuration would be: server { listen 80; server_name example.org…
-
1
votes1
answer42
viewsA: Where do the ip addr add ips go?
This command sets in real time an address on the specified network card, for example: ip addr add 192.168.50.5 dev eth1 This setting is not saved in any file: after system reboot, it will be lost.…
-
0
votes2
answers110
viewsA: Send process to server and release user
You can use the Celery to do this. It is an asynchronous job queue library based on distributed message passing. It is focused on real-time operations, but supports scheduling as well. Celery is…
-
1
votes1
answer159
viewsA: Mask for hour 24:00
According to the ISO 8601, which is an international standard for date and time representation, the two representations are correct: 24:00 and 00:00. But the W3C defines that the element…
-
0
votes2
answers1638
viewsA: How to test if a host port is open?
Using socket: import socket def test_port(ip, port): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) result = sock.connect_ex((ip, port)) sock.close() if result == 0: return True else:…
-
4
votes2
answers3456
viewsA: How to create Android apps on weak PC?
Try the Intellij IDEA, it features a layout editor as well: https://www.jetbrains.com/help/idea/2016.2/designer-tool-window.html…
-
-1
votes2
answers1638
viewsQ: How to test if a host port is open?
How to find out if a particular port of a network computer is open? The more efficient the method, the better. I will need to scan an entire subnet several times a day.
-
8
votes2
answers5134
viewsA: What makes Join() so superior compared to other concatenation techniques?
Article: Efficient String Concatenation Method 1 (concatenation) def method1(): out_str = '' for num in xrange(loop_count): out_str += `num` return out_str Method 4 (Join) def method4(): str_list =…
-
2
votes2
answers140
viewsA: Classification system
Create a variable $i out of the loop by storing how many times the block was iterated (repeated). At each iteration, you add a unit to that variable: <?php include("./configs/dados.php");…
-
14
votes1
answer4323
viewsA: What is the purpose of the JSON column in MYSQL?
There are many advantages to the countryside JSON in relation to the TEXT: Validation - Data is automatically validated. If JSON is invalid, the record will not be inserted and the operation will…
-
3
votes2
answers437
viewsA: Hide error messages
Use the &>, that in addition to redirecting the standard output (stdout), redirects errors as well (stderr): ping 8.asd.8.8 -c1 -q &> /dev/null…
-
10
votes2
answers2428
viewsA: Can I market software that uses a GPL license?
If you distribute your application and have used something GPL as part of your application (even if it is just a library), and even if you do not charge money, you should make the source code of…
-
2
votes1
answer2466
viewsA: Create . bat file to open Node.js terminal and run one or more commands
Just create a file iniciar_projeto.bat with something like: cd C:\Users\Alan\Documentos\Seu_Projeto\ npm run babel The first command must obviously be changed to the path of your project. This is…
-
2
votes1
answer804
viewsA: How to create Debian startup script by modifying environment variables
Due to bugged drivers or hardware, the monitor resolution can be detected incorrectly. For example, the EDID data block provided by your monitor may be incorrect or an outdated version of KDE or…
-
3
votes1
answer98
viewsA: Create a new function with scrapy
There is a problem in the indentation of your file. The two functions are outside the class (as Python does not have { }, is the indentation that defines the code blocks). The file carros_spider.py…
-
0
votes1
answer127
viewsA: Is it possible to develop pro Safari extensions using Windows or Linux?
Today we develop through the Extension Builder within Safari itself. A Mac and an account are required on Developer Program which costs 99 dollars a year. This means that it is not possible to…
-
5
votes1
answer1393
viewsA: Is there a Google API to capture the featured search information?
This painting is called Knowledge Graph and you can find the documentation here. For example, when making this request (you will need to enter your API key):…
-
1
votes1
answer89
viewsA: Is there any way to know if someone is referencing some file from my site in another?
It is possible to know who made the request through the header Referer of HTTP. This is usually stored in a log file access.log, but it depends on the configuration and which server you are using.…
-
1
votes1
answer44
viewsA: Regex to add a hierarchy level to all CSS rules
The Pattern you are looking for is (.+) { Replace with .minhaClasse \1 {
-
3
votes1
answer156
viewsA: Error sending Ajax data to PHP script
In function $.ajax([settings]) the parameter settings accepts this key success, but its value must be a function, as documented. You specified a call to a function, which does not return a function…
-
5
votes2
answers385
viewsA: Pagination effect
There are many ways to do this, the most convenient way depends on your environment. This is usually done server-side, but as you tagged javascript and css I will present a way to do with these…
-
1
votes1
answer542
viewsA: How to take the value of a Curl and play to another Curl
Extract the data with regex and then assemble the second URL with the POST parameters based on these data: <?php // Primeiro CURL, obtém dados de login $output = curl_exec($curl); $obj =…
-
0
votes1
answer113
viewsA: How to do software versioning based on Microsoft recommendations?
Versioning is project specific, is defined by the team. It depends on the development objectives and methodology (the methodology influences the cycles, if the project has cycles). These things are…
-
1
votes1
answer227
viewsA: Wait Servlet finish action, and update screen with js
It is necessary to define a function to handle the event XMLHttpRequest.onreadystatechange. This event is triggered whenever the order status is changed. To do something when the request ends…
-
1
votes2
answers769
viewsA: Double quotes in the URL
Apparently the values are already coming in double quotes, which is weird. The ideal would be to investigate it, but if you want to just treat it the way it came, you can do it this way: <?php…
-
3
votes3
answers317
viewsA: How to delete whitespace around a given character?
I recommend using str_replace because of the performance. Just out of curiosity, this is what you would do if you were to use preg_replace: $txt = "Compras / Vendas"; echo preg_replace("# / #g", "",…
-
4
votes3
answers553
viewsA: Nth-Child does not work
Let’s understand what happens here .intro-frases h1:nth-child(4) { color: red; font-weight: 600; } The selector :nth-child means "select the element that": Be an element h1 Be the fourth Child of a…
-
0
votes1
answer59
viewsA: Jquery.Validate
At startup, set a selector for the ignored fields. For example, so that the plugin ignores all the elements it has class="ignore" do so: $('#aspnetForm').validate({ ... ignore: ".ignore", ... });…
-
1
votes2
answers2476
viewsA: Add event in Fullcalendar dynamically
Use the method renderEvent: $('#calendario').fullCalendar( 'renderEvent', { title: 'Novo evento', start: '2016-03-31', } ); How to use dates in dd/mm/yyyy format? Natively, Fullcalendar only…
-
1
votes1
answer265
viewsA: Create email accounts using Postfix to send on Woocommerce
I found it easier to use the Swiftmailer to send emails. I use this code in production: $text = 'Olá Fulano'; $html = "<html>Olá <strong>Fulano de Tal</strong></html>";…
-
5
votes3
answers9575
viewsA: Allow only letters, numbers and hyphen
You can use regular expressions. The function preg_match returns 1 if the string is valid, zero if not valid and FALSE if an error occurs. To validate accented letters, numbers and hyphens:…
-
3
votes1
answer1838
viewsA: Compare Coordinates
To check if a point belongs to a polygon, you can use this algorithm: class pointLocation { var $pointOnVertex = true; // Check if the point sits exactly on one of the vertices? function…