Posts by Zulian • 1,827 points
52 posts
-
1
votes1
answer40
viewsA: Return single message after 5 repetitions of command
One of the ways is to create a variable to store the names that are valid or not valid through your method ChecaUser and then just show on MsgBox that variable. Ex: Dim UserName Dim UserPass Dim…
-
3
votes3
answers277
viewsA: Using regular expressions with square brackets
Try this (remove spaces before or after square brackets): $string = "[Texto entre colchetes] Texto fora do colchetes"; $String = preg_replace("\s*\[.*?\]\s*",'',$string); echo $string; \s removes…
-
2
votes1
answer183
viewsA: Quicksort vs Radix-Sort
The Quicksort is more pliable and works well with all kinds of data, all you need to sort is the possibility to compare items. It is trivial with numbers, but can be used with other data types as…
-
2
votes1
answer605
viewsA: How to query select and call the connection from within
One of the best ways is to make your class Conexaodb method return a Connection using a static method. Ex.: public static Connection conectaBD(){ try { Class.forName(driverDB); conexao =…
-
0
votes1
answer40
viewsA: Bug transition Jquery slides
I managed to solve it very simply, I just added a variable boolean control that checks whether the operation is active or not. Ex: $(function(){ var slides = $('.slide-vinho'); var count = 0; var…
-
0
votes1
answer40
viewsQ: Bug transition Jquery slides
I’m venturing into the front-end and I’m having a problem with multiple clicks in a row on the side arrows of the "slide" that I created, where if the user waits a second or so to move on to the…
-
2
votes1
answer126
viewsA: Fixed background, no resizing on keyboard
For the keyboard not to modify its layout, use the following flag in your file Manifest.xml: <activity android:windowSoftInputMode="adjustPan"> adjustPan - The main window of the activity is…
-
1
votes1
answer683
viewsA: Orientation - Handling hours and minutes Java + Postgres
I strongly recommend using the library Jodatime to manipulate dates, times, time zones, etc in Java, since the native classes (Date, Calendar), although they are better, they are neither practical…
-
0
votes1
answer220
viewsA: Capture field of a complex JSON
I believe the simplest way using JSONArray that’s how it is: JSONArray jsonRates = new JSONObject(jsonString) .getJSONObject("query") .getJSONObject("results") .getJSONArray("cidades");…
-
2
votes1
answer807
viewsA: Manipulating a JSON with the GSON library
Since you have professions and locations in your JSON, you need to have these classes with these same attributes in order to transform this JSON into a manipulable object. The basic structure in…
-
2
votes4
answers3003
viewsA: Allow uppercase letters only in Edittext
The android has a InputFilter for this, as you can see in the official documentation. With this simply set the filter through the method setFilters() of your EditText. Ex: editText.setFilters(new…
-
12
votes2
answers3224
viewsA: What is the Rust programming language?
Rust is a programming language focused primarily on: Security without garbage collector. Competition without data dispute. Abstraction without overhead. Its design enables the creation of programs…
-
3
votes1
answer52
viewsA: Fix writing on txt
Add the Boolean true to the builder of PrintStream. Ex: public class TestandoEscrita { public static void main(String[] args) throws FileNotFoundException { PrintStream out = new…
-
0
votes0
answers55
viewsQ: What is the correct/user friendly way to perform this operation?
Usually in desktop/web applications, we have a field código where is inserted the code of something and next another field that shows the description of this "something" after the search in the…
-
2
votes1
answer60
viewsA: Options menu with setOnItemClickListener
Create a Alertdialog. Ex: AlertDialog.Builder builder = new AlertDialog.Builder(SuaClasse.this); builder.setTitle("Excluir"); builder.setMessage("Deseja excluir o registro?");…
-
0
votes2
answers559
viewsA: Capture Textfield change from Javafx
Add a Listener to textProperty of your Textfield: textField.textProperty().addListener((observable, oldValue, newValue) -> { System.out.println("Valor antigo = " + oldValue + ". Valor novo = " +…
-
3
votes1
answer7190
viewsA: How to Manipulate Arraylist of Java Objects
1 - How I create the getDiscipline method, the attribute being an Arraylist? Simple, make him return one ArrayList of Disciplina, since each student will have more than one subject. Ex: public…
-
2
votes1
answer272
viewsA: incompatible types Boolean cannot be converted to Usuarios
Note that you declare a Usuario u and then does receive the method inserir() that returns a Boolean and not a user. That is, they are different types. Note: Usuarios u = new Usuarios(); // aqui você…
-
1
votes2
answers471
viewsA: Take programmatically generated Edittext values
As you already have the amount of players, first create a ArrayList of EditText and put them in your layout: public class MainActivity extends AppCompatActivity { private LinearLayout ll; private…
-
1
votes1
answer52
viewsA: Adapt txt file reader
Replace the variable nome for selectedFile. Ex: File selectedFile = null; JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new File(System.getProperty("user.home")));…
-
1
votes1
answer458
viewsA: How to create an indoor map with the google maps api?
It’s a broad question, but the creation of Google’s indoor maps cannot be done directly by an API. First you need to send the site plan from a computer for them to approve and after approval and…
-
2
votes1
answer802
viewsA: Android - Textview Hyperlink to another Activity
You just use one SpannableString and use the onClick class ClickableSpan. In this case I created a subclass, in case you want to create a link in more than one word. Ex: public class MainActivity…
-
1
votes2
answers13323
viewsA: How to add foreign key with Constraint and alter table in Oracle?
You don’t own the column cod_client in the OS table, add it and it will work. Your scheme would look like this: Create table OS( nro_os number(4), data_os date , hora_os number(4), cod_cliente…
-
0
votes1
answer1031
viewsA: How to maintain the screen ratio after being resized by the user?
You can use the componentResized of componentListener to perform the calculation in accordance with ratio. Remember that the ratio is 10:7 or approximately 1.42 to stay horizontal or 7:10 = 0.7 to…
-
1
votes1
answer173
viewsA: Vector for Jtextfield
You can loop all components of your dashboard and if it is an instance of JTextField, you sum up. Ex: Double total = 0.00; for (Component c : painel.getComponents()) { if (c instanceof JTextField) {…
-
2
votes2
answers244
viewsA: I’m having trouble trying to list data from a mysql table
Complementing the @rray response, if you don’t want to have to pass the connection every time you instantiate a Hallucination can do so: Factory: public class Fabrica { public static Connection…
-
4
votes1
answer937
viewsA: Check in real time what you have typed in Edittext Android
Give a setOnFocusChangeListener in his EditText. Ex: seuEditText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus)…
-
2
votes1
answer46
viewsA: Listview with config.properties
I believe that this does not have a "correct" answer, it goes a lot of testing and how you want to create your database and the purpose of your application. For example: If it is only to show…
-
5
votes3
answers111
viewsA: Prevent data from appearing in MYSQL search
Select * From tabela_exemplo where Produto = '030' and Compra >= 0
-
0
votes2
answers3456
viewsA: Grant for several Oracle tables
You can also use EXECUTE in a loop. Ex: FOR x IN (SELECT * FROM all_tables) LOOP EXECUTE IMMEDIATE 'GRANT select,update,delete,insert ON ' || x.table_name || ' TO STACKOVERFLOW'; END LOOP;…
-
2
votes1
answer367
viewsA: Onclick in Marker in the Maps API
Implying that you already know how to create popups. Add the event like this and use the variable marker.html: marker.addListener('click', function() { /* Aqui você utiliza a variável marker.html */…
-
0
votes2
answers4197
viewsA: How to put an edge on an Android Textview
If you don’t need a solution as complete as @Mateus, you can set it to xml, but if the number of digits within the circle is variable (2 or +), you’d better create a class. circulo_drawable.xml…
-
1
votes1
answer81
viewsA: Function Postgresql
Missing a semicolon at the end of INSERT. Ex: INSERT INTO suprimentoslog ( codigoestoque , numeroserie , dataoperacao , clienteempresa , clienteusuario , solicitante , operacao) values…
-
3
votes1
answer732
viewsA: Create a precedent in Postgresql
I think this might help you. First you create the function: CREATE OR REPLACE FUNCTION aloca_equip() RETURNS trigger AS $teste_trigger$ BEGIN UPDATE equipamento SET edstatus = 'ALOCADO' WHERE eqcod…
-
9
votes1
answer690
viewsQ: Why is it better to use char[] than String for passwords?
Using Swing, the method getPassword() of JPasswordField returns a character array char[] instead of returning a String like the getText() (which by the way is discontinued). I should not use String…
-
3
votes1
answer148
viewsA: How to use foreign key to create a record in another table
I think it would look like this, remember that the table fields user_info shall permit null values. CREATE TRIGGER tg_user AFTER INSERT ON users FOR EACH ROW INSERT INTO user_info (id_user,…
-
2
votes1
answer432
viewsA: Arraylist, Collections
I think your question asks the piggy bank to receive an array of coins, just as it would in "reality", although it is more correct to receive one coin at a time. Change your class Cofrinho to…
-
1
votes3
answers883
viewsA: Validate whether INSERT was successfully executed or not (JTDS)
Do the following: Connection connInsert = DriverManager.getConnection(ConnectionURL); PreparedStatement inserir = connInsert.prepareStatement("INSERT INTO PRODUTO (ID, NOME, QTDE) VALUES (varId,…
-
1
votes2
answers92
viewsA: Keep the item focus Bottomnavigationview clicked after rotate screen
First try saving the selected Bottomnavigationview id in onSaveInstanceState() in your Homeactivity @Override public void onSaveInstanceState(Bundle savedInstanceState) { // Salva o id do menu do…
-
2
votes1
answer435
viewsA: How to implement a javascript undo and redo system?
I found this library on Github which facilitates the undoing and redoing approach. You only need to tell which methods are responsible for creating and removing the components (both graphics,…
-
1
votes2
answers759
viewsA: How to give Restart in an Activity?
To restart a Activity you can use the method recreation(), available from API 11. Make this Activity be recreated with a new instance. This results in the same flow when Activity is created due to a…
-
4
votes1
answer49
viewsA: Display only a maximum number of characters
You can use the SUBSTRING to make the query return only the first 25 characters: SELECT SUBSTRING(col_texto, 1, 25) FROM textos;
-
2
votes1
answer238
viewsA: Add a lower menu
to set time and runtime or even some part of configuration. For this quoted, just put one JPanel in the BorderLayout.SOUTH, and give it an edge to visually separate from the rest of the content. Ex:…
-
2
votes0
answers71
viewsQ: Drag & Drop in Jtree
I need to implement a Drag & Drop in one Jtree of 3 levels so that by clicking on one node of the tree and dragging it to another, some operations are performed. The scheme is basically:…
-
6
votes1
answer570
viewsA: What is the difference between revalidate() and repaint()?
Briefly you should use both. The repaint() warns Swing that some area of the screen is inadequate, "dirty". It is necessary to erase the image of old child components removed by removeAll() for…
-
1
votes2
answers55
viewsA: Duplicate random numbers
It was not clear what the methods created by you do exactly, but following your logic you should store the values in a List and then show them. Ex: MegaSenaController numberRandom = new…
-
0
votes1
answer334
viewsA: Customize pdf file name made in Jaspersoft, java and spring
Jasperreports has the method JasperExportManager.exportReportToPdfFile(print, "nome_arquivo");. Where the second argument is the file name. I’ll put an example: public void relatorioTeste(String…
-
2
votes1
answer84
viewsA: Is with the same value as the last time it was used
One way to solve this is to use SharedPreferences to save your counter number. First instancie: SharedPreferences config = PreferenceManager.getDefaultSharedPreferences(this);…
-
2
votes2
answers505
viewsA: how to specify values to sort sql server
I believe using order by with a CASE solve your problem: ORDER BY CASE ColunaValor WHEN 'DIAMANTE' THEN 0 WHEN 'OURO' THEN 1 WHEN 'PRATA' THEN 2 WHEN 'BRONZE' THEN 3 END…
-
2
votes1
answer85
viewsA: How to get gender from a Google user in an app using Firebase?
In the very question you mentioned is exemplified to AsyncTask necessary to catch the user’s gender using the Google People API Basically you send for this AsyncTask the account you logged in to…