Posts by Woss • 73,416 points
1,476 posts
-
4
votes2
answers1825
views -
2
votes1
answer144
viewsA: Error to access parent class method
First, indentation is all in Python code. Wrong whitespace and your code will not work: it will give error or generate some unexpected result. In class Funcionario you start using an indentation of…
-
1
votes2
answers64
viewsA: php site returns >
Your code is wrong on the line: <input type="hidden" name="advogado" id="acao" value="<?php echo $_SERVER['PHP_SELF']."?login=$_SESSION['_codigo_usuario']"; ?>"> See (not) working on…
-
2
votes3
answers322
viewsA: How to know the names of the array positions in php?
If you ever walk the array, you can get the key directly with the foreach: foreach($_POST as $key => $value) { echo $key; } See working on Ideone. Obviously this way is only efficient if you need…
-
2
votes4
answers318
viewsA: How to get the last segment of the path?
The simplest solution is using PHP, as presented in other answers, but if you only want the regular expression to use next to the file .htaccess, see the solution below. To answer this, we first…
-
2
votes1
answer163
viewsA: Justify contents of a variable
It’s by CSS, just like you tried to do in the first example, but it’s just justify, nay justifictify. Take an example: p { text-align: justify; } <p>Lorem ipsum dolor sit amet, consectetur…
-
0
votes1
answer79
viewsA: How to clean up Google Blockly?
As I commented, just use the Worspace.clear. The object of workspace you already have in Javascript, just call the method clear by pressing the button. See: var workspace =…
-
2
votes1
answer241
viewsA: Kill and reply JSON with PHP
A little confused, but I believe it would be something like: //Dentro do loop para desconcatenar { $arr[$key][$label] = utf8_encode(\vidbModel\validate::get($value,$validation));…
-
8
votes1
answer3547
viewsA: What does vendor mean?
In fact, the directory vendor is related to applications developed by third parties that compose the requirements of their application. What is a 3rd Party and its importance for the development of…
-
15
votes2
answers2129
viewsA: What does the "|=" operator mean in Python?
Just like the operator += increments the value of a variable, something like x +=y be equivalent to x = x + y, the operator |= executes the or binary between the current value and the other…
-
2
votes4
answers94
viewsA: Putting elements in lists
Breaking the content of the text in the white space does not seem to be a good solution, since there may be names of fruits and colors that have spaces, as for example fruta do conde [rosa choque]…
-
2
votes1
answer148
views -
2
votes2
answers215
viewsA: Gather background information that is in different arrays in the same array
To create a array as explained, just use the function array_map passing the first parameter as NULL, so it will be returned one array with the combinations of arrays input. For example: $tempero =…
-
1
votes1
answer4482
viewsA: Internal search with HTML
Usually such an application has a very well defined database structure, with relationships between tables, if necessary, and a server-side programming language controlling everything. If your…
-
2
votes1
answer55
viewsA: Identify repeated indices and exchange only one of them
A simple way is to go through all the values in a, check whether the current value belongs to the list b, which will be the output, and as long as it belongs, draw a new number between 1 and 11,…
-
1
votes2
answers76
viewsA: Auto insert string text
First, the objects that will be responsible for manipulating the DOM and the word list: const form = document.getElementById("procurar-form"); const input = form.getElementsByTagName("input")[0];…
javascriptanswered Woss 73,416 -
1
votes2
answers346
viewsA: Main differences between structuring CSS with PHP and LESS/SASS
The difference is that tools like Less/Sass provide all these features of generating a dynamic CSS very close to CSS vanilla. The syntax of a Less file can easily be written and understood by a CSS…
-
1
votes1
answer231
viewsA: Optimize the CSS view
Google believes the page will perform better when considering load time when the entire CSS responsible for styling the region above the fold is embedded in HTML via tag style; this because such CSS…
-
5
votes3
answers8998
viewsA: How to call, in Python, a function whose name is stored in a variable?
Because there are 99 distinct defined functions that will be executed randomly, I believe that the problem has been poorly developed and that this is probably not the best solution for it. However,…
-
2
votes2
answers249
viewsA: Input elements outside the tag form
It depends on what you are considering as "HTML code validation". If it is the result of HTML validation tools that can be found over the internet, including W3C, yes, there is a possibility that…
-
1
votes1
answer100
viewsA: Parameter in page URL
Given the content of this page, just set the parameter in the URL between keys, such as {parametro} and use it through request.matchdict. Take an example: @view_config(route_name='quotes_number')…
-
4
votes3
answers1616
viewsA: How to create a button inside an iframe to close it
If the function of the button is just to hide the iframe, I don’t see why you insert it into it; you can create the button on your page and just position it on the iframe, in the desired position.…
-
2
votes2
answers326
viewsA: Force require on display:None
I believe the goal is to interact radio along with the image that is displayed, making the image have the behavior of radio. If it is, you can, instead of defining display: none, removing the DOM…
-
1
votes1
answer16467
viewsA: Error: 'int' Object is not subscriptable
As I commented, the error is given in this line because you did: [i[j]]. With this code, you are accessing the position j of the variable i; as i is a variable of the type int, cannot do this,…
-
1
votes1
answer125
viewsA: Semantic-ui, action-free checkbox in the form
Your HTML is not structured according to library specifications. You cannot place multiple elements radio within a single div.ui.radio.checkbox. This div should contain only one form field. See an…
-
10
votes3
answers835
viewsA: How to go through an array skipping some indices?
Yes, there is. Just use continue. In this case, how do you want to interact with the loop external, you must specify a label and use it next to the continue. The label may be specified with an…
-
0
votes1
answer103
viewsA: PHP: Interface type attribute
Yes, this is wrong. It makes no sense for you to define the type of an attribute in a dynamic typing language. This is only possible in static typing languages, such as Java, which has been cited.…
-
3
votes1
answer1434
viewsA: Access object inside object (Sdtclass - Codeigniter)
Just look at the types of each value. That is, the return of: $objeto_decode = json_decode($objeto); It will be an object, so to access the attribute contratos, just do $objeto_decode->contratos.…
-
7
votes2
answers119
viewsA: What is the difference between # and #! in HTML 5?
We can call it a hack to create an element clickable without generating undesirable side effects. In this case, if you press the link 1, defining href="#", you will be moved to the top of the page;…
-
3
votes2
answers488
viewsA: Select values of a <td> with click
The problem is that you are setting the attribute id an element that repeats on the page. The attribute id must be unique and represent only one element. For example, the HTML generated by your PHP…
-
1
votes1
answer30
viewsA: Calculation of event latency load with window object.performance
According to W3C recommendations about the object PerformanceTiming represented by window.performance.timing: connectStart attribute This attribute must Return the time immediately before the user…
javascriptanswered Woss 73,416 -
1
votes1
answer148
viewsA: Tuples: index out of range - recursion
I can’t say exactly what’s wrong, because I just couldn’t understand the logic that you implemented. If you edit the question and comment on your code, it might ease the process. Anyway, the…
-
2
votes2
answers276
viewsA: PHP mkdir folders with the same name
Just as Rafael quoted in his reply, you just have to always check the existence of the directory before creating it. Assuming there are numerous directories with the same name, we can create a…
-
3
votes2
answers3283
viewsA: Pass whole javascript variable to php
Communication between Javascript and PHP I tried in the comments, but I saw that it would extend too much and I decided to answer. The code you made does not work because doesn’t make sense. To only…
-
0
votes1
answer613
viewsA: Read contents of multiple. txt’s files from a given folder
For commenting, you want to pick up only the lines that contain the values of _twitter_sess, ct0 and auth_token. You can store these values in a list: $tokens = ['_twitter_sess', 'ct0',…
-
4
votes1
answer649
viewsA: Open multiple files with "with open"
It is possible, yes, from version 2.7 of Python. See: What’s with no Python for? The syntax for various expressions in with is to separate them with a comma: with EXPR1 as VAR1, EXPR2 as VAR2: BLOCK…
-
3
votes1
answer83
viewsA: Make getopt ignore first argument
I don’t know if it satisfies your needs, but there is a library docopt for PHP. With it, all you have to do is write the documentation of your commands and the library will handle the entries,…
-
6
votes2
answers6727
viewsA: Day of the week by php variable
Alternatively, you can use the function strftime, since the locale is properly configured. See an example: <?php if (setlocale(LC_TIME, 'pt')) { echo strftime("%A, %e de %B de %Y",…
-
8
votes3
answers10675
viewsA: What are Path Parameters in a URI?
What are the path Parameters of a URI and its function? It is first necessary to understand the concept of segments of path. Segments of path are parts that make up the value of path of a URI,…
-
1
votes1
answer477
viewsA: How to order a dictionary with a key
First, a reading that will possibly be interesting: What is the difference between ordered, unordered and Sorted? It doesn’t make much sense that you want to order a dictionary, because the…
-
28
votes1
answer1203
viewsQ: What is an opaque value?
Sometimes I see in documentation or specifications that a certain value, in general, string, can, or should, be considered opaque. What does this really mean? What are the characteristics that…
-
3
votes3
answers554
viewsA: Extract Array Data in Javascript
This is a new technology, part of the Ecmascript 2015 (ES6) standard. As a matter of curiosity, using generators is also possible to do basically following its logic. See an example: function*…
-
8
votes2
answers12373
viewsA: "perfect" square root in python and identify the rest:
Just use the mathematical operators // to get the entire division and % to get the rest of the division. See the example: import math value = 87 sqrt = math.sqrt(value) # 9.327379053088816 div =…
-
6
votes6
answers7088
viewsA: Intersection between two sets (element that is in set A and B at the same time)
The problem with your code is the condition inside the list constructor: inter = [x for x in range(1,12) if x in conjuntoA and conjuntoB] You are going through all values from 1 to 11 and checking…
-
3
votes5
answers676
viewsA: Individual methods or parameters in Mysql queries?
There is difference in execution from one to another? Yes, but it depends on many factors, at least when considering the response time. If you are having problems with performance in your…
-
3
votes1
answer1258
viewsA: Read a list of lists in txt python 3
It’s up to you serialize your object before saving it to file. In Python, there is the native library pickle that you can use: Saving the object in file To save the object in file, just use the…
-
48
votes8
answers4052
viewsA: How to generate 200,000 primes as fast as possible in Python?
With the very Sieve of Eratosthenes I achieved very satisfactory results. It is worth remembering that, as the sieve returns the list of all primes smaller than the input value, we will have to…
-
0
votes1
answer121
viewsA: Using connection obj in another class
Nor will I go into too much detail about the real need to use class or to inject dependency into the defined class to properly construct the scope that will be used, because it probably wouldn’t…
-
2
votes1
answer32
viewsA: How to create a command that sums using latex
To control page numbering, simply set the value of the respective counter. In Latex, just use it at the beginning of the file to set the counter to start at 20: \setcounter{page}{20} Thus, the first…
-
1
votes2
answers130
viewsA: Why can’t all if have Isis?
There are some additional complicators in the matter of "reading" a button that will interfere with the outcome, especially the deboucing to eliminate mechanical noises from the button, but I will…