qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
5,713,653 | I'm using a search view in my application. Now i just want to get the text typed in the SearchView text box and display it on another textview. If i typed the text and click a button i can do the same. But i don't want to use any extra buttons. I just want to display the result when i am pressing enter key. | 2011/04/19 | [
"https://Stackoverflow.com/questions/5713653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/669322/"
] | Try to use [setOnQueryTextListener](http://developer.android.com/reference/android/widget/SearchView.html#setOnQueryTextListener%28android.widget.SearchView.OnQueryTextListener%29) of SearchView
```
new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextChange(String newText) {
// y... | The right way to solve this is to use **setOnQueryTextListener**
This is a small exmple using Kotlin:
```
txtSearch = rootView.searchView
txtSearch.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextChange(newText: String): Boolean {
return false
}
... |
5,713,653 | I'm using a search view in my application. Now i just want to get the text typed in the SearchView text box and display it on another textview. If i typed the text and click a button i can do the same. But i don't want to use any extra buttons. I just want to display the result when i am pressing enter key. | 2011/04/19 | [
"https://Stackoverflow.com/questions/5713653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/669322/"
] | In Kotlin, you can do :
```
searchView.setOnQueryTextListener(object : OnQueryTextListener {
override fun onQueryTextChange(newText: String): Boolean {
return false
}
override fun onQueryTextSubmit(query: String): Boolean {
// task HERE
return false
}
})
``` | The right way to solve this is to use **setOnQueryTextListener**
This is a small exmple using Kotlin:
```
txtSearch = rootView.searchView
txtSearch.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextChange(newText: String): Boolean {
return false
}
... |
5,713,653 | I'm using a search view in my application. Now i just want to get the text typed in the SearchView text box and display it on another textview. If i typed the text and click a button i can do the same. But i don't want to use any extra buttons. I just want to display the result when i am pressing enter key. | 2011/04/19 | [
"https://Stackoverflow.com/questions/5713653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/669322/"
] | Try to use [setOnQueryTextListener](http://developer.android.com/reference/android/widget/SearchView.html#setOnQueryTextListener%28android.widget.SearchView.OnQueryTextListener%29) of SearchView
```
new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextChange(String newText) {
// y... | In Kotlin, you can do :
```
searchView.setOnQueryTextListener(object : OnQueryTextListener {
override fun onQueryTextChange(newText: String): Boolean {
return false
}
override fun onQueryTextSubmit(query: String): Boolean {
// task HERE
return false
}
})
``` |
5,713,653 | I'm using a search view in my application. Now i just want to get the text typed in the SearchView text box and display it on another textview. If i typed the text and click a button i can do the same. But i don't want to use any extra buttons. I just want to display the result when i am pressing enter key. | 2011/04/19 | [
"https://Stackoverflow.com/questions/5713653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/669322/"
] | It also can be done with RXAndroid and RxBinding by Jake Wharton like this:
```
RxSearchView.queryTextChanges(searchView)
.debounce(500, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<CharSequence>() {
@Override
... | with extension functions, create `SearchViewExtensions.kt`
```
import android.view.View
import androidx.appcompat.widget.SearchView
inline fun SearchView.onQueryTextChanged(crossinline listener: (String) -> Unit) {
this.setOnQueryTextListener(object: SearchView.OnQueryTextListener {
override fun onQueryTe... |
5,713,653 | I'm using a search view in my application. Now i just want to get the text typed in the SearchView text box and display it on another textview. If i typed the text and click a button i can do the same. But i don't want to use any extra buttons. I just want to display the result when i am pressing enter key. | 2011/04/19 | [
"https://Stackoverflow.com/questions/5713653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/669322/"
] | The above answer is good but not complete actually you need to set an action listener for your Search view . you can do this in two ways create a class that implements the necessary classes to be an OnQueryTextListener and make a new object of that and use it as your search view query text listener or use the following... | It also can be done with RXAndroid and RxBinding by Jake Wharton like this:
```
RxSearchView.queryTextChanges(searchView)
.debounce(500, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<CharSequence>() {
@Override
... |
5,713,653 | I'm using a search view in my application. Now i just want to get the text typed in the SearchView text box and display it on another textview. If i typed the text and click a button i can do the same. But i don't want to use any extra buttons. I just want to display the result when i am pressing enter key. | 2011/04/19 | [
"https://Stackoverflow.com/questions/5713653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/669322/"
] | The right way to solve this is to use **setOnQueryTextListener**
This is a small exmple using Kotlin:
```
txtSearch = rootView.searchView
txtSearch.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextChange(newText: String): Boolean {
return false
}
... | This is what I have inside the `onCreateOptionsMenu(Menu menu)` function on my main activity:
```
MenuItem searchItem = menu.findItem(R.id.search);
SearchView searchView = (SearchView) searchItem.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean ... |
615,204 | I've read the already asked questions on this but I'm still stuck:
>
> Prove that when 2 perfectly elastic particles collide, with one being at rest, the angle formed is 90°
>
>
>
**Attempt.** Given that this is perfectly elastic, the energy and the linear momentum doesn't change, and both particles being A and B... | 2021/02/17 | [
"https://physics.stackexchange.com/questions/615204",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/278607/"
] | For an object (mass, m) in the gravitational field of the earth (Mass, M) the potential energy is usually expressed as: U = – GMm/r. (This energy is going up from a negative value towards zero as r gets larger.) If the object is in a circular orbit: F = $GMm/(r^2) = m(v^2)/r$. multiplying by r/2 gives the kinetic energ... | >
> I learnt that the work done was equal to the change in energy
>
>
>
This statement is too ambiguous. We know that the total work due to all forces (conservative or nonconservative) is equal to the change in the **kinetic** energy. However, the work done by external forces (usually just taken to be the nonconse... |
60,100 | I designed a pictures grid in sketch, and wanted to export the hole grid as one jpg or png, and then add it to my website. I am wondering if the quality of the jpg or png would be as good as photoshop? Is there specific settings I should use? What about color management? | 2015/09/04 | [
"https://graphicdesign.stackexchange.com/questions/60100",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/50455/"
] | Sketch is designed especially for the web/mobile UI design. Therefore, unlike photoshop (older versions) Sketch is optimizing PNG and JPG formats successfully. You don't need to worry about lots of quailty settings as in the photoshop at Sketch. [Here is a tutorial for that](http://webdesign.tutsplus.com/tutorials/unde... | The answer is no.
Photoshop JPG export is far superior to Sketch.
This is frustrating as I have to export from Sketch as PNGs. Then open in Photoshop and save the PNGs as JPGs from Photoshop.
(This is the case, even if I set a very high jpg export quality when exporting from Sketch). Photoshop's save-for-web creates hi... |
7,736,196 | >
> **Possible Duplicate:**
>
> [How to get URL of current page in PHP](https://stackoverflow.com/questions/1283327/how-to-get-url-of-current-page-in-php)
>
>
>
ive been searching all over and i do not know php too well but all im trying to to do is display:none in php when on a certain page (/site/page/).
**... | 2011/10/12 | [
"https://Stackoverflow.com/questions/7736196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/990847/"
] | Alright. You can go like so:
```
<?php if($_SERVER['REQUEST_URI']=='/the/page.html'){
echo '<div id="dropdown_navigation"...';
} ?>
```
That should do it. Replace ... with whatever you need. If you need to use a single quote in there, you'll have to escape it by prepending a backslash (i.e. \')
This only works with... | There are two global arrays which contain the information about the url:
1. `$_SERVER['REQUEST_URI']` :
2. `$_SERVER['QUERY_STRING']` : This will contain the query string something after the ? in the url.
The PHP script would be then :
```
<?php
if($_SERVER['REQUEST_URI'] == 'your specific page url') {
?>
<div o... |
7,299,618 | First, I've searched intensely with Google and Yahoo and I've found several replies on topics like mine, but they all don't really cover what I need to know.
I've got several user models in my app, for now it's Customers, Designers, Retailers and it seems there are yet more to come. They all have different data stored... | 2011/09/04 | [
"https://Stackoverflow.com/questions/7299618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927573/"
] | Okay, so I worked it through and came to the following solution.
I needed to costumize devise a little bit, but it's not that complicated.
The User model
```
# user.rb
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
... | I didn't manage to find any way of commenting for the accepted answer, so I'm just gonna write here.
There are a couple of things that don't work exactly as the accepted answer states, probably because it is out of date.
Anyway, some of the things that I had to work out myself:
1. For the UserRegistrationsController... |
7,299,618 | First, I've searched intensely with Google and Yahoo and I've found several replies on topics like mine, but they all don't really cover what I need to know.
I've got several user models in my app, for now it's Customers, Designers, Retailers and it seems there are yet more to come. They all have different data stored... | 2011/09/04 | [
"https://Stackoverflow.com/questions/7299618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927573/"
] | Okay, so I worked it through and came to the following solution.
I needed to costumize devise a little bit, but it's not that complicated.
The User model
```
# user.rb
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
... | I was following the above instructions and found out some gaps and that instructions were just out of date when I was implementing it.
So after struggling with it the whole day, let me share with you what worked for me - and hopefully it will save you few hours of sweat and tears
* First of all, if you are not that f... |
7,299,618 | First, I've searched intensely with Google and Yahoo and I've found several replies on topics like mine, but they all don't really cover what I need to know.
I've got several user models in my app, for now it's Customers, Designers, Retailers and it seems there are yet more to come. They all have different data stored... | 2011/09/04 | [
"https://Stackoverflow.com/questions/7299618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927573/"
] | I didn't manage to find any way of commenting for the accepted answer, so I'm just gonna write here.
There are a couple of things that don't work exactly as the accepted answer states, probably because it is out of date.
Anyway, some of the things that I had to work out myself:
1. For the UserRegistrationsController... | I was following the above instructions and found out some gaps and that instructions were just out of date when I was implementing it.
So after struggling with it the whole day, let me share with you what worked for me - and hopefully it will save you few hours of sweat and tears
* First of all, if you are not that f... |
1,460,146 | I am using Crystal Reports in Visual Studio 2008. I have about 5 pages worth of static text that needs to appear at the top of my report, so I put it in the report header section. I have a page footer section on the page that shows the page number. This does not show, and I suspect it has something to do with the long ... | 2009/09/22 | [
"https://Stackoverflow.com/questions/1460146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | Can you split static text between many header (sub)sections (in a way that every section has about pageful of text)? May help. | Ken Hammady has a solution for crosstabs at
<http://kenhamady.com/cru/archives/87>
It can be adapted to work with long texts in textboxes. |
1,460,146 | I am using Crystal Reports in Visual Studio 2008. I have about 5 pages worth of static text that needs to appear at the top of my report, so I put it in the report header section. I have a page footer section on the page that shows the page number. This does not show, and I suspect it has something to do with the long ... | 2009/09/22 | [
"https://Stackoverflow.com/questions/1460146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | Can you split static text between many header (sub)sections (in a way that every section has about pageful of text)? May help. | I moved all of my text from the Report Header to the Report Footer, and the page numbers will print. I will add a subreport to show my detailed data. |
1,460,146 | I am using Crystal Reports in Visual Studio 2008. I have about 5 pages worth of static text that needs to appear at the top of my report, so I put it in the report header section. I have a page footer section on the page that shows the page number. This does not show, and I suspect it has something to do with the long ... | 2009/09/22 | [
"https://Stackoverflow.com/questions/1460146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | Can you split static text between many header (sub)sections (in a way that every section has about pageful of text)? May help. | I had exactly the same problem. My report header was very long and the page number only was appearing at last page. The problem was that i had my page number in the Report Footer. Then i realize that i had a Page Footer section and moved the page number there. I also changed the section properties (it had the No Drill ... |
1,460,146 | I am using Crystal Reports in Visual Studio 2008. I have about 5 pages worth of static text that needs to appear at the top of my report, so I put it in the report header section. I have a page footer section on the page that shows the page number. This does not show, and I suspect it has something to do with the long ... | 2009/09/22 | [
"https://Stackoverflow.com/questions/1460146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | I moved all of my text from the Report Header to the Report Footer, and the page numbers will print. I will add a subreport to show my detailed data. | Ken Hammady has a solution for crosstabs at
<http://kenhamady.com/cru/archives/87>
It can be adapted to work with long texts in textboxes. |
1,460,146 | I am using Crystal Reports in Visual Studio 2008. I have about 5 pages worth of static text that needs to appear at the top of my report, so I put it in the report header section. I have a page footer section on the page that shows the page number. This does not show, and I suspect it has something to do with the long ... | 2009/09/22 | [
"https://Stackoverflow.com/questions/1460146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | I had exactly the same problem. My report header was very long and the page number only was appearing at last page. The problem was that i had my page number in the Report Footer. Then i realize that i had a Page Footer section and moved the page number there. I also changed the section properties (it had the No Drill ... | Ken Hammady has a solution for crosstabs at
<http://kenhamady.com/cru/archives/87>
It can be adapted to work with long texts in textboxes. |
373,876 | Which of the following is most correct for the complex numbers Z and W, marked with "x" in the picture of the complex numbers below? (the dashed circle represents the unit circle)
a) $Z = W + 3i$
b) $Z = W^2$
c) $W = Z^2$
d) $Z = \dfrac{1}{W}$
e) $Z = 2W$
Picture here: <http://s21.postimg.org/6tt471nd3/problem_co... | 2013/04/26 | [
"https://math.stackexchange.com/questions/373876",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/74589/"
] | You are *already* using calculus when you are performing gradient search in the first place. At some point, you have to stop calculating derivatives and start descending! :-)
In all seriousness, though: what you are describing is *exact line search*. That is, you actually want to find the minimizing value of $\gamma$,... | There is a good discussion of this in chapter 10 of [Numerical Recipes](http://apps.nrbook.com/c/index.html). Old versions are free online.
You are right that if you have $F$ in a simple enough form, you can minimize over $\gamma$ by calculus. You might even be able to find the minimum directly, without iteration. Oft... |
373,876 | Which of the following is most correct for the complex numbers Z and W, marked with "x" in the picture of the complex numbers below? (the dashed circle represents the unit circle)
a) $Z = W + 3i$
b) $Z = W^2$
c) $W = Z^2$
d) $Z = \dfrac{1}{W}$
e) $Z = 2W$
Picture here: <http://s21.postimg.org/6tt471nd3/problem_co... | 2013/04/26 | [
"https://math.stackexchange.com/questions/373876",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/74589/"
] | You are *already* using calculus when you are performing gradient search in the first place. At some point, you have to stop calculating derivatives and start descending! :-)
In all seriousness, though: what you are describing is *exact line search*. That is, you actually want to find the minimizing value of $\gamma$,... | Not your question,
but an *adaptive* step size can beat a constant $\gamma$,
and a $\gamma\_i$ per component can beat a single $\gamma$ for all components.
See [RmsProp](http://climin.readthedocs.org/en/latest/rmsprop.html) ,
[rmsprop.py](https://github.com/BRML/climin/blob/master/climin/rmsprop.py)
and Zeiler, [AD... |
12,428 | I just learned of Ripple and it still seems a bit fuzzy to grasp the concept, but from what I gathered so far its a decentralized exchange that basically has the potential to overtake Bitpay and Mt.gox. I read that there are Gateway points that do the currency conversions from bitcoin to fiat. Now the other question I ... | 2013/07/31 | [
"https://bitcoin.stackexchange.com/questions/12428",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/3029/"
] | Ripple supports a distributed currency exchange; anyone can offer to exchange from one currency to another. These offers are taken when a counter offer the same or better is made.
Like any exchange between two parties, the price would be based on supply and demand, world events, what the market will bear, etc.
The ad... | Bitpay and Mt. Gox (or any other currency exchange) are fundamentally different. Bitpay is not a currency exchange. Bitpay is a service for merchants who wish to take payment in Bitcoin and receive a daily payout in the currency of their choice (including Bitcoin), at an exchange rate that is fixed at the time of the i... |
12,428 | I just learned of Ripple and it still seems a bit fuzzy to grasp the concept, but from what I gathered so far its a decentralized exchange that basically has the potential to overtake Bitpay and Mt.gox. I read that there are Gateway points that do the currency conversions from bitcoin to fiat. Now the other question I ... | 2013/07/31 | [
"https://bitcoin.stackexchange.com/questions/12428",
"https://bitcoin.stackexchange.com",
"https://bitcoin.stackexchange.com/users/3029/"
] | Ripple supports a distributed currency exchange; anyone can offer to exchange from one currency to another. These offers are taken when a counter offer the same or better is made.
Like any exchange between two parties, the price would be based on supply and demand, world events, what the market will bear, etc.
The ad... | You derive the exchange price by simulating attempting the exchange and seeing what it cost you.
For example, say you have 1 Bitcoin and you want to get the exchange rate to USD:
You could look for someone willing to take that Bitcoin and see, among all such offers, who is offering the most USD. You may need to combi... |
62,562,899 | I have nginx directly installed on my server, with a proxy to a Docker container containing a Next.js application.
The HTML of the Next.js is being loaded correctly, but all the assets are failing:
```
server {
listen 443 ssl http2;
listen [::]:443 http2;
server_name app.mydomain.ml;
include extras.... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62562899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1029654/"
] | Removed all the crap in the location block but the proxy\_pass and suddenly worked.
```
location / {
proxy_pass http://127.0.0.1:4000;
}
``` | Why not create a alias for this
```
location /_next {
alias "/etc/nginx/html/_next/;
}
``` |
57,464,592 | I have a `while loop` that I feel should run much faster, but it takes up to 50 seconds to go through a maximum of 350 rows in the website.
I have tried making separate if statements, but that took the same amount of time.
```
while 'x' not in driver.find_element_by_xpath('/html/body/form/table[2]/tbody/tr[2]/th/div/... | 2019/08/12 | [
"https://Stackoverflow.com/questions/57464592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11672154/"
] | The main problem is that you're calling a non-trivial function somewhere from 3 to 9 times, and most of those calls simply repeat a search you've already done. Call the function *once* for each line you want to examine, store the result, and compare against that.
```
# This call has no variables; do it only once
VAR1 ... | I would recommend to use xpath axis for locating elements in different positions. Using loops have a higher cost on the code and it takes unwanted time to reach the specific element. Now with xpath axis you can easily traverse between the xpaths upward or downward in the DOM. |
402,268 | I want to write a PHP code snippet in the question or answer. I searched that but Stack Overflow can insert only HTML, CSS, JavaScript snippet code.
How can I insert a PHP code snippet like below?
JavaScript snippet example:
```js
console.log('hello world');
``` | 2020/10/22 | [
"https://meta.stackoverflow.com/questions/402268",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/10770469/"
] | Stack Overflow has no features for executing live demos of PHP code in questions.
You should format a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) as a regular code block:
```
```php
<?php
echo "123";
?>
```
```
You might additionally link to a live demo using a t... | There isn't any way to run PHP code. You have to insert an additional link in your question/answer to share your PHP code snippet with fellow members.
A PHP code snippet can be shared by using the following websites:
<http://www.writephponline.com/>
<http://phptester.net/> - [My choice]
<https://www.mycompiler.io/o... |
402,268 | I want to write a PHP code snippet in the question or answer. I searched that but Stack Overflow can insert only HTML, CSS, JavaScript snippet code.
How can I insert a PHP code snippet like below?
JavaScript snippet example:
```js
console.log('hello world');
``` | 2020/10/22 | [
"https://meta.stackoverflow.com/questions/402268",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/10770469/"
] | Stack Overflow has no features for executing live demos of PHP code in questions.
You should format a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) as a regular code block:
```
```php
<?php
echo "123";
?>
```
```
You might additionally link to a live demo using a t... | If you understand the difference between client- and server-side code and the security implications thereof, you will understand why this is not, and probably never will be, a feature on Stack Overflow. |
402,268 | I want to write a PHP code snippet in the question or answer. I searched that but Stack Overflow can insert only HTML, CSS, JavaScript snippet code.
How can I insert a PHP code snippet like below?
JavaScript snippet example:
```js
console.log('hello world');
``` | 2020/10/22 | [
"https://meta.stackoverflow.com/questions/402268",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/10770469/"
] | Stack Overflow has no features for executing live demos of PHP code in questions.
You should format a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) as a regular code block:
```
```php
<?php
echo "123";
?>
```
```
You might additionally link to a live demo using a t... | No, probably not, you should use code blocks instead as specified in the other answers.
Adding to the other answers, here are a few extra points:
* The PHP stack snippets would use up all the server CPU/RAM which would make the whole experience slightly slower for everyone
* The PHP `mail()` function could be used to... |
402,268 | I want to write a PHP code snippet in the question or answer. I searched that but Stack Overflow can insert only HTML, CSS, JavaScript snippet code.
How can I insert a PHP code snippet like below?
JavaScript snippet example:
```js
console.log('hello world');
``` | 2020/10/22 | [
"https://meta.stackoverflow.com/questions/402268",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/10770469/"
] | If you understand the difference between client- and server-side code and the security implications thereof, you will understand why this is not, and probably never will be, a feature on Stack Overflow. | There isn't any way to run PHP code. You have to insert an additional link in your question/answer to share your PHP code snippet with fellow members.
A PHP code snippet can be shared by using the following websites:
<http://www.writephponline.com/>
<http://phptester.net/> - [My choice]
<https://www.mycompiler.io/o... |
402,268 | I want to write a PHP code snippet in the question or answer. I searched that but Stack Overflow can insert only HTML, CSS, JavaScript snippet code.
How can I insert a PHP code snippet like below?
JavaScript snippet example:
```js
console.log('hello world');
``` | 2020/10/22 | [
"https://meta.stackoverflow.com/questions/402268",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/10770469/"
] | No, probably not, you should use code blocks instead as specified in the other answers.
Adding to the other answers, here are a few extra points:
* The PHP stack snippets would use up all the server CPU/RAM which would make the whole experience slightly slower for everyone
* The PHP `mail()` function could be used to... | There isn't any way to run PHP code. You have to insert an additional link in your question/answer to share your PHP code snippet with fellow members.
A PHP code snippet can be shared by using the following websites:
<http://www.writephponline.com/>
<http://phptester.net/> - [My choice]
<https://www.mycompiler.io/o... |
402,268 | I want to write a PHP code snippet in the question or answer. I searched that but Stack Overflow can insert only HTML, CSS, JavaScript snippet code.
How can I insert a PHP code snippet like below?
JavaScript snippet example:
```js
console.log('hello world');
``` | 2020/10/22 | [
"https://meta.stackoverflow.com/questions/402268",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/10770469/"
] | If you understand the difference between client- and server-side code and the security implications thereof, you will understand why this is not, and probably never will be, a feature on Stack Overflow. | No, probably not, you should use code blocks instead as specified in the other answers.
Adding to the other answers, here are a few extra points:
* The PHP stack snippets would use up all the server CPU/RAM which would make the whole experience slightly slower for everyone
* The PHP `mail()` function could be used to... |
8,937,277 | I have this working in C#, but don't know where to go with Objective C (Xcode specifically).
I have 8 buttons
Stack1, Stack2, etc.
I want to choose Stack(variable) and change the image.
In C# I used
Button Stacks = this.Controls["Stack" + StackNumber.ToString()] as Button;
Stacks.BackgroundImage = .....
Can I do ... | 2012/01/20 | [
"https://Stackoverflow.com/questions/8937277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1066553/"
] | ```
$('#submit').click(function(e) {
var flag = true;
$('select').each(function(){
if($(this).val() == "select one"){
alert("please select a value in " + $(this).attr("name"));
flag = false;
}
});
if(flag){
alert('perfect');
}else{
e.preventDefault();
}
})... | Your test fails because `length` is not a method. It is a property. Remove the `()`. If you look in your debugger you should see a warning about this.
Also, your selector should be checking the selected option, not the select list itself.
<http://jsfiddle.net/7PPs4/>
```
$('#submit').click(function() {
$foo = $(... |
8,937,277 | I have this working in C#, but don't know where to go with Objective C (Xcode specifically).
I have 8 buttons
Stack1, Stack2, etc.
I want to choose Stack(variable) and change the image.
In C# I used
Button Stacks = this.Controls["Stack" + StackNumber.ToString()] as Button;
Stacks.BackgroundImage = .....
Can I do ... | 2012/01/20 | [
"https://Stackoverflow.com/questions/8937277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1066553/"
] | You can do this with $.each():
```
$('#step_1').find('SELECT').each( function() {
if( $(this).val() === 'select one' ) {
alert('Please select yes or no!');
return false;
}
});
```
Note that returning false will prevent the loop from continuing once a missing field is found. | Your test fails because `length` is not a method. It is a property. Remove the `()`. If you look in your debugger you should see a warning about this.
Also, your selector should be checking the selected option, not the select list itself.
<http://jsfiddle.net/7PPs4/>
```
$('#submit').click(function() {
$foo = $(... |
8,937,277 | I have this working in C#, but don't know where to go with Objective C (Xcode specifically).
I have 8 buttons
Stack1, Stack2, etc.
I want to choose Stack(variable) and change the image.
In C# I used
Button Stacks = this.Controls["Stack" + StackNumber.ToString()] as Button;
Stacks.BackgroundImage = .....
Can I do ... | 2012/01/20 | [
"https://Stackoverflow.com/questions/8937277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1066553/"
] | ```
$('#submit').click(function(e) {
var flag = true;
$('select').each(function(){
if($(this).val() == "select one"){
alert("please select a value in " + $(this).attr("name"));
flag = false;
}
});
if(flag){
alert('perfect');
}else{
e.preventDefault();
}
})... | You can do this with $.each():
```
$('#step_1').find('SELECT').each( function() {
if( $(this).val() === 'select one' ) {
alert('Please select yes or no!');
return false;
}
});
```
Note that returning false will prevent the loop from continuing once a missing field is found. |
49,633 | I'm replacing the wiring from a vintage chandelier and need to know what gauge wire to use. There are five lights on it. This is for the fixture only! | 2014/10/02 | [
"https://diy.stackexchange.com/questions/49633",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/25713/"
] | 18g stranded wire is [quite common on arms](http://www.thisoldhouse.com/toh/photos/0,,20267510_20599803,00.html)
14g stranded is often used to join the 18g arm strands, and to tie into the ceiling.
This applies to North America and normal chandeliers with relatively low (<50 each) wattage bulbs. | If you're in the US, NEC likely applies. Article 402 covers fixture wires, and explains what types and sizes are allowed.
Type
====
Table 402.3 lists the types of wires allowed to be used as fixture wires. If you're going to rewire the fixture, you'll have to use a type of wire listed in this table.
* FFH-2
* HF, H... |
49,633 | I'm replacing the wiring from a vintage chandelier and need to know what gauge wire to use. There are five lights on it. This is for the fixture only! | 2014/10/02 | [
"https://diy.stackexchange.com/questions/49633",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/25713/"
] | 18g stranded wire is [quite common on arms](http://www.thisoldhouse.com/toh/photos/0,,20267510_20599803,00.html)
14g stranded is often used to join the 18g arm strands, and to tie into the ceiling.
This applies to North America and normal chandeliers with relatively low (<50 each) wattage bulbs. | Agree 18 awg for the arms and 16 awg is desirable for a splice if needed to feed the ceiling junction box although 18 awg could be used by code as long as the total current stays below 6 amps. House wiring must be at least 14 awg or larger. The thinner gauge 18 and 16 awg is allowed because the wiring is not buried in ... |
49,633 | I'm replacing the wiring from a vintage chandelier and need to know what gauge wire to use. There are five lights on it. This is for the fixture only! | 2014/10/02 | [
"https://diy.stackexchange.com/questions/49633",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/25713/"
] | If you're in the US, NEC likely applies. Article 402 covers fixture wires, and explains what types and sizes are allowed.
Type
====
Table 402.3 lists the types of wires allowed to be used as fixture wires. If you're going to rewire the fixture, you'll have to use a type of wire listed in this table.
* FFH-2
* HF, H... | Agree 18 awg for the arms and 16 awg is desirable for a splice if needed to feed the ceiling junction box although 18 awg could be used by code as long as the total current stays below 6 amps. House wiring must be at least 14 awg or larger. The thinner gauge 18 and 16 awg is allowed because the wiring is not buried in ... |
4,491,775 | The class $W$ of well-ordered sets is not first-order axiomatizable. However, it does have an associated first-order theory $Th(W)$. I define a pseudo-well-ordered set to be an ordered set $(S;\leq)$ that satisfies $Th(W)$. My question is, is the class of pseudo-well-ordered set closed under taking substructures? If so... | 2022/07/13 | [
"https://math.stackexchange.com/questions/4491775",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/107952/"
] | $\omega+\zeta$ satisfies all the first-order sentences satisfied by $\omega$, but $\zeta$ does not satisfy "there is a smallest element". | Take any countable non-standard model of $\sf PA$ which is elementarily equivalent to the standard one, it is known that the order type of such model has the form $\Bbb{N+Q\times Z}$, therefore it contains a suborder isomorphic to $\Bbb Q$, which is clearly not satisfying the theory of pseudo-well-orders. |
4,491,775 | The class $W$ of well-ordered sets is not first-order axiomatizable. However, it does have an associated first-order theory $Th(W)$. I define a pseudo-well-ordered set to be an ordered set $(S;\leq)$ that satisfies $Th(W)$. My question is, is the class of pseudo-well-ordered set closed under taking substructures? If so... | 2022/07/13 | [
"https://math.stackexchange.com/questions/4491775",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/107952/"
] | Your question has a strong negative answer. Let $S$ be *any* linear order which is not a well-order (for example, any pseudo-well-order which is not a well-order). Then $S$ has an infinite descending chain $s\_0>s\_1>s\_2>\dots$. Let $T=\{s\_i\mid i\in \omega\}$. Then $T$ is a sub-order with no minimal element, so $T$ ... | Take any countable non-standard model of $\sf PA$ which is elementarily equivalent to the standard one, it is known that the order type of such model has the form $\Bbb{N+Q\times Z}$, therefore it contains a suborder isomorphic to $\Bbb Q$, which is clearly not satisfying the theory of pseudo-well-orders. |
47,226,069 | A co-worker and I have been working on the same branch for a week, constantly pushing/pulling changes and all of a sudden today, I hit 'pull' to see if there were any changes I needed to pull and I got an error.
This is in sourcetree by the way. The error was this:
```
git -c diff.mnemonicprefix=false -c core.quotepa... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47226069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954280/"
] | NOTE: This is the only solution that seems to work for some people, but is also a dangerous operation, that has broken some people's local repos. Please use carefully, and at your own discretion.
Here are the steps that fixed it for me:
1. Delete the file `.git/packed_refs`
2. Do a pull.
3. Run `git pack-refs` to rec... | Case 1: Let check branchs from git-server if they are duplicate or not.
```
Example: two branchs below are duplicate:
- upper_with_lower
- UPPER_with_lower
---> Let consider removing one of them.
```
Case 2: The branch you are pushing are duplicate with other branch. |
47,226,069 | A co-worker and I have been working on the same branch for a week, constantly pushing/pulling changes and all of a sudden today, I hit 'pull' to see if there were any changes I needed to pull and I got an error.
This is in sourcetree by the way. The error was this:
```
git -c diff.mnemonicprefix=false -c core.quotepa... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47226069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954280/"
] | The error text was slightly different for me like:
`unable to update local ref it is [hash_code_1] but expected [hash_code_2]`.
So the command like
`rm -rf .git/refs/remotes/origin/angular_removal` helped me only to do fetch once. Then the message would return again.
What actually helped in this situation to fix the... | Just happened to me as well; one of my ref branches under my alias was corrupted. Fix:
```
rm <root of repository>.git/refs/remotes/origin/<your alias>
git fetch
```
You can use `rd /s` instead of `rm` on Windows.
Here are the detailed steps I took to fix the issue. You may choose to skip some of the steps below:
... |
47,226,069 | A co-worker and I have been working on the same branch for a week, constantly pushing/pulling changes and all of a sudden today, I hit 'pull' to see if there were any changes I needed to pull and I got an error.
This is in sourcetree by the way. The error was this:
```
git -c diff.mnemonicprefix=false -c core.quotepa... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47226069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954280/"
] | The accepted solution provides details only about how OP got around the issue and it is not a definitive answer.
For the sake of people like me who end up here from Google, Here is the solution that actually works.
Lets say, if the error message looks like below,
```
error: cannot lock ref 'refs/remotes/origin/angu... | Multiple solutions didn't quite resolve it but I ended up re-cloning |
47,226,069 | A co-worker and I have been working on the same branch for a week, constantly pushing/pulling changes and all of a sudden today, I hit 'pull' to see if there were any changes I needed to pull and I got an error.
This is in sourcetree by the way. The error was this:
```
git -c diff.mnemonicprefix=false -c core.quotepa... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47226069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954280/"
] | I was able to get this fixed by deleted all the items in the `.git/packed-refs` file.
Then I just did a git pull in terminal to get all the references/code from the remote. | ```
git pull
```
resulted in the following error.
```
error: cannot lock ref 'refs/remotes/origin/e2e/gb-feedback-test': is at 2962f77c6b4248a82efbd4d3c*******f but expected c3c0af7e310247b4e8dfd94883******5
From https://company.com
! c3c0af7e3..2962f77c6 branch-name -> origin/branch-name (unable to update local... |
47,226,069 | A co-worker and I have been working on the same branch for a week, constantly pushing/pulling changes and all of a sudden today, I hit 'pull' to see if there were any changes I needed to pull and I got an error.
This is in sourcetree by the way. The error was this:
```
git -c diff.mnemonicprefix=false -c core.quotepa... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47226069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954280/"
] | I had a similar issue, but I couldn't push my commit from my local branch to the remote branch. Looking inside sourcetree under my remote branches, my branch suddenly didn't exist.
I tried @Dudar answer, but the branch wasnt mentioned in the packed-refs file.
So what I did was:
1. go into .git\refs\remotes\origin\feat... | Update ref.
```
$ git update-ref -d refs/remotes/origin/[branchname]
``` |
47,226,069 | A co-worker and I have been working on the same branch for a week, constantly pushing/pulling changes and all of a sudden today, I hit 'pull' to see if there were any changes I needed to pull and I got an error.
This is in sourcetree by the way. The error was this:
```
git -c diff.mnemonicprefix=false -c core.quotepa... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47226069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954280/"
] | The accepted solution provides details only about how OP got around the issue and it is not a definitive answer.
For the sake of people like me who end up here from Google, Here is the solution that actually works.
Lets say, if the error message looks like below,
```
error: cannot lock ref 'refs/remotes/origin/angu... | NOTE: This is the only solution that seems to work for some people, but is also a dangerous operation, that has broken some people's local repos. Please use carefully, and at your own discretion.
Here are the steps that fixed it for me:
1. Delete the file `.git/packed_refs`
2. Do a pull.
3. Run `git pack-refs` to rec... |
47,226,069 | A co-worker and I have been working on the same branch for a week, constantly pushing/pulling changes and all of a sudden today, I hit 'pull' to see if there were any changes I needed to pull and I got an error.
This is in sourcetree by the way. The error was this:
```
git -c diff.mnemonicprefix=false -c core.quotepa... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47226069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954280/"
] | NOTE: This is the only solution that seems to work for some people, but is also a dangerous operation, that has broken some people's local repos. Please use carefully, and at your own discretion.
Here are the steps that fixed it for me:
1. Delete the file `.git/packed_refs`
2. Do a pull.
3. Run `git pack-refs` to rec... | Locate to the project folder in Terminal
```
git gc --prune=now
rm -rf .git/refs/remotes/origin
``` |
47,226,069 | A co-worker and I have been working on the same branch for a week, constantly pushing/pulling changes and all of a sudden today, I hit 'pull' to see if there were any changes I needed to pull and I got an error.
This is in sourcetree by the way. The error was this:
```
git -c diff.mnemonicprefix=false -c core.quotepa... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47226069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954280/"
] | Multiple solutions didn't quite resolve it but I ended up re-cloning | Locate to the project folder in Terminal
```
git gc --prune=now
rm -rf .git/refs/remotes/origin
``` |
47,226,069 | A co-worker and I have been working on the same branch for a week, constantly pushing/pulling changes and all of a sudden today, I hit 'pull' to see if there were any changes I needed to pull and I got an error.
This is in sourcetree by the way. The error was this:
```
git -c diff.mnemonicprefix=false -c core.quotepa... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47226069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954280/"
] | I had a similar issue, but I couldn't push my commit from my local branch to the remote branch. Looking inside sourcetree under my remote branches, my branch suddenly didn't exist.
I tried @Dudar answer, but the branch wasnt mentioned in the packed-refs file.
So what I did was:
1. go into .git\refs\remotes\origin\feat... | Case 1: Let check branchs from git-server if they are duplicate or not.
```
Example: two branchs below are duplicate:
- upper_with_lower
- UPPER_with_lower
---> Let consider removing one of them.
```
Case 2: The branch you are pushing are duplicate with other branch. |
47,226,069 | A co-worker and I have been working on the same branch for a week, constantly pushing/pulling changes and all of a sudden today, I hit 'pull' to see if there were any changes I needed to pull and I got an error.
This is in sourcetree by the way. The error was this:
```
git -c diff.mnemonicprefix=false -c core.quotepa... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47226069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954280/"
] | I was able to get this fixed by deleted all the items in the `.git/packed-refs` file.
Then I just did a git pull in terminal to get all the references/code from the remote. | Case 1: Let check branchs from git-server if they are duplicate or not.
```
Example: two branchs below are duplicate:
- upper_with_lower
- UPPER_with_lower
---> Let consider removing one of them.
```
Case 2: The branch you are pushing are duplicate with other branch. |
12,709,276 | I am interested in knowing why static destructors are not allowed in C#. Note that I am not supposing that they exist in any other language.
I could have a class like this one.
```
class A
{
static A()
{
// here I can load a resource that will be avaliable for all instances
// of this... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12709276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1499972/"
] | I just wrote a tutorial on how You can use the FDT 5.6 AIR for iOS Project Template. Hope is detailed enough to set You on the right path.
Here is the link:
[.SWFGEEK - Using FDT 5.6 AIR for iOS Project Template](http://www.swfgeek.net/2012/10/17/using-fdt-5-6-air-for-ios-project-template/) | The tutorials on the site are outdated, that is why it will seem a little confusing.
To test on device, you simply run an 'FDT AIR Application' configuration, choose the platform and if it's a mobile platform (e.g. Android or iOS) then you will see the option to test on device.
/\\\1/g'
^ ^ ^----------------- with The character with a leading \
|
| | --- the characters `"$\
|
|-- replace
```
So `"` becomes `\"`
2. I have no idea, zsh isn't my cup of tea when you ... |
29,675,159 | says it all really in the title I have this javascript
```
<script>
$(".tile").click(function(e){
$(this).toggleClass("flipOutX") ;
})
</script>
```
I have some html dfined boxes called "tile" and the problem here is that when i click an individual tile the flipoutx function works but only the tile I ... | 2015/04/16 | [
"https://Stackoverflow.com/questions/29675159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3504751/"
] | You need to size the vectors accordingly before accessing elements. You can do that on construction, or using `resize`.
`vector<int>values(5/*pre-size for 5 elements*/);` and similar for `values2` would fix your problem.
Currently your program behaviour is undefined.
If you want to subtract *adjacent* elements, then... | The line of code:
```
values2[i]=values[i+1]-values[0];
```
will take the looked-at element away from the first element each time.
Did you mean:
```
values2[i]=values[i+1]-values[i];
```
? |
352,522 | I'm working on a Bash script that makes an SSH connection via git at a given point during the script's actions. I'm trying to gracefully handle some errors that can occur, stopping the script before it ends up failing part of the way through.
At one point it runs a command like `git push` which initiates a push over S... | 2017/03/20 | [
"https://unix.stackexchange.com/questions/352522",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/53923/"
] | So, instead of adding the host to `known_hosts` automatically, you want to fail the connection if it doesn't already exist there. `StrictHostKeyChecking` is still the option to do this (as in the linked question), but instead of setting it to `no`, set it to `yes`. This will cause the connection to fail if the host key... | The OpenSSH client may prompt the user either through the terminal or through the X11 display. If you want to make sure that the user won't be prompted, arrange to run the client with no controlling terminal and no X display. Getting rid of the X display is easy: unset the `DISPLAY` environment variable or set it to an... |
38,250,261 | I have a table of Appointments made by patients. I want to fetch those new patients who came to our medical facility in the current month, but that they were never here before, so we can send a welcome letter to new patients.
I am not sure how to select. I want to use NOT IN, but not sure how to hold the ones in the cu... | 2016/07/07 | [
"https://Stackoverflow.com/questions/38250261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6556651/"
] | I would use aggregation for this:
```
select patient_id
from t
group by patient_id
having min(appt_date_time) > cast(dateadd(day, - day(getdate()), getdate()) as date)
``` | I would use group by and min() with the Month() and Year() functions for this.
```
select patient_id
from patient_appt -- or whatever your table name is
group by patient_id -- groups all visits together for each patient
having year(min(appt_date_time)) = year(getdate()) -- checks earliest visit year is current year
... |
17,104 | From *My Face for the World to See* (1958) by Alfred Hayes:
>
> Ah! she said, triumphantly: the little boy hurts, doesn't it? I said, stonily, it might be a good idea if, instead of a psychiatrist, she stopped off one afternoon at **a delousing station**.
>
>
> Did I (with her eyes widely open) really think so?
>
... | 2021/01/09 | [
"https://literature.stackexchange.com/questions/17104",
"https://literature.stackexchange.com",
"https://literature.stackexchange.com/users/11834/"
] | A delousing station would generally be a place that gets rid of your [lice](https://www.lexico.com/en/definition/louse) (small insects that live in your hair). However, in this extract, it seems to means a place that will stop you from being a louse (a contemptible or unpleasant person) yourself.
So *delousing station... | From the excerpt, it seems an argument could be made that "soul" refers to some sort of ethicality - (moral) cleanliness and purity.
The mention of a psychiatrist suggests some manner of mental illness. This could be from trauma or psychological disorder. White is a colour that generally represents purity and goodness... |
58,121,048 | I know this issue exists already and people have posted before but I can't get this working so sorry for asking this.
I am using Heroku to build and deploy, this is not being done locally.
I am trying to get MetaMask to get recognized in my Dapp and I am using the code generated by MetaMask to fix their privacy mod... | 2019/09/26 | [
"https://Stackoverflow.com/questions/58121048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11588783/"
] | As of January 2021, Metmask has removed their injected `window.web3`
If you want to connect your dApp to Metamask, I'd try the following
```
export const connectWallet = async () => {
if (window.ethereum) { //check if Metamask is installed
try {
const address = await window.ethereum.enable(); //... | [over here](https://stackoverflow.com/questions/70371844/random-error-ethereum-is-not-defined-in-vue-development-boilerplate) someone says you can solve "ethereum is not defined" by writing
`const { ethereum } = window`
This works for me in React 18.1.0 |
29,196,447 | In Laravel 4.0, I use the code below to compress the HTML laravel response outputs to browser, however it doesn't work in laravel 5.
```
App::after(function($request, $response)
{
if($response instanceof Illuminate\Http\Response)
{
$buffer = $response->getContent();
if(strpos($buffer,'<pre>') !... | 2015/03/22 | [
"https://Stackoverflow.com/questions/29196447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2772319/"
] | This is almost a copy of [Vahid's](https://stackoverflow.com/a/37510913/2836233) answer but it fixes two problems.
1) It checks if a response is a `BinaryFileResponse` as any attempt to modify this type of response will throw an Exception.
2) It retained newline characters as the complete elimination of newlines will... | I did it with very simple code.
**Example: welcome.blade.php**
Add the following code to the beginning of the page
```
<?php ob_start('compress_page');?>
```
Add the following code to the end of the page:
```
<?php
ob_end_flush();
function compress_page($buffer) {
$search = array("/>[[:space:]]+/", "/[[:spa... |
29,196,447 | In Laravel 4.0, I use the code below to compress the HTML laravel response outputs to browser, however it doesn't work in laravel 5.
```
App::after(function($request, $response)
{
if($response instanceof Illuminate\Http\Response)
{
$buffer = $response->getContent();
if(strpos($buffer,'<pre>') !... | 2015/03/22 | [
"https://Stackoverflow.com/questions/29196447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2772319/"
] | It is not very good solution to minify html in middleware as you can spend a lot of CPU time on it and it runs on every request.
Instead it is better to use htmlmin package ( <https://github.com/HTMLMin/Laravel-HTMLMin> ):
```
composer require htmlmin/htmlmin
php artisan vendor:publish
```
Minifying HTML on blade t... | I have created a webpack plugin to solve same purpose.[MinifyHtmlWebpackPlugin](https://www.npmjs.com/package/minify-html-webpack-plugin)
Install the plugin with npm:
```sh
$ npm install minify-html-webpack-plugin --save-dev
```
For Laravel Mix Users
=====================
Paste below snippets into mix.js file.
``... |
29,196,447 | In Laravel 4.0, I use the code below to compress the HTML laravel response outputs to browser, however it doesn't work in laravel 5.
```
App::after(function($request, $response)
{
if($response instanceof Illuminate\Http\Response)
{
$buffer = $response->getContent();
if(strpos($buffer,'<pre>') !... | 2015/03/22 | [
"https://Stackoverflow.com/questions/29196447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2772319/"
] | This is almost a copy of [Vahid's](https://stackoverflow.com/a/37510913/2836233) answer but it fixes two problems.
1) It checks if a response is a `BinaryFileResponse` as any attempt to modify this type of response will throw an Exception.
2) It retained newline characters as the complete elimination of newlines will... | This package is much better option in my opinion [renatomarinho/laravel-page-speed](https://github.com/renatomarinho/laravel-page-speed) |
29,196,447 | In Laravel 4.0, I use the code below to compress the HTML laravel response outputs to browser, however it doesn't work in laravel 5.
```
App::after(function($request, $response)
{
if($response instanceof Illuminate\Http\Response)
{
$buffer = $response->getContent();
if(strpos($buffer,'<pre>') !... | 2015/03/22 | [
"https://Stackoverflow.com/questions/29196447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2772319/"
] | It is not very good solution to minify html in middleware as you can spend a lot of CPU time on it and it runs on every request.
Instead it is better to use htmlmin package ( <https://github.com/HTMLMin/Laravel-HTMLMin> ):
```
composer require htmlmin/htmlmin
php artisan vendor:publish
```
Minifying HTML on blade t... | I did it with very simple code.
**Example: welcome.blade.php**
Add the following code to the beginning of the page
```
<?php ob_start('compress_page');?>
```
Add the following code to the end of the page:
```
<?php
ob_end_flush();
function compress_page($buffer) {
$search = array("/>[[:space:]]+/", "/[[:spa... |
29,196,447 | In Laravel 4.0, I use the code below to compress the HTML laravel response outputs to browser, however it doesn't work in laravel 5.
```
App::after(function($request, $response)
{
if($response instanceof Illuminate\Http\Response)
{
$buffer = $response->getContent();
if(strpos($buffer,'<pre>') !... | 2015/03/22 | [
"https://Stackoverflow.com/questions/29196447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2772319/"
] | The recommended way to do this in Larvel 5 is to rewrite your function as [middleware](http://laravel.com/docs/5.0/middleware). As stated in the docs:
..this middleware would perform its task **after** the request is handled by the application:
```
<?php namespace App\Http\Middleware;
class AfterMiddleware implement... | This is almost a copy of [Vahid's](https://stackoverflow.com/a/37510913/2836233) answer but it fixes two problems.
1) It checks if a response is a `BinaryFileResponse` as any attempt to modify this type of response will throw an Exception.
2) It retained newline characters as the complete elimination of newlines will... |
29,196,447 | In Laravel 4.0, I use the code below to compress the HTML laravel response outputs to browser, however it doesn't work in laravel 5.
```
App::after(function($request, $response)
{
if($response instanceof Illuminate\Http\Response)
{
$buffer = $response->getContent();
if(strpos($buffer,'<pre>') !... | 2015/03/22 | [
"https://Stackoverflow.com/questions/29196447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2772319/"
] | This package is much better option in my opinion [renatomarinho/laravel-page-speed](https://github.com/renatomarinho/laravel-page-speed) | this is best way.. we don't need to use laravel packeges .Thanks..
```html
<?php
namespace App\Http\Middleware;
use Closure;
class OptimizeMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
... |
29,196,447 | In Laravel 4.0, I use the code below to compress the HTML laravel response outputs to browser, however it doesn't work in laravel 5.
```
App::after(function($request, $response)
{
if($response instanceof Illuminate\Http\Response)
{
$buffer = $response->getContent();
if(strpos($buffer,'<pre>') !... | 2015/03/22 | [
"https://Stackoverflow.com/questions/29196447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2772319/"
] | I have created a webpack plugin to solve same purpose.[MinifyHtmlWebpackPlugin](https://www.npmjs.com/package/minify-html-webpack-plugin)
Install the plugin with npm:
```sh
$ npm install minify-html-webpack-plugin --save-dev
```
For Laravel Mix Users
=====================
Paste below snippets into mix.js file.
``... | This package is much better option in my opinion [renatomarinho/laravel-page-speed](https://github.com/renatomarinho/laravel-page-speed) |
29,196,447 | In Laravel 4.0, I use the code below to compress the HTML laravel response outputs to browser, however it doesn't work in laravel 5.
```
App::after(function($request, $response)
{
if($response instanceof Illuminate\Http\Response)
{
$buffer = $response->getContent();
if(strpos($buffer,'<pre>') !... | 2015/03/22 | [
"https://Stackoverflow.com/questions/29196447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2772319/"
] | Complete code is this (with custom GZip enabled) :
```
<?php
namespace App\Http\Middleware;
use Closure;
class OptimizeMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function hand... | this is best way.. we don't need to use laravel packeges .Thanks..
```html
<?php
namespace App\Http\Middleware;
use Closure;
class OptimizeMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
... |
29,196,447 | In Laravel 4.0, I use the code below to compress the HTML laravel response outputs to browser, however it doesn't work in laravel 5.
```
App::after(function($request, $response)
{
if($response instanceof Illuminate\Http\Response)
{
$buffer = $response->getContent();
if(strpos($buffer,'<pre>') !... | 2015/03/22 | [
"https://Stackoverflow.com/questions/29196447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2772319/"
] | I have created a webpack plugin to solve same purpose.[MinifyHtmlWebpackPlugin](https://www.npmjs.com/package/minify-html-webpack-plugin)
Install the plugin with npm:
```sh
$ npm install minify-html-webpack-plugin --save-dev
```
For Laravel Mix Users
=====================
Paste below snippets into mix.js file.
``... | I did it with very simple code.
**Example: welcome.blade.php**
Add the following code to the beginning of the page
```
<?php ob_start('compress_page');?>
```
Add the following code to the end of the page:
```
<?php
ob_end_flush();
function compress_page($buffer) {
$search = array("/>[[:space:]]+/", "/[[:spa... |
29,196,447 | In Laravel 4.0, I use the code below to compress the HTML laravel response outputs to browser, however it doesn't work in laravel 5.
```
App::after(function($request, $response)
{
if($response instanceof Illuminate\Http\Response)
{
$buffer = $response->getContent();
if(strpos($buffer,'<pre>') !... | 2015/03/22 | [
"https://Stackoverflow.com/questions/29196447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2772319/"
] | Just in case you are rendering the view manually:
```php
echo view('example.site')->render(function($view, $content) {
return preg_replace(
['/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'],
['>', '<', '\\1'],
$content
); }
);
``` | This package is much better option in my opinion [renatomarinho/laravel-page-speed](https://github.com/renatomarinho/laravel-page-speed) |
39,156,762 | ```
<li class ="block" ng-repeat="i in items | searchFor:searchString" id={{i.title}}>
<a><img class="gallery" id={{i.title}} ng-src="{{i.image}}" title="{{i.title}}" /></a>
<a href="{{i.image}}" download><button id="eye" title="Preview"></button></a>
<p>{{i.title}}</p>
</li>
```
**Items ... | 2016/08/26 | [
"https://Stackoverflow.com/questions/39156762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6584514/"
] | Different fonts have different "aspect values" which is the size difference between a lowercase x and uppercase X for instance. You could try to use something like "font-size adjust" in your css to make all fonts have the same aspect value regardless of the font family. | I know it's an old post but try
```
-webkit-text-size-adjust:none;
-ms-text-size-adjust:none;
-moz-text-size-adjust:none;
text-size-adjust:none;
``` |
9,160 | I have seen a ticket opened about this on tor bug tracker, but no progress for over a year on the Tor Browser being available on arm processors. I have setup firefox with a proxy to use Tor but that is not safe because the browser itself leaks to much info. So I am asking for help if this is the right place to ask how ... | 2015/12/03 | [
"https://tor.stackexchange.com/questions/9160",
"https://tor.stackexchange.com",
"https://tor.stackexchange.com/users/10106/"
] | Speaking from experience, this is not currently possible.
During the compiling process, the make script will download some binaries that are only built for X86 and not for ARM and therefore the compilation wil fail every time.
The Tor developers plan on releasing a version for Tor Browser for ARM in the future, but t... | On all raspberry pi's, I have found that downloading the source and then running the following commands
```
cd your/source/directory
sudo ./configure && sudo make
```
If all goes well, this will install TOR from source.
Note: You may need some external libraries in order for this to work. I needed libevent and libo... |
9,160 | I have seen a ticket opened about this on tor bug tracker, but no progress for over a year on the Tor Browser being available on arm processors. I have setup firefox with a proxy to use Tor but that is not safe because the browser itself leaks to much info. So I am asking for help if this is the right place to ask how ... | 2015/12/03 | [
"https://tor.stackexchange.com/questions/9160",
"https://tor.stackexchange.com",
"https://tor.stackexchange.com/users/10106/"
] | Tor Browser does not work on ARM as of this time.
<https://trac.torproject.org/projects/tor/ticket/12631>
TOR ticket tracker for porting to ARM hasn't had much traction at all.
I wouldn't expect this project to be ported to arm anytime soon.
Note: tor is available on raspberry pi. This is for running a relay. This ... | On all raspberry pi's, I have found that downloading the source and then running the following commands
```
cd your/source/directory
sudo ./configure && sudo make
```
If all goes well, this will install TOR from source.
Note: You may need some external libraries in order for this to work. I needed libevent and libo... |
10,686,209 | I am trying to attach a PDF file called download.pdf to an email in my Android App. I am copying the file first to the SDCard and then attaching it the email.
I'm not if relevant, but I am testing on a galaxy tab device. The external storage path returns mnt/sdcard/
My code is as follows :
```
public void sendemail(... | 2012/05/21 | [
"https://Stackoverflow.com/questions/10686209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/441717/"
] | ```
String[] mailto = {""};
Uri uri = Uri.fromFile(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/CALC/REPORTS/",pdfname ));
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, mai... | If your download.pdf file exists in SDCard. So the problem should be get Uri from File. Try this, it works for me.
```
Uri uri = Uri.fromFile(new File("/sdcard/", "download.pdf"));
``` |
10,686,209 | I am trying to attach a PDF file called download.pdf to an email in my Android App. I am copying the file first to the SDCard and then attaching it the email.
I'm not if relevant, but I am testing on a galaxy tab device. The external storage path returns mnt/sdcard/
My code is as follows :
```
public void sendemail(... | 2012/05/21 | [
"https://Stackoverflow.com/questions/10686209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/441717/"
] | ```
String[] mailto = {""};
Uri uri = Uri.fromFile(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/CALC/REPORTS/",pdfname ));
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, mai... | The same problem happens for me also. I've cleared that using some method from examples. I've already [answered](https://stackoverflow.com/a/9273051/940096) a question similar to your query. Maybe that can be helps you. |
10,686,209 | I am trying to attach a PDF file called download.pdf to an email in my Android App. I am copying the file first to the SDCard and then attaching it the email.
I'm not if relevant, but I am testing on a galaxy tab device. The external storage path returns mnt/sdcard/
My code is as follows :
```
public void sendemail(... | 2012/05/21 | [
"https://Stackoverflow.com/questions/10686209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/441717/"
] | ```
String[] mailto = {""};
Uri uri = Uri.fromFile(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/CALC/REPORTS/",pdfname ));
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, mai... | ```
File externalStorage = Environment.getExternalStorageDirectory();
String PDFpath = externalStorage.toString();
String pdfpath =path.replace("/mnt","");
Uri uri = Uri.parse(new File("file://" + pdfpath));
``` |
35,271,838 | Trying to delete `<shipmentIndex Name=\"shipments\">whatever...</shipmentIndex>`
if it appear more then 1 time, keeping only one.
I have surrounded the item i want to delete here with \*\*\*..
The code i am using worked before, but then i added `.Value == "shipments"`
and now it fail.
How can i keep this code and only... | 2016/02/08 | [
"https://Stackoverflow.com/questions/35271838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1454961/"
] | Not sure I understand the question 100% but here goes:
I am thinking you want to filter the results to only include those elements where the name attribute is equal to 'shipments', although not all of the shipmentIndex elements have a 'Name' attribute so you are probably getting a null reference exception. You need to... | If you want to delete the duplicate from the renderedOutput string:
```
Match match = Regex.Match(renderedOutput, "<shipmentIndex Name=\"shipments\">([^<]*)</shipmentIndex>");
int index = renderedOutput.IndexOf(match.ToString());
renderedOutput = renderedOutput.Remove(index, match.ToString().Length);
``` |
532,590 | A Windows10 / debian system with a shared ntfs drive:
```
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 9.3G 0 part [SWAP]
├─sda2 8:2 0 83.8G 0 part /home
└─sda3 8:3 0 100G 0 part /media/share
nvme0n1 259:0 0 46... | 2019/07/28 | [
"https://unix.stackexchange.com/questions/532590",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/20506/"
] | Modern windows has something called fast startup that causes trouble for dual booting.
If you are using a modern windows (8 or 10) and dual booting you should keep it [turned off](https://www.windowscentral.com/how-disable-windows-10-fast-startup) | 1. Open the terminal and write the command
```
sudo fdisk -l
```
It will show your file system
2. Identify the partition you want permission for read and write, then type the command and give the partition name like this to your specific `sda`
```
sudo ntfsfix /dev/sda3
```
Credits: <https://askubuntu.com/a/11876... |
532,590 | A Windows10 / debian system with a shared ntfs drive:
```
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 9.3G 0 part [SWAP]
├─sda2 8:2 0 83.8G 0 part /home
└─sda3 8:3 0 100G 0 part /media/share
nvme0n1 259:0 0 46... | 2019/07/28 | [
"https://unix.stackexchange.com/questions/532590",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/20506/"
] | Modern windows has something called fast startup that causes trouble for dual booting.
If you are using a modern windows (8 or 10) and dual booting you should keep it [turned off](https://www.windowscentral.com/how-disable-windows-10-fast-startup) | I had a similar issue.
But in my case, there were issues with accessing the Hard Drive because Windows crashed (instead of properly shutting down), so it's possible Windows didn't properly unmount the HDD, and so Linux couldn't have proper access to it.
The fix for me was just to go into Windows, make sure the HDD is ... |
532,590 | A Windows10 / debian system with a shared ntfs drive:
```
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 9.3G 0 part [SWAP]
├─sda2 8:2 0 83.8G 0 part /home
└─sda3 8:3 0 100G 0 part /media/share
nvme0n1 259:0 0 46... | 2019/07/28 | [
"https://unix.stackexchange.com/questions/532590",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/20506/"
] | 1. Open the terminal and write the command
```
sudo fdisk -l
```
It will show your file system
2. Identify the partition you want permission for read and write, then type the command and give the partition name like this to your specific `sda`
```
sudo ntfsfix /dev/sda3
```
Credits: <https://askubuntu.com/a/11876... | I had a similar issue.
But in my case, there were issues with accessing the Hard Drive because Windows crashed (instead of properly shutting down), so it's possible Windows didn't properly unmount the HDD, and so Linux couldn't have proper access to it.
The fix for me was just to go into Windows, make sure the HDD is ... |
66,629,543 | I want to create an AWS IAMS account that has various permissions with CloudFormation.
I understand there are policies that would let a user change his password and let him get his account to use MFA [here](https://security.stackexchange.com/questions/124786/aws-cloudformation-enable-mfa?newreg=9d07e7c9d733438b82b483b... | 2021/03/14 | [
"https://Stackoverflow.com/questions/66629543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15234088/"
] | From [official documentation](https://flutter.dev/docs/development/accessibility-and-localization/internationalization)
By default, Flutter only provides US English localizations. To add support for other languages, an application must specify additional MaterialApp (or CupertinoApp) properties, and include a package ... | Try using langdetect (if you use tkinter)
```
from langdetect import detect
from tkinter import *
from tkinter.constants import *
arabictext = "مرحبا"
root = Tk()
text = Text(root)
lang = detect(arabictext)
if lang == "ar":
text.tag_configure('tag-right', justify='right')
text.insert('end', arabictext, 'tag... |
66,629,543 | I want to create an AWS IAMS account that has various permissions with CloudFormation.
I understand there are policies that would let a user change his password and let him get his account to use MFA [here](https://security.stackexchange.com/questions/124786/aws-cloudformation-enable-mfa?newreg=9d07e7c9d733438b82b483b... | 2021/03/14 | [
"https://Stackoverflow.com/questions/66629543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15234088/"
] | you can use this
<https://pub.dev/packages/auto_direction>
This package changes the direction of a widget from ltr direction into rtl direction and vice versa based on the language of the text provided. | Try using langdetect (if you use tkinter)
```
from langdetect import detect
from tkinter import *
from tkinter.constants import *
arabictext = "مرحبا"
root = Tk()
text = Text(root)
lang = detect(arabictext)
if lang == "ar":
text.tag_configure('tag-right', justify='right')
text.insert('end', arabictext, 'tag... |
66,629,543 | I want to create an AWS IAMS account that has various permissions with CloudFormation.
I understand there are policies that would let a user change his password and let him get his account to use MFA [here](https://security.stackexchange.com/questions/124786/aws-cloudformation-enable-mfa?newreg=9d07e7c9d733438b82b483b... | 2021/03/14 | [
"https://Stackoverflow.com/questions/66629543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15234088/"
] | you can use this
<https://pub.dev/packages/auto_direction>
This package changes the direction of a widget from ltr direction into rtl direction and vice versa based on the language of the text provided. | From [official documentation](https://flutter.dev/docs/development/accessibility-and-localization/internationalization)
By default, Flutter only provides US English localizations. To add support for other languages, an application must specify additional MaterialApp (or CupertinoApp) properties, and include a package ... |
23,135 | 1. Go to this website: <http://parts-of-speech.info/>
2. Now go to this Wikipedia article: <https://en.wikipedia.org/wiki/Evolutionary_psychology>
3. Grab the first paragraph and feed it into POS tagger to see the
tags. This is an image of the result:
[:** *A multiword expression (MWE), also called phraseme, is a lexeme made up of a sequence of two or more lexemes that has properties that are not predictable from the properties of the individ... | You are dealing with **[terminology](https://en.wikipedia.org/wiki/Terminology)** (a discipline of applied linguistics) and **[term extraction](https://en.wikipedia.org/wiki/Terminology_extraction)**. You are looking for **terms**. The quoted wikipedia articles will give you some starters for further reading. |
23,135 | 1. Go to this website: <http://parts-of-speech.info/>
2. Now go to this Wikipedia article: <https://en.wikipedia.org/wiki/Evolutionary_psychology>
3. Grab the first paragraph and feed it into POS tagger to see the
tags. This is an image of the result:
[** (a discipline of applied linguistics) and **[term extraction](https://en.wikipedia.org/wiki/Terminology_extraction)**. You are looking for **terms**. The quoted wikipedia articles will give you some starters for further reading. | You may also want to look into **Idioms**. An Idiom is a phrase (series of words, usually) whose meaning is not composed of its parts, at least not without a layer of metaphorical or (usually lost) historical meaning. For example,
* The fly [kicked the bucket] (to mean the fly died)
is an idiom since knowing what [ki... |
23,135 | 1. Go to this website: <http://parts-of-speech.info/>
2. Now go to this Wikipedia article: <https://en.wikipedia.org/wiki/Evolutionary_psychology>
3. Grab the first paragraph and feed it into POS tagger to see the
tags. This is an image of the result:
[:** *A multiword expression (MWE), also called phraseme, is a lexeme made up of a sequence of two or more lexemes that has properties that are not predictable from the properties of the individ... | These are called multi-word expressions (MWEs). Before we put things into a POS tagger, we need to perform another process known as *tokenisation* to separate characters into words. This is especially important in Chinese, where there are no whitespaces at all, but is also needed in English, where strings surrounded by... |
23,135 | 1. Go to this website: <http://parts-of-speech.info/>
2. Now go to this Wikipedia article: <https://en.wikipedia.org/wiki/Evolutionary_psychology>
3. Grab the first paragraph and feed it into POS tagger to see the
tags. This is an image of the result:
[. Before we put things into a POS tagger, we need to perform another process known as *tokenisation* to separate characters into words. This is especially important in Chinese, where there are no whitespaces at all, but is also needed in English, where strings surrounded by... | You may also want to look into **Idioms**. An Idiom is a phrase (series of words, usually) whose meaning is not composed of its parts, at least not without a layer of metaphorical or (usually lost) historical meaning. For example,
* The fly [kicked the bucket] (to mean the fly died)
is an idiom since knowing what [ki... |
23,135 | 1. Go to this website: <http://parts-of-speech.info/>
2. Now go to this Wikipedia article: <https://en.wikipedia.org/wiki/Evolutionary_psychology>
3. Grab the first paragraph and feed it into POS tagger to see the
tags. This is an image of the result:
[:** *A multiword expression (MWE), also called phraseme, is a lexeme made up of a sequence of two or more lexemes that has properties that are not predictable from the properties of the individ... | You may also want to look into **Idioms**. An Idiom is a phrase (series of words, usually) whose meaning is not composed of its parts, at least not without a layer of metaphorical or (usually lost) historical meaning. For example,
* The fly [kicked the bucket] (to mean the fly died)
is an idiom since knowing what [ki... |
17,529,012 | For far too long I've been stumbling around trying to make a simple .click jquery method work in my c# site. I just want it to call to a function in my controller, but I can't seem to get any button click to register. The calls in it are very similar to a .change() function for another control that works just fine.
JQ... | 2013/07/08 | [
"https://Stackoverflow.com/questions/17529012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2547781/"
] | Did you try debugging your function or even putting alerts in it to flesh out whats happening.
```
$('#addUserButton').click(function () {
alert("FUNCTION IS GETTING CALLED ON CLICK EVENT");
var e = document.getElementById('searchDDL');
alert(e);
var itemText = e.options[e.selectedIndex].text;
... | It's not something silly like the extra closing `>` bracket on this?
```
<button id="addUserButton" type="button" value="addUser">></button>
``` |
17,529,012 | For far too long I've been stumbling around trying to make a simple .click jquery method work in my c# site. I just want it to call to a function in my controller, but I can't seem to get any button click to register. The calls in it are very similar to a .change() function for another control that works just fine.
JQ... | 2013/07/08 | [
"https://Stackoverflow.com/questions/17529012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2547781/"
] | Did you try debugging your function or even putting alerts in it to flesh out whats happening.
```
$('#addUserButton').click(function () {
alert("FUNCTION IS GETTING CALLED ON CLICK EVENT");
var e = document.getElementById('searchDDL');
alert(e);
var itemText = e.options[e.selectedIndex].text;
... | From your [JSFiddle](http://jsfiddle.net/MQLB4/), **it seems you're not including the `jQuery`.**
***Which is at the top-left corner of JSFiddle.***
I've [updated fiddle](http://jsfiddle.net/MQLB4/4/) working fine. Remember you're including `jQuery`, so try to make use of its feature and leave Javascript. |
60,886,431 | I have a section of html that needs to be displayed in a certain way but some elements may be optional and I'm not sure if I can do it with `display:grid`.
I need to have 3 columns, but the first and last one are optional and I need to remove the gap when they are not present.
Note that the markup needs to be this on... | 2020/03/27 | [
"https://Stackoverflow.com/questions/60886431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1458442/"
] | Rely on implicit column creation and keep only one explicit column
```css
.grid {
display: grid;
grid-template-columns: 1fr; /* one column here */
grid-gap: 0 20px;
align-items: center;
background-color: lightgrey;
}
.grid > .image {
grid-column: -3; /* this will create an implicit column at the s... | Instead of using grid gaps, **use margins** on the individual elements.
```css
.grid {
display: grid;
grid-auto-columns: auto 1fr auto;
/* grid-gap: 0 20px; */
align-items: center;
background-color: lightgrey;
}
.grid > .image {
margin-right: 20px; /* new */
grid-column: 1;
grid-row: 1 / spa... |
35,611,371 | I tried everything I can find, but I am unable to get the result I'm looking for. I am taking two txt files, combining them together in every possible way with no duplicates and saving the output to a CSV file.
Everything works, except I can't get it to remove the middle space. For example:
list1.txt:
```
1
2
```
... | 2016/02/24 | [
"https://Stackoverflow.com/questions/35611371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3526961/"
] | Use the below code
```
foreach ($array1 as $key1){
foreach ($array2 as $key2){
$array3[] = trim($key1).trim($key2);
$array4[] = trim($key2).trim($key1);
}
}
```
Or Use array\_map function to trim all the elements of an array
```
$array = array_map('trim', $array);
``` | As Ravinder and Rizier stated, use trim(). So for example:
```
<?php
$array1 = file('list1.txt');
$array2 = file('list2.txt');
$array3 = array();
$array4 = array();
foreach ($array1 as $key1)
{
foreach ($array2 as $key2)
{
$array3[] = trim($key1) . trim($key2);
... |
35,611,371 | I tried everything I can find, but I am unable to get the result I'm looking for. I am taking two txt files, combining them together in every possible way with no duplicates and saving the output to a CSV file.
Everything works, except I can't get it to remove the middle space. For example:
list1.txt:
```
1
2
```
... | 2016/02/24 | [
"https://Stackoverflow.com/questions/35611371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3526961/"
] | Use the below code
```
foreach ($array1 as $key1){
foreach ($array2 as $key2){
$array3[] = trim($key1).trim($key2);
$array4[] = trim($key2).trim($key1);
}
}
```
Or Use array\_map function to trim all the elements of an array
```
$array = array_map('trim', $array);
``` | Try this `foreach` loop instead:
```
foreach ($array1 as $key1)
{
foreach ($array2 as $key2)
{
$key1 = trim($key1);
$key2 = trim($key2);
/*
If the above doesn't work, try this method:
(If you use this method, you should delete your $array3 and $array4 assignments)
... |
35,611,371 | I tried everything I can find, but I am unable to get the result I'm looking for. I am taking two txt files, combining them together in every possible way with no duplicates and saving the output to a CSV file.
Everything works, except I can't get it to remove the middle space. For example:
list1.txt:
```
1
2
```
... | 2016/02/24 | [
"https://Stackoverflow.com/questions/35611371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3526961/"
] | Thanks to the help from Rizier123, I solved the problem by simply changing lines 3 and 4 as follows:
```
$array1 = file('list1.txt'**, FILE\_IGNORE\_NEW\_LINES**);
$array2 = file('list2.txt'**, FILE\_IGNORE\_NEW\_LINES**);
```
The problem was due to the line breaks in my two list files, as each keyword used in the a... | Use the below code
```
foreach ($array1 as $key1){
foreach ($array2 as $key2){
$array3[] = trim($key1).trim($key2);
$array4[] = trim($key2).trim($key1);
}
}
```
Or Use array\_map function to trim all the elements of an array
```
$array = array_map('trim', $array);
``` |
35,611,371 | I tried everything I can find, but I am unable to get the result I'm looking for. I am taking two txt files, combining them together in every possible way with no duplicates and saving the output to a CSV file.
Everything works, except I can't get it to remove the middle space. For example:
list1.txt:
```
1
2
```
... | 2016/02/24 | [
"https://Stackoverflow.com/questions/35611371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3526961/"
] | Thanks to the help from Rizier123, I solved the problem by simply changing lines 3 and 4 as follows:
```
$array1 = file('list1.txt'**, FILE\_IGNORE\_NEW\_LINES**);
$array2 = file('list2.txt'**, FILE\_IGNORE\_NEW\_LINES**);
```
The problem was due to the line breaks in my two list files, as each keyword used in the a... | As Ravinder and Rizier stated, use trim(). So for example:
```
<?php
$array1 = file('list1.txt');
$array2 = file('list2.txt');
$array3 = array();
$array4 = array();
foreach ($array1 as $key1)
{
foreach ($array2 as $key2)
{
$array3[] = trim($key1) . trim($key2);
... |
35,611,371 | I tried everything I can find, but I am unable to get the result I'm looking for. I am taking two txt files, combining them together in every possible way with no duplicates and saving the output to a CSV file.
Everything works, except I can't get it to remove the middle space. For example:
list1.txt:
```
1
2
```
... | 2016/02/24 | [
"https://Stackoverflow.com/questions/35611371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3526961/"
] | Thanks to the help from Rizier123, I solved the problem by simply changing lines 3 and 4 as follows:
```
$array1 = file('list1.txt'**, FILE\_IGNORE\_NEW\_LINES**);
$array2 = file('list2.txt'**, FILE\_IGNORE\_NEW\_LINES**);
```
The problem was due to the line breaks in my two list files, as each keyword used in the a... | Try this `foreach` loop instead:
```
foreach ($array1 as $key1)
{
foreach ($array2 as $key2)
{
$key1 = trim($key1);
$key2 = trim($key2);
/*
If the above doesn't work, try this method:
(If you use this method, you should delete your $array3 and $array4 assignments)
... |
4,167,419 | >
> Let $f(x)=a(x-2)(x-b)$, where $a,b\in R$ and $a\ne0$. Also, $f(f(x))=a^3\left(x^2-(2+b)x+2b-\frac2a\right)\left(x^2-(2+b)x+2b-\frac ba\right)$, $a\ne0$ has exactly one real zeroes $5$. Find the minima and maxima of $f(x)$.
>
>
>
$f(f(x))$ is a quartic equation. So, it would have $4$ roots. Its real root should... | 2021/06/08 | [
"https://math.stackexchange.com/questions/4167419",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/87430/"
] | Let $q>3$. Then there exists a nonzero element $a\in \Bbb F\_q$ with $a^2-1\neq 0$. Let $A=\begin{pmatrix} 1 & -x \cr 0 & 1 \end{pmatrix}$ and $B=\begin{pmatrix} a & 0 \cr 0 & a^{-1} \end{pmatrix}$ in $SL(2,q)$. Then
\begin{align\*}
[A,B] & = ABA^{-1}B^{-1} \\
& =\begin{pmatrix} 1 & (a^2-1)x \cr 0 & 1 \end{pmatrix}
\e... | I might approach it via Bruhat decomposition. Let $B$ be the group of upper triangular matrices in $G$. It is the semidirect product of the group $T$ of diagonal matrices in $G$ and the group $N$ of upper triangular matrices with $1$s on the diagonal. First, show that every element of $B$ is a product of commutators in... |
73,334,904 | I've got a .showGuesses block which max-height is set to 100px. When its height goes over its maximum I want a vertical scroll bar to appear. But, unfortunately, for some reason I never get the scroll bar.
**How to make the scrollbar to appear?**
Here's the code and the result: <https://liveweave.com/hyo1ut>
HTML
`... | 2022/08/12 | [
"https://Stackoverflow.com/questions/73334904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19712456/"
] | Pattern matching and regular expressions are two different things. In pattern matching `*` means *any string*. In regular expressions it means *zero or more of what precedes*. In pattern matching `(.+)` means... the literal `(.+)` string. In regular expressions it represents a capture group with at least one character.... | To use regular expressions in `bash` you need to use `[[ $x =~ regex ]]`, and you can use groups with `$BASH_REMATCH`, so:
```
for x in *; do
[[ $x =~ ^(S2EC[0-9]+)_.*_([0-9]+).fq.gz$ ]] &&
mv $x ${BASH_REMATCH[1]}_R${BASH_REMATCH[2]}.fastq.gz
done
``` |
34,190,609 | ```
Page A
Page B
Page C
```
If the user is coming from `page A` do something on `page C` (within the same website)
If the user is coming from `page B` do something else on `page C` (within the same website)
What would be the best approach to do that in JS? (dont use `document.referrer`) | 2015/12/09 | [
"https://Stackoverflow.com/questions/34190609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3195927/"
] | In my opinion, there are two decent solutions:
1. When Page A loads Page C, include a variable in the URL that essentially says "*loaded from page A*". (Same applies to Page B.)
2. When Page A is loaded, set either a cookie, `localStorage`, or `sessionStorage` variable that says "*loaded from page A*". (Same applies f... | What you can do is have a global variable that will hold the location. When you load a page. assign that variable the location
```
window.location.href
```
or
```
document.URL;
```
Another option would be using cookies. |
34,190,609 | ```
Page A
Page B
Page C
```
If the user is coming from `page A` do something on `page C` (within the same website)
If the user is coming from `page B` do something else on `page C` (within the same website)
What would be the best approach to do that in JS? (dont use `document.referrer`) | 2015/12/09 | [
"https://Stackoverflow.com/questions/34190609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3195927/"
] | In my opinion, there are two decent solutions:
1. When Page A loads Page C, include a variable in the URL that essentially says "*loaded from page A*". (Same applies to Page B.)
2. When Page A is loaded, set either a cookie, `localStorage`, or `sessionStorage` variable that says "*loaded from page A*". (Same applies f... | Your description doesnt make a lot of sense (to me), especially because you havent included any framework/stack you're using (which this responsibility would likely fall on).
That said, I would use a variable with session getters and setters. You can parse the query string or URL, set that equal to a session variable,... |
34,190,609 | ```
Page A
Page B
Page C
```
If the user is coming from `page A` do something on `page C` (within the same website)
If the user is coming from `page B` do something else on `page C` (within the same website)
What would be the best approach to do that in JS? (dont use `document.referrer`) | 2015/12/09 | [
"https://Stackoverflow.com/questions/34190609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3195927/"
] | In my opinion, there are two decent solutions:
1. When Page A loads Page C, include a variable in the URL that essentially says "*loaded from page A*". (Same applies to Page B.)
2. When Page A is loaded, set either a cookie, `localStorage`, or `sessionStorage` variable that says "*loaded from page A*". (Same applies f... | You can have `page A` and `page B` set a cookie that indicates which page they are. Then `page C` can check the cookie value. |
1,441,686 | I am planning to use PHP's autoload function to dynamicly load only class files that are needed. Now this could create a huge mess if every single function has a seperate file, So I am hoping and asking is there a way to have related classes remain in 1 class file and still be auto-loaded
```
function __autoload($clas... | 2009/09/17 | [
"https://Stackoverflow.com/questions/1441686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143030/"
] | >
> if I were to call the dogs class but
> NOT call the animals class, would the
> animals class file still be loaded?
>
>
>
Yes. When you load an class that extends another class, PHP must load the base class so it knows what it's extending.
re: the idea of storing multiple classes per file: This will not work... | Yes it will load unless you don't include/require the class file.
You have to always import any files that contain needed PHP code. PHP itself can't guess the name you gave to your class file. Unlike Java for instance, PHP doesn't have any file naming requirements for classes.
The common way so solve this problem is ... |
1,441,686 | I am planning to use PHP's autoload function to dynamicly load only class files that are needed. Now this could create a huge mess if every single function has a seperate file, So I am hoping and asking is there a way to have related classes remain in 1 class file and still be auto-loaded
```
function __autoload($clas... | 2009/09/17 | [
"https://Stackoverflow.com/questions/1441686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143030/"
] | Have you considered explicit definitions of your class locations? Sometimes it makes a lot of sense to group related classes.
Here is a proven way of handling it.
This code is placed in an `auto_prepend_file` (or included first)
```
class Import
{
public static $_AutoLoad = array();
public static $_Imported ... | Yes it will load unless you don't include/require the class file.
You have to always import any files that contain needed PHP code. PHP itself can't guess the name you gave to your class file. Unlike Java for instance, PHP doesn't have any file naming requirements for classes.
The common way so solve this problem is ... |
1,441,686 | I am planning to use PHP's autoload function to dynamicly load only class files that are needed. Now this could create a huge mess if every single function has a seperate file, So I am hoping and asking is there a way to have related classes remain in 1 class file and still be auto-loaded
```
function __autoload($clas... | 2009/09/17 | [
"https://Stackoverflow.com/questions/1441686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143030/"
] | >
> if I were to call the dogs class but
> NOT call the animals class, would the
> animals class file still be loaded?
>
>
>
Yes. When you load an class that extends another class, PHP must load the base class so it knows what it's extending.
re: the idea of storing multiple classes per file: This will not work... | Have you considered explicit definitions of your class locations? Sometimes it makes a lot of sense to group related classes.
Here is a proven way of handling it.
This code is placed in an `auto_prepend_file` (or included first)
```
class Import
{
public static $_AutoLoad = array();
public static $_Imported ... |
1,441,686 | I am planning to use PHP's autoload function to dynamicly load only class files that are needed. Now this could create a huge mess if every single function has a seperate file, So I am hoping and asking is there a way to have related classes remain in 1 class file and still be auto-loaded
```
function __autoload($clas... | 2009/09/17 | [
"https://Stackoverflow.com/questions/1441686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143030/"
] | >
> if I were to call the dogs class but
> NOT call the animals class, would the
> animals class file still be loaded?
>
>
>
Yes. When you load an class that extends another class, PHP must load the base class so it knows what it's extending.
re: the idea of storing multiple classes per file: This will not work... | There's a workaround, I've just used it and it seems to work:
Let's assume we have an autoloaded class called animals stored in animals.class.php. In the same file you could have other classes that extends animals
```
class animals{
static function load(){
return true;
}
}
cl... |
1,441,686 | I am planning to use PHP's autoload function to dynamicly load only class files that are needed. Now this could create a huge mess if every single function has a seperate file, So I am hoping and asking is there a way to have related classes remain in 1 class file and still be auto-loaded
```
function __autoload($clas... | 2009/09/17 | [
"https://Stackoverflow.com/questions/1441686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143030/"
] | Have you considered explicit definitions of your class locations? Sometimes it makes a lot of sense to group related classes.
Here is a proven way of handling it.
This code is placed in an `auto_prepend_file` (or included first)
```
class Import
{
public static $_AutoLoad = array();
public static $_Imported ... | There's a workaround, I've just used it and it seems to work:
Let's assume we have an autoloaded class called animals stored in animals.class.php. In the same file you could have other classes that extends animals
```
class animals{
static function load(){
return true;
}
}
cl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.