qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
138,658
I'm applying for a graduate position. One professor answered my email and asked me some questions. Two of them are listed below: > > What are your short- and long-term academic/professional goals? > > > What are your short- and long-term personal goals? > > > I can talk about my professional goals in the first ...
2019/10/17
[ "https://academia.stackexchange.com/questions/138658", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/115210/" ]
I agree that the question could be interpreted as inappropriate. But, while it's impossible to know the professor's intention (were they trying to screen out applicants who want to start families, etc.?), I think it's safe to answer the question ASSUMING that they are interested in your academic goals that may not be d...
I'd like to argue that this is to some extent country-specific. No country was mentioned in the original post, though. Applying to a concrete position while mentioning "graduate admissions" sounds compatible with the German academic system, for which the following answer is particularly applicable. The professor *may*...
67,153,826
I'm stuck on trying to use dynamic names for dataframe in Python. My goal is to read a list of csv files in a folder like: ```none aaa.csv bbb.csv ccc.csv ``` for example with: ``` path = "../somepath/" files = [f for f in os.listdir(path)] ``` Then, loop on the list and for every step create a dataframe from a...
2021/04/18
[ "https://Stackoverflow.com/questions/67153826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14884832/" ]
``` Problem 1 - tcg/voyager[1.4.x-dev, ..., 1.x-dev] require doctrine/dbal ^2.5 -> found doctrine/dbal[v2.5.0-BETA2, ..., 2.13.x-dev] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command. - tcg/vo...
This happened to me. I fixed it by downgrading the doctrine/dbal to ^2.6 version because none of other packages on my project need DBAL version later than 2.6 <https://github.com/the-control-group/voyager/issues/5391#issuecomment-873819579>
12,211,305
I'm about to implement a web form that requires some form of spam prevention. I'd like to avoid spam prevention techniques involving user input, and integrating with Akismet is overkill for this situation (it's ok if a small amount of spam does get through). I'd also prefer to avoid techniques involving javascript - ag...
2012/08/31
[ "https://Stackoverflow.com/questions/12211305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/523245/" ]
It depends on the decoder present on the devices. WMV is a Microsoft proprietory format for which you need license from them.
wmv video format is not officially supported by Android. See the list of supported media formats [here](http://developer.android.com/guide/appendix/media-formats.html#core)
15,400,789
I'm researching a side project I'm interested in at the moment which is having an attachment to an android phone that can scan fingerprints and enrol/verify them on an online database. I'd like to have a log in system so the user could access their database and I've already scoped out a good open source recognition p...
2013/03/14
[ "https://Stackoverflow.com/questions/15400789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2168141/" ]
You Android app can make a HTTP request just like a web browser, JavaScript in a web browser, and any other applications. You'll just need to declare a permission in your `AndroidManifest.xml` file: ``` <uses-permission android:name="android.permission.INTERNET" /> ``` Check out the docs for [HttpURLConnection](htt...
You can use `ksoap` library for this purpose,more help at <http://www.sacoskun.com/2010/02/consuming-net-web-services-via-ksoap_07.html>
7,131
NHL announcers constantly mention it, and I've seen some news articles online referring to players who used to be / are a healthy scratch. **What is a healthy scratch?** I didn't find anything on Google's first two pages on a search, but if I had to guess I think it has to do with injured players who are healthy now.
2014/11/19
[ "https://sports.stackexchange.com/questions/7131", "https://sports.stackexchange.com", "https://sports.stackexchange.com/users/7589/" ]
Good try, but that's not what it means. It means that the player is healthy and eligible to play, but the coach has decided not to use him. Players usually become a healthy scratch after poor performances or as a wake-up call.
From Wikipedia article "[Glossary of ice hockey terms](https://en.wikipedia.org/wiki/Glossary_of_ice_hockey_terms#H)": > > Healthy scratch > > > An uninjured player on the roster who does not dress for a game. Only 20 players (22 in international competition) are allowed to dress for a game, players who are not goi...
18,428,690
I implemented analytics.js (new version) in my ASPX webapplication. I got pageview working just fine, but events is very often not being send. In my example, I tried pushing 3 different buttons, but only one of them fired the event. I added an alert-box to each event, to verify that it actually is fired, and these all...
2013/08/25
[ "https://Stackoverflow.com/questions/18428690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1205202/" ]
When a new page is being loaded, pending requests on the current page are canceled -- in this case the analytics tracking pixel request. 'async' is referring more to the loading of the analytics javascript code then the processing of analytics data. With ga.js, a common approach is to stop propagation of the click eve...
Okay, here is how I fixed it, if anyone else has the same problem: I made a function, to call the analytics tracking, where I delayed the page for just a fraction of a second: ``` function TrackEvent(link, category, action, label, page) { try { ga("send", "event", category, action, label, { 'page': page }...
18,428,690
I implemented analytics.js (new version) in my ASPX webapplication. I got pageview working just fine, but events is very often not being send. In my example, I tried pushing 3 different buttons, but only one of them fired the event. I added an alert-box to each event, to verify that it actually is fired, and these all...
2013/08/25
[ "https://Stackoverflow.com/questions/18428690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1205202/" ]
When a new page is being loaded, pending requests on the current page are canceled -- in this case the analytics tracking pixel request. 'async' is referring more to the loading of the analytics javascript code then the processing of analytics data. With ga.js, a common approach is to stop propagation of the click eve...
I would suggest executing a dummy anchor click after successful event registration : ``` a.onclick = function(e){ var anchor = this; _gaq.push(['_trackEvent', 'Category','event','label']); _gaq.push(function() { var a = document.createElement('a'); a....
18,428,690
I implemented analytics.js (new version) in my ASPX webapplication. I got pageview working just fine, but events is very often not being send. In my example, I tried pushing 3 different buttons, but only one of them fired the event. I added an alert-box to each event, to verify that it actually is fired, and these all...
2013/08/25
[ "https://Stackoverflow.com/questions/18428690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1205202/" ]
When a new page is being loaded, pending requests on the current page are canceled -- in this case the analytics tracking pixel request. 'async' is referring more to the loading of the analytics javascript code then the processing of analytics data. With ga.js, a common approach is to stop propagation of the click eve...
As pointed out by Mike, you should use a hit callback in this case. In addition, you also need to take into account that users may block Google Analytics using some privacy protection tool such as Ghostery, in which case the hit callback will never be executed. Therefore you need to implement this very carefully so tha...
18,428,690
I implemented analytics.js (new version) in my ASPX webapplication. I got pageview working just fine, but events is very often not being send. In my example, I tried pushing 3 different buttons, but only one of them fired the event. I added an alert-box to each event, to verify that it actually is fired, and these all...
2013/08/25
[ "https://Stackoverflow.com/questions/18428690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1205202/" ]
Okay, here is how I fixed it, if anyone else has the same problem: I made a function, to call the analytics tracking, where I delayed the page for just a fraction of a second: ``` function TrackEvent(link, category, action, label, page) { try { ga("send", "event", category, action, label, { 'page': page }...
As pointed out by Mike, you should use a hit callback in this case. In addition, you also need to take into account that users may block Google Analytics using some privacy protection tool such as Ghostery, in which case the hit callback will never be executed. Therefore you need to implement this very carefully so tha...
18,428,690
I implemented analytics.js (new version) in my ASPX webapplication. I got pageview working just fine, but events is very often not being send. In my example, I tried pushing 3 different buttons, but only one of them fired the event. I added an alert-box to each event, to verify that it actually is fired, and these all...
2013/08/25
[ "https://Stackoverflow.com/questions/18428690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1205202/" ]
I would suggest executing a dummy anchor click after successful event registration : ``` a.onclick = function(e){ var anchor = this; _gaq.push(['_trackEvent', 'Category','event','label']); _gaq.push(function() { var a = document.createElement('a'); a....
As pointed out by Mike, you should use a hit callback in this case. In addition, you also need to take into account that users may block Google Analytics using some privacy protection tool such as Ghostery, in which case the hit callback will never be executed. Therefore you need to implement this very carefully so tha...
37,073,082
Is it possible to merge these 2 left join into one? I can't think of any way ``` select left1.field1, left2.field2 from masterTable left join ( select somefield, field1, row_number() over (partition by somefield orderby otherfield) as rowNum from childTable inner join masterT...
2016/05/06
[ "https://Stackoverflow.com/questions/37073082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40868/" ]
You can use `max() over()` to get the max of field2 per somefield in the same query. ``` select left1.field1, left1.field2 from masterTable left join (select somefield,field1 ,row_number() over (partition by somefield orderby otherfield) as rowNum ,max(field2) over(partition by somefield) as field2 from chi...
Please try this .. ``` select left1.field1, left1.field2 from masterTable left join (select somefield,field1 ,row_number() over (partition by somefield orderby otherfield) as rowNum ,max(field2) over(partition by somefield) as field2 from childTable inner join masterTable on masterTable.somefield = childTa...
37,073,082
Is it possible to merge these 2 left join into one? I can't think of any way ``` select left1.field1, left2.field2 from masterTable left join ( select somefield, field1, row_number() over (partition by somefield orderby otherfield) as rowNum from childTable inner join masterT...
2016/05/06
[ "https://Stackoverflow.com/questions/37073082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40868/" ]
You can use `max() over()` to get the max of field2 per somefield in the same query. ``` select left1.field1, left1.field2 from masterTable left join (select somefield,field1 ,row_number() over (partition by somefield orderby otherfield) as rowNum ,max(field2) over(partition by somefield) as field2 from chi...
Try this, but without samples of data and output I can't guarantee that it will work properly, it's just guessing. ``` SELECT field1, MAX(field2) AS field2 FROM ( SELECT ct.field1, ct1.field2, ROW_NUMBER() OVER (PARTITION BY ct.somefield ORDER BY ct.otherfield) as rn FROM mas...
5,942,617
I have a function that outputs a number to a multi-line text field. Currently, I set the contents of the text field with ``` [outputField setFloatValue:side]; ``` (the name of the text field is "outputField" and the name of the variable I am putting in the text field is "side"). I don't think I can make "side" a s...
2011/05/09
[ "https://Stackoverflow.com/questions/5942617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/720889/" ]
Assuming you want to add `side` to a new line preserving all the previous text and `side` is a float: ``` outputField.stringValue = [NSString stringWithFormat:@"%@\n%f",outputField.stringValue,side]; ```
``` outputField.text = [NSString stringWithFormat:@"%@%f",outputField.text,side]; ```
116,647
In the context of preparing a CV for a math academic job search Is it advisable to list preprints which are not yet accessible to the wide public in the CV? If so, should it be in a rubric of its own (i.e. separate from "research publications"), or can I put it in the same rubric but write something like "(draft, av...
2018/09/10
[ "https://academia.stackexchange.com/questions/116647", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/88263/" ]
If the paper has been submitted, then of course you can list it as "submitted", whether it's public or not. Otherwise, I think that about all you can do is to say "in preparation", but this won't really have much impact. My impression is that "in preparation" means about as much to a search committee as "I had this id...
You are a mathematician. Maybe I am overstating this a bit, but you should have no preprints that are not publicly available. * If it's accepted, it's on the CV and available, at least for those having subscription, see also below. * Before it's sent to the peer review, you upload it to arXiv, hence it's available (bu...
116,647
In the context of preparing a CV for a math academic job search Is it advisable to list preprints which are not yet accessible to the wide public in the CV? If so, should it be in a rubric of its own (i.e. separate from "research publications"), or can I put it in the same rubric but write something like "(draft, av...
2018/09/10
[ "https://academia.stackexchange.com/questions/116647", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/88263/" ]
I second Nate Eldridge’s excellent answer, and in particular the opinion that “in preparation” means nothing and will be ignored. “Submitted” is okay to write if true, but also doesn’t mean much if the paper can’t be viewed by the person reading your CV. “Available upon request” is marginally better than “in prepar...
You are a mathematician. Maybe I am overstating this a bit, but you should have no preprints that are not publicly available. * If it's accepted, it's on the CV and available, at least for those having subscription, see also below. * Before it's sent to the peer review, you upload it to arXiv, hence it's available (bu...
446,268
Some of our projects call for default Visual Studio tab options (width 4; keep tabs); some call for width 3; use spaces. Don't ask. Rather than set these globally, is there anyway in which I could set this on a per-solution or per-project or even (emacs-style) per-file? Visual Studio 2005 and 2008.
2009/01/15
[ "https://Stackoverflow.com/questions/446268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8446/" ]
The most convenient solution I know is to create a set of Visual Studio macros to switch to the settings you want. Go to `Tools > Macros > Macros IDE`. There, in the tree on the left, right-click `MyMacros` and choose `Add > Add Module`. Give the module a name such as `TabSize`. Within this module, create subs to chan...
I have a similar problem: my new project needs to be set up with **keep tabs**, while my other projects are developed with **insert spaces** option. Since this is a strictly Visual Studio setting, i didn't expect to find any per-project information that will empower this (either if one use a specific add-in for that p...
446,268
Some of our projects call for default Visual Studio tab options (width 4; keep tabs); some call for width 3; use spaces. Don't ask. Rather than set these globally, is there anyway in which I could set this on a per-solution or per-project or even (emacs-style) per-file? Visual Studio 2005 and 2008.
2009/01/15
[ "https://Stackoverflow.com/questions/446268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8446/" ]
I have a similar problem: my new project needs to be set up with **keep tabs**, while my other projects are developed with **insert spaces** option. Since this is a strictly Visual Studio setting, i didn't expect to find any per-project information that will empower this (either if one use a specific add-in for that p...
You can also use these properties to complete Daniel's example : ``` DTE.Properties("TextEditor", "AllLanguages").Item("InsertTabs").Value DTE.Properties("TextEditor", "AllLanguages").Item("IndentStyle").Value ```
446,268
Some of our projects call for default Visual Studio tab options (width 4; keep tabs); some call for width 3; use spaces. Don't ask. Rather than set these globally, is there anyway in which I could set this on a per-solution or per-project or even (emacs-style) per-file? Visual Studio 2005 and 2008.
2009/01/15
[ "https://Stackoverflow.com/questions/446268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8446/" ]
I have a similar problem: my new project needs to be set up with **keep tabs**, while my other projects are developed with **insert spaces** option. Since this is a strictly Visual Studio setting, i didn't expect to find any per-project information that will empower this (either if one use a specific add-in for that p...
I know I'm a bit late to the game: Since Visual Studio 2017, there's support for [`.editorconfig`](https://learn.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options) files in the IDE on a per-directory basis.
446,268
Some of our projects call for default Visual Studio tab options (width 4; keep tabs); some call for width 3; use spaces. Don't ask. Rather than set these globally, is there anyway in which I could set this on a per-solution or per-project or even (emacs-style) per-file? Visual Studio 2005 and 2008.
2009/01/15
[ "https://Stackoverflow.com/questions/446268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8446/" ]
The most convenient solution I know is to create a set of Visual Studio macros to switch to the settings you want. Go to `Tools > Macros > Macros IDE`. There, in the tree on the left, right-click `MyMacros` and choose `Add > Add Module`. Give the module a name such as `TabSize`. Within this module, create subs to chan...
You can also use these properties to complete Daniel's example : ``` DTE.Properties("TextEditor", "AllLanguages").Item("InsertTabs").Value DTE.Properties("TextEditor", "AllLanguages").Item("IndentStyle").Value ```
446,268
Some of our projects call for default Visual Studio tab options (width 4; keep tabs); some call for width 3; use spaces. Don't ask. Rather than set these globally, is there anyway in which I could set this on a per-solution or per-project or even (emacs-style) per-file? Visual Studio 2005 and 2008.
2009/01/15
[ "https://Stackoverflow.com/questions/446268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8446/" ]
The most convenient solution I know is to create a set of Visual Studio macros to switch to the settings you want. Go to `Tools > Macros > Macros IDE`. There, in the tree on the left, right-click `MyMacros` and choose `Add > Add Module`. Give the module a name such as `TabSize`. Within this module, create subs to chan...
I know I'm a bit late to the game: Since Visual Studio 2017, there's support for [`.editorconfig`](https://learn.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options) files in the IDE on a per-directory basis.
446,268
Some of our projects call for default Visual Studio tab options (width 4; keep tabs); some call for width 3; use spaces. Don't ask. Rather than set these globally, is there anyway in which I could set this on a per-solution or per-project or even (emacs-style) per-file? Visual Studio 2005 and 2008.
2009/01/15
[ "https://Stackoverflow.com/questions/446268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8446/" ]
You can also use these properties to complete Daniel's example : ``` DTE.Properties("TextEditor", "AllLanguages").Item("InsertTabs").Value DTE.Properties("TextEditor", "AllLanguages").Item("IndentStyle").Value ```
I know I'm a bit late to the game: Since Visual Studio 2017, there's support for [`.editorconfig`](https://learn.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options) files in the IDE on a per-directory basis.
8,569,121
I am extremely new to Java (just started this weekend) and have a background in Perl. So I have a question: **What is the Java equivalent to the Perl Diamond Operator (<>)?** So basically what is Java's equivalent to: ``` print "What is your name?"; my $name = <>; print "Hello, $name!"; ``` Thanks in advance! ---...
2011/12/19
[ "https://Stackoverflow.com/questions/8569121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/875067/" ]
That would be `new BufferedReader(new InputStreamReader(System.in))` (or `new Scanner(System.in)`, depending on your needs). Note however that it is not *strictly* equivalent to perl's diamond operator, since the diamond operator is influenced by `$/`. In Java, you'd have to do that differently. And just for complete...
I doubt there is a Java equivalent as [`<>` does more than just read from `STDIN`](http://perldoc.perl.org/perlop.html): > > The null filehandle `<>` is special: it can be used to emulate the behavior of sed and awk. Input from `<>` comes either from standard input, or from each file listed on the command line. Here'...
8,569,121
I am extremely new to Java (just started this weekend) and have a background in Perl. So I have a question: **What is the Java equivalent to the Perl Diamond Operator (<>)?** So basically what is Java's equivalent to: ``` print "What is your name?"; my $name = <>; print "Hello, $name!"; ``` Thanks in advance! ---...
2011/12/19
[ "https://Stackoverflow.com/questions/8569121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/875067/" ]
Well, java is not a scripting language and it's designed for different things. Anyhow, similar code in java might look like this: ``` public class Readline { public static void main(String[] args) throws java.io.IOException { System.out.print("What is your name?"); java.io.BufferedReader stdin = ...
I doubt there is a Java equivalent as [`<>` does more than just read from `STDIN`](http://perldoc.perl.org/perlop.html): > > The null filehandle `<>` is special: it can be used to emulate the behavior of sed and awk. Input from `<>` comes either from standard input, or from each file listed on the command line. Here'...
3,324,926
I am thinking of secure ways to serve HTML and JSON to JavaScript. Currently I am just outputting the JSON like: > > > ``` > ajax.php?type=article&id=15 > > ``` > > ``` { "name": "something", "content": "some content" } ``` but I do realize this is a security risk -- because the articles are created by us...
2010/07/24
[ "https://Stackoverflow.com/questions/3324926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/283055/" ]
If you set the `Content-Type` to `application/json` then **NO Browser** will execute JavaScript on that page. This is apart of [RFC-4627](http://www.ietf.org/rfc/rfc4627), and Google uses this to protect them selves. Other `Application/` Content types follow similar rules. You still have to worry about [DOM Based XSS...
For outputting safe html from php, I recommend <http://htmlpurifier.org/>
3,324,926
I am thinking of secure ways to serve HTML and JSON to JavaScript. Currently I am just outputting the JSON like: > > > ``` > ajax.php?type=article&id=15 > > ``` > > ``` { "name": "something", "content": "some content" } ``` but I do realize this is a security risk -- because the articles are created by us...
2010/07/24
[ "https://Stackoverflow.com/questions/3324926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/283055/" ]
Instead of worrying about how you could encode the malicious code when you return it, you should probably take care that it does not even get into your database. A quick [google search](http://www.google.com/search?num=50&hl=en&q=how+to+prevent+cross+site+scripting&aq=f&aqi=&aql=&oq=&gs_rfai=) about preventing cross-si...
For outputting safe html from php, I recommend <http://htmlpurifier.org/>
3,324,926
I am thinking of secure ways to serve HTML and JSON to JavaScript. Currently I am just outputting the JSON like: > > > ``` > ajax.php?type=article&id=15 > > ``` > > ``` { "name": "something", "content": "some content" } ``` but I do realize this is a security risk -- because the articles are created by us...
2010/07/24
[ "https://Stackoverflow.com/questions/3324926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/283055/" ]
Instead of worrying about how you could encode the malicious code when you return it, you should probably take care that it does not even get into your database. A quick [google search](http://www.google.com/search?num=50&hl=en&q=how+to+prevent+cross+site+scripting&aq=f&aqi=&aql=&oq=&gs_rfai=) about preventing cross-si...
If the user has to be logged in to view the web page then secure the ajax.php with the same authorization mechanism. Then a client that's not logged in cannot access ajax.php directly to retrieve the data.
3,324,926
I am thinking of secure ways to serve HTML and JSON to JavaScript. Currently I am just outputting the JSON like: > > > ``` > ajax.php?type=article&id=15 > > ``` > > ``` { "name": "something", "content": "some content" } ``` but I do realize this is a security risk -- because the articles are created by us...
2010/07/24
[ "https://Stackoverflow.com/questions/3324926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/283055/" ]
If the user has to be logged in to view the web page then secure the ajax.php with the same authorization mechanism. Then a client that's not logged in cannot access ajax.php directly to retrieve the data.
For outputting safe html from php, I recommend <http://htmlpurifier.org/>
3,324,926
I am thinking of secure ways to serve HTML and JSON to JavaScript. Currently I am just outputting the JSON like: > > > ``` > ajax.php?type=article&id=15 > > ``` > > ``` { "name": "something", "content": "some content" } ``` but I do realize this is a security risk -- because the articles are created by us...
2010/07/24
[ "https://Stackoverflow.com/questions/3324926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/283055/" ]
If you set the `Content-Type` to `application/json` then **NO Browser** will execute JavaScript on that page. This is apart of [RFC-4627](http://www.ietf.org/rfc/rfc4627), and Google uses this to protect them selves. Other `Application/` Content types follow similar rules. You still have to worry about [DOM Based XSS...
Insertion of script tags (or SQL) is only a problem if you fail to ensure it isn't at the point that it *could* be a problem. A `<script>` tag in the middle of a comment that somebody submits will not hurt your server and it won't hurt your database. What it *would* hurt, if you fail to take appropriate measures, woul...
3,324,926
I am thinking of secure ways to serve HTML and JSON to JavaScript. Currently I am just outputting the JSON like: > > > ``` > ajax.php?type=article&id=15 > > ``` > > ``` { "name": "something", "content": "some content" } ``` but I do realize this is a security risk -- because the articles are created by us...
2010/07/24
[ "https://Stackoverflow.com/questions/3324926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/283055/" ]
Instead of worrying about how you could encode the malicious code when you return it, you should probably take care that it does not even get into your database. A quick [google search](http://www.google.com/search?num=50&hl=en&q=how+to+prevent+cross+site+scripting&aq=f&aqi=&aql=&oq=&gs_rfai=) about preventing cross-si...
I don't think your question is about validating user input, as others pointed out. You don't want to provide your JSON api to other people... right? If this is the case then there isn't much you can do... in fact, even if you were serving HTML instead of JSON, people would still be doing HTML scraping to get what they...
3,324,926
I am thinking of secure ways to serve HTML and JSON to JavaScript. Currently I am just outputting the JSON like: > > > ``` > ajax.php?type=article&id=15 > > ``` > > ``` { "name": "something", "content": "some content" } ``` but I do realize this is a security risk -- because the articles are created by us...
2010/07/24
[ "https://Stackoverflow.com/questions/3324926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/283055/" ]
If you set the `Content-Type` to `application/json` then **NO Browser** will execute JavaScript on that page. This is apart of [RFC-4627](http://www.ietf.org/rfc/rfc4627), and Google uses this to protect them selves. Other `Application/` Content types follow similar rules. You still have to worry about [DOM Based XSS...
Instead of worrying about how you could encode the malicious code when you return it, you should probably take care that it does not even get into your database. A quick [google search](http://www.google.com/search?num=50&hl=en&q=how+to+prevent+cross+site+scripting&aq=f&aqi=&aql=&oq=&gs_rfai=) about preventing cross-si...
3,324,926
I am thinking of secure ways to serve HTML and JSON to JavaScript. Currently I am just outputting the JSON like: > > > ``` > ajax.php?type=article&id=15 > > ``` > > ``` { "name": "something", "content": "some content" } ``` but I do realize this is a security risk -- because the articles are created by us...
2010/07/24
[ "https://Stackoverflow.com/questions/3324926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/283055/" ]
If the user has to be logged in to view the web page then secure the ajax.php with the same authorization mechanism. Then a client that's not logged in cannot access ajax.php directly to retrieve the data.
I don't think your question is about validating user input, as others pointed out. You don't want to provide your JSON api to other people... right? If this is the case then there isn't much you can do... in fact, even if you were serving HTML instead of JSON, people would still be doing HTML scraping to get what they...
3,324,926
I am thinking of secure ways to serve HTML and JSON to JavaScript. Currently I am just outputting the JSON like: > > > ``` > ajax.php?type=article&id=15 > > ``` > > ``` { "name": "something", "content": "some content" } ``` but I do realize this is a security risk -- because the articles are created by us...
2010/07/24
[ "https://Stackoverflow.com/questions/3324926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/283055/" ]
If you set the `Content-Type` to `application/json` then **NO Browser** will execute JavaScript on that page. This is apart of [RFC-4627](http://www.ietf.org/rfc/rfc4627), and Google uses this to protect them selves. Other `Application/` Content types follow similar rules. You still have to worry about [DOM Based XSS...
If the user has to be logged in to view the web page then secure the ajax.php with the same authorization mechanism. Then a client that's not logged in cannot access ajax.php directly to retrieve the data.
3,324,926
I am thinking of secure ways to serve HTML and JSON to JavaScript. Currently I am just outputting the JSON like: > > > ``` > ajax.php?type=article&id=15 > > ``` > > ``` { "name": "something", "content": "some content" } ``` but I do realize this is a security risk -- because the articles are created by us...
2010/07/24
[ "https://Stackoverflow.com/questions/3324926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/283055/" ]
Instead of worrying about how you could encode the malicious code when you return it, you should probably take care that it does not even get into your database. A quick [google search](http://www.google.com/search?num=50&hl=en&q=how+to+prevent+cross+site+scripting&aq=f&aqi=&aql=&oq=&gs_rfai=) about preventing cross-si...
Insertion of script tags (or SQL) is only a problem if you fail to ensure it isn't at the point that it *could* be a problem. A `<script>` tag in the middle of a comment that somebody submits will not hurt your server and it won't hurt your database. What it *would* hurt, if you fail to take appropriate measures, woul...
69,009,736
I have an array of objects as below ``` let arr = [ { name: "string 1", details: [ { id: 1, values: [ { date: "12-Mar", score: "15" }, { date: "13-Mar", score: "16" }, { date: "14-Mar", score: "17" }, { date: "15-Mar", score: "18" }, ], ...
2021/09/01
[ "https://Stackoverflow.com/questions/69009736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11232091/" ]
Working version: ``` declare p_owner_name all_tables.owner%type := 'ODS03'; p_table_name all_tables.table_name%type := 'ODS_SALES'; v_size_mb number(8,1); v_pk_columns varchar2(1000); v_index_cnt number; v_row_cnt_sql varchar2(1000) := 'select count(*) from ' || p_owner_name||'....
Your approach in not optimal. You can not use *static SQL* to select from parametrized table, but you can use static SQL to select from the database metadata for any table. One possible approach is to define a *view* that selects the dictionary data (this is not necessary, but will keep your procedure simpler). ``` c...
2,076,288
I wanted to check whether my proof was correct and thorough since my book offers a different solution. > > Let $V, W$ be vector spaces, and $F: V \to W$ a linear map. Let $w\_1, ..., w\_n$ be elements of $W$ which are linearly independent, and let $v\_1, ..., v\_n$ be elements of $V$ such that $F(v\_i) = w\_i$ for $i...
2016/12/29
[ "https://math.stackexchange.com/questions/2076288", "https://math.stackexchange.com", "https://math.stackexchange.com/users/375000/" ]
By contradiction if the $v\_i$'s are linearly dependent then there are $t\_1,\ldots,t\_n$ not all $0$ such that $\sum\_{i=1}^n t\_iv\_i=0$ and if we apply $F$ we find that $\sum\_{i=1}^n t\_iw\_i=0$ which means that the $w\_i$'s are linearly dependent and this contradicts the hypothesis.
I think you're on the right track, but it's not enough to consider just three elements of $V$. Instead, suppose that there are scalars $c\_1,\dots,c\_n$ such that $c\_1v\_1+\dots+c\_nv\_n=0$. What happens when you apply $F$ to this equation, and what does this tell you about the $c\_i$?
2,076,288
I wanted to check whether my proof was correct and thorough since my book offers a different solution. > > Let $V, W$ be vector spaces, and $F: V \to W$ a linear map. Let $w\_1, ..., w\_n$ be elements of $W$ which are linearly independent, and let $v\_1, ..., v\_n$ be elements of $V$ such that $F(v\_i) = w\_i$ for $i...
2016/12/29
[ "https://math.stackexchange.com/questions/2076288", "https://math.stackexchange.com", "https://math.stackexchange.com/users/375000/" ]
By contradiction if the $v\_i$'s are linearly dependent then there are $t\_1,\ldots,t\_n$ not all $0$ such that $\sum\_{i=1}^n t\_iv\_i=0$ and if we apply $F$ we find that $\sum\_{i=1}^n t\_iw\_i=0$ which means that the $w\_i$'s are linearly dependent and this contradicts the hypothesis.
It is not enough to consider linear combinations of only two vectors. For example, the vectors $$ v\_1 = (1,0,0), v\_2 = (0,1,0), v\_3 = (0,0,1), v\_4 = (1,2,3) $$ are linearly dependent, but there are no scalars or vectors for which $tv\_a + kv\_b = v\_c$ Instead, we use the general definition of linear dependence, n...
2,076,288
I wanted to check whether my proof was correct and thorough since my book offers a different solution. > > Let $V, W$ be vector spaces, and $F: V \to W$ a linear map. Let $w\_1, ..., w\_n$ be elements of $W$ which are linearly independent, and let $v\_1, ..., v\_n$ be elements of $V$ such that $F(v\_i) = w\_i$ for $i...
2016/12/29
[ "https://math.stackexchange.com/questions/2076288", "https://math.stackexchange.com", "https://math.stackexchange.com/users/375000/" ]
By contradiction if the $v\_i$'s are linearly dependent then there are $t\_1,\ldots,t\_n$ not all $0$ such that $\sum\_{i=1}^n t\_iv\_i=0$ and if we apply $F$ we find that $\sum\_{i=1}^n t\_iw\_i=0$ which means that the $w\_i$'s are linearly dependent and this contradicts the hypothesis.
Suppose $\alpha\_1v\_1+\alpha\_2v\_2+\dots + \alpha v\_n=0$, then $T(\alpha\_1v\_1+\alpha\_2v\_2+\dots + \alpha v\_n)=\alpha\_1w\_1+\alpha\_2w\_2+\dots+ \alpha w\_n=0$. So $\alpha\_1=\alpha\_2=\dots = \alpha\_n=0$, since the $w\_i$ are L.I.
57,861,775
I am looking to query an Orders database to show which customers switched subscriptions from a high-cost subscription to a low cost subscription. Each month, the subscriptions get billed and a new record gets created. What I'm looking for is something like this but for all clients where they have purchased both AAAA...
2019/09/09
[ "https://Stackoverflow.com/questions/57861775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9968553/" ]
Unable to solve the Custom Painter rendering issue, I ended up using a different approach. I simply render the masked png on a separate canvas, export a ui.Image and draw it using the custom painter. Thins enables me to use BlendMode.srcIn and keep transparency. You can read more about it on this [blog post](https://co...
Without custom painter, you can get expected result by using ShaderMask and ImageShader. [This video](https://www.youtube.com/watch?v=7sUL66pTQ7Q) and [my repository](https://github.com/ryoheinagao/flutter-image-blend) will help you.
73,129,304
Given an unsorted array of size n, write a program to find number of elements between two user-defined elements a and b (where a and b both are inclusive) of a user-defined array. Input : arr = [1, 2, 2, 7, 5, 4] a=2 b=5 Output : 4 Here is my code. What is wrong with this code. Can you please explain me my mistake and...
2022/07/26
[ "https://Stackoverflow.com/questions/73129304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17869699/" ]
Think about the challenge. Rather than trying to count, simply find the index of each target and calculate the difference between them. ``` int loInd = -1, hiInd = -1; for( i = 0; i < n; i++ ) { if( a[ i ] == m && loInd < 0 ) loInd = i; if( a[ i ] == b ) hiInd = i; } if( loInd >= 0 && hiInd ...
There is no error in the logic, but you'd better use `else if` to make the logic judgment only execute once. Or just judge the case where no count is needed. ``` for (i = 0; i < n; i++) { if (a[i] < m || a[i] > b) { continue; } count++; } ```
73,129,304
Given an unsorted array of size n, write a program to find number of elements between two user-defined elements a and b (where a and b both are inclusive) of a user-defined array. Input : arr = [1, 2, 2, 7, 5, 4] a=2 b=5 Output : 4 Here is my code. What is wrong with this code. Can you please explain me my mistake and...
2022/07/26
[ "https://Stackoverflow.com/questions/73129304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17869699/" ]
``` for(i=0;i<n;i++) { if(a[i]==m || a[i]==b) { count++; } if(a[i]>m && a[i]<b) { count++; } } ``` The logic of this part of code is to count the array element whose VALUE is between a and b. But i guess the subject is to count ele...
There is no error in the logic, but you'd better use `else if` to make the logic judgment only execute once. Or just judge the case where no count is needed. ``` for (i = 0; i < n; i++) { if (a[i] < m || a[i] > b) { continue; } count++; } ```
3,957,294
Some years ago I built an Excel file for my colleagues that displays lots of data from an external ODBC data source. The data is partitioned into lots of data tables in different sheets. The file also contains a button that allows the user to update the data. Since accessing the data from the external source was very ...
2010/10/18
[ "https://Stackoverflow.com/questions/3957294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21038/" ]
LLVM compiles the source without complaints, switch to LLVM: Select target → Get Info → Build → C/C++ Compiler Version → LLVM 1.5. From my limited experience it’s a better compiler anyway. No idea why GCC behaves the way it does – interesting catch.
The testIvar undeclared error is actually red herring in this case. This message seems to be caused by testProperty not having a corresponding ivar. To resolve the issue either declare a testProperty ivar in TestSubClass.h or make testProperty @dynamic in TestSubClass.m.
19,655,256
I'd like to create an attribute to change the content of the property. ``` [CleanContent] public string address {get;set;} address = "hello world "; address would change to "hello world" ``` I've used ValidationAttribute, anyone know if I can get Attributes can do this?
2013/10/29
[ "https://Stackoverflow.com/questions/19655256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58309/" ]
Attributes aren't "active" - they are just metadata, and don't do anything unless some calling framework checks for them via reflection and then deliberately does something like invoking a method on them. So no, you can't do this. Caveat: IL-rewriting tools like post-sharp also use attributes, but they behave in a ver...
You could use attributes to mark what properties you want to clean, but they won't clean it themselves, you need something to call them. Below is a question closely related to what you are asking, and it provides a few ideas: [Trim all string properties](https://stackoverflow.com/questions/7726714/trim-all-string-pro...
19,751,429
I have successfully done up a shortest path algorithm for a maze (see code below). However, I want to store the coordinates of the shortest path into the Stack parameter that is passed into my function. Could someone please advise me on how I could achieve this? Here is the maze that I am working on: Legend: 1: Wall, ...
2013/11/03
[ "https://Stackoverflow.com/questions/19751429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2349125/" ]
There is something fundamentally wrong with your approach: you compute **all** possible paths through the maze and then pick the shortest one. Try to change your input map to ``` String[][] map = new String[][] { new String[] { "s", "0", "0", "0", "0", "0", "0", "0", "0", "0" }, new String[] { "0", "0", "0", "...
You can create a new class `Coordinate` with two fields X and Y where you can store the location of the cell. Then, you can pass a list of `Coordinate`s as a parameter to your function. That is not the most efficient way though. For better performance, you use a matrix of predecessors. In such a matrix you keep the in...
33,804,245
I'm doing the screen onboarding for an app. I did a lot of tests to adapt the three main elements (title, image and description) for all sizes (from iPhone 4 to iPhone 6 Plus), but in the end I gave up and I set the items for the iPhone 4. The result as you can see, all right on the iPhone 4 but going to climb on large...
2015/11/19
[ "https://Stackoverflow.com/questions/33804245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745855/" ]
Hey i have added your sample project to a git repo and i have changed the constraints in such a way that whatever you needed to be in higher end devices for the screen. Take deep look at that and you can get idea to design any kind of screen with dynamic gaping and dynamic sizing without using size class. I am using pr...
Set the proportional width constraint with SuperView. [![enter image description here](https://i.stack.imgur.com/bz1uh.png)](https://i.stack.imgur.com/bz1uh.png) [![enter image description here](https://i.stack.imgur.com/gc3Wg.png)](https://i.stack.imgur.com/gc3Wg.png)
38,739,794
I have a PopupMenu in my Application which pops up when a user right clicks on my App's Notification Area icon. When I right click on this icon, pop up the menu, and do nothing, my App behaves like resuming its work because it looks like it is waiting until I click on a Menu Item. I want to remove this behavior. I t...
2016/08/03
[ "https://Stackoverflow.com/questions/38739794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6536104/" ]
A standard popup menu is not supposed to auto-close when the user moves the mouse outside of it. The user is meant to click somewhere to dismiss it. If you really want to auto-close a popup menu when the mouse moves outside of it, you have to manually implement your own tracking to know when the mouse is outside of th...
Try like this: ``` ..... hPopupWnd := FindWindow('#32768', SystemTrayPopUpMenu); if hPopupWnd = 0 then Exit; ..... GetWindowRect(SystemTrayPopUpMenu.Handle, R); ```
607,767
What experimental evidence do we have that leptons (electrons, muons, tau leptons, neutrinos) create—rather than merely respond to—a gravitational field? General relativity (GR) predicts that all forms of mass-energy gravitate, that is, generate a curvature of spacetime proportional to their associated energy-momentum...
2021/01/15
[ "https://physics.stackexchange.com/questions/607767", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/241077/" ]
General relativity in its classical formulation does not use the language or mathematics of fields, having substituted the curvature induced by the stress energy tensor. So the title : > > What is the experimental evidence for creation of a gravitational field by electrons or other leptons? > > > is not involved ...
There is no distinction between active and passive mass in mainstream physics. In Newton physics masses interact by $E= -G m\_1 m\_2 /r$. Which of the two masses should be the active and which the passive? Therefore the answer is that measuring the electronic contribution to weight is enough to establish that electrons...
607,767
What experimental evidence do we have that leptons (electrons, muons, tau leptons, neutrinos) create—rather than merely respond to—a gravitational field? General relativity (GR) predicts that all forms of mass-energy gravitate, that is, generate a curvature of spacetime proportional to their associated energy-momentum...
2021/01/15
[ "https://physics.stackexchange.com/questions/607767", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/241077/" ]
First of all we should keep in mind that in order to quantify possible deviations from established theory of general relativity we must work in a wider frameworks that potentially allow e.g. deviations from momentum conservation and make distinction between passive and active gravitational and inertial masses. For a g...
General relativity in its classical formulation does not use the language or mathematics of fields, having substituted the curvature induced by the stress energy tensor. So the title : > > What is the experimental evidence for creation of a gravitational field by electrons or other leptons? > > > is not involved ...
607,767
What experimental evidence do we have that leptons (electrons, muons, tau leptons, neutrinos) create—rather than merely respond to—a gravitational field? General relativity (GR) predicts that all forms of mass-energy gravitate, that is, generate a curvature of spacetime proportional to their associated energy-momentum...
2021/01/15
[ "https://physics.stackexchange.com/questions/607767", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/241077/" ]
The theory which identifies inertial and gravitational masses, General Relativity, has a great deal of experimental support. Mass is just a curvature of spacetime, with both gravity and inertia arising from this fact. If you were to describe a particle which responds to curvature but produces none itself, then it would...
General relativity in its classical formulation does not use the language or mathematics of fields, having substituted the curvature induced by the stress energy tensor. So the title : > > What is the experimental evidence for creation of a gravitational field by electrons or other leptons? > > > is not involved ...
607,767
What experimental evidence do we have that leptons (electrons, muons, tau leptons, neutrinos) create—rather than merely respond to—a gravitational field? General relativity (GR) predicts that all forms of mass-energy gravitate, that is, generate a curvature of spacetime proportional to their associated energy-momentum...
2021/01/15
[ "https://physics.stackexchange.com/questions/607767", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/241077/" ]
First of all we should keep in mind that in order to quantify possible deviations from established theory of general relativity we must work in a wider frameworks that potentially allow e.g. deviations from momentum conservation and make distinction between passive and active gravitational and inertial masses. For a g...
There is no distinction between active and passive mass in mainstream physics. In Newton physics masses interact by $E= -G m\_1 m\_2 /r$. Which of the two masses should be the active and which the passive? Therefore the answer is that measuring the electronic contribution to weight is enough to establish that electrons...
607,767
What experimental evidence do we have that leptons (electrons, muons, tau leptons, neutrinos) create—rather than merely respond to—a gravitational field? General relativity (GR) predicts that all forms of mass-energy gravitate, that is, generate a curvature of spacetime proportional to their associated energy-momentum...
2021/01/15
[ "https://physics.stackexchange.com/questions/607767", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/241077/" ]
The theory which identifies inertial and gravitational masses, General Relativity, has a great deal of experimental support. Mass is just a curvature of spacetime, with both gravity and inertia arising from this fact. If you were to describe a particle which responds to curvature but produces none itself, then it would...
There is no distinction between active and passive mass in mainstream physics. In Newton physics masses interact by $E= -G m\_1 m\_2 /r$. Which of the two masses should be the active and which the passive? Therefore the answer is that measuring the electronic contribution to weight is enough to establish that electrons...
607,767
What experimental evidence do we have that leptons (electrons, muons, tau leptons, neutrinos) create—rather than merely respond to—a gravitational field? General relativity (GR) predicts that all forms of mass-energy gravitate, that is, generate a curvature of spacetime proportional to their associated energy-momentum...
2021/01/15
[ "https://physics.stackexchange.com/questions/607767", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/241077/" ]
First of all we should keep in mind that in order to quantify possible deviations from established theory of general relativity we must work in a wider frameworks that potentially allow e.g. deviations from momentum conservation and make distinction between passive and active gravitational and inertial masses. For a g...
The theory which identifies inertial and gravitational masses, General Relativity, has a great deal of experimental support. Mass is just a curvature of spacetime, with both gravity and inertia arising from this fact. If you were to describe a particle which responds to curvature but produces none itself, then it would...
28,114,250
I have a big data file consist of blocks of xy data, blocks are separated by a blank line. now I want to change all x to a set of sequential number, and start from 1 for next block. number of rows within each block could be different. input: ``` 165168 14653 5131655 51365 155615 1356 13651625 13651 12 51 ...
2015/01/23
[ "https://Stackoverflow.com/questions/28114250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4487367/" ]
I would use: ``` $ awk '!NF{i=0; print; next} {print ++i, $2}' file 1 14653 2 51365 3 1356 1 13651 2 51 3 51656 1 64 2 546546 ``` ### Explanation It is a matter of keeping a counter `i` and resetting it appropriately. * `!NF{i=0; print; next}` if there are no fields, that is, if the line is empty, print an empty...
Maybe even ``` awk '!NF { n=NR } NF { $1=NR-n } 1' file ``` So on an empty line, we set `n` to the current line number. On nonempty lines, we change the first field to the current line number minus `n`. Print all lines.
54,214
Is this a strange sentence? > > Z have been supporting and are still supporting the current uk dates for X. > > > "Have been supporting" is present perfect continuous that means the action is still going on , so there is no need to add "are still supporting". Or maybe the action stopped recently, started again af...
2015/04/06
[ "https://ell.stackexchange.com/questions/54214", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/5577/" ]
The usage is not unusual. Despite there technically being a degree of redundancy in the meaning, people would read it and know what it meant without feeling that it was in any way forced or unusual. On reflection it is likely that the writer has written in this way to ensure that there is no doubt either re wht th...
Z have been supporting and are still supporting the current uk dates for X. We usually use the present perfect continuous for an action over a period of time leading up to the present time - the action is still ongoing. Besides, we can also use it to talk about an action which ends just before the present. For exampl...
724,027
Can I use Ubuntu server with a Raspberry Pi 2? I plan to use it as a headless web server. How can I install Ubuntu server on the sd card?
2016/01/22
[ "https://askubuntu.com/questions/724027", "https://askubuntu.com", "https://askubuntu.com/users/-1/" ]
This command has now changed in recent versions of snappy to the following:- ``` sudo snap install classic --devmode --edge ``` Followed by the following to enter classic mode:- ``` sudo classic ```
You need to be running all-snaps 16.04 Ubuntu Core, images found here: <http://people.canonical.com/~mvo/all-snaps/> . Then that command will work :) . Soon that will become the 16.04 version of Ubuntu Core.
724,027
Can I use Ubuntu server with a Raspberry Pi 2? I plan to use it as a headless web server. How can I install Ubuntu server on the sd card?
2016/01/22
[ "https://askubuntu.com/questions/724027", "https://askubuntu.com", "https://askubuntu.com/users/-1/" ]
You need to be running all-snaps 16.04 Ubuntu Core, images found here: <http://people.canonical.com/~mvo/all-snaps/> . Then that command will work :) . Soon that will become the 16.04 version of Ubuntu Core.
For Ubuntu core 18: ``` sudo snap install --channel=18/edge classic --devmode ``` In my case, it complained about my user not existing so I did: ``` sudo SUDO_USER=root classic ```
724,027
Can I use Ubuntu server with a Raspberry Pi 2? I plan to use it as a headless web server. How can I install Ubuntu server on the sd card?
2016/01/22
[ "https://askubuntu.com/questions/724027", "https://askubuntu.com", "https://askubuntu.com/users/-1/" ]
This command has now changed in recent versions of snappy to the following:- ``` sudo snap install classic --devmode --edge ``` Followed by the following to enter classic mode:- ``` sudo classic ```
For Ubuntu core 18: ``` sudo snap install --channel=18/edge classic --devmode ``` In my case, it complained about my user not existing so I did: ``` sudo SUDO_USER=root classic ```
50,377,171
I have to make a "Scroll to top" button, and I have already written the HTML, CSS, and the main script. HTML ``` <a href="#" class="scrollup">Наверх</a> ``` jQuery ``` $(document).ready(function(){ $(window).scroll(function(){ if ($(this).scrollTop() > 100) { $('.scrollup').fadeIn(); ...
2018/05/16
[ "https://Stackoverflow.com/questions/50377171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9678367/" ]
> > Make sure this code does not conflict with any script then > > > Try to the following ``` if ($(this).scrollTop() != 0) ``` instead of ``` if ($(this).scrollTop() > 100) ``` See this ``` $(document).ready(function(){ $(window).scroll(function () { if ($(this).scrollTop() != 0) { ...
You need to include jquery first and later you can call its functions. ```html <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script> $(document).ready(function() { $(window).scroll(function() { if ($(this).scrollTop() > 100) { $('.scrollup').fadeIn(); }...
36,242,345
The Problem ----------- When running custom cookbooks on AWS OpsWorks a `setup_failed` status appears against the instance and the following in the failure log: ``` [2016-03-26T22:53:48+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /var/chef One version per cookbook data_bags at /var/...
2016/03/27
[ "https://Stackoverflow.com/questions/36242345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/865148/" ]
I'm pretty sure this is how you are supposed to do it now. They removed a bunch of the automated berks integration between the Chef 11 and Chef 12 stacks for reasons I've never understood.
Here is the answer for this above matter. check your metadatatab.rb file and check your version of chef, my case it should be 12.0 or upper. second before execute your customcookbooks, update it and run the execute. once you run the updatecookbook check /var/chef/cookbook folder and check your files is there or not....
36,242,345
The Problem ----------- When running custom cookbooks on AWS OpsWorks a `setup_failed` status appears against the instance and the following in the failure log: ``` [2016-03-26T22:53:48+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /var/chef One version per cookbook data_bags at /var/...
2016/03/27
[ "https://Stackoverflow.com/questions/36242345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/865148/" ]
I have the same issue. It looks like it is supposed to use `berk pack` with s3 storage, but (as to me) it adds a other level of complexity (and is useful only with CI tools, where cookbook archive created by berkshelf would be convenient 'artifact'): > > In Chef 12 Linux, Berkshelf is no longer installed on stack ins...
Here is the answer for this above matter. check your metadatatab.rb file and check your version of chef, my case it should be 12.0 or upper. second before execute your customcookbooks, update it and run the execute. once you run the updatecookbook check /var/chef/cookbook folder and check your files is there or not....
33,878,121
I've been given a class called PhysicsVector that deals with vector addition etc, which must be fine as it was written by my professor. My GravField class calculates good estimates of g so I don't think that's the problem. No curls brackets missing, no loops outside methods. But it still gives 'illegal start of type'...
2015/11/23
[ "https://Stackoverflow.com/questions/33878121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5574107/" ]
This worked for me. ``` svg { pointer-events: none; } path{ pointer-events: auto; } ``` Then we can add on click event on path. worked!! thanks
I had similar problem with react, I was trying to handle onclick event for svg. Simple css solved problem for me: ``` svg { pointer-events: none; } ```
33,878,121
I've been given a class called PhysicsVector that deals with vector addition etc, which must be fine as it was written by my professor. My GravField class calculates good estimates of g so I don't think that's the problem. No curls brackets missing, no loops outside methods. But it still gives 'illegal start of type'...
2015/11/23
[ "https://Stackoverflow.com/questions/33878121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5574107/" ]
I did it this way: Just using `polyline` for example, it could be any SVG element. ``` export default class Polyline extends React.Component { componentDidMount() { this.polyline.addEventListener('click', this.props.onClick); } componentWillUnmount(){ this.polyline.removeEventListener('c...
You can use `onClick` as you do with other DOM elements.
33,878,121
I've been given a class called PhysicsVector that deals with vector addition etc, which must be fine as it was written by my professor. My GravField class calculates good estimates of g so I don't think that's the problem. No curls brackets missing, no loops outside methods. But it still gives 'illegal start of type'...
2015/11/23
[ "https://Stackoverflow.com/questions/33878121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5574107/" ]
I did it this way: Just using `polyline` for example, it could be any SVG element. ``` export default class Polyline extends React.Component { componentDidMount() { this.polyline.addEventListener('click', this.props.onClick); } componentWillUnmount(){ this.polyline.removeEventListener('c...
Two major ways to do this: 1. You put an HTML event listener on the 'path' tag in the svg code. You will have to escape your code properly if you choose this method. The following example features a star shape cut in two paths each of which logs "Hello" in the console ( console.log("Hello") ) Example: ``` <?xml versi...
33,878,121
I've been given a class called PhysicsVector that deals with vector addition etc, which must be fine as it was written by my professor. My GravField class calculates good estimates of g so I don't think that's the problem. No curls brackets missing, no loops outside methods. But it still gives 'illegal start of type'...
2015/11/23
[ "https://Stackoverflow.com/questions/33878121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5574107/" ]
This worked for me. ``` svg { pointer-events: none; } path{ pointer-events: auto; } ``` Then we can add on click event on path. worked!! thanks
You can use `onClick` as you do with other DOM elements.
33,878,121
I've been given a class called PhysicsVector that deals with vector addition etc, which must be fine as it was written by my professor. My GravField class calculates good estimates of g so I don't think that's the problem. No curls brackets missing, no loops outside methods. But it still gives 'illegal start of type'...
2015/11/23
[ "https://Stackoverflow.com/questions/33878121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5574107/" ]
I did it this way: Just using `polyline` for example, it could be any SVG element. ``` export default class Polyline extends React.Component { componentDidMount() { this.polyline.addEventListener('click', this.props.onClick); } componentWillUnmount(){ this.polyline.removeEventListener('c...
I had similar problem with react, I was trying to handle onclick event for svg. Simple css solved problem for me: ``` svg { pointer-events: none; } ```
33,878,121
I've been given a class called PhysicsVector that deals with vector addition etc, which must be fine as it was written by my professor. My GravField class calculates good estimates of g so I don't think that's the problem. No curls brackets missing, no loops outside methods. But it still gives 'illegal start of type'...
2015/11/23
[ "https://Stackoverflow.com/questions/33878121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5574107/" ]
This worked for me. ``` svg { pointer-events: none; } path{ pointer-events: auto; } ``` Then we can add on click event on path. worked!! thanks
I did it this way: Just using `polyline` for example, it could be any SVG element. ``` export default class Polyline extends React.Component { componentDidMount() { this.polyline.addEventListener('click', this.props.onClick); } componentWillUnmount(){ this.polyline.removeEventListener('c...
33,878,121
I've been given a class called PhysicsVector that deals with vector addition etc, which must be fine as it was written by my professor. My GravField class calculates good estimates of g so I don't think that's the problem. No curls brackets missing, no loops outside methods. But it still gives 'illegal start of type'...
2015/11/23
[ "https://Stackoverflow.com/questions/33878121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5574107/" ]
I wrap my SVG with a div and apply any attributes that I desire (click handlers, fill colors, classes, width, etc..), [like so](https://jsfiddle.net/69z2wepo/78043/) (fiddle link): ``` import React, { PropTypes } from 'react' function XMark({ width, height, fill, onClick }) { return ( <div className="xmar...
You can use `onClick` as you do with other DOM elements.
33,878,121
I've been given a class called PhysicsVector that deals with vector addition etc, which must be fine as it was written by my professor. My GravField class calculates good estimates of g so I don't think that's the problem. No curls brackets missing, no loops outside methods. But it still gives 'illegal start of type'...
2015/11/23
[ "https://Stackoverflow.com/questions/33878121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5574107/" ]
This worked for me. ``` svg { pointer-events: none; } path{ pointer-events: auto; } ``` Then we can add on click event on path. worked!! thanks
Two major ways to do this: 1. You put an HTML event listener on the 'path' tag in the svg code. You will have to escape your code properly if you choose this method. The following example features a star shape cut in two paths each of which logs "Hello" in the console ( console.log("Hello") ) Example: ``` <?xml versi...
33,878,121
I've been given a class called PhysicsVector that deals with vector addition etc, which must be fine as it was written by my professor. My GravField class calculates good estimates of g so I don't think that's the problem. No curls brackets missing, no loops outside methods. But it still gives 'illegal start of type'...
2015/11/23
[ "https://Stackoverflow.com/questions/33878121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5574107/" ]
I wrap my SVG with a div and apply any attributes that I desire (click handlers, fill colors, classes, width, etc..), [like so](https://jsfiddle.net/69z2wepo/78043/) (fiddle link): ``` import React, { PropTypes } from 'react' function XMark({ width, height, fill, onClick }) { return ( <div className="xmar...
I did it this way: Just using `polyline` for example, it could be any SVG element. ``` export default class Polyline extends React.Component { componentDidMount() { this.polyline.addEventListener('click', this.props.onClick); } componentWillUnmount(){ this.polyline.removeEventListener('c...
33,878,121
I've been given a class called PhysicsVector that deals with vector addition etc, which must be fine as it was written by my professor. My GravField class calculates good estimates of g so I don't think that's the problem. No curls brackets missing, no loops outside methods. But it still gives 'illegal start of type'...
2015/11/23
[ "https://Stackoverflow.com/questions/33878121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5574107/" ]
I wrap my SVG with a div and apply any attributes that I desire (click handlers, fill colors, classes, width, etc..), [like so](https://jsfiddle.net/69z2wepo/78043/) (fiddle link): ``` import React, { PropTypes } from 'react' function XMark({ width, height, fill, onClick }) { return ( <div className="xmar...
Two major ways to do this: 1. You put an HTML event listener on the 'path' tag in the svg code. You will have to escape your code properly if you choose this method. The following example features a star shape cut in two paths each of which logs "Hello" in the console ( console.log("Hello") ) Example: ``` <?xml versi...
23,367,344
I want my macro to run automatically when Sheet1 is open AND a value is changed in any of the drop down menus in Column B. I assume I can write a couple of event listener wrappers such as: ``` ' pseudocode While Sheet1 is open When a dropdown value is changed in column B Call Update End...
2014/04/29
[ "https://Stackoverflow.com/questions/23367344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2168400/" ]
You can use a worksheet event macro: ``` Private Sub Worksheet_Change(ByVal Target As Range) Dim rB As Range Set rB = Range("B:B").Cells.SpecialCells(xlCellTypeAllValidation) If Intersect(Target, rB) Is Nothing Then Else Application.EnableEvents = False Call Update Applicati...
What you are going to need is a Worksheet\_Changed event similar to this: ``` Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Column("B")) Is Nothing Then Application.EnableEvents = False Call Update Application.EnableEvents = True End If End Sub ``` This ...
59,621,083
I have an Postgresql Stored Procedure that receive an input parameter of json type and output parameter of text type, i have an java application that call the stored procedure, but when call it from java obtain this error when call from postman: ``` [stdout] (default task-4) [EL Warning]: 2020-01-06 19:36:19.087--Unit...
2020/01/07
[ "https://Stackoverflow.com/questions/59621083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4868379/" ]
Usually I receive json object as a text inside my postgresql procedure. You can also do like this. Inside procedure you will convert json text to json object and parse it. You should also send json object as string into procedure. Inside procedure you should know json array size as well. ``` CREATE OR REPLACE FUNCTION...
If your function is something like ``` CREATE OR REPLACE FUNCTION public.function_that_takes_json(_iAmAJson json) RETURNS void AS ``` You could use: ``` Query query = em.createNativeQuery(select * from function_that_takes_json(?::json)); query.setParameter(1, your_json_string).getResultList(); ``` If any of the...
94,718
When running an app that is not already defined as a launcher icon under the Dash icon, a new icon always pop up at the bottom of the vertical string of assigned icons. Is it possible to make the newly active icon pop up under the Dash button, so new active program icons are on top and not the bottom of the list?
2012/01/11
[ "https://askubuntu.com/questions/94718", "https://askubuntu.com", "https://askubuntu.com/users/41547/" ]
The launcher gives you keyboard shortcuts to switch between windows. These are dynamic and based on the launcher position. If Nautilus is the first item, for instance, then you can start an instance or switch to an existing instance by pressing super+1. To display all open Nautilus windows, you'd then press super+11. (...
When you do not mind about starting applications with super key shortcuts or the length of your launcher, here is the answer to your question: The `unity://running-apps` position in the list of `com.canonical.Unity.Launcher` gsettings schema does affect where running apps appear, which have no launcher icon. More on ...
4,684,052
``` BitmapImage B = new BitmapImage(); B.BeginInit(); B.StreamSource = asm.GetManifestResourceStream("WpfApplication26.Back1.png"); B.EndInit(); image1.Source = B; ``` The size of the image (Back1.png) is 32\*32, and I set the size of my image control to 32\*32 and set the property "Scale" to "None".
2011/01/13
[ "https://Stackoverflow.com/questions/4684052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572361/" ]
Try ``` RenderOptions.BitmapScalingMode="NearestNeighbor" ``` on the image control in xaml or ``` RenderOptions.SetBitmapScalingMode(image1, BitmapScalingMode.NearestNeighbor) ``` in code.
Try `SnapsToDevicePixels="True"` on the image control.
4,684,052
``` BitmapImage B = new BitmapImage(); B.BeginInit(); B.StreamSource = asm.GetManifestResourceStream("WpfApplication26.Back1.png"); B.EndInit(); image1.Source = B; ``` The size of the image (Back1.png) is 32\*32, and I set the size of my image control to 32\*32 and set the property "Scale" to "None".
2011/01/13
[ "https://Stackoverflow.com/questions/4684052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572361/" ]
Try ``` RenderOptions.BitmapScalingMode="NearestNeighbor" ``` on the image control in xaml or ``` RenderOptions.SetBitmapScalingMode(image1, BitmapScalingMode.NearestNeighbor) ``` in code.
If you still want to clear the image, meaning, turning it to blank, just set the source to "null" ``` image1.Source = null; ``` This does not require a BitmapImage. Sorry for the late reply...
41,639,210
So I have the following C code which asks the user to give a command (valid in unix), and then I have to take the string and split it in an array in order to execute the command that the user gave with execvp(). It compiles but the execvp doesn't seem to work. Is something wrong in the way I split the user's input in a...
2017/01/13
[ "https://Stackoverflow.com/questions/41639210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7159168/" ]
You're calling `strtok(str, " ")` before `str` has any information. Simply call it after you get input: ``` main() { char str[64]; char *array[sizeof(str)]; char *p = NULL; int i = 0; printf("Please give me a Unix command! :\n"); fgets(str, sizeof(str), stdin); // Use fgets instead of gets. p = strto...
The first problem as I see here is with ``` char *p = strtok(str," "); ``` as you're trying to read indeterminate values. `str` is not initialized, there's no guarantee that there is a null-terminator present there which makes this a *string*. So, you're essentially invoking [undefined behavior](https://en.wikipedi...
58,478
I recently liberated an old model B from the loft, put NOOBS on an SD card, and installed the latest version of Raspbian on it. I booted it up, attempted to SSH to it from my Mac, but got: ``` ssh: connect to host 192.168.1.248 port 22: Connection refused ``` I got around this in the first instance by running `sudo ...
2016/12/04
[ "https://raspberrypi.stackexchange.com/questions/58478", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/57629/" ]
Quoting [the documentation](https://www.raspberrypi.org/documentation/remote-access/ssh/): > > As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually. > > > To enable SSH on machines through console: > > Enter `sudo raspi-config` in the terminal, f...
There has recently been a security update for Raspberry Pi. Here is an article from <https://www.raspberrypi.org/blog/a-security-update-for-raspbian-pixel/> From the foundation's article: > > What has changed? > > > First, from now on SSH will be disabled by default on our images. SSH > (Secure SHell) is a networ...
58,478
I recently liberated an old model B from the loft, put NOOBS on an SD card, and installed the latest version of Raspbian on it. I booted it up, attempted to SSH to it from my Mac, but got: ``` ssh: connect to host 192.168.1.248 port 22: Connection refused ``` I got around this in the first instance by running `sudo ...
2016/12/04
[ "https://raspberrypi.stackexchange.com/questions/58478", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/57629/" ]
Quoting [the documentation](https://www.raspberrypi.org/documentation/remote-access/ssh/): > > As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually. > > > To enable SSH on machines through console: > > Enter `sudo raspi-config` in the terminal, f...
Yes, as @tecraf said `ssh` is disabled by default, but the configuration location has changed. To enable SSH on your machine through console: Enter `sudo raspi-config` in the terminal go to `5-Interfacing Options`, then navigate to `P2-ssh`, press Enter and use `tab` to enable or disable `ssh server`. Then `sudo shutd...
58,478
I recently liberated an old model B from the loft, put NOOBS on an SD card, and installed the latest version of Raspbian on it. I booted it up, attempted to SSH to it from my Mac, but got: ``` ssh: connect to host 192.168.1.248 port 22: Connection refused ``` I got around this in the first instance by running `sudo ...
2016/12/04
[ "https://raspberrypi.stackexchange.com/questions/58478", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/57629/" ]
Quoting [the documentation](https://www.raspberrypi.org/documentation/remote-access/ssh/): > > As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually. > > > To enable SSH on machines through console: > > Enter `sudo raspi-config` in the terminal, f...
**`systemctl` solution** If you already have a shell on the Pi through a non-SSH method such as screen + keyboard or UART (see [this post](https://raspberrypi.stackexchange.com/questions/3867/ssh-to-rpi-without-a-network-connection/53823#53823)), you can also just run: ``` sudo systemctl enable ssh sudo service sshd ...
58,478
I recently liberated an old model B from the loft, put NOOBS on an SD card, and installed the latest version of Raspbian on it. I booted it up, attempted to SSH to it from my Mac, but got: ``` ssh: connect to host 192.168.1.248 port 22: Connection refused ``` I got around this in the first instance by running `sudo ...
2016/12/04
[ "https://raspberrypi.stackexchange.com/questions/58478", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/57629/" ]
Quoting [the documentation](https://www.raspberrypi.org/documentation/remote-access/ssh/): > > As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually. > > > To enable SSH on machines through console: > > Enter `sudo raspi-config` in the terminal, f...
I was getting `Permission denied (publickey,password).` It turns out that for headless setups there is now a new step on top of creating the [ssh enabling file](https://www.raspberrypi.com/documentation/computers/remote-access.html#enabling-the-server): you need to setup the [user enabling file](https://www.raspberryp...
58,478
I recently liberated an old model B from the loft, put NOOBS on an SD card, and installed the latest version of Raspbian on it. I booted it up, attempted to SSH to it from my Mac, but got: ``` ssh: connect to host 192.168.1.248 port 22: Connection refused ``` I got around this in the first instance by running `sudo ...
2016/12/04
[ "https://raspberrypi.stackexchange.com/questions/58478", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/57629/" ]
There has recently been a security update for Raspberry Pi. Here is an article from <https://www.raspberrypi.org/blog/a-security-update-for-raspbian-pixel/> From the foundation's article: > > What has changed? > > > First, from now on SSH will be disabled by default on our images. SSH > (Secure SHell) is a networ...
Yes, as @tecraf said `ssh` is disabled by default, but the configuration location has changed. To enable SSH on your machine through console: Enter `sudo raspi-config` in the terminal go to `5-Interfacing Options`, then navigate to `P2-ssh`, press Enter and use `tab` to enable or disable `ssh server`. Then `sudo shutd...
58,478
I recently liberated an old model B from the loft, put NOOBS on an SD card, and installed the latest version of Raspbian on it. I booted it up, attempted to SSH to it from my Mac, but got: ``` ssh: connect to host 192.168.1.248 port 22: Connection refused ``` I got around this in the first instance by running `sudo ...
2016/12/04
[ "https://raspberrypi.stackexchange.com/questions/58478", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/57629/" ]
There has recently been a security update for Raspberry Pi. Here is an article from <https://www.raspberrypi.org/blog/a-security-update-for-raspbian-pixel/> From the foundation's article: > > What has changed? > > > First, from now on SSH will be disabled by default on our images. SSH > (Secure SHell) is a networ...
**`systemctl` solution** If you already have a shell on the Pi through a non-SSH method such as screen + keyboard or UART (see [this post](https://raspberrypi.stackexchange.com/questions/3867/ssh-to-rpi-without-a-network-connection/53823#53823)), you can also just run: ``` sudo systemctl enable ssh sudo service sshd ...
58,478
I recently liberated an old model B from the loft, put NOOBS on an SD card, and installed the latest version of Raspbian on it. I booted it up, attempted to SSH to it from my Mac, but got: ``` ssh: connect to host 192.168.1.248 port 22: Connection refused ``` I got around this in the first instance by running `sudo ...
2016/12/04
[ "https://raspberrypi.stackexchange.com/questions/58478", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/57629/" ]
There has recently been a security update for Raspberry Pi. Here is an article from <https://www.raspberrypi.org/blog/a-security-update-for-raspbian-pixel/> From the foundation's article: > > What has changed? > > > First, from now on SSH will be disabled by default on our images. SSH > (Secure SHell) is a networ...
I was getting `Permission denied (publickey,password).` It turns out that for headless setups there is now a new step on top of creating the [ssh enabling file](https://www.raspberrypi.com/documentation/computers/remote-access.html#enabling-the-server): you need to setup the [user enabling file](https://www.raspberryp...
58,478
I recently liberated an old model B from the loft, put NOOBS on an SD card, and installed the latest version of Raspbian on it. I booted it up, attempted to SSH to it from my Mac, but got: ``` ssh: connect to host 192.168.1.248 port 22: Connection refused ``` I got around this in the first instance by running `sudo ...
2016/12/04
[ "https://raspberrypi.stackexchange.com/questions/58478", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/57629/" ]
**`systemctl` solution** If you already have a shell on the Pi through a non-SSH method such as screen + keyboard or UART (see [this post](https://raspberrypi.stackexchange.com/questions/3867/ssh-to-rpi-without-a-network-connection/53823#53823)), you can also just run: ``` sudo systemctl enable ssh sudo service sshd ...
Yes, as @tecraf said `ssh` is disabled by default, but the configuration location has changed. To enable SSH on your machine through console: Enter `sudo raspi-config` in the terminal go to `5-Interfacing Options`, then navigate to `P2-ssh`, press Enter and use `tab` to enable or disable `ssh server`. Then `sudo shutd...
58,478
I recently liberated an old model B from the loft, put NOOBS on an SD card, and installed the latest version of Raspbian on it. I booted it up, attempted to SSH to it from my Mac, but got: ``` ssh: connect to host 192.168.1.248 port 22: Connection refused ``` I got around this in the first instance by running `sudo ...
2016/12/04
[ "https://raspberrypi.stackexchange.com/questions/58478", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/57629/" ]
I was getting `Permission denied (publickey,password).` It turns out that for headless setups there is now a new step on top of creating the [ssh enabling file](https://www.raspberrypi.com/documentation/computers/remote-access.html#enabling-the-server): you need to setup the [user enabling file](https://www.raspberryp...
Yes, as @tecraf said `ssh` is disabled by default, but the configuration location has changed. To enable SSH on your machine through console: Enter `sudo raspi-config` in the terminal go to `5-Interfacing Options`, then navigate to `P2-ssh`, press Enter and use `tab` to enable or disable `ssh server`. Then `sudo shutd...
58,478
I recently liberated an old model B from the loft, put NOOBS on an SD card, and installed the latest version of Raspbian on it. I booted it up, attempted to SSH to it from my Mac, but got: ``` ssh: connect to host 192.168.1.248 port 22: Connection refused ``` I got around this in the first instance by running `sudo ...
2016/12/04
[ "https://raspberrypi.stackexchange.com/questions/58478", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/57629/" ]
I was getting `Permission denied (publickey,password).` It turns out that for headless setups there is now a new step on top of creating the [ssh enabling file](https://www.raspberrypi.com/documentation/computers/remote-access.html#enabling-the-server): you need to setup the [user enabling file](https://www.raspberryp...
**`systemctl` solution** If you already have a shell on the Pi through a non-SSH method such as screen + keyboard or UART (see [this post](https://raspberrypi.stackexchange.com/questions/3867/ssh-to-rpi-without-a-network-connection/53823#53823)), you can also just run: ``` sudo systemctl enable ssh sudo service sshd ...
23,416
The Goal ======== We have a subset of items on our site that are not Joomla pages, but other systems such as a selection of HTML5 and Flash (for now) Games: * `/play` * `/photobooth` * etc. These should only be accessible after logging in through Joomla, but trying to intercept these URLS only leads to Joomla Errors...
2018/09/07
[ "https://joomla.stackexchange.com/questions/23416", "https://joomla.stackexchange.com", "https://joomla.stackexchange.com/users/12867/" ]
Assuming you have a database table setup for this, you can use the following code to perform you check: ``` // This function is taken from my own extension public function getIpAddress() { $server = $this->app->input->server; $clientIp = $server->get('HTTP_CLIENT_IP'); $httpFwd = $server->get('HTTP_X_FO...
Just to clear a few things: I don't think there is anything that can tell this, not only in Joomla but in anything in the web. Under certain conditions you may be able to tell if a certain browser was at your site recently, e.g. like what G. Analytics does when counting new vs old visitors, which is a cookie based solu...
23,416
The Goal ======== We have a subset of items on our site that are not Joomla pages, but other systems such as a selection of HTML5 and Flash (for now) Games: * `/play` * `/photobooth` * etc. These should only be accessible after logging in through Joomla, but trying to intercept these URLS only leads to Joomla Errors...
2018/09/07
[ "https://joomla.stackexchange.com/questions/23416", "https://joomla.stackexchange.com", "https://joomla.stackexchange.com/users/12867/" ]
Just to clear a few things: I don't think there is anything that can tell this, not only in Joomla but in anything in the web. Under certain conditions you may be able to tell if a certain browser was at your site recently, e.g. like what G. Analytics does when counting new vs old visitors, which is a cookie based solu...
Personally, I wouldn't put that pressure (checking if the visitor is new or not) on the server powering the Joomla website as I've seen the havoc that a custom made analytics can wreak on a Joomla website. I would throw it on Google Analytics as described [here](https://stackoverflow.com/questions/43048191/how-can-i-te...
23,416
The Goal ======== We have a subset of items on our site that are not Joomla pages, but other systems such as a selection of HTML5 and Flash (for now) Games: * `/play` * `/photobooth` * etc. These should only be accessible after logging in through Joomla, but trying to intercept these URLS only leads to Joomla Errors...
2018/09/07
[ "https://joomla.stackexchange.com/questions/23416", "https://joomla.stackexchange.com", "https://joomla.stackexchange.com/users/12867/" ]
Assuming you have a database table setup for this, you can use the following code to perform you check: ``` // This function is taken from my own extension public function getIpAddress() { $server = $this->app->input->server; $clientIp = $server->get('HTTP_CLIENT_IP'); $httpFwd = $server->get('HTTP_X_FO...
I went down this rabbit hole several years ago as a self-educating endeavor. You can go to the extent of leveraging a blend of server-side and client-side to sniff/frisk/detect a device. The truth is that all data that you might wish to process: * can be spoofed/circumvented * can naturally fluctuate/vary enough to t...
23,416
The Goal ======== We have a subset of items on our site that are not Joomla pages, but other systems such as a selection of HTML5 and Flash (for now) Games: * `/play` * `/photobooth` * etc. These should only be accessible after logging in through Joomla, but trying to intercept these URLS only leads to Joomla Errors...
2018/09/07
[ "https://joomla.stackexchange.com/questions/23416", "https://joomla.stackexchange.com", "https://joomla.stackexchange.com/users/12867/" ]
I went down this rabbit hole several years ago as a self-educating endeavor. You can go to the extent of leveraging a blend of server-side and client-side to sniff/frisk/detect a device. The truth is that all data that you might wish to process: * can be spoofed/circumvented * can naturally fluctuate/vary enough to t...
Personally, I wouldn't put that pressure (checking if the visitor is new or not) on the server powering the Joomla website as I've seen the havoc that a custom made analytics can wreak on a Joomla website. I would throw it on Google Analytics as described [here](https://stackoverflow.com/questions/43048191/how-can-i-te...
23,416
The Goal ======== We have a subset of items on our site that are not Joomla pages, but other systems such as a selection of HTML5 and Flash (for now) Games: * `/play` * `/photobooth` * etc. These should only be accessible after logging in through Joomla, but trying to intercept these URLS only leads to Joomla Errors...
2018/09/07
[ "https://joomla.stackexchange.com/questions/23416", "https://joomla.stackexchange.com", "https://joomla.stackexchange.com/users/12867/" ]
Assuming you have a database table setup for this, you can use the following code to perform you check: ``` // This function is taken from my own extension public function getIpAddress() { $server = $this->app->input->server; $clientIp = $server->get('HTTP_CLIENT_IP'); $httpFwd = $server->get('HTTP_X_FO...
Personally, I wouldn't put that pressure (checking if the visitor is new or not) on the server powering the Joomla website as I've seen the havoc that a custom made analytics can wreak on a Joomla website. I would throw it on Google Analytics as described [here](https://stackoverflow.com/questions/43048191/how-can-i-te...
20,297,222
How do I attach a new method to a collection object in meteorjs? ``` user = Meteor.user() user.newMethod() // how/where do I attach this function? ```
2013/11/30
[ "https://Stackoverflow.com/questions/20297222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/749477/" ]
The thing is `Meteor.user()` returns the result of something like `Meteor.findOne({_id: Meteor.userId()});` so you have to redefine the entire method because there's no prototype object. Client js, Server js or both: ``` Meteor.startup(function() { Meteor.user = function() { var user = Meteor.users.findOne...
You can simply do this: ``` user = Meteor.user(); user.newMethod = function () { // Do something }; ``` and later on ``` user.newMethod(); ```
38,949,573
I want to immediately hide the navigation when browser size is reduced to responsive. I'm using media query to control the nav layout. The code I've written is working but when I reduce the browser width, it will still show me a glimpse of the navigation and then slides to the left instead of just hiding itself immedia...
2016/08/15
[ "https://Stackoverflow.com/questions/38949573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3528779/" ]
``` Dim timers As New List(Of System.Threading.Timer) timers.Add(New System.Threading.Timer(AddressOf MyHandler, Nothing, 100, 100)) timers.Add(New System.Threading.Timer(AddressOf MyHandler, Nothing, 1000, 1000)) timers.Add(New System.Threading.Timer(AddressOf MyHandler, Nothing, 10000, 10000)) tim...
Use Time interval ``` Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick ' Do What you want here End Sub Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick ' Do What you want here End Sub ' Have a private sub that handles each tick .. Private Sub Button1...
18,120,053
How do I display a image only after it loads but the rest of the page shows normally? On each page I have something like this `<html class"page-name">` and the css is as follows `html.page-name { background: url(images/page-name.jpg) no-repeat center center fixed; background-size: cover; }` I tried to do the javascrip...
2013/08/08
[ "https://Stackoverflow.com/questions/18120053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2513485/" ]
Load image dynamically and then on its onload add it to the background ``` $(document).ready(function(){ var img = new Image(); img.onload = function(){ // image has been loaded $("html.page-name").css("background-image","url('"+image_url+"')"); }; img.src = image_url; }) ```
### jQuery: ``` // Wait for page load $(function() { // apply background image class to body (fade over 500 milliseconds) $('body').addClass('page-title', 500); }); ``` ### CSS: ``` .page-title { background-image: url('/path_to/image.jpg'); } ```
69,823,012
In bash, I parse a file line by line and extract the first and second field, like this: ``` $ cat myfile a1 1 a2 2 a3 3 a4 $ while read -r first second; do echo first is $first second is $second; done < myfile first is a1 second is 1 first is a2 second is 2 first is a3 second is 3 first is a4 second is ``` Now, I n...
2021/11/03
[ "https://Stackoverflow.com/questions/69823012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/497180/" ]
Your parameters expands in the parent shell, change your quotes or escape the parameter expansions: ``` $ bash -c 'while read -r first second; do echo first is $first second is $second; done < myfile' ``` or ``` $ bash -c "while read -r first second; do echo first is \$first second is \$second; done < myfile" ``` ...
And if you do not want to deal with intricacies of shell double-qouting, first define a function where you type your code manually where also shellcheck can help you typing proper code: ``` f() { while IFS=' ' read -r first second; do echo "first is $first second is $second"; done } ``` then do: ```...
20,727,378
I am creating a jQuery accordion plugin for personal use. **My main goal is having a super-duper neat JS code and HTML stracture.** This is how far I made it <http://jsfiddle.net/QA2eH/> HTML Stracture: ``` <div class="accordion"> <div class="accordion-wrapper"> <div class="accordion-toggle"> ...
2013/12/22
[ "https://Stackoverflow.com/questions/20727378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3121234/" ]
My best guess is inter-process communication (IPC) overhead. In the single-process instance, the single process has the word list. When delegating to various other processes, the main process needs to constantly shuttle sections of the list to other processes. Thus, it follows that a better approach might be to spin o...
I experienced something similar with the Pool on a different problem. I'm not sure of the actual cause at this point... **The Answer** edit by OP Karim Bahgat is the same solution that worked for me. After switching to a Process & Queue system, I was able to see speedups inline with the number of cores for a machine. ...
20,727,378
I am creating a jQuery accordion plugin for personal use. **My main goal is having a super-duper neat JS code and HTML stracture.** This is how far I made it <http://jsfiddle.net/QA2eH/> HTML Stracture: ``` <div class="accordion"> <div class="accordion-wrapper"> <div class="accordion-toggle"> ...
2013/12/22
[ "https://Stackoverflow.com/questions/20727378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3121234/" ]
My best guess is inter-process communication (IPC) overhead. In the single-process instance, the single process has the word list. When delegating to various other processes, the main process needs to constantly shuttle sections of the list to other processes. Thus, it follows that a better approach might be to spin o...
`Pool.map` is slower because it takes time to start the processes and then transfer the necessary memory from one to all processes as **Multimedia Mike** said. I have gone through the similar problem and I switched to `multiprocessing.Process`. But `multiprocessing.Process` takes more time to start the processes than ...
20,727,378
I am creating a jQuery accordion plugin for personal use. **My main goal is having a super-duper neat JS code and HTML stracture.** This is how far I made it <http://jsfiddle.net/QA2eH/> HTML Stracture: ``` <div class="accordion"> <div class="accordion-wrapper"> <div class="accordion-toggle"> ...
2013/12/22
[ "https://Stackoverflow.com/questions/20727378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3121234/" ]
These problems usually boil down to the following: > > *The function you are trying to parallelize doesn't require enough CPU resources (i.e. CPU time) to rationalize parallelization!* > > > Sure, when you parallelize with `multiprocessing.Pool(8)`, you theoretically (*but not practically)* could get a **8x** spe...
I experienced something similar with the Pool on a different problem. I'm not sure of the actual cause at this point... **The Answer** edit by OP Karim Bahgat is the same solution that worked for me. After switching to a Process & Queue system, I was able to see speedups inline with the number of cores for a machine. ...
20,727,378
I am creating a jQuery accordion plugin for personal use. **My main goal is having a super-duper neat JS code and HTML stracture.** This is how far I made it <http://jsfiddle.net/QA2eH/> HTML Stracture: ``` <div class="accordion"> <div class="accordion-wrapper"> <div class="accordion-toggle"> ...
2013/12/22
[ "https://Stackoverflow.com/questions/20727378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3121234/" ]
I experienced something similar with the Pool on a different problem. I'm not sure of the actual cause at this point... **The Answer** edit by OP Karim Bahgat is the same solution that worked for me. After switching to a Process & Queue system, I was able to see speedups inline with the number of cores for a machine. ...
`Pool.map` is slower because it takes time to start the processes and then transfer the necessary memory from one to all processes as **Multimedia Mike** said. I have gone through the similar problem and I switched to `multiprocessing.Process`. But `multiprocessing.Process` takes more time to start the processes than ...
20,727,378
I am creating a jQuery accordion plugin for personal use. **My main goal is having a super-duper neat JS code and HTML stracture.** This is how far I made it <http://jsfiddle.net/QA2eH/> HTML Stracture: ``` <div class="accordion"> <div class="accordion-wrapper"> <div class="accordion-toggle"> ...
2013/12/22
[ "https://Stackoverflow.com/questions/20727378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3121234/" ]
These problems usually boil down to the following: > > *The function you are trying to parallelize doesn't require enough CPU resources (i.e. CPU time) to rationalize parallelization!* > > > Sure, when you parallelize with `multiprocessing.Pool(8)`, you theoretically (*but not practically)* could get a **8x** spe...
`Pool.map` is slower because it takes time to start the processes and then transfer the necessary memory from one to all processes as **Multimedia Mike** said. I have gone through the similar problem and I switched to `multiprocessing.Process`. But `multiprocessing.Process` takes more time to start the processes than ...
42,248,892
My textarea has a value, but it is not displayed in the textarea, which is working in my input field... ```html <textarea value="This text is not visible"></textarea> <input value="This text is visible"> ```
2017/02/15
[ "https://Stackoverflow.com/questions/42248892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5024157/" ]
Textarea doesn't have `value` attribute. Put the text between opening and closing tags. **note** : Don't forgot to add name attribute . It should be like this ``` <textarea name="textarea_field" placeholder="Text enter here">This text is visible</textarea> ```
``` <textarea>This text is visible</textarea> ```