Posts by Ivan Ferrer • 12,096 points
772 posts
-
0
votes1
answer44
viewsQ: How to convert Java source string to HEX for Unicode to embed in HTML?
How to convert using Javascript: The guy Java source string: \u900 for Unicode: ऀ Today I have the following HTML element: <i class="icon-zoom-out"></i> And the CSS class:…
-
0
votes0
answers27
viewsQ: How to generate a hierarchical rule CSS using Gulp
I have a father file called: /assets/hierarchy-file.scss, inside it I import the children files: @import "./style_guide"; @import './default_styles'; @import './header'; // :::::::::: OS ARQUIVOS…
-
3
votes1
answer622
viewsQ: How to reverse git push --force?
I made a git push --force, but I wish I had git push --force-with-lease it is possible to reverse this?
-
0
votes3
answers663
viewsA: Dynamically access a JSON element
The simplest way to solve this is to work with the object itself: var data = [{ "posts": { "ID": 452, "post_date": "01\/01\/2016 15:30:00", "post_title": "Titulo do post" }, "postmeta": { "anexo": {…
-
-1
votes1
answer86
viewsQ: How to insert null values into a data list?
I believe the problem is here: 'tlkc_conversation_2' => '', I am trying to enter data in the database, but some fields are null, and I am receiving the following message: Illuminate Database…
-
-1
votes1
answer32
viewsQ: How to set SSL in the cookie and display in the browser?
My site on site uses SSL, charge by https://, then, it should set the SSL protocol, my doubt is why when accessed by Chrome console, in Application > Storage > Cookies, where has the cookie,…
-
0
votes1
answer113
viewsA: How to catch two tables without joining them with Zend1.12 query Builder?
I resolved it this way: $init = new Zend_Db_Expr(",(SELECT @rank := 0) init"); $select = $this->dbTable->select() ->setIntegrityCheck(false) ->from(array('rank_res' =>…
-
-2
votes1
answer113
viewsQ: How to catch two tables without joining them with Zend1.12 query Builder?
Based on documentation of Zend 1.12, using the Builder query: How I select two tables with comma only without joinInner: Example: SELECT TABELA1 FROM ( BLABLABLA... ) A, (SELECT TABELA2) B To…
-
5
votes4
answers320
viewsA: What is .= in php?
.= is a leaner way of concatenating without having to rewrite the variable: Would be similar to this: $variavel = $variavel . "sua string concatenada"; In this situation, you are saying that the…
-
-2
votes1
answer179
viewsQ: Menu with svg image icons sometimes does not load in mobile version
What could possibly be affecting my experience in this? I had to change some images to png, but I can’t tell if it was the best way, the experience I have on desktop layout is much better with SVG…
-
0
votes1
answer69
viewsA: Problem with SVG elements coming out of place in mobile version
I solved the problem, just include it in the CSS: .my-avatar .hair-fringe-top { position: absolute; }
-
-1
votes1
answer69
viewsQ: Problem with SVG elements coming out of place in mobile version
I created an avatar editor that places SVG elements on the screen. When I put in the resolution of mobile version, there is a strange event happening, which causes a single element to descend,…
-
0
votes2
answers584
viewsA: Why is the Json_encode() PHP function not returning data in Json format?
You are passing an array to the utf8_encode($data), that’s a mistake: expects parameter 1 to be string, it will not return the converted array, and in this case also will not arrive in the…
-
2
votes1
answer71
viewsQ: Is there any way to break every word of a span text into children?
Imagine that I identify within a text a span element that starts and ends with the class "color-green": <span data-id="1" class="cor-verde">O texto está assim <strong>parte em…
-
0
votes0
answers250
viewsQ: How to remove this selection blue when generating the PDF?
I have a system that marks the text, creating a span with the notes, I’m using a lib to export PDF, but when it loads the DOM to export to PDF, it’s keeping this blue check mark, very strange. Have…
-
2
votes1
answer967
viewsA: How to adjust the top margin of PDF for the following problem in html2pdf.js?
Unfortunately I could not find any solution to edit the margin after breaking the page, but I solved the problem by keeping the default margin for: [30, 0, 30, 0]. The background image, in this case…
-
1
votes6
answers14461
viewsA: Convert month number to name
There is another way. Your server needs to support setting up the pt_BR locale: $monthNum = 3; $dateObj = DateTime::createFromFormat('m', $monthNum); $dateObj->setTimezone(new…
-
1
votes1
answer519
viewsA: How to access a safe local site by firefox?
Here’s what I got by doing: First I clicked on the browser lock icon and went to Firefox settings: Preferences > Privacy & Security > Certificates in the URL: about:preferences#privacy…
-
-2
votes1
answer519
viewsQ: How to access a safe local site by firefox?
I’m looking to release a site that I’m developing through the Chrome browser and need to fix the CSS bugs that are occurring in Firefox. But I’m having trouble accessing it through Firefox. Message…
-
6
votes2
answers2279
viewsA: How to get only the date month with PHP from the database
Just do it in SQL, in case: SELECT MONTH(reg_data) as mes, DAY(reg_data) as dia, barraswiki.* from barraswiki order by aprovam DESC, reg_data DESC; But you can also format dates like this: SELECT…
-
0
votes2
answers257
viewsA: Passing the token of an Angularjs controller to an Laravel API
In PHP: use Illuminate\Support\Facades\Validator; use Illuminate\Http\Request as Request; use App\User; use Illuminate\Support\Facades\DB; use App\Http\Requests\PessoaRequest; use…
-
0
votes2
answers92
viewsA: My Node js API mixes data from different requests
One way to solve it is to make a callback of events in queue, each time an event is solved, you call the next, then at the end presents the data, example: init = (callback, resolveFinal) => {…
-
0
votes5
answers1240
viewsA: How to split a string into specific Javascript sizes?
There’s n ways of doing, another way would be like this: var string = 'stackoverflow'; fnc = (str, num) => { var t=str.split(''), col = []; for(var i in t) { col.push(t[i]); if((i+1) % num === 0)…
-
0
votes3
answers420
viewsA: Is it possible to create an application entirely with Javascript?
Nowadays it is possible, Javascript although it is a front-end language, it allows to build backend applications, there are some frameworks that make use of it as backend as Node.js. It is also…
-
0
votes1
answer2746
viewsA: Jquery - Add HTML attribute to a specific element
Welcome to Sopt. Try placing an attribute on your date element: data-add, with the ID you want as parameter, then only pick by ID: HTML: <label class="prefixo"><input data-add="1"…
-
13
votes1
answer967
viewsQ: How to adjust the top margin of PDF for the following problem in html2pdf.js?
This is the main reference The idea was that the image was behind, but the lib is a limited way to do it, and the text ended up being on top: Here is an example, see that although the image is…
-
2
votes3
answers268
viewsA: How to sort an array of Javascript objects through an object value
Try something like this, he orders by the object Date() , the slice() is to disaggregate from the original object: var valores = [1, 2, 3, 4, 5]; var data = [ { ...valores, requestedCase: {…
-
1
votes1
answer82
viewsQ: Quill editor formatting button event problem
How could fix an event conflict issue on the editor click button Quill: If, for example, I use "control+b", the text bolds and bold, but when I click on the editor button, it seems to have a desired…
-
0
votes2
answers51
viewsA: How to sort a table in MYSQL, along with the query command
So the "N" ways to sort, I do not recommend making only a year field, because this can give you problems in the future, especially when you will have to display a report per period of records. You…
-
1
votes2
answers49
viewsA: I’m having problems with my login system
I recommend using Preparestatement for security reasons and to avoid major risks of Sqlinjection, I simulated a session by taking the user’s access profile, and the user’s id, because that’s all you…
-
2
votes4
answers2497
viewsA: Merge two Javascript arrays
Thus also works and minimizes the code: var array1 = ['abc', 'def', 'ghi']; var array2 = ['123', '456', '789']; function arrayIntersect(array1, array2) { var arr_join = [],arr = array1.map((res, i)…
javascriptanswered Ivan Ferrer 12,096 -
0
votes2
answers123
viewsA: How to simulate button click on jQuery?
To trigger automatic events: Trigger / triggerHandler. $('.btnDigital').click(function () { $(".btnEntrega").trigger('click'); }); Documentation jQuery.…
-
1
votes2
answers103
viewsA: how to check if an image is online
I believe this should work: function isImg(file, result) { var img = document.createElement('img'); img.src = file; img.onload = () => { result.action(true) } img.onerror = () => {…
javascriptanswered Ivan Ferrer 12,096 -
0
votes3
answers60
viewsA: Copy row to identical table - mysql
Try it this way, and see if it worked: INSERT INTO pacientes_backup_novo(foto) SELECT p.foto FROM pacientes p, pacientes_backup pk WHERE p.nome = pk.nome; But before you do, make sure that the bank…
mysqlanswered Ivan Ferrer 12,096 -
1
votes2
answers138
viewsA: Get object inside an array that has the lowest value in a specific Javascript key
Just sort your object by weight and bring the first position of your index: const mani = cores.filter(spec => (spec.cor === 'amarelo')).sort((a, b) => { if(a.peso < b.peso) { return -1; }…
-
0
votes1
answer227
viewsA: How to validate an empty payload from an API?
I solved the problem, the validation was already working. The problem was elsewhere, which I have corrected. Was passing the $request straight to the getDataUser method, so I wasn’t checking the…
-
2
votes1
answer227
viewsQ: How to validate an empty payload from an API?
I have an API that returns in error when I pass the payload parameter as: {}. This happens because it enters the method, going through the validation of the Standard. The validation of the rule is…
-
0
votes2
answers67
viewsA: Validate a table column
I believe that first you must do the append in the correct location, which is within the tags <tbody></tbody>: $("#tableNSerie tbody").append("<tr>" ...); If you remove the first…
javascriptanswered Ivan Ferrer 12,096 -
2
votes2
answers65
viewsA: Button appear only after you see all carousel slides
I imagine you’re looking for something like this: <script> $(function() { $('[data-target="#carouselExampleIndicators"]').on('click',function(e) { var total_slide =…
-
0
votes2
answers377
viewsA: Fetch stock balance on a given day (or day)
Try this and see if it returns what you need: SELECT saldo_id, dia, saldo, ISNULL((SELECT SUM(saldo) FROM saldos_dias AS SaldoDiaAtual WHERE SaldoDiaAnterior.saldo_id = SaldoDiaAtual.saldo_id AND…
-
-2
votes2
answers215
viewsA: What are the alternatives for mcrypt_* functions?
Here is a solution for what you need: public function encode($encrypt, $key, $iv) { $encrypted = openssl_encrypt($encrypt, 'aes-256-cbc', $key, 0, $iv); return base64_encode($encrypted . '::' .…
-
1
votes1
answer46
viewsA: Calculate Toolbar positioning next to a rotated element
Managed to do, thanks @Augustovasques, I ended up finding the way from what you said: var bound = current.getBoundingRect(), ang = Math.round(current.get('angle')), distance = (ang > 72…
-
1
votes1
answer23
viewsA: Screen zoom problem using fabricjs
All I had to do was add this into the functions and solve the problem: var originalWidth = canvas.getWidth(); var originalHeight = canvas.getHeight(); var ratio = 1; canvas.setDimensions({ width:…
-
1
votes1
answer46
viewsQ: Calculate Toolbar positioning next to a rotated element
I’m kind of bad at math, but I imagine this is something based on cosine and tangent based on the hypotenuse radius. It should be considered that when the angle is 0 or 90 degrees, Toolbar should be…
-
0
votes1
answer1001
viewsA: How do I update a component and go back to its initial state?
The problem has been solved by placing / removing from Asyncstorage, and including useEffect: import React, { useState, useEffect, Fragment, Component } from 'react' import AsyncStorage from…
-
1
votes1
answer47
viewsQ: How to capture the onRendered event from a canvas?
How to know if the canvas is ready? I’m using the library fabricjs, that creates a complex element structure within a canvas, but I’d like to call a callback function after the canvas had all the…
-
-1
votes1
answer23
viewsQ: Screen zoom problem using fabricjs
Screen zoom problem when using fabricjs. When I have a canvas with many elements, the zoom takes a lot, doing a very slow delay, is breaking the drawing, and the canvas does not finish the rendering…
-
1
votes5
answers9010
viewsA: How do I multiply an array within a function in JS?
I think that will solve the case: var result = [1, 4, 7].reduce( (a,b) => a * b );
-
1
votes2
answers106
viewsA: How to put the response of a function as a parameter in another function?
Welcome to Sopt, what you want seems to be a function that makes a sum from another sum... That is, just take the result of the first sum and add with the result of another sum: let nun1 = 3 const…
-
1
votes3
answers977
viewsA: How to know the size of an object in memory?
You can create the sizeof method: VMSupport.sizeOf(...) public static int sizeOf(Object o) { if (VMSupport.INSTRUMENTATION != null) { return VMSupport.align((int)…