qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
17,022,075
I am using XAMPP running php 5.3 and mysql version 5.5.27 to develop with on my local machine. For a long time I have noticed that page load times where hitting the 2-3 second mark but asumed that as I was using a remote MySQL database to connect to it was the latency of that connection adding to the load time. I hav...
2013/06/10
[ "https://Stackoverflow.com/questions/17022075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1225977/" ]
This behavior is documented in the manual: > > When the host name is set to "localhost", then the connection to the server is made thru a domain socket. If PDO\_MYSQL is compiled against libmysqlclient then the location of the socket file is at libmysqlclient's compiled in location. If PDO\_MYSQL is compiled against ...
I do not know why, but changing the host in my laravel4 mysql configuration from `localhost` to `127.0.0.1` just solved the problem. The following works :) ``` 'mysql' => array( 'driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'laravel4', 'username' => 'laravel4', 'password' =>...
22,425,685
I am trying to select database entries where a field is filled in. The database has 2 ways of inserting data, one enters a comment and one does not, i am lookin to only select rows that have comments filled in. ``` $requete = "SELECT * FROM daysoff WHERE comment = true ORDER BY id"; ``` where is this going wrong? o...
2014/03/15
[ "https://Stackoverflow.com/questions/22425685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2967211/" ]
You may try: ``` $requete = "SELECT * FROM daysoff WHERE comment IS NOT NULL ORDER BY id"; ```
You must try this ``` $requete = "SELECT * FROM daysoff WHERE comment IS NOT NULL AND comment != '' ORDER BY id"; ```
47,810,673
I have uploaded a Pdf file to firebase storage, after uploading the pdf file to firebase storage, I am getting the download url. Now I want to open the pdf file in webview in my android application. Below is the url I am getting after uploading the pdf file to firebase storage. <https://firebasestorage.googleapis.com...
2017/12/14
[ "https://Stackoverflow.com/questions/47810673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4519165/" ]
Late but you should encode your url, ``` try { url=URLEncoder.encode(url,"UTF-8"); myWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+url); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } ```
I think your problem when you upload the file to firebase, you should add metadata of your uploaded file in you case you should define StorageMetadata and set contentType of "application/pdf" This code from iOS app ``` FIRStorageMetadata* metadata = [[FIRStorageMetadata alloc] init]; metadata.contentType = @"applicat...
21,053,479
I often extend my Entities in BreezeJS using the below syntax: ``` var Employee = function () { this.FirstName = ko.observable(""); // default FirstName this.LastName = ko.observable(""); // default LastName this.fullName = ko.computed( function () { return this.FirstName() + " " + this.LastName()...
2014/01/10
[ "https://Stackoverflow.com/questions/21053479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1283937/" ]
You'll have to use [`OVER()`](https://my.vertica.com/docs/6.1.x/HTML/index.htm#13400.htm) with [`NVL()`](https://my.vertica.com/docs/6.1.x/HTML/index.htm#10435.htm) (you'll have to extend the concatenation for more than 10 instances per name): ``` CREATE TABLE t1 ( id int, name varchar(10) ); INSERT INTO t1 SELEC...
Have look at Concatenate UDAF in vertica examples which comes with vertica installation that's the mysql equivalent. you can just directly install it. more /opt/vertica/sdk/examples/AggregateFunctions/Concatenate.cpp ``` -- Shell comppile cd /opt/vertica/sdk/examples/AggregateFunctions/ g++ -D HAVE_LONG_INT_64 -I /op...
21,053,479
I often extend my Entities in BreezeJS using the below syntax: ``` var Employee = function () { this.FirstName = ko.observable(""); // default FirstName this.LastName = ko.observable(""); // default LastName this.fullName = ko.computed( function () { return this.FirstName() + " " + this.LastName()...
2014/01/10
[ "https://Stackoverflow.com/questions/21053479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1283937/" ]
The easiest on the long term is to use one of the official Vertica UDFs to be found on github at <https://github.com/vertica/Vertica-Extension-Packages/tree/master/strings_package> which provides a group\_concat function. The installation procedure is to found in the README, and examples are even provided.
Have look at Concatenate UDAF in vertica examples which comes with vertica installation that's the mysql equivalent. you can just directly install it. more /opt/vertica/sdk/examples/AggregateFunctions/Concatenate.cpp ``` -- Shell comppile cd /opt/vertica/sdk/examples/AggregateFunctions/ g++ -D HAVE_LONG_INT_64 -I /op...
16,984,930
I have a pricing array ``` pricing = new Array(); pricing[1] = 35; pricing[2] = 60; pricing[3] = 84; pricing[4] = 104; pricing[5] = 120; pricing[6] = 132; pricing[7] = 140; pricing[8] = 144; pricing[9] = 153; pricing[10] = 160; ``` Everything below 10 has a price, everything above 10 will have the same price as ten...
2013/06/07
[ "https://Stackoverflow.com/questions/16984930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2195085/" ]
You can leave your array as is and use a function like: ``` var getPrice = function(arr, index){ return arr[index > 10 ? 10 : index]; } ```
``` i=10; while(i--) { pricing[i+10] = 160; } ```
16,984,930
I have a pricing array ``` pricing = new Array(); pricing[1] = 35; pricing[2] = 60; pricing[3] = 84; pricing[4] = 104; pricing[5] = 120; pricing[6] = 132; pricing[7] = 140; pricing[8] = 144; pricing[9] = 153; pricing[10] = 160; ``` Everything below 10 has a price, everything above 10 will have the same price as ten...
2013/06/07
[ "https://Stackoverflow.com/questions/16984930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2195085/" ]
``` var pricing = [], i; pricing.push(35); pricing.push(60); pricing.push(84); pricing.push(104); pricing.push(120); pricing.push(132); pricing.push(140); pricing.push(144); pricing.push(153); for (i = 0; i < 11; i++) { pricing.push(160); } ``` I also made a [JSFiddle](http://jsfiddle.net/38Erq/1/) for this. @CD...
``` i=10; while(i--) { pricing[i+10] = 160; } ```
16,984,930
I have a pricing array ``` pricing = new Array(); pricing[1] = 35; pricing[2] = 60; pricing[3] = 84; pricing[4] = 104; pricing[5] = 120; pricing[6] = 132; pricing[7] = 140; pricing[8] = 144; pricing[9] = 153; pricing[10] = 160; ``` Everything below 10 has a price, everything above 10 will have the same price as ten...
2013/06/07
[ "https://Stackoverflow.com/questions/16984930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2195085/" ]
You can leave your array as is and use a function like: ``` var getPrice = function(arr, index){ return arr[index > 10 ? 10 : index]; } ```
``` pricing = new Array(); var arraySize = 100; pricing[1] = 35; pricing[2] = 60; pricing[3] = 84; pricing[4] = 104; pricing[5] = 120; pricing[6] = 132; pricing[7] = 140; pricing[8] = 144; pricing[9] = 153; for(var x = 10; x < arraySize; x++) pricing[x] = 160 console.log(pricing); ```
16,984,930
I have a pricing array ``` pricing = new Array(); pricing[1] = 35; pricing[2] = 60; pricing[3] = 84; pricing[4] = 104; pricing[5] = 120; pricing[6] = 132; pricing[7] = 140; pricing[8] = 144; pricing[9] = 153; pricing[10] = 160; ``` Everything below 10 has a price, everything above 10 will have the same price as ten...
2013/06/07
[ "https://Stackoverflow.com/questions/16984930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2195085/" ]
You can leave your array as is and use a function like: ``` var getPrice = function(arr, index){ return arr[index > 10 ? 10 : index]; } ```
You missed the first entry in your array (since it is 0 based). I would change it to this: ``` pricing = new Array(20); pricing[0] = 35; pricing[1] = 60; pricing[2] = 84; pricing[3] = 104; pricing[4] = 120; pricing[5] = 132; pricing[6] = 140; pricing[7] = 144; pricing[8] = 153; pricing[9] = 160; ``` Then you can s...
16,984,930
I have a pricing array ``` pricing = new Array(); pricing[1] = 35; pricing[2] = 60; pricing[3] = 84; pricing[4] = 104; pricing[5] = 120; pricing[6] = 132; pricing[7] = 140; pricing[8] = 144; pricing[9] = 153; pricing[10] = 160; ``` Everything below 10 has a price, everything above 10 will have the same price as ten...
2013/06/07
[ "https://Stackoverflow.com/questions/16984930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2195085/" ]
``` var pricing = [], i; pricing.push(35); pricing.push(60); pricing.push(84); pricing.push(104); pricing.push(120); pricing.push(132); pricing.push(140); pricing.push(144); pricing.push(153); for (i = 0; i < 11; i++) { pricing.push(160); } ``` I also made a [JSFiddle](http://jsfiddle.net/38Erq/1/) for this. @CD...
``` pricing = new Array(); var arraySize = 100; pricing[1] = 35; pricing[2] = 60; pricing[3] = 84; pricing[4] = 104; pricing[5] = 120; pricing[6] = 132; pricing[7] = 140; pricing[8] = 144; pricing[9] = 153; for(var x = 10; x < arraySize; x++) pricing[x] = 160 console.log(pricing); ```
16,984,930
I have a pricing array ``` pricing = new Array(); pricing[1] = 35; pricing[2] = 60; pricing[3] = 84; pricing[4] = 104; pricing[5] = 120; pricing[6] = 132; pricing[7] = 140; pricing[8] = 144; pricing[9] = 153; pricing[10] = 160; ``` Everything below 10 has a price, everything above 10 will have the same price as ten...
2013/06/07
[ "https://Stackoverflow.com/questions/16984930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2195085/" ]
``` var pricing = [], i; pricing.push(35); pricing.push(60); pricing.push(84); pricing.push(104); pricing.push(120); pricing.push(132); pricing.push(140); pricing.push(144); pricing.push(153); for (i = 0; i < 11; i++) { pricing.push(160); } ``` I also made a [JSFiddle](http://jsfiddle.net/38Erq/1/) for this. @CD...
You missed the first entry in your array (since it is 0 based). I would change it to this: ``` pricing = new Array(20); pricing[0] = 35; pricing[1] = 60; pricing[2] = 84; pricing[3] = 104; pricing[4] = 120; pricing[5] = 132; pricing[6] = 140; pricing[7] = 144; pricing[8] = 153; pricing[9] = 160; ``` Then you can s...
29,567,408
Git does not have a way to backup a working copy. (You can use git commit, but that pollutes your repo with backups.) So I use git diff, but it has an issue with Visual Studio 2010 (VS). Sometimes, VS saves C# files as UTF-8, sometimes UTF-16LE. When VS switches a file from one to the other, the git patch file says, "B...
2015/04/10
[ "https://Stackoverflow.com/questions/29567408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1074214/" ]
If you have GNU sed, it has an option `I` for case-insensitive match: ``` sed 's/Name://gI;s/Age://gI;s/Hometown://gI' file ``` With a slight change, the awk solution would work: ``` awk '{ for(i=1;i<=NF;i++) {if ($i ~/:/) {$i=""}} ; print }' file ```
Piling on the answer, with perl: To remove the specific labels: ``` perl -pe 's/(?:name|age|hometown): *//ig' file ``` To remove any label: ``` perl -pe 's/\w+:\s*//ig' file ``` `tr` is not the right tool, because it maps *characters*, not words.
29,567,408
Git does not have a way to backup a working copy. (You can use git commit, but that pollutes your repo with backups.) So I use git diff, but it has an issue with Visual Studio 2010 (VS). Sometimes, VS saves C# files as UTF-8, sometimes UTF-16LE. When VS switches a file from one to the other, the git patch file says, "B...
2015/04/10
[ "https://Stackoverflow.com/questions/29567408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1074214/" ]
You can use this gnu-awk command also: ``` awk -v IGNORECASE=1 -v OFS='\t' -F ' *(Name|AGE|Hometown): *' ' { printf $2; for (i=3; i<=NF; i++) printf OFS $i; print ""}' file Dean 23 Chicago Mary 68 New York Lisa 36 Los angeles Greg 18 London ```
Piling on the answer, with perl: To remove the specific labels: ``` perl -pe 's/(?:name|age|hometown): *//ig' file ``` To remove any label: ``` perl -pe 's/\w+:\s*//ig' file ``` `tr` is not the right tool, because it maps *characters*, not words.
29,567,408
Git does not have a way to backup a working copy. (You can use git commit, but that pollutes your repo with backups.) So I use git diff, but it has an issue with Visual Studio 2010 (VS). Sometimes, VS saves C# files as UTF-8, sometimes UTF-16LE. When VS switches a file from one to the other, the git patch file says, "B...
2015/04/10
[ "https://Stackoverflow.com/questions/29567408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1074214/" ]
``` $ awk -F' ?[^ ]+: ' '{print $2, $3, $4}' file Dean 23 Chicago Mary 68 New York Lisa 36 Los angeles Greg 18 London ``` or in general for any number of fields: ``` $ awk -F' ?[^ ]+: ' '{for (i=2;i<=NF;i++) printf "%s%s", $i, (i<NF?OFS:ORS)}' file Dean 23 Chicago Mary 68 New York Lisa 36 Los angeles Greg 18 London ...
Piling on the answer, with perl: To remove the specific labels: ``` perl -pe 's/(?:name|age|hometown): *//ig' file ``` To remove any label: ``` perl -pe 's/\w+:\s*//ig' file ``` `tr` is not the right tool, because it maps *characters*, not words.
29,567,408
Git does not have a way to backup a working copy. (You can use git commit, but that pollutes your repo with backups.) So I use git diff, but it has an issue with Visual Studio 2010 (VS). Sometimes, VS saves C# files as UTF-8, sometimes UTF-16LE. When VS switches a file from one to the other, the git patch file says, "B...
2015/04/10
[ "https://Stackoverflow.com/questions/29567408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1074214/" ]
What about deleting all the words ending in `:` from the input and printing what's left? ``` $ awk '{ gsub(/[^ ]+: /, "") }1' data.txt Dean 23 Chicago Mary 68 New York Lisa 36 Los angeles Greg 18 London ``` **Edit:** And as suggested in the comments, perhaps even more to the point is the `sed` equivalent: ``` sed ...
Piling on the answer, with perl: To remove the specific labels: ``` perl -pe 's/(?:name|age|hometown): *//ig' file ``` To remove any label: ``` perl -pe 's/\w+:\s*//ig' file ``` `tr` is not the right tool, because it maps *characters*, not words.
50,398,763
**Debouncing** is a common method to postpone a function/job from executing until after certain time has passed. **Use-case:** A conversation with active chatting from multiple users, they should not receive an email notification for each message typed. But more than likely after a few minutes of silence, if the messa...
2018/05/17
[ "https://Stackoverflow.com/questions/50398763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1536309/" ]
Doing yourself is not so bad. ```rb class AdminJob def self.debounce(job, args={}) handler = YAML.dump(job) count = Delayed::Job.where(handler: handler).where('locked_at IS NULL').delete_all Rails.logger.info("deleted: #{count} jobs") Delayed::Job.enqueue(job, args) end end ``` Instead of writing...
What I would do is schedule a periodic task, lets say every 5 minutes that checks if there is someone who has to be notified. Yes it seems an expensive operation, but for your use case I don't see (for now) others solutions. So lets say you have 10 users that uses a chat. Every 5 minutes you could check if there are us...
50,398,763
**Debouncing** is a common method to postpone a function/job from executing until after certain time has passed. **Use-case:** A conversation with active chatting from multiple users, they should not receive an email notification for each message typed. But more than likely after a few minutes of silence, if the messa...
2018/05/17
[ "https://Stackoverflow.com/questions/50398763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1536309/" ]
Doing yourself is not so bad. ```rb class AdminJob def self.debounce(job, args={}) handler = YAML.dump(job) count = Delayed::Job.where(handler: handler).where('locked_at IS NULL').delete_all Rails.logger.info("deleted: #{count} jobs") Delayed::Job.enqueue(job, args) end end ``` Instead of writing...
If you are using Delayed Job as the implementation for Active Job then take a look at the 'activejob-trackable' gem. <https://github.com/ignatiusreza/activejob-trackable> It uses another table that tracks the jobs and can throttle and debounce.
63,314,457
In doing a lotto checker program, where one of the constraints is to ***not use loops***, or ***data structures like arrays, lists etc*** I've written the following piece of code to check if the 3 entries given by the user (*draw1, draw2, draw3*) are equal to any of the 7 random numbers generated by the program (*rando...
2020/08/08
[ "https://Stackoverflow.com/questions/63314457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14070529/" ]
experimental worked for me ``` "python.formatting.autopep8Args": ["--max-line-length", "120", "--experimental"] ``` [check out this link for proper format specifier settings](https://code.visualstudio.com/docs/python/editing#_formatterspecific-settings)
This should work - ``` "python.formatting.provider": "autopep8", "python.formatting.autopep8Args": [ "--max-line-length", "120", "--experimental" ] ```
63,314,457
In doing a lotto checker program, where one of the constraints is to ***not use loops***, or ***data structures like arrays, lists etc*** I've written the following piece of code to check if the 3 entries given by the user (*draw1, draw2, draw3*) are equal to any of the 7 random numbers generated by the program (*rando...
2020/08/08
[ "https://Stackoverflow.com/questions/63314457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14070529/" ]
experimental worked for me ``` "python.formatting.autopep8Args": ["--max-line-length", "120", "--experimental"] ``` [check out this link for proper format specifier settings](https://code.visualstudio.com/docs/python/editing#_formatterspecific-settings)
As mentioned in the answer by @senti143, On Windows, to set the **python** word wrap at 120 characters Go to settings and search for autopep8 Find Python > Formatting: Autopep8 Args Click on **Add Item** button and add the value ``` --max-line-length ``` Click on **Add Item** button again and add the value ```...
63,314,457
In doing a lotto checker program, where one of the constraints is to ***not use loops***, or ***data structures like arrays, lists etc*** I've written the following piece of code to check if the 3 entries given by the user (*draw1, draw2, draw3*) are equal to any of the 7 random numbers generated by the program (*rando...
2020/08/08
[ "https://Stackoverflow.com/questions/63314457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14070529/" ]
This should work - ``` "python.formatting.provider": "autopep8", "python.formatting.autopep8Args": [ "--max-line-length", "120", "--experimental" ] ```
As mentioned in the answer by @senti143, On Windows, to set the **python** word wrap at 120 characters Go to settings and search for autopep8 Find Python > Formatting: Autopep8 Args Click on **Add Item** button and add the value ``` --max-line-length ``` Click on **Add Item** button again and add the value ```...
50,518,540
I have a temporary table with datatype `NVARCHAR` which I need to migrate to a table with datatype `INTEGER`. I have two `NVARCHAR` tables which need to be `INTEGER`, one is working and the other is giving an error, > > Conversion failed when converting the nvarchar value '9824 > > ' to data type int. > > > ...
2018/05/24
[ "https://Stackoverflow.com/questions/50518540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5822607/" ]
You probably have a linebreak in there, TRIM/RTRIM don't trim those. ``` declare @value nvarchar(10) = '1234 ' select ISNUMERIC(Replace(CHAR(9), '', @value)) select ISNUMERIC(Replace(CHAR(10), '', @value)) select ISNUMERIC(Replace(CHAR(13), '', @value)) select ISNUMERIC(Replace(CHAR(32), '', @value)) ```
Instead of `cast()` use `try\_cast() ``` SELECT TRY_CAST(table_name AS integer) FROM OLTP.table ```
50,518,540
I have a temporary table with datatype `NVARCHAR` which I need to migrate to a table with datatype `INTEGER`. I have two `NVARCHAR` tables which need to be `INTEGER`, one is working and the other is giving an error, > > Conversion failed when converting the nvarchar value '9824 > > ' to data type int. > > > ...
2018/05/24
[ "https://Stackoverflow.com/questions/50518540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5822607/" ]
You probably have a linebreak in there, TRIM/RTRIM don't trim those. ``` declare @value nvarchar(10) = '1234 ' select ISNUMERIC(Replace(CHAR(9), '', @value)) select ISNUMERIC(Replace(CHAR(10), '', @value)) select ISNUMERIC(Replace(CHAR(13), '', @value)) select ISNUMERIC(Replace(CHAR(32), '', @value)) ```
``` SELECT PARSE(column_name AS int ) from table ``` [![Tested](https://i.stack.imgur.com/etvgV.png)](https://i.stack.imgur.com/etvgV.png)
50,518,540
I have a temporary table with datatype `NVARCHAR` which I need to migrate to a table with datatype `INTEGER`. I have two `NVARCHAR` tables which need to be `INTEGER`, one is working and the other is giving an error, > > Conversion failed when converting the nvarchar value '9824 > > ' to data type int. > > > ...
2018/05/24
[ "https://Stackoverflow.com/questions/50518540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5822607/" ]
You probably have a linebreak in there, TRIM/RTRIM don't trim those. ``` declare @value nvarchar(10) = '1234 ' select ISNUMERIC(Replace(CHAR(9), '', @value)) select ISNUMERIC(Replace(CHAR(10), '', @value)) select ISNUMERIC(Replace(CHAR(13), '', @value)) select ISNUMERIC(Replace(CHAR(32), '', @value)) ```
I would check the length. This will give you an idea if how many special characters you are looking for. ``` SELECT LEN(Revenue) FROM OLTP.ExtractedData ``` Then use `SUBSTRING` and `ASCII` to find out what the character is. ``` SELECT ASCII(SUBSTRING(Revenue, 5, 1)) FROM OLTP.ExtractedData ```
28,517,282
I have a code::blocks project, called Test.cbp. It has three files, `main.cpp` in the `Test` directory, and `jAlg.cpp` and `jAlg.h`, both in the `jAlg` directory. **main.cpp** ``` #include <iostream> #include "jAlg.h" int main(){ jVector bob; jMatrix ann; bob.display(); return 0; } ``` **jAlg.cpp**...
2015/02/14
[ "https://Stackoverflow.com/questions/28517282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4333939/" ]
You can use `mpl.rc_context` to temporarily set the default `figsize` before plotting. ``` import numpy as np import matplotlib as mpl from statsmodels.graphics.gofplots import qqplot_2samples np.random.seed(10) sample1 = np.random.rand(10) sample2 = np.random.rand(10) n, m = 6, 6 with mpl.rc_context(): mpl.rc("...
The `qqplot_2samples` function has an `ax` parameter which allows you to specify a matplotlib axes object on which the plot should be drawn. If you don't supply the `ax`, then a new axes object is created for you. So, as an alternative to cel's solution, if you wish to create your own figure, then you should also pass...
28,517,282
I have a code::blocks project, called Test.cbp. It has three files, `main.cpp` in the `Test` directory, and `jAlg.cpp` and `jAlg.h`, both in the `jAlg` directory. **main.cpp** ``` #include <iostream> #include "jAlg.h" int main(){ jVector bob; jMatrix ann; bob.display(); return 0; } ``` **jAlg.cpp**...
2015/02/14
[ "https://Stackoverflow.com/questions/28517282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4333939/" ]
You can use `mpl.rc_context` to temporarily set the default `figsize` before plotting. ``` import numpy as np import matplotlib as mpl from statsmodels.graphics.gofplots import qqplot_2samples np.random.seed(10) sample1 = np.random.rand(10) sample2 = np.random.rand(10) n, m = 6, 6 with mpl.rc_context(): mpl.rc("...
This is a great solution and works for other plots too - I upvoted it. Here is the implementation for acf and pacf plots. ``` N, M = 12, 6 fig, ax = plt.subplots(figsize=(N, M)) plot_pacf(df2, lags = 40, title='Daily Female Births', ax=ax) plt.show() ```
28,517,282
I have a code::blocks project, called Test.cbp. It has three files, `main.cpp` in the `Test` directory, and `jAlg.cpp` and `jAlg.h`, both in the `jAlg` directory. **main.cpp** ``` #include <iostream> #include "jAlg.h" int main(){ jVector bob; jMatrix ann; bob.display(); return 0; } ``` **jAlg.cpp**...
2015/02/14
[ "https://Stackoverflow.com/questions/28517282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4333939/" ]
You can use `mpl.rc_context` to temporarily set the default `figsize` before plotting. ``` import numpy as np import matplotlib as mpl from statsmodels.graphics.gofplots import qqplot_2samples np.random.seed(10) sample1 = np.random.rand(10) sample2 = np.random.rand(10) n, m = 6, 6 with mpl.rc_context(): mpl.rc("...
Just use `plt.rc("figure", figsize=(16,8))` before plotting.
28,517,282
I have a code::blocks project, called Test.cbp. It has three files, `main.cpp` in the `Test` directory, and `jAlg.cpp` and `jAlg.h`, both in the `jAlg` directory. **main.cpp** ``` #include <iostream> #include "jAlg.h" int main(){ jVector bob; jMatrix ann; bob.display(); return 0; } ``` **jAlg.cpp**...
2015/02/14
[ "https://Stackoverflow.com/questions/28517282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4333939/" ]
You can use `mpl.rc_context` to temporarily set the default `figsize` before plotting. ``` import numpy as np import matplotlib as mpl from statsmodels.graphics.gofplots import qqplot_2samples np.random.seed(10) sample1 = np.random.rand(10) sample2 = np.random.rand(10) n, m = 6, 6 with mpl.rc_context(): mpl.rc("...
Check this link [here.](https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.rc.html) I used `plt.rc()` ```py plt.rc("figure", figsize=(10,6)) sm.graphics.tsa.plot_acf(nifty_50['close_price'], lags=36000); ```
28,517,282
I have a code::blocks project, called Test.cbp. It has three files, `main.cpp` in the `Test` directory, and `jAlg.cpp` and `jAlg.h`, both in the `jAlg` directory. **main.cpp** ``` #include <iostream> #include "jAlg.h" int main(){ jVector bob; jMatrix ann; bob.display(); return 0; } ``` **jAlg.cpp**...
2015/02/14
[ "https://Stackoverflow.com/questions/28517282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4333939/" ]
This is a great solution and works for other plots too - I upvoted it. Here is the implementation for acf and pacf plots. ``` N, M = 12, 6 fig, ax = plt.subplots(figsize=(N, M)) plot_pacf(df2, lags = 40, title='Daily Female Births', ax=ax) plt.show() ```
The `qqplot_2samples` function has an `ax` parameter which allows you to specify a matplotlib axes object on which the plot should be drawn. If you don't supply the `ax`, then a new axes object is created for you. So, as an alternative to cel's solution, if you wish to create your own figure, then you should also pass...
28,517,282
I have a code::blocks project, called Test.cbp. It has three files, `main.cpp` in the `Test` directory, and `jAlg.cpp` and `jAlg.h`, both in the `jAlg` directory. **main.cpp** ``` #include <iostream> #include "jAlg.h" int main(){ jVector bob; jMatrix ann; bob.display(); return 0; } ``` **jAlg.cpp**...
2015/02/14
[ "https://Stackoverflow.com/questions/28517282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4333939/" ]
The `qqplot_2samples` function has an `ax` parameter which allows you to specify a matplotlib axes object on which the plot should be drawn. If you don't supply the `ax`, then a new axes object is created for you. So, as an alternative to cel's solution, if you wish to create your own figure, then you should also pass...
Check this link [here.](https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.rc.html) I used `plt.rc()` ```py plt.rc("figure", figsize=(10,6)) sm.graphics.tsa.plot_acf(nifty_50['close_price'], lags=36000); ```
28,517,282
I have a code::blocks project, called Test.cbp. It has three files, `main.cpp` in the `Test` directory, and `jAlg.cpp` and `jAlg.h`, both in the `jAlg` directory. **main.cpp** ``` #include <iostream> #include "jAlg.h" int main(){ jVector bob; jMatrix ann; bob.display(); return 0; } ``` **jAlg.cpp**...
2015/02/14
[ "https://Stackoverflow.com/questions/28517282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4333939/" ]
This is a great solution and works for other plots too - I upvoted it. Here is the implementation for acf and pacf plots. ``` N, M = 12, 6 fig, ax = plt.subplots(figsize=(N, M)) plot_pacf(df2, lags = 40, title='Daily Female Births', ax=ax) plt.show() ```
Just use `plt.rc("figure", figsize=(16,8))` before plotting.
28,517,282
I have a code::blocks project, called Test.cbp. It has three files, `main.cpp` in the `Test` directory, and `jAlg.cpp` and `jAlg.h`, both in the `jAlg` directory. **main.cpp** ``` #include <iostream> #include "jAlg.h" int main(){ jVector bob; jMatrix ann; bob.display(); return 0; } ``` **jAlg.cpp**...
2015/02/14
[ "https://Stackoverflow.com/questions/28517282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4333939/" ]
This is a great solution and works for other plots too - I upvoted it. Here is the implementation for acf and pacf plots. ``` N, M = 12, 6 fig, ax = plt.subplots(figsize=(N, M)) plot_pacf(df2, lags = 40, title='Daily Female Births', ax=ax) plt.show() ```
Check this link [here.](https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.rc.html) I used `plt.rc()` ```py plt.rc("figure", figsize=(10,6)) sm.graphics.tsa.plot_acf(nifty_50['close_price'], lags=36000); ```
28,517,282
I have a code::blocks project, called Test.cbp. It has three files, `main.cpp` in the `Test` directory, and `jAlg.cpp` and `jAlg.h`, both in the `jAlg` directory. **main.cpp** ``` #include <iostream> #include "jAlg.h" int main(){ jVector bob; jMatrix ann; bob.display(); return 0; } ``` **jAlg.cpp**...
2015/02/14
[ "https://Stackoverflow.com/questions/28517282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4333939/" ]
Just use `plt.rc("figure", figsize=(16,8))` before plotting.
Check this link [here.](https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.rc.html) I used `plt.rc()` ```py plt.rc("figure", figsize=(10,6)) sm.graphics.tsa.plot_acf(nifty_50['close_price'], lags=36000); ```
44,148,979
So today my data structures final had an exam question that asked this: "Consider the BinaryTree class and add two recursive methods (independent from each other) named compBT to compare two binary trees. If the two binary trees are structurally identical (i.e., they look the same when the objects stored in the nodes...
2017/05/24
[ "https://Stackoverflow.com/questions/44148979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6859466/" ]
If your script has no `#PBS` directives, and you don't submit with something like `qsub -q batch ...`, then it seems like you either a) have no default queue defined, or b) the queue name being submitted to does not exist (or has a typo). Run this (as an admin) to see the default queue: `qmgr -c 'print server default_...
This is what i found out from [here](https://www.nas.nasa.gov/hecc/support/kb/common-reasons-for-being-unable-to-submit-jobs_197.html) : Queue is Unknown Be sure to use the correct queue. For Pleiades jobs, use the common queue names normal, long, vlong, and debug. For Endeavour jobs, use the queue names e\_normal, e...
21,512,076
From set theory: > > Sets A,B are disjoint exactly if A∩B = {} > > > *where {} is empty set*. Reference: [**Elementary Set Theory with a Universal Set**, *by Randall Holmes*](http://www.e-booksdirectory.com/details.php?ebook=5313) Furthermore it says; > > It is not correct to say that disjoint sets A and B ha...
2014/02/02
[ "https://Stackoverflow.com/questions/21512076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1712065/" ]
Your `Intersect` returns `IEnumerable<string>`. Therefore you are comparing two *instances* of IEnumerable. As L.B mentioned in the comments, you can use `Any` to check whether the resultant `IEnumerable<string>` is empty. ``` bool empty = !a.Intersect(b).Any(); ``` Another way would be to use HashSet's `SetEquals` ...
The `==` operator in C# and most similar programming languages is not the kind of equality that you can find in mathematics. It behaves like that with most numbers, but even that is not always true (in case of floating point rounding errors). It is very different when it comes to comparing objects. In your case, it mer...
17,277,427
Should I use MySQL with SSL protocol if my web application and database are on the same machine?
2013/06/24
[ "https://Stackoverflow.com/questions/17277427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1688894/" ]
There is no definitive answer to about when you should use MySQL over SSL. If your website isn't dealing with sensitive information, then you most likely don't need it. However, if you deal with information such as payment info (or similar sensitive info) coming back and forth from your scripting language and MySQL, t...
That depends on how much you trust the other users on that machine. If you don't use SSL, the logins will be passed as cleartext, and potentially sniffable by anyone else on that machine.
17,277,427
Should I use MySQL with SSL protocol if my web application and database are on the same machine?
2013/06/24
[ "https://Stackoverflow.com/questions/17277427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1688894/" ]
If MySQL and the client application run on the same machine, then the best idea would be to have them communicate via a [Unix domain socket](http://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_socket). I don't think one can spy communications on this channel without kind of rewriting some low-level...
That depends on how much you trust the other users on that machine. If you don't use SSL, the logins will be passed as cleartext, and potentially sniffable by anyone else on that machine.
16,560,485
I have a ViewPager that I am populating with fragments(representing objects from arrayListOfObjects) using FragmentStatePagerAdapter. All works well: ``` mMyFragmentPagerAdapter = new fragmentAdapter(getSupportFragmentManager(),orientation ,rePopulatedfireInfoList); mPager = (ViewPager)...
2013/05/15
[ "https://Stackoverflow.com/questions/16560485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1961015/" ]
I guess the problem is in the fact that old fragments still reside in `FragmentManager` you use for your adapter. If this is the case all you have to do is remove all old fragments from the fragment manager. So basically just execute the following code in the constructor of your adapter: ``` public fragmentAdapter(Fr...
All I needed to do was to re-assign the FragmentStatePagerAdapter. This has been in place as can be seen in onActivityResult but what was masking the correct behaviour was my viewPager page indicator it was incrementing the pages e.g. if I had 2 pages on the viewPager and call the child actvity which will add one obje...
45,902,511
My javascript array is : ``` [ "Action=Complete", "Echo=echotest", "PayerID=1675506249460924", "ObfuscatedAccountNumber=*********************", "ExpireDate=1225", "CardholderName=John Q. Test", "Address1=123 A. Street", "A...
2017/08/27
[ "https://Stackoverflow.com/questions/45902511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4588730/" ]
This is a hacky solution of mine. ``` var array = [ "Action=Complete", "Echo=echotest", "PayerID=1675506249460924", "ObfuscatedAccountNumber=*********************", "ExpireDate=1225", "CardholderName=John Q. Test", "Address1=123 A. Street", "Address2=", "Address3=", "City=Orem",...
You can try: `JSON.stringify (yourArray);`. You can consult the documentation [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON). Tell me if you have some questions.
45,902,511
My javascript array is : ``` [ "Action=Complete", "Echo=echotest", "PayerID=1675506249460924", "ObfuscatedAccountNumber=*********************", "ExpireDate=1225", "CardholderName=John Q. Test", "Address1=123 A. Street", "A...
2017/08/27
[ "https://Stackoverflow.com/questions/45902511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4588730/" ]
You can use `map` function which will return an array.That array will contain the required object. Use the split function to split the string. ```js var oldArray = [ "Action=Complete", "Echo=echotest", "PayerID=1675506249460924", "ObfuscatedAccountNumber=*********************", "ExpireDate=1225", "Ca...
You can try: `JSON.stringify (yourArray);`. You can consult the documentation [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON). Tell me if you have some questions.
45,902,511
My javascript array is : ``` [ "Action=Complete", "Echo=echotest", "PayerID=1675506249460924", "ObfuscatedAccountNumber=*********************", "ExpireDate=1225", "CardholderName=John Q. Test", "Address1=123 A. Street", "A...
2017/08/27
[ "https://Stackoverflow.com/questions/45902511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4588730/" ]
This is a hacky solution of mine. ``` var array = [ "Action=Complete", "Echo=echotest", "PayerID=1675506249460924", "ObfuscatedAccountNumber=*********************", "ExpireDate=1225", "CardholderName=John Q. Test", "Address1=123 A. Street", "Address2=", "Address3=", "City=Orem",...
You can use `map` function which will return an array.That array will contain the required object. Use the split function to split the string. ```js var oldArray = [ "Action=Complete", "Echo=echotest", "PayerID=1675506249460924", "ObfuscatedAccountNumber=*********************", "ExpireDate=1225", "Ca...
3,231,009
When deriving the quadratic formula, isn't the square root of $(x+\frac{b}{2a})^2$ the absolute value of $(x+\frac{b}{2a})$? It's usually just represented as $(x+\frac{b}{2a})$ without absolute value and then $\frac{b}{2a}$ is subtracted from left side and boom, theres the quadratic formula. I just don't understand why...
2019/05/18
[ "https://math.stackexchange.com/questions/3231009", "https://math.stackexchange.com", "https://math.stackexchange.com/users/675281/" ]
You seem to be asking why after the step $\;\left(x+\cfrac b{2a}\right)^2=\cfrac{b^2-4ac}{4a^2}\;$ , they don't go to $$\left|x+\cfrac b{2a}\right|=\sqrt{\frac{b^2-4ac}{4a^2}}$$ But we **actually** do! To write the above is **exactly** the same as to write $$x+\cfrac b{2a}=\pm\sqrt\frac{b^2-4ac}{4a^2}$$ just as $\;...
Well actually it is done. $$ax^2 + bx + c = 0$$ $$\implies x^2+\frac{bx}{a} +\frac{c}{a} = 0$$ Now completing the square: $$\left(x+\frac{b}{2a}\right)^2= \frac{b^2-4ac}{4a^2}$$ Now since we know that, $$x^2 = a, \quad a > 0$$ has two solutions, $x=\pm a$. Now if $b^2 - 4ac > 0$, there are two solutions in...
3,231,009
When deriving the quadratic formula, isn't the square root of $(x+\frac{b}{2a})^2$ the absolute value of $(x+\frac{b}{2a})$? It's usually just represented as $(x+\frac{b}{2a})$ without absolute value and then $\frac{b}{2a}$ is subtracted from left side and boom, theres the quadratic formula. I just don't understand why...
2019/05/18
[ "https://math.stackexchange.com/questions/3231009", "https://math.stackexchange.com", "https://math.stackexchange.com/users/675281/" ]
Well actually it is done. $$ax^2 + bx + c = 0$$ $$\implies x^2+\frac{bx}{a} +\frac{c}{a} = 0$$ Now completing the square: $$\left(x+\frac{b}{2a}\right)^2= \frac{b^2-4ac}{4a^2}$$ Now since we know that, $$x^2 = a, \quad a > 0$$ has two solutions, $x=\pm a$. Now if $b^2 - 4ac > 0$, there are two solutions in...
When they get to point of having $$\bigl{(}x+\frac{b}{2a}\bigr{)}^2 =-\frac{c}{a}+\bigl{(}\frac{b}{2a}\bigr{)}$$ the square root of both sides has no absolute value sign on the left because the right side can be $\pm$. $$\biggl{|}x+\frac{b}{2a}\biggr{|}\ne\sqrt{-\frac{c}{a}+\biggl{(}\frac{b}{2a}\biggr{)}}$$ One comple...
3,231,009
When deriving the quadratic formula, isn't the square root of $(x+\frac{b}{2a})^2$ the absolute value of $(x+\frac{b}{2a})$? It's usually just represented as $(x+\frac{b}{2a})$ without absolute value and then $\frac{b}{2a}$ is subtracted from left side and boom, theres the quadratic formula. I just don't understand why...
2019/05/18
[ "https://math.stackexchange.com/questions/3231009", "https://math.stackexchange.com", "https://math.stackexchange.com/users/675281/" ]
Well actually it is done. $$ax^2 + bx + c = 0$$ $$\implies x^2+\frac{bx}{a} +\frac{c}{a} = 0$$ Now completing the square: $$\left(x+\frac{b}{2a}\right)^2= \frac{b^2-4ac}{4a^2}$$ Now since we know that, $$x^2 = a, \quad a > 0$$ has two solutions, $x=\pm a$. Now if $b^2 - 4ac > 0$, there are two solutions in...
You can look at it differently: $$ax^2+bx+c=0 \iff \\ x^2+\frac bax+\frac ca=0\iff \\ \left(x+\frac b{2a}\right)^2-\frac{b^2}{4a^2}+\frac{4ac}{4a^2}=0 \iff \\ \left(x+\frac b{2a}\right)^2-\left(\frac{\sqrt{b^2-4ac}}{2a}\right)^2=0 \iff \\ \left[\left(x+\frac b{2a}\right)-\frac{\sqrt{b^2-4ac}}{2a}\right]\cdot \left[\lef...
3,231,009
When deriving the quadratic formula, isn't the square root of $(x+\frac{b}{2a})^2$ the absolute value of $(x+\frac{b}{2a})$? It's usually just represented as $(x+\frac{b}{2a})$ without absolute value and then $\frac{b}{2a}$ is subtracted from left side and boom, theres the quadratic formula. I just don't understand why...
2019/05/18
[ "https://math.stackexchange.com/questions/3231009", "https://math.stackexchange.com", "https://math.stackexchange.com/users/675281/" ]
You seem to be asking why after the step $\;\left(x+\cfrac b{2a}\right)^2=\cfrac{b^2-4ac}{4a^2}\;$ , they don't go to $$\left|x+\cfrac b{2a}\right|=\sqrt{\frac{b^2-4ac}{4a^2}}$$ But we **actually** do! To write the above is **exactly** the same as to write $$x+\cfrac b{2a}=\pm\sqrt\frac{b^2-4ac}{4a^2}$$ just as $\;...
When they get to point of having $$\bigl{(}x+\frac{b}{2a}\bigr{)}^2 =-\frac{c}{a}+\bigl{(}\frac{b}{2a}\bigr{)}$$ the square root of both sides has no absolute value sign on the left because the right side can be $\pm$. $$\biggl{|}x+\frac{b}{2a}\biggr{|}\ne\sqrt{-\frac{c}{a}+\biggl{(}\frac{b}{2a}\biggr{)}}$$ One comple...
3,231,009
When deriving the quadratic formula, isn't the square root of $(x+\frac{b}{2a})^2$ the absolute value of $(x+\frac{b}{2a})$? It's usually just represented as $(x+\frac{b}{2a})$ without absolute value and then $\frac{b}{2a}$ is subtracted from left side and boom, theres the quadratic formula. I just don't understand why...
2019/05/18
[ "https://math.stackexchange.com/questions/3231009", "https://math.stackexchange.com", "https://math.stackexchange.com/users/675281/" ]
You seem to be asking why after the step $\;\left(x+\cfrac b{2a}\right)^2=\cfrac{b^2-4ac}{4a^2}\;$ , they don't go to $$\left|x+\cfrac b{2a}\right|=\sqrt{\frac{b^2-4ac}{4a^2}}$$ But we **actually** do! To write the above is **exactly** the same as to write $$x+\cfrac b{2a}=\pm\sqrt\frac{b^2-4ac}{4a^2}$$ just as $\;...
You can look at it differently: $$ax^2+bx+c=0 \iff \\ x^2+\frac bax+\frac ca=0\iff \\ \left(x+\frac b{2a}\right)^2-\frac{b^2}{4a^2}+\frac{4ac}{4a^2}=0 \iff \\ \left(x+\frac b{2a}\right)^2-\left(\frac{\sqrt{b^2-4ac}}{2a}\right)^2=0 \iff \\ \left[\left(x+\frac b{2a}\right)-\frac{\sqrt{b^2-4ac}}{2a}\right]\cdot \left[\lef...
3,231,009
When deriving the quadratic formula, isn't the square root of $(x+\frac{b}{2a})^2$ the absolute value of $(x+\frac{b}{2a})$? It's usually just represented as $(x+\frac{b}{2a})$ without absolute value and then $\frac{b}{2a}$ is subtracted from left side and boom, theres the quadratic formula. I just don't understand why...
2019/05/18
[ "https://math.stackexchange.com/questions/3231009", "https://math.stackexchange.com", "https://math.stackexchange.com/users/675281/" ]
You can look at it differently: $$ax^2+bx+c=0 \iff \\ x^2+\frac bax+\frac ca=0\iff \\ \left(x+\frac b{2a}\right)^2-\frac{b^2}{4a^2}+\frac{4ac}{4a^2}=0 \iff \\ \left(x+\frac b{2a}\right)^2-\left(\frac{\sqrt{b^2-4ac}}{2a}\right)^2=0 \iff \\ \left[\left(x+\frac b{2a}\right)-\frac{\sqrt{b^2-4ac}}{2a}\right]\cdot \left[\lef...
When they get to point of having $$\bigl{(}x+\frac{b}{2a}\bigr{)}^2 =-\frac{c}{a}+\bigl{(}\frac{b}{2a}\bigr{)}$$ the square root of both sides has no absolute value sign on the left because the right side can be $\pm$. $$\biggl{|}x+\frac{b}{2a}\biggr{|}\ne\sqrt{-\frac{c}{a}+\biggl{(}\frac{b}{2a}\biggr{)}}$$ One comple...
11,252,940
I want to initialize an instance variable within my Rails model that will hold an array and I want to access this variable in other methods within my model. I tried this: ``` class Participant < ActiveRecord::Base @possible_statuses = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', '...
2012/06/28
[ "https://Stackoverflow.com/questions/11252940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1090367/" ]
I would recommend using a constant for this kind of cases: ``` class Participant < ActiveRecord::Base STATUSES = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', 'money_sent' ] ``` If you want to access that array from the inside class, just do `STATUSES`, and from the outside cla...
In your example, @possible\_statuses is a variable on the class rather than on each instance of the object. Here is a rather verbose example of how you might accomplish this: ``` class Participant < ActiveRecord::Base @possible_statuses = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', ...
11,252,940
I want to initialize an instance variable within my Rails model that will hold an array and I want to access this variable in other methods within my model. I tried this: ``` class Participant < ActiveRecord::Base @possible_statuses = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', '...
2012/06/28
[ "https://Stackoverflow.com/questions/11252940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1090367/" ]
I would recommend using a constant for this kind of cases: ``` class Participant < ActiveRecord::Base STATUSES = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', 'money_sent' ] ``` If you want to access that array from the inside class, just do `STATUSES`, and from the outside cla...
The instance variable will only exist when you create the model, since it is not being stored in a database anywhere. You will want to make it a constant as per Nobita's suggestion. Alternatively, you could make it a module like... ``` module Status EXISTS = "exists" PAIRED = "paired" QUIZ_FINISHED = "quiz_finis...
11,252,940
I want to initialize an instance variable within my Rails model that will hold an array and I want to access this variable in other methods within my model. I tried this: ``` class Participant < ActiveRecord::Base @possible_statuses = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', '...
2012/06/28
[ "https://Stackoverflow.com/questions/11252940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1090367/" ]
I would recommend using a constant for this kind of cases: ``` class Participant < ActiveRecord::Base STATUSES = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', 'money_sent' ] ``` If you want to access that array from the inside class, just do `STATUSES`, and from the outside cla...
The best answer for me was to create a class variable, not an instance variable: ``` @@possible_statuses = [ 'exists', 'paired', 'chat1_ready', 'chat1_complete' ] ``` I could then freely access it in methods of the class: ``` def status=(new_status) self.status_data = @@possible_statuses.index...
11,252,940
I want to initialize an instance variable within my Rails model that will hold an array and I want to access this variable in other methods within my model. I tried this: ``` class Participant < ActiveRecord::Base @possible_statuses = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', '...
2012/06/28
[ "https://Stackoverflow.com/questions/11252940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1090367/" ]
In your example, @possible\_statuses is a variable on the class rather than on each instance of the object. Here is a rather verbose example of how you might accomplish this: ``` class Participant < ActiveRecord::Base @possible_statuses = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', ...
The instance variable will only exist when you create the model, since it is not being stored in a database anywhere. You will want to make it a constant as per Nobita's suggestion. Alternatively, you could make it a module like... ``` module Status EXISTS = "exists" PAIRED = "paired" QUIZ_FINISHED = "quiz_finis...
11,252,940
I want to initialize an instance variable within my Rails model that will hold an array and I want to access this variable in other methods within my model. I tried this: ``` class Participant < ActiveRecord::Base @possible_statuses = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', '...
2012/06/28
[ "https://Stackoverflow.com/questions/11252940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1090367/" ]
The best answer for me was to create a class variable, not an instance variable: ``` @@possible_statuses = [ 'exists', 'paired', 'chat1_ready', 'chat1_complete' ] ``` I could then freely access it in methods of the class: ``` def status=(new_status) self.status_data = @@possible_statuses.index...
In your example, @possible\_statuses is a variable on the class rather than on each instance of the object. Here is a rather verbose example of how you might accomplish this: ``` class Participant < ActiveRecord::Base @possible_statuses = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', ...
11,252,940
I want to initialize an instance variable within my Rails model that will hold an array and I want to access this variable in other methods within my model. I tried this: ``` class Participant < ActiveRecord::Base @possible_statuses = [ 'exists', 'paired', 'quiz_finished', 'quiz_results_seen', '...
2012/06/28
[ "https://Stackoverflow.com/questions/11252940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1090367/" ]
The best answer for me was to create a class variable, not an instance variable: ``` @@possible_statuses = [ 'exists', 'paired', 'chat1_ready', 'chat1_complete' ] ``` I could then freely access it in methods of the class: ``` def status=(new_status) self.status_data = @@possible_statuses.index...
The instance variable will only exist when you create the model, since it is not being stored in a database anywhere. You will want to make it a constant as per Nobita's suggestion. Alternatively, you could make it a module like... ``` module Status EXISTS = "exists" PAIRED = "paired" QUIZ_FINISHED = "quiz_finis...
46,322,419
With iOS 11 and iPhone X [Apple specified](https://developer.apple.com/ios/human-interface-guidelines/overview/iphone-x/) every app should live in a "safe area" (due to the virtual home button): [![enter image description here](https://i.stack.imgur.com/5643k.png)](https://i.stack.imgur.com/5643k.png) > > **Inset es...
2017/09/20
[ "https://Stackoverflow.com/questions/46322419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4734139/" ]
You should be able to apply the same principle outlined in [this answer](https://stackoverflow.com/a/46232813/777265) to the Ionic v1 footer, i.e. ``` .bar-footer { margin-bottom: constant(safe-area-inset-bottom); } ``` (or something similar - I haven't tested this)
You can add a constraint to your custom tabBar main view to connect it to the bottom safeAreaLayoutGuide. ``` yourView.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor).isActive = true ```
46,322,419
With iOS 11 and iPhone X [Apple specified](https://developer.apple.com/ios/human-interface-guidelines/overview/iphone-x/) every app should live in a "safe area" (due to the virtual home button): [![enter image description here](https://i.stack.imgur.com/5643k.png)](https://i.stack.imgur.com/5643k.png) > > **Inset es...
2017/09/20
[ "https://Stackoverflow.com/questions/46322419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4734139/" ]
For an Ionic 4 project, this would be: **app.scss** ``` body { margin-top: env(safe-area-inset-top); margin-top: constant(safe-area-inset-top); } ion-tab-bar { margin-bottom: env(safe-area-inset-bottom); } ``` `env` is for more recent iOS11 versions, and `constant` is for older ones.
You should be able to apply the same principle outlined in [this answer](https://stackoverflow.com/a/46232813/777265) to the Ionic v1 footer, i.e. ``` .bar-footer { margin-bottom: constant(safe-area-inset-bottom); } ``` (or something similar - I haven't tested this)
46,322,419
With iOS 11 and iPhone X [Apple specified](https://developer.apple.com/ios/human-interface-guidelines/overview/iphone-x/) every app should live in a "safe area" (due to the virtual home button): [![enter image description here](https://i.stack.imgur.com/5643k.png)](https://i.stack.imgur.com/5643k.png) > > **Inset es...
2017/09/20
[ "https://Stackoverflow.com/questions/46322419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4734139/" ]
For an Ionic1 project, I found that targeting the tab-nav did the trick. ``` .tab-nav { margin-bottom: constant(safe-area-inset-bottom); } ```
You can add a constraint to your custom tabBar main view to connect it to the bottom safeAreaLayoutGuide. ``` yourView.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor).isActive = true ```
46,322,419
With iOS 11 and iPhone X [Apple specified](https://developer.apple.com/ios/human-interface-guidelines/overview/iphone-x/) every app should live in a "safe area" (due to the virtual home button): [![enter image description here](https://i.stack.imgur.com/5643k.png)](https://i.stack.imgur.com/5643k.png) > > **Inset es...
2017/09/20
[ "https://Stackoverflow.com/questions/46322419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4734139/" ]
For an Ionic 4 project, this would be: **app.scss** ``` body { margin-top: env(safe-area-inset-top); margin-top: constant(safe-area-inset-top); } ion-tab-bar { margin-bottom: env(safe-area-inset-bottom); } ``` `env` is for more recent iOS11 versions, and `constant` is for older ones.
You can add a constraint to your custom tabBar main view to connect it to the bottom safeAreaLayoutGuide. ``` yourView.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor).isActive = true ```
46,322,419
With iOS 11 and iPhone X [Apple specified](https://developer.apple.com/ios/human-interface-guidelines/overview/iphone-x/) every app should live in a "safe area" (due to the virtual home button): [![enter image description here](https://i.stack.imgur.com/5643k.png)](https://i.stack.imgur.com/5643k.png) > > **Inset es...
2017/09/20
[ "https://Stackoverflow.com/questions/46322419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4734139/" ]
For an Ionic 4 project, this would be: **app.scss** ``` body { margin-top: env(safe-area-inset-top); margin-top: constant(safe-area-inset-top); } ion-tab-bar { margin-bottom: env(safe-area-inset-bottom); } ``` `env` is for more recent iOS11 versions, and `constant` is for older ones.
For an Ionic1 project, I found that targeting the tab-nav did the trick. ``` .tab-nav { margin-bottom: constant(safe-area-inset-bottom); } ```
63,588,126
I created a custom field for my products using [this tutorial](https://www.cloudways.com/blog/add-custom-product-fields-woocommerce/), but I need to set a default value for this field. I have already created hundreds of products and I need to have this field updated at those as well. I'm then using this value to order ...
2020/08/25
[ "https://Stackoverflow.com/questions/63588126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13242944/" ]
What I would do is use the `value` argument in the `woocommerce_wp_text_input` parameters. You can then pass it the current value OR a default if nothing exists yet. Also added new save routine via `woocommerce_admin_process_product_object` ``` // Display Fields add_action('woocommerce_product_options_general_product...
This is the solution which worked for me. ``` // Display Fields add_action('woocommerce_product_options_general_product_data', 'woocommerce_product_custom_fields'); // Save Fields add_action('woocommerce_process_product_meta', 'woocommerce_product_custom_fields_save'); function woocommerce_product_custom_fields() ...
51,526,159
I have a table with 2 columns `email` and `id`. I need to find emails that are closely related. For example: ``` john.smith12@example.com ``` and ``` john.smith12@some.subdomains.example.com ``` These should be considered the same because the username (`john.smith12`) and the most top level domain (`example.com`)...
2018/07/25
[ "https://Stackoverflow.com/questions/51526159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3783243/" ]
You told us that the table has 700K rows. This is not much, but you are joining it to itself, so in the worst case the engine would have to process `700K * 700K = 490 000 000 000 = 490B` rows. An index can definitely help here. The best index depends on the data distribution. What does the following query return? ...
No `REGEXP_REPLACE` needed, so it will work in all versions of MySQL/MariaDB: ``` UPDATE tbl SET email = CONCAT(SUBSTRING_INDEX(email, '@', 1), '@', SUBSTRING_INDEX( SUBSTRING_INDEX(email, '@', -1), '.', ...
51,526,159
I have a table with 2 columns `email` and `id`. I need to find emails that are closely related. For example: ``` john.smith12@example.com ``` and ``` john.smith12@some.subdomains.example.com ``` These should be considered the same because the username (`john.smith12`) and the most top level domain (`example.com`)...
2018/07/25
[ "https://Stackoverflow.com/questions/51526159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3783243/" ]
No `REGEXP_REPLACE` needed, so it will work in all versions of MySQL/MariaDB: ``` UPDATE tbl SET email = CONCAT(SUBSTRING_INDEX(email, '@', 1), '@', SUBSTRING_INDEX( SUBSTRING_INDEX(email, '@', -1), '.', ...
If you search related data, you should have look to some data mining tools or Elastic Search for instance, which work like you need. I have another possible "database-only" solution, but I don't know if it would work or if it'd be the best solution. If I have had to do this, I would try to make a table of "word refer...
51,526,159
I have a table with 2 columns `email` and `id`. I need to find emails that are closely related. For example: ``` john.smith12@example.com ``` and ``` john.smith12@some.subdomains.example.com ``` These should be considered the same because the username (`john.smith12`) and the most top level domain (`example.com`)...
2018/07/25
[ "https://Stackoverflow.com/questions/51526159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3783243/" ]
No `REGEXP_REPLACE` needed, so it will work in all versions of MySQL/MariaDB: ``` UPDATE tbl SET email = CONCAT(SUBSTRING_INDEX(email, '@', 1), '@', SUBSTRING_INDEX( SUBSTRING_INDEX(email, '@', -1), '.', ...
You get the name (i.e. the part before '@') with ``` substring_index(email, '@', 1) ``` You get the domain with ``` substring_index(replace(email, '@', '.'), '.', -2)) ``` (because if we substitute the '@' with a dot, then it's always the part after the second-to-last dot). Hence you find duplicates with ``` se...
51,526,159
I have a table with 2 columns `email` and `id`. I need to find emails that are closely related. For example: ``` john.smith12@example.com ``` and ``` john.smith12@some.subdomains.example.com ``` These should be considered the same because the username (`john.smith12`) and the most top level domain (`example.com`)...
2018/07/25
[ "https://Stackoverflow.com/questions/51526159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3783243/" ]
You told us that the table has 700K rows. This is not much, but you are joining it to itself, so in the worst case the engine would have to process `700K * 700K = 490 000 000 000 = 490B` rows. An index can definitely help here. The best index depends on the data distribution. What does the following query return? ...
If you search related data, you should have look to some data mining tools or Elastic Search for instance, which work like you need. I have another possible "database-only" solution, but I don't know if it would work or if it'd be the best solution. If I have had to do this, I would try to make a table of "word refer...
51,526,159
I have a table with 2 columns `email` and `id`. I need to find emails that are closely related. For example: ``` john.smith12@example.com ``` and ``` john.smith12@some.subdomains.example.com ``` These should be considered the same because the username (`john.smith12`) and the most top level domain (`example.com`)...
2018/07/25
[ "https://Stackoverflow.com/questions/51526159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3783243/" ]
You told us that the table has 700K rows. This is not much, but you are joining it to itself, so in the worst case the engine would have to process `700K * 700K = 490 000 000 000 = 490B` rows. An index can definitely help here. The best index depends on the data distribution. What does the following query return? ...
You get the name (i.e. the part before '@') with ``` substring_index(email, '@', 1) ``` You get the domain with ``` substring_index(replace(email, '@', '.'), '.', -2)) ``` (because if we substitute the '@' with a dot, then it's always the part after the second-to-last dot). Hence you find duplicates with ``` se...
35,138
I'm using Emacs 25.1 on fresh Debian Unstable installation. I have gnupg installed on my system, and `twittering-use-master-password` is `t`. When I invoke `M-x twit`, a web page with an application PIN is opened, and I must enter that PIN in Emacs. After I authorize the application, I get the following messages: ``` ...
2017/08/27
[ "https://emacs.stackexchange.com/questions/35138", "https://emacs.stackexchange.com", "https://emacs.stackexchange.com/users/4026/" ]
From GnuPG 2.1 two software should be used: gpg-agent and pinentry. Update the files as follows: ``` $ echo 'allow-loopback-pinentry' >> ~/.gnupg/gpg-agent.conf $ echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf ``` Restart gpg-agent: ``` $ gpgconf --kill gpg-agent ``` It worked for me on Emacs24 / FreeBsd11, ...
My solution to this problem, generate a key with `gpg`: ``` $ gpg --generate-key gpg (GnuPG) 2.2.0; Copyright (C) 2017 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Note: Use "gpg --full-generate-key" for a full ...
61,142,527
I have one of those `.env` files with several variables set, like: ``` VAR1=111 VAR2=222 ``` I want to run a script (without changing it) that makes use of those variables. I know I can `source` that file in the shell and export the variables from the file, like: ``` set -a source myenvs.env # this is my .env fi...
2020/04/10
[ "https://Stackoverflow.com/questions/61142527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21420/" ]
Do that in a subshell and main shell's environment won't be altered. E.g: ``` ( set -a source myenvs.env # this is my .env file exec ./myscript.sh # avoid unnecessary fork() ) ``` > > The truth is I need to keep that script flexible to run with different combinations of settings. Imagine I have several .en...
Declare vars that you don't want to change as read only ``` declare -r VAR3 VAR4 ``` and source the rest ``` . ./myenvs.env ```
64,350,624
I am trying to place a div below a video and can't figure out what the best way is. I want to stick it to the bottom of the video and make it responsive. I want the div to stay at the same place on tablet/mobile screen too. Here is what I have for now: <https://codepen.io/luca099/pen/xxOwogo> ``` <div class="myBl...
2020/10/14
[ "https://Stackoverflow.com/questions/64350624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It seem works only with CompactDatePickerStyle ``` DatePicker("", selection: $notificationTimeOnPicker, displayedComponents: .hourAndMinute) .foregroundColor(Color("ChartColor")) .datePickerStyle(CompactDatePickerStyle()) .clipped() .labelsHidden() ```
Solution for UIKit ------------------ After several Google searches, I kept finding this post at the top of the results page, so I'm just going to answer here even though it doesn't exactly relate to the OP question, feel free to punish me ;). Given this structure in Interface Builder: [![enter image description her...
64,350,624
I am trying to place a div below a video and can't figure out what the best way is. I want to stick it to the bottom of the video and make it responsive. I want the div to stay at the same place on tablet/mobile screen too. Here is what I have for now: <https://codepen.io/luca099/pen/xxOwogo> ``` <div class="myBl...
2020/10/14
[ "https://Stackoverflow.com/questions/64350624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It seem works only with CompactDatePickerStyle ``` DatePicker("", selection: $notificationTimeOnPicker, displayedComponents: .hourAndMinute) .foregroundColor(Color("ChartColor")) .datePickerStyle(CompactDatePickerStyle()) .clipped() .labelsHidden() ```
The compact style was too small and the behaviour was strange for my requirements, so I reasonably hard coded the size considering accessibility as well: ``` struct ContentView: View { @Environment(\.sizeCategory) private var sizeCategory var body: some View { DatePicker("Select a time", selection...
64,350,624
I am trying to place a div below a video and can't figure out what the best way is. I want to stick it to the bottom of the video and make it responsive. I want the div to stay at the same place on tablet/mobile screen too. Here is what I have for now: <https://codepen.io/luca099/pen/xxOwogo> ``` <div class="myBl...
2020/10/14
[ "https://Stackoverflow.com/questions/64350624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The compact style was too small and the behaviour was strange for my requirements, so I reasonably hard coded the size considering accessibility as well: ``` struct ContentView: View { @Environment(\.sizeCategory) private var sizeCategory var body: some View { DatePicker("Select a time", selection...
Solution for UIKit ------------------ After several Google searches, I kept finding this post at the top of the results page, so I'm just going to answer here even though it doesn't exactly relate to the OP question, feel free to punish me ;). Given this structure in Interface Builder: [![enter image description her...
116,458
[![IR spec and C NMR](https://i.stack.imgur.com/WiZ5D.jpg)](https://i.stack.imgur.com/WiZ5D.jpg) [![H NMR](https://i.stack.imgur.com/Ef6cm.jpg)](https://i.stack.imgur.com/Ef6cm.jpg) I have the following IR spec, C NMR and H NMR data. The boiling points determined for the unknown compound were 116.8 and 119.1°C (two tri...
2019/06/06
[ "https://chemistry.stackexchange.com/questions/116458", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/57988/" ]
Peaks of acidic protons in an NMR spectrum can change (in position, form and intensity) due to exchange with other volatile protons. * A very fast exchange makes the peaks coalesce, you get one singlet between the two "original" (expected) chemical shifts, the exact position depends on the respective amount of both. *...
The proton on O or N atoms can be acidic enough to exchange with the deuterium atoms of the NMR solvent, thus "hydrogen-bonding protons" are often absent from H NMR spectra, or may show up "[anywhere](https://www.google.com/amp/s/www.researchgate.net/post/How_to_interpret-NH_and-OH_peaks_in_proton_NMR_and_how_to_report...
24,930,850
I'm parsing an array using `$.each()`, but inside it, I'm using `.splice()` method, so I need to iterate backward. Is it possible ? ``` var store = [...]; //... var rules = [...]; //... $.each(store, function(index, element) { // This loop needs to iterate backward $.each(rules, function(index2, rule) { if...
2014/07/24
[ "https://Stackoverflow.com/questions/24930850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2034990/" ]
``` $.each(store.reverse(), function(index, element) { // This loop iterate backward [...] ``` This works, it's the same as this post [jquery-each-backwards](https://stackoverflow.com/questions/4496795/how-to-iterate-elements-in-reverse-order-in-jquery/4496814). But the point here is, you're applying this over the `s...
You could use $.each but you'd have to decrement the indice variables (index, index2) as you did.
24,930,850
I'm parsing an array using `$.each()`, but inside it, I'm using `.splice()` method, so I need to iterate backward. Is it possible ? ``` var store = [...]; //... var rules = [...]; //... $.each(store, function(index, element) { // This loop needs to iterate backward $.each(rules, function(index2, rule) { if...
2014/07/24
[ "https://Stackoverflow.com/questions/24930850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2034990/" ]
You could use $.each but you'd have to decrement the indice variables (index, index2) as you did.
`$.each()` itself cannot be iterated backwards as there is no modifier for it. The input it takes is from a selector. which can be converted into an array. Then `$.each()` iterates forwards by index (0,1,2,... and so on). The only way to reverse flow is to either `Array.reverse()` or find an iterator loop that does so...
24,930,850
I'm parsing an array using `$.each()`, but inside it, I'm using `.splice()` method, so I need to iterate backward. Is it possible ? ``` var store = [...]; //... var rules = [...]; //... $.each(store, function(index, element) { // This loop needs to iterate backward $.each(rules, function(index2, rule) { if...
2014/07/24
[ "https://Stackoverflow.com/questions/24930850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2034990/" ]
``` $.each(store.reverse(), function(index, element) { // This loop iterate backward [...] ``` This works, it's the same as this post [jquery-each-backwards](https://stackoverflow.com/questions/4496795/how-to-iterate-elements-in-reverse-order-in-jquery/4496814). But the point here is, you're applying this over the `s...
`$.each()` itself cannot be iterated backwards as there is no modifier for it. The input it takes is from a selector. which can be converted into an array. Then `$.each()` iterates forwards by index (0,1,2,... and so on). The only way to reverse flow is to either `Array.reverse()` or find an iterator loop that does so...
6,258,176
I'm trying to read different lines of input through a file using scanf. I was only able to read the first line and to store it. here's the code I wrote. ``` #include <stdio.h> #include <string.h> int imageWidth, imageHeight, safeRegionStart, safeRegionWidth; main(void) { int i=0, j=0; int total...
2011/06/06
[ "https://Stackoverflow.com/questions/6258176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/786550/" ]
MY advice is to never use scanf (or fscanf) to read input. Read input using other methods (fgets, etc) and then parse the output. Possibly with sscanf, possibly with some other system. I've seen way too many errors from people reading directly with scanf.
Your code is reading data from standard input and not from file. Your code is screaming asking for error checking, but works in best case scenarios. Here is an example of running it: ``` $ ./test 1 2 3 4 total # of pixels: 2 Total # of safe Pixels: 8 12 13 $ ``` Basically, don't forget to hit `<Enter>`, `scanf` fu...
6,258,176
I'm trying to read different lines of input through a file using scanf. I was only able to read the first line and to store it. here's the code I wrote. ``` #include <stdio.h> #include <string.h> int imageWidth, imageHeight, safeRegionStart, safeRegionWidth; main(void) { int i=0, j=0; int total...
2011/06/06
[ "https://Stackoverflow.com/questions/6258176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/786550/" ]
MY advice is to never use scanf (or fscanf) to read input. Read input using other methods (fgets, etc) and then parse the output. Possibly with sscanf, possibly with some other system. I've seen way too many errors from people reading directly with scanf.
As Vlad Lazarenko said, you're reading data from standard input. If you want to read from a file you may consider using [fscanf](http://www.cplusplus.com/reference/clibrary/cstdio/fscanf/).
66,703
I am working for a company for the last 3 years, they sponsored me on Tier 2 General. My UK visa will expire in July of this year, the company was supposed to renew their COS allocations in January but they still haven't done it. Here are the reasons I have been told for this: * HR was too busy, they applied in Marc...
2016/05/08
[ "https://workplace.stackexchange.com/questions/66703", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/50254/" ]
You can hope for a miracle if the CEO knows and likes you personally, and it sounds like you can't make things worse so you might as well try, but the CEO would generally let lower management decide whether you were worth the trouble. Delegation is why multiple layers of management exist, after all. Make plans assumin...
Ask your CEO if he has time to discuss some Problems that you could not solve with your Manager. You can't drop the bom on him. Ask him if he has time for your Problems related to x. Seeing as you are a relatively small Company he might even know what you are talking about from the start. Honestly you should have sta...
130,924
I've owned my home for 1.5 years and it has been my primary residence. I decided to move, and want to sell, however, I'm unsure if I have to pay capital gains. When searching the internet I find conflicting resources. Some say I need to have owned the home for 1 year, others say 2. I've even read that if its my first ...
2020/09/16
[ "https://money.stackexchange.com/questions/130924", "https://money.stackexchange.com", "https://money.stackexchange.com/users/102595/" ]
The property must be your primary residence and you must have occupied it for 2 of the last 5 years and make no more than $250,000 in gains if you're single or $500,000 if file joint tax returns with a spouse. There are exceptions, for instance for members of the armed forces. Official IRS document regarding this sub...
How much (percentage) has the home appreciated in 1.5 years? If you're selling at the same price or less than you bought it then there are no gains to be had and no taxes to be paid. If you are selling above your purchase price then you can add qualified home improvements which you may have done during your occupancy...
6,595,585
In this fiddle <http://jsfiddle.net/mjmitche/6nar4/3/>, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be dragged into the boxes inside the black box. At the end of the fiddle, you see the code that changes the black box ...
2011/07/06
[ "https://Stackoverflow.com/questions/6595585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577455/" ]
I would go with such code: ``` var oBox = $("#blackbox"); var curClass = oBox.attr("class"); var newClass = (curClass == "bg_black") ? "bg_pink" : "bg_black"; oBox.removeClass().addClass(newClass); ``` To have it working, you first have to change your CSS and remove the `background` from the `#blackbox` declaration,...
Here is a working example in side a function: ```html function setCurrency(){ var returnCurrent; $("#RequestCurrencyType").is(":checked") === true ? returnCurrent = 'Dollar': returnCurrent = 'Euro'; return returnCurrent; } ``` In your case. Change the selector and the return values ```html $("#blackbo...
6,595,585
In this fiddle <http://jsfiddle.net/mjmitche/6nar4/3/>, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be dragged into the boxes inside the black box. At the end of the fiddle, you see the code that changes the black box ...
2011/07/06
[ "https://Stackoverflow.com/questions/6595585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577455/" ]
I think Dan and Nicola have suitable corrected code, however you may not be clear on why the original code didn't work. What has been called here a "ternary operator" is called a conditional operator in ECMA-262 section 11.12. It has the form: ``` LogicalORExpression ? AssignmentExpression : AssignmentExpression ```...
Also, the ternary operator expects expressions, not statements. Do not use semicolons, only at the end of the ternary op. ``` $("#blackbox").css({'background': $("#blackbox").css('background') === 'pink' ? 'black' : 'pink'}); ```
6,595,585
In this fiddle <http://jsfiddle.net/mjmitche/6nar4/3/>, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be dragged into the boxes inside the black box. At the end of the fiddle, you see the code that changes the black box ...
2011/07/06
[ "https://Stackoverflow.com/questions/6595585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577455/" ]
I would go with such code: ``` var oBox = $("#blackbox"); var curClass = oBox.attr("class"); var newClass = (curClass == "bg_black") ? "bg_pink" : "bg_black"; oBox.removeClass().addClass(newClass); ``` To have it working, you first have to change your CSS and remove the `background` from the `#blackbox` declaration,...
From what it looks like you are trying to do, [toggle](http://api.jquery.com/toggle/) might better solve your problem. EDIT: Sorry, toggle is just visibility, I don't think it will help your bg color toggling. But here you go: ``` var box = $("#blackbox"); box.css('background') == 'pink' ? box.css({'background':'bl...
6,595,585
In this fiddle <http://jsfiddle.net/mjmitche/6nar4/3/>, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be dragged into the boxes inside the black box. At the end of the fiddle, you see the code that changes the black box ...
2011/07/06
[ "https://Stackoverflow.com/questions/6595585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577455/" ]
I would go with such code: ``` var oBox = $("#blackbox"); var curClass = oBox.attr("class"); var newClass = (curClass == "bg_black") ? "bg_pink" : "bg_black"; oBox.removeClass().addClass(newClass); ``` To have it working, you first have to change your CSS and remove the `background` from the `#blackbox` declaration,...
I'd do (added caching): ``` var bbx = $("#blackbox"); bbx.css('background-color') === 'rgb(255, 192, 203)' ? bbx.css('background','black') : bbx.css('background','pink') ``` wroking fiddle (new AGAIN): <http://jsfiddle.net/6nar4/37/> I had to change the first operator as `css()` returns the rgb value of the color
6,595,585
In this fiddle <http://jsfiddle.net/mjmitche/6nar4/3/>, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be dragged into the boxes inside the black box. At the end of the fiddle, you see the code that changes the black box ...
2011/07/06
[ "https://Stackoverflow.com/questions/6595585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577455/" ]
I would go with such code: ``` var oBox = $("#blackbox"); var curClass = oBox.attr("class"); var newClass = (curClass == "bg_black") ? "bg_pink" : "bg_black"; oBox.removeClass().addClass(newClass); ``` To have it working, you first have to change your CSS and remove the `background` from the `#blackbox` declaration,...
Ternary operator works because the first part of it returns a Boolean value. In your case, jQuery's css method returns the jQuery object, thus not valid for ternary operation.
6,595,585
In this fiddle <http://jsfiddle.net/mjmitche/6nar4/3/>, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be dragged into the boxes inside the black box. At the end of the fiddle, you see the code that changes the black box ...
2011/07/06
[ "https://Stackoverflow.com/questions/6595585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577455/" ]
I'd do (added caching): ``` var bbx = $("#blackbox"); bbx.css('background-color') === 'rgb(255, 192, 203)' ? bbx.css('background','black') : bbx.css('background','pink') ``` wroking fiddle (new AGAIN): <http://jsfiddle.net/6nar4/37/> I had to change the first operator as `css()` returns the rgb value of the color
Ternary operator works because the first part of it returns a Boolean value. In your case, jQuery's css method returns the jQuery object, thus not valid for ternary operation.
6,595,585
In this fiddle <http://jsfiddle.net/mjmitche/6nar4/3/>, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be dragged into the boxes inside the black box. At the end of the fiddle, you see the code that changes the black box ...
2011/07/06
[ "https://Stackoverflow.com/questions/6595585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577455/" ]
I think Dan and Nicola have suitable corrected code, however you may not be clear on why the original code didn't work. What has been called here a "ternary operator" is called a conditional operator in ECMA-262 section 11.12. It has the form: ``` LogicalORExpression ? AssignmentExpression : AssignmentExpression ```...
As others have correctly pointed out, the first part of the ternary needs to return `true` or `false` and in your question the return value is a jQuery object. The problem that you may have in the comparison is that the [web color](http://en.wikipedia.org/wiki/Html_color) will be converted to RGB so you have to text f...
6,595,585
In this fiddle <http://jsfiddle.net/mjmitche/6nar4/3/>, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be dragged into the boxes inside the black box. At the end of the fiddle, you see the code that changes the black box ...
2011/07/06
[ "https://Stackoverflow.com/questions/6595585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577455/" ]
From what it looks like you are trying to do, [toggle](http://api.jquery.com/toggle/) might better solve your problem. EDIT: Sorry, toggle is just visibility, I don't think it will help your bg color toggling. But here you go: ``` var box = $("#blackbox"); box.css('background') == 'pink' ? box.css({'background':'bl...
Also, the ternary operator expects expressions, not statements. Do not use semicolons, only at the end of the ternary op. ``` $("#blackbox").css({'background': $("#blackbox").css('background') === 'pink' ? 'black' : 'pink'}); ```
6,595,585
In this fiddle <http://jsfiddle.net/mjmitche/6nar4/3/>, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be dragged into the boxes inside the black box. At the end of the fiddle, you see the code that changes the black box ...
2011/07/06
[ "https://Stackoverflow.com/questions/6595585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577455/" ]
Ternary operator works because the first part of it returns a Boolean value. In your case, jQuery's css method returns the jQuery object, thus not valid for ternary operation.
As others have correctly pointed out, the first part of the ternary needs to return `true` or `false` and in your question the return value is a jQuery object. The problem that you may have in the comparison is that the [web color](http://en.wikipedia.org/wiki/Html_color) will be converted to RGB so you have to text f...
6,595,585
In this fiddle <http://jsfiddle.net/mjmitche/6nar4/3/>, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be dragged into the boxes inside the black box. At the end of the fiddle, you see the code that changes the black box ...
2011/07/06
[ "https://Stackoverflow.com/questions/6595585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577455/" ]
I'd do (added caching): ``` var bbx = $("#blackbox"); bbx.css('background-color') === 'rgb(255, 192, 203)' ? bbx.css('background','black') : bbx.css('background','pink') ``` wroking fiddle (new AGAIN): <http://jsfiddle.net/6nar4/37/> I had to change the first operator as `css()` returns the rgb value of the color
From what it looks like you are trying to do, [toggle](http://api.jquery.com/toggle/) might better solve your problem. EDIT: Sorry, toggle is just visibility, I don't think it will help your bg color toggling. But here you go: ``` var box = $("#blackbox"); box.css('background') == 'pink' ? box.css({'background':'bl...
1,231,561
I have several projects built by maven, and I want to share some common properties among them - spring version, mysql driver version, svn base url, etc. - so I can update them once and it will be reflected on all projects. I thought of having a single super pom with all the properties, but if I change one of the prob...
2009/08/05
[ "https://Stackoverflow.com/questions/1231561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82804/" ]
What you can do is to use the [Properties Maven plugin](https://web.archive.org/web/20110107121304/http://mojo.codehaus.org:80/properties-maven-plugin/). This will let you define your properties in an external file, and the plugin will read this file. With this configuration : ``` <build> <plugins> <plugi...
I think the properties-maven-plugin is the right approach long term, but as you responded to that answer it doesn't allow the properties to be inherited. There are some facilities in maven-shared-io that allow you to discover resources on the project classpath. I've included some code below that extends the properties ...
1,231,561
I have several projects built by maven, and I want to share some common properties among them - spring version, mysql driver version, svn base url, etc. - so I can update them once and it will be reflected on all projects. I thought of having a single super pom with all the properties, but if I change one of the prob...
2009/08/05
[ "https://Stackoverflow.com/questions/1231561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82804/" ]
*Note that the original idea I have here is something that I am doing, but that I may have found a much better idea which I've also listed out below. I wanted to keep both ideas here for completeness in case the newer idea does **not** work.* --- I think you can solve this problem using the parent pom, but you need t...
I think the properties-maven-plugin is the right approach long term, but as you responded to that answer it doesn't allow the properties to be inherited. There are some facilities in maven-shared-io that allow you to discover resources on the project classpath. I've included some code below that extends the properties ...
23,626,725
I have a table named 'country' with a column named 'name' and the names in this column appears with translation followed by special character '/'. ``` IRELAND/IRLANDE GREECE/GRÈCE DENMARK/DANEMARK ``` Now i want only the countrynames before this special character'/' so the out put should look like this.. ``` IRELA...
2014/05/13
[ "https://Stackoverflow.com/questions/23626725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3518233/" ]
Printing all single result and then combinations of `two keys` using `combinations`. ``` from itertools import combinations for key in mydict: print "{}: '{}'".format(key, mydict[key]) for x, y in combinations(mydict, 2): print "{}: '{}'".format(x+y, '-'.join((mydict[x], mydict[y]))) ``` **UPDATED** Print...
We don't know what you are actually looking for, but if it it is the powerset you are looking for: ``` from copy import deepcopy def powerset (id_base=0, prefix="", dictionary=dict(), length=0): if length < 0: return dict() if length == 0: return dict((id_base,prefix)) if len(prefix): ...
24,788,262
There is a quote from [cppreference](http://en.cppreference.com/w/cpp/language/object#Alignment): > > Every object type has the property called alignment requirement, which > is an integer value (of type std::size\_t, always a power of 2) > representing the number of bytes between successive addresses at which > obje...
2014/07/16
[ "https://Stackoverflow.com/questions/24788262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2786156/" ]
The standard has the final word for the language, so here a quote of that section. I bolded the power-of-2 requirement: > > ### 3.11 Alignment `[basic.align]` > > > 1 Object types have alignment requirements (3.9.1, 3.9.2) which place restrictions on the addresses at which an object of that type may be allocated. A...
That's how computers are built. A computer has a natural 'word' size that is handled more easily than other sizes. On 64-bit CPUs, the size is 8-bytes. Operating on 8-bytes is most efficient. The hardware is built in a way that fetching memory that is aligned to this word size is also more efficient. So alignment is ...
55,413,409
I am new to java servlet and decided to make online coaching centre fees estimator... In this student have to select their board, class , subjects and submit the form `index.html`. Form data is requested at java servlet `Fees_Calculator .java`. The fees is than printed on through `servlet-out.println()` command. But fe...
2019/03/29
[ "https://Stackoverflow.com/questions/55413409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11276342/" ]
If the checkbox with value `English` is not selected this line `request.getParameter("English")` returns `null` and one of these lines `if(sub3.equals("on"))` throws `NullPointerException` hence the `out.println` lines are not reached. This happens if any of the checkboxes is not selected, the `NullPointerException` wi...
``` Hope it helps: index.jsp ----------------------------- <!DOCTYPE html> <html> <head> <title>Tuition Hub</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link type="text/png" rel="icon" href=""/> <style> #page{ back...
30,830,974
I am getting in touch with celery and I wrote a task by following [Tutorial](https://www.digitalocean.com/community/tutorials/how-to-use-celery-with-rabbitmq-to-queue-tasks-on-an-ubuntu-vps) but somehow worker not getting up and I get following log After entering command: ``` celery worker -A tasks -l debug ``` I ge...
2015/06/14
[ "https://Stackoverflow.com/questions/30830974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1437609/" ]
Don't run celery workers as root. I recommend using [supervisord](https://github.com/celery/celery/tree/3.1/extra/supervisord/) to manage celery workers - you can use the `user` configuration directive to specify which user to run the celery workers as.
The error message pretty much tells you what's going on in this case. You're trying to run the worker as root (generally a bad idea due to security concerns). If you want to override this and allow it to run, you must set your environment: ``` export C_FORCE_ROOT="true" ``` Then run the worker. Or you can just run...
7,546
![enter image description here](https://i.stack.imgur.com/z3v19.jpg) There's been a lot of talk recently about what it means to support piracy and pirated games. A very recent example is [this question](https://gaming.stackexchange.com/questions/127918/why-cant-i-harvest-blood-for-discerning-the-transmundane), in whic...
2013/08/19
[ "https://gaming.meta.stackexchange.com/questions/7546", "https://gaming.meta.stackexchange.com", "https://gaming.meta.stackexchange.com/users/3062/" ]
We are not here to judge users (though educating them might sometimes be adequate...). While posts and comments clearly implying the necessity of piracy should be removed due to the legal implications, the mere fact that someone uses a pirated version of a game does not render an otherwise valid question suddenly inval...
[SE's policy is to not dictate to us how to handle piracy, so studiously avoiding even the possibility of being involved in helping someone using a pirated game isn't *our* concern.](http://chat.stackexchange.com/transcript/message/10889506#10889506) That means my concerns about exposure to liability aren't relevant – ...
7,546
![enter image description here](https://i.stack.imgur.com/z3v19.jpg) There's been a lot of talk recently about what it means to support piracy and pirated games. A very recent example is [this question](https://gaming.stackexchange.com/questions/127918/why-cant-i-harvest-blood-for-discerning-the-transmundane), in whic...
2013/08/19
[ "https://gaming.meta.stackexchange.com/questions/7546", "https://gaming.meta.stackexchange.com", "https://gaming.meta.stackexchange.com/users/3062/" ]
As I see it, closing a question **strictly** because the asker admits (or implies) the use of an illegal copy, is a misuse of close votes. There are two major problems that arise from this, "Piracy == Close" policy. The first has been demonstrated by Sterno, who re-asked the question that sparked this whole debate. I...
We are not here to judge users (though educating them might sometimes be adequate...). While posts and comments clearly implying the necessity of piracy should be removed due to the legal implications, the mere fact that someone uses a pirated version of a game does not render an otherwise valid question suddenly inval...
7,546
![enter image description here](https://i.stack.imgur.com/z3v19.jpg) There's been a lot of talk recently about what it means to support piracy and pirated games. A very recent example is [this question](https://gaming.stackexchange.com/questions/127918/why-cant-i-harvest-blood-for-discerning-the-transmundane), in whic...
2013/08/19
[ "https://gaming.meta.stackexchange.com/questions/7546", "https://gaming.meta.stackexchange.com", "https://gaming.meta.stackexchange.com/users/3062/" ]
One of the founding principles of the network is to focus not on people, but on information. It's why we disallow discussion, why votes are focused on posts and not people, and a host of other components we have enabled to improve the quality of our Q&A above all. A great question asked for stupid reasons (though this ...
I'm not very clear on what policy or practice has been established or agreed upon. The impression I have in the mixture of answers and ensuing comments was: *the onus should be on site members to differentiate between intent and content by encouraging edits and semantics as a means to mitigate negative reaction and se...
7,546
![enter image description here](https://i.stack.imgur.com/z3v19.jpg) There's been a lot of talk recently about what it means to support piracy and pirated games. A very recent example is [this question](https://gaming.stackexchange.com/questions/127918/why-cant-i-harvest-blood-for-discerning-the-transmundane), in whic...
2013/08/19
[ "https://gaming.meta.stackexchange.com/questions/7546", "https://gaming.meta.stackexchange.com", "https://gaming.meta.stackexchange.com/users/3062/" ]
One of the founding principles of the network is to focus not on people, but on information. It's why we disallow discussion, why votes are focused on posts and not people, and a host of other components we have enabled to improve the quality of our Q&A above all. A great question asked for stupid reasons (though this ...
[SE's policy is to not dictate to us how to handle piracy, so studiously avoiding even the possibility of being involved in helping someone using a pirated game isn't *our* concern.](http://chat.stackexchange.com/transcript/message/10889506#10889506) That means my concerns about exposure to liability aren't relevant – ...
7,546
![enter image description here](https://i.stack.imgur.com/z3v19.jpg) There's been a lot of talk recently about what it means to support piracy and pirated games. A very recent example is [this question](https://gaming.stackexchange.com/questions/127918/why-cant-i-harvest-blood-for-discerning-the-transmundane), in whic...
2013/08/19
[ "https://gaming.meta.stackexchange.com/questions/7546", "https://gaming.meta.stackexchange.com", "https://gaming.meta.stackexchange.com/users/3062/" ]
One of the founding principles of the network is to focus not on people, but on information. It's why we disallow discussion, why votes are focused on posts and not people, and a host of other components we have enabled to improve the quality of our Q&A above all. A great question asked for stupid reasons (though this ...
We are not here to judge users (though educating them might sometimes be adequate...). While posts and comments clearly implying the necessity of piracy should be removed due to the legal implications, the mere fact that someone uses a pirated version of a game does not render an otherwise valid question suddenly inval...
7,546
![enter image description here](https://i.stack.imgur.com/z3v19.jpg) There's been a lot of talk recently about what it means to support piracy and pirated games. A very recent example is [this question](https://gaming.stackexchange.com/questions/127918/why-cant-i-harvest-blood-for-discerning-the-transmundane), in whic...
2013/08/19
[ "https://gaming.meta.stackexchange.com/questions/7546", "https://gaming.meta.stackexchange.com", "https://gaming.meta.stackexchange.com/users/3062/" ]
When I think of the "no piracy" policy, I think of avoiding situations where we're suggesting an illegal or questionably legal activity to further another illegal or questionably legal activity. We *close questions to prevent answers -* in this case, the "evil" of the answer is the furtherance of this illegal activit...
In general, the pirated version of a game really is a different game from the "public" one. * The public version gets updates, the pirated usually doesn't. * The public version integrates with Steam, Origin and pals, the pirated thinks it does but it doesn't. * The public version passes any internal anti-piracy checks...
7,546
![enter image description here](https://i.stack.imgur.com/z3v19.jpg) There's been a lot of talk recently about what it means to support piracy and pirated games. A very recent example is [this question](https://gaming.stackexchange.com/questions/127918/why-cant-i-harvest-blood-for-discerning-the-transmundane), in whic...
2013/08/19
[ "https://gaming.meta.stackexchange.com/questions/7546", "https://gaming.meta.stackexchange.com", "https://gaming.meta.stackexchange.com/users/3062/" ]
When I think of the "no piracy" policy, I think of avoiding situations where we're suggesting an illegal or questionably legal activity to further another illegal or questionably legal activity. We *close questions to prevent answers -* in this case, the "evil" of the answer is the furtherance of this illegal activit...
I'm not very clear on what policy or practice has been established or agreed upon. The impression I have in the mixture of answers and ensuing comments was: *the onus should be on site members to differentiate between intent and content by encouraging edits and semantics as a means to mitigate negative reaction and se...
7,546
![enter image description here](https://i.stack.imgur.com/z3v19.jpg) There's been a lot of talk recently about what it means to support piracy and pirated games. A very recent example is [this question](https://gaming.stackexchange.com/questions/127918/why-cant-i-harvest-blood-for-discerning-the-transmundane), in whic...
2013/08/19
[ "https://gaming.meta.stackexchange.com/questions/7546", "https://gaming.meta.stackexchange.com", "https://gaming.meta.stackexchange.com/users/3062/" ]
In general, the pirated version of a game really is a different game from the "public" one. * The public version gets updates, the pirated usually doesn't. * The public version integrates with Steam, Origin and pals, the pirated thinks it does but it doesn't. * The public version passes any internal anti-piracy checks...
[SE's policy is to not dictate to us how to handle piracy, so studiously avoiding even the possibility of being involved in helping someone using a pirated game isn't *our* concern.](http://chat.stackexchange.com/transcript/message/10889506#10889506) That means my concerns about exposure to liability aren't relevant – ...