SlideShare una empresa de Scribd logo
1 de 48
iPhone SDK



iPhone
iPhone SDK




h"p://kishikawakatsumi.com

Twi"er
@k_katsumi

24/7
twenty‐four
seven
h"p://d.hatena.ne.jp/KishikawaKatsumi/
iPhone SDK


•      
touch   •          
on
the
WEB

•LDR
touch      •
•               •i‐Radio
•LCD
Clock      •
•Subway
Map     •
•MyWebClip
•               •
iPhone SDK

http://github.com/kishikawakatsumi

•hatena‐touch        •DescripMonBuilder
•ldr‐touch           •TiledLayerView
•tv‐lisMngs          •UICCalendarPicker
•MapKit‐Route‐DirecMons
•FlipCardNavigaMonView
•PhotoFlipCardView
iPhone SDK
iPhone SDK



iPhone
iPhone SDK
iPhone SDK



    (SQLite? CoreData? and so on...)


•
•
iPhone SDK

                   Library

Tokyo Cabinet
http://fallabs.com/tokyocabinet/

Tokyo Dystopia
http://fallabs.com/tokyodystopia/

BNRPersistence
https://github.com/hillegass/BNRPersistence
iPhone SDK
Tokyo Cabinet
DBM



Tokyo Dystopia
Tokyo Cabinet


FTSKit
BNRPersistence
Tokyo Dystopia   Cocoa Wrapper
iPhone SDK


             Sample Code


FTSKit
https://github.com/kishikawakatsumi/FTSKit
iPhone SDK



   FKStoredObject
iPhone SDK
#import "FKStoredObject.h"

@interface Address : FKStoredObject {
  NSString *zipcode;
  NSString *full;
  NSString *kana;
}

@property (nonatomic, retain) NSString *zipcode;
@property (nonatomic, retain) NSString *full;
@property (nonatomic, retain) NSString *kana;

@end
iPhone SDK
#import "FKStoredObject.h"

@interface Address : FKStoredObject {
  NSString *zipcode;
  NSString *full;
  NSString *kana;
}

@property (nonatomic, retain) NSString *zipcode;
@property (nonatomic, retain) NSString *full;
@property (nonatomic, retain) NSString *kana;

@end
@implementation Address
              iPhone SDK
- (void)readContentFromBuffer:(FKDataBuffer *)d {
   [zipcode release];
   zipcode = [[d readString] retain];

    [full release];
    full = [[d readString] retain];

    [kana release];
    kana = [[d readString] retain];
}

- (void)writeContentToBuffer:(FKDataBuffer *)d {
   [d writeString:zipcode];
   [d writeString:full];
   [d writeString:kana];
}

@end
iPhone SDK



       Save
iPhone SDK

      FKStore


   FKStoreBackend


  FKIndexManager
iPhone SDK
self.store = [[[FKStore alloc] init] autorelease];

FKTCBackend *backend =
 [[FKTCBackend alloc] initWithPath:dataPath
                   error:nil];
[store setBackend:backend];
[backend release];

FKTCIndexManager *indexManager =
 [[FKTCIndexManager alloc] initWithPath:dataPath
                     error:nil];
[store setIndexManager:indexManager];
[indexManager release];

[store addClass:[Address class]];
iPhone SDK
// Mark object for insertion into object store
- (void)insertObject:(FKStoredObject *)obj;

// Mark object for deletion from object store
- (void)deleteObject:(FKStoredObject *)obj;

// Mark object to be updated in object store
- (void)willUpdateObject:(FKStoredObject *)obj;

- (BOOL)saveChanges:(NSError **)errorPtr;
iPhone SDK
CSVParser *parser = [[[CSVParser alloc]
               initWithString:csvString
                   separator:@","
                   hasHeader:YES
                  fieldNames:nil] autorelease];
NSArray *lines = [parser arrayOfParsedRows];
for (NSDictionary *line in lines) {
   Address *record = [[Address alloc] init];
   record.zipcode = [line objectForKey:@"               "];
    record.full = [line objectForKey:@"   "];
    record.kana = [line objectForKey:@"           "];

    [store insertObject:record];
    [record release];
}

[store saveChanges:nil];
iPhone SDK



      Search
iPhone SDK
- (FKResultSet *)resultSetForClass:(Class)c
              mactchesText:(NSString *)text
                   forKey:(NSString *)key;

- (FKResultSet *)resultSetForClass:(Class)c
              containsText:(NSString *)text
                   forKey:(NSString *)key;

- (FKResultSet *)resultSetForClass:(Class)c
             beginsWithText:(NSString *)text
                   forKey:(NSString *)key;

- (FKResultSet *)resultSetForClass:(Class)c
              endsWithText:(NSString *)text
                   forKey:(NSString *)key;
NSString *text = searchText;

             iPhone SDK
NSString *key = @"kana";

FKResultSet *resultSet;
if (searchType == FKSearchTypeStartsWith) {
    resultSet = [store resultSetForClass:[Address class]
                   beginsWithText:text
                         forKey:key];
} else if (searchType == FKSearchTypeEndsWith) {
    resultSet = [store resultSetForClass:[Address class]
                    endsWithText:text
                         forKey:key];
} else if (searchType == FKSearchTypeContains) {
    resultSet = [store resultSetForClass:[Address class]
                    containsText:text
                         forKey:key];
} else {
    resultSet = [store resultSetForClass:[Address class]
                    mactchesText:text
                         forKey:key];
}
iPhone SDK


Performance Tuning
iPhone SDK

    Performance Tuning


•
•       2:8
•
iPhone SDK
iPhone SDK




•
iPhone SDK
iPhone SDK
iPhone SDK




             OK.
iPhone SDK
iPhone SDK
       •
       •
       •
       iPhone
iPhone SDK




•



•
iPhone SDK

- (void)searchBar:(FKSearchBar *)searchBar
   textDidChange:(NSString *)searchText {
   [NSObject
    cancelPreviousPerformRequestsWithTarget:self];
   [self performSelector:@selector(searchWithSearchBar:)
           withObject:searchBar
           afterDelay:0.2];
}
- (void)searchWithSearchBar:(FKSearchBar *)searchBar {

               iPhone SDK
   [queue cancelAllOperations];

    NSString *searchText = searchBar.text;
    if ([searchText length] == 0) {
        self.resultSet = nil;
        [listView reloadData];
        return;
    }

    FKSearchOperation *searchOperation =
     [[FKSearchOperation alloc] init];
    searchOperation.delegate = self;
    searchOperation.store = store;
    searchOperation.searchText = searchText;
    searchOperation.searchType = searchBar.searchType;

    [queue addOperation:searchOperation];
    [searchOperation release];
}

- (void)searchOperaionDidFinished:(FKResultSet *)results {
   self.resultSet = results;
   [listView reloadData];
}
iPhone SDK


        API Cocoa


Foundation
iPhone SDK
iPhone SDK


Boolean CFStringTransform (
   CFMutableStringRef string,
   CFRange *range,
   CFStringRef transform,
   Boolean reverse
);
iPhone SDK
const   CFStringRef   kCFStringTransformStripCombiningMarks;
const   CFStringRef   kCFStringTransformToLatin;
const   CFStringRef   kCFStringTransformFullwidthHalfwidth;
const   CFStringRef   kCFStringTransformLatinKatakana;
const   CFStringRef   kCFStringTransformLatinHiragana;
const   CFStringRef   kCFStringTransformHiraganaKatakana;
const   CFStringRef   kCFStringTransformMandarinLatin;
const   CFStringRef   kCFStringTransformLatinHangul;
const   CFStringRef   kCFStringTransformLatinArabic;
const   CFStringRef   kCFStringTransformLatinHebrew;
const   CFStringRef   kCFStringTransformLatinThai;
const   CFStringRef   kCFStringTransformLatinCyrillic;
const   CFStringRef   kCFStringTransformLatinGreek;
const   CFStringRef   kCFStringTransformToXMLHex;
const   CFStringRef   kCFStringTransformToUnicodeName;
const   CFStringRef   kCFStringTransformStripDiacritics;
iPhone SDK
NSString *text = searchText;

NSMutableString *toKana =
 [NSMutableString stringWithString:text];
CFRange range = CFRangeMake(0, [text length]);
CFStringTransform((CFMutableStringRef)toKana,
            &range,
            kCFStringTransformHiraganaKatakana,
            false);
text = toKana;



 CF~    NS~                        (toll-free bridge)
                                            Cocoa
 ※UI~
iPhone SDK
iPhone SDK


CFIndex CFArrayBSearchValues (
   CFArrayRef theArray,
   CFRange range,
   const void *value,
   CFComparatorFunction comparator,
   void *context
);
NSArray *sortedArray;
           iPhone SDK
NSNumber *target = [NSNumber numberWithInteger:10];
CFIndex count = [sortedArray count];
CFRange range = CFRangeMake(0, count);
AData *data = nil;

CFIndex index = CFArrayBSearchValues(
                         (CFArrayRef)sortedArray,
                         range,
                         target,
                         compareAData,
                         NULL);
if(index < count) {
    data = [sortedArray objetAtIndex:index];
} else {
    // Not found.
}
if(NSOrderedSame != [data.number compare:target]) {
    // Not found.
}
NSBinarySearchingOptions
                 iPhone SDK
Options for searches and insertions using
indexOfObject:inSortedRange:options:usingComparator:.
enum {
   NSBinarySearchingFirstEqual = (1 << 8),
   NSBinarySearchingLastEqual = (1 << 9),
   NSBinarySearchingInsertionIndex = (1 << 10),
};
typedef NSUInteger NSBinarySearchingOptions;
Constants
NSBinarySearchingFirstEqual
Specifies that the search should return the first object in the range that is equal to the given object.
Available in iOS 4.0 and later.
Declared in NSArray.h.
NSBinarySearchingLastEqual
Specifies that the search should return the last object in the range that is equal to the given object.
Available in iOS 4.0 and later.
Declared in NSArray.h.
NSBinarySearchingInsertionIndex
Returns the index at which you should insert the object in order to maintain a sorted array.
Available in iOS 4.0 and later.
Declared in NSArray.h.
iPhone SDK
iPhone SDK


 NSString
CFURL
iPhone SDK


- (NSString *)stringByAddingPercentEscapesUsingEncoding:
(NSStringEncoding)encoding


- (NSString
*)stringByReplacingPercentEscapesUsingEncoding:
(NSStringEncoding)encoding
iPhone SDK
CFStringRef CFURLCreateStringByReplacingPercentEscapes (
   CFAllocatorRef allocator,
   CFStringRef originalString,
   CFStringRef charactersToLeaveEscaped
);


CFStringRef
CFURLCreateStringByReplacingPercentEscapesUsingEncodin
g(
   CFAllocatorRef allocator,
   CFStringRef origString,
   CFStringRef charsToLeaveEscaped,
   CFStringEncoding encoding
);

Más contenido relacionado

Último

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

iPhone勉強会 (2011.04.30) 全文検索 -Full Text Search on iOS-

  • 3. iPhone SDK • 
touch • 
on
the
WEB •LDR
touch • • •i‐Radio •LCD
Clock • •Subway
Map • •MyWebClip • •
  • 4. iPhone SDK http://github.com/kishikawakatsumi •hatena‐touch •DescripMonBuilder •ldr‐touch •TiledLayerView •tv‐lisMngs •UICCalendarPicker •MapKit‐Route‐DirecMons •FlipCardNavigaMonView •PhotoFlipCardView
  • 8. iPhone SDK (SQLite? CoreData? and so on...) • •
  • 9. iPhone SDK Library Tokyo Cabinet http://fallabs.com/tokyocabinet/ Tokyo Dystopia http://fallabs.com/tokyodystopia/ BNRPersistence https://github.com/hillegass/BNRPersistence
  • 10. iPhone SDK Tokyo Cabinet DBM Tokyo Dystopia Tokyo Cabinet FTSKit BNRPersistence Tokyo Dystopia Cocoa Wrapper
  • 11. iPhone SDK Sample Code FTSKit https://github.com/kishikawakatsumi/FTSKit
  • 12. iPhone SDK FKStoredObject
  • 13. iPhone SDK #import "FKStoredObject.h" @interface Address : FKStoredObject { NSString *zipcode; NSString *full; NSString *kana; } @property (nonatomic, retain) NSString *zipcode; @property (nonatomic, retain) NSString *full; @property (nonatomic, retain) NSString *kana; @end
  • 14. iPhone SDK #import "FKStoredObject.h" @interface Address : FKStoredObject { NSString *zipcode; NSString *full; NSString *kana; } @property (nonatomic, retain) NSString *zipcode; @property (nonatomic, retain) NSString *full; @property (nonatomic, retain) NSString *kana; @end
  • 15. @implementation Address iPhone SDK - (void)readContentFromBuffer:(FKDataBuffer *)d { [zipcode release]; zipcode = [[d readString] retain]; [full release]; full = [[d readString] retain]; [kana release]; kana = [[d readString] retain]; } - (void)writeContentToBuffer:(FKDataBuffer *)d { [d writeString:zipcode]; [d writeString:full]; [d writeString:kana]; } @end
  • 16. iPhone SDK Save
  • 17. iPhone SDK FKStore FKStoreBackend FKIndexManager
  • 18. iPhone SDK self.store = [[[FKStore alloc] init] autorelease]; FKTCBackend *backend = [[FKTCBackend alloc] initWithPath:dataPath error:nil]; [store setBackend:backend]; [backend release]; FKTCIndexManager *indexManager = [[FKTCIndexManager alloc] initWithPath:dataPath error:nil]; [store setIndexManager:indexManager]; [indexManager release]; [store addClass:[Address class]];
  • 19. iPhone SDK // Mark object for insertion into object store - (void)insertObject:(FKStoredObject *)obj; // Mark object for deletion from object store - (void)deleteObject:(FKStoredObject *)obj; // Mark object to be updated in object store - (void)willUpdateObject:(FKStoredObject *)obj; - (BOOL)saveChanges:(NSError **)errorPtr;
  • 20. iPhone SDK CSVParser *parser = [[[CSVParser alloc] initWithString:csvString separator:@"," hasHeader:YES fieldNames:nil] autorelease]; NSArray *lines = [parser arrayOfParsedRows]; for (NSDictionary *line in lines) { Address *record = [[Address alloc] init]; record.zipcode = [line objectForKey:@" "]; record.full = [line objectForKey:@" "]; record.kana = [line objectForKey:@" "]; [store insertObject:record]; [record release]; } [store saveChanges:nil];
  • 21. iPhone SDK Search
  • 22. iPhone SDK - (FKResultSet *)resultSetForClass:(Class)c mactchesText:(NSString *)text forKey:(NSString *)key; - (FKResultSet *)resultSetForClass:(Class)c containsText:(NSString *)text forKey:(NSString *)key; - (FKResultSet *)resultSetForClass:(Class)c beginsWithText:(NSString *)text forKey:(NSString *)key; - (FKResultSet *)resultSetForClass:(Class)c endsWithText:(NSString *)text forKey:(NSString *)key;
  • 23. NSString *text = searchText; iPhone SDK NSString *key = @"kana"; FKResultSet *resultSet; if (searchType == FKSearchTypeStartsWith) { resultSet = [store resultSetForClass:[Address class] beginsWithText:text forKey:key]; } else if (searchType == FKSearchTypeEndsWith) { resultSet = [store resultSetForClass:[Address class] endsWithText:text forKey:key]; } else if (searchType == FKSearchTypeContains) { resultSet = [store resultSetForClass:[Address class] containsText:text forKey:key]; } else { resultSet = [store resultSetForClass:[Address class] mactchesText:text forKey:key]; }
  • 25. iPhone SDK Performance Tuning • • 2:8 •
  • 30. iPhone SDK OK.
  • 32. iPhone SDK • • • iPhone
  • 34. iPhone SDK - (void)searchBar:(FKSearchBar *)searchBar textDidChange:(NSString *)searchText { [NSObject cancelPreviousPerformRequestsWithTarget:self]; [self performSelector:@selector(searchWithSearchBar:) withObject:searchBar afterDelay:0.2]; }
  • 35. - (void)searchWithSearchBar:(FKSearchBar *)searchBar { iPhone SDK [queue cancelAllOperations]; NSString *searchText = searchBar.text; if ([searchText length] == 0) { self.resultSet = nil; [listView reloadData]; return; } FKSearchOperation *searchOperation = [[FKSearchOperation alloc] init]; searchOperation.delegate = self; searchOperation.store = store; searchOperation.searchText = searchText; searchOperation.searchType = searchBar.searchType; [queue addOperation:searchOperation]; [searchOperation release]; } - (void)searchOperaionDidFinished:(FKResultSet *)results { self.resultSet = results; [listView reloadData]; }
  • 36. iPhone SDK API Cocoa Foundation
  • 38. iPhone SDK Boolean CFStringTransform ( CFMutableStringRef string, CFRange *range, CFStringRef transform, Boolean reverse );
  • 39. iPhone SDK const CFStringRef kCFStringTransformStripCombiningMarks; const CFStringRef kCFStringTransformToLatin; const CFStringRef kCFStringTransformFullwidthHalfwidth; const CFStringRef kCFStringTransformLatinKatakana; const CFStringRef kCFStringTransformLatinHiragana; const CFStringRef kCFStringTransformHiraganaKatakana; const CFStringRef kCFStringTransformMandarinLatin; const CFStringRef kCFStringTransformLatinHangul; const CFStringRef kCFStringTransformLatinArabic; const CFStringRef kCFStringTransformLatinHebrew; const CFStringRef kCFStringTransformLatinThai; const CFStringRef kCFStringTransformLatinCyrillic; const CFStringRef kCFStringTransformLatinGreek; const CFStringRef kCFStringTransformToXMLHex; const CFStringRef kCFStringTransformToUnicodeName; const CFStringRef kCFStringTransformStripDiacritics;
  • 40. iPhone SDK NSString *text = searchText; NSMutableString *toKana = [NSMutableString stringWithString:text]; CFRange range = CFRangeMake(0, [text length]); CFStringTransform((CFMutableStringRef)toKana, &range, kCFStringTransformHiraganaKatakana, false); text = toKana; CF~ NS~ (toll-free bridge) Cocoa ※UI~
  • 42. iPhone SDK CFIndex CFArrayBSearchValues ( CFArrayRef theArray, CFRange range, const void *value, CFComparatorFunction comparator, void *context );
  • 43. NSArray *sortedArray; iPhone SDK NSNumber *target = [NSNumber numberWithInteger:10]; CFIndex count = [sortedArray count]; CFRange range = CFRangeMake(0, count); AData *data = nil; CFIndex index = CFArrayBSearchValues( (CFArrayRef)sortedArray, range, target, compareAData, NULL); if(index < count) { data = [sortedArray objetAtIndex:index]; } else { // Not found. } if(NSOrderedSame != [data.number compare:target]) { // Not found. }
  • 44. NSBinarySearchingOptions iPhone SDK Options for searches and insertions using indexOfObject:inSortedRange:options:usingComparator:. enum { NSBinarySearchingFirstEqual = (1 << 8), NSBinarySearchingLastEqual = (1 << 9), NSBinarySearchingInsertionIndex = (1 << 10), }; typedef NSUInteger NSBinarySearchingOptions; Constants NSBinarySearchingFirstEqual Specifies that the search should return the first object in the range that is equal to the given object. Available in iOS 4.0 and later. Declared in NSArray.h. NSBinarySearchingLastEqual Specifies that the search should return the last object in the range that is equal to the given object. Available in iOS 4.0 and later. Declared in NSArray.h. NSBinarySearchingInsertionIndex Returns the index at which you should insert the object in order to maintain a sorted array. Available in iOS 4.0 and later. Declared in NSArray.h.
  • 47. iPhone SDK - (NSString *)stringByAddingPercentEscapesUsingEncoding: (NSStringEncoding)encoding - (NSString *)stringByReplacingPercentEscapesUsingEncoding: (NSStringEncoding)encoding
  • 48. iPhone SDK CFStringRef CFURLCreateStringByReplacingPercentEscapes ( CFAllocatorRef allocator, CFStringRef originalString, CFStringRef charactersToLeaveEscaped ); CFStringRef CFURLCreateStringByReplacingPercentEscapesUsingEncodin g( CFAllocatorRef allocator, CFStringRef origString, CFStringRef charsToLeaveEscaped, CFStringEncoding encoding );

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n