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
2,933,849
All lines in my AppStats look like this: `real=19ms cpu=0ms api=0ms overhead=0ms`, it has the correct real time, but the other values are always 0. Anyone have this problem before or know how to fix this?
2010/05/29
[ "https://Stackoverflow.com/questions/2933849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/243494/" ]
It's a convention, but a particularly useful one when you think about it. In general, if a program succeeds that's all you need to know. If it fails, however, you might need to know all kinds of information about the failure - why it happened, how to fix it, etc. Having zero mean 'success' and non-zero mean failure let...
AFAIK this come from the C convention that you should return 0 if succeded. See: ``` man close ``` Most of the C (POSIX) api is build like this. <http://en.wikipedia.org/wiki/C_POSIX_library>
2,933,849
All lines in my AppStats look like this: `real=19ms cpu=0ms api=0ms overhead=0ms`, it has the correct real time, but the other values are always 0. Anyone have this problem before or know how to fix this?
2010/05/29
[ "https://Stackoverflow.com/questions/2933849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/243494/" ]
Typically programs return zero for success, non-zero for failure; `false` returns 1 because it's a convenient non-zero value, but generally any non-zero value means failure of some sort, and many programs will return different non-zero values to indicate different failure modes
it's a convention dated back to the early days of Unix. By convention, all system calls return 0 if succeed, non-zero otherwise, because then different numbers can be used to indicate different reason of failure. Shells follow this convention, 0 means last command succeeded, non-zero otherwise. Similarly, the non-zer...
2,933,849
All lines in my AppStats look like this: `real=19ms cpu=0ms api=0ms overhead=0ms`, it has the correct real time, but the other values are always 0. Anyone have this problem before or know how to fix this?
2010/05/29
[ "https://Stackoverflow.com/questions/2933849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/243494/" ]
Bash is a programming (scripting) language, but it's also a shell and a user-interface. If `0` was error, then the program could only present one kind of error. However in Bash, any nonzero value is an error, and we may use any number from 1-255 to represent an error. This means we can have many different kinds of err...
it's a convention dated back to the early days of Unix. By convention, all system calls return 0 if succeed, non-zero otherwise, because then different numbers can be used to indicate different reason of failure. Shells follow this convention, 0 means last command succeeded, non-zero otherwise. Similarly, the non-zer...
2,933,849
All lines in my AppStats look like this: `real=19ms cpu=0ms api=0ms overhead=0ms`, it has the correct real time, but the other values are always 0. Anyone have this problem before or know how to fix this?
2010/05/29
[ "https://Stackoverflow.com/questions/2933849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/243494/" ]
AFAIK this come from the C convention that you should return 0 if succeded. See: ``` man close ``` Most of the C (POSIX) api is build like this. <http://en.wikipedia.org/wiki/C_POSIX_library>
Maybe a good way to remember it is : * Return codes answer "what's the answer?" true (or other result) or false * Exit codes answer "what's the problem?" exit code or no problem (0)
61,171,605
I am trying to connect to a cluster created in Mongodb Atlas using mongoose in node js and I am facing below issues when doing so. 1. When I use the connection string that is given in the Mongo db atlas`mongodb+srv://lm_dev_app:<password>@lmdev-q5biw.mongodb.net/test?retryWrites=true&w=majority`I get below error { Er...
2020/04/12
[ "https://Stackoverflow.com/questions/61171605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7203065/" ]
There are couple of things that I need to highlight here. 1. The default connection string that is shown in Mongodb Atlas seems to be wrong. It shows you `mongodb+srv://<username>:<password>@<cluster_url>/test?retryWrites=true&w=majority`. But I used `mongodb://<username>:<password>@<node_url>:27017/` to make it work....
After trying different connection strings for several hours, I finally just copy/pasted the connection string from MongoDB Compass and it works! (first connect, then edit the connection string as it will change) It looks like this: `mongodb+srv://username:password@fra-atlas-shard.abcde.mongodb.net/test?authSource=adm...
1,003,136
Prove that $$\sum^{n}\_{k=1} \frac{1}{\sqrt{k}}>\sqrt{n}$$ for all $n\in \mathbb{N}$ where $n\geq2$. I've already proven the base case for $n=2$, but I don't know how to make the next step. Is the base case right? for $n=2$ $$\sum^{2}\_{k=1} \frac{1}{\sqrt{k}}=\frac{1}{\sqrt{1}}+\frac{1}{\sqrt{2}}=\frac{\sqrt{2}+2}{2...
2014/11/02
[ "https://math.stackexchange.com/questions/1003136", "https://math.stackexchange.com", "https://math.stackexchange.com/users/186823/" ]
Assume $\sum^{n}\_{k=1} \frac{1}{\sqrt{k}}>\sqrt{n}$. Then $$\sum^{n}\_{k=1} \frac{1}{\sqrt{k}} + \frac{1}{\sqrt{n+1}}>\sqrt{n} + \frac{1}{\sqrt{n+1}} = \frac{\sqrt{n}\sqrt{n+1}+1}{\sqrt{n+1}}.$$ Now since $n\ge 2$, we have $$\frac{\sqrt{n}\sqrt{n+1}+1}{\sqrt{n+1}} > \frac{\sqrt{n}\sqrt{n}+1}{\sqrt{n+1}} = \frac{n+1}{...
*Hint:* $(\sqrt{n+1}-\sqrt n)(\sqrt{n+1}+\sqrt n)=1$
1,003,136
Prove that $$\sum^{n}\_{k=1} \frac{1}{\sqrt{k}}>\sqrt{n}$$ for all $n\in \mathbb{N}$ where $n\geq2$. I've already proven the base case for $n=2$, but I don't know how to make the next step. Is the base case right? for $n=2$ $$\sum^{2}\_{k=1} \frac{1}{\sqrt{k}}=\frac{1}{\sqrt{1}}+\frac{1}{\sqrt{2}}=\frac{\sqrt{2}+2}{2...
2014/11/02
[ "https://math.stackexchange.com/questions/1003136", "https://math.stackexchange.com", "https://math.stackexchange.com/users/186823/" ]
Assume $\sum^{n}\_{k=1} \frac{1}{\sqrt{k}}>\sqrt{n}$. Then $$\sum^{n}\_{k=1} \frac{1}{\sqrt{k}} + \frac{1}{\sqrt{n+1}}>\sqrt{n} + \frac{1}{\sqrt{n+1}} = \frac{\sqrt{n}\sqrt{n+1}+1}{\sqrt{n+1}}.$$ Now since $n\ge 2$, we have $$\frac{\sqrt{n}\sqrt{n+1}+1}{\sqrt{n+1}} > \frac{\sqrt{n}\sqrt{n}+1}{\sqrt{n+1}} = \frac{n+1}{...
By the AM-GM inequality $$\begin{align\*}\frac{1}{\sqrt{1}}+\frac{1}{\sqrt{2}}+\ldots+\frac{1}{\sqrt{n}}&\ge n\sqrt[n]{\dfrac{1}{\sqrt{n!}}}>n\sqrt{\dfrac{1}{\sqrt[n]{n^n}}}=n\cdot\dfrac{1}{\sqrt{n}}=\sqrt{n}\end{align\*}$$
9,692
Re-watching the 2009 movie for the first time after answering [this question about shield collisions](https://scifi.stackexchange.com/questions/9312/what-would-happen-in-the-star-trek-universe-if-shields-collided), I noticed the following: > > *Enterprise* is about to drop out of warp in Vulcan space. > > > Captain...
2012/01/25
[ "https://scifi.stackexchange.com/questions/9692", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3247/" ]
I think the shield technology is a little different than the later ellipsoid ones. It is an energy field applied to the hull that deflects energy weapons. In *Star Trek 6* you can see torpedoes hitting the hull even though the shields are up, but they cause little damage compared to later when the shields are down.
The *Enterprise* in this episode is a new and untried ship with an inexperienced crew. The shields are designed to protect the hull of the starship, so a piece of another starship of the same design could possibly breach the shields, as the shields are designed to protect against energy weapons and foreign materials, ...
9,692
Re-watching the 2009 movie for the first time after answering [this question about shield collisions](https://scifi.stackexchange.com/questions/9312/what-would-happen-in-the-star-trek-universe-if-shields-collided), I noticed the following: > > *Enterprise* is about to drop out of warp in Vulcan space. > > > Captain...
2012/01/25
[ "https://scifi.stackexchange.com/questions/9692", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3247/" ]
The exact behavior of shields varies through the canon. It's generally accepted that shields block high-energy transmissions (phasers, disruptors, transporter beams), and "high-velocity" physical objects (photon torpedoes, asteroids, even smaller ships). However, there are also instances of a ship's shields holding bac...
The *Enterprise* in this episode is a new and untried ship with an inexperienced crew. The shields are designed to protect the hull of the starship, so a piece of another starship of the same design could possibly breach the shields, as the shields are designed to protect against energy weapons and foreign materials, ...
9,692
Re-watching the 2009 movie for the first time after answering [this question about shield collisions](https://scifi.stackexchange.com/questions/9312/what-would-happen-in-the-star-trek-universe-if-shields-collided), I noticed the following: > > *Enterprise* is about to drop out of warp in Vulcan space. > > > Captain...
2012/01/25
[ "https://scifi.stackexchange.com/questions/9692", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3247/" ]
I think the shield technology is a little different than the later ellipsoid ones. It is an energy field applied to the hull that deflects energy weapons. In *Star Trek 6* you can see torpedoes hitting the hull even though the shields are up, but they cause little damage compared to later when the shields are down.
The exact behavior of shields varies through the canon. It's generally accepted that shields block high-energy transmissions (phasers, disruptors, transporter beams), and "high-velocity" physical objects (photon torpedoes, asteroids, even smaller ships). However, there are also instances of a ship's shields holding bac...
9,692
Re-watching the 2009 movie for the first time after answering [this question about shield collisions](https://scifi.stackexchange.com/questions/9312/what-would-happen-in-the-star-trek-universe-if-shields-collided), I noticed the following: > > *Enterprise* is about to drop out of warp in Vulcan space. > > > Captain...
2012/01/25
[ "https://scifi.stackexchange.com/questions/9692", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3247/" ]
I'd have to watch that scene again - but it could be that the debris was already inside the shield's surface area. In other *Star Trek* material (particularly *TNG*, but other series, too), shields appear to be ellipsoid shells around the ship, so it is possible that the debris was already inside as the shield was po...
The *Enterprise* in this episode is a new and untried ship with an inexperienced crew. The shields are designed to protect the hull of the starship, so a piece of another starship of the same design could possibly breach the shields, as the shields are designed to protect against energy weapons and foreign materials, ...
9,692
Re-watching the 2009 movie for the first time after answering [this question about shield collisions](https://scifi.stackexchange.com/questions/9312/what-would-happen-in-the-star-trek-universe-if-shields-collided), I noticed the following: > > *Enterprise* is about to drop out of warp in Vulcan space. > > > Captain...
2012/01/25
[ "https://scifi.stackexchange.com/questions/9692", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3247/" ]
I think the shield technology is a little different than the later ellipsoid ones. It is an energy field applied to the hull that deflects energy weapons. In *Star Trek 6* you can see torpedoes hitting the hull even though the shields are up, but they cause little damage compared to later when the shields are down.
I've always attributed this to the *size* of the debris that collided with the ship. As you mentioned, the shields (augmented by the navigational deflector) are capable of deflecting interstellar dust, even at high velocities. But dust has a relatively low mass, meaning the energy required to move it out of the way i...
9,692
Re-watching the 2009 movie for the first time after answering [this question about shield collisions](https://scifi.stackexchange.com/questions/9312/what-would-happen-in-the-star-trek-universe-if-shields-collided), I noticed the following: > > *Enterprise* is about to drop out of warp in Vulcan space. > > > Captain...
2012/01/25
[ "https://scifi.stackexchange.com/questions/9692", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3247/" ]
I think the shield technology is a little different than the later ellipsoid ones. It is an energy field applied to the hull that deflects energy weapons. In *Star Trek 6* you can see torpedoes hitting the hull even though the shields are up, but they cause little damage compared to later when the shields are down.
I don't believe there are canonical examples of starships plowing through fields of ship-sized debris and expecting the shields to handle it for them. Maybe this is just because captains prefer to preserve their shield power, but it's certainly plausible that shields just aren't meant to handle that sort of thing.
9,692
Re-watching the 2009 movie for the first time after answering [this question about shield collisions](https://scifi.stackexchange.com/questions/9312/what-would-happen-in-the-star-trek-universe-if-shields-collided), I noticed the following: > > *Enterprise* is about to drop out of warp in Vulcan space. > > > Captain...
2012/01/25
[ "https://scifi.stackexchange.com/questions/9692", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3247/" ]
I don't believe there are canonical examples of starships plowing through fields of ship-sized debris and expecting the shields to handle it for them. Maybe this is just because captains prefer to preserve their shield power, but it's certainly plausible that shields just aren't meant to handle that sort of thing.
The *Enterprise* in this episode is a new and untried ship with an inexperienced crew. The shields are designed to protect the hull of the starship, so a piece of another starship of the same design could possibly breach the shields, as the shields are designed to protect against energy weapons and foreign materials, ...
9,692
Re-watching the 2009 movie for the first time after answering [this question about shield collisions](https://scifi.stackexchange.com/questions/9312/what-would-happen-in-the-star-trek-universe-if-shields-collided), I noticed the following: > > *Enterprise* is about to drop out of warp in Vulcan space. > > > Captain...
2012/01/25
[ "https://scifi.stackexchange.com/questions/9692", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3247/" ]
I've always attributed this to the *size* of the debris that collided with the ship. As you mentioned, the shields (augmented by the navigational deflector) are capable of deflecting interstellar dust, even at high velocities. But dust has a relatively low mass, meaning the energy required to move it out of the way i...
The *Enterprise* in this episode is a new and untried ship with an inexperienced crew. The shields are designed to protect the hull of the starship, so a piece of another starship of the same design could possibly breach the shields, as the shields are designed to protect against energy weapons and foreign materials, ...
9,692
Re-watching the 2009 movie for the first time after answering [this question about shield collisions](https://scifi.stackexchange.com/questions/9312/what-would-happen-in-the-star-trek-universe-if-shields-collided), I noticed the following: > > *Enterprise* is about to drop out of warp in Vulcan space. > > > Captain...
2012/01/25
[ "https://scifi.stackexchange.com/questions/9692", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3247/" ]
I'd have to watch that scene again - but it could be that the debris was already inside the shield's surface area. In other *Star Trek* material (particularly *TNG*, but other series, too), shields appear to be ellipsoid shells around the ship, so it is possible that the debris was already inside as the shield was po...
I've always attributed this to the *size* of the debris that collided with the ship. As you mentioned, the shields (augmented by the navigational deflector) are capable of deflecting interstellar dust, even at high velocities. But dust has a relatively low mass, meaning the energy required to move it out of the way i...
9,692
Re-watching the 2009 movie for the first time after answering [this question about shield collisions](https://scifi.stackexchange.com/questions/9312/what-would-happen-in-the-star-trek-universe-if-shields-collided), I noticed the following: > > *Enterprise* is about to drop out of warp in Vulcan space. > > > Captain...
2012/01/25
[ "https://scifi.stackexchange.com/questions/9692", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3247/" ]
I don't believe there are canonical examples of starships plowing through fields of ship-sized debris and expecting the shields to handle it for them. Maybe this is just because captains prefer to preserve their shield power, but it's certainly plausible that shields just aren't meant to handle that sort of thing.
I've always attributed this to the *size* of the debris that collided with the ship. As you mentioned, the shields (augmented by the navigational deflector) are capable of deflecting interstellar dust, even at high velocities. But dust has a relatively low mass, meaning the energy required to move it out of the way i...
22,366,299
I'm using Matplotlib and Numpy to plot linear regressions on time series plots in order to predict the trends in the future. Generating the regressions doesn't seem to be particularly difficult, but getting the regression line to extend past the last data point is proving challenging: ![time series with linear regre...
2014/03/12
[ "https://Stackoverflow.com/questions/22366299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1730417/" ]
When you evaluate your regression model, you're predicting a value of submissions for the input date. To predict a wider range, you need to increase the range of dates that you're evaluating the model on. I'd also use `np.polyval` instead of the list comprehension, just because as it's more compact: ``` # Generate dat...
If you want to extend the regression line beyond the data, for example, to cover the entire x range, you can do (just change the last 3 lines): ``` import numpy as np X=np.arange(xmin, xmax, 50) line=beta1*X**2+beta2*X+beta3 plt.plot(X, line, 'r-', lw=5.) ```
1,323,990
> > following Diophantine equation > $$xy^2+yz^2+zx^2=x^2y+y^2z+z^2x+x+y+z$$ > ie:$(x-y)(y-z)(z-x)=x+y+z$ > > > where $x,y,z$ are integers. can find $x+y+z$ I tried some values and got some near equalities when $x,y,z$ at least two are equal, $x+y+z=0$,for other case, who have an idea to discuss...plz. Thank...
2015/06/13
[ "https://math.stackexchange.com/questions/1323990", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Hint: $$x\sqrt{\frac{a^2-x^2}{a^2+x^2}}=x\sqrt{\frac{1-(\frac{x}{a})^2}{1+(\frac{x}{a})^2}}$$ and use the trigonometric identity $$\sqrt{\frac{1-\cos \theta}{1+\cos \theta}}=|\tan\left(\frac{\theta}{2}\right)|$$
**Hint:** $~\dfrac{1+\cos2t}2=\cos^2t~$ and $~\dfrac{1-\cos2t}2=\sin^2t.$
25,967,700
+[CDSession findFirstWithPredicate:inContext:]: unrecognized selector sent to class 0x919b3c What has changed in ios 8? It worked well with ios7. I can't get it approveed. **UPD** After rename methods with prefix i catch next error: ``` results = [context executeFetchRequest:request error:&error]; Terminating app ...
2014/09/22
[ "https://Stackoverflow.com/questions/25967700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/887325/" ]
On devices was added CoreDuet framework with some class name like `CDSession`. i just rename this class and all working correctly now.
Use the MR\_ prefix on all your methods.
1,907,795
I'm currently looking at a function example that I can't seem to figure out using MFC in Visual C++. The function is as follows ``` CMFC_OSG_MDIView::CMFC_OSG_MDIView() :mOSG(0L) { } ``` I understand everything here except the mOSG(0L) snippet. mOSG was declared in the MFC\_OSG \_MDIView class as follows: ``` cOSG*...
2009/12/15
[ "https://Stackoverflow.com/questions/1907795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/224832/" ]
``` CMFC_OSG_MDIView::CMFC_OSG_MDIView() :mOSG(0L) { } ``` The above is a constructor, for a class called `CMFC_OSG_MDIView`. `:mOSG(0L)` is called `initializer list`, which is executed when an object is created. The init-list gets called before the body of the constructor, and it is the *correct* place to initialize...
That's an initializer - `mOSG` is initialized with 0L. When the control enters the constructor body `mOSG` is already initialized. See [this question](https://stackoverflow.com/questions/926752/why-should-i-prefer-to-use-member-initialization-list) for discussion of why use initializers instead of assignment inside of...
1,907,795
I'm currently looking at a function example that I can't seem to figure out using MFC in Visual C++. The function is as follows ``` CMFC_OSG_MDIView::CMFC_OSG_MDIView() :mOSG(0L) { } ``` I understand everything here except the mOSG(0L) snippet. mOSG was declared in the MFC\_OSG \_MDIView class as follows: ``` cOSG*...
2009/12/15
[ "https://Stackoverflow.com/questions/1907795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/224832/" ]
``` CMFC_OSG_MDIView::CMFC_OSG_MDIView() :mOSG(0L) { } ``` The above is a constructor, for a class called `CMFC_OSG_MDIView`. `:mOSG(0L)` is called `initializer list`, which is executed when an object is created. The init-list gets called before the body of the constructor, and it is the *correct* place to initialize...
`0L` specifies a long integer with value zero. So this initializes the class member `mOSG` with 0.
13,763,605
In order to store the state of processes when an error occured, I would like to list all (custom) data stored in AppDomain (by SetData). The LocalStore property is private and AppDomain class not inheritable. Is there any way to enumerate those data ?
2012/12/07
[ "https://Stackoverflow.com/questions/13763605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1298408/" ]
``` AppDomain domain = AppDomain.CurrentDomain; domain.SetData("testKey", "testValue"); FieldInfo[] fieldInfoArr = domain.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance); foreach (FieldInfo fieldInfo in fieldInfoArr) { if (string.Compare(fieldInf...
Based on [Frank59's](https://stackoverflow.com/a/13766250/177710) answer but a bit more concise: ``` var appDomain = AppDomain.CurrentDomain; var flags = BindingFlags.NonPublic | BindingFlags.Instance; var fieldInfo = appDomain.GetType().GetField("_LocalStore", flags); if (fieldInfo == null) return; var localStore...
13,763,605
In order to store the state of processes when an error occured, I would like to list all (custom) data stored in AppDomain (by SetData). The LocalStore property is private and AppDomain class not inheritable. Is there any way to enumerate those data ?
2012/12/07
[ "https://Stackoverflow.com/questions/13763605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1298408/" ]
``` AppDomain domain = AppDomain.CurrentDomain; domain.SetData("testKey", "testValue"); FieldInfo[] fieldInfoArr = domain.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance); foreach (FieldInfo fieldInfo in fieldInfoArr) { if (string.Compare(fieldInf...
Same solution, but as an F# extension method. May not need the null check. <https://gist.github.com/ctaggart/30555d3faf94b4d0ff98> ``` type AppDomain with member x.LocalStore with get() = let f = x.GetType().GetField("_LocalStore", BindingFlags.NonPublic ||| BindingFlags.Instance) i...
13,763,605
In order to store the state of processes when an error occured, I would like to list all (custom) data stored in AppDomain (by SetData). The LocalStore property is private and AppDomain class not inheritable. Is there any way to enumerate those data ?
2012/12/07
[ "https://Stackoverflow.com/questions/13763605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1298408/" ]
Based on [Frank59's](https://stackoverflow.com/a/13766250/177710) answer but a bit more concise: ``` var appDomain = AppDomain.CurrentDomain; var flags = BindingFlags.NonPublic | BindingFlags.Instance; var fieldInfo = appDomain.GetType().GetField("_LocalStore", flags); if (fieldInfo == null) return; var localStore...
Same solution, but as an F# extension method. May not need the null check. <https://gist.github.com/ctaggart/30555d3faf94b4d0ff98> ``` type AppDomain with member x.LocalStore with get() = let f = x.GetType().GetField("_LocalStore", BindingFlags.NonPublic ||| BindingFlags.Instance) i...
73,915,085
I'm looking to edit a Minecraft Windows 10 `level.dat` file in python. I've tried using the package `nbt` and `pyanvil` but get the error `OSError: Not a gzipped file`. If I print `open("level.dat", "rb").read()` I get a lot of nonsensical data. It seems like it needs to be decoded somehow, but I don't know what decodi...
2022/10/01
[ "https://Stackoverflow.com/questions/73915085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11439134/" ]
To read data just do : ``` from nbt import nbt nbtfile = nbt.NBTFile("level.dat", 'rb') print(nbtfile) # Here you should get a TAG_Compound('Data') print(nbtfile["Data"].tag_info()) # Data came from the line above for tag in nbtfile["Data"].tags: # This loop will show us each entry print(tag.tag_info()) ``` As...
You'll have to give the path either relative to the current working directory > > path/to/file.dat > > > Or you can use the absolute path to the file > > C:user/dir/path/to/file.dat > > > Read the data,replace the values and then write it ``` # Read in the file with open('file.dat', 'r') as file : fileda...
37,727
For a disease that I am interested in, five or six published works of research have shown an association of changes in gene expression with presence of the disease. However, all these diagnostic biomarker studies were performed with small numbers of cases (15-30) and controls (15-30), and the overlaps between their lis...
2012/09/21
[ "https://stats.stackexchange.com/questions/37727", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/4045/" ]
You have a contingency table with $C=2$ columns and $R=4$ rows. ``` Right Wrong 1st 20 5 25 2nd 22 8 30 3rd 15 7 22 4th 14 9 23 71 29 100 ``` Let $N\_{ij}$ be the number of observations in the $(i,j)$-cell. Define $$ N\...
ANOVA is not appropriate in this case. Think of this as a 2x4 contingency table. I think the generalization of Fisher's exact test to RxC tables will do exactly what you want. Zen has provided detailed calculations for the Fisher test using program in R (I think it is in R). His proposed chi square approximate test wor...
66,194,964
I am trying to create two custom column for flag in in Power query .On the basis County ,Year , month I am trying to find the Latest month in a country Flag and latest common month available in all the country.The data looks like below: [![enter image description here](https://i.stack.imgur.com/pK80d.png)](https://i.st...
2021/02/14
[ "https://Stackoverflow.com/questions/66194964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6699572/" ]
you may want to install the dependencies npm i @babel/preset-react @babel/preset-env @babel/plugin-transform-react-jsx @babel/plugin-syntax-jsx -D
You need to install @babel/preset-react as mwebi said: ``` npm install --save-dev @babel/preset-react ``` Also, if you bootstrapped your react app using create-react-app script, it will ignore a babel config. You must eject the app (not recommended) or create ground up yourself.
12,120
How do I know which notes of a scale may be a Major/Minor chord? Take [this](https://music.stackexchange.com/questions/6177/finding-out-which-scales-contain-a-specific-chord) question as an example. The OP states that the C major scale contains the following chords: C, Dm, Em, F, G, Am, Bdim How do I accomplish this?
2013/09/30
[ "https://music.stackexchange.com/questions/12120", "https://music.stackexchange.com", "https://music.stackexchange.com/users/7098/" ]
What OP means is that if you use the notes of that scale (no sharps or flats added or removed) and play a third and a fifth on each note you get those chords. **Example on C major scale:** C (first note): 3rd up = E 5th up = G Chord = C major D (second note): 3rd up = F 5th up = A Chord = D minor ...
In the major scale, the first and fourth degrees are major. The fifth degree is dominant (major 3rd but minor 7th). The second, third and sixth degrees are minor, and the seventh degree is a minor with a diminished fifth (also known as minor 7th flat 5 or something like that, I'm not too good with chord names in Englis...
12,120
How do I know which notes of a scale may be a Major/Minor chord? Take [this](https://music.stackexchange.com/questions/6177/finding-out-which-scales-contain-a-specific-chord) question as an example. The OP states that the C major scale contains the following chords: C, Dm, Em, F, G, Am, Bdim How do I accomplish this?
2013/09/30
[ "https://music.stackexchange.com/questions/12120", "https://music.stackexchange.com", "https://music.stackexchange.com/users/7098/" ]
What OP means is that if you use the notes of that scale (no sharps or flats added or removed) and play a third and a fifth on each note you get those chords. **Example on C major scale:** C (first note): 3rd up = E 5th up = G Chord = C major D (second note): 3rd up = F 5th up = A Chord = D minor ...
This comes from walking up the scale and taking triplets of notes which are spaced every other note: CEG, DFA, EGB, ... These are called "triads". ![enter image description here](https://i.stack.imgur.com/XcBP5.png) The majors and minors have a perfect fifth above their root note, for instance the Am chord's A-E inte...
12,120
How do I know which notes of a scale may be a Major/Minor chord? Take [this](https://music.stackexchange.com/questions/6177/finding-out-which-scales-contain-a-specific-chord) question as an example. The OP states that the C major scale contains the following chords: C, Dm, Em, F, G, Am, Bdim How do I accomplish this?
2013/09/30
[ "https://music.stackexchange.com/questions/12120", "https://music.stackexchange.com", "https://music.stackexchange.com/users/7098/" ]
What OP means is that if you use the notes of that scale (no sharps or flats added or removed) and play a third and a fifth on each note you get those chords. **Example on C major scale:** C (first note): 3rd up = E 5th up = G Chord = C major D (second note): 3rd up = F 5th up = A Chord = D minor ...
This may have already been answered, but I'll throw in my grain of salt. If you remember, every triad is made up of 3 tones. The root, the third, and the fifth. If you play a C on your piano, then play one third up, and then play a third above that, you have a C major chord, because C-E is an M3. Continue and you get...
12,120
How do I know which notes of a scale may be a Major/Minor chord? Take [this](https://music.stackexchange.com/questions/6177/finding-out-which-scales-contain-a-specific-chord) question as an example. The OP states that the C major scale contains the following chords: C, Dm, Em, F, G, Am, Bdim How do I accomplish this?
2013/09/30
[ "https://music.stackexchange.com/questions/12120", "https://music.stackexchange.com", "https://music.stackexchange.com/users/7098/" ]
This comes from walking up the scale and taking triplets of notes which are spaced every other note: CEG, DFA, EGB, ... These are called "triads". ![enter image description here](https://i.stack.imgur.com/XcBP5.png) The majors and minors have a perfect fifth above their root note, for instance the Am chord's A-E inte...
In the major scale, the first and fourth degrees are major. The fifth degree is dominant (major 3rd but minor 7th). The second, third and sixth degrees are minor, and the seventh degree is a minor with a diminished fifth (also known as minor 7th flat 5 or something like that, I'm not too good with chord names in Englis...
12,120
How do I know which notes of a scale may be a Major/Minor chord? Take [this](https://music.stackexchange.com/questions/6177/finding-out-which-scales-contain-a-specific-chord) question as an example. The OP states that the C major scale contains the following chords: C, Dm, Em, F, G, Am, Bdim How do I accomplish this?
2013/09/30
[ "https://music.stackexchange.com/questions/12120", "https://music.stackexchange.com", "https://music.stackexchange.com/users/7098/" ]
In the major scale, the first and fourth degrees are major. The fifth degree is dominant (major 3rd but minor 7th). The second, third and sixth degrees are minor, and the seventh degree is a minor with a diminished fifth (also known as minor 7th flat 5 or something like that, I'm not too good with chord names in Englis...
This may have already been answered, but I'll throw in my grain of salt. If you remember, every triad is made up of 3 tones. The root, the third, and the fifth. If you play a C on your piano, then play one third up, and then play a third above that, you have a C major chord, because C-E is an M3. Continue and you get...
12,120
How do I know which notes of a scale may be a Major/Minor chord? Take [this](https://music.stackexchange.com/questions/6177/finding-out-which-scales-contain-a-specific-chord) question as an example. The OP states that the C major scale contains the following chords: C, Dm, Em, F, G, Am, Bdim How do I accomplish this?
2013/09/30
[ "https://music.stackexchange.com/questions/12120", "https://music.stackexchange.com", "https://music.stackexchange.com/users/7098/" ]
This comes from walking up the scale and taking triplets of notes which are spaced every other note: CEG, DFA, EGB, ... These are called "triads". ![enter image description here](https://i.stack.imgur.com/XcBP5.png) The majors and minors have a perfect fifth above their root note, for instance the Am chord's A-E inte...
This may have already been answered, but I'll throw in my grain of salt. If you remember, every triad is made up of 3 tones. The root, the third, and the fifth. If you play a C on your piano, then play one third up, and then play a third above that, you have a C major chord, because C-E is an M3. Continue and you get...
18,123
I fitted a new tap and waste outlet to a small basin, because the new outlet is shorter than the old, the plastic pipework no longer reaches (see photo) I can force the parts to mate but I don't like having the pipe under a lot of strain and it doesn't seal properly (I havent tried applying copious amounts of plumbers ...
2012/09/16
[ "https://diy.stackexchange.com/questions/18123", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/2815/" ]
![enter image description here](https://i.stack.imgur.com/ItRqy.jpg) Cut where marked, but adjust the location so you've got clearance to work later. Seeing as you only need a couple of millimeters, you might be able to get away with buying only the coupling connector similar to this: ![enter image description here]...
So far I have discovered there are at least two incompatible types of "32mm" plastic waste pipe. * "**solvent weld**" PVC or ABS pipe with an inside diameter of **32mm** and outside diameter of **~37mm**. * "**push fit**" plastic pipe with an inside diameter of **~29mm** and an outside diameter of **~35mm** Because o...
12,181,910
I'm going to elaborate a file containing some text and email addresses in this way: ``` TEXT\n Cc: mail1,\n mail2,\n mail3\n EMPTY LINE\n TEXT ``` I have to load into a bash variable the Cc list: FOO="mail1, mail2, mail3". How can I do with sed (or other command)?
2012/08/29
[ "https://Stackoverflow.com/questions/12181910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1633717/" ]
I don't think mdominick's answer is correct. Since I only wanted to disable the NSTextFields and NSButtons, I came up with this: ``` for (NSView *item in [self.window.contentView subviews]) { if ([item isKindOfClass:[NSTextField class]] || [item isKindOfClass:[NSButton class]]) { [(id)item setEnabled:N...
You could try something like: ``` [someWindow setAlpha:0.5]; // you can change this number to you visual taste. [someWindow setIgnoresMouseEvents:YES]; ```
12,181,910
I'm going to elaborate a file containing some text and email addresses in this way: ``` TEXT\n Cc: mail1,\n mail2,\n mail3\n EMPTY LINE\n TEXT ``` I have to load into a bash variable the Cc list: FOO="mail1, mail2, mail3". How can I do with sed (or other command)?
2012/08/29
[ "https://Stackoverflow.com/questions/12181910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1633717/" ]
I don't think mdominick's answer is correct. Since I only wanted to disable the NSTextFields and NSButtons, I came up with this: ``` for (NSView *item in [self.window.contentView subviews]) { if ([item isKindOfClass:[NSTextField class]] || [item isKindOfClass:[NSButton class]]) { [(id)item setEnabled:N...
**Since the first answer would still allow keyboard inputs,** I would make it **clean** and **walk trough each UI element in a loop and set it to disabled** in addition to make the window half visible. (Edit: mmackh's answer has the code to do this.) Or you you use the easy way and simply add an invisible `NSView` on ...
12,181,910
I'm going to elaborate a file containing some text and email addresses in this way: ``` TEXT\n Cc: mail1,\n mail2,\n mail3\n EMPTY LINE\n TEXT ``` I have to load into a bash variable the Cc list: FOO="mail1, mail2, mail3". How can I do with sed (or other command)?
2012/08/29
[ "https://Stackoverflow.com/questions/12181910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1633717/" ]
I don't think mdominick's answer is correct. Since I only wanted to disable the NSTextFields and NSButtons, I came up with this: ``` for (NSView *item in [self.window.contentView subviews]) { if ([item isKindOfClass:[NSTextField class]] || [item isKindOfClass:[NSButton class]]) { [(id)item setEnabled:N...
As a different option, one can have a hidden window with NSMakeRect(0,0,10,0) height 0 and write a disableWindow method in the windowController or window subclass that throws a panel with the above hidden window. On opening the panel the screen will be disabled. enableWindow would alternatively orderOut the above state...
137,332
I have encountered a strange problem, which is, the NSolve does not calcualte, but only reproduce what I have typed. Seems there is no typo in the code I input either. I have attached the code below: ``` f1 = 0.7377392112755202079`9.089193376796182 Cos[Subscript[af, 2]] Sin[Subscript[af, 1]] + (-0.6344315700984...
2017/02/08
[ "https://mathematica.stackexchange.com/questions/137332", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/19927/" ]
``` f1 = 0.7377392112755202079`9.089193376796182 Cos[af[2]] Sin[ af[1]] + (-0.6344315700984725494`9.011997365861196 Cos[af[1]] - 0.5218271784972072738`8.772545864993926 Sin[af[1]]) Sin[ af[2]] == -(1/2); f2 = 0.7729790313212816457`9.097780292912853 Cos[af[3]] Sin[ af[2]] + (-0.6025154363599145...
I'd go about it the same was as is shown [here](https://mathematica.stackexchange.com/questions/136090/nsolve-difficulty-to-find-midpoint-hyperbolic-geodesic/136126#136126). Also I change naming to avoid subscripts. The idea is to turn into explicit polynomials in the trigs, add appropriate algebraic relations linking ...
8,231,166
When I connect to pop3.live.com the connection is fine and it also shows me the amount of messages I have and the size of the file but when I try and use "RETR" to get the messages and show them on a console application nothing is presented. Here is what I have so far ``` string str = string.Empty; strin...
2011/11/22
[ "https://Stackoverflow.com/questions/8231166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/998989/" ]
Controller action: ``` public ActionResult Foo() { // Obviously DoSomething could throw but if we start // trying and catching on every single thing that could throw // our controller actions will resemble some horrible plumbing code more // than what they normally should resemble: a.k.a being slim an...
Create an overriden version of HandleErrorAttribute (JsonHandleErrorAttribute ?) and add [JsonHandleError] on your json action. Have a look at AjaxAuthorizeAttribute in [asp.net mvc [handleerror] [authorize] with JsonResult?](https://stackoverflow.com/questions/1609677/asp-net-mvc-handleerror-authorize-with-jsonresult...
17,869
I bought 2 copies of WoW when it launched, and gave one to a friend. He has since lost his CD key, and needs it to recover his account or some such. Unfortunately I didn't make a note of whose key was whose. Is there any way I can determine which of the CD keys was used to activate my account? That way I can give him ...
2011/03/07
[ "https://gaming.stackexchange.com/questions/17869", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/708/" ]
Once a key is used, it is permanently associated with an account, but you won't be able to look it up anywhere: > > **Should I keep my authentication key?** > > > Yes, the authentication key can be > used to verify an account if other > information (such as the Secret > Question Answer) has been forgotten. > Ho...
There is no existing method to discover your CD key. It is not stored in your account settings on Battle.net nor is it able to be extracted from the game files. Your friend should be able to reset his account password or recover his account via Battle.net's [account recovery tools](https://us.battle.net/account/suppor...
17,869
I bought 2 copies of WoW when it launched, and gave one to a friend. He has since lost his CD key, and needs it to recover his account or some such. Unfortunately I didn't make a note of whose key was whose. Is there any way I can determine which of the CD keys was used to activate my account? That way I can give him ...
2011/03/07
[ "https://gaming.stackexchange.com/questions/17869", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/708/" ]
Once a key is used, it is permanently associated with an account, but you won't be able to look it up anywhere: > > **Should I keep my authentication key?** > > > Yes, the authentication key can be > used to verify an account if other > information (such as the Secret > Question Answer) has been forgotten. > Ho...
If you call Blizzard and read them the CD key, they should be able to tell you which one is used on your account. They often use the CD key as a form of verification, so they should be able to help you figure out which is the right one to use. It's not the best answer, but you can't see keys on battle.net, so I think ...
6,996,603
How do I delete a file or folder?
2011/08/09
[ "https://Stackoverflow.com/questions/6996603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854002/" ]
My personal preference is to work with pathlib objects - it offers a more pythonic and less error-prone way to interact with the filesystem, especially if You develop cross-platform code. In that case, You might use pathlib3x - it offers a backport of the latest (at the date of writing this answer Python 3.10.a0) Pyth...
I recommend using `subprocess` if writing a beautiful and readable code is your cup of tea: ``` import subprocess subprocess.Popen("rm -r my_dir", shell=True) ``` And if you are not a software engineer, then maybe consider using Jupyter; you can simply type bash commands: ``` !rm -r my_dir ``` Traditionally, you ...
6,996,603
How do I delete a file or folder?
2011/08/09
[ "https://Stackoverflow.com/questions/6996603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854002/" ]
shutil.rmtree is the asynchronous function, so if you want to check when it complete, you can use while...loop ``` import os import shutil shutil.rmtree(path) while os.path.exists(path): pass print('done') ```
To remove all files in folder ``` import os import glob files = glob.glob(os.path.join('path/to/folder/*')) files = glob.glob(os.path.join('path/to/folder/*.csv')) // It will give all csv files in folder for file in files: os.remove(file) ``` To remove all folders in a directory ``` from shutil import rmtree i...
6,996,603
How do I delete a file or folder?
2011/08/09
[ "https://Stackoverflow.com/questions/6996603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854002/" ]
Deleting a file or folder in Python =================================== **There are multiple ways to Delete a File in Python but the best ways are the following:** 1. **os.remove()** removes a file. 2. **os.unlink()** removes a file. it is a Unix name of remove() method. 3. **shutil.rmtree()** deletes a directory and...
To remove all files in folder ``` import os import glob files = glob.glob(os.path.join('path/to/folder/*')) files = glob.glob(os.path.join('path/to/folder/*.csv')) // It will give all csv files in folder for file in files: os.remove(file) ``` To remove all folders in a directory ``` from shutil import rmtree i...
6,996,603
How do I delete a file or folder?
2011/08/09
[ "https://Stackoverflow.com/questions/6996603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854002/" ]
Use ``` shutil.rmtree(path[, ignore_errors[, onerror]]) ``` (See complete documentation on [shutil](http://docs.python.org/library/shutil.html)) and/or ``` os.remove ``` and ``` os.rmdir ``` (Complete documentation on [os](http://docs.python.org/library/os.html#os.remove).)
I recommend using `subprocess` if writing a beautiful and readable code is your cup of tea: ``` import subprocess subprocess.Popen("rm -r my_dir", shell=True) ``` And if you are not a software engineer, then maybe consider using Jupyter; you can simply type bash commands: ``` !rm -r my_dir ``` Traditionally, you ...
6,996,603
How do I delete a file or folder?
2011/08/09
[ "https://Stackoverflow.com/questions/6996603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854002/" ]
Here is a robust function that uses both `os.remove` and `shutil.rmtree`: ``` def remove(path): """ param <path> could either be relative or absolute. """ if os.path.isfile(path) or os.path.islink(path): os.remove(path) # remove the file elif os.path.isdir(path): shutil.rmtree(path) # rem...
Deleting a file or folder in Python =================================== **There are multiple ways to Delete a File in Python but the best ways are the following:** 1. **os.remove()** removes a file. 2. **os.unlink()** removes a file. it is a Unix name of remove() method. 3. **shutil.rmtree()** deletes a directory and...
6,996,603
How do I delete a file or folder?
2011/08/09
[ "https://Stackoverflow.com/questions/6996603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854002/" ]
shutil.rmtree is the asynchronous function, so if you want to check when it complete, you can use while...loop ``` import os import shutil shutil.rmtree(path) while os.path.exists(path): pass print('done') ```
To avoid the [TOCTOU](http://en.wikipedia.org/wiki/Time_of_check_to_time_of_use) issue highlighted by [Éric Araujo's comment](https://stackoverflow.com/questions/6996603/how-to-delete-a-file-or-folder#comment99147016_42641792), you can catch an exception to call the correct method: ``` def remove_file_or_dir(path: str...
6,996,603
How do I delete a file or folder?
2011/08/09
[ "https://Stackoverflow.com/questions/6996603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854002/" ]
Here is a robust function that uses both `os.remove` and `shutil.rmtree`: ``` def remove(path): """ param <path> could either be relative or absolute. """ if os.path.isfile(path) or os.path.islink(path): os.remove(path) # remove the file elif os.path.isdir(path): shutil.rmtree(path) # rem...
I recommend using `subprocess` if writing a beautiful and readable code is your cup of tea: ``` import subprocess subprocess.Popen("rm -r my_dir", shell=True) ``` And if you are not a software engineer, then maybe consider using Jupyter; you can simply type bash commands: ``` !rm -r my_dir ``` Traditionally, you ...
6,996,603
How do I delete a file or folder?
2011/08/09
[ "https://Stackoverflow.com/questions/6996603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854002/" ]
* [`os.remove()`](http://docs.python.org/library/os.html#os.remove) removes a file. * [`os.rmdir()`](http://docs.python.org/library/os.html#os.rmdir) removes an empty directory. * [`shutil.rmtree()`](http://docs.python.org/library/shutil.html#shutil.rmtree) deletes a directory and all its contents. --- [`Path`](https...
Python syntax to delete a file ------------------------------ ``` import os os.remove("/tmp/<file_name>.txt") ``` Or ``` import os os.unlink("/tmp/<file_name>.txt") ``` Or **[pathlib](https://docs.python.org/3/library/pathlib.html#module-pathlib) Library for Python version >= 3.4** ``` file_to_rem = pathlib.Pat...
6,996,603
How do I delete a file or folder?
2011/08/09
[ "https://Stackoverflow.com/questions/6996603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854002/" ]
To remove all files in folder ``` import os import glob files = glob.glob(os.path.join('path/to/folder/*')) files = glob.glob(os.path.join('path/to/folder/*.csv')) // It will give all csv files in folder for file in files: os.remove(file) ``` To remove all folders in a directory ``` from shutil import rmtree i...
I recommend using `subprocess` if writing a beautiful and readable code is your cup of tea: ``` import subprocess subprocess.Popen("rm -r my_dir", shell=True) ``` And if you are not a software engineer, then maybe consider using Jupyter; you can simply type bash commands: ``` !rm -r my_dir ``` Traditionally, you ...
6,996,603
How do I delete a file or folder?
2011/08/09
[ "https://Stackoverflow.com/questions/6996603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854002/" ]
Deleting a file or folder in Python =================================== **There are multiple ways to Delete a File in Python but the best ways are the following:** 1. **os.remove()** removes a file. 2. **os.unlink()** removes a file. it is a Unix name of remove() method. 3. **shutil.rmtree()** deletes a directory and...
``` import os folder = '/Path/to/yourDir/' fileList = os.listdir(folder) for f in fileList: filePath = folder + '/'+f if os.path.isfile(filePath): os.remove(filePath) elif os.path.isdir(filePath): newFileList = os.listdir(filePath) for f1 in newFileList: insideFilePat...
23,850,119
I am trying to put [MaxMind's GeoIp2](https://github.com/maxmind/GeoIP2-php/tree/master/src/GeoIp2) into my Yii application. Basically, I copied the files under "src" (see previous link) under `protected -> vendors -> maxmind`. The folder structure under my application is the following: ``` protected |---- vendors ...
2014/05/24
[ "https://Stackoverflow.com/questions/23850119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1475898/" ]
You can't put a form in a button, the button must be in the form. You need to write the returned value where you can see it. ``` <form> <button type="button" onclick="this.form.timeField.value=getTimeStamp()">Get time stamp</button> <input type="text" name="timeField" size="11"> </form> ``` Don't give any elemen...
In your code you have some basic errors. This is working example: ``` <html> <head> <script type="text/javascript"> function getTimeStamp() { var now = new Date(); return ((now.getMonth() + 1) + '/' + (now.getDate()) + '/' + now.getFullYear() + " " + now.getHours() + ':' + ((now.get...
61,310,067
I am loading a data into IBM cloud and it has a date and time format that looks like this, 08/28/2004 05:50:56 PM. what would be the correct time format? i have tried given available formats but they do not match. If i need to create one, how do i go about it? Thank you.
2020/04/19
[ "https://Stackoverflow.com/questions/61310067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13356536/" ]
I believe that the Db2 Console for Db2 on Cloud currently uses LOAD statements to get data into Db2. The Db2 Console for Db2 *Warehouse*on Cloud uses both LOAD and EXTERNAL TABLE (for Netezza/PDA sourced data) The timestamp format options for LOAD are less flexible than those available with EXTERNAL TABLE based loads ...
The following works: ``` values to_date('08/28/2004 05:50:56 PM', 'MM/DD/YYYY HH:MI:SS AM') ``` So, try this format.
298,976
I am trying to rename a few directories that contain "Fever" to contain "Malaria" instead. The instruction is to do it without sed or rename. So far, my errors include mostly lines like `mv: cannot stat ‘retest\nretest/Section-01\nretest/Section-02\nretest/Section-03\nretest/Section-04’: No such file or directory`. Th...
2016/07/28
[ "https://unix.stackexchange.com/questions/298976", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/182039/" ]
As Don Crissti mentions, there are a lot of ways of solving this with `find`. But I thought, since we're only talking two directory levels, that we can do this slightly differently with only one external command: `mv` ``` #!/bin/bash fixdir() { local f g for f in Fever* do if [ -e "$f" ] then g=M...
What about: ``` for dir in $(find /startdir -depth -type d -name '*Fever*') do dn=$(basename $dir) mv $dir $(dirname $dir)/${dn//Fever/Malaria} done ``` That should do it. (Change startdir to your start directory) The find will only return directories containing 'Fever'. the mv command uses bash inline subst...
15,133,023
I want to rewrite `http://example.com/articles.html#first-article` with `http://example.com/articles/first-article` Is it possible to rewrite? I tried using following but didn't work for me: ``` RewriteRule ^articles/(.+)$ /articles\.html\#$1 ```
2013/02/28
[ "https://Stackoverflow.com/questions/15133023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2100508/" ]
The `#` can be added in the substitution URL with the NE flag. Check: * [This Apache link](http://httpd.apache.org/docs/2.2/rewrite/advanced.html#redirectanchors) that describes specifically how to `redirect anchors`. * [This W3C Protocols link](http://www.w3.org/Protocols/HTTP/Fragment/draft-bos-http-redirect-00.txt)...
No, it's not possible. The *URL fragment* (everything from `#` on) not even gets sent to the server. Maybe you want to consider a JavaScript based solution, where the actual content will be loaded via AJAX dependent on the fragment. You will find some useful information about this method here: [What's the shebang/hash...
70,874
In my opinion, not so much. I haven't got much experience with the US justice system, but everything the detective learns is hearsay, so (s)he can't tell the jury what witness so-and-so says. (S)he sends everything to the crine lab for testing, but only the scientist can testify about the results. So really, all (s)he ...
2021/08/17
[ "https://law.stackexchange.com/questions/70874", "https://law.stackexchange.com", "https://law.stackexchange.com/users/23774/" ]
> > How useful a lead detective will be as a murder witness in a trial inside of the courtroom? > > > Very useful. *As a murder witness*, the detective's testimony can be more useful than the average witness's because the detective's training renders him capable of paying attention to important elements that to th...
> > ... everything the detective learns is hearsay ... > > > [Hearsay](https://en.wikipedia.org/wiki/Hearsay) doesn't mean what you think it means. Under the Federal Rule of Evidence (which is representative of all common law jurisdictions): "Hearsay is a statement, other than one made by the declarant while test...
35,081
Given to me, by a friend: > > How would you make 20, using two threes? > > > * You may use any basic operation. And others, such as square roots (the symbol), factorials, etc. Any operation is allowed. * Just two threes, though. You can't raise a three to any digit other than three, etc. Any out of the box, non-...
2016/06/06
[ "https://puzzling.stackexchange.com/questions/35081", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/24648/" ]
A little bit silly, but it gets 20 without using any *digits* other than the two '3's > > $\lfloor3+3+\pi+\pi+\pi+e+e\rfloor$ > > >
> > output(++(++(++3))\*(++3)); Consider this as a C expression > > >
35,081
Given to me, by a friend: > > How would you make 20, using two threes? > > > * You may use any basic operation. And others, such as square roots (the symbol), factorials, etc. Any operation is allowed. * Just two threes, though. You can't raise a three to any digit other than three, etc. Any out of the box, non-...
2016/06/06
[ "https://puzzling.stackexchange.com/questions/35081", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/24648/" ]
Does this count? > > $\dbinom{3!}{3} = 20$ > > >
Two threes: [![enter image description here](https://i.stack.imgur.com/9iVy6.png)](https://i.stack.imgur.com/9iVy6.png) > > How would you make 20, using two threes? > > > Solution: > > [![enter image description here](https://i.stack.imgur.com/FRKXm.png)](https://i.stack.imgur.com/FRKXm.png) > > > With ap...
35,081
Given to me, by a friend: > > How would you make 20, using two threes? > > > * You may use any basic operation. And others, such as square roots (the symbol), factorials, etc. Any operation is allowed. * Just two threes, though. You can't raise a three to any digit other than three, etc. Any out of the box, non-...
2016/06/06
[ "https://puzzling.stackexchange.com/questions/35081", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/24648/" ]
> > If we're allowing chopping up the numbers, how about some Roman Numerals [![enter image description here](https://i.stack.imgur.com/N1qCw.png)](https://i.stack.imgur.com/N1qCw.png) > > >
[![enter image description here](https://i.stack.imgur.com/MRAgA.jpg)](https://i.stack.imgur.com/MRAgA.jpg) Very non-mathematical and taking a leaf out of the Car Talk match-stick puzzlers, we can shift around some lines and get a 2 and a 0 from a 3 and a 3.
35,081
Given to me, by a friend: > > How would you make 20, using two threes? > > > * You may use any basic operation. And others, such as square roots (the symbol), factorials, etc. Any operation is allowed. * Just two threes, though. You can't raise a three to any digit other than three, etc. Any out of the box, non-...
2016/06/06
[ "https://puzzling.stackexchange.com/questions/35081", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/24648/" ]
Does this count? > > $\dbinom{3!}{3} = 20$ > > >
[![enter image description here](https://i.stack.imgur.com/MRAgA.jpg)](https://i.stack.imgur.com/MRAgA.jpg) Very non-mathematical and taking a leaf out of the Car Talk match-stick puzzlers, we can shift around some lines and get a 2 and a 0 from a 3 and a 3.
35,081
Given to me, by a friend: > > How would you make 20, using two threes? > > > * You may use any basic operation. And others, such as square roots (the symbol), factorials, etc. Any operation is allowed. * Just two threes, though. You can't raise a three to any digit other than three, etc. Any out of the box, non-...
2016/06/06
[ "https://puzzling.stackexchange.com/questions/35081", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/24648/" ]
Since the OP says "any operation is allowed", I find it convenient to use this one: `3 ʭ 3`, where the operator ʭ is defined as follows: `∀(x∈Z) ∀(y∈Z) x ʭ y = 20`
> > Just buy two \$3 things from ebay. That will be \$20 easy. > > > Not answering within the spirit of this, sorry, but I'm waiting with baited breath as I can't figure out a correct answer.
35,081
Given to me, by a friend: > > How would you make 20, using two threes? > > > * You may use any basic operation. And others, such as square roots (the symbol), factorials, etc. Any operation is allowed. * Just two threes, though. You can't raise a three to any digit other than three, etc. Any out of the box, non-...
2016/06/06
[ "https://puzzling.stackexchange.com/questions/35081", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/24648/" ]
Since the puzzle oddly and specifically mentions the **symbol** for the square root, I used this: > > [![enter image description here](https://i.stack.imgur.com/hYj9q.png)](https://i.stack.imgur.com/hYj9q.png) > > > but rotated and reflected it giving: > > [![enter image description here](https://i.stack.imgu...
> > How would you get 20, using two threes? > > > > Any out of the box, non-mathematical solutions are accepted. > > > How about an “[in the box](http://www.urbandictionary.com/define.php?term=in%20the%20box&defid=6763204)” solution? You'd be lucky to **not** get 20, following the explicit formula publis...
35,081
Given to me, by a friend: > > How would you make 20, using two threes? > > > * You may use any basic operation. And others, such as square roots (the symbol), factorials, etc. Any operation is allowed. * Just two threes, though. You can't raise a three to any digit other than three, etc. Any out of the box, non-...
2016/06/06
[ "https://puzzling.stackexchange.com/questions/35081", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/24648/" ]
Two threes: [![enter image description here](https://i.stack.imgur.com/9iVy6.png)](https://i.stack.imgur.com/9iVy6.png) > > How would you make 20, using two threes? > > > Solution: > > [![enter image description here](https://i.stack.imgur.com/FRKXm.png)](https://i.stack.imgur.com/FRKXm.png) > > > With ap...
[![enter image description here](https://i.stack.imgur.com/MRAgA.jpg)](https://i.stack.imgur.com/MRAgA.jpg) Very non-mathematical and taking a leaf out of the Car Talk match-stick puzzlers, we can shift around some lines and get a 2 and a 0 from a 3 and a 3.
35,081
Given to me, by a friend: > > How would you make 20, using two threes? > > > * You may use any basic operation. And others, such as square roots (the symbol), factorials, etc. Any operation is allowed. * Just two threes, though. You can't raise a three to any digit other than three, etc. Any out of the box, non-...
2016/06/06
[ "https://puzzling.stackexchange.com/questions/35081", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/24648/" ]
If you are allowed to use decimals, then > > $$\frac{3!}{.3} = 20$$ > > >
If we consider the function :$$f(x) = (x-1)\sum\_{i=1}^{x+1}i$$ Then we see that $f(3) = 20$. So in this case we get away with using just one 3, but maybe $-1$ and $+1$ inside the function would be considered cheating. If we must use two threes then function: $$g(x,y) = (x-1)\sum\_{i=1}^{y+1}i$$ then $$g(3,3) = 20$$ A...
35,081
Given to me, by a friend: > > How would you make 20, using two threes? > > > * You may use any basic operation. And others, such as square roots (the symbol), factorials, etc. Any operation is allowed. * Just two threes, though. You can't raise a three to any digit other than three, etc. Any out of the box, non-...
2016/06/06
[ "https://puzzling.stackexchange.com/questions/35081", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/24648/" ]
Another answer could be > > $\lfloor \sqrt{(3!)!}-3! \rfloor$  > > $= \lfloor \sqrt{6!}-3! \rfloor$  > > $= \lfloor \sqrt{720}-6 \rfloor$  > > $= \lfloor 26.8328...-6 \rfloor$  > > $= \lfloor 20.8328... \rfloor$  > > $= 20$ > > >
In C++: ``` #include <cassert> int ConvertThreesToTwenty(const int first_three, const int second_three) { // verify preconditions assert(first_three == second_three && first_three == 3); return 20; } ```
35,081
Given to me, by a friend: > > How would you make 20, using two threes? > > > * You may use any basic operation. And others, such as square roots (the symbol), factorials, etc. Any operation is allowed. * Just two threes, though. You can't raise a three to any digit other than three, etc. Any out of the box, non-...
2016/06/06
[ "https://puzzling.stackexchange.com/questions/35081", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/24648/" ]
Since the puzzle oddly and specifically mentions the **symbol** for the square root, I used this: > > [![enter image description here](https://i.stack.imgur.com/hYj9q.png)](https://i.stack.imgur.com/hYj9q.png) > > > but rotated and reflected it giving: > > [![enter image description here](https://i.stack.imgu...
As you specifically said to think outside the box, I drew a box, and two three's (one Roman numeral and one Arabic numeral) which extend "outside the box". As my answer note that they divide the box into 20 (yellow regions). ![diagram](https://i.stack.imgur.com/gulUn.png) Therefore: Box / two three's = 20
44,614,685
I have recently upgraded to vtiger 7.0.1 . In the previous version, I have a function for the summary view page which sets a different option in a picklist under certain condition. Thew new version arranges almost everything differently. val() property did not help me get picklist value, had to use text().trim() - `jQu...
2017/06/18
[ "https://Stackoverflow.com/questions/44614685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7946810/" ]
Its simple. First get the instance of Field. > > var targetPickList = jQuery('[name="' + fieldname + '"]', container); > > > Now Set the value of Picklist Field and Trigger Update method to set the Picklist value > > var targetPickListSelectedValue = 'Value'; targetPickList.val(targetPickListSelectedValue).tri...
So this worked for us $('[name=FIELDNAME]').val('NEW VALUE').trigger('change');
24,962,162
I have built a Cordova alarm clock app that has a timer. Everything works good except that I now want to inform the user when the clock is up with a visual and audio alarm. I have used the following plugin for local notifications: <https://github.com/katzer/cordova-plugin-local-notifications> This seems to work good ...
2014/07/25
[ "https://Stackoverflow.com/questions/24962162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178457/" ]
This is easily solved using [RxSwift](https://github.com/ReactiveX/RxSwift "RxSwift/RxCocoa") ``` import RxSwift import RxCocoa ... @IBOutlet weak var button:UIButton! ... let taps = button.rx.tap.asDriver() taps.drive(onNext: { // handle tap }) ``` --- **Edit**: I wanted to acknowledge that RxSwift/RxC...
UIButton inherits from UIControl, which handles the receiving of input and forwarding to the selection. According to the docs, the action is "A selector identifying an action message. It cannot be NULL." And a Selector is strictly a pointer to a method. I would think that given the emphases Swift seems to be placing ...
24,962,162
I have built a Cordova alarm clock app that has a timer. Everything works good except that I now want to inform the user when the clock is up with a visual and audio alarm. I have used the following plugin for local notifications: <https://github.com/katzer/cordova-plugin-local-notifications> This seems to work good ...
2014/07/25
[ "https://Stackoverflow.com/questions/24962162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178457/" ]
The general approach for anything you think should be in the libraries but isn't: Write a category. There's lots of this particular one on GitHub but didn't find one in Swift so I wrote my own: === Put this in its own file, like UIButton+Block.swift === ``` import ObjectiveC var ActionBlockKey: UInt8 = 0 // a type ...
UIButton inherits from UIControl, which handles the receiving of input and forwarding to the selection. According to the docs, the action is "A selector identifying an action message. It cannot be NULL." And a Selector is strictly a pointer to a method. I would think that given the emphases Swift seems to be placing ...
24,962,162
I have built a Cordova alarm clock app that has a timer. Everything works good except that I now want to inform the user when the clock is up with a visual and audio alarm. I have used the following plugin for local notifications: <https://github.com/katzer/cordova-plugin-local-notifications> This seems to work good ...
2014/07/25
[ "https://Stackoverflow.com/questions/24962162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178457/" ]
The general approach for anything you think should be in the libraries but isn't: Write a category. There's lots of this particular one on GitHub but didn't find one in Swift so I wrote my own: === Put this in its own file, like UIButton+Block.swift === ``` import ObjectiveC var ActionBlockKey: UInt8 = 0 // a type ...
According to [n13's solution](https://stackoverflow.com/a/33461778/1151665), I made a swift3 version. Hopes it could help some people like me. ``` import Foundation import UIKit import ObjectiveC var ActionBlockKey: UInt8 = 0 // a type for our action block closure typealias BlockButtonActionBlock = (_ sender: UIBut...
24,962,162
I have built a Cordova alarm clock app that has a timer. Everything works good except that I now want to inform the user when the clock is up with a visual and audio alarm. I have used the following plugin for local notifications: <https://github.com/katzer/cordova-plugin-local-notifications> This seems to work good ...
2014/07/25
[ "https://Stackoverflow.com/questions/24962162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178457/" ]
According to [n13's solution](https://stackoverflow.com/a/33461778/1151665), I made a swift3 version. Hopes it could help some people like me. ``` import Foundation import UIKit import ObjectiveC var ActionBlockKey: UInt8 = 0 // a type for our action block closure typealias BlockButtonActionBlock = (_ sender: UIBut...
You can approach this with a proxy class that routes events through the target / action (selector) mechanism to a closure of your making. I have done this for gesture recognizers, but the same pattern should hold for controls. You could do something like this: ``` import UIKit @objc class ClosureDispatch { init(...
24,962,162
I have built a Cordova alarm clock app that has a timer. Everything works good except that I now want to inform the user when the clock is up with a visual and audio alarm. I have used the following plugin for local notifications: <https://github.com/katzer/cordova-plugin-local-notifications> This seems to work good ...
2014/07/25
[ "https://Stackoverflow.com/questions/24962162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178457/" ]
UIButton inherits from UIControl, which handles the receiving of input and forwarding to the selection. According to the docs, the action is "A selector identifying an action message. It cannot be NULL." And a Selector is strictly a pointer to a method. I would think that given the emphases Swift seems to be placing ...
The associatedObject and wrapping and pointers and import of ObjectiveC are unnecessary, at least in Swift 3. This works great and is much more Swift-y. Feel free to throw a typealias in there for `() -> ()` if you find it more readable, bit I find it easier to read the block signature directly. ``` import UIKit clas...
24,962,162
I have built a Cordova alarm clock app that has a timer. Everything works good except that I now want to inform the user when the clock is up with a visual and audio alarm. I have used the following plugin for local notifications: <https://github.com/katzer/cordova-plugin-local-notifications> This seems to work good ...
2014/07/25
[ "https://Stackoverflow.com/questions/24962162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178457/" ]
The general approach for anything you think should be in the libraries but isn't: Write a category. There's lots of this particular one on GitHub but didn't find one in Swift so I wrote my own: === Put this in its own file, like UIButton+Block.swift === ``` import ObjectiveC var ActionBlockKey: UInt8 = 0 // a type ...
This is not necessarily a "hooking," but you can effectively achieve this behavior by subclassing UIButton: ``` class ActionButton: UIButton { var touchDown: ((button: UIButton) -> ())? var touchExit: ((button: UIButton) -> ())? var touchUp: ((button: UIButton) -> ())? required init?(coder aDecoder: N...
24,962,162
I have built a Cordova alarm clock app that has a timer. Everything works good except that I now want to inform the user when the clock is up with a visual and audio alarm. I have used the following plugin for local notifications: <https://github.com/katzer/cordova-plugin-local-notifications> This seems to work good ...
2014/07/25
[ "https://Stackoverflow.com/questions/24962162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178457/" ]
This is not necessarily a "hooking," but you can effectively achieve this behavior by subclassing UIButton: ``` class ActionButton: UIButton { var touchDown: ((button: UIButton) -> ())? var touchExit: ((button: UIButton) -> ())? var touchUp: ((button: UIButton) -> ())? required init?(coder aDecoder: N...
You can approach this with a proxy class that routes events through the target / action (selector) mechanism to a closure of your making. I have done this for gesture recognizers, but the same pattern should hold for controls. You could do something like this: ``` import UIKit @objc class ClosureDispatch { init(...
24,962,162
I have built a Cordova alarm clock app that has a timer. Everything works good except that I now want to inform the user when the clock is up with a visual and audio alarm. I have used the following plugin for local notifications: <https://github.com/katzer/cordova-plugin-local-notifications> This seems to work good ...
2014/07/25
[ "https://Stackoverflow.com/questions/24962162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178457/" ]
According to [n13's solution](https://stackoverflow.com/a/33461778/1151665), I made a swift3 version. Hopes it could help some people like me. ``` import Foundation import UIKit import ObjectiveC var ActionBlockKey: UInt8 = 0 // a type for our action block closure typealias BlockButtonActionBlock = (_ sender: UIBut...
UIButton inherits from UIControl, which handles the receiving of input and forwarding to the selection. According to the docs, the action is "A selector identifying an action message. It cannot be NULL." And a Selector is strictly a pointer to a method. I would think that given the emphases Swift seems to be placing ...
24,962,162
I have built a Cordova alarm clock app that has a timer. Everything works good except that I now want to inform the user when the clock is up with a visual and audio alarm. I have used the following plugin for local notifications: <https://github.com/katzer/cordova-plugin-local-notifications> This seems to work good ...
2014/07/25
[ "https://Stackoverflow.com/questions/24962162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178457/" ]
You can replace target-action with a closure by adding a helper closure wrapper (ClosureSleeve) and adding it as an associated object to the control so it gets retained. This is a similar solution to the one in **n13**'s answer. But I find it simpler and more elegant. The closure is invoked more directly and the wrapp...
This is not necessarily a "hooking," but you can effectively achieve this behavior by subclassing UIButton: ``` class ActionButton: UIButton { var touchDown: ((button: UIButton) -> ())? var touchExit: ((button: UIButton) -> ())? var touchUp: ((button: UIButton) -> ())? required init?(coder aDecoder: N...
24,962,162
I have built a Cordova alarm clock app that has a timer. Everything works good except that I now want to inform the user when the clock is up with a visual and audio alarm. I have used the following plugin for local notifications: <https://github.com/katzer/cordova-plugin-local-notifications> This seems to work good ...
2014/07/25
[ "https://Stackoverflow.com/questions/24962162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178457/" ]
This is not necessarily a "hooking," but you can effectively achieve this behavior by subclassing UIButton: ``` class ActionButton: UIButton { var touchDown: ((button: UIButton) -> ())? var touchExit: ((button: UIButton) -> ())? var touchUp: ((button: UIButton) -> ())? required init?(coder aDecoder: N...
The associatedObject and wrapping and pointers and import of ObjectiveC are unnecessary, at least in Swift 3. This works great and is much more Swift-y. Feel free to throw a typealias in there for `() -> ()` if you find it more readable, bit I find it easier to read the block signature directly. ``` import UIKit clas...
59,109,686
I would like to use http4k to stream a long response. I plan to use `Content-type: multipart/x-mixed-replace` so I push data to the client quite endlessly. In http4k, we have `typealias HttpHandler = (Request) -> Response`. But my handler cannot return a response because it is not a limited document that I want to retu...
2019/11/29
[ "https://Stackoverflow.com/questions/59109686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161012/" ]
If you're pulling from another HTTP source, you can use the streaming body mode on one of the various HTTP client modules (Apache/OkHttp/Jetty will work). Alternatively if you're generating the content yourself or streaming from a database, you'll have to start a Thread and handle it that way. There's an example of ho...
Could be that websocket is what you need? <https://www.http4k.org/blog/typesafe_websockets/> So you can have an endless stream of event (e.g you need to push a feed).
45,672,649
Qt has a layout system kind of separate from the widgets, which is causing me problems. I know that when I have a QSplitter, I can add stuff to it just by doing ``` new SomeCustomQWidget(splitter); ``` However, if I have a QWidget, shouldn't I be able to do something similar? The Qt web pages only explain how to add...
2017/08/14
[ "https://Stackoverflow.com/questions/45672649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3034914/" ]
``` QWidget *parent = new QWidget(); QVBoxLayout *rootLayout = new QVBoxLayout(parent); QHBoxLayout *subLayout1 = new QHBoxLayout(); QHBoxLayout *subLayout2 = new QHBoxLayout(); rootLayout->addLayout(subLayout1); rootLayout->addLayout(subLayout2); subLayout1->addWidget(new QLabel("Foo")); subLayout1->addWidget(new QLa...
I think you're confusing parent/child relationship with managing layout. Lets start with layouts. When set on a widget the layout becomes a child of that widget. When constructed with a widget parent the widget becomes a parent and the layout is set on the widget. When adding widgets to layout they become children of ...
48,322,397
I'm trying to login as root on a remote linux machine using [mscdex/ssh2](https://github.com/mscdex/ssh2), the steps I'm trying to achieve are : 1. connect via ssh to the remot machine 2. execute command as root user but I'm failing in the second part, I can't get to put the password right, here is my code. ``` co...
2018/01/18
[ "https://Stackoverflow.com/questions/48322397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2743774/" ]
Using triggers across a linked server is a terrible idea. There are so many things that can go wrong with the process, in addition to the deadlocks. Most likely, the transaction for the insert into Table A is being held longer due to latency for the insert into ServerB.TableB. If that linked server connection is slow ...
I totally agree with the opinion of Wes H, but I don't like the idea of having a high frequency ETL. If inserts happen once a day, you will waste lots of resources. According to you script, you are replicating an entire table on the other server, so why don't you actually use replication? Otherwise, this seems a sce...
17,032,434
I have the following syntax: ``` echo "<img src=\"images2/" . $row['image'] . "\" alt=\"\" /><br />"; } ``` I would like to a give a specific height and width for the image, but I can't to do it.
2013/06/10
[ "https://Stackoverflow.com/questions/17032434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2352777/" ]
You can specify dimensions directly in your HTML `<img>` tag: ``` echo "<img src=\"images2/\" . $row['image'] . "\" alt=\"\" height=\"100\" width=\"100\" /><br />"; ``` Note that your posted code has a closing curly brace (`}`) following your `echo` statement, which will cause a PHP error if there's no correspondin...
This should work ``` echo '<img src="images2"'.$row['image'].'\ alt="" width="" height="" /><br />'; } ```
244,822
When I type any word ending with an 'l' (ell, like "local") and then press the `/` key, the 'l' is replaced with another symbol and the slash, '/', is omitted. How can I deactivate that function? [![enter image description here](https://i.stack.imgur.com/lBxkj.gif)](https://i.stack.imgur.com/lBxkj.gif)
2016/07/05
[ "https://apple.stackexchange.com/questions/244822", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/190873/" ]
This looks like the behavior of some very old Mac fonts (Palatino was one of them) where you could make the character l with stroke (used in Polish and elsewhere) by typing such a sequence. Try changing your font. If this is in fact the cause of the problem, you should get rid of the font that does this, which should n...
This looks to me like a rendering bug rather than a feature. I would try increasing the font size on your terminal.
244,822
When I type any word ending with an 'l' (ell, like "local") and then press the `/` key, the 'l' is replaced with another symbol and the slash, '/', is omitted. How can I deactivate that function? [![enter image description here](https://i.stack.imgur.com/lBxkj.gif)](https://i.stack.imgur.com/lBxkj.gif)
2016/07/05
[ "https://apple.stackexchange.com/questions/244822", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/190873/" ]
Seeing that you use white on black, I take it you use the "Pro" profile (unless you duplicated it or created a fresh new one). I would look into Terminal's preferences and check the used encoding and other options. If there are differences with, let's say the "Basic" profile, try to see if using that profile is behavi...
This looks to me like a rendering bug rather than a feature. I would try increasing the font size on your terminal.
244,822
When I type any word ending with an 'l' (ell, like "local") and then press the `/` key, the 'l' is replaced with another symbol and the slash, '/', is omitted. How can I deactivate that function? [![enter image description here](https://i.stack.imgur.com/lBxkj.gif)](https://i.stack.imgur.com/lBxkj.gif)
2016/07/05
[ "https://apple.stackexchange.com/questions/244822", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/190873/" ]
I had this same problem because I had an old Monaco font in ~/Library/Fonts/. I was able to disable the old font with FontBook, and the issue was resolved. Note that I had the same issue with a number of leftover old fonts. I was able to clean them all out in FontBook with "Look for enabled duplicates..."
This looks to me like a rendering bug rather than a feature. I would try increasing the font size on your terminal.
244,822
When I type any word ending with an 'l' (ell, like "local") and then press the `/` key, the 'l' is replaced with another symbol and the slash, '/', is omitted. How can I deactivate that function? [![enter image description here](https://i.stack.imgur.com/lBxkj.gif)](https://i.stack.imgur.com/lBxkj.gif)
2016/07/05
[ "https://apple.stackexchange.com/questions/244822", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/190873/" ]
This looks like the behavior of some very old Mac fonts (Palatino was one of them) where you could make the character l with stroke (used in Polish and elsewhere) by typing such a sequence. Try changing your font. If this is in fact the cause of the problem, you should get rid of the font that does this, which should n...
Seeing that you use white on black, I take it you use the "Pro" profile (unless you duplicated it or created a fresh new one). I would look into Terminal's preferences and check the used encoding and other options. If there are differences with, let's say the "Basic" profile, try to see if using that profile is behavi...
244,822
When I type any word ending with an 'l' (ell, like "local") and then press the `/` key, the 'l' is replaced with another symbol and the slash, '/', is omitted. How can I deactivate that function? [![enter image description here](https://i.stack.imgur.com/lBxkj.gif)](https://i.stack.imgur.com/lBxkj.gif)
2016/07/05
[ "https://apple.stackexchange.com/questions/244822", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/190873/" ]
This looks like the behavior of some very old Mac fonts (Palatino was one of them) where you could make the character l with stroke (used in Polish and elsewhere) by typing such a sequence. Try changing your font. If this is in fact the cause of the problem, you should get rid of the font that does this, which should n...
I had this same problem because I had an old Monaco font in ~/Library/Fonts/. I was able to disable the old font with FontBook, and the issue was resolved. Note that I had the same issue with a number of leftover old fonts. I was able to clean them all out in FontBook with "Look for enabled duplicates..."
26,124,848
I have a job setup to email when the disk space falls below 20 %. Right now everything works great except when it comes to the results in the email. I have tried changing the query\_result\_width to every possible variation. I want to send it in plain text as some of the higher-ups that get the email for some reason on...
2014/09/30
[ "https://Stackoverflow.com/questions/26124848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1860451/" ]
Why don't you just add it as an attachment rather than as text in the email. The size would still be relativly small and it would give a much better appearance which also solves your alignment issue. Something like this.... ``` DECLARE @tab char(1) = CHAR(9) execute msdb.dbo.sp_send_dbmail @profile_name = 'Profil...
DECLARE @NewLineChar AS CHAR(2) = CHAR(13) + CHAR(10) apply it(its mostly try and error)
51,561,678
I want to remove the default autocomplete from all input fields of my web application using CSS only. I will put that CSS in the header of my web application to get the effect of that css on all web pages. I can't put `autocomplete=off` in all input fields individually. as there are more than 200 input in the applicati...
2018/07/27
[ "https://Stackoverflow.com/questions/51561678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7982022/" ]
It is not possible since `autocomplete=off` is not a css attribute, but a html5 one. Maybe you want to do it with js by setting element's `attr`, or just find and replace those 200 entries once and for all. More info on `autocomplete=off` [can be found in MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element...
It's not possible in CSS. You can achieve it by using JS.
6,787,551
I am a XSLT newbie and have a simple task: Suppose I have the following XML: > > > ``` > <Element1> > <Element2 attr1="1"/> > </Element1> > <Element1 attr1="2"/> > <Element1> > <Element2 attr1="2"/> > </Element1> > > ``` > > I want to transform the XML to the same XML with one change: All attributes nam...
2011/07/22
[ "https://Stackoverflow.com/questions/6787551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/857556/" ]
You can define characters to replace and replacing chars, then use `translate`. You can use this XSLT: ``` <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="xml" indent="yes"/> <xsl:variable name="in">12</xsl:variable> <xsl:variable name="out">AX</xsl:var...
Another way, using `document` function: ``` <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:l="local" > <xsl:output method="xml" indent="yes"/> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy>...
6,787,551
I am a XSLT newbie and have a simple task: Suppose I have the following XML: > > > ``` > <Element1> > <Element2 attr1="1"/> > </Element1> > <Element1 attr1="2"/> > <Element1> > <Element2 attr1="2"/> > </Element1> > > ``` > > I want to transform the XML to the same XML with one change: All attributes nam...
2011/07/22
[ "https://Stackoverflow.com/questions/6787551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/857556/" ]
You can define characters to replace and replacing chars, then use `translate`. You can use this XSLT: ``` <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="xml" indent="yes"/> <xsl:variable name="in">12</xsl:variable> <xsl:variable name="out">AX</xsl:var...
xslt 2 version below works: ``` <xsl:output method="xml" indent="yes"/> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> <xsl:template match="@attr1[.='1']"> <xsl:attribute name="attr1"> ...
6,787,551
I am a XSLT newbie and have a simple task: Suppose I have the following XML: > > > ``` > <Element1> > <Element2 attr1="1"/> > </Element1> > <Element1 attr1="2"/> > <Element1> > <Element2 attr1="2"/> > </Element1> > > ``` > > I want to transform the XML to the same XML with one change: All attributes nam...
2011/07/22
[ "https://Stackoverflow.com/questions/6787551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/857556/" ]
You didn't say what happens when @attr=3 for example so there is an otherwise clause to just copy the value if it is not one of the selected. ``` <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> ...
Another way, using `document` function: ``` <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:l="local" > <xsl:output method="xml" indent="yes"/> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy>...
6,787,551
I am a XSLT newbie and have a simple task: Suppose I have the following XML: > > > ``` > <Element1> > <Element2 attr1="1"/> > </Element1> > <Element1 attr1="2"/> > <Element1> > <Element2 attr1="2"/> > </Element1> > > ``` > > I want to transform the XML to the same XML with one change: All attributes nam...
2011/07/22
[ "https://Stackoverflow.com/questions/6787551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/857556/" ]
You didn't say what happens when @attr=3 for example so there is an otherwise clause to just copy the value if it is not one of the selected. ``` <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> ...
xslt 2 version below works: ``` <xsl:output method="xml" indent="yes"/> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> <xsl:template match="@attr1[.='1']"> <xsl:attribute name="attr1"> ...
6,787,551
I am a XSLT newbie and have a simple task: Suppose I have the following XML: > > > ``` > <Element1> > <Element2 attr1="1"/> > </Element1> > <Element1 attr1="2"/> > <Element1> > <Element2 attr1="2"/> > </Element1> > > ``` > > I want to transform the XML to the same XML with one change: All attributes nam...
2011/07/22
[ "https://Stackoverflow.com/questions/6787551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/857556/" ]
Another way, using `document` function: ``` <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:l="local" > <xsl:output method="xml" indent="yes"/> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy>...
xslt 2 version below works: ``` <xsl:output method="xml" indent="yes"/> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> <xsl:template match="@attr1[.='1']"> <xsl:attribute name="attr1"> ...
305,245
I have a device I designed which utilizes 32 SK6812 LEDs (RGBW neopixels). I am experiencing noise in the 1.2khz range (SK6812 LEDs use a 1.2khz PWM signal to control color and brightness) and its associated harmonic frequencies. This noise is most apparent in the 5v line on my device (the SK6812 LEDs are powered on ...
2017/05/14
[ "https://electronics.stackexchange.com/questions/305245", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/149106/" ]
That is the nature of these neopixel devices. They have no output inductance or capacitance on the PWM switching. They generate a lot of EMI. With a PWM frequency of 1.2Khz, the 1.2khz noise you are experiencing is expected. It would be best if the 5.5 switcher, 5v LDO, and LEDs had their own ground plane. F...
No that won't help your noise is broadband with harmonics of 20Hz with some phase noise around 1.2kHz . **Any clues why?** [![enter image description here](https://i.stack.imgur.com/36gXR.jpg)](https://i.stack.imgur.com/36gXR.jpg) The problem appears to be **load regulation noise ,** which does not follow the SMPS l...
23,819,440
I have a situation where the Angular $routeProvider appears to not fire controller actions on route changes. The routes are super simple urls: ``` window.app = angular.module('app', ['ngRoute', 'app.filters', 'app.services', 'app.directives', 'app.controllers']) .config([ '$routeProvider', function($route...
2014/05/23
[ "https://Stackoverflow.com/questions/23819440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11197/" ]
Well you are returning an anonymous type correctly. BUT, you need add `JsonRequestBehavior.AllowGet` e.g. ``` public ActionResult ExportQuote(string projectNumber) { //more code here... return Json(new { quoteFileName = _quoteFileName, itemsNotSupportedWarning = _itemsNotSupported...
Is that a typo there ?? ``` date["itemsNotSupportedWarning"] ``` instead of data you are typing date
32,336,160
I am having trouble with the display print of the Employee and Executive class it is giving a weird output that is giving me issues resolving. \*\*\*\*\* I have updated the code to correctly working code.....Thanks ``` public class Employee { private String name; private int salary; public Employee(String nam, int...
2015/09/01
[ "https://Stackoverflow.com/questions/32336160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4956567/" ]
``` String tostring() ``` should be ``` @Override public String toString() ``` Java method names are case-sensitive. Also, you cannot reduce the visibility of a method you plan to override. (toString needs to be public, you made it the default package protected). Also, you should include an `@Override` annotati...
``` @override public String toString() { ... ``` You have the error in your signature of method. Use the `@override` annotation to ensure the overriding method, in which you can help the compiler.
133,563
So I'm just trying to create a simple script in C# which will allow me to switch between two cameras, named Camera1 and Camera2. But I have run into the error UnityEngine.Camera doesn't contain definition for "active". Which I can't seem to figure out at all. I would really appreciate any help I can get so that I can k...
2016/11/26
[ "https://gamedev.stackexchange.com/questions/133563", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/52484/" ]
Check the current active camera by comparing the gameobject ``` using UnityEngine; public class CameraSwitching : MonoBehaviour { public GameObject camera1, camera2; public void SwitchCamera() { if (Camera.current.gameObject == camera1) { camera1.SetActive (false); camera2.Se...
Try accessing it like this ``` Camera2.camera.gameObject.SetActive(true); Camera1.camera.gameObject.SetActive(false); ``` *note*: if you are using Unity 5, directly accessing `active` is deprecated and you should use `SetActive(bool b)` instead.
68,587,735
A python function is created in GCP function to modify the metadata of objects in storage. An error is displayed during deployment,The error message is as follows: ``` Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the...
2021/07/30
[ "https://Stackoverflow.com/questions/68587735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12111390/" ]
Based on the error message you mentioned, the issue is caused by your runtime not having a Cloud Storage module in it. In addition to Guillaume's answer, you need to install that dependency during function deployment. You can do so by adding google-cloud-storage to your requirements.txt file. For example: ``` google-...
Your function signature is wrong. You need to [comply with the platform definition](https://cloud.google.com/functions/docs/quickstart-python) You will have the data that you need in the function parameters.
939,072
I'm new to docker and ECS, so I might not use the right terms. Please let me know if I need to clarify. **My Scenario:** I have a number of independent containers. Each container represents a web site. Each container should run all the time, but might see long periods of inactivity (e.g. zero CPU usage). For illustrat...
2018/11/08
[ "https://serverfault.com/questions/939072", "https://serverfault.com", "https://serverfault.com/users/195547/" ]
That's correct, Fargate is more expensive than EC2 for the same vCPU/RAM amount. For example: * The **[smallest Fargate container](https://aws.amazon.com/fargate/pricing/)** with 0.25 vCPU and 0.5 GB RAM costs $0.019/hr, that's ca **$14/month per container**. * If you need 1 vCPU then the minimum amount of RAM is 2GB...
You can also use EKS (Elastic Kubernetes Service) instead of ECS. Kubernetes give some more control over the pods, services, volumes and such. However not sure if it's cheaper than ECS, maybe not.