qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
331,079 | >
> Consider the following experiment. Three cards are drawn from a standard deck
> of 52 cards, one after the other. Before the second card is drawn, the first card
> is put back in the deck and the deck is re-shuffled. Before the third card is
> drawn, the second card is put back in the deck and the deck is re-sh... | 2013/03/15 | [
"https://math.stackexchange.com/questions/331079",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/44342/"
] | In the calculation in (1) you have a typo in the first numerator $-$ you clearly meant to have $\binom{13}3$, not $\binom{13}2$ $-$ and an arithmetic error: $\binom{13}3=286$, not $2860$. However, you’ve made a more fundamental error at the start: with the errors corrected, your calculation would give you the probabili... | I'm a bit confused with the card drawing process. From your statement, it seems that the three cards are all drawn from a full deck following a uniform distribution. So the answer should be
(1)$$P(\text{all three are hearts}) = \left(\cfrac{13}{52}\right)^3 = \cfrac{1}{64}$$
(2)$$P(\text{not all three are hearts}) = 1... |
2,213,945 | >
> Prove $\varphi(a)\varphi(b)=\varphi(\gcd(a,b))\varphi(\operatorname{lcm}[a,b])$
>
>
>
I know $ab=\gcd(a,b)\operatorname{lcm}[a,b]$.
Let $d = \gcd(a,b)$ and $\ell=\operatorname{lcm}(a,b)$. Notice that $\frac{ab}{d}$ is a common multiple of $a$ and $b$, since $\frac{a}{d}$ and $\frac{b}{d}$ are integers, by def... | 2017/04/02 | [
"https://math.stackexchange.com/questions/2213945",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/255400/"
] | This solution uses the fundamental theorem of arithmetic. Let's write $$a=p\_1^{r\_1}\cdots p\_n^{r\_n},$$ $$b=p\_1^{s\_1}\cdots p\_n^{s\_n}.$$
where the $p\_i$'s are prime numbers and $r\_1,\ldots r\_n,s\_1\ldots s\_n\ge 0$. Then by a well-known formula we have $$\phi(a)=p\_1^{r\_1-1}(p\_1-1)\cdots p\_n^{r\_n-1}(p\_n... | Hint: It seems straightforward using the following explicit formula: $$\phi(n) = n\prod\_{p|n}(1-\dfrac{1}{p}).$$
Also use that if $p\_1,p\_2,..p\_k$ are the common prime factors of $a$ and $b$, with respective orders $\alpha\_k$ and $\beta\_k$, then $lcm(a,b) = \prod\_{i=1}^kp\_i^{\max(\alpha\_i, \beta\_i)}$ and $gcd... |
2,213,945 | >
> Prove $\varphi(a)\varphi(b)=\varphi(\gcd(a,b))\varphi(\operatorname{lcm}[a,b])$
>
>
>
I know $ab=\gcd(a,b)\operatorname{lcm}[a,b]$.
Let $d = \gcd(a,b)$ and $\ell=\operatorname{lcm}(a,b)$. Notice that $\frac{ab}{d}$ is a common multiple of $a$ and $b$, since $\frac{a}{d}$ and $\frac{b}{d}$ are integers, by def... | 2017/04/02 | [
"https://math.stackexchange.com/questions/2213945",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/255400/"
] | With the convention that the product of the members of the empty set is $1$:
Let $P(n)$ be the set of prime divisors of $n$. Then $\phi (n)=n\cdot\prod\_{p\in P(n)}(p-1)/p.$
Let $A=P(a)\cap P(b)$ and $Q(a)=P(a)$ \ $A$ and $Q(b)=P(b)$ \ $A$. Note that these sets are pair-wise disjoint.
We have $\phi(a)=$ $a\cdot\pro... | Hint: It seems straightforward using the following explicit formula: $$\phi(n) = n\prod\_{p|n}(1-\dfrac{1}{p}).$$
Also use that if $p\_1,p\_2,..p\_k$ are the common prime factors of $a$ and $b$, with respective orders $\alpha\_k$ and $\beta\_k$, then $lcm(a,b) = \prod\_{i=1}^kp\_i^{\max(\alpha\_i, \beta\_i)}$ and $gcd... |
2,213,945 | >
> Prove $\varphi(a)\varphi(b)=\varphi(\gcd(a,b))\varphi(\operatorname{lcm}[a,b])$
>
>
>
I know $ab=\gcd(a,b)\operatorname{lcm}[a,b]$.
Let $d = \gcd(a,b)$ and $\ell=\operatorname{lcm}(a,b)$. Notice that $\frac{ab}{d}$ is a common multiple of $a$ and $b$, since $\frac{a}{d}$ and $\frac{b}{d}$ are integers, by def... | 2017/04/02 | [
"https://math.stackexchange.com/questions/2213945",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/255400/"
] | This solution uses the fundamental theorem of arithmetic. Let's write $$a=p\_1^{r\_1}\cdots p\_n^{r\_n},$$ $$b=p\_1^{s\_1}\cdots p\_n^{s\_n}.$$
where the $p\_i$'s are prime numbers and $r\_1,\ldots r\_n,s\_1\ldots s\_n\ge 0$. Then by a well-known formula we have $$\phi(a)=p\_1^{r\_1-1}(p\_1-1)\cdots p\_n^{r\_n-1}(p\_n... | With the convention that the product of the members of the empty set is $1$:
Let $P(n)$ be the set of prime divisors of $n$. Then $\phi (n)=n\cdot\prod\_{p\in P(n)}(p-1)/p.$
Let $A=P(a)\cap P(b)$ and $Q(a)=P(a)$ \ $A$ and $Q(b)=P(b)$ \ $A$. Note that these sets are pair-wise disjoint.
We have $\phi(a)=$ $a\cdot\pro... |
44,454,291 | This may be a bit difficult to describe, so I'll try to give a concrete example of what I'm trying to do.
Suppose we have a Facade interface and class (in Java), like this:
```
interface FacadeInterface<T> {
void method(String from, String via);
}
class Facade<T> implements FacadeInterface<T> {
private Class... | 2017/06/09 | [
"https://Stackoverflow.com/questions/44454291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/724358/"
] | It's sadly not possilble!
The [*Kotlin Delegation*](https://kotlinlang.org/docs/reference/delegation.html) is a nice way to reduce boilerplate code. But it comes with the inability to actually access the delegate within the class body.
The second issue you're facing regarding `@JvmStatic` is actually more drastic to ... | I don't know if it is possible to have delegated methods as static methods inside an object in Kotlin.
However, as you are interested in creating singletons that proxy a class, you could use package-level constants in Kotlin:
```
val SingletonKt : FacadeInterface<String> = Facade(String::class.java)
```
Now, you ca... |
15,422,003 | Problem
=======
I want to use `expect()` to assert something in my e2e test, but `expect()` operates on `Future`'s only. How can I get this to work:
```
expect(true).toBe(true);
```
Details
=======
The above `expect()` call works fine in unit tests, but `expect()` is a different beast in e2e tests. In my situation... | 2013/03/14 | [
"https://Stackoverflow.com/questions/15422003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/412099/"
] | The API call GetAdaptersInfo fills a IP\_ADAPTER\_INFO struct for each network adapter. According to the documentation the mask is provided in the list of addresses:
[http://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).aspx](http://msdn.microsoft.com/en-us/library/windows/desktop/aa366062%28v=vs.... | RichardBrock's answer was correct, the GetAdaptersInfo gives the needed info. Here's some code showing more specifically how to do this. Note that this code uses MFC and a string conversion macro, STR\_A2T which just converts from the char\* string to the wchar\_t\* string as the project is built for Unicode. The resul... |
37,130,006 | I have a java program:
```
public class ProcessMain {
public static final void main(String[] args) throws Exception {
Scanner keyboard = new Scanner(System.in);
boolean exit = false;
do
{ if(keyboard.hasNext()){
String input = keyboard.next();
... | 2016/05/10 | [
"https://Stackoverflow.com/questions/37130006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1513648/"
] | If you only need an external trigger to stop current processing. You might create a semaphore file and stop as soon it is created by another process.
See the following snippet.
```
// it will check for the file in the current directory
File semaphore = new File("abort.semaphore");
semaphore.deleteOnExit();
System.out... | Program not printing on console might be because of your `testfifo` file is empty.
Try this:
```
printf "Hello\nMy\nFriend\nabort" > testfifo
java -cp "Test.jar" com.example.ProcessMain < testfifo
```
It will work. |
12,851,767 | I am trying to replicate a superscript icon in text within a jquery ui button. I have tried several combos but everything screws up the button. It will align incorrectly within a buttonset().
css
```
.superscript{float: left; font-size:xx-small; vertical-align:top;}
.floatleft{ float: left;}
```
js
```
$("<a/>",{... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12851767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1138984/"
] | Why not just use the HTML `<sup>` tag instead of a span? | In your CSS, if you give `float: left;` it affects the `vertical-align: top;` because, `vertical-align` can be given only to inline elements and when you `float`, it becomes a block level element.
Small change in your CSS.
```
.superscript {font-size: xx-small; vertical-align: top;}
.floatleft {float: left;}
```
#... |
23,742,011 | I am trying to send a checkbox value via ajax to send data to a external function.
I have the function working using the following javascript, however it is very messy as i am currently writing this javascript function for every instance of script which exisits.
```
<form>
<input type="checkbox" name="event_status" i... | 2014/05/19 | [
"https://Stackoverflow.com/questions/23742011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1051827/"
] | solved my problem i need to grab the id of my checkbox in order to distinguish which checkbox value i was running my function on.
```
<script>
$('input:checkbox').change(function(e) {
e.preventDefault();
// Determine ID
var value = $(this).attr('id');
var EsID = value;
var isChecked = $("input:checkbox").is(":chec... | What about giving your checkbox input a class and raise the change event on the class rather than the checkbox name.
e.g.
Change
```
$('#event_status<? echo $cobj->getCollectionID()?>').change(function() {
```
to
```
$('.CheckboxClassName<? echo $cobj->getCollectionID()?>').change(function() {
``` |
19,717,174 | I am trying to make a program that will show the numbers:
```
1, 10 +30
2, 40 (the scale goes up in this pattern by adding 20 to the last number added)
3, 90 +50
4, 160
5, 250 +70
```
So far I have this code:
```
using System;
using System.Collections.Generic;
using System.Linq;
usi... | 2013/10/31 | [
"https://Stackoverflow.com/questions/19717174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2867304/"
] | Stream the console output to file first
```
FileStream filestream = new FileStream("loopdata.csv", FileMode.Create);
var streamwriter = new StreamWriter(filestream);
streamwriter.AutoFlush = true;
Console.SetOut(streamwriter);
Console.SetError(streamwriter);
``` | One rather ugly implementation which is totally untested...
```
int col3 = 30;
bool col3set = true;
for( int col1 = 1; col1 <=20; col1++ )
{
int col2 = col1*col1*10;
Console.WriteLine(col1 + "," + col2 + " +" + (col3set ? col3.ToString() : ""));
col3set = !col3set; //flip setting col3 so it's on for eve... |
19,717,174 | I am trying to make a program that will show the numbers:
```
1, 10 +30
2, 40 (the scale goes up in this pattern by adding 20 to the last number added)
3, 90 +50
4, 160
5, 250 +70
```
So far I have this code:
```
using System;
using System.Collections.Generic;
using System.Linq;
usi... | 2013/10/31 | [
"https://Stackoverflow.com/questions/19717174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2867304/"
] | If you take a look at the numbers you will find that the difference between two numbers can be calculated by using the following formula:
```
valueInSecondColumn = 20 * (valueInFirstColumn + 1) - 10;
```
Applying that knowledge you can formulate a code like the following one:
```
List<string> data = new List<string... | Stream the console output to file first
```
FileStream filestream = new FileStream("loopdata.csv", FileMode.Create);
var streamwriter = new StreamWriter(filestream);
streamwriter.AutoFlush = true;
Console.SetOut(streamwriter);
Console.SetError(streamwriter);
``` |
19,717,174 | I am trying to make a program that will show the numbers:
```
1, 10 +30
2, 40 (the scale goes up in this pattern by adding 20 to the last number added)
3, 90 +50
4, 160
5, 250 +70
```
So far I have this code:
```
using System;
using System.Collections.Generic;
using System.Linq;
usi... | 2013/10/31 | [
"https://Stackoverflow.com/questions/19717174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2867304/"
] | If you take a look at the numbers you will find that the difference between two numbers can be calculated by using the following formula:
```
valueInSecondColumn = 20 * (valueInFirstColumn + 1) - 10;
```
Applying that knowledge you can formulate a code like the following one:
```
List<string> data = new List<string... | One rather ugly implementation which is totally untested...
```
int col3 = 30;
bool col3set = true;
for( int col1 = 1; col1 <=20; col1++ )
{
int col2 = col1*col1*10;
Console.WriteLine(col1 + "," + col2 + " +" + (col3set ? col3.ToString() : ""));
col3set = !col3set; //flip setting col3 so it's on for eve... |
26,239,766 | I have seen some pretty similar questions but none of them have the answer I was looking for. Some of them wasn't answered.
I have a VBA Macro which verify all files created in a certain date (in this case yesterday) by searching for the files and verifying when the file was created. As the macro was found in the inte... | 2014/10/07 | [
"https://Stackoverflow.com/questions/26239766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2793093/"
] | `f.DateLastModified` would probably do for you.
If you add references to `Microsoft Scripting Runtime` library via Tools -> References in VBE you can early bind your objects and get intelli-sense with them.
```
Sub VerifyNewFiles()
Dim fName As String, msg As String, fDate As Date
Dim fso As New FileSystem... | It seems like you should use the DateLastModified property on the fil object within your for each loop. So this:
```
d = fil.DateCreated
```
Would become this:
```
d = fil.DateLastModified
```
I suggest you look [here](http://msdn.microsoft.com/en-us/library/office/gg251660(v=office.15).aspx) for more information... |
44,804,352 | i am trying to add 5 element in array and print sum of elements in java script without function
```html
<HTML>
<body>
<script type="text/javascript">
var x=new Array(5);
for(i=0;i<x.length;i++){
x[i]=prompt("enter Any Value") <!-- its properly working till now -->
t=0;
... | 2017/06/28 | [
"https://Stackoverflow.com/questions/44804352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8226451/"
] | Try the code below, use the `With ws` statement to get all objects, such as `Cells` qualified with the current `Worksheet` you are looping through.
***Code***
```
Sub Hours()
Dim ws As Worksheet
Dim i As Long, k As Long
For Each ws In ActiveWorkbook.Worksheets
With ws
For i = 6 To 21
'k = i ... | I use this to loop through my worksheet :
```
For i = 1 To ActiveWorkbook.Worksheets.Count
ActiveWorkbook.Worksheets(i)
'adapt your code into that
Next i
```
It may work better for you |
44,804,352 | i am trying to add 5 element in array and print sum of elements in java script without function
```html
<HTML>
<body>
<script type="text/javascript">
var x=new Array(5);
for(i=0;i<x.length;i++){
x[i]=prompt("enter Any Value") <!-- its properly working till now -->
t=0;
... | 2017/06/28 | [
"https://Stackoverflow.com/questions/44804352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8226451/"
] | Try the code below, use the `With ws` statement to get all objects, such as `Cells` qualified with the current `Worksheet` you are looping through.
***Code***
```
Sub Hours()
Dim ws As Worksheet
Dim i As Long, k As Long
For Each ws In ActiveWorkbook.Worksheets
With ws
For i = 6 To 21
'k = i ... | You have to tell the vba to select the next worksheet. Right now it is looping through the number of worksheets you have, but since there is nothing in the code that activates the next worksheets it just loops on the first one. Try this:
```
Sub Hours()
Dim ws As Worksheet
Dim I As Integer
For Each ws In ActiveWo... |
44,804,352 | i am trying to add 5 element in array and print sum of elements in java script without function
```html
<HTML>
<body>
<script type="text/javascript">
var x=new Array(5);
for(i=0;i<x.length;i++){
x[i]=prompt("enter Any Value") <!-- its properly working till now -->
t=0;
... | 2017/06/28 | [
"https://Stackoverflow.com/questions/44804352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8226451/"
] | Try the code below, use the `With ws` statement to get all objects, such as `Cells` qualified with the current `Worksheet` you are looping through.
***Code***
```
Sub Hours()
Dim ws As Worksheet
Dim i As Long, k As Long
For Each ws In ActiveWorkbook.Worksheets
With ws
For i = 6 To 21
'k = i ... | Consider this.
```
Sub Test1()
'UpdatebyExtendoffice20161222
Dim x As Integer
Dim ws As Worksheet
' Begin looping through the sheets
For Each ws In ActiveWorkbook.Worksheets
ws.Select
' Begin looping through the cells
' Set numrows = number of rows of data.
NumRow... |
41,571,912 | Does dynamodb stores number datatype as string only. Whats the size of number say with value 123456. will it be 6 bytes or 4 bytes - stored as string or int in dynamodb table ? | 2017/01/10 | [
"https://Stackoverflow.com/questions/41571912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1846749/"
] | Based on [these DynamoDB docs](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/CapacityUnitCalculations.html), I believe `123456` would require **~4 bytes as a number** and **6 bytes as a string** (excluding attribute name). This is based on
1/2 bytes per significant digit \* 6 significant digits + 1 ... | DynamoDB represents numbers as JSON strings internally.
From the [official documentation](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-data-types):
>
> A Number can have up to 38 digits of precision, and can be positive, negative, or zero.
>
>
> Positive range: 1E-130 to 9.999... |
14,505,185 | I'm reading in Steven Sanderson's book about ASP.NET and I've reached a point where I'm really confused.
**Works**
```
@foreach (var link in Model)
{
@Html.RouteLink(link, new { controller = "Product", action = "List", category = link, page = 1 });
}
```
**Doesn't work**
```
@foreach (var link in Model)
{
... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14505185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/825637/"
] | When you use the semicolon ; (or without the @) it's executing a line of code but the return is not written to the response stream, whereas without it and by using the @ it is returning a result (MvcHtmlString) directly to the response stream at that point. | The thing to remember is that you can have html inside that foreach block as well:
Works:
```
@if (someConditionalExpression)
{
<p>Only shown if the conditional was true.</p>
}
```
Since markup is also legal here, you need to use the `@` symbol to indicate to the view engine that you want code again, rather tha... |
14,505,185 | I'm reading in Steven Sanderson's book about ASP.NET and I've reached a point where I'm really confused.
**Works**
```
@foreach (var link in Model)
{
@Html.RouteLink(link, new { controller = "Product", action = "List", category = link, page = 1 });
}
```
**Doesn't work**
```
@foreach (var link in Model)
{
... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14505185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/825637/"
] | Inside the `foreach` the parser automagically works out if it is in code mode or razor template mode, allowing you to output html, razor or code.
The difference between the two statements is one is in razor template mode (working) and the other is in code mode (not working)
`Html.RouteLink` returns an `MvcHtmlString... | When you use the semicolon ; (or without the @) it's executing a line of code but the return is not written to the response stream, whereas without it and by using the @ it is returning a result (MvcHtmlString) directly to the response stream at that point. |
14,505,185 | I'm reading in Steven Sanderson's book about ASP.NET and I've reached a point where I'm really confused.
**Works**
```
@foreach (var link in Model)
{
@Html.RouteLink(link, new { controller = "Product", action = "List", category = link, page = 1 });
}
```
**Doesn't work**
```
@foreach (var link in Model)
{
... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14505185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/825637/"
] | Inside the `foreach` the parser automagically works out if it is in code mode or razor template mode, allowing you to output html, razor or code.
The difference between the two statements is one is in razor template mode (working) and the other is in code mode (not working)
`Html.RouteLink` returns an `MvcHtmlString... | The thing to remember is that you can have html inside that foreach block as well:
Works:
```
@if (someConditionalExpression)
{
<p>Only shown if the conditional was true.</p>
}
```
Since markup is also legal here, you need to use the `@` symbol to indicate to the view engine that you want code again, rather tha... |
14,505,185 | I'm reading in Steven Sanderson's book about ASP.NET and I've reached a point where I'm really confused.
**Works**
```
@foreach (var link in Model)
{
@Html.RouteLink(link, new { controller = "Product", action = "List", category = link, page = 1 });
}
```
**Doesn't work**
```
@foreach (var link in Model)
{
... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14505185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/825637/"
] | The `@` in this instance indicates that you want to output the result of the statement to the user. Similar to `Response.Write()`.
When the `@` sign is omitted, the function returns the result, but as it is not assigned or sent anywhere, it is lost. | The thing to remember is that you can have html inside that foreach block as well:
Works:
```
@if (someConditionalExpression)
{
<p>Only shown if the conditional was true.</p>
}
```
Since markup is also legal here, you need to use the `@` symbol to indicate to the view engine that you want code again, rather tha... |
14,505,185 | I'm reading in Steven Sanderson's book about ASP.NET and I've reached a point where I'm really confused.
**Works**
```
@foreach (var link in Model)
{
@Html.RouteLink(link, new { controller = "Product", action = "List", category = link, page = 1 });
}
```
**Doesn't work**
```
@foreach (var link in Model)
{
... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14505185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/825637/"
] | Inside the `foreach` the parser automagically works out if it is in code mode or razor template mode, allowing you to output html, razor or code.
The difference between the two statements is one is in razor template mode (working) and the other is in code mode (not working)
`Html.RouteLink` returns an `MvcHtmlString... | The `@` in this instance indicates that you want to output the result of the statement to the user. Similar to `Response.Write()`.
When the `@` sign is omitted, the function returns the result, but as it is not assigned or sent anywhere, it is lost. |
30,801,333 | I'm struggling to get a regex expression to work.
I need to allow the following transforms based on the existence of leading zeros...
>
> 1. 001234 -> 1234
> 2. 1234 -> 1234
> 3. 00AbcD -> AbcD
> 4. 001234.1234 -> 1234.1234
> 5. 001234.000002 -> 1234.2
> 6. 001234/000002 -> 1234.2
>
>
>
I've found the expression... | 2015/06/12 | [
"https://Stackoverflow.com/questions/30801333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/565804/"
] | You can get the zeros with following regex :
```
/(?:^|[./])0+/g
```
[Demo](https://regex101.com/r/gK6bV2/1)
and replace the second group with first group (`\1`).
For example in python i can do following :
```
>>> s="""001234
... 1234
... 00AbcD
... 001234.1234
... 001234.000002
... 001234/000002"""
>>> [re.sub... | ```
^(0+)(.+)
```
Group 2 should be result. |
49,520,535 | I am attempting to use two different area generators inside one `.data()` selection, so that one set of points can have an area rendered from top to bottom while the second set's area can be rendered from left to right. I can pass fat arrow functions to every `.attr()` except 'd', which produces the following error:
`... | 2018/03/27 | [
"https://Stackoverflow.com/questions/49520535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6881890/"
] | The issue in your code is simply the famous **first argument** in D3.
Your [comment](https://stackoverflow.com/questions/49520535/d3-js-v4-pass-function-to-attrd#comment86049227_49521191):
>
> I was wondering why D3 executes the area generator automatically if it's passed by itself (`.attr('d', myArea)`) but doesn'... | if you inspect your generated code, you'll see this:
[](https://i.stack.imgur.com/noG5I.png)
So, you are not geting values. Instead call the function.
Add `(d)` to the return value so that the area generator function is executed:
```
.attr('d', f... |
18,534,563 | I should write a journal when I do changes in my code to make it work, sometimes, in a rush, I just put it to work without knowing exactly why.
I did change a setRequestHeader of a xmlhttprequest from "application/x-www-form-urlencoded; charset=UTF-8" to "application/octet-stream", for some reason, but later, when try... | 2013/08/30 | [
"https://Stackoverflow.com/questions/18534563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1572493/"
] | I realized my mistakes:
A) The samples i am drawing need to come from the `.rvs` method. Like so:
`sample_dist = sp.stats.lognorm.rvs(3, loc=0, scale=np.exp(10), size=2000)`
B) The fit has some problems. When we fix the `loc` parameter the fit succeeds much better.
`param=sp.stats.lognorm.fit(samp, floc=0)` | This problem has been fixed in newer scipy versions. After upgrading scipy0.9 to scipy0.14 the problem dissapears. |
18,534,563 | I should write a journal when I do changes in my code to make it work, sometimes, in a rush, I just put it to work without knowing exactly why.
I did change a setRequestHeader of a xmlhttprequest from "application/x-www-form-urlencoded; charset=UTF-8" to "application/octet-stream", for some reason, but later, when try... | 2013/08/30 | [
"https://Stackoverflow.com/questions/18534563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1572493/"
] | I realized my mistakes:
A) The samples i am drawing need to come from the `.rvs` method. Like so:
`sample_dist = sp.stats.lognorm.rvs(3, loc=0, scale=np.exp(10), size=2000)`
B) The fit has some problems. When we fix the `loc` parameter the fit succeeds much better.
`param=sp.stats.lognorm.fit(samp, floc=0)` | I answered in [here](https://stackoverflow.com/a/48714583/2412701)
I leave the code here too just for lazy :D
```
import scipy
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
mu = 10 # Mean of sample !!! Make sure your data is positive for the lognormal example
sigma = 1.5 # Standard deviat... |
18,534,563 | I should write a journal when I do changes in my code to make it work, sometimes, in a rush, I just put it to work without knowing exactly why.
I did change a setRequestHeader of a xmlhttprequest from "application/x-www-form-urlencoded; charset=UTF-8" to "application/octet-stream", for some reason, but later, when try... | 2013/08/30 | [
"https://Stackoverflow.com/questions/18534563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1572493/"
] | I realized my mistakes:
A) The samples i am drawing need to come from the `.rvs` method. Like so:
`sample_dist = sp.stats.lognorm.rvs(3, loc=0, scale=np.exp(10), size=2000)`
B) The fit has some problems. When we fix the `loc` parameter the fit succeeds much better.
`param=sp.stats.lognorm.fit(samp, floc=0)` | If you are just interested in plotting you can use seaborn to get a lognormal distribution.
```
import seaborn as sns
import numpy as np
from scipy import stats
mu=0
sigma=1
n=1000
x=np.random.normal(mu,sigma,n)
sns.distplot(x, fit=stats.norm) # normal distribution
loc=0
scale=1
x=np.log(np.random.lognormal(loc,sc... |
18,534,563 | I should write a journal when I do changes in my code to make it work, sometimes, in a rush, I just put it to work without knowing exactly why.
I did change a setRequestHeader of a xmlhttprequest from "application/x-www-form-urlencoded; charset=UTF-8" to "application/octet-stream", for some reason, but later, when try... | 2013/08/30 | [
"https://Stackoverflow.com/questions/18534563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1572493/"
] | I made the same observations: a free fit of all parameters fails most of the time. You can help by providing a better initial guess, fixing the parameter is not necessary.
```
samp = stats.lognorm(0.5,loc=0,scale=1).rvs(size=2000)
# this is where the fit gets it initial guess from
print stats.lognorm._fitstart(samp)
... | This problem has been fixed in newer scipy versions. After upgrading scipy0.9 to scipy0.14 the problem dissapears. |
18,534,563 | I should write a journal when I do changes in my code to make it work, sometimes, in a rush, I just put it to work without knowing exactly why.
I did change a setRequestHeader of a xmlhttprequest from "application/x-www-form-urlencoded; charset=UTF-8" to "application/octet-stream", for some reason, but later, when try... | 2013/08/30 | [
"https://Stackoverflow.com/questions/18534563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1572493/"
] | I made the same observations: a free fit of all parameters fails most of the time. You can help by providing a better initial guess, fixing the parameter is not necessary.
```
samp = stats.lognorm(0.5,loc=0,scale=1).rvs(size=2000)
# this is where the fit gets it initial guess from
print stats.lognorm._fitstart(samp)
... | I answered in [here](https://stackoverflow.com/a/48714583/2412701)
I leave the code here too just for lazy :D
```
import scipy
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
mu = 10 # Mean of sample !!! Make sure your data is positive for the lognormal example
sigma = 1.5 # Standard deviat... |
18,534,563 | I should write a journal when I do changes in my code to make it work, sometimes, in a rush, I just put it to work without knowing exactly why.
I did change a setRequestHeader of a xmlhttprequest from "application/x-www-form-urlencoded; charset=UTF-8" to "application/octet-stream", for some reason, but later, when try... | 2013/08/30 | [
"https://Stackoverflow.com/questions/18534563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1572493/"
] | I made the same observations: a free fit of all parameters fails most of the time. You can help by providing a better initial guess, fixing the parameter is not necessary.
```
samp = stats.lognorm(0.5,loc=0,scale=1).rvs(size=2000)
# this is where the fit gets it initial guess from
print stats.lognorm._fitstart(samp)
... | If you are just interested in plotting you can use seaborn to get a lognormal distribution.
```
import seaborn as sns
import numpy as np
from scipy import stats
mu=0
sigma=1
n=1000
x=np.random.normal(mu,sigma,n)
sns.distplot(x, fit=stats.norm) # normal distribution
loc=0
scale=1
x=np.log(np.random.lognormal(loc,sc... |
18,534,563 | I should write a journal when I do changes in my code to make it work, sometimes, in a rush, I just put it to work without knowing exactly why.
I did change a setRequestHeader of a xmlhttprequest from "application/x-www-form-urlencoded; charset=UTF-8" to "application/octet-stream", for some reason, but later, when try... | 2013/08/30 | [
"https://Stackoverflow.com/questions/18534563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1572493/"
] | This problem has been fixed in newer scipy versions. After upgrading scipy0.9 to scipy0.14 the problem dissapears. | I answered in [here](https://stackoverflow.com/a/48714583/2412701)
I leave the code here too just for lazy :D
```
import scipy
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
mu = 10 # Mean of sample !!! Make sure your data is positive for the lognormal example
sigma = 1.5 # Standard deviat... |
18,534,563 | I should write a journal when I do changes in my code to make it work, sometimes, in a rush, I just put it to work without knowing exactly why.
I did change a setRequestHeader of a xmlhttprequest from "application/x-www-form-urlencoded; charset=UTF-8" to "application/octet-stream", for some reason, but later, when try... | 2013/08/30 | [
"https://Stackoverflow.com/questions/18534563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1572493/"
] | If you are just interested in plotting you can use seaborn to get a lognormal distribution.
```
import seaborn as sns
import numpy as np
from scipy import stats
mu=0
sigma=1
n=1000
x=np.random.normal(mu,sigma,n)
sns.distplot(x, fit=stats.norm) # normal distribution
loc=0
scale=1
x=np.log(np.random.lognormal(loc,sc... | I answered in [here](https://stackoverflow.com/a/48714583/2412701)
I leave the code here too just for lazy :D
```
import scipy
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
mu = 10 # Mean of sample !!! Make sure your data is positive for the lognormal example
sigma = 1.5 # Standard deviat... |
18,676,065 | I am creating a wrapper, mock sample as follows
```
var car = function() {
}
car.prototype.method1 = function() {
this.method2();
}
car.protoptype.method2 = function(callback) {
var request = foo() //call to async method
request.onsucces = function() {
this.method3();
});
}
car.protoptype.m... | 2013/09/07 | [
"https://Stackoverflow.com/questions/18676065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648914/"
] | I think you will want [`fn.bind`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind)
```
request.onsuccess = this.method3.bind(this);
```
This way you can avoid any `var that = this;` context hacks
**Note** this relies on ECMAScript 5 and will not work in dinosaur browse... | This is probably due to the `context` from within the callback. You can store a reference to `this` as `self`:
```
car.protoptype.method2 = function(callback) {
var self = this;
var request = foo() //call to async method
request.onsucces(function() {
self.method3()
});
}
```
Others have suggeste... |
18,676,065 | I am creating a wrapper, mock sample as follows
```
var car = function() {
}
car.prototype.method1 = function() {
this.method2();
}
car.protoptype.method2 = function(callback) {
var request = foo() //call to async method
request.onsucces = function() {
this.method3();
});
}
car.protoptype.m... | 2013/09/07 | [
"https://Stackoverflow.com/questions/18676065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648914/"
] | I think you will want [`fn.bind`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind)
```
request.onsuccess = this.method3.bind(this);
```
This way you can avoid any `var that = this;` context hacks
**Note** this relies on ECMAScript 5 and will not work in dinosaur browse... | Use `Function.prototype.bind()`
```
request.onsuccess = this.method3.bind(this);
```
This creates a new function with the value you passed as the first argument bound as the `this` value. |
24,395,618 | I have a Rails 4 application that I use in conjunction with `sidekiq` to run asynchronous jobs. One of the jobs I normally run outside of my Rails application is a large set of complex SQL queries that cannot really be modeled by ActiveRecord. The connection this set of SQL queries has with my Rails app is that it shou... | 2014/06/24 | [
"https://Stackoverflow.com/questions/24395618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175836/"
] | If you are running big SQL every time, i suggest you to create a sql `view` for it. It be boost the execution time. The other thing is, if possible try to split all those SQL query in such a way that it will be executed parallely instead of sequentially and then push it to `sidekiq` queue.
You have to use `ActiveRecor... | I see this post is kind of old. But I would like to add my solution to it. I was in a similar situation; I also needed a way to force feed "PRAGMA foreign\_keys = on;" into my sqlite connection (I could not find a previous post that spelled it out how to do it.) Anywho, this worked like a charm for me. It allowed me to... |
24,395,618 | I have a Rails 4 application that I use in conjunction with `sidekiq` to run asynchronous jobs. One of the jobs I normally run outside of my Rails application is a large set of complex SQL queries that cannot really be modeled by ActiveRecord. The connection this set of SQL queries has with my Rails app is that it shou... | 2014/06/24 | [
"https://Stackoverflow.com/questions/24395618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175836/"
] | 1. use available database tools to handle the complex queries, such as views, stored procedures etc and call them as other people already suggested (`ActiveRecord::Base.connection.execute` and `ModelClass.find_by_sql` for example)- it might very well cut down significantly on query preparation time in the DB and make y... | I see this post is kind of old. But I would like to add my solution to it. I was in a similar situation; I also needed a way to force feed "PRAGMA foreign\_keys = on;" into my sqlite connection (I could not find a previous post that spelled it out how to do it.) Anywho, this worked like a charm for me. It allowed me to... |
24,395,618 | I have a Rails 4 application that I use in conjunction with `sidekiq` to run asynchronous jobs. One of the jobs I normally run outside of my Rails application is a large set of complex SQL queries that cannot really be modeled by ActiveRecord. The connection this set of SQL queries has with my Rails app is that it shou... | 2014/06/24 | [
"https://Stackoverflow.com/questions/24395618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175836/"
] | You didn't say what database you are using, so I'm going to assume MySQL.
You could shell out to the `mysql` binary to do the work:
```
result = `mysql -u #{user} --password #{password} #{database} < #{huge_sql_filename}`
```
Or use `ActiveRecord::Base.connection.execute(File.read("huge.sql"))`, but it won't work ... | I see this post is kind of old. But I would like to add my solution to it. I was in a similar situation; I also needed a way to force feed "PRAGMA foreign\_keys = on;" into my sqlite connection (I could not find a previous post that spelled it out how to do it.) Anywho, this worked like a charm for me. It allowed me to... |
24,395,618 | I have a Rails 4 application that I use in conjunction with `sidekiq` to run asynchronous jobs. One of the jobs I normally run outside of my Rails application is a large set of complex SQL queries that cannot really be modeled by ActiveRecord. The connection this set of SQL queries has with my Rails app is that it shou... | 2014/06/24 | [
"https://Stackoverflow.com/questions/24395618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175836/"
] | I agree with Sharagoz, if you just need to run a specific query, the best way is to send the query string directly into the connection, like:
```
ActiveRecord::Base.connection.execute(File.read("myquery.sql"))
```
If the query is not static and you have to compose it, I would use Arel, it's already present in Rails ... | I had the same problem with a set of sql statements that I needed to execute all in one call to the server. What worked for me was to set up an initializer for Mysql2 adapter (as explained in [infused answer](https://stackoverflow.com/questions/24395618/invoking-a-large-set-of-sql-from-a-rails-4-application/24460961#24... |
24,395,618 | I have a Rails 4 application that I use in conjunction with `sidekiq` to run asynchronous jobs. One of the jobs I normally run outside of my Rails application is a large set of complex SQL queries that cannot really be modeled by ActiveRecord. The connection this set of SQL queries has with my Rails app is that it shou... | 2014/06/24 | [
"https://Stackoverflow.com/questions/24395618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175836/"
] | If you want to execute raw SQL through active record you can use this API:
`ActiveRecord::Base.connection.execute("SELECT COUNT(*) FROM users")` | 1. use available database tools to handle the complex queries, such as views, stored procedures etc and call them as other people already suggested (`ActiveRecord::Base.connection.execute` and `ModelClass.find_by_sql` for example)- it might very well cut down significantly on query preparation time in the DB and make y... |
24,395,618 | I have a Rails 4 application that I use in conjunction with `sidekiq` to run asynchronous jobs. One of the jobs I normally run outside of my Rails application is a large set of complex SQL queries that cannot really be modeled by ActiveRecord. The connection this set of SQL queries has with my Rails app is that it shou... | 2014/06/24 | [
"https://Stackoverflow.com/questions/24395618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175836/"
] | Executing one query is - as outlined by other people - quite simply done through
```
ActiveRecord::Base.connection.execute("SELECT COUNT(*) FROM users")
```
You are talking about a 20.000 line sql script of multiple queries. Assuming you have the file somewhat under control, you can extract the individual queries fr... | 1. use available database tools to handle the complex queries, such as views, stored procedures etc and call them as other people already suggested (`ActiveRecord::Base.connection.execute` and `ModelClass.find_by_sql` for example)- it might very well cut down significantly on query preparation time in the DB and make y... |
24,395,618 | I have a Rails 4 application that I use in conjunction with `sidekiq` to run asynchronous jobs. One of the jobs I normally run outside of my Rails application is a large set of complex SQL queries that cannot really be modeled by ActiveRecord. The connection this set of SQL queries has with my Rails app is that it shou... | 2014/06/24 | [
"https://Stackoverflow.com/questions/24395618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175836/"
] | I agree with Sharagoz, if you just need to run a specific query, the best way is to send the query string directly into the connection, like:
```
ActiveRecord::Base.connection.execute(File.read("myquery.sql"))
```
If the query is not static and you have to compose it, I would use Arel, it's already present in Rails ... | You didn't say what database you are using, so I'm going to assume MySQL.
You could shell out to the `mysql` binary to do the work:
```
result = `mysql -u #{user} --password #{password} #{database} < #{huge_sql_filename}`
```
Or use `ActiveRecord::Base.connection.execute(File.read("huge.sql"))`, but it won't work ... |
24,395,618 | I have a Rails 4 application that I use in conjunction with `sidekiq` to run asynchronous jobs. One of the jobs I normally run outside of my Rails application is a large set of complex SQL queries that cannot really be modeled by ActiveRecord. The connection this set of SQL queries has with my Rails app is that it shou... | 2014/06/24 | [
"https://Stackoverflow.com/questions/24395618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175836/"
] | I agree with Sharagoz, if you just need to run a specific query, the best way is to send the query string directly into the connection, like:
```
ActiveRecord::Base.connection.execute(File.read("myquery.sql"))
```
If the query is not static and you have to compose it, I would use Arel, it's already present in Rails ... | If you are running big SQL every time, i suggest you to create a sql `view` for it. It be boost the execution time. The other thing is, if possible try to split all those SQL query in such a way that it will be executed parallely instead of sequentially and then push it to `sidekiq` queue.
You have to use `ActiveRecor... |
24,395,618 | I have a Rails 4 application that I use in conjunction with `sidekiq` to run asynchronous jobs. One of the jobs I normally run outside of my Rails application is a large set of complex SQL queries that cannot really be modeled by ActiveRecord. The connection this set of SQL queries has with my Rails app is that it shou... | 2014/06/24 | [
"https://Stackoverflow.com/questions/24395618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175836/"
] | You didn't say what database you are using, so I'm going to assume MySQL.
You could shell out to the `mysql` binary to do the work:
```
result = `mysql -u #{user} --password #{password} #{database} < #{huge_sql_filename}`
```
Or use `ActiveRecord::Base.connection.execute(File.read("huge.sql"))`, but it won't work ... | I had the same problem with a set of sql statements that I needed to execute all in one call to the server. What worked for me was to set up an initializer for Mysql2 adapter (as explained in [infused answer](https://stackoverflow.com/questions/24395618/invoking-a-large-set-of-sql-from-a-rails-4-application/24460961#24... |
24,395,618 | I have a Rails 4 application that I use in conjunction with `sidekiq` to run asynchronous jobs. One of the jobs I normally run outside of my Rails application is a large set of complex SQL queries that cannot really be modeled by ActiveRecord. The connection this set of SQL queries has with my Rails app is that it shou... | 2014/06/24 | [
"https://Stackoverflow.com/questions/24395618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175836/"
] | I agree with Sharagoz, if you just need to run a specific query, the best way is to send the query string directly into the connection, like:
```
ActiveRecord::Base.connection.execute(File.read("myquery.sql"))
```
If the query is not static and you have to compose it, I would use Arel, it's already present in Rails ... | Executing one query is - as outlined by other people - quite simply done through
```
ActiveRecord::Base.connection.execute("SELECT COUNT(*) FROM users")
```
You are talking about a 20.000 line sql script of multiple queries. Assuming you have the file somewhat under control, you can extract the individual queries fr... |
9,346,604 | ```
public function genMenu($parent_id, $menu_type, $utype, $parent_token=0, $currentpage = 0) {
$stmt = $this->db->prepare("SELECT n.page_id, p.short_name, p.token FROM navigation AS n, pages AS p, user_page_restr AS r WHERE n.parent_id = ? AND r.pg_id=p.id AND n.menu=? AND (r.user_type=? OR r.user_type=0) AND n.... | 2012/02/19 | [
"https://Stackoverflow.com/questions/9346604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/978733/"
] | I'm guessing that PHP is implicitly converting the string to an `int`, which would lead to a comparison `0 == 0`, which would always be true. Try using the strict equality operator:
```
$menu['token'] === $currentpage
```
What a strict equality operator does is compare both the type *and* the value of the two sides.... | 'new\_mail' get cast to an integer for comparison; which becomes 0.
```
"new_mail" == 0 equals true
``` |
9,346,604 | ```
public function genMenu($parent_id, $menu_type, $utype, $parent_token=0, $currentpage = 0) {
$stmt = $this->db->prepare("SELECT n.page_id, p.short_name, p.token FROM navigation AS n, pages AS p, user_page_restr AS r WHERE n.parent_id = ? AND r.pg_id=p.id AND n.menu=? AND (r.user_type=? OR r.user_type=0) AND n.... | 2012/02/19 | [
"https://Stackoverflow.com/questions/9346604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/978733/"
] | You have a casting issue. When you compare an integer to a string with the `==` operator the string is cast to its integer equivalent, which for a string that does not begin with a digit is 0.
The answer depends on what you want to do. If you only want to match a string with a string use the `===` operator.
If you wa... | I'm guessing that PHP is implicitly converting the string to an `int`, which would lead to a comparison `0 == 0`, which would always be true. Try using the strict equality operator:
```
$menu['token'] === $currentpage
```
What a strict equality operator does is compare both the type *and* the value of the two sides.... |
9,346,604 | ```
public function genMenu($parent_id, $menu_type, $utype, $parent_token=0, $currentpage = 0) {
$stmt = $this->db->prepare("SELECT n.page_id, p.short_name, p.token FROM navigation AS n, pages AS p, user_page_restr AS r WHERE n.parent_id = ? AND r.pg_id=p.id AND n.menu=? AND (r.user_type=? OR r.user_type=0) AND n.... | 2012/02/19 | [
"https://Stackoverflow.com/questions/9346604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/978733/"
] | You have a casting issue. When you compare an integer to a string with the `==` operator the string is cast to its integer equivalent, which for a string that does not begin with a digit is 0.
The answer depends on what you want to do. If you only want to match a string with a string use the `===` operator.
If you wa... | 'new\_mail' get cast to an integer for comparison; which becomes 0.
```
"new_mail" == 0 equals true
``` |
10,193,774 | I submitted a question that was actually a bunch of questions in one, so i'm splitting them into their own separate questions, as requested.
just a general question about direct3D, if i was to write an application entirely in d3d11 with hlsl 5.0 shaders, will these still be compatible with only d3d10 or d3d9 capable s... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10193774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1191020/"
] | I don't believe the previous comment is entirely accurate.
You might need to install the DX11 runtime onto the target machine, but you should be able to create a D3D11Device on any card that is DX9+ hardware compatible.
But that doesn't really get you much, because you need to pass in a list of feature levels you sup... | No, it is not backwards compatible. If you want to run on more platforms, a directX11 capable graphics card will certainly support directx9. So either develop one time in DX9, or in both DX11 and DX9. |
10,193,774 | I submitted a question that was actually a bunch of questions in one, so i'm splitting them into their own separate questions, as requested.
just a general question about direct3D, if i was to write an application entirely in d3d11 with hlsl 5.0 shaders, will these still be compatible with only d3d10 or d3d9 capable s... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10193774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1191020/"
] | It is backward compatible to a certain degree. However there are few things to keep in mind:
* DX11 can only be installed on Vista+, which eliminates whose who are still sitting on XP for religious reasons (I personally think it's stupid, but that's just a fact that you have to be aware of)
* DX11's killer-feature (ha... | No, it is not backwards compatible. If you want to run on more platforms, a directX11 capable graphics card will certainly support directx9. So either develop one time in DX9, or in both DX11 and DX9. |
10,193,774 | I submitted a question that was actually a bunch of questions in one, so i'm splitting them into their own separate questions, as requested.
just a general question about direct3D, if i was to write an application entirely in d3d11 with hlsl 5.0 shaders, will these still be compatible with only d3d10 or d3d9 capable s... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10193774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1191020/"
] | It is backward compatible to a certain degree. However there are few things to keep in mind:
* DX11 can only be installed on Vista+, which eliminates whose who are still sitting on XP for religious reasons (I personally think it's stupid, but that's just a fact that you have to be aware of)
* DX11's killer-feature (ha... | I don't believe the previous comment is entirely accurate.
You might need to install the DX11 runtime onto the target machine, but you should be able to create a D3D11Device on any card that is DX9+ hardware compatible.
But that doesn't really get you much, because you need to pass in a list of feature levels you sup... |
8,725,042 | i have done this <http://jsfiddle.net/thilakar/WsxJy/3/> using with anchor tag and name attributes.
but i need to do using with jquery like below link.
<http://www.jibevisuals.com/>
when click on "about us" menu page moves slowly up. I need that kind of work.
Any suggestion
Thanks in advance. | 2012/01/04 | [
"https://Stackoverflow.com/questions/8725042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/824280/"
] | ### Description
You can do this using `jQuery.offset()` and `jQuery.animate()`.
Check out the [jsFiddle Demonstration](http://jsfiddle.net/BjpWB/6/).
### Sample
```
function scrollToAnchor(aid){
var aTag = $("a[name='"+ aid +"']");
$('html,body').animate({scrollTop: aTag.offset().top},'slow');
}
scrollToA... | do you mean like this -> <http://css-tricks.com/examples/SmoothPageScroll/#source-code> ? |
8,725,042 | i have done this <http://jsfiddle.net/thilakar/WsxJy/3/> using with anchor tag and name attributes.
but i need to do using with jquery like below link.
<http://www.jibevisuals.com/>
when click on "about us" menu page moves slowly up. I need that kind of work.
Any suggestion
Thanks in advance. | 2012/01/04 | [
"https://Stackoverflow.com/questions/8725042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/824280/"
] | ### Description
You can do this using `jQuery.offset()` and `jQuery.animate()`.
Check out the [jsFiddle Demonstration](http://jsfiddle.net/BjpWB/6/).
### Sample
```
function scrollToAnchor(aid){
var aTag = $("a[name='"+ aid +"']");
$('html,body').animate({scrollTop: aTag.offset().top},'slow');
}
scrollToA... | Snake Eyes answer is the most dynamic option since you don't have to code every tag in js. All the client has to do is use the HTML solution, better for CMS control.
This little code snippet is all you need (well, ofcourse jQuery too)
```
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (locat... |
8,725,042 | i have done this <http://jsfiddle.net/thilakar/WsxJy/3/> using with anchor tag and name attributes.
but i need to do using with jquery like below link.
<http://www.jibevisuals.com/>
when click on "about us" menu page moves slowly up. I need that kind of work.
Any suggestion
Thanks in advance. | 2012/01/04 | [
"https://Stackoverflow.com/questions/8725042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/824280/"
] | ### Description
You can do this using `jQuery.offset()` and `jQuery.animate()`.
Check out the [jsFiddle Demonstration](http://jsfiddle.net/BjpWB/6/).
### Sample
```
function scrollToAnchor(aid){
var aTag = $("a[name='"+ aid +"']");
$('html,body').animate({scrollTop: aTag.offset().top},'slow');
}
scrollToA... | You can use [jQuery Animate](https://api.jquery.com/animate/):
```
var $root = $('html, body');
$('a').click(function() {
if ($.attr(this, 'href').indexOf("#")!=-1&&$.attr(this, 'href')!="#")
{
$root.animate({
scrollTop: $( $.attr(this, 'href') ).offset().top
}, 500);
... |
8,725,042 | i have done this <http://jsfiddle.net/thilakar/WsxJy/3/> using with anchor tag and name attributes.
but i need to do using with jquery like below link.
<http://www.jibevisuals.com/>
when click on "about us" menu page moves slowly up. I need that kind of work.
Any suggestion
Thanks in advance. | 2012/01/04 | [
"https://Stackoverflow.com/questions/8725042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/824280/"
] | do you mean like this -> <http://css-tricks.com/examples/SmoothPageScroll/#source-code> ? | Snake Eyes answer is the most dynamic option since you don't have to code every tag in js. All the client has to do is use the HTML solution, better for CMS control.
This little code snippet is all you need (well, ofcourse jQuery too)
```
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (locat... |
8,725,042 | i have done this <http://jsfiddle.net/thilakar/WsxJy/3/> using with anchor tag and name attributes.
but i need to do using with jquery like below link.
<http://www.jibevisuals.com/>
when click on "about us" menu page moves slowly up. I need that kind of work.
Any suggestion
Thanks in advance. | 2012/01/04 | [
"https://Stackoverflow.com/questions/8725042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/824280/"
] | You can use [jQuery Animate](https://api.jquery.com/animate/):
```
var $root = $('html, body');
$('a').click(function() {
if ($.attr(this, 'href').indexOf("#")!=-1&&$.attr(this, 'href')!="#")
{
$root.animate({
scrollTop: $( $.attr(this, 'href') ).offset().top
}, 500);
... | Snake Eyes answer is the most dynamic option since you don't have to code every tag in js. All the client has to do is use the HTML solution, better for CMS control.
This little code snippet is all you need (well, ofcourse jQuery too)
```
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (locat... |
60,681,207 | I have a zip in s3 which has hundreds of csv files. I am trying to stream the files and need to read the top n lines of the file. I am able to unzip it and read the content but not sure how to stop the stream when I am done reading n lines and carry on with rest of the files.
Code tried so far
```
const aws = require... | 2020/03/14 | [
"https://Stackoverflow.com/questions/60681207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1021796/"
] | I have tried to replicate a similar case. I hope you require something like this:
```
const etl = require("etl");
const unzip = require("unzip-stream");
const fs = require('fs');
function readRecord(entry, entNum) {
let recordCount = 0;
let etlcsv = entry.pipe(etl.csv())
etlcsv.pipe(etl.map(d => {
... | I've done something a bit similar to this, using got.
I've had to adapt the code so it's not tested, but this general approach worked for me. I've not used etl so I'm not sure how it handles chunks of files rather than whole files.
```
const aws = require("aws-sdk");
const s3 = new aws.S3();
const got = require('got'... |
87,510 | I am working on a text classification task that contains 216 labeled paragraphs. The distribution of tags is as follows:
{0: 17, 1: 15, 2: 16, 3: 9, 4: 10, 5: 18, 6: 24, 7: 9, 8: 33, 9: 38, 10: 27}.
The keys are representing the classes, and the value is the number of samples.
**Here's my questions:**
Q1. Is ther... | 2021/01/05 | [
"https://datascience.stackexchange.com/questions/87510",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/100557/"
] | Just to expand on @Ankita Talwar answer and give some slightly more formal intuition you can write a linear model with to regressors and their interaction as follows:
$$ y = w\_0 + w\_1 x\_1 + w\_2 x\_2 + w\_3 x\_1 x\_2$$
where $x\_1 x\_2$ is the interaction term.
Now refactoring you can see that the interaction can be... | Interaction effect refers to the fact when two or more independent variables together impact the dependent variable. Interaction of two independent variables to affect the outcome variable is not affected by any relation between those variables. We might have a situation where two variables independently might not sign... |
87,510 | I am working on a text classification task that contains 216 labeled paragraphs. The distribution of tags is as follows:
{0: 17, 1: 15, 2: 16, 3: 9, 4: 10, 5: 18, 6: 24, 7: 9, 8: 33, 9: 38, 10: 27}.
The keys are representing the classes, and the value is the number of samples.
**Here's my questions:**
Q1. Is ther... | 2021/01/05 | [
"https://datascience.stackexchange.com/questions/87510",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/100557/"
] | Just to expand on @Ankita Talwar answer and give some slightly more formal intuition you can write a linear model with to regressors and their interaction as follows:
$$ y = w\_0 + w\_1 x\_1 + w\_2 x\_2 + w\_3 x\_1 x\_2$$
where $x\_1 x\_2$ is the interaction term.
Now refactoring you can see that the interaction can be... | Several mixed effects models are available for identification of interaction effects. However, you need to plan and implement a correct statistical design. Choosing an appropriate model in terms of fixed-effects or random effects assumption is crucial part of the process. |
1,421,666 | Why am I getting this warning in Qt Creator: ` inline function ‘bool Lion::growl ()’ used but never defined?
I double-checked my code, and have a declaration
`inline bool growl ()` in `Lion` (`lion.h`)
and the corresponding implementation in `lion.cpp`:
`inline bool Lion::growl ()`
What’s going on?
EDIT: My assu... | 2009/09/14 | [
"https://Stackoverflow.com/questions/1421666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67063/"
] | Well, I don't know the exact problem, but for starters:
* Inline methods are supposed to be implemented in the header file. The compiler needs to know the code to actually *inline* it.
* Also using the "inline" keyword in the class declaration doesn't have any effect. But it cannot hurt either.
See also: [c++ faq lit... | In addition to what Johan said, you cannot have a separate definition and declaration for the function even if both are in the same header file. This holds true especially for member functions of classes. The function code should be of the form:
```
class someClass
{
void someFunc()
{ ... }
}
// This will make the fun... |
1,421,666 | Why am I getting this warning in Qt Creator: ` inline function ‘bool Lion::growl ()’ used but never defined?
I double-checked my code, and have a declaration
`inline bool growl ()` in `Lion` (`lion.h`)
and the corresponding implementation in `lion.cpp`:
`inline bool Lion::growl ()`
What’s going on?
EDIT: My assu... | 2009/09/14 | [
"https://Stackoverflow.com/questions/1421666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67063/"
] | Well, I don't know the exact problem, but for starters:
* Inline methods are supposed to be implemented in the header file. The compiler needs to know the code to actually *inline* it.
* Also using the "inline" keyword in the class declaration doesn't have any effect. But it cannot hurt either.
See also: [c++ faq lit... | >
> Inline methods are supposed to be implemented in the header file. The
> compiler needs to know the code to actually inline it.
>
>
>
Except if the inline function is used in the same project, possibly in another file that *#include* its header.
I miss there is such a restriction for libraries because restric... |
1,421,666 | Why am I getting this warning in Qt Creator: ` inline function ‘bool Lion::growl ()’ used but never defined?
I double-checked my code, and have a declaration
`inline bool growl ()` in `Lion` (`lion.h`)
and the corresponding implementation in `lion.cpp`:
`inline bool Lion::growl ()`
What’s going on?
EDIT: My assu... | 2009/09/14 | [
"https://Stackoverflow.com/questions/1421666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67063/"
] | >
> Inline methods are supposed to be implemented in the header file. The
> compiler needs to know the code to actually inline it.
>
>
>
Except if the inline function is used in the same project, possibly in another file that *#include* its header.
I miss there is such a restriction for libraries because restric... | In addition to what Johan said, you cannot have a separate definition and declaration for the function even if both are in the same header file. This holds true especially for member functions of classes. The function code should be of the form:
```
class someClass
{
void someFunc()
{ ... }
}
// This will make the fun... |
53,167,219 | When I changed constraint layout version to alpha-2 it showing error. previously I was using an older version it was not showing any error:
**older version workes fine without error:**
```
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk... | 2018/11/06 | [
"https://Stackoverflow.com/questions/53167219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6014928/"
] | I used this code to fix that. Put in your app module `build.gradle`:
```
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.an... | change
```
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
```
to
```
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
``` |
45,153,484 | I want to change all values in the dataframe for all the columns except for a particular column. How do i do that?
***Problem 1:*** My below code will change all the values in dataframe where ever it finds 13. But I do not want to change in column C.
```
df <- data.frame(list(A=c(12,14,13), B=c(16,13,18)),c=c(13,20,2... | 2017/07/17 | [
"https://Stackoverflow.com/questions/45153484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8238708/"
] | You can replace all 13s with NA in each of the columns except for C with `dplyr`
```
library(dplyr)
df %>% mutate_at(vars(-one_of("c")), recode, `13`=NA_real_)
```
You can set all values for rows with C==13 to NA with
```
df[df$c==13,setdiff(names(df), "c")]<-NA
```
or using parts of `dplyr`
```
notc <- setdiff(... | You need to define which subset of your data.frame you want to apply the condition as well as defining that subset within that condition.
Also, `1:ncol(df)-1` subtracts 1 from all the sequence so you would get (in this case) `0` and `1` instead of `1` and `2`.
```
df[,1:(ncol(df)-1)][df[,1:(ncol(df)-1)]==13] <-NA
... |
45,153,484 | I want to change all values in the dataframe for all the columns except for a particular column. How do i do that?
***Problem 1:*** My below code will change all the values in dataframe where ever it finds 13. But I do not want to change in column C.
```
df <- data.frame(list(A=c(12,14,13), B=c(16,13,18)),c=c(13,20,2... | 2017/07/17 | [
"https://Stackoverflow.com/questions/45153484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8238708/"
] | You can replace all 13s with NA in each of the columns except for C with `dplyr`
```
library(dplyr)
df %>% mutate_at(vars(-one_of("c")), recode, `13`=NA_real_)
```
You can set all values for rows with C==13 to NA with
```
df[df$c==13,setdiff(names(df), "c")]<-NA
```
or using parts of `dplyr`
```
notc <- setdiff(... | ```
indices = which(df == "13", arr.ind = TRUE)
replace(df, indices[names(df)[indices[,2]]!= "c",], NA)
# A B c
#1 12 16 13
#2 14 NA 20
#3 NA 18 21
replace(df, cbind(which(df$c == "13"), (1:NCOL(df))[-which(names(df) == "c")]), NA)
# A B c
#1 NA NA 13
#2 14 13 20
#3 13 18 21
``` |
949,794 | Windows 10 Action Center lights up whenever I receive a new Outlook mail.
Problem: I get new mails all the time, so the Action Center icon is (almost) constantly lit. Clicking on it to "clear" it is a nuisance, and I'm afraid that I might miss "important" notifications from the Action Center once I start ignoring it.
... | 2015/08/03 | [
"https://superuser.com/questions/949794",
"https://superuser.com",
"https://superuser.com/users/14517/"
] | In the Settings app, go to [System > Notifications & actions](https://support.microsoft.com/en-us/help/4028678/windows-10-change-notification-settings-in-action-center), find Outlook and turn off the toggle in the same row.
Personally, I found it better to let the toggle on, click the whole Outlook row and disable jus... | Right-click on the "Outlook 2013" heading in the Action Center, and select "Turn off notifications for this app". |
949,794 | Windows 10 Action Center lights up whenever I receive a new Outlook mail.
Problem: I get new mails all the time, so the Action Center icon is (almost) constantly lit. Clicking on it to "clear" it is a nuisance, and I'm afraid that I might miss "important" notifications from the Action Center once I start ignoring it.
... | 2015/08/03 | [
"https://superuser.com/questions/949794",
"https://superuser.com",
"https://superuser.com/users/14517/"
] | Right-click on the "Outlook 2013" heading in the Action Center, and select "Turn off notifications for this app". | You can also disable those notifications in Outlook itself. Currently, in Outlook 365, it's under "File" > "Options" > "Mail", section "Message arrival", option "Display a Desktop Alert". |
949,794 | Windows 10 Action Center lights up whenever I receive a new Outlook mail.
Problem: I get new mails all the time, so the Action Center icon is (almost) constantly lit. Clicking on it to "clear" it is a nuisance, and I'm afraid that I might miss "important" notifications from the Action Center once I start ignoring it.
... | 2015/08/03 | [
"https://superuser.com/questions/949794",
"https://superuser.com",
"https://superuser.com/users/14517/"
] | In the Settings app, go to [System > Notifications & actions](https://support.microsoft.com/en-us/help/4028678/windows-10-change-notification-settings-in-action-center), find Outlook and turn off the toggle in the same row.
Personally, I found it better to let the toggle on, click the whole Outlook row and disable jus... | You can also disable those notifications in Outlook itself. Currently, in Outlook 365, it's under "File" > "Options" > "Mail", section "Message arrival", option "Display a Desktop Alert". |
19,754,256 | I have multiple buttons in my WinForm. A random sequence is chosen and the buttons have to be pressed in that sequence.
How do i detect If the sequence was broken i.e. the buttons were not clicked in the proper order?
The point is that i want to know which button was pressed after a certain button was pressed
```
D... | 2013/11/03 | [
"https://Stackoverflow.com/questions/19754256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866752/"
] | Make all the buttons fire the same handler and append the Text() property to a String:
```
Private sequence As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click, Button5.Click, _
Button6.Click, Butt... | Try this...
You'll need to add 10 buttons (in this case), and enter the numbers 1 to 10 in the tag properties for them...
**EDIT:** A smarter way ;-)
```
Dim lstButtonOrder As New List(Of Integer)
Dim lstMyRandomArray As New List(Of Integer)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Lo... |
19,754,256 | I have multiple buttons in my WinForm. A random sequence is chosen and the buttons have to be pressed in that sequence.
How do i detect If the sequence was broken i.e. the buttons were not clicked in the proper order?
The point is that i want to know which button was pressed after a certain button was pressed
```
D... | 2013/11/03 | [
"https://Stackoverflow.com/questions/19754256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866752/"
] | Make all the buttons fire the same handler and append the Text() property to a String:
```
Private sequence As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click, Button5.Click, _
Button6.Click, Butt... | I’d keep an array of buttons:
```
Private buttons() As Button = { Me.Button1, Me.Button2, Me.Button3, … }
```
You can make a handler:
```
Private Sub Button_Click(sender As Object, e As EventArgs)
' TODO
End Sub
```
Add the handlers to the buttons in `New()`:
```
Public Sub New()
Me.InitializeComponent()... |
4,602 | Through my studies I have come across the letter 'Ь' for soft sign and the letter 'й' for iot. I wonder now if there are more named letters within the Ukrainian language. | 2018/07/23 | [
"https://ukrainian.stackexchange.com/questions/4602",
"https://ukrainian.stackexchange.com",
"https://ukrainian.stackexchange.com/users/1642/"
] | Every letter has a name.
But the fact is that names of the most of the Ukrainian letters simply resemble their pronunciations more or less:
* Names of vowel-like letters exactly resemble their pronunciation as when the letter is used in the beginning of the word, e.g.: *а* is called *а* /ɑ/, *я* is called *я* /jɑ/, e... | *Just for notice to answer of Sasha and about not obviously things.*
Sasha writed about their *sound* for reading alphabet. What is it meaning? When to write here is just *к* — not *ка*, but when reading, here is *ка*. So, each letter is already name themself.
Another thing, Ukrainian has genders, and each name of l... |
23,031,274 | Hello World, am kinda new To java and oop and I would like to ask if an infinite loop needs an increment for example
```
for(int i = 0;i < 4;i++) {
System.out.print("Hello World");
}
```
so in this loop, there is an increment, so do all types of loop need increment | 2014/04/12 | [
"https://Stackoverflow.com/questions/23031274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3526881/"
] | No, if you want to run an infinite loop you could use `while(true)`
```
while (true) {
System.out.print("Hello World");
}
```
With your `for` you are just doing an useless thing (increment `i` every time).
If you need to keep a "number of times"
```
int x = 0;
while (true) {
System.out.print("Hello World");
... | Infinite loop with for :
```
for(;;) {
System.out.print("Hello World");
}
```
Indeed there are infinite ways to create an infinite loop with either `for` or `while` or `do..while` statements, if only the condition never satisfies. |
23,031,274 | Hello World, am kinda new To java and oop and I would like to ask if an infinite loop needs an increment for example
```
for(int i = 0;i < 4;i++) {
System.out.print("Hello World");
}
```
so in this loop, there is an increment, so do all types of loop need increment | 2014/04/12 | [
"https://Stackoverflow.com/questions/23031274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3526881/"
] | No, if you want to run an infinite loop you could use `while(true)`
```
while (true) {
System.out.print("Hello World");
}
```
With your `for` you are just doing an useless thing (increment `i` every time).
If you need to keep a "number of times"
```
int x = 0;
while (true) {
System.out.print("Hello World");
... | Infinite loop using for()
```
for(;;) {
System.out.print("Hello World");
}
``` |
23,031,274 | Hello World, am kinda new To java and oop and I would like to ask if an infinite loop needs an increment for example
```
for(int i = 0;i < 4;i++) {
System.out.print("Hello World");
}
```
so in this loop, there is an increment, so do all types of loop need increment | 2014/04/12 | [
"https://Stackoverflow.com/questions/23031274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3526881/"
] | This loop:
```
for(int i = 0;i < 4;i++) {
System.out.print("Hello World");
}
```
is not infinite. It will iterate 4 times, then end. If you wanted an infinite loop, then you could do this:
```
for(;;) {
System.out.print("Hello World");
}
```
or:
```
while(true)
{
System.out.print("Hello World");
}
``... | Infinite loop with for :
```
for(;;) {
System.out.print("Hello World");
}
```
Indeed there are infinite ways to create an infinite loop with either `for` or `while` or `do..while` statements, if only the condition never satisfies. |
23,031,274 | Hello World, am kinda new To java and oop and I would like to ask if an infinite loop needs an increment for example
```
for(int i = 0;i < 4;i++) {
System.out.print("Hello World");
}
```
so in this loop, there is an increment, so do all types of loop need increment | 2014/04/12 | [
"https://Stackoverflow.com/questions/23031274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3526881/"
] | This loop:
```
for(int i = 0;i < 4;i++) {
System.out.print("Hello World");
}
```
is not infinite. It will iterate 4 times, then end. If you wanted an infinite loop, then you could do this:
```
for(;;) {
System.out.print("Hello World");
}
```
or:
```
while(true)
{
System.out.print("Hello World");
}
``... | Infinite loop using for()
```
for(;;) {
System.out.print("Hello World");
}
``` |
54,048,436 | I would like to do a comparison among items in a pandas series. If the item is not equal to the next value, append to a list, else move on. I think my code is working, except it fails on the last occurrence because the index of items[k+1] is out of range. How do I get this to stop comparing on the last row?
I am doing... | 2019/01/05 | [
"https://Stackoverflow.com/questions/54048436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4123749/"
] | One solution is to catch `KeyError`:
```
for k, i in items.items():
try:
if items[k+1] != items[k]:
unique.append(items[k+1])
except KeyError:
pass
```
But you shouldn't be iterating this way in the first place, as Pandas specialises in vectorised operations. You can use [`shift`]... | You can use `shift()` for this.
```
df = pd.DataFrame({'euribor3m':[5,5,7,7,8,9,11,11,34,45,45]})
df0 = df.shift()
mask = df['euribor3m']==df0['euribor3m']
df_new = df[mask]
print(list(df_new['euribor3m']))
```
Output:
```
[5, 7, 11, 45]
``` |
863 | Lately I’ve been seeing a lot of comments arguing about downvotes, close votes, and topicality, many of which get deleted by moderators. For example:
[How to identify complex time signatures?](https://music.stackexchange.com/questions/22436/how-to-identify-complex-time-signatures)
>
> I have cleaned up the comments ... | 2014/08/10 | [
"https://music.meta.stackexchange.com/questions/863",
"https://music.meta.stackexchange.com",
"https://music.meta.stackexchange.com/users/6556/"
] | I guess we simply agree to not have these discussions in the comments, linking to e.g. this question for reasons why. One comment with a link to the corresponding question / chat room should be enough. | I have to say that I am guilty of the argumentative comments described in this post. I am a supporter of a more tolerant set of rules, and many of my comments are along the lines of "Please don't close this question even though it seems off-topic. X and Y are good reasons why this question is to be considered on-topic.... |
863 | Lately I’ve been seeing a lot of comments arguing about downvotes, close votes, and topicality, many of which get deleted by moderators. For example:
[How to identify complex time signatures?](https://music.stackexchange.com/questions/22436/how-to-identify-complex-time-signatures)
>
> I have cleaned up the comments ... | 2014/08/10 | [
"https://music.meta.stackexchange.com/questions/863",
"https://music.meta.stackexchange.com",
"https://music.meta.stackexchange.com/users/6556/"
] | I guess we simply agree to not have these discussions in the comments, linking to e.g. this question for reasons why. One comment with a link to the corresponding question / chat room should be enough. | I do think *some* meta-commentary is reasonable and appropriate for questions. When there are concrete reasons, specific to the question, why the usual policies might not apply, I think it’s entirely appropriate to point them out. For example, it’s good to point out why a question isn’t really a duplicate. Likewise, it... |
863 | Lately I’ve been seeing a lot of comments arguing about downvotes, close votes, and topicality, many of which get deleted by moderators. For example:
[How to identify complex time signatures?](https://music.stackexchange.com/questions/22436/how-to-identify-complex-time-signatures)
>
> I have cleaned up the comments ... | 2014/08/10 | [
"https://music.meta.stackexchange.com/questions/863",
"https://music.meta.stackexchange.com",
"https://music.meta.stackexchange.com/users/6556/"
] | I do think *some* meta-commentary is reasonable and appropriate for questions. When there are concrete reasons, specific to the question, why the usual policies might not apply, I think it’s entirely appropriate to point them out. For example, it’s good to point out why a question isn’t really a duplicate. Likewise, it... | I have to say that I am guilty of the argumentative comments described in this post. I am a supporter of a more tolerant set of rules, and many of my comments are along the lines of "Please don't close this question even though it seems off-topic. X and Y are good reasons why this question is to be considered on-topic.... |
2,096,780 | It is famous enough that $f(x)=\exp(x) \to f'(x)=f(x)$ . For example we can show it by taylor series like below :
$$\quad{e^x=1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\frac{x^4}{4!}+...\\
(e^x)'=0+1+\frac{2x}{2!}+\frac{3x^2}{3!}+\frac{4x^3}{4!}+\frac{5x^4}{5!}+...(\text{simplify})\\(e^x)'=1+\frac{x}{1!}+\frac{x^2}{2!}+\frac{x... | 2017/01/13 | [
"https://math.stackexchange.com/questions/2096780",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/104171/"
] | >
> **ATTENTION:** No cucumbers were harmed in the making of the graphics!
>
>
>
Here's a proof that I thought was kind of fun:
You can try this experiment to prove $(e^x)'=e^x$.
**Materials:**
1. A cucumber
2. A knife
3. A cutting board
4. An almost infinite amount of time
---
Place the cucumber on the cutti... | **Yes, you can show this visually.**
I don't know if this could be called a *proof,* strictly speaking, but it will indeed show it visually.
Choose **any** point on the graph of $y=e^x$. Mark that point. (Call it point $B$.)
Now mark the point on the $x$ axis with the same $x$ coordinate as point $B$. (Call it point... |
2,096,780 | It is famous enough that $f(x)=\exp(x) \to f'(x)=f(x)$ . For example we can show it by taylor series like below :
$$\quad{e^x=1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\frac{x^4}{4!}+...\\
(e^x)'=0+1+\frac{2x}{2!}+\frac{3x^2}{3!}+\frac{4x^3}{4!}+\frac{5x^4}{5!}+...(\text{simplify})\\(e^x)'=1+\frac{x}{1!}+\frac{x^2}{2!}+\frac{x... | 2017/01/13 | [
"https://math.stackexchange.com/questions/2096780",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/104171/"
] | **Yes, you can show this visually.**
I don't know if this could be called a *proof,* strictly speaking, but it will indeed show it visually.
Choose **any** point on the graph of $y=e^x$. Mark that point. (Call it point $B$.)
Now mark the point on the $x$ axis with the same $x$ coordinate as point $B$. (Call it point... | Here is a completion of [the idea given by Wildcard](https://math.stackexchange.com/a/2096791/276406), turning the visual demonstration into a proof.
We claim that for any $x\_0$, the line
$$y(x)=e^{x\_0}(x-(x\_0-1))$$
is tangent to $e^x$ at $x\_0$. This tells us, as Wildcard suggested, that the derivative of $e^x$ ... |
2,096,780 | It is famous enough that $f(x)=\exp(x) \to f'(x)=f(x)$ . For example we can show it by taylor series like below :
$$\quad{e^x=1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\frac{x^4}{4!}+...\\
(e^x)'=0+1+\frac{2x}{2!}+\frac{3x^2}{3!}+\frac{4x^3}{4!}+\frac{5x^4}{5!}+...(\text{simplify})\\(e^x)'=1+\frac{x}{1!}+\frac{x^2}{2!}+\frac{x... | 2017/01/13 | [
"https://math.stackexchange.com/questions/2096780",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/104171/"
] | >
> **ATTENTION:** No cucumbers were harmed in the making of the graphics!
>
>
>
Here's a proof that I thought was kind of fun:
You can try this experiment to prove $(e^x)'=e^x$.
**Materials:**
1. A cucumber
2. A knife
3. A cutting board
4. An almost infinite amount of time
---
Place the cucumber on the cutti... | Here is a completion of [the idea given by Wildcard](https://math.stackexchange.com/a/2096791/276406), turning the visual demonstration into a proof.
We claim that for any $x\_0$, the line
$$y(x)=e^{x\_0}(x-(x\_0-1))$$
is tangent to $e^x$ at $x\_0$. This tells us, as Wildcard suggested, that the derivative of $e^x$ ... |
18,660,121 | I am currently retrofitting several custom code review Packages developed in an ECC environment for use in BW. I used a TOC to bring them from ECC into a BW Sandbox outside of STMS and as expected got a few RC8's. As I am going through and activating and fitting the code base to BW I immediatley came across the missing... | 2013/09/06 | [
"https://Stackoverflow.com/questions/18660121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/625983/"
] | This is not tested but can you try this, assuming you have mapped it already.
```
var map = Mapper.FindTypeMapFor<Source, Destination>();
foreach( var propertMap in map.GetPropertyMaps() )
{
var dest = propertMap.DestinationProperty.MemberInfo;
var source = propertMap.SourceMemb... | You can use simple reflection to achive that. Given that the properties names match in source and destination, you can write following code:
```
PropertyInfo GetDestinationProperty<TSource, TDestination>(string sourceProperty)
{
var result = typeof(TDestination).GetProperty(sourceProperty);
return result;
}
`... |
18,660,121 | I am currently retrofitting several custom code review Packages developed in an ECC environment for use in BW. I used a TOC to bring them from ECC into a BW Sandbox outside of STMS and as expected got a few RC8's. As I am going through and activating and fitting the code base to BW I immediatley came across the missing... | 2013/09/06 | [
"https://Stackoverflow.com/questions/18660121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/625983/"
] | I worked out a solution, but the code is a little messy. To get the path to the destination property in a complex mapping, which I can then toss into the ModelState for errors, I can use this code:
```
public string GetDestinationPath(Type source, Type destination, string propertyName)
{
return GetDest... | You can use simple reflection to achive that. Given that the properties names match in source and destination, you can write following code:
```
PropertyInfo GetDestinationProperty<TSource, TDestination>(string sourceProperty)
{
var result = typeof(TDestination).GetProperty(sourceProperty);
return result;
}
`... |
18,660,121 | I am currently retrofitting several custom code review Packages developed in an ECC environment for use in BW. I used a TOC to bring them from ECC into a BW Sandbox outside of STMS and as expected got a few RC8's. As I am going through and activating and fitting the code base to BW I immediatley came across the missing... | 2013/09/06 | [
"https://Stackoverflow.com/questions/18660121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/625983/"
] | I worked out a solution, but the code is a little messy. To get the path to the destination property in a complex mapping, which I can then toss into the ModelState for errors, I can use this code:
```
public string GetDestinationPath(Type source, Type destination, string propertyName)
{
return GetDest... | This is not tested but can you try this, assuming you have mapped it already.
```
var map = Mapper.FindTypeMapFor<Source, Destination>();
foreach( var propertMap in map.GetPropertyMaps() )
{
var dest = propertMap.DestinationProperty.MemberInfo;
var source = propertMap.SourceMemb... |
630,826 | here is the theorem(Thm 6.9 page 126): if $f$ is monotonic on $[a,b]$ and if $\alpha$ is continuous then $f \in \mathscr R$ ($\alpha$ is assumed montonic)
the detail that i don't understand in the proof is the following:
$(1\*) \enspace$ $\triangle \alpha\_i = \frac{\alpha(b) - \alpha(a) }{n} , (i = 1,...,n)$ . This ... | 2014/01/07 | [
"https://math.stackexchange.com/questions/630826",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/97382/"
] | (Prove (1\*)) Let's analyse to get the solution: Put $c=(\alpha(b)-\alpha(a))/n$. We find $n-2$ points $a=x\_0\le x\_1\le...\le x\_{n-1}\le x\_n=b$ such that
$$ \alpha(x\_i)-\alpha(x\_{i-1})=c,\quad i=1,n$$
Adding the first k equations gives
$$\alpha(x\_k)-\alpha(a)=kc$$
Hence $$\alpha(x\_k)=k/n\alpha(b)+ (n-k)/n\alph... | >
> anyhow how does he use theorem 4.23 to conclude that (1∗) is possible?
>
>
>
Define the partition $a=x\_0 \leq x\_1 \leq \dots \leq x\_n=b$ by solving the following equations $$\alpha(x\_1)=\alpha(x\_0)+\Delta \alpha\_1 \\ \alpha(x\_2)=\alpha(x\_1)+\Delta\alpha\_2 \\ \vdots \\ \alpha(x\_n)=\alpha(x\_{n-1})+\De... |
634,068 | I understand that in an X-ray tube electrons collide with the anode which then deflects them out of the window producing X-rays and that this anode is rotated to dissipate heat. But why is it necessary? I imagine the cathode filament will get far hotter but this is not rotated. Is the dissipation of heat connected to t... | 2021/05/04 | [
"https://physics.stackexchange.com/questions/634068",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/222769/"
] | The electron beam power is (voltage) x (current), only a small fraction of which actually generates X-rays. Most of those watts end up dissipated as heat when they collide with the anode. This heating is manageable in small X-ray machines running at low power for short periods of time but for big industrial X-ray tubes... | There are multiple types of X-ray tubes used, e.g., in crystallography, and the one using a rotating anode is *one* (but not *the only*) type being used. The advantage compared to a "conventional" X-ray tube in a diffractometer is the higher brightness of this source of radiation, i.e. number of photons suitable for th... |
71,196,913 | **Problem:** Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
>
> Input: nums = [2,7,11,15],
> ... | 2022/02/20 | [
"https://Stackoverflow.com/questions/71196913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17200355/"
] | You can make a dictionary of the last position of the complement value of each number. Then use it to find the position of the value for which the complement exists in the list (at a greater index in case you have a value that is half the target):
```
nums = [2,7,11,15]
target = 9
pos = {target-n:i for i,n in enume... | Your code isn't really `O(n)`, it's actually `O(n^2)` in disguise.
You go through `i` `O(n)` times for each `cnt` (and then reset `i` back to 0), and go through `cnt` `O(n)` times.
For a more efficient algorithm, sites like this one (<https://www.educative.io/edpresso/how-to-implement-the-two-sum-problem-in-python>) ... |
71,196,913 | **Problem:** Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
>
> Input: nums = [2,7,11,15],
> ... | 2022/02/20 | [
"https://Stackoverflow.com/questions/71196913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17200355/"
] | You can make a dictionary of the last position of the complement value of each number. Then use it to find the position of the value for which the complement exists in the list (at a greater index in case you have a value that is half the target):
```
nums = [2,7,11,15]
target = 9
pos = {target-n:i for i,n in enume... | if we`re not talking about space complexity:
```py
def search(values, target):
hashmap = {}
for i in range(len(values)):
current = values[i]
if target - current in hashmap:
return current, hahsmap[target - current]
hashmap[current] = i
return None
``` |
71,196,913 | **Problem:** Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
>
> Input: nums = [2,7,11,15],
> ... | 2022/02/20 | [
"https://Stackoverflow.com/questions/71196913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17200355/"
] | You can make a dictionary of the last position of the complement value of each number. Then use it to find the position of the value for which the complement exists in the list (at a greater index in case you have a value that is half the target):
```
nums = [2,7,11,15]
target = 9
pos = {target-n:i for i,n in enume... | I am not sure of the time complexity but I think this solution will be better. `p1` and `p2` act as two pointers of indexes:
```
def twoSum(nums, target):
nums2 = nums[:]
nums2.sort()
p1 = 0
p2 = len(nums2)-1
while nums2[p1]+nums2[p2]!=target:
if nums2[p1]+nums2[p2]<target:
p1 +... |
2,980,297 | I want to install perl modules on a shared server on which I do not have root access. How can I do this? They also seem to have an older version of CPAN (it complains about that when running the command), is it possible to update the CPAN command being used from my account without requiring root access? | 2010/06/05 | [
"https://Stackoverflow.com/questions/2980297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359178/"
] | The easiest method I have found so far is to say
```
wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile
echo 'export MANPATH=$HOME/perl5/man:$MANPATH' >> ~/.profile
```
This assumes ... | <http://web.archive.org/web/20120427144232/http://perl.jonallen.info/writing/articles/install-perl-modules-without-root>
<http://novosial.org/perl/life-with-cpan/non-root/>
The main step in both sets of instructions involves [local::lib module](http://search.cpan.org/~mstrout/local-lib-1.006000/lib/local/lib.pm)
AFA... |
2,980,297 | I want to install perl modules on a shared server on which I do not have root access. How can I do this? They also seem to have an older version of CPAN (it complains about that when running the command), is it possible to update the CPAN command being used from my account without requiring root access? | 2010/06/05 | [
"https://Stackoverflow.com/questions/2980297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359178/"
] | <http://web.archive.org/web/20120427144232/http://perl.jonallen.info/writing/articles/install-perl-modules-without-root>
<http://novosial.org/perl/life-with-cpan/non-root/>
The main step in both sets of instructions involves [local::lib module](http://search.cpan.org/~mstrout/local-lib-1.006000/lib/local/lib.pm)
AFA... | For completeness, this is the installation process of `cpanm` on OSX if you want to keep your `perl5` under `~/Library`.
```
curl -L http://cpanmin.us | perl - -l ~/Library/perl5 App::cpanminus local::lib
eval `perl -I ~/Library/perl5/lib/perl5 -Mlocal::lib=~/Library/perl5`
echo 'eval `perl -I ~/Library/perl5/lib/perl... |
2,980,297 | I want to install perl modules on a shared server on which I do not have root access. How can I do this? They also seem to have an older version of CPAN (it complains about that when running the command), is it possible to update the CPAN command being used from my account without requiring root access? | 2010/06/05 | [
"https://Stackoverflow.com/questions/2980297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359178/"
] | <http://web.archive.org/web/20120427144232/http://perl.jonallen.info/writing/articles/install-perl-modules-without-root>
<http://novosial.org/perl/life-with-cpan/non-root/>
The main step in both sets of instructions involves [local::lib module](http://search.cpan.org/~mstrout/local-lib-1.006000/lib/local/lib.pm)
AFA... | If you want to be able to read man pages for the cpanminus-installed modules as well, you should also make sure the correct subdirectory of the chosen library path is in MANPATH. So the above solution showing the installation process of cpanm needs the following additional command:
```
export MANPATH=$HOME/Library/pe... |
2,980,297 | I want to install perl modules on a shared server on which I do not have root access. How can I do this? They also seem to have an older version of CPAN (it complains about that when running the command), is it possible to update the CPAN command being used from my account without requiring root access? | 2010/06/05 | [
"https://Stackoverflow.com/questions/2980297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359178/"
] | <http://web.archive.org/web/20120427144232/http://perl.jonallen.info/writing/articles/install-perl-modules-without-root>
<http://novosial.org/perl/life-with-cpan/non-root/>
The main step in both sets of instructions involves [local::lib module](http://search.cpan.org/~mstrout/local-lib-1.006000/lib/local/lib.pm)
AFA... | we have been using [the following func](https://github.com/YordanGeorgiev/qto/blob/master/src/bash/deployer/check-install-perl-modules.func.sh) during the last 6 months on over 20 deployments successful automated deployments to aws ... called from the main provisioning [as follows](https://github.com/YordanGeorgiev/qto... |
2,980,297 | I want to install perl modules on a shared server on which I do not have root access. How can I do this? They also seem to have an older version of CPAN (it complains about that when running the command), is it possible to update the CPAN command being used from my account without requiring root access? | 2010/06/05 | [
"https://Stackoverflow.com/questions/2980297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359178/"
] | The easiest method I have found so far is to say
```
wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile
echo 'export MANPATH=$HOME/perl5/man:$MANPATH' >> ~/.profile
```
This assumes ... | For completeness, this is the installation process of `cpanm` on OSX if you want to keep your `perl5` under `~/Library`.
```
curl -L http://cpanmin.us | perl - -l ~/Library/perl5 App::cpanminus local::lib
eval `perl -I ~/Library/perl5/lib/perl5 -Mlocal::lib=~/Library/perl5`
echo 'eval `perl -I ~/Library/perl5/lib/perl... |
2,980,297 | I want to install perl modules on a shared server on which I do not have root access. How can I do this? They also seem to have an older version of CPAN (it complains about that when running the command), is it possible to update the CPAN command being used from my account without requiring root access? | 2010/06/05 | [
"https://Stackoverflow.com/questions/2980297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359178/"
] | The easiest method I have found so far is to say
```
wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile
echo 'export MANPATH=$HOME/perl5/man:$MANPATH' >> ~/.profile
```
This assumes ... | If you want to be able to read man pages for the cpanminus-installed modules as well, you should also make sure the correct subdirectory of the chosen library path is in MANPATH. So the above solution showing the installation process of cpanm needs the following additional command:
```
export MANPATH=$HOME/Library/pe... |
2,980,297 | I want to install perl modules on a shared server on which I do not have root access. How can I do this? They also seem to have an older version of CPAN (it complains about that when running the command), is it possible to update the CPAN command being used from my account without requiring root access? | 2010/06/05 | [
"https://Stackoverflow.com/questions/2980297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359178/"
] | The easiest method I have found so far is to say
```
wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile
echo 'export MANPATH=$HOME/perl5/man:$MANPATH' >> ~/.profile
```
This assumes ... | we have been using [the following func](https://github.com/YordanGeorgiev/qto/blob/master/src/bash/deployer/check-install-perl-modules.func.sh) during the last 6 months on over 20 deployments successful automated deployments to aws ... called from the main provisioning [as follows](https://github.com/YordanGeorgiev/qto... |
2,980,297 | I want to install perl modules on a shared server on which I do not have root access. How can I do this? They also seem to have an older version of CPAN (it complains about that when running the command), is it possible to update the CPAN command being used from my account without requiring root access? | 2010/06/05 | [
"https://Stackoverflow.com/questions/2980297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359178/"
] | For completeness, this is the installation process of `cpanm` on OSX if you want to keep your `perl5` under `~/Library`.
```
curl -L http://cpanmin.us | perl - -l ~/Library/perl5 App::cpanminus local::lib
eval `perl -I ~/Library/perl5/lib/perl5 -Mlocal::lib=~/Library/perl5`
echo 'eval `perl -I ~/Library/perl5/lib/perl... | If you want to be able to read man pages for the cpanminus-installed modules as well, you should also make sure the correct subdirectory of the chosen library path is in MANPATH. So the above solution showing the installation process of cpanm needs the following additional command:
```
export MANPATH=$HOME/Library/pe... |
2,980,297 | I want to install perl modules on a shared server on which I do not have root access. How can I do this? They also seem to have an older version of CPAN (it complains about that when running the command), is it possible to update the CPAN command being used from my account without requiring root access? | 2010/06/05 | [
"https://Stackoverflow.com/questions/2980297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359178/"
] | For completeness, this is the installation process of `cpanm` on OSX if you want to keep your `perl5` under `~/Library`.
```
curl -L http://cpanmin.us | perl - -l ~/Library/perl5 App::cpanminus local::lib
eval `perl -I ~/Library/perl5/lib/perl5 -Mlocal::lib=~/Library/perl5`
echo 'eval `perl -I ~/Library/perl5/lib/perl... | we have been using [the following func](https://github.com/YordanGeorgiev/qto/blob/master/src/bash/deployer/check-install-perl-modules.func.sh) during the last 6 months on over 20 deployments successful automated deployments to aws ... called from the main provisioning [as follows](https://github.com/YordanGeorgiev/qto... |
2,980,297 | I want to install perl modules on a shared server on which I do not have root access. How can I do this? They also seem to have an older version of CPAN (it complains about that when running the command), is it possible to update the CPAN command being used from my account without requiring root access? | 2010/06/05 | [
"https://Stackoverflow.com/questions/2980297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359178/"
] | If you want to be able to read man pages for the cpanminus-installed modules as well, you should also make sure the correct subdirectory of the chosen library path is in MANPATH. So the above solution showing the installation process of cpanm needs the following additional command:
```
export MANPATH=$HOME/Library/pe... | we have been using [the following func](https://github.com/YordanGeorgiev/qto/blob/master/src/bash/deployer/check-install-perl-modules.func.sh) during the last 6 months on over 20 deployments successful automated deployments to aws ... called from the main provisioning [as follows](https://github.com/YordanGeorgiev/qto... |
3,948,061 | i need to use sat solver for checking satisfiability of boolean expressions..
I have complex boolean expression like this

is there any automatic cnf file converter so that i can give it straight to sat solver?
I read the cnf format file.. but how to express this expr... | 2010/10/16 | [
"https://Stackoverflow.com/questions/3948061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/416123/"
] | There are a couple of solutions.
[Limboole](http://fmv.jku.at/limboole/) is an open source tool which I believe includes a separate 'propositional logic to CNF' converter.
More generally, you could also use a tool that supports propositional logic natively; some examples include [Z3](http://research.microsoft.com/en-... | [SBSAT](http://www.cs.uc.edu/~weaversa/SBSAT.html) is a state based SAT solver that is able to accept a variety of input formats. You could take a simple expression and give it to SBSAT to convert to CNF. The [manual](http://gauss.ececs.uc.edu/sbsat_user_manual.pdf), section 4.10, describes how to do this. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.