Posts by helderk • 583 points
27 posts
-
0
votes1
answer43
viewsA: Dynamically change CSS variable within an iframe
After some research is tests I got a soulção, I do not know if it is the most elegant but it works: $('iframe').contents().find('html').get(0).style.setProperty("--color_bg", "#000"); or $(":root",…
-
0
votes1
answer43
viewsQ: Dynamically change CSS variable within an iframe
I have the variable within the iframe defined like this: :root { --color_bg: #ffffff; } I want to change this CSS variable from the outside, already tried: $(function() { setTimeout(function(){ var…
-
0
votes1
answer90
viewsQ: Group JSON data (sent by multiple devices) by date
I’m working on a project with websokets and I’m not sure how to solve the following problem. I receive via WS JSON data from various devices. Each device sends a value once per second. In the client…
-
0
votes1
answer840
viewsQ: Calculate difference between timestamp field with specific timestamp
I’m trying to develop a ranking chart for a kind of questionnaire. Each day a question is asked at 4pm, which can be answered until 5:59:59 the next day. The table has to show the position of the…
-
0
votes1
answer100
viewsQ: Use an array as a key for another associative array
I have these two arrays in php: Array ( [0] => nome [1] => cargo [2] => email ) Array ( [0] => Array ( [0] => nome1 [1] => cargo1 [2] => [email protected] ) [1] => Array (…
-
5
votes1
answer1721
viewsA: Create splash screen in the Electron application
You must do something like. First the main screen must be hidden. mainWindow = new BrowserWindow({titleBarStyle: 'hidden', width: 1200, height: 800, show: false }) Next create and show a new window…
-
1
votes1
answer310
viewsA: Random number in a range of numbers with predefined probabilities
After much thought and thanks to the help of the comments I managed to reach a functional solution: var premios = [ { 'tipo': 'premio1', 'stock': 50, 'probabilidade': 5 }, { 'tipo': 'premio2',…
javascriptanswered helderk 583 -
0
votes1
answer310
viewsQ: Random number in a range of numbers with predefined probabilities
I need to create a kind of roulette where a random prize comes out: the type of prize, for example 5 different prizes some better than others The better the premium the lower the chance of leaving…
javascriptasked helderk 583 -
0
votes3
answers2000
views -
2
votes1
answer38
viewsA: appear a message when connection drops
The only way to do what you want is on the client side and not the server side. Here is an example in Javascript to detect whether or not the page is online at the time it is loaded:…
-
4
votes2
answers2640
viewsA: Sum days on input date
I suppose this is what you’re looking for. $('#txtSolicitacao')[0].valueAsDate = new Date(); $('#txtSolicitacao').change(function() { var date = this.valueAsDate; date.setDate(date.getDate() + 7);…
-
0
votes2
answers168
viewsA: Inclusion of external files . js
Access-Control-Allow-Origin called a header CORS (Cross-Origin Resource Sharing). When a site X tries to access the content of another site Y, the site that made the request (site X) can send a…
-
0
votes2
answers1376
viewsA: How to publish multiple Laravel applications on Shared Server?
If you’re using cPanel with Softaculous, try installing Laravel through the Softaculous installer, not manually. Ai will have way to install in separate directories and Softaculous will set…
-
1
votes3
answers2529
viewsA: Using the Google Maps API for certain Longitude and Latitude
Visit the Google maps API for full examples. You got a example that does exactly what you ask, so it works you have to replace in the URL YOUR_API_KEY by your API KEY, if you don’t already have one…
-
3
votes1
answer618
viewsQ: Alternate image in case of fallha when loading
I’m creating a script that randomly shows an instaram mosaic. I keep the original image Urls in a comic book, but it turns out that sometimes I have image Urls that don’t load because users have…
-
5
votes1
answer618
viewsA: Alternate image in case of fallha when loading
Okay, searching a little I found the parameter onError executing a script when the image does not require. <img src="imagem.jpg" onError="this.onerror=null;this.src='/imagens/semimagem.jpg';"…
-
2
votes2
answers5048
viewsA: How to make a progress bar with steps?
Try progressStep.js is a plugin jQuery to dynamically create progress bars with numbered steps. https://github.com/mateagar/progressStep Implementation: Create a <div> to hold the progress…
-
1
votes1
answer877
viewsA: How can I replace multiple words without using STR_REPLACE?
Can use preg_replace_callback() he’s fast. In If you want to replace bad words with '*' here is a good example: $badwords = array('bad1', 'bad2', 'bad3', 'ass'); $text = 'This is a test. Ass. Grass.…
-
3
votes1
answer617
viewsA: How do I list all directories using FTP?
I tested your code on my server and it works perfectly both the ftp_nlist() like the ftp_rawlist() Are you working locally or on a host? if you are hosted on a host try including the domain in the…
-
0
votes1
answer385
viewsA: parse HTML as PHP with Htaccess
Edit or create the file with the name .htaccess inside the directory where the html files are and put the following command: For Suphp linux servers: AddHandler php-script html For linux servers…
-
1
votes2
answers2426
viewsA: Get URL ID instead of INDEX
You can use explode('/', $url): $url = 'http://domain.com/1999/api.php?output=json'; $r = explode('/', $url); $id = $r[3]; echo $id; http://php.net/manual/en/function.explode.php…
-
0
votes4
answers989
viewsA: Return data from a URL with Query String
Try with CURL, use this code: $url = 'https://www.servico.com.br' $querydata = array( 'nome' => 'abc', 'cpf' => 'abc', 'cep' => 'abc' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,…
-
5
votes3
answers1005
viewsA: How to convert animation in Canvas/JS to SVG?
Using only SVG maybe something like this is a good approach. https://jsfiddle.net/wgzk3qze/ Of course, the animation that I did was not perfect, it was just to illustrate. I created 8 cases in…
-
0
votes1
answer55
viewsQ: Mysql, number of rows in a table with values from another table
today I have a question maybe a little basic but my mysql ta a little rusty. I have 2 tables one with the users' names is another with a mailing list and wanted to know how many messages each user…
-
3
votes1
answer95
viewsQ: css matrix3d, drag the element while maintaining distortion
I’ve been playing with css Matrix3d in this code: http://jsfiddle.net/88Lv8kfp Now I wanted a stitch in the middle to drag the element keeping the distortion, but I don’t know how to do. So far, the…
-
0
votes3
answers3015
views -
1
votes1
answer69
viewsQ: Simplify Probability function with priority
I have this function that works as I want. It takes a value between -2 and 2 to set the priority to choose between two strings. My point is: How can I simplify the function? function…