<commit_before>class CrimeMapController < UIViewController

  def viewDidLoad
    super

    @mapView = MKMapView.alloc.initWithFrame(CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height))
    @mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight
    self.view.addSubview(@mapView)
    @mapView.delegate = self

    #Init instance values
    @didInitialZoom = false
    @didInitialPinZoom = false
    @theDate = NSDate.date
    @thePoints = NSMutableArray.alloc.init

  	#Set the application title
  	self.title = "Winston-Salem Crime Map"
    
    #Setup the toolbar and navigationbar
    self.navigationController.setToolbarHidden(false)
    self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
    self.navigationController.toolbar.barStyle = UIBarStyleBlack;

    #Create buttons
    reZoomButton = UIBarButtonItem.alloc.initWithImage(
      UIImage.imageNamed("location.png"), 
      style: UIBarButtonItemStyleBordered, 
      target: self, 
      action: "rezoom:")
  	self.navigationItem.rightBarButtonItem = reZoomButton

    buttonItem1 = UIBarButtonItem.alloc.initWithTitle(
      "About",
      style: UIBarButtonItemStyleBordered,
      target: self,
      action: "loadAboutWindow:")
    #arButton = UIBarButtonItem.alloc.initWithTitle(
    #  "AR",
    #  style: UIBarButtonItemStyleBordered,
    #  target: self,
    #  action: "initAR")
  	flexibleSpace = UIBarButtonItem.alloc.initWithBarButtonSystemItem(
  		UIBarButtonSystemItemFlexibleSpace,
  		target:nil,
  		action:nil)

  	@activityView = UIActivityIndicatorView.alloc.initWithActivityIndicatorStyle(UIActivityIndicatorViewStyleWhite)
  	@activityView.hidesWhenStopped = true
  	@activityView.startAnimating()
  	@activityViewButton = UIBarButtonItem.alloc.initWithCustomView(@activityView)

    @dateButton = UIBarButtonItem.alloc.initWithTitle(
      "Loading data from server...",
       style: UIBarButtonItemStyleBordered,
       target: self,
       action: "changeDate:")
    
    #if Device.camera.front?
    #  self.toolbarItems = [buttonItem1, arBUtton, flexibleSpace, @activityViewButton, @dateButton]
    #else
      self.toolbarItems = [buttonItem1, flexibleSpace, @activityViewButton, @dateButton]
    #end


    #Send a request off to the server to get the data.
    loadData

  end

  #def initAR
  #  p "init AR"
  #end

  def viewWillAppear(animated)
    
    #Check to see if we've loaded the view into Winston-Salem yet
    if @didInitialZoom == false

      #Center on Winston-Salem.
      metersPerMile = 1609.344
      initialLocation = CLLocationCoordinate2D.new(36.10, -80.26)
      region = MKCoordinateRegionMakeWithDistance(initialLocation, 4 * metersPerMile, 4 * metersPerMile)
      @mapView.setRegion(region, animated:true)

      @didInitialZoom = true
    else
      puts "Initial zoom already done."
    end

  end    

  #This method loads the data from my server and sets the data into the @thePoints var
  def loadData

    @dateButton.title = "Loading data from server..."
    @activityView.startAnimating

    #Find the date to use
    dateFormat = NSDateFormatter.alloc.init
    dateFormat.setDateFormat("yyyy-MM-dd")
    dateString = dateFormat.stringFromDate(@theDate)
<commit_msg>CHanged text on loading button.<commit_after>class CrimeMapController < UIViewController

  def viewDidLoad
    super

    @mapView = MKMapView.alloc.initWithFrame(CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height))
    @mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight
    self.view.addSubview(@mapView)
    @mapView.delegate = self

    #Init instance values
    @didInitialZoom = false
    @didInitialPinZoom = false
    @theDate = NSDate.date
    @thePoints = NSMutableArray.alloc.init

  	#Set the application title
  	self.title = "Winston-Salem Crime Map"
    
    #Setup the toolbar and navigationbar
    self.navigationController.setToolbarHidden(false)
    self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
    self.navigationController.toolbar.barStyle = UIBarStyleBlack;

    #Create buttons
    reZoomButton = UIBarButtonItem.alloc.initWithImage(
      UIImage.imageNamed("location.png"), 
      style: UIBarButtonItemStyleBordered, 
      target: self, 
      action: "rezoom:")
  	self.navigationItem.rightBarButtonItem = reZoomButton

    buttonItem1 = UIBarButtonItem.alloc.initWithTitle(
      "About",
      style: UIBarButtonItemStyleBordered,
      target: self,
      action: "loadAboutWindow:")
    #arButton = UIBarButtonItem.alloc.initWithTitle(
    #  "AR",
    #  style: UIBarButtonItemStyleBordered,
    #  target: self,
    #  action: "initAR")
  	flexibleSpace = UIBarButtonItem.alloc.initWithBarButtonSystemItem(
  		UIBarButtonSystemItemFlexibleSpace,
  		target:nil,
  		action:nil)

  	@activityView = UIActivityIndicatorView.alloc.initWithActivityIndicatorStyle(UIActivityIndicatorViewStyleWhite)
  	@activityView.hidesWhenStopped = true
  	@activityView.startAnimating()
  	@activityViewButton = UIBarButtonItem.alloc.initWithCustomView(@activityView)

    @dateButton = UIBarButtonItem.alloc.initWithTitle(
      "Loading data...",
       style: UIBarButtonItemStyleBordered,
       target: self,
       action: "changeDate:")
    
    #if Device.camera.front?
    #  self.toolbarItems = [buttonItem1, arBUtton, flexibleSpace, @activityViewButton, @dateButton]
    #else
      self.toolbarItems = [buttonItem1, flexibleSpace, @activityViewButton, @dateButton]
    #end


    #Send a request off to the server to get the data.
    loadData

  end

  #def initAR
  #  p "init AR"
  #end

  def viewWillAppear(animated)
    
    #Check to see if we've loaded the view into Winston-Salem yet
    if @didInitialZoom == false

      #Center on Winston-Salem.
      metersPerMile = 1609.344
      initialLocation = CLLocationCoordinate2D.new(36.10, -80.26)
      region = MKCoordinateRegionMakeWithDistance(initialLocation, 4 * metersPerMile, 4 * metersPerMile)
      @mapView.setRegion(region, animated:true)

      @didInitialZoom = true
    else
      puts "Initial zoom already done."
    end

  end    

  #This method loads the data from my server and sets the data into the @thePoints var
  def loadData

    @dateButton.title = "Loading data..."
    @activityView.startAnimating

    #Find the date to use
    dateFormat = NSDateFormatter.alloc.init
    dateFormat.setDateFormat("yyyy-MM-dd")
    dateString = dateFormat.stringFromDate(@theDate)

{'fraction_non_alphanumeric': 0.0847846012832264, 'fraction_numerical': 0.007027192178429576, 'mean_word_length': 3.63012729844413, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6244915', 'n_tokens_mistral': 2060, 'n_tokens_neox': 2005, 'n_words': 422}