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
GAI.sharedInstance().logger.logLevel = GAILogLevel.None | |
#if TARGET_IPHONE_SIMULATOR | |
// [[GAI sharedInstance] setDryRun:YES]; | |
GAI.sharedInstance.setDryRun:true | |
#endif |
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
static func withFormat(format: String, list:NSMutableArray) -> String { | |
if list.count > 0 { | |
let path = String(format: format, list.firstObject as! String) | |
list.removeObject(list.firstObject!) | |
return self.withFormat(path, list: list) | |
} else { | |
return format | |
} | |
} |
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
// To unzip the epub, move the ePub to a folder, cd to it then simply: | |
unzip MyEbook.epub | |
// To zip up an epub: | |
1. zip -X MyNewEbook.epub mimetype | |
2. zip -rg MyNewEbook.epub META-INF -x \*.DS_Store | |
3. zip -rg MyNewEbook.epub OEBPS -x \*.DS_Store | |
Some explanations necessary here. We start each line with two flags: |
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
CGPoint points[N]; | |
CGFloat area = 0; | |
for (int i = 0; i < N; i++) { | |
area += (points[i].x * points[(i+1) % N].y - points[(i+1) % N].x * points[i].y)/2.0; | |
} |
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
NSManagedObjectContext *context = <#Get the context#>; | |
NSFetchRequest *request = [[NSFetchRequest alloc] init]; | |
NSEntityDescription *entity = [NSEntityDescription entityForName:@"<#Entity name#>" inManagedObjectContext:context]; | |
[request setEntity:entity]; | |
// Specify that the request should return dictionaries. | |
[request setResultType:NSDictionaryResultType]; | |
// Create an expression for the key path. |
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
NSManagedObjectContext *context = <#Get the context#>; | |
NSEntityDescription *entity = [NSEntityDescription entityForName:@"<#Entity name#>" inManagedObjectContext:context]; | |
NSFetchRequest *request = [[NSFetchRequest alloc] init]; | |
[request setEntity:entity]; | |
[request setResultType:NSDictionaryResultType]; | |
[request setReturnsDistinctResults:YES]; | |
[request setPropertiesToFetch:@[@"<#Attribute name#>"]]; | |
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
import os | |
directory = "D:\INFOWEBAPPSLOGS\W3SVC1618619580\\" | |
fileList = os.listdir(directory) | |
for fname in fileList: | |
filePath = directory + fname | |
a = open(filePath) | |
c = a.readlines() | |
for line in c: | |
if ("/secretariat/article.xml.asp") in line: |