Paris Tech Meetup talk : Troubles start at version 1.0Laurent Cerveau
Presentation given at the Paris Tech Meetup 2013. A checklist (with code example for iOS development) to anticipate potential problems that can happen during the upgrade process of an application.
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...Sencha
At Ubisoft Technology Group, we've created a platform for video game production to share game assets, in-game footage, and animations across the entire company. Ease of search and good UX were incredibly important for an audience of artists and creative types. This is where the Web and a powerful JavaScript framework came in; we chose Ext JS for its robustness and scalability. In this session, we'll showcase two different applications and dive into the technical aspects of designing the UI for a faceted search based on Elasticsearch.
Introduction to CQRS - command and query responsibility segregationAndrew Siemer
A high level introduction to CQRS (command and query responsibility segregation), CQS (command query separation), DDD (domain driven design), DDD-D ...with distributed, and how all those weave together.
Paris Tech Meetup talk : Troubles start at version 1.0Laurent Cerveau
Presentation given at the Paris Tech Meetup 2013. A checklist (with code example for iOS development) to anticipate potential problems that can happen during the upgrade process of an application.
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...Sencha
At Ubisoft Technology Group, we've created a platform for video game production to share game assets, in-game footage, and animations across the entire company. Ease of search and good UX were incredibly important for an audience of artists and creative types. This is where the Web and a powerful JavaScript framework came in; we chose Ext JS for its robustness and scalability. In this session, we'll showcase two different applications and dive into the technical aspects of designing the UI for a faceted search based on Elasticsearch.
Introduction to CQRS - command and query responsibility segregationAndrew Siemer
A high level introduction to CQRS (command and query responsibility segregation), CQS (command query separation), DDD (domain driven design), DDD-D ...with distributed, and how all those weave together.
How to implements the infra-structure for micro services? In this session, we'll compare building it with Spring Cloud vs. using Docker swarm/Kubernetes support.
This talk lays out the elements of an extension including the content model, JS API, Web Scripts, Content Policies, Action Executors, Web Scripts and more. This will draw on years of experience delivering extensions to various projects.
There is a code sample in github: https://github.com/rmknightstar/devcon2018
You can see the presentation as given at the Alfresco Developer Conference here : https://youtu.be/CKRswhh-jHE?list=PLyJdWuUHM3igOUt49uiFqs-6DCQAgJ1vs&t=0
Multi-threading in the modern era: Vertx Akka and QuasarGal Marder
Everybody wants scalable systems. However, writing non-blocking applications in Java is not an easy task. In this session, we'll go over 3 different frameworks for managing multi-treading and concurrency support (Akka, Vertx and Quasar).
SenchaCon 2016: Ext JS + React: A Match Made in UX Heaven - Mark BrocatoSencha
Have you ever wished you could use Sencha’s powerful Ext JS components in your React apps? Now you can. Learn about the new bridge we’ve created that enables you to use the Ext JS grid, treegrid, pivot grid, calendar, charts, and other components in your React based apps. We’ve integrated the frameworks, so you can manage data and respond to events using React while rendering UI controls using Ext JS with React's tag-based JSX syntax.
Mobile devices are so useful because they can get on the net with their built-in wi-fi or cellular data radios. But how does this work? In iOS, we have a slew of networking APIs, each appropriate in different situations. From decades-old BSD sockets to the new-in-iOS-5 iCloud, there are a wide range of networking calls available to your app, and an equally wide range of semantics in how to use them. In this talk, we'll start with high-level abstractions like iCloud and other objects that can either load from or save to a URL, then progress down through the stack, grabbing arbitrary content from URLs, self-networking with Bonjour and Game Kit, and finally accessing the socket layer with CFNetwork and BSD sockets.
iCloud sample code at: http://dl.dropbox.com/u/12216224/conferences/codemash12/bonjour-icloud/CloudNotes.zip
Terracotta (an open source technology) provides a clustered, durable virtual heap. Terracotta's goal is to make Java apps scale with as little effort as possible. If you are using Hibernate, there are several patterns that can be used to leverage Terracotta and reduce the load on your database so your app can scale.
First, you can use the Terracotta clustered Hibernate cache. This is a high-performance clustered cache and allows you to avoid hitting the database on all nodes in your cluster. It's suitable, not just for read-only, but also for read-mostly and read-write use cases, which traditionally have not been viewed as good use cases for Hibernate second level cache.
Another high performance option is to disconnect your POJOs from their Hibernate session and manage them entirely in Terracotta shared heap instead. This is a great option for conversational data where the conversational data is not of long-term interest but must be persistent and highly-available. This pattern can significantly reduce your database load but does require more changes to your application than using second-level cache.
This talk will examine the basics of what Terracotta provides and examples of how you can scale your Hibernate application with both clustered second level cache and detached clustered state. Also, we'll take a look at Terracotta's Hibernate-specific monitoring tools.
This talk demonstrates how to develop single page apps with the new angular2 framework and TypeScript. We show the new concepts of angular2 not only in theory, but using a real application. To this end, we develop a real-time angular2 website, for users to to ask and upvote questions during a talk identified by a hash tag. The session chair can ask the most popular questions at the end of the talk.
Dieser Vortrag zeigt, wie man mit dem neuen Angular2 Framework und TypeScript schnelle Single Page Apps entwickelt. Die neuen Konzepte von Angular2 zeigen wir dabei nicht nur in der Theorie, sondern ganz praktisch. Dazu entwickeln wir live eine Real-Time Angular2 App, mit der Zuhörer während eines Vortrags – identifiziert durch einen Hash-Tag - Fragen stellen und gegenseitig upvoten können. Der Session Chair kann so am Ende eines Vortrags die bestbewertesten Fragen an den Speaker stellen.
Arnaud vous propose de découvrir le framework Spring Batch: du Hello World! jusqu'à l'exécution multi-threadée de batch, en passant par la lecture de fichiers CSV et la reprise sur erreur. Les techniques qu'utilise le framework pour lire et écrire efficacement de grands volumes de données e vous seront pas non plus épargnées ! La présentation se base sur une approche problème/solution, avec de nombreux exemples de code et des démos. A la suite de cette présentation, vous saurez si Spring Batch convient à vos problématiques et aurez toutes les cartes en mains pour l'intégrer à vos applications batch.
Atlanta JUG - Integrating Spring Batch and Spring IntegrationGunnar Hillert
This talk is for everyone who wants to efficiently use Spring Batch and Spring Integration together. Users of Spring Batch often have the requirements to interact with other systems, to schedule the periodic execution Batch jobs and to monitor the execution of Batch jobs. Conversely, Spring Integration users periodically have Big Data processing requirements, be it for example the handling of large traditional batch files or the execution of Apache Hadoop jobs. For these scenarios, Spring Batch is the ideal solution. This session will introduce Spring Batch Integration, a project that provides support to easily tie Spring Batch and Spring Integration together. We will cover the following scenarios:
Launch Batch Jobs through Spring Integration Messages
Generate Informational Messages
Externalize Batch Process Execution using Spring Integration
Create Big Data Pipelines with Spring Batch and Spring Integration
How to implements the infra-structure for micro services? In this session, we'll compare building it with Spring Cloud vs. using Docker swarm/Kubernetes support.
This talk lays out the elements of an extension including the content model, JS API, Web Scripts, Content Policies, Action Executors, Web Scripts and more. This will draw on years of experience delivering extensions to various projects.
There is a code sample in github: https://github.com/rmknightstar/devcon2018
You can see the presentation as given at the Alfresco Developer Conference here : https://youtu.be/CKRswhh-jHE?list=PLyJdWuUHM3igOUt49uiFqs-6DCQAgJ1vs&t=0
Multi-threading in the modern era: Vertx Akka and QuasarGal Marder
Everybody wants scalable systems. However, writing non-blocking applications in Java is not an easy task. In this session, we'll go over 3 different frameworks for managing multi-treading and concurrency support (Akka, Vertx and Quasar).
SenchaCon 2016: Ext JS + React: A Match Made in UX Heaven - Mark BrocatoSencha
Have you ever wished you could use Sencha’s powerful Ext JS components in your React apps? Now you can. Learn about the new bridge we’ve created that enables you to use the Ext JS grid, treegrid, pivot grid, calendar, charts, and other components in your React based apps. We’ve integrated the frameworks, so you can manage data and respond to events using React while rendering UI controls using Ext JS with React's tag-based JSX syntax.
Mobile devices are so useful because they can get on the net with their built-in wi-fi or cellular data radios. But how does this work? In iOS, we have a slew of networking APIs, each appropriate in different situations. From decades-old BSD sockets to the new-in-iOS-5 iCloud, there are a wide range of networking calls available to your app, and an equally wide range of semantics in how to use them. In this talk, we'll start with high-level abstractions like iCloud and other objects that can either load from or save to a URL, then progress down through the stack, grabbing arbitrary content from URLs, self-networking with Bonjour and Game Kit, and finally accessing the socket layer with CFNetwork and BSD sockets.
iCloud sample code at: http://dl.dropbox.com/u/12216224/conferences/codemash12/bonjour-icloud/CloudNotes.zip
Terracotta (an open source technology) provides a clustered, durable virtual heap. Terracotta's goal is to make Java apps scale with as little effort as possible. If you are using Hibernate, there are several patterns that can be used to leverage Terracotta and reduce the load on your database so your app can scale.
First, you can use the Terracotta clustered Hibernate cache. This is a high-performance clustered cache and allows you to avoid hitting the database on all nodes in your cluster. It's suitable, not just for read-only, but also for read-mostly and read-write use cases, which traditionally have not been viewed as good use cases for Hibernate second level cache.
Another high performance option is to disconnect your POJOs from their Hibernate session and manage them entirely in Terracotta shared heap instead. This is a great option for conversational data where the conversational data is not of long-term interest but must be persistent and highly-available. This pattern can significantly reduce your database load but does require more changes to your application than using second-level cache.
This talk will examine the basics of what Terracotta provides and examples of how you can scale your Hibernate application with both clustered second level cache and detached clustered state. Also, we'll take a look at Terracotta's Hibernate-specific monitoring tools.
This talk demonstrates how to develop single page apps with the new angular2 framework and TypeScript. We show the new concepts of angular2 not only in theory, but using a real application. To this end, we develop a real-time angular2 website, for users to to ask and upvote questions during a talk identified by a hash tag. The session chair can ask the most popular questions at the end of the talk.
Dieser Vortrag zeigt, wie man mit dem neuen Angular2 Framework und TypeScript schnelle Single Page Apps entwickelt. Die neuen Konzepte von Angular2 zeigen wir dabei nicht nur in der Theorie, sondern ganz praktisch. Dazu entwickeln wir live eine Real-Time Angular2 App, mit der Zuhörer während eines Vortrags – identifiziert durch einen Hash-Tag - Fragen stellen und gegenseitig upvoten können. Der Session Chair kann so am Ende eines Vortrags die bestbewertesten Fragen an den Speaker stellen.
Arnaud vous propose de découvrir le framework Spring Batch: du Hello World! jusqu'à l'exécution multi-threadée de batch, en passant par la lecture de fichiers CSV et la reprise sur erreur. Les techniques qu'utilise le framework pour lire et écrire efficacement de grands volumes de données e vous seront pas non plus épargnées ! La présentation se base sur une approche problème/solution, avec de nombreux exemples de code et des démos. A la suite de cette présentation, vous saurez si Spring Batch convient à vos problématiques et aurez toutes les cartes en mains pour l'intégrer à vos applications batch.
Atlanta JUG - Integrating Spring Batch and Spring IntegrationGunnar Hillert
This talk is for everyone who wants to efficiently use Spring Batch and Spring Integration together. Users of Spring Batch often have the requirements to interact with other systems, to schedule the periodic execution Batch jobs and to monitor the execution of Batch jobs. Conversely, Spring Integration users periodically have Big Data processing requirements, be it for example the handling of large traditional batch files or the execution of Apache Hadoop jobs. For these scenarios, Spring Batch is the ideal solution. This session will introduce Spring Batch Integration, a project that provides support to easily tie Spring Batch and Spring Integration together. We will cover the following scenarios:
Launch Batch Jobs through Spring Integration Messages
Generate Informational Messages
Externalize Batch Process Execution using Spring Integration
Create Big Data Pipelines with Spring Batch and Spring Integration
Adding Support for Networking and Web Technologies to an Embedded SystemJohn Efstathiades
These are the slides for a presentation we gave at Device Developer Conference 2014 in the UK. The presentation discusses the work done, experiences, and lessons learnt from adding an open source TCP/IP network stack and web server to an existing industrial control system running on an ARM Cortex M3-based processor from TI.
The presentation covers the following:
· Integrating the network stack into the existing software base
· Configuring and using the network stack and web server
· Adding support for HTTP basic authentication to restrict user access
· Using HTTP to remotely access the target system and retrieve operational data
· Debugging hints and tips
· Pitfalls to avoid and other lessons learnt
Integration Monday - BizTalk Migrator Deep DiveBizTalk360
Join Dan Probert as we take you on a deep dive of Microsoft’s BizTalk Migrator tool. Learn what all the moving parts do, how to modify the configuration, how to improve performance, how to create your scenarios, how to debug the tool when it runs, and how to view the model built behind the scenes. If you have questions, then this is the place to be, as we’ll also have a Q&A session towards the end. In fact, there is so much content, we probably won’t cover everything in one session!
AngularJS 1.x - your first application (problems and solutions)Igor Talevski
We will talk about all aspects of building a single page application with AngularJS, and we will discuss real examples from day-to-day work. We will also cover a large amount of theory about general web development, best practices, and today's client demands. We will focus on three (3) main points: architecture, security, and real time notification.
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Elements for an iOS Backend
1. A Possible way for Client
Backend
lcerveau@nephorider.com
2. • This talk follows the one about API Design and
starts from its principle
• Although it is mainly focused on iOS (and code
example will be), principles can be applied to
other environment. In particular for modern JS
framework like Angular (and the creation of a
service)
• Configuration: a client talks to a server
Foreword
4. !
• Make sure the client can talk to the server and
fetch/display data
• Why the world fetch data each time????? We
should start faster
• Did you think about Facebook login?
• Offline usage is a must
The marketing requirement road
5. !
• Client side is usually determined on a “pane”
basis. In iOS wording: “view controllers”
• At first fetch is done on a per pane basis with
simple network calls
• When it evolves it is good to have a backend
managing all
Consequences
7. Backend Roles
!
• User management : switch, registration
• Network state management : online/offline
• Data fetch in the context of one user
• Communication backend frontend
8. Global Application
!
• May be good to have a special objects
managing the navigation (Pane Manager)
• This one can be triggered from anywhere (e.g
also with an application special URL)
• Let the view controllers have a view controller
logic
9. Reminder: API prerequisite
!
• Each returned object is having
• an unique identifier : uuid
• an self describing type : __class_name
11. Talk & code
!
• Follows Obj-C/Apple conventions
• Use MM as an example prefix
• For now, no sample code available, contact me
for further questions
• Example uses only Apple API calls, no third
parties components (but they may be worth be
looked at)
13. Storage
!
• At first separate data for each user. Do not try to
optimize by saying some data is common
• Store in “Application Support” or “Documents”
folder, Complement with a storage in Cache for
data that can be lost, with same structure
14. One user - one provider
• Let’s define an object “doing all for a user” as a
MMDataProvider. An entry point to manage all
data for a user
• Let’s define an object managing
MMDataProvider as MMDataProviderManager.
It holds the main server endpoint
• The manager will also be responsible for user
switch as well as network state listening
(SCNetworkReachability). If the app features
elements like location services, they should be
here also
16. Session management
• Users will be created as session are started and
linked to possible already existing storage
• The MMDataProviderManager is the only one
storing the last save user, which can be read at start
for direct login
• Special userID can be defined to keep the front end
code light : kMMCurrentUser, kMMLastUser,
kMMAnonymousUser….
• The manager will be the main point to manage
session and internally ask each provider to start/
stop itself
17. Registration
• As no user/provider exists before registration, the
manager is the one handling the process
• In terms of implementation, one must take care of
possible “network cookies” side effect.
• Usually multiple registration methods should exists :
login/password, token, Facebook, Anonymous (boils
down to one user with a device linked UUID)
18. A note about Facebook login
• The iOS Facebook SDK is easy to put in place but
usually stores its data inside the preferences
• It may be necessary to push tokens to the server.
This should be done by subclassing the
FBSessionTokenCachingStrategy that will read and
write data to a server
• Development tokens behaves differently than
production ones
22. Local and remote
• There may be differences in local objects than
remote one. Runtime versus Persistent
• As a consequence thinking about “let’s sync
everything” should be done in a cautious way
• Remote __class_name and uuid will drive
instantiations
23. Base class: MMBaseObject
• Holds as class variables the matching between
local class and server __class_name
• Useful to have additionally a local object type as int
for fast comparison
• Default implementation method may do nothing, or
even be forbidden (use of abstract class). For
exemple local storage in a DB
• At the base level : handling of UUID, present fields,
instantiation with JSON Data, storage creation
24. Objective-C implementation
/* Registration of MMXXX class at load time */
+ (void)load
{
[MMBaseObject registerClass:NSStringFromClass([self
class]) forType:kMMObjectTypeUser JSONClassName:@"user"
persistentDBType:@"USER"];;
}
/* Main object instantiation entry point */
[MMBaseObject createMMObjectsFromJSONResult:tmpJSON
parsedTypes:&tmpbjectTypes context:(void *)context];
!
/* Abstract method for Storage creation */
+ (char *)persistentSQLCreateStatement;
25. Objective-C implementation
/* To be implemented by subclass */
- (id)initWithJSONContent:(id) JSONContent;
!
/* To be implemented by subclass */
- (void)updateWithJSONContent:(id) JSONContent;
!
/* Write to SQL Database */
- (BOOL)writeToDatabaseWithHandle:(sqlite3 *)dbHandle;
!
/* remove to SQL Database */
- (BOOL)removeFromDataBaseWithHandle:(sqlite3 *)dbHandle;
!
/* Create with init dictionary SQL Database */
- (id)initWithDatabaseInformation:(NSDictionary *)information;
26. Collections
• An additionnel object should exist storing list of
items. We call it a collection, it is purely local
• Will be useful for handling of slices
• In addition to its UUID it should have a secondary
identifier, describing what it is linked too (e.g a slice
endpoint, an HTTP request)
• It should be able to hold multiple orders, which may
be more or less complete
• It should be KVO/KVC compliant
27. Parsing
• Having declared a base class, parsing can be
generic
• The parser is called with the result of every request
• A context should be provided to the parser. For
example if a sliced endpoint is queried, this can be
the collection class in order to enhance it
• The parser itself is recursive.
• It can contain a preparing phase to “fix/enhance/
modify” objects from coming from the backend
28. Parsing implementation
/* Entry point for JSON parsing and MMObject instantiations */
+ (void)createMMObjectsFromJSONResult:(id)jsonResult parsedTypes:
(MMObjectType *)parsedTypes contextProvider:(MMDataProvider
*)provider contextTask:(MMHTTPTask*)task parsingContext:(void
*)context
{
MMObjectType allParsedType =
_ParseAPIObjectWithExecutionBlock(jsonResult, provider, task);
if (parsedTypes) { *parsedTypes = allParsedType; }
return ;
}
30. API goodies : fields, version
• Use a NSSet to hold and manage present fields
• Define field sets that can be used to find what is
missing
• User server object versioning to avoid unneeded
parsing
• One point to pay attention : date parsing is costly,
use per thread date formatter caching
31. Offline storage (problems)
• After a few versions it is always cool to have it
• This is an heavy testing field!!!!!
• You can use CoreData but you should never believe
it is simple
• Simple SQLite 3 may be a good compromise
• Great benefits are also in startup times
33. Abstract or not abstract
• Abstract: the front end simply says “get me those
objects and if not here the are fetched”
• Non abstract: the front end check if there are
needed objects, and if not decide to fetch them
• Non abstract: network calls need to be launched
manually which is a good way of learning an API
I prefer not abstract
34. Abstract or not abstract
• Abstract: the front end simply says “get me those
objects and if not here the are fetched”
• Non abstract: the front end check if there are
needed objects, and if not decide to fetch them
• Non abstract: network calls need to be launched
manually which is a good way of learning an API
I prefer not abstract
35. Implementation
• One unique interface
/* Main interface to do queries and all */
- (NSString *)launchRequestToEndPointPath:(NSString
*)endPointPath andHTTPMethod:(NSString *)HTTPMethod
useSecureConnection:(BOOL)isSecure inBackground:(BOOL)background
withBody:(NSString *)body preparsingBlock:
(MMPreparseBlock)preparsingBlock completionBlock:
(MMCompletionBlock)completionBlock
• Endpoint path : the API path minus server. Learn
the API!!!
• Use of blocks avoid to spread code in all places
36. Technology
• iOS 7 has made a lot of network progress. IMHO no
need for a third party library
• Learn NSURLSession!
• Background modes can be difficult. You are usually
not the owner of time. Never try to go against the OS
all is here to be understood. But clearly it takes time
38. Communication Back Front
• Give a role to different way of communication
• To avoid definitely : NSNotification for everything.
This easily becomes unmanageable (more than 130
notifications)
• Personal rules :
• Notifications are for application important
changes (Network, User session start and stop)
• KVO is king for data transmission. Be careful of
threading
• Use block to mark end of network operation
39. Upgrade management
• Dedicate one object to version management
• First usage, first usage for current version,
• Mange data upgrade in an incremental way
40. Upgrade management
/* Use the Objective-C runtime */
- (BOOL) runUpgradeScenario
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
__block BOOL result = NO;
!
if(NO == self.firstTimeForCurrentVersion && NO == self.firstTime)
return result;
!
!
}
NSMutableDictionary *allUpgrades= [NSMutableDictionary dictionary];
NSMutableDictionary *allStarts= [NSMutableDictionary dictionary];
//Find all upgrade methods
unsigned int outCount;
Method * allMethods = class_copyMethodList([self class], &outCount);
for(unsigned int idx = 0; idx < outCount; idx++) {
Method aMethod = allMethods[idx];
NSString *aMethodName = NSStringFromSelector(method_getName(aMethod));
if([aMethodName hasPrefix:@"_upgradeFrom"]) {
NSString *upgradeVersionString = [aMethodName substringWithRange:NSMakeRange([@"_upgradeFrom" length], 3)];
[allUpgrades setObject:aMethodName forKey:upgradeVersionString];
} else if ([aMethodName hasPrefix:@"_startAt"]) {
NSString *startVersionString = [aMethodName substringWithRange:NSMakeRange([@"_startAt" length], 3)];
[allStarts setObject:aMethodName forKey:startVersionString];
}
}
if(allMethods) free(allMethods);
if(self.firstTime) {
//sort them and perform the most "recent" one
SEL startSelector = NSSelectorFromString([allStarts[[[allStarts keysSortedByValueUsingSelector:@selector(compare:)]lastObject]]]);
[self performSelector:startSelector withObject:nil];
result = YES;
} else if(self.firstTimeForCurrentVersion) {
//Sort them and apply the one that needs to be applied
[[allUpgrades keysSortedByValueUsingSelector:@selector(compare:)] enumerateObjectsUsingBlock:^(NSString *obj, NSUInteger idx, BOOL
*stop) {
if([obj intValue] > _previous3DigitVersion) {
result = YES;
[self performSelector:NSSelectorFromString([allUpgrades objectForKey:obj]) withObject:nil];
}
}];
}
#pragma clang diagnostic pop
return result;