qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
53,242,882 | I have tried saving 800 JSON responses to .txt file and also Excel file.
For txt, I am using:
```
for activity_id in activity_ids:
activity_details = requests.get(url, params=activity_id).text
with open('test.txt','a') as f:
f.write(activity_details + '\n')
```
For JSON:
```
def df_to_e... | 2018/11/10 | [
"https://Stackoverflow.com/questions/53242882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8461786/"
] | Excel documents (.xlsx) are zip files containing xml files. The size difference that you’re seeing is a result of the compression from the zip process. | The text file is being opened in append mode. If you haven't cleared it somewhere at the beginning of your code, it will keep accumulating a lot of excess text on each run of code. Additionally, you are writing responses for each activity id in text file, whereas it seems like you are overwriting sheet 1 in excel, so t... |
19,729,243 | I'm learning about CSS3 transitions and struggling with the vendor prefixes. This is just for fun but I'd like to know why the circle expands on hover in Firefox as it's meant to but shrinks in Safari and Chrome. Webkit seems to be ignoring the width and height but border and opacity are fine. The animation in the norm... | 2013/11/01 | [
"https://Stackoverflow.com/questions/19729243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2945307/"
] | It looks like it may be an animation bug since the `expando` animation is still applied to the element even while hovered. Each browser deals with it differently.
Clearing the animation seems to fix it.
### CSS
```
.disc:hover {
/* ... */
-webkit-animation:none;
animation:none;
}
``` | Firstly you have to differentiate between transition and animation.
The **keyframe animation** defines the activity that is going on regardless of your input (hover or whatever).
The **transition** defines what happens when you do something.
To examine the differences between the two states to see what is being tran... |
6,539,391 | I am creating a user registration functionality in my application and needed some direction in how to implement it. Currently, my main screen only has a sign up button. When the user clicks the sign up button, a modalview slides up from the bottom and presents the user with the required textfields for registration. The... | 2011/06/30 | [
"https://Stackoverflow.com/questions/6539391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/276424/"
] | I would suggest you add the activity indicator as another view to your navigation controller and set the animation to NO. If the validation is successful pop out this view and add the new controller with animation set to YES.
If unsucessfull then pop till the root view controller. Your piece of code suggests you are a... | Take Navigation controller to appear in modal view, and inside navigation controller, there would be view controller, so that you do not need to take navigation bar in modal view.
```
[self presentModalViewController:navController animated:YES];
```
where navController is UINavigationController, this way it would be... |
3,163,775 | If I download a module which is not stable to run in Drupal (red color over download link), is this causing issues to my drupal installation even if it is not enabled ?
In other words, if I enable it, and use it.. could it cause issues to other modules or drupal core that remain there even after I've disabled it ?
th... | 2010/07/02 | [
"https://Stackoverflow.com/questions/3163775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/257022/"
] | If a bug in the module messes up configuration settings or other data in your database, these will remain even after you uninstalled the module. So yes, it could cause issues for other modules or Drupal core, even after removal.
Note that this could happen with 'stable' modules as well, as the decision on when to decl... | There are two things you need to do which may help
1. Clear the cache manually Under admin->performance
2. Uninstall the module (there is a tab at the top of the modules page to allow you to do this).
Modules which are well written should not affect your site after these steps are taken, but they may corrupt the data... |
863,781 | I'm converting all of our Crystal Reports to use a home-built reporting system. Essentially, I serialize report objects to XML, transform that with XSL to HTML/CSS. Everything works beautifully, except for the design process.
Once I get the XML built correctly, I have to open up the XSL and CSS in SciTE, edit, reload ... | 2009/05/14 | [
"https://Stackoverflow.com/questions/863781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64203/"
] | The `<oXygen/>` XSL / XSLT Editor can do XHTML previews. See the "Preview Transformation Results" section of <http://www.oxygenxml.com/xslt_editor.html>. | Syntext Serna presents a real-time WYSIWYG view of XML based on XSLFO. |
863,781 | I'm converting all of our Crystal Reports to use a home-built reporting system. Essentially, I serialize report objects to XML, transform that with XSL to HTML/CSS. Everything works beautifully, except for the design process.
Once I get the XML built correctly, I have to open up the XSL and CSS in SciTE, edit, reload ... | 2009/05/14 | [
"https://Stackoverflow.com/questions/863781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64203/"
] | Visual Studio supports XSLT processing as does [XML Notepad](http://www.codeplex.com/xmlnotepad).
XML Notepad is free. | Syntext Serna presents a real-time WYSIWYG view of XML based on XSLFO. |
863,781 | I'm converting all of our Crystal Reports to use a home-built reporting system. Essentially, I serialize report objects to XML, transform that with XSL to HTML/CSS. Everything works beautifully, except for the design process.
Once I get the XML built correctly, I have to open up the XSL and CSS in SciTE, edit, reload ... | 2009/05/14 | [
"https://Stackoverflow.com/questions/863781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64203/"
] | This one is online javascript editor.
<http://www.purplegene.com/static/transform.html>
No matter you are a Windows, Linux or Mac user it will simply work! | Syntext Serna presents a real-time WYSIWYG view of XML based on XSLFO. |
863,781 | I'm converting all of our Crystal Reports to use a home-built reporting system. Essentially, I serialize report objects to XML, transform that with XSL to HTML/CSS. Everything works beautifully, except for the design process.
Once I get the XML built correctly, I have to open up the XSL and CSS in SciTE, edit, reload ... | 2009/05/14 | [
"https://Stackoverflow.com/questions/863781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64203/"
] | You can use Altova XmlSpy for creating/editing xml/ xslts, getting xslt outputs, making calls to web service, evaluating xqueries in the database and many more things. It is a very powerful all-purpose xml tool. Requires a license though. | I've used the XSLT debugger in Visual Studio. Very useful.
<http://msdn.microsoft.com/en-us/library/ms255605.aspx> |
863,781 | I'm converting all of our Crystal Reports to use a home-built reporting system. Essentially, I serialize report objects to XML, transform that with XSL to HTML/CSS. Everything works beautifully, except for the design process.
Once I get the XML built correctly, I have to open up the XSL and CSS in SciTE, edit, reload ... | 2009/05/14 | [
"https://Stackoverflow.com/questions/863781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64203/"
] | You can use Altova XmlSpy for creating/editing xml/ xslts, getting xslt outputs, making calls to web service, evaluating xqueries in the database and many more things. It is a very powerful all-purpose xml tool. Requires a license though. | Visual Studio supports XSLT processing as does [XML Notepad](http://www.codeplex.com/xmlnotepad).
XML Notepad is free. |
863,781 | I'm converting all of our Crystal Reports to use a home-built reporting system. Essentially, I serialize report objects to XML, transform that with XSL to HTML/CSS. Everything works beautifully, except for the design process.
Once I get the XML built correctly, I have to open up the XSL and CSS in SciTE, edit, reload ... | 2009/05/14 | [
"https://Stackoverflow.com/questions/863781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64203/"
] | This one is online javascript editor.
<http://www.purplegene.com/static/transform.html>
No matter you are a Windows, Linux or Mac user it will simply work! | I've used the XSLT debugger in Visual Studio. Very useful.
<http://msdn.microsoft.com/en-us/library/ms255605.aspx> |
863,781 | I'm converting all of our Crystal Reports to use a home-built reporting system. Essentially, I serialize report objects to XML, transform that with XSL to HTML/CSS. Everything works beautifully, except for the design process.
Once I get the XML built correctly, I have to open up the XSL and CSS in SciTE, edit, reload ... | 2009/05/14 | [
"https://Stackoverflow.com/questions/863781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64203/"
] | You can use Altova XmlSpy for creating/editing xml/ xslts, getting xslt outputs, making calls to web service, evaluating xqueries in the database and many more things. It is a very powerful all-purpose xml tool. Requires a license though. | The `<oXygen/>` XSL / XSLT Editor can do XHTML previews. See the "Preview Transformation Results" section of <http://www.oxygenxml.com/xslt_editor.html>. |
863,781 | I'm converting all of our Crystal Reports to use a home-built reporting system. Essentially, I serialize report objects to XML, transform that with XSL to HTML/CSS. Everything works beautifully, except for the design process.
Once I get the XML built correctly, I have to open up the XSL and CSS in SciTE, edit, reload ... | 2009/05/14 | [
"https://Stackoverflow.com/questions/863781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64203/"
] | You can use Altova XmlSpy for creating/editing xml/ xslts, getting xslt outputs, making calls to web service, evaluating xqueries in the database and many more things. It is a very powerful all-purpose xml tool. Requires a license though. | This one is online javascript editor.
<http://www.purplegene.com/static/transform.html>
No matter you are a Windows, Linux or Mac user it will simply work! |
863,781 | I'm converting all of our Crystal Reports to use a home-built reporting system. Essentially, I serialize report objects to XML, transform that with XSL to HTML/CSS. Everything works beautifully, except for the design process.
Once I get the XML built correctly, I have to open up the XSL and CSS in SciTE, edit, reload ... | 2009/05/14 | [
"https://Stackoverflow.com/questions/863781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64203/"
] | The `<oXygen/>` XSL / XSLT Editor can do XHTML previews. See the "Preview Transformation Results" section of <http://www.oxygenxml.com/xslt_editor.html>. | Visual Studio supports XSLT processing as does [XML Notepad](http://www.codeplex.com/xmlnotepad).
XML Notepad is free. |
863,781 | I'm converting all of our Crystal Reports to use a home-built reporting system. Essentially, I serialize report objects to XML, transform that with XSL to HTML/CSS. Everything works beautifully, except for the design process.
Once I get the XML built correctly, I have to open up the XSL and CSS in SciTE, edit, reload ... | 2009/05/14 | [
"https://Stackoverflow.com/questions/863781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64203/"
] | The `<oXygen/>` XSL / XSLT Editor can do XHTML previews. See the "Preview Transformation Results" section of <http://www.oxygenxml.com/xslt_editor.html>. | I've used the XSLT debugger in Visual Studio. Very useful.
<http://msdn.microsoft.com/en-us/library/ms255605.aspx> |
20,893,187 | Is there any expression where by an object's toString method is **implicitly** called overriding its valueOf method?
In the examples below, valueOf is always called implicitly (overriding toString).
```
"4" + {
toString: function () {
return "4";
},
valueOf: function () {
return 6;
}
... | 2014/01/02 | [
"https://Stackoverflow.com/questions/20893187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3124390/"
] | >
> Is there any expression where by an object's toString method is implicitly called overriding its valueOf method?
>
>
>
Yes, that does happen whenever the abstract [`ToString` operation](http://es5.github.io/#x9.8) is applied on an object, using the [`DefaultValue` procedure](http://es5.github.io/#x8.12.8) with... | >
> *Is there any expression*
>
>
>
Yes. Here's an example that will use `toString`:
```
alert({
toString: function () {
return "4";
},
valueOf: function () {
return 6;
}
}); // alerts "4"
``` |
20,893,187 | Is there any expression where by an object's toString method is **implicitly** called overriding its valueOf method?
In the examples below, valueOf is always called implicitly (overriding toString).
```
"4" + {
toString: function () {
return "4";
},
valueOf: function () {
return 6;
}
... | 2014/01/02 | [
"https://Stackoverflow.com/questions/20893187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3124390/"
] | The + operator on Date objects uses toString not valueOf. Also if valueOf returns a non-primitive value then the toString method is called next. (JavaScript - The definitive guide, section 3.14) Using your example:
```
var result = "4" + {
toString: function () {
return "4";
},
valueOf: function ()... | >
> *Is there any expression*
>
>
>
Yes. Here's an example that will use `toString`:
```
alert({
toString: function () {
return "4";
},
valueOf: function () {
return 6;
}
}); // alerts "4"
``` |
8,154,590 | Here's the scenario:
1. development branch (current commit dated 11/15)
2. then, i've make a feature branch (FeatureA) from development (with current commit dated 11/15)
3. modify & work in the feature branch (FeatureA)
4. other user, committed/merged to the development branch (current commit dated 11/16)
So, I upda... | 2011/11/16 | [
"https://Stackoverflow.com/questions/8154590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/332128/"
] | Either `git merge development` or `git rebase development`. Prefer the latter only after reading up on [rebasing](http://book.git-scm.com/4_rebasing.html), since it rewrites history. | ```
git fetch origin
```
should update your branch with the changes made to the code in development. |
2,785,506 | Suppose $g$ is $\alpha$-Hölder continuous and $f\_n$ converges uniformly to $f$ at rate $a\_n$, so that
$a\_n \sup\_{x}|f\_n(x) - f(x)| \to 0 $ as $n \to \infty$
Then does $g \circ f\_n$ converges uniformly to $g\circ f$ at rate $a\_n$? | 2018/05/17 | [
"https://math.stackexchange.com/questions/2785506",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/556297/"
] | The claim is false in general. To see it,
take $f\_n(x) = x + \frac 1n$, $f(x) = x$, and set $a\_n = n^{1/2}$ (for instance), let also $g(x)= x^{1/2}$, where $x\geq 0$.
We have that $g$ is Holder-$\frac 12$, but the claim in your question fails for these data.
Indeed, $f\_n$ converges to $f$ uniformly on $\mathbb{R... | No.
We need $a\_n \sup\_x|f\_n(x) - f(x)|^\alpha \to 0$
From the Hölder continuity of $g$, there are non-negative constant $C$, $\alpha$ such that
$ a\_n|g(x) - g(y)| \le a\_n C |x - y |^{\alpha} $
For $\alpha > 1$, the function $g$ is constant and the convergence is automatic. For $\alpha < 1$, we have, from the ... |
38,919,640 | I have a PL/SQL script which generates a text file currently, but I need to generate excel file from the script. I have currently have pl/sql code like below,
```
BEGIN
--column headers
DBMS_OUTPUT.PUT_LINE(‘column name header 1 | column name header 2 |
column name header 3 |………..| column name header n’); ... | 2016/08/12 | [
"https://Stackoverflow.com/questions/38919640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6706909/"
] | You have to use `document.getElementById()`, as you have not locally defined a function called `getElementById()`. You can take a look at more `document.getElementById()` syntax at the **[MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById)**. | Prefix `getElementById` with `document`, e.g. `document.getElementById` |
7,688,077 | I am trying to make a 2D density plot (from some simulation data) with matplotlib. My x and y data are defined as the log10 of some quantities. How can I get logarithmic axes (with log minor ticks)?
Here is an exemple of my code:
```
import numpy as np
import matplotlib.pyplot as plt
Data = np.genfromtxt("data") # ... | 2011/10/07 | [
"https://Stackoverflow.com/questions/7688077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/984073/"
] | From the matplotlib.pyplot.hist docstring, it looks like there is a 'log' argument to set to 'True' if you want log scale on axis.
```
hist(x, bins=10, range=None, normed=False, cumulative=False,
bottom=None, histtype='bar', align='mid',
orientation='vertical', rwidth=None, log=False, **kwargs)
log:
If True... | The answer from @gcalmettes refers to `pyplot.hist`. The signature for `pyplot.hexbin` is a bit different:
```
hexbin(x, y, C = None, gridsize = 100, bins = None,
xscale = 'linear', yscale = 'linear',
cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None,
edgec... |
7,688,077 | I am trying to make a 2D density plot (from some simulation data) with matplotlib. My x and y data are defined as the log10 of some quantities. How can I get logarithmic axes (with log minor ticks)?
Here is an exemple of my code:
```
import numpy as np
import matplotlib.pyplot as plt
Data = np.genfromtxt("data") # ... | 2011/10/07 | [
"https://Stackoverflow.com/questions/7688077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/984073/"
] | Thank you very much for suggestions.
Below, I join my own solution. It is hardly "a minimum working example" but I have already stripped my script quite a lot!
In a nutshell, I used imshow to plot the "image" (a 2D histogram with log bins) and I remove the axes. Then, I draw a second, empty (and transparent), plot, ... | From the matplotlib.pyplot.hist docstring, it looks like there is a 'log' argument to set to 'True' if you want log scale on axis.
```
hist(x, bins=10, range=None, normed=False, cumulative=False,
bottom=None, histtype='bar', align='mid',
orientation='vertical', rwidth=None, log=False, **kwargs)
log:
If True... |
7,688,077 | I am trying to make a 2D density plot (from some simulation data) with matplotlib. My x and y data are defined as the log10 of some quantities. How can I get logarithmic axes (with log minor ticks)?
Here is an exemple of my code:
```
import numpy as np
import matplotlib.pyplot as plt
Data = np.genfromtxt("data") # ... | 2011/10/07 | [
"https://Stackoverflow.com/questions/7688077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/984073/"
] | Thank you very much for suggestions.
Below, I join my own solution. It is hardly "a minimum working example" but I have already stripped my script quite a lot!
In a nutshell, I used imshow to plot the "image" (a 2D histogram with log bins) and I remove the axes. Then, I draw a second, empty (and transparent), plot, ... | The answer from @gcalmettes refers to `pyplot.hist`. The signature for `pyplot.hexbin` is a bit different:
```
hexbin(x, y, C = None, gridsize = 100, bins = None,
xscale = 'linear', yscale = 'linear',
cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None,
edgec... |
418,210 | What are the things I should be looking for when I produce a dependency graph?
Or to put it another way, what are the characteristics of a good looking graph vs a bad one?
Edit: The context here is my first look at my assemblies in NDepend. | 2009/01/06 | [
"https://Stackoverflow.com/questions/418210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] | a dependency graph of what? classes? stored procedures?
cycles are bad... | If changing one dependency means you need to change a whole lot of others, it's bad.
But yea, some context could help. |
418,210 | What are the things I should be looking for when I produce a dependency graph?
Or to put it another way, what are the characteristics of a good looking graph vs a bad one?
Edit: The context here is my first look at my assemblies in NDepend. | 2009/01/06 | [
"https://Stackoverflow.com/questions/418210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] | a dependency graph of what? classes? stored procedures?
cycles are bad... | I don't known what NDepend shows but artifacts that tend to get into many sections (particularly unrelated sections) of code would tend to be bad (IMHO). I've thought of that as "Cancer Code". |
418,210 | What are the things I should be looking for when I produce a dependency graph?
Or to put it another way, what are the characteristics of a good looking graph vs a bad one?
Edit: The context here is my first look at my assemblies in NDepend. | 2009/01/06 | [
"https://Stackoverflow.com/questions/418210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] | a dependency graph of what? classes? stored procedures?
cycles are bad... | A speaker at a NFJS conference showed us some dependency graphs...
One smell he pointed out was to look for things with relationships to different functional parts of your codebase. These likely break encapsulation.
Also I would look at the general complexity of each section.. ones with lines all over are suspects. |
418,210 | What are the things I should be looking for when I produce a dependency graph?
Or to put it another way, what are the characteristics of a good looking graph vs a bad one?
Edit: The context here is my first look at my assemblies in NDepend. | 2009/01/06 | [
"https://Stackoverflow.com/questions/418210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] | The biggest problem you can spot is definitely Dependencies Cycles. The tool NDepend proposes an interactive [dependency Matrix](http://www.ndepend.com/Doc_Matrix.aspx) and a [dependency Graph](http://www.ndepend.com/Doc_VS_Arch.aspx) that will help to spot [dependency cyles](http://www.ndepend.com/Doc_VS_Arch.aspx#Cyc... | a dependency graph of what? classes? stored procedures?
cycles are bad... |
418,210 | What are the things I should be looking for when I produce a dependency graph?
Or to put it another way, what are the characteristics of a good looking graph vs a bad one?
Edit: The context here is my first look at my assemblies in NDepend. | 2009/01/06 | [
"https://Stackoverflow.com/questions/418210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] | The biggest problem you can spot is definitely Dependencies Cycles. The tool NDepend proposes an interactive [dependency Matrix](http://www.ndepend.com/Doc_Matrix.aspx) and a [dependency Graph](http://www.ndepend.com/Doc_VS_Arch.aspx) that will help to spot [dependency cyles](http://www.ndepend.com/Doc_VS_Arch.aspx#Cyc... | If changing one dependency means you need to change a whole lot of others, it's bad.
But yea, some context could help. |
418,210 | What are the things I should be looking for when I produce a dependency graph?
Or to put it another way, what are the characteristics of a good looking graph vs a bad one?
Edit: The context here is my first look at my assemblies in NDepend. | 2009/01/06 | [
"https://Stackoverflow.com/questions/418210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] | The biggest problem you can spot is definitely Dependencies Cycles. The tool NDepend proposes an interactive [dependency Matrix](http://www.ndepend.com/Doc_Matrix.aspx) and a [dependency Graph](http://www.ndepend.com/Doc_VS_Arch.aspx) that will help to spot [dependency cyles](http://www.ndepend.com/Doc_VS_Arch.aspx#Cyc... | I don't known what NDepend shows but artifacts that tend to get into many sections (particularly unrelated sections) of code would tend to be bad (IMHO). I've thought of that as "Cancer Code". |
418,210 | What are the things I should be looking for when I produce a dependency graph?
Or to put it another way, what are the characteristics of a good looking graph vs a bad one?
Edit: The context here is my first look at my assemblies in NDepend. | 2009/01/06 | [
"https://Stackoverflow.com/questions/418210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] | The biggest problem you can spot is definitely Dependencies Cycles. The tool NDepend proposes an interactive [dependency Matrix](http://www.ndepend.com/Doc_Matrix.aspx) and a [dependency Graph](http://www.ndepend.com/Doc_VS_Arch.aspx) that will help to spot [dependency cyles](http://www.ndepend.com/Doc_VS_Arch.aspx#Cyc... | A speaker at a NFJS conference showed us some dependency graphs...
One smell he pointed out was to look for things with relationships to different functional parts of your codebase. These likely break encapsulation.
Also I would look at the general complexity of each section.. ones with lines all over are suspects. |
8,071,386 | What php function should I use to count the 5th line of a large file as the 5th line is the bandwidth?
Example of data:
```
103.239.234.105 -- [2007-04-01 00:42:21] "GET articles/learn_PHP_basics HTTP/1.0" 200 12729 "Mozilla/4.0"
``` | 2011/11/09 | [
"https://Stackoverflow.com/questions/8071386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009791/"
] | If you want to read *every 5th line*, you could use an [`SplFileObject`](http://php.net/splfileobject) to make life a little easier (than the `fopen/fgets/fclose` family of functions).
```
$f = new SplFileObject('myreallybigfile.txt');
// Read ahead so that if the last line in the file is a 5th line, we echo it.
$f->... | Open the file into a handle:
```
$handle = fopen("someFilePath", "r");
```
Then read the first 5 lines, and only save the fifth:
```
$i = 0;
$fifthLine = null;
while (($buffer = fgets($handle, 4096)) !== false) {
if $i++ >= 5) {
$fifthLine = $buffer;
break;
}
}
fclose($handle);
if ($i < 5); ... |
8,071,386 | What php function should I use to count the 5th line of a large file as the 5th line is the bandwidth?
Example of data:
```
103.239.234.105 -- [2007-04-01 00:42:21] "GET articles/learn_PHP_basics HTTP/1.0" 200 12729 "Mozilla/4.0"
``` | 2011/11/09 | [
"https://Stackoverflow.com/questions/8071386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009791/"
] | If you want to read *every 5th line*, you could use an [`SplFileObject`](http://php.net/splfileobject) to make life a little easier (than the `fopen/fgets/fclose` family of functions).
```
$f = new SplFileObject('myreallybigfile.txt');
// Read ahead so that if the last line in the file is a 5th line, we echo it.
$f->... | <http://tekkie.flashbit.net/php/tail-functionality-in-php>
```
<?php
// full path to text file
define("TEXT_FILE", "/home/www/default-error.log");
// number of lines to read from the end of file
define("LINES_COUNT", 10);
function read_file($file, $lines) {
//global $fsize;
$handle = fopen($file, "r");
$... |
65,832,949 | I'm learning about goroutines and channels and have a question about what happens if multiple goroutines try fetching data from the same channel.
How does the go runtime makes sure that data in a channel that is being read by multiple goroutines is provided to only one of the goroutines waiting on the channel and not ... | 2021/01/21 | [
"https://Stackoverflow.com/questions/65832949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5163149/"
] | Channels are one of the primary ways for goroutines to synchronize with each other. Therefore they contain a mechanism to ensure that only one goroutine at a time is able to pull a data item from a channel and that the data item retrieved is not duplicated.
You can't really count on any particular sequence of multiple... | There is a quite good analysis of Go channel internals here <https://codeburst.io/diving-deep-into-the-golang-channels-549fd4ed21a8>
Basically, the channel maintains an internal queue of goroutines waiting for the read operations. And when something is sent, it just selects one goroutine from that queue and feeds it... |
71,343,624 | given a list of dicts:
```
import pandas as pd
d =[{'foil': ['a', 'b', 'c']},
{'car': ['b', 'c','d','e']},
{'container': ['e','f','g','h','i','j']}]
df=pd.DataFrame()
for c in d:
print(c)
word = list(c.keys())[0]
values = c[word]
df[word] = pd.Series(values, name=word)
df
```
I would like to buil... | 2022/03/03 | [
"https://Stackoverflow.com/questions/71343624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7168098/"
] | You may check `concat` the result with for loop
```
out = pd.concat([pd.DataFrame(x) for x in d],axis=1)
Out[534]:
foil car container
0 a b e
1 b c f
2 c d g
3 NaN e h
4 NaN NaN i
5 NaN NaN j
``` | One can use [`ChainMap`](https://docs.python.org/3/library/collections.html#collections.ChainMap) to merge the dictionaries and the DataFrame constructor:
```
from collections import ChainMap
c = ChainMap(*d)
df = pd.DataFrame(c.values(), index=c).T
```
Or, in line with the nice answer of @not\_speshal,
```
from co... |
71,343,624 | given a list of dicts:
```
import pandas as pd
d =[{'foil': ['a', 'b', 'c']},
{'car': ['b', 'c','d','e']},
{'container': ['e','f','g','h','i','j']}]
df=pd.DataFrame()
for c in d:
print(c)
word = list(c.keys())[0]
values = c[word]
df[word] = pd.Series(values, name=word)
df
```
I would like to buil... | 2022/03/03 | [
"https://Stackoverflow.com/questions/71343624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7168098/"
] | You can change your list of dictionaries to a single dictionary and then call `from_dict`:
```
>>> pd.DataFrame.from_dict({k: v for dct in d for k,v in dct.items()},orient="index").T
foil car container
0 a b e
1 b c f
2 c d g
3 None e h
4 None None ... | One can use [`ChainMap`](https://docs.python.org/3/library/collections.html#collections.ChainMap) to merge the dictionaries and the DataFrame constructor:
```
from collections import ChainMap
c = ChainMap(*d)
df = pd.DataFrame(c.values(), index=c).T
```
Or, in line with the nice answer of @not\_speshal,
```
from co... |
19,375,149 | I am using datepicker. I want to display list of indian holiday on calender.
I am using below script. Calender working fine. Only i need to display holiday.
```
$(function() {
$('#datepicker-dep').datepicker({numberOfMonths: 2, showCurrentAtPos: 0,minDate: 0});
});
``` | 2013/10/15 | [
"https://Stackoverflow.com/questions/19375149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2125947/"
] | You should use `[UIColor colorWithRed:0x38/255. green:0xcb/255. blue:0xf8/255. alpha:1.0]` | Here is a great tool to use for generating UIColor from hex colors. This tool even auto generates the UIColor code for you.
<http://uicolor.org/> |
27,017,341 | My friend's project in Git repository, have downloaded 'Git-1.9.4-preview20140929.exe' and installed GIT bash to pull the project to my end, which I did using
```
$ git clone <with SSH clone URL>
```
I got the project in my local system, and have done few changes now I want to push the changes back to repository, s... | 2014/11/19 | [
"https://Stackoverflow.com/questions/27017341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3779507/"
] | After [the chat](https://chat.stackoverflow.com/rooms/65360/discussion-between-vonc-and-java-beginner), the right way to configure the link with github is:
```
cd c:\Users\ramas\dmsproject\dms
git remote set-url origin git@github.com:vamsiannem/dms.git
```
Then a `git push` can work. | I had this problem too but finally I found the file that had edited and not commit in my working area. So after I commit,and like this:

and then I use the `git push -u origin master` it finished! |
33,263,341 | I need to use recursion in this program for a school project. The program checks if the number inputted is a real number (in this case defined by a number with a decimal with the characters 0-9 (e.g. 56.7). How would I make the function recursive?
Thanks :-)
```
Module Real_Numbers
Sub Main()
Dim number ... | 2015/10/21 | [
"https://Stackoverflow.com/questions/33263341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5418269/"
] | Given that this is a homework assignment, I'm not going to write the code out for you. But I will say this -- there are a couple of ways to set this up. One straightforward way would be to pass the string (of the number) to CheckNumber and then check the first character -- if it's numeric, call CheckNumber again with t... | You should call the CheckNumber function from within itself, that is a recursion. Learn more about recursion [here](https://en.wikipedia.org/wiki/Recursion). |
38,230,814 | I want to create two tables: supporters and tickets in database. In tickets table, I want to add id of supporters table as foreign key( supports\_id in tickets table). But I will not define as foreign key in migration. I read Eloquent relations at Laravel official site, it say 'Eloquent will automatically determine the... | 2016/07/06 | [
"https://Stackoverflow.com/questions/38230814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6496970/"
] | I looked into this in some detail because I was dealing with a similar issue.
The short version is, `slidify` is not longer really compatible with `shiny`, but the bulk of its functionality has been rolled-into `rmarkdown`, which is compatible with `shiny`.
Ramnath's last comments about this with `slidify`, were th... | You might go through this examples here by Ramnath
<https://www.youtube.com/watch?v=I95GOmLc7TA> |
19,450,256 | I understand that symbols and strings are not same, but I don't understand the concept of symbols.
As I understand, a symbol refers to something else. I use the word refer here for my better understanding, not in the in sense of C/C++ pointers or references.
1. When I create a new controller in Rails, using something... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19450256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/922581/"
] | A `Symbol` in Ruby is just an immutable string with a special syntax. It's used mostly so you can use less memory when doing string matching like operations as in:
```
options = { :me => 'joe' }
puts options[:me]
```
This creates a single symbol for `:me`, if you used strings:
```
options = { 'me' => 'joe' }
puts o... | `:all` is instance of `Symbol` class, it's built-in Ruby class. All
```
@posts1 = Post.find(:all)
```
line is deprecated way to load all posts to `@posts1` variable. `:all` symbol is what indicates that you want to fetch all posts. If you type:
```
@post = Post.find(5)
```
you'd get only one post, the one with id... |
19,450,256 | I understand that symbols and strings are not same, but I don't understand the concept of symbols.
As I understand, a symbol refers to something else. I use the word refer here for my better understanding, not in the in sense of C/C++ pointers or references.
1. When I create a new controller in Rails, using something... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19450256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/922581/"
] | Symbol is just an immutable interned string meaning that all symbol variables with the same value point to exactly the same memory location. They also never garbage collected so avoid creating them with `to_sym`. They are frequently used as keys in hash tables but here's the catch - some hash tables you'll receive from... | `:all` is instance of `Symbol` class, it's built-in Ruby class. All
```
@posts1 = Post.find(:all)
```
line is deprecated way to load all posts to `@posts1` variable. `:all` symbol is what indicates that you want to fetch all posts. If you type:
```
@post = Post.find(5)
```
you'd get only one post, the one with id... |
19,450,256 | I understand that symbols and strings are not same, but I don't understand the concept of symbols.
As I understand, a symbol refers to something else. I use the word refer here for my better understanding, not in the in sense of C/C++ pointers or references.
1. When I create a new controller in Rails, using something... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19450256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/922581/"
] | A `Symbol` in Ruby is just an immutable string with a special syntax. It's used mostly so you can use less memory when doing string matching like operations as in:
```
options = { :me => 'joe' }
puts options[:me]
```
This creates a single symbol for `:me`, if you used strings:
```
options = { 'me' => 'joe' }
puts o... | Symbol is just an immutable interned string meaning that all symbol variables with the same value point to exactly the same memory location. They also never garbage collected so avoid creating them with `to_sym`. They are frequently used as keys in hash tables but here's the catch - some hash tables you'll receive from... |
19,450,256 | I understand that symbols and strings are not same, but I don't understand the concept of symbols.
As I understand, a symbol refers to something else. I use the word refer here for my better understanding, not in the in sense of C/C++ pointers or references.
1. When I create a new controller in Rails, using something... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19450256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/922581/"
] | A `Symbol` in Ruby is just an immutable string with a special syntax. It's used mostly so you can use less memory when doing string matching like operations as in:
```
options = { :me => 'joe' }
puts options[:me]
```
This creates a single symbol for `:me`, if you used strings:
```
options = { 'me' => 'joe' }
puts o... | symbol is the same as the string, but one with the same value have the same memory address. And this is a key difference.
```
puts 'string'.object_id
puts 'string'.object_id
puts 'string'.object_id
#=> 3099310
#=> 3099310
#=> 3099310
puts :symbol.object_id
puts :symbol.object_id
puts :symbol.object_id
#=> 3098410
... |
19,450,256 | I understand that symbols and strings are not same, but I don't understand the concept of symbols.
As I understand, a symbol refers to something else. I use the word refer here for my better understanding, not in the in sense of C/C++ pointers or references.
1. When I create a new controller in Rails, using something... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19450256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/922581/"
] | A `Symbol` in Ruby is just an immutable string with a special syntax. It's used mostly so you can use less memory when doing string matching like operations as in:
```
options = { :me => 'joe' }
puts options[:me]
```
This creates a single symbol for `:me`, if you used strings:
```
options = { 'me' => 'joe' }
puts o... | I will recommend you to have a look to this blog [Ruby Symbol and String.](http://railskey.wordpress.com/2013/02/17/ruby-symbols-and-strings/)
You will get a lot more apart from symbol and string definition with details example. |
19,450,256 | I understand that symbols and strings are not same, but I don't understand the concept of symbols.
As I understand, a symbol refers to something else. I use the word refer here for my better understanding, not in the in sense of C/C++ pointers or references.
1. When I create a new controller in Rails, using something... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19450256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/922581/"
] | Symbol is just an immutable interned string meaning that all symbol variables with the same value point to exactly the same memory location. They also never garbage collected so avoid creating them with `to_sym`. They are frequently used as keys in hash tables but here's the catch - some hash tables you'll receive from... | symbol is the same as the string, but one with the same value have the same memory address. And this is a key difference.
```
puts 'string'.object_id
puts 'string'.object_id
puts 'string'.object_id
#=> 3099310
#=> 3099310
#=> 3099310
puts :symbol.object_id
puts :symbol.object_id
puts :symbol.object_id
#=> 3098410
... |
19,450,256 | I understand that symbols and strings are not same, but I don't understand the concept of symbols.
As I understand, a symbol refers to something else. I use the word refer here for my better understanding, not in the in sense of C/C++ pointers or references.
1. When I create a new controller in Rails, using something... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19450256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/922581/"
] | Symbol is just an immutable interned string meaning that all symbol variables with the same value point to exactly the same memory location. They also never garbage collected so avoid creating them with `to_sym`. They are frequently used as keys in hash tables but here's the catch - some hash tables you'll receive from... | I will recommend you to have a look to this blog [Ruby Symbol and String.](http://railskey.wordpress.com/2013/02/17/ruby-symbols-and-strings/)
You will get a lot more apart from symbol and string definition with details example. |
28,063,058 | I am trying to send a `JSON` request with `AFNetworing` but following code giving me `JSON text did not start with array or object and option to allow fragments not set` error:
```
NSString *post = [[NSString alloc] initWithFormat:
@"{\"request\":\"login\",\"userName\":\"%@\",\"password\":\"%@\"}", u... | 2015/01/21 | [
"https://Stackoverflow.com/questions/28063058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/614065/"
] | Another option:
you can always get original body of the route with UnitOfWork interface
```
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
Message originalMessage = (Message)
exchange.getUnitOfWork().getOriginalInMessage();
(do s... | As far as I know, the original message is indeed "lost" when you use the `splitter` pattern.
You can save it as a property on the exchange, and use it again later to replace the message body, with the updated positions list.
```
from("activemq:orders")
.setProperty("OriginalMessage", body())
.split(body().tok... |
28,063,058 | I am trying to send a `JSON` request with `AFNetworing` but following code giving me `JSON text did not start with array or object and option to allow fragments not set` error:
```
NSString *post = [[NSString alloc] initWithFormat:
@"{\"request\":\"login\",\"userName\":\"%@\",\"password\":\"%@\"}", u... | 2015/01/21 | [
"https://Stackoverflow.com/questions/28063058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/614065/"
] | As far as I know, the original message is indeed "lost" when you use the `splitter` pattern.
You can save it as a property on the exchange, and use it again later to replace the message body, with the updated positions list.
```
from("activemq:orders")
.setProperty("OriginalMessage", body())
.split(body().tok... | i write my own Processor. It is to difficult to solve this with Camel build-in methods.
Thank you for your help. |
28,063,058 | I am trying to send a `JSON` request with `AFNetworing` but following code giving me `JSON text did not start with array or object and option to allow fragments not set` error:
```
NSString *post = [[NSString alloc] initWithFormat:
@"{\"request\":\"login\",\"userName\":\"%@\",\"password\":\"%@\"}", u... | 2015/01/21 | [
"https://Stackoverflow.com/questions/28063058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/614065/"
] | Another option:
you can always get original body of the route with UnitOfWork interface
```
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
Message originalMessage = (Message)
exchange.getUnitOfWork().getOriginalInMessage();
(do s... | i write my own Processor. It is to difficult to solve this with Camel build-in methods.
Thank you for your help. |
72,633,494 | I have a metadata table and need to test inserting data:
```
public function test_insert_unique_data()
{
$response = Metadata::create([
'metable_id' => '1',
'metable_type' => File::class,
'type' => 'resolution',
'key' => 'width',
'value' => 1000,
]);
$response->asse... | 2022/06/15 | [
"https://Stackoverflow.com/questions/72633494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19343569/"
] | Why not just use a factory? They have all sorts of assertions in their [Database testing](https://laravel.com/docs/8.x/database-testing#available-assertions) section.
Unless there's a reason for it, every testing that uses any models I'm seeing in modern Laravel (I come from Laravel 3-5 days) is using factories. | I don't know about this `assertCreated` function but I know of something similar:
```php
public function test_insert_unique_data()
{
$metadata = Metadata::create([
'metable_id' => '1',
'metable_type' => File::class,
'type' => 'resolution',
'key' => 'width',
'value' => 1000,
... |
20,733,558 | ```
[TestMethod]
public void Can_Login_With_Valid_Credentials()
{
//Arrange
Mock<IMembershipRepository> mockRepository = new Mock<IMembershipRepository>();
Mock<LoginViewModel> mockModel = new Mock<LoginViewModel>();
mockModel.Setup(x => x.IsLoggedIn()).Returns(true);... | 2013/12/22 | [
"https://Stackoverflow.com/questions/20733558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2094494/"
] | If there is no way to avoid creating new instance of LoginViewModel in the action method, then introduce a factory which does that. Avoid at all costs direct creation of any concrete class - that makes unit testing impossible.
If action method creates an object using the factory, then concrete factory is passed as con... | Based on the comments above and research, the best way to do that would be by using an existing LoginViewModel instead of creating a new instance of it. Here is the re-factored vision of ActionResult that works with Moq.
```
public ActionResult Login(LoginViewModel viewModel)
{
string returnUrl = (string)T... |
8,353,550 | JQuery:
```
var Arr = new Array()
var Selected = null;
if ($('#chk').is(':checked')) {
var List = $('#sellist option:selected');
$.each(List, function(index, item) {
Arr.push($(this).val());
});
Selected = Arr.join(',');
}
... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8353550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/965146/"
] | This is easily a math problem. The distance between 2 points `(x1, y1)` and `(x2, y2)` can be calculated as follows:

Simple Pythagoras. Query your database, point one is the point you want to find, point two is the one you get from the database, if the result of the a... | Note that if you want to have an accurate radius calculation for good ol' earth latitudes/longitudes, you'd have to use more complicated functions than the simple pythagorean distance mentioned in the accepted answer; look for "great circle distance", as e.g. posted [in another thread](https://stackoverflow.com/questio... |
13,691,099 | I have a problem with my code in localhost, i use wampserver.
I did not find the error and the solution.
The error is as follows:
>
> Notice: Undefined offset: 0 in C:\wamp\www\Test.php on line 74
>
>
>
```
$html = curl_exec($ch);
[...]
preg_match_all("(<title>(.*)<\/title>)siU", $html, $title);
$metas = get_me... | 2012/12/03 | [
"https://Stackoverflow.com/questions/13691099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1869076/"
] | If you are using C arrays:
```
struct A { int v; }
A data[10];
void func(A *array, size_t n) {
}
func(data, 10);
```
Or if you are using a vector:
```
std::vector<A> vec;
void func(std::vector<A>& array) {
}
func(vec);
``` | Since you are tagging this as "C++", I assume you are using vectors ( :-) )
```
void f1 ( yourVector& yourVector )
{
// do something with the vector as read-write (for example fill the vector with somthing).
}
void f2 ( const yourVector& yourVector )
{
// do something with the vector as read-only.
}
int main()
{... |
22,911,619 | 
At first the MainActivity.java didn't have an error.
I have configed id for button, text fields. And they are added in com.mikeyaworski.basiccalculations
but i don't know what I have done that the project has two R.java in gen package.
one is in package android.su... | 2014/04/07 | [
"https://Stackoverflow.com/questions/22911619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3506550/"
] | Couple of issues in your code.
* After each time the program encounters a non-numeric character it doesn't read further from the input. It reads the same character. Hence `c=getchar()` should be outside the `if` block
* The multiplication happens for the `char` variable `c`. It should be converted to the actual number... | Use `i=(c-48)*i;` instead of `i = c*i`. So, the changed program would be:
```
#include <stdio.h>
main(){
int c,i;
c = getchar();
i = 1;
while (c!= '$'){
// printf("%c\n", c);
if (c>=48 && c<=57){
i=(c-48)*i;
}
c=getchar();
}
printf("%d",i);
}
```
This will ensure that you are ... |
22,911,619 | 
At first the MainActivity.java didn't have an error.
I have configed id for button, text fields. And they are added in com.mikeyaworski.basiccalculations
but i don't know what I have done that the project has two R.java in gen package.
one is in package android.su... | 2014/04/07 | [
"https://Stackoverflow.com/questions/22911619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3506550/"
] | Couple of issues in your code.
* After each time the program encounters a non-numeric character it doesn't read further from the input. It reads the same character. Hence `c=getchar()` should be outside the `if` block
* The multiplication happens for the `char` variable `c`. It should be converted to the actual number... | ```
int i,c;
i = 1;
while (i){
c=getchar();
if(c == '\n')
{
break;
}
if (c < 48 || c > 57)
{
i = -1;
break;
}
i = i * (c-48);
}
if (i == -1)
{
printf("Error. Non-Number Entered\n\n");
}
else {
printf("%d\n\n",i);
}
``` |
4,904,067 | Hi I'm working on a small bash script that will scan lan every 5 minutes and get live host and then get theirs MAC addresses.
So far I have this:
```
nmap -sP -n -oG - 10.0.0.1-20 | grep "Up" | awk '{print $2}'
```
Which gives me ip addresses. Now I have to do something like
```
arp -an | grep 'ip'
```
but I'm n... | 2011/02/04 | [
"https://Stackoverflow.com/questions/4904067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/525277/"
] | Here is a script that does exactly what you want:
```
#!/bin/bash
HOSTS=$(nmap -sP -n -oG - 192.168.1.1-10 | grep "Up" | awk '{print $2}')
for host in ${HOSTS}; do
arp -an | grep ${host} | awk '{print $2 $4}'
done
``` | Try using `arp-scan`, e.g:
```
sudo arp-scan --interface=wlan0 192.168.1.0/24
``` |
4,904,067 | Hi I'm working on a small bash script that will scan lan every 5 minutes and get live host and then get theirs MAC addresses.
So far I have this:
```
nmap -sP -n -oG - 10.0.0.1-20 | grep "Up" | awk '{print $2}'
```
Which gives me ip addresses. Now I have to do something like
```
arp -an | grep 'ip'
```
but I'm n... | 2011/02/04 | [
"https://Stackoverflow.com/questions/4904067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/525277/"
] | Try using `arp-scan`, e.g:
```
sudo arp-scan --interface=wlan0 192.168.1.0/24
``` | For the second part of the query You could use arping :
```
for host in $(nmap -sP -n -oG - 192.168.83.1-35 | grep "Up" | awk '{print $2}');
do arping $host -c 1;
done
``` |
4,904,067 | Hi I'm working on a small bash script that will scan lan every 5 minutes and get live host and then get theirs MAC addresses.
So far I have this:
```
nmap -sP -n -oG - 10.0.0.1-20 | grep "Up" | awk '{print $2}'
```
Which gives me ip addresses. Now I have to do something like
```
arp -an | grep 'ip'
```
but I'm n... | 2011/02/04 | [
"https://Stackoverflow.com/questions/4904067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/525277/"
] | Try using `arp-scan`, e.g:
```
sudo arp-scan --interface=wlan0 192.168.1.0/24
``` | This one outputs all records in a greppable format:
```
nmap -n -sP 10.0.3.0/24 | awk '/Nmap scan report/{printf $5;printf " ";getline;getline;print $3;}'
```
It seems to work also for IP's/MAC's which are not already in the hosts ARP table. That's a good thing. On my system the script from the accepted answer only... |
4,904,067 | Hi I'm working on a small bash script that will scan lan every 5 minutes and get live host and then get theirs MAC addresses.
So far I have this:
```
nmap -sP -n -oG - 10.0.0.1-20 | grep "Up" | awk '{print $2}'
```
Which gives me ip addresses. Now I have to do something like
```
arp -an | grep 'ip'
```
but I'm n... | 2011/02/04 | [
"https://Stackoverflow.com/questions/4904067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/525277/"
] | Here is a script that does exactly what you want:
```
#!/bin/bash
HOSTS=$(nmap -sP -n -oG - 192.168.1.1-10 | grep "Up" | awk '{print $2}')
for host in ${HOSTS}; do
arp -an | grep ${host} | awk '{print $2 $4}'
done
``` | For the second part of the query You could use arping :
```
for host in $(nmap -sP -n -oG - 192.168.83.1-35 | grep "Up" | awk '{print $2}');
do arping $host -c 1;
done
``` |
4,904,067 | Hi I'm working on a small bash script that will scan lan every 5 minutes and get live host and then get theirs MAC addresses.
So far I have this:
```
nmap -sP -n -oG - 10.0.0.1-20 | grep "Up" | awk '{print $2}'
```
Which gives me ip addresses. Now I have to do something like
```
arp -an | grep 'ip'
```
but I'm n... | 2011/02/04 | [
"https://Stackoverflow.com/questions/4904067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/525277/"
] | Here is a script that does exactly what you want:
```
#!/bin/bash
HOSTS=$(nmap -sP -n -oG - 192.168.1.1-10 | grep "Up" | awk '{print $2}')
for host in ${HOSTS}; do
arp -an | grep ${host} | awk '{print $2 $4}'
done
``` | This one outputs all records in a greppable format:
```
nmap -n -sP 10.0.3.0/24 | awk '/Nmap scan report/{printf $5;printf " ";getline;getline;print $3;}'
```
It seems to work also for IP's/MAC's which are not already in the hosts ARP table. That's a good thing. On my system the script from the accepted answer only... |
48,123,376 | I want to remove an element (an array) from an array (an array of arrays).
```
car = [carId, brand, year]; //array
selectedCars = []; //array of arrays
```
This is what i have tried, but the comparison never gets true, although it should.
```
function removeElementFromArray(carsArray, car){
var i;
for(var k... | 2018/01/06 | [
"https://Stackoverflow.com/questions/48123376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5169717/"
] | `carsArray.indexOf(i)` will never find anything. `carsArray` is an array of arrays, `i` is the index where a match was found, not an array.
You don't need to call `indexOf()`, the `for` loop already found the index you want. You just need to test whether it found anything.
```
if (index !== undefined) {
carsArray... | You can try using the array `.every` method for your comparison, along with `.findIndex` if you can use es6:
```js
car = ["carId", "brand", "year"]; //array
selectedCars = [["carId", "brand", "year"], ["otherCarId", "brand", "year"]]; //array of arrays
function removeCar(selected, car) {
const index = selected... |
8,144,890 | There seems to be two accepted variable declaration placements for Java variables, each with different *raison d'être*.
From the [Sun's code conventions](http://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html) we can see:
>
> Put declarations only at the beginning of blocks. (A block is any
> code surroun... | 2011/11/15 | [
"https://Stackoverflow.com/questions/8144890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1045902/"
] | >
> That is basically waiting to declare variables until their first use.
>
>
>
This is actually not true, and these two styes are not conflicting. Limiting the scope of the variable means that that variable, in fact, does not exist outside of that scope. E.g.
```
for(int i=0; i<10;i++){
int a = 5;
doSometh... | My personal opinion is that either way is fine. I think as long as the variable names are descriptive enough, it doesn't really matter. Again, this is only my opinion. I've had to go through lots of code which wasn't written by me, and the biggest frustration with variables I've faced, is that their names are not very ... |
8,144,890 | There seems to be two accepted variable declaration placements for Java variables, each with different *raison d'être*.
From the [Sun's code conventions](http://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html) we can see:
>
> Put declarations only at the beginning of blocks. (A block is any
> code surroun... | 2011/11/15 | [
"https://Stackoverflow.com/questions/8144890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1045902/"
] | Variables *should* be declared as close to their use as possible, for two reasons:
* Vertical locality
* Tool hinting
**Vertical locality** makes it easier to reason about chunks of code. The less scanning a reader has to do the easier it is to understand what code does, and what side-effects it
Reducing variable ... | My personal opinion is that either way is fine. I think as long as the variable names are descriptive enough, it doesn't really matter. Again, this is only my opinion. I've had to go through lots of code which wasn't written by me, and the biggest frustration with variables I've faced, is that their names are not very ... |
8,144,890 | There seems to be two accepted variable declaration placements for Java variables, each with different *raison d'être*.
From the [Sun's code conventions](http://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html) we can see:
>
> Put declarations only at the beginning of blocks. (A block is any
> code surroun... | 2011/11/15 | [
"https://Stackoverflow.com/questions/8144890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1045902/"
] | >
> That is basically waiting to declare variables until their first use.
>
>
>
This is actually not true, and these two styes are not conflicting. Limiting the scope of the variable means that that variable, in fact, does not exist outside of that scope. E.g.
```
for(int i=0; i<10;i++){
int a = 5;
doSometh... | Those two statements do not need to be contradictory. Scope is decided by the curly brackets, so if you start a new set of brackets closer to where you use them, that is consistent with the Sun coding convention. Of course if you are just arbitrarily inserting scope limitations, that is a problem for reading the flow o... |
8,144,890 | There seems to be two accepted variable declaration placements for Java variables, each with different *raison d'être*.
From the [Sun's code conventions](http://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html) we can see:
>
> Put declarations only at the beginning of blocks. (A block is any
> code surroun... | 2011/11/15 | [
"https://Stackoverflow.com/questions/8144890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1045902/"
] | Variables *should* be declared as close to their use as possible, for two reasons:
* Vertical locality
* Tool hinting
**Vertical locality** makes it easier to reason about chunks of code. The less scanning a reader has to do the easier it is to understand what code does, and what side-effects it
Reducing variable ... | Those two statements do not need to be contradictory. Scope is decided by the curly brackets, so if you start a new set of brackets closer to where you use them, that is consistent with the Sun coding convention. Of course if you are just arbitrarily inserting scope limitations, that is a problem for reading the flow o... |
8,144,890 | There seems to be two accepted variable declaration placements for Java variables, each with different *raison d'être*.
From the [Sun's code conventions](http://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html) we can see:
>
> Put declarations only at the beginning of blocks. (A block is any
> code surroun... | 2011/11/15 | [
"https://Stackoverflow.com/questions/8144890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1045902/"
] | >
> That is basically waiting to declare variables until their first use.
>
>
>
This is actually not true, and these two styes are not conflicting. Limiting the scope of the variable means that that variable, in fact, does not exist outside of that scope. E.g.
```
for(int i=0; i<10;i++){
int a = 5;
doSometh... | I also recommend "Effective Java" by Joshua Bloch for more reasons why one should declare variables where they are first used. |
8,144,890 | There seems to be two accepted variable declaration placements for Java variables, each with different *raison d'être*.
From the [Sun's code conventions](http://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html) we can see:
>
> Put declarations only at the beginning of blocks. (A block is any
> code surroun... | 2011/11/15 | [
"https://Stackoverflow.com/questions/8144890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1045902/"
] | Variables *should* be declared as close to their use as possible, for two reasons:
* Vertical locality
* Tool hinting
**Vertical locality** makes it easier to reason about chunks of code. The less scanning a reader has to do the easier it is to understand what code does, and what side-effects it
Reducing variable ... | >
> That is basically waiting to declare variables until their first use.
>
>
>
This is actually not true, and these two styes are not conflicting. Limiting the scope of the variable means that that variable, in fact, does not exist outside of that scope. E.g.
```
for(int i=0; i<10;i++){
int a = 5;
doSometh... |
8,144,890 | There seems to be two accepted variable declaration placements for Java variables, each with different *raison d'être*.
From the [Sun's code conventions](http://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html) we can see:
>
> Put declarations only at the beginning of blocks. (A block is any
> code surroun... | 2011/11/15 | [
"https://Stackoverflow.com/questions/8144890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1045902/"
] | Variables *should* be declared as close to their use as possible, for two reasons:
* Vertical locality
* Tool hinting
**Vertical locality** makes it easier to reason about chunks of code. The less scanning a reader has to do the easier it is to understand what code does, and what side-effects it
Reducing variable ... | I also recommend "Effective Java" by Joshua Bloch for more reasons why one should declare variables where they are first used. |
1,581,818 | My laptop is connected to 2 external monitors (which makes 3 monitors with laptop inbuilt monitor). Windows 10 only offers "second screen only" but no "third screen only" option. Which means that to use one of the 2 external monitors, I need to unplug the other.
I know the monitors are well detected because I can (onl... | 2020/08/30 | [
"https://superuser.com/questions/1581818",
"https://superuser.com",
"https://superuser.com/users/235752/"
] | Following these steps seems to work
[](https://i.stack.imgur.com/OyXAF.png)
I discovered I could even add some hotkey to switch (and shut down) the monitors. [](https://i.stack.imgur... | In case you may be working with windows 11 now you can do the following:
1- Make sure you are in 2nd display-only mode, then go to display settings (by right-clicking on the home screen or just by pulling up settings).
2- Click the monitor that is labeled as 2.
3- In the section at the top that allows for display ad... |
48,993,697 | I am trying to show a confirm AlertDialog before user press on back button or Activity going Pause.
I tried this code:
```
@Override
public void onBackPressed() {
super.onBackPressed();
AlertDialog.Builder confirmBuilder=new AlertDialog.Builder(DoExam.this);
confirmBuilder.setTitle("Confirm Exit");
... | 2018/02/26 | [
"https://Stackoverflow.com/questions/48993697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6932790/"
] | Because you are calling `super.onBackPressed();` remove that and see what happens. the `super.onBackPressed();` is meant to trigger the default action of closing the activity. you need to defer that call when the user dismisses the dialog. | use this code
```
@Override
public void onBackPressed() {
AlertDialog.Builder confirmBuilder=new AlertDialog.Builder(DoExam.this);
confirmBuilder.setTitle("Confirm Exit");
confirmBuilder.setMessage("are you sure to exit form this activity");
confirmBuilder.setPositiveButton("Yes", new DialogInterface.OnClickListener(... |
48,993,697 | I am trying to show a confirm AlertDialog before user press on back button or Activity going Pause.
I tried this code:
```
@Override
public void onBackPressed() {
super.onBackPressed();
AlertDialog.Builder confirmBuilder=new AlertDialog.Builder(DoExam.this);
confirmBuilder.setTitle("Confirm Exit");
... | 2018/02/26 | [
"https://Stackoverflow.com/questions/48993697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6932790/"
] | Because you are calling `super.onBackPressed();` remove that and see what happens. the `super.onBackPressed();` is meant to trigger the default action of closing the activity. you need to defer that call when the user dismisses the dialog. | >
> Remove `super.onBackPressed();` and add it in `onClick(...)` of your posetive **Yes** button of your Alertdialog..
>
>
>
like this
```
confirmBuilder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { super.onBackPressed... |
84,925 | I have a created one Field on contact which is having checkbox data type name as "In use".
I have a requirement like
1.One Contact can only be active at one place at a time. So we want to restrict the "In Use" field from being active if it is currently active on another Contact for the same account. | 2015/07/27 | [
"https://salesforce.stackexchange.com/questions/84925",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/21496/"
] | I hope this would be helpful...
```
trigger validate on Contact(before insert){
set<id> rids = new set<id>();
set<id> Uids = new set<id>();
for(contact c : trigger.new){
rids.add(c.AccountId);
}
list<contact> conts = [select accountid from contact where accou... | Here is an option to fill the requirement without using code:
1. Create a unique field in contact.
2. Create a workflow on creation/update of contact when the in use check box is checked that fills the unique field created in section 1 with the account id.
3. Create a workflow on creation/update of contact whe... |
84,925 | I have a created one Field on contact which is having checkbox data type name as "In use".
I have a requirement like
1.One Contact can only be active at one place at a time. So we want to restrict the "In Use" field from being active if it is currently active on another Contact for the same account. | 2015/07/27 | [
"https://salesforce.stackexchange.com/questions/84925",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/21496/"
] | Can you try below trigger
```
trigger validate on Contact(before insert){
SET<String> ids = new SET<String>();
for(contact c : trigger.new){
ids.add(c.AccountId);
}
List<AggregateResult> tempAggr = [SELECT AccountId acc FROM Contact WHERE inUse__c= true AND Accontid IN : ids G... | Here is an option to fill the requirement without using code:
1. Create a unique field in contact.
2. Create a workflow on creation/update of contact when the in use check box is checked that fills the unique field created in section 1 with the account id.
3. Create a workflow on creation/update of contact whe... |
84,925 | I have a created one Field on contact which is having checkbox data type name as "In use".
I have a requirement like
1.One Contact can only be active at one place at a time. So we want to restrict the "In Use" field from being active if it is currently active on another Contact for the same account. | 2015/07/27 | [
"https://salesforce.stackexchange.com/questions/84925",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/21496/"
] | Can you try below trigger
```
trigger validate on Contact(before insert){
SET<String> ids = new SET<String>();
for(contact c : trigger.new){
ids.add(c.AccountId);
}
List<AggregateResult> tempAggr = [SELECT AccountId acc FROM Contact WHERE inUse__c= true AND Accontid IN : ids G... | I hope this would be helpful...
```
trigger validate on Contact(before insert){
set<id> rids = new set<id>();
set<id> Uids = new set<id>();
for(contact c : trigger.new){
rids.add(c.AccountId);
}
list<contact> conts = [select accountid from contact where accou... |
5,304,626 | I'm trying to determine if there is a Yahoo API that I can use to create authentication based on membership in a Yahoo Group for a non-Yahoo website writte in ASP.NET. Basically, if a person is a member of a particular group, then they would be able to Login to this website.
Our club has an existing Yahoo site, but we... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5304626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22407/"
] | You can check this PHP code for an example: <http://drupal.org/project/yahoo_bbauth>
And this example:
<http://upcoming.yahoo.com/services/api/group.getMyGroups.php> | I'm not experienced with it, but there is a webservice interface you can query with Yahoo's own query language YQL (<http://developer.yahoo.com/yql/>).
Maybe you could verify the login data against the table `yahoo.identity`. |
5,304,626 | I'm trying to determine if there is a Yahoo API that I can use to create authentication based on membership in a Yahoo Group for a non-Yahoo website writte in ASP.NET. Basically, if a person is a member of a particular group, then they would be able to Login to this website.
Our club has an existing Yahoo site, but we... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5304626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22407/"
] | You can check this PHP code for an example: <http://drupal.org/project/yahoo_bbauth>
And this example:
<http://upcoming.yahoo.com/services/api/group.getMyGroups.php> | [open source - does a Yahoogroups api exist? - Stack Overflow](https://stackoverflow.com/questions/1624147/does-a-yahoogroups-api-exist)
Based on this post from Oct 2009 there is no Yahoo! Groups API yet and if there will be one it'll be listed on the YUI developer page
This index page of YDN Documentation [Yahoo! D... |
173,853 | I have heard the phrase "feeding the dragon" used to describe pouring time, resources, and energy into a situation that is self-perpetuating, caught in a positive feedback loop with negative consequences, or is growing out of control because of actions being taken. I think "giving a mouse a cookie" has similar meaning ... | 2014/05/29 | [
"https://english.stackexchange.com/questions/173853",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/75188/"
] | The phrase appears to be a straightforward metaphor, as Dispensador observes. One early instance where the dragon really is a dragon occurs in Karl Stieler, Hans Wachenhusen, and Friedrich Hacklander, [*The Rhine From Its Source to the Sea*](http://books.google.com/books?id=dk0MAQAAMAAJ&pg=PA315&dq=%22feeding+the+drago... | IT seems to "feed the dragon" is a metaphor for supplying more fuel to that which does not serve us. And yet, a dragon is not a beast, nor is it a negative, it's a myth, a metaphor.
Dragon's have power, if the dragon is within the psyche it needs food to thrive to be powerful and must be fed.
We fear the dragon, and... |
173,853 | I have heard the phrase "feeding the dragon" used to describe pouring time, resources, and energy into a situation that is self-perpetuating, caught in a positive feedback loop with negative consequences, or is growing out of control because of actions being taken. I think "giving a mouse a cookie" has similar meaning ... | 2014/05/29 | [
"https://english.stackexchange.com/questions/173853",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/75188/"
] | I would interpret the phrase as a derivation of ***to feed the beast***. The earliest Google Books results for this phrase refer to the literal feeding of animals, but by 1900 we have uses such as
>
> They perfectly understand the utility of “[feeding the beast](http://books.google.com/books?id=oJhyAAAAMAAJ&pg=PA245... | The etymology seems to be related to morality:
**Dragonism** is defined as "unremitting watchfulness" and there is a historical reference in clergyman Joshua Lacy Wilson's **Episcopal Methodism; or Dragonism Exhibited** (1811)
Wilson, a Presbyterian clergyman, and professor of "moral philosophy
and logic" campaigned... |
173,853 | I have heard the phrase "feeding the dragon" used to describe pouring time, resources, and energy into a situation that is self-perpetuating, caught in a positive feedback loop with negative consequences, or is growing out of control because of actions being taken. I think "giving a mouse a cookie" has similar meaning ... | 2014/05/29 | [
"https://english.stackexchange.com/questions/173853",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/75188/"
] | I always thought that "feeding the dragon" came from the opium dens of Victorian England, where addicts would pour more and more time and money into their habit only to reinforce their addiction.
As mentioned in several other answers, "the dragon" part of the phrase came from the Chinese connection, although whether a... | IT seems to "feed the dragon" is a metaphor for supplying more fuel to that which does not serve us. And yet, a dragon is not a beast, nor is it a negative, it's a myth, a metaphor.
Dragon's have power, if the dragon is within the psyche it needs food to thrive to be powerful and must be fed.
We fear the dragon, and... |
173,853 | I have heard the phrase "feeding the dragon" used to describe pouring time, resources, and energy into a situation that is self-perpetuating, caught in a positive feedback loop with negative consequences, or is growing out of control because of actions being taken. I think "giving a mouse a cookie" has similar meaning ... | 2014/05/29 | [
"https://english.stackexchange.com/questions/173853",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/75188/"
] | The phrase appears to be a straightforward metaphor, as Dispensador observes. One early instance where the dragon really is a dragon occurs in Karl Stieler, Hans Wachenhusen, and Friedrich Hacklander, [*The Rhine From Its Source to the Sea*](http://books.google.com/books?id=dk0MAQAAMAAJ&pg=PA315&dq=%22feeding+the+drago... | I always thought that "feeding the dragon" came from the opium dens of Victorian England, where addicts would pour more and more time and money into their habit only to reinforce their addiction.
As mentioned in several other answers, "the dragon" part of the phrase came from the Chinese connection, although whether a... |
173,853 | I have heard the phrase "feeding the dragon" used to describe pouring time, resources, and energy into a situation that is self-perpetuating, caught in a positive feedback loop with negative consequences, or is growing out of control because of actions being taken. I think "giving a mouse a cookie" has similar meaning ... | 2014/05/29 | [
"https://english.stackexchange.com/questions/173853",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/75188/"
] | I would interpret the phrase as a derivation of ***to feed the beast***. The earliest Google Books results for this phrase refer to the literal feeding of animals, but by 1900 we have uses such as
>
> They perfectly understand the utility of “[feeding the beast](http://books.google.com/books?id=oJhyAAAAMAAJ&pg=PA245... | As a attorney who represents people charged with [drug crimes](http://www.idefendva.com/fairfax-drug-lawyer) I know that "feeding the dragon" is actually not the correct phrase. The correct phraseology is "chasing the dragon." I always tell my clients that the secret to chasing the dragon is to make sure that they neve... |
173,853 | I have heard the phrase "feeding the dragon" used to describe pouring time, resources, and energy into a situation that is self-perpetuating, caught in a positive feedback loop with negative consequences, or is growing out of control because of actions being taken. I think "giving a mouse a cookie" has similar meaning ... | 2014/05/29 | [
"https://english.stackexchange.com/questions/173853",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/75188/"
] | In regards to Chinese economics, the meanings behind *feeding the dragon* and *chasing the dragon* refer to China as a dragon, its mythological mascot of sorts. When referring to China as a dragon, I feel it appropriate to capitalize the D.
*Feeding the Dragon* would be aiding China's economy by giving it business and ... | I always thought that "feeding the dragon" came from the opium dens of Victorian England, where addicts would pour more and more time and money into their habit only to reinforce their addiction.
As mentioned in several other answers, "the dragon" part of the phrase came from the Chinese connection, although whether a... |
173,853 | I have heard the phrase "feeding the dragon" used to describe pouring time, resources, and energy into a situation that is self-perpetuating, caught in a positive feedback loop with negative consequences, or is growing out of control because of actions being taken. I think "giving a mouse a cookie" has similar meaning ... | 2014/05/29 | [
"https://english.stackexchange.com/questions/173853",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/75188/"
] | The etymology seems to be related to morality:
**Dragonism** is defined as "unremitting watchfulness" and there is a historical reference in clergyman Joshua Lacy Wilson's **Episcopal Methodism; or Dragonism Exhibited** (1811)
Wilson, a Presbyterian clergyman, and professor of "moral philosophy
and logic" campaigned... | IT seems to "feed the dragon" is a metaphor for supplying more fuel to that which does not serve us. And yet, a dragon is not a beast, nor is it a negative, it's a myth, a metaphor.
Dragon's have power, if the dragon is within the psyche it needs food to thrive to be powerful and must be fed.
We fear the dragon, and... |
173,853 | I have heard the phrase "feeding the dragon" used to describe pouring time, resources, and energy into a situation that is self-perpetuating, caught in a positive feedback loop with negative consequences, or is growing out of control because of actions being taken. I think "giving a mouse a cookie" has similar meaning ... | 2014/05/29 | [
"https://english.stackexchange.com/questions/173853",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/75188/"
] | The phrase appears to be a straightforward metaphor, as Dispensador observes. One early instance where the dragon really is a dragon occurs in Karl Stieler, Hans Wachenhusen, and Friedrich Hacklander, [*The Rhine From Its Source to the Sea*](http://books.google.com/books?id=dk0MAQAAMAAJ&pg=PA315&dq=%22feeding+the+drago... | As a attorney who represents people charged with [drug crimes](http://www.idefendva.com/fairfax-drug-lawyer) I know that "feeding the dragon" is actually not the correct phrase. The correct phraseology is "chasing the dragon." I always tell my clients that the secret to chasing the dragon is to make sure that they neve... |
173,853 | I have heard the phrase "feeding the dragon" used to describe pouring time, resources, and energy into a situation that is self-perpetuating, caught in a positive feedback loop with negative consequences, or is growing out of control because of actions being taken. I think "giving a mouse a cookie" has similar meaning ... | 2014/05/29 | [
"https://english.stackexchange.com/questions/173853",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/75188/"
] | I would interpret the phrase as a derivation of ***to feed the beast***. The earliest Google Books results for this phrase refer to the literal feeding of animals, but by 1900 we have uses such as
>
> They perfectly understand the utility of “[feeding the beast](http://books.google.com/books?id=oJhyAAAAMAAJ&pg=PA245... | I always thought that "feeding the dragon" came from the opium dens of Victorian England, where addicts would pour more and more time and money into their habit only to reinforce their addiction.
As mentioned in several other answers, "the dragon" part of the phrase came from the Chinese connection, although whether a... |
173,853 | I have heard the phrase "feeding the dragon" used to describe pouring time, resources, and energy into a situation that is self-perpetuating, caught in a positive feedback loop with negative consequences, or is growing out of control because of actions being taken. I think "giving a mouse a cookie" has similar meaning ... | 2014/05/29 | [
"https://english.stackexchange.com/questions/173853",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/75188/"
] | The phrase appears to be a straightforward metaphor, as Dispensador observes. One early instance where the dragon really is a dragon occurs in Karl Stieler, Hans Wachenhusen, and Friedrich Hacklander, [*The Rhine From Its Source to the Sea*](http://books.google.com/books?id=dk0MAQAAMAAJ&pg=PA315&dq=%22feeding+the+drago... | The etymology seems to be related to morality:
**Dragonism** is defined as "unremitting watchfulness" and there is a historical reference in clergyman Joshua Lacy Wilson's **Episcopal Methodism; or Dragonism Exhibited** (1811)
Wilson, a Presbyterian clergyman, and professor of "moral philosophy
and logic" campaigned... |
37,495,059 | I am making a small game using Javascript in which there are two sides.In the left side there are 5 pics and in the right side there are 4 pics.When the user clicks on the missing picture on the left side then the game goes to the next level.I haven't written the full code yet.I have written the following code
```
<!-... | 2016/05/28 | [
"https://Stackoverflow.com/questions/37495059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5732836/"
] | Your problem was you weren't declaring your `div` variable. I presume you must have got some error. Just reference the `div` for which you want to change the `nodeValue` and everything seems good.. Below, I've referred it with `getElementsByTagName`, you can use any of other options if required.
```js
// Javascript
v... | I would suggest you to include an id attribute to that div since it is very likely you have other divs and that can give you trouble.
```
// html
<div id="myDivId">Hello World!</div>
// Javascript
var node = document.getElementById("myDivId");
node.textContent = "Hello Us";
```
if you are using jQuery, easier:
```... |
19,256,078 | [This](https://stackoverflow.com/questions/7288897/how-do-i-convert-byte-array-to-uint32-array) question only vise versa. For now I got this:
```
UInt32[] target;
byte[] decoded = new byte[target.Length * 2];
Buffer.BlockCopy(target, 0, decoded, 0, target.Length);
```
And this doesn't work, I get array filled with ... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19256078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521679/"
] | You can use [BitConverter.GetBytes](http://msdn.microsoft.com/en-us/library/1184xdy4.aspx) method for converting a `unit` to `byte` | You need to multiple by `4` to create your `byte` array, since `UInt32` is 4 bytes (32 bit). But use `BitConverter` and fill a list of `byte` and late you can create an array out of it if you need.
```
UInt32[] target = new UInt32[] { 1, 2, 3 };
byte[] decoded = new byte[target.Length * 4]; //not required now
List<by... |
19,256,078 | [This](https://stackoverflow.com/questions/7288897/how-do-i-convert-byte-array-to-uint32-array) question only vise versa. For now I got this:
```
UInt32[] target;
byte[] decoded = new byte[target.Length * 2];
Buffer.BlockCopy(target, 0, decoded, 0, target.Length);
```
And this doesn't work, I get array filled with ... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19256078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521679/"
] | You can use [BitConverter.GetBytes](http://msdn.microsoft.com/en-us/library/1184xdy4.aspx) method for converting a `unit` to `byte` | Your code has a few errors:
```
UInt32[] target = new uint[] { 1, 2, 3, 4 };
// Error 1:
// You had 2 instead of 4. Each UInt32 is actually 4 bytes.
byte[] decoded = new byte[target.Length * 4];
// Error 2:
Buffer.BlockCopy(
src: target,
srcOffset: 0,
dst: decoded,
dstOffset: 0,
count: decoded.Length /... |
19,256,078 | [This](https://stackoverflow.com/questions/7288897/how-do-i-convert-byte-array-to-uint32-array) question only vise versa. For now I got this:
```
UInt32[] target;
byte[] decoded = new byte[target.Length * 2];
Buffer.BlockCopy(target, 0, decoded, 0, target.Length);
```
And this doesn't work, I get array filled with ... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19256078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521679/"
] | I would recommend something like the following:
```
UInt32[] target;
//Assignments
byte[] decoded = new byte[target.Length * sizeof(uint)];
Buffer.BlockCopy(target, 0, decoded, 0, decoded.Length);
```
See code:
```
uint[] target = new uint[] { 1, 2, 3 };
//Assignments
byte[] decoded = new byte[target.Length * s... | You can use [BitConverter.GetBytes](http://msdn.microsoft.com/en-us/library/1184xdy4.aspx) method for converting a `unit` to `byte` |
19,256,078 | [This](https://stackoverflow.com/questions/7288897/how-do-i-convert-byte-array-to-uint32-array) question only vise versa. For now I got this:
```
UInt32[] target;
byte[] decoded = new byte[target.Length * 2];
Buffer.BlockCopy(target, 0, decoded, 0, target.Length);
```
And this doesn't work, I get array filled with ... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19256078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521679/"
] | Try this code. It works for me.
```
UInt32[] target = new UInt32[]{1,2,3};
byte[] decoded = new byte[target.Length * sizeof(UInt32)];
Buffer.BlockCopy(target, 0, decoded, 0, target.Length*sizeof(UInt32));
foreach(byte b in decoded)
{
Console.WriteLine( b);
}
``` | You need to multiple by `4` to create your `byte` array, since `UInt32` is 4 bytes (32 bit). But use `BitConverter` and fill a list of `byte` and late you can create an array out of it if you need.
```
UInt32[] target = new UInt32[] { 1, 2, 3 };
byte[] decoded = new byte[target.Length * 4]; //not required now
List<by... |
19,256,078 | [This](https://stackoverflow.com/questions/7288897/how-do-i-convert-byte-array-to-uint32-array) question only vise versa. For now I got this:
```
UInt32[] target;
byte[] decoded = new byte[target.Length * 2];
Buffer.BlockCopy(target, 0, decoded, 0, target.Length);
```
And this doesn't work, I get array filled with ... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19256078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521679/"
] | I would recommend something like the following:
```
UInt32[] target;
//Assignments
byte[] decoded = new byte[target.Length * sizeof(uint)];
Buffer.BlockCopy(target, 0, decoded, 0, decoded.Length);
```
See code:
```
uint[] target = new uint[] { 1, 2, 3 };
//Assignments
byte[] decoded = new byte[target.Length * s... | You need to multiple by `4` to create your `byte` array, since `UInt32` is 4 bytes (32 bit). But use `BitConverter` and fill a list of `byte` and late you can create an array out of it if you need.
```
UInt32[] target = new UInt32[] { 1, 2, 3 };
byte[] decoded = new byte[target.Length * 4]; //not required now
List<by... |
19,256,078 | [This](https://stackoverflow.com/questions/7288897/how-do-i-convert-byte-array-to-uint32-array) question only vise versa. For now I got this:
```
UInt32[] target;
byte[] decoded = new byte[target.Length * 2];
Buffer.BlockCopy(target, 0, decoded, 0, target.Length);
```
And this doesn't work, I get array filled with ... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19256078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521679/"
] | Try this code. It works for me.
```
UInt32[] target = new UInt32[]{1,2,3};
byte[] decoded = new byte[target.Length * sizeof(UInt32)];
Buffer.BlockCopy(target, 0, decoded, 0, target.Length*sizeof(UInt32));
foreach(byte b in decoded)
{
Console.WriteLine( b);
}
``` | Your code has a few errors:
```
UInt32[] target = new uint[] { 1, 2, 3, 4 };
// Error 1:
// You had 2 instead of 4. Each UInt32 is actually 4 bytes.
byte[] decoded = new byte[target.Length * 4];
// Error 2:
Buffer.BlockCopy(
src: target,
srcOffset: 0,
dst: decoded,
dstOffset: 0,
count: decoded.Length /... |
19,256,078 | [This](https://stackoverflow.com/questions/7288897/how-do-i-convert-byte-array-to-uint32-array) question only vise versa. For now I got this:
```
UInt32[] target;
byte[] decoded = new byte[target.Length * 2];
Buffer.BlockCopy(target, 0, decoded, 0, target.Length);
```
And this doesn't work, I get array filled with ... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19256078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521679/"
] | I would recommend something like the following:
```
UInt32[] target;
//Assignments
byte[] decoded = new byte[target.Length * sizeof(uint)];
Buffer.BlockCopy(target, 0, decoded, 0, decoded.Length);
```
See code:
```
uint[] target = new uint[] { 1, 2, 3 };
//Assignments
byte[] decoded = new byte[target.Length * s... | Your code has a few errors:
```
UInt32[] target = new uint[] { 1, 2, 3, 4 };
// Error 1:
// You had 2 instead of 4. Each UInt32 is actually 4 bytes.
byte[] decoded = new byte[target.Length * 4];
// Error 2:
Buffer.BlockCopy(
src: target,
srcOffset: 0,
dst: decoded,
dstOffset: 0,
count: decoded.Length /... |
19,256,078 | [This](https://stackoverflow.com/questions/7288897/how-do-i-convert-byte-array-to-uint32-array) question only vise versa. For now I got this:
```
UInt32[] target;
byte[] decoded = new byte[target.Length * 2];
Buffer.BlockCopy(target, 0, decoded, 0, target.Length);
```
And this doesn't work, I get array filled with ... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19256078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521679/"
] | I would recommend something like the following:
```
UInt32[] target;
//Assignments
byte[] decoded = new byte[target.Length * sizeof(uint)];
Buffer.BlockCopy(target, 0, decoded, 0, decoded.Length);
```
See code:
```
uint[] target = new uint[] { 1, 2, 3 };
//Assignments
byte[] decoded = new byte[target.Length * s... | Try this code. It works for me.
```
UInt32[] target = new UInt32[]{1,2,3};
byte[] decoded = new byte[target.Length * sizeof(UInt32)];
Buffer.BlockCopy(target, 0, decoded, 0, target.Length*sizeof(UInt32));
foreach(byte b in decoded)
{
Console.WriteLine( b);
}
``` |
2,261 | Home Depot/Lowes, etc., have boiled linseed oil at a much cheaper price than the local art store that I go to.
Are there any problem using boiled linseed oil from these home stores for oil painting applications, cleaning brushes etc? | 2016/09/28 | [
"https://crafts.stackexchange.com/questions/2261",
"https://crafts.stackexchange.com",
"https://crafts.stackexchange.com/users/1006/"
] | The thing about the art store options is that they're being tested by the manufacturers for their impact on the longevity of the painting or color impact to the pigments, so I would divide my response into a couple of parts...
Brush Cleaning? Sure, presuming that you're doing additional cleaning after. If you're looki... | Since you tagged this as oil-paint, I assume that is your intended use.
Actually, the BLO that is sold in art stores is the same stuff that is peddled in hardware stores, be they large or small.
So you can use the BLO from the gallon cans for anything that you might use the BLO purchased from anywhere else.
**Edit:... |
2,261 | Home Depot/Lowes, etc., have boiled linseed oil at a much cheaper price than the local art store that I go to.
Are there any problem using boiled linseed oil from these home stores for oil painting applications, cleaning brushes etc? | 2016/09/28 | [
"https://crafts.stackexchange.com/questions/2261",
"https://crafts.stackexchange.com",
"https://crafts.stackexchange.com/users/1006/"
] | Since you tagged this as oil-paint, I assume that is your intended use.
Actually, the BLO that is sold in art stores is the same stuff that is peddled in hardware stores, be they large or small.
So you can use the BLO from the gallon cans for anything that you might use the BLO purchased from anywhere else.
**Edit:... | My understanding is that the art store stuff is better filtered and cooked differently.
I read that the main risk is early yellowing-browning....that being said I have used it in the past and I have paintings done 15-20 years ago using very liberal oil amounts (painting in layers, glazes: a very small amount of pigmen... |
2,261 | Home Depot/Lowes, etc., have boiled linseed oil at a much cheaper price than the local art store that I go to.
Are there any problem using boiled linseed oil from these home stores for oil painting applications, cleaning brushes etc? | 2016/09/28 | [
"https://crafts.stackexchange.com/questions/2261",
"https://crafts.stackexchange.com",
"https://crafts.stackexchange.com/users/1006/"
] | Since you tagged this as oil-paint, I assume that is your intended use.
Actually, the BLO that is sold in art stores is the same stuff that is peddled in hardware stores, be they large or small.
So you can use the BLO from the gallon cans for anything that you might use the BLO purchased from anywhere else.
**Edit:... | To reduce the potential effects of yellowing/browning, I use hardware store BLO only with dark colors. I use only art store BLO for light colors. If you don't mind diluting colors with boiled linseed oil, go for it. It works great on the abstract stuff, usually the very large-sized works.
If you do indoor painting, us... |
2,261 | Home Depot/Lowes, etc., have boiled linseed oil at a much cheaper price than the local art store that I go to.
Are there any problem using boiled linseed oil from these home stores for oil painting applications, cleaning brushes etc? | 2016/09/28 | [
"https://crafts.stackexchange.com/questions/2261",
"https://crafts.stackexchange.com",
"https://crafts.stackexchange.com/users/1006/"
] | The thing about the art store options is that they're being tested by the manufacturers for their impact on the longevity of the painting or color impact to the pigments, so I would divide my response into a couple of parts...
Brush Cleaning? Sure, presuming that you're doing additional cleaning after. If you're looki... | My understanding is that the art store stuff is better filtered and cooked differently.
I read that the main risk is early yellowing-browning....that being said I have used it in the past and I have paintings done 15-20 years ago using very liberal oil amounts (painting in layers, glazes: a very small amount of pigmen... |
2,261 | Home Depot/Lowes, etc., have boiled linseed oil at a much cheaper price than the local art store that I go to.
Are there any problem using boiled linseed oil from these home stores for oil painting applications, cleaning brushes etc? | 2016/09/28 | [
"https://crafts.stackexchange.com/questions/2261",
"https://crafts.stackexchange.com",
"https://crafts.stackexchange.com/users/1006/"
] | The thing about the art store options is that they're being tested by the manufacturers for their impact on the longevity of the painting or color impact to the pigments, so I would divide my response into a couple of parts...
Brush Cleaning? Sure, presuming that you're doing additional cleaning after. If you're looki... | To reduce the potential effects of yellowing/browning, I use hardware store BLO only with dark colors. I use only art store BLO for light colors. If you don't mind diluting colors with boiled linseed oil, go for it. It works great on the abstract stuff, usually the very large-sized works.
If you do indoor painting, us... |
2,261 | Home Depot/Lowes, etc., have boiled linseed oil at a much cheaper price than the local art store that I go to.
Are there any problem using boiled linseed oil from these home stores for oil painting applications, cleaning brushes etc? | 2016/09/28 | [
"https://crafts.stackexchange.com/questions/2261",
"https://crafts.stackexchange.com",
"https://crafts.stackexchange.com/users/1006/"
] | My understanding is that the art store stuff is better filtered and cooked differently.
I read that the main risk is early yellowing-browning....that being said I have used it in the past and I have paintings done 15-20 years ago using very liberal oil amounts (painting in layers, glazes: a very small amount of pigmen... | To reduce the potential effects of yellowing/browning, I use hardware store BLO only with dark colors. I use only art store BLO for light colors. If you don't mind diluting colors with boiled linseed oil, go for it. It works great on the abstract stuff, usually the very large-sized works.
If you do indoor painting, us... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.