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
35,247,310
I'm writing an app in Angular 2 and I want to execute several http requests and run a function on the responses. In Angular 1, I would write something like `$q.all([$http.get(...), $http.get(...), ...]).then(doSomethingWithResponses);` But Angular 2 returns RxJS Observables and after a bunch of reading I still can't ...
2016/02/06
[ "https://Stackoverflow.com/questions/35247310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865305/" ]
As @Eric Martinez pointed out, there is [forkJoin](https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/forkjoin.md). forkJoin runs all observable sequences in parallel and collect their last elements. ``` Rx.Observable.forkJoin([a,b]).subscribe(t=> { var firstResult = t[0]; v...
Wouldn't a `merge` work? You can subscribe and attach a handler to the `onComplete` callback. I first build an array of my observables and then use static `merge`: ``` let obs_ary: any = [obs1, obs2, obs3]; Observable.merge(...obs_ary); ```
35,247,310
I'm writing an app in Angular 2 and I want to execute several http requests and run a function on the responses. In Angular 1, I would write something like `$q.all([$http.get(...), $http.get(...), ...]).then(doSomethingWithResponses);` But Angular 2 returns RxJS Observables and after a bunch of reading I still can't ...
2016/02/06
[ "https://Stackoverflow.com/questions/35247310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865305/" ]
I'm not sure you'd want to use [`forkJoin/zip`](http://reactivex.io/documentation/operators/zip.html), especially considering [`combineLatest`](http://reactivex.io/documentation/operators/combinelatest.html) is easier to understand and will emit on every sub-stream event, whereas `forkJoin` basically samples on every s...
I'm learning RxJS and I was trying to do the same thing with RxJS v5 It seems like we don't have `forkJoin` on v5 anymore, so here's how I got it working (works with `flatMap` or `mergeMap`, which are aliases): ``` const callOne = value => new window.Promise(resolve => setTimeout(() => resolve(value + 10)...
35,247,310
I'm writing an app in Angular 2 and I want to execute several http requests and run a function on the responses. In Angular 1, I would write something like `$q.all([$http.get(...), $http.get(...), ...]).then(doSomethingWithResponses);` But Angular 2 returns RxJS Observables and after a bunch of reading I still can't ...
2016/02/06
[ "https://Stackoverflow.com/questions/35247310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865305/" ]
I'm not sure you'd want to use [`forkJoin/zip`](http://reactivex.io/documentation/operators/zip.html), especially considering [`combineLatest`](http://reactivex.io/documentation/operators/combinelatest.html) is easier to understand and will emit on every sub-stream event, whereas `forkJoin` basically samples on every s...
Wouldn't a `merge` work? You can subscribe and attach a handler to the `onComplete` callback. I first build an array of my observables and then use static `merge`: ``` let obs_ary: any = [obs1, obs2, obs3]; Observable.merge(...obs_ary); ```
35,247,310
I'm writing an app in Angular 2 and I want to execute several http requests and run a function on the responses. In Angular 1, I would write something like `$q.all([$http.get(...), $http.get(...), ...]).then(doSomethingWithResponses);` But Angular 2 returns RxJS Observables and after a bunch of reading I still can't ...
2016/02/06
[ "https://Stackoverflow.com/questions/35247310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865305/" ]
Wouldn't a `merge` work? You can subscribe and attach a handler to the `onComplete` callback. I first build an array of my observables and then use static `merge`: ``` let obs_ary: any = [obs1, obs2, obs3]; Observable.merge(...obs_ary); ```
I'm learning RxJS and I was trying to do the same thing with RxJS v5 It seems like we don't have `forkJoin` on v5 anymore, so here's how I got it working (works with `flatMap` or `mergeMap`, which are aliases): ``` const callOne = value => new window.Promise(resolve => setTimeout(() => resolve(value + 10)...
9,442,553
I have two models: call them questions and answers: ``` class FacetQuestion(models.Model): the_question = models.CharField(max_length=50) class FacetAnswer(models.Model): question = models.ForeignKey(FacetQuestion) display_order = models.SmallIntegerField() the_answer = models.CharFie...
2012/02/25
[ "https://Stackoverflow.com/questions/9442553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/311364/" ]
You can use `FacetQuestion.objects.select_related('facetanswer_set').all()` Also have a look at [setdefault()](http://starship.python.net/~mwh/hacks/setdefault.html). It's a Python command that lets you build a nested dict structure. You query all questions and all answers and then build the structure you need in Pyth...
I can only answer you one part of the question. `select_related()` is probably not what you are looking for. It will select you the "1-side" of a 1:n relationship. This would allow you to select all answers nd also fetch the related question for each answer in one go. However, you can filter the query using propertie...
9,442,553
I have two models: call them questions and answers: ``` class FacetQuestion(models.Model): the_question = models.CharField(max_length=50) class FacetAnswer(models.Model): question = models.ForeignKey(FacetQuestion) display_order = models.SmallIntegerField() the_answer = models.CharFie...
2012/02/25
[ "https://Stackoverflow.com/questions/9442553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/311364/" ]
There is an excellent guide here: <http://blog.roseman.org.uk/2010/01/11/django-patterns-part-2-efficient-reverse-lookups/> that describes exactly how to solve this problem. Another approach is to use: [Django-selectreverse](http://code.google.com/p/django-selectreverse/) which is a generic approach to utilizing ...
I can only answer you one part of the question. `select_related()` is probably not what you are looking for. It will select you the "1-side" of a 1:n relationship. This would allow you to select all answers nd also fetch the related question for each answer in one go. However, you can filter the query using propertie...
9,442,553
I have two models: call them questions and answers: ``` class FacetQuestion(models.Model): the_question = models.CharField(max_length=50) class FacetAnswer(models.Model): question = models.ForeignKey(FacetQuestion) display_order = models.SmallIntegerField() the_answer = models.CharFie...
2012/02/25
[ "https://Stackoverflow.com/questions/9442553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/311364/" ]
Based on searching other stack exchange answers: for dealing with the hierarchical data, the best seems to be <http://django-mptt.github.com/django-mptt/> For simply reducing the number of queries **select\_related()** is a great help. For displaying the hierarchical result I have not yet found much.
I can only answer you one part of the question. `select_related()` is probably not what you are looking for. It will select you the "1-side" of a 1:n relationship. This would allow you to select all answers nd also fetch the related question for each answer in one go. However, you can filter the query using propertie...
12,610,853
Let say I have a table entity as it : Partitionkey Rowkey table userid datecreated Let's take a query which works great, with it I can retrieve all entries wich have a particular ID (which is used as the PartitionKey) ``` Dim azt_query As CloudTableQuery(Of adlog) azt_query = azt_context.CreateQuery(Of adlog)("adlog...
2012/09/26
[ "https://Stackoverflow.com/questions/12610853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1686479/" ]
You can query the table that way, but as you noticed it's not a great idea. Without the PartitionKey the storage server is doing exactly what you suspected: it's reading every single entity in the table. In Azure Tables parlance that's called a "table scan", which is very slow. The only way around that is including t...
Both Partition and Row Keys are mandatory fields, while you can query without specifying them it will cause a table scan which *may* actually cause all results to be loaded from azure tables to your application where they will be checked row by row for validity. Both Partition and Row Keys are indexed. The Partition k...
20,601,668
My problem is the following: Inside my urls.py I have defined these url patterns: ``` url(r'^image/upload', 'main.views.presentations.upload_image'), url(r'^image/upload-from-url', 'main.views.presentations.upload_image_from_url'), ``` the problem is when I call from my browser the URL myowndomain:8000/image/upload...
2013/12/16
[ "https://Stackoverflow.com/questions/20601668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2016730/" ]
Here is one way (for three of them, works for four the same way): ``` set.seed(42) ecdf1 <- ecdf(rnorm(100)*0.5) ecdf2 <- ecdf(rnorm(100)*1.0) ecdf3 <- ecdf(rnorm(100)*2.0) plot(ecdf3, verticals=TRUE, do.points=FALSE) plot(ecdf2, verticals=TRUE, do.points=FALSE, add=TRUE, col='brown') plot(ecdf1, verticals=TRUE, do.po...
Here is an approach using `ggplot2` (using the ecdf objects from [Dirk's answer])(<https://stackoverflow.com/a/20601807/1385941>) ``` library(ggplot2) # create a data set containing the range you wish to use d <- data.frame(x = c(-6,6)) # create a list of calls to `stat_function` with the colours you wish to use ll <...
20,601,668
My problem is the following: Inside my urls.py I have defined these url patterns: ``` url(r'^image/upload', 'main.views.presentations.upload_image'), url(r'^image/upload-from-url', 'main.views.presentations.upload_image_from_url'), ``` the problem is when I call from my browser the URL myowndomain:8000/image/upload...
2013/12/16
[ "https://Stackoverflow.com/questions/20601668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2016730/" ]
Here is one way (for three of them, works for four the same way): ``` set.seed(42) ecdf1 <- ecdf(rnorm(100)*0.5) ecdf2 <- ecdf(rnorm(100)*1.0) ecdf3 <- ecdf(rnorm(100)*2.0) plot(ecdf3, verticals=TRUE, do.points=FALSE) plot(ecdf2, verticals=TRUE, do.points=FALSE, add=TRUE, col='brown') plot(ecdf1, verticals=TRUE, do.po...
A simpler way is to use ggplot and have the variable that you want to plot as a factor. In the example below, I have Portfolio as a factor and plotting the distribution of Interest Rates by Portfolio. ``` # select a palette myPal <- c( 'royalblue4', 'lightsteelblue1', 'sienna1') # plot the Interest Rate distribution ...
20,601,668
My problem is the following: Inside my urls.py I have defined these url patterns: ``` url(r'^image/upload', 'main.views.presentations.upload_image'), url(r'^image/upload-from-url', 'main.views.presentations.upload_image_from_url'), ``` the problem is when I call from my browser the URL myowndomain:8000/image/upload...
2013/12/16
[ "https://Stackoverflow.com/questions/20601668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2016730/" ]
The package `latticeExtra` provides the function [`ecdfplot`](http://latticeextra.r-forge.r-project.org/#ecdfplot). ``` library(lattice) library(latticeExtra) set.seed(42) vals <- data.frame(r1=rnorm(100)*0.5, r2=rnorm(100), r3=rnorm(100)*2) ecdfplot(~ r1 + r2 + r3, data=vals, a...
Here is an approach using `ggplot2` (using the ecdf objects from [Dirk's answer])(<https://stackoverflow.com/a/20601807/1385941>) ``` library(ggplot2) # create a data set containing the range you wish to use d <- data.frame(x = c(-6,6)) # create a list of calls to `stat_function` with the colours you wish to use ll <...
20,601,668
My problem is the following: Inside my urls.py I have defined these url patterns: ``` url(r'^image/upload', 'main.views.presentations.upload_image'), url(r'^image/upload-from-url', 'main.views.presentations.upload_image_from_url'), ``` the problem is when I call from my browser the URL myowndomain:8000/image/upload...
2013/12/16
[ "https://Stackoverflow.com/questions/20601668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2016730/" ]
Here is an approach using `ggplot2` (using the ecdf objects from [Dirk's answer])(<https://stackoverflow.com/a/20601807/1385941>) ``` library(ggplot2) # create a data set containing the range you wish to use d <- data.frame(x = c(-6,6)) # create a list of calls to `stat_function` with the colours you wish to use ll <...
A simpler way is to use ggplot and have the variable that you want to plot as a factor. In the example below, I have Portfolio as a factor and plotting the distribution of Interest Rates by Portfolio. ``` # select a palette myPal <- c( 'royalblue4', 'lightsteelblue1', 'sienna1') # plot the Interest Rate distribution ...
20,601,668
My problem is the following: Inside my urls.py I have defined these url patterns: ``` url(r'^image/upload', 'main.views.presentations.upload_image'), url(r'^image/upload-from-url', 'main.views.presentations.upload_image_from_url'), ``` the problem is when I call from my browser the URL myowndomain:8000/image/upload...
2013/12/16
[ "https://Stackoverflow.com/questions/20601668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2016730/" ]
The package `latticeExtra` provides the function [`ecdfplot`](http://latticeextra.r-forge.r-project.org/#ecdfplot). ``` library(lattice) library(latticeExtra) set.seed(42) vals <- data.frame(r1=rnorm(100)*0.5, r2=rnorm(100), r3=rnorm(100)*2) ecdfplot(~ r1 + r2 + r3, data=vals, a...
A simpler way is to use ggplot and have the variable that you want to plot as a factor. In the example below, I have Portfolio as a factor and plotting the distribution of Interest Rates by Portfolio. ``` # select a palette myPal <- c( 'royalblue4', 'lightsteelblue1', 'sienna1') # plot the Interest Rate distribution ...
58,667,109
So I just started developing with SwiftUI and I'm running in a small problem. Subviews are also displaying superview's shadow, even if the superview has a background. Does someone know how to fix this? ``` HStack { HStack { [...] } .padding(.leading, 12.0) .padding(.trailing, 4.0) .padding(...
2019/11/01
[ "https://Stackoverflow.com/questions/58667109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3452645/" ]
Certain modifiers, when placed on a stack, are inherited by all their children. For instance, if you have a stack containing a bunch of Text views, you can place one .font() modifier on the stack and they will all be modified. It appears that .shadow() is one of those modifiers. As to why only one is inherited, I susp...
You can try 'overlay' and 'background' tricks when you have to make them render in multiple passes. In above case, the overlay will not be affected by the shadow or other effects. If you think they are subViews, actually, they just render after the superView. It's a 2D world. So the overlay will be quite independentl...
58,667,109
So I just started developing with SwiftUI and I'm running in a small problem. Subviews are also displaying superview's shadow, even if the superview has a background. Does someone know how to fix this? ``` HStack { HStack { [...] } .padding(.leading, 12.0) .padding(.trailing, 4.0) .padding(...
2019/11/01
[ "https://Stackoverflow.com/questions/58667109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3452645/" ]
Certain modifiers, when placed on a stack, are inherited by all their children. For instance, if you have a stack containing a bunch of Text views, you can place one .font() modifier on the stack and they will all be modified. It appears that .shadow() is one of those modifiers. As to why only one is inherited, I susp...
I am also newbie in swiftUI , but I think the problem is related to modifiers order and the fact that they change the View type. I was able to solve the problem by adding .background(Color.white) and .cornerRadius(2.0) modifiers just before the shadow modifier and that applied the changes in parent (not children) View...
58,667,109
So I just started developing with SwiftUI and I'm running in a small problem. Subviews are also displaying superview's shadow, even if the superview has a background. Does someone know how to fix this? ``` HStack { HStack { [...] } .padding(.leading, 12.0) .padding(.trailing, 4.0) .padding(...
2019/11/01
[ "https://Stackoverflow.com/questions/58667109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3452645/" ]
Certain modifiers, when placed on a stack, are inherited by all their children. For instance, if you have a stack containing a bunch of Text views, you can place one .font() modifier on the stack and they will all be modified. It appears that .shadow() is one of those modifiers. As to why only one is inherited, I susp...
If you want to prevent the shadow the be applied to subviews then use the shadow modifier only inside the .background modifier like so: ``` VStack { ... }.background(Color.white.shadow(color: .black.opacity(0.3), radius: 1, x: 1, y: 1)) ```
58,667,109
So I just started developing with SwiftUI and I'm running in a small problem. Subviews are also displaying superview's shadow, even if the superview has a background. Does someone know how to fix this? ``` HStack { HStack { [...] } .padding(.leading, 12.0) .padding(.trailing, 4.0) .padding(...
2019/11/01
[ "https://Stackoverflow.com/questions/58667109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3452645/" ]
I am also newbie in swiftUI , but I think the problem is related to modifiers order and the fact that they change the View type. I was able to solve the problem by adding .background(Color.white) and .cornerRadius(2.0) modifiers just before the shadow modifier and that applied the changes in parent (not children) View...
You can try 'overlay' and 'background' tricks when you have to make them render in multiple passes. In above case, the overlay will not be affected by the shadow or other effects. If you think they are subViews, actually, they just render after the superView. It's a 2D world. So the overlay will be quite independentl...
58,667,109
So I just started developing with SwiftUI and I'm running in a small problem. Subviews are also displaying superview's shadow, even if the superview has a background. Does someone know how to fix this? ``` HStack { HStack { [...] } .padding(.leading, 12.0) .padding(.trailing, 4.0) .padding(...
2019/11/01
[ "https://Stackoverflow.com/questions/58667109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3452645/" ]
I am also newbie in swiftUI , but I think the problem is related to modifiers order and the fact that they change the View type. I was able to solve the problem by adding .background(Color.white) and .cornerRadius(2.0) modifiers just before the shadow modifier and that applied the changes in parent (not children) View...
If you want to prevent the shadow the be applied to subviews then use the shadow modifier only inside the .background modifier like so: ``` VStack { ... }.background(Color.white.shadow(color: .black.opacity(0.3), radius: 1, x: 1, y: 1)) ```
9,358,867
I've got an oracle query like this: ``` SELECT floatColum0,floatColum1,ROUND(floatColum2,2) from table; ``` which is returning values like that: ``` .2 , 1.23, .23 ``` how can I get something like that? (leading zeros) ``` 0.2, 1.23, 0.23 ? ```
2012/02/20
[ "https://Stackoverflow.com/questions/9358867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943095/" ]
It isn't the numbers whose leading zeroes are being `cut`, but rather the **string representation** of the number. Mostly this is not a concern as application logic is used with data from a database, which works with the actual data (in this case the number itself) and not its string representation. But if you absolute...
I think your problem might be Regional Settings. Make this: 1. Go to Control Panel 2. Regional and Language Settings 3. Customize 4. Display Leading Zeros and change the value for what you want.
9,358,867
I've got an oracle query like this: ``` SELECT floatColum0,floatColum1,ROUND(floatColum2,2) from table; ``` which is returning values like that: ``` .2 , 1.23, .23 ``` how can I get something like that? (leading zeros) ``` 0.2, 1.23, 0.23 ? ```
2012/02/20
[ "https://Stackoverflow.com/questions/9358867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943095/" ]
It isn't the numbers whose leading zeroes are being `cut`, but rather the **string representation** of the number. Mostly this is not a concern as application logic is used with data from a database, which works with the actual data (in this case the number itself) and not its string representation. But if you absolute...
You could try casting it as varchar and using a case statement to add a zero if the first character is a '.' (and adding nothing if its anything else). Im not an Oracle expert but I dont think you could 'add' zeros without changing data type.
9,358,867
I've got an oracle query like this: ``` SELECT floatColum0,floatColum1,ROUND(floatColum2,2) from table; ``` which is returning values like that: ``` .2 , 1.23, .23 ``` how can I get something like that? (leading zeros) ``` 0.2, 1.23, 0.23 ? ```
2012/02/20
[ "https://Stackoverflow.com/questions/9358867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/943095/" ]
I think your problem might be Regional Settings. Make this: 1. Go to Control Panel 2. Regional and Language Settings 3. Customize 4. Display Leading Zeros and change the value for what you want.
You could try casting it as varchar and using a case statement to add a zero if the first character is a '.' (and adding nothing if its anything else). Im not an Oracle expert but I dont think you could 'add' zeros without changing data type.
326,359
If you link a GPO to an OU that is designed to push out say, Excel 2007, and half of the computers in that OU already have that software installed, will the GPO be smart enough to notice, or will it force the install to all computers in the OU regardless?
2011/10/31
[ "https://serverfault.com/questions/326359", "https://serverfault.com", "https://serverfault.com/users/12510/" ]
Afaik it depends on the previous installation. If it's the exact same one as published by the GPO it will be smart enough. In all other cases there could be problems.
It does depend on the smartness of the MSI. The installation is triggered in any case, no matter if the software is already installed or not (with the obvious exception that it will not be triggered if it was installed by the very same group policy). In most cases you should see a repair install / reinstall of the appl...
39,145,971
Let's say I have a reactJS component with a render function as something like this: ``` render(){ return( <div> <OnBoardingHeader title={title} subTitle={subtitle} modalFlag={modalFlag}></OnBoardingHeader> <OnBoardingStepsHandler displayContent={this.state.displayContent} modalFlag={...
2016/08/25
[ "https://Stackoverflow.com/questions/39145971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3232918/" ]
I built my own wizard component where your requirements sound similar to what I had to do to it. Basically each child component does its own validation internally and should execute this.props.onValid and this.props.onInvalid along with some useful information you wanna bubble up to the parent after each validation. An...
Why do you specifically need to access the child components? Pass a handler to the child uses (possible after validating the slide) to navigate. Roughly (very): In the parent: ``` render = () => { // ... <SomeChildComponent nextHandler={this.nextHandler} /> // ... } ``` In the child: ``` // ... validate = (...
30,027,479
I have written a recursion (actually I found the recursion online) to get all possible permutations of a set of numbers but in some occasions, due to the large number of possible permutations, I would like to add an If statement to terminate the recursion before it goes through all permutations. I have tried entering a...
2015/05/04
[ "https://Stackoverflow.com/questions/30027479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4861779/" ]
It is a bit tricky to stop a recursive calculation. The best method involves a global variable (or a private class variable if you have objects). This variable says if the recursion should stop or not: ``` bool stopRecursion = false; ``` Now inside your calculation you update this variable after each step: ``` if(...
``` for (int i = 0; i < ParametersClass.trainsToSchedule; i++) { //iterate until we come upon a slot in the array which has not been allocated an elements yet if({your condition}){ break; } if (permutationValue[i] == 0) ...
30,027,479
I have written a recursion (actually I found the recursion online) to get all possible permutations of a set of numbers but in some occasions, due to the large number of possible permutations, I would like to add an If statement to terminate the recursion before it goes through all permutations. I have tried entering a...
2015/05/04
[ "https://Stackoverflow.com/questions/30027479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4861779/" ]
Thanks for the replies everyone. I managed to make it work by doing the following: Under the CalcPermutation(i) line, I wrote ``` if (permutationCount == ParametersClass.timetableNumber) { return; } ``` I tried running it a few times with different inputs and it seems to work just fine.
``` for (int i = 0; i < ParametersClass.trainsToSchedule; i++) { //iterate until we come upon a slot in the array which has not been allocated an elements yet if({your condition}){ break; } if (permutationValue[i] == 0) ...
30,027,479
I have written a recursion (actually I found the recursion online) to get all possible permutations of a set of numbers but in some occasions, due to the large number of possible permutations, I would like to add an If statement to terminate the recursion before it goes through all permutations. I have tried entering a...
2015/05/04
[ "https://Stackoverflow.com/questions/30027479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4861779/" ]
It is a bit tricky to stop a recursive calculation. The best method involves a global variable (or a private class variable if you have objects). This variable says if the recursion should stop or not: ``` bool stopRecursion = false; ``` Now inside your calculation you update this variable after each step: ``` if(...
Thanks for the replies everyone. I managed to make it work by doing the following: Under the CalcPermutation(i) line, I wrote ``` if (permutationCount == ParametersClass.timetableNumber) { return; } ``` I tried running it a few times with different inputs and it seems to work just fine.
31,461,679
I have a table named `SUMMARY`. I want to write a query to find out the student who has at least one row in the table `SUMMARY`. How to find it? ``` Name Subject Mark ABC ENGLISH 100 ABC TAMIL 100 DEF TAMIL 100 GHI FRENCH 100 GHI SCIENCE 100 GHI SOCIAL 100 ``` Count gives us the number of rows. Bu...
2015/07/16
[ "https://Stackoverflow.com/questions/31461679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3242119/" ]
Use GROUP BY and COUNT: ``` SELECT name, count(*) FROM summary GROUP BY name ``` Or, if you need it only for student `ABC`: ``` SELECT count(*) FROM summary WHERE name = 'ABC' ```
``` Select name, count(subject) from suammary where name = [name] group by name ``` That's the basic idea.
31,461,679
I have a table named `SUMMARY`. I want to write a query to find out the student who has at least one row in the table `SUMMARY`. How to find it? ``` Name Subject Mark ABC ENGLISH 100 ABC TAMIL 100 DEF TAMIL 100 GHI FRENCH 100 GHI SCIENCE 100 GHI SOCIAL 100 ``` Count gives us the number of rows. Bu...
2015/07/16
[ "https://Stackoverflow.com/questions/31461679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3242119/" ]
Use GROUP BY and COUNT: ``` SELECT name, count(*) FROM summary GROUP BY name ``` Or, if you need it only for student `ABC`: ``` SELECT count(*) FROM summary WHERE name = 'ABC' ```
the `count() ... group by name` give you how many subject have each student, all those student will have at least one subject. You need a join between `STUDENT` and `SUMMARY` tables to found which student DOESNT have subject yet. Now if you want a list of student with at least one subject. ``` SELECT DISTINCT name F...
3,067,050
Most of the online sites on registration do send a link to activate the site and on any further correspondence with the end user they provide information about the site and also provide the login credentials with password in clear text (as given below) Username - myname@gmail.com Password - mysecretpassword What woul...
2010/06/18
[ "https://Stackoverflow.com/questions/3067050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253714/" ]
It's a commonly-held fallacy that if you receive a password in plain-text it means they aren't stored securely - passwords like any other data can be stored using reversible encryption. Having said that, it's pretty likely anyone that sends you a plaintext password does not have a clue about security and is probably s...
Yes, this is definitely a security violation. Only a salted and hashed version of passwords should be stored. It *is* common to have reset password functionality that sends either a temporary auto-generated password (which should be good for only one login) or a one-time reset link. This does mean your other accounts...
3,067,050
Most of the online sites on registration do send a link to activate the site and on any further correspondence with the end user they provide information about the site and also provide the login credentials with password in clear text (as given below) Username - myname@gmail.com Password - mysecretpassword What woul...
2010/06/18
[ "https://Stackoverflow.com/questions/3067050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253714/" ]
Yes, this is definitely a security violation. Only a salted and hashed version of passwords should be stored. It *is* common to have reset password functionality that sends either a temporary auto-generated password (which should be good for only one login) or a one-time reset link. This does mean your other accounts...
There are always trade-offs, and developers have to consider useability, the savvy-ness of the intended users, the secrecy and importance of the data, the frequency that the website will be used, and so on. Of course users don't want their privacy violated, but on the other hand "ordinary" web users may be turned off b...
3,067,050
Most of the online sites on registration do send a link to activate the site and on any further correspondence with the end user they provide information about the site and also provide the login credentials with password in clear text (as given below) Username - myname@gmail.com Password - mysecretpassword What woul...
2010/06/18
[ "https://Stackoverflow.com/questions/3067050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253714/" ]
It's a commonly-held fallacy that if you receive a password in plain-text it means they aren't stored securely - passwords like any other data can be stored using reversible encryption. Having said that, it's pretty likely anyone that sends you a plaintext password does not have a clue about security and is probably s...
There are always trade-offs, and developers have to consider useability, the savvy-ness of the intended users, the secrecy and importance of the data, the frequency that the website will be used, and so on. Of course users don't want their privacy violated, but on the other hand "ordinary" web users may be turned off b...
62,621,660
I'm trying to simplify my code to increase productivity and avoid typing errors and Object Oriented Programming (OOP) seems the way to follow. I'm new to OOP and have started to learn about classes and methods in Python. I'm working in a personal project involving consecutive steps to get a final result in which every ...
2020/06/28
[ "https://Stackoverflow.com/questions/62621660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8331617/" ]
You should pass arguments to the function because you've defined as: `double distance(double, double);` So, the solution would be: ``` #include <iostream> using namespace std; double distance(double, double); int main() { cout << distance(10, 10); return 0; } double distance(double rate, double time) { ...
At least pass the parameters when you are calling the function since your function needs to params
1,929,766
If I have some html like this. ``` <ul class="menu"> <li> <a href="pageGreen"> pageGreen </a> </li> <li> <a href="pageBlue"> pageBlue </a> </li> <li> <a href="pageRed"> pageRed </a> </li> <li> <a href="page1"> page1 </a> </li> <li> <a href="page2"> page2 </a> </li> <li> ...
2009/12/18
[ "https://Stackoverflow.com/questions/1929766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121646/" ]
something like this could work $("a[href='pageGreen']").parent().remove();
You could try something like.... ``` $("li a").each(function() { if($this).html() == "pageGreen" || $(this).html() == "pageBlue") { $(this).closest("li").fadeOut(); } }); ``` Might need tweaking
1,929,766
If I have some html like this. ``` <ul class="menu"> <li> <a href="pageGreen"> pageGreen </a> </li> <li> <a href="pageBlue"> pageBlue </a> </li> <li> <a href="pageRed"> pageRed </a> </li> <li> <a href="page1"> page1 </a> </li> <li> <a href="page2"> page2 </a> </li> <li> ...
2009/12/18
[ "https://Stackoverflow.com/questions/1929766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121646/" ]
something like this could work $("a[href='pageGreen']").parent().remove();
Try [jQuery’s `:contains()` selector](http://docs.jquery.com/Selectors/contains#text): ``` $("li:contains(pageGreen), li:contains(pageBlue)").remove(); ```
1,929,766
If I have some html like this. ``` <ul class="menu"> <li> <a href="pageGreen"> pageGreen </a> </li> <li> <a href="pageBlue"> pageBlue </a> </li> <li> <a href="pageRed"> pageRed </a> </li> <li> <a href="page1"> page1 </a> </li> <li> <a href="page2"> page2 </a> </li> <li> ...
2009/12/18
[ "https://Stackoverflow.com/questions/1929766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121646/" ]
You could try something like.... ``` $("li a").each(function() { if($this).html() == "pageGreen" || $(this).html() == "pageBlue") { $(this).closest("li").fadeOut(); } }); ``` Might need tweaking
Try [jQuery’s `:contains()` selector](http://docs.jquery.com/Selectors/contains#text): ``` $("li:contains(pageGreen), li:contains(pageBlue)").remove(); ```
13,386,890
There are two tables that would be relevant in this. Workon and Employee. The contents of these two tables are EMPID NAME SALARY DID (department ID) for employee and PID EMPID HOURS from work on. The SQL I have written is ``` select e.name, w.pid from employee e, workon w where e.empid = w.empid group by e.name, w.pi...
2012/11/14
[ "https://Stackoverflow.com/questions/13386890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1824931/" ]
your group by was returning one row per employee per project, by definition this could never have more than 1 row below sql should work WARNING: i am not sure how this will affect performance of server use at your own risk following will return 1 row per employee per workon but be limited to employees with more than...
``` SELECT E.NAME, W.PID from employee e inner join workon w on e.empid = w.empid where e.empid in (select EMPID from workon GROUP BY EMPID HAVING COUNT(EMPID) > 1) ``` The subquery is counting all records with that empid associated to it with more than 1 project, and the main Query is checking to see if the empid fr...
13,386,890
There are two tables that would be relevant in this. Workon and Employee. The contents of these two tables are EMPID NAME SALARY DID (department ID) for employee and PID EMPID HOURS from work on. The SQL I have written is ``` select e.name, w.pid from employee e, workon w where e.empid = w.empid group by e.name, w.pi...
2012/11/14
[ "https://Stackoverflow.com/questions/13386890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1824931/" ]
your group by was returning one row per employee per project, by definition this could never have more than 1 row below sql should work WARNING: i am not sure how this will affect performance of server use at your own risk following will return 1 row per employee per workon but be limited to employees with more than...
You can try this below query. Here in a variable all distinct count department has been taken from department master table. After that only those employee has been selected where count match with distinct linked department count in relation table. ``` CREATE TABLE employees ( employee_id int NOT NULL CONSTRAINT ...
13,386,890
There are two tables that would be relevant in this. Workon and Employee. The contents of these two tables are EMPID NAME SALARY DID (department ID) for employee and PID EMPID HOURS from work on. The SQL I have written is ``` select e.name, w.pid from employee e, workon w where e.empid = w.empid group by e.name, w.pi...
2012/11/14
[ "https://Stackoverflow.com/questions/13386890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1824931/" ]
``` SELECT E.NAME, W.PID from employee e inner join workon w on e.empid = w.empid where e.empid in (select EMPID from workon GROUP BY EMPID HAVING COUNT(EMPID) > 1) ``` The subquery is counting all records with that empid associated to it with more than 1 project, and the main Query is checking to see if the empid fr...
You can try this below query. Here in a variable all distinct count department has been taken from department master table. After that only those employee has been selected where count match with distinct linked department count in relation table. ``` CREATE TABLE employees ( employee_id int NOT NULL CONSTRAINT ...
3,276,956
Is there a way to make the something like the following code work? ``` add = lambda n: (yield n) or add(n+1) ``` (answers don't need to be in functional style)
2010/07/18
[ "https://Stackoverflow.com/questions/3276956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/364249/" ]
I'm not sure of the intent of "yield(n) or add(n+1)", but recursive generators are certainly possible. You might want to read the link below to get a grip on what's possible, in particular the section titled "Recursive Generators". * [Python Generator Tricks](http://linuxgazette.net/100/pramode.html)
Your function seems to me just to be other expression for unbound sequence: n, n+1, n+2,.... ``` def add(x): while True: yield x x+=1 for index in add(5): if not index<100: break ## do equivalent of range(5,100) print(index) ``` This is not recursive, but I see no need for recursive sty...
3,276,956
Is there a way to make the something like the following code work? ``` add = lambda n: (yield n) or add(n+1) ``` (answers don't need to be in functional style)
2010/07/18
[ "https://Stackoverflow.com/questions/3276956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/364249/" ]
``` def add(n): yield n for m in add(n+1): yield m ``` With recursive generators it's easy to build elaborate backtrackers: ``` def resolve(db, goals, cut_parent=0): try: head, tail = goals[0], goals[1:] except IndexError: yield {} return try: predicate = (...
I'm not sure of the intent of "yield(n) or add(n+1)", but recursive generators are certainly possible. You might want to read the link below to get a grip on what's possible, in particular the section titled "Recursive Generators". * [Python Generator Tricks](http://linuxgazette.net/100/pramode.html)
3,276,956
Is there a way to make the something like the following code work? ``` add = lambda n: (yield n) or add(n+1) ``` (answers don't need to be in functional style)
2010/07/18
[ "https://Stackoverflow.com/questions/3276956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/364249/" ]
``` def add(n): yield n for m in add(n+1): yield m ``` With recursive generators it's easy to build elaborate backtrackers: ``` def resolve(db, goals, cut_parent=0): try: head, tail = goals[0], goals[1:] except IndexError: yield {} return try: predicate = (...
Your function seems to me just to be other expression for unbound sequence: n, n+1, n+2,.... ``` def add(x): while True: yield x x+=1 for index in add(5): if not index<100: break ## do equivalent of range(5,100) print(index) ``` This is not recursive, but I see no need for recursive sty...
555,256
Modern power FET's can be unreliable in some linear applications due to thermal instability causing die hotspots and premature failure. This is called the Spirito effect. How do Silicon Carbide devices compare?
2021/03/25
[ "https://electronics.stackexchange.com/questions/555256", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/70314/" ]
Take a look at how off-the-line switch mode power supplies work. The very first thing they do is rectify the AC input to DC, using a bridge rectifier. You could literally use such a supply that's rated for 230V AC and connect it to your DC source, bearing in mind that two out of the four diodes in the bridge will be ca...
Basically just a +1 to hacktastical answer, this is copied from Mean Well FAQ: > > Q32: In MEAN WELL's catalog, we see AC and DC at input, what is it all about? > > > > > Ans: Due to different circuit designs, MEAN WELL power supply's input consists of three types as below: > (VAC≒VDC) > a.85~264VAC;120~370VDC >...
63,092,036
Very primitive question. ``` String startTime = "2020-07-15T17:35:00Z"; ``` I want to add 3.5 hours to this string. Timezone is UTC. How should i do that ? I tried going through TemporalAccessor and DateTimeFormatter but no success. ``` DateTimeFormatter formatter = DateTimeFormatter.ISO_INSTANT; TemporalAccessor ...
2020/07/25
[ "https://Stackoverflow.com/questions/63092036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2481681/" ]
``` String startTimeString = "2020-07-15T17:35:00Z"; final LocalDateTime startTime = LocalDateTime.parse(startTimeString, DateTimeFormatter.ISO_DATE_TIME); LocalDateTime endTime = startTime.plusHours(3).plusMinutes(30); String endTimeString = endTime.format(DateTimeFormatter.ISO_DATE_TIME); ```
You can parse from string to `Instant` and then add 3.5 hour. Then again format into the string. ``` String startTime = "2020-07-15T17:35:00Z"; DateTimeFormatter formatter = DateTimeFormatter.ISO_INSTANT; Instant instant = Instant.from(formatter.parse(startTime)); instant = instant.plusSeconds((3*60*60)+(30*60)); star...
2,286,810
If I have $f \in L^1(\mathbb{R})$ and that the Fourier transform $\hat{f} \in L^2(\mathbb{R})$, how can I show that $f \in L^2(R)$? I was thinking about ways to apply Fourier inversion, but could not think of anything. What is a good approach to take here?
2017/05/18
[ "https://math.stackexchange.com/questions/2286810", "https://math.stackexchange.com", "https://math.stackexchange.com/users/447588/" ]
Let $\mathcal{F}^{-1}(\hat{f})=g\in L^2(\mathbb{R})$. We will show $f=g$ a.e. Now we will show that $$ \int u\hat{v}=\int\hat{u}v$$ for all $u\in L^1(\mathbb{R})$ and $v\in\mathcal{S}(\mathbb{R})$. This is clearly true for both $u,v\in\mathcal{S}(\mathbb{R})$ so since $\mathcal{S}(\mathbb{R})$ is dense in $L^1(\mathbb...
This solution is going to seem a bit abstruse, but there aren't a lot of elementary ways to get at this. Using Fourier's heat solution is one of those ways. If $f,g\in L^1$, then $$ \int\_{\mathbb{R}}\hat{f}(u)g(u)du = \int\_{\mathbb{R}}f(u)\hat{g}(u)du. $$ That's an elementary fact which is often overlooked, and one...
2,286,810
If I have $f \in L^1(\mathbb{R})$ and that the Fourier transform $\hat{f} \in L^2(\mathbb{R})$, how can I show that $f \in L^2(R)$? I was thinking about ways to apply Fourier inversion, but could not think of anything. What is a good approach to take here?
2017/05/18
[ "https://math.stackexchange.com/questions/2286810", "https://math.stackexchange.com", "https://math.stackexchange.com/users/447588/" ]
Let $\mathcal{F}^{-1}(\hat{f})=g\in L^2(\mathbb{R})$. We will show $f=g$ a.e. Now we will show that $$ \int u\hat{v}=\int\hat{u}v$$ for all $u\in L^1(\mathbb{R})$ and $v\in\mathcal{S}(\mathbb{R})$. This is clearly true for both $u,v\in\mathcal{S}(\mathbb{R})$ so since $\mathcal{S}(\mathbb{R})$ is dense in $L^1(\mathbb...
I think the answer should be that if $f,g \in L^1$ $$\langle \hat{f},g \rangle = \int\_{-\infty}^\infty \int\_{-\infty}^\infty f(x) e^{-2i \pi y x}dx \overline{g(y)} dy =\int\_{-\infty}^\infty f(x)\int\_{-\infty}^\infty \overline{e^{2i \pi y x} g(y)} dy dx = \langle f,\overset{\vee}{g} \rangle$$ (ie. the adjoint of the...
74,577,833
The question was to find the factorial and this is what I did ``` //Factorial of n numbers #include<stdio.h> int main() { int num, i, fact, s; printf("Enter the value: "); scanf("%d",&num); fact = num; i = num; while(i>1) { s = i-1; fact = fact * s; } i--; prin...
2022/11/25
[ "https://Stackoverflow.com/questions/74577833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20602588/" ]
Same as yours, but use `left_join` afterwards to add the `amount` column from the original ```r library(tidyverse) t <- tibble(subs_id=c(1,1,2,3,3), amount=c(15,10,30,20,10), flag=c("target", "taker", "target", "taker", "target")) t %>% group_by(subs_id)%>% summarise(ttl_amount=sum(amount)) %>% l...
Here's how I would do it: ``` library(dplyr) subs_id <- c(1, 1, 2, 3, 3) amount <- c(15, 10, 30, 20, 10) flag <- c("target", "taker", "target", "taker", "target") data <- data.frame(subs_id, amount, flag) data_new <- data %>% group_by(subs_id) %>% mutate(column_summary = sum(amount)) data_new$column_id <- ifel...
74,577,833
The question was to find the factorial and this is what I did ``` //Factorial of n numbers #include<stdio.h> int main() { int num, i, fact, s; printf("Enter the value: "); scanf("%d",&num); fact = num; i = num; while(i>1) { s = i-1; fact = fact * s; } i--; prin...
2022/11/25
[ "https://Stackoverflow.com/questions/74577833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20602588/" ]
You can multiply by a logical vector to get a conditional sum: ``` library(dplyr) df %>% group_by(subs_id) %>% summarize( ttl_amount = sum(amount), amount = sum(amount * (flag == "taker")) ) ``` ``` # A tibble: 3 × 3 subs_id ttl_amount amount <dbl> <dbl> <dbl> 1 1 25 1...
Same as yours, but use `left_join` afterwards to add the `amount` column from the original ```r library(tidyverse) t <- tibble(subs_id=c(1,1,2,3,3), amount=c(15,10,30,20,10), flag=c("target", "taker", "target", "taker", "target")) t %>% group_by(subs_id)%>% summarise(ttl_amount=sum(amount)) %>% l...
74,577,833
The question was to find the factorial and this is what I did ``` //Factorial of n numbers #include<stdio.h> int main() { int num, i, fact, s; printf("Enter the value: "); scanf("%d",&num); fact = num; i = num; while(i>1) { s = i-1; fact = fact * s; } i--; prin...
2022/11/25
[ "https://Stackoverflow.com/questions/74577833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20602588/" ]
You could try: ``` df %>% group_by(subs_id) %>% summarise( ttl_amount = sum(amount), amount = coalesce(amount[flag == 'taker'][1L], 0L) ) ``` Output: ``` # A tibble: 3 x 3 subs_id ttl_amount amount <int> <int> <int> 1 1 25 10 2 2 30 0 3 3 ...
Same as yours, but use `left_join` afterwards to add the `amount` column from the original ```r library(tidyverse) t <- tibble(subs_id=c(1,1,2,3,3), amount=c(15,10,30,20,10), flag=c("target", "taker", "target", "taker", "target")) t %>% group_by(subs_id)%>% summarise(ttl_amount=sum(amount)) %>% l...
74,577,833
The question was to find the factorial and this is what I did ``` //Factorial of n numbers #include<stdio.h> int main() { int num, i, fact, s; printf("Enter the value: "); scanf("%d",&num); fact = num; i = num; while(i>1) { s = i-1; fact = fact * s; } i--; prin...
2022/11/25
[ "https://Stackoverflow.com/questions/74577833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20602588/" ]
You can multiply by a logical vector to get a conditional sum: ``` library(dplyr) df %>% group_by(subs_id) %>% summarize( ttl_amount = sum(amount), amount = sum(amount * (flag == "taker")) ) ``` ``` # A tibble: 3 × 3 subs_id ttl_amount amount <dbl> <dbl> <dbl> 1 1 25 1...
Here's how I would do it: ``` library(dplyr) subs_id <- c(1, 1, 2, 3, 3) amount <- c(15, 10, 30, 20, 10) flag <- c("target", "taker", "target", "taker", "target") data <- data.frame(subs_id, amount, flag) data_new <- data %>% group_by(subs_id) %>% mutate(column_summary = sum(amount)) data_new$column_id <- ifel...
74,577,833
The question was to find the factorial and this is what I did ``` //Factorial of n numbers #include<stdio.h> int main() { int num, i, fact, s; printf("Enter the value: "); scanf("%d",&num); fact = num; i = num; while(i>1) { s = i-1; fact = fact * s; } i--; prin...
2022/11/25
[ "https://Stackoverflow.com/questions/74577833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20602588/" ]
You could try: ``` df %>% group_by(subs_id) %>% summarise( ttl_amount = sum(amount), amount = coalesce(amount[flag == 'taker'][1L], 0L) ) ``` Output: ``` # A tibble: 3 x 3 subs_id ttl_amount amount <int> <int> <int> 1 1 25 10 2 2 30 0 3 3 ...
Here's how I would do it: ``` library(dplyr) subs_id <- c(1, 1, 2, 3, 3) amount <- c(15, 10, 30, 20, 10) flag <- c("target", "taker", "target", "taker", "target") data <- data.frame(subs_id, amount, flag) data_new <- data %>% group_by(subs_id) %>% mutate(column_summary = sum(amount)) data_new$column_id <- ifel...
74,577,833
The question was to find the factorial and this is what I did ``` //Factorial of n numbers #include<stdio.h> int main() { int num, i, fact, s; printf("Enter the value: "); scanf("%d",&num); fact = num; i = num; while(i>1) { s = i-1; fact = fact * s; } i--; prin...
2022/11/25
[ "https://Stackoverflow.com/questions/74577833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20602588/" ]
Here is a simplified answer to the accepted answer: ```r library(tidyverse) df |> group_by(subs_id) |> summarise( ttl_amount = sum(amount), amount= sum(amount[flag == "taker"])) #> # A tibble: 3 x 3 #> subs_id ttl_amount amount #> <dbl> <dbl> <dbl> #> 1 1 25 10 #> 2 2 ...
Here's how I would do it: ``` library(dplyr) subs_id <- c(1, 1, 2, 3, 3) amount <- c(15, 10, 30, 20, 10) flag <- c("target", "taker", "target", "taker", "target") data <- data.frame(subs_id, amount, flag) data_new <- data %>% group_by(subs_id) %>% mutate(column_summary = sum(amount)) data_new$column_id <- ifel...
74,577,833
The question was to find the factorial and this is what I did ``` //Factorial of n numbers #include<stdio.h> int main() { int num, i, fact, s; printf("Enter the value: "); scanf("%d",&num); fact = num; i = num; while(i>1) { s = i-1; fact = fact * s; } i--; prin...
2022/11/25
[ "https://Stackoverflow.com/questions/74577833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20602588/" ]
You could try: ``` df %>% group_by(subs_id) %>% summarise( ttl_amount = sum(amount), amount = coalesce(amount[flag == 'taker'][1L], 0L) ) ``` Output: ``` # A tibble: 3 x 3 subs_id ttl_amount amount <int> <int> <int> 1 1 25 10 2 2 30 0 3 3 ...
You can multiply by a logical vector to get a conditional sum: ``` library(dplyr) df %>% group_by(subs_id) %>% summarize( ttl_amount = sum(amount), amount = sum(amount * (flag == "taker")) ) ``` ``` # A tibble: 3 × 3 subs_id ttl_amount amount <dbl> <dbl> <dbl> 1 1 25 1...
74,577,833
The question was to find the factorial and this is what I did ``` //Factorial of n numbers #include<stdio.h> int main() { int num, i, fact, s; printf("Enter the value: "); scanf("%d",&num); fact = num; i = num; while(i>1) { s = i-1; fact = fact * s; } i--; prin...
2022/11/25
[ "https://Stackoverflow.com/questions/74577833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20602588/" ]
You can multiply by a logical vector to get a conditional sum: ``` library(dplyr) df %>% group_by(subs_id) %>% summarize( ttl_amount = sum(amount), amount = sum(amount * (flag == "taker")) ) ``` ``` # A tibble: 3 × 3 subs_id ttl_amount amount <dbl> <dbl> <dbl> 1 1 25 1...
Here is a simplified answer to the accepted answer: ```r library(tidyverse) df |> group_by(subs_id) |> summarise( ttl_amount = sum(amount), amount= sum(amount[flag == "taker"])) #> # A tibble: 3 x 3 #> subs_id ttl_amount amount #> <dbl> <dbl> <dbl> #> 1 1 25 10 #> 2 2 ...
74,577,833
The question was to find the factorial and this is what I did ``` //Factorial of n numbers #include<stdio.h> int main() { int num, i, fact, s; printf("Enter the value: "); scanf("%d",&num); fact = num; i = num; while(i>1) { s = i-1; fact = fact * s; } i--; prin...
2022/11/25
[ "https://Stackoverflow.com/questions/74577833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20602588/" ]
You could try: ``` df %>% group_by(subs_id) %>% summarise( ttl_amount = sum(amount), amount = coalesce(amount[flag == 'taker'][1L], 0L) ) ``` Output: ``` # A tibble: 3 x 3 subs_id ttl_amount amount <int> <int> <int> 1 1 25 10 2 2 30 0 3 3 ...
Here is a simplified answer to the accepted answer: ```r library(tidyverse) df |> group_by(subs_id) |> summarise( ttl_amount = sum(amount), amount= sum(amount[flag == "taker"])) #> # A tibble: 3 x 3 #> subs_id ttl_amount amount #> <dbl> <dbl> <dbl> #> 1 1 25 10 #> 2 2 ...
52,620,127
Obviously Java has a Access level [package-private](https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html) which achieved by not adding any explicit modifier. But isn't there a way to explicitly add this modifier? It's a bit confusing that we need to **omit** access level when we want to use member in...
2018/10/03
[ "https://Stackoverflow.com/questions/52620127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7294900/" ]
You can do it like this... ``` <div class="myClass" /> <div class="myClass" /> <div class="myClass" /> .myClass:first-child { position: absolute; animation: shake-1 5s infinite; animation-timing-function: linear; } .myClass:nth-child(2) { position: absolute; animation: shake-2 5s infinite; animation-timin...
Best bet is to add an extra class to each div. So it's like: ``` <div class="myClass shake-lr"></div> <div class="myClass shake-tb"></div> <div class="myClass shake-dia"></div> ``` And then in your css/sass: ``` .myClass position: absolute animation-timing-function: linear .shake-lr animation: shake-1 5s i...
41,168,629
I have two form on same page. There is a text field with same name in both of the forms. I am tried to read the value of the text field from one of the two forms. if I am trying to read the value using below code i am getting the value . But I am not sure from which forms it is returning the value. ``` document.getE...
2016/12/15
[ "https://Stackoverflow.com/questions/41168629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3413961/" ]
Since you're using jQuery you could do : ``` $('[name=form_name]').find('#field_id'); ``` Your case e.g : ``` $('[name=form1]').find('#groupId'); ``` Using pure js you could do it like : ``` document.form_name.getElementById("field_id"); ``` Sample of your case : ``` document.form1.getElementById("groupId"); ...
You can do the following with `jquery`. ``` var element = $(document.forms["form1"]).find('#groupId') ``` And to get the text value you can use the `val` function. ``` var text = element.val(); ```
41,168,629
I have two form on same page. There is a text field with same name in both of the forms. I am tried to read the value of the text field from one of the two forms. if I am trying to read the value using below code i am getting the value . But I am not sure from which forms it is returning the value. ``` document.getE...
2016/12/15
[ "https://Stackoverflow.com/questions/41168629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3413961/" ]
Since you're using jQuery you could do : ``` $('[name=form_name]').find('#field_id'); ``` Your case e.g : ``` $('[name=form1]').find('#groupId'); ``` Using pure js you could do it like : ``` document.form_name.getElementById("field_id"); ``` Sample of your case : ``` document.form1.getElementById("groupId"); ...
> > if i am trying to read the value using below code i am getting the value . But i am not sure from which forms it is returning the value. > > > This means you have multiple elements with same `id` which is a big NO. `id's` are supposed to be unique in your entire HTML. If for some reason you want to use same `i...
41,168,629
I have two form on same page. There is a text field with same name in both of the forms. I am tried to read the value of the text field from one of the two forms. if I am trying to read the value using below code i am getting the value . But I am not sure from which forms it is returning the value. ``` document.getE...
2016/12/15
[ "https://Stackoverflow.com/questions/41168629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3413961/" ]
Since you're using jQuery you could do : ``` $('[name=form_name]').find('#field_id'); ``` Your case e.g : ``` $('[name=form1]').find('#groupId'); ``` Using pure js you could do it like : ``` document.form_name.getElementById("field_id"); ``` Sample of your case : ``` document.form1.getElementById("groupId"); ...
The [W3C standards for HTML](https://www.w3.org/TR/REC-html40/struct/global.html#adef-id) require the id to be unique in a document.
41,168,629
I have two form on same page. There is a text field with same name in both of the forms. I am tried to read the value of the text field from one of the two forms. if I am trying to read the value using below code i am getting the value . But I am not sure from which forms it is returning the value. ``` document.getE...
2016/12/15
[ "https://Stackoverflow.com/questions/41168629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3413961/" ]
You can do the following with `jquery`. ``` var element = $(document.forms["form1"]).find('#groupId') ``` And to get the text value you can use the `val` function. ``` var text = element.val(); ```
The [W3C standards for HTML](https://www.w3.org/TR/REC-html40/struct/global.html#adef-id) require the id to be unique in a document.
41,168,629
I have two form on same page. There is a text field with same name in both of the forms. I am tried to read the value of the text field from one of the two forms. if I am trying to read the value using below code i am getting the value . But I am not sure from which forms it is returning the value. ``` document.getE...
2016/12/15
[ "https://Stackoverflow.com/questions/41168629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3413961/" ]
> > if i am trying to read the value using below code i am getting the value . But i am not sure from which forms it is returning the value. > > > This means you have multiple elements with same `id` which is a big NO. `id's` are supposed to be unique in your entire HTML. If for some reason you want to use same `i...
The [W3C standards for HTML](https://www.w3.org/TR/REC-html40/struct/global.html#adef-id) require the id to be unique in a document.
46,054,005
I have two tables. 'First' table contains 2 ids of 'second' table. v2 and v3 are second table's IDs. **First**: ``` `id`, `mem`, `v2`, `v3`, `v2_amt`, `v3_amt` 1, 'test', 1, 2, '10', '20' 2, 'test2', 1, 2, '10', '' ``` **Second**: ``` `id`, `name` 1, 'anna' 2, 'teena' ``` When I'm jo...
2017/09/05
[ "https://Stackoverflow.com/questions/46054005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4985990/" ]
Use `dict comprehension` with `groupby`: ``` d = {names[i]: x.dropna() for i, x in df.groupby(df[0].isnull().cumsum())} {'c': 0 0 7.0 1 8.0 2 9.0, 'b': 0 0 4.0 1 5.0 2 6.0, 'a': 0 0 1.0 1 2.0 2 3.0} ``` --- ``` print (d['a']) 0 0 1.0 1 2.0 2 3.0 print (d['b']) 0 4 4.0 5 5.0 ...
Here's one way Originally, ``` In [2109]: df_dict = dict(zip( names, [g.dropna() for _, g in df.groupby(df[0].isnull().cumsum())] )) ``` On edits realized it's identical to another answer. ``` In [2100]: df_dict = {names[i]: g.dropna(...
46,054,005
I have two tables. 'First' table contains 2 ids of 'second' table. v2 and v3 are second table's IDs. **First**: ``` `id`, `mem`, `v2`, `v3`, `v2_amt`, `v3_amt` 1, 'test', 1, 2, '10', '20' 2, 'test2', 1, 2, '10', '' ``` **Second**: ``` `id`, `name` 1, 'anna' 2, 'teena' ``` When I'm jo...
2017/09/05
[ "https://Stackoverflow.com/questions/46054005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4985990/" ]
Another method is by numpy array split i.e ``` import numpy as np dic = {names[i]: j.dropna() for i,j in enumerate(np.array_split(df, np.where(df[0].isnull())[0]))} ``` ``` %%timeit dic = {names[i]: j.dropna() for i,j in enumerate(np.array_split(df, np.where(df[0].isnull())[0]))} 100 loops, best of 3: 2.51 ms per ...
Here's one way Originally, ``` In [2109]: df_dict = dict(zip( names, [g.dropna() for _, g in df.groupby(df[0].isnull().cumsum())] )) ``` On edits realized it's identical to another answer. ``` In [2100]: df_dict = {names[i]: g.dropna(...
46,054,005
I have two tables. 'First' table contains 2 ids of 'second' table. v2 and v3 are second table's IDs. **First**: ``` `id`, `mem`, `v2`, `v3`, `v2_amt`, `v3_amt` 1, 'test', 1, 2, '10', '20' 2, 'test2', 1, 2, '10', '' ``` **Second**: ``` `id`, `name` 1, 'anna' 2, 'teena' ``` When I'm jo...
2017/09/05
[ "https://Stackoverflow.com/questions/46054005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4985990/" ]
Use `dict comprehension` with `groupby`: ``` d = {names[i]: x.dropna() for i, x in df.groupby(df[0].isnull().cumsum())} {'c': 0 0 7.0 1 8.0 2 9.0, 'b': 0 0 4.0 1 5.0 2 6.0, 'a': 0 0 1.0 1 2.0 2 3.0} ``` --- ``` print (d['a']) 0 0 1.0 1 2.0 2 3.0 print (d['b']) 0 4 4.0 5 5.0 ...
Another method is by numpy array split i.e ``` import numpy as np dic = {names[i]: j.dropna() for i,j in enumerate(np.array_split(df, np.where(df[0].isnull())[0]))} ``` ``` %%timeit dic = {names[i]: j.dropna() for i,j in enumerate(np.array_split(df, np.where(df[0].isnull())[0]))} 100 loops, best of 3: 2.51 ms per ...
1,512,138
I need to refresh a bunch of EDMX files in my solution. We have disected our tables into groups and each model represents one component or process. However, there are some overlapping tables, which means sometimes I need to refresh/update multiple Entity Models. *Refreshing a group of different entity models in VS 200...
2009/10/02
[ "https://Stackoverflow.com/questions/1512138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34183/" ]
Check out the EDM Generator <http://msdn.microsoft.com/en-us/library/bb387165.aspx> You could put in a pre-build event to regenerate the model. It's also wise to pre-generate the Views which increases performance substantially. Hope this helps.
Open the .edmx file in the Model Browser (double click it in VS.Net). Right-click anywhere and choose "Update Model from Database...". The wizard that opens up will show you a limited diff: new tables and deleted tables. But its granularity stops there. It doesn't show changes in fields, for instance.
1,512,138
I need to refresh a bunch of EDMX files in my solution. We have disected our tables into groups and each model represents one component or process. However, there are some overlapping tables, which means sometimes I need to refresh/update multiple Entity Models. *Refreshing a group of different entity models in VS 200...
2009/10/02
[ "https://Stackoverflow.com/questions/1512138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34183/" ]
As far as I can tell EdmGen will only work for WPF apps. Since you are looking to update a .EDMX file you will not have access to the xml files which the EdmGen tries to validate. I would suggest checking the The ADO.NET blog: <http://blogs.msdn.com/adonet/archive/2008/06/26/edm-tools-options-part-3-of-4.aspx> They...
Open the .edmx file in the Model Browser (double click it in VS.Net). Right-click anywhere and choose "Update Model from Database...". The wizard that opens up will show you a limited diff: new tables and deleted tables. But its granularity stops there. It doesn't show changes in fields, for instance.
6,761,217
This is my definition ``` $(".HideOnClick").live({ click: function () { deactive_tiptip() } }); ``` This is how i am calling it inside title of html elements ``` <a href=# class=HideOnClick>Close Me</a> ``` This is how i add the TipTip plugin to my content ``` <asp:Content ID="Content1" ContentPlaceHolderID="h...
2011/07/20
[ "https://Stackoverflow.com/questions/6761217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310370/" ]
The problem is that `deactive_tiptip` isn't an exposed function, not in the scope you're trying to use it in. Instead, you can \* normally\* trigger it with the same event on to "exit"....but since you're using `keepAlive: true` that won't work either. You could instead (since it isn't exposed) just do what the plugin...
Isn't the correct syntax for `live()`: $(".HideOnClick").live('click', function() { deactive\_tiptip(); }); Also you might want to look into `delegate()`. <http://api.jquery.com/delegate/> It's better performance wise. **EDIT** The function you try to call isn't in the scope of where you call it (e.g. it is in...
6,761,217
This is my definition ``` $(".HideOnClick").live({ click: function () { deactive_tiptip() } }); ``` This is how i am calling it inside title of html elements ``` <a href=# class=HideOnClick>Close Me</a> ``` This is how i add the TipTip plugin to my content ``` <asp:Content ID="Content1" ContentPlaceHolderID="h...
2011/07/20
[ "https://Stackoverflow.com/questions/6761217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310370/" ]
The problem is that `deactive_tiptip` isn't an exposed function, not in the scope you're trying to use it in. Instead, you can \* normally\* trigger it with the same event on to "exit"....but since you're using `keepAlive: true` that won't work either. You could instead (since it isn't exposed) just do what the plugin...
I assume this error is happening when you actually call the `$(".HideOnClick")...` code. It looks like your code doesn't yet know about the jQuery library. Things to try: 1. Ensure your script is block is declared after the two library includes 2. Ensure your script is placed in a `$(document).ready()` handler.
48,038,678
I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password. This article <https://technet.microsoft.com/en-us/library/dn751047(v=ws.11).aspx> explains the logon authentication workflow on Windows in the following image: [![authentication workflow](h...
2017/12/30
[ "https://Stackoverflow.com/questions/48038678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2498116/" ]
Just while passing... But isn't there, among Microsoft's samples, a credential provider that takes asynchronous input? I've certainly written one that logs on a user who scans an acceptable fingerprint no matter what tile is displayed. To me, this means that interaction with LogonUI need be no more than implicit, but p...
You task is to implement a credential provider interfaces and at the point where your service receive credentials they can be easily forwarded to LogonUI - look at this [answer](https://stackoverflow.com/a/51417103/3868464). The goal is to implement default tile which can pack these credentials. My own credential pr...
48,038,678
I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password. This article <https://technet.microsoft.com/en-us/library/dn751047(v=ws.11).aspx> explains the logon authentication workflow on Windows in the following image: [![authentication workflow](h...
2017/12/30
[ "https://Stackoverflow.com/questions/48038678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2498116/" ]
Just while passing... But isn't there, among Microsoft's samples, a credential provider that takes asynchronous input? I've certainly written one that logs on a user who scans an acceptable fingerprint no matter what tile is displayed. To me, this means that interaction with LogonUI need be no more than implicit, but p...
I had almost the same requirements for a selenium based framework that I am building. Long story short, I needed to run an application in the windows station of a user (WinSTA0) - which meant that *a* user had to be logged in a VM. I have already made a project with a credentials manager and used this to achieve the f...
48,038,678
I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password. This article <https://technet.microsoft.com/en-us/library/dn751047(v=ws.11).aspx> explains the logon authentication workflow on Windows in the following image: [![authentication workflow](h...
2017/12/30
[ "https://Stackoverflow.com/questions/48038678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2498116/" ]
Not that i condone doing this, but just giving you a solution to the problem. And it isn't programmatically interacting with the WinLogon process. It is programmatically working around it. Use Windows Autologin property. And reboot to change to that user. Note this does involve storing the Password in the registry, in...
I had almost the same requirements for a selenium based framework that I am building. Long story short, I needed to run an application in the windows station of a user (WinSTA0) - which meant that *a* user had to be logged in a VM. I have already made a project with a credentials manager and used this to achieve the f...
48,038,678
I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password. This article <https://technet.microsoft.com/en-us/library/dn751047(v=ws.11).aspx> explains the logon authentication workflow on Windows in the following image: [![authentication workflow](h...
2017/12/30
[ "https://Stackoverflow.com/questions/48038678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2498116/" ]
Just while passing... But isn't there, among Microsoft's samples, a credential provider that takes asynchronous input? I've certainly written one that logs on a user who scans an acceptable fingerprint no matter what tile is displayed. To me, this means that interaction with LogonUI need be no more than implicit, but p...
I have written a **commercial** solution for this, called SasLibEx. SasLibEx is a library, aimed at developers, supporting c/c++ and delphi natively. SasLibEx can: * Simulate Ctrl Alt Del (Secure Attention Sequence) * Cancel Ctrl Alt Del * Lock Workstation * Unlock Workstation (without credentials) * Disable Ctrl Alt...
48,038,678
I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password. This article <https://technet.microsoft.com/en-us/library/dn751047(v=ws.11).aspx> explains the logon authentication workflow on Windows in the following image: [![authentication workflow](h...
2017/12/30
[ "https://Stackoverflow.com/questions/48038678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2498116/" ]
Not that i condone doing this, but just giving you a solution to the problem. And it isn't programmatically interacting with the WinLogon process. It is programmatically working around it. Use Windows Autologin property. And reboot to change to that user. Note this does involve storing the Password in the registry, in...
I have written a **commercial** solution for this, called SasLibEx. SasLibEx is a library, aimed at developers, supporting c/c++ and delphi natively. SasLibEx can: * Simulate Ctrl Alt Del (Secure Attention Sequence) * Cancel Ctrl Alt Del * Lock Workstation * Unlock Workstation (without credentials) * Disable Ctrl Alt...
48,038,678
I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password. This article <https://technet.microsoft.com/en-us/library/dn751047(v=ws.11).aspx> explains the logon authentication workflow on Windows in the following image: [![authentication workflow](h...
2017/12/30
[ "https://Stackoverflow.com/questions/48038678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2498116/" ]
I have written a **commercial** solution for this, called SasLibEx. SasLibEx is a library, aimed at developers, supporting c/c++ and delphi natively. SasLibEx can: * Simulate Ctrl Alt Del (Secure Attention Sequence) * Cancel Ctrl Alt Del * Lock Workstation * Unlock Workstation (without credentials) * Disable Ctrl Alt...
Pro-grammatically bypassing/logging in on a user's behalf is scary with regards to cyber security. I'm not sure what you are trying to do, but why not deploy a run task to do the work using a service account on the machine instead? You can configure it to run even when the user is not logged in on a specified time/ev...
48,038,678
I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password. This article <https://technet.microsoft.com/en-us/library/dn751047(v=ws.11).aspx> explains the logon authentication workflow on Windows in the following image: [![authentication workflow](h...
2017/12/30
[ "https://Stackoverflow.com/questions/48038678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2498116/" ]
Just while passing... But isn't there, among Microsoft's samples, a credential provider that takes asynchronous input? I've certainly written one that logs on a user who scans an acceptable fingerprint no matter what tile is displayed. To me, this means that interaction with LogonUI need be no more than implicit, but p...
Pro-grammatically bypassing/logging in on a user's behalf is scary with regards to cyber security. I'm not sure what you are trying to do, but why not deploy a run task to do the work using a service account on the machine instead? You can configure it to run even when the user is not logged in on a specified time/ev...
48,038,678
I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password. This article <https://technet.microsoft.com/en-us/library/dn751047(v=ws.11).aspx> explains the logon authentication workflow on Windows in the following image: [![authentication workflow](h...
2017/12/30
[ "https://Stackoverflow.com/questions/48038678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2498116/" ]
You task is to implement a credential provider interfaces and at the point where your service receive credentials they can be easily forwarded to LogonUI - look at this [answer](https://stackoverflow.com/a/51417103/3868464). The goal is to implement default tile which can pack these credentials. My own credential pr...
Pro-grammatically bypassing/logging in on a user's behalf is scary with regards to cyber security. I'm not sure what you are trying to do, but why not deploy a run task to do the work using a service account on the machine instead? You can configure it to run even when the user is not logged in on a specified time/ev...
48,038,678
I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password. This article <https://technet.microsoft.com/en-us/library/dn751047(v=ws.11).aspx> explains the logon authentication workflow on Windows in the following image: [![authentication workflow](h...
2017/12/30
[ "https://Stackoverflow.com/questions/48038678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2498116/" ]
Just while passing... But isn't there, among Microsoft's samples, a credential provider that takes asynchronous input? I've certainly written one that logs on a user who scans an acceptable fingerprint no matter what tile is displayed. To me, this means that interaction with LogonUI need be no more than implicit, but p...
Not that i condone doing this, but just giving you a solution to the problem. And it isn't programmatically interacting with the WinLogon process. It is programmatically working around it. Use Windows Autologin property. And reboot to change to that user. Note this does involve storing the Password in the registry, in...
48,038,678
I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password. This article <https://technet.microsoft.com/en-us/library/dn751047(v=ws.11).aspx> explains the logon authentication workflow on Windows in the following image: [![authentication workflow](h...
2017/12/30
[ "https://Stackoverflow.com/questions/48038678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2498116/" ]
Not that i condone doing this, but just giving you a solution to the problem. And it isn't programmatically interacting with the WinLogon process. It is programmatically working around it. Use Windows Autologin property. And reboot to change to that user. Note this does involve storing the Password in the registry, in...
You task is to implement a credential provider interfaces and at the point where your service receive credentials they can be easily forwarded to LogonUI - look at this [answer](https://stackoverflow.com/a/51417103/3868464). The goal is to implement default tile which can pack these credentials. My own credential pr...
46,807,878
I'm new to Java and I'm stuck at a point where I'm supposed to complete a method with a static ArrayList; I have to use a for loop. I've tried to ask several people but I simply don't understand what to do. It looks like this (I'm supposed to complete it) ``` public static ArrayList<Message> getMessagesTo(Person reci...
2017/10/18
[ "https://Stackoverflow.com/questions/46807878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8578872/" ]
You can create one object to define order of each letter and sort by that object. ```js var cars = ["a", "c", "r", "s"]; var s = {c: 1, a: 2, r: 3, s: 4} var r = cars.sort((a, b) => s[a] - s[b]).join(',') console.log(r) ```
You should implement your own custom function and pass it to the array sort function. Your custom function should have the criteria to order the elements in the array. ``` var cars = ["a", "c", "r", "s"]; cars.sort(function(a, b) { //Return the result of comparing your a and b elements. return result; }); conso...
5,076
Quantum parallelism is usually introduced from CNOT schema, saying that there it results, calling $ |c\rangle $ the control and $|t\rangle$ the target $$ |0\rangle |t\rangle \implies |0\rangle |t\rangle $$ $$ |1\rangle |t\rangle \implies |1\rangle X|t\rangle $$ Generalizing that for a generic controlled-U gate, it giv...
2018/12/29
[ "https://quantumcomputing.stackexchange.com/questions/5076", "https://quantumcomputing.stackexchange.com", "https://quantumcomputing.stackexchange.com/users/4927/" ]
Unfortunately, there is indeed currently no way to generate circuit diagrams from a Q# program. Since this is a feature request, consider making it here: <https://quantum.uservoice.com/forums/906940-debugging-and-simulation>. To give a little bit of context, Q# makes a conscious effort to encourage reasoning about qu...
Q#'s full state simulator has an `OnOperationStart` and `OnOperationEnd` events that, as the names imply, are triggered every time a quantum operation starts/ends. Thus the easiest way to get and print the sequence of gates would be to attach a handler to the `OnOperationStart`, for example: ``` using (var qsi...
63,168,995
I'm trying to have v-model notice which select option a user has clicked on but it's not working and staying as null. My select field is a selection of the 50 US states and it is its own component in a separate file. I need v-model to notice the current value that is selected in order to send it back to a database and ...
2020/07/30
[ "https://Stackoverflow.com/questions/63168995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11882174/" ]
As [docs](https://v2.vuejs.org/v2/guide/components-custom-events.html#Customizing-Component-v-model) said, By default, v-model on a component uses value as the prop and input as the event. So you need the `value` and `input event` to change the `value` ``` <select name="state" id="state" :value="value" @change="e => $...
In you select component use v-modal as below ``` <select v-model="model" name="state" id="state"> <option value="" selected="selected">State</option> <option value="AL">Alabama</option> <option value="AK">Alaska</option> </select> ``` And inside the form you just call ``` <SelectBox/> ``` You can't us...
14,278,842
I'm trying to search for specific text after a certain string. The catch is that this specific string exists twice in my text. It's like this: > > *Billing information* > > Name: SomeName > > Address: SomeAddress > > City: SomeCity > > > > *Shipping Information* > > Name: SomeName > > ...
2013/01/11
[ "https://Stackoverflow.com/questions/14278842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1970043/" ]
Check your spam folder. To make sure emails don't end up there, add an "Unsubscribe" link in each email.
This could happen if your action mailer configuration specifies perform\_deliveries=false. You can check out the configuration in your environment files.
14,278,842
I'm trying to search for specific text after a certain string. The catch is that this specific string exists twice in my text. It's like this: > > *Billing information* > > Name: SomeName > > Address: SomeAddress > > City: SomeCity > > > > *Shipping Information* > > Name: SomeName > > ...
2013/01/11
[ "https://Stackoverflow.com/questions/14278842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1970043/" ]
This could happen if your action mailer configuration specifies perform\_deliveries=false. You can check out the configuration in your environment files.
If your application is deployed to cloud services then you may be getting your emails in a spam folder. Their entire IP blocks are registered as spam at services like `Spamhaus`, which is a sensible precaution or else we'd be getting even more spam than usual. You should enter your server's IP address in that field t...
14,278,842
I'm trying to search for specific text after a certain string. The catch is that this specific string exists twice in my text. It's like this: > > *Billing information* > > Name: SomeName > > Address: SomeAddress > > City: SomeCity > > > > *Shipping Information* > > Name: SomeName > > ...
2013/01/11
[ "https://Stackoverflow.com/questions/14278842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1970043/" ]
This could happen if your action mailer configuration specifies perform\_deliveries=false. You can check out the configuration in your environment files.
The other big issues I have found is that the PATH and rbenv may not be initialized in the CRONTAB depending on how you have it setup. I would recommend adding the following to the top of your `.bashrc` file ``` export PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)" ``` This ensures that if you are using `whene...
14,278,842
I'm trying to search for specific text after a certain string. The catch is that this specific string exists twice in my text. It's like this: > > *Billing information* > > Name: SomeName > > Address: SomeAddress > > City: SomeCity > > > > *Shipping Information* > > Name: SomeName > > ...
2013/01/11
[ "https://Stackoverflow.com/questions/14278842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1970043/" ]
Check your spam folder. To make sure emails don't end up there, add an "Unsubscribe" link in each email.
If your application is deployed to cloud services then you may be getting your emails in a spam folder. Their entire IP blocks are registered as spam at services like `Spamhaus`, which is a sensible precaution or else we'd be getting even more spam than usual. You should enter your server's IP address in that field t...
14,278,842
I'm trying to search for specific text after a certain string. The catch is that this specific string exists twice in my text. It's like this: > > *Billing information* > > Name: SomeName > > Address: SomeAddress > > City: SomeCity > > > > *Shipping Information* > > Name: SomeName > > ...
2013/01/11
[ "https://Stackoverflow.com/questions/14278842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1970043/" ]
Check your spam folder. To make sure emails don't end up there, add an "Unsubscribe" link in each email.
The other big issues I have found is that the PATH and rbenv may not be initialized in the CRONTAB depending on how you have it setup. I would recommend adding the following to the top of your `.bashrc` file ``` export PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)" ``` This ensures that if you are using `whene...
14,278,842
I'm trying to search for specific text after a certain string. The catch is that this specific string exists twice in my text. It's like this: > > *Billing information* > > Name: SomeName > > Address: SomeAddress > > City: SomeCity > > > > *Shipping Information* > > Name: SomeName > > ...
2013/01/11
[ "https://Stackoverflow.com/questions/14278842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1970043/" ]
If your application is deployed to cloud services then you may be getting your emails in a spam folder. Their entire IP blocks are registered as spam at services like `Spamhaus`, which is a sensible precaution or else we'd be getting even more spam than usual. You should enter your server's IP address in that field t...
The other big issues I have found is that the PATH and rbenv may not be initialized in the CRONTAB depending on how you have it setup. I would recommend adding the following to the top of your `.bashrc` file ``` export PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)" ``` This ensures that if you are using `whene...
44,299,517
I have the below class, how do I print the list of objects in format [1,[2,3,8],[[]],10,[]] in C#? ``` public class InnerList { private int val; private boolean isValue; private List<InnerList> intList; } public string ConvertToString() { if (this.isValue) { return this.val + ""; } ...
2017/06/01
[ "https://Stackoverflow.com/questions/44299517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/534377/" ]
**[Solution:](https://dotnetfiddle.net/RTgXSU)** ``` public class InnerList { //public only for simple initialization at usage example public int val; public bool isValue; public List<InnerList> intList; public override string ToString() { if (isValue) return va...
Welcome to C# world! I can't understand what you trying to do, but i can show you how we do in by C#: ``` public class InnerList { public int Value { get { return this.intList.Count; } } public bool HasValue { get; set; } ...
44,299,517
I have the below class, how do I print the list of objects in format [1,[2,3,8],[[]],10,[]] in C#? ``` public class InnerList { private int val; private boolean isValue; private List<InnerList> intList; } public string ConvertToString() { if (this.isValue) { return this.val + ""; } ...
2017/06/01
[ "https://Stackoverflow.com/questions/44299517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/534377/" ]
**[Solution:](https://dotnetfiddle.net/RTgXSU)** ``` public class InnerList { //public only for simple initialization at usage example public int val; public bool isValue; public List<InnerList> intList; public override string ToString() { if (isValue) return va...
It looks like you might run into the problem of circular them references here. Because an `InnerList` could reference its own parent in its `intList`. That is why I would recommend a serializer to do the job for you. It knows how to handle these circular references. I'm using `Newtonsoft.Json` here. ``` public overrid...
12,051,021
I have this query: ``` update table set initTime = '2012-08-20 09:30:00.000' WHERE id='0124' ``` and it says: > > *conversion from varchar to datetime generated an out of range value.* > > > Can you help me out please?:(
2012/08/21
[ "https://Stackoverflow.com/questions/12051021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1610075/" ]
To be safe, you should use a language-independent date format for your date strings: ``` UPDATE dbo.table SET initTime = '2012-08-20T09:30:00.000' WHERE id = '0124' ``` See the difference? I added a `T` between the date and the time portion. This makes this a valid ISO-8601 date/time string, and this should work r...
or use YYYYMMDD HH:MM:SS format. You can find out more about unambigious format is this post <http://beyondrelational.com/modules/2/blogs/70/posts/10898/understanding-datetime-column-part-ii.aspx>
12,051,021
I have this query: ``` update table set initTime = '2012-08-20 09:30:00.000' WHERE id='0124' ``` and it says: > > *conversion from varchar to datetime generated an out of range value.* > > > Can you help me out please?:(
2012/08/21
[ "https://Stackoverflow.com/questions/12051021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1610075/" ]
To be safe, you should use a language-independent date format for your date strings: ``` UPDATE dbo.table SET initTime = '2012-08-20T09:30:00.000' WHERE id = '0124' ``` See the difference? I added a `T` between the date and the time portion. This makes this a valid ISO-8601 date/time string, and this should work r...
Convert it to datetime and then feed it in the table. ``` update table set initTime = CONVERT(DateTime, '2012-08-20 09:30:00.000') WHERE id='0124' ```
12,051,021
I have this query: ``` update table set initTime = '2012-08-20 09:30:00.000' WHERE id='0124' ``` and it says: > > *conversion from varchar to datetime generated an out of range value.* > > > Can you help me out please?:(
2012/08/21
[ "https://Stackoverflow.com/questions/12051021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1610075/" ]
To be safe, you should use a language-independent date format for your date strings: ``` UPDATE dbo.table SET initTime = '2012-08-20T09:30:00.000' WHERE id = '0124' ``` See the difference? I added a `T` between the date and the time portion. This makes this a valid ISO-8601 date/time string, and this should work r...
Try to use [this command](http://msdn.microsoft.com/en-us/library/ms189491.aspx) before your statement. I think you have another DAY/MONTH order in your language settings: ``` SET DATEFORMAT ymd; ```
70,306,003
Today i've deployed my client react app to Azure App Service. The problem is, that instead of displaying site im interested in, it returns structure of wwwroot. Even if I change directory to /src/App.js it return code of the App. What is the problem? [![enter image description here](https://i.stack.imgur.com/t1bv5.png...
2021/12/10
[ "https://Stackoverflow.com/questions/70306003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12526704/" ]
You can match the title followed by 2 newlines, and for the body match all lines that are not a title pattern using 2 capture groups instead of splitting. ``` ^([A-Z][a-z]*(?:[^\S\n]+[A-Z][a-z]*)*)\n\n((?:(?![A-Z][a-z]+(?:[^\S\n]+[A-Z][a-z]*)*$).*(?:\n|$))+) ``` * `^` Start of string * `(` Capture group 1 + `[A-Z][...
Suppose you have this text: ``` txt='''\ This Is A Title This is where the body starts. more body Not a title -- body! This Is Another Title This is where the body starts. The End ''' ``` You can use [This Regex](https://regex101.com/r/Xeqt0H/1) and separate titles (as you have defined them) from body: ``` imp...
26,394,032
I want to generate random words in MIPS. I know how to generate random numbers, I just want a random word from a word bank. I have tried this but I have no idea how to print them. ``` .data ### WORD BANK ### a0: .asciiz "computer" b1: .asciiz "processor" c2: .asciiz "motherboard" d3: .asciiz "graphics"...
2014/10/15
[ "https://Stackoverflow.com/questions/26394032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4147712/" ]
If you have a randomly generated number `n` in the range of int, find the index of your number using the remainder of `n` divided by word bank size (in this case, 13). If you have an upper bound for the RNG set it to the word bank size. Then just load the string using the index from memory.
You could create an Array, then with a forEach Loop with inside an object that generates a random numbers, you display the word of the array that corresponds to random generated number. THIS IS JAVA CODE, BUT I HOPE IT MIGHT HELP ``` import java.util.Random; //main class public class Test1 { public static void ma...
7,492
I want to go to Haridwar from Delhi. Which is the fastest and cheapest way to reach there? Also I want to know which are the must visit places there and nearby to it?
2012/06/05
[ "https://travel.stackexchange.com/questions/7492", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/2321/" ]
The best way to get there is an overnight train ride by [Mussoorie Express](http://indiarailinfo.com/train/1126/349/456) which is fully booked at this time for general class but you can get a foreign quota ticket for any day since there are four tickets available daily. BTW, this train doesn't depart from New Delhi sta...
Taking a train to Haridwar is surely the best option. The road to it, NH 58, is still being worked on and some kilometres of it are in a complete mess. So the best you can do is avoid it altogether. There are many trains to Haridwar, almost all of these taking around 7 hours. One of the best trains to the place is Sh...
7,492
I want to go to Haridwar from Delhi. Which is the fastest and cheapest way to reach there? Also I want to know which are the must visit places there and nearby to it?
2012/06/05
[ "https://travel.stackexchange.com/questions/7492", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/2321/" ]
The best way to get there is an overnight train ride by [Mussoorie Express](http://indiarailinfo.com/train/1126/349/456) which is fully booked at this time for general class but you can get a foreign quota ticket for any day since there are four tickets available daily. BTW, this train doesn't depart from New Delhi sta...
You can go Haridwar From Kashmiri Gate(ISBT) Delhi via AC Bus. It will be the best and the fair is the nearest Rs.400 to Rs.450.
7,492
I want to go to Haridwar from Delhi. Which is the fastest and cheapest way to reach there? Also I want to know which are the must visit places there and nearby to it?
2012/06/05
[ "https://travel.stackexchange.com/questions/7492", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/2321/" ]
Taking a train to Haridwar is surely the best option. The road to it, NH 58, is still being worked on and some kilometres of it are in a complete mess. So the best you can do is avoid it altogether. There are many trains to Haridwar, almost all of these taking around 7 hours. One of the best trains to the place is Sh...
You can go Haridwar From Kashmiri Gate(ISBT) Delhi via AC Bus. It will be the best and the fair is the nearest Rs.400 to Rs.450.
290,776
I have some tiff files I obtained from splitting a bigger tiff file using gdal translate. The border tiff files have some nodata values, which I can see in numpy as number 15. I want to manipulate these files as numpy arrays, and then write them back to tiff file. How can I write a numpy array to tiff file, while manta...
2018/07/26
[ "https://gis.stackexchange.com/questions/290776", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/45577/" ]
The two functions from the code snippet below, `create_raster` and `numpy_array_to_raster` should do the trick. In terms of maintaining the `NoData` value from the array in the output raster, that is set on the band(s) of a raster with the [`.SetNoDataValue()` method](http://www.gdal.org/classGDALRasterBand.html#a6c762...
To read (from: [How to fully load a raster into a numpy array?](https://gis.stackexchange.com/questions/32995/how-to-fully-load-a-raster-into-a-numpy-array?rq=1)): ``` import numpy as np from osgeo import gdal ds = gdal.Open("mypic.tif") cols = ds.RasterXSize rows = ds.RasterYSize myarray = np.array(ds.GetRasterBand(...
16,521,075
So, I've been working on a real time tracking system with opencv. A couple of days ago I had to start using directshow (which was totally new for me) because I needed higher resolution from the webcam. With higher resolution comes higher cpu usage. the cpu is running at 50% when only using directshow without ANY opencv...
2013/05/13
[ "https://Stackoverflow.com/questions/16521075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/925086/" ]
I have solved the problem by Adding page Footer Instead Of Report Footer And writing following Suppress Formula for my Page Footer. **Suppress Formula** ``` PageNumber <> TotalPageCount. ```
Not sure I understand fully but I have solved similar problems by moving the report to a new page footer section and suppressing the new page footer section on all but the last page using `Not onLastRecord` in the section suppression formula.
10,088,521
I have read all possible answer [here](https://stackoverflow.com/questions/4533317/netbeans-with-glassfish-have-no-suitable-driver-found-for-mysqljdbc) and [here](https://stackoverflow.com/questions/9622105/java-sql-sqlexception-no-suitable-driver-found-for-netbeans) and [here](https://stackoverflow.com/questions/28393...
2012/04/10
[ "https://Stackoverflow.com/questions/10088521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932307/" ]
When you use it in Tomcat you have to explicitly load jdbc driver. I experienced the same error in a servlet in Tomcat. And adding `Class.forName("com.mysql.jdbc.Driver");` solve it. The other thing I think, is to put the jar file in your `WEB-INF/lib`, then in your project properties, in Libraries, add the JAR you st...
Include the following piece of code in your code: ``` Class.forName("com.mysql.jdbc.Driver");//load driver connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/bolsms", "root", "@#$5869@#$");//connect to the database ```
10,088,521
I have read all possible answer [here](https://stackoverflow.com/questions/4533317/netbeans-with-glassfish-have-no-suitable-driver-found-for-mysqljdbc) and [here](https://stackoverflow.com/questions/9622105/java-sql-sqlexception-no-suitable-driver-found-for-netbeans) and [here](https://stackoverflow.com/questions/28393...
2012/04/10
[ "https://Stackoverflow.com/questions/10088521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932307/" ]
Include the following piece of code in your code: ``` Class.forName("com.mysql.jdbc.Driver");//load driver connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/bolsms", "root", "@#$5869@#$");//connect to the database ```
you could also import it using the jsp tag <%@page import='com.mysql.jdbc.\*'%> or the usual way Class.forName("com.mysql.jdbc.Driver").newInstance(); in the try catch of the jsp page. Good luck