SQLite’s alter table command only supports renaming the table and adding a column. If you need to alter a column (say, to change it’s length), the high-level process looks like this: export the data, drop the table, recreate the table with the updated column, then import the data. You can use SQLite’s dot commands to achieve that with minimal fuss.
If you’re using Django, it’ll take care of creating the table for you. Just update your models.py to reflect your new changes, then the workflow looks like this:
If you’re looking for RegexKitLite 3.3, it’s a little less than intuitive to find it. I eventually found it here after just grabbing the URL for the 4.0 release and changing it to 3.3.
Why would you want an older version? According this this post on the Cocoa Dev mailing list apps have been rejected for using RegexKitLite 4.0. You can either replace your 4.0 version with 3.3, or just add the -DRKL_BLOCKS=0 flag to your OTHER_CFLAGS build settings in Xcode (much simpler in my opinion).
When you are trying to setup push notifications for an iOS application, you will need to send your device token to a provider. The device token is passed to you by the operating system as binary data. If you need to talk to your provider over HTTP, you’ll need to convert the device token to a string.
At this point, deviceTokenStr will contain the device token as a string, so it can be passed to your provider over HTTP. You might consider throwing that snippet into a category if you need to use it in various spots throughout your app.
Now in a view controller, you try to use the category.
12345678910
@implementationMyViewController-(void)doSomethingAwesome{User*user=[[Useralloc]init];// output - Your name is:NSLog(@"Your name is: %@ %@",user.name.first,user.name.last);[userrelease];}@end
The NSLog statement above will output Your name is:. Why does it not use your category? The reason makes sense now, but was a bit confusing at first. In the example above, the name property on the User object in the view controller is actually nil. So when you ask for the first property on the Name object, it actually sends the message to a nil pointer, which is not a Name object. Thus, it never hits your category.
The solution is to either instantiate an empty Name object when you create a user, or change your category to extend the User object and return a populated Name object when the name property is accessed.
Generally when you view an SVN repository over HTTP, you are looking at the HEAD revision. Using the process described below, you can view a specific revision of the repository.
To make a UITableView transparent, you just need to set it’s opaque property to NO and make the background clear.
12345678
-(void)viewDidLoad{[superviewDidLoad];// assuming you are in a view controller and it contains// a property called tableViewself.tableView.opaque=NO;self.tableView.backgroundColor=[UIColorclearColor];}
Now whatever you have behind your UITableView will shine through. This technique works for all other UIView subclasses too (UITextView, etc…).
If you are using an NSFetchedResultsController and fetching the data using an NSPredicate, you may have seen this nasty message:
12
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** - \
[CALayerArray evaluateWithObject:]: unrecognized selector
In my case, this was due to releasing the NSPredicate object too soon. Simply remove the release message and things will work fine again.
1234567891011121314151617181920212223
-(NSFetchedResultsController*)fetchedResultsController{if(fetchedResultsController==nil){NSFetchRequest*request=[[NSFetchRequestalloc]init];[requestsetEntity:[NSEntityDescriptionentityForName:@"Task"inManagedObjectContext:managedObjectContext]];[requestsetReturnsObjectsAsFaults:NO];NSPredicate*pred=[NSPredicatepredicateWithFormat:@"taskList = %@",taskList];[requestsetPredicate:pred];NSSortDescriptor*sort=[[NSSortDescriptoralloc]initWithKey:@"name"ascending:YES];[requestsetSortDescriptors:[NSArrayarrayWithObject:sort]];NSFetchedResultsController*aFRC=[[NSFetchedResultsControlleralloc]initWithFetchRequest:requestmanagedObjectContext:managedObjectContextsectionNameKeyPath:nilcacheName:nil];aFRC.delegate=self;self.fetchedResultsController=aFRC;[aFRCrelease];[sortrelease];// [pred release]; don't do this ... shouldn't be releasing it anyway (I didn't allocate the memory for it).[requestrelease];}returnfetchedResultsController;}
System.NullReferenceException: Object reference not set to an instance of an object
at NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindClass (System.Xml.XmlNode node, IDecoratable classMapping, NHibernate.Mapping.PersistentClass model, IDictionary`2 inheritedMetas) [0x00000] in :0
at NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind (System.Xml.XmlNode node, NHibernate.Cfg.MappingSchema.HbmClass classSchema, IDictionary`2 inheritedMetas) [0x00000] in :0
at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddRootClasses (System.Xml.XmlNode parentNode, IDictionary`2 inheritedMetas) [0x00000] in :0
at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind (System.Xml.XmlNode node) [0x00000] in :0
at NHibernate.Cfg.Configuration.AddValidatedDocument (NHibernate.Cfg.NamedXmlDocument doc) [0x00000] in :0
I got this stacktrace while trying to get a simple app using NHibernate up and running. I eventually found the solution in this forum post.
12345678910111213141516
// [Class(Table="Task")] - This was the problem.[Class(Name="Project.Models.Task, Project", Table="Task")]publicclassTask{ [Id(Name="Id")] [Generator(1, Class="native")]publicvirtualstringId{get;set;} [Property]publicvirtualstringDescription{get;set;} [Property]publicvirtualboolComplete{get;set;} [Property]publicvirtualDateTimeCreatedAt{get;set;} [Property]publicvirtualDateTimeUpdatedAt{get;set;}}
I needed to add the FQDN of the class and the assembly name. In the example above, replace Project with your assembly name.