Posts by AnthraxisBR • 4,361 points
185 posts
-
1
votes1
answer275
viewsA: How to treat exceptions when deleting a primary key record referenced in another table in the Laravel framework
The Laravel has a way of treating exceptions in the Globa, the class App/Exception/Handler.php. In your case, it is possible that an Illuminate Database Queryexception is being displayed, that is,…
-
3
votes1
answer360
viewsA: [How to check if my list has letters or words in Pyton]
Assuming you have a list: lista = [1,232,723,221,'numero',3455] Simply put, you need to check by the list ITEMS, not by the list: for item in lista: if type(item) != int: pass Now checking if it…
pythonanswered AnthraxisBR 4,361 -
1
votes1
answer195
viewsA: What is the best practice for running select after PHP Insert?
A 'good practice' would be to not execute a select after to request the data that has just been entered (unless there is a need to fetch some data generated by the database at the time of creation…
-
0
votes1
answer42
viewsA: Error adding items to a file. txt Python3
Your code is almost correct, but it’s too. The method open allows the association of more than one rule for file opening, in case r+, means read and write, so you don’t need to access the file…
-
0
votes1
answer130
viewsA: Eloquent ORM select with belongToMany relation
Assuming you’re using the Eloquent ORM, you can get the desired query with joins: $query = DB::table('table')->select('usuario.*') ->where('usuarioid','2') ->join("rede",function($join){…
-
1
votes1
answer1403
viewsA: How/where to host a Webservice?
You need some things to have a Webservice, in Java, I will not be able to pass any help, however in this answer I will try to help you in how to host a Webservice. The answer is that it is…
web-serviceanswered AnthraxisBR 4,361 -
0
votes2
answers365
viewsA: Problem to return invalid email message and invalid password
What is happening is this, when passing a wrong email or user, the same will not exist in the database, so there will be no data in $validar_cliente, so the comparisons don’t work, to fix, check if…
phpanswered AnthraxisBR 4,361 -
2
votes2
answers193
viewsA: arrange automatic paging
Inside your loadPosts function, check if there were more than '0' data in the reply: function loadPosts() { $("#carregando").show(); $.ajax({ url: "dados.php?pagina=" + pagina, dataType: "json"…
-
2
votes2
answers67
viewsA: Check how many dates are equal
You can do this in two ways: Assuming you’re making a selection at the bank: SELECT count(data) as count_data GROUP BY data Or if you want to do with PHP: $array_datas = [ '2018-06-10',…
phpanswered AnthraxisBR 4,361 -
0
votes2
answers56
viewsA: PHP array / json
You are starting an array the more it seems when adding the products, second way must solve. $produtos = [ ["product_id"=>"221663"], ["product_id"=>"221666"], ["product_id"=>"221667"],…
-
1
votes1
answer143
viewsA: Rest Apis for e-commerce
First, start the project: composer create-project --prefer-dist laravel/laravel sua-api Enter the folder: cd sua-api After that, you will need to create the authentication, so use the command: php…
-
1
votes1
answer40
viewsA: Success message after password exchange
Inform a location in the header needs you to enter the whole address of directing, example: if($login == null){ header("Location: index.php"); } else { $_SESSION["email"] = $email; header("Location:…
-
1
votes2
answers900
viewsA: How to increase the input="text" font and cursor according to the desired size?
Define a height fixed to the input: height: 30px After that define the font-size: font-size: 40px; Your own code: table{ border-spacing:0px; border:1px solid #000; } td{ border:1px solid #000;…
-
1
votes1
answer113
viewsA: Error running web application in flask - Python
Try to use something like: En route: atividades = [ { 'atividade':"Estudar", 'url':"estudar.html" }, { 'atividade':"Programar", 'url':"programar.html" }, { 'atividade':"Particar Karate",…
-
2
votes1
answer400
viewsA: Several CRUD in the same PHP project
Assuming you don’t really want to apply a project pattern, or an elaborate framework, you can use a 'mini framework' (without irony, I couldn’t think of another kk name) for that: Follow an example…
-
2
votes1
answer43
viewsQ: Check some array values within another array
I need to test if an array has some values that are mandatory by comparing within another array, I currently count the required values, open a loop, and check if the checked values were in the same…
phpasked AnthraxisBR 4,361 -
1
votes2
answers445
viewsA: Is it wrong for me to use a static method to retouch a collection of objects?
Assuming that its reason is to control several registers at different times, this makes sense, which is even applied in the Laravel with the method Route , which is used to receive instances from…
-
0
votes1
answer39
viewsQ: Is there a way to use a non Form-Associated element as a natural associate?
In the HTML, there are the elements 'Form-Associated', which are elements that are associated with form which are inside, like the input for example. Good, but even if it’s unusual, if in a certain…
-
0
votes1
answer46
viewsA: How to format field names in the output of Laravel validation messages?
You can use the class OutputFormatterStyle and the methods getFormatter and setStyle Example: use Symfony\Component\Console\Formatter\OutputFormatterStyle; // ... function OutputHandler($sua_ saida)…
laravelanswered AnthraxisBR 4,361 -
1
votes2
answers134
viewsA: Toggleclass is not working
Your selectors are aligned in the wrong way, see the example below as it should be (explanation commented in the snippet): //Selecionando o elemento pai, e abrindo o loop pelas 'lis' dentro de…
-
1
votes1
answer28
viewsA: How to make one or more field within the screen run javascript function
1 - To fire the two different id’s : $("#DataAbate, #QuantidadeAnimais").change(function () { //seu codigo }) Or with classnames: $(".classnameEmComumEntreOsCampos").change(function () { //seu…
-
2
votes2
answers970
viewsQ: How to resolve conflict between Vue.js and Laravel 5.4 no. Blade
I have the following element in . Blade (intended to interact with Vue not with Laravel): <div id="app"> {{ message }} </div> To try to activate Vue: window.Vue = require('vue'); var app…
-
0
votes1
answer55
viewsA: Load full XML with simplexml_load_string
As of libxml version 2.7.3 the function simplexml_load_string can only receive up to 10MB per call. According to: Since version 2.7.3 libxml Limits the Maximum size of a single text Node to 10MB.…
phpanswered AnthraxisBR 4,361 -
4
votes1
answer1020
viewsA: Is it a problem to use two different versions of bootstrap?
In most situations, what will occur is the element taking the style of the version of Bootstrap which was last included, as in the 2 examples below: Version 4 <script…
-
18
votes2
answers1231
viewsQ: Can the operators ==, ==, != and !== be considered as "fuzzy logic"?
Doubt is simple and just out of curiosity, from a mathematical point of view, we have something like ratio comparators (or Fuzzy logic): Example: Depiction described: x pode ser de 1 até 100 igual a…
operatorsasked AnthraxisBR 4,361 -
0
votes1
answer33
viewsA: Send the form to different addresses according to zip code
Make a small modification to this part of your code: $headers .= 'From: <[email protected]>' . "\r\n"; $headers .= 'Cc: [email protected]' . "\r\n"; Instead of the above…
-
2
votes0
answers35
viewsQ: What is the 'natural' way to return a class instance as an object of another through a constructor
Assuming that in situation X I want to return a class instance through variables, I see no problem in doing this: $rs = "\\" .$Namespace . "\\" . $Class; $inst = new $rs(); return $inst; In an…
phpasked AnthraxisBR 4,361 -
3
votes2
answers1509
viewsA: Accountant of Visits
There are two types of analysis that you want to do the counter, try to count unique users, or try to count the total number of accesses, for this you can use test cookies or Session respectively.…
-
0
votes1
answer255
viewsQ: How to get around a GOTO problem in PHP
I have a small package manager in the terminal of own use and that manages my Framework, and I am giving an improvement on it, and falls into a problem where I can not loop without using goto, as in…
-
3
votes3
answers90
viewsA: Is it possible to use functions within a condition?
1 - console.log is there to display what has been compared in if, but can be replaced by other functions. In this example this line means, run the function(console.log) and compare, if true, enter…
-
0
votes1
answer591
viewsA: creating javascript html shortcut
I couldn’t find a healthy way to do it with just the attribute accesskey, but with javascript/jQuery besides being relatively simple, you can prevent default browser actions, as in the example…
-
0
votes1
answer57
viewsA: Rule to validate PHP value record
You can do this in two ways, with an execution queue, or with a file to lock the simultaneous execution, the idea is: 1 - While running, create a file . lock (can be any file extension, but we will…
phpanswered AnthraxisBR 4,361 -
1
votes2
answers49
viewsA: Remove tags from a php varchar variable
You can use the Domdocument and Xpath classes to find and remove the nodes (nodes): To the variable: $variavel = ' <table> <tr class="header"> <td class="check"></td> <td…
phpanswered AnthraxisBR 4,361 -
5
votes1
answer138
viewsQ: How to detect if a string is a regex
Supposing I have the string: $regex = "/[^a-z_\-0-9]/i"; There is something native to php to test if it is a regex validate? If not, what would be the best way to test it ?…
-
1
votes1
answer908
viewsA: Change the color of Datepicker
Enter the date element and enter the importance: $( function() { $( "#datepicker" ).datepicker(); } ); <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">…
-
0
votes2
answers200
viewsA: How to rename files into a list. CSV in your output with PHP and CURL?
Assuming you have one .csv in the following format: http://127.0.0.1/stack/fopencsv/imagem1.jpg, novaimagem1.jpg http://127.0.0.1/stack/fopencsv/imagem2.jpg, novaimagem2.jpg…
-
1
votes1
answer189
viewsA: :Hover does not work
Enter the ul element in the selection of widgets in the CSS: nav#menu ul li{ display: inline-block; transition-duration:0.3s; background-color: #ccc; padding: 10px; margin: 2px; } nav#menu ul…
-
0
votes1
answer439
viewsA: Generate error 403 php
Compare whether the user is logged in or not, if you are not setting the header for the exit error: header("HTTP/1.0 403 Forbidden");
-
0
votes1
answer30
viewsA: JSON return in the desired format from SQL
You can treat the answer json current and convert pro format desired with PHP: <?php $arr_json = '{ "contra_cheques":{ "1731793":[ { "periodo":"012018", "0":"012018", "titulo":"Janeiro\/2018",…
-
0
votes1
answer4300
viewsA: How to install and use Bootstrap via Composer
It’s not the best mode, but you can do it by just importing in the project by Composer.json: { "name": "projeto/projeto", "description": "descricao.", "authors": [ { "name": "nome", "email":…
-
3
votes2
answers663
viewsA: Ruby - comparison of values between a range or greater than, less than
I don’t know much about Ruby, but for a quick read I think it’s because I miss the comparison to infinity, both negative and positive. The comparator -Float::INFINITY...0 seems to indicate to…
-
0
votes3
answers259
viewsA: How to get response from 'apt remove' via shell_exec with PHP or Python?
The solution found was in PHP, using the class SSH2 package phplibsec to execute the command. Following example: $input = 'apt-get remove ' . $package . ' -y'; $ssh = new…
-
0
votes3
answers259
viewsQ: How to get response from 'apt remove' via shell_exec with PHP or Python?
With the shell_exec command I can get an answer if the result of the executed command is a single text: shel_exec('dpkg -l > list-softwares-dpkg.txt'); How to have the answer (in PHP or Python,…
-
0
votes1
answer87
viewsQ: Close application in PHP-GUI
Using PHP-GUI, start an application like this: $app = new \Gui\Application([ 'title' => 'G.M Personal APP', 'left' => 248, 'top' => 50, 'width' => 860, 'height' => 600, 'icon' =>…
phpasked AnthraxisBR 4,361 -
0
votes0
answers50
viewsQ: interact with TD with canvas line on the TABLE
I have a common table informed given radius of geometric coordinates, as in the image below: There is a javascript function that calculates the distance from the char point (0,0)' to any marked…
-
1
votes2
answers821
viewsA: Sessions of different systems on the same server
First a session is a superglobal variable in array form, where you store data for a certain time. According to the official documentation for session_id(): session_id() is used to obtain or define…
-
1
votes3
answers62
viewsA: Fill in 3 selects without repetitions
with jQuery, you can do this by opening a loop through the elements and options, and comparing the values, follows commented in the example below: $(document).on('change','select',function(){ var…
-
2
votes1
answer225
viewsA: Manipulating td’s of tables
As Voce is using jQuery, I believe that the simplest way to have this result would be using a plugin in table manipulation, in the example below, I am using the Datatables:…
-
1
votes2
answers101
viewsA: How to mark options in ajax return?
Just one more option using jQuery, traversing the 'options' and checking whether the value of the 'option' traversed is inside the array: var arr = ["valor1","valor2",'valor5'];…
-
0
votes1
answer619
viewsA: Table with Bootstrap does not respond some displays
As it exists in several answers here within Sopt, Bootstrap CSS has responsiveness utilities, what you are doing wrong is not indicating all utilities: You must have 'col-md-* e col-lg-*':…