qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
3,278,850 | Like `csv.reader()` are there any other functions which can read `.rtf`, `.txt`, `.doc` files in Python? | 2010/07/19 | [
"https://Stackoverflow.com/questions/3278850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277603/"
] | You can read a text file with
```
txt = open("file.txt").read()
```
Try [PyRTF](http://pyrtf.sourceforge.net/) for RTF files. I would think that reading MS Word .doc files are pretty unlikely unless you are on Windows and you can use some of the native MS interfaces for reading those files. [This article](http://www... | ```
import win32com.client
if tmpFile.endswith('.xml') or tmpFile.endswith('.doc') or tmpFile.endswith('.docx'):
app = win32com.client.Dispatch("Word.Application")
app.Visible = False
app.Documents.Open(tmpFile)
doc = app.ActiveDocument
docText = doc.Content.Text
print(docTex... |
3,278,850 | Like `csv.reader()` are there any other functions which can read `.rtf`, `.txt`, `.doc` files in Python? | 2010/07/19 | [
"https://Stackoverflow.com/questions/3278850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277603/"
] | You can read a text file with
```
txt = open("file.txt").read()
```
Try [PyRTF](http://pyrtf.sourceforge.net/) for RTF files. I would think that reading MS Word .doc files are pretty unlikely unless you are on Windows and you can use some of the native MS interfaces for reading those files. [This article](http://www... | There is a **python module** called **'docx'** which you can use to read **.docx** files. You won't be able to read .doc though because it is nearly obsolete nowadays.
```
from docx import Document
doc = Document(filepath)
# Reading Data
data = doc.paragraphs
tables = doc.tables
```
You can find it [Here](https://py... |
3,278,850 | Like `csv.reader()` are there any other functions which can read `.rtf`, `.txt`, `.doc` files in Python? | 2010/07/19 | [
"https://Stackoverflow.com/questions/3278850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277603/"
] | I've had a real headache trying to do this simple thing for word and writer documents.
There is a simple solution: call openoffice on the command line to convert your target document to text, then load the text into Python.
Other conversion tools I tried produced unreliable output, while other Python oOo libraries we... | `csv` is a specific format so you need a "parser" to read it. This is what the csv module provides as you've mentioned. Text files (usually suffixed with `.txt`) don't have any fixed "format" so you can just read them after `open`ing them (Jesse's answer gives the details). CSV files are commonly text files so your dis... |
3,278,850 | Like `csv.reader()` are there any other functions which can read `.rtf`, `.txt`, `.doc` files in Python? | 2010/07/19 | [
"https://Stackoverflow.com/questions/3278850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277603/"
] | `csv` is a specific format so you need a "parser" to read it. This is what the csv module provides as you've mentioned. Text files (usually suffixed with `.txt`) don't have any fixed "format" so you can just read them after `open`ing them (Jesse's answer gives the details). CSV files are commonly text files so your dis... | There is a **python module** called **'docx'** which you can use to read **.docx** files. You won't be able to read .doc though because it is nearly obsolete nowadays.
```
from docx import Document
doc = Document(filepath)
# Reading Data
data = doc.paragraphs
tables = doc.tables
```
You can find it [Here](https://py... |
3,278,850 | Like `csv.reader()` are there any other functions which can read `.rtf`, `.txt`, `.doc` files in Python? | 2010/07/19 | [
"https://Stackoverflow.com/questions/3278850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277603/"
] | I've had a real headache trying to do this simple thing for word and writer documents.
There is a simple solution: call openoffice on the command line to convert your target document to text, then load the text into Python.
Other conversion tools I tried produced unreliable output, while other Python oOo libraries we... | ```
import win32com.client
if tmpFile.endswith('.xml') or tmpFile.endswith('.doc') or tmpFile.endswith('.docx'):
app = win32com.client.Dispatch("Word.Application")
app.Visible = False
app.Documents.Open(tmpFile)
doc = app.ActiveDocument
docText = doc.Content.Text
print(docTex... |
3,278,850 | Like `csv.reader()` are there any other functions which can read `.rtf`, `.txt`, `.doc` files in Python? | 2010/07/19 | [
"https://Stackoverflow.com/questions/3278850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277603/"
] | I've had a real headache trying to do this simple thing for word and writer documents.
There is a simple solution: call openoffice on the command line to convert your target document to text, then load the text into Python.
Other conversion tools I tried produced unreliable output, while other Python oOo libraries we... | There is a **python module** called **'docx'** which you can use to read **.docx** files. You won't be able to read .doc though because it is nearly obsolete nowadays.
```
from docx import Document
doc = Document(filepath)
# Reading Data
data = doc.paragraphs
tables = doc.tables
```
You can find it [Here](https://py... |
3,278,850 | Like `csv.reader()` are there any other functions which can read `.rtf`, `.txt`, `.doc` files in Python? | 2010/07/19 | [
"https://Stackoverflow.com/questions/3278850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277603/"
] | ```
import win32com.client
if tmpFile.endswith('.xml') or tmpFile.endswith('.doc') or tmpFile.endswith('.docx'):
app = win32com.client.Dispatch("Word.Application")
app.Visible = False
app.Documents.Open(tmpFile)
doc = app.ActiveDocument
docText = doc.Content.Text
print(docTex... | There is a **python module** called **'docx'** which you can use to read **.docx** files. You won't be able to read .doc though because it is nearly obsolete nowadays.
```
from docx import Document
doc = Document(filepath)
# Reading Data
data = doc.paragraphs
tables = doc.tables
```
You can find it [Here](https://py... |
60,336,824 | I am trying to create a Matrix 5x5 and give to each position of the matrix the value, given the following mij = (i+j)\*10.
For example in 1,1 it would be, (1+1)\*10 = 20
```
Matrix:
20 30 40 50 60
30 ...
40 ...
50 ...
60 ...
```
In general, I do not know how can I involve the indexes of the rows and col... | 2020/02/21 | [
"https://Stackoverflow.com/questions/60336824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5122416/"
] | ```
> outer(1:5,1:5,"+")*10
[,1] [,2] [,3] [,4] [,5]
[1,] 20 30 40 50 60
[2,] 30 40 50 60 70
[3,] 40 50 60 70 80
[4,] 50 60 70 80 90
[5,] 60 70 80 90 100
``` | Here is a naive solution:
```
i <- 4
j <- 5
(matrix(1:j, i, j, byrow = TRUE) + matrix(1:i, i, j)) * 10
[,1] [,2] [,3] [,4] [,5]
[1,] 20 30 40 50 60
[2,] 30 40 50 60 70
[3,] 40 50 60 70 80
[4,] 50 60 70 80 90
``` |
60,336,824 | I am trying to create a Matrix 5x5 and give to each position of the matrix the value, given the following mij = (i+j)\*10.
For example in 1,1 it would be, (1+1)\*10 = 20
```
Matrix:
20 30 40 50 60
30 ...
40 ...
50 ...
60 ...
```
In general, I do not know how can I involve the indexes of the rows and col... | 2020/02/21 | [
"https://Stackoverflow.com/questions/60336824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5122416/"
] | Another base R solution besides [`outer` approach by @user2974951](https://stackoverflow.com/a/60336912/12158757)
```
n <- 5
mat <-(t(replicate(n,seq(n)))+seq(n))*10
```
such that
```
> mat
[,1] [,2] [,3] [,4] [,5]
[1,] 20 30 40 50 60
[2,] 30 40 50 60 70
[3,] 40 50 60 70 80
[4,] ... | Here is a naive solution:
```
i <- 4
j <- 5
(matrix(1:j, i, j, byrow = TRUE) + matrix(1:i, i, j)) * 10
[,1] [,2] [,3] [,4] [,5]
[1,] 20 30 40 50 60
[2,] 30 40 50 60 70
[3,] 40 50 60 70 80
[4,] 50 60 70 80 90
``` |
19,692,148 | I am using Twitter Bootstrap built in dropdowns, and they show on hover. The user should know they are available when the arrow/eject icons shows up. I want these dropdowns only available and able to hover once the user clicks/chooses a row from the table. The fiddle I have below shows them permanently, which isn't wha... | 2013/10/30 | [
"https://Stackoverflow.com/questions/19692148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1882740/"
] | So if you take away the `dropdown` class initially that will stop the dropdowns. If you add the `dropdown` class after the click then the drop downs will be activated.
Everywhere where you have `<li class="dropdown">` change it to `<li class="beforedropdown">`
HTML
```
<li class="beforedropdown"> <a href="#" class=... | Try using `.toggle()` method instead of `.show()`
Or bind a `.hide()` to the event that should remove the menus, such as mouseout(). |
50,891,967 | I have data as such:
```
-----------------------------------------------------
|id | col1 | col2 | col3 | col4 | col5 | col6 |
-----------------------------------------------------
| 1 | 12 | 0 | 10 | 12 | 0 | 11 |
| 2 | 12 | 0 | 0 | 10 | 0 | 11 |
| 3 | 12 | 14 | ... | 2018/06/16 | [
"https://Stackoverflow.com/questions/50891967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/954884/"
] | Using UNION ALL you can get each column separately and group by the count at the end
```
SELECT myValue, COUNT(*) as total
FROM
(
(SELECT col1 as myValue FROM a)
UNION ALL
(SELECT col2 as myValue FROM a)
UNION ALL
(SELECT col3 as myValue FROM a)
UNION ALL
(SELECT col4 as myValue FROM a)
... | You could use `union` for your current structure, but i guess you might need a better structure for your data
```
select col,count(*) as qty
from(
select col1 as col from table
union all
select col2 as col from table
union all
select col3 as col from table
union all
select col4 as col from ... |
72,472,111 | i know this question may sound stupid, but i´m having problems to check/compare Strings in an if-Statement.
I´m new to Python and we need to make a little project for our school work in python. I decided to do "Rock, Paper, Scissors" as an Console Application.
The Problem i am facing, is that i can´t really compare t... | 2022/06/02 | [
"https://Stackoverflow.com/questions/72472111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16222479/"
] | Your condition is always `true`, because only one of the inequalities can be `false` at the same time.
So `false or true or true => true`.
You should use `and` instead of `or`.
Even better, you could check whether the input is part of a set:
```
if Benutzerwahl not in {"Schere", "Stein", "Papier"}:
...
``` | use "and" instead of "or"
"or" will be true as long as one of your checks is true |
72,018,284 | Thank you all in advance, I have been trying to use the query in the post below to update null values in the name\_field column using the same column only if the values are not null
[Update Field based on Same Field not Null](https://stackoverflow.com/questions/67215386/update-field-based-on-same-field-not-null)
My t... | 2022/04/26 | [
"https://Stackoverflow.com/questions/72018284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4059316/"
] | A [`HasManyThrough` relationship](https://laravel.com/docs/9.x/eloquent-relationships#has-many-through) should work, if I'm understanding your model relationships properly:
```
public function ownVenueReviews(): HasManyThrough
{
return $this->hasManyThrough(Review::class, Venue::class);
}
``` | The raw part is only needed because you have to include the foreign key in the select portion of the sub query. Even though you may not want the user\_id in the query result it must still be selected for Laravel to be able to make the relationship match work.
```
public function ownVenuesReviews()
{
return $this->... |
72,018,284 | Thank you all in advance, I have been trying to use the query in the post below to update null values in the name\_field column using the same column only if the values are not null
[Update Field based on Same Field not Null](https://stackoverflow.com/questions/67215386/update-field-based-on-same-field-not-null)
My t... | 2022/04/26 | [
"https://Stackoverflow.com/questions/72018284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4059316/"
] | A [`HasManyThrough` relationship](https://laravel.com/docs/9.x/eloquent-relationships#has-many-through) should work, if I'm understanding your model relationships properly:
```
public function ownVenueReviews(): HasManyThrough
{
return $this->hasManyThrough(Review::class, Venue::class);
}
``` | I did it like this, but I'm not quite sure, that this is the best way, I'm open to suggestions:
```
public function ownVenuesReviews()
{
return Review::whereIn('venue_id', function($query) {
$query->select('id')
->from('venues')
->where('user_id', $this->id);
})->get();
}
``` |
30,075,796 | I'm pretty sure that the following question already has a good answer somewhere else, but it's difficult to find since I do not know the "name" of my problem.
I'm designing a class/object/"something" with the following properties:
* It is sort of a lookup table.
* It does not change after initialization.
* It has sev... | 2015/05/06 | [
"https://Stackoverflow.com/questions/30075796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109064/"
] | Singleton is the pattern, but use the safer variant where this approach avoids static initialization order fiasco and thread race conditions and since you complained about the length - we can shorten it a bit further passing the indices through the get\_entry function:
```
template <int T>
class LookupTable{
publi... | >
> I'm designing a class/object/"something" with the following properties:
>
>
> •It is sort of a lookup table.
>
>
>
```
class LookupTable
{
};
```
>
> •It does not change after initialization.
>
>
>
client code:
```
const LookupTable lookup_table = ...;
^^^^^
```
>
> •It has several non-primitive m... |
30,075,796 | I'm pretty sure that the following question already has a good answer somewhere else, but it's difficult to find since I do not know the "name" of my problem.
I'm designing a class/object/"something" with the following properties:
* It is sort of a lookup table.
* It does not change after initialization.
* It has sev... | 2015/05/06 | [
"https://Stackoverflow.com/questions/30075796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109064/"
] | Meyer's Singleton to the rescue !
```
template <class T>
struct LookupTable {
static LookupTable &get() {
static LookupTable lut;
return lut;
}
private:
LookupTable() {
// Your initialization
}
LookupTable(LookupTable const &) = delete;
LookupTable operator = (LookupT... | You should be able to accomplish what you want by just having a `static const` instance; you just need to give the class a default constructor (which would be equivalent to your `init()` function). If you need different constructors based upon the type `T`, then you can specialize `LookupTable<T>` for those types.
Wit... |
30,075,796 | I'm pretty sure that the following question already has a good answer somewhere else, but it's difficult to find since I do not know the "name" of my problem.
I'm designing a class/object/"something" with the following properties:
* It is sort of a lookup table.
* It does not change after initialization.
* It has sev... | 2015/05/06 | [
"https://Stackoverflow.com/questions/30075796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109064/"
] | Singleton is the pattern, but use the safer variant where this approach avoids static initialization order fiasco and thread race conditions and since you complained about the length - we can shorten it a bit further passing the indices through the get\_entry function:
```
template <int T>
class LookupTable{
publi... | If you want to make a class that is complete static that you never get an instance of and is only setup once then you should be able to use all static functions and have an `Init()` function that doesn't return anything and determines if `Init()` has already been called. This is just a tweak to the Singleton design.
S... |
30,075,796 | I'm pretty sure that the following question already has a good answer somewhere else, but it's difficult to find since I do not know the "name" of my problem.
I'm designing a class/object/"something" with the following properties:
* It is sort of a lookup table.
* It does not change after initialization.
* It has sev... | 2015/05/06 | [
"https://Stackoverflow.com/questions/30075796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109064/"
] | If you want to make a class that is complete static that you never get an instance of and is only setup once then you should be able to use all static functions and have an `Init()` function that doesn't return anything and determines if `Init()` has already been called. This is just a tweak to the Singleton design.
S... | If you can compile with C++14, have you considered to use a variable template?
```
// Complicated initializer function that create entries depending on T
// could be specialized for T.
template <int T>
constexpr std::vector<Entries> init() { return {T, Entries{}}; }
// Class with several non-primitive members.
templa... |
30,075,796 | I'm pretty sure that the following question already has a good answer somewhere else, but it's difficult to find since I do not know the "name" of my problem.
I'm designing a class/object/"something" with the following properties:
* It is sort of a lookup table.
* It does not change after initialization.
* It has sev... | 2015/05/06 | [
"https://Stackoverflow.com/questions/30075796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109064/"
] | Meyer's Singleton to the rescue !
```
template <class T>
struct LookupTable {
static LookupTable &get() {
static LookupTable lut;
return lut;
}
private:
LookupTable() {
// Your initialization
}
LookupTable(LookupTable const &) = delete;
LookupTable operator = (LookupT... | If you can compile with C++14, have you considered to use a variable template?
```
// Complicated initializer function that create entries depending on T
// could be specialized for T.
template <int T>
constexpr std::vector<Entries> init() { return {T, Entries{}}; }
// Class with several non-primitive members.
templa... |
30,075,796 | I'm pretty sure that the following question already has a good answer somewhere else, but it's difficult to find since I do not know the "name" of my problem.
I'm designing a class/object/"something" with the following properties:
* It is sort of a lookup table.
* It does not change after initialization.
* It has sev... | 2015/05/06 | [
"https://Stackoverflow.com/questions/30075796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109064/"
] | Singleton is the pattern, but use the safer variant where this approach avoids static initialization order fiasco and thread race conditions and since you complained about the length - we can shorten it a bit further passing the indices through the get\_entry function:
```
template <int T>
class LookupTable{
publi... | Meyer's Singleton to the rescue !
```
template <class T>
struct LookupTable {
static LookupTable &get() {
static LookupTable lut;
return lut;
}
private:
LookupTable() {
// Your initialization
}
LookupTable(LookupTable const &) = delete;
LookupTable operator = (LookupT... |
30,075,796 | I'm pretty sure that the following question already has a good answer somewhere else, but it's difficult to find since I do not know the "name" of my problem.
I'm designing a class/object/"something" with the following properties:
* It is sort of a lookup table.
* It does not change after initialization.
* It has sev... | 2015/05/06 | [
"https://Stackoverflow.com/questions/30075796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109064/"
] | If you can compile with C++14, have you considered to use a variable template?
```
// Complicated initializer function that create entries depending on T
// could be specialized for T.
template <int T>
constexpr std::vector<Entries> init() { return {T, Entries{}}; }
// Class with several non-primitive members.
templa... | You should be able to accomplish what you want by just having a `static const` instance; you just need to give the class a default constructor (which would be equivalent to your `init()` function). If you need different constructors based upon the type `T`, then you can specialize `LookupTable<T>` for those types.
Wit... |
30,075,796 | I'm pretty sure that the following question already has a good answer somewhere else, but it's difficult to find since I do not know the "name" of my problem.
I'm designing a class/object/"something" with the following properties:
* It is sort of a lookup table.
* It does not change after initialization.
* It has sev... | 2015/05/06 | [
"https://Stackoverflow.com/questions/30075796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109064/"
] | >
> I'm designing a class/object/"something" with the following properties:
>
>
> •It is sort of a lookup table.
>
>
>
```
class LookupTable
{
};
```
>
> •It does not change after initialization.
>
>
>
client code:
```
const LookupTable lookup_table = ...;
^^^^^
```
>
> •It has several non-primitive m... | You should be able to accomplish what you want by just having a `static const` instance; you just need to give the class a default constructor (which would be equivalent to your `init()` function). If you need different constructors based upon the type `T`, then you can specialize `LookupTable<T>` for those types.
Wit... |
30,075,796 | I'm pretty sure that the following question already has a good answer somewhere else, but it's difficult to find since I do not know the "name" of my problem.
I'm designing a class/object/"something" with the following properties:
* It is sort of a lookup table.
* It does not change after initialization.
* It has sev... | 2015/05/06 | [
"https://Stackoverflow.com/questions/30075796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109064/"
] | Singleton is the pattern, but use the safer variant where this approach avoids static initialization order fiasco and thread race conditions and since you complained about the length - we can shorten it a bit further passing the indices through the get\_entry function:
```
template <int T>
class LookupTable{
publi... | You should be able to accomplish what you want by just having a `static const` instance; you just need to give the class a default constructor (which would be equivalent to your `init()` function). If you need different constructors based upon the type `T`, then you can specialize `LookupTable<T>` for those types.
Wit... |
30,075,796 | I'm pretty sure that the following question already has a good answer somewhere else, but it's difficult to find since I do not know the "name" of my problem.
I'm designing a class/object/"something" with the following properties:
* It is sort of a lookup table.
* It does not change after initialization.
* It has sev... | 2015/05/06 | [
"https://Stackoverflow.com/questions/30075796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109064/"
] | >
> I'm designing a class/object/"something" with the following properties:
>
>
> •It is sort of a lookup table.
>
>
>
```
class LookupTable
{
};
```
>
> •It does not change after initialization.
>
>
>
client code:
```
const LookupTable lookup_table = ...;
^^^^^
```
>
> •It has several non-primitive m... | If you can compile with C++14, have you considered to use a variable template?
```
// Complicated initializer function that create entries depending on T
// could be specialized for T.
template <int T>
constexpr std::vector<Entries> init() { return {T, Entries{}}; }
// Class with several non-primitive members.
templa... |
7,476,158 | >
> **Possible Duplicate:**
>
> [MySQL Query to pull items, but always show a certain one at the top](https://stackoverflow.com/questions/6557086/mysql-query-to-pull-items-but-always-show-a-certain-one-at-the-top)
>
>
>
Hi I have a number of items in a database table.
At the moments they're sorted by name.
B... | 2011/09/19 | [
"https://Stackoverflow.com/questions/7476158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/568825/"
] | You can do
```
ORDER BY (id = 12) DESC, someOtherColumn
```
This will order by whether `id` equals `12` first (resulting in either `0` or `1`, hence the DESC to put the positive results first), then any other column(s) you may specify for sorting. | Perform two queries. The first query will return only the record with ID=12, and the second query will return all records with an ID other than 12.
```
SELECT * FROM <table> WHERE id=12;
SELECT * FROM <table> WHERE id!=12;
``` |
1,270,925 | The number of real solutions of equation $$\begin{vmatrix}x^2-12&-18&-5\\10&x^2+2&1\\-2&12&x^2\end{vmatrix}=0$$
is?
Well I wanted to do something like this:
$$\begin{vmatrix}-12&-18&-5\\10&2&1\\-2&12&0\end{vmatrix}+|x^2{\rm I}|=0$$
And then I got:
$$x^2=704>0$$
Does this prove that it has two real roots? | 2015/05/07 | [
"https://math.stackexchange.com/questions/1270925",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/67609/"
] | No. The operation you carried out is not true. Though you got the number of real roots as 2, which is correct, but the real roots are incorrect. The roots of the equation are 2,-2.
You can either split open one row or a column but not all in the same step.
For a speedy way to solve it:
Take $x^2=t$ and then expan... | Expanding, $f(x) = -440 + 134 x^2 - 10 x^4 + x^6$. Solving for $y=x^2$, we get two real roots.
**Edit**: Using Descartes' Rule of signs, it has at most 3 positive (3 or 1), at most 3 negative (3 or 1) roots.
Letting for $y=x^2$, we have $g(y)=-440 + 134 y - 10 y^2 + y^3$, using Descartes' rule of signs, it has at mo... |
1,270,925 | The number of real solutions of equation $$\begin{vmatrix}x^2-12&-18&-5\\10&x^2+2&1\\-2&12&x^2\end{vmatrix}=0$$
is?
Well I wanted to do something like this:
$$\begin{vmatrix}-12&-18&-5\\10&2&1\\-2&12&0\end{vmatrix}+|x^2{\rm I}|=0$$
And then I got:
$$x^2=704>0$$
Does this prove that it has two real roots? | 2015/05/07 | [
"https://math.stackexchange.com/questions/1270925",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/67609/"
] | No. The operation you carried out is not true. Though you got the number of real roots as 2, which is correct, but the real roots are incorrect. The roots of the equation are 2,-2.
You can either split open one row or a column but not all in the same step.
For a speedy way to solve it:
Take $x^2=t$ and then expan... | You cannot use the ``rule'' $\det (A+B) = \det A + \det B$, as it's just wrong :) Try adding the second row to the first and subtracting the third row from it. Such row operations do not change the determinant. |
1,270,925 | The number of real solutions of equation $$\begin{vmatrix}x^2-12&-18&-5\\10&x^2+2&1\\-2&12&x^2\end{vmatrix}=0$$
is?
Well I wanted to do something like this:
$$\begin{vmatrix}-12&-18&-5\\10&2&1\\-2&12&0\end{vmatrix}+|x^2{\rm I}|=0$$
And then I got:
$$x^2=704>0$$
Does this prove that it has two real roots? | 2015/05/07 | [
"https://math.stackexchange.com/questions/1270925",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/67609/"
] | You cannot use the ``rule'' $\det (A+B) = \det A + \det B$, as it's just wrong :) Try adding the second row to the first and subtracting the third row from it. Such row operations do not change the determinant. | Expanding, $f(x) = -440 + 134 x^2 - 10 x^4 + x^6$. Solving for $y=x^2$, we get two real roots.
**Edit**: Using Descartes' Rule of signs, it has at most 3 positive (3 or 1), at most 3 negative (3 or 1) roots.
Letting for $y=x^2$, we have $g(y)=-440 + 134 y - 10 y^2 + y^3$, using Descartes' rule of signs, it has at mo... |
374,968 | I am working in manufacturing related industry. I am tasked with building some models to predict some physical quantities (for example, size of a hole in the structure) from spectra. The data usually comes in groups, for example my customer would 10 of their products and let us collect data on these products. Since the... | 2018/11/02 | [
"https://stats.stackexchange.com/questions/374968",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/223110/"
] | I suppose you want to test whether there is significant evidence that either opinion X or Y has stronger support.
**Simulated data.** One model for your data, in which opinion X is very slightly more popular than opinion Y, might be that you have $N \sim \mathsf{Pois}(\lambda = 90)$
people answering each of the questi... | Since you have a table of counts, you will want to use methods appropriate for count data. These might include chi-square test and logistic regression.
The simplest approach for your data would be to treat each Question separately. You will be assessing if the proportion of X and Y follow a null 50% / 50% distribution... |
11,984,083 | I just learned how to [profile OpenLaszlo applications using Flash Builder](https://stackoverflow.com/questions/11956784/). The approach mentioned in that discussion means that an OpenLaszlo application is compiled into an SWF file with the debug option enabled for the Flex compiler. The generated SWF file can then be ... | 2012/08/16 | [
"https://Stackoverflow.com/questions/11984083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I had "clang failed with exit code 254 only for iOS device target". It was a strange one since I have 2 targets (for free and paid for versions of the app). One target had the error and to fix I had to change the build settings architecture to armv7. The other targer archived without a problem on armv6. Maybe something... | It turns out that the header file Qt used for atomic variable linked to ppc header instead of armv7. The ppc header contains some inline assembly code and crashed the cross compiler. |
52,520,463 | I am trying to get the **value of bgcol** in the string (255;0;0).
I didn't manage to figure out lookaheads in R, which should be useful for this task, so I had to combine a `regexpr+regmatches` with 2 subsequent `gsub` calls.
```
string <- "<params description=\"some desc\" bgcol=\"248;186;203\" col=\"0;200;0\"/>"
s... | 2018/09/26 | [
"https://Stackoverflow.com/questions/52520463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3682794/"
] | You may either use a `regmatches`/`regexec`:
```
string <- "<params description=\"some desc\" bgcol=\"255;0;0\"/>"
lapply(strsplit(regmatches(string, regexec('bgcol="([^"]*)"', string))[[1]][2], ";"), as.integer)
## => [[1]]
## [1] 255 0 0
```
The `bgcol="([^"]*)"` pattern matches `bgcol="`, then matches and ... | You can use this pattern `'.*bgcol=\"(\\d*;\\d*;\\d*)\"\\s?.*'`
```
> bgcol <- gsub('.*bgcol=\"(\\d*;\\d*;\\d*)\"\\s?.*', "\\1", strings)
> lapply(strsplit(bgcol, ";"), as.integer)
[[1]]
[1] 255 0 0
[[2]]
[1] 248 186 203
``` |
52,520,463 | I am trying to get the **value of bgcol** in the string (255;0;0).
I didn't manage to figure out lookaheads in R, which should be useful for this task, so I had to combine a `regexpr+regmatches` with 2 subsequent `gsub` calls.
```
string <- "<params description=\"some desc\" bgcol=\"248;186;203\" col=\"0;200;0\"/>"
s... | 2018/09/26 | [
"https://Stackoverflow.com/questions/52520463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3682794/"
] | You can use this pattern `'.*bgcol=\"(\\d*;\\d*;\\d*)\"\\s?.*'`
```
> bgcol <- gsub('.*bgcol=\"(\\d*;\\d*;\\d*)\"\\s?.*', "\\1", strings)
> lapply(strsplit(bgcol, ";"), as.integer)
[[1]]
[1] 255 0 0
[[2]]
[1] 248 186 203
``` | you can use `read.table`
```
read.table(text = gsub('.*bgcol.*?(\\d+;\\d+;\\d+).*', '\\1', string), sep=';')
V1 V2 V3
1 248 186 203
2 255 0 0
``` |
52,520,463 | I am trying to get the **value of bgcol** in the string (255;0;0).
I didn't manage to figure out lookaheads in R, which should be useful for this task, so I had to combine a `regexpr+regmatches` with 2 subsequent `gsub` calls.
```
string <- "<params description=\"some desc\" bgcol=\"248;186;203\" col=\"0;200;0\"/>"
s... | 2018/09/26 | [
"https://Stackoverflow.com/questions/52520463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3682794/"
] | You can use this pattern `'.*bgcol=\"(\\d*;\\d*;\\d*)\"\\s?.*'`
```
> bgcol <- gsub('.*bgcol=\"(\\d*;\\d*;\\d*)\"\\s?.*', "\\1", strings)
> lapply(strsplit(bgcol, ";"), as.integer)
[[1]]
[1] 255 0 0
[[2]]
[1] 248 186 203
``` | If you had your data in a nice little dataframe, like:
```
df <- tibble(string <- c("<params description=\"some desc\" bgcol=\"248;186;203\" col=\"0;200;0\"/>",
"<params description=\"some desc\" bgcol=\"255;0;0\"/>"))
```
Then you could just do this
```
df %>% mutate(bgcol.value = str_extract(string,... |
52,520,463 | I am trying to get the **value of bgcol** in the string (255;0;0).
I didn't manage to figure out lookaheads in R, which should be useful for this task, so I had to combine a `regexpr+regmatches` with 2 subsequent `gsub` calls.
```
string <- "<params description=\"some desc\" bgcol=\"248;186;203\" col=\"0;200;0\"/>"
s... | 2018/09/26 | [
"https://Stackoverflow.com/questions/52520463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3682794/"
] | You may either use a `regmatches`/`regexec`:
```
string <- "<params description=\"some desc\" bgcol=\"255;0;0\"/>"
lapply(strsplit(regmatches(string, regexec('bgcol="([^"]*)"', string))[[1]][2], ";"), as.integer)
## => [[1]]
## [1] 255 0 0
```
The `bgcol="([^"]*)"` pattern matches `bgcol="`, then matches and ... | you can use `read.table`
```
read.table(text = gsub('.*bgcol.*?(\\d+;\\d+;\\d+).*', '\\1', string), sep=';')
V1 V2 V3
1 248 186 203
2 255 0 0
``` |
52,520,463 | I am trying to get the **value of bgcol** in the string (255;0;0).
I didn't manage to figure out lookaheads in R, which should be useful for this task, so I had to combine a `regexpr+regmatches` with 2 subsequent `gsub` calls.
```
string <- "<params description=\"some desc\" bgcol=\"248;186;203\" col=\"0;200;0\"/>"
s... | 2018/09/26 | [
"https://Stackoverflow.com/questions/52520463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3682794/"
] | You may either use a `regmatches`/`regexec`:
```
string <- "<params description=\"some desc\" bgcol=\"255;0;0\"/>"
lapply(strsplit(regmatches(string, regexec('bgcol="([^"]*)"', string))[[1]][2], ";"), as.integer)
## => [[1]]
## [1] 255 0 0
```
The `bgcol="([^"]*)"` pattern matches `bgcol="`, then matches and ... | If you had your data in a nice little dataframe, like:
```
df <- tibble(string <- c("<params description=\"some desc\" bgcol=\"248;186;203\" col=\"0;200;0\"/>",
"<params description=\"some desc\" bgcol=\"255;0;0\"/>"))
```
Then you could just do this
```
df %>% mutate(bgcol.value = str_extract(string,... |
9,779,332 | From this question
[How do I use a (generic) vector in go?](https://stackoverflow.com/questions/1726336/how-do-i-use-a-generic-vector-in-go)
I tried to create a new vector but the compiler says it is undefined:
```
$ 6g -V
6g version release.r60.3 9516
$ cat > vectest.go <<.
> package main
>
> import vector "conta... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9779332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20654/"
] | >
> [weekly.2011-10-18](http://weekly.golang.org/doc/devel/weekly.html#2011-10-18)
>
>
> The container/vector package has been deleted. Slices are better.
> [SliceTricks: How to do vector-esque things with slices.](http://code.google.com/p/go-wiki/wiki/SliceTricks)
>
>
>
I revised [your `convertToLCD` code](htt... | It's true there is no vector.New in r60.3, but rather than patch up this code, you should learn the new append function. It made the vector package unnecessary, and in fact the package was removed some time ago from the weekly releases. |
67,253,770 | I have a parent component, the parent component has multiple child components inside it.. The parent component has a Save button..
The child components have field/controls like textbox and other types.
Whenever any text or any other fields in the child components are modified/touched i want to enable the Save button ... | 2021/04/25 | [
"https://Stackoverflow.com/questions/67253770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15738664/"
] | try changing **headers** of axios with
```
'content-type': 'multipart/form-data'
``` | I found out : i was sending this
```
Axios.create({baseURL: 'http://localhost:4444'}).post('/api/testUploadImage', {avatarBase64: fd});
```
instead of this :
```
Axios.create({baseURL: 'http://localhost:4444'}).post('/api/testUploadImage', fd);
``` |
67,253,770 | I have a parent component, the parent component has multiple child components inside it.. The parent component has a Save button..
The child components have field/controls like textbox and other types.
Whenever any text or any other fields in the child components are modified/touched i want to enable the Save button ... | 2021/04/25 | [
"https://Stackoverflow.com/questions/67253770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15738664/"
] | try changing **headers** of axios with
```
'content-type': 'multipart/form-data'
``` | change your multer version and try it agian
npm i multer@2.0.0-rc.2
and edit this:
```
Axios.create({baseURL: 'http://localhost:4444'}).post('/api/testUploadImage', fd);
``` |
19,468,432 | EDIT: First of all, sorry for not pasting the link directly. Secondly, thank you ALL for the help, everything works now. Thank you Manoz especially for pasting my code and fixing it. This website is magical, I've been trying (and failing) to make my code work all day yesterday, so I thought to give this website a try a... | 2013/10/19 | [
"https://Stackoverflow.com/questions/19468432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2898244/"
] | If Tony Barnes's idea didn't work (which you should try), you might just not be saving the file before you refresh your browser. | I see nothing wrong with your code. Until you post it in your question (<https://meta.stackexchange.com/questions/22186/how-do-i-format-my-code-blocks>) I'm not going to try it out, but it could be a caching problem. Ctrl+Shift+R (Win) Cmd+Shift+R (Mac) to refresh the page with a new cache. I noticed that you're using ... |
19,468,432 | EDIT: First of all, sorry for not pasting the link directly. Secondly, thank you ALL for the help, everything works now. Thank you Manoz especially for pasting my code and fixing it. This website is magical, I've been trying (and failing) to make my code work all day yesterday, so I thought to give this website a try a... | 2013/10/19 | [
"https://Stackoverflow.com/questions/19468432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2898244/"
] | If Tony Barnes's idea didn't work (which you should try), you might just not be saving the file before you refresh your browser. | The issue for me, is just that there is a cache file that is present in the browser. I had the same issue, so I had to remove that using CTRL + F5.
Otherwise, what does the red line means in the code? Does your text editors shows the error when you hover over to it? I am sure it would help you.
Third thing would be, ... |
19,468,432 | EDIT: First of all, sorry for not pasting the link directly. Secondly, thank you ALL for the help, everything works now. Thank you Manoz especially for pasting my code and fixing it. This website is magical, I've been trying (and failing) to make my code work all day yesterday, so I thought to give this website a try a... | 2013/10/19 | [
"https://Stackoverflow.com/questions/19468432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2898244/"
] | I see nothing wrong with your code. Until you post it in your question (<https://meta.stackexchange.com/questions/22186/how-do-i-format-my-code-blocks>) I'm not going to try it out, but it could be a caching problem. Ctrl+Shift+R (Win) Cmd+Shift+R (Mac) to refresh the page with a new cache. I noticed that you're using ... | The issue for me, is just that there is a cache file that is present in the browser. I had the same issue, so I had to remove that using CTRL + F5.
Otherwise, what does the red line means in the code? Does your text editors shows the error when you hover over to it? I am sure it would help you.
Third thing would be, ... |
59,538,781 | New to and learning React. I have a data file that I am reading in in order to render the Card component for each item. Right now, just one card with nothing in it (one card in the initial state) renders. How do I render multiple components by passing through properties from a data file?
**Card.js**
```js
import Reac... | 2019/12/31 | [
"https://Stackoverflow.com/questions/59538781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9085483/"
] | So, broadly your SQL query is correct (after fixing a couple of typos) although as [@felixmosh](https://stackoverflow.com/users/6539317/felixmosh) points out it has no user information in it: might be tricky to figure out who voted for what! But perhaps you don't need that for your purposes.
Your posted solution will ... | After hours of trying to figure this out I finally got it. Here is solution:
```js
return knex
.from('question')
.select(
'question.id AS question_id',
knex.raw(
`count(DISTINCT vote) AS number_of_votes`,
),
knex.raw(
`SELECT sum(vote) from vote WHERE question_id = question.id GRO... |
40,310,576 | Using Swift, I have an array of about 30 strings (each string is a single word). I also have a variable string and I want to check if the string has a matching value in the array.
My question is, from an efficiency standpoint, should I just use:
```
if myArray.contains("MyString") {
//Do stuff
}
```
Or should I... | 2016/10/28 | [
"https://Stackoverflow.com/questions/40310576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3754003/"
] | From an efficiency standpoint it is more efficient to use `myArray.contains("myString")` since it will stop once it reaches value equal to "myString" , if it does exist in the array at all. A `for-loop` will continue through all the values even after it finds the value you have specified so it is less efficient but pro... | This is the kind of thing where code readability is way more important than performance. The difference in a for-loop and a contains will be pretty much unnoticeable unless you have a really huge array you are using. In my opinion, you should go with contains. |
40,310,576 | Using Swift, I have an array of about 30 strings (each string is a single word). I also have a variable string and I want to check if the string has a matching value in the array.
My question is, from an efficiency standpoint, should I just use:
```
if myArray.contains("MyString") {
//Do stuff
}
```
Or should I... | 2016/10/28 | [
"https://Stackoverflow.com/questions/40310576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3754003/"
] | From an efficiency standpoint it is more efficient to use `myArray.contains("myString")` since it will stop once it reaches value equal to "myString" , if it does exist in the array at all. A `for-loop` will continue through all the values even after it finds the value you have specified so it is less efficient but pro... | If you really care about performance and you have a large dataset, the HashSet or in Swift, simply Set will give you O(1) lookup time for a contains call. So using the better data structure will have a massive impact on performance here while the implementation detail of using a loop or the contains function will be a ... |
132,447 | 
I am really confused and would appreciate help on this....
I know if you have constants as limits of integration and you want to switch them
you just switch the limits from dx to dy and switch the order of integration of variables.....
however i am... | 2012/04/16 | [
"https://math.stackexchange.com/questions/132447",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/18802/"
] | I think your problems are due to the fact that you are identifying groups with their underlying sets.
As you've pointed in the first diagram you have to see $F\_S$ as $U(A)$ and $G$ as $U(Y)$, where $U$ is a functor of type
$$U \colon \mathbf{Grp} \to \mathbf{Set}$$
in particular this is the forgetful functor, which... | The functor $U$ in this case is actually the forgetful functor from ${\rm Grp}$ to ${\rm Set}$, so $A=F\_S$ and $U(A)$ is the underlying set of $F\_S$; $Y=G$ and $U(Y)$ is the underlying set of $G$. Then if we read what the diagram says, for any object $Y$ in ${\rm Grp}$, there is a unique map $g$ from $A$ to $Y$ (in $... |
132,447 | 
I am really confused and would appreciate help on this....
I know if you have constants as limits of integration and you want to switch them
you just switch the limits from dx to dy and switch the order of integration of variables.....
however i am... | 2012/04/16 | [
"https://math.stackexchange.com/questions/132447",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/18802/"
] | The functor $U$ in this case is actually the forgetful functor from ${\rm Grp}$ to ${\rm Set}$, so $A=F\_S$ and $U(A)$ is the underlying set of $F\_S$; $Y=G$ and $U(Y)$ is the underlying set of $G$. Then if we read what the diagram says, for any object $Y$ in ${\rm Grp}$, there is a unique map $g$ from $A$ to $Y$ (in $... | Your first diagram makes no sense, since it is mixing the category of Sets with the category of Groups (I guess $\varphi$ is a group morphism, while $S$ is only a set).
Let $U : Groups \to Sets$ be the forgetful functor.
What you are really looking for when you look for the free group over $S$, is a group $F\_S$ toge... |
132,447 | 
I am really confused and would appreciate help on this....
I know if you have constants as limits of integration and you want to switch them
you just switch the limits from dx to dy and switch the order of integration of variables.....
however i am... | 2012/04/16 | [
"https://math.stackexchange.com/questions/132447",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/18802/"
] | I think your problems are due to the fact that you are identifying groups with their underlying sets.
As you've pointed in the first diagram you have to see $F\_S$ as $U(A)$ and $G$ as $U(Y)$, where $U$ is a functor of type
$$U \colon \mathbf{Grp} \to \mathbf{Set}$$
in particular this is the forgetful functor, which... | Your first diagram makes no sense, since it is mixing the category of Sets with the category of Groups (I guess $\varphi$ is a group morphism, while $S$ is only a set).
Let $U : Groups \to Sets$ be the forgetful functor.
What you are really looking for when you look for the free group over $S$, is a group $F\_S$ toge... |
63,709,760 | Are you able to assign strings to true and false?
for example I'm starting with a hash:
```
shopping_list = {
"milk" => false,
"eggs" => false,
"jalapenos" => true
}
puts "Here is your Shopping List:"
shopping_list.each do |key, value|
puts "#{key} - #{value}"
end
```
I was wanting the output to puts "pur... | 2020/09/02 | [
"https://Stackoverflow.com/questions/63709760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14209918/"
] | Use an inline `if` **or** a [`ternary if operator`](https://ruby-doc.org/core/doc/syntax/control_expressions_rdoc.html#label-Ternary+if):
```
shopping_list = {
"milk" => false,
"eggs" => false,
"jalapenos" => true
}
puts "Here is your Shopping List:"
shopping_list.each do |key, value|
puts "#{key} - #{if val... | Does this answersed your question?
```rb
shopping_list.each do |key, value|
puts "#{key} - #{purchased?(value)}"
end
def purchased?(boolean)
boolean ? 'purchased' : 'not purchased'
end
``` |
63,709,760 | Are you able to assign strings to true and false?
for example I'm starting with a hash:
```
shopping_list = {
"milk" => false,
"eggs" => false,
"jalapenos" => true
}
puts "Here is your Shopping List:"
shopping_list.each do |key, value|
puts "#{key} - #{value}"
end
```
I was wanting the output to puts "pur... | 2020/09/02 | [
"https://Stackoverflow.com/questions/63709760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14209918/"
] | Use an inline `if` **or** a [`ternary if operator`](https://ruby-doc.org/core/doc/syntax/control_expressions_rdoc.html#label-Ternary+if):
```
shopping_list = {
"milk" => false,
"eggs" => false,
"jalapenos" => true
}
puts "Here is your Shopping List:"
shopping_list.each do |key, value|
puts "#{key} - #{if val... | >
> I was wanting the output to puts "purchased" for true and "not purchased" for false.
>
>
>
You'd typically start with an [`if` expression](https://ruby-doc.org/core-2.7.1/doc/syntax/control_expressions_rdoc.html#label-if+Expression):
```
shopping_list.each do |key, value|
if value
puts "#{key} - purchas... |
9,538,397 | Having trouble on a simple one. My morning tea isn't strong enough.
IF div has a child that's an anchor THEN- blah. Don't want to add an additional class to .box
Something like:
```
$('.box').click(function(){
if ($(this).children('a')) {
//some thing
} else {
//some thing else
}
});
<di... | 2012/03/02 | [
"https://Stackoverflow.com/questions/9538397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/563282/"
] | Check the [`length`](http://api.jquery.com/length/) property:
```
$('.box').click(function(){
if ($(this).children('a').length) {
//some thing
} else {
//some thing else
}
});
```
Since the `children` method (like most jQuery methods) returns an instance of jQuery, it will always evaluate... | You can use `.find()` to search the selector for additional selectors: <http://jsfiddle.net/Nf3QH/> hope that helps! |
9,538,397 | Having trouble on a simple one. My morning tea isn't strong enough.
IF div has a child that's an anchor THEN- blah. Don't want to add an additional class to .box
Something like:
```
$('.box').click(function(){
if ($(this).children('a')) {
//some thing
} else {
//some thing else
}
});
<di... | 2012/03/02 | [
"https://Stackoverflow.com/questions/9538397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/563282/"
] | Check the [`length`](http://api.jquery.com/length/) property:
```
$('.box').click(function(){
if ($(this).children('a').length) {
//some thing
} else {
//some thing else
}
});
```
Since the `children` method (like most jQuery methods) returns an instance of jQuery, it will always evaluate... | No need for jQuery nowadays you just need to add a bit of vanilla JavaScript, notice that the code is pretty short.
```js
cells = document.querySelectorAll('div');
[].forEach.call(cells, function (el) {
//console.log(el.nodeName)
if (el.hasChildNodes() && el.firstChild.nodeName=="A... |
508,216 | Here is the result of listing the files in a directory.
```
total 4
-rw-r--r-x 1 y_wc y_wc 6828641 dez 24 18:21 file1
-rw-rw-rw- 1 y_wc y_wc 2051577 dez 24 18:13 file2
-rw-rwxr-x 1 y_wc y_wc 1874334 dez 24 18:14 file3
-rw-rwxrwx 1 y_wc y_wc 2902856 dez 24 18:14 file4
```
I'd like to concatenate the permissions in on... | 2019/03/23 | [
"https://unix.stackexchange.com/questions/508216",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/342951/"
] | `ls` has very poor options for formatting . `stat` has `--printf` option , to format has you want information about files .
a example :
```
root@linux:~# stat --printf '%A\n' /etc/passwd /etc
-rw-r--r--
drwxr-xr-x
```
in tour case because you don't the first character
```
root@linux:~# stat --printf '%A\n' file... | The first character can be removed with `cut -c 2-`
```
ls -l | tail -n+2 | cut -d" " -f1 | cut -c 2- | tr -d '\n'
``` |
3,060,863 | I'm working on a large legacy application using stateless session beans that has recently been migrated from EJB2 to EJB3, and I'd like to use dependency injection. Unfortunately, in a (IMO misguided) attempt to achieve decoupling, all actual business logic lies in "manager" classes to which the session beans forward t... | 2010/06/17 | [
"https://Stackoverflow.com/questions/3060863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16883/"
] | >
> (...) all actual business logic lies in "manager" classes to which the session beans forward their calls.
>
>
>
That was a very common pattern with EJB 2.x allowing to unit test the "manager" classes easily, outside the container, without any adherence to the EJB API.
>
> Can I somehow make these manager cla... | Pascal's suggestion about upgrading to GlassFish 3 sounds probably like the most elegant approach ;)
I'd be curious to hear what prevents moving to a more recent version (not saying there can't be a reason, just wondering what the issue is here). |
15,159,978 | Sorry if the question is very basic.
PROGRAM 1:
```
#include <iostream>
using namespace std;
int max(int &a)
{
a +=100;
return a;
}
int main ( int argc, char ** argv)
{
int x=20;
int y;
y = max(x);
cout <<"x , y value is "<<x<<"and"<<y<<endl;
}
```
**OUTPUT:**
x, y value is 120and120
PROGRAM... | 2013/03/01 | [
"https://Stackoverflow.com/questions/15159978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/916439/"
] | `PROGRAM1`: copies the referenced variable a when returning that,
`PROGRAM2`: returns a reference to the referenced variable itself (the same reference, actually?).
There will be *no difference in output* since the value is copied to variable 'y' either way.
However, The `PROGRAM1` performs *one more copy operati... | The two programs do not have a problem. The problem occurs only when you return by reference a local variable for the function. This is because that reference will disappear at the end of the function. But as you are using `a` it will still be in scope after the function call. |
15,159,978 | Sorry if the question is very basic.
PROGRAM 1:
```
#include <iostream>
using namespace std;
int max(int &a)
{
a +=100;
return a;
}
int main ( int argc, char ** argv)
{
int x=20;
int y;
y = max(x);
cout <<"x , y value is "<<x<<"and"<<y<<endl;
}
```
**OUTPUT:**
x, y value is 120and120
PROGRAM... | 2013/03/01 | [
"https://Stackoverflow.com/questions/15159978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/916439/"
] | `PROGRAM1`: copies the referenced variable a when returning that,
`PROGRAM2`: returns a reference to the referenced variable itself (the same reference, actually?).
There will be *no difference in output* since the value is copied to variable 'y' either way.
However, The `PROGRAM1` performs *one more copy operati... | As I understand it, returning by value creates a new variable, returning by reference returns a reference to the original variable, thus saving memory allocation.
For an integer, the difference is probably academic, as the reference will occupy the same amount of space in memory as the value integer would. |
15,159,978 | Sorry if the question is very basic.
PROGRAM 1:
```
#include <iostream>
using namespace std;
int max(int &a)
{
a +=100;
return a;
}
int main ( int argc, char ** argv)
{
int x=20;
int y;
y = max(x);
cout <<"x , y value is "<<x<<"and"<<y<<endl;
}
```
**OUTPUT:**
x, y value is 120and120
PROGRAM... | 2013/03/01 | [
"https://Stackoverflow.com/questions/15159978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/916439/"
] | `PROGRAM1`: copies the referenced variable a when returning that,
`PROGRAM2`: returns a reference to the referenced variable itself (the same reference, actually?).
There will be *no difference in output* since the value is copied to variable 'y' either way.
However, The `PROGRAM1` performs *one more copy operati... | If you returned a value of a local variable, the second one would be incorrect. But the difference between these variants is only that function *max* in the second one returns original object modified in it. What about the first one - it returns a copy of original value after modifying.
*So, if you worked with another... |
15,159,978 | Sorry if the question is very basic.
PROGRAM 1:
```
#include <iostream>
using namespace std;
int max(int &a)
{
a +=100;
return a;
}
int main ( int argc, char ** argv)
{
int x=20;
int y;
y = max(x);
cout <<"x , y value is "<<x<<"and"<<y<<endl;
}
```
**OUTPUT:**
x, y value is 120and120
PROGRAM... | 2013/03/01 | [
"https://Stackoverflow.com/questions/15159978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/916439/"
] | `PROGRAM1`: copies the referenced variable a when returning that,
`PROGRAM2`: returns a reference to the referenced variable itself (the same reference, actually?).
There will be *no difference in output* since the value is copied to variable 'y' either way.
However, The `PROGRAM1` performs *one more copy operati... | The only difference in your two programs is where the value of `x` is being copied out of `x` into another place [and in actual code, it probably doesn't really make any difference at all, because the compiler optimizes away the "not necessary" copy].
In your first function, `a` is an alias for `x` in main, and it ge... |
15,159,978 | Sorry if the question is very basic.
PROGRAM 1:
```
#include <iostream>
using namespace std;
int max(int &a)
{
a +=100;
return a;
}
int main ( int argc, char ** argv)
{
int x=20;
int y;
y = max(x);
cout <<"x , y value is "<<x<<"and"<<y<<endl;
}
```
**OUTPUT:**
x, y value is 120and120
PROGRAM... | 2013/03/01 | [
"https://Stackoverflow.com/questions/15159978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/916439/"
] | `PROGRAM1`: copies the referenced variable a when returning that,
`PROGRAM2`: returns a reference to the referenced variable itself (the same reference, actually?).
There will be *no difference in output* since the value is copied to variable 'y' either way.
However, The `PROGRAM1` performs *one more copy operati... | As far as I can tell, both programs are exactly alike. Did you not copy in the correct code? In general, when you pass a variable by reference, you are making changes to the original variable. When you pass it by value, you are passing a copy of the variable. This means, if you pass a variable by reference and make a c... |
54,254,017 | I need to select some items using a checkbox in each entry of a android Recycler View. Once I checked the checkbox in position 0, every 9th position checkbox also checked automatically when scrolling.
How to overcome this?
//In my adapter class
```
holder.approveCheckbox.setOnCheckedChangeListener(new CompoundBut... | 2019/01/18 | [
"https://Stackoverflow.com/questions/54254017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7720052/"
] | **Use an array to hold the state of the items**
In the adapter use a Map or a [SparseBooleanArray](https://developer.android.com/reference/android/util/SparseBooleanArray.html) (which is similar to a map but is a key-value pair of int and boolean) to store the state of all the items in our list of items and then use t... | You are facing this issue because `RecyclerView` uses ViewHolder pattern, by which it reuses the child view and reduce the memory consumption.
you can follow this [link](https://android.jlelse.eu/android-handling-checkbox-state-in-recycler-views-71b03f237022?gi=2ab70241a594)
or
you can follow these simple st... |
54,254,017 | I need to select some items using a checkbox in each entry of a android Recycler View. Once I checked the checkbox in position 0, every 9th position checkbox also checked automatically when scrolling.
How to overcome this?
//In my adapter class
```
holder.approveCheckbox.setOnCheckedChangeListener(new CompoundBut... | 2019/01/18 | [
"https://Stackoverflow.com/questions/54254017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7720052/"
] | **Use an array to hold the state of the items**
In the adapter use a Map or a [SparseBooleanArray](https://developer.android.com/reference/android/util/SparseBooleanArray.html) (which is similar to a map but is a key-value pair of int and boolean) to store the state of all the items in our list of items and then use t... | If you can get the `position` inside an annonymous implementations it means it is `final`. Like inside the checkbox listener there.
A `final position` will cause discrepancies between the data and the UI, because it wont be defined again.
At this point there should be a lint in on `onBindViewHolder` method, that has a... |
54,254,017 | I need to select some items using a checkbox in each entry of a android Recycler View. Once I checked the checkbox in position 0, every 9th position checkbox also checked automatically when scrolling.
How to overcome this?
//In my adapter class
```
holder.approveCheckbox.setOnCheckedChangeListener(new CompoundBut... | 2019/01/18 | [
"https://Stackoverflow.com/questions/54254017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7720052/"
] | **Use an array to hold the state of the items**
In the adapter use a Map or a [SparseBooleanArray](https://developer.android.com/reference/android/util/SparseBooleanArray.html) (which is similar to a map but is a key-value pair of int and boolean) to store the state of all the items in our list of items and then use t... | I got problems with this when i assigned the checkedChange listener in OnBindViewHolder, sence this would be called multiple times when recycled. what worked for me was defining the callback and listener in the viewHolder create method.
```
public class CheckBoxHolder : RecyclerView.ViewHolder
{
public Tex... |
1,748,757 | Anyone have any good resources for Delphi and Windows Aero on 7 or Vista?
We're just about to add Windows 7 to our company and want to make sure that our in-house applications use fit in as well as possible.
Using Delphi 2010 I can add the Glass Frame and the menu bar inherits an Aero look, however the TabControls, G... | 2009/11/17 | [
"https://Stackoverflow.com/questions/1748757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78334/"
] | I agree that using the Enable Runtime Themes project option should make most controls theme-aware.
[TMS Components](http://www.tmssoftware.com) are always being updated to include the latest themes, including Windows 7, and [Raize Components](http://www.raize.com/DevTools/RzComps/Default.asp) allow you to make use of ... | Just add the unit `XPMan` to the `Uses` list. |
1,748,757 | Anyone have any good resources for Delphi and Windows Aero on 7 or Vista?
We're just about to add Windows 7 to our company and want to make sure that our in-house applications use fit in as well as possible.
Using Delphi 2010 I can add the Glass Frame and the menu bar inherits an Aero look, however the TabControls, G... | 2009/11/17 | [
"https://Stackoverflow.com/questions/1748757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78334/"
] | We include our own manifest resource because, as far as I am aware, Delphi doesn't include the new manifest additions for Windows 7 (and Vista?). With help from <http://msdn.microsoft.com/en-us/library/dd371711(VS.85).aspx> and [here](http://msdn.microsoft.com/en-us/library/bb756929.aspx) and [here](http://msdn.microso... | Just add the unit `XPMan` to the `Uses` list. |
49,016,846 | I'm trying to create a webapp in azure using VSTS as the source controls. I have this:
```
"properties": {
"repoUrl": "https://clt-8601add0-7378-4c18-839d-8c46ac1cdd98.visualstudio.com/ResourceManagerTest/_git/[ProjectName]",
"branch": "master",
"isManualIntegration": true
}
```
But I get a failed provis... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49016846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273587/"
] | You'll have to initialize the `Person` object first.
```
Person author = new Person("foo", 100d);
```
Then you can change the `Book` class as follow:
```
public class Book {
private Person author;
private String title;
public Book(Person author, final String title) {
this.author = author;
... | `author` should be a new `Person`, whose name is drawn from the `name` field of `Book`'s constructor. |
49,016,846 | I'm trying to create a webapp in azure using VSTS as the source controls. I have this:
```
"properties": {
"repoUrl": "https://clt-8601add0-7378-4c18-839d-8c46ac1cdd98.visualstudio.com/ResourceManagerTest/_git/[ProjectName]",
"branch": "master",
"isManualIntegration": true
}
```
But I get a failed provis... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49016846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273587/"
] | >
> So basically it should get author's name from Person's constructor?
>
>
>
Not necessarily. You can keep the client code simple by creating the Person directly in the Book constructor.
```
public class Book {
private Person author;
private String title;
public Book(String authorName, double heigh... | `author` should be a new `Person`, whose name is drawn from the `name` field of `Book`'s constructor. |
49,016,846 | I'm trying to create a webapp in azure using VSTS as the source controls. I have this:
```
"properties": {
"repoUrl": "https://clt-8601add0-7378-4c18-839d-8c46ac1cdd98.visualstudio.com/ResourceManagerTest/_git/[ProjectName]",
"branch": "master",
"isManualIntegration": true
}
```
But I get a failed provis... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49016846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273587/"
] | Solution 1:
```
public class Book {
private Person author;
private String title;
public Book(String author, String title) {
this.author = new Person(author);
this.title = title;
}
}
class Person {
private String name;
private double height;
public static final double DEFA... | `author` should be a new `Person`, whose name is drawn from the `name` field of `Book`'s constructor. |
49,016,846 | I'm trying to create a webapp in azure using VSTS as the source controls. I have this:
```
"properties": {
"repoUrl": "https://clt-8601add0-7378-4c18-839d-8c46ac1cdd98.visualstudio.com/ResourceManagerTest/_git/[ProjectName]",
"branch": "master",
"isManualIntegration": true
}
```
But I get a failed provis... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49016846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273587/"
] | You'll have to initialize the `Person` object first.
```
Person author = new Person("foo", 100d);
```
Then you can change the `Book` class as follow:
```
public class Book {
private Person author;
private String title;
public Book(Person author, final String title) {
this.author = author;
... | >
> So basically it should get author's name from Person's constructor?
>
>
>
Not necessarily. You can keep the client code simple by creating the Person directly in the Book constructor.
```
public class Book {
private Person author;
private String title;
public Book(String authorName, double heigh... |
49,016,846 | I'm trying to create a webapp in azure using VSTS as the source controls. I have this:
```
"properties": {
"repoUrl": "https://clt-8601add0-7378-4c18-839d-8c46ac1cdd98.visualstudio.com/ResourceManagerTest/_git/[ProjectName]",
"branch": "master",
"isManualIntegration": true
}
```
But I get a failed provis... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49016846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273587/"
] | You'll have to initialize the `Person` object first.
```
Person author = new Person("foo", 100d);
```
Then you can change the `Book` class as follow:
```
public class Book {
private Person author;
private String title;
public Book(Person author, final String title) {
this.author = author;
... | There are two ways you can solve this:
* By changing the parameter type on your constructor to Person:
```
public class Book {
private Person author;
private String title;
public Raamat(Person author, String title) {
this.author = author;
this.title = title;
}
}
```
+ By initializ... |
49,016,846 | I'm trying to create a webapp in azure using VSTS as the source controls. I have this:
```
"properties": {
"repoUrl": "https://clt-8601add0-7378-4c18-839d-8c46ac1cdd98.visualstudio.com/ResourceManagerTest/_git/[ProjectName]",
"branch": "master",
"isManualIntegration": true
}
```
But I get a failed provis... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49016846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273587/"
] | Solution 1:
```
public class Book {
private Person author;
private String title;
public Book(String author, String title) {
this.author = new Person(author);
this.title = title;
}
}
class Person {
private String name;
private double height;
public static final double DEFA... | >
> So basically it should get author's name from Person's constructor?
>
>
>
Not necessarily. You can keep the client code simple by creating the Person directly in the Book constructor.
```
public class Book {
private Person author;
private String title;
public Book(String authorName, double heigh... |
49,016,846 | I'm trying to create a webapp in azure using VSTS as the source controls. I have this:
```
"properties": {
"repoUrl": "https://clt-8601add0-7378-4c18-839d-8c46ac1cdd98.visualstudio.com/ResourceManagerTest/_git/[ProjectName]",
"branch": "master",
"isManualIntegration": true
}
```
But I get a failed provis... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49016846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273587/"
] | >
> So basically it should get author's name from Person's constructor?
>
>
>
Not necessarily. You can keep the client code simple by creating the Person directly in the Book constructor.
```
public class Book {
private Person author;
private String title;
public Book(String authorName, double heigh... | There are two ways you can solve this:
* By changing the parameter type on your constructor to Person:
```
public class Book {
private Person author;
private String title;
public Raamat(Person author, String title) {
this.author = author;
this.title = title;
}
}
```
+ By initializ... |
49,016,846 | I'm trying to create a webapp in azure using VSTS as the source controls. I have this:
```
"properties": {
"repoUrl": "https://clt-8601add0-7378-4c18-839d-8c46ac1cdd98.visualstudio.com/ResourceManagerTest/_git/[ProjectName]",
"branch": "master",
"isManualIntegration": true
}
```
But I get a failed provis... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49016846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273587/"
] | Solution 1:
```
public class Book {
private Person author;
private String title;
public Book(String author, String title) {
this.author = new Person(author);
this.title = title;
}
}
class Person {
private String name;
private double height;
public static final double DEFA... | There are two ways you can solve this:
* By changing the parameter type on your constructor to Person:
```
public class Book {
private Person author;
private String title;
public Raamat(Person author, String title) {
this.author = author;
this.title = title;
}
}
```
+ By initializ... |
28,851,956 | I am using MVVM and my code is as follows
```
<ListBox Grid.Row="0"
x:Name="myListBox"
ItemsSource="{Binding Path=MyClass}"
ItemTemplate="{StaticResource MyDataTemplate}"
SelectedItem="{Binding Path=SelectedItem}"
HorizontalContentAlignment="Stretch">... | 2015/03/04 | [
"https://Stackoverflow.com/questions/28851956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1614233/"
] | Try this.
Add MouseUp event:
```
<ListBox Grid.Row="0"
x:Name="myListBox"
MouseUp="myListBox_MouseUp"
ItemsSource="{Binding Path=MyClass}"
ItemTemplate="{StaticResource MyDataTemplate}"
SelectedItem="{Binding Path=SelectedItem}"
HorizontalContentAlignment="Stret... | You can add your codes to :
```
private void listBox1_Click(object sender, MouseEventArgs e)
{
//Codes :
}
```
Or you can raise this event when you double click in the ListBox :
```
private void listBox1_DoubleClick(object sender, EventArgs e)
{
listBox1.Click+=listBox1_Cli... |
28,851,956 | I am using MVVM and my code is as follows
```
<ListBox Grid.Row="0"
x:Name="myListBox"
ItemsSource="{Binding Path=MyClass}"
ItemTemplate="{StaticResource MyDataTemplate}"
SelectedItem="{Binding Path=SelectedItem}"
HorizontalContentAlignment="Stretch">... | 2015/03/04 | [
"https://Stackoverflow.com/questions/28851956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1614233/"
] | I'm not sure that this is what you want to, but this works for me:
```
<ListBox Grid.Row="6"
x:Name="myListBox"
ItemsSource="{Binding Path=MyClassItems}"
SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}"
HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyl... | You can add your codes to :
```
private void listBox1_Click(object sender, MouseEventArgs e)
{
//Codes :
}
```
Or you can raise this event when you double click in the ListBox :
```
private void listBox1_DoubleClick(object sender, EventArgs e)
{
listBox1.Click+=listBox1_Cli... |
24,927 | The leaders of the world have met and have finally admitted that the best (and only) way of resolving global economic woes is to take stock of how much they owe each other and just pay each other off with huge cheques. They have hired you (ironically, at the lowest contract rate possible) to work out the best means of ... | 2014/03/26 | [
"https://codegolf.stackexchange.com/questions/24927",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/8555/"
] | Perl, 139 137 134 119 112
=========================
Here's another working piece of code... I will document it later.
**Golfed code**
With dictionary (112):
```
for(<>){~/:(.+);/g;$d{$c=$`}+=$1;$l=$';$d{$1}+=$2,$d{$c}-=$2while$l=~/(..):([^,]+)/g}print"$_:$d{$_}
"for keys%d
```
Without dictionary (137):
```
for($... | Ruby - 225
----------
First try in a challenge like this, sure it could be a lot better...
```
R=Hash.new(0)
def pd(s,o=nil);s.split(':').tap{|c,a|R[c]+=a.to_f;o&&R[o]-=a.to_f};end
STDIN.read.split("\n").each{|l|c,d=l.split(';');pd(c);d.split(',').each{|s|pd(s,c.split(':')[0])}}
puts R.map{|k,v|"#{k}: #{v}"}.join("\n... |
24,927 | The leaders of the world have met and have finally admitted that the best (and only) way of resolving global economic woes is to take stock of how much they owe each other and just pay each other off with huge cheques. They have hired you (ironically, at the lowest contract rate possible) to work out the best means of ... | 2014/03/26 | [
"https://codegolf.stackexchange.com/questions/24927",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/8555/"
] | PHP - ~~338~~, 280
------------------
Should work with any version of PHP 5.
**Golfed**:
```php
while(preg_match("#(..):(.+);(.*)#",fgets(STDIN),$m)){$l[$m[1]][0]=(float)$m[2];foreach(explode(",",$m[3])as$x){$_=explode(":",$x);$l[$m[1]][1][$_[0]]=(float)$_[1];}}foreach($l as$c=>$d)foreach($d[1]as$_=>$o){$l[$_][0]+=$... | PHP, 333
========
```
$a='';while(($l=trim(fgets(STDIN)))!='')$a.=$l.'\n';$a=rtrim($a,'\n');$p=explode('\n',$a);foreach($p as $q){preg_match('/^([A-Z]+)/',$q,$b);preg_match_all('/'.$b[0].':(\d+(?:\.\d+)?)/',$a,$c);$e=ltrim(strstr($q,';'),';');preg_match_all('/([A-Z]+)\:(\d+(?:\.\d+)?)/',$e,$d);echo $b[0].':'.(array_su... |
24,927 | The leaders of the world have met and have finally admitted that the best (and only) way of resolving global economic woes is to take stock of how much they owe each other and just pay each other off with huge cheques. They have hired you (ironically, at the lowest contract rate possible) to work out the best means of ... | 2014/03/26 | [
"https://codegolf.stackexchange.com/questions/24927",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/8555/"
] | K, 66
=====
```
{(((!)."SF"$+":"\:'*+a)-+/'d)+/d:"F"$(!).'"S:,"0:/:last'a:";"\:'x}
```
.
```
k)input:0:`:ledg.txt
k){(((!)."SF"$+":"\:'*+a)-+/'d)+/d:"F"$(!).'"S:,"0:/:last'a:";"\:'x} input
US| 9439.3
FR| 2598.9
ES| 852.1
PT| 90.1
IT| 887.5
IE| 48
GR| 116.8
JP| 4817.4
DE| 2903.7
UK| 1546.2
``` | C++ - 1254
==========
```
#include<iostream>
#include<cstring>
#include<vector>
#include<sstream>
#include<cstdlib>
using namespace std;int main(){vector<string>input,countries,output;vector<double>results;string last_val;int j,k,i=0;cout<<"Input\n";do{getline(cin,last_val);if(last_val!=""){input.push_back(last_val);c... |
24,927 | The leaders of the world have met and have finally admitted that the best (and only) way of resolving global economic woes is to take stock of how much they owe each other and just pay each other off with huge cheques. They have hired you (ironically, at the lowest contract rate possible) to work out the best means of ... | 2014/03/26 | [
"https://codegolf.stackexchange.com/questions/24927",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/8555/"
] | Perl, 139 137 134 119 112
=========================
Here's another working piece of code... I will document it later.
**Golfed code**
With dictionary (112):
```
for(<>){~/:(.+);/g;$d{$c=$`}+=$1;$l=$';$d{$1}+=$2,$d{$c}-=$2while$l=~/(..):([^,]+)/g}print"$_:$d{$_}
"for keys%d
```
Without dictionary (137):
```
for($... | JavaScript(ES6) ~~175~~,~~166~~, ~~161~~, ~~156~~, ~~153~~147
=============================================================
**Golfed**
```
R={};prompt().split(/\s/).map(l=>{a=l.split(/[;,:]/);c=b=a[0];a.map(v=>b=!+v?v:(R[b]=(R[b]||0)+ +v c==b?b:R[c]-=+v))});for(x in R)alert(x+':'+R[x])
```
**Ungolfed**
```
R = {};... |
24,927 | The leaders of the world have met and have finally admitted that the best (and only) way of resolving global economic woes is to take stock of how much they owe each other and just pay each other off with huge cheques. They have hired you (ironically, at the lowest contract rate possible) to work out the best means of ... | 2014/03/26 | [
"https://codegolf.stackexchange.com/questions/24927",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/8555/"
] | K, 66
=====
```
{(((!)."SF"$+":"\:'*+a)-+/'d)+/d:"F"$(!).'"S:,"0:/:last'a:";"\:'x}
```
.
```
k)input:0:`:ledg.txt
k){(((!)."SF"$+":"\:'*+a)-+/'d)+/d:"F"$(!).'"S:,"0:/:last'a:";"\:'x} input
US| 9439.3
FR| 2598.9
ES| 852.1
PT| 90.1
IT| 887.5
IE| 48
GR| 116.8
JP| 4817.4
DE| 2903.7
UK| 1546.2
``` | perl (184 characters)
---------------------
**Code**
```
%c,%d,%e=();while(<>){$_=~/(..):(.+);(.*)/;$n=$1;$c{$1}=$2;for $i(split /,/,$3){$i=~/(..):(.+)/;$d{$1}+=$2;$e{$n}+=$2;}}for $i(keys %c){$c{$i}+=$d{$i}-$e{$i};print $i.":".$c{$i}."\n";}
```
**Output**
```
UK:1546.2
DE:2903.7
IT:887.5
FR:2598.9
PT:90.1
US:9439... |
24,927 | The leaders of the world have met and have finally admitted that the best (and only) way of resolving global economic woes is to take stock of how much they owe each other and just pay each other off with huge cheques. They have hired you (ironically, at the lowest contract rate possible) to work out the best means of ... | 2014/03/26 | [
"https://codegolf.stackexchange.com/questions/24927",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/8555/"
] | C - ~~257~~ 253 if no CR at end of line
=======================================
Depends on sizeof(short)==2.
No check for buffer overflow.
```
#define C(c) x[*(short*)c]
main(i){double x[23131]={0},d;char*q,b[99],*(*s)()=strtok;for(;gets(b);)for(s(b,":"),C(b)+=atof(s(0,";"));q=s(0,":");C(b)-=d=(atof(s(0,","))),C(q)+... | Groovy 315
----------
```
def f(i){t=[:];i.eachLine(){l=it.split(/;|,/);s=l[0].split(/:/);if(!z(s[0]))t.put(s[0],0);t.put(s[0],x(z(s[0]))+x(s[1]));(1..<l.size()).each(){n=l[it].split(/:/);t.put(s[0],x(z(s[0]))-x(n[1]));if(!z(n[0]))t.put(n[0],0);t.put(n[0],x(z(n[0]))+x(n[1]))}};t.each(){println it}};def x(j){j.toDouble... |
24,927 | The leaders of the world have met and have finally admitted that the best (and only) way of resolving global economic woes is to take stock of how much they owe each other and just pay each other off with huge cheques. They have hired you (ironically, at the lowest contract rate possible) to work out the best means of ... | 2014/03/26 | [
"https://codegolf.stackexchange.com/questions/24927",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/8555/"
] | Perl, 139 137 134 119 112
=========================
Here's another working piece of code... I will document it later.
**Golfed code**
With dictionary (112):
```
for(<>){~/:(.+);/g;$d{$c=$`}+=$1;$l=$';$d{$1}+=$2,$d{$c}-=$2while$l=~/(..):([^,]+)/g}print"$_:$d{$_}
"for keys%d
```
Without dictionary (137):
```
for($... | Python, 211 185 183
===================
```
import sys,re;t,R,F=sys.stdin.read(),re.findall,float;S=lambda e,s:sum(map(F,R(e,s)))
for m in R('(..:)(.+);(.+)',t):print m[0]+`F(m[1])+S(m[0]+'([\d.]+)(?!;|\d)',t)-S('[\d.]+',m[2])`
```
Output with major test case:
```
US:9439.300000000001
FR:2598.9
ES:852.0999999999999... |
24,927 | The leaders of the world have met and have finally admitted that the best (and only) way of resolving global economic woes is to take stock of how much they owe each other and just pay each other off with huge cheques. They have hired you (ironically, at the lowest contract rate possible) to work out the best means of ... | 2014/03/26 | [
"https://codegolf.stackexchange.com/questions/24927",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/8555/"
] | K, 66
=====
```
{(((!)."SF"$+":"\:'*+a)-+/'d)+/d:"F"$(!).'"S:,"0:/:last'a:";"\:'x}
```
.
```
k)input:0:`:ledg.txt
k){(((!)."SF"$+":"\:'*+a)-+/'d)+/d:"F"$(!).'"S:,"0:/:last'a:";"\:'x} input
US| 9439.3
FR| 2598.9
ES| 852.1
PT| 90.1
IT| 887.5
IE| 48
GR| 116.8
JP| 4817.4
DE| 2903.7
UK| 1546.2
``` | Python, 211 185 183
===================
```
import sys,re;t,R,F=sys.stdin.read(),re.findall,float;S=lambda e,s:sum(map(F,R(e,s)))
for m in R('(..:)(.+);(.+)',t):print m[0]+`F(m[1])+S(m[0]+'([\d.]+)(?!;|\d)',t)-S('[\d.]+',m[2])`
```
Output with major test case:
```
US:9439.300000000001
FR:2598.9
ES:852.0999999999999... |
24,927 | The leaders of the world have met and have finally admitted that the best (and only) way of resolving global economic woes is to take stock of how much they owe each other and just pay each other off with huge cheques. They have hired you (ironically, at the lowest contract rate possible) to work out the best means of ... | 2014/03/26 | [
"https://codegolf.stackexchange.com/questions/24927",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/8555/"
] | C - ~~257~~ 253 if no CR at end of line
=======================================
Depends on sizeof(short)==2.
No check for buffer overflow.
```
#define C(c) x[*(short*)c]
main(i){double x[23131]={0},d;char*q,b[99],*(*s)()=strtok;for(;gets(b);)for(s(b,":"),C(b)+=atof(s(0,";"));q=s(0,":");C(b)-=d=(atof(s(0,","))),C(q)+... | PHP, 333
========
```
$a='';while(($l=trim(fgets(STDIN)))!='')$a.=$l.'\n';$a=rtrim($a,'\n');$p=explode('\n',$a);foreach($p as $q){preg_match('/^([A-Z]+)/',$q,$b);preg_match_all('/'.$b[0].':(\d+(?:\.\d+)?)/',$a,$c);$e=ltrim(strstr($q,';'),';');preg_match_all('/([A-Z]+)\:(\d+(?:\.\d+)?)/',$e,$d);echo $b[0].':'.(array_su... |
24,927 | The leaders of the world have met and have finally admitted that the best (and only) way of resolving global economic woes is to take stock of how much they owe each other and just pay each other off with huge cheques. They have hired you (ironically, at the lowest contract rate possible) to work out the best means of ... | 2014/03/26 | [
"https://codegolf.stackexchange.com/questions/24927",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/8555/"
] | Perl, 139 137 134 119 112
=========================
Here's another working piece of code... I will document it later.
**Golfed code**
With dictionary (112):
```
for(<>){~/:(.+);/g;$d{$c=$`}+=$1;$l=$';$d{$1}+=$2,$d{$c}-=$2while$l=~/(..):([^,]+)/g}print"$_:$d{$_}
"for keys%d
```
Without dictionary (137):
```
for($... | perl (184 characters)
---------------------
**Code**
```
%c,%d,%e=();while(<>){$_=~/(..):(.+);(.*)/;$n=$1;$c{$1}=$2;for $i(split /,/,$3){$i=~/(..):(.+)/;$d{$1}+=$2;$e{$n}+=$2;}}for $i(keys %c){$c{$i}+=$d{$i}-$e{$i};print $i.":".$c{$i}."\n";}
```
**Output**
```
UK:1546.2
DE:2903.7
IT:887.5
FR:2598.9
PT:90.1
US:9439... |
66,161,525 | We have this step in our Azure Pipeline. It runs `npm run publish-shell-ui` if the branch is `main`, and otherwise step is skipped. I would like to modify this step so that the `--dry-run` option is added if the branch is something other than `main`.
```
- task: Npm@1
displayName: "Publish"
condition: and(su... | 2021/02/11 | [
"https://Stackoverflow.com/questions/66161525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37147/"
] | Something I've used in the past are variables to store values that are changed based upon the parameters passed into the YAML pipeline/template.
I believe something like this will accomplish what you're looking for:
```
- script: |
branch='$(Build.SourceBranch)'
if [[ $branch == *"/main"* ]]
then
echo ... | You could try with [conditional insertion](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#conditional-insertion), something like this:
```yaml
- task: Npm@1
displayName: "Publish"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
i... |
20,085,788 | I was wondering if it is possible to do an str\_replace within an array. I have a script that gets values from a CSV file and put it into a mysql database. However cells within the csv file might contain '-', in order to indicate that there is no value. The current script will, however, will import the value '-' into t... | 2013/11/20 | [
"https://Stackoverflow.com/questions/20085788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2050383/"
] | the following code demonstrates how you can remove all the "-" hyphens from an array using **array\_walk**.
```
function remove_dash(&$item, $key) {
if($item === '-') $item = '';
}
$myArray = array("d" => "hello", "-", "b" => "test", "c" => "-");
array_walk($myArray, 'remove_dash');
```
(ho... | I am hoping that this is the right line you are looking at, but why not just do it as you are setting it?
```
$this->psFields1a = array(
sub_sub_category => str_replace('-','',$this->l('Sub-sub-category'))
);
``` |
39,644,616 | I've got a DAG of around 3.300 vertices which can be laid out quite successfully by `dot` as a more or less simple tree (things get complicated because vertices can have more than one predecessor from a whole different rank, so crossovers are frequent). Each vertex in the graph came into being at a specific time in the... | 2016/09/22 | [
"https://Stackoverflow.com/questions/39644616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2722968/"
] | You can make a [topological sorting](https://en.wikipedia.org/wiki/Topological_sorting) of the [DAG](https://en.wikipedia.org/wiki/Directed_acyclic_graph) to have the vertices sorted in a way that for every edge `x->y`, vertex `x` comes before than `y`.
Therefore, if you have `a -> v, b -> v`, you will get something ... | If I understood you correctly then you want to minimize the number of edge-crossings in your graph layout. If so, then the answer is "No", because this problem is proved to be NP-complete in the general case. See [this](http://epubs.siam.org/doi/abs/10.1137/0604033), "Crossing Number is NP-Complete, Garey, Johnson".
I... |
39,644,616 | I've got a DAG of around 3.300 vertices which can be laid out quite successfully by `dot` as a more or less simple tree (things get complicated because vertices can have more than one predecessor from a whole different rank, so crossovers are frequent). Each vertex in the graph came into being at a specific time in the... | 2016/09/22 | [
"https://Stackoverflow.com/questions/39644616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2722968/"
] | You can make a [topological sorting](https://en.wikipedia.org/wiki/Topological_sorting) of the [DAG](https://en.wikipedia.org/wiki/Directed_acyclic_graph) to have the vertices sorted in a way that for every edge `x->y`, vertex `x` comes before than `y`.
Therefore, if you have `a -> v, b -> v`, you will get something ... | Yes, as @Arturo-Menchaca said a topological sorting may help to reduce overlapping count of edges. But it may be not optimal. There is no good algorithm for edge crossing minimization. Problem for crossing minimization is NP-complete. The heuristics are applied for solving this problem.
This StackOverflow link may hel... |
39,644,616 | I've got a DAG of around 3.300 vertices which can be laid out quite successfully by `dot` as a more or less simple tree (things get complicated because vertices can have more than one predecessor from a whole different rank, so crossovers are frequent). Each vertex in the graph came into being at a specific time in the... | 2016/09/22 | [
"https://Stackoverflow.com/questions/39644616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2722968/"
] | Yes, as @Arturo-Menchaca said a topological sorting may help to reduce overlapping count of edges. But it may be not optimal. There is no good algorithm for edge crossing minimization. Problem for crossing minimization is NP-complete. The heuristics are applied for solving this problem.
This StackOverflow link may hel... | If I understood you correctly then you want to minimize the number of edge-crossings in your graph layout. If so, then the answer is "No", because this problem is proved to be NP-complete in the general case. See [this](http://epubs.siam.org/doi/abs/10.1137/0604033), "Crossing Number is NP-Complete, Garey, Johnson".
I... |
37,996,201 | I am trying to set a video over another one by using the css property by making the video position relevant to another one.
As you see in the pic I am trying to position the small video in the right corner. However the position of the small screen changes whenever I change the browser screen. For example it changes w... | 2016/06/23 | [
"https://Stackoverflow.com/questions/37996201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6495170/"
] | This problem is solvable is time **O(NlogN)** and constant space **O(1)**, where **N** is the number of towers.
We have to make `m` towers of equal height such that we have to build minimum floors.
**Important Observations**
**1**. Because we are building minimum floors,rather than building floors on `m` towers and ... | You sort by height in ascending or descending order, and the rest is trivial. |
37,996,201 | I am trying to set a video over another one by using the css property by making the video position relevant to another one.
As you see in the pic I am trying to position the small video in the right corner. However the position of the small screen changes whenever I change the browser screen. For example it changes w... | 2016/06/23 | [
"https://Stackoverflow.com/questions/37996201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6495170/"
] | Updating the answer from @gnasher729:
Straightforward solution for `n` element array:
1. Sort in descending order: `(5,4,2,1,1)`
2. Loop over elements and for each element look ahead `m-1` next elements. Sum the differences and save the minimum. Time complexity `O(n*m)`
Slightly more advanced solution:
1. Sort in d... | You sort by height in ascending or descending order, and the rest is trivial. |
23,369,045 | We are in the process of creating a new site and up until now have had no issues. We are still able to access our admin panel, but yesterday this message showed up in place of the home page:
>
> 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right s... | 2014/04/29 | [
"https://Stackoverflow.com/questions/23369045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3585935/"
] | `IN()` cannot be empty:
```
AND a.catid IN()
```
You need to either add your missing values or remove it when it has none. | It just happened to me that I left empty a required field called "Categories" in the Filter section in the !Cagenda component form in Joomla.
So the system build automatically the sql as `AND a.catid IN ()` with no values inside the "IN" statement.
Check all your fields have the required values ;) |
40,689,323 | How can I switch on a `Byte` value? The obvious way would be:
```
fun foo(b: Byte): Boolean {
return when(b) {
0 -> true
else -> false
}
}
```
but that fails at compile time with
```
src/ByteSwitch.kt:3:5: error: incompatible types: kotlin.Int and kotlin.Byte
0 -> true
^
```
Is there a way to ... | 2016/11/19 | [
"https://Stackoverflow.com/questions/40689323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/477476/"
] | Since Kotlin allows branch conditions to be arbitrary expressions (not necessarily constants), one approach is to accept that the `0` will be an `Int` and simply convert it explicitly to a `Byte`:
```
fun foo(b: Byte): Boolean {
return when(b) {
0.toByte() -> true
else -> false
}
}
```
Per [Ilya](https:/... | You cannot specify a byte literal in Kotlin ([nor can you in Java](https://stackoverflow.com/a/5193919/3255152)). From [Literal Constants - Basic Types - Kotlin Programming Language](https://kotlinlang.org/docs/reference/basic-types.html#literal-constants)
>
> There are the following kinds of literal constants for in... |
64,734,720 | I am a song leader at our church, and I am using a spreadsheet to track *how recently* we have used each hymn in our hymnbook. (In an effort to give some rotation to the songs we sing each week.)
Using some very [helpful guides](https://exceljet.net/formula/index-and-match-on-multiple-columns) on Exceljet, I was able ... | 2020/11/08 | [
"https://Stackoverflow.com/questions/64734720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4121863/"
] | If dates are sorted you can reduce your formula to
```
=INDEX(A:A,AGGREGATE(14,6,ROW(A:A)/(B:D=F2),1))
```
[](https://i.stack.imgur.com/5tvpi.png) | Here's a longer formula that will return the last match. I'm not sure if it fits your definition of "very complicated". This version is longer since it does not use the latest version of excel.
`=INDEX(A1:A10,MATCH(LARGE(MMULT(--(B1:D10=F2),TRANSPOSE(COLUMN(B1:D10)^0))*ROW(A1:A10),1),MMULT(--(B1:D10=F2),TRANSPOSE(COLU... |
64,734,720 | I am a song leader at our church, and I am using a spreadsheet to track *how recently* we have used each hymn in our hymnbook. (In an effort to give some rotation to the songs we sing each week.)
Using some very [helpful guides](https://exceljet.net/formula/index-and-match-on-multiple-columns) on Exceljet, I was able ... | 2020/11/08 | [
"https://Stackoverflow.com/questions/64734720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4121863/"
] | If dates are sorted you can reduce your formula to
```
=INDEX(A:A,AGGREGATE(14,6,ROW(A:A)/(B:D=F2),1))
```
[](https://i.stack.imgur.com/5tvpi.png) | If you have `Office365` and dynamic formulas then you can use simply below formula.
```
=MAX(FILTER(A2:A9,(B2:B9=F2)+(C2:C9=F2)+(D2:D9=F2)))
```
[](https://i.stack.imgur.com/yYKpu.png)
If you do not have `Office365` then try below `Array` formula.
... |
64,734,720 | I am a song leader at our church, and I am using a spreadsheet to track *how recently* we have used each hymn in our hymnbook. (In an effort to give some rotation to the songs we sing each week.)
Using some very [helpful guides](https://exceljet.net/formula/index-and-match-on-multiple-columns) on Exceljet, I was able ... | 2020/11/08 | [
"https://Stackoverflow.com/questions/64734720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4121863/"
] | If dates are sorted you can reduce your formula to
```
=INDEX(A:A,AGGREGATE(14,6,ROW(A:A)/(B:D=F2),1))
```
[](https://i.stack.imgur.com/5tvpi.png) | Your formula can be amended as follows...
```
=INDEX(ServiceDate,MATCH(2,1/MMULT(--(HymnNumbers=F2),TRANSPOSE(COLUMN(HymnNumbers))^0)))
```
However, you can avoid using MMULT as follows...
```
=INDEX(ServiceDate,LARGE(IF(HymnNumbers=F2,ROW(ServiceDate)-MIN(ROW(ServiceDate))+1),1))
```
Note that both these formula... |
36,546 | In Spanish we adopted the word *ambigú* somewhere in the 18th century with the sense of "meal with all items served at the same time", with the first text I can find that uses the word dating from 1751. Of course, we adopted the word from French *[ambigu](https://www.littre.org/definition/ambigu)*:
>
> Repas où l'on ... | 2019/05/29 | [
"https://french.stackexchange.com/questions/36546",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/20830/"
] | I never heard "ambigu" used for a meal before. In France I think we only use it for the meaning "Qui est à plusieurs sens, et par conséquent d'un sens incertain".
But for the meal I found this [source](http://portail.atilf.fr/cgi-bin/dico1look.pl?strippedhw=ambigu) (*Dictionnaire de l'Académie française* p.33 on [BNF]... | My fourth great grandfather Colonel the Baron George Frederick Wilhelm von Pfeiltizer genannt Franck, a Russian Courland Prussian officer and Pour le Merit winner who had been drafted by the Duke of York held one of these parties.
It was called a déjeuné à l'ambigu held in Cheltenham in 1810. His military service had ... |
36,546 | In Spanish we adopted the word *ambigú* somewhere in the 18th century with the sense of "meal with all items served at the same time", with the first text I can find that uses the word dating from 1751. Of course, we adopted the word from French *[ambigu](https://www.littre.org/definition/ambigu)*:
>
> Repas où l'on ... | 2019/05/29 | [
"https://french.stackexchange.com/questions/36546",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/20830/"
] | I never heard "ambigu" used for a meal before. In France I think we only use it for the meaning "Qui est à plusieurs sens, et par conséquent d'un sens incertain".
But for the meal I found this [source](http://portail.atilf.fr/cgi-bin/dico1look.pl?strippedhw=ambigu) (*Dictionnaire de l'Académie française* p.33 on [BNF]... | **1-**
>
> When was the word "ambigu" first used with the sense of "meal with all items served at the same time"?
>
>
>
The word *ambigu* used as a noun meaning *Repas où l'on sert à la fois les viandes et le dessert* can be found before the date mentioned in the question (1751) since we find it in the *Mémoire d... |
36,546 | In Spanish we adopted the word *ambigú* somewhere in the 18th century with the sense of "meal with all items served at the same time", with the first text I can find that uses the word dating from 1751. Of course, we adopted the word from French *[ambigu](https://www.littre.org/definition/ambigu)*:
>
> Repas où l'on ... | 2019/05/29 | [
"https://french.stackexchange.com/questions/36546",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/20830/"
] | **1-**
>
> When was the word "ambigu" first used with the sense of "meal with all items served at the same time"?
>
>
>
The word *ambigu* used as a noun meaning *Repas où l'on sert à la fois les viandes et le dessert* can be found before the date mentioned in the question (1751) since we find it in the *Mémoire d... | My fourth great grandfather Colonel the Baron George Frederick Wilhelm von Pfeiltizer genannt Franck, a Russian Courland Prussian officer and Pour le Merit winner who had been drafted by the Duke of York held one of these parties.
It was called a déjeuné à l'ambigu held in Cheltenham in 1810. His military service had ... |
103,361 | What you are about to read may be a very mind-boggling paragraph but please do not regard it as nonsense. Please think through it thoroughly.
In Chapter 6 of Organic Chemistry (4th ed.) by Maitland Jones Jr. and Steven A. Fleming, the following is written (p. 237):
>
> In 1970, Professor John Brauman (b. 1937) and... | 2018/10/23 | [
"https://chemistry.stackexchange.com/questions/103361",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/44877/"
] | I wonder if the pKa for water (15.7) is a typo. Usually we think it to be 14.0 (at 25C, anyway). And I wonder how much the gas phase acidity changes over this series.
Acidity in the gas phase means ROH must dissociate to RO- and H+ but doesn't put the proton onto anything else. Since the proton isn't solvated, it must... | Note that the table compares very small acidities, and the difference for different alkyl substituents is small (although the table for the gas phase data is missing), so the contribution of the alkyl groups to the total electron withdrawing effect (stabilizing the loss of a proton) is small. One doesn't think of carbo... |
42,733,543 | I have a database consists of 7 column (RequestID,Meal,Name,Address,City,Phone,Email,Status)
I wanna update the status of my Requests by entering the RequestID then the new status
I'm having a problem
>
> Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown c... | 2017/03/11 | [
"https://Stackoverflow.com/questions/42733543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7694103/"
] | Per document:
>
> write(stream) Writes the collection of pages added to this object out
> as a **PDF** file.
>
>
> Parameters: stream – An object to write the file to. The object must
> support the write method and the tell method, similar to a file
> object.
>
>
>
So the object pdf\_bytes contains a PDF fil... | [![enter image description here][1]][1]
```
import glob, sys, fitz
# To get better resolution
zoom_x = 2.0 # horizontal zoom
zoom_y = 2.0 # vertical zoom
mat = fitz.Matrix(zoom_x, zoom_y) # zoom factor 2 in each dimension
filename = "/xyz/abcd/1234.pdf" # name of pdf file you want to render
doc = fitz.open(fi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.