qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
12,073,416 | I have a string (confirm to be of decimal expression)
0.4351242134
I want to convert to a string with two decimal place
0.44
How should I do in C#? | 2012/08/22 | [
"https://Stackoverflow.com/questions/12073416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1497720/"
] | ```
var d = decimal.Parse("0.4351242134");
Console.WriteLine(decimal.Round(d, 2));
``` | ```
Convert.ToDecimal(Value).ToString("N2")
``` |
12,073,416 | I have a string (confirm to be of decimal expression)
0.4351242134
I want to convert to a string with two decimal place
0.44
How should I do in C#? | 2012/08/22 | [
"https://Stackoverflow.com/questions/12073416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1497720/"
] | ```
float myNumber = float.Parse("0.4351242134");
Console.WriteLine(string.Format("{0:f2}", myNumber ));
```
<https://msdn.microsoft.com/en-us/library/s8s7t687.aspx> | Would this help
```
double ValBefore= 0.4351242134;
double ValAfter= Math.Round(ValBefore, 2, MidpointRounding.AwayFromZero); //Rounds"up"
``` |
12,073,416 | I have a string (confirm to be of decimal expression)
0.4351242134
I want to convert to a string with two decimal place
0.44
How should I do in C#? | 2012/08/22 | [
"https://Stackoverflow.com/questions/12073416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1497720/"
] | ```
float f = float.Parse("0.4351242134");
Console.WriteLine(string.Format("{0:0.00}", f));
```
See [this](http://www.csharp-examples.net/string-format-double/) for string.Format. | Would this help
```
double ValBefore= 0.4351242134;
double ValAfter= Math.Round(ValBefore, 2, MidpointRounding.AwayFromZero); //Rounds"up"
``` |
12,073,416 | I have a string (confirm to be of decimal expression)
0.4351242134
I want to convert to a string with two decimal place
0.44
How should I do in C#? | 2012/08/22 | [
"https://Stackoverflow.com/questions/12073416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1497720/"
] | Well I would do:
```
var d = "0.4351242134";
Console.WriteLine(decimal.Parse(d).ToString("N2"));
``` | First, you must parse using a culture or you may loose the decimals.
Next, you must have a text result to have a fixed count of decimals.
Finally, you round to two decimals, but `ToString()` can do that for you, thus:
```cs
string amount5 = "2.509"; // should be parsed as 2.51
decimal decimalValue = Decimal.Parse(amo... |
12,073,416 | I have a string (confirm to be of decimal expression)
0.4351242134
I want to convert to a string with two decimal place
0.44
How should I do in C#? | 2012/08/22 | [
"https://Stackoverflow.com/questions/12073416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1497720/"
] | ```
var probablyDecimalString = "0.4351242134";
decimal value;
if (Decimal.TryParse(probablyDecimalString , out value))
Console.WriteLine ( value.ToString("0.##") );
else
Console.WriteLine ("not a Decimal");
``` | Well I would do:
```
var d = "0.4351242134";
Console.WriteLine(decimal.Parse(d).ToString("N2"));
``` |
17,925,591 | I am getting linker errors and can not make out the source of the problem. I hope you can help me! The error occurs already when creating an object of the class `ClMyClass`.
The two errors:
```
Error 18 error LNK2019: unresolved external symbol "public: virtual __thiscall ClMyClass::~ClMyClass(void)" (??1ClMyClass... | 2013/07/29 | [
"https://Stackoverflow.com/questions/17925591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338476/"
] | You haven't defined the constructor and destructor that you declared in your class `ClMyClass`.
```
ClMyClass::ClMyClass(){
//implementation
}
ClMyClass::~ClMyClass(){
//implementation
}
```
That's usually done in a separate `.cpp` file that contains all the class' member functions' implementations. | In your implementation you have not implement the virtual functions. If you use virtual functions, then you must implement all functions which are virtual, even if you don't use them. Otherwise the linker will have the unresolved symbol error you are seeing.
If a function is not used in a class, then will not get an e... |
45,232,825 | After normal run the ./startFabric.sh(it shows as follow ):
```
2017-07-21 07:47:37.477 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO
00a Chaincode invoke successful. result: status:200
2017-07-21 07:47:37.477 UTC [main] main -> INFO 00b Exiting.....
Total execution time : 364 secs ...
```
Then I try to run `np... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45232825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7783401/"
] | It looks like you don't have all the required pieces for npm to work on Windows.
Try to do a "npm install --global windows-build-tools" and once this is done, rerun "npm install".
For more info, see <https://www.npmjs.com/package/windows-build-tools>
Arnaud | In my case, I did
>
> $ npm update
>
>
>
This should include fabric-client@1.1.2 (at DateTime.Now = Jun/09/2018) |
45,232,825 | After normal run the ./startFabric.sh(it shows as follow ):
```
2017-07-21 07:47:37.477 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO
00a Chaincode invoke successful. result: status:200
2017-07-21 07:47:37.477 UTC [main] main -> INFO 00b Exiting.....
Total execution time : 364 secs ...
```
Then I try to run `np... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45232825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7783401/"
] | It looks like you don't have all the required pieces for npm to work on Windows.
Try to do a "npm install --global windows-build-tools" and once this is done, rerun "npm install".
For more info, see <https://www.npmjs.com/package/windows-build-tools>
Arnaud | Fabric client and Fabric CA client packages are needed to run this, which you have to install by "npm install" in the folder, if this operation is unsuccessful, remove the node\_modules folder and then reinstall it , you can use "rm -rf node\_modules" to remove it. |
45,232,825 | After normal run the ./startFabric.sh(it shows as follow ):
```
2017-07-21 07:47:37.477 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO
00a Chaincode invoke successful. result: status:200
2017-07-21 07:47:37.477 UTC [main] main -> INFO 00b Exiting.....
Total execution time : 364 secs ...
```
Then I try to run `np... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45232825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7783401/"
] | It looks like you don't have all the required pieces for npm to work on Windows.
Try to do a "npm install --global windows-build-tools" and once this is done, rerun "npm install".
For more info, see <https://www.npmjs.com/package/windows-build-tools>
Arnaud | I had the same problem on mac and I had to re-install the xcode tools
```
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
``` |
45,232,825 | After normal run the ./startFabric.sh(it shows as follow ):
```
2017-07-21 07:47:37.477 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO
00a Chaincode invoke successful. result: status:200
2017-07-21 07:47:37.477 UTC [main] main -> INFO 00b Exiting.....
Total execution time : 364 secs ...
```
Then I try to run `np... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45232825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7783401/"
] | It looks like you don't have all the required pieces for npm to work on Windows.
Try to do a "npm install --global windows-build-tools" and once this is done, rerun "npm install".
For more info, see <https://www.npmjs.com/package/windows-build-tools>
Arnaud | ```
rm package-lock.json
rm -rf node_modules
npm install
```
That should fix issue and install all packages. |
45,232,825 | After normal run the ./startFabric.sh(it shows as follow ):
```
2017-07-21 07:47:37.477 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO
00a Chaincode invoke successful. result: status:200
2017-07-21 07:47:37.477 UTC [main] main -> INFO 00b Exiting.....
Total execution time : 364 secs ...
```
Then I try to run `np... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45232825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7783401/"
] | In my case, I did
>
> $ npm update
>
>
>
This should include fabric-client@1.1.2 (at DateTime.Now = Jun/09/2018) | Fabric client and Fabric CA client packages are needed to run this, which you have to install by "npm install" in the folder, if this operation is unsuccessful, remove the node\_modules folder and then reinstall it , you can use "rm -rf node\_modules" to remove it. |
45,232,825 | After normal run the ./startFabric.sh(it shows as follow ):
```
2017-07-21 07:47:37.477 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO
00a Chaincode invoke successful. result: status:200
2017-07-21 07:47:37.477 UTC [main] main -> INFO 00b Exiting.....
Total execution time : 364 secs ...
```
Then I try to run `np... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45232825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7783401/"
] | In my case, I did
>
> $ npm update
>
>
>
This should include fabric-client@1.1.2 (at DateTime.Now = Jun/09/2018) | I had the same problem on mac and I had to re-install the xcode tools
```
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
``` |
45,232,825 | After normal run the ./startFabric.sh(it shows as follow ):
```
2017-07-21 07:47:37.477 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO
00a Chaincode invoke successful. result: status:200
2017-07-21 07:47:37.477 UTC [main] main -> INFO 00b Exiting.....
Total execution time : 364 secs ...
```
Then I try to run `np... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45232825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7783401/"
] | In my case, I did
>
> $ npm update
>
>
>
This should include fabric-client@1.1.2 (at DateTime.Now = Jun/09/2018) | ```
rm package-lock.json
rm -rf node_modules
npm install
```
That should fix issue and install all packages. |
45,232,825 | After normal run the ./startFabric.sh(it shows as follow ):
```
2017-07-21 07:47:37.477 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO
00a Chaincode invoke successful. result: status:200
2017-07-21 07:47:37.477 UTC [main] main -> INFO 00b Exiting.....
Total execution time : 364 secs ...
```
Then I try to run `np... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45232825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7783401/"
] | Fabric client and Fabric CA client packages are needed to run this, which you have to install by "npm install" in the folder, if this operation is unsuccessful, remove the node\_modules folder and then reinstall it , you can use "rm -rf node\_modules" to remove it. | I had the same problem on mac and I had to re-install the xcode tools
```
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
``` |
45,232,825 | After normal run the ./startFabric.sh(it shows as follow ):
```
2017-07-21 07:47:37.477 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO
00a Chaincode invoke successful. result: status:200
2017-07-21 07:47:37.477 UTC [main] main -> INFO 00b Exiting.....
Total execution time : 364 secs ...
```
Then I try to run `np... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45232825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7783401/"
] | Fabric client and Fabric CA client packages are needed to run this, which you have to install by "npm install" in the folder, if this operation is unsuccessful, remove the node\_modules folder and then reinstall it , you can use "rm -rf node\_modules" to remove it. | ```
rm package-lock.json
rm -rf node_modules
npm install
```
That should fix issue and install all packages. |
31,601,411 | **Context:**
I am current learning c/c++ compiling on my raspberry pi b+ model (started last week), but having trouble using a header file inside a object file.
---
**File locations:**
main.cpp - ~/src/c++/projects/web\_server
http\_socket.o - ~/src/c++/web
---
**g++ output for `g++ -o webserver ~/src/c++/web/ht... | 2015/07/24 | [
"https://Stackoverflow.com/questions/31601411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4894154/"
] | >
> Why does modifying data member through the reference member in the child class works, but not directly?
>
>
>
Because you're not modifying the reference. `const` in C++ isn't logical `const`, it's more like bitwise `const`. When you do:
```
w.x = 100;
```
You're not actually modifying `w.x`, so that's allo... | >
> Why does modifying data member through the reference member in the child class works, but not directly?
>
>
>
Why it does not work directly is pretty obvious, your try to modify const object. Why it does let you modify reference is pretty obvious too - you are not modifying state of the object, but modifying s... |
31,601,411 | **Context:**
I am current learning c/c++ compiling on my raspberry pi b+ model (started last week), but having trouble using a header file inside a object file.
---
**File locations:**
main.cpp - ~/src/c++/projects/web\_server
http\_socket.o - ~/src/c++/web
---
**g++ output for `g++ -o webserver ~/src/c++/web/ht... | 2015/07/24 | [
"https://Stackoverflow.com/questions/31601411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4894154/"
] | >
> Why does modifying data member through the reference member in the child class works, but not directly?
>
>
>
Because you're not modifying the reference. `const` in C++ isn't logical `const`, it's more like bitwise `const`. When you do:
```
w.x = 100;
```
You're not actually modifying `w.x`, so that's allo... | `w` is declared as `const`. `const` does not apply to the referenced member (or pointer in case of a pointer).
This is less clear with a reference since a `float& const` is not allowed, just because you can't reassign a reference (so you can consider it `& const` by default).
But with a pointer is clearer to understa... |
31,601,411 | **Context:**
I am current learning c/c++ compiling on my raspberry pi b+ model (started last week), but having trouble using a header file inside a object file.
---
**File locations:**
main.cpp - ~/src/c++/projects/web\_server
http\_socket.o - ~/src/c++/web
---
**g++ output for `g++ -o webserver ~/src/c++/web/ht... | 2015/07/24 | [
"https://Stackoverflow.com/questions/31601411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4894154/"
] | `w` is declared as `const`. `const` does not apply to the referenced member (or pointer in case of a pointer).
This is less clear with a reference since a `float& const` is not allowed, just because you can't reassign a reference (so you can consider it `& const` by default).
But with a pointer is clearer to understa... | >
> Why does modifying data member through the reference member in the child class works, but not directly?
>
>
>
Why it does not work directly is pretty obvious, your try to modify const object. Why it does let you modify reference is pretty obvious too - you are not modifying state of the object, but modifying s... |
38,200,373 | I attached DataTable to one of my tables in application:
```
var productList = $("#productList").DataTable({});
```
Unfortunately it completely reorganized my table. It changed the way it looked and added some more unnecessary (for now) buttons.
I need only one particular feature of DataTables for now - KeyTable. I... | 2016/07/05 | [
"https://Stackoverflow.com/questions/38200373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1804027/"
] | You can do it like this:
```
var table = $('#example').DataTable({
dom: 't',
ordering: false,
paging: false,
keys: true, //enable KeyTable extension
});
```
The [`dom` option](https://datatables.net/reference/option/dom) is an easy way to enable/disable certain functionality. I've disabled `ordering... | You can set the default properties like this. You can remove the unnecessary properties by setting false.
```
$.extend( true, $.fn.dataTable.defaults, {
"searching": false,
"ordering": false
} );
$(document).ready(function() {
$('#example').DataTable();
});
``` |
22,325,374 | How can you use multiple config files on Spinx Search (preferably by including one inside another)? I need it for different environments, because the only difference between development, stage and production is the database credentials. Is there an easy way to achieve this? | 2014/03/11 | [
"https://Stackoverflow.com/questions/22325374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1399387/"
] | On linux, can use dymamic config files.
ie the config file can be executed by arbitary parsers. So the config file could be a PHP, perl or even shell script.
<http://sphinxsearch.com/blog/2013/11/05/sphinx-configuration-features-and-tricks/>
More: <https://www.google.com/search?q=sphinx+search+shebang> | An old question, but still worth leaving an answer in case it helps...
**indexes.conf**
```
#!/bin/sh
my_function() {
cat << EOF
source source_$1 {
type = csvpipe
csvpipe_delimiter = |
csvpipe_command = cat /input/data_file_$1.txt
csvpipe_field_string = product_name
csvpipe_attr_string = sku
... |
18,429,516 | I'm developing an application where I have one activity and many view subclasses.
When I need to change the view I'm calling a loading screen (which is another view class) and load the new view on a separate thread (using runnable) and when it's ready I'm setting the view with `SetContentView` function.
Now the proble... | 2013/08/25 | [
"https://Stackoverflow.com/questions/18429516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2448395/"
] | Here is how I would do in JS:
```
times=['00:05:00', '00:09:15', '01:13:15'];
```
1. First get seconds
```
function getsec(time){
arr=time.split(':');
return (+arr[0])*3600 + (+arr[1])*60 + (+arr[2]);
}
times.map(getsec)
[ 300, 555, 4395 ]
```
2. Then filter times into slots of particular time period
```
fun... | Simplest way would be for you to convert everything into seconds, and then do your thing.
```
inSeconds = function(time) {
var secs, arr = [];
arr = time.split(':').map(function(item) { return parseInt(item) });
secs = arr[0]*3600 + arr[1]*60 + arr[2];
return secs;
}
``` |
200,980 | I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be used to make objects or be used in inheritance.
Like for example I can have an animal class and then from that inherit cat... | 2013/06/09 | [
"https://softwareengineering.stackexchange.com/questions/200980",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/91470/"
] | Many functional languages have a module system. (Many object-oriented languages do too, by the way.) But even in the absence of one, you can use functions as modules.
JavaScript is a good example. In JavaScript, functions are used both to implement modules and even object-oriented encapsulation. In Scheme, which was t... | It looks like you're asking two questions: "How can you achieve modularity in functional languages?" which has been dealt with in other answers and "how can you create abstractions in functional languages?" which I'll answer.
In OO languages, you tend to concentrate on the noun, "an animal", "the mailserver", "his gar... |
200,980 | I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be used to make objects or be used in inheritance.
Like for example I can have an animal class and then from that inherit cat... | 2013/06/09 | [
"https://softwareengineering.stackexchange.com/questions/200980",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/91470/"
] | It looks like you're asking two questions: "How can you achieve modularity in functional languages?" which has been dealt with in other answers and "how can you create abstractions in functional languages?" which I'll answer.
In OO languages, you tend to concentrate on the noun, "an animal", "the mailserver", "his gar... | Actually, OO code is far less reusable, and that's by design. The idea behind OOP is to restrict operations on particular pieces of data to certain privileged code that's either in the class or in the appropriate place in the inheritance hierarchy. This limits the adverse effects of mutability. If a data structure chan... |
200,980 | I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be used to make objects or be used in inheritance.
Like for example I can have an animal class and then from that inherit cat... | 2013/06/09 | [
"https://softwareengineering.stackexchange.com/questions/200980",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/91470/"
] | Actually, OO code is far less reusable, and that's by design. The idea behind OOP is to restrict operations on particular pieces of data to certain privileged code that's either in the class or in the appropriate place in the inheritance hierarchy. This limits the adverse effects of mutability. If a data structure chan... | One of popular solutions, is to break code into modules, here is how it's done in JavaScript:
```
media.podcast = (function(name) {
var fileExtension = 'mp3';
function determineFileExtension() {
console.log('File extension is of type ' + fileExtension);
}
return {
dow... |
200,980 | I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be used to make objects or be used in inheritance.
Like for example I can have an animal class and then from that inherit cat... | 2013/06/09 | [
"https://softwareengineering.stackexchange.com/questions/200980",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/91470/"
] | Although "functional programming" does not convey far reaching implications for issues of modularity, particular languages address programming-in-the-large in different ways. Code reuse and abstraction interact in that the less you expose the harder it is to reuse the code. Putting abstraction aside, I'll address two i... | One of popular solutions, is to break code into modules, here is how it's done in JavaScript:
```
media.podcast = (function(name) {
var fileExtension = 'mp3';
function determineFileExtension() {
console.log('File extension is of type ' + fileExtension);
}
return {
dow... |
200,980 | I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be used to make objects or be used in inheritance.
Like for example I can have an animal class and then from that inherit cat... | 2013/06/09 | [
"https://softwareengineering.stackexchange.com/questions/200980",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/91470/"
] | Many functional languages have a module system. (Many object-oriented languages do too, by the way.) But even in the absence of one, you can use functions as modules.
JavaScript is a good example. In JavaScript, functions are used both to implement modules and even object-oriented encapsulation. In Scheme, which was t... | Although "functional programming" does not convey far reaching implications for issues of modularity, particular languages address programming-in-the-large in different ways. Code reuse and abstraction interact in that the less you expose the harder it is to reuse the code. Putting abstraction aside, I'll address two i... |
200,980 | I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be used to make objects or be used in inheritance.
Like for example I can have an animal class and then from that inherit cat... | 2013/06/09 | [
"https://softwareengineering.stackexchange.com/questions/200980",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/91470/"
] | Actually, OO code is far less reusable, and that's by design. The idea behind OOP is to restrict operations on particular pieces of data to certain privileged code that's either in the class or in the appropriate place in the inheritance hierarchy. This limits the adverse effects of mutability. If a data structure chan... | Modularity is designing so that things can be taken apart and put back together, sometimes substituting new parts for old ones.
OOP defines stateful objects and so modularity can include aggregation (building one object from several) and/or coordination (allowing collaboration via message passing). This will necessita... |
200,980 | I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be used to make objects or be used in inheritance.
Like for example I can have an animal class and then from that inherit cat... | 2013/06/09 | [
"https://softwareengineering.stackexchange.com/questions/200980",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/91470/"
] | Many functional languages have a module system. (Many object-oriented languages do too, by the way.) But even in the absence of one, you can use functions as modules.
JavaScript is a good example. In JavaScript, functions are used both to implement modules and even object-oriented encapsulation. In Scheme, which was t... | Actually, OO code is far less reusable, and that's by design. The idea behind OOP is to restrict operations on particular pieces of data to certain privileged code that's either in the class or in the appropriate place in the inheritance hierarchy. This limits the adverse effects of mutability. If a data structure chan... |
200,980 | I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be used to make objects or be used in inheritance.
Like for example I can have an animal class and then from that inherit cat... | 2013/06/09 | [
"https://softwareengineering.stackexchange.com/questions/200980",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/91470/"
] | Modularity is designing so that things can be taken apart and put back together, sometimes substituting new parts for old ones.
OOP defines stateful objects and so modularity can include aggregation (building one object from several) and/or coordination (allowing collaboration via message passing). This will necessita... | One of popular solutions, is to break code into modules, here is how it's done in JavaScript:
```
media.podcast = (function(name) {
var fileExtension = 'mp3';
function determineFileExtension() {
console.log('File extension is of type ' + fileExtension);
}
return {
dow... |
200,980 | I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be used to make objects or be used in inheritance.
Like for example I can have an animal class and then from that inherit cat... | 2013/06/09 | [
"https://softwareengineering.stackexchange.com/questions/200980",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/91470/"
] | Although "functional programming" does not convey far reaching implications for issues of modularity, particular languages address programming-in-the-large in different ways. Code reuse and abstraction interact in that the less you expose the harder it is to reuse the code. Putting abstraction aside, I'll address two i... | Actually, OO code is far less reusable, and that's by design. The idea behind OOP is to restrict operations on particular pieces of data to certain privileged code that's either in the class or in the appropriate place in the inheritance hierarchy. This limits the adverse effects of mutability. If a data structure chan... |
200,980 | I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be used to make objects or be used in inheritance.
Like for example I can have an animal class and then from that inherit cat... | 2013/06/09 | [
"https://softwareengineering.stackexchange.com/questions/200980",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/91470/"
] | Many functional languages have a module system. (Many object-oriented languages do too, by the way.) But even in the absence of one, you can use functions as modules.
JavaScript is a good example. In JavaScript, functions are used both to implement modules and even object-oriented encapsulation. In Scheme, which was t... | Modularity is designing so that things can be taken apart and put back together, sometimes substituting new parts for old ones.
OOP defines stateful objects and so modularity can include aggregation (building one object from several) and/or coordination (allowing collaboration via message passing). This will necessita... |
109,920 | In my previous game, I was moving my sprite like so:
```
float time = 10f; //Number of seconds to pass a pre-defined area (using the screen width in this example)
float velocity = 1f/time; //work out velocity based on above time
float realX-=velocity*dt; //Move the sprite to the left (where dt is previously defined d... | 2015/10/19 | [
"https://gamedev.stackexchange.com/questions/109920",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/22241/"
] | If I understand properly, you are approximating your physics calculations perhaps too much. When making non-representative physics calculations, it makes it very challenging to keep things straight, and causes problems down the road if you build off them.
When you compute position in a game, you do so by multiplying v... | By looking at the code, I think all you need to do is to take the sign of the variable `tilt`, instead of taking its actual value, to achieve the equivalent of your touch based code. So change your `onSensorChanged` listener to this
```
@Override
public void onSensorChanged(SensorEvent event){
tilt = event.values... |
147,774 | If I’m designing icons/images in native iPhone 5 resolution, what @x multiple do I need to export them at for iPhone 6+? Just use @2x? That’s too big right? Example: an icon is 44px x 44px. If I export at @2x it’s 88px. That’s too large for 6+ right? What’s the right multiple or ratio from 5 to 6+.
In the past, from n... | 2014/09/30 | [
"https://apple.stackexchange.com/questions/147774",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/86800/"
] | Ricardo is correct in his answer of @3x, but I'll take a shot at answering your question as well.
If you're working from Retina resolution assets already, the upscale factor would be an additional 1.5x for the iPhone 6 Plus.
For example, your 88px by 88px Retina icon would have to be up-scaled to a resolution one and... | Check this chart : <https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/iconmatrix.html>
So for your answer iPhone 6 Plus is @3x |
61,138,660 | I am trying to parse a webpage with bs4 but the elements I am trying to access all have different class names.
Example: class='list-item listing … id-12984' and class='list-item listing … id-10359'
```
def preownedaston(url):
preownedaston_resp = requests.get(url)
if preownedaston_resp.status_code == 200:
... | 2020/04/10 | [
"https://Stackoverflow.com/questions/61138660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12654469/"
] | Css Selector for matching a partial value of a certain attribute is as follows :
```
div[class*='list-item'] # the * means match the class with this partial value
```
But if you look at the source code of the page you will see that the content you are trying to scrape is being generated by Javascript So you have th... | The information from this URL actually comes back in JSON format which means you can easily extract the fields you want. For example:
```
import requests
url = "https://preowned.astonmartin.com/ajax/stock-listing/get-items/pageId/3760/ratio/3_2/taxBandImageLink/aHR0cHM6Ly9kMnBwMTFwZ29wNWY2cC5jbG91ZGZyb250Lm5ldC9UYXhC... |
9,822,873 | Is it possible somehow to pass through the keepalive limitation of uwsgi? If not, what is the best way of persistent connection implementation. I'm using NGiNX + uWSGI (Python), and I want clients to have asynchronous updates from server. | 2012/03/22 | [
"https://Stackoverflow.com/questions/9822873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1285467/"
] | UWSGI supports keep-alive via --http-keepalive option if you receive requests via http.
```
/tmp$ cat app.py
def application(env, start_response):
content = b"Hello World"
start_response('200 OK', [
('Content-Type','text/html'),
('Content-Length', str(len(content))),
])
return [content]... | You are talking about two different things. If you want persistent connections from your clients to your app, you may want to use async modes (via ugreen, gevent...). In that way you will be able to maintain thousand of concurrent connections. Keepalive is a way to route multiple requests to the same connections, but t... |
15,102,680 | I am trying to redirect stdout to a socket. I do something like this:
```
dup2(new_fd, STDOUT_FILENO);
```
After doing so all `stdio` functions writing to the stdout fail. I have tried to reopen stdout this way:
```
fclose(stdout);
stdout = fdopen(STDOUT_FILENO, "wb");
```
But `printf` and other functions still d... | 2013/02/27 | [
"https://Stackoverflow.com/questions/15102680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766545/"
] | Here you go, it doesn't handle everything but should be sufficient.
```
Ext.define('HideColumnIfEmpty', {
extend: 'Ext.AbstractPlugin',
alias: 'plugin.hideColumnIfEmpty',
mixins: {
bindable: 'Ext.util.Bindable'
},
init: function(grid) {
this.grid = grid;
this._initStates()... | If you want to iterate over the store, you need to put a listener on the `load` event of your store. The beforerender doesn't mean that your store is already loaded.
I would put the creation of you store in the initComponent. Something like this:
```
Ext.define('com.abc.MyGrid', {
extend: 'Ext.grid.Panel',
co... |
37,614,826 | I am new to coding in NinjaTrader. I am trying to draw a dot beneath bars based on a condition being true.
if I make my condition as simple as possible, like this:
```
if (Close[0] < Open[0])
```
-- I can get the dots to display correctly.
But, if I try to refer to previous bars, like this:
```
if (Close[0] < O... | 2016/06/03 | [
"https://Stackoverflow.com/questions/37614826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2904588/"
] | In case anybody else has a need for this information, it requires a check for enough bars in the data series you are accessing.
I don't know whether posting external links is permitted, so I'll assume it is not. A Google search should find the info.
I had to amend the code as below.
```
protected override void OnBar... | For these cases, you can just create the code using the Strategy Builder. I did that and this is what I got:
```
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// Set 1
if (Close[1] > Open[1])
{
Draw.Dot(this, @"Temp01 Dot_1", false, 0, 3, Brushes.Cornf... |
37,614,826 | I am new to coding in NinjaTrader. I am trying to draw a dot beneath bars based on a condition being true.
if I make my condition as simple as possible, like this:
```
if (Close[0] < Open[0])
```
-- I can get the dots to display correctly.
But, if I try to refer to previous bars, like this:
```
if (Close[0] < O... | 2016/06/03 | [
"https://Stackoverflow.com/questions/37614826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2904588/"
] | In case anybody else has a need for this information, it requires a check for enough bars in the data series you are accessing.
I don't know whether posting external links is permitted, so I'll assume it is not. A Google search should find the info.
I had to amend the code as below.
```
protected override void OnBar... | In addition to the above answers, with which I agree, I like to include this in the top of my method as well:
```
protected override void OnBarUpdate()
{
CandleState candleState = CandleState.HistoricalClosed;
if (Bars.Count - 1 == CurrentBar)
{
if (State != State.Historical)
{
... |
48,289,144 | I'm creating a mailchimp signup form, following [this documentation.](https://kb.mailchimp.com/lists/signup-forms/design-and-host-your-own-thank-you-pages) I'm hosting my own signup form, so I'm specifying that URL here:
[](https://i.stack.imgur.com/h... | 2018/01/16 | [
"https://Stackoverflow.com/questions/48289144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3852890/"
] | Your request has `<input name='radio'>` so you'll want to find the request with that, like so:
```
public function add_profil(Request $request)
{
$profil = new Profil();
if($request->radio == 'adminitrator'){
$profil->adminitrator = 1;
$profil->moder... | You're getting wrong name in laravel, change form to this:
```
public function add_profil(Request $request)
{
$profil = new Profil();
if($request->administrator == 'checked'){
$profil->adminitrator = 1;
$profil->moderator = 0;
}
... |
48,289,144 | I'm creating a mailchimp signup form, following [this documentation.](https://kb.mailchimp.com/lists/signup-forms/design-and-host-your-own-thank-you-pages) I'm hosting my own signup form, so I'm specifying that URL here:
[](https://i.stack.imgur.com/h... | 2018/01/16 | [
"https://Stackoverflow.com/questions/48289144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3852890/"
] | When the request has been sent, you get inputs with their names. so your radio buttons have the name 'radio'. So you should check the request with that input name, not the value of the input.
I recommend you fetch the requests with request->all() method and set it to a variable $request. This way you can treat request... | You're getting wrong name in laravel, change form to this:
```
public function add_profil(Request $request)
{
$profil = new Profil();
if($request->administrator == 'checked'){
$profil->adminitrator = 1;
$profil->moderator = 0;
}
... |
23,166,312 | How can I do it so that when I run this query.
```
SELECT distinct cus_areacode AS "Area Code", cus_code AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;
```
instead of showing the following.
```
Area Code Number
713 10015
713 10018
615 10019
615 10017
713 ... | 2014/04/19 | [
"https://Stackoverflow.com/questions/23166312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190122/"
] | Try this
```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER
WHERE cus_areacode IN(713,615)
GROUP BY cus_areacode;
```
OR:
```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615
GROUP BY cus_areacode;
```
**[F... | ```
SELECT areacode,count(cus_code) FROM CUSTOMER GROUP BY areacode
``` |
23,166,312 | How can I do it so that when I run this query.
```
SELECT distinct cus_areacode AS "Area Code", cus_code AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;
```
instead of showing the following.
```
Area Code Number
713 10015
713 10018
615 10019
615 10017
713 ... | 2014/04/19 | [
"https://Stackoverflow.com/questions/23166312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190122/"
] | Try this
```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER
WHERE cus_areacode IN(713,615)
GROUP BY cus_areacode;
```
OR:
```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615
GROUP BY cus_areacode;
```
**[F... | ```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number" FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615
GROUP BY cus_areacode;
``` |
23,166,312 | How can I do it so that when I run this query.
```
SELECT distinct cus_areacode AS "Area Code", cus_code AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;
```
instead of showing the following.
```
Area Code Number
713 10015
713 10018
615 10019
615 10017
713 ... | 2014/04/19 | [
"https://Stackoverflow.com/questions/23166312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190122/"
] | ***you need this:***
First of all I appreciate to tried query, your going right way, And almost got it you should just ***`remove the distinct`*** and ***`add the Group By`*** your area code.
And they ***`distinct`*** mean its In a table, a column may contain many duplicate values; and sometimes you only want to list... | ```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number" FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615
GROUP BY cus_areacode;
``` |
23,166,312 | How can I do it so that when I run this query.
```
SELECT distinct cus_areacode AS "Area Code", cus_code AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;
```
instead of showing the following.
```
Area Code Number
713 10015
713 10018
615 10019
615 10017
713 ... | 2014/04/19 | [
"https://Stackoverflow.com/questions/23166312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190122/"
] | Try this
```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER
WHERE cus_areacode IN(713,615)
GROUP BY cus_areacode;
```
OR:
```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615
GROUP BY cus_areacode;
```
**[F... | try this:
```
select * from
(
select cus_areacode , cus_code
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615
) tempalias
group by cus_areacode
``` |
23,166,312 | How can I do it so that when I run this query.
```
SELECT distinct cus_areacode AS "Area Code", cus_code AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;
```
instead of showing the following.
```
Area Code Number
713 10015
713 10018
615 10019
615 10017
713 ... | 2014/04/19 | [
"https://Stackoverflow.com/questions/23166312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190122/"
] | ```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER GROUP BY cus_areacode
``` | ```
SELECT areacode,count(cus_code) FROM CUSTOMER GROUP BY areacode
``` |
23,166,312 | How can I do it so that when I run this query.
```
SELECT distinct cus_areacode AS "Area Code", cus_code AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;
```
instead of showing the following.
```
Area Code Number
713 10015
713 10018
615 10019
615 10017
713 ... | 2014/04/19 | [
"https://Stackoverflow.com/questions/23166312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190122/"
] | ```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER GROUP BY cus_areacode
``` | ```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number" FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615
GROUP BY cus_areacode;
``` |
23,166,312 | How can I do it so that when I run this query.
```
SELECT distinct cus_areacode AS "Area Code", cus_code AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;
```
instead of showing the following.
```
Area Code Number
713 10015
713 10018
615 10019
615 10017
713 ... | 2014/04/19 | [
"https://Stackoverflow.com/questions/23166312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190122/"
] | ***you need this:***
First of all I appreciate to tried query, your going right way, And almost got it you should just ***`remove the distinct`*** and ***`add the Group By`*** your area code.
And they ***`distinct`*** mean its In a table, a column may contain many duplicate values; and sometimes you only want to list... | try this:
```
select * from
(
select cus_areacode , cus_code
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615
) tempalias
group by cus_areacode
``` |
23,166,312 | How can I do it so that when I run this query.
```
SELECT distinct cus_areacode AS "Area Code", cus_code AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;
```
instead of showing the following.
```
Area Code Number
713 10015
713 10018
615 10019
615 10017
713 ... | 2014/04/19 | [
"https://Stackoverflow.com/questions/23166312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190122/"
] | Try this
```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER
WHERE cus_areacode IN(713,615)
GROUP BY cus_areacode;
```
OR:
```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615
GROUP BY cus_areacode;
```
**[F... | ***you need this:***
First of all I appreciate to tried query, your going right way, And almost got it you should just ***`remove the distinct`*** and ***`add the Group By`*** your area code.
And they ***`distinct`*** mean its In a table, a column may contain many duplicate values; and sometimes you only want to list... |
23,166,312 | How can I do it so that when I run this query.
```
SELECT distinct cus_areacode AS "Area Code", cus_code AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;
```
instead of showing the following.
```
Area Code Number
713 10015
713 10018
615 10019
615 10017
713 ... | 2014/04/19 | [
"https://Stackoverflow.com/questions/23166312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190122/"
] | ```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER GROUP BY cus_areacode
``` | Try this
```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER
WHERE cus_areacode IN(713,615)
GROUP BY cus_areacode;
```
OR:
```
SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615
GROUP BY cus_areacode;
```
**[F... |
23,166,312 | How can I do it so that when I run this query.
```
SELECT distinct cus_areacode AS "Area Code", cus_code AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;
```
instead of showing the following.
```
Area Code Number
713 10015
713 10018
615 10019
615 10017
713 ... | 2014/04/19 | [
"https://Stackoverflow.com/questions/23166312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190122/"
] | ***you need this:***
First of all I appreciate to tried query, your going right way, And almost got it you should just ***`remove the distinct`*** and ***`add the Group By`*** your area code.
And they ***`distinct`*** mean its In a table, a column may contain many duplicate values; and sometimes you only want to list... | ```
SELECT areacode,count(cus_code) FROM CUSTOMER GROUP BY areacode
``` |
4,636,149 | I need a container (like array)for integers in such a way that given x and y and z ,which has to be inserted between x and y it will be possible to insert z between them.And given x and y ,get if x is placed left to the y. | 2011/01/08 | [
"https://Stackoverflow.com/questions/4636149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/466056/"
] | Do you mean like throwing a [NotSupportedException](http://msdn.microsoft.com/en-us/library/system.notsupportedexception.aspx)? By tautology, if you define that your operation will throw an exception or return a special value, your behavior was defined. If the specification says that behavior is undefined, then the imp... | I don't see how that other question applies. The operations *behave as documented* and have very useful semantics, even if initially seeming incorrect. I found the answer by Philip Rieck to be the most clear in the explanation of *why* it occurs. In either case, it's *not* undefined.
If there are "hints" or "warnings"... |
4,636,149 | I need a container (like array)for integers in such a way that given x and y and z ,which has to be inserted between x and y it will be possible to insert z between them.And given x and y ,get if x is placed left to the y. | 2011/01/08 | [
"https://Stackoverflow.com/questions/4636149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/466056/"
] | I don't see how that other question applies. The operations *behave as documented* and have very useful semantics, even if initially seeming incorrect. I found the answer by Philip Rieck to be the most clear in the explanation of *why* it occurs. In either case, it's *not* undefined.
If there are "hints" or "warnings"... | Well, in the case you cited, there *is* a well-defined standard, IEEE 754, and `Math.Max` adheres to it, while the implementation of `Enumerable.Max(this IEnumerable<double>)` does not. As for implementing code based upon a standard, the onus is always on the implementer. |
4,636,149 | I need a container (like array)for integers in such a way that given x and y and z ,which has to be inserted between x and y it will be possible to insert z between them.And given x and y ,get if x is placed left to the y. | 2011/01/08 | [
"https://Stackoverflow.com/questions/4636149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/466056/"
] | Do you mean like throwing a [NotSupportedException](http://msdn.microsoft.com/en-us/library/system.notsupportedexception.aspx)? By tautology, if you define that your operation will throw an exception or return a special value, your behavior was defined. If the specification says that behavior is undefined, then the imp... | Well, in the case you cited, there *is* a well-defined standard, IEEE 754, and `Math.Max` adheres to it, while the implementation of `Enumerable.Max(this IEnumerable<double>)` does not. As for implementing code based upon a standard, the onus is always on the implementer. |
7,270,160 | I have changed my default image (so instead of the black loading screen its a custom image). And i want this same image to be the background on my first UIView. I have made the navigation bar on this UIView hidden. However, when I set a background image of the view to the image of size 480x320, the one used in the defa... | 2011/09/01 | [
"https://Stackoverflow.com/questions/7270160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/836601/"
] | Set your view.frame to:
```
[[UIScreen mainScreen] bounds];
```
I think its using:
```
[[UIScreen mainScreen] applicationFrame]
```
Now =) | I was struggling with this as well. I did not hide/show the navigation bar. Instead, in IB for the ViewController which is shown after the Default.png splash page, I enabled the "Wants Full Screen" option on the Attributes Inspector. This stopped my identical default image from shifting downwards once the initial view ... |
2,539,069 | I have the following tag with a Html.TextBoxFor expression and I want the contents to be read only, is this possible?
```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action)%>
``` | 2010/03/29 | [
"https://Stackoverflow.com/questions/2539069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91729/"
] | Use the following:
```
@Html.TextBoxFor(m => m.Whatever, new {@readonly = "readonly"})
```
If you want to assign a class to it you could do it the same way , by adding the
@class = ""
property. Hope this helps :) | In fact the answer of Brain Mains is almost correct:
```
@Html.TextBoxFor(model => model.RIF, new { value = @Model.RIF, @readonly = true })
``` |
2,539,069 | I have the following tag with a Html.TextBoxFor expression and I want the contents to be read only, is this possible?
```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action)%>
``` | 2010/03/29 | [
"https://Stackoverflow.com/questions/2539069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91729/"
] | This work for me...
```
@Html.TextBoxFor(model => model.RIF, new { value = @Model.RIF, @readonly = "readonly" })
``` | In case if you have to apply your custom class you can use
```
@Html.TextBoxFor(m => m.Birthday, new Dictionary<string, object>() { {"readonly", "true"}, {"class", "commonField"} } )
```
Where are
**commonField** is CSS class
and **Birthday** could be string field that you probably can use to keep `jQuery Dat... |
2,539,069 | I have the following tag with a Html.TextBoxFor expression and I want the contents to be read only, is this possible?
```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action)%>
``` | 2010/03/29 | [
"https://Stackoverflow.com/questions/2539069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91729/"
] | The following snippet worked for me.
```
@Html.TextBoxFor(m => m.Crown, new { id = "", @style = "padding-left:5px", @readonly = "true" })
``` | Using the example of @Hunter, in the new { .. } part, add readonly = true, I think that will work. |
2,539,069 | I have the following tag with a Html.TextBoxFor expression and I want the contents to be read only, is this possible?
```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action)%>
``` | 2010/03/29 | [
"https://Stackoverflow.com/questions/2539069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91729/"
] | Updated for modern versions of .NET per @1c1cle's suggestion in a comment:
```
<%= Html.TextBoxFor(model => Model.SomeFieldName, new {{"readonly", "true"}}) %>
```
Do realize that this is not a "secure" way to do this as somebody can inject javascript to change this.
Something to be aware of is that if you set that... | To make it read only
```
@Html.TextBoxFor(m=> m.Total, new {@class ="form-control", @readonly="true"})
```
To diable
```
@Html.TextBoxFor(m=> m.Total, new {@class ="form-control", @disabled="true"})
``` |
2,539,069 | I have the following tag with a Html.TextBoxFor expression and I want the contents to be read only, is this possible?
```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action)%>
``` | 2010/03/29 | [
"https://Stackoverflow.com/questions/2539069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91729/"
] | Use the following:
```
@Html.TextBoxFor(m => m.Whatever, new {@readonly = "readonly"})
```
If you want to assign a class to it you could do it the same way , by adding the
@class = ""
property. Hope this helps :) | An other possibility :
```
<%= Html.TextBoxFor(model => Model.SomeFieldName, new Dictionary<string, object>(){{"disabled", "true"}}) %>
``` |
2,539,069 | I have the following tag with a Html.TextBoxFor expression and I want the contents to be read only, is this possible?
```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action)%>
``` | 2010/03/29 | [
"https://Stackoverflow.com/questions/2539069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91729/"
] | To make it read only
```
@Html.TextBoxFor(m=> m.Total, new {@class ="form-control", @readonly="true"})
```
To diable
```
@Html.TextBoxFor(m=> m.Total, new {@class ="form-control", @disabled="true"})
``` | The following snippet worked for me.
```
@Html.TextBoxFor(m => m.Crown, new { id = "", @style = "padding-left:5px", @readonly = "true" })
``` |
2,539,069 | I have the following tag with a Html.TextBoxFor expression and I want the contents to be read only, is this possible?
```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action)%>
``` | 2010/03/29 | [
"https://Stackoverflow.com/questions/2539069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91729/"
] | Updated for modern versions of .NET per @1c1cle's suggestion in a comment:
```
<%= Html.TextBoxFor(model => Model.SomeFieldName, new {{"readonly", "true"}}) %>
```
Do realize that this is not a "secure" way to do this as somebody can inject javascript to change this.
Something to be aware of is that if you set that... | The following snippet worked for me.
```
@Html.TextBoxFor(m => m.Crown, new { id = "", @style = "padding-left:5px", @readonly = "true" })
``` |
2,539,069 | I have the following tag with a Html.TextBoxFor expression and I want the contents to be read only, is this possible?
```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action)%>
``` | 2010/03/29 | [
"https://Stackoverflow.com/questions/2539069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91729/"
] | ```
<%: Html.TextBoxFor(m => Model.Events.Subscribed[i].Action, new { @autocomplete = "off", @readonly=true})%>
```
This is how you set multiple properties | You can also disabled TextBoxFor
```
@Html.TextBoxFor(x=>x.day, null, new { @class = "form-control success" ,@disabled="disabled" })
``` |
2,539,069 | I have the following tag with a Html.TextBoxFor expression and I want the contents to be read only, is this possible?
```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action)%>
``` | 2010/03/29 | [
"https://Stackoverflow.com/questions/2539069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91729/"
] | ```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action, new {readonly=true})%>
``` | ```
@Html.TextBoxFor(model => model.IdUsuario, new { @Value = "" + User.Identity.GetUserId() + "", @disabled = "true" })
@disabled = "true"
```
Work very well |
2,539,069 | I have the following tag with a Html.TextBoxFor expression and I want the contents to be read only, is this possible?
```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action)%>
``` | 2010/03/29 | [
"https://Stackoverflow.com/questions/2539069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91729/"
] | ```
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action, new { @readonly = true })%>
``` | In case if you have to apply your custom class you can use
```
@Html.TextBoxFor(m => m.Birthday, new Dictionary<string, object>() { {"readonly", "true"}, {"class", "commonField"} } )
```
Where are
**commonField** is CSS class
and **Birthday** could be string field that you probably can use to keep `jQuery Dat... |
10,468,326 | I'm trying to implement lazy loading on a blogger blog, but I'm running into some issues. The lazy load plugin in question is this one: <http://www.appelsiini.net/projects/lazyload>
So in the documentation, it says the images to be lazy-loaded should the the following html code format:
```
<img class="lazy" src="img/... | 2012/05/06 | [
"https://Stackoverflow.com/questions/10468326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/576589/"
] | You can switch to HTML view, then modify each img tag according to requirement of lazy load script. | You don't need to do all this you can use the below lazy load script created specially for blogger blogs
`<script type='text/javascript'>//<![CDATA[
(function(a){a.fn.lazyload=function(b){var c={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};if(b){a.extend(c,b)}var d=this;if("scroll"==c.even... |
10,468,326 | I'm trying to implement lazy loading on a blogger blog, but I'm running into some issues. The lazy load plugin in question is this one: <http://www.appelsiini.net/projects/lazyload>
So in the documentation, it says the images to be lazy-loaded should the the following html code format:
```
<img class="lazy" src="img/... | 2012/05/06 | [
"https://Stackoverflow.com/questions/10468326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/576589/"
] | You can switch to HTML view, then modify each img tag according to requirement of lazy load script. | You can use `loading='lazy'` in js function. |
47,958,901 | I want to make every first letter typed in a textarea be uppercase. But when I try this code, it doesn't work:
HTML
```
<textarea name="content" rows="18" placeholder="Your Message"
title="Give Your Advice To Us" wrap="soft"></textarea>
```
CSS
```
textarea::first-letter {
text-transform: uppercase;
}... | 2017/12/24 | [
"https://Stackoverflow.com/questions/47958901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6738162/"
] | You need a block container in order to use the `::first-letter` pseudo-element:
```
<p>
<textarea name="content" rows="18" placeholder="Your Message"
title="Give Your Advice To Us" wrap="soft"></textarea>
</p>
```
And your CSS:
```
p::first-letter {
text-transform: uppercase;
}
``` | A textarea cannot have a `::first-letter` pseudo-element. Only a block container can have such a pseudo-element, but due to its nature a textarea cannot be a block container and therefore you can't emulate this behavior with CSS.
Applying text transforms to form fields is generally never a good idea anyway. You're onl... |
47,228,210 | What's missing for the div to transition smoothly in and out of the pulse animation?
<https://jsfiddle.net/86gxLy2a/>
CSS
```
div {
width: 20px;
height: 20px;
border-radius: 10px;
border: 2px solid black;
transform: scale(.5);
transition: all .3s ease-in-out;
}
div:hover {
animation: pulse 1s infinite... | 2017/11/10 | [
"https://Stackoverflow.com/questions/47228210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6779450/"
] | You can delay the animation and scale up on hover
Update: Working smoothly in Chrome now as well. Only issue now is that the unpulse animation will run on page load.
```css
div {
width: 20px;
height: 20px;
border-radius: 10px;
border: 2px solid black;
-webkit-transform: scale(.5);
-moz-transform: sc... | Your div's scale needs to be equal to the animations initial scale to appear smooth
transform: scale(1); - DIV
transform: scale(1); - Animation first keyframe
```css
div {
width: 20px;
height: 20px;
border-radius: 10px;
border: 2px solid black;
transform: scale(1);
transition: all .3s ease-in-out;... |
5,927,473 | Using 'find' I'm planning to pass all files with a specific ending as an argument to a jar-file.
```
find $directory -type f -name "*.in"
```
Somehow this is supposed to happen:
java -jar MyJar-jar input.in
How can this be performed?
Thanks in Advance | 2011/05/08 | [
"https://Stackoverflow.com/questions/5927473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/743857/"
] | ```
find "$directory" -type f -name '*.in' -exec java -jar MyJar.jar {} \;
```
Replace `\;` with `+` if the application can take more than one file at a time as arguments. | ```
java -jar MyJar.jar `find $directory -type f -name "*.in"`
```
should do the trick. |
5,927,473 | Using 'find' I'm planning to pass all files with a specific ending as an argument to a jar-file.
```
find $directory -type f -name "*.in"
```
Somehow this is supposed to happen:
java -jar MyJar-jar input.in
How can this be performed?
Thanks in Advance | 2011/05/08 | [
"https://Stackoverflow.com/questions/5927473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/743857/"
] | ```
xargs -0 -a<(find $directory -type f -name '*.in' -print0) java -jar MyJar.jar
``` | ```
java -jar MyJar.jar `find $directory -type f -name "*.in"`
```
should do the trick. |
38,408,228 | I saw questions with similar problems, but when I tried to implement their responses I wasn't able to solve my problem.
Here is a snapshot of my landscape layout:
[](https://i.stack.imgur.com/hO8NE.png)
As you can see the bottom 'sticks' beyond scree... | 2016/07/16 | [
"https://Stackoverflow.com/questions/38408228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2912653/"
] | its because the `app:layout_behavior="@string/appbar_scrolling_view_behavior"` property if you will remove this then layout will stick on Toolbar.
To avoid this you need to set the static height to relative layout or wrapcontent! | I think the problem is that the coordinator layout in activity\_main.xml is having 2 children - the AppBarLayout and the included content\_screen.xml. The AppBarLayout has its layout\_height property set to wrap\_content as usual but the problem is **the layout\_height property of the content\_screen.xml which is set t... |
21,431,641 | This is my XML file
```
<?xml version="1.0" encoding="UTF-8"?>
<playerxml>
<config>
<player type="videoplayer" sessionId="" buffrTime="9" width="1024" height="768">
<xmlpath url="../config/interface_videoplayer.xml"/>
<preloadpath url="../presentation/nuggetplayer/preloader.... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21431641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1847560/"
] | You're right that [COW is disallowed](https://stackoverflow.com/q/12199710/560648). But GCC [hasn't updated its implementation yet](http://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html), allegedly [due to ABI constraints](https://stackoverflow.com/q/10463851/560648). A new implementation, designed eventually to ... | libstd++'s implementation is non-conformant to C++11, but that doesn't mean your code is correctly guaranteeing the results you expect.
Doing anything to modify the values stored in the character array returned by `c_str()` results in undefined behavior. The standard explicitly says this:
>
> 21.4.7.1 basic\_string ... |
21,431,641 | This is my XML file
```
<?xml version="1.0" encoding="UTF-8"?>
<playerxml>
<config>
<player type="videoplayer" sessionId="" buffrTime="9" width="1024" height="768">
<xmlpath url="../config/interface_videoplayer.xml"/>
<preloadpath url="../presentation/nuggetplayer/preloader.... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21431641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1847560/"
] | You're right that [COW is disallowed](https://stackoverflow.com/q/12199710/560648). But GCC [hasn't updated its implementation yet](http://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html), allegedly [due to ABI constraints](https://stackoverflow.com/q/10463851/560648). A new implementation, designed eventually to ... | >
> Does g++ meets `std::string` C++11 requirements?
>
>
>
No.
>
> Before C++11 this did not pose a big problem since `c_str` didn't return a pointer to the actual data the string object holds, so changing it didn't matter.
>
>
>
This is incorrect, `c_str` was always allowed to return the actual data and tha... |
21,431,641 | This is my XML file
```
<?xml version="1.0" encoding="UTF-8"?>
<playerxml>
<config>
<player type="videoplayer" sessionId="" buffrTime="9" width="1024" height="768">
<xmlpath url="../config/interface_videoplayer.xml"/>
<preloadpath url="../presentation/nuggetplayer/preloader.... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21431641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1847560/"
] | You're right that [COW is disallowed](https://stackoverflow.com/q/12199710/560648). But GCC [hasn't updated its implementation yet](http://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html), allegedly [due to ABI constraints](https://stackoverflow.com/q/10463851/560648). A new implementation, designed eventually to ... | The other answers were correct at the time, but as of nowadays, accordingly to [the GCC 5.x Change Log](https://gcc.gnu.org/gcc-5/changes.html), libstdc++ as shipped by gcc 5 is now fully C++11 conformant. |
21,431,641 | This is my XML file
```
<?xml version="1.0" encoding="UTF-8"?>
<playerxml>
<config>
<player type="videoplayer" sessionId="" buffrTime="9" width="1024" height="768">
<xmlpath url="../config/interface_videoplayer.xml"/>
<preloadpath url="../presentation/nuggetplayer/preloader.... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21431641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1847560/"
] | libstd++'s implementation is non-conformant to C++11, but that doesn't mean your code is correctly guaranteeing the results you expect.
Doing anything to modify the values stored in the character array returned by `c_str()` results in undefined behavior. The standard explicitly says this:
>
> 21.4.7.1 basic\_string ... | >
> Does g++ meets `std::string` C++11 requirements?
>
>
>
No.
>
> Before C++11 this did not pose a big problem since `c_str` didn't return a pointer to the actual data the string object holds, so changing it didn't matter.
>
>
>
This is incorrect, `c_str` was always allowed to return the actual data and tha... |
21,431,641 | This is my XML file
```
<?xml version="1.0" encoding="UTF-8"?>
<playerxml>
<config>
<player type="videoplayer" sessionId="" buffrTime="9" width="1024" height="768">
<xmlpath url="../config/interface_videoplayer.xml"/>
<preloadpath url="../presentation/nuggetplayer/preloader.... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21431641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1847560/"
] | libstd++'s implementation is non-conformant to C++11, but that doesn't mean your code is correctly guaranteeing the results you expect.
Doing anything to modify the values stored in the character array returned by `c_str()` results in undefined behavior. The standard explicitly says this:
>
> 21.4.7.1 basic\_string ... | The other answers were correct at the time, but as of nowadays, accordingly to [the GCC 5.x Change Log](https://gcc.gnu.org/gcc-5/changes.html), libstdc++ as shipped by gcc 5 is now fully C++11 conformant. |
21,431,641 | This is my XML file
```
<?xml version="1.0" encoding="UTF-8"?>
<playerxml>
<config>
<player type="videoplayer" sessionId="" buffrTime="9" width="1024" height="768">
<xmlpath url="../config/interface_videoplayer.xml"/>
<preloadpath url="../presentation/nuggetplayer/preloader.... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21431641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1847560/"
] | >
> Does g++ meets `std::string` C++11 requirements?
>
>
>
No.
>
> Before C++11 this did not pose a big problem since `c_str` didn't return a pointer to the actual data the string object holds, so changing it didn't matter.
>
>
>
This is incorrect, `c_str` was always allowed to return the actual data and tha... | The other answers were correct at the time, but as of nowadays, accordingly to [the GCC 5.x Change Log](https://gcc.gnu.org/gcc-5/changes.html), libstdc++ as shipped by gcc 5 is now fully C++11 conformant. |
69,622,114 | I'm having trouble trying to figure out the following. Imagine that I have the generic class `Node<T>` for representing the nodes of a binary tree, with some methods in it.
```
public class Node<T> {
T info;
Node<T> left;
Node<T> right;
public Node(T info) {this.info=info;}
//an... | 2021/10/18 | [
"https://Stackoverflow.com/questions/69622114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17185540/"
] | Use a `reduce` function like the `Stream` provides:
```
public static class Node<T>{
public Node(T value, Node<T> a, Node<T> b){
this.value = value;
this.a = a;
this.b = b;
}
private final Node<T> a,b;
private final T value;
private T reduc... | You should define your T as
```
class Node<T extends Number> {
}
```
then you can write the function of sum as
```
int sum() {
int sum = this.info.intValue();
}
``` |
69,622,114 | I'm having trouble trying to figure out the following. Imagine that I have the generic class `Node<T>` for representing the nodes of a binary tree, with some methods in it.
```
public class Node<T> {
T info;
Node<T> left;
Node<T> right;
public Node(T info) {this.info=info;}
//an... | 2021/10/18 | [
"https://Stackoverflow.com/questions/69622114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17185540/"
] | Use a `reduce` function like the `Stream` provides:
```
public static class Node<T>{
public Node(T value, Node<T> a, Node<T> b){
this.value = value;
this.a = a;
this.b = b;
}
private final Node<T> a,b;
private final T value;
private T reduc... | Instead of using a `NodeOfInteger` class, I would define in the Node class a
```
public T combine(BinaryOperator<T> combiner) {
T res = this.info;
if (this.left != null) res = combine(res, this.left.combine(combiner);
if (this.right != null) res = combine(res, this.right.combine(combiner);
return res;
... |
52,503 | I've read studies where fixatives (eg glutaraldehyde) have been perfused into the brain while it is still inside the skull. I would have thought that this could also be done after the brain is removed, provided all the veins/arteries are connected to a perfusion machine. Is this possible, and are there any major obstac... | 2016/10/15 | [
"https://biology.stackexchange.com/questions/52503",
"https://biology.stackexchange.com",
"https://biology.stackexchange.com/users/27077/"
] | Of course it is possible to perfuse an organ once it has been removed from the body. It is probably unwise to do so with the brain as the [delicacy of the structures and high levels of lipids make rapid fixation necessary and difficult.](http://tpx.sagepub.com/content/28/1/122.full.pdf) I think the major obstacle is th... | The main obstacle would be connecting all of the arteries to a perfusion machine.
The neurovasculature is complex, and begins branching prior to entering the brain, therefore it is easier to do in situ. With a larger brain, the meninges and skull are also important for supporting the brain stucture. If unfixed brain i... |
8,105,578 | Consider the following, I want to store data about Stone Bricks in Cassandra. First the brick has a unique name/id called brick123. This brick has "dimensions" of width:6, height:3, length:4. Its "weight:2pds." It has some wild "color" basecolor:red, hue:sandstone, striping:blue. It is "produced" in the following count... | 2011/11/12 | [
"https://Stackoverflow.com/questions/8105578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/940798/"
] | The normal advice seems to be to avoid SCFs in favour of multiple CFs.
For the plain properties of a brick (width, color...), you can use a simple row per brick with a column per property (you could also enable automatic secondary indexes if you want to look up bricks with particular properties):
```
CF "bricks":
br... | Super columns are not indexed - this means, that read access on super column would load its whole content into RAM. This is also another reason to avoid SCF, especially if it contains large amount of data.
<http://wiki.apache.org/cassandra/CassandraLimitations> |
63,020,214 | Apologies if this is a "Well, duh!" moment but I'm trying to figure out how to reference a prior calculated property in a script and I'm at a loss after searching various forums. The following script runs perfectly in my environment until the last line. The $theusers system array is pulled from a .csv
```
Get-MsolDevi... | 2020/07/21 | [
"https://Stackoverflow.com/questions/63020214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13970413/"
] | I would avoid using `Select-Object` in this case and just use a `foreach-object` from which you cal `Get-ADUser` *once* and then return a custom PS object manually. I think the result is more flexible, readable and efficient:
```
Get-MsolDevice -All -ReturnRegisteredOwners |
Where-Object {($_.DeviceOSType -eq 'iPhone'... | When you use `$_.LoginName` you are trying to access an *output* property which doesn't exist on the *input* object, `$_`. A workaround would be to wrap your `Select` in a `ForEach-Object`, inside of which you calculate and store in a variable the value on which both properties are based...
```bsh
Get-MsolDevice -All ... |
33,943 | I'm coming from a math background (so my mind is set up for Definitions-Observation-Lemma-Proof frameworks) and looking for recommendations of a Macroeconomics textbook mainly devoted to growth models and foreign exchange rates.
Any recommendations? | 2020/02/10 | [
"https://economics.stackexchange.com/questions/33943",
"https://economics.stackexchange.com",
"https://economics.stackexchange.com/users/25619/"
] | I really think a great place to start in general is Olivier Blanchard's "Macroeconomics". However, this is an economics undergraduate text and may not be optimal for a mathematician, especially given the structure you expect.
More to your taste may be the following standard texts:
"Introduction to modern economic gro... | I would also add the following books to the @BBKing list:
David Romer. Advanced Macroeconomics - the first three chapters devoted to growth are excellent (but it does not contain much about exchange rates).
Nelson Mark. International Macroeconomics and Finance - this is very good book for catching up with the researc... |
33,943 | I'm coming from a math background (so my mind is set up for Definitions-Observation-Lemma-Proof frameworks) and looking for recommendations of a Macroeconomics textbook mainly devoted to growth models and foreign exchange rates.
Any recommendations? | 2020/02/10 | [
"https://economics.stackexchange.com/questions/33943",
"https://economics.stackexchange.com",
"https://economics.stackexchange.com/users/25619/"
] | I really think a great place to start in general is Olivier Blanchard's "Macroeconomics". However, this is an economics undergraduate text and may not be optimal for a mathematician, especially given the structure you expect.
More to your taste may be the following standard texts:
"Introduction to modern economic gro... | I would suggest that you also read books by Richard Duncan, e.g. The Dollar Crisis, to get a lucid explanation of the global economy from one of the few people who anticipated the 2006/7 financial crisis.
I have also seen approaches where economists use dynamic physics simulators to identify areas of the economy as be... |
33,943 | I'm coming from a math background (so my mind is set up for Definitions-Observation-Lemma-Proof frameworks) and looking for recommendations of a Macroeconomics textbook mainly devoted to growth models and foreign exchange rates.
Any recommendations? | 2020/02/10 | [
"https://economics.stackexchange.com/questions/33943",
"https://economics.stackexchange.com",
"https://economics.stackexchange.com/users/25619/"
] | I really think a great place to start in general is Olivier Blanchard's "Macroeconomics". However, this is an economics undergraduate text and may not be optimal for a mathematician, especially given the structure you expect.
More to your taste may be the following standard texts:
"Introduction to modern economic gro... | "Definitions-Observation-Lemma-Proof" is not the right perspective for macro, and one will not, and should not, get that in a proper introduction. Start with an undergraduate text, such as Blanchard, for proper economic perspective.
(If a macro-economist wants a beginner's reference on algebraic geometry, one would r... |
33,943 | I'm coming from a math background (so my mind is set up for Definitions-Observation-Lemma-Proof frameworks) and looking for recommendations of a Macroeconomics textbook mainly devoted to growth models and foreign exchange rates.
Any recommendations? | 2020/02/10 | [
"https://economics.stackexchange.com/questions/33943",
"https://economics.stackexchange.com",
"https://economics.stackexchange.com/users/25619/"
] | I would also add the following books to the @BBKing list:
David Romer. Advanced Macroeconomics - the first three chapters devoted to growth are excellent (but it does not contain much about exchange rates).
Nelson Mark. International Macroeconomics and Finance - this is very good book for catching up with the researc... | I would suggest that you also read books by Richard Duncan, e.g. The Dollar Crisis, to get a lucid explanation of the global economy from one of the few people who anticipated the 2006/7 financial crisis.
I have also seen approaches where economists use dynamic physics simulators to identify areas of the economy as be... |
33,943 | I'm coming from a math background (so my mind is set up for Definitions-Observation-Lemma-Proof frameworks) and looking for recommendations of a Macroeconomics textbook mainly devoted to growth models and foreign exchange rates.
Any recommendations? | 2020/02/10 | [
"https://economics.stackexchange.com/questions/33943",
"https://economics.stackexchange.com",
"https://economics.stackexchange.com/users/25619/"
] | "Definitions-Observation-Lemma-Proof" is not the right perspective for macro, and one will not, and should not, get that in a proper introduction. Start with an undergraduate text, such as Blanchard, for proper economic perspective.
(If a macro-economist wants a beginner's reference on algebraic geometry, one would r... | I would suggest that you also read books by Richard Duncan, e.g. The Dollar Crisis, to get a lucid explanation of the global economy from one of the few people who anticipated the 2006/7 financial crisis.
I have also seen approaches where economists use dynamic physics simulators to identify areas of the economy as be... |
69,231,577 | how to apply unique CSS styling to an individual page of content without using any plugin such as TinyMCE in WordPress classic editor | 2021/09/18 | [
"https://Stackoverflow.com/questions/69231577",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11930497/"
] | Firstly, you are using onclick instead of onClick. onclick is ok while using html, but while using react use onClick.
And instead of using an inline function, create a separate function called handleClick and then call this function after clicking.
For more reference checkout this link - [React Router Dom](https://re... | The problem is that you have forgotten to write the word const before history |
5,627,826 | Ok I have a user form that has values submitted to the database.
My values are as follows,
```
$type = $_POST['type'];
$username = mysql_real_escape_string($_POST['username']);
$gender = $_POST['gender'];
$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);
``... | 2011/04/11 | [
"https://Stackoverflow.com/questions/5627826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/690929/"
] | It's the concept of [sanitizing your data](http://codeassembly.com/How-to-sanitize-your-php-input/), ***especially*** unpredictable inputs that are public facing. | Rule #1 of web security: never trust your input.
mysql\_real\_escape\_string will usually be good enough. You can do other fun things like check to see that something that *should* be a number *is* (it's easier to do that than to call mysql\_real\_escape\_string).
Keep in mind too that if you use your input for thing... |
5,627,826 | Ok I have a user form that has values submitted to the database.
My values are as follows,
```
$type = $_POST['type'];
$username = mysql_real_escape_string($_POST['username']);
$gender = $_POST['gender'];
$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);
``... | 2011/04/11 | [
"https://Stackoverflow.com/questions/5627826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/690929/"
] | It's the concept of [sanitizing your data](http://codeassembly.com/How-to-sanitize-your-php-input/), ***especially*** unpredictable inputs that are public facing. | Escaping all your parameters will do the trick, because that will make sure all your special chars will be escaped. So just trust your mysql\_real\_escape\_string :-) |
5,627,826 | Ok I have a user form that has values submitted to the database.
My values are as follows,
```
$type = $_POST['type'];
$username = mysql_real_escape_string($_POST['username']);
$gender = $_POST['gender'];
$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);
``... | 2011/04/11 | [
"https://Stackoverflow.com/questions/5627826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/690929/"
] | It's the concept of [sanitizing your data](http://codeassembly.com/How-to-sanitize-your-php-input/), ***especially*** unpredictable inputs that are public facing. | The real issue you are referencing is called [SQL injection](http://www.google.com/#hl=en&source=hp&q=sql%20injection&aq=f&aqi=n1g10&aql=&oq=&gs_rfai=&fp=1&cad=b) which is a huge deal.
My goto advice is to use the [php PDO](http://php.net/manual/en/book.pdo.php) to bind your variables instead of running them directly.... |
5,627,826 | Ok I have a user form that has values submitted to the database.
My values are as follows,
```
$type = $_POST['type'];
$username = mysql_real_escape_string($_POST['username']);
$gender = $_POST['gender'];
$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);
``... | 2011/04/11 | [
"https://Stackoverflow.com/questions/5627826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/690929/"
] | It's the concept of [sanitizing your data](http://codeassembly.com/How-to-sanitize-your-php-input/), ***especially*** unpredictable inputs that are public facing. | This is called SQL injection, and is an important lesson of programming web inputs. You should *never* trust your users' input. Always use `mysql_real_escape_string` and `htmlspecialchars` when dealing with user input (the latter helps keep your site safe from XSS; if you *do* want to allow HTML, use a library like [HT... |
5,627,826 | Ok I have a user form that has values submitted to the database.
My values are as follows,
```
$type = $_POST['type'];
$username = mysql_real_escape_string($_POST['username']);
$gender = $_POST['gender'];
$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);
``... | 2011/04/11 | [
"https://Stackoverflow.com/questions/5627826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/690929/"
] | It's the concept of [sanitizing your data](http://codeassembly.com/How-to-sanitize-your-php-input/), ***especially*** unpredictable inputs that are public facing. | On the surface of it, sure, your radio buttons define a constrained set of inputs and your user can't choose any option that you haven't predefined. So you know that your radio button inputs are safe.
Except... you don't. It's trivial to modify your HTML to submit some different value to your server-side PHP script. Y... |
41,258,678 | ```
def has_name? name
results = auths.map do |auth|
auth.role_groups.map do |role_group|
role_group.resources.any?{ |r| r.name == name}
end
end
results.any?
end
```
This is a method in User model
1 user has many auths
1 auth has many ... | 2016/12/21 | [
"https://Stackoverflow.com/questions/41258678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5511391/"
] | You can, but the result will have array of array and it isn't considered empty.
```
[[]].any?
=> true
```
`#flat_map` might help you here
```
def has_name? name
results = auths.flat_map do |auth|
auth.role_groups.map do |role_group|
role_group.resources.any?{ |r| r.name == name}
end
end
result... | Firstly, you can add a direct relationship between `auth` and `resources`.
In the `Auth` model:
`has_many: resources, through: role_groups`
the has-many-through relationship can also be used for nested has-many relationships(like in your case). Check out the last example (document, section, paragraph relationships) i... |
41,258,678 | ```
def has_name? name
results = auths.map do |auth|
auth.role_groups.map do |role_group|
role_group.resources.any?{ |r| r.name == name}
end
end
results.any?
end
```
This is a method in User model
1 user has many auths
1 auth has many ... | 2016/12/21 | [
"https://Stackoverflow.com/questions/41258678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5511391/"
] | You can, but the result will have array of array and it isn't considered empty.
```
[[]].any?
=> true
```
`#flat_map` might help you here
```
def has_name? name
results = auths.flat_map do |auth|
auth.role_groups.map do |role_group|
role_group.resources.any?{ |r| r.name == name}
end
end
result... | Yes you can use nested maps to get the Cartesian product (simple list of all combinations) of two arrays:
```
a = [1,2,3]
b = [4,5,6]
l = a.map { |i|
b.map { |j|
{"a": i, "b": j}
}
}.flatten(1)
```
`l` result:
```
=> [{:a=>1, :b=>4}, {:a=>1, :b=>5}, {:a=>1, :b=>6}, {:a=>2, :b=>4}, {:a=>2, :b=>5}, {:a=>2, :... |
58,673,161 | I'm learning how to use BlueJ and I am struggling in writing the code for it to output the minimum number that the user has inputted. Any help would be appreciated!
```
import java.util.Scanner;
public class FindMin
{
public static void main(String[] args)
{
System.out.print("Program to compare three n... | 2019/11/02 | [
"https://Stackoverflow.com/questions/58673161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12312892/"
] | `|` is the bitwise OR operator. You want `&&`, the logical AND operator. "If `number2` is greater than `number1` **and** `number3` is greater than `number1`." Also, you don't want any `if` on the last `else`, since by then you've ruled out two of the three possibilities and there's only one possibility left. So:
```
i... | You can also `import java.util.*` witch comes with `java.lang.Math`. This allows you to use methods that come from `Math`, such as `Math.min`.
```
import java.util.Scanner;
public class FindMin
{
public static void main(String[] args)
{
System.out.print("Program to compare three numbers");
Syst... |
58,673,161 | I'm learning how to use BlueJ and I am struggling in writing the code for it to output the minimum number that the user has inputted. Any help would be appreciated!
```
import java.util.Scanner;
public class FindMin
{
public static void main(String[] args)
{
System.out.print("Program to compare three n... | 2019/11/02 | [
"https://Stackoverflow.com/questions/58673161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12312892/"
] | `|` is the bitwise OR operator. You want `&&`, the logical AND operator. "If `number2` is greater than `number1` **and** `number3` is greater than `number1`." Also, you don't want any `if` on the last `else`, since by then you've ruled out two of the three possibilities and there's only one possibility left. So:
```
i... | Or you can do this
```
int minimum = 0;
if(number1 < number2){
minimum = number1;
}else{
minimum = number2;
}
if(number3<minimum){
minimum = number3;
}
``` |
58,673,161 | I'm learning how to use BlueJ and I am struggling in writing the code for it to output the minimum number that the user has inputted. Any help would be appreciated!
```
import java.util.Scanner;
public class FindMin
{
public static void main(String[] args)
{
System.out.print("Program to compare three n... | 2019/11/02 | [
"https://Stackoverflow.com/questions/58673161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12312892/"
] | `|` is the bitwise OR operator. You want `&&`, the logical AND operator. "If `number2` is greater than `number1` **and** `number3` is greater than `number1`." Also, you don't want any `if` on the last `else`, since by then you've ruled out two of the three possibilities and there's only one possibility left. So:
```
i... | Try the below method and pass your three numbers as parameters.
```java
public static int getMinimumNumber(int no1, int no2, int no3) {
return no1 < no2 ? (no1 < no3 ? no1 : (no2 < no3 ? no2 : no3)) : (no2 < no3 ? no2 : no3);
}
``` |
58,673,161 | I'm learning how to use BlueJ and I am struggling in writing the code for it to output the minimum number that the user has inputted. Any help would be appreciated!
```
import java.util.Scanner;
public class FindMin
{
public static void main(String[] args)
{
System.out.print("Program to compare three n... | 2019/11/02 | [
"https://Stackoverflow.com/questions/58673161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12312892/"
] | You can also `import java.util.*` witch comes with `java.lang.Math`. This allows you to use methods that come from `Math`, such as `Math.min`.
```
import java.util.Scanner;
public class FindMin
{
public static void main(String[] args)
{
System.out.print("Program to compare three numbers");
Syst... | Or you can do this
```
int minimum = 0;
if(number1 < number2){
minimum = number1;
}else{
minimum = number2;
}
if(number3<minimum){
minimum = number3;
}
``` |
58,673,161 | I'm learning how to use BlueJ and I am struggling in writing the code for it to output the minimum number that the user has inputted. Any help would be appreciated!
```
import java.util.Scanner;
public class FindMin
{
public static void main(String[] args)
{
System.out.print("Program to compare three n... | 2019/11/02 | [
"https://Stackoverflow.com/questions/58673161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12312892/"
] | You can also `import java.util.*` witch comes with `java.lang.Math`. This allows you to use methods that come from `Math`, such as `Math.min`.
```
import java.util.Scanner;
public class FindMin
{
public static void main(String[] args)
{
System.out.print("Program to compare three numbers");
Syst... | Try the below method and pass your three numbers as parameters.
```java
public static int getMinimumNumber(int no1, int no2, int no3) {
return no1 < no2 ? (no1 < no3 ? no1 : (no2 < no3 ? no2 : no3)) : (no2 < no3 ? no2 : no3);
}
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.