constraints

What is the reason for the remaining vertical spacing between an “inner”-view and the contentview of an UITableViewCell using Storyboard?

帅比萌擦擦* 提交于 2019-11-29 06:22:00
I am using storyboard in an iOS/xcode project with the following simplified "hierarchy" (from top to bottom): ViewController (not a TableViewController for some customizing reasons) View TableView (and some other content that does not matter I think) Cell ContentView "AnyView" (specific type seems to be irrelevant, as the following happens for every item I tried) When I set the constraints between AnyView and ContentView to Zero Spacing for Top/Bottom/Leading/Trailing there is still quite some "space" between the ContentView and AnyView. (I have never encountered this when doing similar things

How do I generate a unique, random string for one of my MySql table columns?

大憨熊 提交于 2019-11-29 06:16:29
问题 I’m using MySql 5.5.37. I have a table with the following columns +------------------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------+------------------+------+-----+---------+-------+ | ID | varchar(32) | NO | PRI | NULL | | | CODE | varchar(6) | NO | UNI | NULL | | The code column is unique and my ID column is a GUID. I have a number of rows that I would like to update, subject to some criteria in the above table (e.g.

Can you replace or update a SQL constraint?

对着背影说爱祢 提交于 2019-11-29 05:18:08
问题 I have written the following constraint for a column I've called 'grade': CONSTRAINT gradeRule CHECK grade IN (‘easy’, ‘moderate’, ‘difficult’), Is it possible to later update the gradeRule to have different values? For example, 'moderate' and 'difficult' could be changed to 'medium' and 'hard'. Thanks 回答1: You could drop the existing constraint, and add the new constraint with the NOCHECK option. This would allow you to add the constraint even though data in the table violates the constraint

Deferrable, case-insensitive unique constraint

谁都会走 提交于 2019-11-29 03:35:21
Is it possible in PostgreSQL to create a deferrable unique constraint on a character column, but case-insensitive? Let's assume the following basic table: CREATE TABLE sample_table ( my_column VARCHAR(100) ); If deferrable constraint is not needed, it is as simple as creating unique index with function, e.g.: CREATE UNIQUE INDEX my_unique_index ON sample_table(UPPER(my_column)); Deferred constraint check requires creating the constraint explicitly, e.g.: ALTER TABLE sample_table ADD CONSTRAINT my_unique_constraint UNIQUE(my_column) DEFERRABLE INITIALLY IMMEDIATE; And unfortunately it is not

Unique constraint in XML Schema

和自甴很熟 提交于 2019-11-29 03:27:54
Let's say I have following XML file: <authors> <author>a1</author> <author>a2</author> <lastmodified>2010</lastmodified> </authors> and an XML schema fragment: <xs:element name="authors" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element name="author" maxOccurs="unbounded" type="xs:string"> </xs:element> <xs:element name="lastmodified" type="xs:date" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:unique name="uniqueAuthor"> <xs:selector xpath="."/> <xs:field xpath="author"/> </xs:unique> </xs:element> What I want is to make a constraint that will not allow two identical author

C# Multiple generic constraints

久未见 提交于 2019-11-29 03:02:59
I was wondering if it is possible to add multiple generic constraints? I have an Add method that takes an Object (Either Email, Phone or Address), so i was thinking something like: public void Add<T>(T Obj) where T : Address where T : Email where T : Phone { if (Obj is Address) m_Address.Add(Obj as Address); else if (Obj is Email) m_Email.Add(Obj as Email); else m_Phone.Add(Obj as Phone); } But I keep getting: "A constraint clause has already been specified for type parameter 'T'. All of the constraints for a type parameter must be specified in a single where clause." You can't do that. Why

How to do multiple column UniqueConstraint in hbm?

孤人 提交于 2019-11-29 02:57:14
Working on some legacy hibernate code. How do I do the following with hbm.xml(hibernate mapping file) instead of with annotations? @Table(name="users", uniqueConstraints = { @UniqueConstraint(columnNames={"username", "client"}), @UniqueConstraint(columnNames={"email", "client"}) }) public class User implements Serializable { private static final long serialVersionUID = 1L; @Id private int id; private String username; private String email; private Client client; } Use the properties tag: ... <properties name="uk1" unique="true"> <property name="username" .../> <many-to-one name="client" .../> <

How to give a unique constraint to a combination of columns in Oracle?

霸气de小男生 提交于 2019-11-29 02:53:12
I have a Table with 4 Columns Each Column will be A,B,C,D Column A is the Primary key. Column B has unique name constraint. Now I want to remove the unique constraint for column B and give a unique constraint by combining the columns B, C and D. So the table will allow only one row with a particular value in columns B,C and D. How can I give this type of a constraint? I tried giving the composite unique key like : ALTER TABLE TABLENAME ADD CONSTRAINT CONSTRAINT_NAME UNIQUE (COLUMN_B, COLUMN_C, COLUMN_D) But it is checking whether any one of the constraint is present rather than checking for

Rails 3 - Whitelisting list of IPs via routes

*爱你&永不变心* 提交于 2019-11-29 02:49:49
问题 This is a two part question. I'm needing to restrict a rails site that I'm throwing on development server to only a few IP addresses, so the public can't access it. (Basic HTTP auth doesn't 'entirely' work as the auth breaks a Flash uploader in the project.) Based on what I've Googled, this is what I've come up with in my routes file... class WhitelistConstraint def initialize @ips = '127.0.0.1' end def matches?(request) @ips.include?(request.remote_ip) end end MyProject::Application.routes

Can there be constraints with the same name in a DB?

浪子不回头ぞ 提交于 2019-11-29 02:47:57
This is a follow-on question from the one I asked here . Can constraints in a DB have the same name? Say I have: CREATE TABLE Employer ( EmployerCode VARCHAR(20) PRIMARY KEY, Address VARCHAR(100) NULL ) CREATE TABLE Employee ( EmployeeID INT PRIMARY KEY, EmployerCode VARCHAR(20) NOT NULL, CONSTRAINT employer_code_fk FOREIGN KEY (EmployerCode) REFERENCES Employer ) CREATE TABLE BankAccount ( BankAccountID INT PRIMARY KEY, EmployerCode VARCHAR(20) NOT NULL, Amount MONEY NOT NULL, CONSTRAINT employer_code_fk FOREIGN KEY (EmployerCode) REFERENCES Employer ) Is this allowable? Does it depend on the