unique

Handling NA values in apply and unique

I have a 114 row by 16 column data frame where the rows are individuals, and the columns are either their names or NA. For example, the first 3 rows looks like this: name name.1 name.2 name.3 name.4 name.5 name.6 name.7 name.8 name.9 name.10 name.11 name.12 name.13 name.14 name.15 1 ...

grep and sed command question

Hi there i have a truckload of files with sql commands in them, i have been asked to extract all database table names from the files How can I use grep and sed to parse the files and create a list of the unique table names in a text file ..one per line? the name names all seem to start with "db_" which is handy! what would be the best ...

Multiple unique counters in a table

Hi all, I have a problem where I need to keep and increment an object number field in a table, however this number should be unique within given logical domain, not across table globally. An example would be multiple Businesses scheduling multiple Jobs; Job.Number should be unique within a business. So I basically need to make sure t...

How to check if a table contains an element in Lua ?

Is there a method for checking if a table contains a value ? I have my own (naive) function, but I was wondering if something "official" exists for that ? Or something more efficient... function table.contains(table, element) for _, value in pairs(table) do if value == element then return true end end return false en...

Are there circumstances where a hash algorithm can be guaranteed unique?

If I'm hashing size-constrained similar data (social security numbers, for example) using a hash algorithm with a larger byte size than the data (sha-256, for example), will the hash guarantee the same level of uniqueness as the original data? ...

Unique XML element constraint in T-SQL

Hi, I have an SQL (Microsoft SQL 2008) table with XML data in one of the columns. Each XML root node has an attribute which is a GUID. For example: <!--Row 1--> <example:root id="E0B1BCEA-C0E2-4d7c-BF67-FA9A7C3FBA73"> [...] </example:root> <!--Row 2--> <example:root id="13BB87F4-32A5-4de7-8CE9-E62AF002B958"> [...] </example:r...

SELECT with conditions for preferential source

I have a query which I've been using for sometime however I have a new scenario which I'm not sure how to handle. The query below extracts avg pricing from a table called availables. The problem I have now is that, the data which is contained in this table can come from one of two sources. So I added a source field to the table. Th...

Need help with mysql query

hi all, I'm new to mysql so please can you help me. I have 2 tables "words" and "text" words has columns: word synonyms text has columns: text word article_id I need to get unique words.word, and biggest unique text.atricle_id fields. The same article_id can have different words. for example words word synonyms ---...

Entity framework stored procedure mapping results not unique entities

I have a problem where I've mapped a stored procedure named sp_getMyEntity, which takes in one parameter called Id and then maps the results to a custom entity called MyEntity I'm using mock data to illustrate the point. When I run the stored procedure with an id of 1, I get two distinct results back from the database: exec [dbo].[sp_g...

SOlving the problem of unique key in joomla

I am novice to joomla. I am using Joomla 1.5. I have declared a field in database table as unique. Lets suppose , I have declared "username" as unique . I created a component named "com_user" in the administrator/components section. Now, when I add a user "xyz123", for the first time, its ok. But, during next entry, when I enter the same...

SQL Server 2008: produce table of unique entries

Hi all I have the following problem. I have a table with a few hundred thousand records, which has the following identifiers (for simplicity) MemberID SchemeName BenefitID BenefitAmount 10 ABC 1 10000 10 ABC 1 2000 10 ABC ...

Access - Select distinct records where only one column is distinct

I have an Access table with two columns (ID and Active) with data like the following: ID | Active ------------ 123 | 0 124 | 0 125 | 0 123 | 1 314 | 1 948 | 1 I want to select the distinct records that have a unique ID (that only exist once, not just the first time they exist), but I also need the Active value. If I do a SELECT DI...

Deleting duplicates from a large table

Hi, I have quite a large table with 19 000 000 records, and I have problem with duplicate rows. There's a lot of similar questions even here in SO, but none of them seems to give me a satisfactory answer. Some points to consider: Row uniqueness is determined by two columns, location_id and datetime. I'd like to keep the execution time...

MySQL id sequence

Is this a correct way for id generation in MySQL ? INSERT INTO Picture (PictureId,First_pick,Title,Description,File_Name,Is_Vertical)VALUES ((SELECT max(pictureid)+1 FROM Picture),0,?,?,?,?) I mean if it is guaranted that PictureId will be unique when this query is run by many threads ? I can't modify table structure. Should I...

Cartesian product of several vectors

Hi, similar questions have been asked before but I cant find an exact match to my question. I have 4 vectors each of which hold between 200-500 4 digit integers. The exact number of elements in each vector varies but I could fix it to a specific value. I need to find all possible combinations of the elements in these 4 vectors. eg: ...

Finding unique maximum values in a list using python

Hi I have a list of points as shown below points=[ [x0,y0,v0], [x1,y1,v1], [x2,y2,v2].......... [xn,yn,vn]] Some of the points have duplicate x,y values. What I want to do is to extract the unique maximum value x,y points For example, if I have points [1,2,5] [1,1,3] [1,2,7] [1,7,3] I would like to obtain the list [1,1,3] [1,2...

Python - Why use anything other than uuid4() for unique strings?

I see quit a few implementations of unique string generation for things like uploaded image names, session IDs, et al, and many of them employ the usage of hashes like SHA1, or others. I'm not questioning the legitimacy of using custom methods like this, but rather just the reason. If I want a unique string, I just say this: >>> import...

SharePoint: Unique column values

I Want to have only unique values in a SharePoin List. To achieve this I can use 'ItemAdding' event handler as mentioned in the below link. http://weblogs.asp.net/vikram/archive/2008/12/24/sharepoint-using-event-handler-to-make-a-column-unique.aspx Now I have a Doubt: Suppose that two user tries to add list Item in the list with the sa...

How to generate unique number of 12 digits?

I'm working on an app that sends raw data to zebra printer and print out barcodes. And since every item has its own unique barcode, I need to define a variable that automatically generates unique number of 12 digits long. see example: printBar prnt = new printBar("123456789012"); Is there anyway to define a double variable and pass i...

PHP: why uniqid returned value is only 13 digits long

uniqid() function returns a 13 digits long hexadecimal number. According to the spec in php.net site, the function uses microtime to generate the unique value. But microtime returns numbers in string format as the following one: "0.70352700 12689396875" which are basically the microseconds and the seconds elapsed since 1970. This is a...