Core data to existing project issue - sqlite

I am migrating a core data using sqlite as the persistentStoreCoordinator, the Core Data Model, entities, I created everything, but now my problem is I don't know how to make Core Data to write initial data file to the file I put in the mainBunddle. And there is always error like this:
-[NSKeyedUnarchiver initForReadingWithData:]: data is empty; did you forget to send -finishEncoding to the NSKeyedArchiver?
2011-07-14 17:37:59.409 SalePersonApp[1202:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableArray insertObject:atIndex:]: attempt to insert nil object at 0'
when I assign my context to the appDelegate Context:
SalePersonAppAppDelegate *app = [[UIApplication sharedApplication] delegate];
NSManagedObjectContext *context = app.managedObjectContext;
Error was at the second line.
Right now my sqlite files are empty because as I told, I don't know how to make the Core Data write back my Entities to the sql file.
Can anyone tell me how to do this. Thanks so much in advance.

If you put your persistent store inside the application bundle, then it is permanently readonly because everything inside the app bundle is read only.
To make a writable store, you need to create the store in one of the app directories outside the bundle usually either in Documents or Library.
If you need to provide a pre-populated persistent store, use Core Data to populate the store when run within Xcode. Then add the persistent store file itself to the build target so that it will be written into the app bundle. The first time the app runs, copy the persistent store from the app bundle to one of the writable directories. Then open the copy as normal.

Related

How to deploy changes in an existing Progress PASOE aplication when some method is added

I have a deployed application in Progress 4GL PASOE that is working in Production, but now we had to add a new method to the Business Entity class. We did it locally with Developer Studio and, after restarting the instance, it works as expected. However, I don´t know how to apply this changes to Production. I have already copied the .r/.cls files to the corresponding openedge folder and also the service json file with the catalog to the webapp folder. I have restarted the pasoe instance (tcman stop/tcman start) and restarted service, but if I make a request through Postman it raises a 500 error:
What else should we have to do? Is it necessary to delete the instance and do the whole deploy again to just add a new method?
The log file is throwing the following exception:
2021-06-16T16:44:30.500+02:00 WARN [thd-1] nynweb:r:0000000b o.a.cxf.phase.PhaseInterceptorChain - Interceptor for usuari has thrown exception, unwinding now
java.lang.NullPointerException: null
"usuari" is a table which is in the catalogue indeed.
Please let me know if you need some clarifying data to fully understand my problem.
Many thanks in advance.
Regards.
Normally, to add new methods to existing classes, I update the classes in the application directory and export the services again by OpenEdge, creating a ROOT.zip. I always use the incremental deploy so I delete the agents and then, when calling the created method, it will respond.
A tip to check if the method is published is important to access http://server:port/rest/; there you will see the catalogs that are published and also if your new method is available.

Importing existing sqlite db into Swift project

I have not developed anything for IOS in a long time so please bear with me. Using the Swift language for the first time in XCode 6.3.
I have a pre-existing sqlite database, myDB.sqlite, that I want to import into my project.
I have added the sqlite Framework, added FMDB and the bridging header file and then added the myDB.sqlite file to my project. It is also included in "Copy Bundle Resources".
I am just trying to access myDB.sqlite in my bundle directory to copy it to my Documents directory when the app is run for the first time in the Simulator. However it keeps saying it cannot find the file.
In my AppDelegate.swift:
let dbPath = NSBundle.mainBundle().pathForResource("myDB", ofType:"sqlite")
It keeps telling me that dbPath is nil.
Check the target membership of your SQLite database and it's done:

Database using Sqlite in C# windows phone 8

I have doubt regarding windows phone 8 application development. The database using sqlite for windows phone 8 is pre-loaded into the application or it should be created dynamically at the time of installation in windows phone..? and if it is pre-loaded then how to create the database.db file..?? and also if it is dynamically created, what is the procedure to create dynamically...??
I would say, pre-loaded into the application is the very common way.
Take a look at this article, I think the steps to accomplish your task are quite the same: http://wp.qmatteoq.com/import-an-already-existing-sqlite-database-in-a-windows-8-application/
The first step is to copy your database in to the Visual Studio project and, from the Properties window, set the Build action to Content.
Once you’ve done this operation, you’ll be able to access to the files embedded in your project thanks to the Package.Current.InstalledLocation object that is available in the Windows.ApplicationModel namespace.
The InstalledLocation’s type is StorageFolder, which is the base class of all the folders mapping in WinRT: for this reason, it exposes all the standard methods to interact with the storage, like getting a file or a folder. This way we can use the GetFileAsync method to get a reference to the database embedded into the project and, after that, using the CopyAsync method we can copy it into the local storage of the application. We can copy it in the root of the local storage (like in the following example) or in a specific folder, by getting a reference to it first using the GetFolderAsync method.
For those who are not able to work with sqlite I would like to suggest them to follow this link : http://dotnetslackers.com/articles/silverlight/Windows-Phone-7-Native-Database-Programming-via-Sqlite-Client-for-Windows-Phone.aspx and when you are dumping the data into the project .. you just need to change the properties of the "database1.sqlite" i.e. Build Action = resource . Thats all you need to do ..

There is already an object named 'Applications' in the database

I got this error in my asp.net webapi service when I call method Membership.ValidateUser(email, password);.
I am using EF 4.3.1. DB created using this code
using (var db = DbFactory.Get())
{
Console.WriteLine("Creating new database...");
db.Database.Create();
Console.WriteLine("Initializing with initial objects...");
db.Database.Initialize(true);
}
I get this error only once on first start of my service.
Does anybody know why it happens?
It sounds like you already have an object named 'Applications' in the database the first time your application starts.
Does the code snippet you provided only run at startup?
Try dropping the object through the database management engine, and then re-running your service.
The error is self-explanatory.
You are trying to create an object (ex: table, sp, view, etc.) that is named Applications but that object already exists in the database.
Maybe you didn't remove it after initial testing.
Providing you're trying to run it on the right project:
Check your migrations folder, the Up method of your InitialCreate class is probably trying to create the Application table. You can either
Drop the table and run the code again
or
Set up your InitialCreate properly to handle this scenario

MyGeneration.dOOdads problem with MySQL connection in ASP.net with stored procedures

I am using MyGeneration.dOOdads which helps in generating Business layer and Data layer easily, but currently I am facing a problem with it.
I had worked with MS SQL database and was successful, but now I have to work with MySQL 5.
I have the generated data layer classes of MySQL database successfully, but when I add them in my project along with the reference of MyGeneration.dOOdads dll file it gives error of no MySql4Entity class in the namespace.
I have generated the class according to the given instructions and also added the reference of mysql.data in the project but still this error is occuring.
Please guide me if you have used MyGeneration.doodads for MYSQL5 database in asp.net.
Also please tell me how to make stored procedure using MyGeneration.doodads of MYSQL database?
open doodads project (source code) .. right click on MySql4Entity class (and other classes related to mysql) and choose 'properties' the choose build action as 'compile' from the list ... to compile the file then build the project and it its output as reference to your project ...

Resources