Posts by Franchesco • 5,144 points
95 posts
-
10
votes8
answers5853
viewsA: Recognize word repeats in String
The code itself is explanatory. Basically what I did was: Create a list of repeated words; Scroll through this list and search for each word in the original text in the list; Exchange the word for…
-
9
votes1
answer1274
viewsA: Select Multiple with dynamic operation
whereas the select disponiveis is the same as yours select vet[], that comes filled by java, I would do so: var lista = []; pegaLista(); function pegaLista() { var disponiveis =…
-
1
votes4
answers1981
viewsA: Go to the first option after clicking the button
Just use the function prop() to set the option as marked by clicking the button. $(".bt").click(function() { $(".op1").prop('selected', true); }); <script…
jqueryanswered Franchesco 5,144 -
4
votes2
answers2531
viewsA: What is the logical "XOR" operator in PHP? When do you use it? What does it do?
xor is a logical operator such as or and and. It returns true if the two operands are different, and false if the two are equal, both true and false. A practical example is when you need a field to…
phpanswered Franchesco 5,144 -
4
votes2
answers5265
viewsA: Show/hide each element within a toggle class (jquery)
You can use the function next() for this, which selects the next element. In your example I modified the line $('.menu-departamento > ul > li').hide(); to hide all ul. Then the next() always…
-
0
votes3
answers366
viewsA: How to Record Data in Windows Registry?
As never used, I will post only what I found on the MSDN site. The following code uses the key CurrentUser to create an instance of class writing RegistryKey, corresponding to the Software key. The…
c++answered Franchesco 5,144 -
5
votes3
answers1128
viewsA: Draw characters in variable
Use the function replace(), replacing string. The first parameter is string which must be replaced and the second parameter is what will replace the first. The first parameter accepts both a regular…
-
7
votes1
answer805
viewsA: Moving text within a textarea
You can use the tag marquee to that end. For example: <marquee direction="up" width="250" height="100" style="border:1px solid"> Texto rolando </marquee> However, it is not recommended…
-
10
votes3
answers3152
viewsA: When to use Setters and Getters?
You use setters and getters to provide management of the attributes of your object. That is, you can change the variables of the object once created. On the other hand, by encapsulating the…
-
2
votes2
answers1913
viewsA: Font color in placeholder
You need to use the selectors -place-holder specific to each type of browser to work: .teste::-webkit-input-placeholder { /* WebKit browsers */ color: red; } .teste:-moz-placeholder { /* Mozilla…
cssanswered Franchesco 5,144 -
1
votes3
answers312
viewsA: Placeholder does not work in Textarea
It doesn’t work because you’ve already included a content in it. Just take that works normal: <form name="trabalheConoscoFormulario" id="trabalheConoscoFormulario" action="" method="post"…
-
1
votes1
answer415
viewsA: Get value of the week that will start a month
You can use the function date() for this goal. By passing the 'w' option it returns the week number of a certain day. First you turn the date into timestamp, with the function strtotime();. The date…
phpanswered Franchesco 5,144 -
8
votes4
answers688
viewsQ: Superclass can become subclass?
I have the classes Versao, that a general version, VersaoFirmware and VersaoSoftware. In practice the user can add one or more versions to an equipment. However, at first, it is not yet known what…
-
4
votes3
answers225
viewsA: Doubt about showing local network IP
If it’s just to show the IP you can just use the method getHostAddress(). InetAddress localhost = InetAddress.getLocalHost(); // Pega o nome do host do sistema, resolvendo pra um // objeto…
-
1
votes4
answers3412
viewsA: How to take the value with getElement and assign to a variable?
This mistake NaN (Not a Number) happens when you try to do an operation ( + can be a concatenation) with a variable that is not number. You probably didn’t enter any number in input and then he…
javascriptanswered Franchesco 5,144 -
6
votes1
answer1778
viewsA: Change text and background color Tooltip
Solution 1 Some swing elements accept HTML in the text. For example in a label you can put something like this in the text: "<html>Palavra em…
-
1
votes1
answer836
viewsA: Import PHP CSV file
You can use the function fgetcsv. Follows an example of use, assuming a table CONTATO(Nome, Funcao, Morada) and a line in the CSV of the type costa;Programador;Lisboa;: <?php if ($db =…
-
2
votes1
answer58
viewsA: Check that process is running without bumping into the 15-character limit
According to the notes in the pgrep should be used the option -f for the command. The default is usually only compared to the process name. When -f is defined, every command line is used in the…
-
1
votes2
answers185
viewsA: Automatically creating input limiting to 5
You can get the number of inputs within a parent element. For example find the number of inputs within the div "fate". Example: function duplicarCampos(){ var count = $("#destino input").length; if…
-
5
votes2
answers189
viewsQ: Why does Netbeans suggest improving the for?
When I was doing this for Netbeans Showcased That Lamp of Tips to Improve Code on the Line of for. The suggestion was to reverse the condition. Follow the code: Before of improvement: for(int j = 0;…
-
4
votes2
answers329
viewsA: How to know when two Threads ended up in Swing?
Create a CountDownLatch started in 2; Create both SwingWorkers, passing to each one the CountDownLatch as a reference. In the done() of each call the countDown() of latch. Do it in the methods…
-
2
votes2
answers329
viewsQ: How to know when two Threads ended up in Swing?
I have a method that performs two tasks. I would like two threads perform each task. Tasks do not share data, are completely independent. Before starting the tasks is shown a dialog with the…
-
4
votes2
answers75
viewsA: What is the error in this return exercise: Object orientation
You put the controls off the main. Correcting this and removing the return 0 of function maior(), swirled normal here. public static void main(String[] args) { Matematica m = new Matematica(); int…
javaanswered Franchesco 5,144 -
1
votes4
answers1964
viewsA: Set placeholder with PHP variable
With Javascript you can do so: var placeholder = document.getElementById("entrada").getAttribute("placeholder"); alert(placeholder); <input type="text" placeholder="teste" id="entrada">…
-
20
votes3
answers3927
viewsA: What is the difference between $(this) and $this and this?
$() is the jQuery constructor function. this is a reference to the DOM element invoked. So, basically, in $(this), you’re just passing by this for the function $() as a parameter, you can call…
-
10
votes3
answers2035
viewsQ: Interface or Abstract?
I read several contents on this subject, until arriving at this example: public interface Funcionario{ public void trabalha(); public void recebe(double salario); } public abstract class Geek…
-
2
votes3
answers1981
viewsA: Rescue the index of an object with a certain attribute within an object array
indexes = $.map(listaImagens, function(obj, index) { if(obj.idCategoria == 2) { return index; } }) firstIndex = indexes[0] Gringo OS source:…
-
10
votes1
answer18996
viewsA: Change address bar url without refreshing page
With HTML5 you can use window.history.pushState("object or string", "Title", "/new-url"); Read this article for more details: HTML5: Changing the browser-URL without Refreshing page…
-
4
votes2
answers275
viewsA: Multi-level in an OL
You need to leave the tag open <li> each level and close when another level starts. Corrected code: ol { counter-reset: item } li { display: block } li:before { content: counters(item, ".") "…
-
15
votes1
answer166
viewsQ: Why does HTML accept color with random names/strings in the <body> tag?
Some time ago I read somewhere about it, but I never understood how it works: Take the example with the word 'chucknorris': jsfiddle Not only with the word 'chucknorris' but any random word always…
htmlasked Franchesco 5,144 -
5
votes1
answer717
viewsQ: Function statement in Javascript
What are the differences in declaring a function in these two ways: Mode 1 var funcao = function() { // ... }; Mode 2 function funcao() { // ... } What are the advantages and disadvantages of each?…
javascriptasked Franchesco 5,144 -
10
votes1
answer14365
viewsA: Pop up with Bootstrap when loading page
First apply an ID to the modal: <div id="myModal" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true"> <div…
twitter-bootstrapanswered Franchesco 5,144 -
3
votes4
answers4185
viewsA: How to separate values from a php variable?
Since it’s always two characters so just do it like this: $valores = '12'; $primeiroValor = $valores[0]; $segundoValor = $valores[1];
phpanswered Franchesco 5,144 -
1
votes2
answers756
viewsA: Treat ranges between two Time Mysql fields
You can use the function TIMEDIFF(). Example: SELECT TIMEDIFF('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002') Source:…
-
6
votes7
answers762
viewsA: Randomize results with PHP
Wouldn’t that be? <?php echo do_shortcode("meubanner_".rand(1,9))?> Or better, not to repeat, use the function array_rand(). Create an array with the numbers 1-9 and Randomize, then with a…
-
1
votes1
answer790
viewsA: Open a folder on the user’s machine and open a file (csv,txt or xls)
As you are working with jQuery, you can use the jQuery File Upload.
-
1
votes4
answers1844
viewsA: Factoring in Javascript
I found it on the Internet. I didn’t test it, but it seems to work: function fator(numero) { if (isNaN(numero) || !isFinite(numero) || numero%1!=0 || numero==0) return ''+numero; if (numero<0)…
javascriptanswered Franchesco 5,144 -
4
votes1
answer629
viewsA: Difficulty positioning table on screen with bootstrap - layout only
I would put the table in one column and the inputs in another, to divide the screen. I don’t know if it’s what you want but it would look like this: <div class="container"> <div…
-
18
votes2
answers57495
viewsA: Formatting a double in java
You can do it like this: String resultado = String.format("%.2f", valor); Or you can do it like this: double numero= 10.00; DecimalFormat formato = new DecimalFormat("#.##"); numero =…
-
15
votes2
answers1978
viewsA: How to use the Java scanner
Is because of the ENTER that you give when you read the whole. UPDATE: I made a mistake, changed nextLine() for readLine(). Is already corrected. The ENTER produces a string \n which is consumed by…
-
3
votes3
answers2508
viewsA: How to work with OCR to recognize photographs
I had the same problem a few days ago. After testing some the one that worked best for my case was the ocrad, which is in javascript. I needed to recognize the image title of a photo taken from a…
-
0
votes2
answers377
viewsA: Checkbox is not checked
Tried to specify data type in ajax? Type dataType: 'html' In PHP code I would put everything in a variable and return in JSON format. Thus: $retorno['html'] = array(); while ($ln2 =…
-
2
votes3
answers1211
viewsA: How to modify form fields if user input is invalid compared to regular expression with Jquery
I guess that’s about it: $(':text').change(function() { var pattern = $('[name=nome]').attr('pattern'); var str = $(this).val(); var retorno = str.match(pattern); // retorna a resposta do match...…
-
1
votes2
answers389
viewsA: Failure to validate fields
Put @Alisson code inside tags <script></script> Or put inside your existing function, like this: $('.voltar').on('click', function() {…
-
3
votes3
answers8188
viewsA: Validity of a QR Code
I believe it has no validity, because QR Code is a standard, as is the barcode. When a QR Code reader is used to read your code, it will simply translate the code into the link you used to create…
qrcodeanswered Franchesco 5,144