- Profilo Linkedin: https://it.linkedin.com/in/marcovelluto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<classpath> | |
<classpathentry kind="src" path="src"/> | |
<classpathentry kind="src" path="gen"/> | |
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> | |
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> | |
<classpathentry kind="lib" path="/Users/Marco/Dropbox/Hackthlon/Libreria per tornare coordinate/Libreria fai da te/JCoord.jar"/> | |
<classpathentry kind="output" path="bin/classes"/> | |
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSString *) filePath { | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *documentsDir = [paths objectAtIndex:0]; | |
return [documentsDir stringByAppendingPathComponent:@"database.sql"]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) openDB { | |
//-- Create Database -- | |
if (sqlite3_open([[self filePath] UTF8String], &(db)) != SQLITE_OK) { | |
sqlite3_close(db); | |
WITH_LOG ? NSLog(@"Database falied to open.") : nil; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)createTableNamed:(NSString *)tableName{ | |
char *err; | |
NSString *sql = [NSString stringWithFormat:@"CREATE TABLE IF NOT EXISTS '%@' ('%@' " | |
"INTEGER PRIMARY KEY, '%@' REAL, '%@' REAL);", tableName, @"id", FIELD_WEIGHT , FIELD_DATE]; | |
if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, &err) != SQLITE_OK) { | |
sqlite3_close(db); | |
NSLog(@"Table %@ falied create.", tableName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) insertRecordWithWeight:(float)weight date:(double)date { | |
int countOfDb = 0; | |
countOfDb = [self countOfDb]; | |
NSString *sql = [NSString stringWithFormat:@"INSERT OR REPLACE INTO '%@' ('%@','%@','%@')" | |
"VALUES ('%d','%f','%f')", TABLE_NAME, @"id",FIELD_WEIGHT, FIELD_DATE, countOfDb, weight, date]; | |
char *err; | |
if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, &err) != SQLITE_OK) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSArray *)getAll{ | |
NSString * qsql = [NSString stringWithFormat:@"SELECT * FROM '%@'", TABLE_NAME]; | |
sqlite3_stmt *statment; | |
NSMutableArray *tempArray = [[NSMutableArray alloc] init]; | |
if (sqlite3_prepare_v2(db, [qsql UTF8String], -1, &statment, nil) == SQLITE_OK) { | |
while (sqlite3_step(statment) == SQLITE_ROW) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (NSDictionary *)getDictionaryArticoliFromPlistName:(NSString *)plistName { | |
NSString *path = [[NSBundle mainBundle] pathForResource:plistName ofType:@"plist"]; | |
NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:path]; | |
return dictionary; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (void)writeDictionary:(NSDictionary *)dictionary fromPlistName:(NSString *)plistName { | |
NSString *path = [[NSBundle mainBundle] pathForResource:plistName ofType:@"plist"]; | |
[dictionary writeToFile:path atomically:YES]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSArray *codes = [[NSArray alloc] initWithArray:[NSLocale ISOCountryCodes]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender | |
{ | |
if ([[segue identifier] isEqualToString:@"showDetail"]) { | |
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; | |
NSManagedObject *object = [[self fetchedResultsController] objectAtIndexPath:indexPath]; | |
[[segue destinationViewController] setDetailItem:object]; | |
} | |
} |
OlderNewer