qid int64 10 74.7M | question stringlengths 15 26.2k | date stringlengths 10 10 | metadata list | response_j stringlengths 27 28.1k | response_k stringlengths 23 26.8k |
|---|---|---|---|---|---|
57,810,418 | I'm creating a dataframe out of a string data, the header of which have duplicate columns. Because of pandas default check to auto-rename in case of duplicate columns, it adds '.1, .2, and so on' suffix to each duplicate.
```py
formatted_data = "a|b|c|a\n1|xyz|3|4"
final_data = StringIO(formatted_data)
df = pd.read_... | 2019/09/05 | [
"https://Stackoverflow.com/questions/57810418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8551891/"
] | ```
create table mytab(p_id number, p_code varchar2(10), comm varchar2(10), mdate date);
insert into mytab values(112, 'WXCVA', null, to_date('20190202','yyyymmdd'));
insert into mytab values(112, 'UCXVA', 'WXCVA', to_date('20190909','yyyymmdd'));
insert into mytab values(222, 'DCVA', null, to_date('20180808','yyyymmd... | Is this what you want?
```
update tab
set mdate = (select t2.mdate
from tab t2
where t2.p_code = tab.comm
)
where tab.comm is not null;
``` |
7,366,817 | I need to add some validation that will only allow one capital letter in a string that may include spaces. The capital letter can be anywhere in the string, but can only be used once or not at all.
I was going to incorporate the solution below as a separate rule, but I have this bit of validation and wondering if I ca... | 2011/09/09 | [
"https://Stackoverflow.com/questions/7366817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335514/"
] | ```
"this is A way to do it with regex".match(/^[^A-Z]*[A-Z]?[^A-Z]*$/)
```
Regex breaks down like this...
start of string (`^`) followed by not capital letter (`[^A-Z]`) zero or more times (`*`) follow by optional (`?`) capital letter (`[A-Z]`) followed by not capital letter (`[^A-Z]`) zero or more times (`*`) foll... | Could you loop through each character to check if it is equal to ascii code 65 through 94?
```
var CharArr = "mystring".toCharArray();
var countCapsChars = 0;
for(var i =0;i<= CharArr.length;i++) {
if (CharArr[i].CharCodeAt(0) >= 65 && CharArr[i].CharCodeAt(0) <=94) {
countCapsChars++;
}
if (countCapsChars == 1 ||... |
34,619,135 | I'm using this code to customize UIButtons on my main ViewController and have placed it in it's own separate .swift file to be referenced wherever a UIButton exists. I want to be able to modify the properties of the MyCustomButton from within my main ViewController after a button is pressed.
For example, I press a butt... | 2016/01/05 | [
"https://Stackoverflow.com/questions/34619135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3912266/"
] | Consider this code,
```
String str1 = "ABC";
String str2 = new String("ABC");
System.out.println(str1==str2); // false
System.out.println(str1.equals(str2)); //true
```
The reason for this is that when you write `String str1="ABC"` this string is kept in **string pool** and `String str2 = new String("ABC")` creates ... | Strings are immutable in nature. So, when we do this,
```
String a1 = "a";
String a2 = "a";
```
Actually in memory, only one instance of String "a" is created. Both a1 and a2 will point to the same instance.
That's why, `a1 == a2` and `a1.equals(a2)` are both true.
But, in this,
```
String a1 = "a";
String a2 = n... |
26,759,069 | I have an angular service that wraps my rest api calls and returns a $http promise.
My question is how do I throw an error so that a promise that triggers the .error method gets called? I don't want to just throw error since I want it to use the .success/.error in the calling function rather than doing a try catch blo... | 2014/11/05 | [
"https://Stackoverflow.com/questions/26759069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/611750/"
] | First inject the $q-service in your service. Then in your else:
```
else {
var deferred = $q.defer();
deferred.reject("reject reason, foo was false");
return deferred.promise;
}
```
Not as clever as Blazemonger's, but its quick to do. | You can raise or throw a custom error using `throw new Error ("custom error")`.
For http:
```
http.get('url').toPromise().then (result =>{
throw new Error ("My Custom Error") // New Custom error New is optional w
}).catch(err => {
throw err
}); // catch will catch any error occur while http call
``` |
19,509,725 | I have an object like
```
{ a: 2.078467321618,
b :13521.4,
c : 4503.9,
more...}
```
(In debug mode)
I want to loop through the object and separate key and value;
How can I achieve this? | 2013/10/22 | [
"https://Stackoverflow.com/questions/19509725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1770457/"
] | ```
Object.keys(obj).forEach(function(key) {
var val = obj[key];
...
});
``` | ```
Try the following:
for(var key in object){
var value = object[key];
//now you have access to "key" and "value"
}
``` |
6,144,166 | So I am writing a little utility to format my inventory file is such a manner that I can import it to a preexisting db. I am having a large issue trying to just do fscanf. I have read tons of file in c in the past. What am I doing wrong here.
Edit based on Christopher's suggestion still getting NULL.
```
#include <st... | 2011/05/26 | [
"https://Stackoverflow.com/questions/6144166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/673191/"
] | ```
if (stream = NULL)
{
return 0;
}
```
should be
```
if (stream == NULL)
{
return 0;
}
``` | Backslash is escape character inside strings. Use forward slash in your pathnames.
"c:/foo/bar.txt" |
202,772 | How does this website need to change in order to discourage the endless 'I'm a newbie help me out, here's my homework'?
Also, how do we discourage people from 'here's the solution, give me some points now' kind of answers?
EDIT - context: <https://stackoverflow.com/questions/19555424/simple-nested-loop-program/195554... | 2013/10/24 | [
"https://meta.stackexchange.com/questions/202772",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/237711/"
] | >
> Why do people not do their own homework?
>
>
>
1. They're lazy or they aren't interested in learning
2. Their behavior is almost always reinforced by *copy/paste* answers
>
> How do we discourage people from answering?
>
>
>
That seems almost impossible.
I think we should try to discourage copy/paste an... | If your question is on topic for the site, well written (for your definition of "well"), and answerable, *and* I am inclined to do so, **I will answer the question, regardless of if it's a homework question or not.**
Discouraging users from asking these questions, as tempting as it may be, isn't entirely in the spirit... |
11,278,308 | I stumbled upon <https://codereview.stackexchange.com/questions/10610/refactoring-javascript-into-pure-functions-to-make-code-more-readable-and-mainta> and I don't understand the answer since the user uses an @ symbol in a way I've never seen before. What does it do when attached to the if keyword? Can you attach it to... | 2012/06/30 | [
"https://Stackoverflow.com/questions/11278308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1493605/"
] | It's not a JavaScript thing. It's a symbol used by whatever templating system that answer was referring to. Note that the `<script>` element has type `text/html`, which will prevent browsers from paying any attention to its contents.
Some other JavaScript code will find that script and fetch its `innerHTML` in order t... | @: syntax in Razor
Said by @StriplingWarrior at [Using Razor within JavaScript](https://stackoverflow.com/questions/4599169/using-razor-within-javascript)
It is razor code, not javascript, if you are interested in razor check:
<http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx> |
37,624,903 | Since I am creating a dataframe, I don't understand why I am getting an array error.
```
M2 = df.groupby(['song_id', 'user_id']).rating.mean().unstack()
M2 = np.maximum(-1, (M - 3).fillna(0) / 2.) # scale to -1..+1 (treat "0" scores as "1" scores)
M2.head(2)
AttributeError: 'numpy.ndarray' object has no attribute ... | 2016/06/03 | [
"https://Stackoverflow.com/questions/37624903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5187157/"
] | `(M - 3)` is getting interpreted as a `numpy.ndarray`. This implies that `M` is defined somewhere as a `numpy.ndarray`. Test it out by running:
```
print type(M)
``` | You are calling the `.fillna()` method on a numpy array. And `numpy` arrays don't have that method defined.
You can probably convert the `numpy` array to a `pandas.DataFrame` and then apply the `.fillna()` method. |
25,907,478 | somehow I am struggling with finding out whether it is possible to define an imported library in CMake, specifying target properties (include\_directories and library path) and hoping that CMake will append the include directories once I add that project to target\_link\_libraries in another project.
Let's say I have ... | 2014/09/18 | [
"https://Stackoverflow.com/questions/25907478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/260493/"
] | The difference between the `INCLUDE_DIRECTORIES` property and the `INTERFACE_INCLUDE_DIRECTORIES` property is transitivity.
Set `INTERFACE_INCLUDE_DIRECTORIES` instead.
<http://www.cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#transitive-usage-requirements> | Starting from CMake 3.11, it's possible to use [target\_include\_directories()](https://cmake.org/cmake/help/latest/command/target_include_directories.html) with IMPORTED targets.
```
add_library(mymodule SHARED IMPORTED)
target_include_directories(mymodule INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DI... |
618,643 | >
> Given $\varphi: \mathbb{Z} \to \mathbb{Z}\_{10}$ such that $\varphi(1)=6$, compute $\ker(\varphi)$ and $\varphi(19)$.
>
>
>
In my attempt I found that since $\varphi(1)=6$ has order 5, then $\ker(\varphi)= \{5 \mathbb{Z} \}$ and since the function is homomorphism I got $\varphi(19)=4$. Am I right? Thanks. | 2013/12/26 | [
"https://math.stackexchange.com/questions/618643",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/117722/"
] | You are right to conclude from $\phi(5)=20+10\mathbb Z=0+10\mathbb Z$ that $5\mathbb Z= \ker \phi$ (or first only "$\subseteq$", but there is no subgroup properly between $5\mathbb Z$ and $\mathbb Z$). But note that you "spelled" this statement wrong (no $\{\}$ here). But from $19\cdot 4=76=7\cdot 10+6$ you should obta... | @nzobo, you are absolutely correct. Im($\phi$) has order $5$ and so Ker($\phi$)=$5\mathbb{Z}$. Your second conclusion follows from $19=15+4$ so that $\phi(19)=\phi(15)+\phi(4)=\phi(4)=(6\times 4) ~mod ~ 10=4$
(This should be a comment but I can't comment.) |
41,061 | I have these albums and songs in my iTunes Library. They should appear grouped, but for some reason, iTunes splits them up and shows them as separate albums with the same name and details:

I check the metadata and everything seems to be in... | 2012/02/20 | [
"https://apple.stackexchange.com/questions/41061",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/13705/"
] | I've only ever seen this happen when the metadata absolutely differs in some way between tracks. There are two ideas that come to mind:
1. Highlight each individual character and make sure 3 dots ( ... ) haven't been transformed into a single character elipses ( … ). Highlight each of the dots above and you should und... | I would suggest selecting all four songs and doing the following:
1. Delete metadata from the tracks: at least Grouping, Album, Artist, Sort Album, and Sort Artist, but more wouldn't hurt.
2. Save the absence of the data by selecting "Done."
3. While they continue to be selected, Get Info again and fill in the relevan... |
7,270,177 | I'm new to WPF and the MVVM pattern so keep that in mind.
The project I'm tasked with working on has a view and a view model. The view also contains a user control that does NOT have a view model. There is data (custom object ... Order) being passed to the view model that I also need to share with the user control.
... | 2011/09/01 | [
"https://Stackoverflow.com/questions/7270177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/447341/"
] | Yes: Use the [Scripting API](http://download.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html).
There are implementations to run scripts written in JavaScript, Groovy, Python and lots of other languages.
**[EDIT]**
Since it was mentioned in the comments: Be wary of security issues.
Th... | Sure, see [Mozilla Rhino](http://www.mozilla.org/rhino/) |
5,631,566 | ```
"NewsML": [
{
"Identification": {"NewsIdentifier": {
"ProviderId": "timesofindia.com",
"NewsItemId": "7954765"
}},
"NewsLines": {
"HeadLine": "I want KKR to win for Ganguly: Shah Rukh",
"DateLine": "IANS, Apr 12, 2011, 04.41am IST"
},
... | 2011/04/12 | [
"https://Stackoverflow.com/questions/5631566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/703525/"
] | I pulled up designer and made your layout without any trouble at all. As shown in the hierarchy in the top right of my screenshot, I created a line edit and a text edit. Joined those in a vertical layout. Created a treeWidget and joined that with the layout in a horizontal splitter.
I was able to get it to look like y... | The widget on the right side of the splitter (the one containing the QLineEdit and the QListWidget) probably has default values for the layout. In QtCreator, select the QWidget, then in the property editor, scroll all the way down to the Layout section, and set the 4 values for layoutLeftMargin, layoutTopMargin, layout... |
49,015,827 | I have the error `MethodNotAllowedHttpException` when I submit form data using `ajax`.
**HTML**
```
<form class="form-signin" id="loginForm" role="form" method="POST">
// Form
</form>
<script>
$('#loginForm').submit(function () {
initLogin($('#email').val(),$('#password').val());
});
<... | 2018/02/27 | [
"https://Stackoverflow.com/questions/49015827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2898592/"
] | Here's a regex that can do what I think you're looking for:
```
/(?:(?:^|[-+_*/])(?:\s*-?\d+(\.\d+)?(?:[eE][+-]?\d+)?\s*))+$/
```
<https://regex101.com/r/w74GSk/4>
It matches a number, optionally negative, with an optional decimal number followed by zero or more operator/number pairs.
It also allows for whitespace... | Using [`complex-js`](https://www.npmjs.com/package/complex-js), you can wrap [`Complex.compile()`](https://github.com/patrickroberts/complex-js#compile) in a `try/catch` statement:
```js
function isMathExpression (str) {
try {
Complex.compile(str);
} catch (error) {
return false;
}
return true;
}
con... |
1,113,280 | There is a sample code of apple named "reachability" which tells us the network status of the device, wifi or edge/gprs, but I couldn't see any documentation or sample code regarding gathering if the device is on 3g or not while accessing to internet. I also googled, but no hope. Is it possible to do that, if so how? | 2009/07/11 | [
"https://Stackoverflow.com/questions/1113280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/133617/"
] | ### Column / Row
>
> ... I don't need the transactional integrity to be maintained across
> the entire operation, because I know that the column I'm changing is
> not going to be written to or read during the update.
>
>
>
Any `UPDATE` in [PostgreSQL's MVCC model](https://www.postgresql.org/docs/current/transacti... | I am by no means a DBA, but a database design where you'd frequently have to update 35 million rows might have… issues.
A simple `WHERE status IS NOT NULL` might speed up things quite a bit (provided you have an index on status) – not knowing the actual use case, I'm assuming if this is run frequently, a great part of... |
29,272,827 | i have the following `three.js` code:
```
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 65, window.innerWidth/window.innerHeight, .1, 1000 );
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement )... | 2015/03/26 | [
"https://Stackoverflow.com/questions/29272827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3524493/"
] | You need to have an image that has a square size in the power of two to use this kind of texture, so make sure your images is 2x2, 8x8, 16x16, 32x32, etc.. | please try [**fileReader Object**](https://developer.mozilla.org/en-US/docs/Web/API/FileReader) which lets web applications to read the contents of files, and in this case an image, stored on the user's computer.
Hope that you can go to next step from here. |
4,289,381 | I am trying to answer a question about line integrals, I have had a go at it but I am not sure where I am supposed to incorporate the line integral into my solution.
$$ \mathbf{V} = xy\hat{\mathbf{x}} + -xy^2\hat{\mathbf{y}}$$
$$ \mathrm{d}\mathbf{l} = \hat{\mathbf{x}}\mathrm{d}x + \hat{\mathbf{y}}\mathrm{d}y $$
$$ \i... | 2021/10/27 | [
"https://math.stackexchange.com/questions/4289381",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/824765/"
] | * One could also use a parametrization.
Set $x(t)=t$ and and $y(t)= t^2/3$.
* The parabola corresponds to the endpoint of the position vector :
$ \vec r (t)= t\vec i + \frac {t^2}{3} \vec j$.
* This allows to calculate the differential $d\vec r$:
$d\vec{\mathbf{r}}(t)=\vec{\mathbf{r\space '}}(t) dt = (1\vec i + (2... | In this case, it's as simple as plugging in $y=\frac{x^2}{3}$ into the first integral and integrating from $x=0$ to $x=3$. In the second integral, do the same thing, but plug in $dy=\frac{2x}{3}dx$. In other words, parameterize the whole curve in terms of $x$.
In other examples (like circles), it may be more convenien... |
2,808,022 | I have to parse an XML file in C++. I was researching and found the RapidXml library for this.
I have doubts about `doc.parse<0>(xml)`.
Can `xml` be an .xml file or does it need to be a `string` or `char *`?
If I can only use `string` or `char *` then I guess I need to read the whole file and store it in a char arr... | 2010/05/11 | [
"https://Stackoverflow.com/questions/2808022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337891/"
] | We usually read the XML from the disk into a `std::string`, then make a safe copy of it into a `std::vector<char>` as demonstrated below:
```
string input_xml;
string line;
ifstream in("demo.xml");
// read file into input_xml
while(getline(in,line))
input_xml += line;
// make a safe-to-modify copy of input_xml
/... | The [manual](http://rapidxml.sourceforge.net/manual.html#classrapidxml_1_1xml__document) tells us:
>
> function xml\_document::parse
>
>
> [...] Parses zero-terminated XML string
> according to given flags.
>
>
>
RapidXML leaves loading the character data from a file to you. Either read the file into a buffer... |
2,408,976 | Could you please help me how to format a `struct timeval` instance to human readable format like "2010-01-01 15:35:10.0001"? | 2010/03/09 | [
"https://Stackoverflow.com/questions/2408976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/289637/"
] | Combining previous answers and comments, changing the format to be [RFC3339](https://www.rfc-editor.org/rfc/rfc3339)-compliant, and checking all of the error conditions, you get this:
```
#include <stdio.h>
#include <sys/time.h>
ssize_t format_timeval(struct timeval *tv, char *buf, size_t sz)
{
ssize_t written = -1... | This is what I use:
```
#include <time.h>
#include <string.h>
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
#define gmtime_r(ptime,ptm) (gmtime_s((ptm),(ptime)), (ptm))
#else
#include <sys/time.h>
#endif
#define ISO8601_LEN (sizeof "1970-01-01T23:59:59.123456Z")
char *timeval_... |
56,701,988 | **models.py**
```
class UserManager(BaseUserManager):
def create_user(self, phone, password=None):
if not phone:
raise ValueError('Please provide a valid Phone')
user = self.model(
phone = phone,
)
user.set_password(password)
user.save(using=self._d... | 2019/06/21 | [
"https://Stackoverflow.com/questions/56701988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9632454/"
] | try this
```
from django.contrib.auth.hashers import make_password
...
def create(self,validated_data):
user = User.objects.create(validated_data['phone'],None,make_password(validated_data['password']))
return user
``` | In view.py "use make\_password()"
if validated:
temp\_data = {
'phone': phone,
'password': make\_password(password),
} |
38,060,505 | I have googled quite a bit, and I have fairly decent reading comprehension, but I don't understand if this script will work in multiple threads on my postgres/postgis box. Here is the code:
```
Do
$do$
DECLARE
x RECORD;
b int;
begin
create temp table geoms (id serial, geom geometry) on commit dr... | 2016/06/27 | [
"https://Stackoverflow.com/questions/38060505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3059517/"
] | One subtle trap you will run into though, which is why I am not quite ready to declare it "safe" is that the scope is per session, but people often forget to drop the tables (so they drop on disconnect).
I think you are much better off if you don't need the temp table after your function to drop it explicitly after yo... | Temp tables in PostgreSQL (or Postgres) (PostGres doesn't exists) are local only and related to session where they are created. So no other sessions (clients) can see temp tables from other session. Both (schema and data) are invisible for others. Your code is safe. |
236,849 | I have a potentially-repeated question, but I was unable to find anything about this. So, I need to create a giant binomial coefficient in LaTeX (something around 1000pt). When I compile the below, though, it scales the `\binom{}{}` up, but not the a and b. Is there any way to make the whole thing bigger?
```
\documen... | 2015/04/04 | [
"https://tex.stackexchange.com/questions/236849",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/75612/"
] | You can use the Latin Modern fonts, provided you fix the `largesymbols` font:
```
\documentclass[border=10]{standalone}
\usepackage{lmodern}
\usepackage{amsmath}
\DeclareFontFamily{OMX}{lmex}{}
\DeclareFontShape{OMX}{lmex}{m}{n}{ <-> lmex10 }{}
\SetSymbolFont{largesymbols}{normal}{OMX}{lmex}{m}{n}
\begin{document}
\... | Easiest here is just to scale the entire construction to suit your needs using [`graphicx`](http://ctan.org/pkg/graphicx)'s `\resizebox` or `\scalebox` functionality:

```
\documentclass[12pt,border=5pt]{standalone}
\usepackage{amsmath, graphicx}
\be... |
30,602,250 | I am trying to use Roo to import data from an Excel spreadsheet into a table (data\_points) in a Rails app.
I am getting the error:
```
undefined method `fetch_value' for nil:NilClass
```
and that error references my data\_point.rb file at line (see below for full code excerpt):
```
data_point.save!
```
The "App... | 2015/06/02 | [
"https://Stackoverflow.com/questions/30602250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4797451/"
] | This is the problem encountered yesterday, the reason is I defined a Database field with name `class`, which is a reserved word for the Ruby language. It caused the conflict. | If you are not restricted to delete the `initialize` method for some reason, instead of removing it, you can try to add a `super` call like so:
```
def initialize(annual_income, income_percentile, years_education)
super()
@annual_income = annual_income
@income_percentile = income_percentile
@years_education =... |
10,270,914 | Greeting people...i develop a web..everything working fine till deployment...my question is - why is it this error appear? because if i run the web on Visual Studio Server
everything fine...but when i deploy and run it on IIS server suddenly this error
appear..why is people? really need some help here..
```
string... | 2012/04/22 | [
"https://Stackoverflow.com/questions/10270914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1124948/"
] | Chances are the server-side default culture is different to the one you've been using in development.
What format are you expecting the date to be in, anyway? You should either use [`DateTime.TryParseExact`](http://msdn.microsoft.com/en-us/library/system.datetime.tryparseexact.aspx) or *at least* use [`DateTime.TryPar... | [](https://i.stack.imgur.com/xaBI2.png)
Issue is resolved by setting up .net globlization settings in IIS |
3,367,553 | Is $S$ linearly dependent on $\textsf V = \mathcal{F}(\Bbb R,\Bbb R)$ and $S = \{t, e^t ,\sin(t)\}$.
How to prove that a set of functions are linearly dependent? | 2019/09/24 | [
"https://math.stackexchange.com/questions/3367553",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/708009/"
] | Suppose we have some scalars $a\_0,a\_1,a\_2$ in $\Bbb R$ such that
$$a\_0t+a\_1e^t+a\_2\sin t =0 \tag{1}$$
for all real number $t$. Making $t=0$ this gives us $a\_1=0$. Returning to $(1)$, we have
$$a\_0t+a\_2\sin t =0 \tag{2}$$
Now, make $t=\pi$ and then $a\_0\pi=0$, which means $a\_0=0$. | HINT.- A good way to try this problem is to consider that the elements of $V$ are $f\_1,f\_2,f\_3$ where $f\_1(t)=t,f\_2(t)=e^t,f\_3(t)=\sin(t)$ so you have to show that if the linear combination
$$a\_1f\_1+a\_2f\_2+a\_3f\_3=0$$ where les $f\_i$ are three vectors and les $a\_i$ are scalars in your vectorial space, then... |
42,359,944 | There are a few loops in javascript including forEach, some, map, and reduce. However, from what I currently understand, none of these are appropriate if you want to iterate through an array and return the value of a particular index. It seems like I am pretty much left with the standard for loop only. Is that true?
S... | 2017/02/21 | [
"https://Stackoverflow.com/questions/42359944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3534132/"
] | [Array.prototype.findIndex()](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) , as suggested by @Andreas in comments.
You can pass in a function to findIndex() method and define your equality criteria in that function.
It will return the index of first array element, th... | [Array.prototype.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) or [Array.prototype.indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) like everyone said. |
296,665 | Sorry for such a noob question, but where is the log out?
I have looked under every menu option. Can not find it in the title bar.
Typed in search box looking for results or instructions, not listed on the help page.
Checked the footer. Am I suppose to stay logged on forever? | 2015/06/11 | [
"https://meta.stackoverflow.com/questions/296665",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/-1/"
] | It's hidden under the StackExchange dropdown menu at the top left.
 | Click on the StackExchange banner up in the nav bar (far left), on the very right of the popup menu you'll find the logout link. |
14,741,966 | Please recommend a scrum/agile project management tool. First, it should be able to be installed or deployed on my local computer. Additionally, it should be free, no need for complete unlimited usage, just that it can support 5 users and some scrum project functions, such as "kanban".
I found some answers of other qu... | 2013/02/07 | [
"https://Stackoverflow.com/questions/14741966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1954315/"
] | Given that you're wanting a local application, I'm assuming that your team is all located in the same place.
If so, I'd advise against using tools. As the agile manifesto says: "We value Individuals and Interactions over processes and tools". I'd urge you to consider co-locating your team(s), improving communication, ... | <http://www.simple-kanban.com>
This seems like it meets your requirements. There are other possibilities if you will accept a hosted solution rather than a local install. |
175,739 | I'm trying to mount an hfsplus filesystem in a Xubuntu 12.04 VM (kernel version 3.2.0-23-generic) but when I type `mount -o remount,rw /dev/sdb3` in command line it returns `not mounted or bad option`. Any help would be appreciated. | 2012/08/14 | [
"https://askubuntu.com/questions/175739",
"https://askubuntu.com",
"https://askubuntu.com/users/83303/"
] | for busybox/android users:
>
> Oddly, I needed to *add* a space (in contrast to normal usage) between 'remount' and 'rw':
>
>
>
```
mount -o remount, rw /
```
otherwise it wouldn't work.
>
> UPDATE: it seems that this is almost never the case (see comments). Not sure which busybox-version + android-version I ... | First, let us fix NTFS problems (if you have an Ubuntu/Windows dual boot setup)
```
sudo ntfsfix /dev/sda7
```
Before mounting we need a Directory (folder)
```
mkdir ~/Desktop/disk
```
Now mount the partition
```
sudo mount /dev/sda7 ~Desktop/disk
```
In this case "sda7" is the partition name.
Now you read fro... |
10,309,529 | I was thinking of a class like:
```
template < typename ...Whatever >
class MyClass
{
public:
static constexpr bool has_default_ctr = Something;
// I want this only if "has_default_ctr" is "true".
MyClass();
//...
};
```
I don't think I can use a constructor template and `std::enable_if` for this (... | 2012/04/25 | [
"https://Stackoverflow.com/questions/10309529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1010226/"
] | C++11 allows to (reliably) use `enable_if`-style SFINAE in template arguments:
```
template<
// This is needed to make the condition dependent
bool B = has_default_ctr
, typename std::enable_if<B, int>::type = 0
>
MyClass();
// When outside of class scope:
// have to repeat the condition for out-of-line d... | With `enable_if` it's easy (it works if the class templated also):
```
#include <type_traits>
class MyClass
{
public:
static constexpr bool has_default_ctr = Something;
// I want this only if "has_default_ctr" is "true".
template <typename = std::enable_if<has_default_ctr>::type>
MyClass();
//..... |
60,547 | Whilst working on a recent project, I was visited by a customer QA representitive, who asked me a question that I hadn't really considered before:
>
> How do you know that the compiler you are using generates machine code that matches the c code's functionality exactly and that the compiler is fully deterministic?
> ... | 2008/09/13 | [
"https://Stackoverflow.com/questions/60547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | >
> ...you trust your compiler implicitly
>
>
>
You'll stop doing that the first time you come across a compiler bug. ;-)
But ultimately this is what testing is for. It doesn't matter to your test regime how the bug got in to your product in the first place, all that matters is that it didn't pass your extensive ... | If your worried about *malicious* bugs in the compiler, one recommendation (IIRC, an NSA requirement for some projects) is that the compiler binary predate the writing of the code. At least then you know that no one has *added* bugs targeted at *your* program. |
5,379,093 | I am not familiar with the lambda function itself, and don't really know how to debug this issue.
Django-1.1.2
I am using, [django-activity-stream](https://github.com/philippWassibauer/django-activity-stream) in order to render activity streams for my users.
In the documentation for this items it says that you need t... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5379093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/348869/"
] | Somewhere above where these lambdas are defined, you need to import the names `get_people_i_follow` and `get_my_followers`. I'm not familiar with django-activity-stream, but it's probably something like `from activity_stream import get_people_i_follow, get_my_follwers`.
Lambda is a keyword for creating anonymous func... | If you are integrating with a pre-existing network I don't believe you're actually supposed to write verbatim:
```
ACTIVITY_GET_PEOPLE_I_FOLLOW = lambda user: get_people_i_follow(user)
ACTIVITY_GET_MY_FOLLOWERS = lambda user: get_my_followers(user)
```
I believe the author was just showing an example that `ACTIVITY_... |
62,533,888 | I decided to learn Python since I now have more time (due to pandemic) and have been teaching myself Python.
I am trying to scrape tax rates from a site and can get almost everything I need. Below is a snippet of the code that comes out of my *Soup* variable as well as the relevant piece of Python.
Where I am having ... | 2020/06/23 | [
"https://Stackoverflow.com/questions/62533888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13798125/"
] | First thing the response from API is not a json list, its a simple json object.
If you wanna iterate over the keys of the above object you can create a list with all the keys and then use key index to get the actual key name in the response.
```
final List<String> keys = ["alm","co2","hu","temp","th","tm","ts"];
```
... | You're getting a `Map` from your API. you cannot use that on a `ListView.builder`. You can use a regular `ListView` and add the ListTiles manually.
Create the `ListView` and add the ListTiles manually using each key in the map.
```dart
body: ListView(
children: <Widget>[
buildTile('alm'),
... |
38,056,899 | I'm not able to run simple JMH benchmark inside eclipse.
Maven dependencies:
```
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId... | 2016/06/27 | [
"https://Stackoverflow.com/questions/38056899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6381145/"
] | pom.xml must have the below dependencies and configurations to Java Micro-benchmark Harness (JMH) Framework
```
<properties>
<jmh.version>1.21</jmh.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
<... | Add version as well. This works for me
```
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
``` |
2,585,092 | Thinking about this [question on testing string rotation](https://stackoverflow.com/questions/2553522/interview-question-check-if-one-string-is-a-rotation-of-other-string), I wondered: Is there was such thing as a circular/cyclic hash function? E.g.
```
h(abcdef) = h(bcdefa) = h(cdefab) etc
```
Uses for this include... | 2010/04/06 | [
"https://Stackoverflow.com/questions/2585092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36537/"
] | Here's an implementation using Linq
```
public string ToCanonicalOrder(string input)
{
char first = input.OrderBy(x => x).First();
string doubledForRotation = input + input;
string canonicalOrder
= (-1)
.GenerateFrom(x => doubledForRotation.IndexOf(first, x + 1))
.Skip(1) // the -1... | I did something like this for a project in college. There were 2 approaches I used to try to optimize a Travelling-Salesman problem. I think if the elements are NOT guaranteed to be unique, the second solution would take a bit more checking, but the first one should work.
If you can represent the string as a matrix of... |
8,530,275 | Senario
I have an object Keyword -> It has a name and a Value (string)
A keyword cannot contain itsSelf... but can contain other keywords example
`K1 = "%K2% %K3% %K4%"`
where K2,K3,K4 are keywords.....
Just Relpacing them with their values works but here a catch that i am facing
Examlple :
`K3= "%K2%"`
`K2= "... | 2011/12/16 | [
"https://Stackoverflow.com/questions/8530275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/756987/"
] | From your comment:
>
> I want to be able to take a Context Free Grammar and run an analyzer on it that determines if there is **any** "infinite cycle".
>
>
>
That is easily done. First off, let's clearly define a "context free grammar". A CFG is a substitution system which has "terminal" and "non-terminal" symbol... | Each time you're going to replace a keyword, add it to a collection. If, at some point, that collection contains the keyword more than one time, it is recursive. Then you can throw an exception or just skip it. |
2,451,757 | We know that the definition of a limit is: $\forall \epsilon > 0 \space \exists\delta>0, 0<|x-c|<\delta \to |f(x) - L| < \epsilon$
From my understanding, this means that the closer $x$ gets to $c$, then the closer $f(x)$ gets to $L$. However, since $x$ is never actually at $c$, then isn't it impossible for $f(x) = L$?... | 2017/09/30 | [
"https://math.stackexchange.com/questions/2451757",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | It is possible for $f(x)$ to be $L$, even if $x\neq c$.
Maybe $f$ takes the value $L$ at another point than $c$. This happens for instance for all constant functions. | Is such an example what you are after: If $f(x) = 1$, then $f(x) = f(1)$ for all $x \neq 1$. |
322,341 | The System process running on my Windows 7 installation uses almost 50% of CPU arbitrarily. I monitor the process with Process Explorer from [Sysinternals](http://www.sysinternals.com).
*Click the images to enlarge them...*
[](https://i.stack.imgur.com/... | 2011/08/12 | [
"https://superuser.com/questions/322341",
"https://superuser.com",
"https://superuser.com/users/93931/"
] | In my situation it was cpu fan speed that was somehow slower than usual.
For some reason or another, the fan was slow, after 5 years of perfect operation, its settings got corrupt or whatever. So cpu got hot, so system was protecting things with this "high cpu usage in system process" trick. That is a trick to reduce ... | To diag the CPU usage issues, you should use Event Tracing for Windows (ETW) to capture CPU Sampling data / Profile.
To capture the data, [install the Windows Performance Toolkit](http://social.technet.microsoft.com/wiki/contents/articles/4847.install-the-windows-performance-toolkit-wpt.aspx), which is part of the [Wi... |
4,053 | We are currently getting some new [survey marks](http://en.wikipedia.org/wiki/Survey_marker) established in the main town of our shire, we have been told that there are different orders based on accuracy: 1st, 2nd and 3rd both for horizontal and vertical. In the main town we already have a few good 1st order horizontal... | 2010/12/01 | [
"https://gis.stackexchange.com/questions/4053",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/97/"
] | In order to establish a mark of a particular order, you have to design the survey so that it meets all the Class and Order requirements (listed in the standards) AND meet the error requirements, which vary depending on the method used (differential or GPS/Trigonometric). The actual position/elevation measurement is fai... | The more points in the 'survey control' the more accurate the data.
Can be denoted as:
```
First order: f = +/- 0.02(sqrt(M))
Second order: f = +/- .035(sqrt(M))
Third order: f = +/- .05(sqrt(M))
```
These reflect the closure between established control where f is the
maximum misclosure in feet and M is the distanc... |
24,984 | Making a single pancake **in a microwave** is easy: just take a Tefal round pan (no sharp corner no sparks), drop your dough, wait 2.5 minutes (it also work on any eating plates, but the first one is quite hard to unstick). But it's not really efficient in terms of time and energy. There should be a way to make several... | 2021/08/06 | [
"https://lifehacks.stackexchange.com/questions/24984",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/9915/"
] | **What is the special liquid for cleaning the peeing liquid on the floor?**
Generally speaking any anti-bacterial solution or soap will do to clean the area affected. However, if the smell persists I would recommend using the product: [**Fresh-Aire Deodorant Concentrate**](https://www.amazon.ca/12015627-RMC-Fresh-Aire... | I have no idea how well they work on human urine but any major pet store will have products to remove pet odors and stains from cat and dog urine. They have various enzymes to break down the odor causing elements. |
5,652,570 | I have written a following code (see code comments for the question),
```
#include<stdio.h>
int main()
{
int size;
scanf("%d",&size);
int arr[size]; /*is it a valid statement?*/
for(int i=1;i<=size;i++)
{
scanf("%d",&arr[i]);
printf("%d",arr[i]);
}
return 0;
}
``` | 2011/04/13 | [
"https://Stackoverflow.com/questions/5652570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/681929/"
] | The use of a non constant array size is valid C99 but not C90. There is an older gcc extension allowing it.
Note that taking advantage of this make it harder to check that memory allocation succeed. Using it with values provided by the user is probably not wise. | The compiler tries to evaluate `int arr[size]` at compile time. In this case, arr is allocated on the stack, so the compiler wants to know its size ahead of time. Instead, you need to allocate arr on the heap using `malloc`, like this.
```
#include<stdio.h>
int main()
{
int size;
scanf("%d",&size);
int *ar... |
45,984,737 | Does anyone know if it's possible to capture the variables from an Adobe Analytics implementation and pass them to GTM so that they can be used as custom dimensions in Google Analytics?
I was wondering if there was some javascript that i could implement in GTM that would extract the neccessary props i want from the ad... | 2017/08/31 | [
"https://Stackoverflow.com/questions/45984737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8543980/"
] | ```
UPDATE my_table SET
[Col 1] = CASE WHEN [Flag] = 0 THEN [Col 1] ELSE 0 END,
[Col 2] = CASE WHEN [Flag] = 1 THEN [Col 2] ELSE 0 END ,
[Col 3] = CASE WHEN [Flag] = 1 THEN [Col 3] ELSE 0 END
``` | Assuming that `Flag` only has values `0` or `1`:
```
update ThyTable
set Col1 = Col1 * ( 1 - Flag ), Col2 = Col2 * Flag, Col3 = Col3 * Flag
``` |
30,031,952 | I've been working as a Java developer for just short of a year now and am gradually trying to increase my knowledge to speed up development times. One of the habits I find myself doing is forcing an occasional *clean* without really knowing if I need it.
I get that if you use it, your project will be completely re-bui... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1768351/"
] | Clean is useful if some external tool modifies your output folder. For example, you are using Eclipse, but occasinally compile via command line compiler into the same folder. In this case Eclipse may fail to do incremental build and display errors in code when they are actually absent.
Another case is working around s... | It is for example useful if you delete a class, and then you forget to remove a reference to it in another class. If you do not clean the project, your local copy will still work, but what you actually did is that you just broke the build. ;)
Your local copy of the project will still work because the .class of the del... |
223,328 | Carl Barks created the Duckverse. Don Rosa created "The Life and Time of Uncle Scrooge". Generally, all comics by those two artists are considered canon.
Apart from those two artists, which other artists (or stories) are considered Duck canon? | 2019/11/20 | [
"https://scifi.stackexchange.com/questions/223328",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/89771/"
] | It depends highly on what you consider canon. There are numerous Donald Duck stories published in Europe, mostly by Italian and Spanish artists, now under the auspices of Danish publishing house Egmont. Being official, licensed productions, they can be considered canon.
[This site](https://www.lambiek.net/comics/disne... | It depends on how you view the DuckVerse and continuity.
First, you have to understand that each version of the Duck world is its own continuity.
That’s a undisputed fact.
There are many minor and major differences between each incarnation of this world.
However, you can have your own headcanon, which is what you, ... |
819,514 | Say I have 1280x720 pixels on my screen and the current resolution is set to 1280x720 as well. What are the differences between the 1080p version and the 720p version of the same media? Is it noticeable to an end user (a non-video expert or enthusiast)?
**Clarification Edit**: The question was in regard to .mkv files ... | 2014/10/01 | [
"https://superuser.com/questions/819514",
"https://superuser.com",
"https://superuser.com/users/279815/"
] | The result depends on the resizing algorithm. But the default algorithm in most situations will produce a sharper image. So a 1080p video may look better on a 720p screen, provided that the 720p is the original version and was not scaled down from 1080p or a higher resolution
Scaling down has another advantage that so... | Personally I think that 1080 and 720 thing was a screwup in multiple ways. First, 1920x1080 is a 16:9 aspect ratio. Why not make it 2048\*1024 so that is a perfect 2:1 aspect ratio and cuz it is well known that computers love powers of 2? For smaller TVs such as 21" or even smaller, they could just toss away every othe... |
129,393 | Let $S$ be an orientable compact surface. A homeomorphism $f: S \to S$ induces an isomorphism $f\_{\*}: H\_1(S) \to H\_1(S)$.
How much can we say the converse? Namely, if we are given an element of $\alpha \in$ $\operatorname{Aut}(H\_1(S))$, is there a self-homeomorphism $f$ of $S$ (unique up to isotopy or something) ... | 2012/04/08 | [
"https://math.stackexchange.com/questions/129393",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | The set of self-homeomorphisms of a surface up to isotopy is called the mapping class group of the surface. For genus one, this is determined by the action on homology, but for higher genus there is a very large and interesting subgroup of the mapping class group, called the Torelli group, which consists of self-homeom... | Here's an example without the assumption that $S$ is a surface:
Let $S = S^1 \vee A$ where $A$ is a closed annulus. Then $H\_1(S) = \mathbb Z \oplus \mathbb Z$. Take the isomorphism $\varphi: (a,b) \mapsto (b,a)$.
A homeomorphism $f$ inducing $\varphi$ would have to map $x$ in $S^1$ to $f(x) \in A$. But $S^1$ and $A$... |
13,510,504 | I'm learning multi-threading in C# and I saw a code below
```
static readonly object _locker = new object();
static void Main()
{
lock (_locker)
{
AnotherMethod();
// ...some work is going on
}
}
static void AnotherMethod()
{
lock (_locker) { Console.WriteLine ("Another method"); }
}
```
I wonder... | 2012/11/22 | [
"https://Stackoverflow.com/questions/13510504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/468345/"
] | My first response would be that AnotherMethod can be called directly, not going through the Main method, so therefor you might need nested locking. | To allow [re-entrant](https://stackoverflow.com/questions/391913/re-entrant-locks-in-c-sharp) code.
Your example is not appropriate. Locks are used to provide controlled access to [critical section](http://en.wikipedia.org/wiki/Critical_section).
If one critical section invokes another critical section, then deadloc... |
37,366,664 | I'm trying to run some PhpUnit tests and it's working great but I keep running into the following problem.
When I write a Unittest and it fails for whatever reason I'm getting the following error message (I'm also getting a unclear message why the test failed):
`1) testUser_ReadOnly::testLoginFunction
PHP Warning: req... | 2016/05/21 | [
"https://Stackoverflow.com/questions/37366664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5763101/"
] | Allright, I found the sollution to this problem. It was not clear for me when I started with phpUnit I had to run the commands from the Xampp shell instead of the windows commandline. You can find this by opening the Xampp control panel and click the 'shell button'. Since I execute the phpUnit commands here, I never ha... | The error message is indeed not very clear on first sight, but that already is the solution to the problem: Your setup is incompatible with PHPUnit, the autoloader you have configured in file `C:\xampp\htdocs\map\src\tests\autoload.php` brings the testsuite to halt.
As often with configuration problems they are hard t... |
44,153,497 | I did some research and couldn't find any solution and hence posting it here.
We have a dataload job which runs on a daily basis. We have separate DML statements to insert, update etc. We wanted to avoid insert statements to run multiple times.
Is there an option to use merge statement in this scenario to update if ... | 2017/05/24 | [
"https://Stackoverflow.com/questions/44153497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/803449/"
] | Try this
```
select
date_format(created_at,'%Y') as Year,
sum(case when date_format(created_at,'%m')='01' then 1 else 0 end) as val01,
sum(case when date_format(created_at,'%m')='02' then 1 else 0 end) as val02,
sum(case when date_format(created_at,'%m')='03' then 1 else 0 end) as val03,
sum(case when date_format(cre... | If this had been Oracle, you could have used Function based index on column Created\_at and using the same function (EXTRACT in this case) in your query:
```
CREATE INDEX IDX1 ON RESERVATIONS (EXTRACT(YEAR FROM CREATED_AT))
```
Since, this is MySQL, try using [this](http://mysqlserverteam.com/generated-columns-in-my... |
56,151,300 | I make a call to a REST-API and get a list of persons in JSON format. How do I just refer to one specific Object e.g. "Adam"?
I make the call via Node.js and would like to pass the Javascript object to another function.
I use:
```
request('rest-api-URL', function (error, response, body) {
if (!error && response.s... | 2019/05/15 | [
"https://Stackoverflow.com/questions/56151300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5122411/"
] | Styling for `IFrame` should be within the `IFrame` itself.
Note that the `Sticky` rule will apply WITHIN the `IFrame`
```html
<!DOCTYPE html>
<html>
<body>
<style>
iframe { height:200px; border: 0; }
</style>
<p>Your Page with Some Content...</p>
<iframe srcdoc="<!DOCTYPE html><html><body><div id='... | Position:sticky does appear to work if you have a scrollable iframe: <iframe scrolling="yes"...
The content is sticky in relation to the iframe's scroll bars, not the host page's.
The height of the iframe content must overflow (be larger than) the specified iframe height. |
223,885 | In Fallout Shelter you're able to rush the product of a resource. According to the game, it is influenced by the luck of the people assigned to the room and whether or not you have recently rushed the room. However, as the incident rate goes down, so do the rewards for rushing. What are the underlying mechanics? I woul... | 2015/06/16 | [
"https://gaming.stackexchange.com/questions/223885",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/107588/"
] | **Failure rate = 40 - 2 \* (Average room Luck + Average room Skill) + 10 for each successive rush (up to +50)**
Use one maxed dweller in a tripple lvl 3 room and you always complete the first rush.
Average room luck also increases chance to get +200 caps when picking up reasources.
Source: <https://docs.google.com/s... | I am currently gathering intel on this as well and here is what I have seen from my own observations
* The incident rate seems to start at around 31% (this is with 2-4 people in the room with ok stats)
* It increases every time you do a rush whether you fail or succeed by about 10%
* The chance of failure also seems t... |
175,656 | So, let's say long ago, somewhere along the evolutionary process, homo sapiens got fully prehensile tails that can support their weight, of about 1,5 to 2 meters long.
The tail is naked, about as much hair as an arm.
It also has a tactile pad at the end.
The tail is not taboo and they only cover it to shield it fr... | 2020/05/05 | [
"https://worldbuilding.stackexchange.com/questions/175656",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/75533/"
] | One day you may find your soulmate. And you will wish to share a bed with that person. Very probably that person will want you to spoon with them, and at times you will be the big spoon. And when that happens you'd better be healthy and free of circulatory problems, for you will be in for the kinda of suffering your ho... | Doors would roll up, be counter-weighted with the knob or handle at the center bottom. Reach out between your legs with your tail as you approached the door, flip it up, go through, close door without breaking stride. Smooth. |
22,410,148 | I have the following html
```
<table>
<tr>
<td headers="Monday"> <div class="foo"> Some stuff </div> </td>
<td headers="Tuesday"> <div class="foo"> Some stuff </div> </td>
<td headers="Wednesday"> <div class="foo"> Some stuff </div> </td>
</tr>
</table>
```
How can I target the td with Monday headers... | 2014/03/14 | [
"https://Stackoverflow.com/questions/22410148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2735572/"
] | You can remove class with something like this:
```
$('td[headers="Monday"] > div').removeClass('foo');
```
**Demo:** <http://jsfiddle.net/8qbba/> | Try this...
```
if($('.foo:contains("Monday")')){
$('table').each(function(){
var mondayHeader = $(this).find('tr.td[headers="Monday"]');
$(mondayHeader).closest('div').removeClass('foofoo');
});
}
``` |
577,756 | I have a genealogical database (about sheep actually), that is used by breeders to research genetic information. In each record I store fatherid and motherid. In a seperate table I store complete 'roll up' information so that I can quickly tell the complete family tree of any animal without recursing thru the entire da... | 2009/02/23 | [
"https://Stackoverflow.com/questions/577756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53686/"
] | Assuming each sheep has one male parent and one female parent, and that no sheep can be its own parent (leading to an Ovine Temporal Paradox), then what about using two HierarchyIDs?
```
CREATE TABLE dbo.Sheep(
MotherHID hierarchyid NOT NULL,
FatherHID hierarchyid NOT NULL,
Name int NOT NULL
)
GO
ALTER TAB... | SQL Server hierarchyID is not a robust solution for many genealogy analytic questions. It is based on ORDPATH and I've used it for awhile in genealogy; but there are too many scenarios in genealogy that cannot be readily addressed with ORDPATH methods for directed acyclic graphs. A graph database is much more robust an... |
9,592,736 | I have an activities view that contains an array of activities. This array gets sorted sometimes based on a calculated property(distanced\_from\_home) that the user can update. When the array is sorted I want the child views to be re-rendered by according to the new order. Here is my Template and View:
*index.html*
`... | 2012/03/06 | [
"https://Stackoverflow.com/questions/9592736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/354101/"
] | Does this help? <http://jsfiddle.net/rNzcy/>
Putting together this simple example, I was a little confused why the view update didn't "just work" when sorting the content array in the ArrayController. It seems there are 2 simple things you can do to trigger the view update. Either:
* Set the content array to null, so... | I met the same issue. And I don't think observe `array.@each` or `array.length` is good practice. At last I found this <http://jsfiddle.net/rNzcy/4/> i.e. call `this.propertyDidChange('foo')` |
29,287,742 | I've just upgraded IntelliJ IDEA (ultimate) to Version 14.1 and the font used in the Project View, Menus and Dialogs seems not to be rendering correctly. I exported the same settings from my 14.0.3 version just in case, although they seem identical, but it still remained the same. I didn't do any changes to the JDK or ... | 2015/03/26 | [
"https://Stackoverflow.com/questions/29287742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/340088/"
] | I am using OSX. It may not help.
Double tap shift and search for 'Switch IDE boot JDK'. Try different JDKs if there are. | This might not be the answer you are looking for - but ever since I've started using tuxjdk, I haven't had problems any more with font rendering & intellij on ubuntu. Maybe give it a try? |
5,683,371 | I am trying to code a function that basically gets a "property" from a sentence. These are the parameters.
```
$q = "this apple is of red color"; OR $q = "this orange is of orange color";
$start = array('this apple', 'this orange');
$end = array('color', 'color');
```
and this is the function I am trying to make:
`... | 2011/04/15 | [
"https://Stackoverflow.com/questions/5683371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325499/"
] | Something like this should work
```
function prop($q, $start, $end) {
foreach ($start as $id=>$keyword) {
$res = false;
if ((strpos($q, $keyword) === 0) && (strrpos($q, $end[$id]) === strlen($q) - strlen($end[$id]))) {
$res = trim(str_replace($end[$id], '', str_replace($keyword, '', $q)));
break;... | Use `strpos` and `strrpos`. If they return 0 the string is at the very beginning/end.
Not that you have to use `=== 0` (or `!== 0` for the inverse) to test since they return `false` if the string was not found and `0 == false` but `0 !== false`. |
3,977,554 | Recently I've been assigned a bug to fix, which from my point of view, was actually a change request. After some investigation it turned out that this bug was caused by a defect in business requirements, but it was still considered as a bug.
I often see change requests being pushed forward masqueraded as bugs. I am ju... | 2010/10/20 | [
"https://Stackoverflow.com/questions/3977554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294915/"
] | A "bug in requirements" means there was something wrong with how the functionality was originally designed.
A "change request" means that everything was defined correct, but the customer wants a piece of functionality changed/added. | It happens all the time.
We as developers generally get annoyed if we get our things thrown back at us as having bugs to fix where it wasn't our fault.
What to do depends on the situation and on the process. Unless you get your performance reviews damaged by those, just don't think of those much and implement those b... |
133,389 | I've downloaded a game (Shank) but the bin file doesn't run. The error that is shown when I try to launch the executable is:
```
bash: ./shank-linux-120720110-1-bin: No such file or directory
``` | 2012/05/07 | [
"https://askubuntu.com/questions/133389",
"https://askubuntu.com",
"https://askubuntu.com/users/53662/"
] | By installing the deb for 32 bit I realized I was missing some libraries (in addition to ia32-libs and libc6). I first solved this problem by giving this command:
```
sudo apt-get install -f
```
Then I got another error:
```
Message: SDL_GL_LoadLibrary
Error: Failed loading libGL.so.1
```
Obviously, t... | As posted in <https://askubuntu.com/a/1035037/676490>
```
sudo apt-get install lsb
```
solved the problem |
14,879,903 | I'm having certain items on my page. When someone hovers an item, I'd like an overlay div over that item. This is working if I'm using the function without `$(this)`, but then it's overlaying all the items. I would like to only overlay the item that I'm hovering at that moment.
My code:
jQuery:
```
<script>
$(docu... | 2013/02/14 | [
"https://Stackoverflow.com/questions/14879903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1852721/"
] | This:
```
$(this).('.item-overlay')
```
is invalid, and should probably be:
```
$(this).find('.item-overlay')
```
In total:
```
<script type="text/javascript">
$(function() {
$(document).on({
mouseenter: function() {
$(this).find('.item-overlay').stop().fadeTo(250, 1);
},
... | ```
$(function() {
$(document).on("mouseenter", ".item" , function() {
$(this).children('.item-overlay').stop().fadeTo(250, 1);
});
$(document).on("mouseleave", ".item" , function() {
$(this).children('.item-overlay').stop().fadeTo(250, 0);
});
```
});
needed "children" |
42,577,526 | Ive want to pull down a list of dates in excel to auto fill a bunch of rows eg. type 03/03/17 and then pull down the cell to auto populate the dates all the way through march.
Normally this is straight forward, but in this instance im trying to get all of the workdays only and no weekend dates, how could that be done... | 2017/03/03 | [
"https://Stackoverflow.com/questions/42577526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1183150/"
] | Put this formula below your first date and then autofill the formula down. make sure your first date is a weekday.
```
=IF(WEEKDAY(A1+1)<>7,A1+1,A1+3)
```
How it works
WEEKDAY(A11+1)<>7 if the cell above + 1 day is not Saturday then add a day A1+1 else add 3 days to the cell above A1+3.
You can copy and paste as v... | The `WORKDAY(Start_date, Days [Holidays])` function returns the Monday to Friday dates based on a Start\_date, number of days and optional Holidays array of dates.
Data Validation allows you to create a list of comma separated items or a named range of cells.
Create a list of Public Holidays in a column and name the ... |
16,122,987 | I was reading about it quite a bit in the past couple of hours, and I simply cannot see any reason (**valid** reason) to call `shutdown()` on the `ExecutorService`, unless we have a humongous application that stores, dozens and dozens of different executor services that are not used for a long time.
The only thing (fr... | 2013/04/20 | [
"https://Stackoverflow.com/questions/16122987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905938/"
] | The `shutdown()` method does one thing: prevents clients to send more work to the executor service. This means all the existing tasks will still run to completion unless other actions are taken. This is true even for scheduled tasks, e.g., for a ScheduledExecutorService: new instances of the scheduled task won't run. I... | >
> Isn't the whole idea for the ExecutorService to reuse the threads? So why destroy the ExecutorService so soon?
>
>
>
Yes. You should not destroy and re-create `ExecutorService` frequently. Initialize `ExecutorService` when you require (mostly on start-up) and keep it active until you are done with it.
>
> I... |
13,508,147 | I have a SQL which counts the number of rows. Say the result is 80.
I would like to have a parameter that is user-input, to be the total. Lets say the user enters 100.
How would I use the two numbers, 80 and 100, to create a pie chart that shows the data takes up 80% of the total?
I cannot find a way to add custom s... | 2012/11/22 | [
"https://Stackoverflow.com/questions/13508147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/883376/"
] | What you could do is:
```
private Thread tMethod1 = new Thread(runMethod1);
private Thread tMethod2 = new Thread(runMethod2);
private Thread tMethod3 = new Thread(runMethod3);
private void runThreads();
{
tMethod1.Start(); //starts method 1
tMethod2.Start(); //starts method 2
tMethod1.Join(); //waits for... | Sounds like you have a multiple-producer-single-consumer problem, with the downloading tasks being producers and giving images to the consumer task to be compared. There is high potential for parallelism here:
```
Download task 1
\
Compare task
/
Download task 2 ... |
881,777 | I came across the use of [Descartes' theorem](http://en.wikipedia.org/wiki/Descartes'_theorem) while solving a question.I searched it but I could only find the `theorem` but *not* any `proof`.Even `Wikipedia` also, just states the theorem!!I want to know the procedure to find the `radius` of the `Soddy Circle`??
I apo... | 2014/07/29 | [
"https://math.stackexchange.com/questions/881777",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/99578/"
] | **Part I** - *Proof of Soddy-Gosset theorem (generalization of Descartes theorem)*.
For any integer $d \ge 2$, consider the problem of placing $n = d + 2$ hyper-spheres touching each other in $\mathbb{R}^d$. Let $\vec{x}\_i \in \mathbb{R}^d$ and $R\_i \in \mathbb{R}$ be the center and radius for the $i^{th}$ sphere. T... | In high-school, my geometry teacher mentioned the Soddy-Gosset theorem and I had been curious about its proof ever since. About 5 years ago, I decided to attempt to prove it and came up with a nice proof and a corollary that, according to my investigation, was unknown, at least in the form that I have.
The first secti... |
41,700,616 | How do I update a `List` object without deleting all objects and appending a record with a specific primary key twice?
For example:
I have a `User` object. This user has many `locations` from type `UserLocation`. If I ask my RESTful API now for all locations (e.g. `/api/users/6/locations`) I want to check if still al... | 2017/01/17 | [
"https://Stackoverflow.com/questions/41700616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3756358/"
] | You can use `UserLocation.create(..., update: true)` for updating the objects with existing primary keys, see more in [docs](https://realm.io/docs/swift/latest/#creating-and-updating-objects-with-primary-keys).
As for deletion you have to manually delete invalid objects, however you don't need to delete if from `Lists... | I had to do similar thing in one of my past projects. I am not sure this is the best way to do that.
```
let realm = try! Realm()
realm.beginWrite()
let locations = User.locations //existing locations
var locIdsAdded : [String] = []
//1. collect existing locations
let existingIds = channels.map({ (loc) -> String in
... |
36,467,031 | I have a XAML page layout defined that includes a `WebView` populated from an HTML string:
```
<WebView HorizontalOptions="Fill" VerticalOptions="FillAndExpand">
<WebView.Source>
<HtmlWebViewSource Html="{Binding Flag.Description}" />
<!-- <HtmlWebViewSource Html="<html><body><p>The HTML string... | 2016/04/07 | [
"https://Stackoverflow.com/questions/36467031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132599/"
] | The accepted answer worked for me but I will add that it only works when you specify a height and width.
There are a few combinations that worked:
1.
define HeightRequest and WidthRequest
```
<WebView Source="{Binding HtmlSource}" HeightRequest="300" WidthRequest="250" />
```
2.
define HorizontalOptions and Vertic... | Seems like Binding `Html` property for `HtmlWebViewSource` just won't work out of the box. I think a `IValueConverter` will do the job. Please have a look how it is done in this [answer](https://forums.xamarin.com/discussion/comment/106437/#Comment_106437). I think that should be enough |
15,246,878 | Method inside the model:
```
public function get_fichas(){
$query = $this->db->query("SELECT * FROM fichas;");
return $query->result();
}
```
Then, I'm trying to pass this data to the controller. Method on the controller:
```
public function listar_fichas(){
$data['fichas_info'] = $this->fichas_... | 2013/03/06 | [
"https://Stackoverflow.com/questions/15246878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1511579/"
] | ```
<td><?php echo $row['cod_produto'] ;?></td>
<td><?php echo $row['nome_produto'] ;?></td>
<td><?php echo $row['versao'];?></td>
```
should be:
```
<td><?php echo $row->cod_produto ;?></td>
<td><?php echo $row->nome_produto ;?></td>
<td ><?php echo $row->versao;?></td>
```
The result set is an object, so each co... | Do this :
```
<?php foreach($fichas_info as $row){?>
<table>
<tr>
<td><?php echo $row->cod_produto ;?></td>
<td><?php echo $row->nome_produto ;?></td>
<td ><?php echo $row->versao;?></td>
</tr>
</table>
<?php }?>
``` |
165,793 | I installed an [Ecosmart 27kw tankless water heater](https://www.amazon.ca/Ecosmart-ECO-24-Modulating-Technology/dp/B002635ODW/ref=pd_rhf_se_s_cr_simh_0_8?_encoding=UTF8&pd_rd_i=B005NM3K2K&pd_rd_r=f44fd24e-3c52-49cf-adfb-102ff733d6b7&pd_rd_w=6XIvH&pd_rd_wg=c8ikG&pf_rd_p=a3d30d92-9f26-4e0d-8f24-fd3e9e75bbfd&pf_rd_r=3R7N... | 2019/05/24 | [
"https://diy.stackexchange.com/questions/165793",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/101692/"
] | Something you might want to consider here is that your phone line inside the house is probably something crappy and unshielded. Cat3, for instance, offers virtually no shielding at all. What I would suggest is upgrading your phone line from the box to your modem with something that is better shielded, like Cat6. If you... | First, make sure that your three supply cables are paired properly. The unit has 3 heaters internally. There are several ways cables could be crossed that would result in power from 1 heater coming up one cable and returning on another cable. The heater would work properly, but would kick stupid large amounts of EMF fr... |
45,254,596 | I am new in **Codeigniter** and I need to show success and error message after `insert` data's in database.
How can I show the message in the `view` page?
This is my coding:
**Model**
```
function addnewproducts($data)
{
if($data['product_name']!="" && $data['product_qty']!="" && $data['product_price']!="" && $... | 2017/07/22 | [
"https://Stackoverflow.com/questions/45254596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7870379/"
] | There are many ways but below is which i recommend:
Set temp session **in controller** on success or error:
```
$res = $this->products->addnewproducts($data);
if($res==true)
{
$this->session->set_flashdata('success', "SUCCESS_MESSAGE_HERE");
}else{
$this->session->set_flashdata('error', "ERROR_MESSAGE_HERE")... | Controller:
```
function addnewproduct()
{
$this->load->model('products');
$data['product_name'] = trim(strip_tags(addslashes($this->input->post('product_name'))));
$data['product_qty'] = trim(strip_tags(addslashes($this->input->post('product_qty'))));
$data['product_price'] = trim(strip_tags(addslashe... |
4,761,767 | I need to display words on a WPF Canvas in such a way that they perfectly fit in pre-defined boxes.
One box typically contains a single line of text, from one letter to a few words.
The text inside a box must be as large as possible, i.e: touching all borders of the box (except maybe where it would cause too much tex... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4761767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93447/"
] | As the answer by Robery Levy said, you can use a `Viewbox` to achieve this. The text itself won't stretch however so you'll still have some "margin" on zero or more sides depending on your text (as you noticed). To work around this you can create a custom control which builds a `Geometry` from a `FormattedText` and the... | Put the TextBlock inside a Viewbox: <http://msdn.microsoft.com/en-us/library/system.windows.controls.viewbox.aspx> |
38,780,207 | So I am currently doing this in my Js script:
```
var someObject = require('./stored');
this.makeDuplicates = function(){
var storeDuplicates = [];
this.addDuplicates = function(astring){
storeDuplicates[astring] = new someObject();
}
this.printDuplicate = function(){
console.log(s... | 2016/08/05 | [
"https://Stackoverflow.com/questions/38780207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4557142/"
] | First, if your intention is not to use a list-like thing, don't use arrays, use objects. Unlike other languages, javascript objects are extensible. That is, you can always add new methods and properties to object instances. Therefore javascript don't have hashes since objects behave in a hash-like manner. To make using... | So I just went back to my code and realized I make an extremely careless mistake. Instead of newDupe.addDuplicates(input), my actual code had
newDupe.addDuplicates("anon") hence the undefined. Nevertheless, I am reading the proper use of this. . |
156,647 | I am building an API platform.
I have already ensured that the platform always returns JSON responses.
My question is
**Should my API platform enforce the rule that all requests must be JSON?
What are the benefits of making all requests to be JSON?**
I understand the benefits of making all responses to be JSON as... | 2012/07/13 | [
"https://softwareengineering.stackexchange.com/questions/156647",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/16777/"
] | Your API needs to be able to understand the request.
How can you do this if you accept random formats.
An API consists of the definition of the formats, acceptable values contained within and the sequence in which they are exchanged.
If you wish you can specify that your API also accepts XML requests, or perhaps pla... | I think this is a question of approach, and you are right on "failing to see the benefits" of such restriction. Your service has a defined API; some of the entries require structured data (commands and data objects), others process streams (file upload). If I see it in this way, I see no problem.
* If you have to acc... |
37,618,679 | I would like to format (round) float (double) numbers to lets say 2 significant digits for example like this:
```
1 => 1
11 => 11
111 => 110
119 => 120
0.11 => 0.11
0.00011 => 0.00011
0.000111 => 0.00011
```
So the arbitrary precision remains same
I expect there is some nice function for... | 2016/06/03 | [
"https://Stackoverflow.com/questions/37618679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3358126/"
] | With little modification to possible duplicate, answer by Todd Chaffee:
```
public static function roundRate($rate, $digits)
{
$mod = pow(10, intval(round(log10($rate))));
$mod = $mod / pow(10, $digits);
$answer = ((int)($rate / $mod)) * $mod;
return $answer;
}
``` | To make sigFig(0.9995, 3) output 1.00, use
if(floor(log10($value)) !== floor(log10(round($value, $decimalPlaces)))) {$decimalPlaces--;}
Said line of code should be placed before declaring $answer.
If input $value is negative, set a flag and remove the sign at the beginning of the function, like this:
if($value < 0)... |
32,200,108 | Note that the question title is:
```
Random math question generation algorithm not working
```
because I can't enter "question" in question title...
---
So I am writing an android app that helps little kids learn maths by giving math questions to them. They can change the number of digits and the type of operation... | 2015/08/25 | [
"https://Stackoverflow.com/questions/32200108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5133585/"
] | what is wrong here is where you use 10 ^ options.get...
that isnt the same as power, you can in turn use Math.pow(10, options.get...)
The problem you have is that the ^ operator does not act as a exponent mod in this case :)
edited code
```
int minValue = (int)(Math.pow(10, (options.getDigitCount () - 1));
int maxVa... | `^` is the XOR operator in Java. Given that, your expressions for max and min value do not make sense. |
148,636 | I need to run a scheduled job every few hours to refresh my API token for a 3rd party source. I want to store that API token in a global variable so I can access it from my controller. (I'm building a SPA within a single Visualforce page so there's only one controller that will be using it).
Is there a standard place ... | 2016/11/14 | [
"https://salesforce.stackexchange.com/questions/148636",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/38084/"
] | This is a bug inside the framework where dynamically created components are not getting properly indexed to their parents. Doesn't look like anyone is actively working on it right now. If you'd like to put some pressure on the devs who own this you can file a case and tell them to link the case to internal bug **W-2529... | as @[techbusinessman](https://salesforce.stackexchange.com/users/8359/techbusinessman) stated, the only **workaround** (so far) to get the value from a dynamically created component is to use :
```
var value = component.get("v.*attributeName*").get("v.value");// for type="Aura.Component"
```
or
```
var value = co... |
51,921 | I am a logic circuits beginner.
We are asked to draw a circuit which takes a four-bit word as input, and outputs true if the word is greater than or equal to 10.
Symbolizing the word as (b1b2b3b4), this translates to (b1 | b2 | b3).
Now b4 is completely useless in the circuit. What is the drawing convention for a com... | 2012/12/21 | [
"https://electronics.stackexchange.com/questions/51921",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/17146/"
] | Firstly, it's conventional to number bits like digits, from the right, and from zero:
```
b3 b2 b1 b0
```
Secondly, you should test your circuit with some testcases, as it doesn't act as a >=10 comparator. For example, it reports true for 9 (1001 binary).
Thirdly, you can just leave things disconnected. I've someti... | You don't say if your 10 is a decimal Ten or a Binary value = decimal two. I'll assume the former. Ten = 1010 which DOES require the 4th input. If the questions was greater than or equal to 7 you'd be right in not needing that input.
b<3:0> is another representation.
a 4 bit value is also known as a nybble |
11,498,616 | I am trying to send bulk of mails but i only receive 500 mails not matter how many mails i send.I am sending mails in loop.Here is a sample.
```
foreach (EmailInfo data in emaildata.ToArray())
{
SmtpClient smtpClient = new SmtpClient();
MailMessage mailMsg = new MailMessage();
smtpClient.Send(mailMsg);
... | 2012/07/16 | [
"https://Stackoverflow.com/questions/11498616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1405921/"
] | Use *boundary* `\b`:
```
\b The match must occur on a boundary
between a \w (alphanumeric) and a \W (nonalphanumeric) character.
```
for example:
```
\b\w+\s\w+\b
```
result is
```
"them theme" "them them" in "them theme them them"
```
so that use:
```
Regex.Replace(inputString, @"(\bb\b)", "20")... | Try to be more specific in your regex rather than just replacing the values. Here are some rules which describes whether a character captured is variable or not
1. Variable must have binary operator(+,-,\*,/) and optinally spaces to its right(if start) ,to its left(if end) or on both side. It can also have paranethis ... |
247,373 | I'm importing data from another system to MySQL, its a CSV file. The "Date" field however contains cryptic of 3-digit time entries, here's a random sample set:
```
> 540
> 780
> 620
> 965
```
What's this? obviously its not 5:40 and 6:20. But it's not UNIX either (I tried 1225295**XXX** before I realized the time ran... | 2008/10/29 | [
"https://Stackoverflow.com/questions/247373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547/"
] | [swatch internet time](http://en.wikipedia.org/wiki/Swatch_Internet_Time)
day is divided into 1,000 equal parts. very metric altogether. | I've seen some systems where the date is stored in a special table and elsewhere as an id to it. This might be one of them |
2,780,076 | I used asp.net in a project in an old company. The vs was licensed etc. Right now, I am planning to use mono since my new company is using linux based stuff and I heard that mono uses the .net framework etc. I just want to know if I need to purchase anything or is it ok to create a webapp using mono? | 2010/05/06 | [
"https://Stackoverflow.com/questions/2780076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194283/"
] | You can create a webapp using mono wihtout buying anything, of course. You only buy from Microsoft the license of Visual Studio, not the .Net compiler nor the Framework. | @SoMoS has the right answer. If you want more detail, and a better explanation of the patent situation, check out the [Mono Licensing page](http://www.mono-project.com/Licensing). |
20,212,665 | Defining a function in c using this structures of data:
```
typedef struct {
int number;
char name[25];
} person;
person rep[100];
int key=0;
```
Is there any problem with memory allocation when defining this function:
(i'm just a beginner: i don't know what memory allocation means)
```
void add_person(int nu... | 2013/11/26 | [
"https://Stackoverflow.com/questions/20212665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2727656/"
] | A function's pointer is something completely different than this.
What you have is a function with a `char *` (`char` pointer). If you call this function, you pass it the contents for a "new" `person` struct.
This `person` struct contains a (rather small) array where the name can be held, so memory allocation (which ... | your function definition is good
just a thing concerning the `key` variable: It should be defined as global variable |
31,063,962 | I'm trying to use toolbar for my project.
Here is the code I am using:
```
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true"
android:background="?attr/colorPrimary"
an... | 2015/06/26 | [
"https://Stackoverflow.com/questions/31063962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3901323/"
] | See the below code and here I added `app:contentInsetStart="0dp"`. You need to add that to your code because before API 21 (i.e. Lollipop) you need to add that line.
```
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_... | **Add below xml code to your Toolbar**
```
<android:contentInsetLeft="0dp"
android:contentInsetStart="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
android:contentInsetRight="0dp"
android:contentInsetEnd="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp">
``` |
2,933,391 | I have read a lot of threads about the joys and awesome points of unit testing. Is there have a good argument against unit testing? | 2010/05/29 | [
"https://Stackoverflow.com/questions/2933391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/202184/"
] | In the places I have previously worked, unit testing is usually used as a reason to run with a smaller testing department; the logic is **"we have UNIT TESTS!! Our code can't possibly fail!! Because we have unit tests, we don't need real testers!!"**
Of course that logic is flawed. I have seen many cases where you can... | * It can discourage experimenting with several variations, especially in early stages of a project. (But it can also encourage experimenting in later stages!)
* It can't replace system testing, because it doesn't cover the relationship between components. So if you have to split up the available testing time between sy... |
36,000,867 | Is there a way to change the responder or select another text view by pressing tab on the keyboard, in Swift?
[](https://i.stack.imgur.com/xnwwN.png)
Notes:
It's for a fill in the blank type application.
My VC creates a list of Words [Word], and ea... | 2016/03/15 | [
"https://Stackoverflow.com/questions/36000867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4093643/"
] | Assuming you want to go from textView1 to textView2. First set the delegate:
```
self.textView1.delegate = self
```
Then implement the delegate method:
```
func textView(textView: NSTextView, doCommandBySelector commandSelector: Selector) -> Bool {
if commandSelector == "insertTab:" && textView == self.textView... | If you want some control over how your field tabs or moves with arrow keys between fields in Swift, you can add this to your delegate along with some move meaningful code to do the actual moving like move next by finding the control on the superview visibly displayed below or just to the right of the control and can ac... |
49 | To improve upon traditional democracy, various alternatives to the normal up down voting have been put forth such as [range voting](http://en.wikipedia.org/wiki/Range_voting). (Range voting is a voting method for one-seat elections under which voters score each candidate, the scores are added up, and the candidate with... | 2012/12/05 | [
"https://politics.stackexchange.com/questions/49",
"https://politics.stackexchange.com",
"https://politics.stackexchange.com/users/21/"
] | [This](https://www.rangevoting.org/VenHist.html) isn't the best source, but supposedly the [Doge](https://en.wikipedia.org/wiki/Doge_of_Venice) of Venice was elected using a 3-point Score/Range system for over 500 years, by placing balls in colored urns.
(Actually it might also be [Combined approval voting](https://en... | Having researched this topic and having found no examples I would like to answer the question: **No**. |
39,506,642 | I am trying to solve a problem in Topcoder, where I need to find the number of rectangles(excluding squares) when the width and length are provided. My code works perfect for all test cases, but for one final test case, ie `592X964` I need to return `81508708664` , which is greater than `2^32-1` , which is greater than... | 2016/09/15 | [
"https://Stackoverflow.com/questions/39506642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4738175/"
] | >
> running this code returns garbage values, I cant see why it does that if the value can be hold by long
>
>
>
Because you're doing `int` multiplication:
```
public static long countRectangles(int m, int n)
// Note ---------------------------^^^----^^^
{
long tot_rect = (long)(((m*m)+m)*((n*n)+n))/4;
//... | Long is 8 bytes which means its range is -2^63 to 2^63 - 1; So it is by far greater then 2^32-1. It is Integer type that is 4 bytes and its range is -2^31 to 2^31-1. So you are perfectly fine with long as you are within range. |
4,338,024 | So I have this contact script which works great in firefox but whenever anyone tries it in ie 7 or 8 the plan always returns array and for the life of me I cant figure out what I did wrong. Any help would be greatly appreciated.
```
<?php
if(!$_POST) exit;
$name = $_POST['name'];
$email = $_POST['e... | 2010/12/02 | [
"https://Stackoverflow.com/questions/4338024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/348843/"
] | `<select name="plan" type="text" id="plan">`
should be
`<select name="plan" id="plan">` | The html `select` element does not have an attribute `type` so perhaps that's confusing IE |
57,328,560 | There's a table storing the time that users listened to music which looks like the follow:
```
+-------+-------+---------------------+
| user | music | listen_time |
+-------+-------+---------------------+
| A | m | 2019-07-01 16:00:00 |
+-------+-------+---------------------+
| A | n | 2019-... | 2019/08/02 | [
"https://Stackoverflow.com/questions/57328560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1755317/"
] | This is a hint.
```
df.groupBy($"user", window($"listen_time", "30 minutes")).agg(collect_list($"music"))
```
The result is
```
+----+------------------------------------------+-------------------+
|user|window |collect_list(music)|
+----+------------------------------------------... | This will work for you
```
val data = Seq(("A", "m", "2019-07-01 16:00:00"),
("A", "n", "2019-07-01 16:05:00"),
("A", "x", "2019-07-01 16:10:00"),
("A", "y", "2019-07-01 17:10:00"),
("A", "z", "2019-07-02 18:10:00"),
("A", "m", "2019-07-02 18:15:00"),
("B", "t", "2019-07-02 18:15:00"),
("B", "s", "2019-07-02 18:20:00"... |
7,524 | If a photo is over or under exposed but not to the point of clipping (histogram does not reach the left or right side) is there any reason you couldn't just fix the exposure in Photoshop or Lightroom? Obviously you wouldn't ultimately want a photo that is to bright or too dark, but is any actual information lost if the... | 2011/01/23 | [
"https://photo.stackexchange.com/questions/7524",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/1431/"
] | Yes, you can correct a little bit; That's what the exposure sliders in Aperture/Photoshop/Lightroom are for, and it's one of the reasons RAW can be a better choice than JPEG.
However, some information is hidden by noise, and you're better off changing ISO in camera to get a proper exposure than underexposing and corre... | You can, but there is only so much data, at some point you are going to hit the case where the light colors are all the same or the dark colors are all the same. To really understand this go look an Ansel Adam's "The Zone System" and understand what he was doing in B&W film 60 years ago. |
11,017,655 | CSS: Is it possible to specify a style to a fieldset before another fieldset? When Two fieldset follow in my code I would like to apply them a specific style.
EDIT Without using class and id of course...
Here is my code
```
<div id="tabs">
<fieldset class="one">
<legend>One</legen... | 2012/06/13 | [
"https://Stackoverflow.com/questions/11017655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196526/"
] | Without using any classes or id's you can use `first-child` to target the first one and then use the default styling for second.
e.g.
```
form fieldset{ background: green; }
form fieldset:first-child{ background: red; }
```
First fieldset will have a red background, any others will have a green background. Note tho... | If you don't want to use classes or id's but still want them to have different styles, how about using inline CSS for each fieldset?
Is there a particularly good reason to avoid classes and id's while still wanting to use CSS? With a little more detail, we can probably give you a better answer. |
25,485 | I want to be able to record band practices and then quickly create mp3s and send them out. Fidelity doesn't matter so much, right now I'm using garage band, creating an m4a from garage band and then using ITunes to convert that file to mp3. The last step is emailing out the mp3s (or uploading them to ftp server).
Is ... | 2011/01/03 | [
"https://sound.stackexchange.com/questions/25485",
"https://sound.stackexchange.com",
"https://sound.stackexchange.com/users/-1/"
] | [Audacity](http://audacity.sourceforge.net/) is a nice open source audio editor that can record, edit and export to mp3. | Have you tried automating some of the steps with [Automator](http://support.apple.com/kb/HT2488)? |
45,080,142 | I've been trying to vectorize a for loop in Matlab because it bottlenecks the whole program but I have no clue about how to do it when iterating on different rows or columns of a single matrix inside of the loop. Here's the code :
```
// X is an n*k matrix, W is n*n
// W(i,j) stores the norm of the vector resulting fr... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45080142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4513390/"
] | Using combinatory:
```
% sample data
X = randi(9,5,4);
n = size(X,1);
% row index combinations
combIdx = combvec(1:n,1:n);
% difference between row combinations
D = X(combIdx(1,:),:)-X(combIdx(2,:),:);
% norm of each row
W = diag(sqrt(D*D'));
% reshape
W = reshape(W,n,[]);
``` | * If you have the Statistics Toolbox, use [`pdist`](https://es.mathworks.com/help/stats/pdist.html):
```
W = squareform(pdist(X));
```
* No toolbox: good old [`bsxfun`](https://es.mathworks.com/help/matlab/ref/bsxfun.html):
```
W = sqrt(sum(bsxfun(@minus, permute(X, [1 3 2]), permute(X, [3 1 2])).^2, 3));
``` |
14,893,043 | I'm working on a custom provider that works exactly like a classical user form, however I have to give a second parameter to identify the user: a websiteId (I'm creating a dynamic website plateform).
So a username is no more unique, but the combinaison of username and websiteId it is.
I successfully created my custo... | 2013/02/15 | [
"https://Stackoverflow.com/questions/14893043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/875519/"
] | Firewall::onKernelRequest is registered with a priority of 8 (sf2.2). A priority of 9 should ensure that your listener is called first (works for me).
I had a similar problem, which was to create subdomain-specific "Campaign" sites within a single sf2.2 app: {campaign}.{domain} . Every User has many Campaigns and I, l... | As you can see in the SecurityExtension.php The factories used do not have any sort of priority system. It just adds your factory to the end of the array, that's it.
Therefore it is impossible to put your custom authentication before that of symfony's security component.
An option may be to override the DaoAuthenticat... |
2,431,365 | This is more a use-case question, but I generate static files for a personal website using txt2tags. I was thinking of maybe storing this information in a git repository. Normally I use RCS since it's simplest, and I'm only a single user.
But there just seems to be a large trend of people using git/svn/cvs/etc. for pe... | 2010/03/12 | [
"https://Stackoverflow.com/questions/2431365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/421924/"
] | I version all of my data. I commit each time I change it.
Versionning my code allow a backup too. | Use git. Git gives you the convenience of offline commits plus the ability to push changes to other machines. I keep my configuration files (screen, shell, emacs,...) in git to have them synchronized between my machines. Also makes it dead-easy to get your custom setup on a machine you're only temporarily using.
Split... |
5,199,296 | In eclipse I have created a .target file where I add features from remote eclipse p2 sites.
Now I would like to create a local p2 site which is a copy of the aggregated features defined in the target definition (and preferably for all environments).
I need this local p2 site to be used with a build system using maven... | 2011/03/04 | [
"https://Stackoverflow.com/questions/5199296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/363603/"
] | `#!/usr/bin/env rvm 1.9.3@mygemset do ruby` | Check out this gist :
<https://gist.github.com/343545>
HTH |
33,916,538 | ```
import java.util.Scanner;
public class abc {
public static void main(String[] args) {
char[] ch = str.toCharArray();
int len = ch.length;
for (int i = 0; i < len; i++) {
int counte = 0;
char c = str.charAt(i);
for (int j = 0; j < len; j++) {
... | 2015/11/25 | [
"https://Stackoverflow.com/questions/33916538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5604102/"
] | ```
Try this below code. It may help you to generate the random date.
--Creation of dummy table
CREATE TABLE RANDOM_TEST
( num NUMBER, DATE_COL DATE
);
--IOnsertion of dummy data
INSERT INTO RANDOM_TEST
SELECT LEVEL,NULL FROM DUAL
CONNECT BY LEVEL < 10;
-- Updating values with some random data
MERGE INTO RANDOM... | for insert you can use
```
insert into test_table
SELECT level,TO_DATE( TRUNC( DBMS_RANDOM.VALUE(TO_CHAR(DATE '2015-12-01','J'),TO_CHAR(DATE '2016-08-01','J'))),'J') FROM DUAL
connect by level<100;
```
for update you can try this...
```
UPDATE vish_test a
SET a.idate = (SELECT TO_DATE( TRUNC( DBMS_RANDOM.VALUE(... |
38,091,542 | More of a curious question rather than solving an actual problem.
How do frameworks like angular contain CSS within a component and prevent the CSS from leaking all over the page? | 2016/06/29 | [
"https://Stackoverflow.com/questions/38091542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4093621/"
] | One thing you have to be clear is that HTML loaded sequentially.
In your code
```
...........................
<script src="index.js"></script>
................
....................
<h1 id="test">Should this change?!</h1>
```
Here the JavaScript loaded first then the remaining html.
As the JavScript will exe... | ```
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Design All</title>
<script src="index.js"></script>
</head>
<body onload = "chng()">
<h2>------------------------</h2>
<h1 id="test">Should this change?!</h1>
<h2>-------------------... |
46,747 | I've tried a few time to roast gammon, typically my method is to soak the gammon and then roast for a few hours. The result is typically just this side of editable. I've even tried boiling it first (after a suggestion that this removes the salt), but to no avail.
Does anyone have any suggestions? | 2014/08/30 | [
"https://cooking.stackexchange.com/questions/46747",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/1710/"
] | Soak at least overnight. In addition to that, consider a sweet glaze like apricot, or an acidic one like one that includes cider vinegar. Best yet might be all three, an overnight soak (change the water a few times) and a sweet, acidic glaze.
If you *still* find it too salty, go ahead and try boiling briefly in fresh ... | Heavily salted meats, like gammon, speck, country ham, proscuito di parma and such aren't intended to be eaten as a steak or roast.
They're typically used in small amounts as flavoring in other dishes.
If you're looking to roast a ham, you'll want to find a different variety that isn't as heavily salted. There are 'f... |
266,009 | I have a function called `USB()`, that will observe a [USB stick's](https://en.wikipedia.org/wiki/USB_flash_drive) insertion and delete files inside of it, if there are some:
```
import os
import shutil
# 1. Check and clean USB
def USB():
usb_inserted = os.path.isdir("F:") # <-- returns boolean...checks whether ... | 2021/08/12 | [
"https://codereview.stackexchange.com/questions/266009",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/231109/"
] | A production-grade solution would not have a polling loop at all, and would rely on a filesystem change notification hook. There are [many, many ways](https://stackoverflow.com/questions/182197/how-do-i-watch-a-file-for-changes) to do this with varying degrees of portability and ease of use; if I were you I'd use somet... | Making a program to delete everything on a USB stick is dangerous. Consider listing current contents and asking for confirmation, to make sure you don't accidentally wipe the wrong stick or drive. |
65,332,141 | After upgrading my MacBook Pro to OS X 11.1 Big Sur, I am unable to get compilation of c++ programs using gcc to work.
I am using CLion with CMake, and I get the following error when reloading the CMake configuration
```
ld: library not found for -lgcc_s.10.4
```
The things that I have tried are installing Xcode, i... | 2020/12/16 | [
"https://Stackoverflow.com/questions/65332141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4567066/"
] | [According to this answer](https://stackoverflow.com/questions/40034457/os-x-installed-gcc-links-to-clang) you should use: `g++-10 -o main main.cpp`
* The correct path of brew installed g++ in MacOS is:
```
$ which g++-10
> /usr/local/bin/g++-10
--
$ which g++
> /usr/bin/g++ //this is alias of clang (same for lyb)
... | I spent hours trying to solve this compilation problem with cmake, the original statement in `CMakeLists.txt` for library linkage is!
```
link_directories(/usr/local/lib)
target_link_libraries(Program libsndfile.dylib)
```
With error message after make:
>
> ld: library not found for -lsndfile
>
>
>
The solutio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.