Posts by Murilo Portugal • 2,092 points
82 posts
-
-1
votes5
answers691
viewsA: How to delete a deleted Github repository?
Friend, as seen Github has this security policy of keeping a history of your repository for 90 days before actually deleting. An idea to get around this would be, before deleting, change the name of…
githubanswered Murilo Portugal 2,092 -
0
votes1
answer22
viewsA: Creation of Trigger to help add a field according to an operation
Ayrton, you can make one select into to get the gender in the table ute_utente and then compare on IF whether it is male (M) or female (F). CREATE TRIGGER update_frequencia_emp_generoMasc after…
-
0
votes1
answer122
viewsA: HELP! How to perform Datediff with difference between columns and not current_date?
Friend, you can use the command Datediff() informing the columns you want. For example imagine you have the following table: create table Dados( id int not null primary key, data_ini date default…
firebirdanswered Murilo Portugal 2,092 -
0
votes1
answer35
viewsA: html and mysql special characters
Matthew, this is happening because the character " is being switched to ", this is normal because reserved characters in HTML are replaced by your hml entities. Behold here the complete…
-
1
votes3
answers279
viewsA: use of cursor to update item to item stock
Friend, you can do what you need using a variable that increases. For this you would need, first of all, to change your table and add a primary key (it may be a field id simple. CREATE TABLE…
-
0
votes1
answer573
viewsA: How does an express session work?
Friend, when the user logs into your application a cookie is saved in the client side to identify that this user is logged in. As long as the cookie is valid the application understands that the…
-
0
votes1
answer30
viewsA: How to check two variables
Buddy, it can be done this way: function calculaNota(nota1,nota2) { if(isNaN(nota1) || isNaN(nota2)) { isNaN(nota1) ? console.log('Você digitou ' + nota1 + ' isso não é um numero') :…
-
0
votes2
answers55
viewsA: Create function to make calculations with a given operator using Javascript
Amgio, I believe what you’re looking for is the method eval(), it takes a string, and if it is an expression Eval will calculate the result: eval("1 + 1"); The output of the above command will be 2…
-
0
votes1
answer36
viewsA: Mysql characters
Matthew, put the CHARSET and the COLLATE of your tables (or the entire database) the same as your PHP is using and both are accentuated compatible. For example, in the database your tables should be…
-
1
votes1
answer775
viewsA: How to correctly invoke and use js-hs1?
Friend, by your question we can not be sure if you want to calculate the hash on the front (browser) or back (nodejs), but follows below the two ways: By Navigator You can use the…
-
1
votes1
answer117
viewsA: Mysql query with 3 different criteria within the same table in the DB
Buddy, it can be done using a pivot (turn the rows into columns). If you want the select bring you 3 columns analise, aprovado and reprovado with the summed values, use this select: SELECT…
-
2
votes1
answer400
viewsA: I’m having trouble compiling a java code using Packages on linux
Larissa, as you are compiling in hand, have to take into account some considerations: 1° You write the code in the archives .java, but before creating the JAR executable you must compile the files…
-
1
votes1
answer272
viewsA: Return a JSON Array with shell script to use in PHP
Friend, you can create your entire JSON as a string, and in php you get that string (as you already do with the table) but instead of giving one echo in it you use the method json_decode to cover…
-
1
votes1
answer102
viewsA: Message from "Empty Child" on an Expandable Listview on Android
Friend in your code is almost ready. See, the method that creates the Chield elements is the getChildView, and in it you already check if Chield is non-zero (if it is not empty): if…
-
1
votes2
answers631
viewsA: How to verify the occurrence of a given string and return part of it?
Buddy, if the value rows returned is fixed, you can use the method replace to remove it, thus: var str = ('56 rows returned'); var vNumero = parseInt(str.replace('rows returned','')); The value of…
-
1
votes2
answers473
viewsA: How to automatically populate a table field with a foreign key?
Friend, when you do an Insert in the database, the database returns some data of that insertion, one of them is the ID that has just been inserted, so you can recover the ID that was inserted in the…
-
0
votes1
answer140
viewsA: I can’t seem to instantiate an object
In java you must tell what type of object is being created, so it should be done like this: Aluno aluno = new Aluno(id,nome,endereco,numero,email,matricula);
-
2
votes3
answers651
viewsA: Treat Json return array with CURL
You can do it this way: <?php $lista = array( 3152=>array('codigo'=>3152), 3153=>array('codigo'=>3153), 2448=>array('codigo'=>2448), 3141=>array('codigo'=>3141),…
-
2
votes1
answer97
viewsA: Convert date string to date
You can use the datetime.strptime for this, see the example below: import datetime dataString = 'Aug 29, 2019' dataObj = datahora = datetime.datetime.strptime(dataString,'%b %d, %Y')…
-
1
votes1
answer135
viewsA: Error returning objects saved in database between activites - Null object
Good, on android you can pass data using the parceable or the serializable. With the serializable I believe that the simplest way to do this is to send the whole object, since you are sending all…
-
3
votes2
answers48
viewsA: Insert WHERE into query giving error
Friend, in the select that is shown in your error, in addition to missing the field participante_id you’re putting the condition where in the wrong order, try so: SELECT participantes.name,…
-
1
votes1
answer704
viewsA: Read and write to a file. txt in php without using BD [Solved]
Use the functions fopen and fwrite. <?php $meu_arquivo = 'seuArquivo.txt'; $handle = fopen($meu_arquivo, 'a') or die('Erro ao abrir o arquivo: '.$meu_arquivo); $texto = 'texto 1 ';…
-
0
votes2
answers47
viewsA: Doubt about SELECT command using IN
Friend, you said the content of the Comment table is 11,157,66,158,407, if you meant that when doing select in this table it returns only 1 row with this value, then the problem is this, you are not…
mysqlanswered Murilo Portugal 2,092 -
3
votes1
answer126
viewsA: Select with LIKE operator using an array
Friend, the problem is that you put the handle %s amid %, so python gets lost when replacing. Change your code to: query= "select * from DADOS where CLIENTNAME like %%s%".format(placeholders) Note…
-
3
votes2
answers9026
viewsA: Run Javascript code in VS Code
Friend, by error message you should not have nodejs installed on your machine. Javascript is a language originally created to run on the client side, but with nodejs you can use it as a server-side…
-
0
votes1
answer45
viewsA: How to join a string to a variable of type BYTE path[]
In C you will need to create a char array that is the size of the two strings in order to concatenate. Take a look at this example. #include<stdlib.h> #include<stdio.h>…
canswered Murilo Portugal 2,092 -
0
votes1
answer68
viewsA: Recover URL id without losing any parameters - PHP
The signs of + do not appear because PHP is getting lost when it is time to do the parameters. From what I understand you this "encoding" the special characters manually when forming your URL…
-
1
votes1
answer348
viewsA: Pandas: Subtract dates into grouped indexes in a dataframe
Friend, it can be done by going through the table with the method itertuples() as follows: import pandas as pd df = pd.read_excel('suaPlanilha.xlsx') for row in df.itertuples(): if row.leg % 2 == 0:…
-
2
votes1
answer1643
viewsA: Turning a table column into a list in Python
Patricia is just like you tried to do. See the example below, and if you want to test it you can access here. import pandas as pd dados = {'feature': [1, 2], 'importance': [3, 4]} df =…
-
1
votes1
answer1038
viewsA: Error connecting to bank!
Lucas, in your registration file you need to call the open method. Thus: <?php include "conexao.php"; $mysqli = abrirConexao(); //Aqui o restante da sua classe cadastro. ?> And in your.php…
-
0
votes1
answer37
viewsA: Passing the Parameters of a Fragment that uses json for another Fragment
Luciana, the correct communication between fragments would be done by the parent Activity so that one fragment does not depend on the other, and so you can reuse it without problems. But if in your…
-
6
votes2
answers89
viewsA: Backslashes on the way: do they influence anything?
Just complementing the friend’s reply with a curiosity, since you said you never understood why some systems use the bar \ and others use the / for the same purpose. Well, windows is the only one…
-
2
votes1
answer50
viewsA: Find diff between different arrays
Friend, as your arrays have partially different values you will need to do the comparisons manually, you will not have a python ready method to help you. If the data that are equal between the 2…
-
2
votes1
answer83
viewsA: Helps in date formatting from the database
Friend, if I understand correctly, in your bank the field date is storing the values in the format yyyy-dd-mm, and in addition, for the months between 01 till 09 it does not save the zero, and you…
-
2
votes2
answers613
viewsA: Convert an Arraylist<String> into a String[]
Friend, you are not succeeding because you are not passing the size of the List to your Array, you are creating the Array with size 0. Change your code of: String[] input = list.toArray(new…
-
1
votes1
answer569
viewsA: Example of Callbacks in c
In C the "callback" are not equal to the javascript that are much more imploded, are simply functions that are passed in arguments of other functions using function pointers. Take this example:…
-
1
votes1
answer66
viewsA: Take the values that were changed in the bank and match the new values
Friend, I believe that the best way to do this is by own BD using triggers. For example, let’s suppose you contact the table below: | CONTATO | | id_contato | | telefone | | email | Then you need to…
-
1
votes1
answer36
viewsA: I would like someone to help me with an excerpt of this SQL and Python code
This %s is from the Python String Format, serves for you to format strings, see the example below. name = "Mundo" print("Olá %s!" %name) The output of the command below is: Olá Mundo! The %s is used…
-
1
votes1
answer77
viewsA: Jtextfield left alignment, but he won’t stay left
Friend, this position has no relation with the alignment of the text since its text is bigger than the JTextField, but by the position of the cursor. To display the beginning of the text and not the…
-
1
votes2
answers356
viewsA: Setting parameters and filtering file . TXT
To work with tabulated data you can use the pandas libraries. use the command below to install it, if you do not have. python3 -m pip install --upgrade pandas And as an example: import pandas as pd…
-
0
votes2
answers251
viewsA: Failed to create Node pool connection
Friend, this error that is returning does not explain which error in connection with the BD. This error is displayed when you have an error that is not being handled, so first you should treat this…
-
3
votes1
answer209
viewsA: Error while creating tables simultaneously in sqlite database
Friend, your second table is with wrong script, see: create table imagens( _id integer primary key autoincrement, status varchar(10), imagem varchar(300), FOREIGN KEY(paciente_id) REFERENCES…
-
0
votes1
answer266
viewsA: Socketio com Typescript
Friend, to give this error you must be using XMLHttpRequest.withCredentials as TRUE (generally uses this property as true when you need to send a cookie). To solve your problem you can pass this…
-
1
votes1
answer276
viewsA: Allow requests only for a specific Nodejs route?
Buddy, you can do this two ways: 1° In your application, by checking the source IP of the requests, you can get it with the command request.connection.remoteAddress. Then just put a validation on…
-
1
votes2
answers1039
viewsA: Table in Postgrethe ID field is not auto incremented
Friend, if the id field is autoincrement then you do not need to declare them in your Sert. For example, imagine you have a fruit table: CREATE TABLE frutas( id SERIAL PRIMARY KEY, nome VARCHAR NOT…
-
1
votes2
answers180
viewsA: Error sending push notification with Firebase-messaging
Friend, Google Cloude Messaging (GCM) has been deprecated, in place google advises to use Cloud Messaging with Firebase. See the documentation of GCM. And how to use the Firebase Cloud Messaging.…
-
16
votes4
answers9952
viewsA: Error: Another git process seems to be running in this Repository
This error happens because inside the directory .git there is a file called index.lock, after deleting this file you will be able to run git commands. But after all, what is index.lock.? The…
-
0
votes1
answer37
viewsA: .NET CORE | How to handle fields that cannot be changed (Disabled or Readonly)
Friend, really disabled inputs are not sent by Submit. One solution would be for you to create a <input type="hidden"> same as disabled, this in turn will be hidden from the user and can be…
-
2
votes2
answers131
viewsA: Change link name with jQuery
Friend, you can put an id on the link and change the text property. Below is an example: <!DOCTYPE html> <html lang="en"> <head> <script…
jqueryanswered Murilo Portugal 2,092 -
0
votes1
answer253
viewsA: Save a list to Sqlite
Friend, I did not understand right if your doubt is to do any manipulation (select, Insert and update) in the android database (sqlite) or if you know how to do this but only this with problem…