Posts by Diego Souza • 16,524 points
642 posts
-
0
votes0
answers34
viewsQ: How do I email attachment to Moodle?
I’m trying to do this way, but the attachment is not sent, only the email. $fileName = 'Arquivo'.date('d-m-Y H-i').'.xlsx'; $directory = $_SERVER['DOCUMENT_ROOT'].'/local/plugin/exports/'.$fileName;…
-
0
votes0
answers47
viewsQ: How to create a loading without AJAX
I have a download button that makes a GET request that makes a Download. It all happens on the same page, but without AJAX. Not using the tag download. Is using the Laravel that internally makes the…
-
0
votes1
answer51
viewsA: Ionic - Problems Pulling Data from PHP Database
Use this property: [innerHTML] <div [innerHTML]="dados[0].conteudo"></div>
-
0
votes3
answers5349
viewsA: Python3: How to calculate the number of working days between two dates?
You can use this library. from datetime import date from = date(2008, 8, 18) to = date(2008, 9, 26) delta = from - to print delta.days
python-3.xanswered Diego Souza 16,524 -
2
votes2
answers225
viewsQ: Make a Relationship Many for Many
I am trying to put in a view the amount of students enrolled in a course using the following Models below. NOTE: I cannot change the columns of the Models, since the database already exists and I am…
-
1
votes1
answer354
viewsA: Inner Join ORM Django
Error corrected. As noted above, Django automatically sets the name of the Foreign Key column. It turns out that the database already exists and I’m making a system from it. So I can’t follow…
-
0
votes1
answer354
viewsQ: Inner Join ORM Django
I have 2 models: class MdlCourse(models.Model): id = models.BigAutoField(primary_key=True) category = models.ForeignKey(MdlCourseCategories, on_delete=models.CASCADE) sortorder =…
-
0
votes1
answer247
viewsQ: Create date condition in UNIX format Timestamp - Django
I have a table in the database that the date fields are of type Biginteger, in which receives a date in Timestamp format. How do I make one SELECT in the table with the following conditions: SELECT…
-
2
votes1
answer616
viewsA: ORDERBY, ignore accents
No need to specify ASC, because by default it’s already like that. Just need to specify the DESC. $collection = \App\Producer_BVU::orderBy('name')->get(); Alternative function for sorting:…
-
2
votes2
answers528
viewsQ: How to call class method in another app?
I want to create a file called config.py and put some settings inside a dictionary for whenever you need to invoke these parameters. But how I call this parameter in Python? For example, I will…
-
0
votes1
answer110
viewsA: HTML/CSS responsiveness
The person responsible for this is the property arrows, must be true when it is of certain size. You specify. $('.responsive').slick({ dots: true, infinite: false, speed: 300, slidesToShow: 4,…
htmlanswered Diego Souza 16,524 -
3
votes1
answer262
viewsQ: Project Structure in Django
I installed Django in a project and would like to make the folder structure somewhat similar to Laravel. I can organize myself better this way. But I don’t know if it’s possible using such a…
-
3
votes3
answers924
viewsA: Can you start a Select (SQL) in the middle of the data table?
Using LIMIT and OFFSET Show 10 records starting from the first: SELECT * FROM TABELA LIMIT 0, 10 Show 10 records starting from tenth: SELECT * FROM TABELA LIMIT 10, 10 Show 32 records starting from…
-
2
votes3
answers293
viewsA: Change the color of a button by comparing 2 attributes of a list with Jquery
I usually put the ID on the line. So I can have more control over the DOM. Whereas if you put the ID in a Hidden field, it takes a lot of manual work to treat the DOM. See that on the TR of each…
jqueryanswered Diego Souza 16,524 -
1
votes3
answers1015
viewsA: Remove style added with . css() Function with jQuery
Leave transparent can solve the problem. $(document).ready(function(){ $('ul > li').on('click', function(){ var cor = $(this).data('cor'); var body = $('body'); body.css('background-color', cor);…
-
6
votes1
answer500
viewsQ: Pure CSS for circle progress
I’m trying to make a circle of progress, but I’m not making it. I want it exactly this way. I want a black circle. A gray border smaller than that circle, like 5px less. A circle that is progress. I…
cssasked Diego Souza 16,524 -
3
votes3
answers1329
viewsA: Select data with Between in Varchar format
Gambiarra SELECT * FROM caixa WHERE DATE_FORMAT ( DATA, '%Y-%m-%d %H:%i:%s') BETWEEN '2017-05-01 00:00:00' AND '2017-05-31 23:59:59' The Right Change the field type for a date field. You have…
-
0
votes1
answer203
viewsA: Modify TAG Html inside an IFRAME with Javascript
You can use the contentWindow or contentDocument. var x = document.getElementById("player_externo"); var y = (x.contentWindow || x.contentDocument); if (y.document)y = y.document; var download =…
-
2
votes4
answers281
viewsA: CSS - How to manipulate Div’s?
Lacked a clear:both in the div #maior #total { background-color:red; width:300px; height:400px; } #pequeno { background-color:yellow; float:right; width:50px; height:60px; } #maior {…
-
1
votes3
answers5329
viewsA: How to Remove Header and Footer with @media print CSS?
Creates a class within a @media print and put this class on all the elements you want to delete at the time of printing. @media print { .no-print{ display: none; } } <a href="#"…
cssanswered Diego Souza 16,524 -
2
votes0
answers54
viewsQ: Push Sending arriving frantically or not enough
I have a system that sends notifications pushs to devices that have an app installed. Specifically on iOS is coming several times (30 and more) the same push. On Android is happening the following…
-
2
votes2
answers981
viewsQ: How to access relationship attributes in Laravel?
In the image below we see a typical example of Collection in Laravel. We may see in Relations there is another Collection. How do I access this in the View? I’m doing so in Controller: $users =…
laravelasked Diego Souza 16,524 -
1
votes0
answers36
viewsQ: What would be the equivalent of delegating to the JS?
When an element is created dynamically by JS and this element needs to perform a function I do so in jQuery: $(document).on('click', 'button#doLogin', function(){ }); How is it in the pure JS ?…
-
1
votes1
answer1054
viewsQ: How to optimize this query in Mysql that is too slow?
I’m doing a simple query on LMS Moodle to get the amount of hits from all users. SELECT count(userid) as total, action, userid FROM mdl_logstore_standard_log log WHERE action = 'loggedin' GROUP BY…
-
4
votes2
answers81
viewsA: Step made with css
div{ font-size: 0; display: inline-block; } .ground{ padding: 0; margin: 0; width: 40%; height: 20px; background-color: #000; position: relative; vertical-align: bottom; } .footer{ width: 60%;…
cssanswered Diego Souza 16,524 -
0
votes2
answers1954
viewsA: Relationship with 3 tables in Standard
I believe this will not work. You can use the whereHas in place of with. $not_faculdade = Noticia::with(['foto' => function($query){ $query->get()->first(); }]) ->whereHas('unidade',…
-
1
votes1
answer302
viewsA: Redirect page through a select php
You can do it using Javascript. Creates a function in the onChange passing as parameter the chosen value. It will call the function and send to a page with due value as parameter. function…
phpanswered Diego Souza 16,524 -
0
votes1
answer73
viewsA: Laravel not saved POPUP session
The use of the intended. if(Auth::attempt($credentials)){ return redirect()->intended('/painel'); }
-
0
votes1
answer73
viewsQ: Laravel not saved POPUP session
On my page you have 3 login options: E-mail, Facebook and Google. When I log in by email - using Auth::attempt() - everything goes well. In this case I log in for a fancybox and not for a popup.…
-
2
votes1
answer639
viewsQ: Group data with Ngfor and Groupby
Before in Angular 1 when I wanted to make a grouping of data I did so: ng-repeat="(key, value) in me | groupBy: 'role_id'" In my object me had a list of users with a field role_id different. Then I…
-
1
votes1
answer268
viewsQ: Domain forwarding in file . htaccess
I have a domain like this: https://www.dominio.com, that always has to access this way. So I need to do some redirects. These are the ones: Of: (http) www.dominio.com.br (http) www.dominio.com…
htaccessasked Diego Souza 16,524 -
0
votes2
answers189
viewsA: Laravel 5.1 problem with csrf_token
Log in VerifyCsrfToken.php inside App/HTTP/Middleware and in the array $except add the route in which you do not want to check the token. protected $except = [ 'route'/ ];…
-
0
votes2
answers452
viewsA: How to make an if/Else within a route?
Create a Middleware. Open the Command Prompt, go to the folder of your project and type: php artisan make:middleware CheckRoleUser Register this Middleware on App/Http/Kernel.php in $routeMiddleware…
-
1
votes2
answers96
viewsA: How to check if last item was registered today?
I would do so: SELECT * FROM myTable WHERE strftime ('%Y-%m-%d', created_at) = strftime ('%Y-%m-%d', 'now') ORDER BY created_at DESC LIMIT 1 Using the STRFTIME(Format, Field) to format the date. If…
sqliteanswered Diego Souza 16,524 -
-1
votes2
answers962
viewsA: CSS problem, does not work
li ul The above command is not sequence, so if you do this will not work at all. It would be right: ul li Because in the HTML that’s how it is: <ul> <li> 1 </li> <li> 1…
-
3
votes2
answers145
viewsA: Laravel Blade (Error While Displaying Text)
Use {!! !!} instead of {{ }} {!! ucwords(strtolower($produto->produto)) !!}
-
3
votes2
answers7919
viewsA: How to join 2 select in mysql
Uses the UNION. SELECT DISTINCT a.id, a.unidade, a.posicao, a.nome, a.peso FROM produtos a, produtos_pedidos b WHERE a.id = b.id_produto AND b.id_pedido IN (1, 2) UNION SELECT DISTINCT c.id,…
-
3
votes2
answers95
viewsQ: What is the combination of table and float?
Everyone who deals with web programming has been through this: .children { float: left; } <div class="parent"> <div class="children"> Teste </div> </div> If you use the…
-
1
votes1
answer94
viewsA: Mysterious padding when using Scale CSS
The effect of scale is not tired to the elements above it. That is, the parent elements of the object in which you are applying the scale will not be affected. To not have to give scale in the main…
-
2
votes2
answers56
viewsA: Error while fetching Mysql data with PHP
IS $result in place of $sql. Another thing is that its function is mysql_num_rows. Must be mysqli_num_rows, with i in the mysqli. $sql = "SELECT pergunta, resA, resB, resC, resD, resE, acertaram,…
-
1
votes1
answer229
viewsQ: Push of the same file with different parameter in Git
In Laravel there is the file .env. In it I define my database connections, email, among other things. Suppose I have three connections: Localhost Homologation Production When I want to work on…
-
2
votes4
answers342
viewsA: Laravel 5.3 - Model that can be created by multiple Controllers
I created a folder called Classes inside App. And I created a file with the class name. Kind in your case may be CadastroDuplicata. <?php namespace App\Classes; class CadastroDuplicata{ public…
-
2
votes2
answers493
viewsA: Specify columns in a relationship with Laravel
In the model User in relationship function role() you can do select(). public function role(){ return $this->belongsTo('App\Role')->select('name', 'id'); } Other option:…
-
3
votes3
answers528
viewsQ: How to compare indexes of two objects and return what is different?
I would like to compare these two objects and return the index that is different. In this case it is to return the 4 of the second object (will always be different in the second). var arr = { 1 :…
-
2
votes2
answers718
viewsA: Create two lines with Owl Carousel inside a foreach
You can use the array_chunk to cut the array into pieces. In case it will cut into 2 pieces. So if it has 12, it will be 6 on top and 6 on bottom. You have to take the total of items and divide by…
-
5
votes3
answers2397
viewsA: How to check if there is a certain number in a php variable?
One can use the strpos(). But it has to be looked at as string. $numeros = "1 2 3 4 5 6 7 8 9"; $temNumero = strpos($numeros, '1'); if($temNumero >= 0) // ou ($temNumero > -1) echo 'Achou';…
-
1
votes2
answers202
viewsA: Event conflict with jquery
$('#abre-busca').click(function(event) { $('#menu-principal-sub form').addClass('active'); return…
-
0
votes3
answers85
viewsA: preg_replace to change image src
<?php $re = '/([^<img src=\'"]+):/'; $str = '<img src="http://www.google.com"> <img src=\'http://www.google.com\'>'; preg_match_all($re, $str,…
-
2
votes2
answers812
viewsA: Insert points into a map with an array that passes through the database
You have to create an ajax function that does the query in the database. var request = new XMLHttpRequest(); request.open('GET', '/localizacoes.php', true); request.onload = function(){ if…
-
4
votes1
answer1378
viewsA: More than one chart with Chart.js
$(function() { var optionsBar = { responsive: true, scales: { yAxes: [{ ticks: { beginAtZero: true …