Posts by Jorge B. • 11,427 points
255 posts
-
9
votes2
answers215
viewsQ: What are the alternatives for mcrypt_* functions?
The functions of the type mcrypt_* were discontinued in PHP 7.1.0 and removed in PHP 7.2.0 as shown in manual: Warning This Function was DEPRECATED in PHP 7.1.0, and REMOVED in PHP 7.2.0. I was…
-
1
votes3
answers141
viewsA: Result range
I don’t know if I understand the problem correctly, but I understand that every five minutes, no matter where the five-minute break starts, you can do it like this: SELECT * FROM tab1 WHERE MOD(…
-
2
votes2
answers105
viewsA: Grouping the largest ID per line does not take up correct values
There is another way beyond reply that @Bacco gave that is to use the IN: SELECT id_pessoas, id, id_empreitadas FROM tabela_1 WHERE id IN (SELECT MAX(id) AS id FROM tabela_1 GROUP BY id_pessoas);…
-
13
votes2
answers338
viewsQ: How to pass the value of a variable to uppercase or minuscule?
I have a script that gets a variable when running, for example: ./myscript OLA the content of myscript: #!/bin/bash if [ -z $1 ] then echo "Por favor escolha uma opção:" echo "OLA - Faz qualquer…
-
2
votes3
answers127
viewsQ: How to get dates with X days interval?
I have a field data in a table. And every day I will search: SELECT * FROM table WHERE DATE_ADD( data, INTERVAL 7 DAY ) = CURDATE( ) That is, if the date of the table + 7 days is equal to today.…
-
7
votes4
answers94
viewsA: How do I make the CSS class not affect anyone who has a particular class?
To do this just add the class dropdown-toggle of your tag <a> after the tag statement in css: a.dropdown-toggle See working: .navbar-solid { background-color: transparent !important;…
-
1
votes4
answers93
viewsA: Enable input type="file" when input type="checkbox" == true
From what I understand you want to hide this input file. For this you can use the attribute hidden. Without wanting to change your code too much in its form just add or remove the attribute hidden…
-
1
votes2
answers485
viewsA: Save txt file with windows encoding
For this it is enough that whenever you save something in the file you already go with the correct formatting, using the function iconv: <?php $dados = "Eu não conseguia guardar texto em formato…
-
3
votes2
answers388
viewsQ: How do replace in all fields except one?
I have a table with several fields, and I need to make a insert or replace on each line. I receive the data coming from a software and if it does not exist, I enter, otherwise I replace. I get a…
-
0
votes2
answers4117
viewsA: SQL how do I enter into a table that has FK?
You stated your problem in the question «id_endereco int (foreign key) There from another table, which is still empty» (before editing). If you want to use one id_endereco on insertion with value…
-
11
votes2
answers365
viewsQ: How can I force refresh after deploy?
I have a web application made in PHP, and I wanted to force that whenever I deploy a new version of the application the client is "obliged" to update everything that has changed, such as images,…
-
3
votes1
answer61
viewsQ: How can I manage Javascript bilbiotecas in my PHP project?
I have a PHP project and use commiserate to manage libraries such as Phpmailer for sending emails. To be able to use the installed libraries just include the autoload: require…
-
7
votes1
answer181
viewsQ: Is the "Row ID" equal to the primary key?
The function Insert of Android returns a row ID according to the documentation, the Row ID of the Newly inserted Row, or -1 if an error occurred To row ID corresponds to the primary key, ID, if…
-
3
votes2
answers78
viewsA: Search script does not return results or errors
Beyond what I said Everaldo you have to put the table prefixes in each field: $query = "SELECT C.id, C.card_name, C.monster_lrl, C.link_image, C.effect_description, C.card_atk, C.card_def,…
-
3
votes1
answer244
viewsQ: How do I know if a socket is "listening" on the server side?
When I use the function isConnected() of java.net.Socket, on the client’s side, and she returns to me true can I make sure the server is "listening"? How else can I know? Only with a waiting time…
-
1
votes1
answer3461
viewsQ: SMTP ERROR: Failed to connect to server: (0)
I’m using AWS Elastic Beanstalk and I can’t send mails with Phpmailer. On my local server it works right with exactly the same configuration. AWS Elastic Beanstalk uses Red Hat 4.8.3-9... I tried…
-
0
votes1
answer283
viewsA: How to redirect to a folder and HTTPS simultaneously?
I figured out a way to do on Soen that solved my problem, it’s not really an answer to what I asked, but it’s the solution of the problem, which is basically to use the lines that were suggested to…
-
3
votes1
answer283
viewsQ: How to redirect to a folder and HTTPS simultaneously?
I have a website http://meusite.pt which is a CNAME of http://minhamaquina.amazon.com, where the hosted site is. Only that I needed it to be redirected to the folder meusite from my Amazon machine,…
-
3
votes3
answers296
viewsA: How do prepare dynamic and generic with mysqli?
What you want to do is a bind_param with variable arguments, you can create a reference array and use callback call_user_func_array to associate the bind function to the parameter array: public…
-
5
votes4
answers130
viewsA: How to format this array?
You want something like that? <?php $array = array(); $id = "meu_id"; $nomes = ["Aluguel", "Água", "Contabilidade", "Energia", "Imposto", "IPTU", "Marketing" , "Telefone"]; $max = count( $nomes…
-
3
votes3
answers62
viewsA: Error with "Method"
The error is in the XML of the first button "Hang up": android:onClick="java.view.Tools (call_Desligar)" should be android:onClick="call_Desligar" If you analyze the error well it says everything:…
-
21
votes2
answers249
viewsQ: What is a Saas anyway?
I was reading this question What is cloud computing? and I was left wondering which line separates normal software from a Software as a Service (Saas). After all, what is a Saas? And what are the…
-
2
votes4
answers381
viewsA: Transform Multiple arrays into an array only
You can use the function array_walk_recursive: array_walk_recursive($array, function ($item, $key) { global $Characeristics; if (! is_array( $item ) ) $Characeristics[] = $item; }); $result = array(…
-
1
votes2
answers96
viewsA: Forms and Files
For this just make a search condition, if the product is equal to the searched then calculates the total of the price multiplied by the quantity: //... $produto = isset( $_POST["produto"] ) ?…
-
3
votes1
answer424
viewsA: Make <a> change href=" button with each new access on a given page
You can simply use the .htaccess so that whenever the link is clicked, the page passes the value to PHP: RewriteRule ^exemplo/([0-9]*)/$ index.php?contador=$1 [QSA,L] Then in the index.php just…
-
5
votes2
answers1014
viewsQ: How can we get the execution time of a script?
You’re reading the question here Compared to Datetime class, the date function is more performative? and did some tests with the answer by Daniel Omine, but I got results that didn’t seem at all…
-
2
votes1
answer67
viewsA: Click one button and make another appear
This is simple to do, just use the onClick of botao1 to make others appear? botao1.setOnClickListener( new OnClickListener( ) { @Override public void onClick( View v ) { botao1.setVisibility(…
-
3
votes2
answers126
viewsA: Release of exceptions as a function of prime number
It can even simplify a lot: public static boolean primo( int n ) { int contador = 0; for( int j = 1; j <= Math.sqrt( n ); j++ ) if( n % j == 0 ) if( ++contador == 2 ) return false; return true; }…
-
0
votes2
answers155
viewsA: Create PHP form using recovered result of an SQL query
You can do it in a simpler way, using the id of each product in an array of quantities: echo '<form action="#" method="post">'; while( $rows_usuarios = mysqli_fetch_assoc( $resultado_usuarios…
-
7
votes4
answers1052
viewsA: How do we know the date is the last day of the month?
A funnier way to do with the relative format 'last day of' ;) <?php function isLastDay($day) { return date( 'd', strtotime( $day ) ) == date( 'd', strtotime( 'last day of ' . date( 'M Y' ,…
-
0
votes1
answer113
viewsA: How to send images with two inputs file?
This is what you want? $file = $_FILES['img']; $thumb = $_FILES['thumb'];
-
4
votes3
answers4152
viewsA: PHP Parse error: syntax error, Unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING
Since you are already in PHP you don’t need to open again, you understand? The right thing would be: <a href='<?php if($dado['st_nome'] =="FINALIZADO") {echo…
-
1
votes2
answers497
viewsA: Conflict of types in function
Simple, you say the function list_new returns of type Lista and then it’s returning NULL: Lista* list_new (void) { return NULL; }…
-
8
votes3
answers8116
viewsA: How to join 2 tables in a select?
If I noticed correctly you want to join the two tables and then select all products by id_produto and add up the quantities, then it’ll be this: SELECT id_produto, SUM(qtd) as qtdTotal FROM ( SELECT…
-
1
votes1
answer30
viewsA: Field set_base NULL > SQL compliant
You must be doing something wrong in PHP, because it works right here example in sqlfiddle. CREATE TABLE IF NOT EXISTS `setores` ( `set_cod` int(10) NOT NULL AUTO_INCREMENT, `set_base` int(10) NOT…
-
6
votes1
answer1539
viewsA: Replace point by comma in Javascript
With the toLocaleString() Javascript can have this adapted depending on the locale: 22.33.toLocaleString(); /* depende do locale */ "22,33" Or use a default, for example: 22.33.toLocaleString('EN');…
-
2
votes1
answer122
viewsA: Effect on jQuery does not work with datepicker
It happens because you lose the focus in input, one of the solutions can be to make a focus: $('.data').datepicker({ 'autoclose': true, }).on('hide', function(e) {…
-
5
votes1
answer442
viewsA: effect on input using jQuery
That’s because your class select overlap, just add the color of the border on select:hover. .select:hover, .select:focus { border: 0 solid; border-bottom-width: 1px; border-color: #0091FF; } Now get…
-
3
votes1
answer183
viewsA: How do you call a function without waiting for it to end?
You can use the class Thread of PHP: <?php class segundoPlano extends Thread { public function __construct($sP) { $this->sP = $sP; } public function run() { //o teu código a executar; } }…
-
1
votes1
answer46
viewsQ: Is it possible to have interaction when updating my app?
How can I change sharedPreferences or add a folder at the time of my app update? I have a C app that I’m running on Android with the SDL library and every time I update the app the application files…
-
1
votes1
answer63
viewsA: Android: Listview custom this with error while simulating
Where do you have the layout activity_main? It’s the one that’s listed as "My Listview"? Is that if the listview is not in your layout activity_main when you do listaDePropostas = (ListView)…
-
1
votes1
answer934
viewsA: How to stop the Carousel bootstrap rotary
Just put the option wrap to false: $('.carousel').carousel({wrap: false}); You can see here working: $('.carousel').carousel({wrap: false}); html, body, .carousel, .carousel-inner, .carousel-inner…
twitter-bootstrapanswered Jorge B. 11,427 -
2
votes4
answers2422
viewsA: How to open a keyboard when you "focus" on an Edittext?
To show the keyboard you can do so: EditText editText = (EditText) findViewById(R.id.editText); editText.requestFocus();…
-
6
votes2
answers248
viewsQ: How can I make the Blur effect on IE?
I’m using this css code to do the effect blur in a div: .blur { -webkit-filter: blur(25px); -moz-filter: blur(25px); -o-filter: blur(25px); -ms-filter: blur(25px); filter: blur(25px); } <div…
-
6
votes3
answers3191
viewsQ: Should I use the «or die»?
I saw this question Display mysqli error using die and I got to thinking I should always wear the or die or is it just for those who are just beginning to see that it gave problem? $sql =…
-
2
votes1
answer55
viewsA: onFling conflict with onSingleTapUp in Gesturedetector
I solved the problem with a kind of gambiarra: @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY) { int pos = pointToPosition((int) e1.getX(), (int)…
-
1
votes1
answer405
views -
2
votes2
answers104
viewsQ: How to check with binary operations?
I have an application in which I separate the mistakes by crease, for example, system errors of 10-19, ie 10 slots for system errors, then have 20-29 login errors, etc. How can I make one if to know…
-
1
votes1
answer132
viewsQ: How do you make the iCloud dynamic background effect?
How can I do the effect of the login with the background as the iCloud when changing the size of the browser? If you repair the overshadowed objects change their position depending on the size of…
-
0
votes2
answers354
viewsA: Update command does not update table
<?php //PHP para ALTERAR OS DADOS NA TABELA ini_set( 'display_errors', true ); error_reporting( E_ALL ); $conexao = mysqli_connect("localhost","root","usbw"); if (!$conexao) die ("Erro de conexão…