unique

Compare unique values from two mysql tables

I have two mysql tables: TableA has 10,000 records TableB has 2,000 records. I want to copy the 8,000 unique records from TableA into TableB ignoring the 2,000 in TableB which have already been copied. ...

Generating a Not-Quite-Globally Unique Identifier

I've found a number of different questions on generating UIDs, but as far as I can tell, my requirements here are somewhat unique (ha). To summarize: I need to generate a very short ID that's "locally" unique, but does not have to be "globally" or "universally" unique. The constraints are not simply based on aesthetic or space concerns...

Unique values in an array

I have an array of numbers that I need to make sure are unique. I found the code snippet below on the internet and it works great until the array has a zero in it. I found this other script here on SO that looks almost exactly like it, but it doesn't fail. So for the sake of helping me learn, can someone help me determine where the prot...

SQL table - semi-unique row?

Hi I have an SQL table with basically the following structure: PK (int, primary key), userID (int), data (varchar 64) Basically, any user as defined by userID is allowed to store any number of short strings. However, no user is allowed to store two identical strings (although user 1 and user 2 can both store the same string separatel...

Datediff between non-consecutive rows in a table

I would like to take the average of the time difference from Table1 below. The values are not consecutive and occasionally the time value is repeated, so I need to 1) sort by time, 2) discard non-unique values, 3) perform the time difference (in milliseconds), then 4) average the resulting time difference values. Further I'd like to 5)...

Unique ID and multiple classes with XPath

Hi I'm using XSLT for displaying a ul menu containing li and a. I want the following: Find the first li a element and add the .firstitem class. Find the last li a element and add the .lastitem class. Find the active li a element and add the .active class. Add an unique ID to each li a element. (I.e. URL friendly menu text as ID). I...

In Java: create unique random filename in a directory

How do I create a random unique filename in a directory (of my choice)? Note: I don’t want this file in the system temp path but rather in the directory I specify ...

Unique subscriptions

Architectural question for a classic ecommerce problem: I researched and didn't see a good solution. We're looking to create a subscription model where a person is given access to content. We're looking for ways to constrict people from sharing login/passwords. The hash combination of password + machine name wont work because our solu...

What is a good .NET data structure for finding unique items?

I have a large collection of custom objects that I have retrieved from a query in my system. Let's say these objects all have 5 different properties - FirstName, LastName, Gender, ZipCode and Birthday. For each of the different properties I would like to be able to get a list of all of the unique values and their counts and sort them i...

hash functions-sql studio express

I need to create a hash key on my tables for uniqueness and someone mentioned to me about md5. But I have read about checksum and binary sum; would this not serve the same purpose? To ensure no duplicates in a specific field. Now I managed to implement this and I see the hask keys in my tables. Do I need to alter index keys originally cr...

Use of unique on STL vector with a structure

In a programming task, I'm trying to ensure a particular vector contains only unique items. With primitive types, the operation is as simple as: vector<int> lala; lala.push_back(1); lala.push_back(99); lala.push_back(3); lala.push_back(99); sort(lala.begin(), lala.end()); // lala: 1, 3, 99, 99 lala.erase(unique(lala.begin(), lala.end()...

A common way to make checking for nonexistence of a row and inserting it atomic?

I have a web-application. The flow of processing a form in it goes like this: Validate List errors or Insert/update the data In this particular scenario I'm developing a user registration process but I'm trying to find a common solution for all types of forms bases on checking availability of unique value in a database table. In thi...

Unique Virtual Machine

I am working on some method to protect my software with a license. Doing some wmi calls to uniquely distinguish computers and making sure there cannot be loaded multiple instances of the application. I came to think though when the application is installed on a virtual machine (MS Virtual PC, VMWare, Virtual Box etc.) and licensed on th...

Algorithm to generate unique (possibly auto incremented) ids

I need to generate unique ids for my application and I am looking for suitable algorithms. I would prefer something like this -- YYYY + MM + DD + HH + MM + SS + <random salt> + <something derived from the preceding values> F.ex. - 20100128184544ewbhk4h3b45fdg544 I was thinking about using SHA-256 or something but the resultant string...

Finding unique nodes with xslt

I have an xml document that contains some "Item" elements with ids. I want to make a list of the unique Item ids. The Item elements are not in a list though - they can be at any depth within the xml document - for example: <Node> <Node> <Item id="1"/> <Item id="2"/> </Node> <Node> <Item id="1"/> <Node> <It...

Unique List<T> in .NET 2

What is a (preferably generic) unique(IComparable/IEquitable) valued collection (à la List<T>; ideally a equivalent to HashSet<T> in .NET 3.5 without ordered items) of objects for .NET 2? ...

Sessions/Session IDs being assigned to more than one user

I hope someone out there has some update to date information on sessions and their IDs. I'm running on IIS 7 and we're seeing Sessions assigned to more than 1 IP address. I ruled out the possibility of it being caused by users resetting their IP addresses, for instance by unplugging their modems. In at least one instance a user logge...

On the mobile phone, is there a "mac address" that makes each mobile phone different?

In other words, is there an ID for each and every mobile phone--that makes it different. No two phones can have the same ID. (I'm talking about smartphones ...android, iphone, etc) ...

Saving auto increment in MySQL

Hello, I am trying to sync between 2 tables: I have active table where has auto_increment, and I have archive table with the same values. I would like both ID's to be unique (between the tables as well) - I mean, I would like to save auto incremenet, and if I UNION both table I still have uniqness. How can I do that? Is there a possibili...

Assign a value equal only to itself

I wish to assign to a variable (a "constant"), a value that will allow that variable to only ever return True in is and == comparisons against itself. I want to avoid assigning an arbitary value such as an int or some other type on the off chance that the value I choose clashes with some other. I'm considering generating an instance of...