Posts by Leo Letto • 3,303 points
170 posts
-
3
votes3
answers1075
views -
3
votes1
answer36
viewsQ: Is it possible to create a map to position elements?
I wonder if it is possible to "pre-define" the position of an element when using a append, for example: <div id="mainDiv"> <div class="child" data-position="2"></div> <div…
-
-1
votes1
answer83
viewsQ: Calculation of relevance of a product?
Let’s say I have the following data: Video A: Procurado: 12000 vezes Clicado: 7000 vezes Video B: Procurado: 11000 vezes Clicado: 10000 vezes How can I calculate the relevance of these two videos in…
-
2
votes1
answer40
viewsQ: Looking for similar items when using an intermediation table?
Following some advice to optimize queries in Mysql, I decided to split a list of items into 3 tables: Table anime: +----------------+-------------+ | id | titulo | +----------------+-------------+ |…
-
1
votes1
answer59
viewsQ: How to perform this Select?
I need to relate data according to the last item found in the user table, for example: Table: +----------------+-------------+ | user_id | title_id | +----------------+-------------+ | 154138746 |…
-
0
votes1
answer44
viewsQ: Select using an array?
I have the following array: var arr = ['A', 'B', 'C'...]; And in my database I have the column categoria where values are saved in the following mode: 'A,B,C...', how could I make a SELECT picking…
-
1
votes1
answer203
viewsQ: Do multiple requisitions or just one?
I am making an application in nodejs, where constantly it is necessary to consult information in the database, for example: name, description of items and etc... A similar site would be Netflix,…
-
1
votes1
answer188
viewsA: Event when closing tab/browser
You could use a beforeunload to call your event before the window closes, although it is not compatible with some browsers. $(window).on('beforeunload',function(){ //meu evento }); An alternative…
-
3
votes2
answers211
viewsA: PHP - Add everything and give a value
You have to give your Alert after the while $exp_selector = "SELECT reward_qty FROM public_rewards WHERE client_id = '".$_SESSION['u_id']."'"; $exp_query = $con->query($exp_selector); $reward_exp…
-
1
votes1
answer924
viewsA: How to make URL friendly with . htaccess with Variable in URL
In your htaccess just do the following: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^linkdireto/([0-9]+)?$ meuScript.php?id=$1 [NC,L] </IfModule> [0-9] in case…
-
1
votes0
answers30
viewsQ: Angualar JS Translate and dynamic elements?
I’m using Angularjs to create a site Multi-lingual, but I’m having problems with the elements created dynamically. var app = angular.module('myApp', ['pascalprecht.translate']);…
-
1
votes1
answer63
viewsA: How can I rearrange this array?
Always allow the keys to match the array id_item and cantidad, you can do it in the following way: $array_final = array(); $array_atual = array ( 'id_item' => array('1', '3'), // 'id_item',…
-
3
votes2
answers117
viewsQ: String match does not work with 1 character
I have the following obstacle: var myString = "c/q/1"; var match = myString.match(/c\/q\/([a-zA-Z0-9-].+)/); However match returns as null, already in the following example: var myString =…
-
3
votes1
answer90
viewsQ: Selection area with the mouse?
I am developing the following code, to create an element selection area using the mouse. var draggingMouse = false; var leftMouseDrag, topMouseDrag; $(document).on("mousedown mouseup",…
-
1
votes1
answer115
viewsQ: How to cancel an Xmlhttprequest using a button?
I am creating a file upload script that will be divided into Chunks according to the file size, thus creating several requests with different parts of the file, but I would like to put the option…
-
1
votes1
answer932
viewsQ: Force Divs with text to remain in the same line?
I have the following HTML structure: <div class="cloud_current_folder"> <div data-folder-name>My Cloud</div> <div data-spliter></div> <div…
-
1
votes0
answers133
viewsQ: How to return the value within a function?
What’s the right way to make one return in a Function response, I have the following code: $('random-button').click(function(){ console.log(moveFile()); }); function moveFile(fileID, newFolderID,…
-
0
votes1
answer506
viewsQ: Gdrive API Upload files javascript
I followed all the steps and some other questions I found here in the stack, and using the following code I can upgrade a file to Google Drive: var importFiles = $('#files')[0].files; const boundary…
-
2
votes0
answers184
viewsQ: Download large PHP files?
With the following code, I get a file stored in Google Drive: $response = $service->files->get("id-do-meu-arquivo", array('alt' => 'media')); $content =…
-
0
votes1
answer37
viewsQ: Error calling variable outside function
I have the following code: var rtn = null; gapi.client.drive.files.list({ q: "mimeType = 'application/vnd.google-apps.folder'", }).then(function(response) { var files = response.result.files; rtn =…
-
7
votes3
answers331
viewsQ: How to make this regex?
I have some difficulties using REGEX, so I would like help to separate the following text, example: 1ª Temporada - Nome da temporada 01 - Nome do ep um 02 - Nome do ep dois 03 - Nome do ep três ...…
-
3
votes3
answers1524
viewsQ: If with 3 conditions and at least 2 true?
Suppose I have the following if if(a || b || c == true) In this case, just one of the values is true to activate the condition, but I would like the condition to activate only when at least 2 of the…
-
0
votes2
answers117
viewsQ: Explode and compare value in a Select?
In my Mysql I have the following column data_id it stores values in this format 120-01-01, what a SELECT make a EXPLODE in that field and checks whether the first value of the array which in case…
-
2
votes1
answer964
viewsA: How to remove accents?
If you want to replace the special characters with their normal correspondents, I use this function: function limpaString($str) { $str = preg_replace('/[áàãâä]/ui', 'a', $str); $str =…
-
6
votes4
answers5283
viewsQ: Separate an array into groups?
I have the code below answered by a question similar to this but I would like to upgrade, this is the current function: function separar(base, maximo) { var resultado = [[]]; var grupo = 0; for (var…
-
1
votes2
answers65
viewsQ: Keyup event should not activate with special keys
In my document I am creating some keyboard shortcuts to facilitate the use of the page itself, and I am doing it as follows: $(document).on("keyup", function(e){ /*Tecla C*/ if(e.which === 67){…
-
0
votes1
answer167
viewsQ: Rewrite sending to wrong page
I have the following rewrites in my htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^dados/series/([a-z,0-9,A-Z-].+)/?$ dados-series.php?cache=$1 [NC,L]…
-
0
votes3
answers557
viewsA: See if a video has been paused to upload?
So far after a few tests, this was the best result I could get to determine whether a video stopped or not to load content. setInterval( function(){ if ($(video)[0].paused != true &&…
-
1
votes0
answers37
viewsQ: What would an event like in the input range look like?
I am creating a custom progress bar for videos, but I have a certain difficulty in detecting when the user tries to drag the reed through the video bar, I want to simulate something similar to what…
-
4
votes2
answers1055
viewsQ: Convert seconds to timestamp?
I am creating a PHP script to generate a json from a caption file webvtt, take the beginning and the end that are in the format minuto:segundo.milisegundo or if the video is too big they come as…
-
2
votes2
answers161
viewsQ: Don’t events work with dynamic video?
I am using a page where content is dynamically loaded with ajax, the problem is that some events mainly video are not working as they should, for example: Man functions.js loaded when entering the…
-
3
votes3
answers2114
viewsQ: Insert if it does not exist or Update if it already exists in Mysql?
How can I in Mysql give a INSERT or a UPDATE if the line in question already exists or not? I tried it this way but it didn’t work: IF EXISTS (SELECT * FROM configs WHERE id_serie = :id) UPDATE…
-
1
votes1
answer369
viewsQ: How to create a regex to remove lines with #?
I’m starting with regex now so I’m not very good yet with expressions, assuming I have the following variable: $foo = " #01 = linha comentada; 02 = valor para ser interpretado; #03 = outra linha…
-
1
votes2
answers190
viewsQ: Why doesn’t :Hover work this way?
I have the following code: .player-info .episodios-lista .lista-episodios{ width:100%; height:100%; overflow-x:hidden; overflow-y:auto; box-sizing:border-box; display: flex; display: -webkit-flex;…
-
9
votes3
answers557
viewsQ: See if a video has been paused to upload?
I’m using the shaka-player to play a Dash stream from a Nimble server, but I’ve been reading that event waiting is not always the most reliable option, and in fact when the video stops to load the…
-
0
votes1
answer194
viewsQ: Run function only when user drops input type="range"?
I’m wearing a input[type="range"] as progress bar for a video player, it is when simulating the event to change the time of the video because I only want the action to be executed only after the…
-
0
votes1
answer215
viewsQ: What is wrong with the request for this script?
At a certain point I need to request a json script from the server, but I’m making some changes and I’m getting errors that supposedly shouldn’t happen. The example below works perfectly well:…
-
6
votes2
answers996
viewsQ: How do I protect my JSON application?
I created a unique subdomain to provide data from my tables in JSON, it facilitates requests for both the mobile version and the desktop version of my site, but I would like to protect such data or…
-
0
votes1
answer185
viewsQ: $_FILES returning empty
This is the form I’m using to send the file <form id="form_converter" enctype="multipart/form-data"> <input type="file" name="arquivo" /> <input type="submit" value="Enviar" />…
-
2
votes1
answer47
viewsQ: How to mount this effect with JS?
I have a list, and I would like to create a loop by passing each of these elements, basically what I want is this effect: $.each($('.elemento'), function(i, el){ $(el).fadeIn(100);…
-
0
votes1
answer356
viewsQ: Error with htaccess Sem redirect to WWW
I have the following code in my htaccess which redirects the user if they access the site without www, it works perfectly if you type in the direct domain without www it will redirect, but from…
-
0
votes1
answer160
viewsA: PHP does not return the second parameter via URL in Google Chrome
Try to get the parameters this way, because here tested and worked normal so much by $_GET how much for parse_url <?php $url =…
-
0
votes1
answer546
viewsQ: Abort script without closing bat
A PHP script generates a file .bat and then runs the same, the problem is that I do not want my PHP script to be expecting such .bat finish running. I just want it to run, create and run the bat and…
-
1
votes2
answers212
viewsQ: How to prevent my site from falling, when running a "heavy" script?
I have a script that goes through a directory looking for video files in it and then I use the shell_exec with the ffmpeg to convert the same, the problem is that my site is falling while running…
-
0
votes1
answer42
viewsQ: How to make this variable global?
I am using this script to check image support webp but I’m having trouble defining the type, here’s the code that checks: hasWebP = (function() { var images = { basic:…
-
1
votes2
answers77
viewsQ: How to extract this information in a string?
Below follows an output string generated by ffmpeg referring some video file: Stream #0:0(Jpn): Video: H264 ... Stream #0:1(Jpn): Audio: mp3 ... Stream #0:2(by): Subtitle ... In most cases ffmpeg…
-
0
votes3
answers361
viewsA: How to define the opacity of an element from within a div larger than the div itself
You can do using position absolute and placing one on top of the other. .div1 { width: 100px; height: 100px; background: #6a6a6a; opacity: 0.5; position:absolute; z-index:1; } .button { width: 50px;…
-
3
votes5
answers721
viewsA: Element with different end size than width and height definition in CSS?
You’re adding 50px of padding on all sides of the element, so you’re adding this up to the size already set in the width and in the heightplus the 1px edges. To get around this problem with the…
-
4
votes4
answers874
viewsQ: Manipulating JS odds when using Math.Random()?
When using this function Math.floor((Math.random() * 10) + 1) I get a random number from 1 to 10. We assume that each number has a 10% chance so we have a 50% chance for Odd or Even, but if I wanted…
-
1
votes2
answers254
viewsA: How to split a link into "multiple parts"?
You can do it this way $url = parse_url("https://steamcommunity.com/tradeoffer/new/?partner=377361903&token=9Q0WYuq0"); parse_str($url['query'], $par); $par is now a array with the data you want…