Menu
  • HOME
  • TAGS

mysql error “cannot add foreign key constraint”

mysql,foreign-keys,constraints,mysql-error-1064

You might want to add a description of the table you are using just DESC table_name then update your question. the most common reason will be that the number of digit in each of your column you want to link with a reference is different maybe INT(11) UNSIGNED and INT(11)...

Get info about foreign key on delete action

sql,foreign-keys,constraints,sybase,sybase-ase

Sybase ASE 15 does not support on cascade DDL so none of your foreign keys will have a cascade option. If you want the delete or update on cascade functionality you must implement a trigger.

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

sql,oracle,constraints

You can't perform such complex validation using constraints unfortunately. While there is a way to use a combination of materialized views and constraints (see my blog) in reality we don't normally do that as it could have adverse performance implications. Triggers are an option, but I would avoid them as...

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

ios,objective-c,constraints

What result does that code give you? When I do this same setup in the storyboard, I get the result you want. If you're not getting that result, you might need to set the content hugging priority of the label to a higher value than that for the text field...

Constraint with multiple tables. UDF?

sql-server,sql-server-2008-r2,constraints,user-defined-functions

You are right, having UDF in CHECK constraints can be tricky and some UPDATE statements may bypass the check: http://sqlblog.com/blogs/tibor_karaszi/archive/2009/12/17/be-careful-with-constraints-calling-udfs.aspx MSSQL: Update statement avoiding the CHECK constraint As you can see in that SO question the answer recommended to use trigger for the check. Writing a correct efficient trigger is...

DDL date data type in check constraint manipulation in oracle

oracle,date,constraints,ddl

You could use a CHECK constraint with following conditions: starting_date > prenotation_date + 3 starting_date < ending_date TRUNC(starting_date) = TRUNC(ending_date) starting_date > prenotation_date + 3 will make sure that the booking is allowed after 3 days of the reservation. starting_date < ending_date will make sure that the time at which...

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. No, you are wrong. You can drop a NOT NULL column. If the collumn is not a primary key or foreign key , why cant i just drop it? Yes, you...

Using parameterized constructor from generic types base class

c#,generics,constructor,constraints

Well, firstly you are missing the new() constraint which allows the construction of a generic type i.e. public static T Create<T>(string key) where T : Baseclass, new() { ... } However, given you need to pass arguments to the constructor, that only results in replacing one error for another. One...

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

ios,uitableview,swift,autolayout,constraints

I've solved this by adding a custom UITableView class with an outlet to the needed constraint, then I had a direct approach on my cellForRowAtIndexPath method. class: import UIKit class CustomTableViewCell: UITableViewCell { @IBOutlet weak var bottomPadding: NSLayoutConstraint! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(selected:...

ios autolyouts: labels centering

ios,objective-c,autolayout,constraints

Why don't you use subString and only one label??? Hehe, it's very simple... If folow your idea, i thinks: Set properties uilabel is fitsize Set autolayout horizol spacing between 2 label is 0 Cacutator the total width (2 label) and width's parentView a = parentView.frame.size.width - (lbl1.frame.size.width+lbl2.frame.size.width) Set autolayout lbl1:...

Symfony2 form builder without class check if multiple fields are empty

validation,symfony2,constraints,formbuilder

the easiest solution is to just set both as required ... but.. on post you could check as simple as if( empty($form->get('name')->getData()) && empty($form->get('dob')->getData())){ $form->addError(new FormError("fill out both yo")); // ... return your view }else { // ... do your persisting stuff } ... the symfony way would possibly be...

Moving a textfield with auto layout constraints when the keyboard appears

ios,swift,autolayout,constraints

Instead of adjusting theframe values, I think you should be creating @IBOutlet references to constraints in Interface Builder and then changing the constant value of those constraints when you want to animate them, followed by a call to layoutIfNeeded. As I understand it, manually changing the values of a view's...

MySQL check before soft delete

mysql,foreign-keys,constraints,soft-delete

This should work if you create the active_view as you said you could. Just add the active flags of all the related tables into the foreign_active column, and you should be good to go. CREATE TRIGGER before_update_student BEFORE UPDATE ON student FOR EACH ROW BEGIN IF NEW.active = 0 AND...

Cannot insert into field with primary key constraint in PostgreSQL

sql,postgresql,constraints

If two different teams with the same id are in raw_table e.g. (1, 'foo') and (1, 'bar') the group by will still return both, because those two are different. If you just want to pick one of the rows for duplicate values of team_id then you should use something like...

Bottom space constraint proportional to height of view

ios,objective-c,uiview,autolayout,constraints

Use the multiplier value. You want the bottom of your view to be 0.8 times the bottom of the superview. ...

about constraints in class diagram

uml,constraints,class-diagram

I would use a qualifier to express that given a date, there will be zero or one Thesis Defence. That looks like an extra rectangle on the Member end of the association containing the string "defence date : DateTime" and a multiplicity of [0..1] on the other end. Please see...

Oracle: unique index with check on a specific value

sql,oracle,constraints

I don't think you can fit that logic into a unique or check constraint. You may have to resort to using a trigger to enforce this: create trigger trg_ref_grp_check after insert or update on t42 declare l_cnt pls_integer; begin select max(count(distinct case when group_id = 'reference' then 1 else 0...

Swift: Pan UIImage using constraints

ios,swift,uiimage,autolayout,constraints

Generally speaking, if a view has active auto layout constraints you should not set its frame directly. This is because your change will get overwritten the next time the layout engine makes a pass over the relevant views, and you cannot control when that will happen. Your solution to update...

AMPL constraint syntax

constraints,linear-programming,ampl

The problem is that you use the same index c name in two different indexing expressions with overlapping scope, (c,r) in GROUP and c in COUNTRY. You can rename the second index to avoid the error: subject to WITHIN_REGION{r in REGION, (c,r) in GROUP, l in LOAN_DURATION}: x[c,l] <= QUOTA[r]*sum{c2...

UITextField placeholder alignment scrolling trouble

ios,objective-c,uitableview,uitextfield,constraints

The first thing is that you are allocating your uitextfield in cellForRowAtIndexPath method thats why they appears again and again when you are scrolling.Because nature of uitableview is do whatever developer want in visible cells not in the out of screen thats why when you scrolling this method calling again...

Need assistance regarding autolayouts

ios,objective-c,xcode,autolayout,constraints

Auto layout is based on linear algebra. The relevance being that it has to be able to 'solve' the 'equation' based on the constraints you provide. It looks like you are trying to set the constraints for the inner view while leaving the outer view undefined. That won't work because...

Deletion with on restrict constraint postgres

postgresql,constraints

Neither is possible. Your options would be to: DROP CONSTRAINT, DELETE and ADD CONSTRAINT or DROP CONSTRAINT, ADD CONSTRAINT ... ON DELETE CASCADE and DELETE From PostgreSQL Documentation you can see what alterations can be done on table constraints: I. SQL Commands - ALTER TABLE...

ORACLE - CHECK constraint enforcing conditional uniqueness

database,oracle,constraints,unique-constraint

You can define this sort of conditional unique constraint using a function-based unique index. CREATE UNIQUE INDEX idx_unique_program_name ON program( CASE WHEN program_number IS NULL THEN program_name ELSE NULL END ); This takes advantage of the fact that Oracle doesn't index NULL values so the index that gets created only...

Can constraintsWithVisualFormat be used with dynamically generated views?

ios,constraints

You should create your own dictionary, so the names can be added that don't have the extra brackets that you're getting now. Names like "list[0]" seem to be confusing the parser. NSMutableDictionary *views = [NSMutableDictionary new]; NSMutableArray *list = [NSMutableArray new]; for (long i=0; i<_tagView.subviews.count; i++) { UILabel *tagLabel =...

Complex AutoLayout for Cell with dynamic size

ios,swift,autolayout,constraints,nsautolayout

I managed to setup your constraints so that you get the result you needed. This is what I get: I hope this is how you wanted it to look like. Here is a link with the project. I will try to explain how I added the constraints so that it...

iOS - Wrong size on iPhone 6 simulator

ios,objective-c,xcode,constraints,uistoryboard

There are different resolutions for iOS devices, especially after the release of iPhone 6 and iPhone 6 Plus. Because the storyboard is just a general representation of your application's interface, the size of canvas does not actually resemble any one particular screen size. In fact, you may notice that the...

iOS / XCode Auto Layout Woes. Easier Way?

ios,iphone,xcode,layout,constraints

I think you have to understand constraints first...without that you always made things frustrating....For understand the constraints you can check this links http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1 http://mathewsanders.com/designing-adaptive-layouts-for-iphone-6-plus/

auto layout modify multiplier of constriaint programmatically

ios,objective-c,autolayout,constraints

As others said,you have to delete the old one and add a new one.If you do not want to store it as a property,just set identifier and search to get it later -(NSLayoutConstraint *)constraintWithIndientifer:(NSString *)identifer InView:(UIView *)view{ NSLayoutConstraint * constraintToFind = nil; for (NSLayoutConstraint * constraint in view.constraints ) {...

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

database,oracle,constraints,create-table

Oracle RDBMS does not support ON UPDATE CASCADE.

How could I put a constraint on a literal string parameter

c#,constraints,parameter-passing

No you can't. The pattern normally used is to throw a throw new ArgumentException("docType"); Technically even a throw new ArgumentOutOfRangeException("docType"); would be correct, but I haven't ever seen it used outside "numeric" indexes. For example, Enum.Parse throw an ArgumentException if you use illegal values, and your method seems to be...

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

What ended up being the actual problem was the fact that I wasn't using UIControlStateSelected. A foolish error. But that was the actual issue. Even after synchronizing my defaults and making sure the success block was returning the data properly, and that I was then accessing that data properly, the...

Cplex constraint for 2 dimensional binary decision variables

math,model,binary,constraints,cplex

From memory, the sum(q in papers) only applies to the immediate following term. Try putting the two separate parts in parentheses, like: forall(p in papers) sum (q in papers) ( y[p][q] + y[q][p] ) <= 1; ...

UIViewController: adjust contraints of xib

ios,swift,constraints

Try to call this method before adding constraints. feedDetail.setTranslatesAutoresizingMaskIntoConstraints(false) ...

Constraints set but views not placed correctly

ios,objective-c,constraints

Looks like you added the items to the w:Regular and h:Regular size class. The UI Elements aren't in any other size class besides that one. You're not seeing the UI Elements because the iPhone's size class is w:Compact h:Regular. You need to add the UI Elements to all size classes,...

iOS addView: Adds view from story board without constraints

ios,objective-c,constraints,addsubview

As far as I understood, you want to only show and hide view in UIViewController? If that is your purpose you should use this code: self.ErrorView.hidden = YES; // To hide alert and self.ErrorView.hidden = NO; // To show alert ...

How do I interpret PostgreSQL error messages from within Go?

sql,postgresql,go,constraints

For information about how to interpret errors from github.com/lib/pq, see http://godoc.org/github.com/lib/pq#Error. Here is what I do: // ShowError sends an appropriate error message. func ShowError(w http.ResponseWriter, r *http.Request, err error) { switch e := err.(type) { case *pq.Error: switch e.Code { case "23502": // not-null constraint violation http.Error(w, fmt.Sprint("Some required...

MySQL - Constraint NOT NULL Error 1064

mysql,constraints,notnull

MySQL doesn't support syntax to give a name to a NOT NULL constraint. This will throw an error: Personennummer INT(5) constraint not_null_mitarbpersnr NOT NULL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ To declare a NOT NULL constraint on a column in MySQL, you have to omit the keyword CONSTRAINT and the name. This syntax is valid:...

How to add constraints to a Custom UITableViewCell

swift,constraints,tableview,cell

You only have to set up your constraints correctly. Indeed, even if Add Missing Constraints and Reset to Suggested Constraints are handy sometimes they don't know what you want, thus the result cannot always be what you expect. What you might want to do here is the following. For you...

How to use triggers to prevent duplicate records in PostgreSQL?

postgresql,database-design,triggers,constraints,plpgsql

I previously had used a unique index on the record's fields, but would like to learn how a trigger is written to accomplish this. This is a misunderstanding. If a set of columns is supposed to be unique, use a UNIQUE constraint (or make it the PK) in any...

SQL Constraint on column value depending on value of other column

sql,sql-server,constraints,check-constraints

You can do this with filtered index: CREATE UNIQUE NONCLUSTERED INDEX [IDX_SomeTable] ON [dbo].[SomeTable] ( [UserID] ASC ) WHERE ([SomeTypeID] <> 1 AND [IsExpression] = 1) or: CREATE UNIQUE NONCLUSTERED INDEX [IDX_SomeTable] ON [dbo].[SomeTable] ( [UserID] ASC, [SomeTypeID] ASC ) WHERE ([SomeTypeID] <> 1 AND [IsExpression] = 1) Depends on...

Symfony Custom Validation Constraint pass parameter

validation,symfony2,constraints,unique-constraint

I like to attach the a virtual resource to the form as a way to accomplish these kinds of validations. When you construct your Book model, simply assign it a new property with an instance of the book record. Then, you can apply your validator as a class constraint (instead...

Laravel 5: SQLSTATE[23000]: Integrity constraint violation

php,mysql,validation,constraints,laravel-5

instead of $user = new User(array( 'name' => \Input::get('name'), 'description' => \Input::get('description'), 'fullname' => \Input::get('fullname'), 'email' => \Input::get('email'), 'city' => \Input::get('city'), )); do this $user = new User(); $user->fill(array( 'name' => \Input::get('name'), 'description' => \Input::get('description'), 'email' => \Input::get('email') )); $user->fullname = \Input::get('fullname'); $user->city= \Input::get('city'); or change the $fillable property in...

Having error for alter table to add constraint

sql,oracle,constraints,add,alter-table

If you only want the constraint to apply for future data changes, as you said in a comment, then you can make it ignore other existing values with the NOVALIDATE clause: ALTER TABLE ACCOUNT ADD CONSTRAINT AccountCK_Type CHECK (TYPE IN('Saving','Credit Card','Home Loan','Personal Loan', 'Fixed Deposit','Current','iSaver')) ENABLE NOVALIDATE; Otherwise, you will...

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

ios,objective-c,uiscrollview,autolayout,constraints

You are referring to the contentSize's height of the table view. First you need to add a height constraint for the table view. Then after the table finishes loading, do this : self.tableViewHeightConstraint.constant = self.tableView.contentSize.height; ...

Custom UITableViewCell Constraints not working

ios,xcode,uitableview,constraints,ios8.3

Select the label you want to constrain, click in the icon indicate in the pic bellow, select the right constrain line in the top the view where says add constrains, you add by clicking in the red line, enter the distance in point from the right margin you want (if...

Xcode 6 and Constraints - Greyed out equal widths option

ios,iphone,xcode,button,constraints

You need to right-click drag from one of the objects to the other one to enable that option (It needs to know what heights should be equal)

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

sql-server,encryption,constraints

Normally, you could use "deterministic encryption", for example, AES ECB mode, or AES-SIV. But since you are within the limitations of SQL Server encryption, you'll have to find another way. Here is an old post that discusses the issue: http://blogs.msdn.com/b/raulga/archive/2006/03/11/549754.aspx. Here is a newer post that mentions that SQL Server...

CPLEX/OPL model - constraints with subset index

constraints,scheduling,subset,cplex,opl

It is not clear what your problem is, but I am guessing your problem is to do with modelling things like products(j) in constraint 2. Try using sets for these - so create an array of sets of products in each product family. There are examples of this in the...

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

ios,objective-c,xcode,constraints,nsdictionary

The mistake you're making is that viewWithTag: doesn't instantiate a new UIView, it just searches an existing UIView's heirarchy for another UIView that has that as its tag value. More at the documentation: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/index.html#//apple_ref/occ/instm/UIView/viewWithTag: What you need to do is instatiate your UIView first, then set its tag: UIView *infoView...

IOS8 Autolayout with relative width / height

ios8,storyboard,autolayout,constraints,orientation

Here is a way to do it: Start with the four constraints you list above: Center X, Center Y, Equal Widths (0.9 multiplier), and Aspect Ratio, all with priority 1000. Change the priority of the Equal Widths to 750. This will allow Auto Layout to ignore or modify this constraint...

Xcode -Set UIIMageView equal width-height with UITableViewCell

xcode,uitableview,constraints

Solution: Add constraints to center the Image View Horizontaly/Vertical and for Bottom/Top space.

domain class constraint in entry creation

grails,constraints,grails-domain-class,grails-controller

That's quite simple to make a unique property. For example: static constraints = { healthService(unique: ['doctor']) } The above will ensure that the value of healthService is unique for each value of doctor within your domain class....

Change a constraints constant using code

ios,swift,cocoa-touch,constraints

You are giving == instead of = while assigning. import Foundation import UIKit import iAd class dayPicker: UIViewController , ADBannerViewDelegate{ var UIiAd: ADBannerView = ADBannerView() var SH = UIScreen.mainScreen().bounds.height var AH = CGFloat() @IBOutlet var constOne: NSLayoutConstraint! @IBOutlet var constTwo: NSLayoutConstraint! func appdelegate() -> AppDelegate { return UIApplication.sharedApplication().delegate as! AppDelegate...

Postgres SQL constraint a character type

postgresql,constraints

Use a check constraint: 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, constraint check_allowed check (my_text in ('A', 'B', 'C')) ); More details in the manual: http://www.postgresql.org/docs/current/static/ddl-constraints.html#DDL-CONSTRAINTS-CHECK-CONSTRAINTS...

xcode buttons overlap despite constraints

ios,xcode,layout,constraints

I have something similar in my code, if u are setting button constraints programatically, i have a scrollview and a contentview inside it and setted constraints in storyboard, but other stuff i add programatically button1.setTranslatesAutoresizingMaskIntoConstraints(false) constX = NSLayoutConstraint(item: button1, attribute: NSLayoutAttribute.CenterX, relatedBy: NSLayoutRelation.Equal, toItem: ContentView, attribute: NSLayoutAttribute.CenterX, multiplier: 1, constant:...

Changing constraint after adding it causes constraint error (swift)

ios,swift,constraints

I figured out how to change a constraint using a constant. In the viewController class I defined the constraint: var errorViewHeight:NSLayoutConstraint! and in the viewDidLoad, I specified and added it to my UIView errorViewHeight = NSLayoutConstraint(item:errorView, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier:1.0, constant:0) errorView.addConstraint(errorViewHeight) From then on,...

How to set constrains in Xcode 6 on login viewcontroller

swift,storyboard,xcode6,autolayout,constraints

Unfortunately, you can't make a spacing constraint change depending on the height of something. However, as a spacer, you could use a transparent UIView, whose height can be proportional to the View Controller's view height (which, in turn, depends on the phone screen height). Make sure your UIImageView and UILabel...

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

python,django,django-models,constraints

You're referring to choices. Example from the docs: from django.db import models class Student(models.Model): FRESHMAN = 'FR' SOPHOMORE = 'SO' JUNIOR = 'JR' SENIOR = 'SR' YEAR_IN_SCHOOL_CHOICES = ( (FRESHMAN, 'Freshman'), (SOPHOMORE, 'Sophomore'), (JUNIOR, 'Junior'), (SENIOR, 'Senior'), ) year_in_school = models.CharField(max_length=2, choices=YEAR_IN_SCHOOL_CHOICES, default=FRESHMAN) ...

Use reified constraints to make 3 numbers consecutive

prolog,constraints,clpfd

This implements consecutive in the sense you gave in the comments. For a list of N values, we need space enough to make all the values fit in between, and all values need to be different. consecutive([]). % debatable case consecutive(Xs) :- Xs = [_|_], length(Xs, N), all_different(Xs), max_of(Max, Xs),...

Setting Autolayout Constraints on UIButton in Swift

ios,iphone,swift,constraints

try this code self.view.addConstraint(NSLayoutConstraint(item: infoButton, attribute: NSLayoutAttribute.Leading, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.Leading, multiplier: 1.0, constant: 0.0)) self.view.addConstraint(NSLayoutConstraint(item: infoButton, attribute: NSLayoutAttribute.Trailing, relatedBy: NSLayoutRelation.Equal, toItem: self, attribute: NSLayoutAttribute.Trailing, multiplier: 1.0, constant: 0.0)) self.view.addConstraint(NSLayoutConstraint(item: infoButton, attribute:...

When Would This INSERT.. ON DUPLICATE Fail?

mysql,constraints,unique-constraint

This will happen if fixing the first uniqueness constraint (by updating the conflicting row instead of inserting a new one) causes the second one to fail. For example, let's say your table already has the following rows: (6, 494, NULL, 'category/123', 'lessons/teacher-s-planning-calendar/n-a', 'catalog/category/view/id/123', 1), (6, 494, NULL, 'category/494', 'lessons/foobar/whatever', 'catalog/category/view/id/494',...

Re-enable “Update Constraint” option

ios,autolayout,constraints,uistoryboard

its stop showing that "yellow pointer" even after I change the frame of particular UI control. The red arrow simply means that you've got conflicting or unspecified constraints somewhere. You need to click the red arrow to find out what the problem is and fix it. A yellow arrow,...

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

tsql,constraints

For one, your syntax is wrong. ALTER TABLE dbo.MyTable ALTER COLUMN column2 VARCHAR(50) NOT NULL Note that NOT NULL doesn't quite behave as a constraint, but rather a feature of the column's type. As such, you don't use the ADD CONSTRAINT operation. Secondly, you just have to use multiple statements,...

Can i use python to CSP? [closed]

python,python-2.7,python-3.x,constraints

A) Stackoverflow is not a site to ask for examples of programs. It is a site to help answer questions about problems with an existing program. B)That said, I can point you to some tutorials. You didn't find anything? Here are the first 3 results I got from Google: python-constraint...

Add constraints to the elemets of List

grails,command,constraints

The constraint size will work for this purpose. Check the documentation for complete details, but your example would be: static constraints = { ... chours(size:0..3) // example of minimum of 0 maximum of 3 ... } The above will limit the number of elements (min and max), however if you...

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

matlab,constraints,equality,nonlinear-optimization,inequality

I believe fmincon is well suited for your problem. Naturally, as with most minimization problems, the objective function is a multivariate scalar function. Since you are dealing with a vector function, fmincon complained about that. Is using the norm the "best" approach? The short answer is: it depends. The reason...

C++ Templates with multiple constraints

c++,templates,generics,constraints

you usually make constraints on C++ template with std::enable_if here is the trick - if your template looks like this: template <class T> <return type> <function name> (args...) you take the return type and corporate it with enable_if like this : template <class T> typename std::enable_if<XXX,<return type>>::type <function name> (args...)...

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

mysql,constraints,mysql-5.0

I believe this should work -- drop the constraint, index and column ALTER TABLE book DROP FOREIGN KEY book_library_id_fkey; DROP INDEX library_id ON book; ALTER TABLE book DROP COLUMN external_id; -- Recreate the index and foreign key if necessary ALTER TABLE book ADD CONSTRAINT book_library_id_fkey FOREIGN KEY(library_id) REFERENCES library(id); ALTER...

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

Use inequality constraints. If they are aligned at the top, you can just set the container's top to equal the label tops. Then, you set the bottom to be greater than label1's bottom and, with another constraint, greater than label2's bottom. That leaves ambiguity because it can be any height...

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

ios,swift,constraints

If the image sixes are fixed for all devices and orientations then you can simple make a UIView and add these images in the order you want them to be shown and apply basic constraints. if the image sixes are to grow then make use of spacer views. For the...

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

sql,oracle,constraints

UPDATE Based on OP's two cases, I think a BEFORE INSERT TRIGGER would do the job: Test case: SQL> DROP TABLE TEST PURGE; Table dropped. SQL> SQL> CREATE TABLE test 2 ( col INT 3 ); Table created. SQL> SQL> CREATE OR REPLACE TRIGGER trg BEFORE 2 INSERT ON TEST...

Is one serie of constraints a subset of the other?

prolog,constraints,subset

The comment by @false is correct, as far as I can see: given two sets S and S': if S is a subset of S', then the intersection of the complement of S' and S should be the empty set (there are no elements outside of S' that are elements...

Word wrap not working on my UILabel

xcode,swift,constraints,word-wrap

When you are targeting iOS 6 until 8 or higher, you have to explicitly set the preferredWidth attribute on the UILabel. You have to do it, if the label has more than one line. See also [preferredMaxLayoutWidth: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UILabel_Class/#//apple_ref/occ/instp/UILabel/preferredMaxLayoutWidth So you just need to specify this value (in most cases it's...

Back up stacktrace at runtime

c#,debugging,constraints

What you want is the DebuggerStepThroughAttribute. When an exception is thrown in a method tagged with this attribute, the debugger will be placed on the line that called the method, and not inside the method. In other words, you want to declare your methods like this: [DebuggerStepThrough] public static void...

Why can't I add pin constraints in Xcode?

ios,xcode,constraints

You need to click on each of the four orange I-beams to turn them from dashed to solid. Then the button will change to Add 4 Constraints. ...

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

mysql,database,foreign-keys,constraints

In order to add a Foreign Key the two fields must be INDEXed. Try this: -- ----------------------------------------------------- -- Table test_schema.table_one -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS table_one ( table_one_id INT UNSIGNED NOT NULL AUTO_INCREMENT, table_one_name VARCHAR(45) NOT NULL, PRIMARY KEY (table_one_id, table_one_name), KEY `one_name` (`table_one_name`) ) ENGINE = InnoDB;...

Having constraints into constraints

c#,constraints

You'll have to include all of the generic types in your class definition. public class UblConverter<TParser, TDto, TUbl> where TParser : UblParser<TDto, TUbl> where TUbl : UblBaseDocumentType where TDto : DtoB { //... } ...

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

c#,generics,constraints

Let's say that SampleA represents animals, and you do this public class Bird : SampleA { } public class Dog : SampleA { } Test<Bird> b = new Test<Bird>(); b.DoStuff<Dog>(); The field action now knows how to act on a Bird, but not on the Dog you passed it, even...

Unique first column in multi-column index

mysql,indexing,constraints

You asked. I have multi-column index for 2 columns. Can I make first column unique without making separate index for that? The answer is no. You need a separate unique index on the first column to enforce a uniqueness constraint....

Referential integrity across multiple tables

sql,database,postgresql,database-design,constraints

I want to enforce that the player plays the sport BEFORE joining a team. Add another FK constraint like this: CREATE TABLE IF NOT EXISTS has_players ( team_name varchar(50) , sport_id int , player_id int , PRIMARY KEY(team_name, sport_id, player_id) , FOREIGN KEY (team_name, sport_id) REFERENCES teams(team_name, sport_id) ,...

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

ios,swift,parse.com,constraints,pfquery

Figured it out using subqueries: var defaultQuery = PFQuery(className: "MyClass") defaultQuery.whereKeyDoesNotExist("createdBy") var userQuery = PFQuery(className: "MyClass") userQuery.whereKey("createdBy", equalTo: PFUser.currentUser()) var query = PFQuery.orQueryWithSubqueries([defaultQuery, userQuery]) ...

change constraint inside tableViewCell

ios,objective-c,uitableview,constraints,tableviewcell

You can do this by following way Either by creating new view dynamically UIView *v=[[UIView alloc]init]; v.frame=CGRectMake(0, 0, 500, 250); Or by accessing view by tag or by accessing content view subviews in -(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath UIView *v=[cell.contentView.subviews objectAtIndex:0]; v.frame=CGRectMake(0, 0, 500, 250); Hope this helps...

Swift constraints programmatically creates odd behavior

ios,xcode,swift,autolayout,constraints

Without knowing what your requirements are, it's hard to give you good advice. Here is an example of how I might do it. I added all the views in code, and added background colors to the views so I could better see their layout. I'm assuming that the scroll view...

iOS 8.3 - UITableView cell height bug

uitableview,height,constraints,ios8.3

I have found out what was going wrong. Before the iOS 8.3 update the table view should somehow auto calculating the height of the custom cell and everything was working properly. My mistake was that i believed that i had correctly connect the table view's data source and delegate at...

iOS AutoLayout Problems - Subviews Misplaced Even Though No Constraints

ios,objective-c,iphone,autolayout,constraints

Because,AutoLayout in XCode is default enabled. Even you do not create any your constraints, XCode will auto create some constraints at build time so that iOS will know how to render the views If you want to disable autoLayout,just uncheck the Use auto layout as image shown below ...

Size-classes and constraints with buttons

ios,objective-c,autolayout,constraints,size-classes

Pin the top of the top button to its superview. Pin the bottom of the bottom button to its superview. Assign a fixed vertical space between each button. Select all the buttons and specify "Equal Height." This should take care of your vertical constraints, and the button heights will...

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

ios,resize,autolayout,constraints

To answer your question: a) Yes, this is the correct way to update the height of the view b) Yes, there is a way to get rid of the warnings Since your view gets negative values for the height constraints, you could add a check for the height so that...

iOS Dynamic Autolayout with VFL Constraints

ios,iphone,xcode,xamarin,constraints

The issue is that you're removing constraints that you didn't create that are helping the view controllers view to lay itself and subviews out. Instead of removing all of the constraints from your view, just remove the ones you created (save the arrays of constraints that are are returned from...

Weakening vinyl's RecAll constraint through entailment

haskell,constraints,ghc,vinyl

Let's begin by reviewing how Dict and (:-) are meant to be used. ordToEq :: Dict (Ord a) -> Dict (Eq a) ordToEq Dict = Dict Pattern matching on a value Dict of type Dict (Ord a) brings the constraint Ord a into scope, from which Eq a can be...

How to get CAShapeLayer to work with constraints with swift?

ios,swift,constraints,cashapelayer

The problem is that rectShape1.bounds.size is {0,0} at the time you create the bezier path. Remove the line where you create the path from viewDidLoad, and move it to after you set the frame in viewDidLayoutSubviews, override func viewDidLayoutSubviews() { self.rectShape1.frame = self.redview.bounds rectShape1.path = UIBezierPath(roundedRect: rectShape1.bounds, byRoundingCorners: .BottomLeft |...

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

mysql,sql,constraints

Indeed, you have a constraint in book table, that does not let you delete a user as long as there are books added by that user: CONSTRAINT `book_user_key` FOREIGN KEY (`user_id`) REFERENCES `fyp`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION You can change it to ON DELETE CASCADE...