constraints

How to trap on UIViewAlertForUnsatisfiableConstraints?

故事扮演 提交于 2019-11-26 08:52:31
问题 I\'m seeing an error appear in my debugger log: Will attempt to recover by breaking constraint <NSLayoutConstraint:0x191f0920 H:[MPKnockoutButton:0x17a876b0]-(34)-[MPDetailSlider:0x17a8bc50](LTR)> Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. How do I trap on that call? It does not appear anywhere in my code. 回答1: This

NOT NULL constraint over a set of columns

扶醉桌前 提交于 2019-11-26 08:35:35
问题 I have a table in Postgres which currently has a NOT NULL constraint on it\'s email column. This table also has a phone column which is optional. I would like the system to accept some records without email but only if these have phone as NOT NULL . In other words, I need a NOT NULL database constraint such that CREATE or UPDATE queries succeed without any errors if either or both of email or phone fields are present. Extending the above further, is it possible in Postgres, to specify a set

UIStackView Distribution Fill Equally

岁酱吖の 提交于 2019-11-26 08:29:56
问题 So, I have a UIStackView that contains four (4) UIView s. If I remove one (1) of those UIView s, the other three (3) will fill the entire space in the UIStackView . MY QUESTION: How can I add a max height on a UIView so that it won\'t fill the entire space of the UIStackView even though the distribution is filled equally? I read something about adding a constraint but I\'m not able to make it work. I\'m using swift by the way. Thank you. 回答1: As a confirmation, this is the current behavior:

Curiously Recurring Template Pattern and generics constraints (C#)

北城余情 提交于 2019-11-26 08:26:23
问题 I would like to create a method in a base generic class to return a specialized collection of derived objects and perform some operations on them, like in the following example: using System; using System.Collections.Generic; namespace test { class Base<T> { public static List<T> DoSomething() { List<T> objects = new List<T>(); // fill the list somehow... foreach (T t in objects) { if (t.DoSomeTest()) { // error !!! // ... } } return objects; } public virtual bool DoSomeTest() { return true;

What is the purpose of constraint naming

流过昼夜 提交于 2019-11-26 08:09:22
问题 What is the purpose of naming your constraints (unique, primary key, foreign key)? Say I have a table which is using natural keys as a primary key: CREATE TABLE Order ( LoginName VARCHAR(50) NOT NULL, ProductName VARCHAR(50) NOT NULL, NumberOrdered INT NOT NULL, OrderDateTime DATETIME NOT NULL, PRIMARY KEY(LoginName, OrderDateTime) ); What benefits (if any) does naming my PK bring? Eg. Replace: PRIMARY KEY(LoginName, OrderDateTime) With: CONSTRAINT Order_PK PRIMARY KEY(LoginName,

Springs in Auto Layout: Distribute views evenly, with constraints, in Xcode 5

两盒软妹~` 提交于 2019-11-26 08:05:19
I understand the old Struts and Springs method of aligning, sizing and distributing views in Interface Builder. However, I cannot seem to figure out how to evenly distribute views using auto layout with Xcode 5. There was a way to do it using Xcode 4, but that option is gone. I have 7 buttons arranged in a vertical stack. On a 3.5" layout, it looks great. When I preview the screen in the 4" layout, all of the buttons remain tightly packed and there is a large amount of space below the last button. I want them to stay the same height, but I want the space between them to be able flex so they

How to add “on delete cascade” constraints?

瘦欲@ 提交于 2019-11-26 07:59:40
问题 In PostgreSQL 8 is it possible to add ON DELETE CASCADES to the both foreign keys in the following table without dropping the latter? # \\d scores Table \"public.scores\" Column | Type | Modifiers ---------+-----------------------+----------- id | character varying(32) | gid | integer | money | integer | not null quit | boolean | last_ip | inet | Foreign-key constraints: \"scores_gid_fkey\" FOREIGN KEY (gid) REFERENCES games(gid) \"scores_id_fkey\" FOREIGN KEY (id) REFERENCES users(id) Both

MySQL Removing Some Foreign keys

本小妞迷上赌 提交于 2019-11-26 07:55:13
问题 I have a table whose primary key is used in several other tables and has several foreign keys to other tables. CREATE TABLE location ( locationID INT NOT NULL AUTO_INCREMENT PRIMARY KEY ... ) ENGINE = InnoDB; CREATE TABLE assignment ( assignmentID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, locationID INT NOT NULL, FOREIGN KEY locationIDX (locationID) REFERENCES location (locationID) ... ) ENGINE = InnoDB; CREATE TABLE assignmentStuff ( ... assignmentID INT NOT NULL, FOREIGN KEY assignmentIDX

Can a MySQL trigger simulate a CHECK constraint? [duplicate]

断了今生、忘了曾经 提交于 2019-11-26 07:42:28
问题 This question already has an answer here: CHECK constraint in MySQL is not working 8 answers I want to use the CHECK constraint in MySQL, but it is not supported. (Unlike other RDBMS, it will understand but not enforce the CHECKs.) I have seen some workarounds with triggers. But they tend to set a default value to the field in question instead of returning an error. Is it possible to construct a trigger that returns an error if a condition is not met? Ultimately I want a trigger that copies a

Is there a C# generic constraint for “real number” types? [duplicate]

怎甘沉沦 提交于 2019-11-26 07:42:08
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: C# generic constraint for only integers Greets! I\'m attempting to set up a Cartesian coordinate system in C#, but I don\'t want to restrict myself to any one numerical type for my coordinate values. Sometimes they could be integers, and other times they could be rational numbers, depending on context. This screams \"generic class\" to me, but I\'m stumped as to how to constrict the type to both integrals and