Posts by Bacco • 93,720 points
1,184 posts
-
7
votes1
answer2867
viewsA: Backup all tables except one
The mysqldumphas a flag exactly for this: --ignore-table Example of use: mysqldump -u username -p database --ignore-table=meubanco.tabelaCorrupta > database.sql Remembering that, if necessary,…
-
2
votes1
answer416
viewsA: Service bar at the bottom of the page
Follow recipe ready (not optimized for browsers older): html,body { position:relative; padding:0; margin:0; min-width:100%; min-height:100% } #pagina { padding-bottom:60px; } #barra {…
-
5
votes2
answers3905
viewsA: How to delete all Cookies from a Javascript page?
The following are two responses withdrawn of Sozão. This: function deleteAllCookies() { var cookies = document.cookie.split(";"); for (var i = 0; i < cookies.length; i++) { var cookie =…
-
4
votes4
answers860
viewsA: Select with indefinite amount of conditions
One possibility with a more complete result is to use PHP to split your search into separate words, and generate the WHERE clause for you: <?php $pesquisa = 'carro verde amassado '; // Aqui você…
-
6
votes4
answers9003
viewsA: Invert a 3-digit number in C
For the exact conditions of the problem, just this: str[0] ^= str[2]; str[2] ^= str[0]; str[0] ^= str[2]; See working on IDEONE Inline version :) str[0] ^= str[2] ^= str[0] ^= str[2]; See working on…
-
6
votes2
answers3135
viewsA: How to add with jQuery data in a table?
Note that in both cases, I used the subtotal2 as a reference, but logic serves any field. I also removed the short PHP tags (<?=) , because they’re not portable, but it’s just a suggestion. The…
-
6
votes2
answers1687
viewsA: PHP mail() function
I think the question has a simple syntax error, because your HTML must be sending a lot of backslashes improperly. Probably this will solve: $texto_mensagem = ' <html> <head>…
-
3
votes1
answer139
viewsA: Regexp with only one letter
Just use a set: [xX\d] para 0 a 9 OU x [0-9xX] para 0 a 9 OU x [xX] para SOMENTE x Applying to your case: v=v.replace(/^(\d{4})([0-9x])/g,"$1-$2"); When you use sets in Regexp, is saying "any of…
-
5
votes4
answers1308
viewsA: I cannot concatenate variable in a query
Probably your code just needs this setting: $codigo = $cod[3]; Reason: if you have a URL in the format http://exemplo.com/usuario/perfil/39 the variable $_SERVER['REQUEST_URI']; will contain…
-
6
votes1
answer41
viewsA: How to set up a field using three others?
UPDATE tabela SET todosjuntos = CONCAT( estados, " ", cidades, " ", categoria ) WHERE todosjuntos = ""; But if you’re gonna spin the first time, you don’t even need the WHERE todosjuntos = ""…
-
7
votes2
answers1364
views -
3
votes2
answers426
views -
4
votes1
answer230
viewsA: How to search for multiple order independent terms?
Follow modification in your loop to mount the query: $search_term = filter_var( $_GET['s'], FILTER_SANITIZE_STRING ); $palavras = explode( ' ', $search_term ); $q = 'SELECT * FROM classificados…
-
23
votes4
answers28233
viewsA: How to know the highest value of an Array?
In JS this is very simple: Math.max.apply(null, meuArray ); Example of use: var meuArray= [0,12,13,2,1273,28,1]; var maior = Math.max.apply(null, meuArray ); document.getElementById( 'resultado'…
-
3
votes2
answers234
viewsA: How to make this SQL request with this particularity?
You need to do a routine that manages: SELECT * FROM imovel WHERE dormitorio >= 4 instead of IN. It doesn’t make any sense to use IN in this case. You can set the form options to 1,2,3 and 4, and…
-
10
votes3
answers14327
viewsA: Count amount of LI within a UL
First, a care: Instead of $( "li" ).length use $( ".rodapeUlCat li" ).length, to count the <li> only from the desired div. Maybe it’s the case that you even wear one id separated in each block…
-
10
votes10
answers360
viewsA: Organization of CSS
No, there’s no pattern. What should be considered is: for example, at the time of development, many authors prefer to leave everything separate to facilitate the location of the parts of interest…
-
6
votes2
answers2420
viewsA: Checking nearest branch of a zip code
First, you need to georeference your Zip Codes, and your units, with latitude and longitude. Some databases provide this data, for example, the ZIP CODE (there are other initiatives in this regard,…
-
11
votes3
answers1135
viewsA: How to make the first two numbers of a sequence Math.Andom are NOT EQUAL
Follows a solution using Fisher-Yates shuffle. This algorithm has the characteristic of not repeating the data, because it simply changes the position of the members. The algorithm is a very simple…
-
3
votes2
answers58
viewsA: "DD/MM/YYYY - HH:SS" for "milliseconds"
Just use the method getDate, or any of the events, such as changeDate, to recover in format Date, instead of taking the string formatted. Then just apply the .getTime():…
-
14
votes1
answer12581
viewsA: How to reverse engineer an android app?
Got some tools for that: The 7-Zip can be used to unzip the .apk; To leave converts files .dex in archives .jar; d2j-dex2jar.sh -f -o saida.jar entrada.apk (linux) d2j-dex2jar.bat -f -o saida.jar…
-
2
votes2
answers780
viewsA: How to add parameters in the html action?
"The order of the parameters does not change the product" :) The parameter pairs are separated by &, but in most applications, the order in which you present them is irrelevant. So, just use the…
-
5
votes1
answer860
viewsA: Saving hexadecimal data in the database
PHP already has its own functions for this: string hex2bin ( string $data ) that converts the string hehadecimal passed in parameter $data in a binary format, which can be stored in a BLOB in the…
-
8
votes3
answers4578
viewsA: Create a comic balloon-like div
Version CSS3 HTML <div class="balao">Oi!</div> CSS .balao { float:left; background-color:#39c; border-top:10px solid #39c; border-left:10px solid transparent; background-clip:…
-
3
votes3
answers261
viewsA: Mathematical combinatorics
I will use PHP as a base because of related question about number sum. If the ordering of the output does not have much problem, this one is a very efficient algorithm: <?php $len = 10; for( $i =…
-
5
votes3
answers1816
viewsA: Find sum of values in array
Optimized solution: I had posted a reasonable solution (can be seen in the edits history of the reply), but I ended up researching a little more about this type of combination, and I came to this…
-
4
votes2
answers290
viewsA: Center a Div between two others, one at each end
There are many ways to achieve this result. See a simple one: HTML <div class="barra"> <button class="l"><</button> <button>Confirmar</button>…
-
7
votes2
answers1201
viewsA: How to store information when leaving an application and recover in next use?
There are several ways to store application data on Android. These are the most common: Internal storage: to store private data on the device; Shared preferences: store data in keys => values;…
-
2
votes2
answers819
viewsA: Remove data from an array and insert into the table
To separate the items, you can do something like this: $tabela_p = array(); $tabela_s = array(); for each ( $array_dados as $item ) { if( strtoupper( $item{0} ) == 'P' ) { $tabela_p[] = substr(…
-
3
votes2
answers905
viewsA: Google Maps with file_get_contents error. What can it be?
Here is a version with Curl: <?php $key = "AIzaSyCfYKBdv9RFbsHaRuUu7Pf5Ft8CrQ0wHQo"; $address = urlencode( $linha['ENDERECO_TIPO'].' '. $linha['ENDERECO'].', '. $linha['NUMERO'].', Bairro '.…
-
1
votes3
answers615
viewsA: Save file name with empty spaces html/php
First, decide which is the Content-Type desired, you have 3 headers with Content-Type, and must have only one. Since your file name is already encoded, you can take urlencode from the $file:…
-
2
votes4
answers1530
viewsA: Problem with sorting in Postgresql
The ideal is to specify the encoding and the collation when creating the database, so that future tables stay the way you want them to be: CREATE DATABASE name ENCODING 'UTF8 LC_COLLATE 'pt_BR' A…
-
19
votes2
answers929
viewsA: Operator " | " in Java
The Operator || is the "or" operator for logical operations ("boolean" or "bulian"): if(foo == 'a' || foo == 'b') Is the same as saying foo = a or foo = b, that is, any of the results being true,…
-
6
votes2
answers215
viewsA: Data overwritten when logging file accesses
Change the way of fopen for a (append): $fp = fopen($arquivo, 'a+'); see the difference between the flags of fopen in the PHP manual (highlighted the key points): w+ Opens for reading and writing;…
-
5
votes4
answers2051
viewsA: Leave last 12 records and delete the rest in PHP/Mysql
This is a very simplified solution, without Queries assuming the order of ids either temporal: // primeiro pegamos os 12 ids mais recentes, do maior pro menor $query = $pdo->prepare( 'SELECT id…
-
8
votes1
answer883
viewsA: How to make a page to know Ipv6?
What defines the address is the connection The variable $_SERVER["REMOTE_ADDR"]; shows both Ipv4 and Ipv6. It only depends on how the server network is configured, and how the client accessed their…
-
5
votes3
answers3063
viewsA: Put site path in a PHP include
If you want to run a remote PHP in your code: Attention: this is a danger, for a number of reasons, but there it goes: To make a include "for real" with PHP, the directive allow_url_include needs to…
-
4
votes1
answer2075
viewsA: How to use Tfdjsondatasets in Delphi XE4?
Tfdjsondatasets was introduced in XE6, unfortunately there is no way to use in XE4. maybe the path is an Fdmemtable instead. There is a tutorial XE5 that might suit XE4. Here’s a example using…
-
1
votes2
answers431
viewsA: Alert by email such a day
In the specific case of the body of the question, @Sergio’s answer is the ideal solution. I am posting this alternative only to future users who eventually need to repetitive tasks, but with little…
-
3
votes1
answer1501
viewsA: How to delete all files from a folder using VB Shell
First, this is a CMD (command line) question, as the language used to call the CMD is irrelevant to the question in question. Second, we can not assume that Chrome will be on disk C: So the right…
-
6
votes1
answer125
viewsA: Problems with captcha and variable email
I refactored your code, making a more linear logic to at least see if you can better visualize where you are having problems. Anyway, you don’t pay attention to all the recommendations and keep…
-
5
votes1
answer657
viewsA: How to determine the direction of the touchmove
To know the difference horizontally and vertically, you should work on the X and Y axes. This would be so if we were to use the logic of your code. var ts_x; var ts_y; $(document).bind('touchstart',…
-
3
votes1
answer970
viewsA: Setting a margin in a background image
It’s not quite what you’re asking for, because the CSS is very limited in that respect, but if you have control over the padding of the element, and it is the same as the content of the <div>,…
-
14
votes2
answers13934
viewsA: What is a complete NP problem?
P, NP and NP-complete problems: The problem P is a decision problem (i.e., the answer may be sim or não), that might be solved polynomial-time. The problem NP (Non-deterministic Polynomial time),…
-
3
votes2
answers2789
viewsA: Display Mysql PHP errors correctly
What is happening is that on the current server the CPF column is with unique, so Mysql is not letting you enter the data. If you remove the unique of the index, your if test original will work. If…
-
4
votes2
answers1770
viewsA: random background-color on div without the same color repeating twice consecutively
If you want to switch colors between the divs, it is easier to create a function: <?php function corAleatoria() { static $corAnterior = 0; static $cor = array( '#CFF', '#9FF', '#600', '#FF0',…
-
5
votes1
answer435
viewsA: Place line-height of same font-size size
Although browsers tend to have a behavior considered standard, the specification of line-height says that the parameter normal recommended is to 1.0 to 1.2, that is, it can vary from browser to…
-
20
votes3
answers17170
viewsA: How to generate numerical sequences in SQL without creating tables?
In these cases, a performatic solution is to use generators. The initial solution works on virtually any DBMS with SQL support. See more at the end of the answer solutions optimized for specific…
-
4
votes3
answers1627
viewsA: How do you set zero or null in an SQL query of a date range, for those whose value does not exist?
You can use a generator of dates not to need intermediate tables: SELECT DATE_ADD( '2014-01-01', INTERVAL d1+d2*10+d3*100 DAY ) AS diaDoAno FROM ( SELECT 0 AS d1 UNION SELECT 1 UNION SELECT 2 UNION…
-
19
votes8
answers481
viewsA: I can’t learn syntax for
Syntax of the for: for( INICIALIZACAO; CONDICAO para executar o CODIGO entre { }; tarefa para fazer depois de cada execucao do CODIGO ) { CODIGO a ser executado repetidas vezes, enquanto a CONDICAO…