Posts by Iron Man • 768 points
43 posts
-
-1
votes3
answers691
viewsA: Python 3.6 regular expression for inteitra phrase extraction
Using regex to HTML formatted this way, you can do so: regex = r'(?<=<a…
-
2
votes2
answers566
viewsA: How to implement operator overload << and >> in C++?
In the function header: ostream &operator>>(ostream& saida, const MeuInt& meuint) Try to change operator >> for <<, for this is what is used in output operations. The…
-
3
votes1
answer102
viewsA: Call to a Member Function mysqli_fetch_object() on a non-object
Your problem is why you are calling the function: mysqli_fecth_object(), with a parameter that should be passed to the function: mysqli_query(). for example in function getArtigos(), is like this:…
-
0
votes2
answers414
viewsA: Motion Animation in a Box
You can use Animations of the CSS, for example: @keyframes help{ 0%{ transform: rotateZ(0deg); } 10%{ transform: rotateZ(10deg); } 15%{ transform: rotateZ(15deg); } 20%{ transform: rotateZ(20deg); }…
-
1
votes3
answers1209
viewsA: Extract numbers from a list using Regex
For lists this way you can do so: lista = [u'1', u'2', u'5', u'3', u'9', u'1'] result = [x for x in lista if re.match(r"\d+", x) ]
-
0
votes1
answer94
views -
4
votes2
answers567
viewsA: Constructor with a String and a String array is not working
You are passing the ingredients as simple objects not as array. Do it that way: //você cria o array de Strings String[] ingredientes = {"molho de tomate", "mussarela", "presunto", "tomate",…
-
0
votes1
answer69
viewsA: How to have boolean results from the interaction of two lists?
You can iterate this way: for x in a: print(x in b) Or so: for x in a: if x in b: print(x) # ou print(x in b) If you want to store items that are common among lists, in a new list do so: c =…
python-3.xanswered Iron Man 768 -
2
votes2
answers823
viewsA: Swap Long for Biginteger or Bigdecimal?
In this example, replace the variable res by a BigInteger, thus: BigInteger num = BigInteger.ONE; And in the loop for do so: for(fat=1;fat<=100000;fat++){ num =…
-
2
votes1
answer131
viewsA: Output of largest matrix value exiting incorrect
Your first problem is that you are declaring the matrix before setting its size. Declare it after setting the values of n and m, int matriz[n][m]. Your second problem is in the for loop you add the…
-
0
votes1
answer108
viewsA: Error while trying to change column widths from Tableview
Try to include the method setPrefWidth(tabela * valor), within the method redefineColunas(double tabela), to set the preferred column width.
-
7
votes3
answers13930
viewsA: Change color of an image by hovering the mouse over it
You can use the filter of CSS3 example: <img src = "image_path" class="image"> And in CSS do so: .image{ -webkit-filter:grayscale(100%); } .image:hover{ -webkit-filter:grayscale(0%);…
-
1
votes4
answers485
viewsA: How to determine the index of items in one list in another
You can do it like this: for name in S_names: for x in other: if name == x: Result.append(other.index(x))
-
1
votes2
answers35
viewsA: List the answers according to the number of questions
Try it like this: for($contar = 1; $contar <= 10; $contar++){ echo" Pergunta $contar "; for($i = 1; $i < count($array); $i++){ echo"$array[$i]:<input type='radio' name='respostas[]'…
-
0
votes2
answers77
viewsA: Div does not line up with the text
An alternative is to use the column-count or column-width in id sobre, and remove the margin of p.title and also the float Example: #sobre { /* seu estilo aqui */ -webkit-column-count:2; } p.title{…
-
1
votes2
answers247
viewsA: Image upload using CGI Python - Doesn’t work!
You must open, read and write the file in binary mode this way: f = open(file, mode = 'rb') #'rb' para ler arquivos binários f2 = open(upload_dir + file, 'wb') #'wb' para gravar arquivos binários…
-
1
votes2
answers677
viewsA: Dictionary for list of dictionaries
To get the list of dictionaries do so: dict_1 = {'Eva': [4], 'Ana': [53], 'Ada': [12]} lista_dict = [{'Media de Idade':idade.pop(), 'Nome do Dono':nome} for nome, idade in dict_1.items()]…
-
2
votes4
answers16229
viewsA: How to add entries to a dictionary?
For this example you are showing: 1 abcde 2 adecd 3 aaabb As if the user entered the values separated that way you can do so: user_input = input('1 abcde')# simulando a entrada do usuário user_input…
-
1
votes2
answers556
viewsA: Javafx Enter by TAB
You can do it like this: textfield1.setOnKeyPressed( (keyEvent) -> { if(keyEvent.getCode() == KeyCode.ENTER) textfield2.requestFocus(); } );
-
1
votes1
answer899
viewsA: Filter using stream with Class Lists that contain lists of other classes
An example of Stream: List<PontoDeParada> pontos = new ArrayList<>(); If you want to receive the result of the filtering in a Stream do so: Stream<PontoDeParada> stream =…
-
3
votes1
answer436
viewsA: How to use external CSS in a Javafx application?
Use the class instance Scene, example: Scene cena = new Scene(Parent); cena.getStylesheets().add(getClass().getResource("Caminho_Para_O_Arquivo")); If it doesn’t work out, try it this way:…
-
3
votes1
answer218
viewsA: Formatting values in the millions
You can use the class NumberFormat, to format. Example: double num = 12345678.90; Locale ptBr = new Locale("pt", "BR"); //define a região NumberFormat moeda = NumberFormat.getCurrencyInstance(ptBr);…
-
0
votes3
answers115
viewsA: Multidimensional array
Do it like this: for a in range(len(Test)): Tsup = [ [Test[i] for i in range(l)] for j in range(x) ] or just like that: Tsup = [ [Test[i] for i in range(l)] for j in range(x) ]…
-
0
votes1
answer118
viewsA: Insert into does not return
Your problem seems to be in the part $ins->bindParam(":a_areaid",$a_areaid);. Put the parameter PDO::PARAM_INT, after the $a_areaid in that way:…
-
2
votes4
answers1429
viewsA: How to search for results in Mysql where a given field only has special characters?
Try it like this: SELECT * FROM Table_Name WHERE nome REGEXP ^[^a-z0-9]+$ removed the A-Z, because you only need to use the operator BINARY to be case sensitive. this link:…
-
1
votes3
answers138
viewsA: How to declare variables in for in c?
although the question is not very detailed you can do so: for(int i = 0; i < 10; i++) /* seu código aqui*/ or so if the variable is within the loop: int i; for(i = 0; i < 10; i++){ int j = 2;…
-
0
votes1
answer190
viewsA: Cell Field Mask and Validation
Change the attribute maxlenght to 9 and use this function in the onblur. function validarTel() { var tel = document.getElementById('txtTelCel').value; var pattern = /^\d{4}-\d{4}$/;…
javascriptanswered Iron Man 768 -
0
votes5
answers737
viewsA: How to save data from a changed grid?
With the UPDATE, is faster because the data is being rewritten on existing lines. With the DELETE you would have to delete and then insert again and it takes more time, lines of code and…
-
2
votes2
answers12681
viewsA: How to resolve accentuation problems when using the setlocale function?
In function setLocale put as second parameter the string "" (double quotes), this may solve because that way the location is configured according to the OS location. example: setLocale(LC_ALL,"");…
-
1
votes3
answers175
viewsA: Why is my Array item not changed in foreach?
If courses are an Arraylist try so: public boolean changeCurso(String cursoModificar, String cursoNovo) { for(String curso : cursos) { if (curso.equals(cursoModificar)) { int index =…
-
0
votes1
answer465
viewsA: How to run a video on Android Chrome?
Remove the attribute type tag source and implement play via Javascript. var player = document.getElementById("bgVideo"); function playVideo() { player.play(); } put this function in body onload =…
-
2
votes3
answers4285
viewsA: Use of colon character ":" in Python
The operator : is also used in the construction of dictionaries or Dictionary. Dictionaries use the concept of hash tables, in which each value has a key that can be a String, a tuple, or anything…
-
0
votes1
answer461
viewsA: Textfield Javafx catching the event
Try it that way: textFieldC1.setOnAction( (ActionEvent e)-> { if(textFieldC1.getText().equals("50")) { slider1.setValue(Double.valueOf(textFieldC1.getText())) } });…
-
1
votes2
answers762
viewsA: Send email with PHP
Your problem seems to be because you have not configured php.ini. search the archive for [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 In SMTP = you indicate the SMTP server you…
-
0
votes2
answers92
viewsA: Find the first line in the matrix with all positive elements, and the sum of these elements. Reduce all elements to that sum
That solves? sum = 0; pos = False; for i in range(len(matrix)): for j in range(len(matrix[i])): if matrix[i][j] > 0: pos = True; sum+=matrix[i][j]; else pos = False; sum = 0; break; if pos:…
-
1
votes2
answers775
viewsA: Generate random numbers
To generate random numbers use the method rand, it generates a decimal number from 0.0 to 1.0 if used without arguments. To use with integers pass an integer parameter this way: rand NUM_INT This…
-
6
votes2
answers1164
viewsA: What are the differences between the "vw", "em" and "%" font sizes?
The unity vw uses the width of the viewport or browser as a measurement base, 1vw being equivalent to 1/100 of the width of the browser. For example if the width of the browser is 900px, 1vw is…
-
1
votes4
answers1365
viewsA: Find out the type of variable in ruby on Rails
To find out the type of the variable use the method kind_of?, because it returns a boolean value. use that way: variável.kind_of? tipo Example to find out if "x" is integer type: x.kind_of?Integer…
-
3
votes2
answers4260
viewsA: Update page after sending the form
after the data insert use the PHP header function. header('Location:url_da_pagina'), to be redirected to the page.
-
0
votes4
answers959
views -
1
votes2
answers111
viewsA: How to reuse data in a class without having to repeat this data?
so that the values are constant declare as, const NOME_DA_CONSTANTE without the dollar sign. to use inside the methods call the variable this way::NOME_DA_CONSTANTE is not mandatory but is…
-
2
votes1
answer45
viewsA: Is there an Aot compiler for Java?
There is this "https://gcc.gnu.org/java/" but it is very limited.
-
1
votes2
answers1465
viewsA: How to make source responsive?
You can use the unit of measure "rem", it uses as a basis the root source of the page or html tag which is always 16px. this avoids having to do calculations with different contexts.