In Geospatial API documentation, says
Check VPS availability in your app
The Geospatial API can be used in any place where the device is able to determine its location. If your AR experience hinges on VPS coverage, you can use AREarthManager.CheckVpsAvailability() to obtain a VpsAvailabilityPromise, an asynchronous task that checks the VPS availability at a given horizontal position. Once you have the VpsAvailabilityPromise, you can obtain its result by polling.
But I can't use it. It doesn't exist. I know that this is static func...
I need to check if VPS is enabled or not. I just wonder why the function described in the official documentation doesn't exist.
First thing to do it's add this line of code at the top of your file:
using Google.XR.ARCoreExtensions;
After that you can use AREarthManager in your code, so for use that function you have to do this:
AREarthManager.CheckVpsAvailability(latitude, longitude);
Where latitude and longitude are a double variable where you want to check if vps is available
Related
I've got Sony A6000 camera with the latest firmware(3.20) and latest Smart Remote Control application (4.30). I've been trying to write application for transferring images, but faced with issues.
I can't switch camera function to Contents Transfer mode.
Repro steps:
Run Smart Remote Control app on my camera;
Sucesfully connect device to camera via WI-FI;
Discover the camera with parameter ST=urn:schemas-sony-com:service:ScalarWebAPI:1;
Receive response Location http://ip:port/scalarwebapi_dd.xml (instead mentioned in doc http://ip:port/dd.xml);
Parsed scalarwebapi_dd.xml contains guide, accessControl and camera services (instead mentioned in doc camera, system and avContent);
Request with getAvailableApiList method return the following:
getVersions, getMethodTypes, getApplicationInfo, getAvailableApiList, getEvent, startRecMode, stopRecMode.
Successfully run request with "startRecMode" method;
"getAvailableApiList" result doesn't contain "getCameraFunction" and
"setCameraFunction"
"getCameraFunction" return the following result:
{"id":1,"error":[1,"Not Available Now"]}
What I'm doing wrong?
Smart Remote 4.30 should give you the avContent services. I had an older version that had the same guide, accessControl, camera but after I updated it had the avContent service.
You can also try using getEvent to troubleshoot the camera status. This could shed some light into why the services aren't available.
I have just converted some existing VMs to v2 (Resource Manager) VMs, and subsequently updating scripts etc.
I have this line to find out the status (stopped / running / starting) of machines.
string URL = string.Format("https://management.azure.com/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Compute/virtualmachines/{2}?api-version=2015-05-01-preview",
SubscriptionID,
ResourceGroup,
ComputerName
);
In the classiccompute model I would get some json that I could parse to find status. Now however all I get is json object describing my machine. (size, attached disks etc)
No problem I thought! there's going to be an earlier version of the API that gives what I'm looking for I found a versioning document that talks about the service management versions but I can't find anything about the ARM versioning.
No problem I thought, I'll see what Powershell does. Alas it seems to read the same API, and give the same information. (and obviously service management mode no longer sees my VM)
From what I've seen in the last hour of poking around this, there's no way of checking the status of a v2 VM. I imagine I'm missing something that is getting lost in the sea of V1 google results.
How do I find out if my v2 VM is running? (bonus points for a document that covers the ARM api versions!)
After some further digging around! it appears the answer is to append /instanceview to the URI which will give the state of all of the attached resources.
For powershell there is the -status parameter for Get-AzureVM which will give the same json resource.
I am running an asp.net mvc website, and i want to block every user that reaches my site through TOR. By now i have two solutions:
Download list of TOR exit nodes once every hour, store that list in
memory, and check every request IP address with that list.
Try to block TOR exit nodes with windows firewall - i think that this would
be better, but i don't know how to do that.
Is there any other possible solution? Have any of you maybe had a similar problem to mine? How did you solve it?
The answer is absolutely the second option you listed. You will have to download a list of known exit node IP's every so often regardless of which solution you use, but using the firewall that already exists is much more simple than rolling your own primitive replica.
How the IP's can be added to the firewall depends on your version of Windows. A previous StackOverflow question whose answer includes links that explain how to programmatically block IP addresses via the Windows Server 2008 firewall can be found here.
Here(https://github.com/RD17/DeTor) is a simple REST API which use TorDNSEl to determine whether a request was made from TOR network or not. I think it will be pretty simple to use it from C# with RESTSharp for example.
The request is:
curl -X GET http://detor.ambar.cloud/.
The response is
{
"sourceIp": "104.200.20.46",
"destIp": "89.207.89.82",
"destPort": "8080",
"found": true
}
As a bonus you can add a badge to your site to detect whether a user comes from TOR or not:
<img src='http://detor.ambar.cloud/badge' />
I am tasked to get the location where our SQL Server database is geographically located via C# code because it may vary time to time due to frequent relocation of our database to protect it from physical and cyber harm. Is this possible or another dream of my boss thanks in advance.
1 - Buy somethihng like this. It's a UPS GPS receiver.
2 - Connect it to the server machine.
3 - Write a batch or shell script that will call the GPS software and return the current position.
4 - Use xp_cmdshell to call this script and return the current position via SQL Server query.
Buy an iPhone/Android phone and have it sellotaped to the top of the machine that has the database on it. Write a quick app to have it look at the GPS API and post it's position to the database the phone is connected on using some kind of JSON/SOAP API over HTTPS (for security purposes).
You can then access the GPS information from where you are using C#.
Edit
Working with the GPS on Mono/iPhone: http://drdobbs.com/mobility/222600599
Example code, GPS on Mono/Android: https://github.com/gshackles/Sample-Projects/blob/master/MonoDroid/MonoDroidSamples/MonoDroidSamples/DemoActivities/LocationDemo/LocationActivity.cs
The simplest solution is to do a DNS lookup, then use an IP location service as Cody suggested. Try this:
var foo = Dns.GetHostEntry("database.windows.net");
Once you've got your IP address, you'll need to load something like http://www.iplocationfinder.com/65.55.23.107 using an HttpWebRequest, unless you want to pay for an IP location database. Once you've got the response to the HttpWebRequest, you can use a regular expression to parse the location name, or latitude and longitude if you need that instead.
Do you have so many servers which are moved around overnight in your company or is this for a cloud db setup? the IP address is probably a basic inaccurate-better than nothing starting point.
As Davide Piras mentioned you can use for example this site : http://ip-lookup.net/ to trace the IP Address of you're DB Server and you can grab the Output maybe using Regular Expresion's or http://htmlagilitypack.codeplex.com/ .
Bu that works only if you can get you're DB Server IP Address ,which i think shouldn't be an Issue because you need the IP for the Connection String .
To achieve that use a WebBrowser Control ,do webbrowser1.navigate("http://ip-lookup.net/");
than :
HtmlElementCollection elc = this.webBrowser1.Document.GetElementsByTagName("input");
foreach (HtmlElement el in elc)
{
if (el.GetAttribute("type").Equals("text") && el.GetAttribute("name").Equals("ip"))
{
el.InnerText = "Server IP";
}
}
next :
HtmlElement form = webBrowser1.Document.GetElementById("form_single_IP");
if (form != null)
form.InvokeMember("submit");
//Submit the form
and try to filter the output because im not very good using Regex .You can capture the Output by using webbrowser1.DocumentText;
Why not use the database to tell you the location? To clarify what I mean:
Using SQL CLR Stored Procedure To Track IP Address - but make the CLR sproc return the ipaddress of the server its hosted on.
I saw the azure connection string you mentioned to Cody and thought these would be a handy links:
http://blogs.msdn.com/b/windowsazure/archive/2011/07/06/windows-azure-deployments-and-the-virtual-ip-address.aspx
Get Azure public IP address from deployed app
Determining the time zone is probably the best you can do from SQL Server, but that could be enough for you based on your description. You can use this query to get the GMT offset of the time zone where the server is located:
SELECT DATEDIFF(hh, GETUTCDATE(), GETDATE()) AS ServerTimeZone
From this result, you can easily add some logic to return the time zone abbreviation, i.e. EST, CST, etc. I know this isn't much, but hopefully it helps.
If someone already physically moves the server, why not write some script that writes the corresponding location to DB? When the machine starts up, auto-start that tool and have the "mover" select a location.
I have some wrapper code that runs a set of NUnit tests that scan live websites for certain response codes.
I'd like to run these tests against a different server. When running manually, I can do this by editing the /etc/hosts file in Windows\System32\drivers and temporarily setting www.mysite.com to 10.0.0.whatever
Is there any way I can do the same within a .NET console application - temporarily override a DNS record or somehow intercept the resolution and return a different IP address?
EDIT: This is for testing multiple servers in a web farm. I have three live servers, all of which THINK they are www.example.com. Because the servers use HTTP host headers, I can't just run a test against server1, then server2, then server3, because an HTTP request to http://server1/ will NOT return the same thing as a request to http://www.example.com/ that's resolved to server1...
In the past with C++ I was able to hook to the WSOCK32.DLL's gethostbyname function and reroute DNS requests. I used the Microsoft Detours library to do that.
As for C# I found this: http://easyhook.codeplex.com/ maybe it will help you. Basically you can hook to the gethostbyname windows function and execute your own code or return a different result (different IP).
The other possible solution is to temporarily (and programatically) edit the hosts file when the application starts and ends. From your own code.
EDIT: I found my old C++ code, maybe it will give you a hint what to do.
struct hostent FAR * WSAAPI MyGetHostByName(IN const char FAR * name)
{
// Call the regular function
struct hostent* ret = GetHostByNameFunction(name);
// Check if it's the hostname you want to reroute
if ( strcmp(host, (char*)name) == 0 )
{
// Edit the IP returned by the regular gethostbyname
ret->h_addr_list[0] = hostIP;
ret->h_length = 15;
}
// Return the result
return ret;
}
EDIT2: Found another link with newer release of easyhooks