Can Core Data content be edited directly? - cocoa

I've been using Core Data for about a week now, and really loving it, but one minor issue is that setting default values requires going through and setting up a temp interface to load the data, which I then do away with once I have the data seeded. Is there any way to edit values in a table, like how you can use phpMyAdmin to manipulate values in a MySQL database? Alternately, is there a way to write a function to import seed values from something like a Numbers spreadsheet if it doesn't detect the storedata XML file?

For your first question, you could edit the file directly but it's highly recommended you don't. How to edit it depends entirely on the store type you selected.
Regarding importing or setting up pre-generated data, of course: you can write code to manually insert entity instances into your Managed Object Context. There's a dedicated section on this very topic in the documentation. Further, if you have a lot of data to import, there's even a section on how to do this efficiently.

Is there any way to edit values in a
table, like how you can use phpMyAdmin
to manipulate values in a MySQL
database?
Xcode has a means of creating a quick and dirty interface for a data model. You just drag the data model file into a window in interface builder and it autogenerates an interface for you. This lets you view the data without having to have your entire app up and running.

Related

Data area access through SQL

I am looking for advice on how to use the QSYS2.DATA_AREA_INFO in a particular situation. So I have created a few views which selects data from multiple tables. I am trying to fetch data from a data area as well using the DATA_AREA_INFO function.
The views need to be installed in a number of data libraries. The create view SQL statement does not have any libraries hardcoded. The tables to pull data from will be based on the default library we set in iSeries navigator while creating the views. So once the view is created, it would permanently point to tables from the default data library set. (Hope this is correct?)
The issue is with fetching the data from the data area:
SELECT DATA_AREA_VALUE
FROM TABLE(QSYS2.DATA_AREA_INFO(
DATA_AREA_NAME => 'TESTDA1',
DATA_AREA_LIBRARY => '*LIBL'))
Writing the statement as above would result in the view selecting the data from the data area present in the library list.
But the jobs from which the views will be executed might not have a library list setup. Hence I cant rely on DATA_AREA_LIBRARY => '*LIBL'
Is there a way I can make the view point to the same data library always (same as how the tables work)?
You could wrap up the data area access in a (service)program which accesses the *dtaara via ILE. The advantage is, that your able to reuse the program in several ways, in and outside an sql context. You can find information about this technique here:
Scott Klement Powerpoint

Storing user input (Visual Basic)

I'm creating an application that will take a number of user inputs, store the data for a while, and eventually (at the end of the day) export it to an excel file.
An example might be that a user would input what they did throughout the day. Breakfast/At Home/for 10 minutes. Then later on they would input Coding/At Work/8 hours. Then later on Commuting/Subway/15 minutes. Etc.
I can handle the user interface, and the exporting to excel.
I'm just wondering what might be the best way to store that data and display it back to the user while the program is running. I'm used to working with macros in Excel itself, where I could simply store each row of data in another row on the excel spreadsheet itself.
I would still like a spreadsheet-like display, so that the user can go in to each data point and correct any mistakes. But I am making this as a standalone application using visual basic. Fortunately, I think the ListView or DataGridView tools will let me do this.
At the moment the method I'm thinking of using is simply to store all the user inputs in an array. But I would have to ReDim the array and increase its size each time the user created a new entry.
I can already see a problem with this, however, and that is that an array would have to be constantly stored in active memory. If the user's computer were to crash then all the data would be lost for good.
I'm really a rookie here, so I could use some guidance on how to store a bunch of user inputs like this.
You can use a database file. A local Sql Server Compact Editon database (a single file) that will store your data. You can use Entity Framework to interact with this database.
If you want to use Code First (generate your database from your code) use this:
https://www.codeproject.com/Articles/680116/Code-First-with-SQL-CE
If you want to use Database First (generate your entities from your database) use this:
http://erikej.blogspot.com/2013/11/entity-framework-6-sql-server-compact-4_25.html
You can also use SQLite or other kind database file, but i like SQL Server CE

Purpose and implemetnation of json field type in laravel schema builder

what is purpose of $table->json('options'); as field type of laravel database schema builder.I tried searching hard but couldn't get any relevant info on it.Please some one state list purpose with example
Some database engines - PostgreSQL being a major example - have JSON-friendly data types (that MySQL currently lacks - it'll just store as a TEXT data type there). This can be handy for working with data (like the options example you cite) that might contain a large amount of schema-less or loosely-structured data.
http://www.postgresql.org/docs/9.4/static/datatype-json.html
http://www.postgresql.org/docs/9.3/static/functions-json.html
Instead of having 100+ columns for a bunch of on/off options for a model, you could store them in a JSON object in the database.
Sometimes it is useful, even with MySQL to store data as JSON.
If you are building an application with user settings, when you only require a handful of user settings for your applications, a few columns in your users or settings table will do the trick nicely. But what about when you have dozens and dozens of configuration options? Well, in these cases, you might consider encoding a bit of JSON, and saving it to a single column.

ADOX Rearrange Or Insert Columns Rather than Append them in Access Vb6, VB.Net or CSharp

I need to insert a field in the middle of current fields of a database table. I'm currently doing this in VB6 but may get the green light to do this in .net. Anyway I'm wondering since Access gives you the ability to "insert" fields in the table is there a way to do this in ADOX? If I had to I could step back and use DAO, but not sure how to do it there either.
If yor're wondering why I want to do this applications database has changed over time and I'm being asked to create Upgrade program for some of the installations with older versions.
Any help would be great.
This should not be necessary. Use the correct list of fields in your queries to retrieve them in the required order.
BUT, if you really need to do that, the only way i know is to create a new table with the fields in the required order, read the data from the old table into the new one, delete the old table and rename the new table as the old one.
I hear you: in Access the order of the fields is important.
If you need a comprehensive way to work with ADOX, your go to place is Allen Browne's website. I have used it to from my novice to pro in handling Access database changes. Here it is: www.AllenBrowne.com. Go to Access Tips then scroll down to ADOX Code.
That is also where I normally refer people with doubts about capabilities of Access as a database :)
In your case, you will juggle through creating a new table with the new field in the right position, copying data to the new table, applying properties to the fields, deleting original table, renaming the new table to the required (original) name.
That is the correct order. Do not apply field properties before copying the data. Some indexes and key properties may not be applied when the fields already have data.
Over time, I have automated this so I just run an application to do detect and implement the required changes for me. But that took A LOT of work-weeks.

Save simple data in Magento's DB w/o Model

I'm looking to save some data in the Magento database without hassling with creating a new EAV object (or even a DB table if I can avoid it). Is there any place that you all know about that Magento will let you store serialized data?
If it matters, the data is a serialized set of SKUs that I need to retrieve. I know that I could create a new model, or possibly even create an attribute as a flag on each product, but those are both really overkill for my purposes.
Thanks,
Joe
First, it's possible to setup a simple, non-EAV model with Magento. You still need to do some configuration and setup, but it's much less complicated than a full on EAV store.
Second, if you're storing information specific to users you can throw it in a session object. I can't recall the syntax right now (will update later), but search through your codebsae for ::getModel followed by the phrase "session".
Third, you still have access to all the old PHP tools you'd normally have. Writing/reading out of a file or memcached space (or bringing in a third party Model library) is another option.
If you just want to run some database queries directly then you can do so with the underlying Zend Db abstractions.

Resources