How do I put the information from the database into javascript?
I am giving the information coming from the database to the screen with the following command.
<td ><asp:Label ID="Label24" runat="server"
Text=": "><%#Eval("Latitude") %>' <%#Eval("Longtitude") %>' </asp:Label>
and this way I get results. Coordinate : 38,5225983' 27,0441333'
I have the values of Latitude and Longitude from this
// [START maps_streetview_controls]
function initPano() {
// Note: constructed panorama objects have visible: true
// set by default.
const panorama = new google.maps.StreetViewPanorama(
document.getElementById("map2"),
{
position: { lat: X, lng: Y },
addressControlOptions: {
position: google.maps.ControlPosition.BOTTOM_CENTER,
},
linksControl: false,
panControl: false,
enableCloseButton: false,
}
);
}
// [END maps_streetview_controls]
How do I put these incoming Latitude and Longitude values to X and Y below. Note: Incoming data ',' but with comma. ' I have to put it as a point.
See also questions close to this topic
-
Can I access any response that is shown in dev tools?
Here is the scenario...
- I have an Iframe that is using RightSignature to capture a signed document.
- When I submit the document in the iframe, I can see in my Dev tools that I have a PUT with a json response that I want to grab.
- once it is submitted, the page in the iframe is redirected.
So far I have had no luck in capturing the response using just vanilla js and .addEventListener. It seems like there should be a way to do it but I am just curious if what I think should be possible actually is.
So in short, if I can see the response in my Dev Tools, does that mean I should be able to capture it somehow using js, or because it is in an iframe does that not necessarily translate into something that is accessible to me? I just want to know so I dont keep trying to go down a path that leads nowhere.
Thanks
-
Is there is a way to DM someone that is mentioned in a message with discord.js?
Is there is a way to DM someone that is mentioned in a message with discord.js?
this is my code.
client.on("message", message => { if (message.author.bot) {return} let person = message.content.mentions person.send("My message") })
it's not working for some reason
-
How to check cookie parameters in if-else condition after it is stored?
I have here a function that checks each parameters in the url and store it as cookie. But I have a problem, whenever I pass those parameter entered into a new url using
XMLHttpRequest()
it returns only the first parameter entered from the user. I guess this is something to do with theif-else
condition in mycode.Here is my javascript code:
<!-- Get Parameters for gclid, token , fbclid or cjevent when user visits the website --> <script> window.onload = function() { try { var url_string = (window.location.href).toLowerCase(); var url = new URL(url_string); // check parameters if exists ['gclid', 'token', 'fbclid', 'cjevent'].forEach(function (key) { var value = url.searchParams.get(key); if (value) { //token expires in 6 hours document.cookie = `${key}=${value}; max-age=21600` + ';path=/'; } }); const getCookieValue = (name) => ( document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)')?.pop() || '' ) // Sending a get request to laravel controller var base_url = window.location.origin; // get the base url var params = ''; // pass parameters if gclid, token, or fbclid if(getCookieValue('gclid')) { params = 'gclid=' + getCookieValue('gclid');} else if (getCookieValue('token')) { params = 'token=' + getCookieValue('token');} else if (getCookieValue('fbclid')) { params = 'fbclid=' + getCookieValue('fbclid');} else if (getCookieValue('cjevent')) { params = 'cjevent=' + getCookieValue('cjevent');} // send those parameters in TrafficTracking Controller storeTracking function let xhr = new XMLHttpRequest(); xhr.open("GET", base_url+"/storetrackvisit?"+params, true); xhr.send(); } catch (err) { console.log("Issues with Parsing URL Parameter's - " + err); } } </script>
When I try to use the
alert(params)
function in the varparams
it returns only the first parameter that user has entered.For example:
1.) User enters
test.com?gclid=111
-> stores that as a cookie2.) user re enters another value for other parameter
test.com?token=551
-> it will still alert thegclid
parameterHow do I refactor my if-else condition that returns only the parameter when a user enters it and assign it in the
params
variable. So that the variableparams
is dynamic when passing it to the new urlXMLHttpRequest()
.I believe this is something to do with this code:
if(getCookieValue('gclid')) { params = 'gclid=' + getCookieValue('gclid');} else if (getCookieValue('token')) { params = 'token=' + getCookieValue('token');} else if (getCookieValue('fbclid')) { params = 'fbclid=' + getCookieValue('fbclid');} else if (getCookieValue('cjevent')) { params = 'cjevent=' + getCookieValue('cjevent');} alert(params);
How can I modify my if-else conditions to return only the parameters what user entered? I believe that what I've done it fetches the last cookie saved. Is there anything good to do about the
if/else
condition? -
Huge amount of logon attempts when loading a page (without cache)
I notice in the Performance Monitor of Windows Server 2012 that there are spikes in logon attempts per second under Web Service -> Logon Attempts/sec. These spikes go from about 0 to 50.
I've traced this down to a page refresh. Loading a page with no cache that is. An average page load does about 50 requests (images, scripts, etc). Now apparently these 50 requests are shown as logon attempts.
Is this normal?
Note that this page does not require the visitor to be logged in.
-
Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[3\
When warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {e43b756a-2818-4898-8730-5e8e0f230be7} may be persisted to storage in unencrypted form.
info: IdentityServer4.Startup[0]
Starting IdentityServer4 version 4.1.1+cebd52f5bc61bdefc262fd20739d4d087c6f961f
info: IdentityServer4.Startup[0]
You are using the in-memory version of the persisted grant store. This will store consent decisions, authorization codes, refresh and reference tokens in memory only. If you are using any of those features in production, you want to switch to a different store implementation.
info: IdentityServer4.Startup[0]
Using the default authentication scheme Identity.Application for IdentityServer
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://[::]:8081
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://[::]:8080
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /app
info: IdentityServer4.Hosting.IdentityServerMiddleware[0]
Invoking IdentityServer endpoint: IdentityServer4.Endpoints.TokenEndpoint for /connect/token
info: IdentityServer4.AspNetIdentity.ResourceOwnerPasswordValidator[0]
Credentials validated for username: muthu
info: IdentityServer4.Validation.TokenRequestValidator[0]
Token request validation success, {
"ClientId": "sdgfsdsgsdg",
"ClientName": "Swagger UI",
"GrantType": "password",
"Scopes": "api",
"AuthorizationCode": "********",
"RefreshToken": "********",
"UserName": "sample",
"Raw": {
"grant_type": "password",
"username": "sample",
"password": "REDACTED"
}
}
fail: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[3]
Exception occurred while processing message.
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'http://*:8080/.well-known/openid-configuration'.
---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'http://*:8080/.well-known/openid-configuration'.
---> System.UriFormatException: Invalid URI: The hostname could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString, UriKind uriKind)
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
fail: IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationHandler[0]
IDX20803: Unable to obtain configuration from: 'http://*:8080/.well-known/openid-configuration'.
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'http://*:8080/.well-known/openid-configuration'.
---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'http://*:8080/.well-known/openid-configuration'.
---> System.UriFormatException: Invalid URI: The hostname could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString, UriKind uriKind)
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationHandler.HandleAuthenticateAsync()
info: IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationHandler[7]
Bearer was not authenticated. Failure message: IDX20803: Unable to obtain configuration from: 'http://*:8080/.well-known/openid-configuration'.
info: IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationHandler[12]
AuthenticationScheme: Bearer was challenged.
-
ASP.NET using return RedirectToAction(" ", " ") how to use this to redirect to a cshtml
I can not find a useable tutorial that explains how to redirect using REdirectToAction. can someone share a link that that explains ALL the steps needed to use this? I think I am having a hard time understanding how the parameters are given can find an HTML file with a model in the parameter? or is it a controller? I am very lost on how they communicate. please someone if you can help.
-
Find Nearst point to latitude longitude data with pyspark
I would like to find the nearest charging point to the location of the motorcycles which I have these latitudes and longitudes.
Here is an example of the input data I simulated. Normally I have a database in "parquet" format that contains 20000 different IDs.
from pyspark.context import SparkContext from pyspark.sql.session import SparkSession sc = SparkContext.getOrCreate() spark = SparkSession(sc) dept = [("A1",48.8098355785716, 1.8762286321361976), ("A2",48.87490973436179, 2.7249223947571197), ("A3",48.87310326056905, 2.376106511738165), ("A4",48.77364673144199, 2.4447710556395346), ("A5",48.73380884885322, 2.4859697819803555), ("A6",48.90922034335811, 2.2497637509596458), ("A7",48.950722737880504, 2.340400948909453), ("A8",48.561418801770806, 2.37885309349422), ("A9",48.889359176469895, 2.219551351643043), ("A10",48.61300713353443, 2.3691997918996357),("A11",48.60672483571858, 2.444485385582323),("A12",48.94007184177472, 2.349059773535683), ("A13",48.885997661659246, 2.3551224492619607),("B1",48.94386432403636, 2.2494586715372527), ("B2",48.9495525060667, 2.5087102445386615), ("B3",48.930529023081654, 2.3901206775629458), ("B4",48.909392025417134, 2.38004589590435), ("B5",48.91098758245912, 2.3319782575065426), ("B6",48.93993809157587, 2.162649081702116), ("B7",48.83519864979911, 2.2786498657494145), ("C1",48.951107012289704, 2.4963614066025053), ("C2",49.008150042213764, 2.5392869756158625)] deptColumns = ["Id","Moto_LATITUDE","Moto_LONGITUDE"] deptDF = spark.createDataFrame(data=dept, schema = deptColumns) deptDF.show(50,False)
I also have the gps coordinates of the recharging stations in a CSV file (with 3000 terminal location). Here is an example to test the code:
from pyspark.context import SparkContext from pyspark.sql.session import SparkSession sc = SparkContext.getOrCreate() spark = SparkSession(sc) dept1 = [(1.993369,48.71864), (1.961653,48.742661),(2.081791,48.715224),(2.049655,48.726621),(2.066867,48.698864),(1.982888,48.687171), (2.037731,48.70488),(1.982888,48.687171),(2.081791,48.715224),(1.986804,48.705833),(2.037731,48.70488),(1.956922,48.744725), (1.920657,48.723412),(2.045842,48.705908),(2.066867,48.698864),(2.017795,48.686673),(2.045842,48.705908),(2.043351,48.711696),(2.120955,48.80989800),(2.473874,48.82018200), (2.21009400,48.78062100),(2.15195000,48.80674000),(2.21545400,48.78283600),(2.21193600,48.78544000),(2.18705800,48.83864400),(2.44581300,48.92167500), (2.15357700,48.79967400),(2.21009500,48.78062100),(2.21009100,48.78062100),(2.21545200,48.78283400),(2.170365,48.83886100),(2.473446,48.82444600), (2.21545300,48.78283500),(2.25016700,48.82261300),(2.21009300,48.78062100),(2.46686000,48.81686690),(2.170364,48.83886100),(2.21193300,48.78543700), (2.44580900,48.92168100),(2.46686000,48.81686700),(2.129935,48.80188000),(2.473441,48.82444600),(2.26764600,48.82743000),(2.24949300,48.82274900),(2.12905600,48.00833000),(2.473443,48.82444600), (2.13669300,48.79661000),(2.19017900,48.78259900),(2.12905300,48.80080600),(2.18696000,48.83858700),(2.13669300,48.79661000), (2.24987200,48.82274800),(2.15357700,48.79967400),(2.46681200,48.81684200),(2.170362,48.83886100),(2.473444,48.82444600),(2.24993700,48.82276800),(2.21545600,48.78283800)] deptColumns = ["Terminal_recharging_LONG","Terminal_recharging_LATITUDE"] deptDF = spark.createDataFrame(data=dept1, schema = deptColumns) deptDF.show(50,False)
From these two dataframes, I have to define the nearest point for each ID, and then calculate the exact distance in Km.
I have seen that there is a way to use algorithms from the toolbox "scikit learn" like the "KD tree" or "Ball tree" (see this link for more information: https://scikit-learn.org/stable/modules/neighbors.html#unsupervised-neighbors). But I can't understand how to use them with my two dataframes. If you have any other suggestions, I will be glad to take them.
-
how to extract coordinates from postal code in swift through API?
I am stuck here in extracting latitude and longitude for a given postal code. can anyone please help me figuring out this issue?
-
Which GPS tracker will give me accurate location and I will be able to extract coordinates from that device?
I need a gps device which will be pretty much accurate and will give me right path. I was using my phone but it gives me zigzag roads. Is there any device available that can give me accurate path and has the feature to extract longitude and latitude?