Posts by Leonardo • 9,130 points
332 posts
-
0
votes2
answers120
viewsA: Get the latest IDS
I don’t know if it’ll help because you’re working with XML, not posted if you’re working with him as string or turning it into array. I didn’t actually use the str_slipt, did otherwise. I took a…
-
5
votes7
answers10590
viewsA: How do I know if today’s date is Saturday or Sunday (weekend) in PHP?
<?php $domingo = mktime(0, 0, 0, 6, 19, 2016); // 19/6/2016 $sabado = mktime(0, 0, 0, 7, 2, 2016); // 2/7/2016 $sexta = mktime(0, 0, 0, 6, 24, 2016); // 24/6/2016 echo "Data 01 : " .…
-
0
votes2
answers241
viewsA: Ordering of all elements of a multidimensional array (array)
In the comments the method was cited asort(), but it sorts by value, in your case, how the sort is done by key so it should use the ksort(), which has the same goal, but orders by keys, would be…
-
1
votes3
answers399
viewsA: Check instance values of a php class
I have decided to answer because I disagree a little with the other answer, but I make it clear that it is not wrong either. But the ideal would be to validate the input data and have method to…
-
4
votes2
answers48
viewsA: PHP session after Load()
In php you need to start a new session before using session variables, so call: session_start(); Before using $_SESSION. If this is not the case then edit the question by placing the php file code…
-
3
votes1
answer63
viewsA: Inform or not the View inside the php controller?
I think that anyone who talks that is bullshit and that is reinventing the wheel has no knowledge on the subject, it is often better to work with a framework of its own that work vom more robust and…
-
0
votes1
answer84
viewsA: Why does PHP allow you to "declare" $this with Extract?
Why this permission is really something that also intrigued me, is not considered bug, because it does not affect the functioning of language. I tried to force one anyway bug or strange behavior,…
-
1
votes1
answer378
viewsA: Is it possible to take the name of a variable and use it as a string?
I didn’t quite understand the question, so I’m going by the title: You can take the name of a variable and use it as a string? Yes, it is possible, the easiest method to do this is by exploring the…
-
5
votes4
answers3142
views -
4
votes1
answer329
viewsQ: Create Splashscreen to show file copy progress
I’m trying to create a splashscreen because when my application is open I perform some time-consuming actions, such as: Copy files Run a . exe My Main is like this: import…
-
0
votes1
answer543
viewsQ: Take only equal elements in a matrix
I have a matrix for example: 1 4 7 1 3 4 6 7 1 2 3 4 5 6 I have to see the repeating numbers in ALL lines, in the example, the numbers should be the result: 1 and 4. For it is they who repeat in all…
-
2
votes1
answer61
viewsQ: Take all elements that meet a condition
I have some Vector: public static Vector<Integer> id = new Vector<Integer>(); public static Vector<String> nome = new Vector<String>(); public static Vector<String>…
-
1
votes2
answers78
views -
1
votes1
answer94
viewsA: PHP System to heal x user in x minutes
You can have an event in the database that every x and x time does some action for you, for example: Character table, with id, name and life. CREATE TABLE IF NOT EXISTS personagem ( id INT PRIMARY…
-
1
votes2
answers112
viewsA: $key starting with 1
It seems that 1 would be more in the display as it is putting in the table so using a +1 would solve the print. foreach ($dados as $key => $reg) { $newKey = $key +1; $table .= '<tr> <td…
-
1
votes1
answer64
viewsA: Time Comparison in Approach
I wouldn’t answer because I’m on my cell phone. But I decided to answer. You can use the class DateTime (recommended), or the time(): <?php $inicio = time(); #pega o tempo atual em segundos…
-
2
votes1
answer52
viewsA: Call PHP function when entering the page
Basically like this: I call the function when the page is requested. <?php myFunction(); function myFunction() { echo "Executou aqui!"; }
-
0
votes1
answer108
viewsQ: Error while trying to change column widths from Tableview
I have a method that increases and decreases the width of my table at the click of a button (it works perfectly): public void toggleTela() { if(this.tblAudiencias.getWidth() == 940) {…
-
6
votes3
answers1864
viewsA: Check if a date is earlier than another date
The right way is: $data1 = new DateTime( '2016-06-06' ); $data2 = new DateTime( '2016-06-15' ); echo ($data1 < $data2) ? "Está Ok!" : "Data de encerramento errada"; In the query you can use only…
-
1
votes1
answer56
viewsA: foreach with PHP for two strings
So it must be: $explodeR = explode(",",$jmTurmas->Respostas; $explodeQ = explode(",",$jmTurmas->Questoes); foreach($explodeQ as $exQkey => $exQ) { echo $exQ. " -…
-
0
votes1
answer1062
viewsA: visualg ladder break line
Stayed like this: Algoritmo "escada" Var p, x1, x, lin, col, degr: inteiro Inicio Escreva ("Quantidade de degraus: ") Leia (degr) degr:=degr + 1 Para lin de degr ate 0 passo -1 faca Para col de 1…
-
3
votes3
answers2952
viewsQ: What is the concept of GTK? Is it recommended to use it?
GTK is to 'create' desktop applications using PHP, I want to know how it works, is a modified browser, with its own server? I’m interested in doing something similar, something to turn development…
-
7
votes5
answers1744
viewsA: Difference between back-end and front-end?
It is probably an action performed on back-end, because filtering is usually done via SQL Query, then to perform operations in the database a language of back-end like the PHP. However this may vary…
-
4
votes2
answers8469
viewsA: How to call php in html and validate a form?
The code php is full of syntax error (mainly in echo). The correct (not so correct) would be: <html> <body> <?php $nome = $_POST["nome"]; $sobrenome = $_POST["sobrenome"]; $email =…
-
2
votes1
answer4323
viewsQ: Neural Networks and Artificial Intelligence in PHP?
I’m interested in creating smart software in PHP, but I don’t know where to start, for there is little material about it. What neural networks and artificial intelligence have in common or how they…
-
24
votes1
answer933
viewsQ: Why is the use of "break" considered bad?
In many places I have heard several comments about this, such as: "Professional programmer does not use break" "The code sucks when you see a break" Because the use of break is so frowned upon by…
-
8
votes2
answers972
viewsQ: Why only use Return, without returning any data?
Studying the code of a framework I came across the following code snippet: if (file_exists('lib/util/' . $className . '.php')) { include 'lib/util/' . $className . '.php'; return; } What is the…
-
2
votes1
answer25
viewsQ: Dependency installation adds extra dependencies
This is the first time I’ve tried to work with composer, the purpose is to use only the PHPUnit, because I no longer use any dependencies. By installing composer, with the composer.json having only…
-
8
votes5
answers993
viewsQ: What is the difference between referencing an attribute directly or by get/set
As an example I have a private String atributo, so I can have two ways of referencing the same, this internally in the class: this.atributo And also: this.getAtributo(); It’s correct to say it’s…
-
4
votes3
answers4243
viewsQ: How to check if return from Ajax is JSON or String?
My code is like this: sendAjax(new FormData(this), function(retorno) { if(retorno.isArray) { $(".erro-login strong").text("ID: " + retorno.id + " usuário: " + retorno.usuario);…
-
9
votes5
answers1956
viewsQ: Difference between JSON and String data
I’m just finishing building a website on PHP with architecture MVC, the next step is to integrate the application (I only have the interface) with the core(controller) site, to fetch information…
-
1
votes1
answer1578
views -
0
votes3
answers239
viewsQ: Pick up a single record for equal columns
I have an example table: produto | supermercado ---------------------------- 1 | 1 4 | 2 6 | 1 5 | 1 8 | 2 7 | 3 I want to get all existing supermarkets in this table, without picking up repeat…
-
2
votes2
answers124
viewsQ: Get more SQL-rated records
I have two tables: comentarios ---id ---comentario ---usuario ---supermercado ---avaliacao supermercado ---id ---nome ---endereco ---admin I want to take the average of ratings from each supermarket…
-
2
votes1
answer58
viewsQ: Function to send AJAX data?
I am trying to set up a function to send an ajax, the function should return my ajax result: var url = localStorage.getItem("site"); var dataForm = new FormData(this); $.ajax( { type: "POST", url:…
-
0
votes2
answers1117
viewsQ: Row complete the entire screen
I’m trying to make the following layout: ----------------------------------------------- Cabeçalho ----------------------------------------------- | | | | FORM | TEXTO | | | | |…
-
0
votes1
answer119
views -
0
votes1
answer92
viewsQ: What Structure/Role of a Web Service?
I have a project in which I should create a website and an application (Intel XDK) of the same, I thought it would be more ideal to have a 'core' of the application itself to make the database…
-
0
votes2
answers1646
viewsQ: Minimum height of screen size, with materialize?
I’m trying to make a screen of login simple in the MaterializeCSS, In it I have a logo, a panel with the login form and the footer, as it is little content, on some screens the page ends and below…
-
0
votes2
answers102
viewsA: Error trying to submit form with AJAX file
I got it this way: var dados = new FormData(this); $.ajax( { url: 'recebe.php', type: 'POST', data: dados, mimeType:"multipart/form-data", contentType: false, cache: false, processData:false,…
-
0
votes2
answers102
viewsQ: Error trying to submit form with AJAX file
I have the following code I implemented for testing before putting in my project: index php. <form method="post" id="formulario" enctype="multipart/form-data"> <input name="nome"…
-
1
votes2
answers83
viewsA: Screen to enter values
From what I understand you want to go putting data in the array and run your code, I used session variables to store the arrays even when the page is updated (they are only deleted when the browser…
-
1
votes1
answer770
viewsQ: Send form data by Ajax in MVC project
To begin I will illustrate a bit of the system for you, my directory structure is the following: >leganto(raiz) ---> controller -------> ControllerGlobal.php ------->…
-
0
votes3
answers1281
viewsA: Url friendly to MVC
In my case what worked was: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^([a-z]+)/?$ index.php?ato=$1 [NC] RewriteRule ^([a-z]+)/([a-z]+)/?$ index.php?objeto=$1&ato=$2 [NC]…
-
1
votes3
answers4276
viewsA: Display menu when right-clicking?
I used this library is simple, but it has some limitations (like the few icons): http://swisnl.github.io/jQuery-contextMenu/index.html…
-
3
votes2
answers2074
viewsQ: Add line in Jtable at the click of the button
I’m starting in creating interface in Java, an example I’m trying to do is to have a form with textField nome and email, and by clicking on the Enviar the data of those textField goes to my JTable,…
-
-3
votes2
answers827
viewsQ: What is the best way to persist data in an application?
In a company CRUD for example, we often find extensive forms, with many fields and probably the user will forget or fill out some(s) incorrectly, so by giving Submit in the form which is the best…
-
2
votes1
answer1770
viewsA: Generate UML diagrams from PHP code?
As @rray said, the Phpstorm has this feature, just select the folders or files that have classes in Project Explorer, right click on Diagrams select Show Diagrams, or select folders and press…
-
1
votes1
answer1770
viewsQ: Generate UML diagrams from PHP code?
There is some way, software, IDE that generates diagrams from PHP code, example, I have the project ready in PHP, so it takes my code and generates the diagrams. As IDE I use Phpstorm but I do not…
-
0
votes3
answers4276
viewsQ: Display menu when right-clicking?
I have a data table, where each row is a record. I want to do like Windows or One Drive/Outlook etc.. Right-clicking the table item opens a menu with the options "Delete" "Edit" and "Hide". I have…