Most voted questions
150,413 questions
Sort by count of
-
9
votes3
answers4676
viewsIs the Finally block always run in Java?
In this code there is a block of Try/catch with a Return within it. try { alguma_coisa(); return successo; } catch (Exception e) { return falha; } finally { System.out.println("Eu não sei se será…
-
9
votes7
answers91443
viewsError: Unable to find or load the main class in Java (Eclipse or CMD)?
If you ever came across the error message: Erro: não é possível localizar nem carregar a classe principal you probably won’t be able to run your code in Java. In the eclipse I came across this…
javaasked 9 years, 5 months ago Maicon Herverton 877 -
9
votes1
answer197
viewsif with a Matches or multiple comparisons?
Whereas I have a variable of the type String tipoResidencia that will never be null, and that I need to run a test, the default solution is this: if (tipoResidencia.equals("CASA") ||…
-
9
votes1
answer817
viewsSpring Security, display message when log out
I am controlling the session of my application with Spring Security, I have two rules to end the session, max-Session <session-management> <concurrency-control max-sessions="1"…
-
9
votes2
answers1683
viewsConvert a collection from Set to List type
I have a class that has an attribute of the type of Set, because I want repeated values to be ignored, however I need to return this in the form of a List to fill in a ListView, so what is the best…
-
9
votes1
answer150
viewsWhat is the relationship between OOP and code security?
Is there any foundation to think that an object-oriented programming style is safer than the structural one?
-
9
votes4
answers8429
viewsHow to use template string in Javascript?
I’m having trouble making a Javascript function that I pass a string and an object and it fills this string with the attributes of that object, for example: var user = { nome: "danilo", idade: 29 };…
-
9
votes4
answers13678
viewsRounding a decimal to a lower decimal
Using Javascript how can I round a decimal number with several decimal places to a number with two decimal places being the lowest decimal number? Example: 44,97714285714286 To 44,97 I’ve used the…
-
9
votes2
answers23399
viewsPicking up parent div attributes through child elements
I own several structures that follow a unique style: <div data-id="1"> <div> <button>Descobrir é o data-id desta estrutura</button> </div> </div> with jQuery or…
-
9
votes4
answers268
viewsHow to improve this jQuery code?
I’m learning jQuery and I don’t always know exactly how to develop the code more cleanly, semantically, I’ll end up learning. How could I improve this code? $("#click_apoio").on('click', function(…
-
9
votes3
answers382
viewsDesign Standard for Filters
First, filter in my current context is a list of objects to be used in Combobox type controls so that the user can choose from among the options. My scenario is this: Screen 1 - Has filters of…
-
9
votes1
answer515
viewsWhat are the pros and cons of the Task<List<Object>> implementation on List<Object>
What are the advantages between the two implementations below. Both return a list with multiple products (more than 1k): public Task<List<Product>> GetAllProductsAsync() { var query =…
-
9
votes2
answers1749
viewsPOST method does not take FORM value
I’m making a contact form on a website, but the PHP method does not take the value of input in the form, I’ve searched the internet and I can’t find anyone with the same problem. And e-mail is being…
-
9
votes3
answers31270
viewsFormat mask for CNPJ
I need to format a mask for CNPJ. Until then this is done, but the standard of the company is to format with space instead of stitch. This is the code I’m using. valorDoTextBox =…
-
9
votes4
answers12072
viewsInclude UTF-8 charset in mysqli connection
Hello, after noticing that my code is full of strange characters like ??? I tried to fix it but found I need to change the charset through the mysqli connection, but the problem is I don’t know how…
-
9
votes1
answer261
viewsMirroring of Database
I am developing an application in Java using database PostgreSQL, locally. I would like to know if there is a way to mirror my local database to an external server? Is there an API on Java for that…
-
9
votes1
answer1603
viewsHow to bring table with data when returning from an Insert
I edited the question of the post because I think it is the most logical solution to the issue. I have a page with 3 tabs and in one of these I upload files to my hosting and send the necessary…
-
9
votes2
answers16374
viewsWhat is the difference between Ajax dataTypes in jQuery?
I am learning jQuery and I need to know the difference between Ajax dateTypes. dataType: "xml" dataType: "json" dataType: "script" dataType: "html" How this influences the execution of the script…
-
9
votes2
answers8501
viewsSynchronous requests
I need to make requisitions, but the first must be a GET (getByNome) and then run the rest because they depend on it. It turns out my code is sending a Undefined because the requisitions depend on…
-
9
votes2
answers48118
viewsLoad a tab into a div
I am developing an HTML page for mobile and I have the following question: is it possible to load one page inside another? For example: pagina.html: <div class="container22"> <div…
-
9
votes1
answer6033
viewsUsing @Supresswarnings in Java
Good morning. Until when it is recommended to use the annotation @SuppressWarnings to hide a Warning of a certain problem that the compiler finds in your code and show that you know what you’re…
-
9
votes2
answers874
viewsIs it possible to prevent injection of external resources and requests for greater security?
I understand that we can create and search javascript plugins, analyze the code and make sure that it will not inject anything on the outside page. But supposing there is some library from which…
-
9
votes3
answers2587
viewsWhat are the advantages of using Docker instead of Vagrant?
I’ve been using Vagrant and I’ve been hearing good things about Docker. I am a developer of web applications. What are the advantages of using Docker instead of Vagrant in a software development…
-
9
votes1
answer555
viewsLocation of specific points on maps
Hello I am developing an application that works with the Jxmapviewer library in the java language, one of the proposals is to find geolocation points (ex: stops/snack bars) in a certain street that…
-
9
votes1
answer519
viewsSynchronized in static methods, and in nonstatic methods
If I have a class, where I have two methods one static and the other not. Is the lock the same or not? How to do for the two sharing methods, the same synchronization mechanism, ie the same lock?…
-
9
votes6
answers19681
viewsHow to fix this error "Error cannot resolve Symbol R" in Android Studio
I imported a project made on Eclipse to the Android Studio and errors appeared in the code regarding the R with the following message cannot resolve Symbol R How to correct this error?…
-
9
votes2
answers1183
viewsAdd multiple objects to a list
I’m developing an application web, where I have a list of an object called frames, well, every time I click on a button I add a new object to that list, only the problem is this: When I try to add a…
-
9
votes1
answer610
viewsHow to set up mopub ads?
When you install the plugin mopub in the Android Studio you choose the type of banner ad and it gives you all the code to go pasting in the right place. You perform works right appears in the test…
-
9
votes8
answers794
viewsMapping an array with possible subarrays as elements
I am trying to create a function that files an array to another newArray. If one of the array elements is an array, I want to map all its subelements to newArray. Therefore: var array = [1,2,3,4,5,…
-
9
votes0
answers147
viewsWhat are the currently adopted software licenses, and what is their most suitable use?
I can say that I matured as a professional in the GNU era, when the GPL Software License was being matured and widely adopted for use with open and free software, but in the present times (in the…
-
9
votes5
answers20983
viewsGrab content from another page by javascript or jquery
I need to get content from another page inside the site using Javascript, I tried using ajax, but gives this error "Blocked cross-origin request: The same origin policy (Same Origin Policy) prevents…
-
9
votes2
answers3391
viewsWebbrowser/Java Browser
How I put a kind of a 'Webbrowser[. NET]' in a Java project? I know that there are free rendering engines like Gecko, which is used in Firefox. But I don’t even know where to start, even getting a…
javaasked 9 years, 7 months ago Nickolas Carlos 632 -
9
votes1
answer907
viewsThread or Asynctask? When and which one should I use?
When it is recommended to use threads? At what point it is advisable to use the AsyncTask? I would like to know what to use and when to use it.
-
9
votes1
answer266
viewsProblem with Fast Colored Textbox (indentation)
I’m modifying an open source project created by Pavel Torgashov, called Fast Colored Textbox, and I’m having problems with the language VB in the editor, because methods and properties are indented…
-
9
votes2
answers229
viewsuser tree with dots and profile in C#
I have a list of users in which each has a sponsor (sponsor is also a user). Each user has points and is of one type. I want to know which branch of the tree has the highest number of points and for…
-
9
votes1
answer285
viewsHow does the LED lightweight encryption algorithm work?
I would like to better understand the functioning of the algorithm LED step by step, mainly the process of substituting and permutation of the blocks and mainly the use of the keys in each round.…
-
9
votes4
answers455
viewsIs it appropriate to create a`CSS Sprite` with disparate images?
It is appropriate to create a CSS Sprite with images of different dimensions? Because I have exactly 20 images where their height and width are limited: Maximum image height is 60px; Maximum width…
-
9
votes2
answers598
viewsGit workflow (workflow) using Github?
I need to learn how to clone a project from github to my local computer and, after making the necessary changes, send the modifications back to the remote project. Basically the workflow git by…
-
9
votes3
answers260
viewsCreate a real "loading..."?
I’ve been researching some legal effects for a status of "Loading..." But I realized that on all the sites, they use timeout so that the animation goes in and out of the page, being then, just a…
-
9
votes5
answers3697
viewsHow to import a variable within a function of a class?
I’d like to take the $valortotal and take it into a function of a class as can be seen in the example below. Thank you. $valortotal = 15.00; class CreatePaymentRequestLightbox { public static…
-
9
votes2
answers144
viewsIs it redundant to use LIMIT in a QUERY whose ID is the primary key?
My question is if using LIMIT there will be some performance gain in the QUERY. Example: SELECT descricao FROM produto WHERE id = 9999 LIMIT 1 Has better performance than? SELECT descricao FROM…
-
9
votes1
answer27206
viewsDatabase connection - Mysql and Java
I already have a local server on my machine (localhost) with Mysql running normally. From there, I would like to connect my database with Java, but... how do I do that? Is there any Swing component…
-
9
votes1
answer303
viewsUse local files if CDN is Offline
I wonder if it is possible to perform a callback if a CDN is offline the system uses local files. Ex: I use the Fontawesome CDN but if the user runs out of the internet or the CDN goes offline, it…
-
9
votes1
answer2493
viewsWhat are logical operators and how do bit-to-bit operations work in the C language?
What are logical operators NOT, AND, OR, XOR, in language C? Nor did I understand these operators: ~, &, |, ^, >>, << and the result in bits. I have the following example of code:…
-
9
votes2
answers1839
viewsWhich one performs better? For or Foreach+Range?
Of the two forms below, which has a better performance? For: for( $x=1; $x < 31; $x++ ) echo $x . PHP_EOL; Foreach + range: foreach( range(1,30) as $x ) echo $x . PHP_EOL; I know the difference…
-
9
votes2
answers3219
viewsConnect Arduino to SQL Server
I’m looking to keep an updated database with the outputs of the Arduino sensors. I wonder if it is possible to connect directly the Arduino to SQL Server for sending and receiving data. Or the only…
-
9
votes2
answers295
views -
9
votes1
answer234
viewsEncapsulation and Java Access Modifiers
A very simple question: Given that class: public class User { private String nome; //get/set public boolean fazQualquerCoisa(){ **duvida**.equals("algumacoisa"); } } Within the method did All() I…
-
9
votes3
answers1163
viewsHow to separate a string from a certain line of a data.frame and at the same time create more rows?
I have a data.frame with a column with strings like "123-235-203". For example, the line: string column1 column2 123-235-203 x y I want to separate this string so that the row that contains it…
-
9
votes4
answers114
viewsWhy is this SQL statement incorrect?
SELECT * FROM produtos WHERE categoria = 'Vestidos' AND cor = 'Branco' OR cor = 'Rosa' Returned 3 records, 2 of them from the category Dresses, and 1 of the category Shoes. Why not returned only…