Buster McLeod Benson needs to clean up his goal list

build an iPhone app (read all 11 entries…)
More progress 3 months ago

I found a cool easy way to incorporate a database with EntropyDB. It’s an easy way to store and retrieve models directly, without having to write SQL.

It seems to work well, but already I can see that the lack of other kinds of queries is going to be a pain in the future, especially if I want to display stats or store games by lat/long and find nearby places. Things like that.

I’ve spent some time trying to figure out how to deploy my app onto my phone, but so far no luck. Part of it probably has to do with how Apple thinks my name is “Erik McLeod” because they updated my last name but not my first name. Secondly, I think I revoked a certificate when I tried to start over and now don’t know how to add a new one.

Other than that, I’ve now got the app saving Player and Game information, including place name, price of the bill, etc. It then calculates whether a player is “ahead” or “behind” in their playing… if they’re making more money by playing or losing money, and how much. Sorta cool.

Next steps:

  • Figure out how to run it on my actual phone instead of just the iPhone Simulator on my computer.
  • Option to let people easily select players who’ve played before rather than always have to select from the Address Book.
  • Figure out if I want to display a list of games, or stats on games. Not much point in keeping track of location names unless they’re re-displayed somehow.


Comments:

Hi, I’d like to encourage you to submit your feature requests to the Issue tracker on the Entropy page. As for the queries, you could write your own predicates and use them exactly as the built-in ones. You only need to override the ‘evaluate’ method. Of course, the query won’t be optimized, however the functionality will be there and if you attach the source code of your predicate to the posted issue, the predicate could be optimized later and the code which uses it wouldn’t need to be changed.
(I’ve already implemented some optimized predicates.)

Buster McLeod Benson needs to clean up his goal list

Interesting! Is there any documentation on how to write your own predicates? I can’t quite tell how they work from the .h files that it comes with.

My main feature request at this point is to have the code at a point where it can build on the iPhone itself, rather than just the Simulator… but that’s supposed to be coming soon.

It’s very simple, you only need to override the evaluate method and return YES when you wish the object being evaluated to be part of the result set of a particular query type.

Here’s an example for texts (NSString):

@interface EXPredicateEqualText : EXPredicate {
NSString* value;
}

- (id)initWithFieldName:(NSString)_fieldName value:(NSString)_value;
- (NSString)textValue;

@end

@implementation EXPredicateEqualText

- (id)initWithFieldName:(NSString)_fieldName value:(NSString)_value {
if (self = [super initWithFieldName: _fieldName]) {
value = [_value retain];
}
return self;
}

- (BOOL)evaluateWithObject:(id)object {
void
_value;
Ivar ivar = object_getInstanceVariable(object, [fieldName UTF8String], &_value);
id valueInObject = object_getIvar(object, ivar);
return [value isEqual: valueInObject];
}

- (void)dealloc {

}

@end


 

I want to: