<commit_before>import UIKit
import CoreData

class ViewController: UIViewController {
                            
    @IBOutlet var txtUsername: UITextField
    @IBOutlet var txtLastname: UITextField
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func btnLoad(sender: UIButton) {
        // Fetch the AppDelegate
        var appDel:AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
        
        // Fetch the NSManagedObjectContext
        var context:NSManagedObjectContext = appDel.managedObjectContext as NSManagedObjectContext
        
        // Create a request
        var request:NSFetchRequest = NSFetchRequest(entityName: "Users")
        // Return a list of objects that we are looking for
        request.returnsObjectsAsFaults = false
        
        // Create a predicate(filter) for the request
        request.predicate = NSPredicate(format: "username = %@", txtUsername.text)
        
        // Execute the request
        var results = context.executeFetchRequest(request, error: nil)
        
        if results.count > 0{
        
            for res in results{
                var user = res as Users
                println("User: \(user.username), \(user.password)")
            }
            println("Found \(results.count) results!")
        }else{
            println("No result found!")
        }
        
    }
    @IBAction func btnSave(sender: UIButton) {
        
        // Fetch the AppDelegate
        var appDel:AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
        
        // Fetch the NSManagedObjectContext
        var context:NSManagedObjectContext = appDel.managedObjectContext as NSManagedObjectContext
        
        // Fetch the user entities
        let ent = NSEntityDescription.entityForName("Users", inManagedObjectContext: context)
        
        // Create a new user object
        var newUser = Users(entity: ent, insertIntoManagedObjectContext: context)<commit_msg>Use the Users methods<commit_after>import UIKit
import CoreData

class ViewController: UIViewController {
                            
    @IBOutlet var txtUsername: UITextField
    @IBOutlet var txtLastname: UITextField
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func btnLoad(sender: UIButton) {
        // Fetch the AppDelegate
        var appDel:AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
        
        // Fetch the NSManagedObjectContext
        var context:NSManagedObjectContext = appDel.managedObjectContext as NSManagedObjectContext
        
        // Create a request
        var request:NSFetchRequest = NSFetchRequest(entityName: "Users")
        // Return a list of objects that we are looking for
        request.returnsObjectsAsFaults = false
        
        // Create a predicate(filter) for the request
        request.predicate = NSPredicate(format: "username = %@", txtUsername.text)
        
        // Execute the request
        var results = context.executeFetchRequest(request, error: nil)
        
        if results.count > 0{
        
            for res in results{
                var user = res as Users
                println("User: \(user.username), \(user.password)")
                println(user.ToString())
                user.AddPrefix("YoYo")
                printlne(user.ToString())
            }
            println("Found \(results.count) results!")
        }else{
            println("No result found!")
        }
        
    }
    @IBAction func btnSave(sender: UIButton) {
        
        // Fetch the AppDelegate
        var appDel:AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
        
        // Fetch the NSManagedObjectContext
        var context:NSManagedObjectContext = appDel.managedObjectContext as NSManagedObjectContext
        
        // Fetch the user entities
        let ent = NSEntityDescription.entityForName("Users", inManagedObjectContext: context)
        
        // Create a new user object
        var newUser = Users(entity: ent, insertIntoManagedObjectContext: context)
{'fraction_non_alphanumeric': 0.07207792207792207, 'fraction_numerical': 0.0004329004329004329, 'mean_word_length': 2.1435374149659863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5512623', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1116, 'n_words': 329}