qid int64 | question string | date string | metadata list | response_j string | response_k string |
|---|---|---|---|---|---|
448,216 | There's a risk of me potentially offending someone but I am an outsider trying to get to grips with this terminology. Online, I read someone who identified themself as a
>
> *pansexual trans/gender-fluid person*
>
>
>
I'd like to know if my understanding of the following terms is generally correct.
I just about... | 2018/05/29 | [
"https://english.stackexchange.com/questions/448216",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/44619/"
] | I want to specifically address the first question in a way that it hasn't been yet.
>
> Q 1. What is the difference between a bisexual and a pansexual?
>
>
>
*Bisexualism* works only in a context where gender is binary. It assumes that people are only one of two possible genders—and that if you are bisexual you a... | * Bisexuality *sensu lato* (in the broad sense) means that one is sexually attracted to both males and females; it makes no distinction as to whether or not one is sexually attracted to persons who are neither male nor female.
+ Bisexuality *sensu stricto* (in the narrow sense) means that one is sexually attracted to ... |
448,216 | There's a risk of me potentially offending someone but I am an outsider trying to get to grips with this terminology. Online, I read someone who identified themself as a
>
> *pansexual trans/gender-fluid person*
>
>
>
I'd like to know if my understanding of the following terms is generally correct.
I just about... | 2018/05/29 | [
"https://english.stackexchange.com/questions/448216",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/44619/"
] | I want to specifically address the first question in a way that it hasn't been yet.
>
> Q 1. What is the difference between a bisexual and a pansexual?
>
>
>
*Bisexualism* works only in a context where gender is binary. It assumes that people are only one of two possible genders—and that if you are bisexual you a... | The difference between Pansexual and Bisexual can be explained like this.
Not all heterosexuals focus on lust when selecting a spouse. For some people, hetero, gay and pan, the emphasis is on being in love, and in a committed "forever" relationship. Many do not consumate their relationships sexually until vows are exc... |
448,216 | There's a risk of me potentially offending someone but I am an outsider trying to get to grips with this terminology. Online, I read someone who identified themself as a
>
> *pansexual trans/gender-fluid person*
>
>
>
I'd like to know if my understanding of the following terms is generally correct.
I just about... | 2018/05/29 | [
"https://english.stackexchange.com/questions/448216",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/44619/"
] | >
> Q2. Why is there no agreement in the LGTBQ community for a single, simple term to express this gender and sexual preference?
>
>
>
A2. Because the LGTBQ is not a single speech community, that's why.
A speech community -- a bunch of people who talk (mostly) with one another -- is where agreements on single te... | Regarding question 1:
I think it's a matter of carefully reading the definitions. Bisexual means to be attracted to both men and women. Pansexual means to be attracted to people regardless of sex or gender identity.
To illustrate the difference, let's use food (because it's more relatable). Suppose you like pizza an... |
448,216 | There's a risk of me potentially offending someone but I am an outsider trying to get to grips with this terminology. Online, I read someone who identified themself as a
>
> *pansexual trans/gender-fluid person*
>
>
>
I'd like to know if my understanding of the following terms is generally correct.
I just about... | 2018/05/29 | [
"https://english.stackexchange.com/questions/448216",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/44619/"
] | >
> Q2. Why is there no agreement in the LGTBQ community for a single, simple term to express this gender and sexual preference?
>
>
>
A2. Because the LGTBQ is not a single speech community, that's why.
A speech community -- a bunch of people who talk (mostly) with one another -- is where agreements on single te... | The difference between Pansexual and Bisexual can be explained like this.
Not all heterosexuals focus on lust when selecting a spouse. For some people, hetero, gay and pan, the emphasis is on being in love, and in a committed "forever" relationship. Many do not consumate their relationships sexually until vows are exc... |
448,216 | There's a risk of me potentially offending someone but I am an outsider trying to get to grips with this terminology. Online, I read someone who identified themself as a
>
> *pansexual trans/gender-fluid person*
>
>
>
I'd like to know if my understanding of the following terms is generally correct.
I just about... | 2018/05/29 | [
"https://english.stackexchange.com/questions/448216",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/44619/"
] | The other answers are well-taken. To attempt a tl;dr:
>
> **Q1.** What *is* the difference between a bisexual and a pansexual?
>
>
>
The people? **Probably nothing**. But the difference between the ***terms*** '[bisexual](http://www.oed.com/view/Entry/19448)' and '[pansexual](http://www.oed.com/view/Entry/136944)... | The difference between Pansexual and Bisexual can be explained like this.
Not all heterosexuals focus on lust when selecting a spouse. For some people, hetero, gay and pan, the emphasis is on being in love, and in a committed "forever" relationship. Many do not consumate their relationships sexually until vows are exc... |
448,216 | There's a risk of me potentially offending someone but I am an outsider trying to get to grips with this terminology. Online, I read someone who identified themself as a
>
> *pansexual trans/gender-fluid person*
>
>
>
I'd like to know if my understanding of the following terms is generally correct.
I just about... | 2018/05/29 | [
"https://english.stackexchange.com/questions/448216",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/44619/"
] | Regarding question 1:
I think it's a matter of carefully reading the definitions. Bisexual means to be attracted to both men and women. Pansexual means to be attracted to people regardless of sex or gender identity.
To illustrate the difference, let's use food (because it's more relatable). Suppose you like pizza an... | The difference between Pansexual and Bisexual can be explained like this.
Not all heterosexuals focus on lust when selecting a spouse. For some people, hetero, gay and pan, the emphasis is on being in love, and in a committed "forever" relationship. Many do not consumate their relationships sexually until vows are exc... |
448,216 | There's a risk of me potentially offending someone but I am an outsider trying to get to grips with this terminology. Online, I read someone who identified themself as a
>
> *pansexual trans/gender-fluid person*
>
>
>
I'd like to know if my understanding of the following terms is generally correct.
I just about... | 2018/05/29 | [
"https://english.stackexchange.com/questions/448216",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/44619/"
] | * Bisexuality *sensu lato* (in the broad sense) means that one is sexually attracted to both males and females; it makes no distinction as to whether or not one is sexually attracted to persons who are neither male nor female.
+ Bisexuality *sensu stricto* (in the narrow sense) means that one is sexually attracted to ... | The difference between Pansexual and Bisexual can be explained like this.
Not all heterosexuals focus on lust when selecting a spouse. For some people, hetero, gay and pan, the emphasis is on being in love, and in a committed "forever" relationship. Many do not consumate their relationships sexually until vows are exc... |
46,159,310 | I'm trying to format the footer of my app, and there are 3 things I want along the footer, all hyperlinks that I'd like on the same line.
```
<p><a href="mailto:me@myemail.com">© 2017 - My Name, Section 4</a>
<a asp-area="" asp-controller="Home" asp-action="About">About</a>
<a asp-area="" ... | 2017/09/11 | [
"https://Stackoverflow.com/questions/46159310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7800355/"
] | Just add a class and float it right with some padding:
<https://jsfiddle.net/cx5m40wu/>
```
<p><a href="mailto:me@myemail.com">© 2017 - My Name, Section 4</a>
<a asp-area="" asp-controller="Home" asp-action="Contact" class="alignRight">Contact</a>
<a asp-area="" asp-controller="Ho... | I would recommend a different approach for the markup.
Use an `<ul>` (unordered list) inside a `<footer>` tag. Then, use `<li>` (list items) for each `<a>` anchor tag. This will be better for semantics and accessibility.
After having a proper HTML markup, you can proceed to style it with any method you like:
**Flex... |
46,159,310 | I'm trying to format the footer of my app, and there are 3 things I want along the footer, all hyperlinks that I'd like on the same line.
```
<p><a href="mailto:me@myemail.com">© 2017 - My Name, Section 4</a>
<a asp-area="" asp-controller="Home" asp-action="About">About</a>
<a asp-area="" ... | 2017/09/11 | [
"https://Stackoverflow.com/questions/46159310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7800355/"
] | Just add a class and float it right with some padding:
<https://jsfiddle.net/cx5m40wu/>
```
<p><a href="mailto:me@myemail.com">© 2017 - My Name, Section 4</a>
<a asp-area="" asp-controller="Home" asp-action="Contact" class="alignRight">Contact</a>
<a asp-area="" asp-controller="Ho... | Flexbox can do that:
```css
p {
display: flex;
}
p a:first-of-type {
margin-right: auto;
}
```
```html
<p><a href="mailto:me@myemail.com">© 2017 - My Name, Section 4</a>
<a asp-area="" asp-controller="Home" asp-action="About">About</a>
<a asp-area="" asp-controller="Home" asp-action="Contact">Con... |
20,897,236 | So I am able to retrieve the images from instagram but I want the individual images to go into my gallery container div which I got a problem with. I have directed the images to the class "html5gallery" but the images does not goes in like other image urls :
```
<!-- Reference to html5gallery.js -->
<script type="text... | 2014/01/03 | [
"https://Stackoverflow.com/questions/20897236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3152558/"
] | Change the class attribute to id or add the id attribute `id="html5gallery"`
```
<div style="display:none;margin:0 auto; "
class="html5gallery" id="html5gallery"
data-skin="horizontal" data-width="1200"
data-height="680" >
```
**EDIT:**
Try this to append image
```
var imgURL = '';
var gallery = $("#html5gal... | I've never used the instagram API before, but I think this is what you want to achieve (code below). I've included both a Vanilla Javascript method as well as a jQuery method (so you can pick and use whichever one you prefer - vanilla is faster of course)
```
(function ($, window) {
var userId = "19410587";
va... |
20,897,236 | So I am able to retrieve the images from instagram but I want the individual images to go into my gallery container div which I got a problem with. I have directed the images to the class "html5gallery" but the images does not goes in like other image urls :
```
<!-- Reference to html5gallery.js -->
<script type="text... | 2014/01/03 | [
"https://Stackoverflow.com/questions/20897236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3152558/"
] | Change the class attribute to id or add the id attribute `id="html5gallery"`
```
<div style="display:none;margin:0 auto; "
class="html5gallery" id="html5gallery"
data-skin="horizontal" data-width="1200"
data-height="680" >
```
**EDIT:**
Try this to append image
```
var imgURL = '';
var gallery = $("#html5gal... | If the human eye can only see 24fps or 30fps or more when playing a game or watching tv, I believe a programer can use less DIVs in HTML within the screen size, with a Javascript array of 3 million colors for a couple of DIVs and cheat it's position(because of our human eyes), based in a timer event with a bunch of fra... |
248,161 | Let $z\_1 , z\_2 $ be two complex numbers that satisfy:
$\dfrac{z\_2 } {\bar{z\_1}}= \frac{3}{8} \big(\cos(75^{\circ})+i\sin(75^{\circ})\big) $ ,
$z\_1 z\_2 ^2 = \frac{1}{3} \big(\cos(120^{\circ}) + i\sin(120^{\circ}) \big) $ .
How can I determine with of the following can be a possible value for $ \sqrt{z\_1} $ ?... | 2012/11/30 | [
"https://math.stackexchange.com/questions/248161",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/50436/"
] | Assuming that each week is independent, we know that if $N$ is the number of employees taken on in a particular week, then $N$ has distribution:
$P(N=k) = e^{-0.1} \frac{0.1^k}{k!}$
So that,
$p:=P(N=0)=e^{-0.1}$,
which I'm calling $p$. Now, assuming we have an unlimited number of weeks, how can we not take on empl... | Alex has answered part of the question.
The probability that more than one new employee is hired in a given week is $1$ minus the probability that only $0$ or $1$ new employees are hired. Thus it is
$$
1- \frac{0.1^0 e^{-0.1}}{0!} - \frac{0.1^1 e^{-0.1}}{1!} = 1 - e^{-0.1} - 0.1e^{-0.1}.
$$
Call this number $p$. Then ... |
2,484,538 | Let $A$ and $B$ from $M\_n(\mathbb{R})$ with $AB=BA$ and $\det(A+B) \geq 0$
Prove that $ \forall n \in \mathbb{N^{\*}} $, $\det (A^n + B^n) \geq 0 $
---
I tried to use induction but I got stuck. | 2017/10/22 | [
"https://math.stackexchange.com/questions/2484538",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/201437/"
] | HINT:
You could use complex numbers. Consider the factorization
$$(X^n + 1) = \prod\_{\omega^n +1 = 0}( X- \omega)$$
The roots of the equation $X^n+1 = 0$ are complex, distinct, and conjugate in pairs, if $n$ is even, or $-1$, and $\frac{n-1}{2}$ pairs of conjugate roots, if $n$ is odd.
Since $A$, $B$ commute, we c... | Ok, I really like the answer by orangeskid.
However, I want to understand the solution outlined by Giuseppe Negro.
As he already noted, commuting diagonalizable matrices are simultaneously diagonalizable. So let us assume that $A=diag(a\_1, a\_2, \ldots a\_n)$ and $B=diag(b\_1, b\_2, \ldots b\_n)$. Then $$\det(A+B)=... |
878,022 | I have the following data structure:
```
typedef vector< vector<int> > MxInt2d;
typedef vector< vector<double> > MxDouble2d;
class QSweep{
public:
....
static MxDouble2d myPoints_;
MxInt2d myEdges_;
MxInt2d sweepEvents;
class order{
public:
bool operator() (const vector<int>& edge1, const vector<int>&... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/82475/"
] | If you have 2 different criteria for sorting then you should have 2 different functors.
Give them meaningful names such as:
OrderBySlopes and OrderByXYZ
If the 2 functors use some common code, you can refactor this out. i.e. into a base class | What [Glen](https://stackoverflow.com/questions/878022/several-functors-for-redefining-order-for-sort-function-of-vector/878046#878046) said.
If you really really insist on having one function do double duty, you can rely on having different parameter types to overload two versions of operator(). |
878,022 | I have the following data structure:
```
typedef vector< vector<int> > MxInt2d;
typedef vector< vector<double> > MxDouble2d;
class QSweep{
public:
....
static MxDouble2d myPoints_;
MxInt2d myEdges_;
MxInt2d sweepEvents;
class order{
public:
bool operator() (const vector<int>& edge1, const vector<int>&... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/82475/"
] | If you have 2 different criteria for sorting then you should have 2 different functors.
Give them meaningful names such as:
OrderBySlopes and OrderByXYZ
If the 2 functors use some common code, you can refactor this out. i.e. into a base class | Your `orderDet::operator()` takes three arguments. The `std::sort` wants only two to compare two values.
A solution may be to add the edges vector as a member of your functor:
```
struct orderDet {
const vector<int>& edges;
orderDet( const vector<int>& edges ):edges(edges){};
bool operator()( const vecto... |
49,020,629 | I have:
```
a = [['-', '-', '-'], ['-', '-', '-'], ['-', '-', '-']]
b = [['-'] * 3] * 3 # => [["-", "-", "-"], ["-", "-", "-"], ["-", "-", "-"]]
a == b #=> true
```
Seems correct.
```
a[0][0] = 'X'
a # => [["X", "-", "-"], ["-", "-", "-"], ["-", "-", "-"]]
b[0][0] = 'X'
b # => [["X", "-", "-"], ["X", "-", "-"], ["... | 2018/02/28 | [
"https://Stackoverflow.com/questions/49020629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236353/"
] | This:
```
[object]*3
```
will create an array with 3 references to the same object so changing one of them changes all of them like this:
```
a = [[1]]*3 #=> [[1], [1], [1]]
a[0][0] = 2 #=> [[2], [2], [2]]
```
If you wish to create an array of length 3 with 3 different objects, do this:
```
a = 3.times.map {[1]}... | I found it has to be done this way:
```
irb(main):001:0> b = Array.new(3) { Array.new(3) { '-' } }
=> [["-", "-", "-"], ["-", "-", "-"], ["-", "-", "-"]]
irb(main):002:0> b[0][0] = 'X'
=> "X"
irb(main):003:0> b
=> [["X", "-", "-"], ["-", "-", "-"], ["-", "-", "-"]]
``` |
49,020,629 | I have:
```
a = [['-', '-', '-'], ['-', '-', '-'], ['-', '-', '-']]
b = [['-'] * 3] * 3 # => [["-", "-", "-"], ["-", "-", "-"], ["-", "-", "-"]]
a == b #=> true
```
Seems correct.
```
a[0][0] = 'X'
a # => [["X", "-", "-"], ["-", "-", "-"], ["-", "-", "-"]]
b[0][0] = 'X'
b # => [["X", "-", "-"], ["X", "-", "-"], ["... | 2018/02/28 | [
"https://Stackoverflow.com/questions/49020629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236353/"
] | This:
```
[object]*3
```
will create an array with 3 references to the same object so changing one of them changes all of them like this:
```
a = [[1]]*3 #=> [[1], [1], [1]]
a[0][0] = 2 #=> [[2], [2], [2]]
```
If you wish to create an array of length 3 with 3 different objects, do this:
```
a = 3.times.map {[1]}... | The first initialization you created 3 arrays nested in 1.
```
a = [['-', '-', '-'], ['-', '-', '-'], ['-', '-', '-']]
# [['-', '-', '-'], ['-', '-', '-'], ['-', '-', '-']]
# ARRAY a ARRAY b ARRAY c
```
The second initialization you created 1 array, and then pointed the same array 3 time... |
41,860,373 | I have a Kotlin Code just like the below, `SingleKotlin.instance` can be called by the other Kotlin files
```
class SingleKotlin private constructor(){
companion object {
val instance by lazy {
SingleKotlin()
}
}
}
```
However, when I try to call `SingleKotlin.instance` from java... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41860373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3239558/"
] | Just add @JvmStatic annotation above field (as said in this documentation <https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#static-fields>)
So, your code should be like this:
```
class SingleKotlin private constructor(){
companion object {
@JvmStatic
val instance by lazy {
... | In addition to [@YuriiKyrylchuk](https://stackoverflow.com/users/2793494/yurii-kyrylchuk)'s answer: another option (and the only option if you don't have control over the Kotlin code) is to refer to `MyClass.Companion` from Java. Example:
```
class MyClass {
companion object {
val x: Int = 0
}
}
```
... |
41,860,373 | I have a Kotlin Code just like the below, `SingleKotlin.instance` can be called by the other Kotlin files
```
class SingleKotlin private constructor(){
companion object {
val instance by lazy {
SingleKotlin()
}
}
}
```
However, when I try to call `SingleKotlin.instance` from java... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41860373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3239558/"
] | Just add @JvmStatic annotation above field (as said in this documentation <https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#static-fields>)
So, your code should be like this:
```
class SingleKotlin private constructor(){
companion object {
@JvmStatic
val instance by lazy {
... | If your `SingleKotlin` object has a single private constructor without parameters, you can use `object` instead:
```
object SingleKotlin {
// some members of SingleKotlin
val x = 42
}
```
Then in Java you reference it through the `INSTANCE` static field:
```
SingleKotlin single = SingleKotlin.INSTANCE;
// o... |
41,860,373 | I have a Kotlin Code just like the below, `SingleKotlin.instance` can be called by the other Kotlin files
```
class SingleKotlin private constructor(){
companion object {
val instance by lazy {
SingleKotlin()
}
}
}
```
However, when I try to call `SingleKotlin.instance` from java... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41860373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3239558/"
] | Just add @JvmStatic annotation above field (as said in this documentation <https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#static-fields>)
So, your code should be like this:
```
class SingleKotlin private constructor(){
companion object {
@JvmStatic
val instance by lazy {
... | You need to call the method from Java like this:
`AppUIUtils.Companion.yourMethod()` |
41,860,373 | I have a Kotlin Code just like the below, `SingleKotlin.instance` can be called by the other Kotlin files
```
class SingleKotlin private constructor(){
companion object {
val instance by lazy {
SingleKotlin()
}
}
}
```
However, when I try to call `SingleKotlin.instance` from java... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41860373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3239558/"
] | Just add @JvmStatic annotation above field (as said in this documentation <https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#static-fields>)
So, your code should be like this:
```
class SingleKotlin private constructor(){
companion object {
@JvmStatic
val instance by lazy {
... | In additional to Ilya answer you can use @JvmStatic annotation
```
object SingleKotlin {
// some members of SingleKotlin
@JvmStatic val x = 42
}
```
Then in Java
```
SingleKotlin.getX();
``` |
41,860,373 | I have a Kotlin Code just like the below, `SingleKotlin.instance` can be called by the other Kotlin files
```
class SingleKotlin private constructor(){
companion object {
val instance by lazy {
SingleKotlin()
}
}
}
```
However, when I try to call `SingleKotlin.instance` from java... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41860373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3239558/"
] | In addition to [@YuriiKyrylchuk](https://stackoverflow.com/users/2793494/yurii-kyrylchuk)'s answer: another option (and the only option if you don't have control over the Kotlin code) is to refer to `MyClass.Companion` from Java. Example:
```
class MyClass {
companion object {
val x: Int = 0
}
}
```
... | You need to call the method from Java like this:
`AppUIUtils.Companion.yourMethod()` |
41,860,373 | I have a Kotlin Code just like the below, `SingleKotlin.instance` can be called by the other Kotlin files
```
class SingleKotlin private constructor(){
companion object {
val instance by lazy {
SingleKotlin()
}
}
}
```
However, when I try to call `SingleKotlin.instance` from java... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41860373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3239558/"
] | In addition to [@YuriiKyrylchuk](https://stackoverflow.com/users/2793494/yurii-kyrylchuk)'s answer: another option (and the only option if you don't have control over the Kotlin code) is to refer to `MyClass.Companion` from Java. Example:
```
class MyClass {
companion object {
val x: Int = 0
}
}
```
... | In additional to Ilya answer you can use @JvmStatic annotation
```
object SingleKotlin {
// some members of SingleKotlin
@JvmStatic val x = 42
}
```
Then in Java
```
SingleKotlin.getX();
``` |
41,860,373 | I have a Kotlin Code just like the below, `SingleKotlin.instance` can be called by the other Kotlin files
```
class SingleKotlin private constructor(){
companion object {
val instance by lazy {
SingleKotlin()
}
}
}
```
However, when I try to call `SingleKotlin.instance` from java... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41860373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3239558/"
] | If your `SingleKotlin` object has a single private constructor without parameters, you can use `object` instead:
```
object SingleKotlin {
// some members of SingleKotlin
val x = 42
}
```
Then in Java you reference it through the `INSTANCE` static field:
```
SingleKotlin single = SingleKotlin.INSTANCE;
// o... | You need to call the method from Java like this:
`AppUIUtils.Companion.yourMethod()` |
41,860,373 | I have a Kotlin Code just like the below, `SingleKotlin.instance` can be called by the other Kotlin files
```
class SingleKotlin private constructor(){
companion object {
val instance by lazy {
SingleKotlin()
}
}
}
```
However, when I try to call `SingleKotlin.instance` from java... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41860373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3239558/"
] | If your `SingleKotlin` object has a single private constructor without parameters, you can use `object` instead:
```
object SingleKotlin {
// some members of SingleKotlin
val x = 42
}
```
Then in Java you reference it through the `INSTANCE` static field:
```
SingleKotlin single = SingleKotlin.INSTANCE;
// o... | In additional to Ilya answer you can use @JvmStatic annotation
```
object SingleKotlin {
// some members of SingleKotlin
@JvmStatic val x = 42
}
```
Then in Java
```
SingleKotlin.getX();
``` |
19,321,047 | I am using this query:
```
SELECT ts as "TimeStamp",
stat as "Status"
FROM myTable
WHERE stat = 'O'
AND source = 'Source1'
AND ts BETWEEN TO_TIMESTAMP('2013-10-05','yyyy-mm-dd') AND
TO_TIMESTAMP('2013-10-06','yyyy-mm-dd')
```
And also tried:
```
SELECT ts as "Time... | 2013/10/11 | [
"https://Stackoverflow.com/questions/19321047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1342249/"
] | Because the TO time stamp has time even though you're not specifying. So it is selecting only up to the very beginning of the lat day. Either specify time 23:59:59 and subseconds as required, or do less than the next day.
```
...
AND ts >= TO_TIMESTAMP('2013-10-05','yyyy-mm-dd')
AND ts < TO_TIMESTAMP('2013-10-07','y... | Try:
AND ts BETWEEN TO\_DATE('2013-10-05','YYYY-MM-DD') AND
TO\_DATE('2013-10-06','YYYY-MM-DD')
And mind that it will get you results from the 10-05 at 00:00:00 to the 10-06 at 00:00:00 If you don't specify the HH MI SS mask.
Date masks are case sensitivve and TO\_DATE will work better. |
55,785,574 | I want to assign the total number of rows to a variable named **"@row\_count"**.
```
DECLARE @row_count int
SET @row_count = SELECT COUNT(*) FROM information
```
I know. I'm doing **wrong**. But I haven't found anything on how to do it.
---
I want to do something like that:
```
CREATE PROC add_person
(
@id t... | 2019/04/21 | [
"https://Stackoverflow.com/questions/55785574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It's not possible to blur other apps in the background.
<https://www.electronjs.org/docs/api/frameless-window#limitations>
>
> The blur filter only applies to the web page, so there is no way to
> apply blur effect to the content below the window (i.e. other
> applications open on the user's system).
>
>
> | Electron does not allow you to blur on anything running behind it. It only allows you to blur the content on your webpage/app. Anything in your css styling will only be applied to the foreground contents. I know because I too have tried and failed. |
55,785,574 | I want to assign the total number of rows to a variable named **"@row\_count"**.
```
DECLARE @row_count int
SET @row_count = SELECT COUNT(*) FROM information
```
I know. I'm doing **wrong**. But I haven't found anything on how to do it.
---
I want to do something like that:
```
CREATE PROC add_person
(
@id t... | 2019/04/21 | [
"https://Stackoverflow.com/questions/55785574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | electron-acrylic-window
=======================
Actually, it is possible, with a little bit of magic. I have no idea why nobody pointed that out, but there exists a small utility called [electron-acrylic-window](https://github.com/Seo-Rii/electron-acrylic-window), which allows you to do exactly that. You can choose be... | It's not possible to blur other apps in the background.
<https://www.electronjs.org/docs/api/frameless-window#limitations>
>
> The blur filter only applies to the web page, so there is no way to
> apply blur effect to the content below the window (i.e. other
> applications open on the user's system).
>
>
> |
55,785,574 | I want to assign the total number of rows to a variable named **"@row\_count"**.
```
DECLARE @row_count int
SET @row_count = SELECT COUNT(*) FROM information
```
I know. I'm doing **wrong**. But I haven't found anything on how to do it.
---
I want to do something like that:
```
CREATE PROC add_person
(
@id t... | 2019/04/21 | [
"https://Stackoverflow.com/questions/55785574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | electron-acrylic-window
=======================
Actually, it is possible, with a little bit of magic. I have no idea why nobody pointed that out, but there exists a small utility called [electron-acrylic-window](https://github.com/Seo-Rii/electron-acrylic-window), which allows you to do exactly that. You can choose be... | Electron does not allow you to blur on anything running behind it. It only allows you to blur the content on your webpage/app. Anything in your css styling will only be applied to the foreground contents. I know because I too have tried and failed. |
11,826,556 | I am using a service called 'embedly' which is showing my feeds. I'm trying to shorten the text of this feed, so I tried:
```
$('.description').html(
function(){
return $.trim($(this).html())
.substring(0, 100)
.split(" ").slice(0, -1)
.join(" ") + "...";}
... | 2012/08/06 | [
"https://Stackoverflow.com/questions/11826556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647909/"
] | This one took me a very long time to figure out, but I think the best you can do is give the elements a second to load into the DOM, and then run your function: <http://jsfiddle.net/2VBSX/5/>
```
$('div.newscontainer').embedly({
key:':e0a98aba95ef11e09dcd4040d3dc5c07'
}).hide();
setTimeout(function() {
$('div... | Jquery's HTML doesn't accept a function as argument, but only plain HTML (a string).
To do what you wanto to do, use `.each()` :)
**Correction:** as pointed out by the commenter below, my code is correct but .html() **does** indeed accept a function as argument, in the form `$(...).html(function(index, oldhtml));`, ma... |
11,826,556 | I am using a service called 'embedly' which is showing my feeds. I'm trying to shorten the text of this feed, so I tried:
```
$('.description').html(
function(){
return $.trim($(this).html())
.substring(0, 100)
.split(" ").slice(0, -1)
.join(" ") + "...";}
... | 2012/08/06 | [
"https://Stackoverflow.com/questions/11826556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647909/"
] | Jquery's HTML doesn't accept a function as argument, but only plain HTML (a string).
To do what you wanto to do, use `.each()` :)
**Correction:** as pointed out by the commenter below, my code is correct but .html() **does** indeed accept a function as argument, in the form `$(...).html(function(index, oldhtml));`, ma... | So, my other answer is not valid because the OP didn't mention that all the elements were created on the fly, so they cannot be matched in the classical way.
If the modifications are attached to a suitable event (click, for example), then it would be easy to use delegates with `.on()`, as they are valid also for new e... |
11,826,556 | I am using a service called 'embedly' which is showing my feeds. I'm trying to shorten the text of this feed, so I tried:
```
$('.description').html(
function(){
return $.trim($(this).html())
.substring(0, 100)
.split(" ").slice(0, -1)
.join(" ") + "...";}
... | 2012/08/06 | [
"https://Stackoverflow.com/questions/11826556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647909/"
] | This one took me a very long time to figure out, but I think the best you can do is give the elements a second to load into the DOM, and then run your function: <http://jsfiddle.net/2VBSX/5/>
```
$('div.newscontainer').embedly({
key:':e0a98aba95ef11e09dcd4040d3dc5c07'
}).hide();
setTimeout(function() {
$('div... | So, my other answer is not valid because the OP didn't mention that all the elements were created on the fly, so they cannot be matched in the classical way.
If the modifications are attached to a suitable event (click, for example), then it would be easy to use delegates with `.on()`, as they are valid also for new e... |
14,480,944 | I have a String as folder/File Name. I am creating folder , file with that string. This string may or may not contain some charters which may not allow to create desired folder or file
e.g
```
String folder = "ArslanFolder 20/01/2013";
```
**So I want to remove these characters with "\_"**
Here are characters
... | 2013/01/23 | [
"https://Stackoverflow.com/questions/14480944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/486139/"
] | Use this code:
```
String folder = "ArslanFolder 20/01/2013 ? / '";
String result = folder.replaceAll("[|?*<\":>+\\[\\]/']", "_");
```
And the result would be:
```
ArslanFolder 20_01_2013 _ _ _
```
you didn't say that space should be replaced, so spaces are there... you could add it if it is necessary to be done. | Try this :
```
replaceAll("[\\W]", "_");
```
It will replace all non alphanumeric characters with underscore |
14,480,944 | I have a String as folder/File Name. I am creating folder , file with that string. This string may or may not contain some charters which may not allow to create desired folder or file
e.g
```
String folder = "ArslanFolder 20/01/2013";
```
**So I want to remove these characters with "\_"**
Here are characters
... | 2013/01/23 | [
"https://Stackoverflow.com/questions/14480944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/486139/"
] | I used one of this:
```
String alphaOnly = input.replaceAll("[^\\p{Alpha}]+","");
String alphaAndDigits = input.replaceAll("[^\\p{Alpha}\\p{Digit}]+","");
```
See this link:
[Replace special characters](https://stackoverflow.com/questions/4283351/how-to-replace-special-characters-in-a-string) | Try this :
```
replaceAll("[\\W]", "_");
```
It will replace all non alphanumeric characters with underscore |
14,480,944 | I have a String as folder/File Name. I am creating folder , file with that string. This string may or may not contain some charters which may not allow to create desired folder or file
e.g
```
String folder = "ArslanFolder 20/01/2013";
```
**So I want to remove these characters with "\_"**
Here are characters
... | 2013/01/23 | [
"https://Stackoverflow.com/questions/14480944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/486139/"
] | Use this code:
```
String folder = "ArslanFolder 20/01/2013 ? / '";
String result = folder.replaceAll("[|?*<\":>+\\[\\]/']", "_");
```
And the result would be:
```
ArslanFolder 20_01_2013 _ _ _
```
you didn't say that space should be replaced, so spaces are there... you could add it if it is necessary to be done. | I used one of this:
```
String alphaOnly = input.replaceAll("[^\\p{Alpha}]+","");
String alphaAndDigits = input.replaceAll("[^\\p{Alpha}\\p{Digit}]+","");
```
See this link:
[Replace special characters](https://stackoverflow.com/questions/4283351/how-to-replace-special-characters-in-a-string) |
14,480,944 | I have a String as folder/File Name. I am creating folder , file with that string. This string may or may not contain some charters which may not allow to create desired folder or file
e.g
```
String folder = "ArslanFolder 20/01/2013";
```
**So I want to remove these characters with "\_"**
Here are characters
... | 2013/01/23 | [
"https://Stackoverflow.com/questions/14480944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/486139/"
] | Use this code:
```
String folder = "ArslanFolder 20/01/2013 ? / '";
String result = folder.replaceAll("[|?*<\":>+\\[\\]/']", "_");
```
And the result would be:
```
ArslanFolder 20_01_2013 _ _ _
```
you didn't say that space should be replaced, so spaces are there... you could add it if it is necessary to be done. | **This is correct solution:**
```
String result = inputString.replaceAll("[\\\\|?\u0000*<\":>+\\[\\]/']", "_");
```
Kent answer is good, but he isnt include characters `NUL` and `\`.
Also, this is a secure solution for replacing/renaming text of user-input file names, for example. |
14,480,944 | I have a String as folder/File Name. I am creating folder , file with that string. This string may or may not contain some charters which may not allow to create desired folder or file
e.g
```
String folder = "ArslanFolder 20/01/2013";
```
**So I want to remove these characters with "\_"**
Here are characters
... | 2013/01/23 | [
"https://Stackoverflow.com/questions/14480944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/486139/"
] | I used one of this:
```
String alphaOnly = input.replaceAll("[^\\p{Alpha}]+","");
String alphaAndDigits = input.replaceAll("[^\\p{Alpha}\\p{Digit}]+","");
```
See this link:
[Replace special characters](https://stackoverflow.com/questions/4283351/how-to-replace-special-characters-in-a-string) | **This is correct solution:**
```
String result = inputString.replaceAll("[\\\\|?\u0000*<\":>+\\[\\]/']", "_");
```
Kent answer is good, but he isnt include characters `NUL` and `\`.
Also, this is a secure solution for replacing/renaming text of user-input file names, for example. |
6,122,091 | I'm familiar with Java and trying to teach myself C/C++. I'm stealing some curriculum from a class that is hosting their materials [here](http://courses.washington.edu/css342/zander/css332/array.html). I unfortunately can't ask the teacher since I'm not in the class. My concern is with the section under "dynamically de... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6122091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349611/"
] | >
> My understanding is that an array in C is simply a reference to the memory address of the first element in the array.
>
>
> So, what is the difference between int \*pointerArray = new int[10]; and int array[10]; if any?
>
>
>
What you mention is the reason for much confusion in any C/C++ beginner.
In C/C++,... | The main difference is that some operations that are allowed on pointers are not allowed on arrays. |
6,122,091 | I'm familiar with Java and trying to teach myself C/C++. I'm stealing some curriculum from a class that is hosting their materials [here](http://courses.washington.edu/css342/zander/css332/array.html). I unfortunately can't ask the teacher since I'm not in the class. My concern is with the section under "dynamically de... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6122091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349611/"
] | `int array[10];` declares the array size statically, that means it is fixed - which is the only major difference. It also might be allocated to be inside the function's stack frame, i.e. on the program's stack. You do not need to worry about using `delete []` on that kind of array, in fact, you might crash the program ... | Dynamically allocated:
```
int * pointerArray = new int[10];
```
[BTW, this is a pointer to an array of 10 ints, NOT a pointer array]
Statically allocated (possibly on the stack):
```
int array[10];
```
Otherwise they are the same. |
6,122,091 | I'm familiar with Java and trying to teach myself C/C++. I'm stealing some curriculum from a class that is hosting their materials [here](http://courses.washington.edu/css342/zander/css332/array.html). I unfortunately can't ask the teacher since I'm not in the class. My concern is with the section under "dynamically de... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6122091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349611/"
] | `int array[10];` declares the array size statically, that means it is fixed - which is the only major difference. It also might be allocated to be inside the function's stack frame, i.e. on the program's stack. You do not need to worry about using `delete []` on that kind of array, in fact, you might crash the program ... | On the one hand:
```
int ar[10];
```
is using memory allocated on the stack. You can think of it also locally available and while it is possible to pass a pointer / reference to otehr functions, the memory will be freed as soon as it goes out of scope (in your example at the end of the main method but that's usually... |
6,122,091 | I'm familiar with Java and trying to teach myself C/C++. I'm stealing some curriculum from a class that is hosting their materials [here](http://courses.washington.edu/css342/zander/css332/array.html). I unfortunately can't ask the teacher since I'm not in the class. My concern is with the section under "dynamically de... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6122091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349611/"
] | >
> My understanding is that an array in C is simply a reference to the memory address of the first element in the array.
>
>
> So, what is the difference between int \*pointerArray = new int[10]; and int array[10]; if any?
>
>
>
What you mention is the reason for much confusion in any C/C++ beginner.
In C/C++,... | There is a difference but not in the area that you point to. `*pointerArray` will point to the beginning of a block of memory of size 10 bytes. So will `array`. The only difference will be where it is stored in memory. `pointerArray` is dynamically assigned memory (at `run-time`) and hence will go on the heap, while `a... |
6,122,091 | I'm familiar with Java and trying to teach myself C/C++. I'm stealing some curriculum from a class that is hosting their materials [here](http://courses.washington.edu/css342/zander/css332/array.html). I unfortunately can't ask the teacher since I'm not in the class. My concern is with the section under "dynamically de... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6122091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349611/"
] | `int array[10];` declares the array size statically, that means it is fixed - which is the only major difference. It also might be allocated to be inside the function's stack frame, i.e. on the program's stack. You do not need to worry about using `delete []` on that kind of array, in fact, you might crash the program ... | >
> My understanding is that an array in C is simply a reference to the memory address of the first element in the array.
>
>
> So, what is the difference between int \*pointerArray = new int[10]; and int array[10]; if any?
>
>
>
What you mention is the reason for much confusion in any C/C++ beginner.
In C/C++,... |
6,122,091 | I'm familiar with Java and trying to teach myself C/C++. I'm stealing some curriculum from a class that is hosting their materials [here](http://courses.washington.edu/css342/zander/css332/array.html). I unfortunately can't ask the teacher since I'm not in the class. My concern is with the section under "dynamically de... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6122091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349611/"
] | Dynamically allocated:
```
int * pointerArray = new int[10];
```
[BTW, this is a pointer to an array of 10 ints, NOT a pointer array]
Statically allocated (possibly on the stack):
```
int array[10];
```
Otherwise they are the same. | The main difference is that some operations that are allowed on pointers are not allowed on arrays. |
6,122,091 | I'm familiar with Java and trying to teach myself C/C++. I'm stealing some curriculum from a class that is hosting their materials [here](http://courses.washington.edu/css342/zander/css332/array.html). I unfortunately can't ask the teacher since I'm not in the class. My concern is with the section under "dynamically de... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6122091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349611/"
] | `int array[10];` declares the array size statically, that means it is fixed - which is the only major difference. It also might be allocated to be inside the function's stack frame, i.e. on the program's stack. You do not need to worry about using `delete []` on that kind of array, in fact, you might crash the program ... | First, I'd look for some other place to learn C++. The page you cite is
very confusing, and has little to do with the way one actually programs
in C++. In C++, most of the time, you'd use `std::vector` for an array,
not the complex solutions proposed on the page you cite. In practice,
you never use `operator new[]` (an... |
6,122,091 | I'm familiar with Java and trying to teach myself C/C++. I'm stealing some curriculum from a class that is hosting their materials [here](http://courses.washington.edu/css342/zander/css332/array.html). I unfortunately can't ask the teacher since I'm not in the class. My concern is with the section under "dynamically de... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6122091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349611/"
] | >
> My understanding is that an array in C is simply a reference to the memory address of the first element in the array.
>
>
> So, what is the difference between int \*pointerArray = new int[10]; and int array[10]; if any?
>
>
>
What you mention is the reason for much confusion in any C/C++ beginner.
In C/C++,... | First, I'd look for some other place to learn C++. The page you cite is
very confusing, and has little to do with the way one actually programs
in C++. In C++, most of the time, you'd use `std::vector` for an array,
not the complex solutions proposed on the page you cite. In practice,
you never use `operator new[]` (an... |
6,122,091 | I'm familiar with Java and trying to teach myself C/C++. I'm stealing some curriculum from a class that is hosting their materials [here](http://courses.washington.edu/css342/zander/css332/array.html). I unfortunately can't ask the teacher since I'm not in the class. My concern is with the section under "dynamically de... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6122091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349611/"
] | `int array[10];` declares the array size statically, that means it is fixed - which is the only major difference. It also might be allocated to be inside the function's stack frame, i.e. on the program's stack. You do not need to worry about using `delete []` on that kind of array, in fact, you might crash the program ... | It is true that you can get most of array functionality by using a pointer to its first element. But compiler knows that a static array is composed of several elements and the most notable difference is the result of the `sizeof` operator.
`sizeof(pointerArray) = sizeof int*`
`sizeof(array) = 10 * sizeof int` |
6,122,091 | I'm familiar with Java and trying to teach myself C/C++. I'm stealing some curriculum from a class that is hosting their materials [here](http://courses.washington.edu/css342/zander/css332/array.html). I unfortunately can't ask the teacher since I'm not in the class. My concern is with the section under "dynamically de... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6122091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349611/"
] | The problem with understanding C/C++ arrays when coming from Java is that C/C++ distinguishes between the array variable and the memory used to store the array contents. Both concepts are important and distinct. In Java, you really just have a reference to an object that is an array.
You also need to understand that C... | The main difference is that some operations that are allowed on pointers are not allowed on arrays. |
10,710,566 | How to match different instances of the same word.
Eg: if the string is synergy. How to match it with synergizes, synergism, synergically, synergistic.
I could write the following:
```
while(<IN>)
{
chomp $_;
my $line= $_;
$word="Synergy";
if($line=~m/$word(\w+)/i)
{
$line=~s/$word/<Effect>$word<\/Effect>/... | 2012/05/22 | [
"https://Stackoverflow.com/questions/10710566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1226696/"
] | What you probably want to do is called stemming.
However, for this to work, you have to stem all the words in the text plus the one you search for. Hopefully all of your listed words result in the same stem. I haven't tested it yet.
```
use Lingua::Stem;
my $stemmer = Lingua::Stem->new( -locale => 'EN-UK' );
# first ... | You're going to want to use regular expressions. It is unclear what exactly the criteria you want to match, but in your example all the words start with "synergi" so `if($string =~ \bsynergi\w*\b)` would find all lines containing "synergi" anywhere in them. |
10,710,566 | How to match different instances of the same word.
Eg: if the string is synergy. How to match it with synergizes, synergism, synergically, synergistic.
I could write the following:
```
while(<IN>)
{
chomp $_;
my $line= $_;
$word="Synergy";
if($line=~m/$word(\w+)/i)
{
$line=~s/$word/<Effect>$word<\/Effect>/... | 2012/05/22 | [
"https://Stackoverflow.com/questions/10710566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1226696/"
] | What you probably want to do is called stemming.
However, for this to work, you have to stem all the words in the text plus the one you search for. Hopefully all of your listed words result in the same stem. I haven't tested it yet.
```
use Lingua::Stem;
my $stemmer = Lingua::Stem->new( -locale => 'EN-UK' );
# first ... | You might want to check out Text::Soundex. For example,
```
use Text::Soundex;
# The following all return S562
print soundex("synergizes"), "\n";
print soundex("synergism"), "\n";
print soundex("synergically"), "\n";
print soundex("synergistic"), "\n";
```
Further reading: [Perldoc Text::Soundex](http://perldoc.per... |
161,687 | You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.
So an example Perl problem:
A simple script which recursively iterates through a ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/161687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19468/"
] | Others have mentioned File::Find, which is the way I'd go, but you asked for an iterator, which File::Find isn't (nor is File::Find::Rule). You might want to look at [File::Next](http://search.cpan.org/dist/File-Next/) or [File::Find::Object](http://search.cpan.org/dist/File-Find-Object/), which do have an iterative in... | My preferred method is to use the File::Find module as so:
```
use File::Find;
find (\&checkFile, $directory_to_check_recursively);
sub checkFile()
{
#examine each file in here. Filename is in $_ and you are chdired into it's directory
#directory is also available in $File::Find::dir
}
``` |
161,687 | You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.
So an example Perl problem:
A simple script which recursively iterates through a ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/161687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19468/"
] | This sounds like a job for [File::Find::Rule](http://search.cpan.org/perldoc?File::Find::Rule):
```
#!/usr/bin/perl
use strict;
use warnings;
use autodie; # Causes built-ins like open to succeed or die.
# You can 'use Fatal qw(open)' if autodie is not installed.
use File::Find::Rule;
use Getopt::Std;
... | [File::Find](http://search.cpan.org/~rgarcia/perl-5.10.0/lib/File/Find.pm) is the right way to solve this problem. There is no use in reimplementing stuff that already exists in other modules, but reimplementing something that is in a standard module should really be discouraged. |
161,687 | You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.
So an example Perl problem:
A simple script which recursively iterates through a ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/161687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19468/"
] | Where the problem is solved mainly by standard libraries use them.
File::Find in this case works nicely.
There may be many ways to do things in perl, but where a very standard library exists to do something, it should be utilised unless it has problems of it's own.
```
#!/usr/bin/perl
use strict;
use File::Find();
... | I write a subroutine that reads a directory with `readdir`, throws out the "." and ".." directories, recurses if it finds a new directory, and examines the files for what I'm looking for (in your case, you'll want to use `utime` or `stat`). By time the recursion is done, every file should have been examined.
I think a... |
161,687 | You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.
So an example Perl problem:
A simple script which recursively iterates through a ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/161687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19468/"
] | Others have mentioned File::Find, which is the way I'd go, but you asked for an iterator, which File::Find isn't (nor is File::Find::Rule). You might want to look at [File::Next](http://search.cpan.org/dist/File-Next/) or [File::Find::Object](http://search.cpan.org/dist/File-Find-Object/), which do have an iterative in... | I write a subroutine that reads a directory with `readdir`, throws out the "." and ".." directories, recurses if it finds a new directory, and examines the files for what I'm looking for (in your case, you'll want to use `utime` or `stat`). By time the recursion is done, every file should have been examined.
I think a... |
161,687 | You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.
So an example Perl problem:
A simple script which recursively iterates through a ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/161687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19468/"
] | My preferred method is to use the File::Find module as so:
```
use File::Find;
find (\&checkFile, $directory_to_check_recursively);
sub checkFile()
{
#examine each file in here. Filename is in $_ and you are chdired into it's directory
#directory is also available in $File::Find::dir
}
``` | I write a subroutine that reads a directory with `readdir`, throws out the "." and ".." directories, recurses if it finds a new directory, and examines the files for what I'm looking for (in your case, you'll want to use `utime` or `stat`). By time the recursion is done, every file should have been examined.
I think a... |
161,687 | You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.
So an example Perl problem:
A simple script which recursively iterates through a ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/161687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19468/"
] | Where the problem is solved mainly by standard libraries use them.
File::Find in this case works nicely.
There may be many ways to do things in perl, but where a very standard library exists to do something, it should be utilised unless it has problems of it's own.
```
#!/usr/bin/perl
use strict;
use File::Find();
... | I wrote [File::Find::Closures](http://search.cpan.org/dist/File-Find-Closures) as a set of closures that you can use with File::Find so you don't have to write your own. There's a couple of mtime functions that should handle
```
use File::Find;
use File::Find::Closures qw(:all);
my( $wanted, $list_reporter ) = find... |
161,687 | You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.
So an example Perl problem:
A simple script which recursively iterates through a ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/161687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19468/"
] | This sounds like a job for [File::Find::Rule](http://search.cpan.org/perldoc?File::Find::Rule):
```
#!/usr/bin/perl
use strict;
use warnings;
use autodie; # Causes built-ins like open to succeed or die.
# You can 'use Fatal qw(open)' if autodie is not installed.
use File::Find::Rule;
use Getopt::Std;
... | Where the problem is solved mainly by standard libraries use them.
File::Find in this case works nicely.
There may be many ways to do things in perl, but where a very standard library exists to do something, it should be utilised unless it has problems of it's own.
```
#!/usr/bin/perl
use strict;
use File::Find();
... |
161,687 | You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.
So an example Perl problem:
A simple script which recursively iterates through a ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/161687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19468/"
] | My preferred method is to use the File::Find module as so:
```
use File::Find;
find (\&checkFile, $directory_to_check_recursively);
sub checkFile()
{
#examine each file in here. Filename is in $_ and you are chdired into it's directory
#directory is also available in $File::Find::dir
}
``` | Using standard modules is indeed a good idea but out of interest here is my back to basic approach using no external modules. I know code syntax here might not be everyone's cup of tea.
It could be improved to use less memory via providing an iterator access (input list could temporarily be on hold once it reaches a ... |
161,687 | You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.
So an example Perl problem:
A simple script which recursively iterates through a ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/161687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19468/"
] | Where the problem is solved mainly by standard libraries use them.
File::Find in this case works nicely.
There may be many ways to do things in perl, but where a very standard library exists to do something, it should be utilised unless it has problems of it's own.
```
#!/usr/bin/perl
use strict;
use File::Find();
... | There's my [File::Finder](http://search.cpan.org/perldoc/File::Finder), as already mentioned, but there's also my iterator-as-a-tied-hash solution from [Finding Files Incrementally (Linux Magazine)](http://www.stonehenge.com/merlyn/LinuxMag/col30.html). |
161,687 | You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.
So an example Perl problem:
A simple script which recursively iterates through a ... | 2008/10/02 | [
"https://Stackoverflow.com/questions/161687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19468/"
] | There's my [File::Finder](http://search.cpan.org/perldoc/File::Finder), as already mentioned, but there's also my iterator-as-a-tied-hash solution from [Finding Files Incrementally (Linux Magazine)](http://www.stonehenge.com/merlyn/LinuxMag/col30.html). | I'm riskying to get downvoted, but IMHO 'ls' (with appropriate params) command does it in a best known performant way. In this case it might be quite good solution to pipe 'ls' from perl code through shell, returning results to an array or hash.
Edit: It could also be 'find' used, as proposed in comments. |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 18