Certificates Basic Constraint’s Path Length

Taken from RFC 5280, section 4.2.1.9: A pathLenConstraint of zero indicates that no non-self-issued intermediate CA certificates may follow in a valid certification path. Where it appears, the pathLenConstraint field MUST be greater than or equal to zero. Where pathLenConstraint does not appear, no limit is imposed. I.e. a pathLenConstraintof 0 does still allow the … Read more

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

EDIT Note that in iOS 9 this technique will become unnecessary, because a UIStackView will perform distribution automatically. I’ll add another answer explaining how that works. How to Perform Even Distribution Using Autolayout The simplest way to do this in Interface Builder alone (rather than constructing constraints in code) is to use “spacer” views: Position … Read more

Does SQL Server allow constraint violations in a transaction as long as it’s not committed yet?

No, sorry. SQL Server does not allow deferred contraints in a transaction. It was present in SQL Server 6.5, but removed in SQL Server 2000: SET DISABLE_DEF_CNST_CHK ON Each individual statement must be consistent etc, regardless of whether it is in a transaction Some RDBMS do allow this (e.g. Oracle, Postgres, Interbase) Connect There is … Read more

CONSTRAINT to check values from a remotely related table (via join etc.)

CHECK constraints cannot currently reference other tables. The manual: Currently, CHECK expressions cannot contain subqueries nor refer to variables other than columns of the current row. One way is to use a trigger like demonstrated by @Wolph. A clean solution without triggers: add redundant columns and include them in FOREIGN KEY constraints, which are the … Read more

How do you drop a default value or similar constraint in T-SQL?

You can use this code to do it automatically: DECLARE @tableName VARCHAR(MAX) = ‘<MYTABLENAME>’ DECLARE @columnName VARCHAR(MAX) = ‘<MYCOLUMNAME>’ DECLARE @ConstraintName nvarchar(200) SELECT @ConstraintName = Name FROM SYS.DEFAULT_CONSTRAINTS WHERE PARENT_OBJECT_ID = OBJECT_ID(@tableName) AND PARENT_COLUMN_ID = ( SELECT column_id FROM sys.columns WHERE NAME = @columnName AND object_id = OBJECT_ID(@tableName)) IF @ConstraintName IS NOT NULL EXEC(‘ALTER TABLE … Read more