Posts by Wallace Maxters • 102,340 points
1,984 posts
-
2
votes2
answers158
viewsA: Shadow outside the div
Maybe what you’re looking for is the box-shadow with the option inset. Behold: .caixa{ height: 150px; background-color: orange; margin: 10px 0; } .sombra{ box-shadow: 0 -45px 45px red inset; }…
cssanswered Wallace Maxters 102,340 -
4
votes1
answer4787
viewsA: How do I create a project in Gitlab using git?
I think you’re talking about sending a remote repository to an existing project. Local Repository of Zero I usually do like this: I create the project folder I start the local repository inside the…
-
8
votes1
answer4263
viewsQ: What is the difference between ASC or DESC in clustered indices?
When I’m going to create an index no clustered in SQL SERVER, appears in SSMS the option to choose if the option "Columns" is ASC or DESC, as shown below: It is usually used ASC or DESC for sorting…
-
2
votes2
answers69
viewsA: Lock button until Function is completed Angularjs
As a complement to Otto’s response, I suggest you use finally instead of then, because, if a failure occurs, the variable that indicates loading will be locked "forever". I would do so: <button…
angularjsanswered Wallace Maxters 102,340 -
11
votes2
answers271
viewsQ: What is a language builder?
In PHP, I have read and heard several times about Language Builders. The cases I’ve always heard of were in cases where it was said: "prefer to use X rather than Y, because Y is a function and X is…
-
0
votes2
answers124
viewsA: Httpresponse not returning anything
It’s because Python takes the block by indentation. Note that your return render is "on the same vertical line" as the if request.method == 'POST'. This will make your method add_user only return…
pythonanswered Wallace Maxters 102,340 -
3
votes2
answers2045
viewsA: Vue.js: How to format a value in a v-model?
v-model is for attribution only. You won’t be able to format the results the way you called them v-model="formatPrice(valorPrecoImovel)" because it is not an expression of attribution. What I…
vue.jsanswered Wallace Maxters 102,340 -
7
votes1
answer82
viewsA: How to pick variable and print several "<li>" according to the variable number?
For what you are wanting to do, I recommend using the for. Example: <?php for ($i = 1; $i <= $abas; $i++): ?> <li><?= $i ?></li> <?php endfor ?> The for is a…
-
2
votes1
answer148
viewsA: Assign Json content to the PHP variable
I think in your case you can use the list. list($a1_cod, $a1_nome, $tipo) = $retorno['CAMPOS'] The list will take each index (starting from the 0 and shall assign the values within CAMPOS. You could…
-
1
votes1
answer195
viewsQ: How to add dependencies in a module already initialized in Angularjs?
I usually use Angularjs with a structure where I have a Javascript script for each page of my application. Main dependencies and project settings I define in a file app.js, which is used on all…
-
1
votes1
answer517
viewsQ: Is there a command to list all foreign keys of a MYSQL table?
I would like to know how to list all existing Foreign Keys in a specific table. For example: usuarios [id, nome, nivel_id*, empresa_id*, cargo_id*] In the above case, list the fields empresa_id,…
mysqlasked Wallace Maxters 102,340 -
2
votes2
answers51
viewsQ: How to clone an object in Fabricjs?
In Fabricjs, through the function canvas.getActiveObject() it is possible to return the value of the currently active object. I would like to know if there is any way to clone this object and add it…
-
3
votes2
answers365
viewsA: How can I force refresh after deploy?
In a remote time, I even created a library to manage my scripts and style sheets added to the site. The main point that made me want to create the library was to have a parameter that I defined in…
-
1
votes1
answer209
viewsA: Save source of user traffic
However, I am not able to rescue this data by the value in the input (the data is always empty). Usually, when you open the page directly from the browser bar, the header is not generated…
-
6
votes3
answers5888
viewsA: Difference between the create and Fill method - Standard
The method fill means "fill in". It just fills in your Model information. The Fill used thus: $usuario = Usuario::first(); $usuario->fill(['nivel_id' => 1, 'nome' => 'Wallace']); It’s the…
-
1
votes2
answers87
viewsA: How to convert data in "September 18, 2018" format in PHP?
Simply use the class DateTime. new DateTime('September 18, 2018') Upshot: DateTime {#168 +"date": "2018-09-18 00:00:00.000000", +"timezone_type": 3, +"timezone": "America/Sao_Paulo", } If you like…
-
1
votes2
answers1033
viewsA: How to generate pagination links with limits?
I eventually decided to publish my own reply. I created a function to generate a range of numbers according to the limit passed. The logic is this: if I have 55 pages and I want to limit to 10. Will…
phpanswered Wallace Maxters 102,340 -
3
votes1
answer518
viewsQ: How to insert emoji character into a MYSQL TEXT field?
I have a text editor. In this text editor, you save the information in a table, using a column like MEDIUMTEXT. When I tried to insert an emoji, the following error appeared: Incorrect string value:…
-
1
votes1
answer197
viewsA: Compare SQL result using PHP
The mistake is that pg_query accepts not only one parameter, but two! You need to pass the resouce of the current connection as the first parameter. Example: $db = pg_connect("dbname=wallace");…
-
15
votes4
answers2051
viewsQ: Dropping indexes or Foreign Keys in a table can slow the query?
What I always read some tutorials talking about Mysql and I’ve also heard from some fellow programmers is that the lack of indexes or foreign keys in a table can make a query slow. For example, I…
-
2
votes1
answer845
viewsA: Error when exporting Excel using Maatwebsite / Laravel-Excel
There is often a 500 error followed by a blank page. Unfortunately, this Laravel excel generation library cannot behave very well when the amount of data generated is too large. I would suggest you…
-
3
votes1
answer455
viewsA: Django Session, emite: Object of type '' is not JSON serializable
I believe you can change to the following form: At the beginning of your script: from django.forms.models import model_to_dict In the part you saved in the session: request.session['student'] =…
-
1
votes3
answers137
viewsA: Text abbreviation <td> does not work
I usually leave a predefined class to do this. I think is the best way to work on CSS .text-limit{ white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } <div class="text-limit"…
-
0
votes1
answer52
viewsA: How to verify if a matrix contains a specific value?
Take off the [0]. Thus: const roles = tokenPayload.params.role.map(r => { return r.value; }); console.log(roles); The [0] is making you take the first value of the array generated by map. Look at…
-
1
votes1
answer48
viewsQ: "NOT IN" behavior affecting NULL column display
I have a table where I record purchases made by the site. I use a field called status_plataforma to receive the status of the Paypal transaction. This field, besides being able to receive an…
mysqlasked Wallace Maxters 102,340 -
4
votes2
answers115
viewsQ: How to read comments of a class, function or method?
I’ve seen some implementations in the Symfony and Laravel framework that allow you to define through comments routes in controller methods, or the Doctrine Models' Annotation definitions. Sort of…
-
30
votes3
answers5657
viewsQ: What is the LOCK TABLES command for?
These days I came across a snippet of an SQL that had the command LOCK TABLES. I had never seen this before and, as little as I could see, it seems to me that this would be to lock the table during…
mysqlasked Wallace Maxters 102,340 -
1
votes2
answers80
viewsA: How to use copy()?
This line here: $arquivo = $_FILES['arquivo']; $_FILES['arquivo'] is always a array containing the upload information. The function copy expects an entry with the origin and destination, and both…
phpanswered Wallace Maxters 102,340 -
11
votes1
answer118
viewsQ: What is Typedarray? What are the advantages of using them compared to the traditional Array?
I was reading on MDN about Typedarray and saw that various classes derive from this. Classes derived from TypeArray: Int8array Uint8array Uint8clampedarray Int16array Uint16array Int32array…
-
4
votes2
answers1213
viewsQ: Is there any way to connect Python to a Websocket as a client?
Modern browsers own the object Websocket, which allows you to make a connection to a Websocket server, allowing real-time communication. My question is this:: Is there any library, in Python, that…
-
0
votes2
answers53
viewsA: How to slideToggle() from div that was requested via ajax?
When the element is created after the DOM has been fully loaded, jQuery’s event delegation does not usually work. For events delegation of elements created dynamically, use the following code:…
-
1
votes2
answers304
viewsA: Sending data with ajax
Form data POST when they are sent to the server, they usually have formatting by default application/x-www-form-urlencoded. And, as its name suggests, the data is encoded as URL data. Characters…
-
5
votes1
answer137
viewsA: Css in all options except one
Thus? .select-user{ width: 200px; } .select-user > option[value^="2"]{ background-color: blue; color: white; } <select name="user" class="select-user"> <option…
-
3
votes2
answers934
viewsA: Identify if mouse scroll is rolling up or down
I believe the code below can help: var lastScrollTop = 0; window.addEventListener('scroll', function (e) { // mesma posição if (e.scrollY === lastScrollTop) return; console.log(this.scrollY <…
javascriptanswered Wallace Maxters 102,340 -
2
votes2
answers1570
viewsA: What is this __php_incomplete_class?
In addition to what has already been mentioned, it is important to remember that PHP returns an instance __php_incomplete_class when you call the function unserialize in a string that contains a…
phpanswered Wallace Maxters 102,340 -
6
votes1
answer390
viewsA: Object Serialization (serialize/unserialize)
I would like to know, for example, where I would apply this function in a real scenario? Jobs I use a lot to create Jobs, particularly an implementation of Laravel. It basically works like this: You…
phpanswered Wallace Maxters 102,340 -
0
votes1
answer545
viewsA: Should I use html.Raw in every application?
When I had accentuation problem in Asp Net MVC Views, I simply saved the specific files that were having this problem with encoding UTF-8 with GOOD. See a small example: Here at that link explains…
-
15
votes1
answer222
viewsQ: Can displaying many elements in the DOM impair performance?
I really like using libraries like Vue and AngularJs and my favorite implementation was to Infinite Scroll (or loading on demand). I mean, I initially upload 15 records via ajax. If the user scrolls…
-
3
votes1
answer110
viewsQ: Is it possible to make a Picker color with canvas?
With the addition of canvas in HTML5, several possibilities have emerged, such as creating small games or even a meme generator. With that, I wonder if through the canvas it would be possible to…
-
1
votes3
answers465
viewsA: Join arrays by equal keys, but separating values
I had tried to give a more elaborate answer, using sophisticated array functions, but nothing was easier than using the array itself foreach. Behold: $result = []; foreach ($arX as $key =>…
phpanswered Wallace Maxters 102,340 -
1
votes1
answer211
viewsA: file_exists returns False even if the file exists
It is usually used file_exists to test the existence of a physical file, not an http address. In your case, it seems to me that you are trying to check whether a file that is in a directory of your…
-
1
votes1
answer173
viewsA: I can not get the data of who is logged
You can use the View Composer to add a global variable, which all views of the Laravel will inherit. You need to define this in the method App\Providers\AppServiceProvider::register of its…
laravel-5answered Wallace Maxters 102,340 -
0
votes3
answers2206
viewsA: How to not return a None value in Python?
No need for you to use two if, you can use the else in place: def regras(x): if x < 100: if x % 2 == 0: return x else: return (x+x) v1 = list(map(regras,lista)) print(v1) If you want to ignore…
-
3
votes1
answer910
viewsA: Custom resize of a div
Well, the closest I could do was using the event mousemove. I detect if div .drag was triggered to increase the size of the textarea according to the position I am moving the mouse (up or down)…
-
2
votes2
answers133
viewsQ: How to set a variable in the configuration of a Virtual Host, to avoid repetition?
I always get upset when I see that my virtualhost ends up being configured this way: <VirtualHost :80> ServerName meusite.local ServerAlias www.meusite.local DocumentRoot…
-
4
votes2
answers465
viewsA: How to change the JSON serialization format of PHP Datetime?
I made a scheme similar to Anderson’s answer. But instead of implementing the JsonSerializable in the date class, I make for the entire collection. Thus: class CustomJsonSerialize implements…
-
4
votes2
answers465
viewsQ: How to change the JSON serialization format of PHP Datetime?
In PHP, when I use a json_encode on an object of the type DateTime, it displays the following result: $date = new DateTime(); echo json_encode(compact('date'), JSON_PRETTY_PRINT); Exit: { "date": {…
-
0
votes1
answer109
viewsA: Relationship count in Laravel 4
To be registered here on the site: to solve this situation, I had to use a somewhat astonishing idea. I did an almost manual implementation using some features present in the class…
-
1
votes1
answer279
viewsQ: How to get a Blob Answer with Angularjs?
I was reading in the MDN documentation that it is possible to get an answer Blob through ajax, according to the code below: var oReq = new XMLHttpRequest(); oReq.open("GET", "/myfile.png", true);…
-
7
votes3
answers1082
viewsA: How to style "broken image" (when image does not load)
Well, I don’t know if there’s any way to solve this just through CSS, but what I usually do is use the event onerror to capture when there is a failure when opening the image. thus:…