In my application I am retrieving data from database and showing in it. In db some of the tables contain 1000+ records. Now my requirement is to show this data even if there is no net connection, so I am planning to store the tables in SQLite db at user's machine, but there is a worry:
Since SQLite db will be included
within resources folder, in project,
so it will be by default contained
within application binary. So I want
to know that when the application will
be launched will all this data reside
on RAM ? If yes, then I think this can
cause some problems, so in that case- is
there any alternative solution to
store data locally?
Thanks,
Miraaj
No, it won't all reside in RAM. The contents of the application bundle (NIB files, images, etc.) are not all automatically loaded into memory when the app is launched. Resources are typically loaded on demand. For example, a view controller might call initWithNibName: to load the resources for that view.
Also, unless the database is a read-only part of the application (never changes unless you upgrade), you probably don't want to store it in the app bundle -- use the application documents directory instead (although you might include an initial "default" copy of the database within the app bundle). See "A Few Important Application Directories" in the iOS Application Programming Guide
Related
I have gone through Laravel beginners tutorial, and now I can understand every topics listed in those tutorials and have created my own project, but as I saw in those, the tutors were able to understand what each file was meant for and had the capability to edit it and change it as per their needs.
So how do they learn so deeply and from which source?
I will try brief what is said at Laravel Official Documentation
The root directory
In the root directory of every Laravel project you can find the following directories:
The app directory, as you might expect, contains the core code of your application. Models, controllers, services, middlewares are stored here.
The bootstrap folder contains a few files that bootstrap the framework and configure autoloading, as well as a cache folder that contains a few framework generated files for bootstrap performance optimization. Commonly you don't need touch this folder.
The config directory, as the name implies, contains all of your application's configuration files. You have to set your database connections, email drivers, sessions storage configuration (and much more), here.
The database folder contains your database migration and seeds. If you wish, you may also use this folder to hold an SQLite database. Migrations allows you define your database without writing any SQL code. It's very useful if you are interested at versioning your database structure. See more info here
The public directory contains the front controller and your assets (images, JavaScript, CSS, etc.).
The resources directory contains your views, raw assets (LESS, SASS, CoffeeScript), and localization files. By default, views uses the view engine named blade, but you could change this in the config folder.
The storage directory contains compiled Blade templates, file based sessions, file caches, and other files generated by the framework. This folder is segregated into app, framework, and logs directories. The app directory may be used to store any files utilized by your application. The framework directory is used to store framework generated files and caches. Finally, the logs directory contains your application's log files.
The tests directory contains your automated tests. An example PHPUnit is provided out of the box.
The vendor directory contains your Composer dependencies and the libraries needed for you application. Each library installed through composer will be stored here.
App folder
The app folder contains the core code of your application. There different directories inside this folder, each one has an specific purpose:
The app directory ships with a variety of additional directories such as Console, Http, and Providers. Think of the Console and Http directories as providing an API into the "core" of your application. The HTTP protocol and CLI are both mechanisms to interact with your application, but do not actually contain application logic. In other words, they are simply two ways of issuing commands to your application. The Console directory contains all of your Artisan commands, while the Http directory contains your controllers, middleware, and requests. The routes of your application are defined in this directory also.
The Events directory, as you might expect, houses event classes. Events may be used to alert other parts of your application that a given action has occurred, providing a great deal of flexibility and decoupling. Check this link for more info
The Exceptions directory contains your application's exception handler and is also a good place to stick any exceptions thrown by your application.
The Jobs directory, of course, houses the queueable jobs for your application. Jobs may be queued by your application or run synchronously within the current request lifecycle. There is more info here.
The Listeners directory contains the handler classes for your events. Handlers receive an event and perform logic in response to the event being fired. For example, a UserRegistered event might be handled by a SendWelcomeEmail listener.
The Policies directory contains the authorization policy classes for your application. Policies are used to determine if a user can perform a given action against a resource. More info here.
I have application to which i'm trying to add widget too.
I wonder where should i put files which i want to use between application and the widget (sql lite database for core data).
Currently app data is inside:
~/Library/Application Support/my.app/
And widget data is inside:
~/Library/Application Support/my.app.widget/
Sandboxing is on on both (as it's required).
I wold like the sql file to be accessible from both app and the widget.
According to "The Application Group Container Directory" section of Apple's App Sandbox Design Guide:
an application can use the com.apple.security.application-groups
entitlement to request access to a shared container that is common to
multiple applications produced by the same development team. This
container is intended for content that is not user-facing, such as
shared caches or databases.
What this means is that you can obtain the path to your application group containers by using the "containerURLForSecurityApplicationGroupIdentifier" method of NSFileManager to get the path to your application & widget's shared data folder.
We have a CMS on heroku, some files were generated by the CMS, how can I pull those changes down? Can I commit the changes remotely and pull them down? Is there an FTP option of some kind?
See: https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem
It's not designed for persistent file generation and usage.
In practice, it works like this: User puts some code into a repository. That code is dynamically pulled into temporary Amazon EC instances and executed. The code can be pulled from virtual machine to virtual machine, node to node, without disruption, across data centers. There is no real "place" to get the products of your code from the environment, because anything generated by the checked-out code can (and will) be destroyed as your code deploy skips around between the temporary machines.
That being said, there are some workarounds:
If your app includes something like a file browser within your deployed code, you can grab the (entirely) temporary files using that file browser, and commit it back to your persistent code trunk.
Another option is using something like S3 for your persistent storage, with your application reading from, and writing to, a data storage service, knowing that while heroku will just re-write and destroy your local data on a frequent basis, the external service will maintain the files.
Similarly, you can change your application to use heroku's postgres for persistent data storage, or use Amazon's RDS, (etc.).
Alternately, you can edit your application in such a way as to ensure that any files generated by it will be regenerated every time the code is refreshed, redeployed, and moved around.
I have a Spring MVC application.
For example I have a simple JSP page that displays list of Contact objects.
User can add, remove objects. The question is about the way of Contact objects storage. I cannot (by some reasons) use database. How can I anyway store list of objects globally for application?
According to this
it must be stored across whole application lifec-cycle. After I
restart server it the list should not be lost
you can use H2 or HSQLDB database and keep it content into single file, located in configurable path. Anyway, to keep some persisted data, you should use local file or remote storage, so, i think, it would simplify solution if you use such kind of database.
I guess I am not the first one who encount this issue, but can't find much information after a bit of research. Here is my question:
A windows store app access a sqlite database, the database contains a
few tables, and it is read only. The size of database is 20 MB.
at the starting of the App, it will copy the database to
application folder (if it is not already there). It works fine,
when i test it manually (although it is not lighting fast). but it
always failed badly when testing again the certification test
toolkits, failed at the preformance test with "app crash" or "app
can start" error.
so my question is
1) is this the correct way of using sqlite database in windows
store app? (i mean using a 20MB database locally) or should i port
the data to cloud?
2) is the failure of the certification toolkit really matter? (
will it also means failure of publishing process?)
Thanks in advance
You are going on perfect way. If your app doesn't need Internet connectivity at all then don't go for cloud database. You should use extended splash screen to copy the database, you should not do that thing in App.xaml.cs. If you use cloud database then it will require more time for request-response. I think SQLite transaction is faster than that.
The certification may fail, if you are not using latest version of WACK. If your app fails WACK test, it won't be published.