I'm using the Web Connector to fetch data from multiple company files, and I want to know whether storing the ListID of an Invoice will produce a unique identifier across company files, or if I need to also store in each record a reference to its company file to establish uniqueness.
Is the QuickBooks ListID unique across company files?
No, it's not. It's a hexadecimal incrementing integer.
if I need to also store in each record a reference to its company file to establish uniqueness.
Yes, you do need to do that.
Related
I'm using Outlook Redemption to write an algorithm that will synchronize SQL database w/ the contents of an email folder.
I'd like to track the emails in the database by Outlook EntryID, but the Microsoft documentation on EntryIDs mentions that one Email Item can have multiple EntryIDs. Under what conditions will an Email Item have more than one EntryID?
MAPI can refer to the same object using multiple entry ids. Exchange uses so called short-term entry ids (returned by the folder contents table) and long term entry ids (returned from the object itself). Short term entry ids can only be used in the session that returned them, hence they should not be persisted and used across MAPI sessions.
I have a dilemma regarding Core Data and syncing data with server.
I wrote an app which uses Core Data, don't use id attributes, everything is set with relationships. Most of data is being generated on device and should be sent to server as backup. On the other hand, there is some data that can be reused among users and I want to have control over it, i.e. modifying, deleting, adding.
Question
When sending data to server, what's prefered way of dealing with relationships? In my opinion, it would be very inefficient to think in terms of Core Data, sending all relation objects to server and then deal with them if they already exist on server. So, using uniqueId is obligatory? Generating ones on server which will be shared and others on devices? Is there any other approach?
Thank you.
Assuming that the server database works with foreign keys, one common solution is to introduce id attributes and set them to some invalid state for new objects. For example, for new relationships you could generate an arbitrary number of unique "invalid" ids by using negative integers. The server would have to then assign new (server-unique) ids and send them back to the client. Of course, when importing data from the server, you replace foreign keys with relationships.
So if you have potentially more than one device trying to modify data also used by other users or devices, the server will have to be part of the solution. Otherwise, you could just generate unique IDs so the server can store the relationships.
We've an MVC web app which has a Claim management wizard (similar to a typical Order entry stuff). Claim can have multiple Items and each Item can have multiple files related to it.
Claim --> Items --> Files
While adding a new Claim - we want to allow the user to add one or more items to it and also allow file upload for those items. But we want to keep everything in memory until the Claim is actually saved - so that if the user doesn't complete the Claim entry or discards it, no database interaction is done.
We're able to handle data level in-memory management via session. We serialize the Claim object (which also includes a Claim.Items property) in session. But how to manage files?
We store files in < ClaimID >\< ItemID > folder but while creating a new
claim in memory we don't have any IDs until the record is being
saved in the database (both are auto-increment int).
For now, we've to restrict the user from uploading files until a Claim is saved.
Why not interact with the database? It sounds like you're intending to persist data between multiple requests to the application, and databases are good for that.
You don't have to persist it in the same tables or even in the same database instance as the more long-term persisted data. Maybe create tables or a database for "transient" data, or data that isn't intended to persist long-term until it reaches a certain state. Or perhaps store it in the same tables as the long-term data but otherwise track state to mark it as "incomplete" or in some other way transient.
You could have an off-line process which cleans up the old data from time to time. If deletes are costly on the long-term data tables then that would be a good reason to move the transient data to their own tables, optimized for lots of writes/deletes vs. lots of reads over time.
Alternatively, you could use a temporary ID for the in-memory objects to associate them with the files on the disk prior to be persisted to the database. Perhaps even separate the file-associating ID from the record's primary ID. (I'm assuming that you're using an auto-incrementing integer for the primary key and that's the ID you need to get from the database.)
For example, you could have another identifier on the record which is a Guid (uniqueidentifier in SQL) for the purpose of linking the record to a file on the disk. That way you can create the identifier in-memory and persist it to the database without needing to initially interact with the database to generate the ID. This also has the added benefit of being able to re-associate with different files or otherwise change that identifier as needed without messing with keys.
A Guid shouldn't be used as a primary key in many cases, so you probably don't want to go that route. But having a separate ID could do the trick.
I'm wanting to change our c# asp.net mvc application to work with windows authentication as well as forms authentication (as is currently implemented).
Currently we have a number of tables referencing a user id integer in the user table used by the forms authentication.
Is there an appropriate way of converting the unique string username returned by windows authentication to a unique integer that can be used as the id for the other tables?
An example might be using .GetHashCode() on the username, however I'm not sure if that will definitely create an appropriate integer (ie. unique, always the same integer returned given the same username, etc.)
GetHashCode() changes between framework versions, OS platform, etc., so you cannot rely on it for use as a DB PK.
If you are working with Windows authentication then maintaining the identify is useful for debugging, troubleshooting and possibly impersonation. Why not store it in a table with a Windows Username -> UserID mappings so that you can lookup a User ID given a user name?
Do not use GetHashCode()!
Instead, you should create a database table mapping Windows user accounts to integral user IDs (a Users table).
You can also store additional information about each user in this table.
I'm working on a database that stores user-created surveys. The database needs to store a unique ID for each survey. Using SQL, I'd just use a SERIAL column type so each row has an auto-incrementing numeric key.
SimpleDB seems to store everything as a string, meaning I would have to generate a unique key myself. Since this key will be part of the URL, I think a UUID is just too long. I want to be able to load a survey with something like:
foo.com/1a
Is there any way to have SimpleDB generate a unique row ID for each item you store? Thanks!
OK, so you're asking for opinions here.... I would choice any other storage mechanism over simpledb. For example, you could easily go with MongoDB as a document storage alternative to a relational DB and get more benefits than with SimpleDB.
As far as wanting a short unique URL, you can search and find a ruby implementation to turn an ID into a shorted ID. http://blog.kischuk.com/2008/06/23/create-tinyurl-like-urls-in-ruby/
That implementation will turn 1174229 into "7sH_" (according to the post. YMMV)
So, you'd have something like
class Survey
include Mongoid::Document
def to_param
generate_url(self.id)
end
end
in routes
resources :surverys, :path=>''
And that would create
http://yourapp/7sh_
Of course this technique can work for non-mongo installs.
SDB Explorer supports bulk upload from MYSQL to Amazon SimpleDB. You can upload your MYSQL data to Amazon SimpleDB using Upload feature. While upload SDB Explorer generates unique ID. Even you can choose you own MYSQL filed as a itemName() i.e. unique id for Amazon SimpleDB.