Posts by Bacco • 93,720 points
1,184 posts
-
1
votes1
answer3237
viewsA: How to display the values of an Arraylist separately?
This answer was for an earlier version that the question already had. The println should already break the lines, try the variant below if it is a platform difference problem: ArrayList exemplo =…
-
5
votes1
answer1578
viewsA: Problem to retrieve dynamically added array fields[]
The problems: Initial problem: to use $slcDias as $slcDia $slcDias = $_POST['slcDia']; foreach ($slcDias as $slcDia) { echo $slcDia; } One more problem here: if one adds 3 new fields, you will get 3…
-
2
votes2
answers2243
viewsA: Count lines with PHP and JS
Javascript: //Simplifiquei o JS, baseado na versão do @vmartins, muito mais enxuta document.getElementById('texto').onkeyup = function() { count = this.value.split("\n").length;…
-
2
votes2
answers287
views -
116
votes5
answers6116
viewsA: What is the difference between the functions var name = Function() and Function name()?
Function Statement: Function name() A function statement defines a function variable without the need for variable assignment. They are constructs independent, and cannot be nested in non-function…
javascriptanswered Bacco 93,720 -
12
votes2
answers7696
viewsA: Get the current date and time by internet in desktop application
Solution in C# Original: https://stackoverflow.com/a/12150289/916193 public static DateTime GetNetworkTime() { //Servidor nacional para melhor latência const string ntpServer = "a.ntp.br"; //…
-
17
votes2
answers3471
viewsA: Search with LIKE or MATCH.. AGAINST in two columns
A somewhat laborious possibility, but with a more complete result, is to use PHP to divide your search in separate words, and generate the WHERE clause for you: <?php $pesquisa = 'carro verde…
-
5
votes3
answers4519
viewsA: How to display part of a text stored in a TEXT column?
Here are several examples to illustrate the possibilities. Just understand the basic logic, and recombine according to the desired result! Solutions with PHP: <?php $res2 = mysql_query("SELECT *…
-
9
votes1
answer1988
views -
20
votes1
answer15905
viewsA: How to rescue the GPS location in coordinates, from all users of the application?
If what you want is an app ready, click here, otherwise, adapt the code below. Kickoff: There are several examples on the web, but I started from a reply from Soen himself: First of all, this has to…
-
18
votes3
answers12698
viewsA: Difference between dates
Based on one of the best OS replies in English and applied to your specific case: if ( ($("#txtDateStart").val().split("/") == "") && ($("#txtDateEnd").val().split("/") == "") ) { data1 =…
-
8
votes1
answer526
viewsA: 503 redirect across multiple Urls with the exception of one
Put in the .htaccess (or apache configuration): RewriteEngine on RewriteCond %{REQUEST_URI} !^/caminho/permitido.html RewriteRule .* /erro503.php To ! in the RewriteCond means denial, i.e., the…
-
7
votes3
answers161
viewsA: Plicas and IF php problem
Follow "fix" to your code: echo '<div id="tabs-2">'; echo '<p>Ficha de Aptidão Médica Validade:'; if ($exibe['MedicaValidade']) { if (strtotime($exibe['MedicaValidade']) < time()) {…
-
7
votes1
answer915
viewsA: Difficulties with binarySearch Class Arrays method
To use binarySearch, before you need to have an ordered Array. If you do this, it already changes the result (but read until the end): java.util.Arrays.sort(); See this excerpt from java…
-
5
votes1
answer1593
viewsA: Relationship between state, city, municipality and district
Basically lacking index in names to improve performance: CREATE TABLE IF NOT EXISTS `cidade` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nome` varchar(255) NOT NULL, `estado_id` int(11) NOT NULL,…
-
5
votes3
answers1792
viewsA: How to create a solid mask from a semi-transparent Bitmap?
A possible solution: var Image, Mask : TBitmap; i,j,Color : LongWord; rowI, rowM : pRGBQuadArray; begin Color := $FF0000; Image := TBitmap.Create; Image.LoadFromFile('Yoshi.png'); Mask :=…
-
6
votes1
answer216
viewsA: Torrent link (Magnet) with counter
The link page would look like this: <?php $link = urlencode( 'magnet:?xt=urn:btih:ed4fad95b4cb' ); echo '<a href="contador.php?link='.$link.'">Clique para baixar</a>' ?> And the…
-
6
votes2
answers402
viewsA: "Variable system" with regular expressions
Recommended solution without regex: The following example merges two texts, one with the variables and the other with the templates. I think it is very easy to adapt for your use: <?php…
-
14
votes3
answers6487
viewsA: How to take ID from another table and INSERT into another?
First, the answer to: To get the ID of the last insert, just use the mysql_insert_id() $sqlinsert1 = mysql_query("INSERT INTO `destinos` VALUES('', '$destino')"); $id_destino = mysql_insert_id();…
-
86
votes2
answers17606
viewsA: Why use WHERE 1 = 1 in an SQL query?
This condition in principle does not appear to be right, because removing it gives in the same. However, when Where conditions are generated dynamically, and the programmer adds them with AND inside…
-
6
votes1
answer760
viewsA: How to apply css to body inside an iframe?
It’s not a pure CSS solution, but see if it works for your specific case. This first part in the definition of iframe allows transparency, but does not require it. <iframe…
-
2
votes4
answers1585
viewsA: How to make a "Generic Trigger" in SQL Server?
Not a solution for Rigger’s update, but maybe good for Criadoem: (can vary a little from SQL dialect to another, but almost all allow things like) When creating the table use: CREATE TABLE T (…
-
7
votes3
answers2818
viewsA: Check Mysql Connection Existence in PHP
The function mysql_ping returns FALSE if there is no connection, with the advantage of trying to reconnect before, if the connection has been lost in a script: mysql_ping ([…
-
3
votes2
answers2851
views -
6
votes4
answers5851
viewsA: How to order a Mysql search with date in d-m-Y format?
If the data is stored in string (char or varchar field), there may be no need for conversions just for sorting, so you can simply use substrings, which are quick to process: If you have separator on…
-
3
votes3
answers247
viewsA: Switch Result
I answered here what I had already put in a double question, and deleted from there. Well, what I notice (looking a little fast) is that when a person changes pages, there are no more variables of…
-
6
votes1
answer328
viewsA: Doubt about POST and GET in php
A possible solution would be to use this structure: Página PHP com o formulário | +- If cliente clicou em "buscar cep" | | | +- Include "buscacep.php" | Que busca o endereço do cep e substitui as…
-
3
votes3
answers2329
viewsA: CSS: Firefox and Chrome problem using padding
Add the font settings, and see if it’s at least the same on all browsers: #menu ul, #menu ul li {font-size: 15px; line-height: 20px}
-
6
votes2
answers240
viewsA: QUERY with no expected result, what might be missing?
Test like this: SELECT p.nome AS NOME, d.nome AS DEPENDENTE, c.valorAuxilio AS VALOR_AUXILIO FROM sca_pessoa p -- Mantive o left join, mas no exemplo dado nao vem ao caso. LEFT JOIN sca_dependente d…
-
5
votes2
answers230
viewsA: How to make a site that fits between 970px and 1300px
Basically adding min-width. .container-fluid { margin-left: auto; margin-right: auto; max-width: 1300px; min-width: 970px; } Consider using media-queries to meet other formats, if any, as in this…
-
3
votes2
answers177
viewsA: Problem with Case Sensitive
Basically, program the names and always write the same in both the source code and the files. The way, in your case, is to revise the code, and fix. If it’s a "desperate measure," which is really…
-
3
votes3
answers462
viewsA: My code does not abort form submission as it should
Just a few adjustments. See the changes: Added Ids in the two form inputs Change the getElementByName for getElementById, to individually return each element of our interest Added return true; no…
-
9
votes4
answers28928
viewsA: Calculator in php
Follow the code set at @lost’s suggestion, but using POST method and buttons. I tried to maintain the simplicity of the original, adding some small details to illustrate the use of value of Submit,…
-
2
votes1
answer319
viewsA: Recursivedirectoryiterator: failed to open dir: Too Many open files
This can be a limitation of the server the code is running on. Each OS allows a certain number of/Handles/sockets files. Usually this number is reduced when the server is virtualized. On a Linux…
-
3
votes3
answers2423
viewsA: Calculation of growth percentage
Solution to Visualize Monthly Growth: Follow a query to get the columns and the growth rate monthly (assuming that each line was a month). For larger or total periods, simply adapt the solution to…
-
4
votes2
answers725
viewsA: Is it possible to stream a video signal locally to a browser?
Depends on the driver of the video card, it can. Many drivers can work in an identical way to a webcam, so both Flash and HTML5 have access. Example of HTML5 video: <video autoplay id="vid"…
-
32
votes2
answers6682
viewsA: What would be the way to validate the CPF checker digits in a DB using only a SELECT?
Query for CPF digit calculation and validation I used Mysql as a base, but it’s relatively simple to adapt to other "dialects". Format-free base version, default SELECT id, nome, cpf, CONCAT(…
-
3
votes1
answer474
viewsA: Media queries for Internet Explorer 8 and 9
Some things to consider: IE9 has support for media-query, but you need to make sure to be in standards mode, namely, your <doctype> have to be correct, and the proper care with the html taken.…
-
16
votes2
answers27342
viewsA: Submit form with <a href=""> instead of <input="Submit">
Thus, only with javascript. The correct method is to use a button of the type <input type="submit">, one <button type="submit"> or a <input type="image">, the latter two have a…
-
5
votes2
answers94
viewsA: Background disappears when my menu items are horizontal
I noticed some problems: As you used display: inline, the float is not necessary, and how there is a <a>, the white color of <li> is having no effect. This css solves both problems:…
-
3
votes1
answer148
viewsA: E-mail Marketing
Just insert one table into the other, and change the background colors, to simulate the border: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"…
-
3
votes2
answers2326
viewsA: Find and replace before and after using an sql wildcard
This is a very simple task to solve using traditional functions. Here are two examples for two common dialects of SQL, but surely you can adapt to virtually any version and language. The secret lies…
-
8
votes3
answers982
viewsA: Operation in PHP. Multiplication using percentage
Version "short": <?php echo $i['sellingStatus'][0]['currentPrice'][0]['__value__'] * 3.2 ;> Explanation: Calculating 60% increment is the same thing as multiplying by 1.6. After all 100% = 1,…
-
15
votes2
answers17877
viewsA: What are the syntax of the for loop in java?
This is a loop mode equivalent to for ... each of other languages. As you suspected, it iterates the array arrayDeStrings, sequentially picking up each of its items and returning in novaString,…
-
5
votes1
answer79
viewsA: How to perform an action when replying to an email
The secret is in the subject line or email address used for sending, which contains a token that serves to identify the message. To implement such functionality on your own, you need to master…
-
8
votes2
answers2845
viewsA: @CSS font-face installs the font on the computer or just uses it on the website?
@font-face does not install the font in OS: Its statement is correct, so much so that the @font-face directive lowers the font for use in the browser, and has no relation to the operating system…
-
16
votes1
answer12693
viewsA: Which DPI is recommended for images used on websites?
Quick response: Whatever :) Relax, there’s an explanation! DPI stands for "Dots per Inch", or "Dots per inch". In the digital archive, this information is a mere number stored in metadata. The…
-
97
votes4
answers120536
viewsA: Regular expression to validate a field that accepts CPF or CNPJ
Solution: This solution validates these formats: 00000000000, 00000000000000, 000,000,000-00, 00,000,000/0000-00 and up to 000000000-00 or 00000000/0000-00, for example. The dots and dashes are…
-
8
votes2
answers211
viewsA: Displays hexadecimal value in cmd.exe
The printf is showing hexadecimal as you used "%x", which is just that! Show the hexadecimal value :) Just use this way in the case of your example: printf("%c" ,eh); Remember that in C++11 you can…
-
6
votes6
answers5717
viewsA: Disable Chrome Password Save in Javascript
This is a complementary and server-side response. I am posting as an additional option. Advantage of the method: it respects the user name autocomplete, and only protects the password. Using some…