Information Technology

Help!! I get fatal error whenever I try to obtain the user location

iOS Programming - 8 hours 9 min ago

This is my code. The error happens at this line: mapView.showsUserLocation = true

Please Help.

//

// MainVC.swift

// aidkit

//

// Created by Roberto Guarneros on 1/15/19.

// Copyright © 2019 Roberto Guarneros. All rights reserved.

//

import UIKit

import MapKit

import CoreLocation

class MainVC: UIViewController, MKMapViewDelegate {

@IBOutlet var helpLabel: UILabel!

@IBOutlet weak var mapView: MKMapView!

let locationManager = CLLocationManager()

let regionInMeters: Double = 10000

override func viewDidLoad() {

super.viewDidLoad()

checkLocationServices()

NotificationCenter.default.addObserver(self, selector: #selector(showFirstAidKit), name: NSNotification.Name("ShowFirstAidKit"), object: nil)

NotificationCenter.default.addObserver(self, selector: #selector(showCPR), name: NSNotification.Name("ShowCPR"), object: nil)

NotificationCenter.default.addObserver(self, selector: #selector(showBleeding), name: NSNotification.Name("ShowBleeding"), object: nil)

NotificationCenter.default.addObserver(self, selector: #selector(showChoking), name: NSNotification.Name("ShowChoking"), object: nil)

NotificationCenter.default.addObserver(self, selector: #selector(showSeizures), name: NSNotification.Name("ShowSeizures"), object: nil)

NotificationCenter.default.addObserver(self, selector: #selector(showSprains), name: NSNotification.Name("ShowSprains"), object: nil)

NotificationCenter.default.addObserver(self, selector: #selector(showBurns), name: NSNotification.Name("ShowBurns"), object: nil)

NotificationCenter.default.addObserver(self, selector: #selector(showFractures), name: NSNotification.Name("ShowFractures"), object: nil)

NotificationCenter.default.addObserver(self, selector: #selector(showMap), name: NSNotification.Name("ShowMap"), object: nil)

NotificationCenter.default.addObserver(self, selector: #selector(showHelp), name: NSNotification.Name("ShowHelp"), object: nil)

}

func setUpLocationManger() {

locationManager.delegate = self

locationManager.desiredAccuracy = kCLLocationAccuracyBest

}

func centerViewOnUserLocation(){

if let location = locationManager.location?.coordinate{

let region = MKCoordinateRegion.init(center: location, latitudinalMeters: regionInMeters, longitudinalMeters: regionInMeters)

mapView.setRegion(region, animated: true)

}

}

func checkLocationServices(){

if CLLocationManager.locationServicesEnabled(){

setUpLocationManger()

checkLocationAuthorization()

}else {

//show alert

}

}

func checkLocationAuthorization(){

switch CLLocationManager.authorizationStatus(){

case .authorizedWhenInUse:

mapView.showsUserLocation = true

centerViewOnUserLocation()

locationManager.startUpdatingLocation()

break

case . denied:

break

case .notDetermined:

locationManager.requestWhenInUseAuthorization()

break

case .restricted:

break

case .authorizedAlways:

break

}

}

@objc func showFirstAidKit(){

performSegue(withIdentifier: "ShowFirstAidKit", sender: nil)

}

@objc func showCPR(){

performSegue(withIdentifier: "ShowCPR", sender: nil)

}

@objc func showBleeding(){

performSegue(withIdentifier: "ShowBleeding", sender: nil)

}

@objc func showChoking(){

performSegue(withIdentifier: "ShowChoking", sender: nil)

}

@objc func showSeizures(){

performSegue(withIdentifier: "ShowSeizures", sender: nil)

}

@objc func showSprains(){

performSegue(withIdentifier: "ShowSprains", sender: nil)

}

@objc func showBurns(){

performSegue(withIdentifier: "ShowBurns", sender: nil)

}

@objc func showFractures(){

performSegue(withIdentifier: "ShowFractures", sender: nil)

}

@objc func showHelp(){

performSegue(withIdentifier: "ShowHelp", sender: nil)

}

@objc func showMap(){

performSegue(withIdentifier: "ShowMap", sender: nil)

}

@IBAction func onMoreTapped() {

print ("Toggle Side Menu")

NotificationCenter.default.post(name: NSNotification.Name("ToggleSideMenu"), object: nil)

}

@IBAction func helpButton(_ sender: Any) {

if helpLabel.isHidden {

helpLabel.isHidden = false

} else {

helpLabel.isHidden = true

}

}

@IBAction func linkButton1(_ sender: Any) {

UIApplication.shared.open(URL(string: "https://youtu.be/cosVBV96E2g")! as URL, options: [:], completionHandler: nil)

}

@IBAction func linkButton2(_ sender: Any) {

UIApplication.shared.open(URL(string: "https://youtu.be/y8CYSFgBJiI")! as URL, options: [:], completionHandler: nil)

}

@IBAction func linkButton3(_ sender: Any) {

UIApplication.shared.open(URL(string: "https://youtu.be/SwJlZnu05Cw")! as URL, options:[:], completionHandler: nil)

}

@IBAction func linkButton4(_ sender: Any) {

UIApplication.shared.open(URL(string: "https://youtu.be/Ovsw7tdneqE")! as URL, options: [:], completionHandler: nil)

}

@IBAction func linkButton5(_ sender: Any) {

UIApplication.shared.open(URL(string: "https://youtu.be/BZMD3cfyjVI")! as URL, options: [:], completionHandler: nil)

}

@IBAction func linkButton6(_ sender: Any) {

UIApplication.shared.open(URL(string: "https://youtu.be/EaJmzB8YgS0")! as URL, options: [:], completionHandler: nil)

}

@IBAction func linkButton7(_ sender: Any) {

UIApplication.shared.open(URL(string: "https://youtu.be/2v8vlXgGXwE")! as URL, options: [:], completionHandler: nil)

}

}

extension MainVC: CLLocationManagerDelegate {

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {

guard let location = locations.last else { return }

let region = MKCoordinateRegion.init(center: location.coordinate, latitudinalMeters: regionInMeters, longitudinalMeters: regionInMeters)

mapView.setRegion(region,animated : true)

}

func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {

checkLocationAuthorization()

}

}

submitted by /u/robertguarneros
[link] [comments]

Can somebody help me improve this baby app?

Learn Programming - 8 hours 14 min ago

https://github.com/jakehamtexas/Loan_Repayment_Utility

I tried to make the smallest project possible, basically. I'm hoping for some feedback. Is there anything that's counterintuitive, hard to understand? Any feedback is very welcome!

Project is written in C#, FWIW

submitted by /u/bluefish1432
[link] [comments]

Are programmers this cruel?

Learn Programming - 8 hours 18 min ago

A friend told me that it is hard to learn programming. Even in schools. He said that no programmer would teach me becouse that's how they could get rich that i can't program so i ask them to so some coding for money. And if I want to learn programming i have to get in this programmer community. Is this true? (sorry for bad English if i did write anything bad)

submitted by /u/Tobislav
[link] [comments]

I can code but dont know how to make an app

Learn Programming - 8 hours 27 min ago

So I'm in my second year of University of Comp Sci. I know 3 languages enough to solve a fair share coding problems and make programs that lack a real GUI. I know since I'm asking this question, I still have a long road ahead of me in coding, but I wanna speed it up and want to make some apps even though I know I'll get there from University eventually.

My main weakness is making files interact with each other and different user info. If I wanted to make a clone of Uber for example. Getting a login, validating it, storing user info specifically and for multiple users, maps integration, and the actual features, I dont know where to start. What would be the best way to learn?

submitted by /u/bruhsmh
[link] [comments]

Microsoft blue biz bug bounty bonanza beckons

The Register - 8 hours 30 min ago
Azure DevOps Services invites hackers to test its limits

There's more money to be made from bug hunting in Microsoft code after Redmond announced its 10th active bug hunting reward scheme, the Azure DevOps Bounty Program.…

Topics of research in Computer Science

Hello everyone! I wonder, what are the latest topics of research in Computer Science!

submitted by /u/durgesh2018
[link] [comments]

Weekly [Discussion] Thread

Pull up a chair and put that work away, it's Friday! /r/Tasker open discussion starts now

Allowed topics - Post your tasks/profiles

  • Screens/Plugins

  • "Stupid" questions

  • Anything Android

Happy Friday!

submitted by /u/AutoModerator
[link] [comments]

Long-Range RFID With Feedback

Hack a Day - 8 hours 52 min ago

Not long ago, we published an article about researchers adding sensor data to passive RFID tags, and a comment from a reader turned our heads to a consumer/maker version which anyone can start using right away. If you’re catching up, passive RFID technology is behind the key fobs and stickers which don’t need power, just proximity to the reader’s antenna. This is a much “hackier” version that works with discrete signals instead of analog ones. It will not however require writing a new library and programming new tags from the ground up just for the user to get started, so there is that trade-off. Sparkfun offers a UHF reader which can simultaneously monitor 25 of the UHF tags shown in this paper.

To construct one of these enhanced tags, the antenna trace is broken and then routed through a switching device such as a glass-break sensor, temperature limit switch, doorbell, or light sensor. Whenever continuity is restored the tag will happily send back its pre-programmed data, and the reader will acknowledge that somewhere one of the tags is seeing some activity. Nothing says this could not be applied to inexpensive RFID readers should you just want a temperature warning for your gecko terrarium or light sensor to your greenhouse‘s sealed controller.

Thank you, [Mike Massen], for your tip on RFID Doing More Than ID.

Light gaming laptop/desktop

I don’t know how much information you guys need, so I’m going to basically say everything. Sorry for the long post, but I know nothing about computer hardware.

I’d prefer a laptop but I’m looking for a computer to do some light gaming and video streaming. Right now I only play grim dawn offline with a lan connection for multiplayer, but would like something that could run online games without lag but probably not anything too intense. I don’t play games much and usually play one until the end then uninstall then find a new game.

I also use Hulu/Netflix/Prime/HBO streaming daily so good internet connection is a must, although I don’t think that has much to do with the computer itself but more the internet connection and router? I’m not sure.

Battery life isn’t that important to me because I usually have it plugged in 24/7 unless I take it to the kitchen to read a recipe off or watch an episode while cooking/taking a bath.

I feel like most laptops could do this for me, but I don’t want to be screwed by overestimating the computer. I’d like to spend under 500 preferably closer to 200-300. But if you think I can’t get this without spending more, please let me know!

Thank you guys for all your help!

submitted by /u/iuqram
[link] [comments]

I seriously can't figure this out

Learn Programming - 8 hours 56 min ago

How do you paste in git bash? I know copy is control+shift+c, but control+shift+v doesn't work when I'm trying to paste. It's really annoying especially when I'm trying to clone a github repo with git bash and I have to type out the url because I still can't figure out how to copy and paste on this. All the tutorials I've read/seen seem outdated!

submitted by /u/SnowTheCone
[link] [comments]

Overwhelmed by HTML and CSS tags?

Learn Programming - 8 hours 57 min ago

This past week I've started learning how to use HTML and CSS. I was doing pretty well up until I started doing things with flex box and grids. I'm using freecodecamp.org to learn, but when it comes to doing things on my own I find myself forgetting or remembering that half the tags exist. I know it is only going to get more complicated when I dive into JS and the back-end of web development. I'm sure it is normal to be overwhelmed at the start, but is there something I should be doing to "memorize" more of the tags in languages or does it just come with experience?

submitted by /u/ItsFreakout
[link] [comments]

Folders for java projects in eclipse?

Learn Programming - 8 hours 58 min ago

I have a ton of project folders in my package explorer, so is there a way for to make regular folders to organize them? Someone told me to working sets but I don't think that is the correct way. I want to make folder for my labs, class projects, side projects etc..

submitted by /u/SneakGeek1337
[link] [comments]

Quick python scraping question using beautiful soup

Learn Programming - 9 hours 3 min ago

So I'm working on a little project to learn about python and what not, this is my first time scraping a page online so this may be an obvious answer I'm not sure.

Trying to scrape this page for some basic data, eventually trying to save the info into a JSON then use node to do a small api sort of thing online.

Page I'm scraping: https://www.pro-football-reference.com/players/K/KelcTr00.htm

So I'm trying to just collect all the rows in the first stats table. I'm using this code:

import requests from bs4 import BeautifulSoup url = 'https://www.pro-football-reference.com/players/K/KelcTr00.htm'

r = requests.get(url, timeout=10) html = r.text soup = BeautifulSoup(html, 'html.parser')

whole_season = {} rows = soup.find_all(id="stats")

I thought using id = "stats" would only grab the stats.65-80 + stats.0 (which is what I want). But for some reason its picking up both the last elements in the table, how come?

submitted by /u/DunkyourSausage
[link] [comments]

Command line utility requests

Command Line - 9 hours 5 min ago

I have 2 months of free time and am planning to make 3 command line utilities. I'm making them open source ofc. Any ideas?

submitted by /u/milanoscookie
[link] [comments]

Looking to program small RF transmitter to send 2-bit signal

Learn Programming - 9 hours 7 min ago

Not too new to programming and unsure if this is the right subreddit to ask this question in

Hey guys, for my next personal project I'm looking to acquire and program and small "button," for lack of a better word, that will send a 2-4 bit signal (only need 2 for proof of concept) up to 300 ft and an accompanying receiver to process the signal. Programming hardware and radio frequencies are all completely new to me and mainly what I am looking for is: * Where to get the equipment for relatively cheap? * How do I program the transmitter and receiver? * What would I need to do to create an application that interfaces with the hardware receiver when a signal is processed?

Once again, apologies if this is in the wrong subreddit.

Also, while I am mainly looking for starting points, any tutorial links or general info dumps into the world of hardware programming and RF stuff would be greatly appreciated!

submitted by /u/kkdelux
[link] [comments]

MVC in Java: Controller and View Confusion?

Learn Programming - 9 hours 9 min ago

I keep thinking I understand MVC; however one problem persists.

If controller is responsible for the actions of JButtons, and View is responsible for showing those buttons, how am I supposed to connect them both?

I.E. Declare and set the options of the start button to be visible in the window, which is in the view class. Yet, I have the action Listener in the Controller class, and it's supposed to be the same button?

is a this and return statement needed for this?

submitted by /u/Zillakazi
[link] [comments]

Pages