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 |
|---|---|---|---|---|---|
29,001,035 | I am trying to follow a piece of code to open and read a text file. To do this I have a package called readText. Within I build a class readLocalFile to open and read the file, and a main method to call it. Below are these two classes.
```
public class readFileLocal {
private String path;
public readFileLocal... | 2015/03/12 | [
"https://Stackoverflow.com/questions/29001035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4661057/"
] | Try changing the row item's parent size to "match\_parent".
```
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp"
android:background="#ffffff">
<com.jiyuzhai.setimagebitm... | Try removing "padding" property from linear layout (or setting it to 0dp) and setting scaleType to fitXY in SquareImageView. |
37,869,292 | I'm developing a 3D space game, which is using alot of math formulas, navigation, ease effects, rotations, huge distances between planets, objects mass, and so on...
My Question is what would be the best way in doing so using math. Should I calculate everything as integers and obtain really large integers(over 20 digi... | 2016/06/16 | [
"https://Stackoverflow.com/questions/37869292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2334004/"
] | I would avoid using decimals. They have known issues with precision: <http://floating-point-gui.de/>
---
I would recommend using integers, though if you need to work with very large integers I would suggest using a big number or big integer library such as one of these:
* <http://jsfromhell.com/classes/bignumber>
* ... | Use the JavaScript Number Object
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number>
>
> Number.MAX\_SAFE\_INTEGER
> The maximum safe integer in JavaScript (2^53 - 1).
>
>
> Number.MIN\_SAFE\_INTEGER
> The minimum safe integer in JavaScript (-(253 - 1)).
>
>
>
```js
var ... |
37,869,292 | I'm developing a 3D space game, which is using alot of math formulas, navigation, ease effects, rotations, huge distances between planets, objects mass, and so on...
My Question is what would be the best way in doing so using math. Should I calculate everything as integers and obtain really large integers(over 20 digi... | 2016/06/16 | [
"https://Stackoverflow.com/questions/37869292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2334004/"
] | Use the JavaScript Number Object
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number>
>
> Number.MAX\_SAFE\_INTEGER
> The maximum safe integer in JavaScript (2^53 - 1).
>
>
> Number.MIN\_SAFE\_INTEGER
> The minimum safe integer in JavaScript (-(253 - 1)).
>
>
>
```js
var ... | The problem with [BigNumber](https://github.com/MikeMcl/bignumber.js/) is with
>
> Precision loss from using numeric literals with more than 15
> significant digits
>
>
>
My solution would be a combination of BigNumber and [web3.js](https://github.com/ethereum/wiki/wiki/JavaScript-API#web3towei*):
```
var web3... |
37,869,292 | I'm developing a 3D space game, which is using alot of math formulas, navigation, ease effects, rotations, huge distances between planets, objects mass, and so on...
My Question is what would be the best way in doing so using math. Should I calculate everything as integers and obtain really large integers(over 20 digi... | 2016/06/16 | [
"https://Stackoverflow.com/questions/37869292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2334004/"
] | I would avoid using decimals. They have known issues with precision: <http://floating-point-gui.de/>
---
I would recommend using integers, though if you need to work with very large integers I would suggest using a big number or big integer library such as one of these:
* <http://jsfromhell.com/classes/bignumber>
* ... | The distance from our Sun to Alpha Centauri is 4.153×1018 cm. You can represent this value well with the `Number` datatype which stores values up to 1.7977×10308 with about 17 significant figures.
However, what if you want to model a spaceship stationed at Alpha Centauri?
Due to the limited precision of `Number`, you... |
37,869,292 | I'm developing a 3D space game, which is using alot of math formulas, navigation, ease effects, rotations, huge distances between planets, objects mass, and so on...
My Question is what would be the best way in doing so using math. Should I calculate everything as integers and obtain really large integers(over 20 digi... | 2016/06/16 | [
"https://Stackoverflow.com/questions/37869292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2334004/"
] | I would avoid using decimals. They have known issues with precision: <http://floating-point-gui.de/>
---
I would recommend using integers, though if you need to work with very large integers I would suggest using a big number or big integer library such as one of these:
* <http://jsfromhell.com/classes/bignumber>
* ... | The problem with [BigNumber](https://github.com/MikeMcl/bignumber.js/) is with
>
> Precision loss from using numeric literals with more than 15
> significant digits
>
>
>
My solution would be a combination of BigNumber and [web3.js](https://github.com/ethereum/wiki/wiki/JavaScript-API#web3towei*):
```
var web3... |
37,869,292 | I'm developing a 3D space game, which is using alot of math formulas, navigation, ease effects, rotations, huge distances between planets, objects mass, and so on...
My Question is what would be the best way in doing so using math. Should I calculate everything as integers and obtain really large integers(over 20 digi... | 2016/06/16 | [
"https://Stackoverflow.com/questions/37869292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2334004/"
] | The distance from our Sun to Alpha Centauri is 4.153×1018 cm. You can represent this value well with the `Number` datatype which stores values up to 1.7977×10308 with about 17 significant figures.
However, what if you want to model a spaceship stationed at Alpha Centauri?
Due to the limited precision of `Number`, you... | The problem with [BigNumber](https://github.com/MikeMcl/bignumber.js/) is with
>
> Precision loss from using numeric literals with more than 15
> significant digits
>
>
>
My solution would be a combination of BigNumber and [web3.js](https://github.com/ethereum/wiki/wiki/JavaScript-API#web3towei*):
```
var web3... |
28,643,618 | I'm using **WebStorm** as the IDE.
Here's my folder structure and express.js insalled:

But my sample code is not aware of the **require** keyword:
```
var express = require('express');
var app = express();
app.listen(1337, function(){
console... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28643618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93468/"
] | In Webstorm, there are three places in your settings (`ctrl-alt-s`) where you can update settings for Node.js projects.
**Settings: Javascript Libraries**
First, in `Javascript | Libraries` you can specify that Node libraries should be loaded. Your set of libraries may look different than this, but it should be prett... | Make sure that you have a [`package.json`](https://docs.npmjs.com/files/package.json) file in the root of your website. |
28,643,618 | I'm using **WebStorm** as the IDE.
Here's my folder structure and express.js insalled:

But my sample code is not aware of the **require** keyword:
```
var express = require('express');
var app = express();
app.listen(1337, function(){
console... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28643618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93468/"
] | Under `Settings > Languages & Frameworks > Node.js and NPM` make sure to check `Index internal node modules`. After it's done indexing, it will recognize the require keyword.
 | Make sure that you have a [`package.json`](https://docs.npmjs.com/files/package.json) file in the root of your website. |
28,643,618 | I'm using **WebStorm** as the IDE.
Here's my folder structure and express.js insalled:

But my sample code is not aware of the **require** keyword:
```
var express = require('express');
var app = express();
app.listen(1337, function(){
console... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28643618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93468/"
] | Under Preferences > Languages & Frameworks > Node.js and NPM, make sure "Node.js Core library is enabled" is enabled.
[](https://i.stack.imgur.com/tNUKa.png) | Make sure that you have a [`package.json`](https://docs.npmjs.com/files/package.json) file in the root of your website. |
28,643,618 | I'm using **WebStorm** as the IDE.
Here's my folder structure and express.js insalled:

But my sample code is not aware of the **require** keyword:
```
var express = require('express');
var app = express();
app.listen(1337, function(){
console... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28643618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93468/"
] | ### Update
On the new Webstorm versions, just going above error and clicking in `More Actions...` (or `ALT`+`ENTER`) and selecting
**Enable Node.js coding assistance** will solve this.
[](https://i.stack.imgur.com/Dq2Dj.png)
---
To solve these prob... | Make sure that you have a [`package.json`](https://docs.npmjs.com/files/package.json) file in the root of your website. |
28,643,618 | I'm using **WebStorm** as the IDE.
Here's my folder structure and express.js insalled:

But my sample code is not aware of the **require** keyword:
```
var express = require('express');
var app = express();
app.listen(1337, function(){
console... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28643618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93468/"
] | In Webstorm, there are three places in your settings (`ctrl-alt-s`) where you can update settings for Node.js projects.
**Settings: Javascript Libraries**
First, in `Javascript | Libraries` you can specify that Node libraries should be loaded. Your set of libraries may look different than this, but it should be prett... | Under `Settings > Languages & Frameworks > Node.js and NPM` make sure to check `Index internal node modules`. After it's done indexing, it will recognize the require keyword.
 |
28,643,618 | I'm using **WebStorm** as the IDE.
Here's my folder structure and express.js insalled:

But my sample code is not aware of the **require** keyword:
```
var express = require('express');
var app = express();
app.listen(1337, function(){
console... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28643618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93468/"
] | In Webstorm, there are three places in your settings (`ctrl-alt-s`) where you can update settings for Node.js projects.
**Settings: Javascript Libraries**
First, in `Javascript | Libraries` you can specify that Node libraries should be loaded. Your set of libraries may look different than this, but it should be prett... | Under Preferences > Languages & Frameworks > Node.js and NPM, make sure "Node.js Core library is enabled" is enabled.
[](https://i.stack.imgur.com/tNUKa.png) |
28,643,618 | I'm using **WebStorm** as the IDE.
Here's my folder structure and express.js insalled:

But my sample code is not aware of the **require** keyword:
```
var express = require('express');
var app = express();
app.listen(1337, function(){
console... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28643618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93468/"
] | In Webstorm, there are three places in your settings (`ctrl-alt-s`) where you can update settings for Node.js projects.
**Settings: Javascript Libraries**
First, in `Javascript | Libraries` you can specify that Node libraries should be loaded. Your set of libraries may look different than this, but it should be prett... | ### Update
On the new Webstorm versions, just going above error and clicking in `More Actions...` (or `ALT`+`ENTER`) and selecting
**Enable Node.js coding assistance** will solve this.
[](https://i.stack.imgur.com/Dq2Dj.png)
---
To solve these prob... |
28,643,618 | I'm using **WebStorm** as the IDE.
Here's my folder structure and express.js insalled:

But my sample code is not aware of the **require** keyword:
```
var express = require('express');
var app = express();
app.listen(1337, function(){
console... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28643618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93468/"
] | Under Preferences > Languages & Frameworks > Node.js and NPM, make sure "Node.js Core library is enabled" is enabled.
[](https://i.stack.imgur.com/tNUKa.png) | Under `Settings > Languages & Frameworks > Node.js and NPM` make sure to check `Index internal node modules`. After it's done indexing, it will recognize the require keyword.
 |
28,643,618 | I'm using **WebStorm** as the IDE.
Here's my folder structure and express.js insalled:

But my sample code is not aware of the **require** keyword:
```
var express = require('express');
var app = express();
app.listen(1337, function(){
console... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28643618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93468/"
] | Under `Settings > Languages & Frameworks > Node.js and NPM` make sure to check `Index internal node modules`. After it's done indexing, it will recognize the require keyword.
 | ### Update
On the new Webstorm versions, just going above error and clicking in `More Actions...` (or `ALT`+`ENTER`) and selecting
**Enable Node.js coding assistance** will solve this.
[](https://i.stack.imgur.com/Dq2Dj.png)
---
To solve these prob... |
28,643,618 | I'm using **WebStorm** as the IDE.
Here's my folder structure and express.js insalled:

But my sample code is not aware of the **require** keyword:
```
var express = require('express');
var app = express();
app.listen(1337, function(){
console... | 2015/02/21 | [
"https://Stackoverflow.com/questions/28643618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93468/"
] | Under Preferences > Languages & Frameworks > Node.js and NPM, make sure "Node.js Core library is enabled" is enabled.
[](https://i.stack.imgur.com/tNUKa.png) | ### Update
On the new Webstorm versions, just going above error and clicking in `More Actions...` (or `ALT`+`ENTER`) and selecting
**Enable Node.js coding assistance** will solve this.
[](https://i.stack.imgur.com/Dq2Dj.png)
---
To solve these prob... |
4,973,467 | I've been mandated to find out what [IBM Cognos](http://www-01.ibm.com/software/data/cognos/?pgel=ibmhzn&cm_re=masthead-_-products-_-sw-cognos) does, and I cannot find useful information on the subject apart what I can read from the IBM Website and [Wikipedia](http://en.wikipedia.org/wiki/Cognos).
What I'm after is so... | 2011/02/11 | [
"https://Stackoverflow.com/questions/4973467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162167/"
] | Financial Performance Management I have no idea about but we use BI 8.4/10.1 quite a bit. The Cognos product line is actually quite large and we only really use the baseline BI stuff with Framework Manager but I'll try and help you out, based on how *we* use it.
Think of BI itself as an application that lets you view ... | A little late but in case anyone else comes here and is looking for information, I would like to enhance @paxdiablo's answer. He was talking only about Modeling and reporting tool which is the best known Cognos.
There is also a powerful tool named Metric Studio which can track in an easy way, how business is performi... |
4,973,467 | I've been mandated to find out what [IBM Cognos](http://www-01.ibm.com/software/data/cognos/?pgel=ibmhzn&cm_re=masthead-_-products-_-sw-cognos) does, and I cannot find useful information on the subject apart what I can read from the IBM Website and [Wikipedia](http://en.wikipedia.org/wiki/Cognos).
What I'm after is so... | 2011/02/11 | [
"https://Stackoverflow.com/questions/4973467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162167/"
] | Financial Performance Management I have no idea about but we use BI 8.4/10.1 quite a bit. The Cognos product line is actually quite large and we only really use the baseline BI stuff with Framework Manager but I'll try and help you out, based on how *we* use it.
Think of BI itself as an application that lets you view ... | A bit late, but for the benefit of anyone browsing ... Cognos BI is essentially web based reporting/ dashboarding/ analytics. Historically it connected to relational databases only; from v8.4 onwards (and moreso from v10) it also connects to OLAP cube data sources. It's designed for end user self service reporting and ... |
4,973,467 | I've been mandated to find out what [IBM Cognos](http://www-01.ibm.com/software/data/cognos/?pgel=ibmhzn&cm_re=masthead-_-products-_-sw-cognos) does, and I cannot find useful information on the subject apart what I can read from the IBM Website and [Wikipedia](http://en.wikipedia.org/wiki/Cognos).
What I'm after is so... | 2011/02/11 | [
"https://Stackoverflow.com/questions/4973467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162167/"
] | A bit late, but for the benefit of anyone browsing ... Cognos BI is essentially web based reporting/ dashboarding/ analytics. Historically it connected to relational databases only; from v8.4 onwards (and moreso from v10) it also connects to OLAP cube data sources. It's designed for end user self service reporting and ... | A little late but in case anyone else comes here and is looking for information, I would like to enhance @paxdiablo's answer. He was talking only about Modeling and reporting tool which is the best known Cognos.
There is also a powerful tool named Metric Studio which can track in an easy way, how business is performi... |
3,422,164 | I could not understand what this javascript line does.
```
chkBox.setAttribute("CheckList", range);
```
What is the "CheckList" attribute is used for? | 2010/08/06 | [
"https://Stackoverflow.com/questions/3422164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134263/"
] | Easiest way is to connect a DataSet as datasource and then save the dataset to xml and load the xml the next time.
```
DataSet ds = new DataSet();
//save the dataset as xml
ds.WriteXml("your path to save the xml");
//read the xml into your dataset
ds.ReadXml("your path to save the xml");
``` | You need to serialize your DataSource not DataGrid.
Create new DataTable, add columns, bound DataTable to DataGrid. Then use DataTable.WriteXml and DataTable.ReadXml to save and load xml. |
3,422,164 | I could not understand what this javascript line does.
```
chkBox.setAttribute("CheckList", range);
```
What is the "CheckList" attribute is used for? | 2010/08/06 | [
"https://Stackoverflow.com/questions/3422164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134263/"
] | Easiest way is to connect a DataSet as datasource and then save the dataset to xml and load the xml the next time.
```
DataSet ds = new DataSet();
//save the dataset as xml
ds.WriteXml("your path to save the xml");
//read the xml into your dataset
ds.ReadXml("your path to save the xml");
``` | the most easy way:
```
Private DataSet UserSettings(string pathofXML)
{
DataSet ds = new DataSet();
ds.ReadXml(pathofXML);
return ds;
}
private void BindGrid()
{
string pathOfXML = Application.StartupPath + @"\Settings.xml";
gridview.DataSource = UserSettings(pathOfXML);
}
``` |
12,418,872 | I am very new to C and I am hoping for some pointers. I am attempting to take an input of 7 integers of an array and search through them to see if any number appears only once. Here is what I have so far:
```
#define size 7
int main(void)
{
int array[size], target, i, prev, count;
//Initialize the array
printf("Please... | 2012/09/14 | [
"https://Stackoverflow.com/questions/12418872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220097/"
] | The simplest way to search for duplicates (though not the most efficient one) is to sort the array. You can use the built-in `qsort` function as such:
```
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
/* ... */
qsort (array, size, sizeof(int), compare);
int seen = 0;
for (int i ... | This can be done in O(n^2) algorithm:
```
int yes = 1, i, j;
for (i = 0; i < n; ++i)
{
for (j = i + 1; j < n; ++j) if (arr[i] == arr[j])
{
printf("Found a duplicate of %d\n", arr[i]);
yes = 0;
break;
}
if (!yes) break;
}
if (yes) printf("No duplicates");
``` |
12,418,872 | I am very new to C and I am hoping for some pointers. I am attempting to take an input of 7 integers of an array and search through them to see if any number appears only once. Here is what I have so far:
```
#define size 7
int main(void)
{
int array[size], target, i, prev, count;
//Initialize the array
printf("Please... | 2012/09/14 | [
"https://Stackoverflow.com/questions/12418872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220097/"
] | The simplest way to search for duplicates (though not the most efficient one) is to sort the array. You can use the built-in `qsort` function as such:
```
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
/* ... */
qsort (array, size, sizeof(int), compare);
int seen = 0;
for (int i ... | I know 3 methods to find duplicates, 2 are already answered, so here is the third (simplified)-
Complexity O(N) time, O(M) memory.
If the numbers are within some range like `0 - M` and `M` is comparable to `N` the number of elements, you can use a array of size `M+1` to check if the number has appeared before.
Code... |
12,418,872 | I am very new to C and I am hoping for some pointers. I am attempting to take an input of 7 integers of an array and search through them to see if any number appears only once. Here is what I have so far:
```
#define size 7
int main(void)
{
int array[size], target, i, prev, count;
//Initialize the array
printf("Please... | 2012/09/14 | [
"https://Stackoverflow.com/questions/12418872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220097/"
] | The simplest way to search for duplicates (though not the most efficient one) is to sort the array. You can use the built-in `qsort` function as such:
```
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
/* ... */
qsort (array, size, sizeof(int), compare);
int seen = 0;
for (int i ... | This one is a little pain in the neck to read, so I explain what I did a little bit here:
First, include the standard i/o library, #define array size to whatever you want, declare you array (I called mine: int entries[SIZE];).
The first for loop after "Enter 10 numbers" is the main one, that allows you to push the 10... |
62,209 | I encrypted my Time Machine backup (A Western Digital 2tb external drive) then realised that Airport wont mount the backup over wifi, so am currently decrypting the drive (via Disk Utility).
I found the command:
```
diskutil cs list
```
which shows me the progress of the operation (it took a while to register at th... | 2012/08/28 | [
"https://apple.stackexchange.com/questions/62209",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/6126/"
] | That’s just paranoia. Hibernate mode is perfectly healthy for an SSD. A SSD will last about 2-4 years of continuous writes. This means the time for which the SSD is powered. I have a 4 year old computer and its HD has been powered for 1.5 years (according to disk utility). Your SSD can definitely last a longer time. | Although this is an old question, I would like to update it with my answer because it is still relevant to me.
<http://blog.alutam.com/2012/04/01/optimizing-macos-x-lion-for-ssd/#hibernation>
```
sudo pmset -a hibernatemode 0
sudo rm /var/vm/sleepimage
```
>
> We do not recommend modifying hibernation settings. An... |
62,209 | I encrypted my Time Machine backup (A Western Digital 2tb external drive) then realised that Airport wont mount the backup over wifi, so am currently decrypting the drive (via Disk Utility).
I found the command:
```
diskutil cs list
```
which shows me the progress of the operation (it took a while to register at th... | 2012/08/28 | [
"https://apple.stackexchange.com/questions/62209",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/6126/"
] | That’s just paranoia. Hibernate mode is perfectly healthy for an SSD. A SSD will last about 2-4 years of continuous writes. This means the time for which the SSD is powered. I have a 4 year old computer and its HD has been powered for 1.5 years (according to disk utility). Your SSD can definitely last a longer time. | I actually prefer [SmartSleep](http://www.jinx.de/SmartSleep.html). Using this little app gives you the best of both worlds. When you sleep your Mac (close the lid), SmartSleep will decide based on your remaining battery capacity whether to write the hibernation image or not. This is useful, because if you ever find yo... |
62,209 | I encrypted my Time Machine backup (A Western Digital 2tb external drive) then realised that Airport wont mount the backup over wifi, so am currently decrypting the drive (via Disk Utility).
I found the command:
```
diskutil cs list
```
which shows me the progress of the operation (it took a while to register at th... | 2012/08/28 | [
"https://apple.stackexchange.com/questions/62209",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/6126/"
] | Although this is an old question, I would like to update it with my answer because it is still relevant to me.
<http://blog.alutam.com/2012/04/01/optimizing-macos-x-lion-for-ssd/#hibernation>
```
sudo pmset -a hibernatemode 0
sudo rm /var/vm/sleepimage
```
>
> We do not recommend modifying hibernation settings. An... | I actually prefer [SmartSleep](http://www.jinx.de/SmartSleep.html). Using this little app gives you the best of both worlds. When you sleep your Mac (close the lid), SmartSleep will decide based on your remaining battery capacity whether to write the hibernation image or not. This is useful, because if you ever find yo... |
12,714,749 | I want to select the first level `.box` of each one of these three `.box` siblings, but not their children `.box`(s). (Does this make sense?)
Here's my markup:
```
<div class="box">
<div class="box">
test
</div>
</div>
<div class="box">
<div class="box">
test2
</div>
</div>
<div cla... | 2012/10/03 | [
"https://Stackoverflow.com/questions/12714749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1195603/"
] | This is not possible unless you specifically refer to the parent of the outer boxes somehow. For example, if you know that all of this is going to be inside `#foo`, then `#foo > .box` will do the job.
However, you *can* select boxes which are in another box with `.box > .box` or `.box .box`, so in this manner it might... | The better way to select just the first ones is to use the `>` in your css selector so use it like this:
```
body>.box {
css here
}
``` |
20,975,879 | Is it safe to use this code ?
```
$check = mysql_query("SELECT id FROM table WHERE nick='asd'");
$count = mysql_num_rows($check);
```
I just need number of rows. id is AUTO\_INCREMENT | 2014/01/07 | [
"https://Stackoverflow.com/questions/20975879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3162532/"
] | If 'asd' is a constant and not related to any (user) input, then yes it is safe.
Otherwise you should replace it with bind a variable and use prepared statements or at least escape it properly. (But it is easy to forget escaping, so it is a better practice to try to use bind variables instead.) | NO. Absolutely not.
First of all, read up on [MySQLi](http://nl1.php.net/mysqli). The i stands for improved. Secondly, use prepared statements. This prevents injection. Read up on that [here](http://codular.com/php-mysqli).
```
$db = new mysqli("localhost", "DATABASE-NAME", "DATABASE-USER", "DATABASE-PASS");
$check =... |
26,332,181 | I have seen soo many questions and answers about this but cannot get answer suitable for me . I cannot create or start any device

` method. The trick is to do the rotation in `Node.SceneSpace`. This will ensure that the rotations compound correctly in any axis you choose in that the rotations will be applied on top of the latest orientation. I use a `MouseArea` to capture 2d movements in either X or Y. In 3d we interpret... |
74,157,344 | I have a Django model with a DateField, like so:
```
production_date = models.DateField(null=True, blank=True)
```
I am trying to have that field display as the default Python date format in templates, which looks like "2000-01-01". But in a Django template it displays as "Jan. 1, 2000."
In a Python shell, the date... | 2022/10/21 | [
"https://Stackoverflow.com/questions/74157344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1970300/"
] | I'd make a model method `get_production_date`.. So I'm not doing a crap ton of template tags, not a fan of them.. and then CTRL+Shift+F (only HTML files) find `production_date` and change them to `get_production_date`
### models.py
```py
class MyModel(models.Model):
production_date = models.DateField('Creation Ti... | You can apply date filter in template
Example:
```
{{ birthday|date:"m, d, Y" }}
```
Django date format [reference](https://docs.djangoproject.com/en/4.1/ref/templates/builtins/#date) |
36,339,520 | HikariCP database connection pool used in Play 2.5 [supports Dropwizard Metrics](https://github.com/brettwooldridge/HikariCP/wiki/Dropwizard-Metrics). The recommended approach is to use `HikariConfig.setMetricRegistry(MetricRegistry)`, but Play does not seem to be using Dependency Injection for HikariConfig. Is there a... | 2016/03/31 | [
"https://Stackoverflow.com/questions/36339520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3706951/"
] | You can access the HikaryDatasource using
```
@Singleton
class InitMetricRegistry @Inject () (@NamedDatabaseProvider("default") val defaultDB: Database){
val ds: HikariDataSource = defaultDB.dataSource.asInstanceOf[HikariDataSource]
ds.setMetricRegistry(???)
}
```
To initialize the metrics on startup use an eage... | Solved this using the same approach mentioned by @JonasAnso. Here is the Java snippet.
```
public class AppInitProcessor {
@Inject
public AppInitProcessor(Database db, MetricRegistry metricRegistry) {
if (db.getDataSource() instanceof HikariDataSource) {
HikariDataSource dataSource = ((Hika... |
18,780,219 | After installing matplotlib successfully on my Fedora19,I tested my code written by python.
Unfortunately,I got this ImportError .
```
$ python ren.py
Traceback (most recent call last):
File "ren.py", line 10, in <module>
import matplotlib.pyplot as plt
File "/usr/lib64/python2.7/site-packages/matplotlib/... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18780219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2775327/"
] | copy libpng16.so.16 to /usr/lib/ may be ok.
in my computer(Fedora 19), libpng16.so.16 can be found in /usr/local/lib | I have meet the same problem with you. Maybe you can try copy libpng16.so.16 to /usr/lib64/. It works for me |
18,780,219 | After installing matplotlib successfully on my Fedora19,I tested my code written by python.
Unfortunately,I got this ImportError .
```
$ python ren.py
Traceback (most recent call last):
File "ren.py", line 10, in <module>
import matplotlib.pyplot as plt
File "/usr/lib64/python2.7/site-packages/matplotlib/... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18780219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2775327/"
] | copy libpng16.so.16 to /usr/lib/ may be ok.
in my computer(Fedora 19), libpng16.so.16 can be found in /usr/local/lib | Use the following:
```
sudo apt-get install libpng16-16
``` |
18,780,219 | After installing matplotlib successfully on my Fedora19,I tested my code written by python.
Unfortunately,I got this ImportError .
```
$ python ren.py
Traceback (most recent call last):
File "ren.py", line 10, in <module>
import matplotlib.pyplot as plt
File "/usr/lib64/python2.7/site-packages/matplotlib/... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18780219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2775327/"
] | Use the following:
```
sudo apt-get install libpng16-16
``` | I have meet the same problem with you. Maybe you can try copy libpng16.so.16 to /usr/lib64/. It works for me |
54,963,482 | I want to eliminate some duplicated code. Can anyone make this code shorter and better?
```
switch (now.site)
{
case item.SITE.AMAZON:
try
{
price = driver.FindElement(By.XPath("//*[@id=\"priceblock_ourprice\"]")).Text;
fetched = true;
}
catch
{
... | 2019/03/02 | [
"https://Stackoverflow.com/questions/54963482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8594925/"
] | You could create a dictionary of available path strings. I don't know what the type of `site` is. I assume `string`
```
private static Dictionary<string, string[]> pricePaths = new Dictionary<string, string[]> {
[item.SITE.AMAZON] = new string[] { "//*[@id=\"priceblock_ourprice\"]",
... | Here are some recommendations as to how you can beautify your code -
1. Declare constants for all XPath queries.
2. Declare a variable outside the switch statement to capture the price value based on your case statement.
3. Create a function with one try catch statements which accepts 2 xPath strings and an out param... |
54,963,482 | I want to eliminate some duplicated code. Can anyone make this code shorter and better?
```
switch (now.site)
{
case item.SITE.AMAZON:
try
{
price = driver.FindElement(By.XPath("//*[@id=\"priceblock_ourprice\"]")).Text;
fetched = true;
}
catch
{
... | 2019/03/02 | [
"https://Stackoverflow.com/questions/54963482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8594925/"
] | You could create a dictionary of available path strings. I don't know what the type of `site` is. I assume `string`
```
private static Dictionary<string, string[]> pricePaths = new Dictionary<string, string[]> {
[item.SITE.AMAZON] = new string[] { "//*[@id=\"priceblock_ourprice\"]",
... | It appears that you're really trying to get a decimal value. Let's use this assumption and make a method that returns a `decimal?` to indicate success (i.e. a value) or failure (i.e. `null`).
```
public static class Ex
{
public static decimal? FindDecimalMaybe(this IWebDriver driver, string path)
{
try... |
54,963,482 | I want to eliminate some duplicated code. Can anyone make this code shorter and better?
```
switch (now.site)
{
case item.SITE.AMAZON:
try
{
price = driver.FindElement(By.XPath("//*[@id=\"priceblock_ourprice\"]")).Text;
fetched = true;
}
catch
{
... | 2019/03/02 | [
"https://Stackoverflow.com/questions/54963482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8594925/"
] | It appears that you're really trying to get a decimal value. Let's use this assumption and make a method that returns a `decimal?` to indicate success (i.e. a value) or failure (i.e. `null`).
```
public static class Ex
{
public static decimal? FindDecimalMaybe(this IWebDriver driver, string path)
{
try... | Here are some recommendations as to how you can beautify your code -
1. Declare constants for all XPath queries.
2. Declare a variable outside the switch statement to capture the price value based on your case statement.
3. Create a function with one try catch statements which accepts 2 xPath strings and an out param... |
60,858,746 | I am writing documentation for a library using haddock, and, for reasons that are not really necessary to explain, I need to include a little code block in my documentation that looks like:
```
z(<>)
```
Importantly there can be no space between `z` and `(<>)`. It may be a bit esoteric but
```
z (<>)
```
would m... | 2020/03/25 | [
"https://Stackoverflow.com/questions/60858746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4040600/"
] | You can separate the two functions into different code blocks. If there is no space between the code blocks, it will appear no different than a single code block. So
```
@'z'@@'(<>)'@
```
will render as desired.
You can also do it in one code block by moving the `'`s inside of the parentheses to only surround `<>`.... | Here is an alternative solution to add to the answer you already provided:
You can mix and match ' and `. These two will also be rendered correctly by haddock:
```hs
-- | @`z`'(<>)'@
```
```hs
-- | @'z'`(<>)`@
```
At the same time I've tried your solution `@'z'@@'(<>)'@` and for some reason it did not render for ... |
313,578 | How would I go about adding the "A short preface" section?
I know `\section*{0.0 A Short Preface}` would probably be fine, but TeX is awesome and there has to be a better way.
This is sort of what I'm looking for (done in Google Docs):
[](https://i.... | 2016/06/07 | [
"https://tex.stackexchange.com/questions/313578",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/56796/"
] | At its simplest, setting the section counter to `-1` will cause the next section to be `0`.
```
\documentclass{book}
\begin{document}
\setcounter{section}{-1}
\section{text}
\end{document}
```
To change the appearance of sectioning, for example to add the subsection number by default, one needs to redefine `\thesect... | Edit: Update with [xassoccnt v.0.8](https://www.dropbox.com/s/9r9jf1b94kjnzxk/xassoccnt.0.8.tar.gz?dl=0) -- usage of cascaded suspension of counters, i.e. all counters in a counter reset list will be suspended:
```
\documentclass{book}
\usepackage{xassoccnt}
\usepackage{blindtext}
\setcounter{secnumdepth}{4}
\begin{... |
3,585,821 | I am writing a jQuery plugin and need functions that can be called from inside as well as outside the plugin. Here is my code so far:
```
(function($){
$.fn.bxSlider = function(options){
var defaults = {
mode : 'horizontal',
speed : 500
}
var options = $.extend(defaults, options);
var base = this;
... | 2010/08/27 | [
"https://Stackoverflow.com/questions/3585821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/386733/"
] | You're calling it *before* you've added it to that jQuery object.
Try this:
```
var base = this;
this.getText = function(){
return base.children().text();
}
this.each(function(){
var someText = base.getText;
console.log(someText);
});
``` | It appears that you're adding the method `getText` onto each instance, and trying to call it before definition. You could either:
1. Switch the order of your `this.each` and `this.getText =` so that you assign `getText` first
2. Assign `getText` the same way you've assigned `bxSlider`, by extending `$.fn`. This way it... |
6,711,211 | I am trying to find a combination of commands, macro or a plugin to copy the file I am editing in VIM (actually macvim) to the same location but with a different name. I am sure this could be achieved with a simple:
```
!cp $CURRENT_FILE_PATH $NEW_PATH
```
but I don't know what variables to use nor the syntax. | 2011/07/15 | [
"https://Stackoverflow.com/questions/6711211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/418267/"
] | `:saveas %:p:h/new_name`
For more information:
```
:h :saveas
``` | ```
:!cp % %:h/new_name
```
* `%` expands to the current filename
* `%:h` expands to the current filename's directory
To learn more:
* `:help expand()`
* `:help filename-modifiers` |
6,882 | What services provide realtime (or daily-updated) basic traffic informations for Western Europe ?
For example, [traffic.com/Navteq](http://www.traffic.com) provides such data to Bing Maps for US/Canada and Microsoft suggests [CENTRICO](http://www.centrico.org)/[OTAP](http://www.itsproj.com/otap) for Europe in its docu... | 2011/03/08 | [
"https://gis.stackexchange.com/questions/6882",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/2102/"
] | From a recent [Navteq press release](http://press.navteq.com/index.php?s=4260&item=25814): "... NAVTEQ Traffic is also currently available in (these) 23 countries around the world: *Austria, Belgium, Brazil, Canada, Denmark, Finland, France, Germany, Indonesia, Italy, Luxembourg, Mexico, The Netherlands, Norway, Poland... | TeleAtlas now TomTom
<http://licensing.tomtom.com/OurProducts/TrafficProducts/index.htm>
Enterprise Traffic
Navigate with up-to-the minute information
Multinet Coverage Map (PDF)
<http://licensing.tomtom.com/OurProducts/MapData/ssLINK/TA_CT048001> |
63,691,774 | What does this means? And how to decode the data?
`data="B64ENCeyJCdXkiOjI3LCJPdmVyIjoyLCJIb2xkIjozLCJVbmRlcnBlcmZvcm0iOjAsIlNlbGwiOjB9"`
Code from where I extracted this is:
```
<div
class="wsod_silo"
data="B64ENCeyJCdXkiOjI3LCJPdmVyIjoyLCJIb2xkIjozLCJVbmRlcnBlcmZvcm0iOjAsIlNlbGwiOjB9"
date="August 2020"
id... | 2020/09/01 | [
"https://Stackoverflow.com/questions/63691774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8310882/"
] | It is a base 64 encoded string. When you remove the `B64ENC` from the start you get
```
{"Buy":27,"Over":2,"Hold":3,"Underperform":0,"Sell":0}
```
```js
var encodedString = 'eyJCdXkiOjI3LCJPdmVyIjoyLCJIb2xkIjozLCJVbmRlcnBlcmZvcm0iOjAsIlNlbGwiOjB9';
var decodedString = atob(encodedString);
console.log(decodedString);... | That means something is stored into some `DOM` element data encoded using `Base64`.
You have to skip first part of string `B64ENC` and use rest of string and decode it.
For example, let put some `button` to decode it using `js`, and I put `id` for that `div` so we can use it in `js` easiest:
```js
function dc() {
/... |
7,129 | Here is some context, I’m trying to rebuild my credit. I own a House, I’m financing a car and I have 14 credit cards, 4 of the 14 have been paid off within the past 2 months and have a $0 balance the other 10 on average have 88% of the balance utilized so roughly 12% available credit.
I have a First Premier Bank Credi... | 2011/03/23 | [
"https://money.stackexchange.com/questions/7129",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/3075/"
] | Close the account. The age doesn't outweigh the fact that you have to pay for the card. It would be one thing if the credit line was a couple thousand but showing the credit bureaus that you are staying away from the $425.00 doesn't really make them think you are any more trustworthy with your available credit. Utiliza... | First off, congratulations on taking care of your finances and paying off your cards! Takes a lot of discipline.
If your next oldest card is just a year apart, you can safely close this card. |
37,308,447 | I have the following method inside a `User` Class:
```
func Login(username: String, password: String) -> String
{
return "Login Success";
}
```
Why on Earth it only works calling it if I specify the second parameter "label"(not sure what it is called)?
```
var loginReturn = user.Login("aa", password: "zz");
``... | 2016/05/18 | [
"https://Stackoverflow.com/questions/37308447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1248959/"
] | From [Functions in Swift](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Functions.html)
>
> Function parameters have both an external parameter name and a local parameter name. An external parameter name is used to label arguments passed to a function call. A local ... | You can write it like this:
```
func Login(username: String, _ password: String) -> String
{
return "Login Success";
}
```
For every method parameter you can define "inner" and "outer" parameters which will define the final look of the methods call. |
37,308,447 | I have the following method inside a `User` Class:
```
func Login(username: String, password: String) -> String
{
return "Login Success";
}
```
Why on Earth it only works calling it if I specify the second parameter "label"(not sure what it is called)?
```
var loginReturn = user.Login("aa", password: "zz");
``... | 2016/05/18 | [
"https://Stackoverflow.com/questions/37308447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1248959/"
] | From [Functions in Swift](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Functions.html)
>
> Function parameters have both an external parameter name and a local parameter name. An external parameter name is used to label arguments passed to a function call. A local ... | If you call a function that has two parameters, you must list the name of the parameters after the first one if they have a name. With the current way you've written your function...
**This Code Works**
```
var loginReturn = login("aa", password: "zz")
```
**And This Code Fails**
```
var loginReturn = login("aa", ... |
51,576,213 | I want to upload file from user disc to cloudinary from front side of electron app which is angularJS SPA.
I already did uploading photo from angularJS by selecting photo from `input[file]` but this time I want to upload movie by absolute path to file on user disc.
Since I use electron I'm able to use nodeJS packages... | 2018/07/29 | [
"https://Stackoverflow.com/questions/51576213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11262373/"
] | The URI needs to include the actual file contents and not just the path. For example, using formdata-
```
(function() {
var f = document.getElementById('f');
if (f.files.length)
processFile();
f.addEventListener('change', processFile, false);
function processFile(e) {
var f = docum... | @rcstraus correctly point out that I'm not converting to base64 file but just string which was path to file.
Except that my `file: data` was incorrect I should have `file: 'data:video/webm;base64,' + buff` where buff is file in base64 not path.
And the working code is:
```
$scope.uploadVideo = function () {
$sc... |
55,917,050 | I'm unable to download a file from my website that load in the web view.
On clicking the download link of the file the webview reloads the home url.
I changed some code by some blog help, but no change.
And also help with the code to download a file from the website.
```
public class WebPageActivity extends AppCompat... | 2019/04/30 | [
"https://Stackoverflow.com/questions/55917050",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273495/"
] | You could use a hash table for the groups and [`Array#reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) for iterating the array and assigns all object to their groups.
Later return all values from the hash table.
```js
function groupBy(array, group) {
return ... | Just for the sake of providing another solution (despite @NinaScholz's solution is way better), here is a solution relying on `Set`, `map` and `filter`:
```js
let foo = [{"id": "hello123"}, {"id":"goodbye123"}, {"id":"hello123"}];
function sortByKey(arr, key) {
const _uniqueValues = [...new Set(foo.map(i => i[key]... |
322,556 | Was given this to figure out. He said its mathematical, no its not homework. More of one guy trying to prove he is smarter than me.
The code:
```
(!(a&&b)) == |!a||!b| T
!(a||b) == !a&&!b
```
I think it might be some symbolic logic, but couldn't figure out from reading about symbolic mathematics from google searc... | 2013/03/06 | [
"https://math.stackexchange.com/questions/322556",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/23662/"
] | This is (almost) DeMorgan's laws written in C-language syntax (though other languages use the same syntax, too). Writing it a bit more tidily, it would be:
```
!(a && b) = (!a) || (!b)
!(a || b) = (!a) && (!b)
```
That's not exactly what you wrote, but I expect it's what you meant to write.
I don't know anything a... | This is De Morgan's law. See [here](http://en.wikipedia.org/wiki/De_Morgan%27s_laws). |
64,168,701 | Using GADTs, I have defined a depth-indexed tree data type ([2–3 tree](https://en.wikipedia.org/wiki/2%E2%80%933_tree)). The depth is there to statically ensure that the trees are balanced.
```hs
-- Natural numbers
data Nat = Z | S Nat
-- Depth-indexed 2-3 tree
data DT :: Nat -> Type -> Type where
-- Pattern of nod... | 2020/10/02 | [
"https://Stackoverflow.com/questions/64168701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11384906/"
] | You should write a depth-independent equality operator, which is able to compare two trees even if they have different depths `n` and `m`.
```
dtEq :: Eq a => DT n a -> DT m a -> Bool
dtEq N0_0 N0_0 = True
dtEq (N2_1 l1 x1 r1) (N2_1 l2 x2 r2) =
dtEq l1 l2 && x1 == x2 &&... | You could use Data.Coerce.coerce to compare the contents of the trees: as long as you label the depth parameter as phantom, it should be willing to give you `coerce :: DT n a -> DT m a`.
But this doesn't really solve the problem, of course: you want to know if their types are the same. Well, maybe there is some soluti... |
47,752,165 | I am trying to use class inheritance. I have taken a code from a book and tweaked it a bit to create Class Mammal and a Class Dog which inherits Mammal member data. The code is:
```
#include<iostream>
enum BREED{Labrador,Alcetian,Bull,Dalmetian,Pomerarian};
class Mammal{
public:
Mammal();
~Mammal(){}
d... | 2017/12/11 | [
"https://Stackoverflow.com/questions/47752165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4801528/"
] | You didn't define constructors, you only declared them:
```
class Mammal{
public:
Mammal(); // <-- declaration
...
class Dog : public Mammal{
public:
Dog(); // <-- declaration
```
When you declare a constructor (or any function) then the C++ compiler will look for the constructor's definition elsewhere. ... | This because you have just declared the non-parameterized constructors `Dog();` and `Mammal();` in respective classes, but not defined it.
To remove the error do following:
* In `class Mammal`, change line `Mammal();` to `Mammal(){}` **AND**
* In `class Dog`, change line `Dog();` to `Dog() {}`. |
47,752,165 | I am trying to use class inheritance. I have taken a code from a book and tweaked it a bit to create Class Mammal and a Class Dog which inherits Mammal member data. The code is:
```
#include<iostream>
enum BREED{Labrador,Alcetian,Bull,Dalmetian,Pomerarian};
class Mammal{
public:
Mammal();
~Mammal(){}
d... | 2017/12/11 | [
"https://Stackoverflow.com/questions/47752165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4801528/"
] | You didn't define constructors, you only declared them:
```
class Mammal{
public:
Mammal(); // <-- declaration
...
class Dog : public Mammal{
public:
Dog(); // <-- declaration
```
When you declare a constructor (or any function) then the C++ compiler will look for the constructor's definition elsewhere. ... | You have declared constructor for the class `Dog::Dog();`, its not defined. Means constructor is missing body. Define a constructor as follows
`public:
Dog::Dog(){
//statements
}` |
170,499 | I want to change the swap partition to another partition. Is there a gui that can make this process easier so I don't have to do things like manually editing files? | 2010/08/01 | [
"https://superuser.com/questions/170499",
"https://superuser.com",
"https://superuser.com/users/44339/"
] | This is in case you don't find a GUI method, you will find the terminal method quite flexible and easy. Run the following commands:
```
sudo swapoff /dev/hda3
sudo mkswap /dev/hda4
sudo swapon /dev/hda4
```
Then update /etc/fstab. Change the line containing "/dev/hda3" to "/dev/hda4".
Here is the [Ubuntu page on Sw... | Use **Parted Magic LiveCD**. Download it from [here](http://download.cnet.com/Parted-Magic-LiveCD/3000-2094_4-10663999.html), burn it to a CD and go. |
3,153,433 | I'm working on a Rails application that allows users to define Tasks, which require a `due_date`. The `due_date` may or may not include a time.
The way we're handling this right now feels like a hack. `due_date`s default to 12:00 AM, and in that case we don't display a time. The `DateTime` object doesn't allow for emp... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3153433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1249/"
] | Since your data structure needs to accommodate dates with and without a time, you have two choices:
**Use a Ruby DateTime object with a flag value** for the time to indicate that the date does not have a time. The usual flag value for this is 0 which then means the midnight time can't be shown. (Midnight is 0 seconds ... | Splitting the attributes may be unnecessarily complex. Why not adopt a convention that if no time is specified then default it to midnight or noon on the date in question? Unless you need to be able to distinguish between the two cases, i.e. this is midnight because it was explicitly specified or this is midnight becau... |
12,690,459 | I submitted an app which tracks the user's location (and sends it to the server) at some fixed intervals chosen by the user (5 min, 10 min, 30 min, 1 h). The app should work in background, too (sending the requests) and I have declared it as `UIBackgroundMode = location`. I am able to send the requests while in backgro... | 2012/10/02 | [
"https://Stackoverflow.com/questions/12690459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/285553/"
] | Sounds like apple's complaint is that your apple think that your app *doesn't need* to use background location. If what you're trying to do is legitimate - e.g. your user would expect the app to track them in the background and this is a useful thing to them - you could try explaining why location tracking is needed in... | I think it is best to address these questions directly to Apple. I hope you did so.
They are very good at communication, providing your response is professional and clear. As are your questions.
I find it hard to believe that anyone will be able to help you here.
Edit: Add description to your app. Be clear in your... |
12,690,459 | I submitted an app which tracks the user's location (and sends it to the server) at some fixed intervals chosen by the user (5 min, 10 min, 30 min, 1 h). The app should work in background, too (sending the requests) and I have declared it as `UIBackgroundMode = location`. I am able to send the requests while in backgro... | 2012/10/02 | [
"https://Stackoverflow.com/questions/12690459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/285553/"
] | To resolve you have to add the disclaimer in the App description in Itunes Connect "Continued use of GPS running in the background can dramatically decrease battery life." | I think it is best to address these questions directly to Apple. I hope you did so.
They are very good at communication, providing your response is professional and clear. As are your questions.
I find it hard to believe that anyone will be able to help you here.
Edit: Add description to your app. Be clear in your... |
12,690,459 | I submitted an app which tracks the user's location (and sends it to the server) at some fixed intervals chosen by the user (5 min, 10 min, 30 min, 1 h). The app should work in background, too (sending the requests) and I have declared it as `UIBackgroundMode = location`. I am able to send the requests while in backgro... | 2012/10/02 | [
"https://Stackoverflow.com/questions/12690459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/285553/"
] | Sounds like apple's complaint is that your apple think that your app *doesn't need* to use background location. If what you're trying to do is legitimate - e.g. your user would expect the app to track them in the background and this is a useful thing to them - you could try explaining why location tracking is needed in... | To resolve you have to add the disclaimer in the App description in Itunes Connect "Continued use of GPS running in the background can dramatically decrease battery life." |
39,165,489 | I was working on a project that works fine and I now I have restored a backup of the project, the project and the backup is identical, I also change the backup name to the original name and now the controllers inside route.php doesn't work.
For do the backup and restore it I did
```
cp -r project/ project_backup
rm -... | 2016/08/26 | [
"https://Stackoverflow.com/questions/39165489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2197507/"
] | You're using wrong address to access `/login` route, it should be:
```
http://project/login
```
If it doesn't work, you also need to setup web server by setting [document root to `laravel_project/public` directory](https://stackoverflow.com/questions/37507209/how-to-hide-config-files-from-direct-access).
Also:
* ... | You're using `Hash` facade, though you did not declare it's use in `use` statements.
PHP tried to resolve class in your 'App\Http\Controllers` namespace, thus trying to find `App\Http\Controllers\Hash` class which does not exist.
Adding `use Hash;` in the file should fix your problem.
```
use Auth;
use Log;
use Ha... |
33,002 | If this is true then the problem of a reliable source of water on Mars, that is available the entire year, is solved.
[](https://i.stack.imgur.com/MjW4a.jpg)
Crater on Mars filled with permanent ice. ([Source: ESA, Mars Express](https://www.9news.com.... | 2018/12/20 | [
"https://space.stackexchange.com/questions/33002",
"https://space.stackexchange.com",
"https://space.stackexchange.com/users/-1/"
] | The ice-filled Korolev crater appears in [Viking imagery](https://photojournal.jpl.nasa.gov/catalog/PIA00161) taken in the '70s. It took the arrival of suitable radars in orbit (like [MARSIS on Mars Express](https://en.wikipedia.org/wiki/MARSIS) and [SHARAD on MRO](https://en.wikipedia.org/wiki/SHARAD), ca. 2005-6) to ... | Korolev crater has been sitting there in plain sight for quite a while already. There is no sudden "discovery", just the ESA press office doing it's job.
>
> The image itself is a composite of pictures of the crater taken by the Mars Express High Resolution Stereo Camera. The European Space Agency's Mars Express miss... |
4,818,435 | a question on building executable jar files. Suppose we have a jar file *a.jar* that contains UI.class. I have used a metafile in archiving a.jar that says
```
Main-Class: UI
Class-Path: . b.jar c.jar
```
Now, if I want to ship this executable a.jar to somebody, I have to ship 3 files - a.jar, b.jar and c.jar. The u... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4818435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/580796/"
] | Have you looked at this tool [OneJar](http://one-jar.sourceforge.net/index.php?page=getting-started&file=quickstart)? Also [this](http://www.ibm.com/developerworks/java/library/j-onejar/) is a good article to read on OneJar.
If you decide to not use an external tool then your alternative is to put the library/helper j... | OneJar is good for just bundling a few things together, but it's generally quite slow and inflexible. This isn't a dig at OneJar, it's great for what it does but unless I wanted a quick and easy distributable for a tiny program I wouldn't use it.
I did use it for a while but then switched to [izpack](http://izpack.org... |
4,818,435 | a question on building executable jar files. Suppose we have a jar file *a.jar* that contains UI.class. I have used a metafile in archiving a.jar that says
```
Main-Class: UI
Class-Path: . b.jar c.jar
```
Now, if I want to ship this executable a.jar to somebody, I have to ship 3 files - a.jar, b.jar and c.jar. The u... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4818435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/580796/"
] | Have you looked at this tool [OneJar](http://one-jar.sourceforge.net/index.php?page=getting-started&file=quickstart)? Also [this](http://www.ibm.com/developerworks/java/library/j-onejar/) is a good article to read on OneJar.
If you decide to not use an external tool then your alternative is to put the library/helper j... | Another way can be use one of several available tools to create a setup deliverable and your setup pack will unpack your application when installed. |
4,818,435 | a question on building executable jar files. Suppose we have a jar file *a.jar* that contains UI.class. I have used a metafile in archiving a.jar that says
```
Main-Class: UI
Class-Path: . b.jar c.jar
```
Now, if I want to ship this executable a.jar to somebody, I have to ship 3 files - a.jar, b.jar and c.jar. The u... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4818435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/580796/"
] | Have you looked at this tool [OneJar](http://one-jar.sourceforge.net/index.php?page=getting-started&file=quickstart)? Also [this](http://www.ibm.com/developerworks/java/library/j-onejar/) is a good article to read on OneJar.
If you decide to not use an external tool then your alternative is to put the library/helper j... | There is OneJar as people have mentioned but also (especially if you are using eclipse) you can consider [fatjar](http://fjep.sourceforge.net/).
ALternatively, you can also achieve this by using an ANT Task here's an example:
```
<target name="dist" depends="compile,static" description="Compiles and builds jar files... |
4,818,435 | a question on building executable jar files. Suppose we have a jar file *a.jar* that contains UI.class. I have used a metafile in archiving a.jar that says
```
Main-Class: UI
Class-Path: . b.jar c.jar
```
Now, if I want to ship this executable a.jar to somebody, I have to ship 3 files - a.jar, b.jar and c.jar. The u... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4818435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/580796/"
] | Have you looked at this tool [OneJar](http://one-jar.sourceforge.net/index.php?page=getting-started&file=quickstart)? Also [this](http://www.ibm.com/developerworks/java/library/j-onejar/) is a good article to read on OneJar.
If you decide to not use an external tool then your alternative is to put the library/helper j... | Maven users can also use the assembly plugin for this:
<http://maven.apache.org/plugins/maven-assembly-plugin/usage.html> |
4,818,435 | a question on building executable jar files. Suppose we have a jar file *a.jar* that contains UI.class. I have used a metafile in archiving a.jar that says
```
Main-Class: UI
Class-Path: . b.jar c.jar
```
Now, if I want to ship this executable a.jar to somebody, I have to ship 3 files - a.jar, b.jar and c.jar. The u... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4818435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/580796/"
] | There is OneJar as people have mentioned but also (especially if you are using eclipse) you can consider [fatjar](http://fjep.sourceforge.net/).
ALternatively, you can also achieve this by using an ANT Task here's an example:
```
<target name="dist" depends="compile,static" description="Compiles and builds jar files... | OneJar is good for just bundling a few things together, but it's generally quite slow and inflexible. This isn't a dig at OneJar, it's great for what it does but unless I wanted a quick and easy distributable for a tiny program I wouldn't use it.
I did use it for a while but then switched to [izpack](http://izpack.org... |
4,818,435 | a question on building executable jar files. Suppose we have a jar file *a.jar* that contains UI.class. I have used a metafile in archiving a.jar that says
```
Main-Class: UI
Class-Path: . b.jar c.jar
```
Now, if I want to ship this executable a.jar to somebody, I have to ship 3 files - a.jar, b.jar and c.jar. The u... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4818435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/580796/"
] | There is OneJar as people have mentioned but also (especially if you are using eclipse) you can consider [fatjar](http://fjep.sourceforge.net/).
ALternatively, you can also achieve this by using an ANT Task here's an example:
```
<target name="dist" depends="compile,static" description="Compiles and builds jar files... | Another way can be use one of several available tools to create a setup deliverable and your setup pack will unpack your application when installed. |
4,818,435 | a question on building executable jar files. Suppose we have a jar file *a.jar* that contains UI.class. I have used a metafile in archiving a.jar that says
```
Main-Class: UI
Class-Path: . b.jar c.jar
```
Now, if I want to ship this executable a.jar to somebody, I have to ship 3 files - a.jar, b.jar and c.jar. The u... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4818435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/580796/"
] | There is OneJar as people have mentioned but also (especially if you are using eclipse) you can consider [fatjar](http://fjep.sourceforge.net/).
ALternatively, you can also achieve this by using an ANT Task here's an example:
```
<target name="dist" depends="compile,static" description="Compiles and builds jar files... | Maven users can also use the assembly plugin for this:
<http://maven.apache.org/plugins/maven-assembly-plugin/usage.html> |
53,405,383 | I'm currently using OleDB.
My problem is I can't select my table when searching it using textbox.
This is my code:
```
OleDbCommand inv = new OleDbCommand("Select [Part Number], [Part Name], [Ordered Quantity], [Arrived Quantity] From '"+textBox1.Text+"%'", PartsDB);
OleDbDataAdapter adapt = new OleDbDataAdapter(inv... | 2018/11/21 | [
"https://Stackoverflow.com/questions/53405383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10683704/"
] | AWS consoles are pretty separate from the roles which the current user has assumed, so it's expected behavior for it to just fail and say you're not authorized if the signed in user tries to overstep that role.
As far as APIs and schemas, an API is defined by the schema document. You must create an API first, then se... | I had the same issue recently and I was able to fix it.
1. Go to IAM dashboard in your AWS Console and navigate to `Roles`
2. Search for your admin access role (Mine was something like us-east-XXXX\_Full-access)
3. Click on that role and you should only see `AdministratorAccess-Amplify` and `Full-access-Policy`, but n... |
751,710 | I am unable to install updates.
I can download them without problems, But it always fails while installing them.
Very few packages get randomly installed successfully.
I thought it was my machine , so I rebuild a new server. And I still get trouble.
I made sure Firewall isn't blocking, here's a screenshot
![enter ... | 2014/05/09 | [
"https://superuser.com/questions/751710",
"https://superuser.com",
"https://superuser.com/users/316437/"
] | I won't claim to understand the issues that prevent the automated installation of some patches through Windows Update. In the past, I've gotten many unique error codes like your `0x80244018` which Windows Help subsequently cannot find in Microsoft's knowledge base.
Instead of solving the underlying issues, I have cont... | In my case, I had to clear the Internet Explorer proxy settings. Apparently, because I talk to my WSUS server via IP address, it uses the proxy even though it shouldn't. Once I was done performing the update, I re-enabled the settings.
<https://support.microsoft.com/en-us/kb/262981> |
632,518 | Find this follow function $f(x)$ range ,where $x\in R$,
$$f(x)=\sum\_{i=0}^{5}\dfrac{1}{2+\cos{\left(x+\dfrac{i\pi}{3}\right)}}\cdot \dfrac{1}{2+\cos{\left(x+\dfrac{(i+1)\pi}{3}\right)}}$$
or
$$f(x)=\dfrac{1}{2+\cos{x}}\cdot\dfrac{1}{2+\cos{\left(x+\dfrac{\pi}{3}\right)}}+\dfrac{1}{2+\cos{\left(x+\dfrac{\pi}{3}\right)}... | 2014/01/09 | [
"https://math.stackexchange.com/questions/632518",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | If you know $AD = 12$ already, then $DF = 12/3$. This is because $F$ is the centroid of $\triangle ABC$, and the centroid of a triangle divides each median into $1:2$. | F is the intersection of all three medians of the triangle. You can know the length of AD (which is a median) with <http://en.wikipedia.org/wiki/Apollonius%27_theorem> if you have the length of the 3 sides (in ABC), or <http://en.wikipedia.org/wiki/Law_of_cosines> if you have 2 angles and 1 length (in ACD), which you s... |
266,334 | I have developed one SharePoint site for Performance Review.
Site has custom html page with jQuery that creates/updates record using REST and that page is blinded using ASPX page. (I will explain the functionalities used in this page at end of this question)
I have given edit permission to all end users so that they ... | 2019/07/16 | [
"https://sharepoint.stackexchange.com/questions/266334",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/72466/"
] | An "Office 365 Group" is a (special) Active Directory group **plus** a Site Collection. This AD group can be used as an ordinary AD group when granting access to other sites. When used this way, they are just an AD group with no special "Office 365 Group" features in that site. I.e. they are managed as ordinary SharePo... | You can only connect an Office 365 group to an existing SharePoint site. It is a one-to-one relationship. |
40,014,999 | I've got follow code:
```css
.cWrapper {
display: flex;
}
.cLine {
width: 100px;
height: 100px;
border: 1px solid;
}
.cLine1 {
background-color: transparent;
border-color: transparent gray gray transparent;
border-bottom-right-radius: 20px;
}
.cLine2 {
width: 20px;
height: 150px;
ba... | 2016/10/13 | [
"https://Stackoverflow.com/questions/40014999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5466074/"
] | Use cordova-plugin-network-information, to check network connection in ionic.
>
> cordova plugin add cordova-plugin-network-information
>
>
>
When running on device, you can check.
>
> $cordovaNetwork.isOnline();
>
>
>
Joshmorony wrote tutorial about it. [HERE](http://www.joshmorony.com/monitoring-online-an... | You can use event into your app.js
like
`document.addEventListener("offline", function(e) {
//$state.go('offline', {}, {reload: true});
alert('No Internet');
}, false);` |
40,014,999 | I've got follow code:
```css
.cWrapper {
display: flex;
}
.cLine {
width: 100px;
height: 100px;
border: 1px solid;
}
.cLine1 {
background-color: transparent;
border-color: transparent gray gray transparent;
border-bottom-right-radius: 20px;
}
.cLine2 {
width: 20px;
height: 150px;
ba... | 2016/10/13 | [
"https://Stackoverflow.com/questions/40014999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5466074/"
] | Use cordova-plugin-network-information, to check network connection in ionic.
>
> cordova plugin add cordova-plugin-network-information
>
>
>
When running on device, you can check.
>
> $cordovaNetwork.isOnline();
>
>
>
Joshmorony wrote tutorial about it. [HERE](http://www.joshmorony.com/monitoring-online-an... | Following up the answer from Aung Myat Hein, you need to get the cordova-plugin-network-information.
```
cordova plugin add cordova-plugin-network-information
```
In which if you need a simple way, u can set it into your localstorage.
For offline handling:
```
document.addEventListener("offline", function()
... |
48,164,584 | I am having an issue with trying to read a file in my assets folder. The library in question is; Web3j's wallet utility class. For some reason it will not find the json file. The json file is located in the assets folder.
```
currentWallet = WalletUtils.loadCredentials(password , "/some.json");
```
The stacktrace is... | 2018/01/09 | [
"https://Stackoverflow.com/questions/48164584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1690688/"
] | @Sajeetharan *almost* got it.
import the Router with
```
import { Router } from '@angular/router';
```
Inject it in your component
```
constructor(private router: Router) {}
```
Now you have several ways to call it
```
this.router.navigate(['thanks']); // Array of routes
this.router.navigateByUrl('/thanks');... | You have to import **`Router`** and use
**`import { Router } from '@angular/router';`**
```
constructor(private _router: Router)
this.router.navigate("/thanks");
``` |
48,164,584 | I am having an issue with trying to read a file in my assets folder. The library in question is; Web3j's wallet utility class. For some reason it will not find the json file. The json file is located in the assets folder.
```
currentWallet = WalletUtils.loadCredentials(password , "/some.json");
```
The stacktrace is... | 2018/01/09 | [
"https://Stackoverflow.com/questions/48164584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1690688/"
] | @Sajeetharan *almost* got it.
import the Router with
```
import { Router } from '@angular/router';
```
Inject it in your component
```
constructor(private router: Router) {}
```
Now you have several ways to call it
```
this.router.navigate(['thanks']); // Array of routes
this.router.navigateByUrl('/thanks');... | You can either use
`[routerLink]="['/roue']"` in your html
or in your component :
```
import { Router } from '@angular/router';
constructor(
private router: Router,
) { }
goToRoue(){
this.router.navigate(['/roue']);
}
```
Hope it helps! |
108,100 | More and more [`tar`](http://www.gnu.org/software/tar/manual/tar.html) archives use the [`xz`](http://en.wikipedia.org/wiki/Xz) format based on LZMA2 for compression instead of the traditional [`bzip2(bz2)`](http://en.wikipedia.org/wiki/Bz2) compression. In fact *kernel.org* made a late "*Good-bye bzip2*" [announcement... | 2014/01/06 | [
"https://unix.stackexchange.com/questions/108100",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/-1/"
] | For distributing archives over the Internet, the following things are generally a priority:
1. Compression ratio (i.e., how small the compressor makes the data);
2. Decompression time (CPU requirements);
3. Decompression memory requirements; and
4. Compatibility (how wide-spread the decompression program is)
Compress... | First of all, this question is not directly related to `tar`. Tar just creates an uncompressed archive, the compression is then applied later on.
Gzip is known to be relatively fast when compared to LZMA2 and bzip2. If speed matters, `gzip` (especially the multithreaded implementation [`pigz`](http://zlib.net/pigz/)) ... |
108,100 | More and more [`tar`](http://www.gnu.org/software/tar/manual/tar.html) archives use the [`xz`](http://en.wikipedia.org/wiki/Xz) format based on LZMA2 for compression instead of the traditional [`bzip2(bz2)`](http://en.wikipedia.org/wiki/Bz2) compression. In fact *kernel.org* made a late "*Good-bye bzip2*" [announcement... | 2014/01/06 | [
"https://unix.stackexchange.com/questions/108100",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/-1/"
] | First of all, this question is not directly related to `tar`. Tar just creates an uncompressed archive, the compression is then applied later on.
Gzip is known to be relatively fast when compared to LZMA2 and bzip2. If speed matters, `gzip` (especially the multithreaded implementation [`pigz`](http://zlib.net/pigz/)) ... | **Short answer** : xz is more efficient in terms of compression ratio. So it saves disk space and optimizes the transfer through the network.
You can see this [Quick Benchmark](http://catchchallenger.first-world.info/wiki/Quick_Benchmark:_Gzip_vs_Bzip2_vs_LZMA_vs_XZ_vs_LZ4_vs_LZO) so as to discover the difference by... |
108,100 | More and more [`tar`](http://www.gnu.org/software/tar/manual/tar.html) archives use the [`xz`](http://en.wikipedia.org/wiki/Xz) format based on LZMA2 for compression instead of the traditional [`bzip2(bz2)`](http://en.wikipedia.org/wiki/Bz2) compression. In fact *kernel.org* made a late "*Good-bye bzip2*" [announcement... | 2014/01/06 | [
"https://unix.stackexchange.com/questions/108100",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/-1/"
] | First of all, this question is not directly related to `tar`. Tar just creates an uncompressed archive, the compression is then applied later on.
Gzip is known to be relatively fast when compared to LZMA2 and bzip2. If speed matters, `gzip` (especially the multithreaded implementation [`pigz`](http://zlib.net/pigz/)) ... | LZMA2 is a block compression system whereas gzip is not. This means that LZMA2 lends itself to multi-threading. Also, if corruption occurs in an archive, you can generally recover data from subsequent blocks with LZMA2 but you cannot do this with gzip. In practice, you lose the entire archive with gzip subsequent to th... |
108,100 | More and more [`tar`](http://www.gnu.org/software/tar/manual/tar.html) archives use the [`xz`](http://en.wikipedia.org/wiki/Xz) format based on LZMA2 for compression instead of the traditional [`bzip2(bz2)`](http://en.wikipedia.org/wiki/Bz2) compression. In fact *kernel.org* made a late "*Good-bye bzip2*" [announcement... | 2014/01/06 | [
"https://unix.stackexchange.com/questions/108100",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/-1/"
] | For distributing archives over the Internet, the following things are generally a priority:
1. Compression ratio (i.e., how small the compressor makes the data);
2. Decompression time (CPU requirements);
3. Decompression memory requirements; and
4. Compatibility (how wide-spread the decompression program is)
Compress... | **Short answer** : xz is more efficient in terms of compression ratio. So it saves disk space and optimizes the transfer through the network.
You can see this [Quick Benchmark](http://catchchallenger.first-world.info/wiki/Quick_Benchmark:_Gzip_vs_Bzip2_vs_LZMA_vs_XZ_vs_LZ4_vs_LZO) so as to discover the difference by... |
108,100 | More and more [`tar`](http://www.gnu.org/software/tar/manual/tar.html) archives use the [`xz`](http://en.wikipedia.org/wiki/Xz) format based on LZMA2 for compression instead of the traditional [`bzip2(bz2)`](http://en.wikipedia.org/wiki/Bz2) compression. In fact *kernel.org* made a late "*Good-bye bzip2*" [announcement... | 2014/01/06 | [
"https://unix.stackexchange.com/questions/108100",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/-1/"
] | For distributing archives over the Internet, the following things are generally a priority:
1. Compression ratio (i.e., how small the compressor makes the data);
2. Decompression time (CPU requirements);
3. Decompression memory requirements; and
4. Compatibility (how wide-spread the decompression program is)
Compress... | LZMA2 is a block compression system whereas gzip is not. This means that LZMA2 lends itself to multi-threading. Also, if corruption occurs in an archive, you can generally recover data from subsequent blocks with LZMA2 but you cannot do this with gzip. In practice, you lose the entire archive with gzip subsequent to th... |
108,100 | More and more [`tar`](http://www.gnu.org/software/tar/manual/tar.html) archives use the [`xz`](http://en.wikipedia.org/wiki/Xz) format based on LZMA2 for compression instead of the traditional [`bzip2(bz2)`](http://en.wikipedia.org/wiki/Bz2) compression. In fact *kernel.org* made a late "*Good-bye bzip2*" [announcement... | 2014/01/06 | [
"https://unix.stackexchange.com/questions/108100",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/-1/"
] | LZMA2 is a block compression system whereas gzip is not. This means that LZMA2 lends itself to multi-threading. Also, if corruption occurs in an archive, you can generally recover data from subsequent blocks with LZMA2 but you cannot do this with gzip. In practice, you lose the entire archive with gzip subsequent to th... | **Short answer** : xz is more efficient in terms of compression ratio. So it saves disk space and optimizes the transfer through the network.
You can see this [Quick Benchmark](http://catchchallenger.first-world.info/wiki/Quick_Benchmark:_Gzip_vs_Bzip2_vs_LZMA_vs_XZ_vs_LZ4_vs_LZO) so as to discover the difference by... |
69,372,033 | row.remarks has the output of 1 and 0. What I want to happen is that when the output is 0 I want to display it with the string "fail" and 1 is "passed" in the html. ` I'm using mat-table.
html
```
<ng-container matColumnDef="remarks">
<th class="font" mat-header-cell *matHeaderCellDef >Quiz Score</th>
... | 2021/09/29 | [
"https://Stackoverflow.com/questions/69372033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16767985/"
] | ```html
import 'package:flutter/material.dart';
class DropDown extends StatefulWidget {
DropDown({
this.data,
this.hint,
this.initialValue,
Key? key,
}) : super(key: key);
final List<String>? data;
final String? hint;
final String? initialValue;
String chosenValue1 = "";
@override
_Dro... | I tried running your code and, after making your `data` and `hint` required params and moving the `chosenValue` variable inside your `_DropDownState`, it works perfectly fine. Can you maybe share some steps with how to reproduce the error that you're seeing, because I see two different dropdowns with values I can selec... |
69,372,033 | row.remarks has the output of 1 and 0. What I want to happen is that when the output is 0 I want to display it with the string "fail" and 1 is "passed" in the html. ` I'm using mat-table.
html
```
<ng-container matColumnDef="remarks">
<th class="font" mat-header-cell *matHeaderCellDef >Quiz Score</th>
... | 2021/09/29 | [
"https://Stackoverflow.com/questions/69372033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16767985/"
] | ```html
import 'package:flutter/material.dart';
class DropDown extends StatefulWidget {
DropDown({
this.data,
this.hint,
this.initialValue,
Key? key,
}) : super(key: key);
final List<String>? data;
final String? hint;
final String? initialValue;
String chosenValue1 = "";
@override
_Dro... | ```
onChanged: (String value) {
setState(() {
_chosenValue = value;
selcat = null; use dropdown as category
_chosenValue == null
? Container()
: _chosenValue == "h... |
60,825 | Is it possible to dimensionally regularize an amplitude which contains the totally antisymmetric Levi-Civita tensor $\epsilon^{\mu\nu\alpha\beta}$?
I don't know if it's possible to define
$\epsilon^{\mu\nu\alpha\beta}$ in e.g. $$d-\eta$$-dimensions where $\eta$ is considered small and which we set to zero in the end... | 2013/04/11 | [
"https://physics.stackexchange.com/questions/60825",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/22622/"
] | This problem was already mentioned in the original ['t Hooft-Veltman](http://www.staff.science.uu.nl/%7Ehooft101/gthpub/regularization_renormalization.pdf) article and solved by [Breitenlohner and Maison](https://projecteuclid.org/journals/communications-in-mathematical-physics/volume-52/issue-1/Dimensional-renormaliza... | this fails since the tensor $ \epsilon ^{a,b,c,d} $ is diemnsion dependent
however in the case of zeta regularization of integrals $ \int\_{a}^{\infty}dx x^{m-s} $ with 's' a regulator we can overcome this problem |
501,712 | I am using SQL Server Management Studio 2012. I am trying to print a stored procedure in the color-coded syntax that it loves showing me, but cannot find an option to enable this. Any ideas?
I know on VS2010 that we (finally) got color output for text, via an add-in on MS's site, but I cannot seem to locate anything f... | 2012/11/06 | [
"https://superuser.com/questions/501712",
"https://superuser.com",
"https://superuser.com/users/105880/"
] | While making presentations, I used ZoomIT
Download link: [Technet](http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx)
Please check if this suits your purpose. The site says it's XP and higher, so it must work on Win8 too, you might want to try. | In Windows 8 there is a new keyboard shortcut: you can pressthe Win key and the Plus key (win+) to zoom in and the Win key and the Minus key (win-) to zoom out |
5,426 | I have 2 SharePoint WFE Servers, due to some changes by my previous administrator, one of the WFE is out of synch. Can you please suggest.. what could be the issue?
Example: When a create a new web application, it creates the website only on One WFE and not on other. ANother thing.. when I am creating a new web applic... | 2010/09/12 | [
"https://sharepoint.stackexchange.com/questions/5426",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/-1/"
] | restarting the timer services should resolve the issue if the server is healthy.
You can also run stsadm -o execadmsvcjobs to initiate any pending changes immediately. | We faced a similar problem in MOSS 2007 environment . where the webapplication is created in one server and it is not created in the other.
The steps which we did was delete the webapplication first
Restart the timer services in both the WFE and try creating a webapplication . This should solve |
5,034,230 | I noticed that when I set my Rails app to production it created a folder in my application called `RAILS_ENV=production` I've kinda rolled back now and not pushing to production. Am I free to delete this folder? | 2011/02/17 | [
"https://Stackoverflow.com/questions/5034230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/269349/"
] | >
> the following XSLT segment:
>
>
>
```
<xsl:template match="p|b|i">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
```
>
> will actually generate the output like
>
>
> (18221895)
>
>
> But I want
>
>
> (1822-1895)
>
>
>
**I cannot repro the problem.**
**With this X... | Dimitre was correct in saying that there is no problem in the XSLT code. However, this is not an XSLT issue, this is a parsing issue.
Your document contains entity `–`, which is not a predefined XML entity. So a parser is not able to replace its value if it doesn't know the definition of that entity. This means ... |
25,275,070 | I want to create a static library (actually, a framework, but I know how to do that part) that bundles up code from, among other things, another static library. However, the `OBJC_CLASS` exports from the original library end up as undefined symbols.
For example, in Xcode 5.1.1 (using default settings/choices at every ... | 2014/08/12 | [
"https://Stackoverflow.com/questions/25275070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/908494/"
] | I think I may have solved it with single-object prelink (basically this means it does an `ld -r` to build a giant object file, then passes that to `libtool`), although I'm still not sure, and I don't love the solution. So, I will post what I've got as an answer, but hope someone else comes along with a better answer.
... | Adding this to `Other Linker Flags` appears to work
```
-force_load $(CONFIGURATION_BUILD_DIR)/libLibA.a
``` |
12,675,520 | How to create an embedded resource in a Web Site project?
In a web application project I can change the 'build action' through the properties window of a file. In an Web Site project there is no properties window. I noticed, in a web application project, the .csproj file is changed when you change the build action of ... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12675520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/464668/"
] | You can't add an embedded resource, because web site projects are not pre-compiled. There is no generated dll to embed the resource in. | You can still get a properties window on a Web Site project - do you mean that you want to mark an item in your website project to be included for deployment? If so that would be done by setting the Build Action property for the selected file in your solution to Content.
Embedded Resource is an option but is aimed at ... |
474,160 | The help menu in Eclipse has no "Install new software" button so I can't install any new plugins:

I'm on Ubuntu 14.04. Here's my Eclipse version:
```
Eclipse Platform
Version: 4.3.2.v20140221-1852
Build id: M20140221-1700
``` | 2014/05/29 | [
"https://askubuntu.com/questions/474160",
"https://askubuntu.com",
"https://askubuntu.com/users/286652/"
] | I do not have a solution, but I figured out this workaround.
1. Go to Help/Search
2. Search for "Install new"
3. Select "Updating and installing software" from the local search results.
4. Click on the link by the name "Installing new software"
5. Here click the first link with the text "Help > Install New Software ..... | Run as Administrator.
Either Shift-Enter the program or right-click. The problem should be solved immediately. |
23,228,444 | In the similar question [Sonar-Runner talks to the local database](https://stackoverflow.com/questions/17106921/sonar-runner-talks-to-the-local-database) "David RACODON - SonarSource" wrote:
>
> The SonarQube Runner needs to talk to both the database and the web server.
>
>
>
I'm will try to understand why Sonar ... | 2014/04/22 | [
"https://Stackoverflow.com/questions/23228444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3049486/"
] | SonarQube needs to talk to the database in order to save the results (metrics) of the analysis.
I will not talk about all the different possibilities that you can implement in order to avoid SonarQube's users to know the admin login, but here is the one I use:
1. SonarQube + Runner
2. Jenkins with Sonar plugin
Thi... | As of version 5.2, this is no longer the case. Now, all DB credentials/connections are managed by Sonar itself, not the runner. |
14,402,064 | I have written three classes implementing XStream.
It marshalls/unmarshalls the following XML.
```
<Message calledProgram="XXX" programName="YYY">
<Fields>
<Field name="SupplierName" value="ABC"/>
<Field name="SupplierNo" value="123456"/>
<Field name="SupplierCountry" value="AA"/>
<Field name="TermsO... | 2013/01/18 | [
"https://Stackoverflow.com/questions/14402064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1888562/"
] | I haven't been able to configure the `xml-to-object-transformer` so it works OOTB with your XStream annotated classes. The only way I've been able to load the XML sample above and have your flow process it successfully is by using Spring to instantiate and configure XStream as shown below:
```
<spring:beans>
<spri... | The [Xml to object](http://www.mulesoft.org/documentation/display/MULE3USER/XmlObject+Transformers) transformer internally uses Xstream so it should work OOTB.
Please provide the flow configuration and I will update my answer accordingly. |
14,402,064 | I have written three classes implementing XStream.
It marshalls/unmarshalls the following XML.
```
<Message calledProgram="XXX" programName="YYY">
<Fields>
<Field name="SupplierName" value="ABC"/>
<Field name="SupplierNo" value="123456"/>
<Field name="SupplierCountry" value="AA"/>
<Field name="TermsO... | 2013/01/18 | [
"https://Stackoverflow.com/questions/14402064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1888562/"
] | The problem
-----------
The default **Object to XML** transformer only supports the **alias** annotation for classes:
```
<mulexml:object-to-xml-transformer doc:name="Object to XML">
<mulexml:alias name="myAlias" class="com.my.package.MyClass"/>
</mulexml:object-to-xml-transformer>
```
and ignores every other a... | The [Xml to object](http://www.mulesoft.org/documentation/display/MULE3USER/XmlObject+Transformers) transformer internally uses Xstream so it should work OOTB.
Please provide the flow configuration and I will update my answer accordingly. |
2,089,545 | I have a set of functions that work on a file. Originally I made it into a class, with the only private member being a `static const std::string` which was the name of the file. The user used these functions by creating an object and calling functions from it. However, I think I'm going to switch to using a namespace, ... | 2010/01/18 | [
"https://Stackoverflow.com/questions/2089545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/257581/"
] | You can do similar things but they will have different semantics.
In a class, a static variable is a declaration, not a definition, it still requires a definition outside of the class; a variable declaration in a namespace is a definition unless you mark in as `extern` and don't provide an initializer.
In your case i... | I do not see the problem that led you to switch from using a class to using a namespace. If every function is acting on the file whose name is stored in `FILE_NAME`, then the file seems like a perfectly valid part of an object's state. Switching from that to what amounts to a global variable is a strong code smell. Wha... |
48,902,692 | I have a Spring application which is based on REST APIs. I would like to disable HTTP GET/POST methods but would like to allow HTTPS GET/POST methods.
How can I do that ? | 2018/02/21 | [
"https://Stackoverflow.com/questions/48902692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/537569/"
] | Simply add the following to your application.properties :
```
server.port: 8443
server.ssl.key-store: classpath:keystore.p12
server.ssl.key-store-password: password
server.ssl.keyStoreType: PKCS12
server.ssl.keyAlias: tomcat
```
Then generate a certificate to test
```
keytool -genkey -alias tomcat -storetype PKCS12... | Make your server only "HTTPS" enable and block "HTTP" request on server level. on application level HTTP request blocking is bad practice. |
52,557,484 | I update a key value in application.conf by setting the environment variable
```
play.http.secret.key=${?MY_SECRET_KEY}
```
But it still loads the previous value.
After a system reboot the change takes effect.
Is there a way to refresh the config file without rebooting? | 2018/09/28 | [
"https://Stackoverflow.com/questions/52557484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4569436/"
] | Try the following:
Given in a file called *sample1.conf*:
```
a {
b {
c = 30
d = ["Red", "Orange", "Green", "Blue"]
}
}
```
If you wish to change a property be sure to change it as system property first and call invalidate caches then load again. This is also what allows you to override on the com... | AFAIK, there is no Out of the box mechanism to do such thing.
As it turns out, when you start Play through the "sbt run" command, it starts in Dev mode, creating two ClassLoaders, one for your code, and the other one for the immutable code, like libraries, dependencies, and the framework code itself. This is done this ... |
31,906,170 | Let's say I want to set up a poor man's authentication scheme for a simple network service.
I don't want to bother with username/password authentication, for simplicity I just want to have a list of public keys in my application and anyone who can prove they are the owner of that key can use my service.
For the purpo... | 2015/08/09 | [
"https://Stackoverflow.com/questions/31906170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357024/"
] | If you just have a list of users that can use your application and you have no need to see who did what.
You can setup your server so that it listens only on localhost (127.1) rather than 0.0.0.0, and provide a restricted sshd, forwarding the port required to connect to the application
`~/.ssh/authorized_keys` will p... | Assuming you are talking about a web based application. What you are really looking for is X.509 Client certificates (1.3.6.1.5.5.7.3.2). This will allow you to identify a user individually to your application.
These face the same issues that are usually faced when looking at key distribution. Which is generally consi... |
31,906,170 | Let's say I want to set up a poor man's authentication scheme for a simple network service.
I don't want to bother with username/password authentication, for simplicity I just want to have a list of public keys in my application and anyone who can prove they are the owner of that key can use my service.
For the purpo... | 2015/08/09 | [
"https://Stackoverflow.com/questions/31906170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357024/"
] | A dirty hack from top of my head: could you wrap the application so that it would create an actual SSH tunnel from localhost to your server, and use that for ? | Assuming you are talking about a web based application. What you are really looking for is X.509 Client certificates (1.3.6.1.5.5.7.3.2). This will allow you to identify a user individually to your application.
These face the same issues that are usually faced when looking at key distribution. Which is generally consi... |
31,906,170 | Let's say I want to set up a poor man's authentication scheme for a simple network service.
I don't want to bother with username/password authentication, for simplicity I just want to have a list of public keys in my application and anyone who can prove they are the owner of that key can use my service.
For the purpo... | 2015/08/09 | [
"https://Stackoverflow.com/questions/31906170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357024/"
] | If you just have a list of users that can use your application and you have no need to see who did what.
You can setup your server so that it listens only on localhost (127.1) rather than 0.0.0.0, and provide a restricted sshd, forwarding the port required to connect to the application
`~/.ssh/authorized_keys` will p... | A dirty hack from top of my head: could you wrap the application so that it would create an actual SSH tunnel from localhost to your server, and use that for ? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.