Posts by Renan Gomes • 19,011 points
435 posts
-
1
votes4
answers1982
viewsA: How do I validate the radio input of my code?
Óra, why don’t you just use HTML for this? The only requirement of its validation is that the field has some value (text type ones) or that it has been selected (choice ones), this is easily solved…
-
1
votes1
answer89
viewsA: Create progress bar with jQuery’s Hover()
You can use the function hover() to get the event when the mouse pointer enters/exits the element: $(function(){ var interval, progress = $('progress'), INTERVAL_DELAY = 50; // "mouse in"…
-
1
votes2
answers947
viewsA: How to turn all items in a string list into integers?
items = ['1', '2', '-10', 'A', '1234567890'] for item in items: print('{} type: {}'.format(item, type(item))) int_items = [int(value) for value in items if value.lstrip('-').isdigit()] for item in…
pythonanswered Renan Gomes 19,011 -
2
votes2
answers873
viewsA: How to count the spaces of a String in java
There’s nothing wrong with your code, except that you’re using next() instead of nextLine(). The first can read the input until there is a space, that is, you cannot read an "entire" string that has…
javaanswered Renan Gomes 19,011 -
2
votes5
answers1555
viewsA: How to display DIV if radio is marked?
If you change the HTML structure and put the <div> inside the form, after the inputs, can make this toggle effect only with CSS. In that question an explanation about the selector +. form div…
-
0
votes1
answer388
viewsA: Fill label automatically when Stage opens - Javafx
You can override the behavior of the method initialize(), which briefly is the method called when all controls noted by @FXML are injected. For this, your control class must implement Initializable:…
-
2
votes1
answer190
viewsA: Error writing and reading CSV file
But it is the expected behavior, isn’t it?! You are writing null in the file. Just follow how you are calling the methods within the class Main: He instigated an object Arquivo. Created a variable…
-
1
votes1
answer397
viewsA: How to change the placehoder according to the value of the select?
Create an object for key/value mapping based on value of existing options: var placeholders = { 'cafe': 'Cimo, 3Corações, Utam', 'refrigerante': 'Coca, Pepsi, Catuaba' }; In case the item does not…
jqueryanswered Renan Gomes 19,011 -
1
votes4
answers327
viewsA: Doubt about how to generate random numbers
In Java 8 there is the method ints() to generate an array of integer numbers: // Gera um array contendo 6 números de entre 1 e 60. int []valores = new Random().ints(6, 1, 60).toArray(); Running on…
javaanswered Renan Gomes 19,011 -
1
votes1
answer1534
viewsA: Pass an object between Javafx (screens)
Remove the tag fx:controller of your fxml file (if you are using it that way). Then please prompt the controller "manually" at the time you load fxml. From what I understand, you want to pass an…
-
3
votes1
answer209
viewsA: How to insert a value into the prompt box?
All these boxes that appear in the browser have treatment on WebEngine. To control calls to the function prompt() Javascript, you need the WebEngine#setPromptHandler():…
-
1
votes2
answers207
viewsA: UF field that accepts only 2 uppercase letters
In addition to the way you are doing, you can provide a ComboBox<T> for the user, being <T> an One with all federative units available as this information does not change frequently.…
-
0
votes3
answers4227
viewsA: When clicking a button, how to make the screen slide down
Do not use the attribute name, that’s deprecated in the latest version of HTML and J. Guilherme’s answer may not work in newer browsers. Use id: <div id='meuelemento'> <!-- ... -->…
-
3
votes2
answers352
viewsA: When and why use :Hover and onMouserOver and onMouseOut?
CSS should be used to handle layout and Javascript the logical part. Whenever possible choose to use CSS. Please use Javascript in cases where Features CSS can’t meet your needs and may need to add…
-
7
votes1
answer936
viewsA: When to use Collections.emptyList()?
Consider a method that returns a List<?>, it’s not beautiful (and it doesn’t even make sense) to return null, in addition to increasing the chances of a NullPointerException sprout in the…
-
2
votes2
answers276
viewsA: Remove characters from a string between two specific java characters
Use the package classes java.nio.* to handle and manipulate file and directory paths Path path = Paths.get("C:/Users/Vinicius/Documents/NetBeansProjects/ProjetoORI/inseremarca.exe") .getParent(); //…
-
0
votes2
answers452
viewsA: Comparison request.getParameter with JSP string
See the question how to compare strings in Java? As you are doing, the comparison is being made by the reference and not by the contents of the string. Use equals() to perform the verification:…
-
1
votes2
answers660
viewsA: OS library Python - Locating Directories
You only got the same return in both cases because you are running the script directly, in the same working directory. Do the test yourself, put this script in some other directory. Open a prompt on…
pythonanswered Renan Gomes 19,011 -
-1
votes3
answers14308
viewsA: Adjust image to <div> size
Can use background-size: cover since you are inserting the image url directly into css. .profilepic { width: 150px; height: 150px; border-radius: 50%; background:…
-
0
votes1
answer95
viewsA: Doubt with Expression Language JSTL JSP
It’s not clear. If you want to know the value of listPedidos just call a ${listPedidos} anywhere in the document. To loop only if listPedidos is neither null nor empty, you can use the operator…
-
1
votes4
answers804
viewsA: How to change font in textarea using javascript?
document.querySelector('textarea').style.fontFamily = 'Impact'; <textarea></textarea>…
javascriptanswered Renan Gomes 19,011 -
3
votes1
answer71
viewsA: Doubt with Java EL code snippet
Briefly: <c:choose> in expression language is like a switch/case in your Java code. The <when test="{condição}"> is like a case "condição":. And the <c:otherwise> is equivalent to…
javaanswered Renan Gomes 19,011 -
2
votes2
answers1683
viewsA: Place text at the bottom of the css circle
No need to create extra elements (an element <span>, for example) for this, you can use the pseudo element ::before to stylize the circle: div::before { align-items: center; border: 1px solid…
-
1
votes2
answers428
viewsA: Hover and Disabled at the same time
You can use the not() to apply Hover only to elements that have the class .btn-destaque which do not have the attribute disabled: .btn-destaque { padding: 25px 15px 25px 15px; background-color:…
-
0
votes3
answers1798
viewsA: Make Bootstrap columns fill 100% of the Row width
Should your snippet’s red lines be leaning against the sides? According to container documentation you can change the class container for container-fluid: .box { height: 100px; margin-bottom: 20px;…
-
3
votes2
answers2478
viewsA: Check if button is disabled - Javascript
If you need to seek one specific element (either by tag, class, id, data Attributes, etc) use document.querySelector(). It makes more sense than making use of this getElementsByClassName. var button…
-
1
votes1
answer175
viewsA: How to get jsoup to pass only specific parts of the site?
Analyzing html, there is only one element with class realprice on the page, then you can make a selector for that class. I am only considering the page you provided in the question, how missing…
-
1
votes1
answer1113
viewsA: How to create a "new file". txt in java?
This line is unnecessary: Stage janela = (Stage) areaTexto.getScene().getWindow(); janela is not being used anywhere within the Listener event. Remembering that events can be mapped inside the .…
-
1
votes2
answers816
viewsA: How to save a file to Javafx or Java?
You don’t need all this effort in Java 8, you can use the method Files#write(): salvar.setOnAction((ActionEvent e) -> { Stage window = (Stage) cont.getScene().getWindow(); try { String corpo =…
-
6
votes4
answers211
viewsA: jQuery Hover does not work
You don’t need Javascript. Nowadays, css is powerful enough to address much of the problems related to Hover and toggle actions, the above site provides some good examples that can occur in everyday…
-
1
votes2
answers711
viewsA: Hover div inside div
I was answering, but it’s already been explained by Leon at reply from it, just set to rule :hover be applied when it happens in the element .pokeBolaOut. But it is not necessary to use so many…
-
1
votes1
answer685
viewsA: How to update a Label automatically every minute?
Do not mix awt with Javafx. Note with @FXML everything that is file element .fxml. Utilize Timer and TimerTask for processes that do not change the controls in the UI, for example, some action that…
javafxanswered Renan Gomes 19,011 -
3
votes1
answer331
viewsA: Robot Class with Variable
Use KeyEvent.getExtendedKeyCodeForChar(): final String string = "camera"; for(char character : string.toCharArray()){ robot.keyPress(KeyEvent.getExtendedKeyCodeForChar(character));…
javaanswered Renan Gomes 19,011 -
0
votes3
answers2124
viewsA: Image appearing with Fad-in effect after loading page
Treat animation with Javascript if the number of images is dynamic. If you have a fixed number of images, you can create your animation fade-in with @keyframes and make use of the property…
-
8
votes5
answers2126
viewsA: function to count Divs quantity
For the problem you presented, it is not necessary to use Javascript. The increment in the count of elements can be done through the property counter-increment and the sum of the elements can be…
-
3
votes1
answer82
viewsA: Why are instantiated controls not displayed in the UI?
Loaded they are. I believe your doubt is related to the elements not appearing in AnchorPane. If so, the reason is that you are only initiating the objects, but at no time add them to the panel. You…
javafxanswered Renan Gomes 19,011 -
4
votes3
answers1889
viewsA: mark a checkbox and uncheck the others
Use the <input type="radio"> and change the appearance of the element to look like a checkbox: input[type='radio']{ -webkit-appearance: checkbox; -moz-appearance: checkbox; -ms-appearance:…
-
1
votes1
answer114
viewsA: Manipulação Momentjs
You can get the day of the week by name, in the case: Friday. // obtendo o número da semana atual (no seu caso, é a soma das semanas). var week = moment().week(); // obtendo a sexta-feira daquela…
-
1
votes1
answer2583
viewsA: How to open Netbeans . fxml files directly in Scene Builder?
If you installed Scene Builder before Netbeans, you don’t have to do anything, the installer will do the job of setting it up automatically (just like it does with JDK). If you installed Scene…
-
1
votes3
answers3528
viewsA: How to take the space between two inline-block Divs?
The problem is that you have space between the elements: a line break. If you take the html it has and compress, the problem will already be solved: #tudo{text-align: center; margin: 0…
-
3
votes2
answers908
viewsA: How to perform an internal search for the id?
The way you’re doing it has no need to go through all the elements, it would if you were looking for an element by the attribute class (which can be repeated). A id is unique per page, so if…
javascriptanswered Renan Gomes 19,011 -
5
votes6
answers29816
viewsA: How to create space before or at the end of the text contained between html tags?
Óras, use margin for that reason: div { float: left } div:nth-child(1) { margin-right: 6% } <div>Texto</div><div>texto que quero um espaço antes</div>…
htmlanswered Renan Gomes 19,011 -
7
votes5
answers14273
viewsA: How to put a colored layer over an image?
In addition to the solutions they presented, you can use the multiples backgrounds, just use linear-gradient passing two color values rgba next to the image url: div { height: 262px; width: 389px;…
-
4
votes3
answers449
viewsA: Alignment of text vertically
Essentially already answered in the question how best to center an element vertically and horizontally?, although the AP says it needs to "align the text", in the code posted that "text" lies within…
-
3
votes4
answers257
viewsA: Grab link on date and play on src from img on Hover
Your question has already been answered, but this is what you want to do waiving the use of Javascript. Normally they are used sprites to display images that have different "states". And even to…
-
5
votes3
answers924
viewsA: Format String
If it’s something simple, you can use the method format(): String moderator = "João"; int messages = 3; // João tem 3 mensagens. String.format("%s tem %s mensagens.", moderator, messages); If it’s…
-
3
votes2
answers955
viewsA: How to print the day numbers of each month using Array, String and byte?
You can use the package classes java.time.* to obtain the number of days of all months of the year, for example: final int year = 2017; for(Month month : Month.values()){ LocalDate date =…
-
6
votes4
answers6985
viewsA: How to add times in Java?
Since it’s something specific of hours, you can use LocalTime that provides the method plusHours to perform sum of hours. There are other methods to treat sum of minutes, seconds, etc (TODO: see…
-
9
votes5
answers22775
viewsA: What is the best way to iterate objects on a Hashmap?
Can use functional operations: map.forEach((key, value) -> { System.out.println("key: " + key + ", value: " + value); }); Functioning in the IDEONE.…
-
5
votes2
answers475
viewsA: Input alert if typed data is invalid
Can use :invalid to validate a field (text, number, email, etc...) and through this rule, decide whether to display/hide the alert to the user: .input span { color: red; display: none /* Esconde o…