html5- mismatch in key value in session and local storage - html

Is the local storage stores all keys and values in common. ie., if i use a key called counter in one page and same key counter is used in another page to store a value, whether first one overwrites the next one??? how it works actually??

i found it. for each domain you can have only one key with a name. for example: for 199.63.166.222/localwebsite.html , it stores a key name Name , and if i use same key in 199.63.166.222/private.html this will overwrite the value previously stored from localwebsite.html ; this is due to both pages are from same domain.

Related

MS Access -- how to get other fields using a primary key

I'm adding a couple fields to a form made by someone else and am having trouble getting the value in one of the fields.
The field displays a location and is called "location." But when I set a new field to =[location], it returns the primary key from the data table of locations instead of the location. When I try to get the value directly from the source, [Table]![originalLocation] returns #name?.
How can I get a field associated with a primary key? So far everything returns the value of the primary key. Thanks.

Not create a Primary Key when typing in a form

I was wondering if there is a way for a form to not generate a Primary Key as soon as I start typing on a field (this is just in case I don't really want to insert)? Can it show what Primary Key will be generated when I do/only generate and insert in the table?
There is a difference between a Primary Key and a automatically generated number. It is true that Access proposes an autonumber field as a PK, but you can definitely switch it to a number or character field. Then, you will have to find a way to enter manually the PK value, or generate it through code(*), before inserting the record in the table.
(*) In case you are using numbers as PKs, the logic could be here to check the higher PK value already in the table (max()) and add 1 to it.

Foreign key / ID that is not assigned

I have a rails app with records that contain foreign IDs linking to records other records (belongs_to).
I am aware that index IDs start at 1 by default, and it's common to have a validation in the model that ensures foreign ID values are greater than zero.
In my example, I would like to have the option to not have a foreign ID set (i.e. it is not [yet] linked to a another 'owning' record).
Would it be appropriate to remove the validation from the model, and then set the value of the foreign ID to zero in this case, indicating that it is not assigned?
For some reason, I don't seem to be able to find this stated in documentation anywhere, maybe I'm using the wrong terminology, or it's too obvious to document ;-)

Do I need a primary key for every table in MS Access?

I am new to MSAccess so I'm not sure about this; do I have to have a primary key for every single table in my database? I have one table which looks something like this:
(http://i108.photobucket.com/albums/n32/lurker3345/ACCESSHELP.png?t=1382688844)
In this case, every field/column has a repeating term. I have tried assigning the primary key to every field but it returns with an error saying that there is a repeated field.
How do I go about this?
Strictly speaking, Yes, every row in a relational database should have a Primary Key (a unique identifier). If doing quick-and-dirty work, you may be able to get away without one.
Internal Tracking ID
Some database generate a primary key under-the-covers if you do not assign one explicitly. Every database needs some way to internally track each row.
Natural Key
A natural key is an existing field with meaningful data that happens to identify each row uniquely. For example, if you were tracking people assigned to teams, you might have an "employee_id" column on the "person" table.
Surrogate Key
A surrogate key is an extra column you add to a table, just to assign an arbitrary value as the unique identifier. You might assign a serial number (1, 2, 3, …), or a UUID if your database (such as Postgres) supports that data type. Assigning a serial number or UUID is so common that nearly every database engine provides a built-in facility to help you automatically create such a value and assign to new rows.
My Advice
In my experience, any serious long-term project should always use a surrogate key because every natural key I've ever been tempted to use eventually changes. People change their names (get married, etc.). Employee IDs change when company gets acquired by another.
If, on the other hand, you are doing a quick-and-dirty job, such as analyzing a single batch of data to produce a chart once and never again, and your data happens to have a natural key then use it. Beware: One-time jobs often have a way of becoming recurring jobs.
Further advice… When importing data from a source outside your control, assign your own identifier even if the import contains a candidate key.
Composite Key
Some database engines offer a composite key feature, also called compound key, where two or more columns in the table are combined to create a single value which once combined should prove unique. For example, in a "person" table, "first_name" and "last_name", and "phone_number" fields might be unique when considered together. Unless two people married and sharing the same home phone number while also happening to each be named "Alex" with a shared last name! Because of such collisions as well as the tendency for meaningful data to change and also the overhead of calculating such combined values, it is advisable to stick with simple (single-column) keys unless you have a special situation.
If the data doesn't naturally have a unique field to use as the primary key, add an auto-generated integer column called "Id" or similar.
Read the "how to organize my data" section of this page:
http://www.htmlgoodies.com/primers/database/article.php/3478051
This page shows you how to create one (under "add an autonumber primary key"):
http://office.microsoft.com/en-gb/access-help/create-or-remove-a-primary-key-HA010014099.aspx
In you use a DataAdapter and a Currency Manager, your tables must have a primary key in order to push updates, additions and deletions back to the database. Otherwise, they will not register and you will receive an error.
I lost one week figuring that one out until I added this to the Try-Catch-End Try block: MsgBox(er.ToString) which mentioned "key". From there, I figured it out.
(NB : Having a primary key was not a requisite in VB6)
Not having a primary key usually means your data is poorly structured. However, it looks like you're dealing with summary/aggregate data there, so it's probably doesn't matter.

MySQL Primary Key Field Type

I am working with some transactional data and having issues with my primary key field. When importing data from my order manager system and Google analytics, the OrderID field has the following two value formats:
123456
002-0130775-1483424
How do I format this field to be a primary key?
Thank you in advance for your help! :)
(Running MySQL 5.5.27)
You should create an auto-increment primary key field that contains arbitrary integers (an 'internal' key)... you can put your actual "key" data in another field titled OrderNumber or something similar and put a unique index on it.
Yes, keeping your primary key internal helps insulate you from change. Anything that could be exposed as data should be re-considered as a key.
As an option, you can set up a syntetic primary key (for your internal references only) and an indexed CHAR(20) column (probably with a unique index attached for consistency purposes) – this appears to be a better solution as one day you might want to integrate with another system which might have collisions with the existing data.
See, primary key should be bigint in nature, However you can modify the way you want.
MYSQL 5.5.27 have some important changes from its earlier version ,please follow the link
https://dev.mysql.com/doc/refman/5.5/en/news-5-5-27.html