data-integrity

Prevent two users from editing the same data

Hi everyone, I have seen a feature in different web applications including Wordpress (not sure?) that warns a user if he/she opens an article/post/page/whatever from the database, while someone else is editing the same data simultaneously. I would like to implement the same feature in my own application and I have given this a bit of t...

Maintaining integrity of Core Data Entities with many incoming one-to-many relationships

Hi all. I have a Core Data store which contains a number of MediaItem entities that describe, well, media items. I also have NewsItems, which have one-to-many relationships to a number of MediaItems. So far so good. However, I also have PlayerItems and GalleryItems which also have one-to-many relationships to MediaItems. So MediaItems a...

Doubts About Core Data NSManagedObject Deep Copy

Hello everyone, I have a situation where I must copy one NSManagedObject from the main context into an editing context. It sounds unnecessary to most people as I have seen in similar situations described in Stackoverflow but I looks like I need it. In my app there are many views in a tab bar and every view handles different information ...

VS 2010 Database Project dropping data on column name change

Howdy, I am testing out the new database project features of Visual Studio 2010 and want to change the name of a column in a table. I changed the name in the create script and deployed it against the database. The script that was generated just dropped the column and added a new column with the correct name, but all the data was lost....

Export to csv, string w/ comma in it, splits it up

This code exports data into a csv file, which is opened within Excel. When a string has a comma within it, it messes up the order of the data. I need help modifying my code below to resolve any strings that contain a comma within it, to not to create a new column until after the string. I am assuming it will pass each string within do...

How do you manage databases during development?

My development team of four people has been facing this issue for some time now: Sometimes we need to be working off the same set of data. So while we develop on our local computers, the dev database is connected to remotely. However, sometimes we need to run operations on the db that will step on other developers' data, ie we break as...

Repeated parameter checks in functions

I often have call hierarchies in that all methods need the same parameters. If I dont't want to put them on the instance level (member of the class) then I ask me always if its meaningfull to check the validity of them in each method. For example: public void MethodA(object o){ if(null == o){ throw new ArgumentNullException("...

Data integrity question when collecting STDOUTs from multiple remote hosts over SSH

Suppose you run the following commands: ssh $host1 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' > /tmp/output ssh $host2 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' >> /tmp/output ssh $host3 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' >> /tmp/output Then the output would look like: ...

How do I ensure data integrity for objects in google app engine without using key names?

Hi- I'm having a bit of trouble in Google App Engine ensuring that my data is correct when using an ancestor relationship without key names. Let me explain a little more: I've got a parent entity category, and I want to create a child entity item. I'd like to create a function that takes a category name and item name, and creates both ...

Repair Data Integrity

I think this is a long-shot, but here it goes: The basic question is: how does a development team beginning to repair data integrity on a large, damaged dataset? The company I'm helping out has a huge MySQL/PHP5 sytem with a few years of cruft, invalid data, broken references, etc. To top it all off, this data references data on a few ...

Database constraints - keep or ignore?

When I was learning in university, they taught us the database fundamentals, basics and rules, and one of the most important rules is the constraints (primary key, foreign key), and how to make 1-m, 1-1, m-n relationships. Now when I move to real business environment they tell me: you should forget all you have been taught; no constrain...

SQL Trigger not working correctly

here are the 2 tables i have, i want to implement an trigger that customer cannot have more than 5 accounts from a one bank, but can have more than 5 in total. CREATE TABLE ACCOUNT( ACCOUNT_NO VARCHAR(20) NOT NULL, BALANCE REAL, BANK_CODE VARCHAR(20), BRANCH_NO VARCHAR(25), ACCOUNT_CODE VARCHAR(20), PRIMARY KEY(ACCO...

How to form this SQL Constraint, and does it work in reverse?

Say I have "Table A": Id | Col A 1 Z 2 I 3 Null ...and n number of tables that have this format: Id | A_FK | OtherInfo 1 1 "Some info" 2 2 "Some more info" 3 3 "Blah" ...where A_FK is a foreign key reference to the "Table A" Id. So there is one "Table A", and n number of "Table B's". For these "B" ...

How else can this code be optimized for defensive programming?

For my data structures project, the goal is to read in a provided file containing over 10000 songs with artist, title and lyrics clearly marked, and each song is separated by a line with a single double quote. I've written this code to parse the text file, and it works, with a running time of just under 3 seconds to read the 422K lines...

Dumping unreferenced pages in an sqlite file and re-referencing them.

Hi there! I got a damaged sqlite3 file with some pages referenced twice and some with zero references. I would like to know and dump these unreferenced pages and, if possible, manually re-reference them. The result of PRAGMA integrity_check; follows: "*** in database main *** On tree page 108 cell 0: 2nd reference to page 247 On tree p...

MySQL transactions: multiple concurrent transactions and data integrity

I'm using transactions for managing data across several MySQL InnoDB tables in a reasonably complex web application. Briefly, a given transaction works as follows: Data is read from a row in a "user_point_totals" table Various machinations calculate what the user's new point total should be A new entry is created in the "user_point_to...

Non-Trusted Constraints

I just learned, to my amazement, that foreign key constraints can be non-trusted. This occurs when a constraint is added using WITH NOCHECK. When a constraint is non-trusted, it isn't used by the query analyzer for query plan generation. See: http://sqlblog.com/blogs/hugo_kornelis/archive/2007/03/29/can-you-trust-your-constraints.as...

Best way to enforce this data-integrity constraint?

I have 3 tables (lets call them Foo, Bar and Baz. Tables: Foo FooId Bar BarId FooId Baz BazId BarId AnotherValue Obviously the foreign keys make it so that each Baz is associated with a Bar, and hence, associated with a Foo. Now I want to ensure that for each set of Baz with the same "AnotherValue" all the associated Foo's ...

Need for both Ciphering and Integrity ?

Why do some scenarios require both ciphering and integrity whereas some scenarios require only ciphering ? What are the factors that decide this in the case of networking domain ? ...

Suitable hash function for data corruption

What is the most suitable hash function for file integrity checking (checksums) to detect corruption? I need to consider the following: Wide range of file size (1 kb to 10GB+) Lots of different file types Large collection of files (+/-100 TB and growing) Do larger files require higher digest sizes (SHA-1 vs SHA 512)? I see that the S...