on-internet

Google API Error RefererNotAllowedMapError [duplicate]

Im trying to create an application using the Google maps api. While running on my localhost the following code, it displays me in the console the following message: "Google Maps API error: RefererNotAllowedMapError https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error" <!DOCTYPE html> <html> <body> <div id="map" style="width:100%;height:500px"></div> <script> function myMap() { var myCenter = new google.maps.LatLng(51.508742,-0.120850); var mapCanvas = document.getElementById("map"); var mapOptions = {center: myCenter, zoom: 5}; var map = new

Join the discussion →

Which C++ random number engines have a O(1) discard function?

Since C++11 there are a number of std random number engines. One of the member functions they implement is void discard(int long long z) which skips over z randomly generated numbers. The complexity of this function is given as O(z) on www.cplusplus.com (http://www.cplusplus.com/reference/random/mersenne_twister_engine/discard/) However, on www.cppreference.com (http://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine/discard) there is a note to say that For some engines, "fast jump" algorithms are known, which advancing the state by many steps (order of millions) without calcul

Join the discussion →

Auto-register GitLab runner

I have a docker-compose.yml file that sets up Gitlab, Container Registry and a Gitlab Runner. version: '2' services: redis: restart: always image: sameersbn/redis:latest command: - --loglevel warning volumes: - redis:/var/lib/redis:Z postgresql: restart: always image: sameersbn/postgresql:9.5-3 volumes: - postgresql:/var/lib/postgresql:Z environment: - DB_USER=gitlab - DB_PASS=password - DB_NAME=gitlabhq_production - DB_EXTENSION=pg_trgm gitlab: restart: always image: sameersbn/gitlab:10.1.1 volumes: - gitlab-data:/home/git/data:Z - gitlab-logs:/var/log/gitlab - ./certs:/certs depends_on: - re

Join the discussion →

How to download .m3u8 in once time [closed]

I have a .m3u8 file on remote host, with contain fixed numbers of chunk .ts file name, and not stream: #EXTM3U #EXT-X-VERSION:3 #EXT-X-TARGETDURATION:11 #EXT-X-MEDIA-SEQUENCE:0 #EXTINF:9.736, media_0.ts #EXTINF:9.96, media_1.ts #EXTINF:10.0, media_2.ts #EXTINF:10.0, media_3.ts #EXTINF:10.0, media_4.ts #EXTINF:10.2, media_5.ts #EXTINF:10.0, When I use this command: # ffmpeg -i "http://example.com/chunklist.m3u8" file.mp4 frame= 50 fps=5.1 q=-1.0 Lsize= 152kB time=00:00:01.79 bitrate= 693.0kbits/s It works. But It get frame by frame video and very long time needed. (It takes time almost to playb

Join the discussion →

Average of values in Excel from different cells excluding zero

I have a set of values that I want to find the average for. The values are in different cells, not near each other. The value of zero should not be considered. E.g. 1 in cell A1 I have 5, in cell C4 I have 7, in cell Z2 I have 0. E.g. 2 in cell A1 I have 5, in cell C4 I have 7, in cell Z2 I have 8. In example 1 the average should be (5+7)/2 In example 2 the average should be (5+7+8)/3 I would like to achieve this using Excel functions with no hard coding of any values. I am aware that if the values were next to each-other, e.g. in cells A1,A2,A3 I would do =AVERAGEIF(A1:A3,">0")

Join the discussion →

Display root folder image in Codeigniter view

i'm trying to display an image which is located at the root folder of my app, in the same level as the application folder, there is an uploads folder that holds the images. I tried many ways to get there, such as this one: <?php foreach($result as $row): ?> <!-- Main Content --> <div class="container"> <div class="row"> <div class="col-lg-8 col-md-10 mx-auto"> <div class="post-preview"> <h2 class="post-title"> <?php echo $row->title; ?> </h2> <h4 class="post-subtitle"> <?php echo $row->calling; ?> <!-- for test pusposes<span>This is the session: //<?php //echo $_SESSION['post_id']; ?></span> -

Join the discussion →

resize video proportionally to its container

I need to set up a video width/height accordingly to its container. Basically the video should have height 100% of its green container and the width should be variable. plyr.setup(); body { margin: 0; } .plyr { height: 100%; width :100%; } #wrapper{ display: flex; justify-content:center; width: 900px; height: 500px; background-color: green; } <script src="https://cdn.plyr.io/2.0.11/plyr.js"></script> <div id="wrapper"> <div> <div data-type="youtube" data-video-id="5p-Jdjo7sSQ"></div> </div> </div>

Join the discussion →

A certificate chain could not be built to a trusted root authority

During the installation of .NET Framework 4.6.2, I got an error: .NET Framework installation failed: -2146762486. A certificate chain could not be built to a trusted root authority A solution to the above-mentioned error is given at this MSDN Blog link, which says to do the following steps: 1. Download the certificate http://www.microsoft.com/pki/certs/MicRooCerAut2011_2011_03_22.crt locally (Example: C:\Temp) 2. You can use the certmgr.exe utility to add the certificate by using the command line. For more information, see the Certmgr.exe (Certificate Manager Tool) topic at MSDN. 3. Open an ad

Join the discussion →

R: Creating an index vector

I need some help with R coding here. The data set Glass consists of 214 rows of data in which each row corresponds to a glass sample. Each row consists of 10 columns. When viewed as a classification problem, column 10 (Type) specifies the class of each observation/instance. The remaining columns are attributes that might beused to infer column 10. Here is an example of the first row RI Na Mg Al Si K Ca Ba Fe Type 1 1.52101 13.64 4.49 1.10 71.78 0.06 8.75 0.0 0.0 1 First, I casted column 10 so that it is interpreted by R as a factor instead of an integer value. Now I need to create a vector wit

Join the discussion →

How to prevent sending custom value to CORS disabled API?

I get a photo(image file) from my user. I can access to their camera and they will take a photo and send that photo for me. Codes are written in JavaScript. In my API, CORS is disabled and only requests from my site are valid. I want to be sure that photo which i will get it, is a photo that is taken via camera(codes are written in JS). I want to get an image from API endpoint. That value is get from user camera and will be send via ajax request. Can user send custom value to API if CORS is disabled? I know that client side user can access JS codes via browser inspector, but can user change JS

Join the discussion →

How to stretch header & footer to the edges of the page?

I am pretty new to HTML and CSS, and totally new to this forum. Currently I am working––as I learn––on a webpage that I want to send as an email. It's a pretty simple format with a header, sub header, body and footer. Although I am almost done with the page, I still understand very little of the coding. What I am stuck at right now is stretching the header & footer (solid colours) to the edges of the page (top, left and right for the header & sub-header and left, right and bottom for the footer). I have naturally done a lot of research, looked into help forums and tried the tips found there, v

Join the discussion →

PowerShell Script for Filtering in Excel

I am writing a code to filter out the second column (B) of my Excel sheet which consists of the side indicators. I am trying to filter and display the indicator = > only along with the corresponding column A data. However, whenever I run the code below I get the error Unable to get the Autofilter Property of the Range class At line:14 char:1 CSV file format Name SideIndicator asdf = > asdf = > trew = = As I am pretty new to Excel automation using PowerShell, I am kind of stuck on where I am going wrong. The code: $file1 = "C:\Users\achowdhury\Desktop\Comparedfile.csv" # source's fullpath $xl =

Join the discussion →

Formas de descobrir qual o maior e menor número digitado no input pelo usuário em um for

Bem resumidamente estou com uma duvida se há uma forma de fazer este código de outra maneira mais "simples". O código em si já é simples mas queria saber se há outra maneira usando menos linhas ou sem usar a potenciação. Essa foi a única forma que consegui chegar no resultado desejado: maior = -10 ** 20 menor = -10 ** 20 for c in range(1, 5, +1): user_input = float(input('Digite o peso da pessoa Nº{}: '.format(c))) if user_input >= maior: maior = user_input if user_input <= menor: menor = user_input print('O menor peso é {:.2f} e o maior peso é {:.2f}kg'.format(menor, maior))

Join the discussion →

Constraint Layout with transparency and elevation

I have 10 TextViews inside 1 Constraint Layout. What I would like to achieve is to have the Constraint Layout have some elevation to make it seem like all 10 textviews are basically above my background. But I would like to keep the background of my layout to take the background of the phone so have the Constraint layout have a transparent background. What is a way that I can achieve this? I saw various posts here about this but they actually want the layout colored in and not transparent and that is where this one differs from theirs. I have tried way to do it with shapes using a rectangle but

Join the discussion →

Efficient way to build a frequency map from a large vector?

I currently use the following implementation to build a frequency map from a large vector. For each value, I attempt to insert a (value, 1) pair into the map. If the insertion fails because the key is already present, I increment the existing counter instead. Are there any optimizations or alternative approaches? #include <iostream> #include <random> #include <vector> #include <chrono> #include <map> template <typename T> void freqmap (const std::vector<T>& v, std::map<T, int>& m) { m.clear (); if (v.empty ()) return; auto i (v.begin ()); std::pair<T, int> p_; p_.second = 1; std::pair<typename

Join the discussion →

What is Dune Bashing?

I was looking at a website that is offering 40 to 45 minute "Dune Bashing" in a desert tour. What is this "bashing"?

Join the discussion →

What's the purpose of this [1] at the end of struct declaration?

I was snooping through my MSP430 microcontroller's header files, and I ran into this in <setjmp.h>: /* r3 does not have to be saved */ typedef struct { uint32_t __j_pc; /* return address */ uint32_t __j_sp; /* r1 stack pointer */ uint32_t __j_sr; /* r2 status register */ uint32_t __j_r4; uint32_t __j_r5; uint32_t __j_r6; uint32_t __j_r7; uint32_t __j_r8; uint32_t __j_r9; uint32_t __j_r10; uint32_t __j_r11; } jmp_buf[1]; /* size = 20 bytes */ I understand that it declares an anonymous struct and typedef's it to jmp_buf, but I can't figure out what the [1] is for. I know it declares jmp_buf to b

Join the discussion →

export large data with chunk in Laravel-Excel

With this code I can export to excel the data of MyModel, works ok: Excel::create('Filename', function ($excel) { $excel->sheet('Contratos', function ($sheet) { $datos = MyModel::select([ 'id', 'data']) ->get(); $sheet->fromArray($datos, null, 'A1', false, false); }); })->export('xls'); But I need to chunk the data to generate the excel, because in another model I have too much data (like 9000 records). I was seein some examples like this one: http://www.thecreativeroad.com/blog/export-large-dataset-using-laravel-excel-using-laravel-db-chunk $data = $user->query(); try{ return Excel::create('F

Join the discussion →

the web server certificate template could not be duplicated. Access Is denied

Windows Server 2016, ADFS, Certification Authority I tried to create duplicate web server template, but it says that it's not an accessible. see below snap. Now, My client is not technical, he provide me an account with most of the access, account is not an administrator, but I can assign many access to my self using AD Administrative service. My only question is which access DO I need to provide to this account for creating duplicate web server certificate template?

Join the discussion →

Autoloading versus manual loading CodeIgniter libraries

What is the difference of loading a library in CodeIgniter via, autoload.php Controller class Is there any point in loading the library in the constructor method of the controller class as, $this->load->library(array('form_validation')); When can I just load them at the autoload.php?

Join the discussion →

How to decode value in redis cli or shell script

I've written redis-cli bash script to process all key and value for bulk retrieval but values are not printing as expected. When I give my key in redis-cli its printing with all special characters: My Key and output from redis-cli redis-cli MGET "0124" "0016" 1) "\x1f\x8b\b\x00\x00\x00\x00\x00\x00\x00\x1d\x8e1\x0e\xc3@\b\x04?\x04\x0e8Q\x17\xa9\xf9\xdc\xdeY\x0b2\x91[\xfd>K\x99\xfd\xaf\xfc\x03\xeb-1\x10\xef\x00\x00\x00" 2) "\x1f\x8b\b\x00\x00\x00\x00\x00\x00\x00\x1d\x8e1\x92\x031\b\x04?\x04k\x84\x10\xa0\xf8\x1;\xa8-7\xbb\xa2> \xc0n\xdc\xe1\xce\xdb\xbdk\xac\x81\x9a]Q*\x8ex\xa4\xe0\x99\xd5\xd1\xb3

Join the discussion →

Is using InstanceProfileCredentialsProvider correct way to connect to AWS S3 from Ec2 instance?

Until my code works, I have set bucket policy too wide open. { "Version": "2012-10-17", "Id": "Policy15", "Statement": [ { "Sid": "Stmt1", "Effect": "Allow", "Principal": "*", "Action": "s3:*", "Resource": [ "arn:aws:s3:::bcktName", "arn:aws:s3:::bcktName/*" ] } ] } I am using Elastic BeanStalk which in turn uses AWS Ec2. The Ec2 instance has aws-elasticbeanstalk-ec2-role which was provided FullAccess to S3 (I understand full access is dangerous). I'm using the following java code in my webapp which is deployed to Ec2. AmazonS3 s3Client = AmazonS3ClientBuilder.standard() .withCredentials(new I

Join the discussion →

jquery.inputmask unmasking empty email

I am using RobinHerbots/jquery.inputmask library. Library returning _@_._ for empty value. You can try demo. Here is my code. HTML: <input type="text" id="email" autocomplete="off"> <button type="button" id="unmask">Unmask</button><br> Value: '<span id="val"></span>'<br> Unmasked value: '<span id="unmasked"></span>' JS: $("#email").inputmask('email'); $("#email").inputmask({'autoUnmask': true}); $("#unmask").click(function(){ $("#val").text($("#email").val()); $("#unmasked").text($("#email").inputmask('unmaskedvalue')); });

Join the discussion →

Showing a bootstrap alert message for a specific time in html and css

I have this element below that shows a success/failure banner across the screen. Is there a way I can set it in html/css to hide after 4 seconds? <div id=mainAlertMessage class="alert @message.CssClassName alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> <div style="text-align: center"><strong>@message.Title</strong> @message.Message</div> </div> I'm showing it by setting tempData in my controllers like this TempData["UserMessage"] = new BannerMessage() { CssClassName = "alert-success",

Join the discussion →

Dimensionality reduction

I am trying to understand the different methods for dimensionality reduction in data analysis. In particular, I am interested in singular value decomposition (SVD) and principal component analysis (PCA). What would the explanation be for a layperson? I understand the general premise of dimensionality reduction as bringing data to a lower dimension, but a) how do SVD and PCA do this? b) And how do they differ in their approach? OR maybe if you can explain what the results of each technique is telling me, so for a) SVD - what are singular values b) PCA - "proportion of variance" Any example woul

Join the discussion →

Upwork Duplicate Account

I had made an account on Odesk but when upwork came I made another account there and in the meant time I opened my old odesk account on upwork. Now I have a project on my old upwork account and today I saw a notification about the video calling verification from the upwork, I quickly disabled my new upwork account and since then I am worried that if I do video call with them, how many chances are there that they won't disable my account for duplication reason? Any help or suggestion would be appreciated!

Join the discussion →
Older stories