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
9,105,895
how can i set the css (background)property from the server? Does not work at the moment:( cs ``` public string MyBackgroundColor { get; set; } ``` aspx ``` <style type="text/css"> html { background-color: '<%=MyBackgroundColor %>'; } </style> ```
2012/02/02
[ "https://Stackoverflow.com/questions/9105895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/603007/" ]
You can try .aspx ``` <body id="body" runat="server"> ...the body ``` .aspx.cs ``` body.Style["Background-Color"] = blue;//just example you can try using your method too ```
`yourPageOrControlInstance.Styles["background"] = "yellow blah-blah";`
9,105,895
how can i set the css (background)property from the server? Does not work at the moment:( cs ``` public string MyBackgroundColor { get; set; } ``` aspx ``` <style type="text/css"> html { background-color: '<%=MyBackgroundColor %>'; } </style> ```
2012/02/02
[ "https://Stackoverflow.com/questions/9105895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/603007/" ]
You can do it in this way ``` Page.Header.Controls.Add( new LiteralControl( @"<style type='text/css'> html { background-color: red; } </style> " ) ); ```
Assuming your style tag is in the `<head>` element, change the `=` to a `#` (`background-color: '<%#MyBackgroundColor %>';`) add a `runat="server"` to the `<head>` element and call `Page.Header.DataBind()` in the Page\_Load event.
9,105,895
how can i set the css (background)property from the server? Does not work at the moment:( cs ``` public string MyBackgroundColor { get; set; } ``` aspx ``` <style type="text/css"> html { background-color: '<%=MyBackgroundColor %>'; } </style> ```
2012/02/02
[ "https://Stackoverflow.com/questions/9105895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/603007/" ]
You can do it in this way ``` Page.Header.Controls.Add( new LiteralControl( @"<style type='text/css'> html { background-color: red; } </style> " ) ); ```
`yourPageOrControlInstance.Styles["background"] = "yellow blah-blah";`
34,175,799
What is the difference between `git add filename` and `git stage filename`? Because when I tried them both it looks that they do the same thing.
2015/12/09
[ "https://Stackoverflow.com/questions/34175799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
As [the documentation says](https://www.kernel.org/pub/software/scm/git/docs/git-stage.html), `git stage` is just a synonym for `git add`, so there is no difference in usage.
To add to [torek](https://stackoverflow.com/users/1256452/torek)'s [answer](https://stackoverflow.com/a/34175877/6309), that synonym was introduced in [commit 11920d2 (git 1.6.1-rc2, Dec. 2008](https://github.com/git/git/commit/11920d28da1ac1b65eb4041c1b7355924e5d1366)) > > Add a built-in alias for '`stage`' to the ...
24,635,327
(Similar question related to SQL Server : [**SO Link**](https://stackoverflow.com/questions/2624713/how-do-i-insert-multiple-rows-without-repeating-the-insert-into-dbo-blah-part)) I know in Sql Server 2008 or above, you can insert multiple rows doing the following: ``` INSERT INTO MyTable (Name, ID) VALUES ('First',1...
2014/07/08
[ "https://Stackoverflow.com/questions/24635327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436815/" ]
Sybase doen't have insert syntax as SQL Server. What's wrong with showed below classic method? ``` INSERT INTO MyTable (Name, ID) VALUES ('First',1) INSERT INTO MyTable (Name, ID) VALUES ('Second',2) INSERT INTO MyTable (Name, ID) VALUES ('Third',3) go ```
try this: ``` INSERT INTO MyTable (Name, ID) Select 'First',1 Union All Select 'Second',2 Union All Select 'Third',3 ``` I know this works on older versions of SQL server, and suspect that it will work with sybase.
24,635,327
(Similar question related to SQL Server : [**SO Link**](https://stackoverflow.com/questions/2624713/how-do-i-insert-multiple-rows-without-repeating-the-insert-into-dbo-blah-part)) I know in Sql Server 2008 or above, you can insert multiple rows doing the following: ``` INSERT INTO MyTable (Name, ID) VALUES ('First',1...
2014/07/08
[ "https://Stackoverflow.com/questions/24635327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436815/" ]
try this: ``` INSERT INTO MyTable (Name, ID) Select 'First',1 Union All Select 'Second',2 Union All Select 'Third',3 ``` I know this works on older versions of SQL server, and suspect that it will work with sybase.
The syntax in SQL Server for this example will not work in Sybase. Either go with individual statements, or UNION ALL clause
24,635,327
(Similar question related to SQL Server : [**SO Link**](https://stackoverflow.com/questions/2624713/how-do-i-insert-multiple-rows-without-repeating-the-insert-into-dbo-blah-part)) I know in Sql Server 2008 or above, you can insert multiple rows doing the following: ``` INSERT INTO MyTable (Name, ID) VALUES ('First',1...
2014/07/08
[ "https://Stackoverflow.com/questions/24635327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436815/" ]
Sybase doen't have insert syntax as SQL Server. What's wrong with showed below classic method? ``` INSERT INTO MyTable (Name, ID) VALUES ('First',1) INSERT INTO MyTable (Name, ID) VALUES ('Second',2) INSERT INTO MyTable (Name, ID) VALUES ('Third',3) go ```
Looks like that syntax is not valid in Sybase ASE but as suggested in the linked SO post you can get the same using `UNION ALL` like ``` INSERT INTO MyTable (Name, ID) SELECT 'First',1 UNION ALL SELECT 'Second',2 UNION ALL SELECT 'Third',3 ```
24,635,327
(Similar question related to SQL Server : [**SO Link**](https://stackoverflow.com/questions/2624713/how-do-i-insert-multiple-rows-without-repeating-the-insert-into-dbo-blah-part)) I know in Sql Server 2008 or above, you can insert multiple rows doing the following: ``` INSERT INTO MyTable (Name, ID) VALUES ('First',1...
2014/07/08
[ "https://Stackoverflow.com/questions/24635327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436815/" ]
Looks like that syntax is not valid in Sybase ASE but as suggested in the linked SO post you can get the same using `UNION ALL` like ``` INSERT INTO MyTable (Name, ID) SELECT 'First',1 UNION ALL SELECT 'Second',2 UNION ALL SELECT 'Third',3 ```
The syntax in SQL Server for this example will not work in Sybase. Either go with individual statements, or UNION ALL clause
24,635,327
(Similar question related to SQL Server : [**SO Link**](https://stackoverflow.com/questions/2624713/how-do-i-insert-multiple-rows-without-repeating-the-insert-into-dbo-blah-part)) I know in Sql Server 2008 or above, you can insert multiple rows doing the following: ``` INSERT INTO MyTable (Name, ID) VALUES ('First',1...
2014/07/08
[ "https://Stackoverflow.com/questions/24635327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436815/" ]
Sybase doen't have insert syntax as SQL Server. What's wrong with showed below classic method? ``` INSERT INTO MyTable (Name, ID) VALUES ('First',1) INSERT INTO MyTable (Name, ID) VALUES ('Second',2) INSERT INTO MyTable (Name, ID) VALUES ('Third',3) go ```
The syntax in SQL Server for this example will not work in Sybase. Either go with individual statements, or UNION ALL clause
43,287,394
I have a simple `data.frame` as created below. I want to get all the row indices where a new `origin` starts. In this case it would be 1, 5, and 8. Is there a way to do this without looping? ``` df <- data.frame(origin=c(rep('2016-01-01', 4), rep('2016-02-01',3), rep('2016-03-01',2)), date=c('2016-01-01','2016-02-...
2017/04/07
[ "https://Stackoverflow.com/questions/43287394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4913108/" ]
``` which(!duplicated(df$origin)) #[1] 1 5 8 ``` If the values can repeat (or are not sorted), use the following to find where a series of new value begins. ``` which(c(TRUE, as.character(df$origin)[-NROW(df)] != as.character(df$origin)[-1])) #[1] 1 5 8 ```
You could use functions in the `dplyr` package: ``` library(dplyr) df %>% group_by(origin) %>% slice(1) ```
43,287,394
I have a simple `data.frame` as created below. I want to get all the row indices where a new `origin` starts. In this case it would be 1, 5, and 8. Is there a way to do this without looping? ``` df <- data.frame(origin=c(rep('2016-01-01', 4), rep('2016-02-01',3), rep('2016-03-01',2)), date=c('2016-01-01','2016-02-...
2017/04/07
[ "https://Stackoverflow.com/questions/43287394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4913108/" ]
``` which(!duplicated(df$origin)) #[1] 1 5 8 ``` If the values can repeat (or are not sorted), use the following to find where a series of new value begins. ``` which(c(TRUE, as.character(df$origin)[-NROW(df)] != as.character(df$origin)[-1])) #[1] 1 5 8 ```
Another option using `rle` and `cumsum`. We `c()` a `1` onto the beginning because that's the start and then we take off the last element from the run (since there are no new elements after it). A little esoteric, but: ``` date_runs <- rle(as.character(df$origin)) cumsum(c(1,date_runs[[1]][-length(date_runs[[1]])])) #...
43,287,394
I have a simple `data.frame` as created below. I want to get all the row indices where a new `origin` starts. In this case it would be 1, 5, and 8. Is there a way to do this without looping? ``` df <- data.frame(origin=c(rep('2016-01-01', 4), rep('2016-02-01',3), rep('2016-03-01',2)), date=c('2016-01-01','2016-02-...
2017/04/07
[ "https://Stackoverflow.com/questions/43287394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4913108/" ]
Another option using `rle` and `cumsum`. We `c()` a `1` onto the beginning because that's the start and then we take off the last element from the run (since there are no new elements after it). A little esoteric, but: ``` date_runs <- rle(as.character(df$origin)) cumsum(c(1,date_runs[[1]][-length(date_runs[[1]])])) #...
You could use functions in the `dplyr` package: ``` library(dplyr) df %>% group_by(origin) %>% slice(1) ```
3,474,812
We know that for a vanishing real-valued $C^2$-function $f$ and a brownian motion $B$ we have $$\frac{d}{dt}\mathbb{E}\_x[f(B\_t)]=\frac{1}{2}\frac{d^2}{dx^2}\mathbb{E}\_x[f(B\_t)]$$ Now, i have seen the following. Let $$\Phi\_t(x)=\mathbb{P}(B\_t\leq x)$$ which is the distribution function of a normal distribution wi...
2019/12/13
[ "https://math.stackexchange.com/questions/3474812", "https://math.stackexchange.com", "https://math.stackexchange.com/users/591519/" ]
Denote by $$p\_t(y) := \frac{1}{\sqrt{2\pi t}} \exp \left(-\frac{y^2}{2t} \right)$$ the density of $B\_t$. Then $$\Phi\_t(x) = \mathbb{P}(B\_t \leq x) = \int\_{(-\infty,x]} p\_t(y) \, dy.$$ Differentiation with respect to $t$ yields $$\frac{d}{dt} \Phi\_t(x) = \int\_{(-\infty,x]} \frac{d}{dt} p\_t(y) \, dy.$$ Since $$...
\begin{align\*} \frac{\partial}{\partial t} E^x[f(B\_t)] &=\frac{1}{2}\frac{\partial ^2}{\partial x^2} E^x[f(B\_t)] \quad\quad (\*) \\ \frac{\partial}{\partial t}\Phi\_t(x) &=\frac{1}{2}\frac{\partial ^2}{\partial x^2}\Phi\_t(x) \quad \quad \quad (\*\*) \end{align\*} where $\Phi\_t(x)= P(B\_t\leq x)$. The answer given...
37,820,187
I'm trying to organizate my menu (which has many `menuItem` added) in 2 columns, this way it will be better for smaller computer screen to see. I'm using smartgwt menu and I am adding this way: ``` m_menu.setItems( m_itemSaude, v_separator, m_itemMSeguranca, v_separator, m_itemMeioAmbiente, v_separa...
2016/06/14
[ "https://Stackoverflow.com/questions/37820187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2895808/" ]
Have you set up ZOOKEEPER\_HOME in system variable ? Please follow this video <https://www.youtube.com/watch?v=OJKesEpO6ok>
In the latest version kafka\_2.12-3.1.0 (2022) after unzipping and setting the properties and logs. keep the Kafka folder on the C drive and always run the command prompt with 'run as administrator'. You can configure zookeeper with below commands The .bat file is for windows Terminal 1 zookeeper > > C:\kafka\bin\wi...
47,511,467
I want to construct a View that looks like [this](https://i.stack.imgur.com/4PoSa.png), where Fragment2's height should wrap its content and Fragtment1 should fill the remaining space above. After reading up for ways to do that I got the following layout.xml for the activity: ``` <?xml version="1.0" encoding="utf-8"?...
2017/11/27
[ "https://Stackoverflow.com/questions/47511467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2375811/" ]
> > which was fairly obvious because in the bin folder the file isn't > called appsettings.json, its called TestMvcApp.runtimeconfig.json. > > > `TestMvcApp.runtimeconfig.json` is not your `appsettings.json`, it's a runtime configuration file as it's clear from the file name. I bet that your `appsettings.json` i...
The accepted answer only logged some messages for my project. I'm not sure why. [Ondrej Balas's approach](https://ondrejbalas.com/using-serilog-with-asp-net-core-2-0/) worked better for me. **Install** these Nuget packages: * Serilog * Serilog.AspNetCore * Serilog.Settings.Configuration * Serilog.Sinks.Console * Seri...
20,742,526
I'm trying to learn OO PHP and I'm working on a contents manager project, I want to construct an object starting from an html form. For example, if I have a form with ten textbox (or other types of input), I sent the form in POST mode, then I want to construct my object starting from POST data. Do I have to pass them...
2013/12/23
[ "https://Stackoverflow.com/questions/20742526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2288049/" ]
``` private SwingController controller; controller = new SwingController(); SwingViewBuilder viewBuilder = new SwingViewBuilder(controller, properties); JPanel panel = viewBuilder.buildViewerPanel(); controller.setToolBarVisible(false); ``` You have to set the toolbar invisible because icePdf looks in the PDF-documen...
There are two ways to this. 1) Follow this example to set all the toolbars to false. <http://www.icesoft.org/JForum/posts/list/17673.page#sthash.48ICrL2A.dpbs> 2) You can modify or remove the toolbar by editing the source code for `SwingViewBuilder`. Here is a link to the code: <http://sventon.icesoft.org/svn/repos/...
2,844,816
> > Find $\operatorname{Tr}(A^{2018})$ if $\det(A^2-2018I\_2)=0, A\in M\_2(\mathbb{Q})$ > > > My attempt: Let $A^2=\begin{bmatrix}a&b\\c&d\end{bmatrix}$ then $B=A^2-2018I\_2=\begin{bmatrix}a-2018&b\\c&d-2018\end{bmatrix}$ then $\det(B)=(a-2018)(d-2018)-bc$ then we have: $a = 2018$ or $d=2018$ AND $b=0$ or $c=0$....
2018/07/08
[ "https://math.stackexchange.com/questions/2844816", "https://math.stackexchange.com", "https://math.stackexchange.com/users/547191/" ]
Let $$ A=\begin{bmatrix} \sqrt{2018}&0\\0&a\end{bmatrix}.$$ Then, $$ \det(A^2-2018I\_2)=0 $$ and $$ A^{2018}=\begin{bmatrix}2018^{1009}&0\\0&a^{2018}\end{bmatrix},$$ which does not have a trace independent of $a$. So, is there any additional information you have about $A$?
$\det(A^2-2018I\_2)=0$ implies that $2018$ is an eigenvalue of $A^2$. The spectral mapping theorem gives that $\sigma(A^2) = \sigma(A)^2$ so at least one of $\sqrt{2018}$ and $-\sqrt{2018}$ is in $\sigma(A).$ Now, because $A \in M\_2(\mathbb{Q})$, its characteristic polynomial $p\_A$ has rational coefficients and $\d...
26,652,661
If I am using a linear gradient with multiple stops like this: ``` div { border: 1px solid black; width: 100px; height: 2000px; display: inline-block; background-image: linear-gradient(to bottom, #383937 0, #001500 35px, #ffffff 35px, #b0b0b0 150px, #ffffff 150px, #ffffff 100%); } ``` **Firefox** Probl...
2014/10/30
[ "https://Stackoverflow.com/questions/26652661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1427758/" ]
Not a fix to the problem, just a workaround… you can use multiple gradients as multiple backgrounds of a small enough size as to not trigger the problem (< ~300px seems to do it). Combine with `background-size` and `background-position` and you get something that is ugly, but works: ``` background-image: linear-gr...
I just had this requirement in a project and solved it this way: Let's say we want the color change to be 50%. * We must place the gradient of the first color from 0% to 51%. * And the gradient of the next color from 50% to 100%. In this way they overlap and create a cut color effect. ```css .background-overlap { ...
26,652,661
If I am using a linear gradient with multiple stops like this: ``` div { border: 1px solid black; width: 100px; height: 2000px; display: inline-block; background-image: linear-gradient(to bottom, #383937 0, #001500 35px, #ffffff 35px, #b0b0b0 150px, #ffffff 150px, #ffffff 100%); } ``` **Firefox** Probl...
2014/10/30
[ "https://Stackoverflow.com/questions/26652661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1427758/" ]
Not a fix to the problem, just a workaround… you can use multiple gradients as multiple backgrounds of a small enough size as to not trigger the problem (< ~300px seems to do it). Combine with `background-size` and `background-position` and you get something that is ugly, but works: ``` background-image: linear-gr...
Functioning workaround for this issue: Just use multiple linear brackgrounds for the background (this is trivially possible with CSS 3) and use `transparent` background color as an empty placeholder for the other linear background being visible through: ```css background: linear-gradient(to right, green 10...
26,652,661
If I am using a linear gradient with multiple stops like this: ``` div { border: 1px solid black; width: 100px; height: 2000px; display: inline-block; background-image: linear-gradient(to bottom, #383937 0, #001500 35px, #ffffff 35px, #b0b0b0 150px, #ffffff 150px, #ffffff 100%); } ``` **Firefox** Probl...
2014/10/30
[ "https://Stackoverflow.com/questions/26652661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1427758/" ]
I just had this requirement in a project and solved it this way: Let's say we want the color change to be 50%. * We must place the gradient of the first color from 0% to 51%. * And the gradient of the next color from 50% to 100%. In this way they overlap and create a cut color effect. ```css .background-overlap { ...
Functioning workaround for this issue: Just use multiple linear brackgrounds for the background (this is trivially possible with CSS 3) and use `transparent` background color as an empty placeholder for the other linear background being visible through: ```css background: linear-gradient(to right, green 10...
46,226,756
There's [this other question](https://stackoverflow.com/q/45122691/3539651) here that addresses a similar issue, but in that case Xcode's behavior is correct, just annoying. In my case, however, I think it's actually a bug: [![example](https://i.stack.imgur.com/NvP5t.png)](https://i.stack.imgur.com/NvP5t.png) That l...
2017/09/14
[ "https://Stackoverflow.com/questions/46226756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3539651/" ]
If you're still looking for an answer, in your particular case, try setting a proportional width on your label and center horizontally in the view controller's view. Clear all your constraints on the label, right-click drag from the label to the `Background View` and select `Equal Widths`, `Center Horizontally in Con...
Checked in Xcode 9GM (Version 9.0 (9A235)), it works correctly [![Xcode screenshot](https://i.stack.imgur.com/n5vbR.png)](https://i.stack.imgur.com/n5vbR.png) Remove the constraints and add them manually.
46,226,756
There's [this other question](https://stackoverflow.com/q/45122691/3539651) here that addresses a similar issue, but in that case Xcode's behavior is correct, just annoying. In my case, however, I think it's actually a bug: [![example](https://i.stack.imgur.com/NvP5t.png)](https://i.stack.imgur.com/NvP5t.png) That l...
2017/09/14
[ "https://Stackoverflow.com/questions/46226756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3539651/" ]
If you're still looking for an answer, in your particular case, try setting a proportional width on your label and center horizontally in the view controller's view. Clear all your constraints on the label, right-click drag from the label to the `Background View` and select `Equal Widths`, `Center Horizontally in Con...
Some problem here, introduced with the final version of Xcode 9. Seems that the bug is related to the language direction: for some reason Interface Builder doesn't understand quite well the autolayout for the default language direction conditions. As suggested by [Repose](https://stackoverflow.com/users/4577610/repose...
24,540,792
The pop-up type thing (when you press the share button) shown in this picture: ![](https://sharechair.files.wordpress.com/2013/09/photo-skitch-document-5.png) How can I make this in XCode? EDIT: Sorry this wasn't clear, but I mean the actual container that appears when you press share, ignore the arrow
2014/07/02
[ "https://Stackoverflow.com/questions/24540792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3195946/" ]
The entire container for all of these buttons is a `UIPopoverController`, but that single button, or that type of popover, is the `UIActivityViewController`. You can show the default one, which is context aware, and you can also create your own `UIActivity` subclass to perform custom activities.
It is UIPopoverController [Reference](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAA&url=https%3A%2F%2Fdeveloper.apple.com%2Flibrary%2Fios%2Fdocumentation%2Fuikit%2Freference%2FUIPopoverController_class%2FReference%2FReference.html&ei=ynG0U8HwM-jR7AbQ9YCgCQ&usg=AFQjCNG5OoSk...
54,055,867
I have strange question to you, when I built a simple spring boot application I created for testing that everything working as it should a simple Controller called HomeController.java, but when I go to address in my case 'localhost:5000/app' I thought that there should appear Hello World! but it redirect me to address ...
2019/01/05
[ "https://Stackoverflow.com/questions/54055867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10728774/" ]
Just create a class for security configuration like this ``` @Configuration @EnableWebSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorize...
That's because you are not allowing anonymous access to your `/app` url, which in return redirects you to the login form as to authenticate the user. You would need to add the following configuration to your spring security. ``` .authorizeRequests() .antMatchers("/app/**") .permitAll() ``` The `**` w...
68,773,981
In the following pipeline, I am trying to check out only develop branch to build the given project. How do I make sure that the pipeline only run develop, master and release branches? Should I add separate stages for master branch and another for release branch. Instead I am trying to let this pipeline build only when ...
2021/08/13
[ "https://Stackoverflow.com/questions/68773981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14311256/" ]
Generally Angular services are meant to handle data retrieval and all business logic, while the components subscribe to Observables for display purposes. If I understand your situation correctly, you'd be better off doing something like this: **Service** ``` public person$$ = new BehaviorSubject<unknown>(null); publ...
In the service you have `person` as a behavior subject. You'd update it there not in your component. component ``` this.incomeService.updatePerson('something'); ``` service ``` constructor() { this.person.subscribe(person => { console.log(person); }); } updatePerson(arg:string){ console.log('i...
68,773,981
In the following pipeline, I am trying to check out only develop branch to build the given project. How do I make sure that the pipeline only run develop, master and release branches? Should I add separate stages for master branch and another for release branch. Instead I am trying to let this pipeline build only when ...
2021/08/13
[ "https://Stackoverflow.com/questions/68773981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14311256/" ]
In the service you have `person` as a behavior subject. You'd update it there not in your component. component ``` this.incomeService.updatePerson('something'); ``` service ``` constructor() { this.person.subscribe(person => { console.log(person); }); } updatePerson(arg:string){ console.log('i...
The problem was in a function that was generating an error and that is executed before calling `next`. Unfortunately I missed it because errors in my Google Chrome console were hidden. So as a reminder for anyone else having a similar problem; check that your methods are running error free before panicking.
68,773,981
In the following pipeline, I am trying to check out only develop branch to build the given project. How do I make sure that the pipeline only run develop, master and release branches? Should I add separate stages for master branch and another for release branch. Instead I am trying to let this pipeline build only when ...
2021/08/13
[ "https://Stackoverflow.com/questions/68773981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14311256/" ]
Generally Angular services are meant to handle data retrieval and all business logic, while the components subscribe to Observables for display purposes. If I understand your situation correctly, you'd be better off doing something like this: **Service** ``` public person$$ = new BehaviorSubject<unknown>(null); publ...
The problem was in a function that was generating an error and that is executed before calling `next`. Unfortunately I missed it because errors in my Google Chrome console were hidden. So as a reminder for anyone else having a similar problem; check that your methods are running error free before panicking.
5,708,906
What is UID on Android? Is it ID of a particular user or of a particular application?
2011/04/18
[ "https://Stackoverflow.com/questions/5708906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/714166/" ]
If you're referring to [this UID](http://developer.android.com/reference/android/os/Process.html#myUid%28%29): Android is based on Linux, so basically it's the same UID you have on a Unix-like OS. When installing an app / package, Android by default[1] creates a UID specifically for that package, so that it can have it...
In Android, `UID` is actually called `AID`, which is used to identify the owner of a process and the owner of a resource. Binding those two together, it becomes the backbone of Android application sandboxing mechanism. A full and detailed description of how it works and what does it means for application need a long ...
5,708,906
What is UID on Android? Is it ID of a particular user or of a particular application?
2011/04/18
[ "https://Stackoverflow.com/questions/5708906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/714166/" ]
If you're referring to [this UID](http://developer.android.com/reference/android/os/Process.html#myUid%28%29): Android is based on Linux, so basically it's the same UID you have on a Unix-like OS. When installing an app / package, Android by default[1] creates a UID specifically for that package, so that it can have it...
This ID is particular to the application Android assigns a unique user ID (UID) to each Android application and runs it in its own process. Android uses this UID to set up a kernel-level Application Sandbox. Refer to this doc <https://source.android.com/security/app-sandbox>
5,708,906
What is UID on Android? Is it ID of a particular user or of a particular application?
2011/04/18
[ "https://Stackoverflow.com/questions/5708906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/714166/" ]
This ID is particular to the application Android assigns a unique user ID (UID) to each Android application and runs it in its own process. Android uses this UID to set up a kernel-level Application Sandbox. Refer to this doc <https://source.android.com/security/app-sandbox>
In Android, `UID` is actually called `AID`, which is used to identify the owner of a process and the owner of a resource. Binding those two together, it becomes the backbone of Android application sandboxing mechanism. A full and detailed description of how it works and what does it means for application need a long ...
63,343,507
I am encountering an issue developping a VBA functionality in an excel Workbook. This workbook is geared toward being used by end-users without administration rights, who need to activate the macros on this specific workbook before being able to use it. To this end, I have done the following: * I created a *"temporar...
2020/08/10
[ "https://Stackoverflow.com/questions/63343507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10802163/" ]
By default, when you first open a macro-enabled workbook you’ll see a yellow ***“SECURITY WARNING”*** bar appear just underneath the ribbon. Clicking the ***“Enable Content”*** button will enable macros. * **This will trigger any macros that run when the workbook is opened**, so don’t click this by mistake! If the Vi...
As mentionned by @David Donayo in the accepted answer, what triggers the Microsoft Excel Security Notice popup vs. the message bar warning is the fact that the VBA Editor is already open for another xlsm file. What caused my issue (runtime error 1004 when trying to make Object Model calls such as Application.Calculate...
13,957,790
I'm an admin used to the old-school way of defining servlets/mappings, i.e. in web.xml. Servlet 3.0 is great, and the @WebServlet annotation sure is nifty, if you're a developer. The problem is, as an admin, what if I'm managing a webapp that contains lots of different utility servlets (servlets.jar) defined by annot...
2012/12/19
[ "https://Stackoverflow.com/questions/13957790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1266898/" ]
> > *I want to either whitelist the URI mappings that are appropriate for a given deployment, or blacklist the ones that aren't.* > > > You can use a `<security-constraint>` with an empty `<auth-constraint>` to block access to the given URL pattern(s). ``` <security-constraint> <display-name>Restrict direct a...
You can disable the jar scanning adding the `metadata-complete="true"` to `web-app` tag in the web.xml. In this way you will need to all servlets, filters, etc. inside the web.xml as usual.
70,847,771
I want to embed my chart from Apache Superset into my React.js App. So far I know there is possibility to use like this: ``` <iframe id="myIFRAME" width="1600" height="1200" seamless frameBorder="10" scrolling="no" src="http://localhost:8080/r/3" > </iframe...
2022/01/25
[ "https://Stackoverflow.com/questions/70847771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9655774/" ]
``` import string import random random.seed(0) def stock_generator(n=100): return [(''.join(random.choices(string.ascii_uppercase, k=4)), random.random()) for _ in range(n)] stocks = stock_generator() print(stocks) ``` You can generate as many random stocks as you want with this generator expression. `stock_g...
Try: ``` import string import random def stock_generator(num): names = [] for n in range(num): x = ''.join(random.choices(string.ascii_uppercase, k=4)) names.append(x) return names print(stock_generator(100)) ``` Each time you will call the function stock\_generator using a number ...
70,847,771
I want to embed my chart from Apache Superset into my React.js App. So far I know there is possibility to use like this: ``` <iframe id="myIFRAME" width="1600" height="1200" seamless frameBorder="10" scrolling="no" src="http://localhost:8080/r/3" > </iframe...
2022/01/25
[ "https://Stackoverflow.com/questions/70847771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9655774/" ]
``` import string import random random.seed(0) def stock_generator(n=100): return [(''.join(random.choices(string.ascii_uppercase, k=4)), random.random()) for _ in range(n)] stocks = stock_generator() print(stocks) ``` You can generate as many random stocks as you want with this generator expression. `stock_g...
You can generate a consistent `n` random samples by updating the `seed` of `random` before `shuffle`. Here is an example on how to generate these list of names (10 samples): ```py import random, copy sorted_list = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'...
70,847,771
I want to embed my chart from Apache Superset into my React.js App. So far I know there is possibility to use like this: ``` <iframe id="myIFRAME" width="1600" height="1200" seamless frameBorder="10" scrolling="no" src="http://localhost:8080/r/3" > </iframe...
2022/01/25
[ "https://Stackoverflow.com/questions/70847771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9655774/" ]
**I think this approach will work for your task.** ``` import string import random random.seed(0) def stock_generator(): return (''.join(random.choices(string.ascii_uppercase, k=4)), random.random()) parse_result =[] n=100 for i in range(0,n): parse_result.append(stock_generator()) print(parse_result) ```
Try: ``` import string import random def stock_generator(num): names = [] for n in range(num): x = ''.join(random.choices(string.ascii_uppercase, k=4)) names.append(x) return names print(stock_generator(100)) ``` Each time you will call the function stock\_generator using a number ...
70,847,771
I want to embed my chart from Apache Superset into my React.js App. So far I know there is possibility to use like this: ``` <iframe id="myIFRAME" width="1600" height="1200" seamless frameBorder="10" scrolling="no" src="http://localhost:8080/r/3" > </iframe...
2022/01/25
[ "https://Stackoverflow.com/questions/70847771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9655774/" ]
You can generate a consistent `n` random samples by updating the `seed` of `random` before `shuffle`. Here is an example on how to generate these list of names (10 samples): ```py import random, copy sorted_list = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'...
Try: ``` import string import random def stock_generator(num): names = [] for n in range(num): x = ''.join(random.choices(string.ascii_uppercase, k=4)) names.append(x) return names print(stock_generator(100)) ``` Each time you will call the function stock\_generator using a number ...
70,847,771
I want to embed my chart from Apache Superset into my React.js App. So far I know there is possibility to use like this: ``` <iframe id="myIFRAME" width="1600" height="1200" seamless frameBorder="10" scrolling="no" src="http://localhost:8080/r/3" > </iframe...
2022/01/25
[ "https://Stackoverflow.com/questions/70847771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9655774/" ]
**I think this approach will work for your task.** ``` import string import random random.seed(0) def stock_generator(): return (''.join(random.choices(string.ascii_uppercase, k=4)), random.random()) parse_result =[] n=100 for i in range(0,n): parse_result.append(stock_generator()) print(parse_result) ```
You can generate a consistent `n` random samples by updating the `seed` of `random` before `shuffle`. Here is an example on how to generate these list of names (10 samples): ```py import random, copy sorted_list = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'...
42,473,622
Currently I am building a Docker Swarm cluster. It consists of 3 managers and 3 workers. The app I will be deploying on this setup consists of a laravel backend that needs its code in multiple containers for scalability. I already tried GlusterFS volumes and rex-ray with a Ceph backend as shared storage for my volumes....
2017/02/26
[ "https://Stackoverflow.com/questions/42473622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5562492/" ]
What I eventually ended up doing is use CephFS and mount this on the docker hosts. The write speeds are OK, maybe even excellent when compared to glusterfs. The reads are extremely fast on CephFS, this was also the case with GlusterFS. This setup suits my needs, but I can't use shared docker volumes accross hosts. I h...
Note that I have not tried the following. Since your code is mostly read-only, it seems to me that you "just" need a file system cache. CacheFS for example running on top of NFS. Since GlusterFS can be mounted as NFS, you should be able to combine the two.
32,981,856
In modern programming workflow numerous testing frameworks are used at once. For example, in PHP world, it is de-facto standard way to use unit tests, integration tests and functional/acceptance tests at once. Most of the time different frameworks are used for different test type. I am using combination of PHPSpec for ...
2015/10/07
[ "https://Stackoverflow.com/questions/32981856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4584060/" ]
It is actually quite simple to perfrom this task. All your frameworks rely on the same library to generate the code coverage. As you can see the generator in [sebastianbergmann/php-code-coverage](https://github.com/sebastianbergmann/php-code-coverage/blob/master/src/CodeCoverage.php#LC330) already supports a merge fun...
I think we are on same boat. How we can tell how much we have converge using this all different testing tool. We start discuss with team and decide to go for [SonarSource](http://www.sonarsource.com/products/plugins/languages/php/). - For PHP Plugin and Live demo PHP Report Stlyle - I advice you to visit live demo. ...
32,981,856
In modern programming workflow numerous testing frameworks are used at once. For example, in PHP world, it is de-facto standard way to use unit tests, integration tests and functional/acceptance tests at once. Most of the time different frameworks are used for different test type. I am using combination of PHPSpec for ...
2015/10/07
[ "https://Stackoverflow.com/questions/32981856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4584060/" ]
There is a tool for this: [phpcov](https://github.com/sebastianbergmann/phpcov). It allows to merge many coverage files with merge option: ``` $ parallel --gnu ::: \ 'phpunit --coverage-php /tmp/coverage/FooTest.cov tests/FooTest' \ 'phpunit --coverage-php /tmp/coverage/...
I think we are on same boat. How we can tell how much we have converge using this all different testing tool. We start discuss with team and decide to go for [SonarSource](http://www.sonarsource.com/products/plugins/languages/php/). - For PHP Plugin and Live demo PHP Report Stlyle - I advice you to visit live demo. ...
32,981,856
In modern programming workflow numerous testing frameworks are used at once. For example, in PHP world, it is de-facto standard way to use unit tests, integration tests and functional/acceptance tests at once. Most of the time different frameworks are used for different test type. I am using combination of PHPSpec for ...
2015/10/07
[ "https://Stackoverflow.com/questions/32981856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4584060/" ]
It is actually quite simple to perfrom this task. All your frameworks rely on the same library to generate the code coverage. As you can see the generator in [sebastianbergmann/php-code-coverage](https://github.com/sebastianbergmann/php-code-coverage/blob/master/src/CodeCoverage.php#LC330) already supports a merge fun...
The [PHP Test Coverage Tool](http://www.semanticdesigns.com/Products/TestCoverage/PHPTestCoverage.jsp?Home=TestCoverage) from Semantic Designs (my company) collects and combines test coverage from any * framework * test set * individual test * even ad hoc manual tests. After running some set of tests, our tool is can...
32,981,856
In modern programming workflow numerous testing frameworks are used at once. For example, in PHP world, it is de-facto standard way to use unit tests, integration tests and functional/acceptance tests at once. Most of the time different frameworks are used for different test type. I am using combination of PHPSpec for ...
2015/10/07
[ "https://Stackoverflow.com/questions/32981856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4584060/" ]
It is actually quite simple to perfrom this task. All your frameworks rely on the same library to generate the code coverage. As you can see the generator in [sebastianbergmann/php-code-coverage](https://github.com/sebastianbergmann/php-code-coverage/blob/master/src/CodeCoverage.php#LC330) already supports a merge fun...
There is a tool for this: [phpcov](https://github.com/sebastianbergmann/phpcov). It allows to merge many coverage files with merge option: ``` $ parallel --gnu ::: \ 'phpunit --coverage-php /tmp/coverage/FooTest.cov tests/FooTest' \ 'phpunit --coverage-php /tmp/coverage/...
32,981,856
In modern programming workflow numerous testing frameworks are used at once. For example, in PHP world, it is de-facto standard way to use unit tests, integration tests and functional/acceptance tests at once. Most of the time different frameworks are used for different test type. I am using combination of PHPSpec for ...
2015/10/07
[ "https://Stackoverflow.com/questions/32981856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4584060/" ]
There is a tool for this: [phpcov](https://github.com/sebastianbergmann/phpcov). It allows to merge many coverage files with merge option: ``` $ parallel --gnu ::: \ 'phpunit --coverage-php /tmp/coverage/FooTest.cov tests/FooTest' \ 'phpunit --coverage-php /tmp/coverage/...
The [PHP Test Coverage Tool](http://www.semanticdesigns.com/Products/TestCoverage/PHPTestCoverage.jsp?Home=TestCoverage) from Semantic Designs (my company) collects and combines test coverage from any * framework * test set * individual test * even ad hoc manual tests. After running some set of tests, our tool is can...
50,976,754
My Angular project's purpose is to achieve "add to homescreen" mobile functionality. In that process I choose manifest/PWA methodology and I have created manifest.json in the root folder of project on the same level of index.html(root template), and added the manifest.json in the head section of root template (index.ht...
2018/06/21
[ "https://Stackoverflow.com/questions/50976754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7928973/" ]
Files are not copied by default to the dist folder. You need to add them manually in the angular.json config file (if Angular version >= 6) in the `assets` option, [see here for an example](https://github.com/johnpapa/angular-tour-of-heroes/blob/master/angular.json#L19) or in the `.angular-cli.json` config file (if Ang...
Also, I have changed the name of the file to `manifest.json` internally, while `angular.json` contained the entry `manifest.webmanifest`...
50,976,754
My Angular project's purpose is to achieve "add to homescreen" mobile functionality. In that process I choose manifest/PWA methodology and I have created manifest.json in the root folder of project on the same level of index.html(root template), and added the manifest.json in the head section of root template (index.ht...
2018/06/21
[ "https://Stackoverflow.com/questions/50976754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7928973/" ]
Files are not copied by default to the dist folder. You need to add them manually in the angular.json config file (if Angular version >= 6) in the `assets` option, [see here for an example](https://github.com/johnpapa/angular-tour-of-heroes/blob/master/angular.json#L19) or in the `.angular-cli.json` config file (if Ang...
`go to angular.json` `add manifest.json location in assets` ``` "assets": [ "src/favicon.ico", "src/assets", "src/manifest.json" ], ``` restart dev server using `ng serve`
50,976,754
My Angular project's purpose is to achieve "add to homescreen" mobile functionality. In that process I choose manifest/PWA methodology and I have created manifest.json in the root folder of project on the same level of index.html(root template), and added the manifest.json in the head section of root template (index.ht...
2018/06/21
[ "https://Stackoverflow.com/questions/50976754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7928973/" ]
Also, I have changed the name of the file to `manifest.json` internally, while `angular.json` contained the entry `manifest.webmanifest`...
`go to angular.json` `add manifest.json location in assets` ``` "assets": [ "src/favicon.ico", "src/assets", "src/manifest.json" ], ``` restart dev server using `ng serve`
901,345
I have a situation with `ip_hash` on nginx for sticky session where it always direct the traffic to one server only. The nginx is running behind a Google Cloud load balancer, from nginx it hits my app's GC Kubernetes load balancer before actually going to one of the pod. I have a thought that all users' IP was masked ...
2018/03/13
[ "https://serverfault.com/questions/901345", "https://serverfault.com", "https://serverfault.com/users/460358/" ]
If you are using Network load balancing (with target pools) the load balancer keeps the IP. What happens is that Kubernetes is changing the [source IP](https://kubernetes.io/docs/tutorials/services/source-ip/#source-ip-for-services-with-typeloadbalancer) with the cluster/node IPs. Kubernetes has a feature to preserve ...
Configure **[session affinity](https://cloud.google.com/compute/docs/load-balancing/http/#session_affinity)** during the initial configuration of a **[target pool](https://cloud.google.com/compute/docs/load-balancing/network/target-pools)** by setting it to one of the following **non-default values** in order to provid...
901,345
I have a situation with `ip_hash` on nginx for sticky session where it always direct the traffic to one server only. The nginx is running behind a Google Cloud load balancer, from nginx it hits my app's GC Kubernetes load balancer before actually going to one of the pod. I have a thought that all users' IP was masked ...
2018/03/13
[ "https://serverfault.com/questions/901345", "https://serverfault.com", "https://serverfault.com/users/460358/" ]
If you are using Network load balancing (with target pools) the load balancer keeps the IP. What happens is that Kubernetes is changing the [source IP](https://kubernetes.io/docs/tutorials/services/source-ip/#source-ip-for-services-with-typeloadbalancer) with the cluster/node IPs. Kubernetes has a feature to preserve ...
Use the proxy\_set\_header to add your IP original to NGINX header. Checkout the following examples: ``` proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Host $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; ``` In the same way, you can add your IP origin to NGINX header.
24,441,620
I've looked at several [similar](http://www.intstrings.com/ramivemula/articles/data-transfer-between-two-asp-net-pages/) [questions](https://stackoverflow.com/questions/9640286/pass-data-into-user-control-on-master-page-from-sub-page) to this one and right now I am trying to use the FindControl method without success. ...
2014/06/26
[ "https://Stackoverflow.com/questions/24441620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31444/" ]
You can do: ``` DataCaptured = csv.reader(DataFile, delimiter=',', skipinitialspace=True) Category, Year = [], [] for row in DataCaptured: if row[0] not in Year: Year.append(row[0]) if row[1] not in Category: Category.append(row[1]) print Category, Year # ['Category1', 'Category2...
A very concise way to do this is to use `pandas`, the benefits are: it has a faster CSV pharser; and it works in columns (so it only requires one `df.apply(set)` to get you there) : ``` In [244]: #Suppose the CSV is named temp.csv df=pd.read_csv('temp.csv',header=None) df.apply(set) Out[244]: 0 ...
24,441,620
I've looked at several [similar](http://www.intstrings.com/ramivemula/articles/data-transfer-between-two-asp-net-pages/) [questions](https://stackoverflow.com/questions/9640286/pass-data-into-user-control-on-master-page-from-sub-page) to this one and right now I am trying to use the FindControl method without success. ...
2014/06/26
[ "https://Stackoverflow.com/questions/24441620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31444/" ]
You can do: ``` DataCaptured = csv.reader(DataFile, delimiter=',', skipinitialspace=True) Category, Year = [], [] for row in DataCaptured: if row[0] not in Year: Year.append(row[0]) if row[1] not in Category: Category.append(row[1]) print Category, Year # ['Category1', 'Category2...
`dawg` pointed out one of the greatest tricks in Python: using `set()` to remove duplicates from a list. `dawg` shows how to build the unique list from scratch by adding each item to a `set`, which is perfect. But here's another equivalent way to do it, generating a list with duplicates and a list without duplicates us...
24,441,620
I've looked at several [similar](http://www.intstrings.com/ramivemula/articles/data-transfer-between-two-asp-net-pages/) [questions](https://stackoverflow.com/questions/9640286/pass-data-into-user-control-on-master-page-from-sub-page) to this one and right now I am trying to use the FindControl method without success. ...
2014/06/26
[ "https://Stackoverflow.com/questions/24441620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31444/" ]
A very concise way to do this is to use `pandas`, the benefits are: it has a faster CSV pharser; and it works in columns (so it only requires one `df.apply(set)` to get you there) : ``` In [244]: #Suppose the CSV is named temp.csv df=pd.read_csv('temp.csv',header=None) df.apply(set) Out[244]: 0 ...
`dawg` pointed out one of the greatest tricks in Python: using `set()` to remove duplicates from a list. `dawg` shows how to build the unique list from scratch by adding each item to a `set`, which is perfect. But here's another equivalent way to do it, generating a list with duplicates and a list without duplicates us...
69,493,574
I've struct with two properties one is `carName` which's type is string and the other one is `carModel` which is an array of strings, I've created `CollectionView` of `carName`'s and after clicking the specific `CollectionView` cell, Main view controller (which is `CollectionView`) goes to the other one which is `Table...
2021/10/08
[ "https://Stackoverflow.com/questions/69493574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17100913/" ]
You need to either modify the `useLoadRoot` hook or wrap that logic in a child component. Hooks don't allow conditional usage. Route 1: Rewrite `useLoadRoot` ------------------------------ ``` const useLoadRoot = (id) => { const getRoot = async (rootId) => ...; const [root, setRoot] = useState(); useEffect(() ...
The rules of hooks state that all hooks must run in the same order with each render cycle. This means we need to write conditional logic in a particular way. I would recommend this. ``` const MyScreen = () => { const [ID, setID] = useState() cosnt [data, setData] = useState() useEffect(() => { const getData...
69,493,574
I've struct with two properties one is `carName` which's type is string and the other one is `carModel` which is an array of strings, I've created `CollectionView` of `carName`'s and after clicking the specific `CollectionView` cell, Main view controller (which is `CollectionView`) goes to the other one which is `Table...
2021/10/08
[ "https://Stackoverflow.com/questions/69493574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17100913/" ]
You need to either modify the `useLoadRoot` hook or wrap that logic in a child component. Hooks don't allow conditional usage. Route 1: Rewrite `useLoadRoot` ------------------------------ ``` const useLoadRoot = (id) => { const getRoot = async (rootId) => ...; const [root, setRoot] = useState(); useEffect(() ...
It's because you have no `return`. All react components should return something so return `null` from your component and it should solve your problem. Also, to avoid unnecessary rendering, you should do it in useEffect with an empty array so it only get triggers once (after the component mounts).
54,374,929
Say I have a table in the format: ``` | id | category| |----|---------| | 10 | A | | 10 | B | | 10 | C | | 2 | C | ``` I want to count the number of distinct id's that have all three values A, B, and C in the category variable. In this case, the query would return `1` since only for id = ...
2019/01/26
[ "https://Stackoverflow.com/questions/54374929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3899919/" ]
There are several changes you need to make in order to obtain the desired behavior. First of all, you need to understand you're dealing with a negative space scenario in flexbox. That's when the sum of lengths of contents is bigger than the available parent length. In this case, flexbox calculates the difference bet...
I know that your question mentioned flexbox specifically, but I would use `display: grid` for this case. [Grid](https://css-tricks.com/snippets/css/complete-guide-grid/) will allow you to define the columns more accurately, maintain space between each section of content in the row, and truncate that content within the ...
47,216,419
Below is a 1. starting df (called "close"),and 2. an apply line of code, and its resulting df: 1. ``` Date 2006-01-27 100.0 2006-01-30 100.0 2006-01-31 100.0 2006-02-01 100.0 2006-02-02 NaN 2006-02-03 NaN ``` 2. ``` close.apply(lambda x: x.shift(1) + (x.shift(4)) Date 2006-01-27 NaN 2006-01-30 Na...
2017/11/10
[ "https://Stackoverflow.com/questions/47216419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8242299/" ]
Consider a series `close` ``` close = pd.Series( [100] * 3 + [100.706786] + [np.nan] * 10, pd.date_range('2006-01-27', periods=14, name='Date') ) close Date 2006-01-27 100.000000 2006-01-28 100.000000 2006-01-29 100.000000 2006-01-30 100.706786 2006-01-31 NaN 2006-02-01 NaN 20...
I actually found a pretty handy solution (and very fast) using deque: ``` from collections import deque queue = deque([100]*(4)) close = [] for num in range(0,len(close.index-4): nextval = queue[-1] + queue[0] close.append(nextval) queue.popleft() queue.append(nextval) close = pd.DataFrame(close,i...
18,561,457
**Context** I'm learning how to use Google's - GTFS-realtime The timestamps that are supplied by a service adhering to this standard are described on this page: <https://developers.google.com/transit/gtfs-realtime/reference> Part of the instructions include this sentence: "To avoid time skew between systems produ...
2013/09/01
[ "https://Stackoverflow.com/questions/18561457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1193977/" ]
Suppose that your application is running on multiple machines. Some event occurs concurrently (at the same time) on two or more machines. If the machines time is **not** synchronous (machine 1 says 01.09.2013 **08:00:00.000** and machine 2 says 01.09.2013 **07:58:45.123**). The events will not have the correct appearen...
In practical terms, what this means is whenever you want to get a timestamp for use in your application, instead of using your own copmauter's timesatmp, you should get it from a time server on the network. To set this up , you can read this: <http://www.pool.ntp.org/en/use.html>
18,561,457
**Context** I'm learning how to use Google's - GTFS-realtime The timestamps that are supplied by a service adhering to this standard are described on this page: <https://developers.google.com/transit/gtfs-realtime/reference> Part of the instructions include this sentence: "To avoid time skew between systems produ...
2013/09/01
[ "https://Stackoverflow.com/questions/18561457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1193977/" ]
Suppose that your application is running on multiple machines. Some event occurs concurrently (at the same time) on two or more machines. If the machines time is **not** synchronous (machine 1 says 01.09.2013 **08:00:00.000** and machine 2 says 01.09.2013 **07:58:45.123**). The events will not have the correct appearen...
You ask the server what time it is, because your local hardware clock might be inaccurate. For some algorithms it is important that time is synchronized. Even if it is not a strict requirement, synchronous clocks are helpful for debugging. You need to correlate logs sometimes.
62,497,708
I have this php code: ``` foreach($output as $row) { $table.="<tr>"; foreach($row as $column) { $table .="<td>"; $values = implode(",",$column); $table .= count($column); $table .="</td>"; } $table.="</tr>"; } $table.="</table>"; echo $table; ``` This c...
2020/06/21
[ "https://Stackoverflow.com/questions/62497708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13785609/" ]
It's completly normal to have an POST request with a content of ``` { username: "myName123", password: "myPassword456" } ``` You can see this in almost every service, which requires authentication. When you do this, make sure your communication with the client is encrypted (HTTPS) so that a man in the middle c...
1. Don't trust the user - clean the input from stuff that should not be there. 2. Encode / hash the input by adding something to mix up the logic. 3. Decode / dehash and verify. When you encode something with built in feature - like base64 then add some variable to the string that makes it more random.
20,352,715
I am having this problem where my code is returning only one value. ``` class Userlogin extends CI_Model { function login($username,$password) { $this -> db -> select('userid', 'username', 'password'); $this -> db -> from('user'); $this -> db -> where('username', $username); $this -> ...
2013/12/03
[ "https://Stackoverflow.com/questions/20352715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1646729/" ]
In your code, you've got the following line: ``` $this -> db -> select('userid', 'username', 'password'); ``` You cannot pass multiple arguments to the `select` method of the db layer of Codeigniter. It has to be comma-seperated, like this: ``` $this -> db -> select('userid, username, password'); ``` Hope this he...
`select` method expects a string containing all the columns you want. Try ``` $this -> db -> select('userid, username, password'); ```
20,352,715
I am having this problem where my code is returning only one value. ``` class Userlogin extends CI_Model { function login($username,$password) { $this -> db -> select('userid', 'username', 'password'); $this -> db -> from('user'); $this -> db -> where('username', $username); $this -> ...
2013/12/03
[ "https://Stackoverflow.com/questions/20352715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1646729/" ]
In your code, you've got the following line: ``` $this -> db -> select('userid', 'username', 'password'); ``` You cannot pass multiple arguments to the `select` method of the db layer of Codeigniter. It has to be comma-seperated, like this: ``` $this -> db -> select('userid, username, password'); ``` Hope this he...
you can do something like this **Model**: ``` class Userlogin extends CI_Model { function login($username,$password) { $this -> db -> select('userid, username, password'); -> from('user') -> where('username', $username) -> where('password', $password) ->...
6,037,492
This seems simple; I have to be missing something straight forward. **TestTable** Value1 (int) Value2 (int) Value3 (int) Value4 (int) Insert into TestTable 20, 30, 40 ,50 Value1 = 20 Value2 = 30 Value3 = 40 Value4 = 50 I have the number 37. I want to return 30 and 40 (37 falls between these two n...
2011/05/17
[ "https://Stackoverflow.com/questions/6037492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59858/" ]
``` declare @TestTable table (Value1 int, Value2 int, Value3 int, Value4 int) insert into @TestTable values (20, 30, 40, 50) declare @Value int = 37 select case when @Value between Value1 and Value2 then Value1 when @Value between Value2 and Value3 then Value2 when @Value between Value3 and Value4 then ...
``` SELECT TOP 1 [value] FROM TestTable WHERE [value] <= @number ORDER BY [value] DESC UNION SELECT TOP 1 [value] FROM TestTable WHERE [value] >= @number ORDER BY [value] ``` Alternatively ``` SELECT (SELECT TOP 1 [value] FROM TestTable WHERE [value] <= @number ORDER BY [value] DESC) AS [min], (SELECT TOP 1 [val...
6,037,492
This seems simple; I have to be missing something straight forward. **TestTable** Value1 (int) Value2 (int) Value3 (int) Value4 (int) Insert into TestTable 20, 30, 40 ,50 Value1 = 20 Value2 = 30 Value3 = 40 Value4 = 50 I have the number 37. I want to return 30 and 40 (37 falls between these two n...
2011/05/17
[ "https://Stackoverflow.com/questions/6037492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59858/" ]
``` declare @TestTable table (Value1 int, Value2 int, Value3 int, Value4 int) insert into @TestTable values (20, 30, 40, 50) declare @Value int = 37 select case when @Value between Value1 and Value2 then Value1 when @Value between Value2 and Value3 then Value2 when @Value between Value3 and Value4 then ...
You'd replace the 34 with a variable containing the value you want to find, but I think this should get you what you want. ``` select (select top 1 * from TestTable where value > 34 order by value), (select top 1 * from TestTable where value < 34 order by value desc) ```
41,540,854
Hello all I have got somthing wrong while deleting items from database.I have a list of schools in one activity.THis is my screen shot [![Schools.java][1]][1] At the top of schooldetails.class I have an star icon to bookmark the school.On clicking the bookmark icon the icon changes to filled one and the respective sch...
2017/01/09
[ "https://Stackoverflow.com/questions/41540854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7316205/" ]
Use this in your helper class :D ``` public boolean removeBookmarkItem(String id) { SQLiteDatabase db = this.getWritableDatabase(); return db.delete(TABLE_NAME_BOOKMARK, ID + "=" + id, null) > 0; } ```
You can check yours delete method through db. You can download DB browser for SQLite and open your db file with this browser and check, if you're really deleting bookmark state, if not maybe there is problem with query.
54,118
I made two characters and I noticed I get the Paragon Interrupt (the flashing icon that lets you interrupt a cutscene to say something Paragon/Renegade-y) when my character is mostly Paragon and I get Renegade when my character matches that. I haven't played with a neural character at all. What determines which Interr...
2012/03/08
[ "https://gaming.stackexchange.com/questions/54118", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/11920/" ]
From the [ME wiki](http://masseffect.wikia.com/wiki/Interrupt): > > Unlike Charm and Intimidate, Shepard is not required to have any > minimum amount of Paragon or Renegade points in order for an interrupt > to be presented. All characters will encounter the interrupt at the > appropriate time, assuming they made ...
First off, Interrupts are scripted. Not every conversation has one, and not every opportunity to use a Paragon Interrupt has a corresponding Renegade Interrupt, and vice versa. As for what determines whether you can use them, much like charm and intimidate options, there are occasionally minimum reputation or Paragon/...
71,346,924
I have created new dataset using snowflake connector and used the same as source dataset in lookup activity. Then I am trying to INSERT the record into snowflake using following query. 'INSERT INTO SAMPLE\_TABLE VALUES('TEST',1,1,CURRENT\_TIMESTAMP,'TEST'-- (all values are passed) Result: **The row getting inserted i...
2022/03/04
[ "https://Stackoverflow.com/questions/71346924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18297532/" ]
Lookup, as the name suggests, is for searching and retrieving data, not for inserting. However, you can enclose your INSERT code in a procedure and execute it using the Lookup activity. [![enter image description here](https://i.stack.imgur.com/ufsgk.png)](https://i.stack.imgur.com/ufsgk.png) However, I strongly **do...
You *can* use the lookup activity to perform operations other than selects, it just HAS to have an output. I've gotten around it with a postgres database doing create tables, truncates, one off inserts by just concatenating a select current\_date; after the main query. Note, the sql script activity will definitely b...
72,605,237
I have this array : ``` defaultColumnsWithItems = [ { column: 'Contrie', items: [ { id: 1, label: 'USA', selectedItem: true }, { id: 2, label: 'FRANCE', selectedItem: false }, { id: 2, label: 'MAROC', selectedItem: false } ] }, { column: 'Categorie', items: [ { id: 0, label: 'Alimentaion', sele...
2022/06/13
[ "https://Stackoverflow.com/questions/72605237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13082478/" ]
You'll want to use the pandas library within python. It has a function called `pandas.read_excel` that is very useful for reading excel files. This will return a dataframe, which will allow you to use `iloc` or other methods of accessing the values in the first and second columns. From there, I'd recommend using `os.re...
I would encourage you to do this with a .csv file instead of a xls, as is a much easier format (requires 0 formatting of borders, colors, etc.). You can use the os.listdir() function to list all files and folders in a certain directory. Check os built-in library docs for that. Then grab the string name of each file, r...
70,910,597
I'm fairly new to programming, been these last few days watching a few dozens of hours of courses in Dart programming language and coding along on Repl.it through the exercises and tutorials. I'd like to know if any of you have used Replit to not just practice coding but actually create mobile and web applications usin...
2022/01/29
[ "https://Stackoverflow.com/questions/70910597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18068823/" ]
Repl.it is a great tool to start coding without having to setup all development tools on your computer first. I personally haven't used repl.it much before, but from what I can tell it seems to be sufficient to implement simple command line applications in Dart. However, in my opinion repl.it is not suited for web or m...
Instead of using Dart by itself, please consider using Flutter instead. Flutter is built on top of Dart and provide the ability to write mobiles app and web apps (and desktop apps) from the same source code.
3,750,109
I am trying to use some arguments for an Instrumentation test. I noticed that I can read system properties with `System.getProperty()` function. So I use setprop command to set a system property. For example: `adb shell setprop AP 123`. Inside my Test code I try to read this AP property with : ``` tmp = System.getPr...
2010/09/20
[ "https://Stackoverflow.com/questions/3750109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342863/" ]
System properties are read once when the root VM (Zygote) is started, which in turn spawns other Dalvik VMs like that of your application. That means you cannot set system properties on the fly. Try restarting Zygote using `adb shell stop` (wait until it has stopped) and `adb shell start` (wait until it has restarted)...
Based on provided answer, Slightly modified version of SetProperty ``` public void setSystemProperty(String Key, String value){ InputStreamReader in = null; BufferedReader reader = null; try { Process proc = Runtime.getRuntime().exec("/system/bin/setprop "+Key+" "+value); in = new Inpu...
3,750,109
I am trying to use some arguments for an Instrumentation test. I noticed that I can read system properties with `System.getProperty()` function. So I use setprop command to set a system property. For example: `adb shell setprop AP 123`. Inside my Test code I try to read this AP property with : ``` tmp = System.getPr...
2010/09/20
[ "https://Stackoverflow.com/questions/3750109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342863/" ]
To get the property set by 'setprop', there are two options: One. use android.os.SystemProperties, this is a hide API. use it like this: ``` Class clazz = null; clazz = Class.forName("android.os.SystemProperties"); Method method = clazz.getDeclaredMethod("get", String.class); String prop = (String)method.invoke(nul...
Based on provided answer, Slightly modified version of SetProperty ``` public void setSystemProperty(String Key, String value){ InputStreamReader in = null; BufferedReader reader = null; try { Process proc = Runtime.getRuntime().exec("/system/bin/setprop "+Key+" "+value); in = new Inpu...
3,750,109
I am trying to use some arguments for an Instrumentation test. I noticed that I can read system properties with `System.getProperty()` function. So I use setprop command to set a system property. For example: `adb shell setprop AP 123`. Inside my Test code I try to read this AP property with : ``` tmp = System.getPr...
2010/09/20
[ "https://Stackoverflow.com/questions/3750109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342863/" ]
Because there are two types of property in Android. 1. System level - we can get/set with command `adb shell getprop/setprop`. 2. In current process level - we can get/set with regular java `System.getProperty()/setProperty()`. As you are setting a system level property and trying to get its value as current process ...
Based on provided answer, Slightly modified version of SetProperty ``` public void setSystemProperty(String Key, String value){ InputStreamReader in = null; BufferedReader reader = null; try { Process proc = Runtime.getRuntime().exec("/system/bin/setprop "+Key+" "+value); in = new Inpu...
3,750,109
I am trying to use some arguments for an Instrumentation test. I noticed that I can read system properties with `System.getProperty()` function. So I use setprop command to set a system property. For example: `adb shell setprop AP 123`. Inside my Test code I try to read this AP property with : ``` tmp = System.getPr...
2010/09/20
[ "https://Stackoverflow.com/questions/3750109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342863/" ]
Based on provided answer, Slightly modified version of SetProperty ``` public void setSystemProperty(String Key, String value){ InputStreamReader in = null; BufferedReader reader = null; try { Process proc = Runtime.getRuntime().exec("/system/bin/setprop "+Key+" "+value); in = new Inpu...
import android.os.SystemProperties String s = SystemProterties.get("ro.xxx.xxx","default value if property not set");
3,750,109
I am trying to use some arguments for an Instrumentation test. I noticed that I can read system properties with `System.getProperty()` function. So I use setprop command to set a system property. For example: `adb shell setprop AP 123`. Inside my Test code I try to read this AP property with : ``` tmp = System.getPr...
2010/09/20
[ "https://Stackoverflow.com/questions/3750109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342863/" ]
here's a slightly saner version based on accuya's answer: ``` public static String readSystemProperty(String name) { InputStreamReader in = null; BufferedReader reader = null; try { Process proc = Runtime.getRuntime().exec(new String[]{"/system/bin/getprop", name}); in = new InputStreamRead...
import android.os.SystemProperties String s = SystemProterties.get("ro.xxx.xxx","default value if property not set");
3,750,109
I am trying to use some arguments for an Instrumentation test. I noticed that I can read system properties with `System.getProperty()` function. So I use setprop command to set a system property. For example: `adb shell setprop AP 123`. Inside my Test code I try to read this AP property with : ``` tmp = System.getPr...
2010/09/20
[ "https://Stackoverflow.com/questions/3750109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342863/" ]
System properties are read once when the root VM (Zygote) is started, which in turn spawns other Dalvik VMs like that of your application. That means you cannot set system properties on the fly. Try restarting Zygote using `adb shell stop` (wait until it has stopped) and `adb shell start` (wait until it has restarted)...
here's a slightly saner version based on accuya's answer: ``` public static String readSystemProperty(String name) { InputStreamReader in = null; BufferedReader reader = null; try { Process proc = Runtime.getRuntime().exec(new String[]{"/system/bin/getprop", name}); in = new InputStreamRead...
3,750,109
I am trying to use some arguments for an Instrumentation test. I noticed that I can read system properties with `System.getProperty()` function. So I use setprop command to set a system property. For example: `adb shell setprop AP 123`. Inside my Test code I try to read this AP property with : ``` tmp = System.getPr...
2010/09/20
[ "https://Stackoverflow.com/questions/3750109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342863/" ]
To get the property set by 'setprop', there are two options: One. use android.os.SystemProperties, this is a hide API. use it like this: ``` Class clazz = null; clazz = Class.forName("android.os.SystemProperties"); Method method = clazz.getDeclaredMethod("get", String.class); String prop = (String)method.invoke(nul...
here's a slightly saner version based on accuya's answer: ``` public static String readSystemProperty(String name) { InputStreamReader in = null; BufferedReader reader = null; try { Process proc = Runtime.getRuntime().exec(new String[]{"/system/bin/getprop", name}); in = new InputStreamRead...
3,750,109
I am trying to use some arguments for an Instrumentation test. I noticed that I can read system properties with `System.getProperty()` function. So I use setprop command to set a system property. For example: `adb shell setprop AP 123`. Inside my Test code I try to read this AP property with : ``` tmp = System.getPr...
2010/09/20
[ "https://Stackoverflow.com/questions/3750109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342863/" ]
Because there are two types of property in Android. 1. System level - we can get/set with command `adb shell getprop/setprop`. 2. In current process level - we can get/set with regular java `System.getProperty()/setProperty()`. As you are setting a system level property and trying to get its value as current process ...
import android.os.SystemProperties String s = SystemProterties.get("ro.xxx.xxx","default value if property not set");
3,750,109
I am trying to use some arguments for an Instrumentation test. I noticed that I can read system properties with `System.getProperty()` function. So I use setprop command to set a system property. For example: `adb shell setprop AP 123`. Inside my Test code I try to read this AP property with : ``` tmp = System.getPr...
2010/09/20
[ "https://Stackoverflow.com/questions/3750109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342863/" ]
You need a root to set system property ``` adb shell su setprop AP 123 ```
import android.os.SystemProperties String s = SystemProterties.get("ro.xxx.xxx","default value if property not set");
3,750,109
I am trying to use some arguments for an Instrumentation test. I noticed that I can read system properties with `System.getProperty()` function. So I use setprop command to set a system property. For example: `adb shell setprop AP 123`. Inside my Test code I try to read this AP property with : ``` tmp = System.getPr...
2010/09/20
[ "https://Stackoverflow.com/questions/3750109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342863/" ]
To get the property set by 'setprop', there are two options: One. use android.os.SystemProperties, this is a hide API. use it like this: ``` Class clazz = null; clazz = Class.forName("android.os.SystemProperties"); Method method = clazz.getDeclaredMethod("get", String.class); String prop = (String)method.invoke(nul...
System properties are read once when the root VM (Zygote) is started, which in turn spawns other Dalvik VMs like that of your application. That means you cannot set system properties on the fly. Try restarting Zygote using `adb shell stop` (wait until it has stopped) and `adb shell start` (wait until it has restarted)...
29,918,216
I got sharded mongodb setup with two replica sets: ``` mongos> db.runCommand( { listShards : 1 } ) { "shards" : [ { "_id" : "rs01", "host" : "rs01/10.133.250.140:27017,10.133.250.154:27017" }, { "_id" : "rs02", "host" : "rs02/10.133.242.7:2701...
2015/04/28
[ "https://Stackoverflow.com/questions/29918216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349785/" ]
Many times you would need to modify the host string for a shard. The simplest way to change host string is to run an update operation. Connect to mongos and do this - ``` > use config > db.shards.update({ "_id" : "rs01"},{$set : { "host" : "rs01/newip:27017,anothernewip:27017"} }) ``` You might need to restart all ...
Well, removing problem shard and adding it again seems the only option.
4,903,007
How do I tell django-extensions' `shell_plus` what models I want to autoload?
2011/02/04
[ "https://Stackoverflow.com/questions/4903007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199712/" ]
> > **shell\_plus** – An enhanced version of > the Django shell. It will autoload all > your models making it easy to work > with the ORM right away. > > > Quote from django-extensions github wiki located <https://github.com/django-extensions/django-extensions/wiki/Current-Command-Extensions> Don't believe its...
according to the [code](https://github.com/django-extensions/django-extensions/blob/master/django_extensions/management/commands/shell_plus.py). shell\_plus always loading all your models.
4,903,007
How do I tell django-extensions' `shell_plus` what models I want to autoload?
2011/02/04
[ "https://Stackoverflow.com/questions/4903007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199712/" ]
In the past whenever shell\_plus wasn't autoloading my models it was normally because there was an error in the models and it was causing the autoloading to fail. If you open shell plus and then try to manually load your modules one at a time what happens? ``` from app.models import ModelName ``` Another thing to ...
> > **shell\_plus** – An enhanced version of > the Django shell. It will autoload all > your models making it easy to work > with the ORM right away. > > > Quote from django-extensions github wiki located <https://github.com/django-extensions/django-extensions/wiki/Current-Command-Extensions> Don't believe its...
4,903,007
How do I tell django-extensions' `shell_plus` what models I want to autoload?
2011/02/04
[ "https://Stackoverflow.com/questions/4903007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199712/" ]
> > **shell\_plus** – An enhanced version of > the Django shell. It will autoload all > your models making it easy to work > with the ORM right away. > > > Quote from django-extensions github wiki located <https://github.com/django-extensions/django-extensions/wiki/Current-Command-Extensions> Don't believe its...
By default `shell_plus` always loads all your models. Thanks to @xeor you can use the option *SHELL\_PLUS\_DONT\_LOAD* in your settings to skip some of your models. You can also configure aliases to your models to avoid names collisions. More details: <http://django-extensions.readthedocs.org/en/latest/shell_plus.html...
4,903,007
How do I tell django-extensions' `shell_plus` what models I want to autoload?
2011/02/04
[ "https://Stackoverflow.com/questions/4903007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199712/" ]
In the past whenever shell\_plus wasn't autoloading my models it was normally because there was an error in the models and it was causing the autoloading to fail. If you open shell plus and then try to manually load your modules one at a time what happens? ``` from app.models import ModelName ``` Another thing to ...
according to the [code](https://github.com/django-extensions/django-extensions/blob/master/django_extensions/management/commands/shell_plus.py). shell\_plus always loading all your models.
4,903,007
How do I tell django-extensions' `shell_plus` what models I want to autoload?
2011/02/04
[ "https://Stackoverflow.com/questions/4903007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199712/" ]
I've made a new patch for the shell\_plus extension that makes it possible to ignore some models. Waiting for <https://github.com/django-extensions/django-extensions/pull/99> to get accepted.
according to the [code](https://github.com/django-extensions/django-extensions/blob/master/django_extensions/management/commands/shell_plus.py). shell\_plus always loading all your models.
4,903,007
How do I tell django-extensions' `shell_plus` what models I want to autoload?
2011/02/04
[ "https://Stackoverflow.com/questions/4903007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199712/" ]
In the past whenever shell\_plus wasn't autoloading my models it was normally because there was an error in the models and it was causing the autoloading to fail. If you open shell plus and then try to manually load your modules one at a time what happens? ``` from app.models import ModelName ``` Another thing to ...
I've made a new patch for the shell\_plus extension that makes it possible to ignore some models. Waiting for <https://github.com/django-extensions/django-extensions/pull/99> to get accepted.
4,903,007
How do I tell django-extensions' `shell_plus` what models I want to autoload?
2011/02/04
[ "https://Stackoverflow.com/questions/4903007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199712/" ]
In the past whenever shell\_plus wasn't autoloading my models it was normally because there was an error in the models and it was causing the autoloading to fail. If you open shell plus and then try to manually load your modules one at a time what happens? ``` from app.models import ModelName ``` Another thing to ...
By default `shell_plus` always loads all your models. Thanks to @xeor you can use the option *SHELL\_PLUS\_DONT\_LOAD* in your settings to skip some of your models. You can also configure aliases to your models to avoid names collisions. More details: <http://django-extensions.readthedocs.org/en/latest/shell_plus.html...
4,903,007
How do I tell django-extensions' `shell_plus` what models I want to autoload?
2011/02/04
[ "https://Stackoverflow.com/questions/4903007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199712/" ]
I've made a new patch for the shell\_plus extension that makes it possible to ignore some models. Waiting for <https://github.com/django-extensions/django-extensions/pull/99> to get accepted.
By default `shell_plus` always loads all your models. Thanks to @xeor you can use the option *SHELL\_PLUS\_DONT\_LOAD* in your settings to skip some of your models. You can also configure aliases to your models to avoid names collisions. More details: <http://django-extensions.readthedocs.org/en/latest/shell_plus.html...
7,640,694
Simple question, when the test is done executing, does the Start item in the Run menu become enabled again ? I see it disabled for a period while my test is running and then become enabled again. I ask because I've been running Jmeter for 3 days and don't see the tests completing but see start become re-enabled. Cheer...
2011/10/03
[ "https://Stackoverflow.com/questions/7640694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/977430/" ]
As with most computer vision algorithms, [Google Scholar](http://scholar.google.com/schhp?hl=en&as_sdt=0,1&as_vis=1) is your friend :) I would suggest reading a few papers on how it works. [Here](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.115.404&rep=rep1&type=pdf) is one of the most referenced papers on ...
Your terminology is a bit mixed up. HOG is a feature descriptor. You can train a classifier using HOG, which can in turn be used for object detection. OpenCV includes a people detector that uses HOG features and an SVM classifier. It also includes CascadeClassifier, which can use HOG, and which is typically used for fa...
11,379,947
I understand that the seven hu invariant moments are for translation, rotation, and scale change of the object, in order to recognize the object independently these factors. That's why I used the function "moments" from OpenCV to extract the central moments, then I used the function HuMoments to get the seven invarian...
2012/07/08
[ "https://Stackoverflow.com/questions/11379947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/702475/" ]
**First question :** It is ok to do so since you have single object in image. If more objects, and want to find moments for each, use contours. Visit : <http://opencvpython.blogspot.in/2012/06/contours-3-extraction.html> **Second Question :** (I am too thinking about it after seeing your questions) HuMoments were b...
To answer your second question: I don't think the invariant moments have any meaning. They're simply guaranteed to be constant for a given shape, no matter how it's shifted, rotated, or scaled. The kind of meaning you sound like you'd like to know about them: > > what data is related to rotation, what for translati...
23,238,598
I am working on an Asp.net project using C#. I am facing a problem in this project. This task based on service scheduled according to condition. **Problem:** Two textboxes for dates, one dropdownlist for type First I have selected two dates according to type generate scheduled. For example: I have selected dates `...
2014/04/23
[ "https://Stackoverflow.com/questions/23238598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3001573/" ]
To get one item from the collection you can use `FirstOrDefault` ``` Person person = m_PersonCollection.FirstOrDefault(t => t.Active) ``` This will give you the first person found or `null` if no persons were found.
The [Where](http://msdn.microsoft.com/en-us/library/bb534803%28v=vs.110%29.aspx) will return `IEnumberable` but not the Person, use FirstOrDefault or Single to get object of type Person. ``` var selected = m_PersonCollection.FirstOrDefault(t => t.Active == true); Person person = selected as Person; ```
23,238,598
I am working on an Asp.net project using C#. I am facing a problem in this project. This task based on service scheduled according to condition. **Problem:** Two textboxes for dates, one dropdownlist for type First I have selected two dates according to type generate scheduled. For example: I have selected dates `...
2014/04/23
[ "https://Stackoverflow.com/questions/23238598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3001573/" ]
To get one item from the collection you can use `FirstOrDefault` ``` Person person = m_PersonCollection.FirstOrDefault(t => t.Active) ``` This will give you the first person found or `null` if no persons were found.
I am not sure what kind of data erson has but no need to use var and casting. try this one ``` Person objPerson = (from person in m_PersonCollection where person.Active.Equals(true) select new Person { // map y...
23,238,598
I am working on an Asp.net project using C#. I am facing a problem in this project. This task based on service scheduled according to condition. **Problem:** Two textboxes for dates, one dropdownlist for type First I have selected two dates according to type generate scheduled. For example: I have selected dates `...
2014/04/23
[ "https://Stackoverflow.com/questions/23238598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3001573/" ]
Your code returns a list of all `Person` where `Active == true` if you want to get single person you can use ``` var selected = m_PersonCollection.FirstOrDefault(t => t.Active == true) ``` or if there can be only one active person ``` var selected = m_PersonCollection.SingleOrDefault(t => t.Active == true) ``` i...
The [Where](http://msdn.microsoft.com/en-us/library/bb534803%28v=vs.110%29.aspx) will return `IEnumberable` but not the Person, use FirstOrDefault or Single to get object of type Person. ``` var selected = m_PersonCollection.FirstOrDefault(t => t.Active == true); Person person = selected as Person; ```
23,238,598
I am working on an Asp.net project using C#. I am facing a problem in this project. This task based on service scheduled according to condition. **Problem:** Two textboxes for dates, one dropdownlist for type First I have selected two dates according to type generate scheduled. For example: I have selected dates `...
2014/04/23
[ "https://Stackoverflow.com/questions/23238598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3001573/" ]
``` var selected = m_PersonCollection.Where(t => t.Active == true).FirstOrDefault(); ```
The [Where](http://msdn.microsoft.com/en-us/library/bb534803%28v=vs.110%29.aspx) will return `IEnumberable` but not the Person, use FirstOrDefault or Single to get object of type Person. ``` var selected = m_PersonCollection.FirstOrDefault(t => t.Active == true); Person person = selected as Person; ```
23,238,598
I am working on an Asp.net project using C#. I am facing a problem in this project. This task based on service scheduled according to condition. **Problem:** Two textboxes for dates, one dropdownlist for type First I have selected two dates according to type generate scheduled. For example: I have selected dates `...
2014/04/23
[ "https://Stackoverflow.com/questions/23238598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3001573/" ]
Your code returns a list of all `Person` where `Active == true` if you want to get single person you can use ``` var selected = m_PersonCollection.FirstOrDefault(t => t.Active == true) ``` or if there can be only one active person ``` var selected = m_PersonCollection.SingleOrDefault(t => t.Active == true) ``` i...
I am not sure what kind of data erson has but no need to use var and casting. try this one ``` Person objPerson = (from person in m_PersonCollection where person.Active.Equals(true) select new Person { // map y...
23,238,598
I am working on an Asp.net project using C#. I am facing a problem in this project. This task based on service scheduled according to condition. **Problem:** Two textboxes for dates, one dropdownlist for type First I have selected two dates according to type generate scheduled. For example: I have selected dates `...
2014/04/23
[ "https://Stackoverflow.com/questions/23238598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3001573/" ]
``` var selected = m_PersonCollection.Where(t => t.Active == true).FirstOrDefault(); ```
I am not sure what kind of data erson has but no need to use var and casting. try this one ``` Person objPerson = (from person in m_PersonCollection where person.Active.Equals(true) select new Person { // map y...
69,105,194
I try to get all files like scheme\_12.sql and scheme\_23\_analytics.sql from folder with bash and regex works in a strange way in terminal, doesn't return anything. Also checked in python re and some interactive regex sites. It works. my command `ls | find . -type f -regex "\.\/scheme_[0-9]+_([a-zA-Z]+)?.sql"` but c...
2021/09/08
[ "https://Stackoverflow.com/questions/69105194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Because `result` is being reinitialized to `[]` every time the function is called. You are not passing itself the previous `result`, so it gets reset. In the end, only the last iteration with the last index (`[5]`) is sent back. What you can do is use a third argument, optional, that you can initialize to `[]`. ```js...
One workaround could be to add an accumulator to your recursive function, in order to bring in every steps the array you started at the beginning of the first call. ```js function recursive(index, length) { const result = []; result.push(index); return recursiveAcc(++index, length, result); } function recursive...
69,105,194
I try to get all files like scheme\_12.sql and scheme\_23\_analytics.sql from folder with bash and regex works in a strange way in terminal, doesn't return anything. Also checked in python re and some interactive regex sites. It works. my command `ls | find . -type f -regex "\.\/scheme_[0-9]+_([a-zA-Z]+)?.sql"` but c...
2021/09/08
[ "https://Stackoverflow.com/questions/69105194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The [answer](https://stackoverflow.com/a/69105341) from Jeremy Thille is great. It explains what's wrong, and gives a useful and understandable alternative. The code is clean and as it's tail-recursive, it can take advantage of tail-call optimization if that ever becomes widespread. There is a bug in it, though: presum...
One workaround could be to add an accumulator to your recursive function, in order to bring in every steps the array you started at the beginning of the first call. ```js function recursive(index, length) { const result = []; result.push(index); return recursiveAcc(++index, length, result); } function recursive...
69,105,194
I try to get all files like scheme\_12.sql and scheme\_23\_analytics.sql from folder with bash and regex works in a strange way in terminal, doesn't return anything. Also checked in python re and some interactive regex sites. It works. my command `ls | find . -type f -regex "\.\/scheme_[0-9]+_([a-zA-Z]+)?.sql"` but c...
2021/09/08
[ "https://Stackoverflow.com/questions/69105194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Because `result` is being reinitialized to `[]` every time the function is called. You are not passing itself the previous `result`, so it gets reset. In the end, only the last iteration with the last index (`[5]`) is sent back. What you can do is use a third argument, optional, that you can initialize to `[]`. ```js...
The [answer](https://stackoverflow.com/a/69105341) from Jeremy Thille is great. It explains what's wrong, and gives a useful and understandable alternative. The code is clean and as it's tail-recursive, it can take advantage of tail-call optimization if that ever becomes widespread. There is a bug in it, though: presum...
38,935,169
Suppose I have a list: ``` lst = [0, 1, 0, 0] ``` How can I make python interpret this list as a binary number 0100 so that `2*(0100)` gives me `01000`? The only way that I can think of is to first make a function that converts the "binary" elements to corresponding integers(to base 10) and then use bin() function....
2016/08/13
[ "https://Stackoverflow.com/questions/38935169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5847849/" ]
This is not a fancy one-liner, but simple and fast. ``` lst = [0,1,1,0] num = 0 for b in lst: num = 2 * num + b print(num) # 6 ```
Because I have a project atm, where I need to convert an black-white image to a byte-array and send it via TCP, I searched for a "as fast as possible" solution. So I took some solutions from here, added some I thought of and let run some speed tests. I thought sharing this would maybe be helpful... ```py import time...
38,935,169
Suppose I have a list: ``` lst = [0, 1, 0, 0] ``` How can I make python interpret this list as a binary number 0100 so that `2*(0100)` gives me `01000`? The only way that I can think of is to first make a function that converts the "binary" elements to corresponding integers(to base 10) and then use bin() function....
2016/08/13
[ "https://Stackoverflow.com/questions/38935169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5847849/" ]
Because I have a project atm, where I need to convert an black-white image to a byte-array and send it via TCP, I searched for a "as fast as possible" solution. So I took some solutions from here, added some I thought of and let run some speed tests. I thought sharing this would maybe be helpful... ```py import time...
You can use this code for concatenating the list elements: ``` x=[0, 1, 0, 0] b=''.join(map(str,x)) print(b) ``` Output: ``` C:\python\prog>python trying.py 0100 ```
38,935,169
Suppose I have a list: ``` lst = [0, 1, 0, 0] ``` How can I make python interpret this list as a binary number 0100 so that `2*(0100)` gives me `01000`? The only way that I can think of is to first make a function that converts the "binary" elements to corresponding integers(to base 10) and then use bin() function....
2016/08/13
[ "https://Stackoverflow.com/questions/38935169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5847849/" ]
The accepted answer, joining a string, is not the fastest. ```py import random lst = [int(i < 50) for i in random.choices(range(100), k=100)] def join_chars(digits): return int(''.join(str(i) for i in digits), 2) %timeit join_chars(lst) 13.1 µs ± 450 ns per loop (mean ± std. dev. of 7 runs, 100000 loops e...
You can try: ``` l = [0, 0, 1, 0] num = int(''.join(str(x) for x in l), base=2) ```