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 |
|---|---|---|---|---|---|
18,134,815 | I've been learning C++, and this chunk of code is from a simple grading program. But when I try to get the user input, there's a problem.
If I enter a number, whether it be less than 0 or more than 100, or anything in between, my loop works fine.
But if I type in any letter, or any non-alphanumeric character (ex: +, (... | 2013/08/08 | [
"https://Stackoverflow.com/questions/18134815",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2597201/"
] | If cin does not receive valid input for the data type (int), the variable grade is not changed and remains at -1. You can test whether the input was successful like so
```
bool success = (cin >> grade);
if (! success)
{
cin.clear();
cout << "bad input\n";
break;
}
```
You can also use this as a shortcut ... | Correctly and safely reading until you get valid input is far trickier than you'd think. If there's invalid input, like a letter, the stream is set in a "failure" state, and refuses to read any more characters until you clear the state. But even if you clear the state, that input is still waiting there, in the way. So ... |
70,372,175 | Firstly, my apologies for the vague tittle. I have two tables: **Devices** and **DeviceProperties**.
```
[ Devices ]
[ id ]
[ AA ]
[ BB ]
[ CC ]
[ DeviceProperties ]
[ id ][ propertyType ][ propertyKey ][ valueType ][ value ]
[ AA ][ desired ][ scanInterval ][ Number ][ 100 ]
[ AA ][ ... | 2021/12/16 | [
"https://Stackoverflow.com/questions/70372175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5132661/"
] | Insert the required matching criteria in a temp table
```
insert into #temp (propertyType, propertyKey, valueType, value)
values ('desired', 'scanInterval', 'Number', 100),
('tag', 'floor', 'Number', 200);
```
Join it to your table, `GROUP BY` `id` and count for matching rows must be `N`. For the e... | Squirrel gave me an idea. Not sure if this is an ideal approach or not but I could also do something like this:
```
select
d.deviceId
from
Devices as d
join
DeviceProperties as p
on
d.deviceId = p.deviceId
where
p.propertyType in (@pt_0, @pt_1) and
p.propertyKey in (@pk_0, @pk_1) and
p.va... |
1,940,731 | [](https://i.stack.imgur.com/OF1ll.jpg)
I don't see any angles in terms of $x$ , or why $\triangle ODE$ is isosceles I would highly appreciate your hints | 2016/09/25 | [
"https://math.stackexchange.com/questions/1940731",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/366082/"
] | There's a much easier way to see this. Think of complex numbers as points in the plane. The number $i$ is the point on the $y$ axis one unit from the origin.
We want to find a point $z$ which, translated to the right by a certain amount, moves exactly to $i$. This is because we are adding a positive real number to $z$... | with $$z=a+bi$$ you will get the equation
$$\sqrt{a^2+b^2}+a+bi-i=0$$ this is equivalent to
$$\sqrt{a^2+b^2}+a+i(b-1)=0$$ from here we get
$$b=1$$
and $$\sqrt{a^2+b^2}+a=0$$
from the second equation we get
$$\sqrt{a^2+b^2}=-a$$
squaring gives
$$a^2+b^2=a^2$$ substracting $a^2$ gives $$b=0$$
this is a contradiction to ... |
27,210,279 | The purpose of the program is to make comments in the file begin in the same column.
if a line begins with ; then it doesn't change
if a line begins with code then ; the program should insert space before ; so it will start in the same column with the farthest ;
for example:
Before:
```
; Also change "-f elf " for "... | 2014/11/30 | [
"https://Stackoverflow.com/questions/27210279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4307962/"
] | Here is the solution, assuming that comments in your file begin with the first semi-colon (`;`) **that is not inside a string**:
```
$ cat tst.awk
BEGIN{ ARGV[ARGC] = ARGV[ARGC-1]; ARGC++ }
{
nostrings = ""
tail = $0
while ( match(tail,/'[^']*'/) ) {
nostrings = nostrings substr(tail,1,RSTART-1) sp... | There are a few `printf` tricks that make this a manageable project. Take a look at the following. The script formats the assembly file with the assembly code beginning at column `0` to `code_width - 1` with the comments following at column `code_width` lined up after the code. The script is fairly well commented so yo... |
24,258,319 | i am trying to store image in sql on server. Later i want to make these image available for download. Which approach is good:
1. By uploading image and saving path.
or
2.By converting image to base64 and then storing as BLOB type | 2014/06/17 | [
"https://Stackoverflow.com/questions/24258319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1966655/"
] | Foundation 5 tabs have been switched from `ul` to `dl` below is the structure the want
```
<dl class="tabs" data-tab>
<dd class="active"><a href="#panel2-1">Tab 1</a></dd>
....
```
[link on git](https://github.com/zurb/foundation/blob/cc02ba23bed58145c0273955262b2738b7a82d29/doc/includes/tabs/examples_tabs_bas... | nolawi petros' answer is the correct one: they changed the syntax without updating the documentation.
Here is the full syntax (same as the one nolavi linked to, just a bit shorter):
```
<dl class="tabs" data-tab>
<dd class="active"><a href="#panel2-1">Tab 1</a></dd>
<dd><a href="#panel2-2">Tab 2</a></dd>
</dl>
<... |
48,997,983 | Using the code below I get values for `precision`, `recall`, and `F scores` but I get `None` for `support`
```
import numpy as np
from sklearn.metrics import precision_recall_fscore_support
ytrue = np.array(['1', '1', '1', '1', '1','1','1','1','0'])
ypred = np.array(['0', '0', '0', '1', '1','1','1','1','0'])
precision... | 2018/02/26 | [
"https://Stackoverflow.com/questions/48997983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This is probably because you use php 7.2 which Magento doesn't support currently, even in 2.3 pre-release. You can downgrade to php 7.1.X and use Magento 2.2.X or downgrade to php 7.0.7.X and use Magento 2.1.X.
More information about Magento versions and its php support [here](http://devdocs.magento.com/guides/v2.1/in... | Change
```
while (list($name, $value) = each($options)) {
$this->setOption($name, $value);
}
```
To
```
foreach ($options as $name => $value){
$this->setOption($name, $value);
}
```
Reference in: <https://community.magento.com/t5/Installing-Magento-2-x/Deprecated-The-each-function-is-deprecated/td-p/80126> |
48,314,481 | Can anyone point me in the right direction why this sql query got an error?
<http://sqlfiddle.com/#!9/40058/2>
Expected results is to
get the names of Product on a table,
the count of sales on that product,
The amount (transactionamount)
and the net amount (statementdebit) | 2018/01/18 | [
"https://Stackoverflow.com/questions/48314481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1902777/"
] | a transaction is a keyword please cover it with **backtick** `transaction`
you are missing one parenthesis after **transaction.transactionamount**
another thing `COUNT ()`, `SUM ()` should be like `COUNT()`,`SUM()` no extra spaces required in function.
```
SELECT
DISTINCT `transaction`.transactionservicetype AS Pr... | hope it will help you, i'm bit confuse because your table naming field naming.
this my solution
<http://sqlfiddle.com/#!9/40058/83/0>
sql query :
```
SELECT sum(a.statementdebit) debit,count(a.statementdesc) tot_prod,
sum(b.transactionamount) amount,a.statementdesc
FROM
statement a
JOIN transaction b on a.trans... |
39,248,802 | I have public function beforeDelete() in almost every class of CMS. Unfortunately some clever people before me created some of them with `($rowId)` param and some of them with no parameters at all.
Parent `Main_Admin_Module` has empty function declaration like this:
```
public function beforeDelete() {}
```
but be... | 2016/08/31 | [
"https://Stackoverflow.com/questions/39248802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3553976/"
] | It appears to me that the base method is an unnecessary burden, since it doesn't do anything and enforces rules that cannot be followed by all subclasses. Especially if it's called with different parameters under different circumstances, this method shouldn't be a part of the common API of `Admin_Module_Main` class.
M... | One of the solution to avoid this error if you don't want to fix code in all classes is to change the error\_reporting level. Go to your php.ini configuration and update error\_reporting in a way like.
```
error_reporting = E_ALL & ~E_STRICT
```
or do in the code
```
error_reporting(E_ALL ^ E_STRICT);
```
E\_STRI... |
23,433,442 | I'm trying to solve the following problem:
Given a 3x3 grid with numbers 1-9, for example:
```
2 8 3
1 4 5
7 9 6
```
I have to sort the grid by rotating a 2x2 subgrid clockwise or counter-clockwise. The above example could be solved like this:
Rotate the top left piece clockwise:
```
2 8 3 1 2 3
1 4 5 =>... | 2014/05/02 | [
"https://Stackoverflow.com/questions/23433442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1930935/"
] | A variant of the already proposed solution would be to generate a lookup table.
As already mentioned there are at most
```
9! = 362880
```
possible permutations for your matrix.
Each permutation can be represented using a 9-digit number containing each digit between 1 and 9 exactly once. We do this by reading the ... | >
> *I apologize for writing a new answer, but I can't comment on invin's answer (due to not having 50 reputation) so I had to do it here.*
>
>
>
This BFS algorithm could be additionally optimized by making sure you're not expanding from any already visited states.
With [factoradic](http://en.wikipedia.org/wiki/... |
547,255 | In a frictionless environment, why doesn't an object move at infinite acceleration if force is applied on it?
Force causes movement, so unless there is an opposing force there shouldn't be any reason for the force to cause infinite acceleration. | 2020/04/27 | [
"https://physics.stackexchange.com/questions/547255",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/262090/"
] | Because in a no friction environment an object obeys Newton's second law when a force is applied to it,
$$F=ma \tag{1},$$
the acceleration is decided by the mass of the object. When you apply a force to an object its mass decides how much it "resists" being moved by the force. | With light you could apply a force on a body, see [radiation pressure](https://en.wikipedia.org/wiki/Radiation_pressure) on Wikipedia.
No other particles respectively bodies are moving faster than light, at least we haven't found any other.
Even if you can run at no more than 30 km/h, you can throw a ball with your a... |
97,350 | I was reading a blogpost here: <http://mzargar.wordpress.com/2009/07/19/cauchys-method-of-induction/> ([Wayback Machine](http://web.archive.org/web/20120309055020/https://mzargar.wordpress.com/2009/07/19/cauchys-method-of-induction/))
One thing that threw me off was that after the first four large displayed equations,... | 2012/01/08 | [
"https://math.stackexchange.com/questions/97350",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/22569/"
] | **Hint** $\ $ This can be viewed as a sort of *interval* (or *segment*) induction.
**Lemma** $\rm\ S\subset \mathbb N\:$ satisfies $\rm\:n+1\in S\:\!\Rightarrow n \in S\:$ iff $\rm\:S\:$ is an initial segment of $\:\mathbb N$
**Proof** $ $ (hint) $ $ If $\rm\:S\ne \mathbb N\:$ then $\rm\:S = [0,m)\:$ for the least $... | You seem to be confused with the method of infinite descent which is used to prove that something is FALSE :
If $P(0)$ is false and if $P(n)$ implies that there exists a $m < n$ such that $P(m)$, then $P(n)$ is false for all $n$.
This correspond to prove the anteposition of the standard recurrence principle. (The antep... |
16,648,602 | Today I was investigating on something with Fiddler, when I noticed that, when I launch Google Chrome, I have always 3 HEAD requests to some domains which seem to be randomly chosen.
Here is a sample :
```
HEAD http://fkgrekxzgo/ HTTP/1.1
Host: fkgrekxzgo
Proxy-Connection: keep-alive
Content-Length: 0
User-Agent: Moz... | 2013/05/20 | [
"https://Stackoverflow.com/questions/16648602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1814670/"
] | This is Chrome checking to see if your ISP converts non-resolving domains into your.isp.com/search?q=randomnonresolvingdomain
See <https://mikewest.org/2012/02/chrome-connects-to-three-random-domains-at-startup> | This algorithm seems unusable with forward proxy servers. Browser definitely asks for random page and proxy definitely returns some page -- error (50x), masked error (50x or 40x) or nice "you are lost" page with HTTP code 200 . |
1,263,074 | I've got a very simple html unordered list:
```
<ul>
<li>First</li>
<li>Second</li>
</ul>
```
The problem is that the default styling for such a list in firefox leaves a lot of space between each list item - about the same as between paragraphs in a `<p>` tag. My google-fu is proving uncharacteristically useless tod... | 2009/08/11 | [
"https://Stackoverflow.com/questions/1263074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19074/"
] | The properties margin and padding are the correct approach.
I want to add the advice to reset your complete css with a predefined reset-css-file, like this one by Eric Meyer: [Link](http://meyerweb.com/eric/tools/css/reset/index.html)
After this you have the option to control your styles more specified. | ```css
ul {
font-size: 0;
}
ul li {
display: inline;
font-size: 16px;
}
```
Always works! |
10,555,288 | I am parsing a large text file and then calling a rate-limited Google API (mail migration) (The api docs state 1 second per call).
Even when I have Utilities.sleep(1000); inside my loop, I'm still getting this error even though I'm only setting the property one time during the loop:
>
> Service invoked too many time... | 2012/05/11 | [
"https://Stackoverflow.com/questions/10555288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1389683/"
] | Unfortunately the exact short term rate limits aren't exposed. You may want to try to increase your sleep amount, in the hopes of going above the threshold necessary to avoid the error. Ultimately I think your analysis is correct, that you should look into writing to the user properties less often. I'm not sure the Cac... | It really depends on the design of your app. If you are parsing the information and can aggregate that into a summary it would take less calls. Maybe sending as an email is not optimal. Could the parsed data go somewhere else and then direct the user there instead of sending emails? |
12,168,236 | I have for one customer entity multiple viewmodels depending on the existing views like Create,Update,Get,Delete. These viewmodels share the same properties up to 75% with the entity.
Should I better merge all the customer viewmodels to one big viewmodel?
So I have to map only and always from one entity to one viewmo... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12168236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401643/"
] | As said in other answers, you should set the 'selected' option.
What some people don't mention is that your selected array should only contain the id in each element.
Example:
```
$selectedWarnings = $this->Warning->find('list', array(
'fields' => array('id')
));
echo $this->Form->input('email_warning_chb', array(
... | in your controller you have to put the value like this:
```
$this->request->data['Model']['email_warning_chb'] = array(5,15,60);
```
and it will automatically display checkbox as selected.
Please ask if not work for you. |
771,819 | After installing my program on a windows vista premium, I'm getting the following exception.
The view that must be shown contains following controls: 2 textboxes, 3 labels, a button and linkbutton.
```
System.OutOfMemoryException: Out of memory.
at System.Drawing.Graphics.FromHdcInternal(IntPtr hdc)
at System.W... | 2009/04/21 | [
"https://Stackoverflow.com/questions/771819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60572/"
] | Does your app make use of any custom controls or controls you've written yourself? Can you repro this problem with a very simple form?
This...
<http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/4bc34266-edf9-430c-ad5a-c6e29392eb2d>
... and this...
<http://social.expression.microsoft.com/Forums/zh-C... | Might it be possible that you only detected this on a Vista box because there is less free memory than on your Windows XP boxes? If the machines are roughly the same spec then I would guess the Vista box would have less memory free and therefore highlight issues with memory leaks more quickly.
The other possibility is... |
1,098,372 | I am having a disaster. My Ubuntu can not boot. The problem is summarised [here](https://askubuntu.com/questions/1098366/ubunut-18-04-failed-to-boot-faile-to-start-mysql-community-server)
I read about Ubunut recovery mode. I followed these [instructions](https://wiki.ubuntu.com/RecoveryMode). I selected `Drop to root ... | 2018/12/04 | [
"https://askubuntu.com/questions/1098372",
"https://askubuntu.com",
"https://askubuntu.com/users/836841/"
] | Thanks to those tried to help. I solved the issue by following the same steps in the question to use recovery mode. Then I choose `Clean` (instead of `Drop to root shell prompt`). This provided few hundreds MB which allowed me to boot. | I can't make comments, but I want to help anyway.
You should try booting a live ubuntu disc/USB and select "Try without installing".. You'll get a fully working environment and automounting for your HDD and external drives. While at it you can delete at least a couple files to make some room and you'll be able to boo... |
89,357 | I have an odd situation: I have a coworker who acts like he's my boss. I've already confirmed with higher-ups that it's just not true.
He'll say all kinds of things like:
>
> *This is my department*.
>
> *I run this department*.
>
> *This is MY analyst*. (referring to me)
>
> *I need to decide how to manage... | 2017/04/18 | [
"https://workplace.stackexchange.com/questions/89357",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/68769/"
] | >
> Any suggestions on how to handle this?
>
>
>
You need to be a bit more assertive here and put him in his place without going over the top.
Take him aside and have a private, calm talk. Something like "X, we both know that you are not my boss. Let's stop pretending that you are, okay?" should help.
And the ne... | I was once like a milder version of your coworker! Not that creepy, bossy or old but just 2 years in my job I enjoyed delegating work to my junior colleagues. It took just couple of subtle hints from them that they did not appreciate me asking them to do something.
Point is that this has to be communicated to your cow... |
3,511,758 | Is there any way to remove the minus sign when in editing mode and displaying only the reorder icon?
Trying since long time. Somehow succeeded in removing the indentation of table but still failed to remove the minus sign.
Also i want the reorder icon appear permanently on screen so the table view will always be in ... | 2010/08/18 | [
"https://Stackoverflow.com/questions/3511758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/363363/"
] | This is not surprising at all.
Your first constructor seems ok, the second one does miss the allocation for v.
Edit: v1 = x and v2 = y doesn't make sense without overloading operator=. | I hope this is homework!
Otherwise you should be using std::Vector
Couple of problems:
* A constructor should initialize all members.
+ Neither constructor does this.
* The copy constructor (or what seems to be) is not defined incorrectly.
* Because your class manages a RAW pointer you need to see "The rule of th... |
66,693,229 | I have an array as follows
```
[0=>['classId'=>2,'Name'=>'John'],1=>['classId'=>3,'Name'=>'Doe'],2=>['classId'=>4,'Name'=>'Stayne']]
```
I need to remove the elements with classId 2 or 4 from array and the expected result should be
```
[0=>['classId'=>3,'Name'=>'Doe']]
```
How will i achieve this without using a ... | 2021/03/18 | [
"https://Stackoverflow.com/questions/66693229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6654773/"
] | You can use `array_filter` in conjunction with `in_array`.
```
$array = [0=>['classId'=>2,'Name'=>'John'],1=>['classId'=>3,'Name'=>'Doe'],2=>['classId'=>4,'Name'=>'Stayne']];
var_dump(
array_filter($array, function($item){return !in_array($item["classId"], [2,4]);})
);
```
Explanation
-----------
**`array_fi... | Try this:
```
foreach array as $k => $v{
if ($v['classId'] == 2){
unset(array[$k]);
}
}
```
I just saw your edit, you could use array\_filter like so:
```
function class_filter($arr){
return ($arr['classId'] == "whatever");
}
array_filter($arr, "class_filter");
```
Note: you'll still need to l... |
1,373 | Can i configure Tridion 2011 SP1 to publishing over FTPS protocol (FTP over SSL)? | 2013/05/21 | [
"https://tridion.stackexchange.com/questions/1373",
"https://tridion.stackexchange.com",
"https://tridion.stackexchange.com/users/175/"
] | As mentioned already, your requirements match exactly what the Media Manager Connector is designed to do.
I do not know what the "Stub schema component" you refer to is. Basically MMC will create stub components (one for each distribution you for example link to), and a single schema that will be used by the stub comp... | ECL, which is what is used for the Media Manager Connector, currently does not have a separate Schema for each sub-type. Which means that you can only create a link (by using the ECL stub Schema) to all of the items that your ECL provider contains.
The ECL stub Schema is created in the stub folder you set under the `S... |
249,887 | Is it possible to view 2 apps at the same, eg. 2 × Mail, in Split View? | 2016/08/19 | [
"https://apple.stackexchange.com/questions/249887",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/197019/"
] | **This is not possible in iOS 9.** Only one instance of an app can run at any given time.
There is a small change in iOS 10 allowing two instances of **Safari** to run concurrently, but that is a special case. To do that, long-press a link, and select `Open in Split View`. | This can be done only on a newer **iPad** or **iPhone 6 Plus**. running **iOS 9 or higher**. You will notice that these apps are not contained into 1 app, they are each running independently of the other. You can view each app and interact with each app but they can't communicate with each other (other than what's alre... |
15,103,944 | I'm a java novice. Is it possible to get data from a website and then store it in some sort of data structure? For example, the program gets the value of a stock from yahoo finance at a given time and stores it. Like I said, I'm not that proficient with Java and I'd like to know if this could be done. If it can be, is ... | 2013/02/27 | [
"https://Stackoverflow.com/questions/15103944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2113277/"
] | I've used [JSoup](http://jsoup.org/) extensively. If you only need to customize a program to extract data from a website whose layout or structure does not change often, `JSoup` would be enough and handy.
Assuming you know the basics about how to program(not necessarily familiar with `Java`) and understand what consti... | Yes you can download arbitrary web page into a Java string and parse the contents, however such solution wouldn't be reliable. If the author changes the structure of the website your code would immediately break.
Popular way of doing such integration is by [RESTful web service](http://en.wikipedia.org/wiki/Representat... |
47,194,100 | When I add behavior='autocomplete' to my input field, width is changing and not scaling anymore with browser/screen resize.
Someone experienced with easyAutocomplete has the same problem?
Thank you very much.
This code without data-behavior IS RESPONSIVE
```
<form>
<input class="form-control" type="text" plac... | 2017/11/09 | [
"https://Stackoverflow.com/questions/47194100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8152465/"
] | You can use easy-autocomplete like below, no need to put data-behavior.
Also, you need to override CSS applied by the easy-autocomplete library.
```js
var options = {
data: ["blue", "green", "pink", "red", "yellow"]
};
$("#example").easyAutocomplete(options);
```
```css
.easy-autocomplete{
width:100% !importa... | With your jQuery easyautocomplete plugin you just need to set option adjustWidth to false and then you don’t need to touch your CSS.
```
var options = {
...
adjustWidth: false,
...
};
$("#example").easyAutocomplete(options);
``` |
50,655 | ***Doctor Who*** has a long history of multi episode stories, sometimes two or three in a row. Series 9 of New Who has a couple (1/2, 3/4, 7/8).
But I can't seem to confirm if episode 5 "***The Girl Who Died***" and Episode 6 "***The Woman Who Lived***" are a two part story. They both focus on Ashildr, later self-name... | 2016/03/23 | [
"https://movies.stackexchange.com/questions/50655",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/23541/"
] | Officially, yes and no.
-----------------------
Before the series started airing, pre-production publicity said that *The Girl Who Died* and *The Woman Who Lived* would be two parts of the same story, although a more loosely linked two-parter than many of the others in the series. From [this article](http://www.digita... | "The Girl Who Died" and "The Woman Who Lived" are not a two-parter and neither are "Heaven Sent" and "Hell Bent". Steven Moffat confirmed in DWM that the episodes are standalones.
"Heaven Sent" and "Hell Bent" were produced separately and did not have a TBC. While "The Girl Who Died" had a TBC, that doesn't necessari... |
59,532,087 | The below code works in scala-spark
```
scala> val ar = Array("oracle","java")
ar: Array[String] = Array(oracle, java)
scala> df.withColumn("tags",lit(ar)).show(false)
+------+---+----------+----------+--------------+
|name |age|role |experience|tags |
+------+---+----------+----------+--------------+
... | 2019/12/30 | [
"https://Stackoverflow.com/questions/59532087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6867048/"
] | I found the below list comprehension to work
```
>>> arr=["oracle","java"]
>>> mp=[ (lambda x:lit(x))(x) for x in arr ]
>>> df.withColumn("mk",array(mp)).show()
+------+---+----------+----------+--------------+
| name|age| role|experience| mk|
+------+---+----------+----------+--------------+
| John... | There is difference between `ar` declare in `scala` and `tag` declare in `python`. `ar` is `array` type but `tag` is `List` type and `lit` does not allow `List` that's why it is giving error.
You need to install `numpy` to declare `array` like below
```
import numpy as np
tag = np.array(("oracle","java"))
```
Just... |
33,750,760 | Today i come across the peculiar behaviour of equlaity operator.
I’d expect the answer to be false. We’re testing for reference equality
here, after all – and when you box two values, they’ll end up in different boxes, even if the values are the same, right
```
Object x = 129;
Object y = 129;
boolean equality = (x =... | 2015/11/17 | [
"https://Stackoverflow.com/questions/33750760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3848411/"
] | == is a reference comparison. It looks for the "same" object instead of "similar" object.
Since values between -128 to 127 are returned from cache and the same reference is returned, your second comparison returns true.
But values above 127 are not returned from cache so the reference differs and your first comparison ... | It is always recommended to use `object1.equals(onject2)` to check for equality because when you compare using **`==`** it is **reference comparison** and not comparison of value. |
30,676,949 | I have an olap cube which i want to access. I am trying to execute mdx query. here is my simple test program:
```
static void Main(string[] args)
{
using (OleDbConnection cn = new OleDbConnection())
{
cn.ConnectionString = "secret";
cn.Open();
string MDX... | 2015/06/05 | [
"https://Stackoverflow.com/questions/30676949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/899039/"
] | Please try:
```
db.counters('counters').findAndModify
```
instead of:
```
db.collection['counters'].findAndModify
``` | From the mongodb docs:
>
> Existing collections can be opened with collection
>
>
>
> ```
> db.collection([[name[, options]], callback);
>
> ```
>
> If strict mode is off, then a new collection is created if not already
> present.
>
>
>
So you need to do this:
```
db.collection('counters', function(err, co... |
48,754,073 | I know that this question has been asked a lot but I can't seem to find an answer I am looking for. I am getting this error:
```
Uncaught TypeError: $(...).find(...).hasClass(...).val is not a function
at attach_selectors (commercial.js:768)
at HTMLDocument.<anonymous> (commercial.js:117)
at j (jquery-1.11.0.min.js:2... | 2018/02/12 | [
"https://Stackoverflow.com/questions/48754073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9351580/"
] | `hasClass` returns either `true` or `false` which doesn't have a `val` function. Perhaps you want to adjust your selector to `$('form.st-search')`? | **This line returns a boolean rather than a jQuery object**
```
var stInput = $("form").find("input").hasClass("st-search");
```
**Probably you want to do this:**
```
var stInput = $("form").find("input").val();
``` |
28,364,676 | I want to have a function, in Python (3.x), which force to the script itself to terminate, like :
```
i_time_value = 10
mytimeout(i_time_value ) # Terminate the script if not in i_time_value seconds
for i in range(10):
print("go")
time.sleep(2)
```
Where "mytimeout" is the function I need : it terminate the... | 2015/02/06 | [
"https://Stackoverflow.com/questions/28364676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359671/"
] | I would use something like this.
```
import sys
import time
import threading
def set_timeout(event):
event.set()
event = threading.Event()
i_time_value = 2
t = threading.Timer(i_time_value, set_timeout, [event])
t.start()
for i in range(10):
print("go")
if event.is_set():
print('Timed Out!')
... | A little bit of googling turned [this answer](http://code.activestate.com/recipes/577028-timeout-any-function/) up:
```
import multiprocessing as MP
from sys import exc_info
from time import clock
DEFAULT_TIMEOUT = 60
################################################################################
def timeout(limit... |
37,601,055 | I'm trying to implement in java this little project: I want to rename the episodes of an entire season in a series using a text file that has the names of all the episodes in that season.
To that end I wrote a code that reads the text file and stores every line of text (the name of an episode) as a string array, where ... | 2016/06/02 | [
"https://Stackoverflow.com/questions/37601055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6395210/"
] | Just use a 2-dimensional `char` array:
```
char[][] lines = new char[arrLines.length][];
for (int i = 0; i < arrLines.length; i++) {
lines[i] = arrLines[i].toCharArray();
}
```
If you have Java 8, you can use Streams:
```
char[][] lines = Arrays.stream(arrLines)
.map(String::toCharArray)
.toArra... | You can use the String toCharArra method.
```
for(int i = 0; i < strArray.length; i++) {
char[] charArray = strArray[i].toCharArray();
}
``` |
16,856,588 | How do I return a Worksheets Object Reference? I've been perusing through various Google searches with nada results.
For example, I have a functioning code like so. wSheet already dim'ed:
```
Public wSheet As Worksheet
...
Set wSheet = ActiveWorkbook.Worksheets("ExampleSheet")
wSheet.Range("A1").Value = "Hello"
```
... | 2013/05/31 | [
"https://Stackoverflow.com/questions/16856588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275094/"
] | You are returning the wrong type of object in your function.
```
Function get_ExampleSheet() As Worksheets
get_ExampleSheet = ActiveWorkbook.Worksheets("ExampleSheet")
End Function
```
This currently has several errors.
```
Function get_ExampleSheet() As Worksheet
Set get_ExampleSheet = ActiveWorkbook.Sheets... | In order to return an Object from a function, you need to provide the `Set` keyword:
```
Function get_ExampleSheet() As Worksheet
Set get_ExampleSheet = ActiveWorkbook.Worksheets("ExampleSheet")
End Function
``` |
335,457 | I bought a Western Digital 1TB Caviar Green hard drive. I want to store my files on it but also want to encrypt it so I've downloaded TrueCrypt. However TrueCrypt says that I can't encrypt the entire device as it has partitions - I can encrypt individual partitions though.
If I look in diskpart it only has one partiti... | 2011/09/14 | [
"https://superuser.com/questions/335457",
"https://superuser.com",
"https://superuser.com/users/97807/"
] | This is possible using an eSATA external drive and TrueCrypt, but not a USB drive, in my experience.
If you have the option of using eSATA, just back up your data, delete all the partitions, and choose "Encrypt a non-system partition/drive" in TrueCrypt, then select the drive.
TrueCrypt will not encrypt the entire ... | Why not just encrypt the single partition? Since it takes up the entire volume, it's functionally identical to encrypting the entire disk except that the partition table itself won't be encrypted ... and that makes no difference at all. |
45,764,333 | I am trying to create and use a DLL in Xamarin.Forms Project. This is given in the Charles Petzold's book 'Creating Mobile Apps using Xamarin.Form'.
It gives the following method to access the library that I have created
**"From the PCL project of your application solution, add a reference to the library PCL assembly ... | 2017/08/18 | [
"https://Stackoverflow.com/questions/45764333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4390618/"
] | It seems that reloadData and also reloadDataForRowIndexes:columnIndexes: both produce odd behavior in High Sierra. My way around this is as follows:
```
-(void)refreshAllCells {
NSMutableIndexSet* rowIndexes = [[NSMutableIndexSet alloc] init];
if (self.myTable.numberOfRows != 0)
[rowIndexes addIndexesI... | I'm seeing this as well in 10.13, when 10.12 had worked just fine. I was able to work around this problem by, oddly enough, re-adding the cell view's subviews in its `[layout]`:
```
- (void)layout{
if([self needsLayout]){
for(NSView* v in [[self subviews] copy]){
[self addSubview:v];
}
... |
50,534,626 | I want to make a bash script that outputs a msg when a device with a specific MAC addr connects to my "MyNetwork" AP.
```
airbase-ng -a 00:00:00:00:00:00 --essid "MyNetwork" -c 6 wlan0mon | grep 'BB:BB:BB:BB:BB:BB'
```
This command **correctly** outputs airbase-ng lines containing **only** the spesific MAC addr: BB... | 2018/05/25 | [
"https://Stackoverflow.com/questions/50534626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6553529/"
] | You have to update the display of your computer with `pygame.display.flip` after you draw the line.
```
pygame.draw.line(screen, Color_line, (60, 80), (130, 100))
pygame.display.flip()
```
That's usually done at the bottom of the while loop once per frame. | Try giving a width to the line (the last parameter to the line method) and update the display
```
pygame.draw.line(screen, Color_line, (60, 80), (130, 100), 1)
pygame.display.update()
``` |
9,425,706 | Is this possible to share data between two applications on the same device?
Or can I allow some other application to use my application's information / data or in any other way?
For example, the first application is for event management, and I use it to save some event. The second application is for reminders, which ... | 2012/02/24 | [
"https://Stackoverflow.com/questions/9425706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/877873/"
] | From **iOS 8** I've successfully Access Same folder in using "**App Group Functionality.**" I'm extending answer of @siejkowski.
**Note:** It will work from same developer account only.
For that you have to follow below steps.
1. first Enable "App Groups" from your developer account.
2. Generate Provisioning profil... | You can use <https://github.com/burczyk/Camouflage> to read and write NSData to iOS Camera Roll as .bmp file and share it between apps :)
Brand new solution! |
56,536,184 | Similar to [this question](https://stackoverflow.com/q/6198339/188046) except I want this as ideally a per-document setting or mode line. The ideal would be something like:
```
#+STARTUP: showlevels 3
```
Or if needed as a mode line:
```
# -*- org-showlevels: 3 -*-
```
And be equivalent to running `C-3 S-tab` whe... | 2019/06/11 | [
"https://Stackoverflow.com/questions/56536184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188046/"
] | New startup options for this are available in Emacs Org mode master since today.
The implementation is slightly different than your suggestion Elliott, since startup keywords cannot have argument (to the best of my knowledge). But the following will now work if you are using Org mode master:
>
> #+STARTUP: show3leve... | You can replicate what `C-3 S-tab` does with the `org-content` command:
```
# -*- eval:(org-content 3) -*-
```
From the docstring:
>
> Show all headlines in the buffer, like a table of contents. With
> numerical argument N, show content up to level N.
>
>
> |
9,578,990 | I have some VB6 code that needs to be migrated to VB.NET, and I wanted to inquire about this line of code, and see if there is a way to implement it in .NET
```
Dim strChar1 As String * 1
```
Intellisense keeps telling me that an end of statement is expected. | 2012/03/06 | [
"https://Stackoverflow.com/questions/9578990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/709150/"
] | That's known as a "fixed-length" string. There isn't an exact equivalent in VB.NET.
>
> **Edit**: Well, OK, there's **[VBFixedStringAttribute](http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.vbfixedstringattribute.aspx)**, but I'm pretty sure that exists solely so that automated migration tools can more... | ALthough this question was asked ages ago, VB.NET actually has a native fixed-length string -- <VbFixedArray(9)> Public fxdString As Char() 'declare 10-char fixed array. Doing this with scalars actually creates VB6-style Static Arrays. |
11,036 | Вот предложения:
1. Уверенность каждого за свой завтрашний день.
2. У обеих братьев были одинаковые костюмы
3. Войдя в воду, я почувствовал, что всё тело покрылось мурашками
4. Согласно приказу директора предприятие перешло на круглосуточную работу.
5. Он всегда считал своего соседа отъявленным врагом | 2012/10/18 | [
"https://rus.stackexchange.com/questions/11036",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/1294/"
] | В первых двух предложениях - грамматические ошибки.
1. Уверенность в завтрашнем дне
2. У обоих братьев
Речевые недочеты в 1,2 и последнем предложении уже отметили. | Вопрос был именно о лексической норме?
Уверенность каждого за свой завтрашний день.-грамматическая ошибка, не лексическая.
У обеих братьев были одинаковые костюмы.-грамматическая (обеих вместо обоих)+ лексическая - плеоназм(смысловое излишество: у обоих одинаковые)
Войдя в воду, я почувствовал, что всё тело покрылось м... |
18,770,870 | Trying to get following result when I hover

for markup below
```
<ul>
<li><a href="#">Current Month</a></li>
<li><a href="#">Current Week</a></li>
<li><a href="#">Previous ... | 2013/09/12 | [
"https://Stackoverflow.com/questions/18770870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/978733/"
] | ```
li:hover {
background-color:#e4e4e4;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
```
[jsfiddle](http://jsfiddle.net/SEzxP/)
**EDIT**
If you want to use arrows instead, just use the `:before` pseudo element.
```
ul {
list-style-type:none;
}
li {
padding:... | ```
body {
background-color: #F3F3F3;
}
ul {
list-style: none;
margin: 0;
padding: 0;
font-family: Arial, Tahoma;
font-size: 13px;
border-left: 1px solid #4AFFFF;
padding-left: 10px;
}
li {
margin: 0;
padding: 0;
}
li:before {
content: " ";
display:inline-block;
border... |
15,858,766 | I write a script where must find some files in a user-defined directory which may contain tilde (thus, it's possible to have `user_defined_directory='~/foo'`). The construct looks like
```
found_files=$(find "$user_defined_directory" -type f … )
```
I use quotes to cover possible spaces in that path, but tilde expan... | 2013/04/07 | [
"https://Stackoverflow.com/questions/15858766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685107/"
] | You can use `"${user_defined_directory/#~/$HOME}"` to replace a "~" at the beginning of the string with the current user's home directory. Note that this won't handle the `~username/subdir` format, only a plain `~`. If you need to handle the more complex versions, you'll need to write a much more complex converter. | Tilde definitely doesn't expand inside quote. There might be some other bash trick but what I do in this situation is this:
```
find ~/"$user_defined_directory" -type f
```
i.e. move starting `~/` outside quotes and keep rest of the path in the quotes. |
29,019,277 | I created a form that uses phpMailer to email the results to the website owner. Of course, before I add the owner's email address I use mine to test that the form works. When I use my email the form sends perfectly, however, when I use the owner's address it throws the error "could not instantiate mail function" and wo... | 2015/03/12 | [
"https://Stackoverflow.com/questions/29019277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2755541/"
] | The easiest solution would be to split your messages and handlers to multiple projects. Usually in scenarios like yours, there is some sort of logical separation between these messages/handlers groups that you want to control by your configuration (or command line) parameters.
NServiceBus scans all assemblies it finds... | It sounds like you want to turn off auto subscription:
```
config.DisableFeature<AutoSubscribe>();
```
You can then individually subscribe to messages:
```
Bus.Subscribe<MyMessage>();
```
You probably want to first unsubscribe to ALL messages at startup (Bus.Unsubscribe), then re-subscribe to the ones you are int... |
4,255,980 | >
> **Possible Duplicate:**
>
> [Why can templates only be implemented in the header file?](https://stackoverflow.com/questions/495021/why-can-templates-only-be-implemented-in-the-header-file)
>
>
>
Hello. I have a stupid program in c++ consisting in a header file with a class using template and a cpp file wit... | 2010/11/23 | [
"https://Stackoverflow.com/questions/4255980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/517414/"
] | For templates you usually have to put the implementation in the .h/.hpp file. This may seem unnatural, but think of templates as some special "macros" that the compiler expands once you give the actual types or values (in your case, the type `T`, and the value `SIZE`). As most compilers are implemented (in your case GC... | The idea is that a template defines a "family" of functions or types. That is why you cannot simply define the functions in a .cpp file and expect to compile it *once* to an .obj. Every time a new template parameter *T* is used, a new type is created, and new functions need to be compiled.
There are infinitely many ch... |
58,883,736 | I have a JAR dependency that I am required to use. There is one component in that JAR that is interfering with a part of my Spring Boot application. I need to exclude that ONE component, and changing the component definition in the JAR dependency is not currently possible.
I have tried the following, but it does not w... | 2019/11/15 | [
"https://Stackoverflow.com/questions/58883736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/713861/"
] | Try this
```
@SpringBootApplication(exclude = { SomeBean.class })
``` | Doesn't the `@Bean`/`@Component`/etc. or `@Configuration` have any [Conditional](https://docs.spring.io/spring-boot/docs/1.2.1.RELEASE/reference/html/boot-features-developing-auto-configuration.html#boot-features-condition-annotations) annotation on it (e.g.: `@ConditionalOnMissingBean`, `@ConditionalOnProperty`, etc.)... |
101,133 | I have an LG G Pad 7.0 running Android KitKat (4.4.2). Could I update it to Android 5, even though there is no release for the G Pad 7?
I would also by fine with the latest version of CyanogenMod.
Also, I am very new to Android, but is it flexible in the way that you can change the Android version easily, or install ... | 2015/02/28 | [
"https://android.stackexchange.com/questions/101133",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/96283/"
] | After THREE YEARS of searching for a fix... I think I just found a solution - and felt obligated to spread the information. Just plug the headphones in slowly... That's actually all there was to it... The notification icon for a plugged in audio jack at the top of the screen will show up differently if you did it right... | If the headphones were working previously on the phone and now they just suddenly stopped working, then it's likely that the phone's audio hardware has malfunctioned.
Alternatively, there is also a small possibility that some drivers have been updated on your phone to detect Apple headphones and not allow them to be ... |
28,906,096 | Given the [Play Framework 2.3 Computer Database sample application](https://github.com/playframework/playframework/tree/2.3.x/samples/java/computer-database), I would like to practice adding a unique constraint on an attribute. Let's say I want the `name` attribute of the `Computer` class to be unique. I've tried to do... | 2015/03/06 | [
"https://Stackoverflow.com/questions/28906096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1092403/"
] | react-bootstrap seems to complain if the children of an Accordion are not Panels, and by wrapping Panel inside of my Content class I was doing just that.
To solve this problem I had to step away from React's convention. Rather than creating a class Content, I created another js file rather than a react.js file. By tre... | The easiest way to do it is making a condition inside the eventKey parameter.
```
<Card key={item.id}>
<Card.Header>
<Accordion.Toggle as={Button} variant="link" eventKey={index === 0 ? '0' : index}>
{item.title}
</Accordion.Toggle>
</Card.Header>
<Accordion.Collapse eventKey={index ... |
12,820,935 | I would like to find unit tests (written with JUnit) which never fail. I.e. tests which have something like
```
try {
// call some methods, but no assertions
} catch(Throwable e) {
// do nothing
}
```
Those tests are basically useless, because they will never find a problem in the code. So is there a way to make ea... | 2012/10/10 | [
"https://Stackoverflow.com/questions/12820935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1735071/"
] | Well, one approach is to use something like [Jester](http://jester.sourceforge.net/) which implements [mutation testing](http://en.wikipedia.org/wiki/Mutation_testing). It doesn't do things quite the way you've suggested, but it tries to find tests which will still pass however much you change the production code, but ... | I'm not sure about what you want but I understand that the Units are already written, so the only way I can imagine is to override the asserts methods, but even with this you will have to change a little bit the unit code. |
1,910,749 | I am reading a book that is talking about serializing and deserializing files or sending data via web services. My question is.. Is it mandatory to use serialization when using web services. Also when saving files locally using serialization, what is the significants of doing so ?
I know that it saves the data into bi... | 2009/12/15 | [
"https://Stackoverflow.com/questions/1910749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/201934/"
] | Perhaps the best way is to let your server actually fetch the page from the other server, then deliver it as content to the browser.
In that way, the external URL is never sent to the browser and therefore it doesn't know anything about it. Instead all the client sees is a URL to your server. Doing it this way would a... | Why do you want to do this? You really can't completely hide the url of another page, unless you fetch the page and hide it by displaying it on a POSTED form page on your site.
You could try overlaying it in a frame, but the url still could be found.
If you want something simple, to prevent people from causally not b... |
58,250,341 | I have a `*.cpp` file that I compile with C++ (not a C compiler). The containing function relies on a cast (see last line) which seems to be defined in C (please correct if I am wrong!), but not in C++ for this special type.
```
[...] C++ code [...]
struct sockaddr_in sa = {0};
int sockfd = ...;
sa.sin_family = AF_IN... | 2019/10/05 | [
"https://Stackoverflow.com/questions/58250341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10050942/"
] | This is defined in both C++ and C. It does not violate strict aliasing regulations as it does not dereference the resulting pointer.
Here's the [quote from C++](https://timsong-cpp.github.io/cppwp/expr.reinterpret.cast#7) (thanks to @interjay and @VTT) that allows this:
>
> An object pointer can be explicitly conver... | Calls between C and C++ code all invoke Undefined Behavior, from the point of view of the respective standards, but most platforms specify such things.
In situations where parts of the C or C++ Standard and an implementation's documentation together define or describe an action, but other parts characterize it as Unde... |
4,318,481 | writing a simple monte carlo simulation of a neutron beam. Having trouble with the geometry logic (whether something is in one environment or another). My issue is that Ruby seems to be processing the conditions sequentially and keeping the first value it comes to.
The code below illustrates this quite nicely:
```
de... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4318481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/525713/"
] | You've typed "Sheild" a few times where you probably meant "Shield"
In the context you're using them, you should be using `&&` instead of `and`, `||` instead of `or`, and `!` instead of `not`. The reason is that `or` and `and` have such a low precedence that they will cause your assignment operators to not work the wa... | Change all `and` and `or` to `&&` and `||`.
Never seen anyone actually use `array.at(index)` instead of `array[index]` before.
I also recommend against `*args` in favor of a Hash parameter as a kind of named parameters
```
def test(params)
x = params[:x] || raise("You have to provide x!")
y = params[:y] || raise... |
5,828,013 | >
> **Possible Duplicate:**
>
> [How to use scroll view on iPhone?](https://stackoverflow.com/questions/617796/how-to-use-scroll-view-on-iphone)
>
>
>
hi everyone,
i was working with the scroll view , i want to scroll a simple page , how can it be done on iphone, i mean what changes we need to do on interface ... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5828013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766047/"
] | You need to drag a `UIScrollView` in your file.xib then a `UIView` which will be definitely longer than the typical `UIView`. Then drag that `UIView` into `UIScrollView`.
Now drag that `UIScollView` in the `UIView` which is linked to the FilesOwner's View.
Now in your `file.h` make an outlet of `UIScrollView`
```
IB... | Add in .h file
--------------
```
@interface ScrollImageViewController : UIViewController {
UIScrollView *scrollView;
}
@property(nonatomic,retain)UIScrollView *scrollView;
@end
```
and in .m add the following line in viewdidload
-----------------------------------------------
```
scrollView.conte... |
2,935,913 | DO they use a php page to analyze the link, and return all of the images as josn?
Is there a way to do this with just javascript, so you dont have to go to the server to analyze the page? | 2010/05/29 | [
"https://Stackoverflow.com/questions/2935913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335016/"
] | You could remove any character that is not a digit or a decimal point and parse that with [`floatval`](http://php.net/floatval):
```
$number = 1200.00;
$parsed = floatval(preg_replace('/[^\d.]/', '', number_format($number)));
var_dump($number === $parsed); // bool(true)
```
And if the number has not `.` as decimal ... | Thanks to @ircmaxell, I came up with this:
```
$t_sep = localeconv()['thousands_sep'];
$num = (float) str_replace($t_sep? $t_sep : ',', '', $numStr);
``` |
328,091 | I have a computer (laptop) at work that I have installed Thunderbird on and set all of these rules, created contacts, and updated calendars on. I don't want to have to go through all of that process over again on my desktop at home. Is there a tool/add-on or simple way to accomplish this? | 2011/08/25 | [
"https://superuser.com/questions/328091",
"https://superuser.com",
"https://superuser.com/users/47225/"
] | Just sync the whole profile folder [over Dropbox](http://solicitingfame.com/2009/10/05/how-to-dropbox-your-firefoxthunderbird-profiles/). | Another solution, which I use for non-syncing apps,
would be symbolically linking (scriptable, cross-platform)
certain files (filter \*.dat file, etc)
from a Resilio Sync folder (free, self-hosted, infinite space) *a la* Dropbox.
Using this method you cannot open it on both computers.
As for syncing mail, DO NOT... |
41,195,168 | I know this isn't in the scope of a `Array.map` but I'd like to wait until the previous item has finished its promise before starting the next one. It just happens that I need to wait for the previous entry to be saved in the db before moving forwards.
```
const statsPromise = stats.map((item) => {
return playersA... | 2016/12/17 | [
"https://Stackoverflow.com/questions/41195168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240363/"
] | If you are fine with using promise library, you can use [Promise.mapSeries by Bluebird](http://bluebirdjs.com/docs/api/promise.mapseries.html) for this case.
Example:
```
const Promise = require("bluebird");
//iterate over the array serially, in-order
Promise.mapSeries(stats, (item) => {
return playersApi.getOrAddP... | I gave it a thought but I didn't find a better method than the reduce one.
Adapted to your case it would be something like this:
```
const players = [];
const lastPromise = stats.reduce((promise, item) => {
return promise.then(playerInfo => {
// first iteration will be undefined
if (playerInfo) {
pla... |
31,170,484 | I am working on a macro, a part of which takes input from the user asking what he/she would like to rename the sheet. It works fine, but I run into a runtime error if the name provided by the user is already being used by a different sheet. I understand why the error occurs but am not sure as to how I could warn the us... | 2015/07/01 | [
"https://Stackoverflow.com/questions/31170484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4552638/"
] | There are two ways to handle this.
First, trap the error, check if there was an error, and advise, then put the error trapping back to what it was
```
Dim sheetname As String
sheetname = InputBox(Prompt:="Enter Model Code (eg 2SV)", _
Title:="Model Code", Default:="Model Code here")
On Error Resume next
Err.C... | The simplest way is to create a Worksheet variable and Set it to what user has input (you might want to **Trim()** as well to remove leading and trailing spaces).
If it's Nothing then name is safe to use. If **Not Is Nothing** then it already exists.
```
Dim oWS As Worksheet
On Error Resume Next
Set oWS = ThisWorkbo... |
1,097,595 | Toshiba L640
<http://www.cnet.com/products/toshiba-satellite-l640-14-core-i3-350m-windows-7-home-premium-64-bit-3-gb-ram-250-gb-hdd-series/specs/>
I recently had an issue with cooling so I disassembled it and dusted it all and reassembled it. This however did not fix the issue so I took it apart again and replaced th... | 2016/07/06 | [
"https://superuser.com/questions/1097595",
"https://superuser.com",
"https://superuser.com/users/614128/"
] | You can create a bootable usb using the command `dd` :
```
sudo dd if=/path/to/windows.iso of=/dev/sdx bs=4M
sync
```
example: the output of `fdisk -l` is `/dev/sdb1` :
```
sudo dd if=/home/user/Downloads/windows.iso of=/dev/sdb
sync
``` | There is WinUSB which works quite well.
Add the following rep: ppa:colingille/freshlight
and install WinUSB |
35,563 | I have some items in my ubuntu 12.04 desktop. I want to transfer them into the Sdcard of one of the avds in my android emulator (android-sdk-linux) which I have installed on the same system.
Like to know how to do the above. | 2012/12/17 | [
"https://android.stackexchange.com/questions/35563",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/24020/"
] | **1. Using command line:** Here's how you can [copy files to an SD card image](http://developer.android.com/tools/devices/emulator.html#sdcard-files).
You have to use `adb push` to copy files from Desktop to Emulator and `adb pull` for the reverse. Here's the syntax to [copy files to or from an Emulator/Device Instanc... | To transfer data from desktop to an emulator's SdCard on Linux do this:
* Create the SD Card:
Let's create a 64MB sd card for our Android emulator. From a terminal do this:
```
# cd ~/android-sdk-linux/tools
# ./mksdcard 64M ~/Desktop/sdcard.iso
```
* Now you can use the 'Eclipse Android SDK and AVD Manager' to cr... |
15,199,934 | I have a problem when Extracting data from a Dictionary object. Count of the Dictionary is displaying as 1, but the one value it is displaying is null. I want to display a AlertView when there is no data in the Dictionary object. I thought of displaying the AlertView when the count is '0', but it returning '1'.
I am e... | 2013/03/04 | [
"https://Stackoverflow.com/questions/15199934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1987063/"
] | `NSDictionary` and other collections cannot contain `nil` values. When `NSDictionary` must store a `null`, a special value [`[NSNull null]`](https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSNull_Class/Reference/Reference.html) is stored.
Compare the value at `@"My Data"` to `... | ```
if ([[details objectForKey:@"My Data"] isEqual:[NSNull null]] || [[details objectForKey:@"My Data"] isEqualToString:@""]) {
UIAlertView *altTemp = [UIAlertView alloc]initWithTitle:@"Value Null" message:@"Your Message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[altTemp show];
... |
71,004 | I suspect someone broke into my house last night. Nothing was stolen of course, I would have went to the police otherwise.
The reason for my suspicion is a note that I found just beside the door. There were only few people who could get into my house, though I have restricted them to do so! The maid *Margret*, my gir... | 2018/08/30 | [
"https://puzzling.stackexchange.com/questions/71004",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/2368/"
] | So far I have caught four things here:
1.
>
> Dominant means Capital letters of the cipher - RCHAGALXHIAYG (length = 13) - something relating to rot13 cipher technique
>
>
>
2.
>
> If we leave the letters of Name "AALIYAH" here, we get fibonacci sequence from the index of the remaining letters - (R, C, H, G, ... | I think the author is
>
> Aaliyah, since you can find her name in the capital letters of the note
>
>
> |
2,873,807 | I have implemented a web app using session state management as per the instructions found on:
<http://blog.maartenballiauw.be/post/2008/01/ASPNET-Session-State-Partitioning-using-State-Server-Load-Balancing.aspx>
<http://en.aspnet-bhs.info/post/State-Server-Partitioning.aspx>
My SessionIDManager inheritor includes t... | 2010/05/20 | [
"https://Stackoverflow.com/questions/2873807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/71376/"
] | You can't. template are compile time only.
You can build at compile time all the possible templates values you want, and choose one of them in run time. | way too late, i know, but what about this:
```
// MSVC++ 2010 SP1 x86
// boost 1.53
#include <tuple>
#include <memory>
// test
#include <iostream>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/push_back.hpp>
#include <... |
66,911,516 | I have been using the following Excel VBA macro to bring back data from a website. It worked fine until a few days ago when the website stopped supporting IE. Of course the macro just fails now as there is no data on the webpage to bring back to Excel, just a message saying, "Your browser, Internet Explorer, is no long... | 2021/04/01 | [
"https://Stackoverflow.com/questions/66911516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2604372/"
] | [](https://imgflip.com/i/543w7g)
The check for this is a basic server check on user agent. Tell it what it wants to "hear" by passing a supported browser in the UA header...(or technically, in this case, just saying the equivalent of: "Hi, I am not Internet Ex... | Study the article here by *Daniel Pineault* and this paragraph:
[Feature Browser Emulation](https://www.devhut.net/2019/10/18/everything-you-never-wanted-to-know-about-the-access-webbrowser-control/)
Also note my comment dated 2020-09-13. |
8,309 | Suppose there is a person who openly denies the divinity of the Torah, breaks the Sabbath and declares himself an atheist, but goes to synagogue for the sense of community or for cultural reasons. Can he be counted in the minyan, lead the prayers, or read from the Torah? I am asking of course from a traditional or Orth... | 2011/06/16 | [
"https://judaism.stackexchange.com/questions/8309",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/691/"
] | No. In general, if the person is willing to violate the sabbath in public and even in front of a great rabbi, we assume he cannot count for a minyan. Rabbi Nachum Rabinovitch, (*All Jews Are Responsible for One Another*, from "Tradition and the Nontraditional Jew") based on the Rambam, says that chilul shabbos may not ... | one doesn't have to also be an apikores someone who simply does not keep shabbos is not to be counted as part of the minyan. this is the straightforward halacha
here are some things to consider though. there are no apikorsim today. in order to be an apekoris one has to have a great deal of Torah knowledge and understa... |
37,006,225 | I need to refresh the dataset on a powerbi desktop file. The data source is an excel file placed on my onedrive for business folder - to which I have access to. I also saved my pbix file in the folder, however I am using a Mac as of the moment and the only way I'm thinking of is to share the pbix file from one drive to... | 2016/05/03 | [
"https://Stackoverflow.com/questions/37006225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3172172/"
] | To avoid having lengthy JSON structure inline in your fixtures, YAML provide a useful `>` operator
```
fixture_id:
existing_column: "foobar"
data: >
{
"can_edit": true,
"can_se": true,
"can_share": true,
"something_else": true
}
``` | I was maintaining a legacy Rails 4.2 application and needed to put JSON store value into a fixture. I made the following monkey patch to fix the problem. Hope this helps someone:
```rb
module ActiveRecord
class Fixture
def to_hash
h = fixture
model_class.attribute_names.each do |name|
typedef... |
30,602 | [](https://i.stack.imgur.com/Ll7Fg.png)
Undoubtedly, the largest empire in the existence of human history was the Mongol Empire, once a hodgepodge of warring nomadic tribes from Central Asia before banding together under the banner of Temujin, better ... | 2016/06/29 | [
"https://history.stackexchange.com/questions/30602",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/15700/"
] | Instead of a long list of factors, it actually comes down to one point: **military**. They were the superpower from 13th century onward and had the best military, by which I mean **[Operational Art](http://www.au.af.mil/au/awc/awcgate/opart/opart-jrm.htm)**. This is from the Air War College of **[US Air Force](http://w... | By intervening in the internal affairs of other large empires (China, Persia, Kievan Rus) etc., and winning.
China, for instance, was split between the [Jin and Song dynasties](https://en.wikipedia.org/wiki/Jin%E2%80%93Song_Wars). So the Mongols allied with the Song against the Jin, and after defeating the Jin, gather... |
34,383,548 | Backstory: I've made a lot of large and relatively complex projects in Java, have a lot of experience in embedded C programming. I've got acquainted with scheme and CL syntax and wrote some simple programms with racket.
Question: I've planned a rather big project and want to do it in racket. I've heard a lot of "if y... | 2015/12/20 | [
"https://Stackoverflow.com/questions/34383548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2335364/"
] | A number of "paradigms" have come into fashion over the years:
structured programming, object oriented, functional, etc. More will come.
Even after a paradigm falls out of fashion, it can still be good at solving the particular problems that first made it popular.
So for example using OOP for a GUI is still natural. ... | The "Gang of 4" design patterns apply to the Lisp family just as much as they do to other languages. I use CL, so this is more of a CL perspective/commentary.
Here's the difference: Think in terms of methods that operate on families of types. That's what `defgeneric` and `defmethod` are all about. You should use `defs... |
3,756 | I have an underlying function f(x,y,z) that is computationally intensive, but is smooth and continuous. I'm needing to find the function values along a line in xyz. Currently, I'm calculating f at discrete steps and I'm wondering if there is a way to get *Mathematica* to automatically chose the step size and work out a... | 2012/03/31 | [
"https://mathematica.stackexchange.com/questions/3756",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/895/"
] | As far as I know, there is no built-in function to do this. However, what you can do is a heavy abuse of `Part` to extract the points from a `Plot` object:
```
g = Plot[Sin[x], {x, 0, 2 Pi}]
```
>
> 
>
>
>
The `InputForm`, i.e. how Mathematica ... | Whenever I want to do cheap adaptive sampling along a function, I used to do what David did back in old versions of *Mathematica*. Nowadays, I proceed like so:
```
pts = Cases[Normal[Plot[Sin[x], {x, 0, 2 π}, Mesh -> All]], Point[pt_] :> pt, ∞];
```
`ListPlot[pts]` should yield an image similar to the one in David's... |
425,273 | I edited .bashrc file with PATH value, but when I open a new terminal after this, none of command is working.
When i am opening a new terminal its giving :
```
bash: export: `/usr/lib/java/jdk1.7.0_51': not a valid identifier
bash: export: `=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/... | 2014/02/23 | [
"https://askubuntu.com/questions/425273",
"https://askubuntu.com",
"https://askubuntu.com/users/251560/"
] | Probably you messed up the .bashrc file in your home directory.
Check it for errors or make a backup copy of the file and replace it with the example copy in `/etc/skel/.bashrc` | You have add some wrong code inside the bashrc file. Just type following raw in a new terminal. if it gives errors do it twice.
```
PATH=/bin:/usr/bin
``` |
60,566,445 | Say I have a master branch and a feature branch called FA1 that is branched off master and I have another feature branch called FA2 that is branched off FA1.
When I'm working on FA2 and I want to bring changes from FA1, I do: `git rebase -i FA1`.
However, at some point FA1 gets merged into master and I want to change... | 2020/03/06 | [
"https://Stackoverflow.com/questions/60566445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196150/"
] | Make FA2 derive directly from master :
```
git checkout FA2
git rebase FA1 FA2
git rebase --onto master FA1 FA2
```
see the [rebase documentation](https://git-scm.com/docs/git-rebase) | >
> [...] it no longer makes sense that is branched off FA1 [...]
>
>
>
This is not quite true. Whether branch `FA2` still exists or not, `FA1` stays branched off *the same commit*.
If you then need to bring into `FA2` recent commits merged into `master`, yes, you can indeed rebase `FA2` on `master` as you did be... |
14,453,270 | When we create a Subclass object which extends an abstract class, the abstract class constructor also runs . But we know we cannot create objects of an abstract class. Hence does it mean that even if a constructor completes running without any exception, there is no guarantee whether an object is created? | 2013/01/22 | [
"https://Stackoverflow.com/questions/14453270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1163607/"
] | >
> Hence does it mean that even if a constructor completes running
> without any exception, there is no guarantee whether an object is
> created?
>
>
>
Simply speaking, a `constructor` does not create an object. It just *initializes* the *state* of the object. It's the `new` operator which creates the object. N... | Barring any exceptions, the abstract class constructor is only run from within the subclass's constructor (as the first statement). Therefore you can be sure that every time a constructor is run, it is in the process of creating an object.
That said, you may call more than one constructor in the process of creating a ... |
2,905,023 | From Excel, I need to open an Access database and run one of the database's macros.
I'm using Excel and Access 2007. Here is my code in Excel:
```
Sub accessMacro()
Dim appAccess As New Access.Application
Set appAccess = Access.Application
appAccess.OpenCurrentDatabase "C:\blah.mdb"
appAccess.Visible ... | 2010/05/25 | [
"https://Stackoverflow.com/questions/2905023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/123930/"
] | ```
Sub accessMacro()
Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess.OpenCurrentDatabase "C:\blah.mdb"
appAccess.Visible = True
appAccess.DoCmd.RunMacro "Macro Name" '<-- As it appears in the Macro Group in the Access Interface.
appAccess.CloseCurrentData... | The msdn site didn't shed too much light, but I have a feeling that their disclaimer applies here. Here's what they mentioned:
>
> If you run Visual Basic code containing the RunMacro method in a
> library database, Microsoft Access looks for the macro with this name
> in the library database and doesn't look for ... |
8,224,700 | How can I check whether a C# variable is an empty string `""` or null?
I am looking for the simplest way to do this check. I have a variable that can be equal to `""` or null. Is there a single function that can check if it's not `""` or null? | 2011/11/22 | [
"https://Stackoverflow.com/questions/8224700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/975566/"
] | Since .NET 2.0 you can use:
```
// Indicates whether the specified string is null or an Empty string.
string.IsNullOrEmpty(string value);
```
Additionally, since .NET 4.0 there's a new method that goes a bit farther:
```
// Indicates whether a specified string is null, empty, or consists only of white-space charact... | if the variable is a string
```
bool result = string.IsNullOrEmpty(variableToTest);
```
if you only have an object which may or may not contain a string then
```
bool result = string.IsNullOrEmpty(variableToTest as string);
``` |
8,158,784 | I have a problem with my code posted below, set and get methods. I want to call it like this `this.LastError.Set(1);`
But it gives me this error: *'int' does not contain a definition for 'Set' and no extension method 'Set' accepting a first argument of type 'int' could be found (are you missing a using directive or a... | 2011/11/16 | [
"https://Stackoverflow.com/questions/8158784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/820750/"
] | The whole point of properties is that they look like fields, you can get and set them like fields:
```
this.LastError = 1; // set the value
int lastError = this.LastError; // get the value
```
The property is compiled as two methods, `set_LastError()` and `get_LastError()`. You can't use them from C#, but the compil... | To set a property in C# simply use the "=" operator.
```
this.LastError = <myvalue>;
``` |
73,460,571 | I have a spreadsheet that is connected a Hubspot workflow. When a deal is closed in our CRM, Hubspot creates a new row on the sheet with 3 pieces of data from the deal. Due to Hubspot's recommended best practices for working with Google Sheets integration, I have another sheet where I reference data from the sheet that... | 2022/08/23 | [
"https://Stackoverflow.com/questions/73460571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11354588/"
] | recurse. You can't remove while enumerating. Make a list first, then remove
NOTE: this works for the nested controls
```cs
private removeList = new Dictionary<Control, Label>();
private void EnumerateLabels(Control ctrl)
{
foreach (var c in ctrl.Controls)
{
if (c is Label && c.Name.StartsWith("ToClea... | You can do it via `RemoveAll`:
```
this.Controls.RemoveAll(c => (c is Label) && c.Name.StartsWith("ToClear"));
```
See more here: <https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.removeall?view=net-6.0> |
3,745,491 | I would like to test my application with new Samsung Galaxy Tab tablet.
What parameter should I set in the emulator to emulate this device?
* What resolution and density should I set?
* How can I indicate that this is a large screen device?
* What hardware does this tablet support?
* What is the max heap size?
* Whic... | 2010/09/19 | [
"https://Stackoverflow.com/questions/3745491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/361832/"
] | Go to this link ... <https://github.com/bsodmike/android-avd-profiles-2016/blob/master/Samsung%20Galaxy%20Tab%20A%2010.1%20(2016).xml>
Save as xml file in your computer. Go on Android Studio => Tools => AVD Manager => + Create Virtual Device => Import Hardware Profiles ... choose the saved file and the device will be ... | I don't know if it is help.
Create an AVD for a tablet-type device:
Set the target to "Android 3.0" and the skin to "WXGA" (the default skin).
You can check this site.
<http://developer.android.com/guide/practices/optimizing-for-3.0.html> |
9,442,694 | Is this even possible, few argue its possible and i saw it here too [link](https://stackoverflow.com/questions/677595/initialize-final-variable-before-constructor-in-java).. but when i personally tried it gives me compile time errors..
i mean this,
```
Class A{
private final String data;
public A(){
... | 2012/02/25 | [
"https://Stackoverflow.com/questions/9442694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/746710/"
] | Yes, it is possible. Class is written with small case c. Otherwise your code is perfectly fine (except for identation):
```
public class A {
private final String data;
public A() {
data = "new string";
}
}
``` | It is likely that you are having more than one constructor, in that case you must initialize the final instance field in each of those constructors. |
36,770,865 | I have the following string:
>
> 2016-04-29T00:00:00+01:00
>
>
>
I want to turn it into a Unix date timestamp using Python.
I've tried this to convert it into a date object:
```
dt = datetime.datetime.strptime(validated_data.get('scheduled_datetime', None), '%Y-%m-%dT%H:%M:%SZ')
```
But I get the following er... | 2016/04/21 | [
"https://Stackoverflow.com/questions/36770865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/578822/"
] | ```
2016-04-29T00:00:00+01:00
```
is not in a form that [`strptime`](https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior) can understand. It supports
>
> `%z` UTC offset in the form +HHMM or -HHMM
>
>
>
but note that there is no colon `:` in the timezone!
So first remove the colon `:` fr... | If you want to return the current date in a specific format, you should use time.strftime().
```
import time
currentDate = time.strftime('%Y-%m-%dTT%H:%M:%SZ')
```
No need to over complicate things with datetime.
Note: You may need to change some of the formatting characters in order to get the output you want. |
63,603,021 | My problem is similar to this: [R dplyr rowwise mean or min and other methods?](https://stackoverflow.com/questions/31598935/r-dplyr-rowwise-mean-or-min-and-other-methods#31601490)
Wondering if there is any [dplyr](/questions/tagged/dplyr "show questions tagged 'dplyr'") functions (or combination of functions such as `... | 2020/08/26 | [
"https://Stackoverflow.com/questions/63603021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9592557/"
] | I would suggest a mix of `tidyverse` functions like next. You have to reshape your data, then aggregate with the summary functions you want and then as strategy you can re format again and obtain the expected output:
```
library(tidyverse)
sampleData %>% pivot_longer(cols = names(sampleData)) %>%
group_by(name) %>%... | While playing with `pivot_longer`, I discovered that this two-step one-liner also works (building on the answer by @Gregor Thomas, here only one `pivot_` in stead of two or more):
```
sampleData %>%
summarise(across(everything(), list(min, max))) %>%
pivot_longer(everything(), names_to = c(".value", "sta... |
264,380 | In the review system you can only review 20 posts in each queue, except the Close Votes queue which gives 40 reviews.
And if you did complete this queue then you can do more review the next day.
So questions raised:
1. Is there any option available that a user can do more than 20 reviews?
2. Is there a moderation p... | 2015/08/28 | [
"https://meta.stackexchange.com/questions/264380",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/266872/"
] | No, as far as I know, there are no plans to increase the reviews per day for ordinary users.
Worth to mention that only on Stack Overflow we have 40 close reviews per day, due to the huge queue in there, on other sites it's the usual 20.
If you really want more, do your best, and nominate yourself to become a moderat... | I would imagine there are various reasons behind the decision to limit, one of the most notable ones is from [an answer](https://meta.stackexchange.com/a/102223/230506) by Jeff Atwood:
>
> We really want vote diversity here, so that's the point of the limits
> -- if the same 2 folks are vetting all the edits, that'... |
4,911 | I have a problem with SQL code in a PDF document. For code representation I'm using the `listings` package. Everything works perfect until I copy-paste that code from the created PDF document. I get some phantom spaces in string type.
When people are reading my PDF document, they need to copy-paste some of the code. Vi... | 2010/11/04 | [
"https://tex.stackexchange.com/questions/4911",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/1687/"
] | This behaviour is caused by `\lstset{columns=fixed}`. Changing to `columns=flexible` or `columns=fullflexible` should make it go away. | I was looking for a subject about this problem to write what I found out playing around with the fontfamilies.
I used the option columns=fullflexible on my example but it created other problems that was serious to leave them like this.
For example I have the following code in a lstlisting environment.
```
%%%%%%%%%%... |
127,283 | When I typed the search into Google most of the responses were websites selling clothing and the ratio of womens versus women's was about 1:1. Searching for mens versus men's and the version with apostrophes appears almost 90% of the time. For boys versus boy's or girls versus girl's it is a 3:2 ratio in favor of no ap... | 2013/09/15 | [
"https://english.stackexchange.com/questions/127283",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/52117/"
] | Women's room is "correct" as it follows the typical orthography rules. There is the possessive 's after the word "women." Women's room is correct because you want to use the possessive (men's, women's).
"Womens" is "incorrect" by any standard. It should never appear. | **Singlular**
* man
* woman
* boy
* girl
**Plural**
* men
* women
* boys
* girls
**Names of clothing departments/restrooms (plural, non-possessive)**
* Men
* Women
* Boys
* Girls
**Names of clothing departments/restrooms (plural, possessive)**
* Men's
* Women's
* Boys'
* Girls' |
1,290,307 | I get an error when trying to install both AJDT and Scala 2.7.5 plugin into Eclipse 3.5.
I remember seeing a message at one point that there was a known problem with the two being installed, and the solution was to install a pre-release version of Scala plugin, from May I believe, then install AJDT.
But, I don't reme... | 2009/08/17 | [
"https://Stackoverflow.com/questions/1290307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67566/"
] | According to [this thread](http://www.scala-lang.org/node/2560),
>
> 2.7.5.final is compatible with AJDT 1.7.0 on Eclipse 3.5.
>
>
>
If you have [AJDT (AspectJ Development Tools) 2.0.x](http://www.eclipse.org/ajdt/), could you try to downgrade to 1.7.0 as [suggested in this thread](http://www.scala-lang.org/node/... | Here is the message I couldn't find, looking for AJDT 1.7 was the help I needed:
<http://www.nabble.com/Eclipse-Galileo,-AJDT,-Scala-Eclipse-plugin-2.7.5-td24357850.html>
You can get the file from:
<http://eclipse.ialto.org/tools/ajdt/35/dev/update/>
I unzipped this zip file into the Eclipse directory, then installed... |
43,545,818 | I have a form with the following input of a username:
```
<div class="form-group">
<label class="control-label col-sm-2" for="affuser">Affected User: <font color="red">*</font></label>
<div class="col-sm-10">
<input type="affuser" class="form-control" name="affuser" id="affuser" placeholder="Username" value="" requ... | 2017/04/21 | [
"https://Stackoverflow.com/questions/43545818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7740040/"
] | You can achieve smooth movement of text, by using your third method a.k.a the offscreen canvas.
However, it is not really possible to achieve smooth text rendering on canvas.
This is because texts are usually rendered with smart smoothing algorithms, at [sub-pixel level](https://en.wikipedia.org/wiki/Subpixel_rend... | It's because of this:
```
var radius = 15;
var cnv = createHiDPICanvas(radius*2, radius*2, 2);
var ctx = cnv.getContext("2d");
```
When you increase the size of the canvas you're creating to `createHiDPICanvas(2000,2000, ...)`, the movement smoothes out. Right now you're creating a very small resolution canvas (30p... |
44,559,079 | Here is my model validation for check email-id exists or not
```
email:{
type:Sequelize.STRING,
validate:{
notEmpty:{
args:true,
msg:"Email-id required"
},
isEmail:{
args:true,
... | 2017/06/15 | [
"https://Stackoverflow.com/questions/44559079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7425593/"
] | ```
email: {
type : DataTypes.STRING,
validate : {
isEmail: {
msg: "wrong format email"
},
notEmpty: {
msg: 'Email not null'
},
isUnique: function(value, next){
'table'.find({
where : {
email:value,
... | Try this
```
email:{
type:Sequelize.STRING,
validate:{
notEmpty:{
args:true,
msg:"Email-id required"
},
isEmail:{
args:true,
msg:'Valid email-id required'
}
},
unique: { msg: '... |
30,659,833 | I am confused about the case that have multiple constraint annotations on a field, below:
```
public class Student
{
@NotNull
@Size(min = 2, max = 14, message = "The name '${validatedValue}' must be between {min} and {max} characters long")
private String name;
public String getName()
{
... | 2015/06/05 | [
"https://Stackoverflow.com/questions/30659833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1649567/"
] | Add condition `&& places.getCount() > 0`
Example from documentation:
```
Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId)
.setResultCallback(new ResultCallback<PlaceBuffer>() {
@Override
public void onResult(PlaceBuffer places) {
if (places.getStatus().isSuccess()... | Need places.getCount() check as well. Please refer here <https://developers.google.com/places/android-api/place-details> |
167,450 | For quite a while now the print option does not show up under the share menu, as if the share action seems to be missing its share action.
After a while of searching with my google-fu, I have been unable to come up with a working solution, with the two things coming up is:
- Check in your share menu - *If it was there ... | 2017/01/22 | [
"https://android.stackexchange.com/questions/167450",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/121800/"
] | I was able to figure it out.
I just open `chrome://flags` and reset it to defaults as I didn't find anything with the word 'print'.
And, it worked, I am able to print as I could before. | Try a soft reset. Press & hold the power + volume-down buttons together and hold for 12-15 seconds. The print icon should then reappear in the Chrome menu.
Thanks & shout out to Tim at Mequon, WI, Verizon store. |
23,109,342 | I have two tables:
>
> document table (documentID, userID) and sers table (UserID, FirstName, LastName).
>
>
>
For example
document table:
```
documentID = 1 | userID = 2 | modifiedUser = 2
documentID = 3 | userID = 1 | modifiedUser = 1
```
user table:
```
userID = 1 | firstName = Bob | lastName = Hope
user... | 2014/04/16 | [
"https://Stackoverflow.com/questions/23109342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1961497/"
] | ***you need this:***
```
SELECT A.documentID,
CONCAT_WS(' ', B.firstName, B.lastName) AS userID
FROM document A, USER B
WHERE B.userID = A.userID
ORDER BY A.documentID;
```
***output should like:***
```
+----------+----------+
|documentID| userID |
+----------+----------+
| 1 | jhon doe |
+----------+... | ```
SELECT d.documentID, concat_ws(' ', u.firstName, u.lastName) AS userID
FROM document d, user u
WHERE u.userID = d.userID ;
``` |
38,375,088 | I'm having a blank page with that little sample I try to make in angularjs to learn Angular.
I have no errors in console, just a blank page
```
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"... | 2016/07/14 | [
"https://Stackoverflow.com/questions/38375088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5551931/"
] | Use dumpcap for this :
```
dumpcap -i your_interface_here -a duration:3 -w log.pcap | grep '^Packets received/dropped'
```
`dumpcap manpage says:`
>
> -a
>
> Specify a criterion that specifies when Dumpcap is to stop writing
> to a capture file. The criterion is of the form test:value, where
> test is one ... | You can try `iptables -vL`, it shows dropped packet count by iptable rule.
```
s1=$(iptables -vL | grep rule | awk '{ print $1}')
sleep 3
s2=$(iptables -vL | grep rule | awk '{ print $1}')
echo "$(($s2-$s1))"
```
**rule** stands for defined rules in iptables. |
46,474,154 | We are transitioning to DNN 9.01.01 build, but it seems that the import/export feature is not working properly. I submitted an import but it has been sitting on submitted status for the last 8 hours.
Is this a known issue or is there configuration on the server that preventing the import/export to work?
Our instance ... | 2017/09/28 | [
"https://Stackoverflow.com/questions/46474154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5828571/"
] | This thread hasn't been touched in a long time but I dug around and found the problem. I fixed this problem by directly editing the DNN database. I'm on version 9.4 although, I'm sure this would work with any version as this issue is apparently caused some wonky code in the Azure AppService deployment packages.
To re... | I had this issue, when checking the other task scheduled for execution I noticed the server field was empty while on the import/export there were comma separated inputs. When I cleared the import/export field the task ran correctly.
[](https://i.sta... |
14,024,715 | I am trying to send email through an application in asp.net using c#. I searched a lot and mostly found the following code to send email using c# in asp.net:
```
MailMessage objEmail = new MailMessage();
objEmail.From = new MailAddress(txtFrom.Text);
objEmail.To.Add(txtTo.Text);
objEma... | 2012/12/24 | [
"https://Stackoverflow.com/questions/14024715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1927148/"
] | Your code looks reasonable, so you need to figure out what is preventing it from working.
Can you eliminate the possibility of a firewall problem? Most medium or large organizations tend to block ports 25, 465 and 587 - they simply don't want any unauthorized mail going out. If you suspect this might be the case, you ... | You can check this out .. simple code and its works for gmail account ...
```
try
{
MailMessage msg = new MailMessage();
msg.From = new MailAddress(TextFRM.Text);
msg.To.Add(TextTO.Text);
msg.Subject = TextSUB.Text;
msg.Body = TextMSG.Text;
SmtpClient sc = new ... |
37,623,732 | Problem: Getting a set of random numbers between two values that will have a certain mean value.
Let say we getting n number of random number where the number will be between 1 and 100. We have a mean of 25.
My first approach is to have 2 modes where we have aboveMean and belowMean where the first random number is ... | 2016/06/03 | [
"https://Stackoverflow.com/questions/37623732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1888722/"
] | Take some good distribution and use it. Say, [Binomial distribution](https://en.wikipedia.org/wiki/Binomial_distribution). Use `B(99,24/99)`,
so sampled values are in the range 0...99, with parameter `p` equal to 24/99.
So if you have routine which sample from B, then all you need is to add 1
to be in he range 1...10... | you have to go into some probabilities theory. there are a lot of methods to judge on random sequence. for example if you lower the deviation you will get triangle-looking-on-a-graph sequence, which can in the end be proven not trully random. so there is not really much choice than getting random generator and discardi... |
1,736 | I am wondering if there are any packages for python that is capable of performing survival analysis. I have been using the survival package in R but would like to port my work to python. | 2010/08/16 | [
"https://stats.stackexchange.com/questions/1736",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/172/"
] | AFAIK, there aren't any survival analysis packages in python. As mbq comments above, the only route available would be to [Rpy](http://rpy.sourceforge.net/).
Even if there were a pure python package available, I would be very careful in using it, in particular I would look at:
* How often does it get updated.
* Does... | [PyIMSL](http://www.vni.com/campaigns/pyimslstudioeval/) contains a handful of routines for survival analyses. It is Free As In Beer for noncommercial use, fully supported otherwise. From the documentation in the Statistics User Guide...
Computes Kaplan-Meier estimates of survival
probabilties: kaplanMeierEstimates()... |
30,675,561 | I added a resource for a module as follows:
```
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>nbm-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<moduleType>eager</moduleType>
<nbmResources>
<nbmResource>
... | 2015/06/05 | [
"https://Stackoverflow.com/questions/30675561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/198108/"
] | You can run setup.exe one more time and install Oracle Administration Assistant for Windows in the same ORACLE\_HOME directory, use Custom installation type
).
After install check the folder and you'll see deinstall directory. Run the deinstall.bat as... | You can use the Oracle Universal Installer but you need to start from the lowest level of the repository. If you directly select the whole environment, it won't work. |
5,852,459 | how do i create object-instances on runtime in python?
say i have 2 classes:
```
class MyClassA(object):
def __init__(self, prop):
self.prop = prop
self.name = "CLASS A"
def println(self):
print self.name
class MyClassB(object):
def __init__(self, prop):
self.prop = prop
... | 2011/05/02 | [
"https://Stackoverflow.com/questions/5852459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/282204/"
] | You might create a dispatcher, which is a dictionary with your keys mapping to classes.
```
dispatch = {
"a": MyClassA,
"b": MyClassB,
}
instance = dispatch[which_one]() # Notice the second pair of parens here!
``` | You create a class instance by calling the class. Your class dict `{('a': MyClassA), ('b': MyClassB)}` returns classes; so you need only call the class:
```
classes['a']()
```
But I get the sense you want something more specific. Here's a subclass of `dict` that, when called with a key, looks up the associated item ... |
5,940,627 | Anyone know how to code speech recognition that Microsoft speech recognition will detect set word.... any references i have put all the code which can make recognition but do know how to code Microsoft speech recognition will detect set word....
My coding:
```
Option Explicit
Dim rs As New ADODB.Recordset
Dim recogni... | 2011/05/09 | [
"https://Stackoverflow.com/questions/5940627",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/730669/"
] | Before, SSR M.S. and releated company make TTS - Text-To-Speech, basic engine for TTS is foenemmology - phonemes for speak P.C. to louds and phonemes for speech recognition over mcirophone. How like P.C. speak words it except of human to say words to microphone, but a lot of words have same speak and different write in... | Just to be clear, there are two types of speech recognition, dictation and command and control. In dictation mode, you are listening for every word possible and trying to find a match. This is good for dictation type systems where a person is speaking and you wish to transcribe everything. A good example of dictation g... |
14,886,938 | First of all, sorry for my english, I wrote this with some help of Google Translate.
I'm trying to make an application like Google Wave with PHP and Ajax. I have a textarea that when the user input something, the javascript on the page detected with `oninput` and send the contents of the textarea to the server and the... | 2013/02/15 | [
"https://Stackoverflow.com/questions/14886938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1015609/"
] | If you are finding `XHR.abort()` and `connection_aborted()` unreliable, consider other ways to send an out-of-band signal to inform the running PHP request that it should not commit the transaction.
Are you running [APC](http://php.net/manual/en/book.apc.php) (or could you be)?
Instead of invoking `XHR.abort()`, you ... | As Marc B pointed, PHP can't detect if the browser is disconnected without sending some output to the browser. The problem is, you have enabled output buffering at the line `ob_start('ob_gzhandler');` and that prevents PHP from sending output to the browser.
You either have to remove that line or add a ob\_end\_\* (fo... |
30,090 | My first rebus, so I hope that it makes sense.
>
> Given that $f(z)=\dfrac{1}{(z-A)^n}$, is it true that
> $A=[N,\ldots,O]$?
>
>
>
Hint:
>
> $f$, $n$, and $z$ are not important
>
>
>
Hint:
>
> It's about fruits
>
>
> | 2016/04/01 | [
"https://puzzling.stackexchange.com/questions/30090",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/20562/"
] | The community wiki answer is
>
> No.
>
>
>
Community wiki argument:
>
> 1. $A$ is a pole of the function
>
> 2. $[N..O]$ is the $N$-$O$-range, respectively the EN-O-RANGE.
>
> 3. Now the question is: IS A-POLE EQUAL TO EN-O-RANGE?
>
> 4. And the answer is: No, since you cannot compare apples to or... | Is it:
>
> A Polar Molecule?
>
>
>
So the following (ie.$A=[N..O]$) is :
>
> True, as $[N..O]$ (read as $N$ to $O$),ie. $N\_2O$ is a polar molecule.
>
>
> |
5,104,094 | In JSF MVC framework who is Model, View, and Controller? | 2011/02/24 | [
"https://Stackoverflow.com/questions/5104094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187141/"
] | This depends on the point of view (pun intented).
In the big architectural picture, your own JSF code is the **V**:
**M** - Business domain/Service layer (e.g. EJB/JPA/DAO)
**V** - Your JSF code
**C** - FacesServlet
In the developer picture, the architectural **V** is in turn dividable as below:
**M** - Entit... | Java Server Faces is an MVC web framework where the MVC components are as follows,
1. **Model** - It is the managed bean class annotated with @ManagedBean, which has properties to hold the data and respective getters and setters. The managed bean class can also contain the business logic.These are also known as backin... |
864,741 | In a server block, if I have no location block defined, it seems Nginx is serving any files. For example, if the request is "/foo.html", it will serve this file if it is found under root.
Is it possible to make nginx serve files only if they match a location? A request to "/foo.html" would not work if I have not defin... | 2017/07/23 | [
"https://serverfault.com/questions/864741",
"https://serverfault.com",
"https://serverfault.com/users/182146/"
] | You have to turn on ssl.
SSL is a protocol, HTTP is an another protocol. At the server side, port number won't implicitly specify protocols. You can run either one at any ports. At the other hand, browsers implicitly try to communicate using http at port 80 and https (ssl) at 443.
Naturally, if the two party speaks ... | You've made a number of error
* Not listening on SSL
* Not specifying SSL keys and certificates
* Specifying a domain in two server blocks
* Missing slashes
If you don't know about SSL try reading my [Nginx/SSL tutorial](https://www.photographerstechsupport.com/tutorials/hosting-wordpress-on-aws-tutorial-part-5-free-... |
24,265 | Let $s\_n = \sum\_{i=1}^{n-1} i!$ and let $g\_n = \gcd (s\_n, n!)$. Then it is easy to see that $g\_n$ divides $g\_{n+1}$. The first few values of $g\_n$, starting at $n=2$ are $1, 3, 3, 3, 9, 9, 9, 9, 9, 99$, where $g\_{11}=99$. Then $g\_n=99$ for $11\leq n\leq 100,000$.
Note that if $n$ divides $s\_n$, then $n$ divi... | 2010/05/11 | [
"https://mathoverflow.net/questions/24265",
"https://mathoverflow.net",
"https://mathoverflow.net/users/1243/"
] | This is so close to the Kurepa conjecture which asserts that $\gcd\left(\sum\_{k=0}^{n-1}k!,n!\right)=2$ for all $n\geq 2$, which was settled in 2004 by D. Barsky and B. Benzaghou "Nombres de Bell et somme de factorielles". So what they proved is that $K(p)=1!+\cdots+(p-1)!\neq -1\pmod{p}$ for any odd prime $p$. This g... | An amusing (but perhaps useless) observation: the property $1! + \ldots + (p-1)! = 0 \hbox{ mod } p$ is also equivalent to the matrix product property
$$\left( \begin{array}{ll} 1 & 1 \\\ 0 & 1 \end{array} \right) \begin{pmatrix} 2 & 1 \\\ 0 & 1 \end{pmatrix} \ldots \begin{pmatrix} p & 1 \\\ 0 & 1 \end{pmatrix} = \beg... |
65,856,936 | ```
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PetsHotelSystem.User_Control
{
public partial class UC_UpdateRoom : UserControl
{
... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65856936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15064302/"
] | When you need to have some logic which is `depend` on changing a variable, it's better to keep those logic inside `useEffect`
```
const interval = useRef(null);
const timeout = useRef(null);
useEffect(() => {
interval.current = setInterval(
() => (image === 4 ? setImage(1) : setImage((i) => i + 1)),
5000
)... | Anytime that you rerender your component, you will run the whole function once. So you will set an interval every time you use setImage(). In order to prevent this, you have to use side effect functions. here you should use `useEffect()` because you have a functional component. in order to make `useEffect()` only run o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.