How to update value form plist using Objective-C

I have this challenge when I was doing a ios mobile application. My issue was to update an value of the plist from 0 to 1. 🙂 Sometimes it hard to find in the web with this kind of issue, very simple problem but lots of people can’t find in the web and for those people who are like me just starting to build more mobile application.

Here is the sample code.

Here is the sample plist what am talking about.

Screen Shot 2016-03-16 at 11.00.33 PM

Here is the code. I am assume that you already know how to get your record from the plist. How this works is when I press the button inside the UITableView it calls out the IProcess. The event capture the button possition of the button and get the indexPath selected.

- (IBAction)IProcess:(UIButton *)sender
    CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:dTableView];
    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:buttonPosition];
    // I will be getting the data from my mutable array data
    // with the selectedIndedPath from my uiTableView
    NSArray *copySelectedSection = [data objectAtIndex:indexPath.section];

    // Initialize my Value Fom the Plist
    NSMutableDictionary *ValueFromThePlist = [[NSMutableDictionary alloc] init];

    [ValueFromThePlist addEntriesFromDictionary:(NSDictionary *)copySelectedSection];
    // Get the value form the data
    NSNumber *isStatus = (NSNumber *)[ValueFromThePlist objectForKey:@"status"];
    // Create if statement to verify if the value of the status is 1 then if true set to 0
    if ([isStatus isEqualToNumber:[NSNumber numberWithInt:1]])
        [ValueFromThePlist setObject:[NSNumber numberWithInt:0] forKey:@"status"];
    // now since you have updated the value from the record you need to loop again the data from the plist and ammed the value you have selected.

    int ctr = 0;
    NSNumber *indexNumberRow =  [NSNumber numberWithInt:(long)indexPath.row];
    NSMutableArray *newSetOfarray = [NSMutableArray arrayWithCapacity:0];
    for (NSDictionary *mainSection in copySelectedSection) {
        if ([indexNumberRow isEqualToNumber:[NSNumber numberWithInt:ctr]])
            [newSetOfarray addObject:(NSArray*)ValueFromThePlist];
            [newSetOfarray addObject:(NSArray*)mainSection];
    NSString *filePath = [self getDatabasePath];
    NSError *error;
    NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:(NSDictionary *)newSetOfarray format:NSPropertyListXMLFormat_v1_0 options:NSPropertyListImmutable error:&error];
        [plistData writeToFile:filePath atomically:YES];

I hope this will help you as well to fix or to solve some simple things just like what I encountered. Happy Coding!!!

How to resolve 421 Too many connections (8) from this IP

I’ve been knocking my head and waiting for a very longest time for my turn to upload my files to server (because of my colleague is uploading large files to the server).  While waiting to that, I was murmuring so hard, I spelling out maybe she can upload using cPanel while waiting for couple of minutes or hours. On the otherside, Maybe I can do as well. Atleast I can do my job done.

anyways.. Here is a instruction how to resolve your issue with your filezilla connection issue.

1. Go to File
2. Choose Site Manager
3. Select Transfer Setting tab
4. Check/Tick the “Limit number of simultaneous connections”
5. Set the “Maximum number of connections” to 1


Sometimes  if you did the settings and still encounter the same issue. I suggest to restart your router so that it will completely shut off all the connection.

Alternative solution to fix the error 421, If you have an access to you cPanel account.

Go to you cPanel Account

Then you can eliminate any ftp connection connected.


Laravel 4.2 Login Auth via jQuery Ajax

My colleague design the login that pops up.

Here is my Javascript

// JavaScript Document Tabs 01
$(document).ready(function() {
	        type: "POST",
	        url: $(this).attr('action'),
	        dataType: "json",
	         data     : $(this).serializeArray(),
	         success: function(data) {
	            if (data.status) { 
// Success this should redirect or refresh the page. 
	            else {
	        error: function()

		return false;


and here is my controller function

public static function authLogin()
		$input = Input::all();

		// Entry Record 
		$dataRecord = array('Username'=>$input['txtUsername'],

		// For my Future used
		$session_id  = Session::getId();

		// Validation
		$validator = Validator::make($dataRecord, User::$rulesLogin);

		// Intialize Arayy 
		$data = array();
		$data['status'] = 0; // Reload the page success 
		if ($validator->fails())
			$htmlContent = "";
			$errors = $validator->errors()->getMessages();

			foreach ($dataRecord as $key => $value) {
				 $htmlContent .= "<p>".$errors[$key][0]."</p>"; /// I checked the result it is always zero // Then I assume that this display only zero // Lazy me. 
			$data['errorMessage'] =  $htmlContent;
			$rememberMe = false;	
			// Design doesn't capture remember me. 
			// So I remove it. 
			// if (isset($input['remember']))
			// {
			// 	$rememberMe = true;
			// }
			// validate the credentials 

			if (Auth::attempt(array('username' => $input['txtUsername'], 
									'password' => $input['txtPassword'], 
									'status'=>'1'), $rememberMe))
					if (Auth::check())

					$data['status'] = 1; // I assume that when status is success then I can reload the page / or do some redirection 
					$data['errorMessage'] =  trans('messages.LOGIN_LOGIN_DOES_NOT_EXIST');