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
16,834,669
I have a Python application which analyse text data, having purpose to find the topics of the text. What I need to to do is to make this application a web application. I set apache, mod\_wsgi and flask framework together and I correctly make a simple application which show that everything works. But when I try to ca...
2013/05/30
[ "https://Stackoverflow.com/questions/16834669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436111/" ]
This is either going to need `display: table;` or a new CSS3 feature - [`calc()`.](https://developer.mozilla.org/en-US/docs/Web/CSS/calc) What do you need to support? If it is only new browsers, you could try this: ``` .bottom { height: calc(100% - 100px); } ``` [DEMO](http://jsfiddle.net/dmKbn/3/)
``` <div class="top"></div> <div style="overflow:auto;height:100%;position:absolute;"> <div class="bottom"> Lorem ipsum dolor sit amet.... </div> </div> .top{ height:100px; width: 100%; background-color: grey; } .bottom{ min-height:100px; width: 100%; overflow-y: scroll; background-color: red;...
16,834,669
I have a Python application which analyse text data, having purpose to find the topics of the text. What I need to to do is to make this application a web application. I set apache, mod\_wsgi and flask framework together and I correctly make a simple application which show that everything works. But when I try to ca...
2013/05/30
[ "https://Stackoverflow.com/questions/16834669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436111/" ]
Use calc() - <http://html5please.com/#calc> with 100px being your top bar ``` height: 100%; /** older browsers **/ max-height: 100%; /** older browsers **/ max-height: -webkit-calc(100% - 100x); /** Chrome / Safari 6 **/ max-height: -moz-calc(100% - 100px); /** FF 4-15 **/ max-height: calc(100% - 100px); /** FF 16+,...
``` <div class="top"></div> <div style="overflow:auto;height:100%;position:absolute;"> <div class="bottom"> Lorem ipsum dolor sit amet.... </div> </div> .top{ height:100px; width: 100%; background-color: grey; } .bottom{ min-height:100px; width: 100%; overflow-y: scroll; background-color: red;...
16,834,669
I have a Python application which analyse text data, having purpose to find the topics of the text. What I need to to do is to make this application a web application. I set apache, mod\_wsgi and flask framework together and I correctly make a simple application which show that everything works. But when I try to ca...
2013/05/30
[ "https://Stackoverflow.com/questions/16834669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436111/" ]
This is either going to need `display: table;` or a new CSS3 feature - [`calc()`.](https://developer.mozilla.org/en-US/docs/Web/CSS/calc) What do you need to support? If it is only new browsers, you could try this: ``` .bottom { height: calc(100% - 100px); } ``` [DEMO](http://jsfiddle.net/dmKbn/3/)
Add `position:absolute` and `max-height:100%` to `.bottom` class, Then the changed class will be ``` .bottom{ min-height:100px; width: 100%; overflow-y: scroll; background-color: red; position:absolute; max-height:100%; } ```
16,834,669
I have a Python application which analyse text data, having purpose to find the topics of the text. What I need to to do is to make this application a web application. I set apache, mod\_wsgi and flask framework together and I correctly make a simple application which show that everything works. But when I try to ca...
2013/05/30
[ "https://Stackoverflow.com/questions/16834669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436111/" ]
Use calc() - <http://html5please.com/#calc> with 100px being your top bar ``` height: 100%; /** older browsers **/ max-height: 100%; /** older browsers **/ max-height: -webkit-calc(100% - 100x); /** Chrome / Safari 6 **/ max-height: -moz-calc(100% - 100px); /** FF 4-15 **/ max-height: calc(100% - 100px); /** FF 16+,...
Add `position:absolute` and `max-height:100%` to `.bottom` class, Then the changed class will be ``` .bottom{ min-height:100px; width: 100%; overflow-y: scroll; background-color: red; position:absolute; max-height:100%; } ```
16,834,669
I have a Python application which analyse text data, having purpose to find the topics of the text. What I need to to do is to make this application a web application. I set apache, mod\_wsgi and flask framework together and I correctly make a simple application which show that everything works. But when I try to ca...
2013/05/30
[ "https://Stackoverflow.com/questions/16834669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436111/" ]
This is either going to need `display: table;` or a new CSS3 feature - [`calc()`.](https://developer.mozilla.org/en-US/docs/Web/CSS/calc) What do you need to support? If it is only new browsers, you could try this: ``` .bottom { height: calc(100% - 100px); } ``` [DEMO](http://jsfiddle.net/dmKbn/3/)
Use calc() - <http://html5please.com/#calc> with 100px being your top bar ``` height: 100%; /** older browsers **/ max-height: 100%; /** older browsers **/ max-height: -webkit-calc(100% - 100x); /** Chrome / Safari 6 **/ max-height: -moz-calc(100% - 100px); /** FF 4-15 **/ max-height: calc(100% - 100px); /** FF 16+,...
16,834,669
I have a Python application which analyse text data, having purpose to find the topics of the text. What I need to to do is to make this application a web application. I set apache, mod\_wsgi and flask framework together and I correctly make a simple application which show that everything works. But when I try to ca...
2013/05/30
[ "https://Stackoverflow.com/questions/16834669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436111/" ]
This is either going to need `display: table;` or a new CSS3 feature - [`calc()`.](https://developer.mozilla.org/en-US/docs/Web/CSS/calc) What do you need to support? If it is only new browsers, you could try this: ``` .bottom { height: calc(100% - 100px); } ``` [DEMO](http://jsfiddle.net/dmKbn/3/)
the scroll bars will automatically added if content exceeds the window size. To add content height to window height try to use the javascript to get window size and set it within onload method of page instead of setting it inside css.
16,834,669
I have a Python application which analyse text data, having purpose to find the topics of the text. What I need to to do is to make this application a web application. I set apache, mod\_wsgi and flask framework together and I correctly make a simple application which show that everything works. But when I try to ca...
2013/05/30
[ "https://Stackoverflow.com/questions/16834669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436111/" ]
This is either going to need `display: table;` or a new CSS3 feature - [`calc()`.](https://developer.mozilla.org/en-US/docs/Web/CSS/calc) What do you need to support? If it is only new browsers, you could try this: ``` .bottom { height: calc(100% - 100px); } ``` [DEMO](http://jsfiddle.net/dmKbn/3/)
To fulfill your requirement, we need to use jQuery. like this. ``` $(document).ready(function(){ var height = $(window).height() - $(".top").height(); $('.bottom').css('height', height+'px'); }); ``` [jsFiddle File](http://jsfiddle.net/dmKbn/6/)
16,834,669
I have a Python application which analyse text data, having purpose to find the topics of the text. What I need to to do is to make this application a web application. I set apache, mod\_wsgi and flask framework together and I correctly make a simple application which show that everything works. But when I try to ca...
2013/05/30
[ "https://Stackoverflow.com/questions/16834669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436111/" ]
Use calc() - <http://html5please.com/#calc> with 100px being your top bar ``` height: 100%; /** older browsers **/ max-height: 100%; /** older browsers **/ max-height: -webkit-calc(100% - 100x); /** Chrome / Safari 6 **/ max-height: -moz-calc(100% - 100px); /** FF 4-15 **/ max-height: calc(100% - 100px); /** FF 16+,...
the scroll bars will automatically added if content exceeds the window size. To add content height to window height try to use the javascript to get window size and set it within onload method of page instead of setting it inside css.
16,834,669
I have a Python application which analyse text data, having purpose to find the topics of the text. What I need to to do is to make this application a web application. I set apache, mod\_wsgi and flask framework together and I correctly make a simple application which show that everything works. But when I try to ca...
2013/05/30
[ "https://Stackoverflow.com/questions/16834669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436111/" ]
Use calc() - <http://html5please.com/#calc> with 100px being your top bar ``` height: 100%; /** older browsers **/ max-height: 100%; /** older browsers **/ max-height: -webkit-calc(100% - 100x); /** Chrome / Safari 6 **/ max-height: -moz-calc(100% - 100px); /** FF 4-15 **/ max-height: calc(100% - 100px); /** FF 16+,...
To fulfill your requirement, we need to use jQuery. like this. ``` $(document).ready(function(){ var height = $(window).height() - $(".top").height(); $('.bottom').css('height', height+'px'); }); ``` [jsFiddle File](http://jsfiddle.net/dmKbn/6/)
3,874,868
I have gone through one of the books of algorithm and have found a problem named Hiring Problem. Here is the situation: I have to conduct an interview for hiring candidates for my company. I am not personally able to conduct the interview, as I have failed to do so. So I have hired an employment agency to help with hi...
2010/10/06
[ "https://Stackoverflow.com/questions/3874868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/333596/" ]
I think that this is an example of the [Secretary Problem](http://en.wikipedia.org/wiki/Secretary_problem).
Your problem is indeed (a variant of) the hiring problem, which itself is a multi-objective version of the [secretary problem](http://en.wikipedia.org/wiki/Secretary_problem). In the latter, one has a bunch of n candidates arriving in some arbitrary order of quality, and has to take an instant decision (accept the ca...
51,151,739
I want to make a game that includes the component of 'lives'. I would like to start the game with 3 lives. Each time the user dies, the lives remaining decreases by 1 and the game restarts with the new number of lives remaining. PROBLEM: If I play the game and lose a life, it always says "2 lives remaining" even if I ...
2018/07/03
[ "https://Stackoverflow.com/questions/51151739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9982176/" ]
Another option is to define a type with custom JSON marshal and unmarshal functions. ``` type Person string func (p *Person) UnmarshalJSON(b []byte) error { if strings.HasPrefix(string(*p),"{"){ value := map[string]string{} json.Unmarshal(b,&value) *p = Person(value["name"]) }else{ ...
In this case you have to use `interface{}`. But with purpose to reduce complexity of your struct you can have one additional field like `NameValue` and fill this value after `json.Unmarshal` and assign value or from `person` either from `person.name`. In your code you can loosely use `NameValue` which will always con...
2,433,393
Is there a way to force an RCP product to show a welcome page every time it the RCP was stared? (By default, the Welcome page is only shown for the first time the RCP is stared.) I tried `org.eclipse.ui/SHOW_INTRO=true` in plugin\_customization.ini, but it did not do the trick... Thanks, Frank
2010/03/12
[ "https://Stackoverflow.com/questions/2433393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903/" ]
In your intro xml you can have something like ``` <contentProvider id="awc" class="org.eclipse.ui.intro.contentproviders.AlwaysWelcomeCheckbox" pluginId="org.eclipse.ui.intro"> <text></text> </contentProvider> ``` that allows the user to chose whether the intro page is shown every time. It displays a small chec...
Remove the `-showsplash`
2,433,393
Is there a way to force an RCP product to show a welcome page every time it the RCP was stared? (By default, the Welcome page is only shown for the first time the RCP is stared.) I tried `org.eclipse.ui/SHOW_INTRO=true` in plugin\_customization.ini, but it did not do the trick... Thanks, Frank
2010/03/12
[ "https://Stackoverflow.com/questions/2433393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903/" ]
Alternatively you can set this programmatically, e.g. in your WorkbenchAdvisor's initialize Method. ``` PrefUtil.getAPIPreferenceStore().setValue( IWorkbenchPreferenceConstants.SHOW_INTRO, true); PrefUtil.saveAPIPrefs(); ``` But since PrefUtil is an internal class this is only recommended if you can't ...
Remove the `-showsplash`
2,433,393
Is there a way to force an RCP product to show a welcome page every time it the RCP was stared? (By default, the Welcome page is only shown for the first time the RCP is stared.) I tried `org.eclipse.ui/SHOW_INTRO=true` in plugin\_customization.ini, but it did not do the trick... Thanks, Frank
2010/03/12
[ "https://Stackoverflow.com/questions/2433393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903/" ]
In your intro xml you can have something like ``` <contentProvider id="awc" class="org.eclipse.ui.intro.contentproviders.AlwaysWelcomeCheckbox" pluginId="org.eclipse.ui.intro"> <text></text> </contentProvider> ``` that allows the user to chose whether the intro page is shown every time. It displays a small chec...
"intro" element has an attribute "contentDetector". > > **contentDetector** - a fully qualified name of a class extending > org.eclipse.ui.intro.IntroContentDetector. This optional class is used > to detect newly added introduction content. If new content is > available, the view showing the introduction will be o...
2,433,393
Is there a way to force an RCP product to show a welcome page every time it the RCP was stared? (By default, the Welcome page is only shown for the first time the RCP is stared.) I tried `org.eclipse.ui/SHOW_INTRO=true` in plugin\_customization.ini, but it did not do the trick... Thanks, Frank
2010/03/12
[ "https://Stackoverflow.com/questions/2433393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903/" ]
Alternatively you can set this programmatically, e.g. in your WorkbenchAdvisor's initialize Method. ``` PrefUtil.getAPIPreferenceStore().setValue( IWorkbenchPreferenceConstants.SHOW_INTRO, true); PrefUtil.saveAPIPrefs(); ``` But since PrefUtil is an internal class this is only recommended if you can't ...
"intro" element has an attribute "contentDetector". > > **contentDetector** - a fully qualified name of a class extending > org.eclipse.ui.intro.IntroContentDetector. This optional class is used > to detect newly added introduction content. If new content is > available, the view showing the introduction will be o...
69,707,927
We are using Boostrap 4.6.0 in Angular 12 project and we run the following command to upgrade bootstrap to 5.1.3 ``` npm install bootstrap@latest ``` We got an error for the follwing files and these file are not exist ``` @import "~bootstrap/scss/input-group"; @import "~bootstrap/scss/custom-forms"; @import "~bo...
2021/10/25
[ "https://Stackoverflow.com/questions/69707927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10155669/" ]
When I did bootstrap upgrade - I used [Bootstrap Migration Doc](https://getbootstrap.com/docs/5.1/migration/) and applied all related changes to my projects.
It's not so clear from the document what to do with the files but I found the following: ``` //change from @import "~bootstrap/scss/input-group"; //to @import "~bootstrap/scss/forms/input-group"; ``` Dropped the .media component <https://getbootstrap.com/docs/5.1/migration/#grid-updates> Removed print styles and...
3,295,040
I've set up NodeJS and it's returning data when I browse to the URL: <http://184.106.206.235> However, when I try to call that URL using `$.getJSON`, the callback shows `null` for the `data` variable and `"success"` for the `textStatus` variable. I imagine this could be a cross-domain thing, but I'm surprised that th...
2010/07/20
[ "https://Stackoverflow.com/questions/3295040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28118/" ]
Add the "Access-Control-Allow-Origin": "\*" property to your writeHead() call: ``` res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin": "*" }); ```
Just a note for anyone having the same problem, the solution above worked for me with one minor alteration: "Content-Type": "application/json" Not "text/json". Thanks for the solution! It was driving me crazy.
3,295,040
I've set up NodeJS and it's returning data when I browse to the URL: <http://184.106.206.235> However, when I try to call that URL using `$.getJSON`, the callback shows `null` for the `data` variable and `"success"` for the `textStatus` variable. I imagine this could be a cross-domain thing, but I'm surprised that th...
2010/07/20
[ "https://Stackoverflow.com/questions/3295040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28118/" ]
Add the "Access-Control-Allow-Origin": "\*" property to your writeHead() call: ``` res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin": "*" }); ```
if you are using [express](http://expressjs.com/guide.html#res.json%28%29) framework you can try one of the following: 1. `res.contentType('json');` to set to content type. 2. `res.send({ some: 'json' });` that will set the content type and parse it for you. 3. `res.json({ user: 'tj' });` probably the best way...
206,161
How would I get the length of an `ArrayList` using a JSF EL expression? ``` #{MyBean.somelist.length} ``` does not work.
2008/10/15
[ "https://Stackoverflow.com/questions/206161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
After 7 years... the facelets solution still works fine for me as a jsf user include the namespace as `xmlns:fn="http://java.sun.com/jsp/jstl/functions"` and use the EL as `#{fn:length(myBean.someList)}` for example if using in jsf ui:fragment below example works fine ``` <ui:fragment rendered="#{fn:length(myBean....
You can eventually extend the EL language by using the [EL Functor](http://el-functors.sourceforge.net), which will allow you to call any Java beans methods, even with parameters...
206,161
How would I get the length of an `ArrayList` using a JSF EL expression? ``` #{MyBean.somelist.length} ``` does not work.
2008/10/15
[ "https://Stackoverflow.com/questions/206161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
Yes, since some genius in the Java API creation committee decided that, even though certain classes have `size()` members or `length` attributes, they won't implement `getSize()` or `getLength()` which JSF and most other standards require, you can't do what you want. There's a couple ways to do this. One: add a funct...
**Note:** This solution is better for older versions of JSTL. For versions greater then 1.1 I recommend using `fn:length(MyBean.somelist)` as suggested by [Bill James](https://stackoverflow.com/questions/206161/how-do-you-get-the-length-of-a-list-in-the-jsf-expression-language/206252#206252). --- [This article](http:...
206,161
How would I get the length of an `ArrayList` using a JSF EL expression? ``` #{MyBean.somelist.length} ``` does not work.
2008/10/15
[ "https://Stackoverflow.com/questions/206161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
Yes, since some genius in the Java API creation committee decided that, even though certain classes have `size()` members or `length` attributes, they won't implement `getSize()` or `getLength()` which JSF and most other standards require, you can't do what you want. There's a couple ways to do this. One: add a funct...
``` <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> <h:outputText value="Table Size = #{fn:length(SystemBean.list)}"/> ``` On screen it displays the Table size Example: `Table Size = 5`
206,161
How would I get the length of an `ArrayList` using a JSF EL expression? ``` #{MyBean.somelist.length} ``` does not work.
2008/10/15
[ "https://Stackoverflow.com/questions/206161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
``` <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> <h:outputText value="Table Size = #{fn:length(SystemBean.list)}"/> ``` On screen it displays the Table size Example: `Table Size = 5`
After 7 years... the facelets solution still works fine for me as a jsf user include the namespace as `xmlns:fn="http://java.sun.com/jsp/jstl/functions"` and use the EL as `#{fn:length(myBean.someList)}` for example if using in jsf ui:fragment below example works fine ``` <ui:fragment rendered="#{fn:length(myBean....
206,161
How would I get the length of an `ArrayList` using a JSF EL expression? ``` #{MyBean.somelist.length} ``` does not work.
2008/10/15
[ "https://Stackoverflow.com/questions/206161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
You mean size() don't you? ``` #{MyBean.somelist.size()} ``` works for me (using JBoss Seam which has the Jboss EL extensions)
After 7 years... the facelets solution still works fine for me as a jsf user include the namespace as `xmlns:fn="http://java.sun.com/jsp/jstl/functions"` and use the EL as `#{fn:length(myBean.someList)}` for example if using in jsf ui:fragment below example works fine ``` <ui:fragment rendered="#{fn:length(myBean....
206,161
How would I get the length of an `ArrayList` using a JSF EL expression? ``` #{MyBean.somelist.length} ``` does not work.
2008/10/15
[ "https://Stackoverflow.com/questions/206161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
**Note:** This solution is better for older versions of JSTL. For versions greater then 1.1 I recommend using `fn:length(MyBean.somelist)` as suggested by [Bill James](https://stackoverflow.com/questions/206161/how-do-you-get-the-length-of-a-list-in-the-jsf-expression-language/206252#206252). --- [This article](http:...
``` <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> <h:outputText value="Table Size = #{fn:length(SystemBean.list)}"/> ``` On screen it displays the Table size Example: `Table Size = 5`
206,161
How would I get the length of an `ArrayList` using a JSF EL expression? ``` #{MyBean.somelist.length} ``` does not work.
2008/10/15
[ "https://Stackoverflow.com/questions/206161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
**Note:** This solution is better for older versions of JSTL. For versions greater then 1.1 I recommend using `fn:length(MyBean.somelist)` as suggested by [Bill James](https://stackoverflow.com/questions/206161/how-do-you-get-the-length-of-a-list-in-the-jsf-expression-language/206252#206252). --- [This article](http:...
You can eventually extend the EL language by using the [EL Functor](http://el-functors.sourceforge.net), which will allow you to call any Java beans methods, even with parameters...
206,161
How would I get the length of an `ArrayList` using a JSF EL expression? ``` #{MyBean.somelist.length} ``` does not work.
2008/10/15
[ "https://Stackoverflow.com/questions/206161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
After 7 years... the facelets solution still works fine for me as a jsf user include the namespace as `xmlns:fn="http://java.sun.com/jsp/jstl/functions"` and use the EL as `#{fn:length(myBean.someList)}` for example if using in jsf ui:fragment below example works fine ``` <ui:fragment rendered="#{fn:length(myBean....
You can get the length using the following EL: **#{Bean.list.size()}**
206,161
How would I get the length of an `ArrayList` using a JSF EL expression? ``` #{MyBean.somelist.length} ``` does not work.
2008/10/15
[ "https://Stackoverflow.com/questions/206161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
Yes, since some genius in the Java API creation committee decided that, even though certain classes have `size()` members or `length` attributes, they won't implement `getSize()` or `getLength()` which JSF and most other standards require, you can't do what you want. There's a couple ways to do this. One: add a funct...
After 7 years... the facelets solution still works fine for me as a jsf user include the namespace as `xmlns:fn="http://java.sun.com/jsp/jstl/functions"` and use the EL as `#{fn:length(myBean.someList)}` for example if using in jsf ui:fragment below example works fine ``` <ui:fragment rendered="#{fn:length(myBean....
206,161
How would I get the length of an `ArrayList` using a JSF EL expression? ``` #{MyBean.somelist.length} ``` does not work.
2008/10/15
[ "https://Stackoverflow.com/questions/206161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17614/" ]
You can eventually extend the EL language by using the [EL Functor](http://el-functors.sourceforge.net), which will allow you to call any Java beans methods, even with parameters...
You can get the length using the following EL: **#{Bean.list.size()}**
18,550,670
I have my database (called "Starship") and I generate LinqToSql Entity Classes and Data Context with designer. As an output, i got `Starship.dbml` file with 2 sub-files: 1. `Starship.dbml.layout` 2. `Starship.designer.cs` The problem is that I found that the designer generated my Entity classes and Data Context withi...
2013/08/31
[ "https://Stackoverflow.com/questions/18550670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2114608/" ]
Here's a demo of how to use the `mtwist` implementation of Mersenne Twister: ``` #include <stdio.h> #include <stdlib.h> #include "mtwist.h" int main(void) { int i; mt_seed(); for(i = 0; i < 10; ++i) { printf("%f\n", mt_ldrand()); } return EXIT_SUCCESS; } ``` Compiled and run as follows: ``` [p...
That's not a compiler error, it's a linker error. You're missing the appropriate `-l` flag to link the library you're using. Your compiler invocation should look something like: ``` cc -o example example.c -lmtwist ``` I just took a quick look at the mtwist page you linked to, and it appears to be distributed just a...
447,716
I have the following set of equations: $$M\_{1}=\frac{y\_1-y\_0}{x\_1-x\_0}$$ $$M\_{2}=\frac{y\_2-y\_0}{x\_2-x\_0}$$ $M\_1, M\_2, x\_1, y\_1, x\_2, y\_2,$ are known and they are chosen from a $GF(2^m).$ I want to find $x\_0,y\_0$ I ll restate my question. Someone chose three distinct x0,x1,x2, as well as y0,y1,y2, ...
2013/07/19
[ "https://math.stackexchange.com/questions/447716", "https://math.stackexchange.com", "https://math.stackexchange.com/users/83416/" ]
The first system can be solved in the usual way, provided the "slopes" $M\_i$ are distinct. Solve each for the knowns $y\_k$, $k=1,2$ and subtract. You can then get to $$x\_0=\frac{M\_2x\_2-M\_1x\_1-y\_2+y\_1}{M\_2-M\_1},$$ and then use one of the equations you already formed with this $x\_0$ plugged in to get $y\_0.$ ...
I think tha the second system can be solved lik the first one. More specifically, The second system can be solved too. If it is setted $\frac{y\_1-y\_0}{x\_1-x\_0}=a\_1$ and $a\_0=y\_0$ the system of equations can be rewritten as $$M\_1=\frac{k\_1-(a\_0+a\_1(l\_1-x\_0))} {(l\_1-x\_0)(l\_1-x\_1)}$$ $$M\_2=\frac{k\_2-(a\...
35,887,920
I run a pig script in local mode and I can register directory that contains jars and all works fine: ``` register '/home/q/2/' ``` Wwile running exactly same script in mapreduce mode Im getting error as below: ``` at org.apache.pig.PigServer.storeEx(PigServer.java:1034) ... 15 more Caused by: java.i...
2016/03/09
[ "https://Stackoverflow.com/questions/35887920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2818726/" ]
Try running the below command twice in either local or mapreduce mode: *REGISTER '/home/q/2/'* ------- // Registering all jars in a directory. On doing twice in same session, you will face this error the second time you register the folder: **ERROR 2999: Unexpected internal error** This is because the pig compiler ...
You should can do one of the flowing: * Upload your jar to hdfs and register it from there * If you control the cluster then you can add it to the standard share lib
6,895,105
I want to convert a multi-dimensional PHP array to JavaScript and found this script in a post here; ``` <script type='text/javascript'> <?php $js_array = json_encode($php_array); echo "var javascript_array = ". $js_array . ";\n"; ?> </script> ``` But the JS array remains empty. Is it because I have a multi-dimension...
2011/08/01
[ "https://Stackoverflow.com/questions/6895105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/866367/" ]
Based on the comment you gave to one of the answers, are you sure `$js_array` is empty or are you just not decoding it? If you look at the generated JavaScript, do you see `var javascript_array = ;` or something else? Alternatively you could add `alert( javascript_array );` to check. EDIT: Since the variable is ok, yo...
If `$php_array` isn't empty, try to... ``` var javascript_array = <?php echo $js_array; ?>; ``` ...instead of: ``` echo "var javascript_array = ". $js_array . ";\n"; ``` Hope it helps! :)
6,895,105
I want to convert a multi-dimensional PHP array to JavaScript and found this script in a post here; ``` <script type='text/javascript'> <?php $js_array = json_encode($php_array); echo "var javascript_array = ". $js_array . ";\n"; ?> </script> ``` But the JS array remains empty. Is it because I have a multi-dimension...
2011/08/01
[ "https://Stackoverflow.com/questions/6895105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/866367/" ]
You can also try something more manual like this: ``` <?php // $phpArray= ... ?> <script type="text/javascript"> var jsArray = {}; <?php foreach($phpArray as $key => $val){ ?> jsArray.<?php echo $key; ?> = "<?php echo $val; ?>"; <?php } ?> console.log(jsArray); </script> ```
If `$php_array` isn't empty, try to... ``` var javascript_array = <?php echo $js_array; ?>; ``` ...instead of: ``` echo "var javascript_array = ". $js_array . ";\n"; ``` Hope it helps! :)
6,895,105
I want to convert a multi-dimensional PHP array to JavaScript and found this script in a post here; ``` <script type='text/javascript'> <?php $js_array = json_encode($php_array); echo "var javascript_array = ". $js_array . ";\n"; ?> </script> ``` But the JS array remains empty. Is it because I have a multi-dimension...
2011/08/01
[ "https://Stackoverflow.com/questions/6895105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/866367/" ]
Based on the comment you gave to one of the answers, are you sure `$js_array` is empty or are you just not decoding it? If you look at the generated JavaScript, do you see `var javascript_array = ;` or something else? Alternatively you could add `alert( javascript_array );` to check. EDIT: Since the variable is ok, yo...
You probably have to eval that json in order for it to be more than just a string in your JavaScript code.
6,895,105
I want to convert a multi-dimensional PHP array to JavaScript and found this script in a post here; ``` <script type='text/javascript'> <?php $js_array = json_encode($php_array); echo "var javascript_array = ". $js_array . ";\n"; ?> </script> ``` But the JS array remains empty. Is it because I have a multi-dimension...
2011/08/01
[ "https://Stackoverflow.com/questions/6895105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/866367/" ]
You can also try something more manual like this: ``` <?php // $phpArray= ... ?> <script type="text/javascript"> var jsArray = {}; <?php foreach($phpArray as $key => $val){ ?> jsArray.<?php echo $key; ?> = "<?php echo $val; ?>"; <?php } ?> console.log(jsArray); </script> ```
You probably have to eval that json in order for it to be more than just a string in your JavaScript code.
6,895,105
I want to convert a multi-dimensional PHP array to JavaScript and found this script in a post here; ``` <script type='text/javascript'> <?php $js_array = json_encode($php_array); echo "var javascript_array = ". $js_array . ";\n"; ?> </script> ``` But the JS array remains empty. Is it because I have a multi-dimension...
2011/08/01
[ "https://Stackoverflow.com/questions/6895105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/866367/" ]
Based on the comment you gave to one of the answers, are you sure `$js_array` is empty or are you just not decoding it? If you look at the generated JavaScript, do you see `var javascript_array = ;` or something else? Alternatively you could add `alert( javascript_array );` to check. EDIT: Since the variable is ok, yo...
You can also try something more manual like this: ``` <?php // $phpArray= ... ?> <script type="text/javascript"> var jsArray = {}; <?php foreach($phpArray as $key => $val){ ?> jsArray.<?php echo $key; ?> = "<?php echo $val; ?>"; <?php } ?> console.log(jsArray); </script> ```
265,786
I noticed that clickable box showing up on Meta-SO "X new questions with activity". On click, it displays the concerned questions. But, if I'm not wrong, I never saw this on SO before. I guess it's because there is a lot more activity on SO, and "67 new questions with activity" wouldn't be that good. Yet, is there an...
2014/07/16
[ "https://meta.stackoverflow.com/questions/265786", "https://meta.stackoverflow.com", "https://meta.stackoverflow.com/users/2627459/" ]
Live refresh has been around for a long time, but is explicitly disabled on the Stack Overflow front pages (including *interesting*) as the number of new posts per minute would be far too great. As such, you'll *only* see this on tag pages (including combined tag searches). See [New Feature: real time updates to ques...
You can see the live refresh on individual tag pages on Stack Overflow: ![enter image description here](https://i.stack.imgur.com/DdLBW.png)
34,874,248
Given database of the website "eMovies" that manage data about cinema movies. > > Write in SQL query that finds the names of movies that were filmed in 2002, 2003 or 2005, whose family name is "Ford" who played in those movies. > > > [![enter image description here](https://i.stack.imgur.com/R8V1I.png)](https://...
2016/01/19
[ "https://Stackoverflow.com/questions/34874248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Join your tables. ``` SELECT m.MovieName FROM Movies m INNER JOIN ActorsMovies am ON m.movieID = am.movieID INNER JOIN Actors a ON am.ActorID = a.ActorID WHERE m.Year IN ('2002', '2003', '2005') AND a.LastName = 'Ford'; ``` If your looking for a more broad search on actor name use.. ``` SELECT m.MovieName FROM Movi...
``` SELECT Movies.MovieName FROM Movies,Actors,ActorsMovies WHERE Movies.MovieID = Actors.MovieID AND Actors.ActorID = ActorsMovies.ActorID AND Movies.Year in (2002,2003,2005) AND Actors.LastName = "Ford"; ``` You didn't put any join's conditions so you got all the results. In addition, use IN instead of ...
12,323,554
This problem occurred all of a sudden in my Eclipse(which happens to be fully updated) but it seems that my **Graphical Layout** editor is gone for ever. I do not know what happened but graphical layout shows nothing even if there is code in XML. Even layout files of my previous projects stopped coming in the graphica...
2012/09/07
[ "https://Stackoverflow.com/questions/12323554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1393623/" ]
i'd use data-attributes: Use an html attribute to each input: `<input data-value="Value Text">` and then in your css: `.ipad:before { content: attr(data-value); }` <http://jsfiddle.net/4fu3q/3/>
You can kind of fake it, though it's far from ideal. If you use a `label` you can overlay the text over the radiobutton without losing its clickability. Something like the following is one example: <http://jsfiddle.net/4fu3q/2/> ``` <div class="button-holder"> <input type="radio" class="ipad big-radio" name="rad...
16,948,216
I have a datagridview in c# and I am filling it with whatever table from my database I want, getting the table name from a textbox. everything is fine until I try to commit the changes I do in the datagridview to the database. button2 is the button I will be using for update. I've searched all over and apparently upda...
2013/06/05
[ "https://Stackoverflow.com/questions/16948216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2193130/" ]
Your `adap` in the button2\_Click event handler doesn't have any Command (SelectCommand, DeleteCommand, InsertCommand and UpdateCommand) initialized. So how it can update? You obviously don't understand how a DataAdapter works. The DataAdapter has 4 Command which are SelectCommand, DeleteCommand, InsertCommand, Update...
``` private void button3_Click(object sender, EventArgs e) { scb = new SqlCommandBuilder(sqlDataAdapter1); sqlDataAdapter1.Update(dataSetUser); } ``` im able to edit my database from gridview by this code
24,000
Wikipedia [says](https://en.wikipedia.org/wiki/Kilobyte) kB = 1000 bytes and KB = 1024 bytes. Which one are we using for Bitcoin?
2014/03/26
[ "https://bitcoin.stackexchange.com/questions/24000", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/5068/" ]
According to the [Bitcoin.it-wiki page on Transaction fees](https://en.bitcoin.it/wiki/Transaction_fees#Sending) are dependent on multiples of **1,000 bytes** (rounded up). The above page cites Gavin Andresen's [post on 0.8.2 Release notes](https://bitcointalk.org/index.php?topic=219504.msg2311420#msg2311420): > > T...
Here is the latest changed(commit) made for the fee drop: <https://github.com/bitcoin/bitcoin/commit/beabca2be092d0e2a1de26989d4e63a12cce1284#diff-279f95e952b2c1cff13bdfbcd7bc36ee> It seems to be a multiple of 1,000 bytes as it's seen in the source code. So yes, it's a multiple of **1000 bytes**, not **1024 bytes**. ...
11,351
is there a way to execute the batch(\*.bat) file from a sharepoint designer workflow? I've a specific column in the sharepoint list, a batch file should be executed whenever the value of the field is changed. I just want to design a sharepoint designer workflow to be triggered whenever the value of the site column is...
2011/04/15
[ "https://sharepoint.stackexchange.com/questions/11351", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/1232/" ]
I would suggest that you create a custom workflow activity to do the stuff instead of a batch file. Since your only gathering info from a list and producing a file this should be quite easy.
My recommendation is to create a powershell script that runs as a scheduled task. This powershell script will look for a change in a list value item (custom column). When the column changes then the powershell script performs your action. I hope that gets you going in the right direction, Dan
11,351
is there a way to execute the batch(\*.bat) file from a sharepoint designer workflow? I've a specific column in the sharepoint list, a batch file should be executed whenever the value of the field is changed. I just want to design a sharepoint designer workflow to be triggered whenever the value of the site column is...
2011/04/15
[ "https://sharepoint.stackexchange.com/questions/11351", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/1232/" ]
I would suggest that you create a custom workflow activity to do the stuff instead of a batch file. Since your only gathering info from a list and producing a file this should be quite easy.
I would NOT recommend allowing the executing of .bat or powershell scripts from a workflow activity. In some respects, this is a very huge security hole - someone could very easily inject their own code into your batch/script file to execute after yours, and depending on the context of the script, could wreak havok on...
11,351
is there a way to execute the batch(\*.bat) file from a sharepoint designer workflow? I've a specific column in the sharepoint list, a batch file should be executed whenever the value of the field is changed. I just want to design a sharepoint designer workflow to be triggered whenever the value of the site column is...
2011/04/15
[ "https://sharepoint.stackexchange.com/questions/11351", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/1232/" ]
I would NOT recommend allowing the executing of .bat or powershell scripts from a workflow activity. In some respects, this is a very huge security hole - someone could very easily inject their own code into your batch/script file to execute after yours, and depending on the context of the script, could wreak havok on...
My recommendation is to create a powershell script that runs as a scheduled task. This powershell script will look for a change in a list value item (custom column). When the column changes then the powershell script performs your action. I hope that gets you going in the right direction, Dan
37,742,085
I would like to store some multidimensional data in a pandas dataframe or panel such that I would like to be able to return for example: 1. All the times for Runner A, Race A 2. All the times(and names) for Race A for a certain year say 2015 Example data would look something like this, note that not all runners will...
2016/06/10
[ "https://Stackoverflow.com/questions/37742085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1785871/" ]
I think you can use `Multiindex` and then select data by [slicers](http://pandas.pydata.org/pandas-docs/stable/advanced.html#using-slicers): ``` import pandas as pd df = pd.DataFrame({'Time': {('Runner A', 'Male', 35, 'Race A', 2014): '2:47:34', ('Runner C', 'Female', 32, 'Race B', 1998): '1:29:43', ('Runner B', 'Mal...
Simple approach: ``` runners = pd.DataFrame( [ ['Bob', 'Male', 1980], ['Tom', 'Male', 1986], ['Amy', 'Female', 1966], ], columns=['Name', 'Gender', 'BirthYear'] ) races = pd.DataFrame( [ ['A', 2015, 'Bob', '2:35:09'], ['A', 2014, 'Bob', '2:47:34'], [...
51,220,314
I have a table calculated using a df which looks like the following. ``` Month_considered pct `ATC Count` <fct> <dbl> <fct> 1 Apr-17 54.9 198,337 2 May-17 56.4 227,681 3 Jun-17 58.0 251,664 4 Jul-17 57.7 251,934 5 Aug-17 ...
2018/07/07
[ "https://Stackoverflow.com/questions/51220314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1220188/" ]
> > npm view react-native version > > > You can check the latest version of react native. You can run it under the root of your project or everywhere. Of course, you will need internet connection to check latest version. > > react-native -v > > > If you run under the root of project, it will return the versi...
Just wanted to clarify Aung's answer: `npm view react-native version` checks globally while `react-native -v` ran inside project's root folder checks version of the app itself.
51,220,314
I have a table calculated using a df which looks like the following. ``` Month_considered pct `ATC Count` <fct> <dbl> <fct> 1 Apr-17 54.9 198,337 2 May-17 56.4 227,681 3 Jun-17 58.0 251,664 4 Jul-17 57.7 251,934 5 Aug-17 ...
2018/07/07
[ "https://Stackoverflow.com/questions/51220314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1220188/" ]
> > npm view react-native version > > > You can check the latest version of react native. You can run it under the root of your project or everywhere. Of course, you will need internet connection to check latest version. > > react-native -v > > > If you run under the root of project, it will return the versi...
Macbook M1 Chip > > npm view react-native version > > >
51,220,314
I have a table calculated using a df which looks like the following. ``` Month_considered pct `ATC Count` <fct> <dbl> <fct> 1 Apr-17 54.9 198,337 2 May-17 56.4 227,681 3 Jun-17 58.0 251,664 4 Jul-17 57.7 251,934 5 Aug-17 ...
2018/07/07
[ "https://Stackoverflow.com/questions/51220314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1220188/" ]
Just wanted to clarify Aung's answer: `npm view react-native version` checks globally while `react-native -v` ran inside project's root folder checks version of the app itself.
Macbook M1 Chip > > npm view react-native version > > >
34,114,420
I'm trying to run my Mahout\_Recommender.java file within my jsp file. This is my .jsp file: ``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <h...
2015/12/06
[ "https://Stackoverflow.com/questions/34114420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5645686/" ]
You can call a main method from another point. You only need to call Movie\_Recommender.main(null); in your servlet (null because you don't use args). then in your jsp: ``` <% Movie_Recommender.main(null); %> ```
I'm not sure why you really want to execute the main method of that clas directly inside the JSP. but I think you simply can achieve it by **System** class like below: ``` int result = System.exec("/path/to/ClassName.java"); ``` just an example how to execute the class and use your correct data type for the result v...
34,114,420
I'm trying to run my Mahout\_Recommender.java file within my jsp file. This is my .jsp file: ``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <h...
2015/12/06
[ "https://Stackoverflow.com/questions/34114420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5645686/" ]
You can directly call it from .jsp likewise, ``` Movie_Recommender.main(new String[]{}); OR Movie_Recommender.main(null); ``` > > Well honestly speaking, It's totally Bad idea to create main(...), > What are you trying to achieve? Even if you do that, by calling main() > as any other arbitrary method, or by...
I'm not sure why you really want to execute the main method of that clas directly inside the JSP. but I think you simply can achieve it by **System** class like below: ``` int result = System.exec("/path/to/ClassName.java"); ``` just an example how to execute the class and use your correct data type for the result v...
7,025,909
I have an array: ``` $a = array('foo' => 'fooMe'); ``` and I do: ``` print_r($a); ``` which prints: ``` Array ( [foo] => printme ) ``` Is there a function, so when doing: ``` needed_function(' Array ( [foo] => printme )'); ``` I will get the array `array('foo' => 'fooMe');` back?
2011/08/11
[ "https://Stackoverflow.com/questions/7025909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867493/" ]
If you want to store an array as string, use [`serialize` *[docs]*](http://php.net/manual/en/function.serialize.php) and [`unserialize` *[docs]*](http://php.net/manual/en/function.unserialize.php). To answer your question: No, there is no built-in function to parse the output of `print_r` into an array again.
No. But you can use both `serialize` and `json_*` functions. ``` $a = array('foo' => 'fooMe'); echo serialize($a); $a = unserialize($input); ``` Or: ``` echo json_encode($a); $a = json_decode($input, true); ```
7,025,909
I have an array: ``` $a = array('foo' => 'fooMe'); ``` and I do: ``` print_r($a); ``` which prints: ``` Array ( [foo] => printme ) ``` Is there a function, so when doing: ``` needed_function(' Array ( [foo] => printme )'); ``` I will get the array `array('foo' => 'fooMe');` back?
2011/08/11
[ "https://Stackoverflow.com/questions/7025909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867493/" ]
Here is a `print_r` output parser, producing the same expression in PHP syntax. It is written as an interactive Stack Snippet, so you can use it here: ```js function parse(s) { const quote = s => '"' + s.replace(/["\\]/g, '\\$&') + '"'; const compress = indent => " ".repeat(((indent.length + 4) >> 3) * 4); ...
use ``` var_export(array('Sample array', array('Apple', 'Orange'))); ``` Output: ``` array ( 0 => 'Sample array', 1 => array ( 0 => 'Apple', 1 => 'Orange', ), ) ```
7,025,909
I have an array: ``` $a = array('foo' => 'fooMe'); ``` and I do: ``` print_r($a); ``` which prints: ``` Array ( [foo] => printme ) ``` Is there a function, so when doing: ``` needed_function(' Array ( [foo] => printme )'); ``` I will get the array `array('foo' => 'fooMe');` back?
2011/08/11
[ "https://Stackoverflow.com/questions/7025909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867493/" ]
If you want to store an array as string, use [`serialize` *[docs]*](http://php.net/manual/en/function.serialize.php) and [`unserialize` *[docs]*](http://php.net/manual/en/function.unserialize.php). To answer your question: No, there is no built-in function to parse the output of `print_r` into an array again.
This is how I interpreted the question: ``` function parsePrintedArray($s){ $lines = explode("\n",$s); $a = array(); foreach ($lines as $line){ if (strpos($line,"=>") === false) continue; $parts = explode('=>',$line); $a[trim($parts[0],'[] ')] = trim($parts[1]); } ...
7,025,909
I have an array: ``` $a = array('foo' => 'fooMe'); ``` and I do: ``` print_r($a); ``` which prints: ``` Array ( [foo] => printme ) ``` Is there a function, so when doing: ``` needed_function(' Array ( [foo] => printme )'); ``` I will get the array `array('foo' => 'fooMe');` back?
2011/08/11
[ "https://Stackoverflow.com/questions/7025909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867493/" ]
I actually wrote a function that parses a "stringed array" into an actual array. Obviously, it's somewhat hacky and whatnot, but it works on my testcase. Here's a link to a functioning prototype at <http://codepad.org/idlXdij3>. I'll post the code inline too, for those people that don't feel like clicking on the link:...
use ``` var_export(array('Sample array', array('Apple', 'Orange'))); ``` Output: ``` array ( 0 => 'Sample array', 1 => array ( 0 => 'Apple', 1 => 'Orange', ), ) ```
7,025,909
I have an array: ``` $a = array('foo' => 'fooMe'); ``` and I do: ``` print_r($a); ``` which prints: ``` Array ( [foo] => printme ) ``` Is there a function, so when doing: ``` needed_function(' Array ( [foo] => printme )'); ``` I will get the array `array('foo' => 'fooMe');` back?
2011/08/11
[ "https://Stackoverflow.com/questions/7025909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867493/" ]
There is a nice Online-Tool which does exatly what its name is: [print\_r to json online converter](https://www.nestforms.com/php-print_r-to-json-online) From a JSON Object its not far to creating an array with the [json\_decode](http://php.net/json_decode) function: To get an array from this, set the second paramte...
Here is a `print_r` output parser, producing the same expression in PHP syntax. It is written as an interactive Stack Snippet, so you can use it here: ```js function parse(s) { const quote = s => '"' + s.replace(/["\\]/g, '\\$&') + '"'; const compress = indent => " ".repeat(((indent.length + 4) >> 3) * 4); ...
7,025,909
I have an array: ``` $a = array('foo' => 'fooMe'); ``` and I do: ``` print_r($a); ``` which prints: ``` Array ( [foo] => printme ) ``` Is there a function, so when doing: ``` needed_function(' Array ( [foo] => printme )'); ``` I will get the array `array('foo' => 'fooMe');` back?
2011/08/11
[ "https://Stackoverflow.com/questions/7025909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867493/" ]
you cannot do this with `print_r`, `var_export` should allow something similar, but not exactly what you asked for <http://php.net/manual/en/function.var-export.php> ``` $val = var_export($a, true); print_r($val); eval('$func_val='.$val.';'); ```
This is how I interpreted the question: ``` function parsePrintedArray($s){ $lines = explode("\n",$s); $a = array(); foreach ($lines as $line){ if (strpos($line,"=>") === false) continue; $parts = explode('=>',$line); $a[trim($parts[0],'[] ')] = trim($parts[1]); } ...
7,025,909
I have an array: ``` $a = array('foo' => 'fooMe'); ``` and I do: ``` print_r($a); ``` which prints: ``` Array ( [foo] => printme ) ``` Is there a function, so when doing: ``` needed_function(' Array ( [foo] => printme )'); ``` I will get the array `array('foo' => 'fooMe');` back?
2011/08/11
[ "https://Stackoverflow.com/questions/7025909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867493/" ]
There is a nice Online-Tool which does exatly what its name is: [print\_r to json online converter](https://www.nestforms.com/php-print_r-to-json-online) From a JSON Object its not far to creating an array with the [json\_decode](http://php.net/json_decode) function: To get an array from this, set the second paramte...
Quick function (without checks if you're sending good data): ``` function textToArray($str) { $output = []; foreach (explode("\n", $str) as $line) { if (trim($line) == "Array" or trim($line) == "(" or trim($line) == ")") { continue; } preg_match("/\[(.*)\]\ \=\>\ (.*)$/i"...
7,025,909
I have an array: ``` $a = array('foo' => 'fooMe'); ``` and I do: ``` print_r($a); ``` which prints: ``` Array ( [foo] => printme ) ``` Is there a function, so when doing: ``` needed_function(' Array ( [foo] => printme )'); ``` I will get the array `array('foo' => 'fooMe');` back?
2011/08/11
[ "https://Stackoverflow.com/questions/7025909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867493/" ]
I think my function is cool too, works with nested arrays: ``` function print_r_reverse($input) { $output = str_replace(['[', ']'], ["'", "'"], $input); $output = preg_replace('/=> (?!Array)(.*)$/m', "=> '$1',", $output); $output = preg_replace('/^\s+\)$/m', "),\n", $output); $output = rtrim($output, "...
`json_encode()` and `json_decode()` function will do it. ``` $asso_arr = Array([779] => 79 => [780] => 80 [782] => 82 [783] => 83); $to_string = json_encode($asso_arr); ``` It will be as a json format `{"779":"79","780":"80","782":"82","783":"83"}` Then we will convert it into `json_decode()` then it gives associat...
7,025,909
I have an array: ``` $a = array('foo' => 'fooMe'); ``` and I do: ``` print_r($a); ``` which prints: ``` Array ( [foo] => printme ) ``` Is there a function, so when doing: ``` needed_function(' Array ( [foo] => printme )'); ``` I will get the array `array('foo' => 'fooMe');` back?
2011/08/11
[ "https://Stackoverflow.com/questions/7025909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867493/" ]
If you want to store an array as string, use [`serialize` *[docs]*](http://php.net/manual/en/function.serialize.php) and [`unserialize` *[docs]*](http://php.net/manual/en/function.unserialize.php). To answer your question: No, there is no built-in function to parse the output of `print_r` into an array again.
`json_encode()` and `json_decode()` function will do it. ``` $asso_arr = Array([779] => 79 => [780] => 80 [782] => 82 [783] => 83); $to_string = json_encode($asso_arr); ``` It will be as a json format `{"779":"79","780":"80","782":"82","783":"83"}` Then we will convert it into `json_decode()` then it gives associat...
7,025,909
I have an array: ``` $a = array('foo' => 'fooMe'); ``` and I do: ``` print_r($a); ``` which prints: ``` Array ( [foo] => printme ) ``` Is there a function, so when doing: ``` needed_function(' Array ( [foo] => printme )'); ``` I will get the array `array('foo' => 'fooMe');` back?
2011/08/11
[ "https://Stackoverflow.com/questions/7025909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867493/" ]
I actually wrote a function that parses a "stringed array" into an actual array. Obviously, it's somewhat hacky and whatnot, but it works on my testcase. Here's a link to a functioning prototype at <http://codepad.org/idlXdij3>. I'll post the code inline too, for those people that don't feel like clicking on the link:...
Quick function (without checks if you're sending good data): ``` function textToArray($str) { $output = []; foreach (explode("\n", $str) as $line) { if (trim($line) == "Array" or trim($line) == "(" or trim($line) == ")") { continue; } preg_match("/\[(.*)\]\ \=\>\ (.*)$/i"...
60,526
I have been reading about **matched filters** and I'm interested in possible uses for them, I have seen they are used very often in radar, in such a way that you send out a signal, and then you read the incoming signals to look for the reflection of the pulse you sent out using matched filters. I think I'm right in...
2019/09/05
[ "https://dsp.stackexchange.com/questions/60526", "https://dsp.stackexchange.com", "https://dsp.stackexchange.com/users/40860/" ]
Your interpretation of the matched filter for radar seems almost right, just to be sure, let me reiterate a bit: Think of it this way: we're sending a pulse function $p(t)$. If a target in distance $d$ reflects the signal, we receive $\gamma \cdot p(t-\tau)$, where $\tau = 2d/c$ is the total travelled delay. The prob...
There are a lot of different kinds of radar that use matched filters including radars that employ multiple matched filters . The signal characteristic besides time delay that is often important is doppler shift. Estimating the character of the propagation path(s) can also be of interest. Attenuation(s) would fall i...
25,346,318
In my application I would like to preserve the option of using plain controllers for certain sections of code - as opposed to creating directives for one-off things that will never be re-used. In these cases I often want to publish some data from the controller to be used in the contained section. Now, I am aware that...
2014/08/17
[ "https://Stackoverflow.com/questions/25346318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74975/" ]
> > 2) I have been trying to figure out where ngModelControllers are stored so that I could look at the situation in the debugger but have not been able to find them. When using an ngModel directive should I see these in the scope or parent scope? (Where do they live?!?) > > > The answer depends slightly on where ...
When you declare directives on an element: ``` <div ng-controller="AppController" ng-model='fooModel'> {{fooModel}} </div> ``` You can retrieve the controller instance for any directive by calling jQlite/jQuery [$element.data(nameOfController)](http://api.jquery.com/data/), where nameOfController is the normalized...
32,935,232
I have an arbitrarily deep set of nested dictionary: ``` x = {'a': 1, 'b': {'c': 6, 'd': 7, 'g': {'h': 3, 'i': 9}}, 'e': {'f': 3}} ``` and I'd like to basically apply a function to all the integers in the dictionaries, so like `map`, I guess, but for nested dictionaries. So: `map_nested_dicts(x, lambda v: v + 7)` w...
2015/10/04
[ "https://Stackoverflow.com/questions/32935232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/968243/" ]
Visit all nested values recursively: ``` import collections def map_nested_dicts(ob, func): if isinstance(ob, collections.Mapping): return {k: map_nested_dicts(v, func) for k, v in ob.iteritems()} else: return func(ob) map_nested_dicts(x, lambda v: v + 7) # Creates a new dict object: # {'a...
Just to expand on vaultah's answer, if one of your elements can be a list, and you'd like to handle those too: ``` import collections def map_nested_dicts_modify(ob, func): for k, v in ob.iteritems(): if isinstance(v, collections.Mapping): map_nested_dicts_modify(v, func) elif isinstance(v, list): ...
32,935,232
I have an arbitrarily deep set of nested dictionary: ``` x = {'a': 1, 'b': {'c': 6, 'd': 7, 'g': {'h': 3, 'i': 9}}, 'e': {'f': 3}} ``` and I'd like to basically apply a function to all the integers in the dictionaries, so like `map`, I guess, but for nested dictionaries. So: `map_nested_dicts(x, lambda v: v + 7)` w...
2015/10/04
[ "https://Stackoverflow.com/questions/32935232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/968243/" ]
Visit all nested values recursively: ``` import collections def map_nested_dicts(ob, func): if isinstance(ob, collections.Mapping): return {k: map_nested_dicts(v, func) for k, v in ob.iteritems()} else: return func(ob) map_nested_dicts(x, lambda v: v + 7) # Creates a new dict object: # {'a...
If you need it to work for both lists and dicts in arbitrary nesting: ``` def apply_recursive(func, obj): if isinstance(obj, dict): # if dict, apply to each key return {k: apply_recursive(func, v) for k, v in obj.items()} elif isinstance(obj, list): # if list, apply to each element return [ap...
32,935,232
I have an arbitrarily deep set of nested dictionary: ``` x = {'a': 1, 'b': {'c': 6, 'd': 7, 'g': {'h': 3, 'i': 9}}, 'e': {'f': 3}} ``` and I'd like to basically apply a function to all the integers in the dictionaries, so like `map`, I guess, but for nested dictionaries. So: `map_nested_dicts(x, lambda v: v + 7)` w...
2015/10/04
[ "https://Stackoverflow.com/questions/32935232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/968243/" ]
Visit all nested values recursively: ``` import collections def map_nested_dicts(ob, func): if isinstance(ob, collections.Mapping): return {k: map_nested_dicts(v, func) for k, v in ob.iteritems()} else: return func(ob) map_nested_dicts(x, lambda v: v + 7) # Creates a new dict object: # {'a...
I have a more general implementation that can accept any number of containers of any type as parameters. ```py from collections.abc import Iterable import types def dict_value_map(fun, *dicts): keys = dicts[0].keys() for d in dicts[1:]: assert d.keys() == keys return {k:fun(*(d[k] for d in dicts)) ...
32,935,232
I have an arbitrarily deep set of nested dictionary: ``` x = {'a': 1, 'b': {'c': 6, 'd': 7, 'g': {'h': 3, 'i': 9}}, 'e': {'f': 3}} ``` and I'd like to basically apply a function to all the integers in the dictionaries, so like `map`, I guess, but for nested dictionaries. So: `map_nested_dicts(x, lambda v: v + 7)` w...
2015/10/04
[ "https://Stackoverflow.com/questions/32935232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/968243/" ]
Visit all nested values recursively: ``` import collections def map_nested_dicts(ob, func): if isinstance(ob, collections.Mapping): return {k: map_nested_dicts(v, func) for k, v in ob.iteritems()} else: return func(ob) map_nested_dicts(x, lambda v: v + 7) # Creates a new dict object: # {'a...
If you want to avoid dependencies and you need to map a mixed dictionaries/iterables collection with any combination of nesting and deepness, you can use the following solution: ``` def map_nested_coll(func,obj): if '__iter__' in dir(obj) and type(obj) not in (str,bytes): if type(obj) == dict: ...
32,935,232
I have an arbitrarily deep set of nested dictionary: ``` x = {'a': 1, 'b': {'c': 6, 'd': 7, 'g': {'h': 3, 'i': 9}}, 'e': {'f': 3}} ``` and I'd like to basically apply a function to all the integers in the dictionaries, so like `map`, I guess, but for nested dictionaries. So: `map_nested_dicts(x, lambda v: v + 7)` w...
2015/10/04
[ "https://Stackoverflow.com/questions/32935232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/968243/" ]
Just to expand on vaultah's answer, if one of your elements can be a list, and you'd like to handle those too: ``` import collections def map_nested_dicts_modify(ob, func): for k, v in ob.iteritems(): if isinstance(v, collections.Mapping): map_nested_dicts_modify(v, func) elif isinstance(v, list): ...
I have a more general implementation that can accept any number of containers of any type as parameters. ```py from collections.abc import Iterable import types def dict_value_map(fun, *dicts): keys = dicts[0].keys() for d in dicts[1:]: assert d.keys() == keys return {k:fun(*(d[k] for d in dicts)) ...
32,935,232
I have an arbitrarily deep set of nested dictionary: ``` x = {'a': 1, 'b': {'c': 6, 'd': 7, 'g': {'h': 3, 'i': 9}}, 'e': {'f': 3}} ``` and I'd like to basically apply a function to all the integers in the dictionaries, so like `map`, I guess, but for nested dictionaries. So: `map_nested_dicts(x, lambda v: v + 7)` w...
2015/10/04
[ "https://Stackoverflow.com/questions/32935232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/968243/" ]
Just to expand on vaultah's answer, if one of your elements can be a list, and you'd like to handle those too: ``` import collections def map_nested_dicts_modify(ob, func): for k, v in ob.iteritems(): if isinstance(v, collections.Mapping): map_nested_dicts_modify(v, func) elif isinstance(v, list): ...
If you want to avoid dependencies and you need to map a mixed dictionaries/iterables collection with any combination of nesting and deepness, you can use the following solution: ``` def map_nested_coll(func,obj): if '__iter__' in dir(obj) and type(obj) not in (str,bytes): if type(obj) == dict: ...
32,935,232
I have an arbitrarily deep set of nested dictionary: ``` x = {'a': 1, 'b': {'c': 6, 'd': 7, 'g': {'h': 3, 'i': 9}}, 'e': {'f': 3}} ``` and I'd like to basically apply a function to all the integers in the dictionaries, so like `map`, I guess, but for nested dictionaries. So: `map_nested_dicts(x, lambda v: v + 7)` w...
2015/10/04
[ "https://Stackoverflow.com/questions/32935232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/968243/" ]
If you need it to work for both lists and dicts in arbitrary nesting: ``` def apply_recursive(func, obj): if isinstance(obj, dict): # if dict, apply to each key return {k: apply_recursive(func, v) for k, v in obj.items()} elif isinstance(obj, list): # if list, apply to each element return [ap...
I have a more general implementation that can accept any number of containers of any type as parameters. ```py from collections.abc import Iterable import types def dict_value_map(fun, *dicts): keys = dicts[0].keys() for d in dicts[1:]: assert d.keys() == keys return {k:fun(*(d[k] for d in dicts)) ...
32,935,232
I have an arbitrarily deep set of nested dictionary: ``` x = {'a': 1, 'b': {'c': 6, 'd': 7, 'g': {'h': 3, 'i': 9}}, 'e': {'f': 3}} ``` and I'd like to basically apply a function to all the integers in the dictionaries, so like `map`, I guess, but for nested dictionaries. So: `map_nested_dicts(x, lambda v: v + 7)` w...
2015/10/04
[ "https://Stackoverflow.com/questions/32935232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/968243/" ]
If you need it to work for both lists and dicts in arbitrary nesting: ``` def apply_recursive(func, obj): if isinstance(obj, dict): # if dict, apply to each key return {k: apply_recursive(func, v) for k, v in obj.items()} elif isinstance(obj, list): # if list, apply to each element return [ap...
If you want to avoid dependencies and you need to map a mixed dictionaries/iterables collection with any combination of nesting and deepness, you can use the following solution: ``` def map_nested_coll(func,obj): if '__iter__' in dir(obj) and type(obj) not in (str,bytes): if type(obj) == dict: ...
32,935,232
I have an arbitrarily deep set of nested dictionary: ``` x = {'a': 1, 'b': {'c': 6, 'd': 7, 'g': {'h': 3, 'i': 9}}, 'e': {'f': 3}} ``` and I'd like to basically apply a function to all the integers in the dictionaries, so like `map`, I guess, but for nested dictionaries. So: `map_nested_dicts(x, lambda v: v + 7)` w...
2015/10/04
[ "https://Stackoverflow.com/questions/32935232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/968243/" ]
If you want to avoid dependencies and you need to map a mixed dictionaries/iterables collection with any combination of nesting and deepness, you can use the following solution: ``` def map_nested_coll(func,obj): if '__iter__' in dir(obj) and type(obj) not in (str,bytes): if type(obj) == dict: ...
I have a more general implementation that can accept any number of containers of any type as parameters. ```py from collections.abc import Iterable import types def dict_value_map(fun, *dicts): keys = dicts[0].keys() for d in dicts[1:]: assert d.keys() == keys return {k:fun(*(d[k] for d in dicts)) ...
22,854,038
I have a web page for editing a **product** and the UI has **different behavior** depending on **product** type. **It consist in minor changes like**: A specific field is mandatory just for one product type, a dropdown list has fewer options for 2 product types, an `ajax` call is made to a different URL, etc. 1/ How...
2014/04/04
[ "https://Stackoverflow.com/questions/22854038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3104183/" ]
You structure declaration: ``` typedef struct { char *word; int occurences; } HashItem; ``` declares a typedef name for an anonymous struct. There is a `HashItem` type that's a structure, but there is no `struct HashItem` type. So when your `compare_func()` has the following declarations: ``` const...
It now looks to me like your problems are all springing from the first definition. ``` /*DynArray is a dynamically resizing array that is used to hold values and retain size data throughout*/ typedef struct{ int number_of_values; int capacity; HashItem **items; }DynArray; ``` I see no reason for `items`...
22,854,038
I have a web page for editing a **product** and the UI has **different behavior** depending on **product** type. **It consist in minor changes like**: A specific field is mandatory just for one product type, a dropdown list has fewer options for 2 product types, an `ajax` call is made to a different URL, etc. 1/ How...
2014/04/04
[ "https://Stackoverflow.com/questions/22854038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3104183/" ]
You structure declaration: ``` typedef struct { char *word; int occurences; } HashItem; ``` declares a typedef name for an anonymous struct. There is a `HashItem` type that's a structure, but there is no `struct HashItem` type. So when your `compare_func()` has the following declarations: ``` const...
Change `qsort(standard_array, n, sizeof(HashItem), compare_func);` to ``` qsort(standard_array, n, sizeof(HashItem*), compare_func); ``` In function `void qsort (void* base, size_t num, size_t size, int (*compar)(const void*,const void*));` the third parameter `size_t size` stands for: > > Size in bytes of each e...
10,337
I understand that sampling rate should be twice the signal bandwidth for successful reconstruction. But what I don't get is how this translates in the time domain. For example, I have a sine wave pulse with frequency 100MHz and duration of say 50ns. This signal has a bandwidth of 20MHz (1/50ns = 20MHz). Theoretically,...
2013/08/15
[ "https://dsp.stackexchange.com/questions/10337", "https://dsp.stackexchange.com", "https://dsp.stackexchange.com/users/4673/" ]
I solved my problem. The design methodology as described above is sound. However, there was an error in my implementation of the FIR filter. For symmetrical filters you can replace convolution by correlation, and that's what I did. However, since the polyphase filters are asymmetrical this led to incorrect results. I i...
Your approach seems conceptually sound. I suspect that the problem is one of two things: 1) you have implemented it incorrectly, 2) Your filter bandwidth is too wide. You are implementing the "smart" approach in that you are doing it the computationally efficient way. I would try doing it the dumb way (insert I-1 zero...
74,507,765
I've two python class 'tuples' and and i want to compare contents on both of them and get only which is only in 'deactivated' tuple for eg., ``` deactivated = ((34, 'abcd'), (250, 'def'), (350, 'xyz')) schedules = ((34, 'abcd'), (250, 'def')) to_deactivate = () ``` in here, i want to push `(350, 'xyz')` which is not...
2022/11/20
[ "https://Stackoverflow.com/questions/74507765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17994187/" ]
Try: ```py deactivated = ((34, "abcd"), (250, "def"), (350, "xyz")) schedules = ((34, "abcd"), (250, "def")) to_deactivate = tuple(tpl for tpl in deactivated if tpl not in schedules) print(to_deactivate) ``` Prints: ``` ((350, 'xyz'),) ```
You could use iteration to compare every element in one tuple to every element of the other tuple and get the the value of index for which there exist value only in the first tuple ``` deactivated = ((34, 'abcd'), (250, 'def'), (350, 'xyz')) schedules = ((34, 'abcd'), (250, 'def')) to_deactivate = () for i in range(le...
74,507,765
I've two python class 'tuples' and and i want to compare contents on both of them and get only which is only in 'deactivated' tuple for eg., ``` deactivated = ((34, 'abcd'), (250, 'def'), (350, 'xyz')) schedules = ((34, 'abcd'), (250, 'def')) to_deactivate = () ``` in here, i want to push `(350, 'xyz')` which is not...
2022/11/20
[ "https://Stackoverflow.com/questions/74507765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17994187/" ]
Are you sure you those variables should be tuples? Because tuples are immutable. In their essence, you are not supposed to add or remove things from them. It looks like those variables are intended to be collections to which you add or remove things. Which is not possible with tuples. For example, sets, since you don...
Try: ```py deactivated = ((34, "abcd"), (250, "def"), (350, "xyz")) schedules = ((34, "abcd"), (250, "def")) to_deactivate = tuple(tpl for tpl in deactivated if tpl not in schedules) print(to_deactivate) ``` Prints: ``` ((350, 'xyz'),) ```
74,507,765
I've two python class 'tuples' and and i want to compare contents on both of them and get only which is only in 'deactivated' tuple for eg., ``` deactivated = ((34, 'abcd'), (250, 'def'), (350, 'xyz')) schedules = ((34, 'abcd'), (250, 'def')) to_deactivate = () ``` in here, i want to push `(350, 'xyz')` which is not...
2022/11/20
[ "https://Stackoverflow.com/questions/74507765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17994187/" ]
Are you sure you those variables should be tuples? Because tuples are immutable. In their essence, you are not supposed to add or remove things from them. It looks like those variables are intended to be collections to which you add or remove things. Which is not possible with tuples. For example, sets, since you don...
You could use iteration to compare every element in one tuple to every element of the other tuple and get the the value of index for which there exist value only in the first tuple ``` deactivated = ((34, 'abcd'), (250, 'def'), (350, 'xyz')) schedules = ((34, 'abcd'), (250, 'def')) to_deactivate = () for i in range(le...
26,630,513
I have one layout and one partial view which are in the Shared folder. Partial view presents top menu items which are not static. So I need to call an action method to get menu items from database. To do this, I created a controller and add an action method in it. When I try to browse the page in web browser, this err...
2014/10/29
[ "https://Stackoverflow.com/questions/26630513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1557482/" ]
What happens if you put this in your view? ``` @{ Html.RenderAction("TopMenu", "Layout"); } ``` (And comment this out until everything works: //[ChildActionOnly])
You are using the wrong overload of the Action-Method. The 2nd parameter in the variation is not the controllername but the actionname. You can check the correct Method overloads on this [page](http://msdn.microsoft.com/en-us/library/system.web.mvc.html.childactionextensions.action(v=vs.118).aspx) Also: If you specif...
26,630,513
I have one layout and one partial view which are in the Shared folder. Partial view presents top menu items which are not static. So I need to call an action method to get menu items from database. To do this, I created a controller and add an action method in it. When I try to browse the page in web browser, this err...
2014/10/29
[ "https://Stackoverflow.com/questions/26630513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1557482/" ]
Change this line, ``` @Html.Action("~/Views/Shared/_TopMenu.cshtml", "LayoutController", new {area =""}); ``` to, ``` @Html.Action("_TopMenu", "Layout", new {area =""}); ``` and check.
You are using the wrong overload of the Action-Method. The 2nd parameter in the variation is not the controllername but the actionname. You can check the correct Method overloads on this [page](http://msdn.microsoft.com/en-us/library/system.web.mvc.html.childactionextensions.action(v=vs.118).aspx) Also: If you specif...
26,630,513
I have one layout and one partial view which are in the Shared folder. Partial view presents top menu items which are not static. So I need to call an action method to get menu items from database. To do this, I created a controller and add an action method in it. When I try to browse the page in web browser, this err...
2014/10/29
[ "https://Stackoverflow.com/questions/26630513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1557482/" ]
exist differents ways, for this case I like use html.action in layout, and in control I will create a string Menu, the string contains the html code I need, the controller end with return Content(menu); for example Layout: ``` <body> <nav> @Html.Action("_TopMenu", "Layout") </nav> ``` the controller...
You are using the wrong overload of the Action-Method. The 2nd parameter in the variation is not the controllername but the actionname. You can check the correct Method overloads on this [page](http://msdn.microsoft.com/en-us/library/system.web.mvc.html.childactionextensions.action(v=vs.118).aspx) Also: If you specif...
26,630,513
I have one layout and one partial view which are in the Shared folder. Partial view presents top menu items which are not static. So I need to call an action method to get menu items from database. To do this, I created a controller and add an action method in it. When I try to browse the page in web browser, this err...
2014/10/29
[ "https://Stackoverflow.com/questions/26630513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1557482/" ]
What happens if you put this in your view? ``` @{ Html.RenderAction("TopMenu", "Layout"); } ``` (And comment this out until everything works: //[ChildActionOnly])
Change this line, ``` @Html.Action("~/Views/Shared/_TopMenu.cshtml", "LayoutController", new {area =""}); ``` to, ``` @Html.Action("_TopMenu", "Layout", new {area =""}); ``` and check.
26,630,513
I have one layout and one partial view which are in the Shared folder. Partial view presents top menu items which are not static. So I need to call an action method to get menu items from database. To do this, I created a controller and add an action method in it. When I try to browse the page in web browser, this err...
2014/10/29
[ "https://Stackoverflow.com/questions/26630513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1557482/" ]
What happens if you put this in your view? ``` @{ Html.RenderAction("TopMenu", "Layout"); } ``` (And comment this out until everything works: //[ChildActionOnly])
exist differents ways, for this case I like use html.action in layout, and in control I will create a string Menu, the string contains the html code I need, the controller end with return Content(menu); for example Layout: ``` <body> <nav> @Html.Action("_TopMenu", "Layout") </nav> ``` the controller...
26,630,513
I have one layout and one partial view which are in the Shared folder. Partial view presents top menu items which are not static. So I need to call an action method to get menu items from database. To do this, I created a controller and add an action method in it. When I try to browse the page in web browser, this err...
2014/10/29
[ "https://Stackoverflow.com/questions/26630513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1557482/" ]
What happens if you put this in your view? ``` @{ Html.RenderAction("TopMenu", "Layout"); } ``` (And comment this out until everything works: //[ChildActionOnly])
This is how I did it: **Layout** ``` @Html.Action("GetAdminMenu", "AdminMenu") ``` **Admin Menu Controller** ``` public PartialViewResult GetAdminMenu() { var model = new AdminMenuViewModel(); return PartialView(model); } ``` **GetAdminMenu.cshtml** ``` @model ReportingPortal.Models.AdminMenuViewModel...
26,630,513
I have one layout and one partial view which are in the Shared folder. Partial view presents top menu items which are not static. So I need to call an action method to get menu items from database. To do this, I created a controller and add an action method in it. When I try to browse the page in web browser, this err...
2014/10/29
[ "https://Stackoverflow.com/questions/26630513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1557482/" ]
Change this line, ``` @Html.Action("~/Views/Shared/_TopMenu.cshtml", "LayoutController", new {area =""}); ``` to, ``` @Html.Action("_TopMenu", "Layout", new {area =""}); ``` and check.
This is how I did it: **Layout** ``` @Html.Action("GetAdminMenu", "AdminMenu") ``` **Admin Menu Controller** ``` public PartialViewResult GetAdminMenu() { var model = new AdminMenuViewModel(); return PartialView(model); } ``` **GetAdminMenu.cshtml** ``` @model ReportingPortal.Models.AdminMenuViewModel...
26,630,513
I have one layout and one partial view which are in the Shared folder. Partial view presents top menu items which are not static. So I need to call an action method to get menu items from database. To do this, I created a controller and add an action method in it. When I try to browse the page in web browser, this err...
2014/10/29
[ "https://Stackoverflow.com/questions/26630513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1557482/" ]
exist differents ways, for this case I like use html.action in layout, and in control I will create a string Menu, the string contains the html code I need, the controller end with return Content(menu); for example Layout: ``` <body> <nav> @Html.Action("_TopMenu", "Layout") </nav> ``` the controller...
This is how I did it: **Layout** ``` @Html.Action("GetAdminMenu", "AdminMenu") ``` **Admin Menu Controller** ``` public PartialViewResult GetAdminMenu() { var model = new AdminMenuViewModel(); return PartialView(model); } ``` **GetAdminMenu.cshtml** ``` @model ReportingPortal.Models.AdminMenuViewModel...
6,418,303
I am new to PHP and am writing a PHP script that contains `a module which reads the file timestamp out of a file and then compare with system time to see whether the file is older than 5 minutes or not and I am wondering how that can be achieved`. I am currently using ``` $timeStamp = strftime('%c', filectime($this->l...
2011/06/20
[ "https://Stackoverflow.com/questions/6418303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/801807/" ]
That is **Unix timestamp** actually (seconds since 1st jan 1970 or EPOCH) You can use [time() function](http://us3.php.net/manual/en/function.time.php) to get current time in same Unix format. And then subtract both time values to check whether difference is > 300 (5 min) or not.
`$timeStamp2` is a UNIX timestamp (the number of seconds passed since 01/01/1970). You can get the same thing from `$timeStamp1` by doing `$timeStamp1 = strtotime($timeStamp1)` and then compare the two values
6,418,303
I am new to PHP and am writing a PHP script that contains `a module which reads the file timestamp out of a file and then compare with system time to see whether the file is older than 5 minutes or not and I am wondering how that can be achieved`. I am currently using ``` $timeStamp = strftime('%c', filectime($this->l...
2011/06/20
[ "https://Stackoverflow.com/questions/6418303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/801807/" ]
That is **Unix timestamp** actually (seconds since 1st jan 1970 or EPOCH) You can use [time() function](http://us3.php.net/manual/en/function.time.php) to get current time in same Unix format. And then subtract both time values to check whether difference is > 300 (5 min) or not.
Answering your question "What does $timeStamp2 mean?" `1308608221` is the number of seconds that have passed since midnight January 1,1970.
6,418,303
I am new to PHP and am writing a PHP script that contains `a module which reads the file timestamp out of a file and then compare with system time to see whether the file is older than 5 minutes or not and I am wondering how that can be achieved`. I am currently using ``` $timeStamp = strftime('%c', filectime($this->l...
2011/06/20
[ "https://Stackoverflow.com/questions/6418303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/801807/" ]
`$timeStamp2` is a UNIX timestamp (the number of seconds passed since 01/01/1970). You can get the same thing from `$timeStamp1` by doing `$timeStamp1 = strtotime($timeStamp1)` and then compare the two values
Answering your question "What does $timeStamp2 mean?" `1308608221` is the number of seconds that have passed since midnight January 1,1970.
72,831,871
I am creating a solution in VBA code in MS Access where I populate a PDF form from data on the MS form the user is on. I have worked with both XML files to house the data for the fill as well as XFDF file. The VBA fails when I try to fill an xfdf file. On the `xmlRoot.selectSingNode` set attempt, I get an error 91: >...
2022/07/01
[ "https://Stackoverflow.com/questions/72831871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6483188/" ]
You are importing the `ConfigModule` in the `AppModule`, but not as a global module so your `AuthModule` does not know about it. That is why it does not know the secret. You can either import the `ConfigModule` in the `AuthModule` as well or import it as a global module from within the `AppModule`. ``` @Module({ im...
Try removing `JwtService` and `AuthService` from the providers in app.module.ts. Also remove `AuthController` from the controllers in app.module.ts. This worked for me when I had the same error message. Although I am not entirely sure yet why this works (I am very new to NestJS), here is my reasoning: You pass the `A...
72,831,871
I am creating a solution in VBA code in MS Access where I populate a PDF form from data on the MS form the user is on. I have worked with both XML files to house the data for the fill as well as XFDF file. The VBA fails when I try to fill an xfdf file. On the `xmlRoot.selectSingNode` set attempt, I get an error 91: >...
2022/07/01
[ "https://Stackoverflow.com/questions/72831871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6483188/" ]
You are importing the `ConfigModule` in the `AppModule`, but not as a global module so your `AuthModule` does not know about it. That is why it does not know the secret. You can either import the `ConfigModule` in the `AuthModule` as well or import it as a global module from within the `AppModule`. ``` @Module({ im...
I'm late to the party, but I was just banging my head against this problem and just found a solution. The problem is probably on this row in app.module.ts: ``` providers: [UsersService, AuthService, PolsService, JwtService], ``` JwtService should not be added as a provider. If you do, it seems to reset any register...
72,831,871
I am creating a solution in VBA code in MS Access where I populate a PDF form from data on the MS form the user is on. I have worked with both XML files to house the data for the fill as well as XFDF file. The VBA fails when I try to fill an xfdf file. On the `xmlRoot.selectSingNode` set attempt, I get an error 91: >...
2022/07/01
[ "https://Stackoverflow.com/questions/72831871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6483188/" ]
I'm late to the party, but I was just banging my head against this problem and just found a solution. The problem is probably on this row in app.module.ts: ``` providers: [UsersService, AuthService, PolsService, JwtService], ``` JwtService should not be added as a provider. If you do, it seems to reset any register...
Try removing `JwtService` and `AuthService` from the providers in app.module.ts. Also remove `AuthController` from the controllers in app.module.ts. This worked for me when I had the same error message. Although I am not entirely sure yet why this works (I am very new to NestJS), here is my reasoning: You pass the `A...
415,323
Say I need hand write some queries in the console, what's the most efficient way of executing multiline queries like `CREATE TABLE` statements? I am used to using Microsoft Management Studio, but I now find myself having to learn about PostgreSQL on the fly.
2012/08/08
[ "https://serverfault.com/questions/415323", "https://serverfault.com", "https://serverfault.com/users/81366/" ]
The following will take you to PostgreSQL's interactive terminal: ``` $ psql <your database name> ``` Then enter `\e` (or `\edit`) to open an editor (`vi` is default): ``` # \e ``` Write some query: ``` select now(); ``` Finally, save and quit your editor (e.g. `:wq` in `vi`), and `psql` will run the query you...
There is really no such thing as a "multi-line query" - as far as PostgreSQL cares, all that whitespace and those newlines are meaningless (unless they occur inside a string or we're talking about tabs & such in a `COPY` statement or a few other special places). Writing queries "on the console" over SSH is usually don...
415,323
Say I need hand write some queries in the console, what's the most efficient way of executing multiline queries like `CREATE TABLE` statements? I am used to using Microsoft Management Studio, but I now find myself having to learn about PostgreSQL on the fly.
2012/08/08
[ "https://serverfault.com/questions/415323", "https://serverfault.com", "https://serverfault.com/users/81366/" ]
There is really no such thing as a "multi-line query" - as far as PostgreSQL cares, all that whitespace and those newlines are meaningless (unless they occur inside a string or we're talking about tabs & such in a `COPY` statement or a few other special places). Writing queries "on the console" over SSH is usually don...
You can write the query to a temp file and execute it with `psql -f /path/to/temp/file`
415,323
Say I need hand write some queries in the console, what's the most efficient way of executing multiline queries like `CREATE TABLE` statements? I am used to using Microsoft Management Studio, but I now find myself having to learn about PostgreSQL on the fly.
2012/08/08
[ "https://serverfault.com/questions/415323", "https://serverfault.com", "https://serverfault.com/users/81366/" ]
The following will take you to PostgreSQL's interactive terminal: ``` $ psql <your database name> ``` Then enter `\e` (or `\edit`) to open an editor (`vi` is default): ``` # \e ``` Write some query: ``` select now(); ``` Finally, save and quit your editor (e.g. `:wq` in `vi`), and `psql` will run the query you...
You can write the query to a temp file and execute it with `psql -f /path/to/temp/file`
415,323
Say I need hand write some queries in the console, what's the most efficient way of executing multiline queries like `CREATE TABLE` statements? I am used to using Microsoft Management Studio, but I now find myself having to learn about PostgreSQL on the fly.
2012/08/08
[ "https://serverfault.com/questions/415323", "https://serverfault.com", "https://serverfault.com/users/81366/" ]
The following will take you to PostgreSQL's interactive terminal: ``` $ psql <your database name> ``` Then enter `\e` (or `\edit`) to open an editor (`vi` is default): ``` # \e ``` Write some query: ``` select now(); ``` Finally, save and quit your editor (e.g. `:wq` in `vi`), and `psql` will run the query you...
Obvious, but if anyone is not aware, you can write multi-line statements directly in the psql prompt: ```sh psql -h localhost -p 5432 -U postgres public public=# SELECT public=# * public=# FROM public=# mytable public=# LIMIT 1; ``` Note the trailing `;` character - any SQL command will only be executed once this ch...
415,323
Say I need hand write some queries in the console, what's the most efficient way of executing multiline queries like `CREATE TABLE` statements? I am used to using Microsoft Management Studio, but I now find myself having to learn about PostgreSQL on the fly.
2012/08/08
[ "https://serverfault.com/questions/415323", "https://serverfault.com", "https://serverfault.com/users/81366/" ]
The following will take you to PostgreSQL's interactive terminal: ``` $ psql <your database name> ``` Then enter `\e` (or `\edit`) to open an editor (`vi` is default): ``` # \e ``` Write some query: ``` select now(); ``` Finally, save and quit your editor (e.g. `:wq` in `vi`), and `psql` will run the query you...
You can use this syntax in bash (.sh file): ```sh psql postgres://postgres:postgres@localhost:5432/postgres << SQL ALTER TABLE table DISABLE TRIGGER all; TRUNCATE table; ALTER SEQUENCE table_id_seq RESTART WITH 1; SQL ```
415,323
Say I need hand write some queries in the console, what's the most efficient way of executing multiline queries like `CREATE TABLE` statements? I am used to using Microsoft Management Studio, but I now find myself having to learn about PostgreSQL on the fly.
2012/08/08
[ "https://serverfault.com/questions/415323", "https://serverfault.com", "https://serverfault.com/users/81366/" ]
Obvious, but if anyone is not aware, you can write multi-line statements directly in the psql prompt: ```sh psql -h localhost -p 5432 -U postgres public public=# SELECT public=# * public=# FROM public=# mytable public=# LIMIT 1; ``` Note the trailing `;` character - any SQL command will only be executed once this ch...
You can write the query to a temp file and execute it with `psql -f /path/to/temp/file`
415,323
Say I need hand write some queries in the console, what's the most efficient way of executing multiline queries like `CREATE TABLE` statements? I am used to using Microsoft Management Studio, but I now find myself having to learn about PostgreSQL on the fly.
2012/08/08
[ "https://serverfault.com/questions/415323", "https://serverfault.com", "https://serverfault.com/users/81366/" ]
You can use this syntax in bash (.sh file): ```sh psql postgres://postgres:postgres@localhost:5432/postgres << SQL ALTER TABLE table DISABLE TRIGGER all; TRUNCATE table; ALTER SEQUENCE table_id_seq RESTART WITH 1; SQL ```
You can write the query to a temp file and execute it with `psql -f /path/to/temp/file`
52,599,494
When German quotation marks („ and “ or HTML code `&bdquo;` and `&ldquo;`, see <https://unicode-table.com/de/201E/> and <https://unicode-table.com/de/201C/>) are in between bold text markers `**...**`, then pandoc does not render the text bold when I knit in RStudio. Even worse, the `**`s are printed verbatim in the HT...
2018/10/01
[ "https://Stackoverflow.com/questions/52599494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4502495/" ]
The issue tracking input of localized quotes is <https://github.com/jgm/pandoc/issues/661>. Meanwhile, I recommend using non-typographic quotes (`"`) and for HTML-output use the `--html-q-tags` option and [some CSS, like](https://developer.mozilla.org/docs/Web/CSS/quotes): ``` q { quotes: '„' '“'; } ```
My workaround: I made use of the command line tool `sed` and regular expressions: First, modify the .Rmd (or .md) file and replace all the German typographic quotation marks with standard quotation marks: (WARNING: commands change the file inplace!) ``` sed -i 's/„/"/g' mydocument.Rmd sed -i 's/“/"/g' mydocument.Rmd ...
8,957,028
Let's say I have a triangle given by the three integer vertices (x1,y1), (x2,y2) and (x3,y3). What sort of algorithm can I use to return a comprehensive list of ALL (x,y) integer pairs that lie inside the triangle.
2012/01/21
[ "https://Stackoverflow.com/questions/8957028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412082/" ]
I suppose you have a list of pairs you want to test (if this is not what your problem is about, please specify your question clearly). You should store the pairs into quad-tree or kd-tree structure first, in order to have a set of candidates which is small enough. If you have few points, this is probably not worth the ...
I like ray casting, nicely described in [this Wikipedia article](http://en.wikipedia.org/wiki/Point_in_polygon). Used it in my project for the same purpose. That method scales on other polygons too, including concave. Not sure about the performance, but it is easily coded, so you could try it yourself (I had no perform...