Posts by Wallace Maxters • 102,340 points
1,984 posts
-
9
votes1
answer1959
viewsA: Jquery code $ accuses that is not set
This problem may be caused by some factors: Order in which scripts are included. If you put the javascript that uses jQuery before the jQuery inclusion, jQuery will not have been loaded, causing…
jqueryanswered Wallace Maxters 102,340 -
2
votes2
answers107
viewsA: How to use template in directives with restrict M (comments)?
As a complement to Onosendai’s reply, I would like to add that by adding the property replace: true, the Directives with restriction M start working with template. Behold: angular.module('example',…
-
0
votes2
answers107
viewsQ: How to use template in directives with restrict M (comments)?
I’m trying to use the option restrict with the value 'M' (for the angular work through comments) to create a directive. However the comment is not incorporating the value I am adding into template.…
-
31
votes6
answers7015
viewsQ: How to get unique values in a Javascript array?
In PHP, when I have one array with duplicated values, it is possible to obtain only unique values through the function array_unique. Example: $array = ['a', 'b', 'b', 'c', 'c'];…
-
2
votes3
answers899
viewsA: Best syntax for PHP function names
As previously stated by William: there is no correct one. There is a recommendation, which is well demonstrated in PSR-2 - an encoding style. I agree with the part that William explains about "if…
-
5
votes1
answer3064
viewsA: Send form data by array to PHP
Use array_filter so that php only brings data that is not empty. $names = array_filter($_POST['names']); foreach ($names as $key => $value) { } See working on IDEONE The function array_filter…
-
2
votes2
answers305
viewsQ: How to make an ngRepeat without a parent element?
I’m using Angular with Admin LTE. I need to make a ng-repeat where the li within a ul will repeat. I cannot repeat the ul, but only the li within that ul. I can’t encompass those either li with a…
-
3
votes1
answer74
viewsA: Deleting content with Jquery
Your code has an error. You should not use $('<li>'), and yes $('li'). When you use $('<li>'), you are telling jQuery to create a new tag of the type li. In your case, if you want to…
-
7
votes1
answer4730
viewsQ: When to use the term "url" or "link"?
These days I started a "little debate" here in IT on this subject. I realized that several functions, where we returned the image path (to the browser), was named getImageLink. For example: public…
terminologyasked Wallace Maxters 102,340 -
1
votes3
answers395
viewsA: How to specify directory where Bower will place dependencies?
I think the forms presented above are good, but if you have the need to manage your dependencies by specifying the folders, but each of them staying in a specific folder according to the type of…
boweranswered Wallace Maxters 102,340 -
2
votes1
answer89
viewsA: Navigate specific value in PHP Array
I believe you can use a foreach this way: foreach($data['data']['carges'] as $key => $value) { echo $value['charge_id']; }
-
7
votes2
answers299
viewsQ: Compared to Datetime class, is the date function more performative?
It is very common to read some tutorials or articles saying that programming Object Oriented can cost more (I speak in relation to memory). Since I started programming, there’s that little itch in…
-
15
votes2
answers3404
viewsQ: What is the purpose of the third Addeventlistener parameter?
When I want to add one listener of any event in Javascript use the addEventListener. document.addEventListener('click', function (e) { alert('clicked'); }) But I realized that, in some codes, a…
javascriptasked Wallace Maxters 102,340 -
4
votes1
answer1467
viewsA: CSS and JS files in Laravel
Maybe the problem is in the folder you are installing. If you are inside the folder vendor of your project and run the command bower install jquery, it will install inside the folder vendor. The…
-
0
votes3
answers1906
viewsA: How to find the Laravel base url?
In version 4 of Laravel, it is possible to do this using the method URL::to(), but it is necessary to put a bar or an empty string as parameter. $base = URL::to(''); // ou $base = URL::to('/') This…
-
2
votes3
answers1906
viewsQ: How to find the Laravel base url?
I remember that when I used the Codeigniter framework, I could find out what the base url of the application was by simply calling base_url(). On Laravel 3, I wore URL::base(). But now, on the…
-
0
votes1
answer573
viewsQ: How to install Laravel 5 without using Composer?
Is there any way to install Laravel 5 without using Composer? I think version 4 had a form where I didn’t need Composer, but it seems that 5 is now "more dependent on Composer".
-
3
votes1
answer2023
viewsQ: What’s the point of a Cope on the Laravel?
I saw in the documentation of Laravel an explanation about the use of Eloquent. There I saw a part where he talks about Local and Global Scopes. As I do not know much English, I was left with some…
-
0
votes1
answer353
viewsA: Is there any way to render a Laravel view to a string?
In Laravel, the View implements a method called __toString. With it it is possible to obtain a string from an object when you cast a string. Then change your code to: $view = (string) view('hello');…
-
0
votes1
answer353
viewsQ: Is there any way to render a Laravel view to a string?
I wonder if there is any way to save the return of a view on Laravel in a string. Usually we return to view to "print" the result of an action on the page: function getIndex() { return…
-
4
votes2
answers3070
viewsQ: How to see the queries that were executed by the eloquent in Laravel?
How can I find out which queries were executed in Laravel? For example, I have the following query: $usuarios = Usuario::with('nivel')->where(['status' => 1])->get(); I would like to know…
-
40
votes2
answers4961
viewsQ: How to use such semantic tags?
Since the release of HTML5, I have noticed that several different tags have started to "emerge". Everywhere I tried to study on the subject, I always saw the expression "semantics". I understood…
-
25
votes2
answers1936
viewsQ: What do "n" means, numbers and signals on the "Nth-Child" or "Nth-last-Child" selectors?
I’ve always used the n combined with the selector nth-child or nth-last-child in CSS, but I still can’t quite understand its meaning. For example: p:nth-child(3n+0) { background: red; }…
css3asked Wallace Maxters 102,340 -
9
votes1
answer5066
viewsA: how to use last-Child for the penultimate as well?
If you want to capture the last and the penultimate element, use nth-last-child(-n+2): ul.test li { padding:10px; background-color: pink; list-style:none; } ul.test li:nth-last-child(-n+2) {…
-
4
votes1
answer567
viewsQ: How to convert array keys to all uppercase or lowercase?
I’m getting some data from a Webservice, through a JSON response. Convert this data from JSON to array, through json_decode. But one thing that’s bothering me is the fact the keys are coming with…
-
0
votes2
answers2074
viewsA: change png image to jpg with php
As a complement to the answer, I suggest you use a library that facilitates the image processing process. The PHP GD library, as quoted in one of the answers, is very good. But I believe that if you…
phpanswered Wallace Maxters 102,340 -
3
votes3
answers1281
viewsQ: How can I restrict downloading files through PHP authentication?
I have a system where the user can upload audios. The user level that can do this is the client. But on the other hand, I have the people who can download these files to do the audio transcription.…
-
2
votes3
answers1027
viewsQ: How to find out how long an audio is in PHP?
I have a system where the user uploads an audio file. I need to save in the database some information from this audio file such as the size of the disk file and the duration. These files can be in…
-
3
votes3
answers112
viewsQ: How can I specify a "Transition" value to be animated when using "Transform"?
IN THE css, we can use the property transition to define a transition effect when some of the properties of an element are changed. Example: .box{ transition: all 1s linear; background-color:…
-
3
votes2
answers2862
viewsA: Is it possible to create a title for the "select" tag without it being part of the options?
You can define a select, having a first option marked as disabled and selected at the same time. Behold: Simplest way <select> <option disabled selected>Cars</option>…
-
4
votes2
answers230
viewsQ: Direct cast or cast functions. What is the best option?
In PHP, I realize that it is possible to do some things in countless ways. One of them that comes to my attention is the functions and functionalities related to the conversion of types. It is…
-
2
votes2
answers323
viewsA: Variable loses value after leaving Promisse
In fact, the execution is happening at different times. Looking through your code, that’s what gives to understand. The variable does have the value of doc, but you’re giving the console.log outside…
-
1
votes1
answer251
viewsQ: How to perform a callback after an "ng-show" or "ng-Hide"?
I’m using the angular along with the ngAnimate. With the ngAnimate it is possible to add some css classes to the element it applies to ng-hideor ng-show to apply a transition animation. I need to…
-
2
votes1
answer44
viewsA: Instance declared in variable that then receives a new value
It is correct to do this, can cause some kind of problem? Well, I guess that depends a lot on your opinion, but if you want to hear mine, then here goes. But at first, it’s fine. You’re just…
-
2
votes5
answers7434
viewsA: removing part of a string with php
Use the strrpos to detect the latter / of the url and, with substr, extract the desired part: $url = 'https://www.youtube.com/embed/z1n34sRv1-A'; substr($url, strrpos($url, '/') + 1) The function…
phpanswered Wallace Maxters 102,340 -
3
votes2
answers615
viewsA: How to find out if an array is multidimensional or not in PHP?
A possible technique would be using count to count the values of array and then compare with count using the second parameter COUNT_RECURSIVE. Only this method has a flaw. If the array have empty,…
-
0
votes2
answers615
viewsQ: How to find out if an array is multidimensional or not in PHP?
I have these two arrays down below: $a = [1, 2, 3]; $b = [1,[2, [3, 4]]]; I know that $a is a array one-dimensional, and $b, multidimensional (array of arrays). Now, how could I discover, through a…
-
2
votes1
answer654
viewsQ: How can I find out the http request method from PHP?
I know that every http request made, whether by browser or other resource, sends a certain method (GET, POST, PUT, DELETE and etc.). I’m thinking about building a Restful application with PHP, but I…
-
2
votes2
answers475
viewsA: Angular locking GET form Submit
For the response of Vanderlei, we concluded that, the problem was the lack of action in the form, where a data submission to the server was desired. In fact, you can use the form without the action…
angularjsanswered Wallace Maxters 102,340 -
0
votes0
answers93
viewsQ: Cannot Destroy the zip context
What causes this mistake? I have a code where I create a Zip through the class ZipArchive. I read a certain directory and take all the image files present in it. I add it in the ZIP and, at the end,…
-
4
votes1
answer2009
viewsQ: Is there any way to validate an input in Angularjs without using form?
I have a input which I wish to validate via Angularjs. However, this input is not within a form. So, when trying to access the form validation information, I was unsuccessful: <div…
-
8
votes5
answers1240
viewsQ: How to split a string into specific Javascript sizes?
I need to share a string in specific Javascript size. I know it’s possible to use the Join to transform a string in a array letter: 'hello'.split('') However, I need a way where I can determine the…
-
0
votes1
answer854
viewsA: Laravel Undefined column: 7 ERROR: column "1" does not exist
Use of DB::Raw() The class JoinClause (used internally within the Closure, that you called in join, by Laravel) by default expects value with the name of the fields of the related tables. To use a…
-
2
votes2
answers2461
viewsA: Generate random password
I would use the Math.random combined with the toString(36) Math.random().toString(36).substring(0, 7) Parameter 36 passed to toString, shall be an integer between 2 and 36 specifying the basis used…
node.jsanswered Wallace Maxters 102,340 -
0
votes3
answers145
viewsA: Blade default value Laravel 5.2
I believe that the solution presented and marked as accepted will generate a lot of unnecessary code if you want to do this in several lines. Instead, why not use the operator ?: PHP? I believe that…
-
5
votes1
answer399
viewsQ: Is there any way to define a max-height of an element equal to the window size, with pure CSS?
I have a sidebar, which can contain n items in a listing. My sidebar’s kind of like this: In my source code, I defined the following css to work: .sidebar { max-height: 400px; overflow-y: auto; }…
-
3
votes3
answers107
viewsA: validation of superglobal
Looking closely at the question, it seems you want to use a class to apply upload operations. I would recommend you in such cases really not use the $_FILES within the class. Also because, to that…
-
3
votes3
answers93
viewsA: Error in declarations with Array
Two problems, but the main problem is: "What is the version of your PHP?" Empty and arbitrary expressions The empty only accepts arbritarias expressions from version 5.5 of PHP. In PHP 5.5 or higher…
-
8
votes7
answers52205
viewsA: Is there a way to print everything without breaking the line?
In fact, the context of the question seems not to be something to be widely used in day-to-day programming. It doesn’t make much sense for you to want to print letter by letter with the print, if…
pythonanswered Wallace Maxters 102,340 -
3
votes3
answers31234
viewsA: How to print skipping lines (each variable in a row)?
I believe you can use multiples print. In my opinion, it facilitates understanding of your code: #Define as variáveis de jeito mais organizado nome, idade = ("Wallace", 26) print "Nome: " + nome…
pythonanswered Wallace Maxters 102,340