Search Results

Search found 4640 results on 186 pages for 'unique'.

Page 24/186 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • How Can I Generate Random Unqiue Numbers in C#

    - by peace
    public int GenPurchaseOrderNum() { Random random = new Random(); _uniqueNum = random.Next(13287, 21439); return UniqueNum; } I removed unique constraint from the PONumber column in the db because an employee should only generate P.O. # when the deal is set. Otherwise, P.O. # would have 0. P.O. Number used to have unique constraint, this forces employee to generate P.O. in all cases so the db doesn't throw unique constraint error. Since i removed the unique constraint, any quote doesn't have P.O. will carry 0 value. Otherwise, a unique value is generated for P.O. #. However, i don't have a unique constraint in db which makes it hard for me to know whether the application generated P.O. # is unique or not. What should i do? I hope my question is clear enough

    Read the article

  • Database indexes - what should they be

    - by WebweaverD
    Most of my database tables have a clear unique index through which lookups are done 90% of the time but I am a bit unsure on this one - I have a table which keeps track of user rating totals for items in my database, I now want to add another table, to track individual ratings with an ip address column to make sure no one can rate something twice. Since I can see this becoming a big, high use table it is important to optimize it correctly. (MYSQL table) This table will have the following fields: rating_id(always - unique), item_id (always - not unique), user_id (optional - not unique), ip_address (always - not unique), rating_value(always - not unique), has_review(bool) Now I envisions 90% the queries going something like this: When a user rates something - select where item_id = x and ip_address = y, (if rows = 0) insert rating When in user account pages - select where ip_address = x or username = y Now none of the fields searched on are unique, can I still use them as indexes (for example item _id and ip_address), can I have two indexes and will this still improve performance over a non indexed table?

    Read the article

  • How to generate a unique hash for a URL ?

    - by Jacques René Mesrine
    Given these two images from twitter. http://a3.twimg.com/profile_images/130500759/lowres_profilepic.jpg http://a1.twimg.com/profile_images/58079916/lowres_profilepic.jpg I want to download them to local filesystem & store them in a single directory. How shall I overcome name conflicts ? In the example above, I cannot store them as *lowres_profilepic.jpg*. My design idea is treat the URLs as opaque strings except for the last segment. What algorithms (implemented as f) can I use to hash the prefixes into unique strings. f( "http://a3.twimg.com/profile_images/130500759/" ) = 6tgjsdjfjdhgf f( "http://a1.twimg.com/profile_images/58079916/" ) = iuhd87ysdfhdk That way, I can save the files as:- 6tgjsdjfjdhgf_lowres_profilepic.jpg iuhd87ysdfhdk_lowres_profilepic.jpg I don't want a cryptographic algorithm as it this needs to be a performant operation.

    Read the article

  • How to use map/reduce to handle more than 10000 unique keys for grouping in MongoDB?

    - by Magnus Johansson
    I am using MongoDB v1.4 and the mongodb-csharp driver and I try to group on a data store that has more than 10000 keys, so I get this error: assertion: group() can't handle more than 10000 unique keys using c# code like this: Document query = new Document().Append("group", new Document() .Append("key", new Document().Append("myfieldname", true)) .Append("$reduce", new CodeWScope( "function(obj,prev) { prev.count++; }")) .Append("initial", new Document().Append("count", 0)) .Append("ns", "myitems")); I read that I should use map/reduce, but I can't figure out how. Can somebody please shed some light on how to use map/reduce? Or is there any other way to get around this limitation? Thanks.

    Read the article

  • Is it possible to bundle a unique file for each copy of iPhone app downloaded from App Store?

    - by futureelite7
    Hi, I would like to verify the identity of each instance of the iPhone application that a user might use to connect to my service. To that end, I would like each instance of the iPhone app downloaded to include a certificate that I generate, or even some sort of UUID that I have generated. Does the App Store support the inclusion of unique files in an app bundle? Or, must such identifiers be downloaded only after the app is installed? If that is the case, is there a mechanism to ensure that the app downloaded is trusted (from me), instead of from an impersonator?

    Read the article

  • Java generics: What is the compiler's issue here? ("no unique maximal instance")

    - by Epaga
    I have the following methods: public <T> T fromJson( Reader jsonData, Class<T> clazz ) { return fromJson( jsonData, (Type)clazz ); } public <T> T fromJson( Reader jsonData, Type clazz ) { ... } The compiler is saying about the first method: type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,java.lang.Object return fromJson( jsonData, (Type)clazz ); ^ What is the problem?

    Read the article

  • Rails, How can I combine multiple model attributes to create a unique permalink using permalink_fu?

    - by Ranknoodle
    Can Permalink_fu combine 2 or more model attributes to create a unique permalink? Let's say I have a Business Model, this model contains :name, :address, :phone, :city, :state, :country etc. attributes. Right now I have permalink set up in this model only for :name has_permalink :name So I would get "/biz/name". However I would like to combine the Business name, city, and a incremental number if there are more than 1 location in the city for that business. For example I would like to use: "/biz/joes-coffee-shack-chicago" for the permalink or if a multple location business "/biz/starbucks-chicago-92" Is this possible with the current permalink_fu plugin or some fork of permalink_fu? Or will this require some modification to the permalink_fu plugin?

    Read the article

  • Easiest way of checking if a string consists of unique characters?

    - by serg555
    I need to check in Java if a word consists of unique letters (case insensitive). As straight solution is boring, I came up with: For every char in a string check if indexOf(char) == lastIndexOf(char). Add all chars to HashSet and check if set size == string length. Convert a string to a char array, sort it alphabetically, loop through array elements and check if c[i] == c[i+1]. Currently I like #2 the most, seems like the easiest way. Any other interesting solutions?

    Read the article

  • How do i create a view that can filter unique titles from a checkbox?

    - by buws
    I'm currently creating a view in Drupal that contains a number of fields. What I want to do is to create an exposed filter that is able to filter duplicate titles. The filter would be a checkbox. This is an example of the list NAME TIME RACE DISTANCE John Doe 2.07.54 Boston Marathon 42km Jane Boss 2.15.21 Boston Marathon 42km John Doe 2.02.22 Boston Marathon 42km Jane Boss 2.15.44 Boston Marathon 42km What I want to have is an exposed filter that only shows one unique NAME and sorts it by its best time. The resulting list would look as follows: NAME TIME RACE DISTANCE Jane Boss 2.15.21 Boston Marathon 42km John Doe 2.02.22 Boston Marathon 42km Any help is appreciated!

    Read the article

  • is a mysql temporary table unique for each user accessing the script that creates it...?

    - by SpikETidE
    Hi everyone... While looking for a way to temporarily save the search results when a user searches for a hotel free between particular dates i came across temporary tables. But certain questions are not answered even in mysql manual.... like... Will the temporary table be unique for each user that executes the script...? Or will it be overwritten when two different users run the script at the same time...? When will the table be destroyed..? When the user closes the browser window or just navigates away from the page in which the script runs...? Thanks for your clarifications...

    Read the article

  • How to get unique URL identifier after inserting item in Google Base with Zend Gdata API?

    - by msumme
    I need to get the unique URL identifier for the product that is created after inserting an item into Google Base using the Zend_Gdata_Gbase library. I can't seem to do this. I am finding a startling lack of documentation online about manipulating the objects used in these applications. The url that I add to the object does not work to retrieve the base item later, which is why I need to get the one that google generates upon submission. I am writing a program that will need to be able to delete content at a later date, and thus will need to store that information in order to keep the website synced with the Google Base feed. Thanks in advance for any help.

    Read the article

  • Netlogo behaviorspace, How to export each experiment's plot in a separate directory with a unique name? (Answer is by using pathdir extension)

    - by Marzy
    I have a save-plots function which I call it in my final command of behavior space to export selected plots, I could create unique names for plots so they don't replace each other, for example my output file name for one of the plots is like this: DeathRates, PS true, HCHA false 100,true.csv Let FileNameDeathRates ( word "D: /Results/" "DeathRates, " "PS "PS? ", HCHA " HCHA? MPS "," CV? ".csv" ) So far is good, but I want is to have a directory with name of the experiment and export all plots of that experiment in that directory for example: Let DirName( word "D:/Results/" "PS "PS? ", HCHA " HCHA? MPS "," CV? ) Netlogo already exports plots with proper name and I just want the directory name to be different , and of course prior to the experiment the directory does not exist so the directory should be created first , I could not find a command to create a directory in netlogo without pathdir extension. Any idea on how can I do this? Thanks in advance ;)

    Read the article

  • [PHP] md5(uniqid) makes sense for random unique tokens?

    - by Exception e
    I want to create a token generator that generates tokens that cannot be guessed by the user and that are still unique (to be used for password resets and confirmation codes). I often see this code; does it make sense? md5(uniqid(rand(), true)); According to a comment uniqid($prefix, $moreEntopy = true) yields first 8 hex chars = Unixtime, last 5 hex chars = microseconds. I don't know how the $prefix-parameter is handled.. So if you don't set the $moreEntopy flag to true, it gives a predictable outcome. QUESTION: But if we use uniqid with $moreEntopy, what does hashing it with md5 buy us? Is it better than: md5(mt_rand())

    Read the article

  • Where to find a unique session ID at design time in .Net WinForms.

    - by Jules
    I've created a custom clipboard because it's not possible to make my whole class map serializable - which is a requirement for the windows clipboard. However, I need to distinguish between users who are using my clipboard through a unique id. Basically, I want to be able identify a person who is sat at one PC with one or more copies of visual studio (or similar) open. How do I do that? ps: This is at design-time. pps: It's not critical that it should work between copies of visual studio. One copy would be fine, or even one design surface.

    Read the article

  • Python - Flatten a dict of lists into unique values?

    - by Jonathan Vanasco
    I have a dict of lists in python: content = {88962: [80, 130], 87484: [64], 53662: [58,80]} I want to turn it into a list of the unique values [58,64,80,130] I wrote a manual solution, but it's a manual solution. I know there are more concise and more elegant way to do this with list comprehensions, map/reduce , itertools , etc. anyone have a clue ? content = {88962: [80, 130], 87484: [64], 53662: [58,80]} result = set({}) for k in content.keys() : for i in content[k]: result.add(i) # and list/sort/print just to compare the output r2 = list( result ) r2.sort() print r2

    Read the article

  • Prevent duplicate rows with all non-unique columns (only with MySQL)?

    - by letseatfood
    Ho do I prevent a duplicate row from being created in a table with two columns, neither of which are unique? And can this be done using MySQL only, or does it require checks with my PHP script? Here is the CREATE query for the table in question (two other tables exist, users and roles): CREATE TABLE users_roles ( user_id INT(100) NOT NULL, role_id INT(100) NOT NULL, FOREIGN KEY (user_id) REFERENCES users(user_id), FOREIGN KEY (role_id) REFERENCES roles(role_id) ) ENGINE = INNODB; I would like the following query, if executed more than once, to throw an error: INSERT INTO users_roles (user_id, role_id) VALUES (1, 2); Please do not recommend bitmasks as an answer. Thanks!

    Read the article

  • rails 3, active record: any way to tell how many unique values match a "x LIKE ?" query

    - by jpwynn
    I have a query to find all the phone numbers that match a partial expression such as "ends with 234" @matchingphones = Calls.find :all, :conditions => [ "(thephonenumber LIKE ?)", "%234"] The same phone number might be in the database several times, and so might be returned multiple times by this query if it matches. What I need is to know is UNIQUE phone numbers the query returns. For example if the database contains 000-111-1234 * 000-111-3333 000-111-2234 * 000-111-1234 * 000-111-4444 the existing query will return the 3 records marked with * (eg returns one phone number -1234 twice since it's in the database twice) what I need is a query that returns just once instance of each match, in this case 000-111-1234 * 000-111-2234 *

    Read the article

  • Was: Not unique table :: Now: #1054 - Unknown column - 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!? UPDATE: Thanks for the help on the previous query, I'm now up to this: SELECT calendar_events.* , calendar_users.doctorOrNurse, calendar_users.passportName, calendar_jobs.destination FROM `calendar_events` , `calendar_users` RIGHT JOIN calendar_jobs ON calendar_events.jobID = calendar_jobs.jobID WHERE `start` >= 0 AND calendar_users.userID = calendar_events.userID; But am now getting an error saying: #1054 - Unknown column 'calendar_events.jobID' in 'on clause' What is it this time!? Thanks again!

    Read the article

  • Should the include guards be unique even between namespaces?

    - by Arun
    I am using same class name in two namespaces, say A and B. Should the include guards be unique while declaring the classes with different namespaces too? I mean can't there be two files names AFile.h (in different directories) with same include guards and declaring different namespaces? File 1: #ifndef AFILE_H #define AFILE_H namespace A { class CAFile {... }; }; #endif File 2: #ifndef AFILE_H #define AFILE_H namespace B { class CAFile {... }; }; #endif

    Read the article

  • SQL Server 2008: The columns in table do not match an existing primary key or unique constraint

    - by 109221793
    Hi guys, I need to make some changes to a SQL Server 2008 database. This requires the creation of a new table, and inserting a foreign key in the new table that references the Primary key of an already existing table. So I want to set up a relationship between my new tblTwo, which references the primary key of tblOne. However when I tried to do this (through SQL Server Management Studio) I got the following error: The columns in table 'tblOne' do not match an existing primary key or UNIQUE constraint I'm not really sure what this means, and I was wondering if there was any way around it?

    Read the article

  • Upon USB insert, record unique identifer sting, format drive to FAT32 and copy a file. Bash or Pytho

    - by samsixty
    Hello, This is what I want to do, insert USB flash drive. mount it. record uniquie identifer string to a file. format the drive to FAT32. copy a text file to the drive. unmount it. remove the drive. 30 times The situation is this, I have bought 30 usb drives. I need to format each one to ensure they are clean, I need the unique string from each device. I need to put the same txt file on each one. I am not great at writing scripts but can read and follow bash and python. Any pointers would be appreciated.

    Read the article

  • devise register confirmation

    - by mattherick
    hello! i have a user and an admin role in my project. i created my authentification with devise, really nice and goot tool for handling the authentification. in my admin role i don´t have any confirmation or something like that. it is really simple and doesn´t make problems. but in my user model i have following things: model: devise :database_authenticatable, :confirmable, :recoverable, :rememberable, :trackable, :validatable, :timeoutable, :registerable # Setup accessible (or protected) attributes for your model attr_accessible :email, :username, :prename, :surname, :phone, :street, :number, :location, :password, :password_confirmation and few validations, but they aren´t relevant this time. my migration looks like following one: class DeviseCreateUsers < ActiveRecord::Migration def self.up create_table(:users) do |t| t.database_authenticatable :null = false t.confirmable t.recoverable t.rememberable t.trackable t.timeoutable t.validateable t.string :username t.string :prename t.string :surname t.string :phone t.string :street t.integer :number t.string :location t.timestamps end add_index :users, :email, :unique => true add_index :users, :confirmation_token, :unique => true add_index :users, :reset_password_token, :unique => true add_index :users, :username, :unique => true add_index :users, :prename, :unique => false add_index :users, :surname, :unique => false add_index :users, :phone, :unique => false add_index :users, :street, :unique => false add_index :users, :number, :unique => false add_index :users, :location, :unique => false end def self.down drop_table :users end end into my route.rb I added following statements: map.devise_for :admins map.devise_for :users, :path_names = { :sign_up = "register", :sign_in = "login" } map.root :controller = "main" and now my problem.. if I register a new user, I fill in all my data in the register form and submit it. After that I get redirected to the controller main with the flash-notice "You have signed up successfully." And I am logged in. But I don´t want to be logged in, because I don´t have confirmed my new user account yet. If I open the console I see the last things in the logs and there I see the confirmation-mail and the text and all stuff, but I am already logged in... I can´t explain why, ... does somebody of you have an idea? If I copy out the confirmation-token from the logs and confirm my account, I can log in, but if I don´t confirm, I also can log in..

    Read the article

  • SQL Server 2008 Unique Problem for bring DB Online...

    - by Nai
    This is my error I am facing TITLE: Microsoft.SqlServer.Smo Set offline failed for Database 'Go3D_Retailer ------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) Unable to open the physical file "E:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\ftrow_Go3D_catalog.ndf". Operating system error 2: "2(failed to retrieve text for this error. Reason: 15105)". Database 'Go3D_Retailer' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details. ALTER DATABASE statement failed. (Microsoft SQL Server, Error: 5120) Background to this error I've been trying to move my destination logshipping database to another physical server for analysis purposes. Because I do not have active directory set up, I had to hack my process by using the same username/password for both the source and destination servers to get the process to work. Following that, I used this guy's solution to move the destination database to another server. However, this error occurs when I try to bring the database back online. I don't have an E drive on my server and I have no idea why it's trying to open a file from E drive. I have over a 100gb left on my hard disk so it's definitely not a space issue. This sounds like a bug... Any ideas? I'm running SQL Server 2008 Enterprise edition on Windows Server 2008 R2 64bit

    Read the article

  • Triple-monitor set-up (2 unique, 1 cloned): Can a VGA splitter be used on one output of a dual-head

    - by stakx
    Background: I'm currently researching hardware components for some kind of information terminal we're building. This application of ours makes use of three output screens: (1) A touch screen where all user input is made; (2) A regular LCD monitor where the requested information is being displayed; and (3) A projector which displays exactly the same signal as screen (2) does. (All screens will run at the same resolution of 1024x768 btw.) Now I figured that using a dual-head video card would be sufficient, let's say a Matrox P690 low-profile PCI card. This would involve having a Y cable connected to the graphics card itself, then two DVI-to-VGA adapters at each end of the Y cable, and then having a VGA splitter on one of the VGA outputs. The following shows the setup in question: 0--1---------2-> VGA (DSUB-15) \ \ ----2-3---------> VGA (DSUB-15) \ \ -----------------> VGA (DSUB-15) 0: graphics card (LFH60 jack) 1: LFH60 to DVI-I dual monitor Y cable 2: DVI-to-VGA adapters 3: VGA splitter cable Question(s): Will this work? I'm particularly concerned about the following points: Can a low-profile PCI video card output a signal which is strong enough for three monitors (even if it's a dual-head card)? Does the combination of so many adapters and splitter cables work? (The LFH-to-DVI cable comes with the video card) Will the VGA splitter cable degrade the signal on the output screen & projector significantly? (If so, would a USB-powered splitter cable remedy this problem?) I can't possibly expect anyone to answer all those questions, but any input is appreciated.

    Read the article

  • How to configure Windows Server 2008 DHCP to supply unique subnet to a remote site?

    - by caleban
    The Main site hosts the only Windows Server. Windows Server 2008 R2 Domain Controller running AD, DNS, DHCP, Exchange 2007. Remote site has no Windows server. Main site subnet is 192.168.1.0/24 Remote site subnet is 192.168.2.0/24 The Windows Server at Main site is supplying 192.168.1.0/24 via DHCP to hosts at the local site where it resides. Is it possible to configure that Windows Server to supply 192.168.2.0/24 to hosts at the Remote site and if so how? We could use the Cisco router at the Remote site to supply DHCP but if possible we'd like to use the Windows Server at the Main site to supply DHCP.

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >