FAQ Database Discussion Community


How do I interpret PostgreSQL error messages from within Go?

sql,postgresql,go,constraints
How can I parse SQL constraint errors, in particular resulting from constraints such as UNIQUE, FOREIGN KEY, NOT NULL, ON DELETE RESTRICT within Go? e.g. Insert a new user that may have the same email which is defined as a UNIQUE field in the database. Parse constraint error in Go,...

Why can't I add pin constraints in Xcode?

ios,xcode,constraints
I'm reading the book "Learn iOS 8 App Development". I'm following his steps and here is my problem: He asked to deselect the "Constrain to margins". Down this little square he has 4 controls, and I have three (The align, square, and triangle). Why can't I add 4 constraints as...

C++ Templates with multiple constraints

c++,templates,generics,constraints
In C# I am used to specify multiple constraints in a generic method or type as shown right here: How do I specify multiple generic type constraints on a single method? Today I started with C++ for the first time and I am unable to find anything useful when googling...

mysql error “cannot add foreign key constraint”

mysql,foreign-keys,constraints,mysql-error-1064
Here is the mysql query: ALTER TABLE wp_juices_members ADD CONSTRAINT fk_juiceid FOREIGN KEY(juice_id) REFERENCES wp_juices(id) All the tables, fields exist with the correct names as specified in the above query, and i still get this error: "cannot add foreign key constraint" Here are the DESC for the two tables: wp_juices_members:...

How can I change a specific constraints on the last UITableViewCell?

ios,uitableview,swift,autolayout,constraints
I need to change the last UITAbleViewCell Bottom Constraints constant on runtime. I've added an identifier on IB, and I've added the following extension to my UIView. func getConstraintById(id:String) -> NSLayoutConstraint?{ let constraints = self.constraints() for c in constraints{ if((c as! NSLayoutConstraint).identifier == id){ return c as? NSLayoutConstraint } }...

Oracle: unique index with check on a specific value

sql,oracle,constraints
I have a simplified table with two columns (group, key). A key must be unique within a group, but it also have to be unique compared to a 'reference' group. So I created a unique index (group, key) for the first constraint, but is it possible to create a unique...

Weakening vinyl's RecAll constraint through entailment

haskell,constraints,ghc,vinyl
In the vinyl library, there is a RecAll type family, which let's us ask that a partially applied constraint is true for every type in a type level list. For example, we can write this: myShowFunc :: RecAll f rs Show => Rec f rs -> String And that's all...

ScrollView -> View (Label + Label + TableView) and autolayout

ios,objective-c,uiscrollview,autolayout,constraints
Inside the ScrollView are two Labels (multilateral), and below it the TableView (in which the number of rows may be different). The height of both Label and TableView is not set. All outlets set constraints on the indents from each other above and below, including a View of the container....

DROP a not nullable column

sql,oracle,constraints
I use ORACLE and i know that you cannot DROP a column which has a not null constraint. You have to change it first to be nullable and then you can drop it. If the collumn is not a primary key or foreign key , why cant i just drop...

Xcode 6 and Constraints - Greyed out equal widths option

ios,iphone,xcode,button,constraints
I am trying to use the constraints on xcode 6 with side-by-side objects but when I use the "add missing constraints" option, all of the elements resize properly except the side-by-side buttons where they stay the same size but one gets pushed out of the view. Image of View And...

change constraint inside tableViewCell

ios,objective-c,uitableview,constraints,tableviewcell
I need to change a width constraint of a UIView inside a UITableViewCell. Usually I would create an IBOutlet to the constraint but how do I go about that as it's a dynamic prototypes tableView ? Please suggest Thanks!...

Symfony Custom Validation Constraint pass parameter

validation,symfony2,constraints,unique-constraint
I have a custom validation constraint to check if an entered book name in a form is unique. I cannot use @Unique, because that would also validate the current value of the book and will always throw a validation error, even if I didn't want to change the book name....

Symfony2 form builder without class check if multiple fields are empty

validation,symfony2,constraints,formbuilder
I am using form builder without class and have two fields with each having constraints : $form = $this->createFormBuilder() ->add('name', 'text', array( 'required'=>false, 'constraints'=> new Length(array('min'=>3) )) ->add('dob', 'date', array( 'required'=>false, 'constraints'=> new Date() )) ->getForm() ->handleRequest($request); This works great but I want to check if both fields are emtpy,...

Having constraints into constraints

c#,constraints
I have this scenario: public abstract class UblParser<TDto, TUbl> where TUbl : UblBaseDocumentType where TDto: DtoB { public abstract TUbl ParseFrom(TDto dto); public abstract TDto ParseTo(TUbl document); } How do I declare a class using a constraint inside another constraint like this? public class UblConverter<TParser> where TParser : UblParser<TDto, TUbl>...

UITextField placeholder alignment scrolling trouble

ios,objective-c,uitableview,uitextfield,constraints
I'm working on a registration form actually and i'm facing some kind of trouble. I'm using an UITextField into my cell and I wrote a string into the placeholder. Everything runs fine until I try to center the UITextField.textAlignment. It, somehow, manages not to center it. I checked it up...

Moving a textfield with auto layout constraints when the keyboard appears

ios,swift,autolayout,constraints
I have a search bar text field and a table view (for google auto complete) that I would like to translate up when the keyboard comes into view. I am successfully doing this, however, I am getting warnings/errors about my constraints. I am using auto layout via storyboard on this...

iOS addView: Adds view from story board without constraints

ios,objective-c,constraints,addsubview
I have a View in the Storyboard, which shows an error message. I remove this at load using [self.ErrorView removeFromSuperView]; Later on in the code, I then want to show the view, using [self.MainView addSubview:self.ErrorView]; this does show the view, but the view is only sized by the content within...

UIViewController: adjust contraints of xib

ios,swift,constraints
In my project I defined a xib and a ViewController that will contain the xib. class FeedDetailViewController: UIViewController, FeedDetailDelegate { var feedDetail: FeedDetail! override func viewDidLoad() { super.viewDidLoad() feedDetail = (NSBundle.mainBundle().loadNibNamed("FeedDetail", owner: self, options: nil)[0] as? UIView)! as! FeedDetail feedDetail.delegate = self; self.view.addSubview(feedDetail) self.adjustContraints() } func adjustContraints() { feedDetail.sizeThatFits(self.view.frame.size) var...

ERROR 1005 (HY000): Can't create table 'test_schema.#sql-44c_2a' (errno: 150)

mysql,database,foreign-keys,constraints
So, I've recreated the issue I'm having with more readable code. I run this sql file in my mysql prompt: CREATE SCHEMA IF NOT EXISTS test_schema DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ; USE test_schema ; -- ----------------------------------------------------- -- Table test_schema.table_one -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS table_one (...

Find minimum of nonlinear system of equations with nonlinear equality and inequality constraints in MATLAB

matlab,constraints,equality,nonlinear-optimization,inequality
I need to solve this problem better described at the title. The idea is that I have two nonlinear equations in four variables, together with two nonlinear inequality constraints. I have discovered that the function fmincon is probably the best approach, as you can set everything I require in this...

Custom UITableViewCell Constraints not working

ios,xcode,uitableview,constraints,ios8.3
I have a nib that I load for a custom UITableViewCell that I added the missing constraints to in the bottom far right menu item that looks like this: When I don't use auto constrains, it looks like this: But when I click "Add Missing Constraints", it ends up like...

Why am I getting an 'Invalid Parameters' error when the generic type constraints are the same?

c#,generics,constraints
In the code below, I am getting an error at 'action(u)', "Invalid Parameters", even though the type constraints on the generics are the same. Why is that and what can I do? public class Test<T> : IDoStuff where T : SampleA { Action<T> action; void DoStuff<U>(U u) where U :...

How to allow oracle table column to have multiple rows in column but sames values only. Using Constraints

sql,oracle,constraints
How to allow oracle table column to have multiple rows in column but same value only. Create Table test ( col int); case - I insert into test values (1); --should work insert into test values (1); --should work insert into test values (2); --Should throw error !!!! case -...

auto layout modify multiplier of constriaint programmatically

ios,objective-c,autolayout,constraints
How can I modify the multiplier of a constraint programmatically? I have set the following: [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_button attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeWidth multiplier:0.5 constant:0.0]]; and I need to modify it to this: [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_button attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeWidth...

Constraints set but views not placed correctly

ios,objective-c,constraints
I'm having an issue with constraints. I set constraints on my UI elements that you can see below. For each I set x, y, and height/width for some. When I click "Update the Frames", everything is ok and the views are placed at the right place. But on the Preview...

Bottom space constraint proportional to height of view

ios,objective-c,uiview,autolayout,constraints
I have a view at the bottom of my view controller which has the following constraints: align centre horizontally fixed aspect ratio (1:1) proportional width to width of view controller bottom space of -50 How do I make the bottom space constraint proportional to the height of the view using...

How to apply 'IN' constraint to the fields of django models

python,django,django-models,constraints
I want that one of the fields of the model can take only some specific values say a and b. This can be achieved normally in sql by adding the 'IN' constraint. How can I achieve the same using django model class fields. eg. Some field say fruits can have...

How to set constrains in Xcode 6 on login viewcontroller

swift,storyboard,xcode6,autolayout,constraints
Hi Im creating an app where the first screen that shows I's a log in screen. I'm trying to figure out how to make the logo and title look good on all the iPhone's screen sizes. Right now I'm using "Center horizontally in container" and "Top space to top layout...

CPLEX/OPL model - constraints with subset index

constraints,scheduling,subset,cplex,opl
I am currently programming a CPLEX/OPL model using IBM ILOG CPLEX Optimization Studio. I have a problem with using sums or indexes which contain a subset and depend on another parameter/variable, e.g. check the following constraints: NB 2,3,4,8). Can anyone help me with incorporating these constraints properly? Please find the...

ios autolyouts: labels centering

ios,objective-c,autolayout,constraints
In my app, I have two UILabels that can contain different length text inside, depends on selected localization. I want to center both labels to the superview's horizontal center. For example: | "xxxxx""xxxx" | for english it centered to view X. in another case it could be | "xxxxxxxxxxxx""xxxx" |...

Re-enable “Update Constraint” option

ios,autolayout,constraints,uistoryboard
I'm working on an app which having AutoLayout enabled. I'm new in it and trying to set out the views based on my experiments. Before when I have made a change in frame of any UI control, in storyboard I could see a yellow pointer (next to my view controller)...

Contraints greyed-out in Xcode

ios,objective-c,xcode,autolayout,constraints
I am trying to debug+understand autolayout constraints and I notice that when debugging the view with xcode (using the cool layer thing) I noticed that on one element in the view the constraints look like this and the view is indeed ignoring these constraints. All constraints have the same priority...

Referential integrity across multiple tables

sql,database,postgresql,database-design,constraints
What would be the easiest way to ensure any data entering a table matches data from a corresponding relation? In my example, I've got a a sports club. Players can play sports without a team. I want to enforce that the player plays the sport BEFORE joining a team. Here...

Laravel 5: SQLSTATE[23000]: Integrity constraint violation

php,mysql,validation,constraints,laravel-5
I have a form with the following fields: name, fullname, description, email, password, state, city (filled through Ajax when the state is chosen) and photo (a image upload). Here's my schema: public function up() { Schema::create('states', function(Blueprint $table) { $table->increments('id'); $table->string('acronym'); $table->string('name'); }); Schema::create('cities', function(Blueprint $table) { $table->increments('id'); $table->string('name'); $table->integer('state_id')->unsigned();...

Check constraint whether the date from one table (column) fits to another date from another table (column)

sql,oracle,constraints
Lets assume I have two tables as the following ones. create table contract( c_ID number(1) primary key, c_name varchar2(50) not null, start date not null, end date not null, d_ID number(1) null, constraint fk_discount_ID foreign key(d_ID) references discount(d_ID) ); create table discount( d_ID number(1) primary key not null, d_amount decimal(4,2)...

iOS Dynamic Autolayout with VFL Constraints

ios,iphone,xcode,xamarin,constraints
I experience an unexpected behavior when attempting to assign constraints dynamically in a single view controller based on device orientation. Desired behavior: As shown in the code below I am using VFL to attach a view to the right, top and left edges of the superview with a height of...

How can I use autolayout to get a view's height to be the same as the height of the largest label?

swift,autolayout,constraints
I have two labels next to each other in a UIView, and I'd like the UIView to adopt the height of the highest UILabel. If I pin them both to the top and bottom, I've just overconstrained the whole thing. And priorities don't seem to work for me either, since...

Cplex constraint for 2 dimensional binary decision variables

math,model,binary,constraints,cplex
I need to solve a problem where my decision variables are binary and are a 2 dimensional matrix, in Cplex y[p][q], p and q both have the same range papers=1..78. I need to incorporate a constraint that restricts the sum of both a row and column to be smaller or...

MySQL check before soft delete

mysql,foreign-keys,constraints,soft-delete
I'm using MySQL. I have a record on A table with a soft delete column: active with a value of 0. This row is linked to 11 tables. All have the same active column. I need to be sure that the record on A is deleted only if all the...

ORACLE - CHECK constraint enforcing conditional uniqueness

database,oracle,constraints,unique-constraint
I have a table - PROGRAM - which includes the columns PROGRAM_NAME and PROGRAM_NUMBER. PROGRAM_NUMBER is already unique. CREATE UNIQUE INDEX UNIQUE_PROG_NUMBER on PROGRAM(upper(PROGRAM_NUMBER)); There is also a constraint to ensure that either PROGRAM_NAME or PROGRAM_NUMBER is always populated. ALTER TABLE PROGRAM ADD CONSTRAINT NAME_OR_NUMBER_NOT_NULL CHECK (PROGRAM_NAME IS NOT NULL...

How to drop a composite MySQL constraint and/or one column used in the constraint? (Allowing for limitations described.)

mysql,constraints,mysql-5.0
In a MySQL 5.0.45 database, I want to remove a 2-column UNIQUE constraint because it includes a column I am going to drop. One of the columns included in the two-column UNIQUE constraint is also FK-constrained in the same table - however I think that that is irrelevant to what...

T-SQL: Add NOT NULL constraint to multiple existing columns at once

tsql,constraints
I have a table like below: CREATE TABLE dbo.MyTable ( Text int, column2 varchar(50), column3 varchar(50) ) and now I would like using T-SQL to apply a NOT NULL constraints to the three columns at once (Note that I have a column called Text that matches with a reserved type...

Need assistance regarding autolayouts

ios,objective-c,xcode,autolayout,constraints
I have a UIView of size 196x269 yellow color and inside I have another UIView green color and using auto layout it is positioned like this but I am getting this error But if I set the layout of the yellow view, every thing is fine no errors. My question...

UITextField not responding to touch in iOS8?

ios,objective-c,iphone,xcode,constraints
So I have multiple UITextFields in my storyboard, but there is one isolated field that will not respond to any touch (neither in the simulator nor on the device) for all iOS versions, besides on the very right side of the field? This may have something to do with the...

Complex AutoLayout for Cell with dynamic size

ios,swift,autolayout,constraints,nsautolayout
I have a cell that contains a container with 10 subviews (two of them are simply bounds and the others are labels). The scheme looks like this. Dynamic labels may contain huge text so the cells should conform the appropriate size to fit the content. The question is how to...

Unique first column in multi-column index

mysql,indexing,constraints
I have multi-column index for 2 columns. Can I make first column unique without making separate index for that? If I understand correctly mysql can use only first column in this index for lookups, so can it use it to detect uniqueness?...

Size-classes and constraints with buttons

ios,objective-c,autolayout,constraints,size-classes
I hope someone can help here as I've been reading and watching a lot about size classes as I've just started work on first app using size classes.I thought I'd got the idea but having a slight issue. I've got a view with 10 buttons in it. I want the...

Changing constraint after adding it causes constraint error (swift)

ios,swift,constraints
I'm working on adding error messages to my login screen. While the code runs fine, and does what I want it to do. It causes a constraint error on execution. Here are the effected constraints: self.view.addConstraints( NSLayoutConstraint.constraintsWithVisualFormat( "V:|[topBar]-32-[emailInputField]-32-[passwordInputField]-32-[signInButton]-16-[resetPasswordButton]-[signUpButton]", options: nil, metrics: nil, views: viewsDictionary)) self.view.addConstraints( NSLayoutConstraint.constraintsWithVisualFormat(...

DDL date data type in check constraint manipulation in oracle

oracle,date,constraints,ddl
i'm creating a table that should check various date constraint, but oracle is kind ticky on this argument. My goal is to reserve a certain room for let's say a lecture, so i tought of something like this : .... prenotation_date date NOT NULL, starting_date date NOT NULL, ending_date date...

How do I ensure that the text entered into a UIAlertview transforms the text of a UIButton and STAYS that way after exiting and reentering the app

ios,objective-c,uibutton,constraints,nsuserdefaults
TL;DR : Open iOS app Enter a promo code Close app Open app Actual Results: Promo code box is out of wack (see images) Expected Results: Promo code should still be displayed So I've got a UIButton whose text keeps changing after the user clicks on it and exits and...

Check Constraint Referencing Unique Column on another Table

sql,sql-server-2008,foreign-keys,constraints,check-constraints
I would like to limit the available values that can be entered in a column, but the values I would like to use are in another table, which is not the primary key of that table; the primary key of that table is not included in my table. As an...

Tenant based unique username in grails application

grails,spring-security,constraints
I am working on a application which has several companies as our clients and multiple users under each company which access our application. So I have structured the table of users to save users of all companies in same table and have the company_id as a column- class User {...

Getting an ORA - 00907 error on the following at ON UPDATE

database,oracle,constraints,create-table
When implementing my oracle database I receive an ORA-00907 error on line 8 at ON UPDATE. Its complaining about right parenthesis but I don't see this error anywhere. whats my issue? CREATE TABLE Result ( Rid number, Hid number, Jid number, Jweight number(5), Place number(3), CONSTRAINT Result_PK PRIMARY KEY(Rid, Hid,...

How could I put a constraint on a literal string parameter

c#,constraints,parameter-passing
I have to say that the title is too poor to be able to describe the problem but that was the only thing I could think of. Anyway, suppose I've been given the following enum: public enum DocumentType{ IdCard=0, Passport, DriversLicense } And I have a method that accepts a...

Error tells me that my textview is nil when trying to make NSDictionary

ios,objective-c,xcode,constraints,nsdictionary
I am about to set up some constraints in my app. When i try to make an NSDictionary i get the error that tells me that my UITextView is nil. As you can see i have set some preferences for my UITextView, so i would presume that it isn't nil....

about constraints in class diagram

uml,constraints,class-diagram
Take the following class diagram: I want to model the following constraint: A member must not participate in several thesis defences programmed on the same date....

iOS - Wrong size on iPhone 6 simulator

ios,objective-c,xcode,constraints,uistoryboard
I have inserted a UILabel in the UIStoryBoard centered horizontally. But when I run it on iPhone 6 it's not in the center. Why that happening and how I can prevent for facing the same problems on the future? On other simulators like iPhone 5 that is working just fine....

Xcode -Set UIIMageView equal width-height with UITableViewCell

xcode,uitableview,constraints
I am building my custom cell and I want an ImageView to be equal with the Cell size(constraints for Height,Width) but I noticed that there is not option for that like other views(eg UIView). Am I missing something here or is there any workaround? Thank you.

Word wrap not working on my UILabel

xcode,swift,constraints,word-wrap
My app uses a custom cell to display products in a tableview. The product name when used on an iPhone 5 was running off the end so I set it to wrap which doesn't work. Each cell is populated in my Customcell class using the code below, I've added a...

Objective-C VisualFormatString - Label and TextField side by side with width priority to TextField

ios,objective-c,constraints
I currently have these tableView cells: Each cell is of the same type. Each has a UILabel on the left and a UITextField on the right. Some times data may be passed into the text fields upon load and other times users will enter data manually into those fields. Everything...

AMPL constraint syntax

constraints,linear-programming,ampl
I am working on a project for a computational optimization class and am having a problem writing a particular constraint for my mixed integer program. The project is essentially a loan portfolio optimization problem where I am trying to maximize an impact on poverty while satisfying constraints on risk, return...

Use reified constraints to make 3 numbers consecutive

prolog,constraints,clpfd
Here's an outline of my SWI-Prolog program: :- use_module(library(clpfd)). consec1(L) :- L=[L1,L2,L3,L4,L5,L6,L7,L8,L9], L ins 1..9, ..., abs(L5-L4)#=1, all_different(L), labeling([],L) abs(L5-L4)#=1 makes L5 and L4 next to each other. If I wanted to make three numbers next to each other e.g. L3, L4 and L5, how could I use reified constraints...

MySQL Constraint check if exist and active

mysql,constraints
Is there a way to check if the rows already exist and is active? Let say the rows look like that: ID: 123456 Active : 1 I know I could do something like that: SELECT * FROM TableName WHERE id=123456 AND Active=1; But that's not what I want. And if...

In Neo4j, can I enforce a relationship+node value constraint?

neo4j,constraints,unique
this is from a Neo4j noob. The question is about identity rules, I suppose. Imagine I have the following data structure: ARTIST MADE many ALBUMs I can enforce artist uniqueness in the following manner: CREATE CONSTRAINT ON (artist:Artist) ASSERT artist.name IS UNIQUE which means the name is the business identity...

xcode autolayout hidden view takes up space

xcode,uitableview,autolayout,constraints
I have been struggling all day to make this work but but without success. I tried to set the Button Top Constraing (Vertical spacing) relative to the tableView. But when I hide the tableview from my swift code the tableview still takes up space. What I am trying to achieve...

Add multiple CHECK constraints on one column depending on the values of another column

sql,oracle,constraints
Given a table with two columns col1 and col2, how can I use the Oracle CHECK constraint to ensure that what is allowed in col2 depends on the corresponding col1 value. Specifically, if col1 has A, then corresponding col2 value must be less than 50; if col1 has B, then...

Swift constraints programmatically creates odd behavior

ios,xcode,swift,autolayout,constraints
I'm attempting to layout all my constraints programmatically because I have to add and remove boxes based on user input. When I run a function which applies all my constraints in ViewDidLoad, it works great. But if I run it again, after removing them all, 2 of my labels disappear...

iOS AutoLayout Problems - Subviews Misplaced Even Though No Constraints

ios,objective-c,iphone,autolayout,constraints
I have a project where some of my views use constraints and some of them don't really need to because they show up nicely on other device sizes as well. My problem is that when I deleted all my constraints in a view controller's subviews, The subviews get heavily misplaced...

How to add constraints to a Custom UITableViewCell

swift,constraints,tableview,cell
I have created a custom cell for my table view and it works fine except that my Image View will not align correctly. Is there a way to add constraints to a custom cell view? Programmatically or otherwise? This is what my cell looks like in the storyboard - which...

Having error for alter table to add constraint

sql,oracle,constraints,add,alter-table
I would like to add constraint to my table name Account, attribute name Type. In the Type, I want to add type of account eg: Saving, Credit Card, Home Loan, Personal Loan, Fixed Deposit, Current, iSaver. Here is my code: ALTER TABLE ACCOUNT ADD CONSTRAINT AccountCK_Type CHECK (TYPE IN('Saving','Credit Card','Home...

xcode buttons overlap despite constraints

ios,xcode,layout,constraints
I am working with a series of 4 buttons. All same width and height that combined stretch the width of the view. I have tried visually constraining them to each other and to a label (also the width of the view) above them. I used the Leading edge to view...

When Would This INSERT.. ON DUPLICATE Fail?

mysql,constraints,unique-constraint
I was troubleshooting an INSERT... ON DUPLICATE KEY statement due to a constraint error, but I irreversibly edited the row in question, and I'm no longer getting the error. I'm pretty sure I edited either request_path or target_path. Some of the values that were already there for certain area: store_id...

Enforcing a unique constraint on a column encrypted with cell level encryption

sql-server,encryption,constraints
I want to enforce a unique constraint on a column which must be encrypted in MSSQL 2005 using Cell Level Encyption (CLE). CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'itsaSECRET!!!3£3£3£!!!' CREATE CERTIFICATE ERCERT WITH SUBJECT = 'A cert for use by procs' CREATE SYMMETRIC KEY ERKEY WITH ALGORITHM = AES_256...

Cannot insert into field with primary key constraint in PostgreSQL

sql,postgresql,constraints
I have a "raw" table that looks like this (among other many fields): team_id | team_name ---------+------------------------- 1 | Team1 1 | Team1 2 | Team2 2 | Team2 I want to extract the team names and their id codes and create another table for them, so I created: CREATE...

Swift: Pan UIImage using constraints

ios,swift,uiimage,autolayout,constraints
I have an UIImage in my viewController that I am using the UIPanGesture on. I am currently using the following code to move it around based on the RayWenderlich tutorial. @IBAction func panImage(sender: UIPanGestureRecognizer) { let translation = sender.translationInView(self.view) if let view = sender.view { view.center = CGPoint(x:view.center.x + translation.x,...

MySQL - Constraint NOT NULL Error 1064

mysql,constraints,notnull
i want to create a table and i get an error : Why doesn't he like my constraint? is mysql so different to sql? because 2 years ago i created the same table with no problems in sql :( here the whole code CREATE table Mitarbeiter( Mitarbeiternummer INT(5), Personennummer INT(5)...

Back up stacktrace at runtime

c#,debugging,constraints
This might seem like an odd question but google is not giving me anything to go on. I have some extension methods that allow me to evaluate return values and so forth on demand. I use them in places where Contracts don't really do what I want. What these extension...

iOS 8.3 - UITableView cell height bug

uitableview,height,constraints,ios8.3
On previous iOS versions cell height was working perfectly now it doesn't get the explicit height i give at the uitableview delegate. By the time, i updated to 8.3 rendering is so bad. It goes smaller and towards right. Am implementing a custom cell using a xib file and Swift....

How to use triggers to prevent duplicate records in PostgreSQL?

postgresql,database-design,triggers,constraints,plpgsql
I wish to create a stored procedure (in plpgsql, PostgreSQL 9.1) that first checks to be sure that the record which is going to be inserted is unique on four of its columns, or if a record is updated, that it is updated to unique values. Example: Record (1,2,3,4) is...

Can i use python to CSP? [closed]

python,python-2.7,python-3.x,constraints
How can i make a Constraint Solver Programing (CSP) based algorithm that can solve any Futoshiki puzzle. Its there any code for this? I have search on google but didn't find anything....

Change a constraints constant using code

ios,swift,cocoa-touch,constraints
I am creating this generic base code for all my views, It creates an ad bar that flows across all my pages. I have just included some code from the best answer to this Question and I cant work out why it doesn't work. I am trying to make it...

Deletion with on restrict constraint postgres

postgresql,constraints
Is it possible to delete the row "on cascade" in postgres if there is a restrict constraint? And is it possible to change all restrict constraints to cascade constraints automatically?

IOS8 Autolayout with relative width / height

ios8,storyboard,autolayout,constraints,orientation
I need to autolayout a storyboard UIView with a single UIControl. The UIControl should be centered, needs to have a aspect ratio of 1:1 and should always use 90% of the superviews width or height depending on the device orientation without clipping. I added 4 constraints Center Y Alignment -...

How to get CAShapeLayer to work with constraints with swift?

ios,swift,constraints,cashapelayer
i got this in viewdidload rectShape1 = CAShapeLayer() rectShape1.fillColor = UIColor.blueColor().CGColor rectShape1.path = UIBezierPath(roundedRect: rectShape1.bounds, byRoundingCorners: .BottomLeft | .TopRight, cornerRadii: CGSize(width: 20, height: 20)).CGPath redview.layer.addSublayer(rectShape1) var constTop = NSLayoutConstraint(item: redview, attribute: NSLayoutAttribute.CenterX, relatedBy: NSLayoutRelation.Equal, toItem: view, attribute: NSLayoutAttribute.CenterX, multiplier: 1, constant: 0) view.addConstraint(constTop) var constH =...

Postgres SQL constraint a character type

postgresql,constraints
I have a table definition in Postgres. I would like to add a constraint to a column that is of Character datatype to have only 3 allowed values: CREATE TABLE my_table ( id character varying(255) NOT NULL, uid character varying(255) NOT NULL, my_text text NOT NULL, is_enabled boolean NOT NULL...

Error message: Cannot delete or update a parent row: a foreign key constraint fails

mysql,sql,constraints
When executing my doDelete.php, this error message appears: " Cannot delete or update a parent row: a foreign key constraint fails (fyp.book, CONSTRAINT book_user_key FOREIGN KEY (id) REFERENCES user (id) ON DELETE NO ACTION ON UPDATE NO ACTION) " the Delete query: $queryDelete = "DELETE FROM user WHERE id =...

Add constraints to the elemets of List

grails,command,constraints
Is there are any possible way to add constraints to the elements of List? For example I have a command which accept List and I want add constraints on this elements, for example on size. class SongCommand { String title List<String> couplet List<String> chorus Boolean isChorus Boolean isChorusRepeat static constraints...

Constrain multiple items together in the center of the screen in Swift

ios,swift,constraints
![enter image description here][1]I am currently making a TicTacToe app and I have 9 colored boxes that I would like in the exact center of the screen on any device. I do not have the experience in constraining very well and can't figure out how to do it exactly. I...

How to query a class and check if a key is null or a value

ios,swift,parse.com,constraints,pfquery
I have a class that has a column that can be either null, or the user. If null, it means it is an app default object, if not null, it was a user created object. How can I setup the query to use BOTH those constraints so that all 'app...

Is one serie of constraints a subset of the other?

prolog,constraints,subset
I have two series of constraints S and S', they describe possibly infinitely large sets. Say for example S: x <= 10 and y <= x and S': x <= 20 and y <= 20. Now I want to know if S is a subset of S'? I thought I...

Constraint with multiple tables. UDF?

sql-server,sql-server-2008-r2,constraints,user-defined-functions
I have two tables: table A and table B. These two tables are linked with a primary key in A and a foreign key in B. Table A: CREATE TABLE [BIO].[table_A]( [table_A_id] [int] IDENTITY(1,1) NOT NULL, [type_id] [nvarchar](2) NOT NULL CONSTRAINT [PK_table_A] PRIMARY KEY CLUSTERED ( [table_A_id] ASC )) Table...

iOS / XCode Auto Layout Woes. Easier Way?

ios,iphone,xcode,layout,constraints
I'm wondering if xCode auto layout / constraints are really as frustrating as I think, or am I just not understanding them. For example, I started with this basic label in the view controller: Fair enough. A box with text that has equal margins on the left/right and a smaller...

domain class constraint in entry creation

grails,constraints,grails-domain-class,grails-controller
In my Grails project I need to add a particular constraint to an entry of my domain class object. Domain class is as follows: class HealthServiceType { String healthService; static belongsTo = [doctor:Doctor] static constraints = { } static mapping = { } } I need that healthService is not...

How to remove constraint based on columns from oracle database?

oracle,constraints
Is there is a way to remove a constraint (unique index) based on columns name? What I would like to do is to remove a constraint where columna name is name, and name_type. ALTER TABLE MY_TABLE DROP CONSTRAINT NAME_OF_CONSTRAINT; I don't have a name so I would like to do...

Setting Autolayout Constraints on UIButton in Swift

ios,iphone,swift,constraints
I'm still trying to get my head around Swift Autolayouts here in XCode 6.3. I have set up a View Controller that I stuck a couple of labels on in Interface Builder. I have added a UITextView and UIImageView programmatically, and am trying to add a UIButton at the bottom...

Using parameterized constructor from generic types base class

c#,generics,constructor,constraints
I have an abstract base-class and several classes deriving from that. The base-class has - against all conventions - some constructors, which I'd love to use. I'm now writing an extension method, which takes a generic type argument. This type is the return type: public static T Create<T>(string key) where...

Auto layout constraint breaks when resizing view dynamically (dragging motion)

ios,resize,autolayout,constraints
I have a view that is sandwiched between two other views, and the height of the middle view can be changed through pan gesture. I'm using a gesture recognizer to get the location of touch and feeding the value to the middle view's height constraint to make it dynamically resizable....

Get info about foreign key on delete action

sql,foreign-keys,constraints,sybase,sybase-ase
I have a Sybase database with two tables. One table refer to another with a foreign key. I need to know - is this foreign declared with any on cascade option? I have already tried: EXEC sp_helpconstraint <table_with_constraint> but this doesn't return any on cascade information. Is there any way...

Can constraintsWithVisualFormat be used with dynamically generated views?

ios,constraints
I have a list of tags in my model. I would like to add them as label inside a tagView UIView as subviews. NSMutableArray *list = [NSMutableArray new]; for (long i=0; i<_tagView.subviews.count; i++) { UILabel *tagLabel = _tagView.subviews[i]; [tagLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; [list addObject:tagLabel]; } // Create the views and metrics dictionaries...

SQL Constraint on column value depending on value of other column

sql,sql-server,constraints,check-constraints
First, I have simple [SomeType] table, with columns [ID] and [Name]. Also I have [SomeTable] table, with fields like: [ID], [SomeTypeID] (FK), [UserID] (FK), [IsExpression] Finally, I have to made on database layer a constraint that: for concrete [SomeType] IDs (actually, for all but one), for same UserID, only one...