qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
48,358,686
This is my code : ```python #Choose Report def chooseReport(): print "Choose a report." while True: choice = raw_input("Enter A or B: ") if choice == 'a' or choice == 'A': reportA() break elif choice == 'b' or choice == 'B': reportB() brea...
2018/01/20
[ "https://Stackoverflow.com/questions/48358686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9244343/" ]
The code is perfect, except a redundant else, as mentioned in the comment. Are you entering `a` (a + space) rather than simply `a` (a without space) ? The problem is in the input that you are providing and not in the code!
Code is fine. I think you call your chooseReport() function in a loop or your input has extra characters and if conditions didn't satisfied.
48,358,686
This is my code : ```python #Choose Report def chooseReport(): print "Choose a report." while True: choice = raw_input("Enter A or B: ") if choice == 'a' or choice == 'A': reportA() break elif choice == 'b' or choice == 'B': reportB() brea...
2018/01/20
[ "https://Stackoverflow.com/questions/48358686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9244343/" ]
First, your code works fine, the most probably error is that you are writing a wrong input (e.g: with more characters). To solve that you could use `"a" in choice or "A" in choice`. But if it isn't working... keep reading. It's seems that `break` isn't affecting the `while loop`, I don't have python 2 so I am not very...
Code is fine. I think you call your chooseReport() function in a loop or your input has extra characters and if conditions didn't satisfied.
48,358,686
This is my code : ```python #Choose Report def chooseReport(): print "Choose a report." while True: choice = raw_input("Enter A or B: ") if choice == 'a' or choice == 'A': reportA() break elif choice == 'b' or choice == 'B': reportB() brea...
2018/01/20
[ "https://Stackoverflow.com/questions/48358686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9244343/" ]
The problem is in the `raw_input()`. It returns a string but maybe this string is `"a "` or `"a\n"` though you have entered `"a"` or `"b"`. I would do this: ``` def chooseReport(): print "Choose a report." while True: choice = raw_input("Enter A or B: ") if "a" in choice or "A" in choice: ...
Code is fine. I think you call your chooseReport() function in a loop or your input has extra characters and if conditions didn't satisfied.
48,358,686
This is my code : ```python #Choose Report def chooseReport(): print "Choose a report." while True: choice = raw_input("Enter A or B: ") if choice == 'a' or choice == 'A': reportA() break elif choice == 'b' or choice == 'B': reportB() brea...
2018/01/20
[ "https://Stackoverflow.com/questions/48358686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9244343/" ]
Tried your code in the following script, it works fine both on Linux and on Windows. ``` def reportA(): print "AAAAA" def reportB(): print "BBBBB" #Choose Report def chooseReport(): print "Choose a report." while True: choice = raw_input("Enter A or B: ") if choice == 'a' or choice ==...
Code is fine. I think you call your chooseReport() function in a loop or your input has extra characters and if conditions didn't satisfied.
8,869,462
In my Mac app, I override and accept certain keystrokes via the `keyUp` function in an NSView, which isn't meant to accept keystrokes. When a key is pressed, the `keyUp` function *is* called, and I do process the keystroke, without even calling `super keyUp:`, and everything works, except that it also makes that defau...
2012/01/15
[ "https://Stackoverflow.com/questions/8869462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834998/" ]
I think (but am not 100% certain, it's been a bit of time since I did this) you also need to override the `NSView` and/or `NSResponder` [`performKeyEquivalent:`](http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/pe...
Instead of using `keyUp:`, you may want to use the `moveUp:` action, as it takes all of the hassle of determining which key to handle out of the mix. There are also similarly named routines for down and a variety for handling movement with selections, etc. For further documentation on this, please see the [Cocoa Event...
8,869,462
In my Mac app, I override and accept certain keystrokes via the `keyUp` function in an NSView, which isn't meant to accept keystrokes. When a key is pressed, the `keyUp` function *is* called, and I do process the keystroke, without even calling `super keyUp:`, and everything works, except that it also makes that defau...
2012/01/15
[ "https://Stackoverflow.com/questions/8869462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834998/" ]
I think (but am not 100% certain, it's been a bit of time since I did this) you also need to override the `NSView` and/or `NSResponder` [`performKeyEquivalent:`](http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/pe...
The accepted answer might do the trick but I would like to suggest a more correct way to solve the problem :) Using `keyUp:` and `keyDown:` is totally fine, but most importantly, your view must also follow the AppKit responder pattern (You can learn more about `NSResponder` on the [official documentation](https://deve...
8,869,462
In my Mac app, I override and accept certain keystrokes via the `keyUp` function in an NSView, which isn't meant to accept keystrokes. When a key is pressed, the `keyUp` function *is* called, and I do process the keystroke, without even calling `super keyUp:`, and everything works, except that it also makes that defau...
2012/01/15
[ "https://Stackoverflow.com/questions/8869462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834998/" ]
I think (but am not 100% certain, it's been a bit of time since I did this) you also need to override the `NSView` and/or `NSResponder` [`performKeyEquivalent:`](http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/pe...
In my case `performKeyEquivalent` did not capture the Enter key. The beep was triggered in the `keyDown` event. This Swift code prevents beeping when handling the Enter key: ``` override func keyDown(with event: NSEvent) { if event.keyCode != 36 { super.keyDown(with: event) } } override func keyUp(wit...
8,869,462
In my Mac app, I override and accept certain keystrokes via the `keyUp` function in an NSView, which isn't meant to accept keystrokes. When a key is pressed, the `keyUp` function *is* called, and I do process the keystroke, without even calling `super keyUp:`, and everything works, except that it also makes that defau...
2012/01/15
[ "https://Stackoverflow.com/questions/8869462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834998/" ]
I think (but am not 100% certain, it's been a bit of time since I did this) you also need to override the `NSView` and/or `NSResponder` [`performKeyEquivalent:`](http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/pe...
Every answer on this page is not quite right. The following is best practice, in my experience. If the key press is not valid the alert will sound; but if it is valid, it will not… ``` class YourNSViewSubclass: NSView { // Make sure your view will accept responder chain events override var acceptsFirstResponder: B...
8,869,462
In my Mac app, I override and accept certain keystrokes via the `keyUp` function in an NSView, which isn't meant to accept keystrokes. When a key is pressed, the `keyUp` function *is* called, and I do process the keystroke, without even calling `super keyUp:`, and everything works, except that it also makes that defau...
2012/01/15
[ "https://Stackoverflow.com/questions/8869462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834998/" ]
Instead of using `keyUp:`, you may want to use the `moveUp:` action, as it takes all of the hassle of determining which key to handle out of the mix. There are also similarly named routines for down and a variety for handling movement with selections, etc. For further documentation on this, please see the [Cocoa Event...
Every answer on this page is not quite right. The following is best practice, in my experience. If the key press is not valid the alert will sound; but if it is valid, it will not… ``` class YourNSViewSubclass: NSView { // Make sure your view will accept responder chain events override var acceptsFirstResponder: B...
8,869,462
In my Mac app, I override and accept certain keystrokes via the `keyUp` function in an NSView, which isn't meant to accept keystrokes. When a key is pressed, the `keyUp` function *is* called, and I do process the keystroke, without even calling `super keyUp:`, and everything works, except that it also makes that defau...
2012/01/15
[ "https://Stackoverflow.com/questions/8869462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834998/" ]
The accepted answer might do the trick but I would like to suggest a more correct way to solve the problem :) Using `keyUp:` and `keyDown:` is totally fine, but most importantly, your view must also follow the AppKit responder pattern (You can learn more about `NSResponder` on the [official documentation](https://deve...
Every answer on this page is not quite right. The following is best practice, in my experience. If the key press is not valid the alert will sound; but if it is valid, it will not… ``` class YourNSViewSubclass: NSView { // Make sure your view will accept responder chain events override var acceptsFirstResponder: B...
8,869,462
In my Mac app, I override and accept certain keystrokes via the `keyUp` function in an NSView, which isn't meant to accept keystrokes. When a key is pressed, the `keyUp` function *is* called, and I do process the keystroke, without even calling `super keyUp:`, and everything works, except that it also makes that defau...
2012/01/15
[ "https://Stackoverflow.com/questions/8869462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834998/" ]
In my case `performKeyEquivalent` did not capture the Enter key. The beep was triggered in the `keyDown` event. This Swift code prevents beeping when handling the Enter key: ``` override func keyDown(with event: NSEvent) { if event.keyCode != 36 { super.keyDown(with: event) } } override func keyUp(wit...
Every answer on this page is not quite right. The following is best practice, in my experience. If the key press is not valid the alert will sound; but if it is valid, it will not… ``` class YourNSViewSubclass: NSView { // Make sure your view will accept responder chain events override var acceptsFirstResponder: B...
35,405,077
I followed [this example](https://stackoverflow.com/questions/13267846/how-to-add-text-to-an-image-with-php-gd-library) to embed text in image while uploading it but it's not working. This is my code: ``` header('Content-type: image/jpeg'); $img = $_FILES['mainImage']['name']; list($txt, $ext) = explode(".", $img...
2016/02/15
[ "https://Stackoverflow.com/questions/35405077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2519395/" ]
For this we are working with `GD library`. > > "PHP is not limited to creating just HTML output. It can also be used > to create and manipulate image files in a variety of different image > formats, including GIF, PNG, JPEG, WBMP, and XPM. Even more > convenient, PHP can output image streams directly to a browser....
You can try using the [Intervention library](http://image.intervention.io/). I use it for doing what you're asking about. It is quite simple to understand and the [documentation](http://image.intervention.io/api/text) is is well-written.
61,795,508
Currently there's no equivalent to CameraView (and PreviewView) in Compose. Is it possible to wrap it and display it in a compose layout?
2020/05/14
[ "https://Stackoverflow.com/questions/61795508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/211150/" ]
At the moment there isn't any official Composable function for CameraX so we have to inflate the legacy android view inside compose. To achieve that we can use `AndroidView` composable function, it accepts two parameters * @param `resId` The id of the layout resource to be inflated. * @param `postInflationCallback` T...
I've created a library to use CameraX in Jetpack Compose. It might be useful until an official library comes out. <https://github.com/skgmn/CameraXX> In your build.gradle, (requires GitHub personal access token) ``` implementation "com.github.skgmn:cameraxx-composable:0.3.0" ``` Composable method signature ```kot...
61,795,508
Currently there's no equivalent to CameraView (and PreviewView) in Compose. Is it possible to wrap it and display it in a compose layout?
2020/05/14
[ "https://Stackoverflow.com/questions/61795508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/211150/" ]
At the moment there isn't any official Composable function for CameraX so we have to inflate the legacy android view inside compose. To achieve that we can use `AndroidView` composable function, it accepts two parameters * @param `resId` The id of the layout resource to be inflated. * @param `postInflationCallback` T...
This is my snippet (based on Sean's answer), which also handles torch state and resource disposition and adds a focus on tap logic. Dependencies: ``` implementation 'androidx.camera:camera-camera2:1.1.0-alpha11' implementation 'androidx.camera:camera-view:1.0.0-alpha31' implementation 'androidx.camera:camera-lifecycle...
61,795,508
Currently there's no equivalent to CameraView (and PreviewView) in Compose. Is it possible to wrap it and display it in a compose layout?
2020/05/14
[ "https://Stackoverflow.com/questions/61795508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/211150/" ]
There is still no CameraX composable. You need to use `AndroidView` to create one. Updated example for Compose 1.0.0-beta02: ```kotlin @Composable fun CameraPreview( modifier: Modifier = Modifier, cameraSelector: CameraSelector = CameraSelector.DEFAULT_BACK_CAMERA, scaleType: PreviewView.ScaleType = Previ...
I've created a library to use CameraX in Jetpack Compose. It might be useful until an official library comes out. <https://github.com/skgmn/CameraXX> In your build.gradle, (requires GitHub personal access token) ``` implementation "com.github.skgmn:cameraxx-composable:0.3.0" ``` Composable method signature ```kot...
61,795,508
Currently there's no equivalent to CameraView (and PreviewView) in Compose. Is it possible to wrap it and display it in a compose layout?
2020/05/14
[ "https://Stackoverflow.com/questions/61795508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/211150/" ]
There is still no CameraX composable. You need to use `AndroidView` to create one. Updated example for Compose 1.0.0-beta02: ```kotlin @Composable fun CameraPreview( modifier: Modifier = Modifier, cameraSelector: CameraSelector = CameraSelector.DEFAULT_BACK_CAMERA, scaleType: PreviewView.ScaleType = Previ...
This is my snippet (based on Sean's answer), which also handles torch state and resource disposition and adds a focus on tap logic. Dependencies: ``` implementation 'androidx.camera:camera-camera2:1.1.0-alpha11' implementation 'androidx.camera:camera-view:1.0.0-alpha31' implementation 'androidx.camera:camera-lifecycle...
61,795,508
Currently there's no equivalent to CameraView (and PreviewView) in Compose. Is it possible to wrap it and display it in a compose layout?
2020/05/14
[ "https://Stackoverflow.com/questions/61795508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/211150/" ]
This is my snippet (based on Sean's answer), which also handles torch state and resource disposition and adds a focus on tap logic. Dependencies: ``` implementation 'androidx.camera:camera-camera2:1.1.0-alpha11' implementation 'androidx.camera:camera-view:1.0.0-alpha31' implementation 'androidx.camera:camera-lifecycle...
I've created a library to use CameraX in Jetpack Compose. It might be useful until an official library comes out. <https://github.com/skgmn/CameraXX> In your build.gradle, (requires GitHub personal access token) ``` implementation "com.github.skgmn:cameraxx-composable:0.3.0" ``` Composable method signature ```kot...
25,373,554
XCode 6 Beta 5 and autocomplete stopped working. I thought problem in Beta 5 but I've reinstall to Beta 4 and it's still not work but it did before. I check preferences for "suggests" and I tried to delete Derived Data but it doesn't help
2014/08/18
[ "https://Stackoverflow.com/questions/25373554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1146533/" ]
I found the solution. Problem was in an array. I have big array like: `let array:[NSString] = ["first","second"...]` I changed it to `var array = ["first","second"...]` I don't why it's happened but it works. It was so hard to find the problem.
Check if the .m file has been checked in "Target Membership"
25,373,554
XCode 6 Beta 5 and autocomplete stopped working. I thought problem in Beta 5 but I've reinstall to Beta 4 and it's still not work but it did before. I check preferences for "suggests" and I tried to delete Derived Data but it doesn't help
2014/08/18
[ "https://Stackoverflow.com/questions/25373554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1146533/" ]
This happened to me recently because I had a /\* \*/ style comment after the @end of my @implementation. Not sure why that would break autocomplete but moving the comment into the implementation fixed autocomplete. There seems to be a lot of reasons autocomplete breaks. Just adding to the list..
I was having this problem. This is what worked for me. 1. Clear derived data. Window -> Organizer -> "Select you project" -> Delete Derived Data. 2. Clean the project 3. Quit Xcode ----- this is very important. You might have to restart you computer. 4. Open Xcode again Hope this works for you. This worked on 2...
25,373,554
XCode 6 Beta 5 and autocomplete stopped working. I thought problem in Beta 5 but I've reinstall to Beta 4 and it's still not work but it did before. I check preferences for "suggests" and I tried to delete Derived Data but it doesn't help
2014/08/18
[ "https://Stackoverflow.com/questions/25373554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1146533/" ]
Check if the .m file has been checked in "Target Membership"
For me it was because it was a new problem since upgrading my version of Xcode. After downloading the documentation again, everything worked fine.
25,373,554
XCode 6 Beta 5 and autocomplete stopped working. I thought problem in Beta 5 but I've reinstall to Beta 4 and it's still not work but it did before. I check preferences for "suggests" and I tried to delete Derived Data but it doesn't help
2014/08/18
[ "https://Stackoverflow.com/questions/25373554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1146533/" ]
1. Clear derived data. 2. Under build settings, select Always Search User Paths to "YES". 3. Clean the project.
Tried to clean/delete derived data multiple times. Autocomplete was disabled in some files, but not App Delegate. After a while I saw red libraries int he project navigator. Those are managed by cocoapods. The solution turned out to be: * Navigate to the project root folder * Delete "Pods" directory * open terminal, t...
25,373,554
XCode 6 Beta 5 and autocomplete stopped working. I thought problem in Beta 5 but I've reinstall to Beta 4 and it's still not work but it did before. I check preferences for "suggests" and I tried to delete Derived Data but it doesn't help
2014/08/18
[ "https://Stackoverflow.com/questions/25373554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1146533/" ]
I found the solution. Problem was in an array. I have big array like: `let array:[NSString] = ["first","second"...]` I changed it to `var array = ["first","second"...]` I don't why it's happened but it works. It was so hard to find the problem.
Tried to clean/delete derived data multiple times. Autocomplete was disabled in some files, but not App Delegate. After a while I saw red libraries int he project navigator. Those are managed by cocoapods. The solution turned out to be: * Navigate to the project root folder * Delete "Pods" directory * open terminal, t...
25,373,554
XCode 6 Beta 5 and autocomplete stopped working. I thought problem in Beta 5 but I've reinstall to Beta 4 and it's still not work but it did before. I check preferences for "suggests" and I tried to delete Derived Data but it doesn't help
2014/08/18
[ "https://Stackoverflow.com/questions/25373554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1146533/" ]
I was having this problem. This is what worked for me. 1. Clear derived data. Window -> Organizer -> "Select you project" -> Delete Derived Data. 2. Clean the project 3. Quit Xcode ----- this is very important. You might have to restart you computer. 4. Open Xcode again Hope this works for you. This worked on 2...
Tried to clean/delete derived data multiple times. Autocomplete was disabled in some files, but not App Delegate. After a while I saw red libraries int he project navigator. Those are managed by cocoapods. The solution turned out to be: * Navigate to the project root folder * Delete "Pods" directory * open terminal, t...
25,373,554
XCode 6 Beta 5 and autocomplete stopped working. I thought problem in Beta 5 but I've reinstall to Beta 4 and it's still not work but it did before. I check preferences for "suggests" and I tried to delete Derived Data but it doesn't help
2014/08/18
[ "https://Stackoverflow.com/questions/25373554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1146533/" ]
I found the solution. Problem was in an array. I have big array like: `let array:[NSString] = ["first","second"...]` I changed it to `var array = ["first","second"...]` I don't why it's happened but it works. It was so hard to find the problem.
I was having this problem. This is what worked for me. 1. Clear derived data. Window -> Organizer -> "Select you project" -> Delete Derived Data. 2. Clean the project 3. Quit Xcode ----- this is very important. You might have to restart you computer. 4. Open Xcode again Hope this works for you. This worked on 2...
25,373,554
XCode 6 Beta 5 and autocomplete stopped working. I thought problem in Beta 5 but I've reinstall to Beta 4 and it's still not work but it did before. I check preferences for "suggests" and I tried to delete Derived Data but it doesn't help
2014/08/18
[ "https://Stackoverflow.com/questions/25373554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1146533/" ]
1. Clear derived data. 2. Under build settings, select Always Search User Paths to "YES". 3. Clean the project.
This happened to me recently because I had a /\* \*/ style comment after the @end of my @implementation. Not sure why that would break autocomplete but moving the comment into the implementation fixed autocomplete. There seems to be a lot of reasons autocomplete breaks. Just adding to the list..
25,373,554
XCode 6 Beta 5 and autocomplete stopped working. I thought problem in Beta 5 but I've reinstall to Beta 4 and it's still not work but it did before. I check preferences for "suggests" and I tried to delete Derived Data but it doesn't help
2014/08/18
[ "https://Stackoverflow.com/questions/25373554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1146533/" ]
Check if the .m file has been checked in "Target Membership"
Tried to clean/delete derived data multiple times. Autocomplete was disabled in some files, but not App Delegate. After a while I saw red libraries int he project navigator. Those are managed by cocoapods. The solution turned out to be: * Navigate to the project root folder * Delete "Pods" directory * open terminal, t...
25,373,554
XCode 6 Beta 5 and autocomplete stopped working. I thought problem in Beta 5 but I've reinstall to Beta 4 and it's still not work but it did before. I check preferences for "suggests" and I tried to delete Derived Data but it doesn't help
2014/08/18
[ "https://Stackoverflow.com/questions/25373554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1146533/" ]
1. Clear derived data. 2. Under build settings, select Always Search User Paths to "YES". 3. Clean the project.
For me it was because it was a new problem since upgrading my version of Xcode. After downloading the documentation again, everything worked fine.
360,228
Consider a $n \times n$ matrix $A=(a\_{ij})$ with $a\_{12}=1$, $a\_{ij} =0 \ \forall \ (i,j) \neq (1,2)$. Prove that there is no invertible matrix $P$ such that $PAP^{-1}$ is a diagonal matrix. Any help?
2013/04/13
[ "https://math.stackexchange.com/questions/360228", "https://math.stackexchange.com", "https://math.stackexchange.com/users/72382/" ]
If there's some invertible $P$ such that $$PAP^{-1}=D$$ is diagonal, then $$PA^2P^{-1}=D^2$$ $$\Rightarrow P0P^{-1}=D^2$$ $$\Rightarrow D=0$$ So $$A=0$$ a contradiction.
Observe that $A$ is upper triangular, so that you can read off the eigenvalues of $A$. What are the eigenvalues of $A$, then? What would this fact imply about $PAP^{-1}$ if such a $P$ existed?
360,228
Consider a $n \times n$ matrix $A=(a\_{ij})$ with $a\_{12}=1$, $a\_{ij} =0 \ \forall \ (i,j) \neq (1,2)$. Prove that there is no invertible matrix $P$ such that $PAP^{-1}$ is a diagonal matrix. Any help?
2013/04/13
[ "https://math.stackexchange.com/questions/360228", "https://math.stackexchange.com", "https://math.stackexchange.com/users/72382/" ]
If there's some invertible $P$ such that $$PAP^{-1}=D$$ is diagonal, then $$PA^2P^{-1}=D^2$$ $$\Rightarrow P0P^{-1}=D^2$$ $$\Rightarrow D=0$$ So $$A=0$$ a contradiction.
For the sake of exploring different methods of proof, here's my take: if $PAP^{-1}$ is equal to some diagonal matrix $D$, then $D\neq0$. Yet, $\operatorname{trace}(PAP^{-1})=0$. Hence $D$ has at least two nonzero diagonal entries. Consequently, $\operatorname{rank}(D)\ge2>1=\operatorname{rank}(A)$, which is a contradic...
28,443,871
I have all the required dependencies in the Module Settings. I have also installed all the support libraries using the sdk manager. I get the following output from the Gradle Console ``` Executing tasks: [:app:assembleDebug] Configuration on demand is an incubating feature. :app:preBuild :app:compileDebugNdk :app:p...
2015/02/10
[ "https://Stackoverflow.com/questions/28443871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4552638/" ]
Make a script with a loop: ``` while (1) { plot "a.dat" pause 1 # waiting time in seconds } ``` Execute it with `gnuplot script.gp`. --- For purposes of code structure and debugging, you might prefer the following alternative: ``` plot "a.dat" while (1) { replot pause 1 } ``` This has the ...
If `gnuplot` is called with plot commands in the command line (option `-e`) instead of a command script file, only the version ``` gnuplot -e "...plot command(s)...; while (1) { pause 1; replot; }" ``` worked in my case, the other version ``` gnuplot -e "...plot command(s)...; pause 1; reread;" ``` did not. On ...
4,898,053
This is my problem, I have the main view which only shows one button, pressing this button another view is shown. This view has only another button, when this button is push this current view finishs and the control backs to the previous view. To show the second view I use startActivityForResult, I put the code here. ...
2011/02/04
[ "https://Stackoverflow.com/questions/4898053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/603142/" ]
I can't explain what is happening in your code but I have a project sample to do this.. a FooActivity with just a button btnFoo: ``` @Override protected void onStart() { super.onStart(); btnFoo.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { ...
Use this ``` Intent returnIntent = new Intent(); setResult(RESULT_OK,returnIntent); ``` instead of ``` setResult(RESULT_OK); ``` only
4,898,053
This is my problem, I have the main view which only shows one button, pressing this button another view is shown. This view has only another button, when this button is push this current view finishs and the control backs to the previous view. To show the second view I use startActivityForResult, I put the code here. ...
2011/02/04
[ "https://Stackoverflow.com/questions/4898053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/603142/" ]
here, ``` @Override public void onBackPressed() { setResult(Activity.RESULT_OK); finish(); } ``` does work to return(RESULT\_OK) by pressing the BACK button. Do NOT call `super.onBackPressed()`.
Use this ``` Intent returnIntent = new Intent(); setResult(RESULT_OK,returnIntent); ``` instead of ``` setResult(RESULT_OK); ``` only
4,898,053
This is my problem, I have the main view which only shows one button, pressing this button another view is shown. This view has only another button, when this button is push this current view finishs and the control backs to the previous view. To show the second view I use startActivityForResult, I put the code here. ...
2011/02/04
[ "https://Stackoverflow.com/questions/4898053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/603142/" ]
I can't explain what is happening in your code but I have a project sample to do this.. a FooActivity with just a button btnFoo: ``` @Override protected void onStart() { super.onStart(); btnFoo.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { ...
here, ``` @Override public void onBackPressed() { setResult(Activity.RESULT_OK); finish(); } ``` does work to return(RESULT\_OK) by pressing the BACK button. Do NOT call `super.onBackPressed()`.
11,110,900
How can I go about doing this so if the "if" statement is true, to skip the code below the foreach loop and to go on with the rest of the program ``` void() { foreach() { if() { } } //code I want to skip if "if" statement is true } ```
2012/06/19
[ "https://Stackoverflow.com/questions/11110900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455112/" ]
I know this was already answered, but I figured I'd throw in my 2 cents since nobody considered abstracting the check to a separate method: ``` void() { if (ShouldDoStuff(myCollection)) DoStuff(myCollection); else DoOtherStuff(myCollection); } private bool ShouldDoStuff(collection) { forea...
As was mentioned in my comment you may do this through extra bool variable. ``` void() { bool positiveResult; // by default it gets false value foreach() { if() { positiveResult = true; // you may use "break" to skip the loop ...
11,110,900
How can I go about doing this so if the "if" statement is true, to skip the code below the foreach loop and to go on with the rest of the program ``` void() { foreach() { if() { } } //code I want to skip if "if" statement is true } ```
2012/06/19
[ "https://Stackoverflow.com/questions/11110900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455112/" ]
I know this was already answered, but I figured I'd throw in my 2 cents since nobody considered abstracting the check to a separate method: ``` void() { if (ShouldDoStuff(myCollection)) DoStuff(myCollection); else DoOtherStuff(myCollection); } private bool ShouldDoStuff(collection) { forea...
``` void() { bool process = true; foreach() { if() { process = false; break; } } if (process) { //code I want to skip if "if" statement is true } } ```
11,110,900
How can I go about doing this so if the "if" statement is true, to skip the code below the foreach loop and to go on with the rest of the program ``` void() { foreach() { if() { } } //code I want to skip if "if" statement is true } ```
2012/06/19
[ "https://Stackoverflow.com/questions/11110900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455112/" ]
I know this was already answered, but I figured I'd throw in my 2 cents since nobody considered abstracting the check to a separate method: ``` void() { if (ShouldDoStuff(myCollection)) DoStuff(myCollection); else DoOtherStuff(myCollection); } private bool ShouldDoStuff(collection) { forea...
The 'break' keyword will break out of the loop. ``` foreach (someClass a in someArray) { if(a.someProperty) // bool property { //Stuff to do if that condition is true doSomethingElse(); //Calling the break keyword will stop the loop and jump immediately outside of it break; } //Other code to ...
11,110,900
How can I go about doing this so if the "if" statement is true, to skip the code below the foreach loop and to go on with the rest of the program ``` void() { foreach() { if() { } } //code I want to skip if "if" statement is true } ```
2012/06/19
[ "https://Stackoverflow.com/questions/11110900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455112/" ]
There's no way to directly do what you want (without "goto" labels -- perish the thought!), but you can use the "break" keyword, and set a variable you can refer to later. ``` void() { var testWasTrue = false; foreach() { if() { testWasTrue = true; break; // break o...
I know this was already answered, but I figured I'd throw in my 2 cents since nobody considered abstracting the check to a separate method: ``` void() { if (ShouldDoStuff(myCollection)) DoStuff(myCollection); else DoOtherStuff(myCollection); } private bool ShouldDoStuff(collection) { forea...
11,110,900
How can I go about doing this so if the "if" statement is true, to skip the code below the foreach loop and to go on with the rest of the program ``` void() { foreach() { if() { } } //code I want to skip if "if" statement is true } ```
2012/06/19
[ "https://Stackoverflow.com/questions/11110900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455112/" ]
The 'break' keyword will break out of the loop. ``` foreach (someClass a in someArray) { if(a.someProperty) // bool property { //Stuff to do if that condition is true doSomethingElse(); //Calling the break keyword will stop the loop and jump immediately outside of it break; } //Other code to ...
``` void() { bool skip = false; foreach() { if() { skip = true; } } if(!skip) { //code I want to skip if "if" statement is true } } ```
11,110,900
How can I go about doing this so if the "if" statement is true, to skip the code below the foreach loop and to go on with the rest of the program ``` void() { foreach() { if() { } } //code I want to skip if "if" statement is true } ```
2012/06/19
[ "https://Stackoverflow.com/questions/11110900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455112/" ]
There's no way to directly do what you want (without "goto" labels -- perish the thought!), but you can use the "break" keyword, and set a variable you can refer to later. ``` void() { var testWasTrue = false; foreach() { if() { testWasTrue = true; break; // break o...
Only way I know how is a bool flag. ``` void() { bool x = false; foreach() { if() { x = true; break; } } if(!x) { //Code to skip if "if" statement is true. } } ``` Not super elegant, but easy. Edit: beat by 12 secs :)
11,110,900
How can I go about doing this so if the "if" statement is true, to skip the code below the foreach loop and to go on with the rest of the program ``` void() { foreach() { if() { } } //code I want to skip if "if" statement is true } ```
2012/06/19
[ "https://Stackoverflow.com/questions/11110900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455112/" ]
``` void() { bool process = true; foreach() { if() { process = false; break; } } if (process) { //code I want to skip if "if" statement is true } } ```
If the collection you are iterating through contains The IEnumerable Interface, You could use Any() with a Lambda! ``` int[] myArray = { 1, 2, 3 }; if( myArray.Any((a) => a == 1) ) { return; } ``` It is read: if my array contains any value a where ...
11,110,900
How can I go about doing this so if the "if" statement is true, to skip the code below the foreach loop and to go on with the rest of the program ``` void() { foreach() { if() { } } //code I want to skip if "if" statement is true } ```
2012/06/19
[ "https://Stackoverflow.com/questions/11110900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455112/" ]
I know this was already answered, but I figured I'd throw in my 2 cents since nobody considered abstracting the check to a separate method: ``` void() { if (ShouldDoStuff(myCollection)) DoStuff(myCollection); else DoOtherStuff(myCollection); } private bool ShouldDoStuff(collection) { forea...
If the collection you are iterating through contains The IEnumerable Interface, You could use Any() with a Lambda! ``` int[] myArray = { 1, 2, 3 }; if( myArray.Any((a) => a == 1) ) { return; } ``` It is read: if my array contains any value a where ...
11,110,900
How can I go about doing this so if the "if" statement is true, to skip the code below the foreach loop and to go on with the rest of the program ``` void() { foreach() { if() { } } //code I want to skip if "if" statement is true } ```
2012/06/19
[ "https://Stackoverflow.com/questions/11110900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455112/" ]
The 'break' keyword will break out of the loop. ``` foreach (someClass a in someArray) { if(a.someProperty) // bool property { //Stuff to do if that condition is true doSomethingElse(); //Calling the break keyword will stop the loop and jump immediately outside of it break; } //Other code to ...
Only way I know how is a bool flag. ``` void() { bool x = false; foreach() { if() { x = true; break; } } if(!x) { //Code to skip if "if" statement is true. } } ``` Not super elegant, but easy. Edit: beat by 12 secs :)
11,110,900
How can I go about doing this so if the "if" statement is true, to skip the code below the foreach loop and to go on with the rest of the program ``` void() { foreach() { if() { } } //code I want to skip if "if" statement is true } ```
2012/06/19
[ "https://Stackoverflow.com/questions/11110900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455112/" ]
There's no way to directly do what you want (without "goto" labels -- perish the thought!), but you can use the "break" keyword, and set a variable you can refer to later. ``` void() { var testWasTrue = false; foreach() { if() { testWasTrue = true; break; // break o...
The 'break' keyword will break out of the loop. ``` foreach (someClass a in someArray) { if(a.someProperty) // bool property { //Stuff to do if that condition is true doSomethingElse(); //Calling the break keyword will stop the loop and jump immediately outside of it break; } //Other code to ...
12,181,676
This is something I find myself wanting to do occasionally. Say I have a list of arguments. In Lisp, I can go like ``` `(imaginary-function ,@args) ``` in order to call the function with the array turned from one element into the right number of arguments. Is there similar functionality in Ruby? Or am I just using ...
2012/08/29
[ "https://Stackoverflow.com/questions/12181676", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1553178/" ]
Yes! It's called the splat operator. ``` a = [1, 44] p(*a) ```
This is the splat operator: `function(*list)`
14,335,157
I have a div into my html project gwt `<div id="myproject"></div>` how can add this into a specific vertical panel?
2013/01/15
[ "https://Stackoverflow.com/questions/14335157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1921708/" ]
I'm not really sure what you are exactly trying to achieve but the way I understand it, you could do the following. * Add a String parameter to your root job. Affect it the BUILD\_USER variable value. ie:`${BUILD_USER}` * Then just pass the Current Build Parameters in the 'Post-build Actions -> Trigger parameterized b...
For the most part it seems this question has been answered but I want to add something useful for those with multiple copies of Jenkins, and other products on their machine: I have a few Jenkins Servers linked to an SVN doing something similar to what you are trying to do. I have script save the User Name of person wh...
48,099
I have Xcode installed, but when I type `gcc` in terminal I get "command not found". Maybe I messed up the `$PATH` variable? What is suposed to be the default value? EDIT: ``` (...):/ imac2$ echo $PATH /opt/local/bin:/opt/local/sbin:/Applications/SenchaSDKTools-2.0.0-Beta/jsbuilder:/Applications/SenchaSDKTools-2.0.0...
2012/04/09
[ "https://apple.stackexchange.com/questions/48099", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/21411/" ]
You need to install the Xcode command-line developer tools. Open Xcode and go to Xcode → Preferences → Downloads, select the Components tab, and click the button next to “Command Line Tools”. See [Is the installation of Xcode from App Store enough for having the developer tools?](https://apple.stackexchange.com/q/4075...
If you installed the latest Xcode 4.3.2, you'll need to download the optional Command Line Tools component before you can use Terminal to access it. To do this, 1. click on the **Preferences…** menu 2. a new window will appear, locate and click the **Downloads** icon at the top of that window. 3. In the **Components*...
47,432,029
I've created a generic component which renders dynamic content. Idea is to render whatever child elements are provided inside the custom component. Code snippet below:- ``` <DropDownMenu {...profileDropDown}> <div className="profile-drop-down-settings"> profileProps.map(function(data, index) { <span>{da...
2017/11/22
[ "https://Stackoverflow.com/questions/47432029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6298946/" ]
Developer Enterprise Program allows you distribute your in-house apps directly to users in your organization. If you’re distributing your app outside the store, you follow a slightly different process. You don’t have access to iTunes Connect and some app services. Custom apps are distributed privately to authorized Vo...
You can make your app available to the selected members using "Test flight". But you still have to upload your app the app store but this app will be available to the members which you have given permission.
47,432,029
I've created a generic component which renders dynamic content. Idea is to render whatever child elements are provided inside the custom component. Code snippet below:- ``` <DropDownMenu {...profileDropDown}> <div className="profile-drop-down-settings"> profileProps.map(function(data, index) { <span>{da...
2017/11/22
[ "https://Stackoverflow.com/questions/47432029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6298946/" ]
Developer Enterprise Program allows you distribute your in-house apps directly to users in your organization. If you’re distributing your app outside the store, you follow a slightly different process. You don’t have access to iTunes Connect and some app services. Custom apps are distributed privately to authorized Vo...
Assuming that you already have paid Apple account, Probably what should be fit to what are you trying to achieve is the *[TestFlight](https://developer.apple.com/testflight/)*: > > TestFlight is an online service for over-the-air installation and > testing of mobile applications, currently owned by Apple Inc and onl...
47,432,029
I've created a generic component which renders dynamic content. Idea is to render whatever child elements are provided inside the custom component. Code snippet below:- ``` <DropDownMenu {...profileDropDown}> <div className="profile-drop-down-settings"> profileProps.map(function(data, index) { <span>{da...
2017/11/22
[ "https://Stackoverflow.com/questions/47432029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6298946/" ]
Assuming that you already have paid Apple account, Probably what should be fit to what are you trying to achieve is the *[TestFlight](https://developer.apple.com/testflight/)*: > > TestFlight is an online service for over-the-air installation and > testing of mobile applications, currently owned by Apple Inc and onl...
You can make your app available to the selected members using "Test flight". But you still have to upload your app the app store but this app will be available to the members which you have given permission.
2,413
I am studying Informatics and I am interested in doing a Masters in Robotics and I was checking out some unis and their courses and I saw that Robotics contains analysis and a lot of math. Why is that?
2014/01/30
[ "https://robotics.stackexchange.com/questions/2413", "https://robotics.stackexchange.com", "https://robotics.stackexchange.com/users/2538/" ]
Your mechanism will depend on the type of dispenser you want. Like if its gravity feed or not. I will assume it is, so I make this sketch to give you some idea: ![electronics candy dispenser sketch](https://i.stack.imgur.com/5EEuB.gif) The hole size will depend on how many candy you want to dispense at each stroke. (...
There are two good search terms that come to mind. The first one is a "candy machine mechansim", or "dispenser mechanism" (e.g. <http://www.woodworkingformeremortals.com/2012/10/make-candy-dispenser.html>). There are several models of off-the-shelf pet food dispensers and cereal dispensers that use this method. [![cer...
7,679,979
Bit of a weird one. I've recently started WP7 development and trying to port over an iOS app I have written. One part of the application involves placing a pin on a map using a latitude and longitude. I have this working fine using: ``` Pushpin pushpin = new Pushpin(); Location location = new Location(); locati...
2011/10/06
[ "https://Stackoverflow.com/questions/7679979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/957778/" ]
It looks to me like you might benefit from making use of the GeoCoordinate class and a ViewModel to bind your location data to application controls. A few samples have just been published that should be able to help you. The Geo-Location iPhone to Windows Phone migration sample (<http://windowsphone.interoperabilitybr...
Your specified location is invalid. If it's not a valid `GeoCoordinate`, it'll stay fixed in the middle of the screen. I'm not sure why you're using a `Location` since that's the Silverlight class, not the Windows Phone class, for the Pushpin. Are you certain you're adding the right references and using the right push...
1,589,214
Here's my scenario: Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this? i.e. instead of needing to do this: ``` exec p_MyInnerProcedure 4 exec p_MyInnerProcedure 7 exec p_MyInnerProcedure 12 exec p_MyInnerProcedure 22 exec p_MyInne...
2009/10/19
[ "https://Stackoverflow.com/questions/1589214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30006/" ]
``` CREATE TABLE #ListOfIDs (IDValue INT) DECLARE @IDs VARCHAR(50), @ID VARCHAR(5) SET @IDs = @OriginalListOfIDs + ',' WHILE LEN(@IDs) > 1 BEGIN SET @ID = SUBSTRING(@IDs, 0, CHARINDEX(',', @IDs)); INSERT INTO #ListOfIDs (IDValue) VALUES(@ID); SET @IDs = REPLACE(',' + @IDs, ',' + @ID + ',', '') END SELECT * FROM #Li...
Make a connection to your DB using a procedural programming language (here Python), and do the loop there. This way you can do complicated loops as well. ```py # make a connection to your db import pyodbc conn = pyodbc.connect(''' Driver={ODBC Driver 13 for SQL Server}; ...
1,589,214
Here's my scenario: Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this? i.e. instead of needing to do this: ``` exec p_MyInnerProcedure 4 exec p_MyInnerProcedure 7 exec p_MyInnerProcedure 12 exec p_MyInnerProcedure 22 exec p_MyInne...
2009/10/19
[ "https://Stackoverflow.com/questions/1589214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30006/" ]
I usually use the following approach ``` DECLARE @calls TABLE ( id INT IDENTITY(1,1) ,parameter INT ) INSERT INTO @calls select parameter from some_table where some_condition -- here you populate your parameters declare @i int declare @n int declare @myId int select @i = min(id), @n = max(id) from @calls...
``` CREATE TABLE #ListOfIDs (IDValue INT) DECLARE @IDs VARCHAR(50), @ID VARCHAR(5) SET @IDs = @OriginalListOfIDs + ',' WHILE LEN(@IDs) > 1 BEGIN SET @ID = SUBSTRING(@IDs, 0, CHARINDEX(',', @IDs)); INSERT INTO #ListOfIDs (IDValue) VALUES(@ID); SET @IDs = REPLACE(',' + @IDs, ',' + @ID + ',', '') END SELECT * FROM #Li...
1,589,214
Here's my scenario: Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this? i.e. instead of needing to do this: ``` exec p_MyInnerProcedure 4 exec p_MyInnerProcedure 7 exec p_MyInnerProcedure 12 exec p_MyInnerProcedure 22 exec p_MyInne...
2009/10/19
[ "https://Stackoverflow.com/questions/1589214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30006/" ]
use a static cursor variable and a [split function](http://www.sommarskog.se/arrays-in-sql.html): ``` declare @comma_delimited_list varchar(4000) set @comma_delimited_list = '4,7,12,22,19' declare @cursor cursor set @cursor = cursor static for select convert(int, Value) as Id from dbo.Split(@comma_delimited_list) ...
I usually use the following approach ``` DECLARE @calls TABLE ( id INT IDENTITY(1,1) ,parameter INT ) INSERT INTO @calls select parameter from some_table where some_condition -- here you populate your parameters declare @i int declare @n int declare @myId int select @i = min(id), @n = max(id) from @calls...
1,589,214
Here's my scenario: Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this? i.e. instead of needing to do this: ``` exec p_MyInnerProcedure 4 exec p_MyInnerProcedure 7 exec p_MyInnerProcedure 12 exec p_MyInnerProcedure 22 exec p_MyInne...
2009/10/19
[ "https://Stackoverflow.com/questions/1589214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30006/" ]
use a static cursor variable and a [split function](http://www.sommarskog.se/arrays-in-sql.html): ``` declare @comma_delimited_list varchar(4000) set @comma_delimited_list = '4,7,12,22,19' declare @cursor cursor set @cursor = cursor static for select convert(int, Value) as Id from dbo.Split(@comma_delimited_list) ...
``` CREATE TABLE #ListOfIDs (IDValue INT) DECLARE @IDs VARCHAR(50), @ID VARCHAR(5) SET @IDs = @OriginalListOfIDs + ',' WHILE LEN(@IDs) > 1 BEGIN SET @ID = SUBSTRING(@IDs, 0, CHARINDEX(',', @IDs)); INSERT INTO #ListOfIDs (IDValue) VALUES(@ID); SET @IDs = REPLACE(',' + @IDs, ',' + @ID + ',', '') END SELECT * FROM #Li...
1,589,214
Here's my scenario: Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this? i.e. instead of needing to do this: ``` exec p_MyInnerProcedure 4 exec p_MyInnerProcedure 7 exec p_MyInnerProcedure 12 exec p_MyInnerProcedure 22 exec p_MyInne...
2009/10/19
[ "https://Stackoverflow.com/questions/1589214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30006/" ]
``` declare @ids table(idx int identity(1,1), id int) insert into @ids (id) select 4 union select 7 union select 12 union select 22 union select 19 declare @i int declare @cnt int select @i = min(idx) - 1, @cnt = max(idx) from @ids while @i < @cnt begin select @i = @i + 1 declare @id ...
I usually use the following approach ``` DECLARE @calls TABLE ( id INT IDENTITY(1,1) ,parameter INT ) INSERT INTO @calls select parameter from some_table where some_condition -- here you populate your parameters declare @i int declare @n int declare @myId int select @i = min(id), @n = max(id) from @calls...
1,589,214
Here's my scenario: Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this? i.e. instead of needing to do this: ``` exec p_MyInnerProcedure 4 exec p_MyInnerProcedure 7 exec p_MyInnerProcedure 12 exec p_MyInnerProcedure 22 exec p_MyInne...
2009/10/19
[ "https://Stackoverflow.com/questions/1589214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30006/" ]
``` declare @ids table(idx int identity(1,1), id int) insert into @ids (id) select 4 union select 7 union select 12 union select 22 union select 19 declare @i int declare @cnt int select @i = min(idx) - 1, @cnt = max(idx) from @ids while @i < @cnt begin select @i = @i + 1 declare @id ...
use a static cursor variable and a [split function](http://www.sommarskog.se/arrays-in-sql.html): ``` declare @comma_delimited_list varchar(4000) set @comma_delimited_list = '4,7,12,22,19' declare @cursor cursor set @cursor = cursor static for select convert(int, Value) as Id from dbo.Split(@comma_delimited_list) ...
1,589,214
Here's my scenario: Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this? i.e. instead of needing to do this: ``` exec p_MyInnerProcedure 4 exec p_MyInnerProcedure 7 exec p_MyInnerProcedure 12 exec p_MyInnerProcedure 22 exec p_MyInne...
2009/10/19
[ "https://Stackoverflow.com/questions/1589214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30006/" ]
I usually use the following approach ``` DECLARE @calls TABLE ( id INT IDENTITY(1,1) ,parameter INT ) INSERT INTO @calls select parameter from some_table where some_condition -- here you populate your parameters declare @i int declare @n int declare @myId int select @i = min(id), @n = max(id) from @calls...
Make a connection to your DB using a procedural programming language (here Python), and do the loop there. This way you can do complicated loops as well. ```py # make a connection to your db import pyodbc conn = pyodbc.connect(''' Driver={ODBC Driver 13 for SQL Server}; ...
1,589,214
Here's my scenario: Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this? i.e. instead of needing to do this: ``` exec p_MyInnerProcedure 4 exec p_MyInnerProcedure 7 exec p_MyInnerProcedure 12 exec p_MyInnerProcedure 22 exec p_MyInne...
2009/10/19
[ "https://Stackoverflow.com/questions/1589214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30006/" ]
What I do in this scenario is create a table variable to hold the Ids. ``` Declare @Ids Table (id integer primary Key not null) Insert @Ids(id) values (4),(7),(12),(22),(19) ``` -- (or call another table valued function to generate this table) Then loop based on the rows in this table ``` Declare @Id Integer...
``` CREATE TABLE #ListOfIDs (IDValue INT) DECLARE @IDs VARCHAR(50), @ID VARCHAR(5) SET @IDs = @OriginalListOfIDs + ',' WHILE LEN(@IDs) > 1 BEGIN SET @ID = SUBSTRING(@IDs, 0, CHARINDEX(',', @IDs)); INSERT INTO #ListOfIDs (IDValue) VALUES(@ID); SET @IDs = REPLACE(',' + @IDs, ',' + @ID + ',', '') END SELECT * FROM #Li...
1,589,214
Here's my scenario: Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this? i.e. instead of needing to do this: ``` exec p_MyInnerProcedure 4 exec p_MyInnerProcedure 7 exec p_MyInnerProcedure 12 exec p_MyInnerProcedure 22 exec p_MyInne...
2009/10/19
[ "https://Stackoverflow.com/questions/1589214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30006/" ]
What I do in this scenario is create a table variable to hold the Ids. ``` Declare @Ids Table (id integer primary Key not null) Insert @Ids(id) values (4),(7),(12),(22),(19) ``` -- (or call another table valued function to generate this table) Then loop based on the rows in this table ``` Declare @Id Integer...
use a static cursor variable and a [split function](http://www.sommarskog.se/arrays-in-sql.html): ``` declare @comma_delimited_list varchar(4000) set @comma_delimited_list = '4,7,12,22,19' declare @cursor cursor set @cursor = cursor static for select convert(int, Value) as Id from dbo.Split(@comma_delimited_list) ...
1,589,214
Here's my scenario: Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this? i.e. instead of needing to do this: ``` exec p_MyInnerProcedure 4 exec p_MyInnerProcedure 7 exec p_MyInnerProcedure 12 exec p_MyInnerProcedure 22 exec p_MyInne...
2009/10/19
[ "https://Stackoverflow.com/questions/1589214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30006/" ]
What I do in this scenario is create a table variable to hold the Ids. ``` Declare @Ids Table (id integer primary Key not null) Insert @Ids(id) values (4),(7),(12),(22),(19) ``` -- (or call another table valued function to generate this table) Then loop based on the rows in this table ``` Declare @Id Integer...
I usually use the following approach ``` DECLARE @calls TABLE ( id INT IDENTITY(1,1) ,parameter INT ) INSERT INTO @calls select parameter from some_table where some_condition -- here you populate your parameters declare @i int declare @n int declare @myId int select @i = min(id), @n = max(id) from @calls...
52,256,906
I would like to get all tables and their columns in one table. For example: ``` Table 1 | Column1 | Column2 | Column3 | Table 2 | Column1 | Table 3 | Column1 | Column2 | Column3 | Column4 | Column5 Table 4 | Column1 | Column2 | Table 5 | Column1 | Column2 | Column3 | Column4 | Column5 Table 6 | Column1 | Column...
2018/09/10
[ "https://Stackoverflow.com/questions/52256906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10341799/" ]
Since you're only after counting the number of zeros in the `double` column, the following should help: ``` library(tidyverse) df %>% group_by(productID) %>% summarise(sum.of.zeros=sum(double==0, na.rm = T)) ``` The above sums the instances where `double` equals zero (if it equals zero, it would counted as 1 (...
Take a look at the `tidyverse` packages, and `dplyr` in particular ``` library(tidyverse) df %>% group_by( productID, from.value ) %>% summarise( amount = n_distinct( attributeID )) # # A tibble: 2 x 3 # # Groups: productID [?] # productID from.value amount # <dbl> <dbl> <int> # 1 1 ...
52,256,906
I would like to get all tables and their columns in one table. For example: ``` Table 1 | Column1 | Column2 | Column3 | Table 2 | Column1 | Table 3 | Column1 | Column2 | Column3 | Column4 | Column5 Table 4 | Column1 | Column2 | Table 5 | Column1 | Column2 | Column3 | Column4 | Column5 Table 6 | Column1 | Column...
2018/09/10
[ "https://Stackoverflow.com/questions/52256906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10341799/" ]
Since you're only after counting the number of zeros in the `double` column, the following should help: ``` library(tidyverse) df %>% group_by(productID) %>% summarise(sum.of.zeros=sum(double==0, na.rm = T)) ``` The above sums the instances where `double` equals zero (if it equals zero, it would counted as 1 (...
With `data.table` you can do: ``` library("data.table") setDT(df)[, sum(na.omit(double)==0), productID] ``` or ``` setDT(df)[, sum(double==0, na.rm=TRUE), productID] ```
55,081,041
I have been introduced to the concept of ternary operators, and it's pretty straightforward to understand the notation: `desired_variable = true ? false ? "value1" : "value2";` I could not understand, however, the rational behind adding a second variable, even if I understand the answer. To use a classic example: ``...
2019/03/09
[ "https://Stackoverflow.com/questions/55081041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5321011/" ]
You can understand by this example. ``` x ? ( y ? a : b ) : c | |________true ---> y ? a : b | |________false ---> c ``` * first check the value of `x` if it is true it will run `y ? a : b` (i have added `()` just for readability ) * If it is false it will go to `c` You can simply understand it same as if/else, ...
Ternary expressions have 3 expressions inside of them. However, because ternary expressions are themselves expressions you can put ternary expressions inside other ternary expressions. The ternary expressions in your example above look so confusing because they are multiple nested ternary expressions. This confusion ca...
55,081,041
I have been introduced to the concept of ternary operators, and it's pretty straightforward to understand the notation: `desired_variable = true ? false ? "value1" : "value2";` I could not understand, however, the rational behind adding a second variable, even if I understand the answer. To use a classic example: ``...
2019/03/09
[ "https://Stackoverflow.com/questions/55081041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5321011/" ]
You can understand by this example. ``` x ? ( y ? a : b ) : c | |________true ---> y ? a : b | |________false ---> c ``` * first check the value of `x` if it is true it will run `y ? a : b` (i have added `()` just for readability ) * If it is false it will go to `c` You can simply understand it same as if/else, ...
To get a right result, you could group the ternaries and maintain the same level of decisions. ```js var eatsPlants = false, eatsAnimals = false, category = eatsPlants ? eatsAnimals ? "omnivore" : "herbivore" : eatsAnimals ? "carnivore" : ...
55,081,041
I have been introduced to the concept of ternary operators, and it's pretty straightforward to understand the notation: `desired_variable = true ? false ? "value1" : "value2";` I could not understand, however, the rational behind adding a second variable, even if I understand the answer. To use a classic example: ``...
2019/03/09
[ "https://Stackoverflow.com/questions/55081041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5321011/" ]
You can understand by this example. ``` x ? ( y ? a : b ) : c | |________true ---> y ? a : b | |________false ---> c ``` * first check the value of `x` if it is true it will run `y ? a : b` (i have added `()` just for readability ) * If it is false it will go to `c` You can simply understand it same as if/else, ...
You cannot change the order between `then` and `else` parts, as that affects the outcome (if you don't also negate the condition). You can however change the nesting, and write either ``` category = eatsPlants ? eatsAnimals ? "omnivore" : "herbivore" : eatsAnimals ? "carnivore" : undefined;...
55,081,041
I have been introduced to the concept of ternary operators, and it's pretty straightforward to understand the notation: `desired_variable = true ? false ? "value1" : "value2";` I could not understand, however, the rational behind adding a second variable, even if I understand the answer. To use a classic example: ``...
2019/03/09
[ "https://Stackoverflow.com/questions/55081041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5321011/" ]
You can understand by this example. ``` x ? ( y ? a : b ) : c | |________true ---> y ? a : b | |________false ---> c ``` * first check the value of `x` if it is true it will run `y ? a : b` (i have added `()` just for readability ) * If it is false it will go to `c` You can simply understand it same as if/else, ...
A ternary operation always takes three operands, like: ``` inputExpression ? outputExpressionIfTrue : outputExpressionIfFalse ``` The code in the question is using the output from some ternary operations as the input expression for others, which can be seen more clearly if we format it like in this code snippet. In ...
55,081,041
I have been introduced to the concept of ternary operators, and it's pretty straightforward to understand the notation: `desired_variable = true ? false ? "value1" : "value2";` I could not understand, however, the rational behind adding a second variable, even if I understand the answer. To use a classic example: ``...
2019/03/09
[ "https://Stackoverflow.com/questions/55081041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5321011/" ]
Ternary expressions have 3 expressions inside of them. However, because ternary expressions are themselves expressions you can put ternary expressions inside other ternary expressions. The ternary expressions in your example above look so confusing because they are multiple nested ternary expressions. This confusion ca...
You cannot change the order between `then` and `else` parts, as that affects the outcome (if you don't also negate the condition). You can however change the nesting, and write either ``` category = eatsPlants ? eatsAnimals ? "omnivore" : "herbivore" : eatsAnimals ? "carnivore" : undefined;...
55,081,041
I have been introduced to the concept of ternary operators, and it's pretty straightforward to understand the notation: `desired_variable = true ? false ? "value1" : "value2";` I could not understand, however, the rational behind adding a second variable, even if I understand the answer. To use a classic example: ``...
2019/03/09
[ "https://Stackoverflow.com/questions/55081041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5321011/" ]
Ternary expressions have 3 expressions inside of them. However, because ternary expressions are themselves expressions you can put ternary expressions inside other ternary expressions. The ternary expressions in your example above look so confusing because they are multiple nested ternary expressions. This confusion ca...
A ternary operation always takes three operands, like: ``` inputExpression ? outputExpressionIfTrue : outputExpressionIfFalse ``` The code in the question is using the output from some ternary operations as the input expression for others, which can be seen more clearly if we format it like in this code snippet. In ...
55,081,041
I have been introduced to the concept of ternary operators, and it's pretty straightforward to understand the notation: `desired_variable = true ? false ? "value1" : "value2";` I could not understand, however, the rational behind adding a second variable, even if I understand the answer. To use a classic example: ``...
2019/03/09
[ "https://Stackoverflow.com/questions/55081041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5321011/" ]
To get a right result, you could group the ternaries and maintain the same level of decisions. ```js var eatsPlants = false, eatsAnimals = false, category = eatsPlants ? eatsAnimals ? "omnivore" : "herbivore" : eatsAnimals ? "carnivore" : ...
You cannot change the order between `then` and `else` parts, as that affects the outcome (if you don't also negate the condition). You can however change the nesting, and write either ``` category = eatsPlants ? eatsAnimals ? "omnivore" : "herbivore" : eatsAnimals ? "carnivore" : undefined;...
55,081,041
I have been introduced to the concept of ternary operators, and it's pretty straightforward to understand the notation: `desired_variable = true ? false ? "value1" : "value2";` I could not understand, however, the rational behind adding a second variable, even if I understand the answer. To use a classic example: ``...
2019/03/09
[ "https://Stackoverflow.com/questions/55081041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5321011/" ]
To get a right result, you could group the ternaries and maintain the same level of decisions. ```js var eatsPlants = false, eatsAnimals = false, category = eatsPlants ? eatsAnimals ? "omnivore" : "herbivore" : eatsAnimals ? "carnivore" : ...
A ternary operation always takes three operands, like: ``` inputExpression ? outputExpressionIfTrue : outputExpressionIfFalse ``` The code in the question is using the output from some ternary operations as the input expression for others, which can be seen more clearly if we format it like in this code snippet. In ...
13,701,923
I have a search form ``` <input id="price_from" value="price from "> <input id="price_to" value="price to "> <button>search</button> ``` How can I disable editing of dafault text? When user starts to type in price amount it's not possible to edit "price from " and "price to " but they stay in input field. I've tried...
2012/12/04
[ "https://Stackoverflow.com/questions/13701923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540196/" ]
You can either use the `readonly` or the `disabled` attribute. Note that when disabled, the input's value will not be submitted when submitting the form. ``` <input id="price_to" value="price to" readonly="readonly"> <input id="price_to" value="price to" disabled="disabled"> ```
I'm not sure I understand the question correctly, but if you want to prevent people from writing in the input field you can use the `disabled` attribute. ``` <input disabled="disabled" id="price_from" value="price from "> ```
13,701,923
I have a search form ``` <input id="price_from" value="price from "> <input id="price_to" value="price to "> <button>search</button> ``` How can I disable editing of dafault text? When user starts to type in price amount it's not possible to edit "price from " and "price to " but they stay in input field. I've tried...
2012/12/04
[ "https://Stackoverflow.com/questions/13701923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540196/" ]
You can either use the `readonly` or the `disabled` attribute. Note that when disabled, the input's value will not be submitted when submitting the form. ``` <input id="price_to" value="price to" readonly="readonly"> <input id="price_to" value="price to" disabled="disabled"> ```
How about `disabled=disabled`: ``` <input id="price_from" value="price from " disabled="disabled">​​​​​​​​​​​​ ``` Problem is if you don't want user to edit them, why display them in input? You can hide them even if you want to submit a form. And to display information, just use other tag instead.
13,701,923
I have a search form ``` <input id="price_from" value="price from "> <input id="price_to" value="price to "> <button>search</button> ``` How can I disable editing of dafault text? When user starts to type in price amount it's not possible to edit "price from " and "price to " but they stay in input field. I've tried...
2012/12/04
[ "https://Stackoverflow.com/questions/13701923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540196/" ]
You can either use the `readonly` or the `disabled` attribute. Note that when disabled, the input's value will not be submitted when submitting the form. ``` <input id="price_to" value="price to" readonly="readonly"> <input id="price_to" value="price to" disabled="disabled"> ```
I don't think all the other answerers understood the question correctly. The question requires disabling editing **part of the text**. One solution I can think of is simulating a textbox with a **fixed** prefix which is not part of the textarea or input. An example of this approach is: ``` <div style="border:1px soli...
13,701,923
I have a search form ``` <input id="price_from" value="price from "> <input id="price_to" value="price to "> <button>search</button> ``` How can I disable editing of dafault text? When user starts to type in price amount it's not possible to edit "price from " and "price to " but they stay in input field. I've tried...
2012/12/04
[ "https://Stackoverflow.com/questions/13701923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540196/" ]
You can either use the `readonly` or the `disabled` attribute. Note that when disabled, the input's value will not be submitted when submitting the form. ``` <input id="price_to" value="price to" readonly="readonly"> <input id="price_to" value="price to" disabled="disabled"> ```
So, i came across this problem in angular and I made a directive to solve this problem. so my problem was with social link urls. so my directive is some what like.. below are my input fields with default urls: ``` <input type="text" formControlName="twitter" id="twitter" class="form-control inputBox" placeholder="URL...
13,701,923
I have a search form ``` <input id="price_from" value="price from "> <input id="price_to" value="price to "> <button>search</button> ``` How can I disable editing of dafault text? When user starts to type in price amount it's not possible to edit "price from " and "price to " but they stay in input field. I've tried...
2012/12/04
[ "https://Stackoverflow.com/questions/13701923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540196/" ]
I'm not sure I understand the question correctly, but if you want to prevent people from writing in the input field you can use the `disabled` attribute. ``` <input disabled="disabled" id="price_from" value="price from "> ```
How about `disabled=disabled`: ``` <input id="price_from" value="price from " disabled="disabled">​​​​​​​​​​​​ ``` Problem is if you don't want user to edit them, why display them in input? You can hide them even if you want to submit a form. And to display information, just use other tag instead.
13,701,923
I have a search form ``` <input id="price_from" value="price from "> <input id="price_to" value="price to "> <button>search</button> ``` How can I disable editing of dafault text? When user starts to type in price amount it's not possible to edit "price from " and "price to " but they stay in input field. I've tried...
2012/12/04
[ "https://Stackoverflow.com/questions/13701923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540196/" ]
I'm not sure I understand the question correctly, but if you want to prevent people from writing in the input field you can use the `disabled` attribute. ``` <input disabled="disabled" id="price_from" value="price from "> ```
So, i came across this problem in angular and I made a directive to solve this problem. so my problem was with social link urls. so my directive is some what like.. below are my input fields with default urls: ``` <input type="text" formControlName="twitter" id="twitter" class="form-control inputBox" placeholder="URL...
13,701,923
I have a search form ``` <input id="price_from" value="price from "> <input id="price_to" value="price to "> <button>search</button> ``` How can I disable editing of dafault text? When user starts to type in price amount it's not possible to edit "price from " and "price to " but they stay in input field. I've tried...
2012/12/04
[ "https://Stackoverflow.com/questions/13701923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540196/" ]
I don't think all the other answerers understood the question correctly. The question requires disabling editing **part of the text**. One solution I can think of is simulating a textbox with a **fixed** prefix which is not part of the textarea or input. An example of this approach is: ``` <div style="border:1px soli...
How about `disabled=disabled`: ``` <input id="price_from" value="price from " disabled="disabled">​​​​​​​​​​​​ ``` Problem is if you don't want user to edit them, why display them in input? You can hide them even if you want to submit a form. And to display information, just use other tag instead.
13,701,923
I have a search form ``` <input id="price_from" value="price from "> <input id="price_to" value="price to "> <button>search</button> ``` How can I disable editing of dafault text? When user starts to type in price amount it's not possible to edit "price from " and "price to " but they stay in input field. I've tried...
2012/12/04
[ "https://Stackoverflow.com/questions/13701923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540196/" ]
I don't think all the other answerers understood the question correctly. The question requires disabling editing **part of the text**. One solution I can think of is simulating a textbox with a **fixed** prefix which is not part of the textarea or input. An example of this approach is: ``` <div style="border:1px soli...
So, i came across this problem in angular and I made a directive to solve this problem. so my problem was with social link urls. so my directive is some what like.. below are my input fields with default urls: ``` <input type="text" formControlName="twitter" id="twitter" class="form-control inputBox" placeholder="URL...
54,334,615
I have a set of file names in a list in different folders as shown below: **Input files** ``` ['ABC.dat', 'ABC10.dat', 'ABC956.dat', 'ABC_DEF_1.dat', 'ABC_DEF_2.dat', 'ABC_DEF_3.dat', 'ABC10_DEF_1.dat', 'ABC10_DEF_2.dat', 'ABC10_DEF_3.dat', 'ABC956_DEF_1.dat', 'ABC956_DEF_2.dat', 'ABC956_DEF_3.dat', 'XYZ_ABC_1.dat', ...
2019/01/23
[ "https://Stackoverflow.com/questions/54334615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4576447/" ]
You can use recursion: ``` import re def is_match(a, b): a, b = re.sub('\s\w+\.dat$', '', a).split(), re.sub('\s\w+\.dat$', '', b).split() if len(a) != len(b): return False return all(c == d if not c.isdigit() and not d.isdigit() else c.isdigit() and d.isdigit() for c, d in zip(a, b)) def group_vals(d, _cu...
You probably should try Regular Expression in Python (re library). > > **re.findall**(pattern, string, flags=0) > > Return all non-overlapping matches of pattern in string, as a list of strings. > > > ``` # suppose files is a string holds all your file names (you could join your file names together) files = "...
54,334,615
I have a set of file names in a list in different folders as shown below: **Input files** ``` ['ABC.dat', 'ABC10.dat', 'ABC956.dat', 'ABC_DEF_1.dat', 'ABC_DEF_2.dat', 'ABC_DEF_3.dat', 'ABC10_DEF_1.dat', 'ABC10_DEF_2.dat', 'ABC10_DEF_3.dat', 'ABC956_DEF_1.dat', 'ABC956_DEF_2.dat', 'ABC956_DEF_3.dat', 'XYZ_ABC_1.dat', ...
2019/01/23
[ "https://Stackoverflow.com/questions/54334615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4576447/" ]
You can use recursion: ``` import re def is_match(a, b): a, b = re.sub('\s\w+\.dat$', '', a).split(), re.sub('\s\w+\.dat$', '', b).split() if len(a) != len(b): return False return all(c == d if not c.isdigit() and not d.isdigit() else c.isdigit() and d.isdigit() for c, d in zip(a, b)) def group_vals(d, _cu...
This is based on Ajax1234's answer. It avoids that answer's redundant computation. Rather than doing a recursive partition by an equivalence relation. This does discrimination. This reduces the cost from `N**2/2` calls to `is_match` to only `N` calls to `key`. `key` uses `None` as a wildcard for the parts of the filena...
24,263,180
I am new in woo commerce. I have tried with this code But it is not working ``` function contact_concierge() { return '<a class="fsfb" href="'.site_url().'">CONTACT CONCIERGE</a>'; } add_action('woocommerce_after_cart', 'contact_concierge'); ``` I want to add the button after the singple page add to cart table. P...
2014/06/17
[ "https://Stackoverflow.com/questions/24263180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3747821/" ]
Hi does this work for you ? ``` dt$B <- apply(dt, 1, FUN = function(x) x$A[x$B]) dt$C <- apply(dt, 1, FUN = function(x) x$A[x$C]) dt # A B C #1: X,Y X Y #2: J,K K J ```
There's probably a more elegant way to do this and it doesn't scale well but here goes... ``` dt[,A1:=lapply(A,'[[',1)] dt[,A2:=lapply(A,'[[',2)] dt[B==1,`:=`(Bnew=A1,Cnew=A2)] dt[B==2,`:=`(Bnew=A2,Cnew=A1)] dt[,`:=`(A1=NULL,A2=NULL,B=NULL,C=NULL)] setnames(dt,c("Bnew","Cnew"),c("B","C")) ```
24,263,180
I am new in woo commerce. I have tried with this code But it is not working ``` function contact_concierge() { return '<a class="fsfb" href="'.site_url().'">CONTACT CONCIERGE</a>'; } add_action('woocommerce_after_cart', 'contact_concierge'); ``` I want to add the button after the singple page add to cart table. P...
2014/06/17
[ "https://Stackoverflow.com/questions/24263180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3747821/" ]
You can use `mapply` and `set` with a for loop. There may be more efficient ways ``` for(j in c('B','C')){ set(dt, j = j, value = mapply(FUN = '[', dt[['A']],dt[[j]])) } dt # A B C # 1: X,Y X Y # 2: J,K K J ```
Hi does this work for you ? ``` dt$B <- apply(dt, 1, FUN = function(x) x$A[x$B]) dt$C <- apply(dt, 1, FUN = function(x) x$A[x$C]) dt # A B C #1: X,Y X Y #2: J,K K J ```
24,263,180
I am new in woo commerce. I have tried with this code But it is not working ``` function contact_concierge() { return '<a class="fsfb" href="'.site_url().'">CONTACT CONCIERGE</a>'; } add_action('woocommerce_after_cart', 'contact_concierge'); ``` I want to add the button after the singple page add to cart table. P...
2014/06/17
[ "https://Stackoverflow.com/questions/24263180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3747821/" ]
You can use `mapply` and `set` with a for loop. There may be more efficient ways ``` for(j in c('B','C')){ set(dt, j = j, value = mapply(FUN = '[', dt[['A']],dt[[j]])) } dt # A B C # 1: X,Y X Y # 2: J,K K J ```
There's probably a more elegant way to do this and it doesn't scale well but here goes... ``` dt[,A1:=lapply(A,'[[',1)] dt[,A2:=lapply(A,'[[',2)] dt[B==1,`:=`(Bnew=A1,Cnew=A2)] dt[B==2,`:=`(Bnew=A2,Cnew=A1)] dt[,`:=`(A1=NULL,A2=NULL,B=NULL,C=NULL)] setnames(dt,c("Bnew","Cnew"),c("B","C")) ```
52,748,336
I have a FrameLayout which contains an EditText and a Button. ``` <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp"> <EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_heigh...
2018/10/10
[ "https://Stackoverflow.com/questions/52748336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5842014/" ]
That is because your font is italic. If you want to insert a space character in XML file use `&#160;` after `?` like this : `?&#160;`.
That's because of the padding on your button. Remove the padding and try it out.
52,748,336
I have a FrameLayout which contains an EditText and a Button. ``` <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp"> <EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_heigh...
2018/10/10
[ "https://Stackoverflow.com/questions/52748336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5842014/" ]
That is because your font is italic. If you want to insert a space character in XML file use `&#160;` after `?` like this : `?&#160;`.
If all you want is some clickable text, there's no need for a Button: ``` <TextView android:id="@+id/forgottenPassword" android:clickable="true" android:focusable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right|center_vertical" a...
19,477
In many practical applications, one can consider the Earth-Centered Inertial ([ECI](http://en.wikipedia.org/wiki/Earth_Centered_Inertial)) reference frame approximately as an inertial reference system, though strictly speaking, it is non-inertial. Is there any quotable reference, where this claim is supported by a de...
2012/01/14
[ "https://physics.stackexchange.com/questions/19477", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/2740/" ]
The only forces that have a significant impact on the motion of Earth's center-of-mass are gravitational forces. The Earth is "freely falling"; in the language of general relativity, the modern theory of gravity, it is moving along a geodesic. Because of this fact, it is automatically guaranteed that the spacetime in ...
I come from the world of precise satellite orbit determination, so my references also come from there. I realize this means most of the equations in my references relate to orbits and not general measurements, however, I do think you'll find them interesting. I think a good reference is [Fundamentals of Astrodynamics ...
62,041,617
I have a simple use case where I created 2 entities `Account` & `AccountDetail`. These entities have a one-to-one relationship as shown below: [table relationship](https://i.stack.imgur.com/0YNYb.png) The `Account` entity: ``` @Entity @Builder @AllArgsConstructor @NoArgsConstructor @Setter @Getter @EqualsAndHashCode...
2020/05/27
[ "https://Stackoverflow.com/questions/62041617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13518963/" ]
Just use the datanode you created, no need for an inner div, if you don't want one. ``` <script> var jsondata = {"45": {"id":"45","firstname":"Remy","lastname":"Janssen","age":"32"},"72":{"id":"72","firstname":"Anita","lastname":"Janssen","age":45}}; function display( jsdata ){ for ( var key in jsdata ){ ...
You might be overcomplicating it, see a simplified version that gives your required output: ```js var jsondata = { "45": { "id":"45", "firstname":"Remy", "lastname":"Janssen", "age":"32" }, "72": { "id":"72", "firstname":"Anita", "lastname":"Janssen", "age":45 } }; ...
4,448,811
I want to deploy a Sitecore test site I've been playing with from a single developer platform (everything on one local PC) to something more like a test environment (dedicated IIS and SQL servers, virtual access to IIS). I don't really need to worry too much about team development and source control right now, though d...
2010/12/15
[ "https://Stackoverflow.com/questions/4448811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/528656/" ]
Fortunately, moving a Sitecore installation around is a fairly simple task, and there are a number of approaches you could be using. Here's what I would normally do (somewhat simplified). * Set the target environment up. Meaning IIS, SQL Server, security settings and so on * Detach my local databases, stop the local I...
With regards to Installer vs Zip I've always prefered the zip. It seems faster and I get to control the whole process... plus the first installers I played with never seemed to work that well or at all. With regards to moving a site, I'd say make a cleaned up zip of the solution. there are things that are not needed...
501,407
Suppose $L$ be a Vector Space of Polynomials of $x$ of degree $\leq n-1$ with coefficients in the field $\mathbb{K}$. Define $$g\_i(x) :=\prod \_ {{j=1},{j\neq i}}^n \frac{x-a\_j}{a\_i-a\_j}$$ Show that the polynomials $g\_1(x), g\_2(x),...,g\_n(x)$ form a basis of L. Furthermore, show that coordinates of polynomial $...
2013/09/22
[ "https://math.stackexchange.com/questions/501407", "https://math.stackexchange.com", "https://math.stackexchange.com/users/71939/" ]
Here is very easy method to show that they are linearly independent. Suppose that $$b\_1g\_1(x)+b\_2g\_2(x)+...+b\_ng\_n(x)=0$$ To show linear independence, it suffices to show that $$b\_1=b\_2=...=b\_n=0$$ Evaluate $$b\_1g\_1(x)+b\_2g\_2(x)+...+b\_ng\_n(x)=0$$ at $$x=a\_i\;\;\;\;\forall i\le n$$ You can notice that...
Choose arbitrary $f\in L$. Let be $$\tilde{f}(x) = \sum\_{i = 1}^{n}f(a\_i)g\_i(x)\text{.} $$ For every $x\in \{a\_1,\dots, a\_n\}$ we have $f(x) = \tilde{f}(x)$, so the polynomial $p= f - \tilde{f}$ has $n$ zeros and $\deg p \leq n-1$, so $p(x) = 0$ for every $x\in \mathbb{R}$. So $g\_i$ span $L$. We know that $\dim ...
501,407
Suppose $L$ be a Vector Space of Polynomials of $x$ of degree $\leq n-1$ with coefficients in the field $\mathbb{K}$. Define $$g\_i(x) :=\prod \_ {{j=1},{j\neq i}}^n \frac{x-a\_j}{a\_i-a\_j}$$ Show that the polynomials $g\_1(x), g\_2(x),...,g\_n(x)$ form a basis of L. Furthermore, show that coordinates of polynomial $...
2013/09/22
[ "https://math.stackexchange.com/questions/501407", "https://math.stackexchange.com", "https://math.stackexchange.com/users/71939/" ]
Choose arbitrary $f\in L$. Let be $$\tilde{f}(x) = \sum\_{i = 1}^{n}f(a\_i)g\_i(x)\text{.} $$ For every $x\in \{a\_1,\dots, a\_n\}$ we have $f(x) = \tilde{f}(x)$, so the polynomial $p= f - \tilde{f}$ has $n$ zeros and $\deg p \leq n-1$, so $p(x) = 0$ for every $x\in \mathbb{R}$. So $g\_i$ span $L$. We know that $\dim ...
You missed the hypothesis that the $a\_i$ are pairwise distinct. Alternatively, consider the functionals $\eta\_i$ with $P\mapsto P(a\_i)$ in $V=(\Bbb R\_{n-1}[X])^\ast$, and suppose $$\sum\_{i=1}^n\lambda\_i\eta\_i=0$$ Evaluating at $1,X,X^2,\ldots,X^{n-1}$ we get $n$ equations $k=0,1,2,\ldots,n$. $$\sum\_{i=1}^n\l...
501,407
Suppose $L$ be a Vector Space of Polynomials of $x$ of degree $\leq n-1$ with coefficients in the field $\mathbb{K}$. Define $$g\_i(x) :=\prod \_ {{j=1},{j\neq i}}^n \frac{x-a\_j}{a\_i-a\_j}$$ Show that the polynomials $g\_1(x), g\_2(x),...,g\_n(x)$ form a basis of L. Furthermore, show that coordinates of polynomial $...
2013/09/22
[ "https://math.stackexchange.com/questions/501407", "https://math.stackexchange.com", "https://math.stackexchange.com/users/71939/" ]
Here is very easy method to show that they are linearly independent. Suppose that $$b\_1g\_1(x)+b\_2g\_2(x)+...+b\_ng\_n(x)=0$$ To show linear independence, it suffices to show that $$b\_1=b\_2=...=b\_n=0$$ Evaluate $$b\_1g\_1(x)+b\_2g\_2(x)+...+b\_ng\_n(x)=0$$ at $$x=a\_i\;\;\;\;\forall i\le n$$ You can notice that...
You missed the hypothesis that the $a\_i$ are pairwise distinct. Alternatively, consider the functionals $\eta\_i$ with $P\mapsto P(a\_i)$ in $V=(\Bbb R\_{n-1}[X])^\ast$, and suppose $$\sum\_{i=1}^n\lambda\_i\eta\_i=0$$ Evaluating at $1,X,X^2,\ldots,X^{n-1}$ we get $n$ equations $k=0,1,2,\ldots,n$. $$\sum\_{i=1}^n\l...
9,815,363
I am keeping some application meta data in `SharedPreferences`. Whenever I uninstall the application and reinstall it, the `SharedPreferences` are deleted. Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?
2012/03/22
[ "https://Stackoverflow.com/questions/9815363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522729/" ]
You should add a `BackupAgentHelper` to your app. Together with the `SharedPreferenceBackupHelper`, it backups the `SharedPreferences` to the cloud (if the device supports it). When the app is reinstalled the data is restored. See: [BackupAgentHelper](http://developer.android.com/reference/android/app/backup/BackupA...
One way to do this would be to store the user data on a server. Then when the user re-installs the app or installs the app on another device, they can "sync" their user data. That would just be a small HTTP download of the data, likely stored in JSON, which you would then parse and write into the SharedPreferences. If...
9,815,363
I am keeping some application meta data in `SharedPreferences`. Whenever I uninstall the application and reinstall it, the `SharedPreferences` are deleted. Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?
2012/03/22
[ "https://Stackoverflow.com/questions/9815363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522729/" ]
Since Android 6.0 it has been possible to use: ``` <application android:allowBackup="true"> ``` By setting it to true your data (sharedprefs and others) will be saved on Google cloud and restored next time the app is installed. You can read more about it [here](http://developer.android.com/training/backup/a...
I'm pretty sure `SharedPreferences` is always deleted along with the app. In my opinion, the best way to do this would be to write a hidden file (something like ".nameOfFile") onto the SD Card or internal memory and have that contain the preferences as well. You should use SharedPreferences though, it's the Android sta...
9,815,363
I am keeping some application meta data in `SharedPreferences`. Whenever I uninstall the application and reinstall it, the `SharedPreferences` are deleted. Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?
2012/03/22
[ "https://Stackoverflow.com/questions/9815363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522729/" ]
You should add a `BackupAgentHelper` to your app. Together with the `SharedPreferenceBackupHelper`, it backups the `SharedPreferences` to the cloud (if the device supports it). When the app is reinstalled the data is restored. See: [BackupAgentHelper](http://developer.android.com/reference/android/app/backup/BackupA...
This is actually built-in, you just need to implement a couple of classes to enable it. Data will be backed up and linked to the user's Google account, so it will be automatically restored if they install the app on a new device, re-install, etc. <http://developer.android.com/guide/topics/data/backup.html>
9,815,363
I am keeping some application meta data in `SharedPreferences`. Whenever I uninstall the application and reinstall it, the `SharedPreferences` are deleted. Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?
2012/03/22
[ "https://Stackoverflow.com/questions/9815363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522729/" ]
Since Android 6.0 it has been possible to use: ``` <application android:allowBackup="true"> ``` By setting it to true your data (sharedprefs and others) will be saved on Google cloud and restored next time the app is installed. You can read more about it [here](http://developer.android.com/training/backup/a...
As edthethird said: best lay physical files on device external storage and read them on installation. If the file content needs to be hidden from users just perform a simple encryption/decryption process.
9,815,363
I am keeping some application meta data in `SharedPreferences`. Whenever I uninstall the application and reinstall it, the `SharedPreferences` are deleted. Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?
2012/03/22
[ "https://Stackoverflow.com/questions/9815363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522729/" ]
As edthethird said: best lay physical files on device external storage and read them on installation. If the file content needs to be hidden from users just perform a simple encryption/decryption process.
At the age of 2020, it seems to me that `Shared Storage` is the way to go. Android data and file Storage overview <https://developer.android.com/training/data-storage> Shared storage of documents and files <https://developer.android.com/training/data-storage/shared/documents-files>
9,815,363
I am keeping some application meta data in `SharedPreferences`. Whenever I uninstall the application and reinstall it, the `SharedPreferences` are deleted. Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?
2012/03/22
[ "https://Stackoverflow.com/questions/9815363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522729/" ]
Since Android 6.0 it has been possible to use: ``` <application android:allowBackup="true"> ``` By setting it to true your data (sharedprefs and others) will be saved on Google cloud and restored next time the app is installed. You can read more about it [here](http://developer.android.com/training/backup/a...
At the age of 2020, it seems to me that `Shared Storage` is the way to go. Android data and file Storage overview <https://developer.android.com/training/data-storage> Shared storage of documents and files <https://developer.android.com/training/data-storage/shared/documents-files>
9,815,363
I am keeping some application meta data in `SharedPreferences`. Whenever I uninstall the application and reinstall it, the `SharedPreferences` are deleted. Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?
2012/03/22
[ "https://Stackoverflow.com/questions/9815363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522729/" ]
You should add a `BackupAgentHelper` to your app. Together with the `SharedPreferenceBackupHelper`, it backups the `SharedPreferences` to the cloud (if the device supports it). When the app is reinstalled the data is restored. See: [BackupAgentHelper](http://developer.android.com/reference/android/app/backup/BackupA...
At the age of 2020, it seems to me that `Shared Storage` is the way to go. Android data and file Storage overview <https://developer.android.com/training/data-storage> Shared storage of documents and files <https://developer.android.com/training/data-storage/shared/documents-files>
9,815,363
I am keeping some application meta data in `SharedPreferences`. Whenever I uninstall the application and reinstall it, the `SharedPreferences` are deleted. Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?
2012/03/22
[ "https://Stackoverflow.com/questions/9815363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522729/" ]
One way to do this would be to store the user data on a server. Then when the user re-installs the app or installs the app on another device, they can "sync" their user data. That would just be a small HTTP download of the data, likely stored in JSON, which you would then parse and write into the SharedPreferences. If...
sharedPrefs and DBs are removed when you uninstall. You would have to write outside of the app (sd for example).