Categories
Python Uncategorized

Change a value with configparser for python

configparser is a great module to store configuration information into a filehttps://docs.python.org/2/library/configparser.html a config file could look like this: To load the value from the file To change the value in the file:

Categories
Python Uncategorized

Dictionary changed size during iteration while using pop() in python

Running through a json file remove all keys but one This is fine running python2 but in python3 you will run into this error Calling keys() in python2 makes a copy of the keys that we iterate through. This is not how it works in python3, this returns an iterator instead of a list, hence […]

Categories
Python Uncategorized

Remove non letter characters before and after characters in Python

To remove none letters characters from the beginning and end in python use regex from the re.py library. I needed it to remove spaces as well but not in between the words. Here’s what I did: Output:

Categories
Uncategorized

Xcode UIToolbar Set Height Is Locked

The object in Xcode: UIToolbar is locked when using the Interface Builder at 44 px tall. You can easily change this programmably by using setFrame [myToolbar setFrame:CGRectMake(0,50,320,30)]; However you are able to do this in the Interface Builder as well by creating a constraints for the UIToolbar. Select the toolbar element and choose Editor > […]

Categories
Uncategorized

Set The Text Of A Back Button On A UINavigationBar

To set the text of a back button on a UINavigationBar you can set it like this for you iPhone app: UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle: @”Back Button Text” style: UIBarButtonItemStyleBordered target: nil action: nil]; [self.navigationItem setBackBarButtonItem: backButton]; [backButton release];   Further information