qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
33,185,207 | The way to have ad-hoc polymorphism (function overloading) in Haskell is through type classes (see answers to [this](https://stackoverflow.com/questions/33177019/why-has-haskell-troubles-resolving-overloaded-operators), [this](https://stackoverflow.com/questions/30039135/haskell-ad-hoc-polymorphism) and [this](https://... | 2015/10/17 | [
"https://Stackoverflow.com/questions/33185207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/286335/"
] | ### I think I've done it!!!
In my testing it seems that line-height must be at least ~115% of font-size, so if you want 50px high element you must have ~43px for things to all line up:
[](https://i.stack.imgur.com/fiWAC.png)
*Fig 1. Fon... | Try like this
As per the link:[Firefox line-height issue with input fields](https://stackoverflow.com/questions/3650530/firefox-line-height-issue-with-input-fields)
>
> line-height on input won't change unless you change the font-size
>
>
>
so reduce the font-size:50px to 45px it will look fine.
Code Below
``... |
33,185,207 | The way to have ad-hoc polymorphism (function overloading) in Haskell is through type classes (see answers to [this](https://stackoverflow.com/questions/33177019/why-has-haskell-troubles-resolving-overloaded-operators), [this](https://stackoverflow.com/questions/30039135/haskell-ad-hoc-polymorphism) and [this](https://... | 2015/10/17 | [
"https://Stackoverflow.com/questions/33185207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/286335/"
] | I've done a bit of experimenting with line-heights within input boxes and think I've come to some sort of conclusion.
It appears that if the size of the font in an input box equals or exceeds the line height, then the box changes size and its content (but **not** placeholder) changes also to fit. This is obvious if y... | SO Question - 33185205
======================
[**OP**](https://stackoverflow.com/questions/33185205/text-input-on-chrome-line-height-seems-to-have-a-minimum)
[**DEMO**](http://plnkr.co/edit/oHbhKDSPTha8ShWVOC7N?p=preview)
[**FORK**](http://plnkr.co/edit/fFm4nWajybHtLdMRQuFa?p=preview)
**Explination:** `<input>` is ... |
33,185,207 | The way to have ad-hoc polymorphism (function overloading) in Haskell is through type classes (see answers to [this](https://stackoverflow.com/questions/33177019/why-has-haskell-troubles-resolving-overloaded-operators), [this](https://stackoverflow.com/questions/30039135/haskell-ad-hoc-polymorphism) and [this](https://... | 2015/10/17 | [
"https://Stackoverflow.com/questions/33185207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/286335/"
] | ### I think I've done it!!!
In my testing it seems that line-height must be at least ~115% of font-size, so if you want 50px high element you must have ~43px for things to all line up:
[](https://i.stack.imgur.com/fiWAC.png)
*Fig 1. Fon... | **Updated base on comments below**
In order to use the same `line-height` for each of the elements I updated the CSS to this:
```
*,
*:before,
*:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
div {
line-height: 50px;
font-family: Arial;
}
input, span {
b... |
38,812 | I'm a software developer working with hardware devices that are deployed on the field. Every now and then, I would need to update the hardware's firmware (upgrades, patches, etc)
I'm thinking of now, implementing a secure channel to upgrade this firmware, and for some checking to be performed by the hardware before ac... | 2013/07/09 | [
"https://security.stackexchange.com/questions/38812",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/-1/"
] | With respect to your goals you need:
1. Data confidentiality->Encryption. The question is public one or secret one. I guess you need a secret one in which only the owner of the key can encrypt and decrypt. You don't want anyone to encrypt firmware.
2. That implies an integrity mechanism. If you use a secret key scheme... | You're going to need more than application and protocol security. You'll also need robust hardware security.
It's easy to monitor the data flowing to and from the memory chips, or to read the content of a flash chip. Instructions stored in a CPU's flash memory can be retrieved through the JTAG port. Other side channe... |
38,812 | I'm a software developer working with hardware devices that are deployed on the field. Every now and then, I would need to update the hardware's firmware (upgrades, patches, etc)
I'm thinking of now, implementing a secure channel to upgrade this firmware, and for some checking to be performed by the hardware before ac... | 2013/07/09 | [
"https://security.stackexchange.com/questions/38812",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/-1/"
] | With respect to your goals you need:
1. Data confidentiality->Encryption. The question is public one or secret one. I guess you need a secret one in which only the owner of the key can encrypt and decrypt. You don't want anyone to encrypt firmware.
2. That implies an integrity mechanism. If you use a secret key scheme... | Why reinvent the wheel? Use rsync+ssh, scp, or sftp. |
38,812 | I'm a software developer working with hardware devices that are deployed on the field. Every now and then, I would need to update the hardware's firmware (upgrades, patches, etc)
I'm thinking of now, implementing a secure channel to upgrade this firmware, and for some checking to be performed by the hardware before ac... | 2013/07/09 | [
"https://security.stackexchange.com/questions/38812",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/-1/"
] | With respect to your goals you need:
1. Data confidentiality->Encryption. The question is public one or secret one. I guess you need a secret one in which only the owner of the key can encrypt and decrypt. You don't want anyone to encrypt firmware.
2. That implies an integrity mechanism. If you use a secret key scheme... | Your question details no computational restrictions so I am assuming I have a modern CPU to solve the problem.
I personally think of shared secret as the lowest form of authentication. What you are describing seems to boil down to "How can this machine trust that the binary package it's being asked to run is in it's c... |
38,812 | I'm a software developer working with hardware devices that are deployed on the field. Every now and then, I would need to update the hardware's firmware (upgrades, patches, etc)
I'm thinking of now, implementing a secure channel to upgrade this firmware, and for some checking to be performed by the hardware before ac... | 2013/07/09 | [
"https://security.stackexchange.com/questions/38812",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/-1/"
] | You're going to need more than application and protocol security. You'll also need robust hardware security.
It's easy to monitor the data flowing to and from the memory chips, or to read the content of a flash chip. Instructions stored in a CPU's flash memory can be retrieved through the JTAG port. Other side channe... | Why reinvent the wheel? Use rsync+ssh, scp, or sftp. |
38,812 | I'm a software developer working with hardware devices that are deployed on the field. Every now and then, I would need to update the hardware's firmware (upgrades, patches, etc)
I'm thinking of now, implementing a secure channel to upgrade this firmware, and for some checking to be performed by the hardware before ac... | 2013/07/09 | [
"https://security.stackexchange.com/questions/38812",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/-1/"
] | You're going to need more than application and protocol security. You'll also need robust hardware security.
It's easy to monitor the data flowing to and from the memory chips, or to read the content of a flash chip. Instructions stored in a CPU's flash memory can be retrieved through the JTAG port. Other side channe... | Your question details no computational restrictions so I am assuming I have a modern CPU to solve the problem.
I personally think of shared secret as the lowest form of authentication. What you are describing seems to boil down to "How can this machine trust that the binary package it's being asked to run is in it's c... |
267,492 | I f
$$A= \begin{pmatrix}1& 0 & 0 \\
1 & 0 & 1\\
0 & 1 & 0 \end{pmatrix}$$
then $ A^{50} $ is
1. $$ \begin{pmatrix}1& 0 & 0 \\
50 & 1 & 0\\
50 & 0 & 1 \end{pmatrix}$$
2. $$\begin{pmatrix}1& 0 & 0 \\
48 & 1 & 0\\
48 & 0 & 1 \end{pmatrix}$$
3. $$\begin{pmatrix}1& 0 & 0 \\
25 & 1 & 0\\
25 & 0 & 1 \end{pmatrix}$$
4. $... | 2012/12/30 | [
"https://math.stackexchange.com/questions/267492",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/54373/"
] | Simplify your problem as follows. The Jordan Normal form of your matrix $A$ is
$$J = \begin{pmatrix} -1 & 0 & 0 \\ 0 & 1& 1 \\ 0& 0& 1 \end{pmatrix},$$
where the matrix $P$ is such that $P^{-1}AP = J$ is given by
$$P = \begin{pmatrix} 0 & 0& 2 \\ -1 & 1 & 1 \\ 1 & 1 &0 \end{pmatrix}.$$
Then $A^{50} = PJ^{50}P^{-1... | The answer is 3. $$\begin{pmatrix}1& 0 & 0 \\
25 & 1 & 0\\
25 & 0 & 1 \end{pmatrix}$$
Just compute $A^2$ , $A^3$ , $A^4$ and $A^5$ and you will understand the repeated pattern. |
267,492 | I f
$$A= \begin{pmatrix}1& 0 & 0 \\
1 & 0 & 1\\
0 & 1 & 0 \end{pmatrix}$$
then $ A^{50} $ is
1. $$ \begin{pmatrix}1& 0 & 0 \\
50 & 1 & 0\\
50 & 0 & 1 \end{pmatrix}$$
2. $$\begin{pmatrix}1& 0 & 0 \\
48 & 1 & 0\\
48 & 0 & 1 \end{pmatrix}$$
3. $$\begin{pmatrix}1& 0 & 0 \\
25 & 1 & 0\\
25 & 0 & 1 \end{pmatrix}$$
4. $... | 2012/12/30 | [
"https://math.stackexchange.com/questions/267492",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/54373/"
] | You should learn BenjaLim's answer, which provides a general method for dealing with this kind of problems. However, here is a simple answer just for fun. Note that
$$
A^2=
\begin{pmatrix}
1&0&0\\
1&1&0\\
1&0&1\end{pmatrix}
=I+\underbrace{\begin{pmatrix}
0&0&0\\
1&0&0\\
1&0&0\end{pmatrix}}\_{L}
$$
and $L^2=0$. There... | The answer is 3. $$\begin{pmatrix}1& 0 & 0 \\
25 & 1 & 0\\
25 & 0 & 1 \end{pmatrix}$$
Just compute $A^2$ , $A^3$ , $A^4$ and $A^5$ and you will understand the repeated pattern. |
60,911,691 | I have found a working code for this, but don't understand everything about these lines:
```
counter = np.unique(img.reshape(-1, img.shape[2]), axis=0)
print(counter.shape[0])
```
Especially these values:
```
-1, img.shape[2], axis=0
```
What does that -1 do, why is the shape 2, and why is axis 0?
And after that,... | 2020/03/29 | [
"https://Stackoverflow.com/questions/60911691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13046478/"
] | If you don't understand a complex sentence, always break them up and print shapes.
```
print(img.shape)
img2 = img.reshape(-1, img.shape[2]) # reshape the original image into -1, 3; -1 is placeholder, so lets say you have a
# numpy array with shape (6,2), if you reshape it to (-1,... | It is calculating the number of unique RGB pixel values in the image. In other word it is calculation the number of different colors in the images
`img.reshape(-1, img.shape[2])` : A three channel image flattened per channel. A 3 channel image is of shape `width x height x 3` where each channels (3 here) corresponds t... |
60,911,691 | I have found a working code for this, but don't understand everything about these lines:
```
counter = np.unique(img.reshape(-1, img.shape[2]), axis=0)
print(counter.shape[0])
```
Especially these values:
```
-1, img.shape[2], axis=0
```
What does that -1 do, why is the shape 2, and why is axis 0?
And after that,... | 2020/03/29 | [
"https://Stackoverflow.com/questions/60911691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13046478/"
] | If you don't understand a complex sentence, always break them up and print shapes.
```
print(img.shape)
img2 = img.reshape(-1, img.shape[2]) # reshape the original image into -1, 3; -1 is placeholder, so lets say you have a
# numpy array with shape (6,2), if you reshape it to (-1,... | Try this:
```
a = np.array([
[[1,2,3],[1,2,3],[1,2,3],[1,2,3]],
[[1,2,3],[1,2,3],[1,2,3],[1,2,3]]
])
a # to print the contents
a.shape # returns 2, 4, 3
```
Now, if you do reshape, it will change the shape, meaning it will re-arrange the items in the array.
```
# try:
a.reshape(2, 4, 3)
a.reshape(4, 2, ... |
60,911,691 | I have found a working code for this, but don't understand everything about these lines:
```
counter = np.unique(img.reshape(-1, img.shape[2]), axis=0)
print(counter.shape[0])
```
Especially these values:
```
-1, img.shape[2], axis=0
```
What does that -1 do, why is the shape 2, and why is axis 0?
And after that,... | 2020/03/29 | [
"https://Stackoverflow.com/questions/60911691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13046478/"
] | Try this:
```
a = np.array([
[[1,2,3],[1,2,3],[1,2,3],[1,2,3]],
[[1,2,3],[1,2,3],[1,2,3],[1,2,3]]
])
a # to print the contents
a.shape # returns 2, 4, 3
```
Now, if you do reshape, it will change the shape, meaning it will re-arrange the items in the array.
```
# try:
a.reshape(2, 4, 3)
a.reshape(4, 2, ... | It is calculating the number of unique RGB pixel values in the image. In other word it is calculation the number of different colors in the images
`img.reshape(-1, img.shape[2])` : A three channel image flattened per channel. A 3 channel image is of shape `width x height x 3` where each channels (3 here) corresponds t... |
61,947,072 | How would I merge x number of arrays created in a loop like this:
```
$pageCount = // a dynamic number
for ($i = 0; $i <= $pageCount; $i++) {
$events = get_events($search_query, $i);
}
$totalMergedEvents = ??
get_events($query, $page) {
// api call
// $eventData = json_decode($output)
// return $eventData ... | 2020/05/22 | [
"https://Stackoverflow.com/questions/61947072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1704772/"
] | If you have array of events `$events = []`.
```
$events = [];
for ($i = 0; $i <= $pageCount; $i++) {
$events[] = get_events($search_query, $i);
}
```
You can simply flatten the array.
```
$eventData = array_reduce($events, function($arr, $element) {
$arr[] = $element;
return $arr;
});
``` | If you proceed this way:
```
for ($i = 0; $i <= $pageCount; $i++) {
$events = get_events($search_query, $i);
}
```
When the loop is completed you will get only the last data fetch by the API as you are overriding the data saved in `$events`. Exemple:
```
$event = "a";
$event = "b";
echo $event; // will equal to ... |
73,525,188 | Hi everyone hope you guys well!
So here is the deal; I have an android unity project which has not extra plugin or SDK.
When I am going to try to build project, this error appears. I'm stuck with this :(
Tried With this versions;
Unity Version:2021.3.5f1 ,2020.3.25f1
Gradle version: Built-in, 7.4.2, 6.2, 7.0.2
JDK... | 2022/08/29 | [
"https://Stackoverflow.com/questions/73525188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16909470/"
] | **Suggestions:**
Download gradle version 6+ and go to preferences and give the path to that directory where you have downloaded the new gradle then go to Player publishing settings and uncheck any custom gradle or manifest (if they are checked) then check and delete files androidManifest and baseGradleTemplate from Pl... | I use Unity 2021.3, project includes Firebase, Admob, Ironsource. I did follow this steps and it's worked
* Delete folder: <PROJECT\_FOLDER>\Library\Bee\Android
* Android Resolver > Force Resolve
* Build again
Hope this helps! |
51,002,961 | I am new in xamarin I wan to add a shadow effect to my frame and avoid the top border line of my frame, I tried "hasShadow" property of frame but that doesn't help me. How can I do this.
Please help me
Here is my Xaml
```
<ListView x:Name="lv_search" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"... | 2018/06/23 | [
"https://Stackoverflow.com/questions/51002961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9618952/"
] | This article by Alex Dunn looks like what you want exactly:
[](https://i.stack.imgur.com/r8Aqn.png)
<https://alexdunn.org/2018/06/06/xamarin-tip-dynamic-elevation-frames/>
Note that you can control the Elevation as much as you want | You can use the `HasShadow="True"` atribute on Frame definition.
Where did you place the `HasShadow`? It need to be like this
```
<i> <Frame HasShadow="True" ...> </Frame> </i>
``` |
94,866 | I've become fully vested in my company's pension plan, and I intend to quit in the near future to pursue other career options. It seems the pension scheme allows me to decide what to do with the pension when I quit rather than forcing me to wait until retirement. I'll be 28 when I quit.
Based on what I've read, it see... | 2018/04/27 | [
"https://money.stackexchange.com/questions/94866",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/53608/"
] | You could look at it in terms of break even. The annuity pays for itself in 20 months (after you retire) and everything after that is profit. However, that is over-simplifying things somewhat. We all know that a chunk of money today is worth more than the same amount tomorrow, because of inflation and opportunity cost.... | You can eat your cake and have it too. The 401(k) money (or part of it) can be rolled over into an IRA and can be invested inside the IRA. Whatever you *don't* roll over and take as a lump sum is taxable income, and most likely subject to a penalty for premature distribution. I believe that 20% withholding is mandatory... |
94,866 | I've become fully vested in my company's pension plan, and I intend to quit in the near future to pursue other career options. It seems the pension scheme allows me to decide what to do with the pension when I quit rather than forcing me to wait until retirement. I'll be 28 when I quit.
Based on what I've read, it see... | 2018/04/27 | [
"https://money.stackexchange.com/questions/94866",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/53608/"
] | Using Excel's IRR function and the following cashflows:
* 10,000 today (age 28)
* -6,000 annually from age 65 to age 85 (life expectancy)
Gives me an IRR of about 5.6% (which means that the 10,000 grows at 5.6% per year for 37 years and needs to continues to grow at that rate to last another 20 years). Which isn't te... | You can eat your cake and have it too. The 401(k) money (or part of it) can be rolled over into an IRA and can be invested inside the IRA. Whatever you *don't* roll over and take as a lump sum is taxable income, and most likely subject to a penalty for premature distribution. I believe that 20% withholding is mandatory... |
63,141,325 | I am having issues with my boolean operator. I would like a div returned only if featured is true. My console log is showing false values, but true values are showing undefined.
```
{data.allContentfulProducts.nodes.map(product => {
return (
<Link
to={`/shop/${pageContext.slug}/${product.... | 2020/07/28 | [
"https://Stackoverflow.com/questions/63141325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7735041/"
] | You can use && operator to return jsx expression only if it is true.
```
{product.featured && (
<div className={styles.featuredSticker}>
<p>Look I'm New!</p>
</div>
)
``` | Deleting my cache solved this problem. Using Gatsby & Contentful. |
3,092,242 | I understand in Junit 4, @Before can be used to setup test fixtures for the test class's multiple test methods.
However, in my system, there are common test objects i would like to have available for all tests.
What is the most appropriate name for these objects and what is a good best practice way to store them? | 2010/06/22 | [
"https://Stackoverflow.com/questions/3092242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99033/"
] | The best practice is to create them in the fixture so as to keep the tests **isolated**, unless their state is not changed by the tests (such as a logger). Otherwise one may have side-effects between the tests: one test failing because of another one, or the opposite. | The preferred names for your common test objects will depend on what these objects really are (I can't help unless you provide more detail). If you want to share an object between all the tests then it must be static in your test class (JUnit will recreate the test class before every test). |
3,092,242 | I understand in Junit 4, @Before can be used to setup test fixtures for the test class's multiple test methods.
However, in my system, there are common test objects i would like to have available for all tests.
What is the most appropriate name for these objects and what is a good best practice way to store them? | 2010/06/22 | [
"https://Stackoverflow.com/questions/3092242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99033/"
] | There is definitely a use case for having some shared data between test cases. JUnit provides the @BeforeClass annotation for this. Should help you I hope...
<http://junit.sourceforge.net/javadoc/org/junit/BeforeClass.html> | The preferred names for your common test objects will depend on what these objects really are (I can't help unless you provide more detail). If you want to share an object between all the tests then it must be static in your test class (JUnit will recreate the test class before every test). |
3,092,242 | I understand in Junit 4, @Before can be used to setup test fixtures for the test class's multiple test methods.
However, in my system, there are common test objects i would like to have available for all tests.
What is the most appropriate name for these objects and what is a good best practice way to store them? | 2010/06/22 | [
"https://Stackoverflow.com/questions/3092242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99033/"
] | The best practice is to create them in the fixture so as to keep the tests **isolated**, unless their state is not changed by the tests (such as a logger). Otherwise one may have side-effects between the tests: one test failing because of another one, or the opposite. | There is definitely a use case for having some shared data between test cases. JUnit provides the @BeforeClass annotation for this. Should help you I hope...
<http://junit.sourceforge.net/javadoc/org/junit/BeforeClass.html> |
3,092,242 | I understand in Junit 4, @Before can be used to setup test fixtures for the test class's multiple test methods.
However, in my system, there are common test objects i would like to have available for all tests.
What is the most appropriate name for these objects and what is a good best practice way to store them? | 2010/06/22 | [
"https://Stackoverflow.com/questions/3092242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99033/"
] | The best practice is to create them in the fixture so as to keep the tests **isolated**, unless their state is not changed by the tests (such as a logger). Otherwise one may have side-effects between the tests: one test failing because of another one, or the opposite. | Why not have an abstract BaseTest superclass that holds the common objects and initializes them, either in the constructor or a @BeforeClass method? |
3,092,242 | I understand in Junit 4, @Before can be used to setup test fixtures for the test class's multiple test methods.
However, in my system, there are common test objects i would like to have available for all tests.
What is the most appropriate name for these objects and what is a good best practice way to store them? | 2010/06/22 | [
"https://Stackoverflow.com/questions/3092242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99033/"
] | There is definitely a use case for having some shared data between test cases. JUnit provides the @BeforeClass annotation for this. Should help you I hope...
<http://junit.sourceforge.net/javadoc/org/junit/BeforeClass.html> | Why not have an abstract BaseTest superclass that holds the common objects and initializes them, either in the constructor or a @BeforeClass method? |
42,959,273 | I'm sending notifications to an android device using [node-gcm](https://github.com/ToothlessGear/node-gcm), and in some cases, I need to send an image with the notification to display as a thumbnail, like so:
[notification with thumbnail](https://i.stack.imgur.com/XFWlm.png)
And sometimes I need to send notifications ... | 2017/03/22 | [
"https://Stackoverflow.com/questions/42959273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7195740/"
] | While going through the [node-gcm issues](https://github.com/ToothlessGear/node-gcm/issues/285) I found the solution, there is a parameter called "notId" to add a ID to a notification.
```
var message = new gcm.Message({
"data": {
"title": "Test",
"message": "Test message!",
"priority"... | The management of the display of notifications is done on the device. You have to make sure you are setting, on Android, a different NOTIFICATION\_ID for each notification, or the last one will always replace the one before it.
```
// Sets an ID for the notification - make sure to change this for different notificatio... |
48,374,302 | I am looking for a MYSQL paging solution with last\_id and order condition, to use LIMIT, OFFSET I need to figure out the offset for the last\_id.
For example, I have a table news (id, title, updated\_at), the first page returns 3,1,2,5,4, for the second page I have 3 arguments (last\_id is 4, order by updated\_at des... | 2018/01/22 | [
"https://Stackoverflow.com/questions/48374302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/991076/"
] | you can do this with only one `reduce()`:
```
const mapStateToProps = (state, ownProps) => {
console.log("mapStateToProps", state.installations);
let {assignedInstallations,
unassignedInstallations } = Object.keys(state.installations)
.reduce(function(acc, cur, i){
if(state.ins... | `lodash` (An utility library) have a notion of collection (Here is an example <https://lodash.com/docs/4.17.4#filter> for `filter` function). It takes as input Object or Array and returns an Array. It seems to fit to your needs. Here is the refactored code:
```
import {
filter,
} from 'lodash'
const mapStateToProp... |
38,003,653 | Kinda new to meteor. app was functioning fine and seeding the db with dburles:factory until I ran cordova build and meteor add-platform for iOS and Android, and installed all the prerequisites. Now I'm getting the error below. I tried meteor update and meteor reset and it did nothing to remedy.
```
=> Exited with cod... | 2016/06/23 | [
"https://Stackoverflow.com/questions/38003653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6506615/"
] | Chris Walsh has excellent advice in his comment. That said, it is possible for Windows Forms applications to communicate with each other, and the simplest method, for me anyway, is [WCF](http://en.wikipedia.org/wiki/Windows_Communication_Foundation), self-hosted server. Typically the server code will not be running in ... | I assume you have some [SQL Server Express Edition](http://en.wikipedia.org/wiki/SQL_Server_Express) installed as the database backend.
This way you can connect to the database using some authentication, and add the job's directly there.
Then on the other computer, add a refresh button or poll for changes. This has t... |
32,121,181 | I have added a message box using the code
```
If MsgBox("File has been updated", vbinformatoin) = ok Then Exit Sub
```
on to a command button used to update the spreadsheet and save to another sheet.
If the command button were not to work for some reason would this message still appear? and if so how can I change ... | 2015/08/20 | [
"https://Stackoverflow.com/questions/32121181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5247998/"
] | What you need is an error handler. You need to set at the beginning of your sub an "On Error" statement and then write an error handler.
Here is a ressource where you can find information on how to set it up : <https://support.microsoft.com/en-us/kb/141571#/en-us/kb/141571>
Your code would be then like this
```
Sub ... | I'm not sure if this fully answers your question but you could try this:
(NB.Substitute the relevant code in place of the message box)
```
Private change_ind As Integer
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
change_ind = 1
End sub
Private Sub CommandButton1_Click()
If change_ind = 1 Then
... |
22,287,303 | I'm currently trying to make a simple calculator, but I want it to use somewhat big numbers(anything above 10^10 should do). And since any decent calculator has floating point operations, I decided to use double as my type.
Sadly, when I tried to write a big number(around 10^7), it went into e notation.
I want to disp... | 2014/03/09 | [
"https://Stackoverflow.com/questions/22287303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3399371/"
] | If you want to display all digits of your double (instead of going into scientific notation), you have to change your output stream's float formatting to [std::fixed](http://en.cppreference.com/w/cpp/io/manip/fixed):
[Live demo on Coliru:](http://coliru.stacked-crooked.com/a/8d2caf6d2e335bd2)
```
double d = 100000000... | You could try out [GMP](https://gmplib.org/) library for for arbitrary precision arithmetic. If you're using it on Windows you can neatly install it using mingw-get.
For 64bit double you could use [long double](http://en.wikipedia.org/wiki/Long_double), I think. I have personally never needed this.
And also there are... |
30,337,279 | I am trying to prevent a contenteditable div from word wrapping.
The white-space: pre property does not work for a contenteditable.
This is the css:
```
.preDiv{
border:1px solid blue;
overflow:auto;
width:100px;
white-space:pre;
}
```
Here is a fiddle:[contentEditable-fiddle](http://jsfiddle.net/jenietos/fxh3qqgc/... | 2015/05/19 | [
"https://Stackoverflow.com/questions/30337279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2403690/"
] | Luckily the answer was out there on this fiddle:[contenteditable with white-space pre](http://jsfiddle.net/cirosantilli/eaxgesoq/)
This is the CSS this person used:
```
#editor {
border: 1px solid black;
height: 200px;
width: 300px;
white-space: pre;
word-wrap: normal;
overflow-x: auto;
}
```
So it needed the... | Really interesting question.
I've gotten it to work in Chrome (at least) by:
1. Putting `preDiv` in a wrapper element.
2. Moving the `overflow` style to the wrapper.
3. Adding `display: table-cell;` to `preDiv`.
No idea why #3 is needed. I got there through trial and error.
```js
changeWidth=function(){
document... |
24,419 | I am setting up my personal website, and I have designed a simple "Coming Soon / Under Construction" page which basically has nothing but a small notice for the users.
What kind of SEO can I make on this page such that it won't harm the full website's ranking later on? | 2012/01/10 | [
"https://webmasters.stackexchange.com/questions/24419",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/12566/"
] | Instead of a single "coming soon" or "under construction" line, expand it a little and explain *what* is coming soon and why a visitor should bookmark it or visit it again.
There's also no reason why you can't already include a short about paragraph, some contact information and possible even a little subscribe funct... | Make sure the content/keywords on the coming soon page is similar to the content that your final website will contain. Newer websites tend to get crawled less frequently so it may take a while to get your new website crawled and Google's index updated. So the snippet Google displays in their index may not be updated fo... |
24,419 | I am setting up my personal website, and I have designed a simple "Coming Soon / Under Construction" page which basically has nothing but a small notice for the users.
What kind of SEO can I make on this page such that it won't harm the full website's ranking later on? | 2012/01/10 | [
"https://webmasters.stackexchange.com/questions/24419",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/12566/"
] | Instead of a single "coming soon" or "under construction" line, expand it a little and explain *what* is coming soon and why a visitor should bookmark it or visit it again.
There's also no reason why you can't already include a short about paragraph, some contact information and possible even a little subscribe funct... | A good place to start would be to create a simple homepage with an email registration form for 'Early Bird Access'. Add a blog article (highlighting the future launch of your project) and some legal pages (e.g. Terms and Conditions, Privacy Policy, and Cookie Statement).
If you've got Google Webmaster Tools setup and ... |
24,419 | I am setting up my personal website, and I have designed a simple "Coming Soon / Under Construction" page which basically has nothing but a small notice for the users.
What kind of SEO can I make on this page such that it won't harm the full website's ranking later on? | 2012/01/10 | [
"https://webmasters.stackexchange.com/questions/24419",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/12566/"
] | I don't bother with "coming soon" for a domain.
It won't help SEO
-----------------
Search engines don't typically index coming soon pages, and even if they did, the coming soon page would only rank for the name of the website. No real progress on SEO can be made until there is actual content that contains keywords. ... | Make sure the content/keywords on the coming soon page is similar to the content that your final website will contain. Newer websites tend to get crawled less frequently so it may take a while to get your new website crawled and Google's index updated. So the snippet Google displays in their index may not be updated fo... |
24,419 | I am setting up my personal website, and I have designed a simple "Coming Soon / Under Construction" page which basically has nothing but a small notice for the users.
What kind of SEO can I make on this page such that it won't harm the full website's ranking later on? | 2012/01/10 | [
"https://webmasters.stackexchange.com/questions/24419",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/12566/"
] | Make sure the content/keywords on the coming soon page is similar to the content that your final website will contain. Newer websites tend to get crawled less frequently so it may take a while to get your new website crawled and Google's index updated. So the snippet Google displays in their index may not be updated fo... | A good place to start would be to create a simple homepage with an email registration form for 'Early Bird Access'. Add a blog article (highlighting the future launch of your project) and some legal pages (e.g. Terms and Conditions, Privacy Policy, and Cookie Statement).
If you've got Google Webmaster Tools setup and ... |
24,419 | I am setting up my personal website, and I have designed a simple "Coming Soon / Under Construction" page which basically has nothing but a small notice for the users.
What kind of SEO can I make on this page such that it won't harm the full website's ranking later on? | 2012/01/10 | [
"https://webmasters.stackexchange.com/questions/24419",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/12566/"
] | I don't bother with "coming soon" for a domain.
It won't help SEO
-----------------
Search engines don't typically index coming soon pages, and even if they did, the coming soon page would only rank for the name of the website. No real progress on SEO can be made until there is actual content that contains keywords. ... | A good place to start would be to create a simple homepage with an email registration form for 'Early Bird Access'. Add a blog article (highlighting the future launch of your project) and some legal pages (e.g. Terms and Conditions, Privacy Policy, and Cookie Statement).
If you've got Google Webmaster Tools setup and ... |
3,692,518 | Is it possible to have a HTML Select containing elements, not just text values but say an object (specifically i'd like to add a JQuery slider with the text) but if someone could advice me generally how to do this, i could investigate. | 2010/09/11 | [
"https://Stackoverflow.com/questions/3692518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/429664/"
] | No, definitely not. The default `select` element is rendered by the browser and can not be extended beyond its standard behaviour.
You would need to look into entirely JavaScript-powered SELECT alternatives.
[Here's](http://www.queness.com/post/204/25-jquery-plugins-that-enhance-and-beautify-html-form-elements#9) a s... | If you want to do this, don't use an HTML select element. Use a div or whatever, and implement the whole thing in javascript. Then you can add whatever functionality you like. |
41,448,325 | I have this code:
```
<div class="well details-form">
<div class="row">
<div class="col-md-6">Test:</div>
<div class="col-md-6" style="white-space: pre-wrap">mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm</div>
</div>
</div>
```
I am trying to get the `div` that co... | 2017/01/03 | [
"https://Stackoverflow.com/questions/41448325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5525311/"
] | Use `word-break: break-all` instead of `white-space: pre-wrap`.
Read more at MDN: <https://developer.mozilla.org/en-US/docs/Web/CSS/word-break>
```css
.details-form {
width: 70%;
margin: auto;
}
```
```html
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<div c... | The style `style="white-space: pre-wrap"` only works where there's a space encountered in the text. |
7,978,354 | I created a TextBox :-
```
TextBox ID="TxtUname" onKeyPress="ENABLE_BTN()"
```
Now i wrote a function :-
```
script type="text/javascript"
window.onload = function() {
document.getElementById('SSAccept').disabled = true;
};
function ENABLE_BTN() {
var EN=document.getElementById('TxtUname').value;
... | 2011/11/02 | [
"https://Stackoverflow.com/questions/7978354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/983457/"
] | `onkeypress` doesn't work in all browsers -> <http://www.quirksmode.org/js/keys.html>
`onkeyup` / `onkeydown` should be used ->
Working example : <http://jsfiddle.net/KCBzk/>
HTML :
```
<input id="TxtUname" value="" onkeydown="ENABLE_BTN()"/><br>
<button id="SSAccept">Some test</button>
```
Javascript:
```
windo... | the thing is that you need an event to invoke that function. you should monitor your textbox for change and invoke the function whenever the value changes. like using jquery
```
$("#TxtUname").keydown(function(e) {
if($("#TxtUname").val == '') {
//..disable button..
} else {
//..enable button... |
3,797,857 | I want open certain links in a new tab. Since I can't set it directly into the `<a>` tag, I want to put the link into `<span>` tags with a certain class name and set the target attribute via JavaScript.
I thought this would be easy, but I can't get it working:
```
addOnloadHook(function () {
document.getElementByCl... | 2010/09/26 | [
"https://Stackoverflow.com/questions/3797857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/370215/"
] | `document.getElementByClassName` does not exist, the correct function is `document.getElementsByClassName` (note the extra `s`). It returns an array of matching nodes, so you've to give an index:
```
addOnloadHook(function () {
document.getElementsByClassName('newTab')[0].getElementsByTagName('a')[0].setAttribute('t... | but you might need to iterate through every span with the specified class ('newTab') on the page for it to work:
```
addOnLoadHook(function(){
var span = document.getElementsByClassName('newTab');
for(var i in span) {
span[i].getElementsByTagName('a')[0].setAttribute('target','_blank');
}
});
```
in cas... |
45,139,533 | I have a component in a .js file which I have exported as default. I am trying to include this component in another .js file. I have also imported this component in the other file. I have tried using `<componentName />` but this does not seem to work, it compiles and shows no error but nothing shows up. Any ideas? | 2017/07/17 | [
"https://Stackoverflow.com/questions/45139533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5931164/"
] | First of all, as you are saying you are using it like `<componentName />`, this won't work, you should try renaming it with all caps ie. `<ComponentName />`. This is just an assumption. If the issue persists, please share the code, so that we can help you in a better way.
Discussion can be found [here](https://github.c... | As mentioned in the comments, the component name that I was attempting to add is required to start with a capital letter as components beginning with lowercase letters are searched as default DOM elements |
7,884,928 | I am using qx in Perl to execute commands in a Linux machine.
I'm trying to parse some output in Perl but don't know how to replace the new-line character in multi-line output.
I have been trying something like this:
```
$result =~ s/\\n/||/g;
```
I seem to recall a '\r' with some OSs and I have been trying differ... | 2011/10/25 | [
"https://Stackoverflow.com/questions/7884928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647405/"
] | If `\` is either the start of special sequence (if it's followed by a letter), or it causes the next character to be matched literally (if it's followed by a non-letter). Therefore,
```
s/\\n/
```
matches `\` followed by `n`. `\n` is a special sequence that matches a newline, so you want
```
/\n/
```
So you could... | You shouldn't be using double backslashes, for one thing.
Here is how you can do it:
```
$text = <<EOS;
div class equals main
span id equals marquee
blog! slash span slah div
EOS
print "Before: $text \n\n\n\n";
$text =~ s/\n/\|\|/g;
print "After: $text \n\n\n\n";
```
Here is a codepad for it: <http://codepad.org... |
1,032,942 | Ubuntu 20.04. Trying to get fail2ban configured for SSH, but fail2ban not banning any IPs
```
/etc/fail2ban/jail.local
[DEFAULT]
bantime = 10m
ignoreip = 127.0.0.1/8 ##.##.##.##/32 ##.##.##.##/32
findtime = 30m
maxretry = 3
[sshd]
enabled = true
# modes: normal (default), ddos, extra or aggressive (combines all).
#mo... | 2020/09/07 | [
"https://serverfault.com/questions/1032942",
"https://serverfault.com",
"https://serverfault.com/users/293351/"
] | For anyone who finds this a few months after the thread died, I hit the same problem on a new 20.04 server install while following most write-ups.
I solved it by explicitly setting:
`sshd_backend = systemd`
In my [sshd] section of jails.local.
The default (pynotify) was incorrect for that system or had some deeper ... | [Check this issue](https://github.com/fail2ban/fail2ban/issues/3365#issuecomment-1258354533)
Fail2ban uses hash of first line to detect log-rotation (normally it'd always seek to last known position, unless it rotates)...
I guess you are emptying the log by writing a empty line to the beginning of it. |
60,121,373 | This might be more of snowflake knowledge question rather than issue.
I am running a copy command from s3 to snowflake.
and i see it took 30 min to get 100 the byte scanned however even after having byte scanned to 100 percent it took another 40 min for the query to be completed.
Can somebody please explain whats goin... | 2020/02/07 | [
"https://Stackoverflow.com/questions/60121373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11366870/"
] | Sounds like you're referring to the 100% in the Bytes Scanned column of the query profile. If you have transformations in your COPY INTO command this will take additional time to process. As others have mentioned, the size of the warehouse will have an impact as the warehouse size will determine the number of cores and... | We in the past we have found each xsmall can load 40mb/s from S3, and thus a small can load 2x. So that's our base line expectation of load speeds.
What can legitimately slow down a copy is if you are coping from the root of the bucket `s3://buck_name/` but there are millions of file in the that directory, with only o... |
20,913,704 | Our UX team doesn't like the checkbox for handling a boolean - they want a asp:DropDownList with two options for true/false.
My bool has to be bound using <%# Bind("") %>, as it's in the edit template of a asp:GridView.
Here is my code:
```
<asp:GridView ...>
...
<Columns>
...
<asp:TemplateFi... | 2014/01/03 | [
"https://Stackoverflow.com/questions/20913704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1095493/"
] | I changed **ListItem**'s **Value** start with capital (True|False), and it works fine. You might want to give a try.

```
<asp:DropDownList ID="ExcludedDropDown" runat="server"
SelectedValue='<%# Bind("IsExcluded") %>'>
<asp:ListItem Value="... | Thank you for the answer! Knowing the "correct" approach narrowed my search to find the actual bug. By mistake, the meta:resourcekey was mapped (by our translation tool) to handle the Value. Removing the meta:resourcekey attribute and changing to capitalized True/False solved it for me. Here is the new code with the ch... |
67,954,505 | I am wondering how I can create something like this using JavaScript and A-frame (<https://aframe.io>).
I would like to create an onload function called `load()` that will check the value of a variable x and if x is one, the `gltf` with the id of 1 will show and the gltf's with the id of 2 and 3 will not be visible. T... | 2021/06/13 | [
"https://Stackoverflow.com/questions/67954505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15930096/"
] | Store the valid `id`s in an array and loop through each one, then remove correspondingly.
```js
const ids = [1, 2, 3];
function load() {
var x = 1;
ids.forEach((e) => {
if (e != x) {
document.getElementById(e).remove();
}
})
}
```
```css
a-gltf-model {
display: none;
}
```
```html
<script src=... | I think the example on this blog may be helpful:
<https://medium.com/swlh/build-your-location-based-augmented-reality-web-app-a841956eed2c>
have a single `<a-entity></a-entity>` component.
use your `load()` to dynamically change the `gltf-model` and `position` attributes.
maybe store the info in an array of sort like... |
62,208,861 | I have a dictionary like this
```
d = {('tom', 'sam'): 1, ('sam', 'i'): 1, ('i', 'am'): 2,
('am', 'i'): 1, ('am', 'sam'): 1}
```
I would like to perform a distinct count in this dictionary, I will expect the answer to be 4 because I will be counting `tom`, `sam`, `i` and `am`. | 2020/06/05 | [
"https://Stackoverflow.com/questions/62208861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13598618/"
] | Your question title is slightly misleading. You are actually looking for distinct items in tuples, that happen to be the keys of a dictionary. You can use the following method:
```
>>> d = {('tom', 'sam'): 1, ('sam', 'i'): 1, ('i', 'am'): 2,
('am', 'i'): 1, ('am', 'sam'): 1}
>>> len(set(item for key in d for... | Using [`itertools.chain`](https://docs.python.org/3/library/itertools.html#itertools.chain), you can get rather concise:
```
from itertools import chain
len(set(chain(*d)))
# 4
```
This uses the fact that iterating a `dict` iterates its keys which in your case, are iterables themselves. Hence, unpacking (`*`) and c... |
16,035,409 | I've searched the site for an answer to this one, and from what I can see, the other questions don't involve the parent `div` using `position:absolute;`
Here is my code:
```
<div id="wrapper">
<div id="child">
Here are the contents to be displayed.
</div>
</div>
```
Here is my CSS:
```
#wrapper {widt... | 2013/04/16 | [
"https://Stackoverflow.com/questions/16035409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1728650/"
] | If the parent cant be relative then the child has to be relative (you will obtain the same behavior). If both are absolute then they are not related, and therefor the parent cant adapt to the child (or vice versa). You will also have to add padding-bottom to the parent to patch the full size of the child (at least the ... | now give to
```
#wrapper{
position:relative;
position:absolute; // remove this line
}
.child{
position:absolute;
left:0;
right:0;
width:500px; // remove this line
}
```
always give to **parent div** `position relative` and **child div** given `absolute`
More **[about position](http://c... |
23,322,012 | So i have searched a lot about showing a place in google maps, but all of tutorial show a technique which requires Latitude and Longitude, but can someone please tell me a trick where i can achieve this using just the address string ? Thank you | 2014/04/27 | [
"https://Stackoverflow.com/questions/23322012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2776913/"
] | You might want to look at [GHC.Generics](http://www.haskell.org/haskellwiki/GHC.Generics). It basically encodes each ADT as products (`(,)`) and sums (`Either`). As an example, here is how you could show this representation using generics:
```
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ... | The [lens](http://hackage.haskell.org/package/lens) library, in modules [Control.Lens.Iso](http://hackage.haskell.org/package/lens-4.1.2/docs/Control-Lens-Iso.html) and [Control.Lens.Wrapped](http://hackage.haskell.org/package/lens-4.1.2/docs/Control-Lens-Wrapped.html), has a few utilities that make working with such c... |
23,322,012 | So i have searched a lot about showing a place in google maps, but all of tutorial show a technique which requires Latitude and Longitude, but can someone please tell me a trick where i can achieve this using just the address string ? Thank you | 2014/04/27 | [
"https://Stackoverflow.com/questions/23322012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2776913/"
] | You might want to look at [GHC.Generics](http://www.haskell.org/haskellwiki/GHC.Generics). It basically encodes each ADT as products (`(,)`) and sums (`Either`). As an example, here is how you could show this representation using generics:
```
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ... | If you want real n-tuples (and not just some other data that is semantically equivalent) it's going to be cumbersome without Template Haskell.
For example, if you want to convert
```
data Foo = Foo Int String Int
data Bar = Bar String String Int Int
```
into
```
type FooTuple = (Int, String, Int)
type BarTuple = (... |
23,322,012 | So i have searched a lot about showing a place in google maps, but all of tutorial show a technique which requires Latitude and Longitude, but can someone please tell me a trick where i can achieve this using just the address string ? Thank you | 2014/04/27 | [
"https://Stackoverflow.com/questions/23322012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2776913/"
] | You might want to look at [GHC.Generics](http://www.haskell.org/haskellwiki/GHC.Generics). It basically encodes each ADT as products (`(,)`) and sums (`Either`). As an example, here is how you could show this representation using generics:
```
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ... | In some cases, you can use [unsafeCoerce](https://hackage.haskell.org/package/base-4.14.0.0/docs/Unsafe-Coerce.html). The name of the function should be quite a clear warning to be very careful. Particularly, the behavior is dependent on the compiler and even compiler version.
```
data Bar = Bar Text Text
tupleToBar ... |
23,322,012 | So i have searched a lot about showing a place in google maps, but all of tutorial show a technique which requires Latitude and Longitude, but can someone please tell me a trick where i can achieve this using just the address string ? Thank you | 2014/04/27 | [
"https://Stackoverflow.com/questions/23322012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2776913/"
] | You might want to look at [GHC.Generics](http://www.haskell.org/haskellwiki/GHC.Generics). It basically encodes each ADT as products (`(,)`) and sums (`Either`). As an example, here is how you could show this representation using generics:
```
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ... | The function `_Ctor` in `generic-lens` converts any record value to a tuple and vice versa with no template haskell. |
23,322,012 | So i have searched a lot about showing a place in google maps, but all of tutorial show a technique which requires Latitude and Longitude, but can someone please tell me a trick where i can achieve this using just the address string ? Thank you | 2014/04/27 | [
"https://Stackoverflow.com/questions/23322012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2776913/"
] | The [lens](http://hackage.haskell.org/package/lens) library, in modules [Control.Lens.Iso](http://hackage.haskell.org/package/lens-4.1.2/docs/Control-Lens-Iso.html) and [Control.Lens.Wrapped](http://hackage.haskell.org/package/lens-4.1.2/docs/Control-Lens-Wrapped.html), has a few utilities that make working with such c... | If you want real n-tuples (and not just some other data that is semantically equivalent) it's going to be cumbersome without Template Haskell.
For example, if you want to convert
```
data Foo = Foo Int String Int
data Bar = Bar String String Int Int
```
into
```
type FooTuple = (Int, String, Int)
type BarTuple = (... |
23,322,012 | So i have searched a lot about showing a place in google maps, but all of tutorial show a technique which requires Latitude and Longitude, but can someone please tell me a trick where i can achieve this using just the address string ? Thank you | 2014/04/27 | [
"https://Stackoverflow.com/questions/23322012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2776913/"
] | The [lens](http://hackage.haskell.org/package/lens) library, in modules [Control.Lens.Iso](http://hackage.haskell.org/package/lens-4.1.2/docs/Control-Lens-Iso.html) and [Control.Lens.Wrapped](http://hackage.haskell.org/package/lens-4.1.2/docs/Control-Lens-Wrapped.html), has a few utilities that make working with such c... | In some cases, you can use [unsafeCoerce](https://hackage.haskell.org/package/base-4.14.0.0/docs/Unsafe-Coerce.html). The name of the function should be quite a clear warning to be very careful. Particularly, the behavior is dependent on the compiler and even compiler version.
```
data Bar = Bar Text Text
tupleToBar ... |
23,322,012 | So i have searched a lot about showing a place in google maps, but all of tutorial show a technique which requires Latitude and Longitude, but can someone please tell me a trick where i can achieve this using just the address string ? Thank you | 2014/04/27 | [
"https://Stackoverflow.com/questions/23322012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2776913/"
] | The [lens](http://hackage.haskell.org/package/lens) library, in modules [Control.Lens.Iso](http://hackage.haskell.org/package/lens-4.1.2/docs/Control-Lens-Iso.html) and [Control.Lens.Wrapped](http://hackage.haskell.org/package/lens-4.1.2/docs/Control-Lens-Wrapped.html), has a few utilities that make working with such c... | The function `_Ctor` in `generic-lens` converts any record value to a tuple and vice versa with no template haskell. |
23,322,012 | So i have searched a lot about showing a place in google maps, but all of tutorial show a technique which requires Latitude and Longitude, but can someone please tell me a trick where i can achieve this using just the address string ? Thank you | 2014/04/27 | [
"https://Stackoverflow.com/questions/23322012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2776913/"
] | If you want real n-tuples (and not just some other data that is semantically equivalent) it's going to be cumbersome without Template Haskell.
For example, if you want to convert
```
data Foo = Foo Int String Int
data Bar = Bar String String Int Int
```
into
```
type FooTuple = (Int, String, Int)
type BarTuple = (... | In some cases, you can use [unsafeCoerce](https://hackage.haskell.org/package/base-4.14.0.0/docs/Unsafe-Coerce.html). The name of the function should be quite a clear warning to be very careful. Particularly, the behavior is dependent on the compiler and even compiler version.
```
data Bar = Bar Text Text
tupleToBar ... |
23,322,012 | So i have searched a lot about showing a place in google maps, but all of tutorial show a technique which requires Latitude and Longitude, but can someone please tell me a trick where i can achieve this using just the address string ? Thank you | 2014/04/27 | [
"https://Stackoverflow.com/questions/23322012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2776913/"
] | If you want real n-tuples (and not just some other data that is semantically equivalent) it's going to be cumbersome without Template Haskell.
For example, if you want to convert
```
data Foo = Foo Int String Int
data Bar = Bar String String Int Int
```
into
```
type FooTuple = (Int, String, Int)
type BarTuple = (... | The function `_Ctor` in `generic-lens` converts any record value to a tuple and vice versa with no template haskell. |
64,551,291 | I have a user profile page component and in that page I have list of friends.
When I click on friend icon I route to friend page which use the same profile page component just render different info which get by id.
I did routes but if I will pass a few time to different friends I have the url like "`user/user/user/1`... | 2020/10/27 | [
"https://Stackoverflow.com/questions/64551291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12756508/"
] | Here is what you can do to achieve your desired functionality:
At first you can check if URl contains **/user** then don,t route to user and else go to **/user**. You can use **withRouter** or params to make get URl values.
**For Example:**
```
{friends.map((friendInfo, id) =>
return(
<Link to={url.includes('u... | In the render of `friends` array you should add back slash to your `Link` url
```
{friends.map((friendInfo, id) =>
return(
<Link to={`/user/${friends.id}`} > {/* <--- here add back slash */}
</Link>
);
})}
``` |
1,895,872 | You have a chest of $8$ drawers. With probability $1/2$, you put a letter in one of the drawers. With probability $1/2$, you don't put a letter in any drawer. I open the first $7$ drawers, all are empty. What is the probability there is a letter in the $8th$ drawer? I thought the answer was $1/16$ but apparently its $1... | 2016/08/18 | [
"https://math.stackexchange.com/questions/1895872",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/361765/"
] | Let $A$ denote the event in which there is a letter in the $8$th drawer.
Let $B$ denote the event in which the first $7$ drawers are all empty.
Then $P(A|B)=\cfrac{P(A\cap B)}{P(B)}=\cfrac{\frac12\cdot\frac18}{\frac12\cdot(1-\frac78)+(1-\frac12)\cdot1}=\cfrac19$. | Given that the first seven drawers were empty either $A\cup B$ where:
* $A$: The letter is in the eighth drawer: $\mathsf P(A)=\tfrac 12 \tfrac 18$
* $B$: The letter is in no drawer: $\mathsf P(B)=\tfrac 12$
+ $A,B$ are disjoint
So by the definition of conditional probability
$$\mathsf P(A\mid A\cup B) ~=~ \dfrac{\... |
1,895,872 | You have a chest of $8$ drawers. With probability $1/2$, you put a letter in one of the drawers. With probability $1/2$, you don't put a letter in any drawer. I open the first $7$ drawers, all are empty. What is the probability there is a letter in the $8th$ drawer? I thought the answer was $1/16$ but apparently its $1... | 2016/08/18 | [
"https://math.stackexchange.com/questions/1895872",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/361765/"
] | Let $A$ denote the event in which there is a letter in the $8$th drawer.
Let $B$ denote the event in which the first $7$ drawers are all empty.
Then $P(A|B)=\cfrac{P(A\cap B)}{P(B)}=\cfrac{\frac12\cdot\frac18}{\frac12\cdot(1-\frac78)+(1-\frac12)\cdot1}=\cfrac19$. | Alternative way:
Think of it as a chest of $2\times8=16$ drawers and put a letter in one of the drawers.
After opening $7$ empty drawers there are $9$ drawers left and in exactly one of them there is a letter. |
33,172,390 | I've been getting reports of some Xiaomi devices (e.g. Mi 2, running API level 21) not showing overlays. My app targets API 23.
There are [several](http://forum.xda-developers.com/xiaomi-mi-3/help/link-bubble-playing-nice-t2857607) [posts](http://en.miui.com/thread-30931-1-1.html) out there regarding this. It seems th... | 2015/10/16 | [
"https://Stackoverflow.com/questions/33172390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444761/"
] | 1) on pre-API 23, the permission is already given, because the user granted it upon install.
EDIT: it seems there is a bug on Android 6 (that will [**get fixed on 6.0.1**](https://code.google.com/p/android/issues/detail?id=196597)), that if the user has denied this permission , the app will crash with SecurityExceptio... | For searching for while about the issue in Xiaomi, Meizu I have found this. It's working perfectly..
```
public static boolean isMiuiFloatWindowOpAllowed(@NonNull Context context) {
final int version = Build.VERSION.SDK_INT;
if (version >= 19) {
return checkOp(context, OP_SYSTEM_ALERT_WINDOW); //See ... |
33,172,390 | I've been getting reports of some Xiaomi devices (e.g. Mi 2, running API level 21) not showing overlays. My app targets API 23.
There are [several](http://forum.xda-developers.com/xiaomi-mi-3/help/link-bubble-playing-nice-t2857607) [posts](http://en.miui.com/thread-30931-1-1.html) out there regarding this. It seems th... | 2015/10/16 | [
"https://Stackoverflow.com/questions/33172390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444761/"
] | 1) on pre-API 23, the permission is already given, because the user granted it upon install.
EDIT: it seems there is a bug on Android 6 (that will [**get fixed on 6.0.1**](https://code.google.com/p/android/issues/detail?id=196597)), that if the user has denied this permission , the app will crash with SecurityExceptio... | Checking if you have the drawOverlays permission is safer using this:
```
@SuppressLint("NewApi")
public static boolean canDrawOverlayViews(Context con){
if(Build.VERSION.SDK_INT< Build.VERSION_CODES.LOLLIPOP){return true;}
try {
return Settings.canDrawOverlays(con);
}
catch(NoSuchMethodError... |
33,172,390 | I've been getting reports of some Xiaomi devices (e.g. Mi 2, running API level 21) not showing overlays. My app targets API 23.
There are [several](http://forum.xda-developers.com/xiaomi-mi-3/help/link-bubble-playing-nice-t2857607) [posts](http://en.miui.com/thread-30931-1-1.html) out there regarding this. It seems th... | 2015/10/16 | [
"https://Stackoverflow.com/questions/33172390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444761/"
] | 1) on pre-API 23, the permission is already given, because the user granted it upon install.
EDIT: it seems there is a bug on Android 6 (that will [**get fixed on 6.0.1**](https://code.google.com/p/android/issues/detail?id=196597)), that if the user has denied this permission , the app will crash with SecurityExceptio... | Here is the step by step how to handle this:
At first give below permission in manifest file:
```
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
```
Or
```
<uses-permission-sdk-23 android:name="android.permission.SYSTEM_ALERT_WINDOW" />
```
Then handle rest of the things using below c... |
33,172,390 | I've been getting reports of some Xiaomi devices (e.g. Mi 2, running API level 21) not showing overlays. My app targets API 23.
There are [several](http://forum.xda-developers.com/xiaomi-mi-3/help/link-bubble-playing-nice-t2857607) [posts](http://en.miui.com/thread-30931-1-1.html) out there regarding this. It seems th... | 2015/10/16 | [
"https://Stackoverflow.com/questions/33172390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444761/"
] | 1) on pre-API 23, the permission is already given, because the user granted it upon install.
EDIT: it seems there is a bug on Android 6 (that will [**get fixed on 6.0.1**](https://code.google.com/p/android/issues/detail?id=196597)), that if the user has denied this permission , the app will crash with SecurityExceptio... | You can check permission like this:
```
boolean granted = activity.checkSelfPermission("android.permission.SYSTEM_ALERT_WINDOW") == PackageManager.PERMISSION_GRANTED;
``` |
33,172,390 | I've been getting reports of some Xiaomi devices (e.g. Mi 2, running API level 21) not showing overlays. My app targets API 23.
There are [several](http://forum.xda-developers.com/xiaomi-mi-3/help/link-bubble-playing-nice-t2857607) [posts](http://en.miui.com/thread-30931-1-1.html) out there regarding this. It seems th... | 2015/10/16 | [
"https://Stackoverflow.com/questions/33172390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444761/"
] | Checking if you have the drawOverlays permission is safer using this:
```
@SuppressLint("NewApi")
public static boolean canDrawOverlayViews(Context con){
if(Build.VERSION.SDK_INT< Build.VERSION_CODES.LOLLIPOP){return true;}
try {
return Settings.canDrawOverlays(con);
}
catch(NoSuchMethodError... | For searching for while about the issue in Xiaomi, Meizu I have found this. It's working perfectly..
```
public static boolean isMiuiFloatWindowOpAllowed(@NonNull Context context) {
final int version = Build.VERSION.SDK_INT;
if (version >= 19) {
return checkOp(context, OP_SYSTEM_ALERT_WINDOW); //See ... |
33,172,390 | I've been getting reports of some Xiaomi devices (e.g. Mi 2, running API level 21) not showing overlays. My app targets API 23.
There are [several](http://forum.xda-developers.com/xiaomi-mi-3/help/link-bubble-playing-nice-t2857607) [posts](http://en.miui.com/thread-30931-1-1.html) out there regarding this. It seems th... | 2015/10/16 | [
"https://Stackoverflow.com/questions/33172390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444761/"
] | Here is the step by step how to handle this:
At first give below permission in manifest file:
```
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
```
Or
```
<uses-permission-sdk-23 android:name="android.permission.SYSTEM_ALERT_WINDOW" />
```
Then handle rest of the things using below c... | For searching for while about the issue in Xiaomi, Meizu I have found this. It's working perfectly..
```
public static boolean isMiuiFloatWindowOpAllowed(@NonNull Context context) {
final int version = Build.VERSION.SDK_INT;
if (version >= 19) {
return checkOp(context, OP_SYSTEM_ALERT_WINDOW); //See ... |
33,172,390 | I've been getting reports of some Xiaomi devices (e.g. Mi 2, running API level 21) not showing overlays. My app targets API 23.
There are [several](http://forum.xda-developers.com/xiaomi-mi-3/help/link-bubble-playing-nice-t2857607) [posts](http://en.miui.com/thread-30931-1-1.html) out there regarding this. It seems th... | 2015/10/16 | [
"https://Stackoverflow.com/questions/33172390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444761/"
] | For searching for while about the issue in Xiaomi, Meizu I have found this. It's working perfectly..
```
public static boolean isMiuiFloatWindowOpAllowed(@NonNull Context context) {
final int version = Build.VERSION.SDK_INT;
if (version >= 19) {
return checkOp(context, OP_SYSTEM_ALERT_WINDOW); //See ... | You can check permission like this:
```
boolean granted = activity.checkSelfPermission("android.permission.SYSTEM_ALERT_WINDOW") == PackageManager.PERMISSION_GRANTED;
``` |
33,172,390 | I've been getting reports of some Xiaomi devices (e.g. Mi 2, running API level 21) not showing overlays. My app targets API 23.
There are [several](http://forum.xda-developers.com/xiaomi-mi-3/help/link-bubble-playing-nice-t2857607) [posts](http://en.miui.com/thread-30931-1-1.html) out there regarding this. It seems th... | 2015/10/16 | [
"https://Stackoverflow.com/questions/33172390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444761/"
] | Checking if you have the drawOverlays permission is safer using this:
```
@SuppressLint("NewApi")
public static boolean canDrawOverlayViews(Context con){
if(Build.VERSION.SDK_INT< Build.VERSION_CODES.LOLLIPOP){return true;}
try {
return Settings.canDrawOverlays(con);
}
catch(NoSuchMethodError... | Here is the step by step how to handle this:
At first give below permission in manifest file:
```
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
```
Or
```
<uses-permission-sdk-23 android:name="android.permission.SYSTEM_ALERT_WINDOW" />
```
Then handle rest of the things using below c... |
33,172,390 | I've been getting reports of some Xiaomi devices (e.g. Mi 2, running API level 21) not showing overlays. My app targets API 23.
There are [several](http://forum.xda-developers.com/xiaomi-mi-3/help/link-bubble-playing-nice-t2857607) [posts](http://en.miui.com/thread-30931-1-1.html) out there regarding this. It seems th... | 2015/10/16 | [
"https://Stackoverflow.com/questions/33172390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444761/"
] | Checking if you have the drawOverlays permission is safer using this:
```
@SuppressLint("NewApi")
public static boolean canDrawOverlayViews(Context con){
if(Build.VERSION.SDK_INT< Build.VERSION_CODES.LOLLIPOP){return true;}
try {
return Settings.canDrawOverlays(con);
}
catch(NoSuchMethodError... | You can check permission like this:
```
boolean granted = activity.checkSelfPermission("android.permission.SYSTEM_ALERT_WINDOW") == PackageManager.PERMISSION_GRANTED;
``` |
33,172,390 | I've been getting reports of some Xiaomi devices (e.g. Mi 2, running API level 21) not showing overlays. My app targets API 23.
There are [several](http://forum.xda-developers.com/xiaomi-mi-3/help/link-bubble-playing-nice-t2857607) [posts](http://en.miui.com/thread-30931-1-1.html) out there regarding this. It seems th... | 2015/10/16 | [
"https://Stackoverflow.com/questions/33172390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444761/"
] | Here is the step by step how to handle this:
At first give below permission in manifest file:
```
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
```
Or
```
<uses-permission-sdk-23 android:name="android.permission.SYSTEM_ALERT_WINDOW" />
```
Then handle rest of the things using below c... | You can check permission like this:
```
boolean granted = activity.checkSelfPermission("android.permission.SYSTEM_ALERT_WINDOW") == PackageManager.PERMISSION_GRANTED;
``` |
33,417,721 | C# Convert a Multi dimensional Object[,]array into a dataset / datatable
I have Object[,] and I am passing that to function and I need to build Datatable
Here is my code I am trying this way
```
public static DataTable ArraytoDatatable(Object[,] numbers)
{
DataTable dt = new DataTable();
Cons... | 2015/10/29 | [
"https://Stackoverflow.com/questions/33417721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5503486/"
] | How about this:
```
public static DataTable ArraytoDatatable(Object[,] numbers)
{
DataTable dt = new DataTable();
for (int i = 0; i < numbers.GetLength(1); i++)
{
dt.Columns.Add("Column" + (i + 1));
}
for (var i = 0; i < numbers.GetLength(0); ++i)
{
DataRow row... | You can use `Array.GetLength` to get the length of the dimensions of a multi dimensional array:
```
int width = numbers.GetLength(0);
int height = numbers.GetLength(1);
for (int w = 0; w < width; w++)
{
dt.Columns.Add("Column" + (w + 1));
}
for (int h = 0; h < height; h++)
{
DataRow row = dt.NewRow();
fo... |
33,417,721 | C# Convert a Multi dimensional Object[,]array into a dataset / datatable
I have Object[,] and I am passing that to function and I need to build Datatable
Here is my code I am trying this way
```
public static DataTable ArraytoDatatable(Object[,] numbers)
{
DataTable dt = new DataTable();
Cons... | 2015/10/29 | [
"https://Stackoverflow.com/questions/33417721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5503486/"
] | How about this:
```
public static DataTable ArraytoDatatable(Object[,] numbers)
{
DataTable dt = new DataTable();
for (int i = 0; i < numbers.GetLength(1); i++)
{
dt.Columns.Add("Column" + (i + 1));
}
for (var i = 0; i < numbers.GetLength(0); ++i)
{
DataRow row... | In case you want to know how to do it in XML, your function will be very simple:
```
public static DataTable ArraytoDatatable(string numbers)
{
DataSet ds = new DataSet();
ds.ReadXml(new StringReader(numbers));
return ds.Tables[0];
}
```
And here is how you can write your xml and test it:
```
string xml... |
29,615,196 | I am calling a web service and the data from the web service is in csv format.
If I try to save data in xls/xlsx, then I get multiple sheets in a workbook.
So, how can I save the data in csv with multipletab/sheets in c#.
I know csv with multiple tabs is not practical, but is there any damn way or any library to save... | 2015/04/13 | [
"https://Stackoverflow.com/questions/29615196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4780425/"
] | CSV, as a file format, assumes one "table" of data; in Excel terms that's one sheet of a workbook. While it's just plain text, and you can interpret it any way you want, the "standard" CSV format does not support what your supervisor is thinking.
You can fudge what you want a couple of ways:
* Use a different file fo... | >
> If I try to save data in xls/xlsx, then I get multiple sheets in a workbook.
>
>
>
Your answer is in your question, don't use text/csv (which most certainly can **not** do multiple sheets, it can't even do one sheet; there's no such thing as a sheet in text/csv though there is in how some applications like Exc... |
29,615,196 | I am calling a web service and the data from the web service is in csv format.
If I try to save data in xls/xlsx, then I get multiple sheets in a workbook.
So, how can I save the data in csv with multipletab/sheets in c#.
I know csv with multiple tabs is not practical, but is there any damn way or any library to save... | 2015/04/13 | [
"https://Stackoverflow.com/questions/29615196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4780425/"
] | >
> If I try to save data in xls/xlsx, then I get multiple sheets in a workbook.
>
>
>
Your answer is in your question, don't use text/csv (which most certainly can **not** do multiple sheets, it can't even do one sheet; there's no such thing as a sheet in text/csv though there is in how some applications like Exc... | I've been using this library for a while now,
<https://github.com/SheetJS/js-xlsx>
in my projects to import data and structure from formats like: xls(x), csv and xml but you can for sure save in that formats as well (all from client)!
Hope that can help you,, take a look on online demo,
<http://oss.sheetjs.com/j... |
29,615,196 | I am calling a web service and the data from the web service is in csv format.
If I try to save data in xls/xlsx, then I get multiple sheets in a workbook.
So, how can I save the data in csv with multipletab/sheets in c#.
I know csv with multiple tabs is not practical, but is there any damn way or any library to save... | 2015/04/13 | [
"https://Stackoverflow.com/questions/29615196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4780425/"
] | >
> If I try to save data in xls/xlsx, then I get multiple sheets in a workbook.
>
>
>
Your answer is in your question, don't use text/csv (which most certainly can **not** do multiple sheets, it can't even do one sheet; there's no such thing as a sheet in text/csv though there is in how some applications like Exc... | I think you want to reduce the size of your excel file. If yes then you can do it by saving it as xlsb i.e., Excel Binary Workbook format. Further, you can reduce your file size by deleting all the blank cells. |
29,615,196 | I am calling a web service and the data from the web service is in csv format.
If I try to save data in xls/xlsx, then I get multiple sheets in a workbook.
So, how can I save the data in csv with multipletab/sheets in c#.
I know csv with multiple tabs is not practical, but is there any damn way or any library to save... | 2015/04/13 | [
"https://Stackoverflow.com/questions/29615196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4780425/"
] | CSV, as a file format, assumes one "table" of data; in Excel terms that's one sheet of a workbook. While it's just plain text, and you can interpret it any way you want, the "standard" CSV format does not support what your supervisor is thinking.
You can fudge what you want a couple of ways:
* Use a different file fo... | I've been using this library for a while now,
<https://github.com/SheetJS/js-xlsx>
in my projects to import data and structure from formats like: xls(x), csv and xml but you can for sure save in that formats as well (all from client)!
Hope that can help you,, take a look on online demo,
<http://oss.sheetjs.com/j... |
29,615,196 | I am calling a web service and the data from the web service is in csv format.
If I try to save data in xls/xlsx, then I get multiple sheets in a workbook.
So, how can I save the data in csv with multipletab/sheets in c#.
I know csv with multiple tabs is not practical, but is there any damn way or any library to save... | 2015/04/13 | [
"https://Stackoverflow.com/questions/29615196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4780425/"
] | CSV, as a file format, assumes one "table" of data; in Excel terms that's one sheet of a workbook. While it's just plain text, and you can interpret it any way you want, the "standard" CSV format does not support what your supervisor is thinking.
You can fudge what you want a couple of ways:
* Use a different file fo... | I think you want to reduce the size of your excel file. If yes then you can do it by saving it as xlsb i.e., Excel Binary Workbook format. Further, you can reduce your file size by deleting all the blank cells. |
29,615,196 | I am calling a web service and the data from the web service is in csv format.
If I try to save data in xls/xlsx, then I get multiple sheets in a workbook.
So, how can I save the data in csv with multipletab/sheets in c#.
I know csv with multiple tabs is not practical, but is there any damn way or any library to save... | 2015/04/13 | [
"https://Stackoverflow.com/questions/29615196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4780425/"
] | I've been using this library for a while now,
<https://github.com/SheetJS/js-xlsx>
in my projects to import data and structure from formats like: xls(x), csv and xml but you can for sure save in that formats as well (all from client)!
Hope that can help you,, take a look on online demo,
<http://oss.sheetjs.com/j... | I think you want to reduce the size of your excel file. If yes then you can do it by saving it as xlsb i.e., Excel Binary Workbook format. Further, you can reduce your file size by deleting all the blank cells. |
49,975,851 | I have Android app which are writed use Java and C++/JNI code. My C++/JNI part work bad. I want to debug native code.
I work in Android Studio.
I did all step which take official site
[enter link description here](https://developer.android.com/studio/debug/index.html)
But when I start debug I see line
```
Startin... | 2018/04/23 | [
"https://Stackoverflow.com/questions/49975851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9425581/"
] | I found error. But I did not understand. When I test app from USB cable all work good. But when I want to test my app through wifi (I use Android Wifi ADB) LLDB Debug server start, but not attach to process.
If I debug java code use java debugger all work good. | All output in debug console:
Connecting to org.temp.test
Waiting for application to start debug server
Waiting for application to come online: org.temp.test.test | org.temp.test
Connecting to org.temp.test
Now Launching Native Debug Session
Starting LLDB server: /data/data/org.temp.test/lldb/bin/start\_lldb\_server... |
43,469,455 | Perl is giving me an undef value when I access a variable that is supposed to be defined in the **%ENV** hash. How is this possible?
```
root@23cd5f45def7:~/bin$ perl -e 'warn $ENV{SHELL}'
Warning: something's wrong at -e line 1.
```
I would expect perl to output **/bin/bash** instead.
More info on the environment... | 2017/04/18 | [
"https://Stackoverflow.com/questions/43469455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6181762/"
] | The ListView doesn't have the nested scrolls enabled by default. Use
```
ViewCompat.setNestedScrollingEnabled(listView, true);
```
to enable it.
Be aware that this will from from lollipop onwards . If you want to support older versions of android you should use a RecyclerView | **`ListView` doesn't support nested scrolling**
Use `RecyclerView` instead of `ListView` and enable nested scrolling in `RecyclerView` |
43,469,455 | Perl is giving me an undef value when I access a variable that is supposed to be defined in the **%ENV** hash. How is this possible?
```
root@23cd5f45def7:~/bin$ perl -e 'warn $ENV{SHELL}'
Warning: something's wrong at -e line 1.
```
I would expect perl to output **/bin/bash** instead.
More info on the environment... | 2017/04/18 | [
"https://Stackoverflow.com/questions/43469455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6181762/"
] | The ListView doesn't have the nested scrolls enabled by default. Use
```
ViewCompat.setNestedScrollingEnabled(listView, true);
```
to enable it.
Be aware that this will from from lollipop onwards . If you want to support older versions of android you should use a RecyclerView | Best practice is to use `RecyclerView` with `app:layout_behavior="@string/appbar_scrolling_view_behavior"` inside `CoordinatorLayout`. |
43,469,455 | Perl is giving me an undef value when I access a variable that is supposed to be defined in the **%ENV** hash. How is this possible?
```
root@23cd5f45def7:~/bin$ perl -e 'warn $ENV{SHELL}'
Warning: something's wrong at -e line 1.
```
I would expect perl to output **/bin/bash** instead.
More info on the environment... | 2017/04/18 | [
"https://Stackoverflow.com/questions/43469455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6181762/"
] | **`ListView` doesn't support nested scrolling**
Use `RecyclerView` instead of `ListView` and enable nested scrolling in `RecyclerView` | Best practice is to use `RecyclerView` with `app:layout_behavior="@string/appbar_scrolling_view_behavior"` inside `CoordinatorLayout`. |
22,419,518 | I have a `UIPickerView` that was programmed manually so that I was able to add seconds. The `UIPickerView` lets you choose hours, minutes, and seconds. I am having a very hard time figuring out how to get the data from this picker so that I can store it. Can someone help me? All the ones that apple has pre made have at... | 2014/03/15 | [
"https://Stackoverflow.com/questions/22419518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1760836/"
] | Then you can implement this delegate method.
```
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
//Do you stuff here.
}
```
It will fire when you select on the particular row in picker. For example, If you select on first component, You can get selec... | You can assign the delegate and datasource for the UIPickerView. So, In delegate methods you can get the actions from UIPickerView. Please refer this for more info : <https://developer.apple.com/library/ios/documentation/uikit/reference/UIPickerView_Class/Reference/UIPickerView.html>
**Selecting Rows in the View Picke... |
22,419,518 | I have a `UIPickerView` that was programmed manually so that I was able to add seconds. The `UIPickerView` lets you choose hours, minutes, and seconds. I am having a very hard time figuring out how to get the data from this picker so that I can store it. Can someone help me? All the ones that apple has pre made have at... | 2014/03/15 | [
"https://Stackoverflow.com/questions/22419518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1760836/"
] | If you want to get selected row after scrolling of `UIPickerView` is over. Then you need to add valueChanged event of `UIPickerView.`
```
[myPickerView addTarget:self action:@selector(valueChange:) forControlEvents:UIControlEventValueChanged];
```
And add method name is
```
-(void)valueChange:(UIPickerView *) pic... | Then you can implement this delegate method.
```
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
//Do you stuff here.
}
```
It will fire when you select on the particular row in picker. For example, If you select on first component, You can get selec... |
22,419,518 | I have a `UIPickerView` that was programmed manually so that I was able to add seconds. The `UIPickerView` lets you choose hours, minutes, and seconds. I am having a very hard time figuring out how to get the data from this picker so that I can store it. Can someone help me? All the ones that apple has pre made have at... | 2014/03/15 | [
"https://Stackoverflow.com/questions/22419518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1760836/"
] | If you want to get selected row after scrolling of `UIPickerView` is over. Then you need to add valueChanged event of `UIPickerView.`
```
[myPickerView addTarget:self action:@selector(valueChange:) forControlEvents:UIControlEventValueChanged];
```
And add method name is
```
-(void)valueChange:(UIPickerView *) pic... | You can assign the delegate and datasource for the UIPickerView. So, In delegate methods you can get the actions from UIPickerView. Please refer this for more info : <https://developer.apple.com/library/ios/documentation/uikit/reference/UIPickerView_Class/Reference/UIPickerView.html>
**Selecting Rows in the View Picke... |
429,278 | When I shutdown tomcat on server it show following error
```
Using CATALINA_BASE: /usr/local/tomcat7/apache-tomcat-7.0.52
Using CATALINA_HOME: /usr/local/tomcat7/apache-tomcat-7.0.52
Using CATALINA_TMPDIR: /usr/local/tomcat7/apache-tomcat-7.0.52/temp
Using JRE_HOME: /usr/local/java/jre*
Using CLASSPATH: ... | 2014/03/04 | [
"https://askubuntu.com/questions/429278",
"https://askubuntu.com",
"https://askubuntu.com/users/245958/"
] | You need set the `JAVA_HOME` path us [environment variables](https://help.ubuntu.com/community/EnvironmentVariables#Other_files-1). Add in shell config file `/etc/bash.bashrc` path variables. For do this just run follow command in terminal:
```
sudo nano /etc/bash.bashrc
```
And copy & past follow code in bottom of ... | This error may sound silly,
but try to shutdown using `sudo`
from the `bin` folder in tomcat directory run:
`$ sudo ./shutdown.sh` |
49,865,063 | I have some data that looks like this (This is real countries but no sensitive data) It is formatted exactly like i posted
```
Calgary, Alberta T2P 0B3 Canada
Thunder Bay, Ontario P7G 0A1 Canada
Toronto, Ontario M3A 1E5 Canada
Calgary, Alberta T2G 1C6 Canada
Calgary, Alberta T2N 1C2 Canada
Edmonton, Alberta T5J 2W8 Ca... | 2018/04/16 | [
"https://Stackoverflow.com/questions/49865063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9566055/"
] | I think this should work, assuming it **always** ends with `Canada`:
```
=MID(A1,SEARCH("Canada",A1)-8,8)
```
[](https://i.stack.imgur.com/Xuphl.jpg) | You could split the content on spaces and just drop the final content of the split (which will always be Canada), preserving the elements at index -2 and -3 (the zip elements) |
711,018 | We have a dll that is a plug-in for a asp.net shopping cart software that customers can purchase. However, we want to lock that dll to a particular domain for security reasons and we don't want them to be able to read that dll or use that dll in another domain they may have. How can we do this? | 2009/04/02 | [
"https://Stackoverflow.com/questions/711018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45429/"
] | Brainstorming:
* Hard-code a domain-check into the dll's main function and compile a new dll for each customer (ok, not scalable)
* Distribute a license file with the dll that stores the valid domain for the dll, encrypted. Have your DLL check for the file, decrypt the contents, and fail if the file is missing or the ... | The DLL could look at the incoming request's host header. |
33,829 | We want to use SPSS to compare two groups (2 independent samples t-test). The first group contains real data, the other group is fictional. This fictional group should contain as many "subjects" as the real (1st) group. But the mean is set to 0 and the standard deviation to 1 (standard normal distribution).
There are ... | 2012/08/07 | [
"https://stats.stackexchange.com/questions/33829",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/13123/"
] | Spectral coherence, if used correctly would do it. Coherence is computed at each frequency-and hence is a vector. Hence, a sum of a weighted coherence would be a good measure. You would typically want to weight the coherences at frequencies that have a high energy in the power spectral density. That way, you would be m... | Have you tried another approach for climate signal detection/modelling, like a wavelet analysis? The big problem that can arise with the DFT in climate analysis is actually what you mention: the oscillations are not perfectly periodic and they usually have different time spans so they can actually have many different o... |
33,829 | We want to use SPSS to compare two groups (2 independent samples t-test). The first group contains real data, the other group is fictional. This fictional group should contain as many "subjects" as the real (1st) group. But the mean is set to 0 and the standard deviation to 1 (standard normal distribution).
There are ... | 2012/08/07 | [
"https://stats.stackexchange.com/questions/33829",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/13123/"
] | Have you tried another approach for climate signal detection/modelling, like a wavelet analysis? The big problem that can arise with the DFT in climate analysis is actually what you mention: the oscillations are not perfectly periodic and they usually have different time spans so they can actually have many different o... | I voted for and second the use of wavelet and spectrogram based analysis as an alternative to dft. If you can decompose your series into localized time-frequency bins, it reduces the fourier problems of aperiodicity and non-stationarity, as well as provides a nice profile of discretized data to compare.
Once the data ... |
33,829 | We want to use SPSS to compare two groups (2 independent samples t-test). The first group contains real data, the other group is fictional. This fictional group should contain as many "subjects" as the real (1st) group. But the mean is set to 0 and the standard deviation to 1 (standard normal distribution).
There are ... | 2012/08/07 | [
"https://stats.stackexchange.com/questions/33829",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/13123/"
] | Spectral coherence, if used correctly would do it. Coherence is computed at each frequency-and hence is a vector. Hence, a sum of a weighted coherence would be a good measure. You would typically want to weight the coherences at frequencies that have a high energy in the power spectral density. That way, you would be m... | I voted for and second the use of wavelet and spectrogram based analysis as an alternative to dft. If you can decompose your series into localized time-frequency bins, it reduces the fourier problems of aperiodicity and non-stationarity, as well as provides a nice profile of discretized data to compare.
Once the data ... |
890,864 | How can i install wine mono and gecko? I have downloaded the .msi file suitable for installed wine version.
Please help me. Where shoul i place these .msi files? | 2017/03/08 | [
"https://askubuntu.com/questions/890864",
"https://askubuntu.com",
"https://askubuntu.com/users/662941/"
] | From <https://www.winehq.org/pipermail/wine-users/2005-December/020055.html>
```
wine msiexec /i <path to msi>
``` | You can copy `wine-mono` in `/usr/share/wine/mon/`. I already did it and it's the location where wine is looking for it according to this [webpage](https://wiki.winehq.org/Mono).
The same for `wine_gecko` msi placed in`/usr/share/wine/gecko`. |
7,876,341 | I am working on an EE 1.7.1 site and need to display the two most recent article entries on the home page. The challenge is that I also need to link those entries back to their respective category pages to display properly.
Here is the code I have so far:
```
{exp:weblog:entries weblog="articles" limit="2"}
<p><a ... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7876341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152205/"
] | ```
On Error Resume Next
worksheet.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
```
The error handling helps when there are no blank cells. `SpecialCells(xlCellTypeBlanks)` will always return an error if there are no cells like that so error handling is the only way (that I know of) ... | Working fine with me . These statement does not throw any error to me
```
Sheet1.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete 'perfect
```
I found these type of solution for your question
```
On Error Resume Next
Sheet1.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error Go... |
7,876,341 | I am working on an EE 1.7.1 site and need to display the two most recent article entries on the home page. The challenge is that I also need to link those entries back to their respective category pages to display properly.
Here is the code I have so far:
```
{exp:weblog:entries weblog="articles" limit="2"}
<p><a ... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7876341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152205/"
] | You need to test that there are any blanks.
```
If WorksheetFunction.CountBlank(Worksheet.Columns("A:A")) > 0 Then
Worksheet.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End If
```
You can just use On Error Resume Next to skip over the line if there are no blanks, but it's generally preferable ... | Working fine with me . These statement does not throw any error to me
```
Sheet1.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete 'perfect
```
I found these type of solution for your question
```
On Error Resume Next
Sheet1.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error Go... |
7,876,341 | I am working on an EE 1.7.1 site and need to display the two most recent article entries on the home page. The challenge is that I also need to link those entries back to their respective category pages to display properly.
Here is the code I have so far:
```
{exp:weblog:entries weblog="articles" limit="2"}
<p><a ... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7876341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152205/"
] | Working fine with me . These statement does not throw any error to me
```
Sheet1.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete 'perfect
```
I found these type of solution for your question
```
On Error Resume Next
Sheet1.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error Go... | Another way:
```
If Range("Table2").Rows.Count > 1 Then
Range("Table2").EntireRow.Delete
End If
``` |
7,876,341 | I am working on an EE 1.7.1 site and need to display the two most recent article entries on the home page. The challenge is that I also need to link those entries back to their respective category pages to display properly.
Here is the code I have so far:
```
{exp:weblog:entries weblog="articles" limit="2"}
<p><a ... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7876341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152205/"
] | Working fine with me . These statement does not throw any error to me
```
Sheet1.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete 'perfect
```
I found these type of solution for your question
```
On Error Resume Next
Sheet1.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error Go... | ```
Sub delete_rows_blank()
t = 1
lastrow = ActiveSheet.UsedRange.Rows.Count
Do Until t = lastrow
If Cells(t, "A") = "" Then
Rows(t).Delete
End If
t = t + 1
Loop
End Sub
``` |
7,876,341 | I am working on an EE 1.7.1 site and need to display the two most recent article entries on the home page. The challenge is that I also need to link those entries back to their respective category pages to display properly.
Here is the code I have so far:
```
{exp:weblog:entries weblog="articles" limit="2"}
<p><a ... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7876341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152205/"
] | ```
On Error Resume Next
worksheet.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
```
The error handling helps when there are no blank cells. `SpecialCells(xlCellTypeBlanks)` will always return an error if there are no cells like that so error handling is the only way (that I know of) ... | You need to test that there are any blanks.
```
If WorksheetFunction.CountBlank(Worksheet.Columns("A:A")) > 0 Then
Worksheet.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End If
```
You can just use On Error Resume Next to skip over the line if there are no blanks, but it's generally preferable ... |
7,876,341 | I am working on an EE 1.7.1 site and need to display the two most recent article entries on the home page. The challenge is that I also need to link those entries back to their respective category pages to display properly.
Here is the code I have so far:
```
{exp:weblog:entries weblog="articles" limit="2"}
<p><a ... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7876341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152205/"
] | ```
On Error Resume Next
worksheet.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
```
The error handling helps when there are no blank cells. `SpecialCells(xlCellTypeBlanks)` will always return an error if there are no cells like that so error handling is the only way (that I know of) ... | Another way:
```
If Range("Table2").Rows.Count > 1 Then
Range("Table2").EntireRow.Delete
End If
``` |
7,876,341 | I am working on an EE 1.7.1 site and need to display the two most recent article entries on the home page. The challenge is that I also need to link those entries back to their respective category pages to display properly.
Here is the code I have so far:
```
{exp:weblog:entries weblog="articles" limit="2"}
<p><a ... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7876341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152205/"
] | ```
On Error Resume Next
worksheet.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
```
The error handling helps when there are no blank cells. `SpecialCells(xlCellTypeBlanks)` will always return an error if there are no cells like that so error handling is the only way (that I know of) ... | ```
Sub delete_rows_blank()
t = 1
lastrow = ActiveSheet.UsedRange.Rows.Count
Do Until t = lastrow
If Cells(t, "A") = "" Then
Rows(t).Delete
End If
t = t + 1
Loop
End Sub
``` |
7,876,341 | I am working on an EE 1.7.1 site and need to display the two most recent article entries on the home page. The challenge is that I also need to link those entries back to their respective category pages to display properly.
Here is the code I have so far:
```
{exp:weblog:entries weblog="articles" limit="2"}
<p><a ... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7876341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152205/"
] | You need to test that there are any blanks.
```
If WorksheetFunction.CountBlank(Worksheet.Columns("A:A")) > 0 Then
Worksheet.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End If
```
You can just use On Error Resume Next to skip over the line if there are no blanks, but it's generally preferable ... | Another way:
```
If Range("Table2").Rows.Count > 1 Then
Range("Table2").EntireRow.Delete
End If
``` |
7,876,341 | I am working on an EE 1.7.1 site and need to display the two most recent article entries on the home page. The challenge is that I also need to link those entries back to their respective category pages to display properly.
Here is the code I have so far:
```
{exp:weblog:entries weblog="articles" limit="2"}
<p><a ... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7876341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152205/"
] | You need to test that there are any blanks.
```
If WorksheetFunction.CountBlank(Worksheet.Columns("A:A")) > 0 Then
Worksheet.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End If
```
You can just use On Error Resume Next to skip over the line if there are no blanks, but it's generally preferable ... | ```
Sub delete_rows_blank()
t = 1
lastrow = ActiveSheet.UsedRange.Rows.Count
Do Until t = lastrow
If Cells(t, "A") = "" Then
Rows(t).Delete
End If
t = t + 1
Loop
End Sub
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.