This question already has answers here:
iOS: how to get correctly battery level
(2 answers)
Closed 8 years ago.
I need help. I'm trying to make a battery monitor and I can't figure out how too. I'm not sure how any of UIDevice works...
See the related post below. I also hate to add that you should probably search stackoverflow first to see if someone has already answered your question.
iOS: how to get correctly battery level
This question already has answers here:
How to start a Go program as a daemon in Ubuntu?
(2 answers)
Closed 8 years ago.
Has anyone here written a deamon process in Golang? Can you walk me through how to do that? Useful links are welcome.
Yes this has been done. See the go-daemon project. Be aware that there are certain problems when the daemonization happens after goroutines are launched. See issue 227 for details.
At this time I'd recommend to use the utilities your operating system offers you. See this related question for solutions.
This question already has answers here:
Detecting when a space changes in Spaces in Mac OS X
(2 answers)
Closed 9 years ago.
I need code to run every time the user switches to a different space. So if a user goes from space 1 to 2, my desired method should be called. What would this go under. I looked under NSWorkSpace but didn't see anything applicable How do?
You looked right past it. The notification you're looking for is NSWorkspaceActiveSpaceDidChangeNotification.
This question already has answers here:
Objective-C for Windows
(14 answers)
Objective C on Windows or Linux
(4 answers)
Closed 9 years ago.
This is just an easy question!
I want to lean some objective-c but the problem I don't have a mac I've only PC with windows
is there any compiler and editor where I can type my code and run it on windows.
Thanks in advance.
Yes, you can learn Objective-C — for example, see here. But you won't be able to create OS X or iOS applications straight from a Windows machine.
You can try to install a Hackintosh or emulate OS X in VirtualBox or VMWare.
But, IMHO, all of this would be a real pain in the neck!
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am looking for a good geolocation api to use from bash. I want this call to return at the very minimum the name of the city I am in, and the state.
I imagine that there must be some site I can curl, or some scripting language that has a package that works. The machine does not have a GPS, but it does use wireless internet most of the time if that is needed.
I was looking at this problem again recently and found whereami, a geolocation bash script for Mac OS X Snow Leopard, which takes advantage of Core Location. This will tend to be much more precise than IP geolocation, and it works well in my tests.
Since whereami is not (officially) available for Swift 2 and Swift 3, I digged a bit deeper and found locateme what does its job on OSX 10.12.4:
Its asks for permission the first time, and then it works without any additional interaction. Also, the format parameter is nice:
geolocate-cli is still in alpha but should do the job.
Scraping the first Google hit result for "geoip" seems to work easily enough.
$ curl http://www.maxmind.com/app/locate_my_ip |
> awk '/<table>/{RS=RS RS}/tblProduct1/'
I haven't checked their EULA to see if using their service this way is okay, but they do also provide GeoIP libraries for C, Perl, Python, etc. with a "lite" database that you can distribute (with conditions).
If your platform is a *nixlike that supports network-manager, you can use this script:
curl "https://maps.googleapis.com/maps/api/browserlocation/json?browser=firefox&key=AIzaSyDBgL8fm9bD8RLShATOLI1xKmFcZ4ieMkM&sensor=true" --data-urlencode "`nmcli -f SSID,BSSID,SIGNAL dev wifi list |perl -ne "if(s/^(.+?)\s+(..:..:..:..:..:..)\s+(.+?)\s*$/&wifi=mac:\2|ssid:\1|ss:\3/g){print;}"`"
Check out How to create a script to query Google Browserlocation for more details.
Notice that there's some limit to this service. It was working fine, at first, but now I get "status" : "OVER_QUERY_LIMIT". I don't know what the limit is because I can only seem to find geocoding references, but if anyone knows, please tell me!
Wireless internet meaning WiFi, CDMA2k, UMTS, EDGE... ? And your carrier? Not that it matters.
Really. I'd start investing in a GPS dongle.