Search Results

Search found 5527 results on 222 pages for 'unique constraint'.

Page 19/222 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Creating a unique id for a Core Data program on the iPhone

    - by Big Twisty
    I am fairly new at programming in Objective-C, having been a windows programmer since I was a kid. I am falling in LOVE with it. I am, however, having a bit of trouble figuring out this Core Data stuff. How do I create a new entry with a unique ID? In SQL I would just declare one field as an autoincrement field. I'm not seeing anything like that here, but I could just be missing something. I just want an auto incrementing NSInteger field, so when I manually add items to the database, I will have some form of reference to them.

    Read the article

  • Unique elements of list within list in python

    - by user2901061
    We are given a list of animals in different zoos and need to find which zoos have animals that are not in any others. The animals of each zoo are separated by spaces, and each zoo is originally separated by a comma. I am currently enumerating over all of the zoos to split each animal and create lists within lists for different zoos as such: for i, zoo in enumerate(zoos): zoos[i] = zoo.split() However, I then do not know how to tell and count how many of the zoos have unique animals. I figure it is something else with enumerate and possibly sets, but cannot get it down exactly. Any help is greatly appreciated. Thanks

    Read the article

  • Include a unique URL in EXE

    - by John Grey
    Hi :) I want to give users of my site the ability to upload their software/hardware configuration automatically on Windows. So I'm thinking of having an EXE file download, and somehow put in that EXE a unique URL for each user. When the data is collected, the program would just posts some JSON to that URL. How can I do it? I'm most familiar with .NET platform. Tools like this do exist, for example Blizzard uses this approach for their beta test enroll. Each user downloads a slightly different EXE. TIA

    Read the article

  • MySQL - get all unique values of a column, check if has a specific value

    - by gamers2000
    First off - apologies for the poor title, I have no idea how to describe it in a one-liner. I have a table - snippet is below. mysql> select * from playlistfiles; +-----------------------+--------------+-----------+ | FileName | PlaylistName | FileIndex | +-----------------------+--------------+-----------+ | File1 | Image1 | 0 | | File1 | Video1 | 2 | | File2 | Video1 | 0 | | File3 | Video1 | 1 | | File4 | Image1 | 1 | | File4 | Video1 | 3 | +-----------------------+--------------+-----------+ 6 rows in set (0.00 sec) What I need to do is to get all the FileNames and whether the file is in a playlist or not, as well as order them by FileIndex i.e. for the Image1 playlist, the output should be +-----------------------+------------+-----------+ | FileName | InPlaylist | FileIndex | +-----------------------+------------+-----------+ | File1 | 1 | 0 | | File2 | 0 | Null | | File3 | 0 | Null | | File4 | 1 | 1 | +-----------------------+------------+-----------+ and Video1 would be +-----------------------+------------+-----------+ | FileName | InPlaylist | FileIndex | +-----------------------+------------+-----------+ | File2 | 1 | 0 | | File3 | 1 | 1 | | File1 | 1 | 2 | | File4 | 1 | 3 | +-----------------------+------------+-----------+ In short, I need to be able to get all the unique FileNames from the table, and check if it is in a given table and if so, order it by FileIndex.

    Read the article

  • Should I use "id" or "unique username"?

    - by roa3
    I am using PHP, AS3 and mysql. I have a website. A flash(as3) website. The flash website store the members' information in mysql database through php. In "members" table, i have "id" as the primary key and "username" as a unique field. Now my situation is: When flash want to display a member's profile. My questions: Should Flash pass the member "ID" or "username" to php to process the mysql query? Is there any different passing the "id" or "username"? Which one is more secure? Which one you recommend? I would like to optimize my website in terms of security and performance.

    Read the article

  • c# Create a unique name with a GUID

    - by Dave Rook
    I am creating a back up solution. I doubt there is anything new in what I'm trying to achieve. Before copying the file I want to take a backup of the destination file in case anything becomes corrupt. This means renaming the file. I have to be careful when renaming in case the file already exists and adding a 01 to the end is not safe. My question is, based upon not finding the answer else where, would adding a GUID to the file name work. So, if my file was called file01.txt, renaming the file to file01.txtGUID (where GUID is the generated GUID), I could then perform my back up of that file (at this instance having 2 back ups) and then, after ensuring the file has copied (by comparing length of file to the source), delete the file with the GUID in the name. I know the GUID is not 100% guaranteed to be unique but would this suffice?

    Read the article

  • Getting unique items from NSMutableArray

    - by Gidogeek
    Hi Guys, I have a question about Objective-C today involving NSMutableArray. Coming from a .net/c# background I'm having some trouble working with these things. Let's say I have an object called "Song" My song has 3 properties: Title Artist Genre I have a NSMutableArray or NSArray wich holds all my Song objects. How would I go about trying to 'query' my array to get a new array with only (Unique) Artists or Genre's. Where as in .net you would write a simple LINQ query with a DISTINCT clause, how would one solve this in Objective-C ? I'm guessing with predicates but am struggling to find a solution. Thanks in advance.

    Read the article

  • Not unique table/alias - can't understand why!?

    - by Andy Barlow
    Hi! I'm trying to join some tables together in MySQL, but I seem to get an error saying: #1066 - Not unique table/alias: 'calendar_jobs' I really want it to select everything from the cal_events, the 2 user bits and just the destination col from the jobs table, but become "null" if there arn't any job. A right join seemed to fit the bill but doesn't work! Can anyone help!? SELECT calendar_events.* , calendar_users.doctorOrNurse, calendar_users.passportName, calendar_jobs.destination FROM `calendar_events` , `calendar_users` , `calendar_jobs` RIGHT JOIN calendar_jobs ON calendar_events.jobID = calendar_jobs.jobID WHERE `start` >=0 AND calendar_users.userID = calendar_events.userID Cheers!

    Read the article

  • PHP OOP: Unique method per argument type?

    - by sunwukung
    I'm writing a little homebrew ORM (academic interest). I'm trying to adhere to the TDD concept as a training exercise, and as part of that exercise I'm writing documentation for the API as I develop the class. Case in point - I'm working on a classic "getCollection" type mapper class. I want it to be able to retrieve collections of asset X (let's say blog posts) for a specific user, and also collections based on an arbitrary array of numeric values. So - you might have a method like any one of these $User = $UserMapper->load(1); $ArticleCollection = $ArticleMapper->getCollection(range(10,20)); $ArticleCollection = $ArticleMapper->getCollection($User); $ArticleCollection = $ArticleMapper->getCollection($User->getId()); So, in writing the documentation for the getCollection method - I want to declare the @param variable in the Docblock. Is it better to have a unique method for each argument type, or is it acceptable to have a method that delegates to the correct internal method/class based on argument type?

    Read the article

  • effective counter for unique number of visits in PHP & MySQL

    - by Adnan
    Hello, I am creating a counter for unique number of visits on a post, so what I have until now is a table for storing data like this; cvp_post_id | cvp_ip | cvp_user_id In cases a registered user visits a post, for the first time a record is inserted with cpv_post_id and cvp_user_id, so for his next visit I query the table and if the record is available I do not count him as a new visitor. In cases of an anonymous user the same happens but now the cvp_ip and cpv_post_id are used. My concerns is that I do a query every time anyone visits a post for checking if there has been a visit, what would be a more effective way for doing this?

    Read the article

  • unique random id

    - by Piyush
    I am generating unique id for my small application but I am facing some variable scope problem. my code- function create_id() { global $myusername; $part1 = substr($myusername, 0, -4); $part2 = rand (99,99999); $part3 = date("s"); return $part1.$part2.$part3; } $id; $count=0; while($count == 1) { $id; $id=create_id(); $sqlcheck = "Select * FROM ruser WHERE userId='$id';"; $count =mysql_query($sqlcheck,$link)or die(mysql_error()); } echo $id; I dont know which variable I have to declare as global

    Read the article

  • SQL Count unique objects defined by parameters

    - by Eduardo
    I have a table with: id | parameter 1 | A 1 | B 2 | A 3 | A 3 | B That represent objects defined with the values as: 1 -> A,B 2 -> A 3 -> A,B I want to count the number of objects with different parameters using a SQL query, so in this case it would be 2 unique objects as 1 and 3 have the same parameters. The database is a Microsoft SQL Server 2000. But I do not mind knowing the solution for other databases.

    Read the article

  • how external counter get unique visitors?

    - by dnkira
    hello how do external counter track unique visitors via image i'd also like to get Referrer if possible. something like img="http://www.somecounterdomain.com/count.php?page=83599" i'm using ASP.NET, c# i'm aware of a user can "cheat" but would like to make that posibility minimal. additional difficulty is that i should trach external server and can't implement c# code there. what i can is only imlement a counter imag or smth like that. i try to use generated image. thx for answers.

    Read the article

  • Unique visitor counting in ASP.NET MVC

    - by Max
    I'd like to do visitor tracking similar to how stackoverflow does it.. By reading through numerous posts, I've figured out some details already: Count only 1 IP hit per 15 minutes (if anonymous) Count only 1 unique user-Login (per day?) Now that leaves the question of the real implementation.. Should I log the two factors live into a table (and increase count) | IP | timestamp | pageurl | Or do the counting AFTERWARDS (e.g. using IIS log files - which don't include the user, right? I know there're some similar posts outside, but NONE really has a great solution in my opinion yet..

    Read the article

  • Alternative to singleton for unique resources

    - by user1320881
    I keep reading over and over again that one should avoid using singletons for various reasons. I'm wondering how to correctly handle a situation where a class represents a unique system resource. For example, a AudioOutput class using SDL. Since SDL_OpenAudio can only be open once at a time it makes no sense having more then one object of this type and it seems to me preventing accidentally making more then one object would actually be good. Just wondering what experienced programmers think about this, am i missing another option ?

    Read the article

  • Cakephp, i18n, SQL Error, Not unique table/alias

    - by ion
    I get the following SQL error: SQL Error: 1066: Not unique table/alias: 'I18n__name' when doing a simple find query. Any ideas on possible situations that may have caused this?? I'm using a bindModel method to retrieve the data is that related? This is my code: $this->Project->bindModel(array( 'hasOne' => array( 'ProjectsCategories', 'FilterCategory' => array( 'className' => 'Category', 'foreignKey' => false, 'conditions' => array('FilterCategory.id = ProjectsCategories.category_id') )))); $prlist = $this->Project->find('all', array( 'fields' => array('DISTINCT slug','name'), 'conditions' => array('FilterCategory.slug !='=>'uncategorised') ))

    Read the article

  • Writing a unique identifier to script?

    - by dannycab
    I'd like to write a subscript that adds a unique identifier (machine time) to a script everytime that it runs. However, each time I edit the script (in IDLE) the indetifiers are over-written. Is there a elegant way of doing this. The script that I wrote appears below. import os, time f = open('sys_time_append.py','r') lines = f.readlines() f.close() fout = open('sys_time_append.py','w') for thisline in lines: fout.write(thisline) fout.write('\n#'+str(time.time())+' s r\n') fout.close() Thanks for any help.

    Read the article

  • Creating Pages with unique PageMaps

    - by Michael Krauklis
    I have a wicket Application that has long lived Pages. I would like each instance of this Page to be created with a unique PageMap for reasons I won't get into here, but when I try to specify a PageMap on the constructor of my Page I end up getting OOM and StackOverflow errors. Here is the code: public <CTOR>() { super(Session.get().newPageMap("" + System.currentTimeMillis())); ... I'm using a custom BookmarkablePageLink (custom in that it does not pass on the current PageMap name to the new Page) to effectively abandon the old Page/PageMap and create a new one with a new PageMap. The errors seem to be coming from page serialization after only two or three pages have been created. Can anyone find issue with this approach?

    Read the article

  • Zend_Auth_Adapter_DbTable identity not unique

    - by volf
    For authentication on a website i use Zend_Auth_Adapter_DbTable. Everything work's fine, but Zend Framework only allow unique Identitys in the table. As an identity i use the mail-address from my users. The problem is, that there are more items in the table with this mail-adress. User can delete there account and so i don't delete the whole row, i only change the status to -2 or something else. active user has the status 1. i try to use it like so: $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'user', 'email', 'password', "? AND `status`='1'"); $authAdapter->setIdentity($email); $authAdapter->setCredential($password); But it doesn't work. If i delete the inactive user with the same mail-address, everything work's. Why is that?

    Read the article

  • Best way to create a Unique ID field for an enum

    - by jax
    What is the best way to get a Unique ID from an ENUM that will stay consistent between repeated execution of the program? Currently I am doing this manually by passing an ID to the enum constructor. I don't really want to do this is I can help it. Another option would be to use a static field that gets incremented for each enum value. The problem is that if later I decide to move the enum fields around or delete some this will cause problems with my program as the ID will be saved into user preferences. The ID can be any basic type or a String.

    Read the article

  • how to get unique values set from a repeating values list

    - by Mariselvam
    I need to parse a large log file (flat file), which contains two column of values (column-A , column-B). Values in both columns are repeating. I need to find for each unique value in column-A , I need to find a set of column-B values. Is this can be done using unix shell command or need to write any perl or python script? What are the ways this can be done? Example: xxxA 2 xxxA 1 xxxB 2 XXXC 3 XXXA 3 xxxD 4 output: xxxA - 2,1,3 xxxB - 2 xxxC - 3 xxxD - 4

    Read the article

  • Write a tree class in Java where each level has a unique object type

    - by user479576
    I need to write a tree class in Java where each level has a unique object type. The way it is written below does not take advantage of generics and causes alot of duplicate code. Is there a way to write this with Generics ? public class NodeB { private String nodeValue; //private List<NodeB> childNodes; // constructors // getters/setters } public class NodeA { private String value; private List<NodeB> childNodes; // constructors // getters/setters } public class Tree { private String value; private List<NodeA> childNodes; // constructors // tree methods }

    Read the article

  • construct a unique number for a string in java

    - by praveen
    We have a requirement of reading/writing more than 10 million strings into a file. Also we do not want duplicates in the file. Since the strings would be flushed to a file as soon as they are read we are not maintaining it in memory. We cannot use hashcode because of collisions in the hash code due to which we might miss a string as duplicate. Two other approaches i found in my googling: 1.Use a message digest algorithm like MD5 - but it might be too costly to calculate and store. 2.Use a checksum algorithm. [i am not sure if this produces a unique key for a string- can someone please confirm] Is there any other approach avaiable. Thanks.

    Read the article

  • Create a unique ID by fuzzy matching of names (via agrep using R)

    - by tbrambor
    Using R, I am trying match on people's names in a dataset structured by year and city. Due to some spelling mistakes, exact matching is not possible, so I am trying to use agrep() to fuzzy match names. A sample chunk of the dataset is structured as follows: df <- data.frame(matrix( c("1200013","1200013","1200013","1200013","1200013","1200013","1200013","1200013", "1996","1996","1996","1996","2000","2000","2004","2004","AGUSTINHO FORTUNATO FILHO","ANTONIO PEREIRA NETO","FERNANDO JOSE DA COSTA","PAULO CEZAR FERREIRA DE ARAUJO","PAULO CESAR FERREIRA DE ARAUJO","SEBASTIAO BOCALOM RODRIGUES","JOAO DE ALMEIDA","PAULO CESAR FERREIRA DE ARAUJO"), ncol=3,dimnames=list(seq(1:8),c("citycode","year","candidate")) )) The neat version: citycode year candidate 1 1200013 1996 AGUSTINHO FORTUNATO FILHO 2 1200013 1996 ANTONIO PEREIRA NETO 3 1200013 1996 FERNANDO JOSE DA COSTA 4 1200013 1996 PAULO CEZAR FERREIRA DE ARAUJO 5 1200013 2000 PAULO CESAR FERREIRA DE ARAUJO 6 1200013 2000 SEBASTIAO BOCALOM RODRIGUES 7 1200013 2004 JOAO DE ALMEIDA 8 1200013 2004 PAULO CESAR FERREIRA DE ARAUJO I'd like to check in each city separately, whether there are candidates appearing in several years. E.g. in the example, PAULO CEZAR FERREIRA DE ARAUJO PAULO CESAR FERREIRA DE ARAUJO appears twice (with a spelling mistake). Each candidate across the entire data set should be assigned a unique numeric candidate ID. The dataset is fairly large (5500 cities, approx. 100K entries) so a somewhat efficient coding would be helpful. Any suggestions as to how to implement this?

    Read the article

  • unique log file with log4net

    - by Luca Romagnoli
    hi i'm using log4net for logging my website. Every day a new file is created like "filename.log24-06-2009" this is the code in the web.config file: <log4net> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="App_Data\Missioni.log" /> <appendToFile value="true" /> <rollingStyle value="Composite" /> <!--<datePattern value="yyyy-MM-dd" />--> <maxSizeRollBackups value="5" /> <maximumFileSize value="5MB" /> <layout type="log4net.Layout.PatternLayout"> <header value="[Header]&#xA;" /> <footer value="[Footer]&#xA;" /> <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" /> </layout> </appender> <root> <level value="DEBUG" /> <appender-ref ref="RollingLogFileAppender" /> </root> </log4net> How can i do for use a unique log file? thanks

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >