Signup/Sign In

Answers

All questions must be answered. Here are the Answers given by this user in the Forum.

For an array of strings (but not an array of objects), you can check if an item exists by calling .indexOf() and if it doesn't then just push the item into the array:

***var newItem = "NEW_ITEM_TO_ARRAY";
var array = ["OLD_ITEM_1", "OLD_ITEM_2"];

array.indexOf(newItem) === -1 ? array.push(newItem) : console.log("This item already exists");

console.log(array)***
3 years ago
I had set one field as "Unsigned" and other one not. Once I set both columns to Unsigned it worked.
3 years ago
It took me a lot of digging to find real benchmark figures around NOCOUNT, so I figured I'd share a quick summary.

If your stored procedure uses a cursor to perform a lot of very quick operations with no returned results, having NOCOUNT OFF can take roughly 10 times as long as having it ON. 1 This is the worst-case scenario.
If your stored procedure only performs a single quick operation with no returned results, setting NOCOUNT ON might yield around a 3% performance boost. 2 This would be consistent with a typical insert or update procedure. (See the comments on this answer for some discussion about why this may not always be faster.)
If your stored procedure returns results (i.e. you SELECT something), the performance difference will diminish proportionately with the size of the result set.
3 years ago
Since a datetime without a specified time segment will have a value of date 00:00:00.000, if you want to be sure you get all the dates in your range, you must either supply the time for your ending date or increase your ending date and use <.

***select Date,TotalAllowance from Calculation where EmployeeId=1
and Date between '2011/02/25' and '2011/02/27 23:59:59.999'***
OR

***select Date,TotalAllowance from Calculation where EmployeeId=1
and Date >= '2011/02/25' and Date < '2011/02/28'***
OR

***select Date,TotalAllowance from Calculation where EmployeeId=1
and Date >= '2011/02/25' and Date <= '2011/02/27 23:59:59.999'***
DO NOT use the following, as it could return some records from 2011/02/28 if their times are 00:00:00.000.

***select Date,TotalAllowance from Calculation where EmployeeId=1
and Date between '2011/02/25' and '2011/02/28'***
3 years ago
Starting with SQL Server 2012:

***SELECT DATEADD(DAY,1,EOMONTH(@mydate,-1))***
3 years ago
A reason NOT to use max or text fields is that you cannot perform online index rebuilds i.e. REBUILD WITH ONLINE= ON even with SQL Server Enterprise Edition.
3 years ago
I used maxlength and minlength with or without **required** and it worked for me very well for HTML5.

******
3 years ago
You actually need 3 meta tags to support Android, iPhone and Windows Phone

***




***
3 years ago
To convert a NSDictionary to a NSString:

***NSError * err;
NSData * jsonData = [NSJSONSerialization dataWithJSONObject:myDictionary options:0 error:&err];
NSString * myString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];***
3 years ago
Here's how to change the text color.

***UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(10, 3, tableView.bounds.size.width - 10, 18)] autorelease];
label.text = @"Section Header Text Here";
label.textColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.75];
label.backgroundColor = [UIColor clearColor];
[headerView addSubview:label];***
3 years ago
In iOS 8.3 (perhaps earlier) with Swift, it's as simple as overriding the motionBegan or motionEnded methods in your view controller:

***class ViewController: UIViewController {
override func motionBegan(motion: UIEventSubtype, withEvent event: UIEvent) {
println("started shaking!")
}

override func motionEnded(motion: UIEventSubtype, withEvent event: UIEvent) {
println("ended shaking!")
}
}***
3 years ago
I separated the app and the test targets in the Podfile by using
***
target :App do

end

target :AppTests do

end***
This resulted in two new products libPods-App.a and libPods-AppTests.a, respectively and they made the previous product libPods.a obsolete. I had to remove this product from the Link Binary With Libraries Section of the Build Phases configuration of both targets.
3 years ago