qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
944,045
So in a typical model where you have a parent that can have many children and a child that can have only one parent, how do you manage the adding of children. I have been using this approach; ``` public class Parent { public Parent() { Children = new List<Child>(); } public IList<Child> Childr...
2009/06/03
[ "https://Stackoverflow.com/questions/944045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85070/" ]
I'm using public IEnumerable with Add|Remove methods approach. However I don't like it much, because it's not intuitive, and polutes class definition. I'm wondering why people don't use CustomCollection where they override Add, Remove, Replace functions?? (like it's done everywhere in MS code) ????
If you have a foreign key in your DB, and you are using Identity(SQL Server) to generate your primary keys, you are going to *NEED* the backlink from the child to the parent. Else, the insert will complain on child because nhibernate needs to do some back and forth for the parent ID, but it hasn't done it yet. What we...
944,045
So in a typical model where you have a parent that can have many children and a child that can have only one parent, how do you manage the adding of children. I have been using this approach; ``` public class Parent { public Parent() { Children = new List<Child>(); } public IList<Child> Childr...
2009/06/03
[ "https://Stackoverflow.com/questions/944045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85070/" ]
I do it like that except that I don't use property for private list ``` private IList<Child> _children public IEnumerable<Child> Children { get { return children; } } ```
I support the accepted solution to this question, however the solution presented is not complete, as using private fields requires some extra configuration in the mappers. For the benefit of others, the following is the complete solution: ``` public partial class Test { private readonly IList<Child> children = new...
944,045
So in a typical model where you have a parent that can have many children and a child that can have only one parent, how do you manage the adding of children. I have been using this approach; ``` public class Parent { public Parent() { Children = new List<Child>(); } public IList<Child> Childr...
2009/06/03
[ "https://Stackoverflow.com/questions/944045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85070/" ]
I'm using public IEnumerable with Add|Remove methods approach. However I don't like it much, because it's not intuitive, and polutes class definition. I'm wondering why people don't use CustomCollection where they override Add, Remove, Replace functions?? (like it's done everywhere in MS code) ????
I support the accepted solution to this question, however the solution presented is not complete, as using private fields requires some extra configuration in the mappers. For the benefit of others, the following is the complete solution: ``` public partial class Test { private readonly IList<Child> children = new...
944,045
So in a typical model where you have a parent that can have many children and a child that can have only one parent, how do you manage the adding of children. I have been using this approach; ``` public class Parent { public Parent() { Children = new List<Child>(); } public IList<Child> Childr...
2009/06/03
[ "https://Stackoverflow.com/questions/944045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85070/" ]
I do it like this: ``` public class Parent { private ISet<Child> _children = new HashedSet<Child>(); public ReadOnlyCollection<Child> Children { get{ return new List(_children).AsReadOnly(); } } public void AddChild( Child c ) { if( c != null && !_children.Contains (d) ) ...
I support the accepted solution to this question, however the solution presented is not complete, as using private fields requires some extra configuration in the mappers. For the benefit of others, the following is the complete solution: ``` public partial class Test { private readonly IList<Child> children = new...
944,045
So in a typical model where you have a parent that can have many children and a child that can have only one parent, how do you manage the adding of children. I have been using this approach; ``` public class Parent { public Parent() { Children = new List<Child>(); } public IList<Child> Childr...
2009/06/03
[ "https://Stackoverflow.com/questions/944045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85070/" ]
I support the accepted solution to this question, however the solution presented is not complete, as using private fields requires some extra configuration in the mappers. For the benefit of others, the following is the complete solution: ``` public partial class Test { private readonly IList<Child> children = new...
I don't like all the extra `AddXXX()` and `RemoveXXX()` methods cluttering my entity interfaces. Instead, I have a custom list that raises events when the `Add()` and `Remove()` methods are called. The linking then happens in the event handlers: ``` public class Course() { public Course() { this.Topics = n...
944,045
So in a typical model where you have a parent that can have many children and a child that can have only one parent, how do you manage the adding of children. I have been using this approach; ``` public class Parent { public Parent() { Children = new List<Child>(); } public IList<Child> Childr...
2009/06/03
[ "https://Stackoverflow.com/questions/944045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85070/" ]
I do it like that except that I don't use property for private list ``` private IList<Child> _children public IEnumerable<Child> Children { get { return children; } } ```
I'm using public IEnumerable with Add|Remove methods approach. However I don't like it much, because it's not intuitive, and polutes class definition. I'm wondering why people don't use CustomCollection where they override Add, Remove, Replace functions?? (like it's done everywhere in MS code) ????
944,045
So in a typical model where you have a parent that can have many children and a child that can have only one parent, how do you manage the adding of children. I have been using this approach; ``` public class Parent { public Parent() { Children = new List<Child>(); } public IList<Child> Childr...
2009/06/03
[ "https://Stackoverflow.com/questions/944045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85070/" ]
I do it like that except that I don't use property for private list ``` private IList<Child> _children public IEnumerable<Child> Children { get { return children; } } ```
I don't like all the extra `AddXXX()` and `RemoveXXX()` methods cluttering my entity interfaces. Instead, I have a custom list that raises events when the `Add()` and `Remove()` methods are called. The linking then happens in the event handlers: ``` public class Course() { public Course() { this.Topics = n...
71,500,438
Given lots of intervals [ai, bi], find the interval that contains the most number of intervals. I easily know how to do this in O(n^2) but I must do it in O(nlogn). I think abount making two arrays, one with sorted starts and second with sorted ends, but I really don't know what to do next. I can only use structures li...
2022/03/16
[ "https://Stackoverflow.com/questions/71500438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18482707/" ]
Interval containment is a combination of two conditions: a includes b if `a.start <= b.start` and `a.end >= b.end`. If you sort intervals by `(end, size)` and process them in that order, then the end condition is easy -- `current.end` >= `x.end` if x is an interval you've already processed. To find out how many inter...
You can do it simply in O(n log n) using simply two sorts! First, sort every interval according to its starting time. Then, sort them in reverse order of their end time. You know a specific interval cannot contain any of the intervals placed before them neither in the first or the second array, because intervals loca...
41,255,609
I've a `UITextField` for entering pincode number. My requirement is when textField character range reach to 6th character then I've to do server validation and I have to put the data in labels. If character range is less than 5 then I will pass nil value. **Below is my code :-** ``` //TextField character range f...
2016/12/21
[ "https://Stackoverflow.com/questions/41255609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6624878/" ]
`shouldChangeCharactersIn` will get called prior to getting the actual text in the `UITextField` This is how you get the full text from that `UITextField` ``` let newString = NSString(string: textField.text!).replacingCharacters(in: range, with: string) ``` **Edit** this is how you can use it ``` func textField(...
Try this ``` func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { if textField == pinCode { guard let text = textField.text else { return true } var txtAfterUpdate:NSString = textField.text! as NSString txtAfterUpdate = txtAfterUp...
41,255,609
I've a `UITextField` for entering pincode number. My requirement is when textField character range reach to 6th character then I've to do server validation and I have to put the data in labels. If character range is less than 5 then I will pass nil value. **Below is my code :-** ``` //TextField character range f...
2016/12/21
[ "https://Stackoverflow.com/questions/41255609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6624878/" ]
`shouldChangeCharactersIn` will get called prior to getting the actual text in the `UITextField` This is how you get the full text from that `UITextField` ``` let newString = NSString(string: textField.text!).replacingCharacters(in: range, with: string) ``` **Edit** this is how you can use it ``` func textField(...
Use **TextField** delegates method for this. ``` func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { let currentCharacterCount = textField.text?.characters.count ?? 0 if (range.length + range.location > currentCharacterCount+1) ...
41,255,609
I've a `UITextField` for entering pincode number. My requirement is when textField character range reach to 6th character then I've to do server validation and I have to put the data in labels. If character range is less than 5 then I will pass nil value. **Below is my code :-** ``` //TextField character range f...
2016/12/21
[ "https://Stackoverflow.com/questions/41255609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6624878/" ]
`shouldChangeCharactersIn` will get called prior to getting the actual text in the `UITextField` This is how you get the full text from that `UITextField` ``` let newString = NSString(string: textField.text!).replacingCharacters(in: range, with: string) ``` **Edit** this is how you can use it ``` func textField(...
You should get `newlength` from `textfield.text.length` + `string.length` then get the text from `textfield.text` + `string`. You can't get new text from `textfield.text` before call return true.
41,255,609
I've a `UITextField` for entering pincode number. My requirement is when textField character range reach to 6th character then I've to do server validation and I have to put the data in labels. If character range is less than 5 then I will pass nil value. **Below is my code :-** ``` //TextField character range f...
2016/12/21
[ "https://Stackoverflow.com/questions/41255609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6624878/" ]
Use **TextField** delegates method for this. ``` func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { let currentCharacterCount = textField.text?.characters.count ?? 0 if (range.length + range.location > currentCharacterCount+1) ...
Try this ``` func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { if textField == pinCode { guard let text = textField.text else { return true } var txtAfterUpdate:NSString = textField.text! as NSString txtAfterUpdate = txtAfterUp...
41,255,609
I've a `UITextField` for entering pincode number. My requirement is when textField character range reach to 6th character then I've to do server validation and I have to put the data in labels. If character range is less than 5 then I will pass nil value. **Below is my code :-** ``` //TextField character range f...
2016/12/21
[ "https://Stackoverflow.com/questions/41255609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6624878/" ]
You should get `newlength` from `textfield.text.length` + `string.length` then get the text from `textfield.text` + `string`. You can't get new text from `textfield.text` before call return true.
Try this ``` func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { if textField == pinCode { guard let text = textField.text else { return true } var txtAfterUpdate:NSString = textField.text! as NSString txtAfterUpdate = txtAfterUp...
53,108,494
Can someone help me get the latest date for each item id. This what I have so far: ``` select prod_order_number, location_id, prod_order_line_item_id, date_created, primary_bin from p21_view_asap_production_order ``` ![Picture of the output](https://i.stack.imgur.com/2DW1X.png)
2018/11/01
[ "https://Stackoverflow.com/questions/53108494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10593085/" ]
When you use `[]` in regex it takes any characters within literally. However `\n` and `\r` are a two-character string representation of a single control character. What you want instead is `r'(\n|\r)'`
`\r` and `\n` are character escapes, which means you can't split them around control characters in a regex. However, `r"([\r\n])"` works just fine.
53,108,494
Can someone help me get the latest date for each item id. This what I have so far: ``` select prod_order_number, location_id, prod_order_line_item_id, date_created, primary_bin from p21_view_asap_production_order ``` ![Picture of the output](https://i.stack.imgur.com/2DW1X.png)
2018/11/01
[ "https://Stackoverflow.com/questions/53108494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10593085/" ]
When you use `[]` in regex it takes any characters within literally. However `\n` and `\r` are a two-character string representation of a single control character. What you want instead is `r'(\n|\r)'`
Why regex? ``` crlf = set('\r\n') def contains_cr_lf(text): """Returns True if text includes linefeeds or carriage returns as characters.""" return any(x in crlf for x in text) for t in ["Some text \t without: ","""Some text with them: """]: print t, contains_cr_lf(t) ``` Result: ``` Some text wit...
43,549,556
I am using swift 3 and have a TableView, am I trying to fire a particular piece of code when the user is in the last row. For some reason it is completely ignoring that and not firing off . I have even put a breakpoint there and it does not hit it. This is what I have ``` func tableView(tableView: UITableView, willDis...
2017/04/21
[ "https://Stackoverflow.com/questions/43549556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5551912/" ]
Have you verified whether `willDisplay()` is being called? I suspect is isn't. `func tableView(UITableView, willDisplay: UITableViewCell, forRowAt: IndexPath)` is a `UITableViewDelegate` method. Your table view will not know to call it until you set it's delegate property, but I do not see where this is being done. Th...
You need to check for equality against `self.Locations.count - 1`. Since indexing starts from 0, the last item's `indexPath.row` will be 9 while Locations.count is 10. ``` if indexPath.row == self.Locations.count - 1 { print("Last Row") } ```
43,549,556
I am using swift 3 and have a TableView, am I trying to fire a particular piece of code when the user is in the last row. For some reason it is completely ignoring that and not firing off . I have even put a breakpoint there and it does not hit it. This is what I have ``` func tableView(tableView: UITableView, willDis...
2017/04/21
[ "https://Stackoverflow.com/questions/43549556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5551912/" ]
Have you verified whether `willDisplay()` is being called? I suspect is isn't. `func tableView(UITableView, willDisplay: UITableViewCell, forRowAt: IndexPath)` is a `UITableViewDelegate` method. Your table view will not know to call it until you set it's delegate property, but I do not see where this is being done. Th...
Try using ``` if indexPath.row == (self.Locations.count - 1) { print("Last Row") } ``` Its because count returns the number of items in the array, where as the index path returns the iteration, which starts at 0
19,362,887
I tried to setup codeception for my Symfony2 project which already has 4 working bundles and their PHPUnit testcases. Now I wanted to add codeception Testcases, especially for acceptance tests, but when I "bootstrapped" codeception I found all the generated code within my main structure. Since my application is already...
2013/10/14
[ "https://Stackoverflow.com/questions/19362887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1602476/" ]
the `max` command returns as a second argument the index of the max element. So, if you have three vecotrs **of the same size** representing `velocity`, `distance` and `time`, you can simply: ``` >> [mxv ii] = max( velocity ); % find max speed and its index >> [distance(ii), time(ii)] % distance and time correspond...
Assuming, ``` >> distance = [1:5]; % any array >> time=[11:15];% any array >> speed=distance./time; >> [max_speed,index]=max(speed); % max_speed Occurred at time(index), distance(index) ```
209,258
Can I open *http* links from a notepad++ document directly to my default web browser? Like textpad: CTRL + Click ?
2010/11/10
[ "https://superuser.com/questions/209258", "https://superuser.com", "https://superuser.com/users/41417/" ]
Since (at least) Notepad++ 6.3.3, the feature is enabled by default and it is sufficient to **double click** the link. Related [documentation](https://npp-user-manual.org/docs/preferences/). --- In Settings > Preferences > Cloud & Link > **Clickable Link Settings**, click ☒ Enable. Reload Notepad++ document to show ...
I have Notepad ++ 6.9.2. [Here](http://docs.notepad-plus-plus.org/index.php/Clickable_Links) is the answer provided by the "official" documentation. Starting from the Settings dropdown menu: [![The Notepad++ Clickable Link setting](https://i.stack.imgur.com/ZPrRw.jpg)](https://i.stack.imgur.com/ZPrRw.jpg) > > The `S...
209,258
Can I open *http* links from a notepad++ document directly to my default web browser? Like textpad: CTRL + Click ?
2010/11/10
[ "https://superuser.com/questions/209258", "https://superuser.com", "https://superuser.com/users/41417/" ]
Since (at least) Notepad++ 6.3.3, the feature is enabled by default and it is sufficient to **double click** the link. Related [documentation](https://npp-user-manual.org/docs/preferences/). --- In Settings > Preferences > Cloud & Link > **Clickable Link Settings**, click ☒ Enable. Reload Notepad++ document to show ...
Just as an update, in the current version (8.X) the option is under "Cloud/Link": [![enter image description here](https://i.stack.imgur.com/mvaFt.jpg)](https://i.stack.imgur.com/mvaFt.jpg)
209,258
Can I open *http* links from a notepad++ document directly to my default web browser? Like textpad: CTRL + Click ?
2010/11/10
[ "https://superuser.com/questions/209258", "https://superuser.com", "https://superuser.com/users/41417/" ]
I have Notepad ++ 6.9.2. [Here](http://docs.notepad-plus-plus.org/index.php/Clickable_Links) is the answer provided by the "official" documentation. Starting from the Settings dropdown menu: [![The Notepad++ Clickable Link setting](https://i.stack.imgur.com/ZPrRw.jpg)](https://i.stack.imgur.com/ZPrRw.jpg) > > The `S...
Just as an update, in the current version (8.X) the option is under "Cloud/Link": [![enter image description here](https://i.stack.imgur.com/mvaFt.jpg)](https://i.stack.imgur.com/mvaFt.jpg)
42,414,777
The first request works fine, but after another request I got this Error Message. My logic does not double request, but it looks like, that each route isn't called seperately. So the first request to `/api/user` works fine. After a refresh I got the error `Can't set headers after they are sent.` `res.end()` doesn't p...
2017/02/23
[ "https://Stackoverflow.com/questions/42414777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3903682/" ]
when you did `kubectl config delete-context cluster51`, this deleted the context from your `~/.kube/config`. Hence the error: ``` Error in configuration: context was not found for specified context: cluster51 ``` you can view the contents of the `~/.kube/config` file, or use the `kubectl config view` command to help...
`kubectl config delete-cluster my-cluster` doesn't delete your cluster, it only removes the entry from your `kubectl` configuration. The error you are getting suggests that you need to configure kubectl correctly in order to use it with your cluster. I suggest you read the [kubectl documentation](https://kubernetes.io/...
42,414,777
The first request works fine, but after another request I got this Error Message. My logic does not double request, but it looks like, that each route isn't called seperately. So the first request to `/api/user` works fine. After a refresh I got the error `Can't set headers after they are sent.` `res.end()` doesn't p...
2017/02/23
[ "https://Stackoverflow.com/questions/42414777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3903682/" ]
It's might help for a beginner who stuck here and getting below message in kubenetes CLR. [![enter image description here](https://i.stack.imgur.com/vNa2Z.png)](https://i.stack.imgur.com/vNa2Z.png)
`kubectl config delete-cluster my-cluster` doesn't delete your cluster, it only removes the entry from your `kubectl` configuration. The error you are getting suggests that you need to configure kubectl correctly in order to use it with your cluster. I suggest you read the [kubectl documentation](https://kubernetes.io/...
42,414,777
The first request works fine, but after another request I got this Error Message. My logic does not double request, but it looks like, that each route isn't called seperately. So the first request to `/api/user` works fine. After a refresh I got the error `Can't set headers after they are sent.` `res.end()` doesn't p...
2017/02/23
[ "https://Stackoverflow.com/questions/42414777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3903682/" ]
when you did `kubectl config delete-context cluster51`, this deleted the context from your `~/.kube/config`. Hence the error: ``` Error in configuration: context was not found for specified context: cluster51 ``` you can view the contents of the `~/.kube/config` file, or use the `kubectl config view` command to help...
It's might help for a beginner who stuck here and getting below message in kubenetes CLR. [![enter image description here](https://i.stack.imgur.com/vNa2Z.png)](https://i.stack.imgur.com/vNa2Z.png)
74,045,637
let's say I have a `ChildWidget()` and `ParentWidget()` and I want to say something like : * however, the parent width is, the child's width should be 20% of it example : if a parent has a `width: 200`, the child's width should be `width: 40`. and I want a way that's dynamic and not actually hardcoded values, so I w...
2022/10/12
[ "https://Stackoverflow.com/questions/74045637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18670641/" ]
Lets say your parent widget is this `container`: ``` Container( height: 200, width: 300, ), ``` you can do this to get its size: ``` Container( height: 200, width: 300, color: Colors.red, alignment: Alignment.center, // very important part is set alignment child: LayoutBuilder(builder: (context, ...
you should use the MediaQuery class like in the next example : ``` MediaQuery.of(context).size.width * .20 MediaQuery.of(context).size.height * .20 ``` this will give the width and the height for the parent child \* 20% * for getting the width and height of the parent widget you could use this way : you can put the...
74,045,637
let's say I have a `ChildWidget()` and `ParentWidget()` and I want to say something like : * however, the parent width is, the child's width should be 20% of it example : if a parent has a `width: 200`, the child's width should be `width: 40`. and I want a way that's dynamic and not actually hardcoded values, so I w...
2022/10/12
[ "https://Stackoverflow.com/questions/74045637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18670641/" ]
As pskink mentioned, `FractionallySizedBox` is handy in your case. ```dart class MyStatelessWidget extends StatelessWidget { const MyStatelessWidget({super.key}); @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Container( width: 400, hei...
you should use the MediaQuery class like in the next example : ``` MediaQuery.of(context).size.width * .20 MediaQuery.of(context).size.height * .20 ``` this will give the width and the height for the parent child \* 20% * for getting the width and height of the parent widget you could use this way : you can put the...
74,045,637
let's say I have a `ChildWidget()` and `ParentWidget()` and I want to say something like : * however, the parent width is, the child's width should be 20% of it example : if a parent has a `width: 200`, the child's width should be `width: 40`. and I want a way that's dynamic and not actually hardcoded values, so I w...
2022/10/12
[ "https://Stackoverflow.com/questions/74045637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18670641/" ]
As pskink mentioned, `FractionallySizedBox` is handy in your case. ```dart class MyStatelessWidget extends StatelessWidget { const MyStatelessWidget({super.key}); @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Container( width: 400, hei...
Lets say your parent widget is this `container`: ``` Container( height: 200, width: 300, ), ``` you can do this to get its size: ``` Container( height: 200, width: 300, color: Colors.red, alignment: Alignment.center, // very important part is set alignment child: LayoutBuilder(builder: (context, ...
988,153
In "Users and Groups", I see a "Guest User" listed there as "Login only". However I do not want this user account. When I try to uncheck the "Allow guests to login this computer" for this user, I found that checkbox is greyed out. So how can I disable or delete the guest user from my Macbook? I have FileVault and Fin...
2015/10/18
[ "https://superuser.com/questions/988153", "https://superuser.com", "https://superuser.com/users/510794/" ]
Not sure why it's greyed out - assuming you are running from an admin account & have unlocked the padlock, bottom left, then you should have control over the guest account. However, if it shows Login only, then parental control is off for that account, otherwise it would say Enabled, Managed. [![enter image descript...
I don't know if this will help but better try it for you to know. Try activating back your filevault, never mind the find my mac, and then go to the Users and Groups. Now, click the Guest User, be sure that the lock is unlocked and after that uncheck the "Allow guests to log in to this computer". After successfully un...
30,771,883
table contains a record of `name` `salary` like this I want a deduction of 5000 from every employee. If the `salary < 0` then i need to display **"insuffiecient for deduction"** if `salary > 0` then **" can be deducted"** This is the images of the table. ![enter image description here](https://i.stack.imgur.com/kP7...
2015/06/11
[ "https://Stackoverflow.com/questions/30771883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4985282/" ]
Try this solution, i have added case when, which will help you. **Note:** you can add the field as per your requirement ``` SELECT Emno, EmName, CASE WHEN sal < 0 THEN "insuffiecient for deduction" ELSE "can be deducted" END As Status FROM tablename ```
Try the query below: ``` SELECT `name`, `sal`, IF((`sal`-5000)<0,'insufficient for deduction','can be deducted') AS `status` FROM `employee`; ``` I only use the `name` and `sal` field since this two fields are only needed to solve your problem. The formula used was: ``` (`sal`-5000)<0 ``` which means that the sa...
12,797,025
I am creating an app in which I am loading 800 jpg images for the Imageview.On occurance of different enevts different set of images are to be loaded for animation.on fire of first event it works fine but on 2nd event it crashes on iPhone.Any help? my part of code is as below ``` for (int aniCount = 1; aniCount < 480;...
2012/10/09
[ "https://Stackoverflow.com/questions/12797025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1699321/" ]
Assuming you are not using HTML5, `id` attributes cannot start with numbers. Try using another identifier, such as `el2`. *Update* Actually, the problem is because `div` elements are not valid in a `tr`, so the browser is removing them, hence the `#2` selector finds nothing to hide. The best alternative is to add a...
Why don't you give the `<TH>` elements a css class and hide them, instead of introducing DIVs in the middle of a table, e.g: ``` <script> $(document).ready(function(){ $(".th2").hide(); $(".th3").hide(); }); </script> ``` HTML ``` <div align="center"> <table width="10%" border="0" cellsp...
12,797,025
I am creating an app in which I am loading 800 jpg images for the Imageview.On occurance of different enevts different set of images are to be loaded for animation.on fire of first event it works fine but on 2nd event it crashes on iPhone.Any help? my part of code is as below ``` for (int aniCount = 1; aniCount < 480;...
2012/10/09
[ "https://Stackoverflow.com/questions/12797025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1699321/" ]
Assuming you are not using HTML5, `id` attributes cannot start with numbers. Try using another identifier, such as `el2`. *Update* Actually, the problem is because `div` elements are not valid in a `tr`, so the browser is removing them, hence the `#2` selector finds nothing to hide. The best alternative is to add a...
``` Please change Div to table and add jqury.js link to page and test it : <head> <title></title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $("#div2").hide(); $("#div3").hide(); ...
12,797,025
I am creating an app in which I am loading 800 jpg images for the Imageview.On occurance of different enevts different set of images are to be loaded for animation.on fire of first event it works fine but on 2nd event it crashes on iPhone.Any help? my part of code is as below ``` for (int aniCount = 1; aniCount < 480;...
2012/10/09
[ "https://Stackoverflow.com/questions/12797025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1699321/" ]
Why don't you give the `<TH>` elements a css class and hide them, instead of introducing DIVs in the middle of a table, e.g: ``` <script> $(document).ready(function(){ $(".th2").hide(); $(".th3").hide(); }); </script> ``` HTML ``` <div align="center"> <table width="10%" border="0" cellsp...
``` Please change Div to table and add jqury.js link to page and test it : <head> <title></title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $("#div2").hide(); $("#div3").hide(); ...
30,094,806
I'm trying to get the style of an option when it is selected to set this style to the select (parent) element. I can't get the style of the select option whn selected. Only it's value is available... Is there a way to get that in Angular? Please find code below, need some help. ``` <div ng-controller="MyController">...
2015/05/07
[ "https://Stackoverflow.com/questions/30094806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1824508/" ]
Here goes my solution, I created sample Action with AJAX Calls. **Let Controller Action be -** ``` [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)] public JsonResult Data(int id, string s) { return Json("Test", JsonRequestBehavior.AllowGet); } ``` **let the buttons in HTML be -** ``` <input type="button" value=...
For the GET method you have to set `JsonRequestBehavior.AllowGet` in your controller ``` return Json(chartData, JsonRequestBehavior.AllowGet); ``` So: ``` [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)] public JsonResult chartData(int id, int WeatherAll,int paramSites) { string ids = Convert.ToString(id) + Co...
51,759,504
I need one help. In our application we are deleting some directory and files from disk space through a job Sometime this job takes much time due to large number of directories and meanwhile that job gets triggerred for second time and its trying to delete some files which are already deleted by the first job. As a re...
2018/08/09
[ "https://Stackoverflow.com/questions/51759504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3514736/" ]
Consider having null check like: ``` Files.walk(rootPath) .filter(Objects:notNull) .sorted(Comparator.reverseOrder()) .map(Path::toFile) .peek(System.out::println) .forEach(java.io.File::delete); ``` But not sure how would Files.walk yield a null object.
forEach is a method which runs if there is data i.e in your case files , if there is no file then control will come out of forEach. We do not need to check for null inside forEach.
51,759,504
I need one help. In our application we are deleting some directory and files from disk space through a job Sometime this job takes much time due to large number of directories and meanwhile that job gets triggerred for second time and its trying to delete some files which are already deleted by the first job. As a re...
2018/08/09
[ "https://Stackoverflow.com/questions/51759504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3514736/" ]
Consider having null check like: ``` Files.walk(rootPath) .filter(Objects:notNull) .sorted(Comparator.reverseOrder()) .map(Path::toFile) .peek(System.out::println) .forEach(java.io.File::delete); ``` But not sure how would Files.walk yield a null object.
There is not null check. foreach construct in java is great candidate for NullPointerException ``` File[] files = null; for (File file : files) { deleteFile(file); } ``` You should allways check !!! ``` if(files !=null) { for (File file : files) { deleteFile(file); } } ``` see [How does ...
5,332
The phenomenon of high temperature superconductivity has been known for decades, particularly layered cuprate superconductors. We know the precise lattice structure of the materials. We know the band theory of electrons and how electronic orbitals mix. But yet, theoreticians still haven't solved high Tc superconductivi...
2011/02/17
[ "https://physics.stackexchange.com/questions/5332", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/1978/" ]
One problem is that band theory isn't everything! Crucially, band theory completely neglects the interactions between electrons. The fact that often one can do this and obtain near correct results is actually amazing, and worth several lecture courses to flesh out the reasons. However, it cannot always be correct. In m...
For strongly correlated systems — where perturbation theory and mean field theory breaks down — even if you know the exact form of the Hamiltonian, and regulate it over a lattice, it can still be extremely difficult to compute the ground state, or even figure out its qualitative behavior. Being a quantum system, we ca...
5,332
The phenomenon of high temperature superconductivity has been known for decades, particularly layered cuprate superconductors. We know the precise lattice structure of the materials. We know the band theory of electrons and how electronic orbitals mix. But yet, theoreticians still haven't solved high Tc superconductivi...
2011/02/17
[ "https://physics.stackexchange.com/questions/5332", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/1978/" ]
One problem is that band theory isn't everything! Crucially, band theory completely neglects the interactions between electrons. The fact that often one can do this and obtain near correct results is actually amazing, and worth several lecture courses to flesh out the reasons. However, it cannot always be correct. In m...
In perturbation theory, we split the Hamiltonian into a "free" part, and an "interacting" part, with the magnitude of the interacting part being much smaller than that of the free part. If there are no degeneracies in the free Hamiltonian — at least for the ground state which we're interested in — the analysis is relat...
5,332
The phenomenon of high temperature superconductivity has been known for decades, particularly layered cuprate superconductors. We know the precise lattice structure of the materials. We know the band theory of electrons and how electronic orbitals mix. But yet, theoreticians still haven't solved high Tc superconductivi...
2011/02/17
[ "https://physics.stackexchange.com/questions/5332", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/1978/" ]
In perturbation theory, we split the Hamiltonian into a "free" part, and an "interacting" part, with the magnitude of the interacting part being much smaller than that of the free part. If there are no degeneracies in the free Hamiltonian — at least for the ground state which we're interested in — the analysis is relat...
For strongly correlated systems — where perturbation theory and mean field theory breaks down — even if you know the exact form of the Hamiltonian, and regulate it over a lattice, it can still be extremely difficult to compute the ground state, or even figure out its qualitative behavior. Being a quantum system, we ca...
48,394,043
I have the latest version of Python installed. Will `from __future__ import...` statements have any effect at all? Is there any "future" beyond the most up-to-date version that I should know about - a "pre-release" or beta version not obvious to newcomers perhaps? I ask because I'm working through [This introductory t...
2018/01/23
[ "https://Stackoverflow.com/questions/48394043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1099237/" ]
You can use `map` for this. Here is a fiddle: ```js var data = [{ "Month": "Jan 2017 - Check", "balance": "0.00" }, { "Month": "Jan", "balance": "0.00" }, { "Month": "Feb 2017 - Check", "balance": "0.00" }, { "Month": "Feb", "balance": "0.00" }, { "Month": "Mar...
You can use JQUERY for this. Here is a fiddle: ```html <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function () { var data = [{ "Month": "Jan 2017 - Check", ...
38,600,898
I've recently been creating a text adventure game but almost immediately ran into a problem with the input. It is giving me error messages when I use strings instead of integers. There is probably an obvious reason that this is happening and I'm just not seeing it. Here's an example: ``` b = input("Do you like vi...
2016/07/26
[ "https://Stackoverflow.com/questions/38600898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You're passing `&payperhour[p]` as `payperhour` and then using `payperhour[p]`. Note that `(&payperhour[p])[p]` is the same as `payperhour[p+p]` or `payperhour[p*2]`. It looks like you want to call the function like this: ``` calculate(payperhour, hoursworked, wage, overtime, p); ```
You're confusing a few different things here. First, the calling loop: ``` for (p = 0; p <= 4; p) { calculate(&payperhour[p], &hoursworked[p], &wage[p], &overtime[p], p); p++; } ``` This steps through the individual people, and passes their details to `calculate(...)`. There is no need to pass `p` in - you'v...
38,600,898
I've recently been creating a text adventure game but almost immediately ran into a problem with the input. It is giving me error messages when I use strings instead of integers. There is probably an obvious reason that this is happening and I'm just not seeing it. Here's an example: ``` b = input("Do you like vi...
2016/07/26
[ "https://Stackoverflow.com/questions/38600898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You're passing `&payperhour[p]` as `payperhour` and then using `payperhour[p]`. Note that `(&payperhour[p])[p]` is the same as `payperhour[p+p]` or `payperhour[p*2]`. It looks like you want to call the function like this: ``` calculate(payperhour, hoursworked, wage, overtime, p); ```
Since `calculate` reads the `p`th entries of the arrays, the base address of the arrays should be passed. It should be invoked as: ``` calculate(payperhour, hoursworked, wage, overtime, p); ``` The syntax in your loop is confusing and likely incorrect: ``` for (p = 0; p <= 4; p) { calculate(&payperhour[p], &hou...
6,083,520
Is there a marker bar component for a C# application what i could use in my application? As marker bar i mean something like *ReSharper* adds to Visual Studio:![enter image description here](https://i.stack.imgur.com/062fy.png) Another example for something similar (the bar on the left): ![enter image description here...
2011/05/21
[ "https://Stackoverflow.com/questions/6083520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/655134/" ]
In WPF the bar is a bit like a ListBox with just a different way of displaying a 1 pixel high line for each line of text. The state of the line would influence the color of the line and selecting a line would raise the SelectionChanged event to which the textbox could respond. Let me know if you want me to show a prot...
You could use the Graphics class on a panel to paint it yourself. <http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx> (I wouldn't use a bar graph as Teoman Soygul suggested, that's abusing components for something they aren't supposed to do. Same with the listbox idea by Erno. List boxes are made f...
72,581,446
``` function arraysCommon(array1, array2) { return array1.filter(x => array2.includes(x)); } ``` This function does not work the way I want it to. For instance given `array1 = [1,2,3,2,1]` and `array2 = [5,4,3,2,1]` it returns `[1,2,3,2,1]`, since the elements `1,2,3` are seen in both arrays. But I want it to retur...
2022/06/11
[ "https://Stackoverflow.com/questions/72581446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19317513/" ]
Unfortunately, it gets more complicated because you need to know what numbers you have already added. In this case you need a temporary array to hold the result. We also need to track if a number exists in the array two times. Try this: ```js function arraysCommon(array1, array2) { //Copy array2 by duplicating and ...
You can instance a new Set, wich brings only unique values and than retorn a array from this set. Something like this: ``` function arraysCommon(array1, array2) { const filtered = array1.filter(x => array2.includes(x)); const uniqueValues = new Set(filtered) return Array.from(uniqueValues) } ```
72,581,446
``` function arraysCommon(array1, array2) { return array1.filter(x => array2.includes(x)); } ``` This function does not work the way I want it to. For instance given `array1 = [1,2,3,2,1]` and `array2 = [5,4,3,2,1]` it returns `[1,2,3,2,1]`, since the elements `1,2,3` are seen in both arrays. But I want it to retur...
2022/06/11
[ "https://Stackoverflow.com/questions/72581446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19317513/" ]
Unfortunately, it gets more complicated because you need to know what numbers you have already added. In this case you need a temporary array to hold the result. We also need to track if a number exists in the array two times. Try this: ```js function arraysCommon(array1, array2) { //Copy array2 by duplicating and ...
this should work as you wanted! ``` // test 1 const array1 = [1,4,1,1,5,9,2,7]; const array2 = [1,8,2,5,1]; // test 2 const array3 = [1,2,3,2,1]; const array4 = [5,4,3,2,1]; const mapper = (array1, array2) => { var obj = {}; array1.forEach((x, indexX) => { array2.forEach((y, indexY) => { if (x == y) {...
72,581,446
``` function arraysCommon(array1, array2) { return array1.filter(x => array2.includes(x)); } ``` This function does not work the way I want it to. For instance given `array1 = [1,2,3,2,1]` and `array2 = [5,4,3,2,1]` it returns `[1,2,3,2,1]`, since the elements `1,2,3` are seen in both arrays. But I want it to retur...
2022/06/11
[ "https://Stackoverflow.com/questions/72581446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19317513/" ]
Unfortunately, it gets more complicated because you need to know what numbers you have already added. In this case you need a temporary array to hold the result. We also need to track if a number exists in the array two times. Try this: ```js function arraysCommon(array1, array2) { //Copy array2 by duplicating and ...
With sorting and counting this should be possible. Since you are incrementing when you find similar characters, this should be okay: ```js const array1= [1,4,1,1,5,9,2,7]; const array2 = [1,8,2,5,1] const array3 = [1,2,3,2,1]; const array4 = [5,4,3,2,1,2] const array5 = [1,2,3,2,1]; const array6 = [2,2,3,3,4] functi...
72,581,446
``` function arraysCommon(array1, array2) { return array1.filter(x => array2.includes(x)); } ``` This function does not work the way I want it to. For instance given `array1 = [1,2,3,2,1]` and `array2 = [5,4,3,2,1]` it returns `[1,2,3,2,1]`, since the elements `1,2,3` are seen in both arrays. But I want it to retur...
2022/06/11
[ "https://Stackoverflow.com/questions/72581446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19317513/" ]
this should work as you wanted! ``` // test 1 const array1 = [1,4,1,1,5,9,2,7]; const array2 = [1,8,2,5,1]; // test 2 const array3 = [1,2,3,2,1]; const array4 = [5,4,3,2,1]; const mapper = (array1, array2) => { var obj = {}; array1.forEach((x, indexX) => { array2.forEach((y, indexY) => { if (x == y) {...
You can instance a new Set, wich brings only unique values and than retorn a array from this set. Something like this: ``` function arraysCommon(array1, array2) { const filtered = array1.filter(x => array2.includes(x)); const uniqueValues = new Set(filtered) return Array.from(uniqueValues) } ```
72,581,446
``` function arraysCommon(array1, array2) { return array1.filter(x => array2.includes(x)); } ``` This function does not work the way I want it to. For instance given `array1 = [1,2,3,2,1]` and `array2 = [5,4,3,2,1]` it returns `[1,2,3,2,1]`, since the elements `1,2,3` are seen in both arrays. But I want it to retur...
2022/06/11
[ "https://Stackoverflow.com/questions/72581446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19317513/" ]
With sorting and counting this should be possible. Since you are incrementing when you find similar characters, this should be okay: ```js const array1= [1,4,1,1,5,9,2,7]; const array2 = [1,8,2,5,1] const array3 = [1,2,3,2,1]; const array4 = [5,4,3,2,1,2] const array5 = [1,2,3,2,1]; const array6 = [2,2,3,3,4] functi...
You can instance a new Set, wich brings only unique values and than retorn a array from this set. Something like this: ``` function arraysCommon(array1, array2) { const filtered = array1.filter(x => array2.includes(x)); const uniqueValues = new Set(filtered) return Array.from(uniqueValues) } ```
1,752,357
I currently have a Perl script that runs an external command on the system, gathers the output, and performs some action based on what was returned. Right now, here is how I run this (where $cmd is a string with the command setup): ``` @output = `$cmd`; ``` I'd like to change this so if the command hangs and does no...
2009/11/17
[ "https://Stackoverflow.com/questions/1752357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21987/" ]
There's a LOT of ways to do this: * You can do this with a fork (perldoc -f fork) * or using threads (perldoc threads). Both of these make passing the returned information back to the main program difficult. * On systems that support it, you can set an alarm (perldoc -f alarm) and then clean up in the signal handler. ...
If your external program doesn't take any input, look for the following words in the `perlipc` manpage: > > Here's a safe backtick or pipe open for read: > > > Use the example code and guard it with an alarm (which is also explained in `perlipc`).
1,752,357
I currently have a Perl script that runs an external command on the system, gathers the output, and performs some action based on what was returned. Right now, here is how I run this (where $cmd is a string with the command setup): ``` @output = `$cmd`; ``` I'd like to change this so if the command hangs and does no...
2009/11/17
[ "https://Stackoverflow.com/questions/1752357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21987/" ]
There's a LOT of ways to do this: * You can do this with a fork (perldoc -f fork) * or using threads (perldoc threads). Both of these make passing the returned information back to the main program difficult. * On systems that support it, you can set an alarm (perldoc -f alarm) and then clean up in the signal handler. ...
I coded below to run `rsync` on 20 directories simultaneously (in parallel instead of sequentially requiring me to wait hours for it to complete): ```perl use threads; for my $user ( keys %users ) { my $host = $users{$user}; async { system <<~ "SHELL"; ssh $host \\ rsync_user $user SHELL ...
1,752,357
I currently have a Perl script that runs an external command on the system, gathers the output, and performs some action based on what was returned. Right now, here is how I run this (where $cmd is a string with the command setup): ``` @output = `$cmd`; ``` I'd like to change this so if the command hangs and does no...
2009/11/17
[ "https://Stackoverflow.com/questions/1752357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21987/" ]
If you really just need to put a timeout on a given system call that is a much simpler problem than asynchronous programming. All you need is alarm() inside of an eval() block. Here is a sample code block that puts these into a subroutine that you could drop into your code. The example calls sleep so isn't exciting ...
If your external program doesn't take any input, look for the following words in the `perlipc` manpage: > > Here's a safe backtick or pipe open for read: > > > Use the example code and guard it with an alarm (which is also explained in `perlipc`).
1,752,357
I currently have a Perl script that runs an external command on the system, gathers the output, and performs some action based on what was returned. Right now, here is how I run this (where $cmd is a string with the command setup): ``` @output = `$cmd`; ``` I'd like to change this so if the command hangs and does no...
2009/11/17
[ "https://Stackoverflow.com/questions/1752357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21987/" ]
If your external program doesn't take any input, look for the following words in the `perlipc` manpage: > > Here's a safe backtick or pipe open for read: > > > Use the example code and guard it with an alarm (which is also explained in `perlipc`).
I coded below to run `rsync` on 20 directories simultaneously (in parallel instead of sequentially requiring me to wait hours for it to complete): ```perl use threads; for my $user ( keys %users ) { my $host = $users{$user}; async { system <<~ "SHELL"; ssh $host \\ rsync_user $user SHELL ...
1,752,357
I currently have a Perl script that runs an external command on the system, gathers the output, and performs some action based on what was returned. Right now, here is how I run this (where $cmd is a string with the command setup): ``` @output = `$cmd`; ``` I'd like to change this so if the command hangs and does no...
2009/11/17
[ "https://Stackoverflow.com/questions/1752357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21987/" ]
If you really just need to put a timeout on a given system call that is a much simpler problem than asynchronous programming. All you need is alarm() inside of an eval() block. Here is a sample code block that puts these into a subroutine that you could drop into your code. The example calls sleep so isn't exciting ...
I coded below to run `rsync` on 20 directories simultaneously (in parallel instead of sequentially requiring me to wait hours for it to complete): ```perl use threads; for my $user ( keys %users ) { my $host = $users{$user}; async { system <<~ "SHELL"; ssh $host \\ rsync_user $user SHELL ...
158,329
I feel that this must be a common and easy feature on the iPhone. I am looking for the ability to map between two distinct points on the iPhone by thumbtack. I understand you can do it via explicit address, but this is not often at hand and this method runs against several use cases (e.g. Mapping run route). How to d...
2014/11/27
[ "https://apple.stackexchange.com/questions/158329", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/102500/" ]
1. Drop a pin and add the location to your bookmarks. 2. Drop another pin and tap the directions button. 3. Select the first location as the location in your bookmarks and the second location should already be set to the second dropped pin location.
My final method. 1. Open location A, copy the address. 2. Open location B 3. Click 'Directions to Here' 4. Paste into 'Start' location A. Done! I dislike that Apple does not have a feature set to address this and recommend its addition if possible.
158,329
I feel that this must be a common and easy feature on the iPhone. I am looking for the ability to map between two distinct points on the iPhone by thumbtack. I understand you can do it via explicit address, but this is not often at hand and this method runs against several use cases (e.g. Mapping run route). How to d...
2014/11/27
[ "https://apple.stackexchange.com/questions/158329", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/102500/" ]
1. Drop a pin and add the location to your bookmarks. 2. Drop another pin and tap the directions button. 3. Select the first location as the location in your bookmarks and the second location should already be set to the second dropped pin location.
It can be done for walking routes etc in iOS 16.1 and maybe other iOS': 1. In Maps, create two or more **Favourites**. 2. Select a Favourite. A route is created between it and your current location. 3. Change travel method to **Drive**. 4. Select **Add Stop**. 5. Select another Favourite. 6. Select and hold **My Locat...
158,329
I feel that this must be a common and easy feature on the iPhone. I am looking for the ability to map between two distinct points on the iPhone by thumbtack. I understand you can do it via explicit address, but this is not often at hand and this method runs against several use cases (e.g. Mapping run route). How to d...
2014/11/27
[ "https://apple.stackexchange.com/questions/158329", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/102500/" ]
My final method. 1. Open location A, copy the address. 2. Open location B 3. Click 'Directions to Here' 4. Paste into 'Start' location A. Done! I dislike that Apple does not have a feature set to address this and recommend its addition if possible.
It can be done for walking routes etc in iOS 16.1 and maybe other iOS': 1. In Maps, create two or more **Favourites**. 2. Select a Favourite. A route is created between it and your current location. 3. Change travel method to **Drive**. 4. Select **Add Stop**. 5. Select another Favourite. 6. Select and hold **My Locat...
32,737,987
I want to the longest name for 5 given names. I think I should use `compareTo()` method or `length()`? Output must be like this : ``` enter 5 names : Joey Mark Catherine Zachery Foster Longest name is Catherine. ``` What method should I use and how? This is my code so far: ``` Scanner x = new Scanner(System.in); ...
2015/09/23
[ "https://Stackoverflow.com/questions/32737987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5366195/" ]
`.compareTo` tells you which string comes first in lexicographic order (<0 if s1 < s2, 0 if s1==s2, >0 if s1>s2) ``` String s1 = "abc"; String s2 = "def"; s1.compareTo(s2) < 0; ``` `.length()` returns the length of a string ``` s1.length()==3; ``` In your case, you need to compare based on length, so you need the...
Here's a solution that should work with any number of entries: ``` Scanner x = new Scanner(System.in); String name = "", temp=""; while (x.hasNextLine()){ temp = x.nextLine(); if (temp.length() > name.length()) name = temp; } System.out.println("Longest is " + name); ``` You'll need to `Ctrl` + `Z` to end ...
32,737,987
I want to the longest name for 5 given names. I think I should use `compareTo()` method or `length()`? Output must be like this : ``` enter 5 names : Joey Mark Catherine Zachery Foster Longest name is Catherine. ``` What method should I use and how? This is my code so far: ``` Scanner x = new Scanner(System.in); ...
2015/09/23
[ "https://Stackoverflow.com/questions/32737987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5366195/" ]
`.compareTo` tells you which string comes first in lexicographic order (<0 if s1 < s2, 0 if s1==s2, >0 if s1>s2) ``` String s1 = "abc"; String s2 = "def"; s1.compareTo(s2) < 0; ``` `.length()` returns the length of a string ``` s1.length()==3; ``` In your case, you need to compare based on length, so you need the...
What about this? ``` Scanner in = new Scanner(System.in); // no need to have 5 all over the code. // Define it once to avoid "magic nubmers" int namesCount = 5; // fun fact: shortest name is always "". We don't have to use null String longestName = ""; System.out.print("Enter " + nameCount + " names:"); for (int i=0; ...
32,737,987
I want to the longest name for 5 given names. I think I should use `compareTo()` method or `length()`? Output must be like this : ``` enter 5 names : Joey Mark Catherine Zachery Foster Longest name is Catherine. ``` What method should I use and how? This is my code so far: ``` Scanner x = new Scanner(System.in); ...
2015/09/23
[ "https://Stackoverflow.com/questions/32737987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5366195/" ]
`.compareTo` tells you which string comes first in lexicographic order (<0 if s1 < s2, 0 if s1==s2, >0 if s1>s2) ``` String s1 = "abc"; String s2 = "def"; s1.compareTo(s2) < 0; ``` `.length()` returns the length of a string ``` s1.length()==3; ``` In your case, you need to compare based on length, so you need the...
An easy way would be a `for` loop to read 5 names and find the length for largest name. Using the `for` loop avoids the creation of 5 deterrent string variables. If you want to use those names later you can go for `String` array. ``` public static void main(String[] args) throws IOException { Scanner x = new Scan...
32,737,987
I want to the longest name for 5 given names. I think I should use `compareTo()` method or `length()`? Output must be like this : ``` enter 5 names : Joey Mark Catherine Zachery Foster Longest name is Catherine. ``` What method should I use and how? This is my code so far: ``` Scanner x = new Scanner(System.in); ...
2015/09/23
[ "https://Stackoverflow.com/questions/32737987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5366195/" ]
`.compareTo` tells you which string comes first in lexicographic order (<0 if s1 < s2, 0 if s1==s2, >0 if s1>s2) ``` String s1 = "abc"; String s2 = "def"; s1.compareTo(s2) < 0; ``` `.length()` returns the length of a string ``` s1.length()==3; ``` In your case, you need to compare based on length, so you need the...
``` import java.util.Scanner; public class LenghtyName { public static void main(String[] args) { Scanner x = new Scanner(System.in); /* Instead of declaring 5 different String variable just use String array with size = 5 */ String[] names = new String[5]; ...
32,737,987
I want to the longest name for 5 given names. I think I should use `compareTo()` method or `length()`? Output must be like this : ``` enter 5 names : Joey Mark Catherine Zachery Foster Longest name is Catherine. ``` What method should I use and how? This is my code so far: ``` Scanner x = new Scanner(System.in); ...
2015/09/23
[ "https://Stackoverflow.com/questions/32737987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5366195/" ]
`.compareTo` tells you which string comes first in lexicographic order (<0 if s1 < s2, 0 if s1==s2, >0 if s1>s2) ``` String s1 = "abc"; String s2 = "def"; s1.compareTo(s2) < 0; ``` `.length()` returns the length of a string ``` s1.length()==3; ``` In your case, you need to compare based on length, so you need the...
Here's a solution that should work: ``` public class LongestWord { public static String getLongestString(String[] array) { int maxLength = 0; String longestString = null; for (String s : array) { if (s.length() > maxLength) { maxLength = s.length(); ...
32,737,987
I want to the longest name for 5 given names. I think I should use `compareTo()` method or `length()`? Output must be like this : ``` enter 5 names : Joey Mark Catherine Zachery Foster Longest name is Catherine. ``` What method should I use and how? This is my code so far: ``` Scanner x = new Scanner(System.in); ...
2015/09/23
[ "https://Stackoverflow.com/questions/32737987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5366195/" ]
`.compareTo` tells you which string comes first in lexicographic order (<0 if s1 < s2, 0 if s1==s2, >0 if s1>s2) ``` String s1 = "abc"; String s2 = "def"; s1.compareTo(s2) < 0; ``` `.length()` returns the length of a string ``` s1.length()==3; ``` In your case, you need to compare based on length, so you need the...
this is my code for comparing 3 input strings by their length: ``` public static void main(String[] args) { String string1 , string2 , string3; Scanner input = new Scanner(System.in); System.out.println("Enter three string names to compare"); string1 = input.nextLine(); string2 = input.nextLine()...
32,737,987
I want to the longest name for 5 given names. I think I should use `compareTo()` method or `length()`? Output must be like this : ``` enter 5 names : Joey Mark Catherine Zachery Foster Longest name is Catherine. ``` What method should I use and how? This is my code so far: ``` Scanner x = new Scanner(System.in); ...
2015/09/23
[ "https://Stackoverflow.com/questions/32737987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5366195/" ]
`.compareTo` tells you which string comes first in lexicographic order (<0 if s1 < s2, 0 if s1==s2, >0 if s1>s2) ``` String s1 = "abc"; String s2 = "def"; s1.compareTo(s2) < 0; ``` `.length()` returns the length of a string ``` s1.length()==3; ``` In your case, you need to compare based on length, so you need the...
``` //SIMPLE JAVA SOLUTION class GFG { String longest(String names[], int n) { String res=""; for(int i=0;i<n;i++) { if(res.length()<names[i].length()) { res=names[i]; } } return res; } } ```
13,168,258
So in this program there are bank accounts and I'm working on a method that allows users to change their balance this is what I have: ``` public double modifyBalance(int accountID, double adjustment) { Account temp = findAccount(accountID, 0, size, lastPos); double currBal = temp.getBalance(); ...
2012/10/31
[ "https://Stackoverflow.com/questions/13168258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1354836/" ]
I'd use `zip()`: ``` In [25]: l1 = [('a', 2), ('b', 3), ('z', 5)] In [26]: l2 = [('a', 1), ('b', 2), ('c', 3)] In [27]: [x[0] for x,y in zip(l1,l2) if x[0]==y[0]] Out[27]: ['a', 'b'] ``` **EDIT:** After reading your comment above it looks like you're looking for something like this: ``` In [36]: [x[0] for x in l1...
I think you want to use [`set`](http://docs.python.org/2/library/stdtypes.html#set)s here: ``` set(x[0] for x in list1).intersection(y[0] for y in list2) ``` or using syntactic sugar: ``` {x[0] for x in list1} & {y[0] for y in list2} ``` Both of which result in: ``` set(['a', 'b']) ```
13,168,258
So in this program there are bank accounts and I'm working on a method that allows users to change their balance this is what I have: ``` public double modifyBalance(int accountID, double adjustment) { Account temp = findAccount(accountID, 0, size, lastPos); double currBal = temp.getBalance(); ...
2012/10/31
[ "https://Stackoverflow.com/questions/13168258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1354836/" ]
I'd use `zip()`: ``` In [25]: l1 = [('a', 2), ('b', 3), ('z', 5)] In [26]: l2 = [('a', 1), ('b', 2), ('c', 3)] In [27]: [x[0] for x,y in zip(l1,l2) if x[0]==y[0]] Out[27]: ['a', 'b'] ``` **EDIT:** After reading your comment above it looks like you're looking for something like this: ``` In [36]: [x[0] for x in l1...
I think it is probably clearer to use sets here (since you have no duplicate elements): ``` set1 = set( el[0] for el in list1 ) set2 = set( el[0] for el in list2 ) set3 = set1 & set2 # set intersection # list3 = list(set3) ```
13,168,258
So in this program there are bank accounts and I'm working on a method that allows users to change their balance this is what I have: ``` public double modifyBalance(int accountID, double adjustment) { Account temp = findAccount(accountID, 0, size, lastPos); double currBal = temp.getBalance(); ...
2012/10/31
[ "https://Stackoverflow.com/questions/13168258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1354836/" ]
I'd use `zip()`: ``` In [25]: l1 = [('a', 2), ('b', 3), ('z', 5)] In [26]: l2 = [('a', 1), ('b', 2), ('c', 3)] In [27]: [x[0] for x,y in zip(l1,l2) if x[0]==y[0]] Out[27]: ['a', 'b'] ``` **EDIT:** After reading your comment above it looks like you're looking for something like this: ``` In [36]: [x[0] for x in l1...
Assuming that you want the set intersection of the first elements of the tuples, you can use the dictionary key views introduced in Python 2.7: ``` dict(list1).viewkeys() & dict(list2).viewkeys() ``` This will be much more efficient than your solution for long lists, since it has linear runtime (as opposed to O(mn) ...
13,168,258
So in this program there are bank accounts and I'm working on a method that allows users to change their balance this is what I have: ``` public double modifyBalance(int accountID, double adjustment) { Account temp = findAccount(accountID, 0, size, lastPos); double currBal = temp.getBalance(); ...
2012/10/31
[ "https://Stackoverflow.com/questions/13168258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1354836/" ]
I think you want to use [`set`](http://docs.python.org/2/library/stdtypes.html#set)s here: ``` set(x[0] for x in list1).intersection(y[0] for y in list2) ``` or using syntactic sugar: ``` {x[0] for x in list1} & {y[0] for y in list2} ``` Both of which result in: ``` set(['a', 'b']) ```
Assuming that you want the set intersection of the first elements of the tuples, you can use the dictionary key views introduced in Python 2.7: ``` dict(list1).viewkeys() & dict(list2).viewkeys() ``` This will be much more efficient than your solution for long lists, since it has linear runtime (as opposed to O(mn) ...
13,168,258
So in this program there are bank accounts and I'm working on a method that allows users to change their balance this is what I have: ``` public double modifyBalance(int accountID, double adjustment) { Account temp = findAccount(accountID, 0, size, lastPos); double currBal = temp.getBalance(); ...
2012/10/31
[ "https://Stackoverflow.com/questions/13168258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1354836/" ]
I think it is probably clearer to use sets here (since you have no duplicate elements): ``` set1 = set( el[0] for el in list1 ) set2 = set( el[0] for el in list2 ) set3 = set1 & set2 # set intersection # list3 = list(set3) ```
Assuming that you want the set intersection of the first elements of the tuples, you can use the dictionary key views introduced in Python 2.7: ``` dict(list1).viewkeys() & dict(list2).viewkeys() ``` This will be much more efficient than your solution for long lists, since it has linear runtime (as opposed to O(mn) ...
223,096
I'm writing a function to stringify a nested struct. I'm using [`snprintf` to pre-calculate how much space I'll need](https://stackoverflow.com/a/32819876/3000206) to allocate. The problem is, it's extremely repetitious, and will only get worse if I ever need to add more fields to any of the structs. The duplication a...
2019/06/27
[ "https://codereview.stackexchange.com/questions/223096", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/46840/" ]
@vnp's code is solid and helpful, but his `stringify_state_helper` is a single-purpose function, and still leaves a degree of repetition and memory management in `stringify_state`. I'd rather have general-purpose `to_string` that takes printf-style arguments, allocates sufficient space for the converted result, and pri...
There's nothing wrong with the other answers, but if you'd prefer a solution more portable than `asprinf()` and slightly more straightforward than Jerry Coffin's vsnprintf() helper function [solution](https://codereview.stackexchange.com/a/223101/51483), consider this variable length macro solution: ``` #define FOO_AS...
223,096
I'm writing a function to stringify a nested struct. I'm using [`snprintf` to pre-calculate how much space I'll need](https://stackoverflow.com/a/32819876/3000206) to allocate. The problem is, it's extremely repetitious, and will only get worse if I ever need to add more fields to any of the structs. The duplication a...
2019/06/27
[ "https://codereview.stackexchange.com/questions/223096", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/46840/" ]
Consider factoring it out into a function: ``` static size_t stringify_state_helper(State * state, char * buf) { return snprintf(buf, ....); } char * stringify_state(State * state) { size_t len = stringify_state_helper(state, NULL); char * buf = malloc(len + 1); if (buf) { stringify_state_help...
There's nothing wrong with the other answers, but if you'd prefer a solution more portable than `asprinf()` and slightly more straightforward than Jerry Coffin's vsnprintf() helper function [solution](https://codereview.stackexchange.com/a/223101/51483), consider this variable length macro solution: ``` #define FOO_AS...
223,096
I'm writing a function to stringify a nested struct. I'm using [`snprintf` to pre-calculate how much space I'll need](https://stackoverflow.com/a/32819876/3000206) to allocate. The problem is, it's extremely repetitious, and will only get worse if I ever need to add more fields to any of the structs. The duplication a...
2019/06/27
[ "https://codereview.stackexchange.com/questions/223096", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/46840/" ]
The GNU libc already provides `asprintf`, which avoids exactly the repetition you are concerned about. I haven't looked at the solutions of other operating systems (Windows, BSD, AIX, Solaris, embedded), though I hope they provide something equivalent.
Side issue **`"%f"` does not well express the *state* of a floating point (FP) object** When a FP is large, printing 100s of digits is not informative. More compact options exist. Worse, when a FP is much smaller than 1, `"%f"` only retains a few or zero digits - losing perhaps all precession. As FP are encoded in ...
223,096
I'm writing a function to stringify a nested struct. I'm using [`snprintf` to pre-calculate how much space I'll need](https://stackoverflow.com/a/32819876/3000206) to allocate. The problem is, it's extremely repetitious, and will only get worse if I ever need to add more fields to any of the structs. The duplication a...
2019/06/27
[ "https://codereview.stackexchange.com/questions/223096", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/46840/" ]
@vnp's code is solid and helpful, but his `stringify_state_helper` is a single-purpose function, and still leaves a degree of repetition and memory management in `stringify_state`. I'd rather have general-purpose `to_string` that takes printf-style arguments, allocates sufficient space for the converted result, and pri...
Consider factoring it out into a function: ``` static size_t stringify_state_helper(State * state, char * buf) { return snprintf(buf, ....); } char * stringify_state(State * state) { size_t len = stringify_state_helper(state, NULL); char * buf = malloc(len + 1); if (buf) { stringify_state_help...
223,096
I'm writing a function to stringify a nested struct. I'm using [`snprintf` to pre-calculate how much space I'll need](https://stackoverflow.com/a/32819876/3000206) to allocate. The problem is, it's extremely repetitious, and will only get worse if I ever need to add more fields to any of the structs. The duplication a...
2019/06/27
[ "https://codereview.stackexchange.com/questions/223096", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/46840/" ]
Consider factoring it out into a function: ``` static size_t stringify_state_helper(State * state, char * buf) { return snprintf(buf, ....); } char * stringify_state(State * state) { size_t len = stringify_state_helper(state, NULL); char * buf = malloc(len + 1); if (buf) { stringify_state_help...
Write the `if`s such that the error paths are inside them, and the error-free path isn't indented: ```c buff = malloc(len + 1); if (buff) { snprintf(buff, len + 1, format_string, state->last_update_time, p->health, p->max_health, p->satiat...
223,096
I'm writing a function to stringify a nested struct. I'm using [`snprintf` to pre-calculate how much space I'll need](https://stackoverflow.com/a/32819876/3000206) to allocate. The problem is, it's extremely repetitious, and will only get worse if I ever need to add more fields to any of the structs. The duplication a...
2019/06/27
[ "https://codereview.stackexchange.com/questions/223096", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/46840/" ]
@vnp's code is solid and helpful, but his `stringify_state_helper` is a single-purpose function, and still leaves a degree of repetition and memory management in `stringify_state`. I'd rather have general-purpose `to_string` that takes printf-style arguments, allocates sufficient space for the converted result, and pri...
The GNU libc already provides `asprintf`, which avoids exactly the repetition you are concerned about. I haven't looked at the solutions of other operating systems (Windows, BSD, AIX, Solaris, embedded), though I hope they provide something equivalent.
223,096
I'm writing a function to stringify a nested struct. I'm using [`snprintf` to pre-calculate how much space I'll need](https://stackoverflow.com/a/32819876/3000206) to allocate. The problem is, it's extremely repetitious, and will only get worse if I ever need to add more fields to any of the structs. The duplication a...
2019/06/27
[ "https://codereview.stackexchange.com/questions/223096", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/46840/" ]
Consider factoring it out into a function: ``` static size_t stringify_state_helper(State * state, char * buf) { return snprintf(buf, ....); } char * stringify_state(State * state) { size_t len = stringify_state_helper(state, NULL); char * buf = malloc(len + 1); if (buf) { stringify_state_help...
The GNU libc already provides `asprintf`, which avoids exactly the repetition you are concerned about. I haven't looked at the solutions of other operating systems (Windows, BSD, AIX, Solaris, embedded), though I hope they provide something equivalent.
223,096
I'm writing a function to stringify a nested struct. I'm using [`snprintf` to pre-calculate how much space I'll need](https://stackoverflow.com/a/32819876/3000206) to allocate. The problem is, it's extremely repetitious, and will only get worse if I ever need to add more fields to any of the structs. The duplication a...
2019/06/27
[ "https://codereview.stackexchange.com/questions/223096", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/46840/" ]
Write the `if`s such that the error paths are inside them, and the error-free path isn't indented: ```c buff = malloc(len + 1); if (buff) { snprintf(buff, len + 1, format_string, state->last_update_time, p->health, p->max_health, p->satiat...
There's nothing wrong with the other answers, but if you'd prefer a solution more portable than `asprinf()` and slightly more straightforward than Jerry Coffin's vsnprintf() helper function [solution](https://codereview.stackexchange.com/a/223101/51483), consider this variable length macro solution: ``` #define FOO_AS...
223,096
I'm writing a function to stringify a nested struct. I'm using [`snprintf` to pre-calculate how much space I'll need](https://stackoverflow.com/a/32819876/3000206) to allocate. The problem is, it's extremely repetitious, and will only get worse if I ever need to add more fields to any of the structs. The duplication a...
2019/06/27
[ "https://codereview.stackexchange.com/questions/223096", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/46840/" ]
@vnp's code is solid and helpful, but his `stringify_state_helper` is a single-purpose function, and still leaves a degree of repetition and memory management in `stringify_state`. I'd rather have general-purpose `to_string` that takes printf-style arguments, allocates sufficient space for the converted result, and pri...
Write the `if`s such that the error paths are inside them, and the error-free path isn't indented: ```c buff = malloc(len + 1); if (buff) { snprintf(buff, len + 1, format_string, state->last_update_time, p->health, p->max_health, p->satiat...
223,096
I'm writing a function to stringify a nested struct. I'm using [`snprintf` to pre-calculate how much space I'll need](https://stackoverflow.com/a/32819876/3000206) to allocate. The problem is, it's extremely repetitious, and will only get worse if I ever need to add more fields to any of the structs. The duplication a...
2019/06/27
[ "https://codereview.stackexchange.com/questions/223096", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/46840/" ]
@vnp's code is solid and helpful, but his `stringify_state_helper` is a single-purpose function, and still leaves a degree of repetition and memory management in `stringify_state`. I'd rather have general-purpose `to_string` that takes printf-style arguments, allocates sufficient space for the converted result, and pri...
Side issue **`"%f"` does not well express the *state* of a floating point (FP) object** When a FP is large, printing 100s of digits is not informative. More compact options exist. Worse, when a FP is much smaller than 1, `"%f"` only retains a few or zero digits - losing perhaps all precession. As FP are encoded in ...
47,980,949
I want to use the Postman Collection Runner to submit requests to an XML API based on data [imported from a CSV spreadsheet](http://blog.getpostman.com/2014/10/28/using-csv-and-json-files-in-the-postman-collection-runner/). However, rather than running an entire collection, I want to only run an ***individual*** reques...
2017/12/26
[ "https://Stackoverflow.com/questions/47980949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3357935/" ]
You could also simply create a subfolder for the single request you want to iterate over. Runner can zoom in on that folder.
If you want to run the first request you can use the `setNextRequest(null)` function within the `test` tab. As long as the request that you only want to run is first in the collection, it will be the only one that is picked up in the collection runner. More details can be found [here](https://www.getpostman.com/docs/po...
47,980,949
I want to use the Postman Collection Runner to submit requests to an XML API based on data [imported from a CSV spreadsheet](http://blog.getpostman.com/2014/10/28/using-csv-and-json-files-in-the-postman-collection-runner/). However, rather than running an entire collection, I want to only run an ***individual*** reques...
2017/12/26
[ "https://Stackoverflow.com/questions/47980949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3357935/" ]
If you want to run the first request you can use the `setNextRequest(null)` function within the `test` tab. As long as the request that you only want to run is first in the collection, it will be the only one that is picked up in the collection runner. More details can be found [here](https://www.getpostman.com/docs/po...
Select the collections tab on the left hand side. Tap on the name of the collection to expand all the requests in the collection. Select the request you want to run. In the right hand window, the request will show up. Hit the send button to run the request. Of course this is not directly from the collection runner its...
47,980,949
I want to use the Postman Collection Runner to submit requests to an XML API based on data [imported from a CSV spreadsheet](http://blog.getpostman.com/2014/10/28/using-csv-and-json-files-in-the-postman-collection-runner/). However, rather than running an entire collection, I want to only run an ***individual*** reques...
2017/12/26
[ "https://Stackoverflow.com/questions/47980949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3357935/" ]
You could also simply create a subfolder for the single request you want to iterate over. Runner can zoom in on that folder.
Select the collections tab on the left hand side. Tap on the name of the collection to expand all the requests in the collection. Select the request you want to run. In the right hand window, the request will show up. Hit the send button to run the request. Of course this is not directly from the collection runner its...
87,437
The alphametic MANY + MANY = THANKS has no solutions in base 10. How many more "MANYs" must I add before it has a solution?
2019/08/26
[ "https://puzzling.stackexchange.com/questions/87437", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/19026/" ]
From > > 1814400 > > > possible permutations of letters `AHKMNSTY` and digits 0-9 (`P(10,8)`), just > > 759 > > > are valid for the problem `n * MANY = THANKS`. This is, just those were `THANKS/MANY` is an integer. After removing those solutions where `T=0 (THANKS <= 99999)`, there are 727 left from wh...
I think you need (in base ten): > > 15 more manys (17 all together) > > > There are three solutions: > > A=5 H=4 K=3 M=8 N=6 S=9 T=1 Y=7 because $8567\times17=145639$, > > A=5 H=4 K=7 M=8 N=6 S=3 T=1 Y=9 because $8569\times17=145673$, and > > A=5 H=4 K=9 M=8 N=7 S=2 T=1 Y=6 because $8576\times17=14579...
87,437
The alphametic MANY + MANY = THANKS has no solutions in base 10. How many more "MANYs" must I add before it has a solution?
2019/08/26
[ "https://puzzling.stackexchange.com/questions/87437", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/19026/" ]
I think you need (in base ten): > > 15 more manys (17 all together) > > > There are three solutions: > > A=5 H=4 K=3 M=8 N=6 S=9 T=1 Y=7 because $8567\times17=145639$, > > A=5 H=4 K=7 M=8 N=6 S=3 T=1 Y=9 because $8569\times17=145673$, and > > A=5 H=4 K=9 M=8 N=7 S=2 T=1 Y=6 because $8576\times17=14579...
The question was already answered by @Duck, but here is a (not very well-crafted or efficient) C program which tests increasing numbers of **MANY** until a solution (in fact three) is found. Program output: > > x \* MANY = THANKS > > 17 \* 8567 = 145639 > > 17 \* 8569 = 145673 > > 17 \* 8576 = 145792 ...
87,437
The alphametic MANY + MANY = THANKS has no solutions in base 10. How many more "MANYs" must I add before it has a solution?
2019/08/26
[ "https://puzzling.stackexchange.com/questions/87437", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/19026/" ]
I think you need (in base ten): > > 15 more manys (17 all together) > > > There are three solutions: > > A=5 H=4 K=3 M=8 N=6 S=9 T=1 Y=7 because $8567\times17=145639$, > > A=5 H=4 K=7 M=8 N=6 S=3 T=1 Y=9 because $8569\times17=145673$, and > > A=5 H=4 K=9 M=8 N=7 S=2 T=1 Y=6 because $8576\times17=14579...
I also coded this out, running it in python (you can even use change the words for other similar puzzles, they're global variables, I used "CAT" and "DOG" to test the logic worked for trivial examples. I would be very interested in a rigorous proof, but given how complex the setup is to express in mathematical logic I...
87,437
The alphametic MANY + MANY = THANKS has no solutions in base 10. How many more "MANYs" must I add before it has a solution?
2019/08/26
[ "https://puzzling.stackexchange.com/questions/87437", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/19026/" ]
From > > 1814400 > > > possible permutations of letters `AHKMNSTY` and digits 0-9 (`P(10,8)`), just > > 759 > > > are valid for the problem `n * MANY = THANKS`. This is, just those were `THANKS/MANY` is an integer. After removing those solutions where `T=0 (THANKS <= 99999)`, there are 727 left from wh...
The question was already answered by @Duck, but here is a (not very well-crafted or efficient) C program which tests increasing numbers of **MANY** until a solution (in fact three) is found. Program output: > > x \* MANY = THANKS > > 17 \* 8567 = 145639 > > 17 \* 8569 = 145673 > > 17 \* 8576 = 145792 ...
87,437
The alphametic MANY + MANY = THANKS has no solutions in base 10. How many more "MANYs" must I add before it has a solution?
2019/08/26
[ "https://puzzling.stackexchange.com/questions/87437", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/19026/" ]
From > > 1814400 > > > possible permutations of letters `AHKMNSTY` and digits 0-9 (`P(10,8)`), just > > 759 > > > are valid for the problem `n * MANY = THANKS`. This is, just those were `THANKS/MANY` is an integer. After removing those solutions where `T=0 (THANKS <= 99999)`, there are 727 left from wh...
I also coded this out, running it in python (you can even use change the words for other similar puzzles, they're global variables, I used "CAT" and "DOG" to test the logic worked for trivial examples. I would be very interested in a rigorous proof, but given how complex the setup is to express in mathematical logic I...
13,330,684
For reasons that I promise exist, I'm reading input character by character, and if a character meets certain criteria, I'm writing it into a dynamically allocated buffer. This function adds the specified character to the "end" of the specified string. When reading out of the buffer, I read the first 'size' characters. ...
2012/11/11
[ "https://Stackoverflow.com/questions/13330684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1279343/" ]
This function does not append a character to a buffer. ``` void append(char c, char *str, int size) { if(size + 1 > strlen(str)) str = realloc(str, size + 1); str[size] = c; } ``` First, what is `strlen(str)`? You can say "it's the length of `str`", but that's omitting some very important details. Ho...
When you do a: ``` str = (char*)realloc(str,sizeof(char)*(size + 1)); ``` the changes in str will not be reflected in the calling function, in other words the changes are local to the function as the pointer is passed by value. To fix this you can either return the value of str: ``` char * append(char c, char *str,...
42,991,340
This [code demo here](https://jsfiddle.net/Lsre6mfL/) is taken from [this question](https://stackoverflow.com/questions/42966939/javascript-radio-button-enable-disable-elements-not-right). But I wanted to make the text box enable when the value "Others" is chosen from the drop down. This is the code that I edited from...
2017/03/24
[ "https://Stackoverflow.com/questions/42991340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5614160/" ]
You can achieve it in below two ways: 1. set `ref` that represent commit hash in your Gemfile instead of `branch` name and run bundle install. Now when you push again to heroku it will fetch right commmit. ``` gem 'B', git: 'https://yashdfjwehrlhkhklbRrKwgNq:x-token-auth@bitbucket.org/pwa-abcde/B.git', ref: 'commmit...
Instead of running `bundle update` within `Project A` at Heroku, run `bundle update` locally first. This will update your `Gemfile.lock`. Test if the `Project A` still runs locally as expected. Then commit and push the new `Gemfile.lock` to Heroku.
52,294
SARS-CoV-2 infection managed to bring a significant part of the economy to a halt and it is expected for lots of companies to have cash flows problems (e.g. impossible to pay the suppliers). I have recently saw a Romanian economist speaking about this issue and I was wondering how US and EU are dealing with this. [The...
2020/03/29
[ "https://politics.stackexchange.com/questions/52294", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/11278/" ]
The Fed is the central bank of the United States, which is one nation despite the plural form in their name. The ECB is the central bank of some (but not all) EU nations, and their operation is based on an *international treaty*. What the ECB can and cannot do is spelled out in that treaty, and the member states coul...
[Reuters](https://www.reuters.com/article/us-ing-groep-results/dutch-bank-ing-warns-against-further-ecb-money-printing-idUSKCN1UR3JM): > > Dutch bank ING warns against further ECB money printing. [...] > > > “I don’t think QE is a recipe to support an uncertain environment,” Hamers told journalists, referring to so...
52,294
SARS-CoV-2 infection managed to bring a significant part of the economy to a halt and it is expected for lots of companies to have cash flows problems (e.g. impossible to pay the suppliers). I have recently saw a Romanian economist speaking about this issue and I was wondering how US and EU are dealing with this. [The...
2020/03/29
[ "https://politics.stackexchange.com/questions/52294", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/11278/" ]
The Fed is the central bank of the United States, which is one nation despite the plural form in their name. The ECB is the central bank of some (but not all) EU nations, and their operation is based on an *international treaty*. What the ECB can and cannot do is spelled out in that treaty, and the member states coul...
A minor technical nuance that's bugging me is that the article is suggesting that the Federal Reserve can print money. That's misleading at best, and at worst just not true. [The Federal Reserve can't print money](https://www.stlouisfed.org/open-vault/2017/november/does-federal-reserve-print-money) (emphasis mine): > ...
52,294
SARS-CoV-2 infection managed to bring a significant part of the economy to a halt and it is expected for lots of companies to have cash flows problems (e.g. impossible to pay the suppliers). I have recently saw a Romanian economist speaking about this issue and I was wondering how US and EU are dealing with this. [The...
2020/03/29
[ "https://politics.stackexchange.com/questions/52294", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/11278/" ]
[Reuters](https://www.reuters.com/article/us-ing-groep-results/dutch-bank-ing-warns-against-further-ecb-money-printing-idUSKCN1UR3JM): > > Dutch bank ING warns against further ECB money printing. [...] > > > “I don’t think QE is a recipe to support an uncertain environment,” Hamers told journalists, referring to so...
A minor technical nuance that's bugging me is that the article is suggesting that the Federal Reserve can print money. That's misleading at best, and at worst just not true. [The Federal Reserve can't print money](https://www.stlouisfed.org/open-vault/2017/november/does-federal-reserve-print-money) (emphasis mine): > ...
134,445
We are developing a custom module for not allowing user to add the same product (same SKU) into the cart. In the official documentation, I cannot find any information about it. Which class I should override to achieve this?
2016/09/02
[ "https://magento.stackexchange.com/questions/134445", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/42585/" ]
I finally found the setting in Admin Panel. Goto Stores > Configuration > Catalog > Inventory > Product Stock Options > Maximum Qty Allowed in Shopping Cart, set the value to 1 [![enter image description here](https://i.stack.imgur.com/LCbax.png)](https://i.stack.imgur.com/LCbax.png) Thanks @Khoa
We can set the **Maximum Qty Allowed in Shopping Cart** per product: --*Magento version 2.0.7* [![enter image description here](https://i.stack.imgur.com/o6kJV.png)](https://i.stack.imgur.com/o6kJV.png) --*Magento version 2.1*: Choose product > **Advanced Inventory**: [![enter image description here](https://i...
31,756,437
Is it possible to have a horizontal navigation bar (while still keeping the arrows) as seen in Amazon.com's slider below? <http://i.imgur.com/jDWU5qv.jpg> Thank you!
2015/07/31
[ "https://Stackoverflow.com/questions/31756437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2600109/" ]
Most probably the relative path is at fault here. Make sure that is correctly set. **EDIT** While the path thing might be a problem, it is not the biggest here. What you most probably want is either: ``` // this tests if there are zero or more rows in your result if (mysql_num_rows($rst)==0) { echo "<img src='i...
Try switching the if and else so you can see if it has something to do with what your outputting or if it is failing to reach the else. ``` if(($res)==FALSE) echo "<img src='imagini/banner.png'>"; ```
31,756,437
Is it possible to have a horizontal navigation bar (while still keeping the arrows) as seen in Amazon.com's slider below? <http://i.imgur.com/jDWU5qv.jpg> Thank you!
2015/07/31
[ "https://Stackoverflow.com/questions/31756437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2600109/" ]
A few formatting things I would fix that increase the readability ``` while($res = mysql_fetch_array($rst)) if(($res)==TRUE) echo "$res[2]"; else echo "<img src='imagini/banner.png'>"; ``` To this ``` while(false !== ( $res = mysql_fetch_array($rst) ) ){ if($res[2] == true){ // or isset( $res...
Most probably the relative path is at fault here. Make sure that is correctly set. **EDIT** While the path thing might be a problem, it is not the biggest here. What you most probably want is either: ``` // this tests if there are zero or more rows in your result if (mysql_num_rows($rst)==0) { echo "<img src='i...
31,756,437
Is it possible to have a horizontal navigation bar (while still keeping the arrows) as seen in Amazon.com's slider below? <http://i.imgur.com/jDWU5qv.jpg> Thank you!
2015/07/31
[ "https://Stackoverflow.com/questions/31756437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2600109/" ]
A few formatting things I would fix that increase the readability ``` while($res = mysql_fetch_array($rst)) if(($res)==TRUE) echo "$res[2]"; else echo "<img src='imagini/banner.png'>"; ``` To this ``` while(false !== ( $res = mysql_fetch_array($rst) ) ){ if($res[2] == true){ // or isset( $res...
Try switching the if and else so you can see if it has something to do with what your outputting or if it is failing to reach the else. ``` if(($res)==FALSE) echo "<img src='imagini/banner.png'>"; ```
18,390,982
I'm Having fun learning to use jsoup and have successfully retrieved and displayed data from a website, but now I would like some further guidance on it if anyone can help. Using the code below returns all the table rows 30+, How can I retrieve only say the first 10 of those rows? also When returning those rows and ...
2013/08/22
[ "https://Stackoverflow.com/questions/18390982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1442782/" ]
Instead of doing for(Element element:tableRows), Elements has a size method. So, you should be able to just do some validation with the size, and then simply ``` for(int i = 0; i < 10; i++){ tableRows.get(i); } ``` to get 10 of them. As for the spaces, before you store them in your arraylist just use regular ex...
Try this ``` doc.select("table.dynlist tr:lt(10)"); ``` to limt the results. [**Reference**](http://jsoup.org/cookbook/extracting-data/selector-syntax)
18,390,982
I'm Having fun learning to use jsoup and have successfully retrieved and displayed data from a website, but now I would like some further guidance on it if anyone can help. Using the code below returns all the table rows 30+, How can I retrieve only say the first 10 of those rows? also When returning those rows and ...
2013/08/22
[ "https://Stackoverflow.com/questions/18390982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1442782/" ]
**Try This** ``` import java.io.IOException; import java.util.ArrayList; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; public class test { static ArrayList<String> arr_shipping=new ArrayList<String>(); public static void main(Str...
Try this ``` doc.select("table.dynlist tr:lt(10)"); ``` to limt the results. [**Reference**](http://jsoup.org/cookbook/extracting-data/selector-syntax)
12,420,274
To change all TitledBorder fonts, I am using UIManager: ``` UIManager.put("TitledBorder.font", new Font("Tahoma", Font.BOLD, 11)); ``` But what to put to `TitledBorder.border` property to change only the color of the border (or maybe even it's width)? Cheers
2012/09/14
[ "https://Stackoverflow.com/questions/12420274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/617802/" ]
Just as using `UIManager` to change all `TitledBorder` font at once, to change `TitledBorder` borders use this function: ``` UIManager.put("TitledBorder.border", new LineBorder(new Color(200,200,200), 1)); ``` It will change (set) the border property to the border object passed in a second parameter. All border type...
Well, you can always specify any property in TitledBorder itself. Here is a fully customized example of Swing TitledBorder: ``` public static void main ( String[] args ) { LineBorder border = new LineBorder ( Color.RED, 3, true ); TitledBorder tborder = new TitledBorder ( border, "Titled border", TitledBorder...
47,605,828
This is my table: ![this is my table](https://i.stack.imgur.com/j6Z1N.png) Now I need a query to return `name` as `student name` and `teacher_id` as `teacher name` by referring to the same table like below: ![I need result like this](https://i.stack.imgur.com/eHZdn.png)
2017/12/02
[ "https://Stackoverflow.com/questions/47605828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9037857/" ]
You can do a self-join on this table, like this: ``` select t1.name as student_name , t2.name as teacher_name from table_name t1 join table_name t2 on t1.teacher_id = t2.id; ```
Have a look in [Adjacency model](http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/) for query examples.
995,760
For example, if the match is `<div class="class1">Hello world</div>`, I need to return ``` <div class="class1">Hello world</div> ``` not just "Hello world". Thanks!
2009/06/15
[ "https://Stackoverflow.com/questions/995760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/111265/" ]
There's no built-in function for getting the outerHTML, but you can use this: ``` jQuery.fn.outerHTML = function(s) { return (s) ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); } ``` Then in your selector: `$('.class1').outerHTML()` will give you what you are looking for. [Sourc...
Check out this [outerHTML plugin](http://brandonaaron.net/blog/2007/06/17/jquery-snippets-outerhtml/).
995,760
For example, if the match is `<div class="class1">Hello world</div>`, I need to return ``` <div class="class1">Hello world</div> ``` not just "Hello world". Thanks!
2009/06/15
[ "https://Stackoverflow.com/questions/995760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/111265/" ]
Check out this [outerHTML plugin](http://brandonaaron.net/blog/2007/06/17/jquery-snippets-outerhtml/).
I used .andSelf() with success: <http://api.jquery.com/andSelf/>