GeoLocation from gpsd - google-chrome

The gpsd program lets linux users cleanly organize their GPS peripheral data, such that a command line program like cgps or a graphical one like xgps can read the data, and write to a socket, like /var/run/gpsd.sock.
There's a nice tutorial on the net for rigging a raspberry pi to use this data. This is all well and good, but how can I integrate this data in firefox or chromium, as the geolocation API? Is there a specific build process I might need? For instance, setting a ./configure flag or something? Is there a way to integrate this data in a prebuilt version of either browser?

Firefox on Linux supports gpsd - it was added in Firefox 4, removed in Firefox 23 and added back in Firefox 50.
However, it still needs to be enabled during build, with --enable-gpsd (which seems not to be the case yet in Ubuntu) and in the configuration, by following these steps:
Navigate to about:config
Create a new string preference, name geo.location.use_gpsd value true
Prior to Firefox 23, you had to:
Create a new string preference, name geo.gpsd.host.ipaddr value localhost
Create a new boolean value, name geo.gpsd.logging.enabled value true
Google Chrome had gpds support added in November 2011 and removed in October 2013. It looks like hardware GPS support is not a priority. If this was handled in Chrome OS, it might be possible to use the same mechanism, but I don't see support there either.
Someone built an extension which attempts to provide support in recent versions, requiring to install a script system-side.

Firefox on linux used to support gpsd.
Navigate to about:config
Create a new string preference, name geo.gpsd.host.ipaddr value localhost
Create a new boolean value, name geo.gpsd.logging.enabled value true
However, it seems that the gpsd support has been removed
Chromium seems to have had gpsd support in the past, but I can't find anything about it now. It looks like hardware gps support is not a priority. If this was handled in ChromeOS, it might be possible to use the same mechanism, but I don't see support there either.
In both cases, it should be possible to write an extension to fake the GPS coordinates, which could read from your real GPS.

Related

Current browser/system support for <a href="skype:some_id"> (with Microsoft live-ids)?

I vaguely remember that once one could place a link like in the following example on a website and a click on it (if the user had Skype installed) would fire up a Skype window and try to call/chat to the linked account:
Call me on Skype
There were even some browser addons for handling the "Skype-protocol" correctly. Today, Skype recommends to include a piece code which pulls in some javascript file from Microsoft's CDN instead.
What's the current (2017) situation in terms of browser support across operating systems for skype-links like in my example assuming that I do not want to pull stuff from Microsoft's CDN? Firefox 52 64bit on openSUSE Linux with default settings and no addons asks whether it should open Skype, so there is still some support for this method around. Chrome 58 on openSUSE does more or less the same.
Given the fact that this still works at least partially, how would one link to a Microsoft live id, which contains a colon? The following does not work unfortunately:
Call me on Skype
Both Firefox and Chrome fire up Skype, which then tries to call "live%3asome_id". Not escaping the colon kind of does not seem to work either ...

App working fine on emulator but crashes after downloading from store

I've developed an Windows Phone 8 app which is under beta testing and it is working fine on emulator without fail or crash. but after submitting the app on store as beta version and then download the app on device it load the home page and on navigating through home page it crashing. Actually I dont have the device to test, the error is reported by the beta users. I'm not getting that why my app is facing this error if it is working fine on emulator.
Any suggestion would be helpful. Thank you.
When creating an application that is going to be used worldwide, you must keep in mind that different countries use different ways of formatting dates or formatting number. When you use a parse method (double.Parse, DateTime.Parse, ...) without specifying a culture, the user's culture will be used, which often leads to crashes.
The workaround is simply to specify the culture you want to use. In the case of a date, you can event specify the precise date format you want to use.
// Parse a number by forcing the culture to en-US
double.Parse("13.25", CultureInfo.GetCulture("en-US"));
// Parse a date by forcing the culture to en-US
DateTime.Parse("12/31/2011", CultureInfo.GetCulture("en-US"));
// Parse a date by specifying the format
DateTime.ParseExact("12/31/2011", "MM/dd/yyyy", CultureInfo.GetCulture("en-US"));

How to disable Google Chrome source compression "?body=1"?

I'm trying to debug some JavaScript for a Rails project and its incredibly frustrating to go line by line when the source code is compressed in the Sources developer tab.
I know this compression is done by Chrome through the body variable. What I want to know is if there is any way to stop Chrome from compressing files in source view, i.e:
\application.js?body=1 --> \application.js
Thank you for your time.
Compression is being done by Rails. Disable it in your configuration:
# config/production.rb (or whatever environment you're in)
config.assets.compress = false
You might want to investigate a new feature in Chrome called Source Maps.
Source Maps allows Chrome to map the compressed source code it receives to the uncompressed original, which in turn means that you can debug the code, even though it's been compressed.
This feature should help you get around this kind of problem without having to change the compression settings on your server.
You can read more about it here: http://blog.mascaraengine.com/news/2012/4/16/sourcemap-support-in-chrome-greatly-improves-debugging.html
I believe this feature is still in test and not yet in the final release version of Chrome. I'm sure it will arrive in due course, but for the time being you may need to install the "Canary" version of Chrome, ie the pre-release version that includes all the forthcoming features that they're still working on.

How to backup browser state after Watir automation

Summary of tools:
watir-webdriver 1.8.17
Mac OS X 10.7.3
Chrome 18.0.1025.151
I'm currently using Watir WebDriver to automate Chrome sessions across a number of websites. I need to backup the state of the web browser (cookies, cache, etc.) at certain points throughout the session. Originally, I figured I could do this with Ruby's file IO library by copying ~/Library/Application Support/Google/Chrome/Default at the necessary points. However, it does not appear that Chrome sessions created with Watir WebDriver store the needed information in this default location. How can I locate this data to back it up? Is this information stored elsewhere? Is there something other than Watir that would make this easier?
I finally have a solution!
It appears that watir-webdriver stores the browser state/user data in random path. By default this can be found here (where XXXXXX is the random identifier):
/private/var/folders/2v/vkd2v3vs5njf69m59nqzc16m0000gn/T/.com.google.Chrome.XXXXXX/Default/
Instead of relying on this default and randomized path, you can specify a precise location for the user data using the following flag:
Watir::Browser.new :chrome, :switches => %w[--user-data-dir=/path/to/user/data]
Then the cache, cookies, etc. can be backed up, deleted, etc. using Ruby's standard library. Hopefully this helps someone else.
Edit: If you are unable to find where watir-webdriver is storing your user data by default, find Chrome's process id by running watir-webdriver and top. Once you have the pid, type lsof -p <pid> into terminal to find the path to the user data.
Another thing I like to do is serialize(save) the Watir::Browser object into a file using YAML, like so:
require "yaml"
File.open("browserObj.yaml", 'w').write YAML::dump(#browser)
This browserObj.yaml file will then contain all sorts of internal details in easily readable/parseable text, including PID of whichever browser, path to temp profile, etc. Eg.
profile_dir: /tmp/webdriver-rb-profilecopy20121201-1981-9o9t9a

How would I go about creating a custom protocol that would always open an address with a specific browser?

Okay, so I'm a student programmer in my college's IT department, and I'm doing browser compatibility for a web form my boss wrote. I need the user to be able to open a local file from a shared drive with a single click.
The problem is that Firefox and Chrome don't allow that for security reasons. Thus, I'm trying to write a custom protocol of my own to open an address in Internet Explorer regardless of the browser being used.
Can anyone help me with this? I'd also be willing to try an alternative solution to the problem.
The below worked for me, is this what you mean?
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\foo]
#="URL: foo Protocol"
"URL Protocol"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\foo\DefaultIcon]
#="C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\foo\shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\foo\shell\open]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\foo\shell\open\command]
#="C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe \"%1\""
Just to note, I'm running Win7Pro, so you may have to move around file path(s) to conform to your environment.
And if that doesn't work, create a proxy between the protocol and the browser, pass the argument(s) from foo:// to that, parse what's necessary, then hand it off to IE using start iexplorer.exe "args".
I'm unsure whether I understand your question, if it is how do I open local files using chrome/firefox, this is your anwser:
First a disclaimer, I have never done this and cannot vouch for the accuracy of my response
IE
Microsoft's security model is pretty fail so you can go right ahead and open these files
FireFox
Some quick googling found that Firefox can do this after either editing prefs.js as outlined here or installing an addon called LocalLink
Chrome
Practically impossible due to its security, until now when locallink was ported to chrome.