diff --git "a/data/rl/train_data_01.csv" "b/data/rl/train_data_01.csv" new file mode 100644--- /dev/null +++ "b/data/rl/train_data_01.csv" @@ -0,0 +1,66449 @@ +qid,question,date,metadata,response_j,response_k +35957207,"I got an error ""android.database.CursorIndexOutOfBoundsException: Index 20 requested, with a size of 20"" and I can't understand what exactly caused it and how to fix it? Probably something wrong with c.moveToFirst() and c.moveToNext(). + +``` +public class MainActivity extends AppCompatActivity { + + Map articleURLs = new HashMap(); + Map articleTitles =new HashMap(); + ArrayList articleIds =new ArrayList(); + + SQLiteDatabase articlesDB; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + articlesDB=this.openOrCreateDatabase(""Articles"", MODE_PRIVATE, null); + + articlesDB.execSQL(""CREATE TABLE IF NOT EXISTS articles (id INTEGER PRIMARY KEY, articleId INTEGER, url VARCHAR, title VARCHAR, content VARCHAR)""); + + DownloadTask task = new DownloadTask(); + try { + String result = task.execute(""https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"").get(); + JSONArray jsonArray =new JSONArray(result); + articlesDB.execSQL(""DELETE FROM articles""); + + for (int i=5; i<25;i++){ + String articleId = jsonArray.getString(i); + + DownloadTask getArticle = new DownloadTask(); + String articleInfo = getArticle.execute(""https://hacker-news.firebaseio.com/v0/item/""+ articleId+"".json?print=pretty"").get(); + + JSONObject jsonObject= new JSONObject(articleInfo); + + Log.i(""jsonObject"", jsonObject.toString()); + String articleTitle = jsonObject.getString(""title""); + String articleURL = jsonObject.getString(""url""); + + articleIds.add(Integer.valueOf(articleId)); + articleTitles.put(Integer.valueOf(articleId), articleTitle); + articleURLs.put(Integer.valueOf(articleId), articleURL); + + String sql = ""INSERT INTO articles (articleId, url, title) VALUES (?, ?, ?)""; + SQLiteStatement statement = articlesDB.compileStatement(sql); + + statement.bindString(1, articleId); + statement.bindString(2, articleURL); + statement.bindString(3, articleTitle); + + statement.execute(); + + } + Cursor c = articlesDB.rawQuery(""SELECT * FROM articles"",null); + int articleIdIndex = c.getColumnIndex(""articleId""); + int urlIndex = c.getColumnIndex(""url""); + int titleIndex = c.getColumnIndex(""title""); + + c.moveToFirst(); + while (c!= null){ + Log.i(""articleIdIndex"", Integer.toString(c.getInt(articleIdIndex))); + Log.i(""articleUrl"",c.getString(urlIndex) ); + Log.i(""titleTitle"",c.getString(titleIndex)); + c.moveToNext(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public class DownloadTask extends AsyncTask< String, Void, String> { + + protected String doInBackground(String... urls) { + + String result = """"; + URL url; + HttpURLConnection urlConnection = null; + try { + url = new URL(urls[0]); + urlConnection = (HttpURLConnection) url.openConnection(); + InputStream in = urlConnection.getInputStream(); + InputStreamReader reader = new InputStreamReader(in); + int data = reader.read(); + while (data != -1) { + char current = (char) data; + result += current; + data = reader.read(); + } + } + catch(Exception e){ + e.printStackTrace(); + } + return result; + } + } +} + +```",2016/03/12,"['https://Stackoverflow.com/questions/35957207', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5427240/']","Change the below lines to + +``` +c.moveToFirst(); +while (c!= null){ + Log.i(""articleIdIndex"", Integer.toString(c.getInt(articleIdIndex))); + Log.i(""articleUrl"",c.getString(urlIndex) ); + Log.i(""titleTitle"",c.getString(titleIndex)); + c.moveToNext(); +} + +``` + +to + +``` +while (c.moveToNext()) { + Log.i(""articleIdIndex"", Integer.toString(c.getInt(articleIdIndex))); + Log.i(""articleUrl"",c.getString(urlIndex) ); + Log.i(""titleTitle"",c.getString(titleIndex)); +} + +``` + +> +> The condition `(c!= null)` will always be `true`, so while loop will be executed every time even when there are no more records in database. So change the condition in while loop to `c.moveToNext()` so that it'll get record only when there are more records in database. +> +> +> + +And it'll work fine.","Change the below code + +``` +Cursor c = articlesDB.rawQuery(""SELECT * FROM articles"",null); +int articleIdIndex = c.getColumnIndex(""articleId""); +int urlIndex = c.getColumnIndex(""url""); +int titleIndex = c.getColumnIndex(""title""); + +c.moveToFirst(); +while (c!= null){ +Log.i(""articleIdIndex"", Integer.toString(c.getInt(articleIdIndex))); +Log.i(""articleUrl"",c.getString(urlIndex) ); +Log.i(""titleTitle"",c.getString(titleIndex)); +c.moveToNext(); +} + +``` + +to the following + +``` +Cursor c = articlesDB.rawQuery(""SELECT * FROM articles"",null); +int articleIdIndex = c.getColumnIndex(""articleId""); +int urlIndex = c.getColumnIndex(""url""); +int titleIndex = c.getColumnIndex(""title""); + +if(c.moveToFirst()) +do{ + Log.i(""articleIdIndex"", Integer.toString(c.getInt(articleIdIndex))); + Log.i(""articleUrl"",c.getString(urlIndex) ); + Log.i(""titleTitle"",c.getString(titleIndex)); +}while(c.moveToNext()); + +```" +13362921,"According to AngularJS's tutorial, a controller function just sits within the global scope. + + + +Do the controller functions themselves automatically get parsed into an encapsulated scope, or do they dwell within the global scope? I know that they are passed a reference to their own $scope, but it appears that the function themselves are just sitting in the global scope. Obviously this can cause problems down the road, and I have learned through experience and education to encapsulate Further more, if they do dwell within the global scope, would it not be considered a best practice to encapsulate them within an object to be referenced like this: + +``` + Object.functionName(); + +``` + +Rather than this: + +``` + functionName(); + +``` + +So as to prevent issues that occur with the pollution of the global scope (ie overriding functions, etc..)",2012/11/13,"['https://Stackoverflow.com/questions/13362921', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1707160/']","AngularJS supports 2 methods of registering controller functions - either as globally accessible functions (you can see this form in the mentioned tutorial) or as a part of a modules (that forms a kind of namespace). More info on modules can be found here: but in short one would register a controller in a module like so: + +``` +angular.module('[module name]', []).controller('PhoneListCtrl', function($scope) { + + $scope.phones = [..]; + + $scope.orderProp = 'age'; +}); + +``` + +AngularJS uses a short, global-function form of declaring controllers in many examples but while **this form is good for quick samples it rather shouldn't be used in real-life applications**. + +In short: AngularJS makes it possible to properly encapsulate controller functions but also exposes a simpler, quick & dirty way of declaring them as global functions.","You can register a controller as part of a module, as answered by [pkozlowski-opensource](https://stackoverflow.com/a/13363482/1957398). + +If you need minification you can simply extend this by providing the variable names before the actual function in a list: + +``` +angular.module('[module name]', []). + controller('PhoneListCtrl', ['$scope', function($scope) { + + $scope.phones = [..]; + $scope.orderProp = 'age'; + }]); + +``` + +This will work the same after ""minification"": + +``` +angular.module('[module name]', []). + controller('PhoneListCtrl', ['$scope', function(s) { + + s.phones = [..]; + s.orderProp = 'age'; + }]); + +``` + +This notation can be found under ""Inline Annotation"" at [Dependency Injection](http://docs.angularjs.org/guide/di). + +To test a controller, that has been registered as part of a module, you have to ask angular to create your controller. For example: + +``` +describe('PhoneListCtrl test', function() { + var scope; + var ctrl; + + beforeEach(function() { + module('[module name]'); + inject(function($rootScope, $controller) { + scope = $rootScope.$new(); + ctrl = $controller('[module name]', {$scope: scope}); + }); + }); + + it('should be ordered by age', function() { + expect(scope.orderProp).toBe('age'); + }); + +}); + +``` + +This method of testing the controller can be found under ""Testing Controllers"" at [Understanding the Controller Component](http://docs.angularjs.org/guide/dev_guide.mvc.understanding_controller)." +40390491,"``` +for(int i = 0; i < n; i++) { + for(int j = 0; j < i; j++) { + //Code + } +} + +``` + +I know the first for-loop is O(n), but what about the second one?",2016/11/02,"['https://Stackoverflow.com/questions/40390491', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6442096/']","This problem happened because the angular version I am using is 1.5. + +changing the executable from npm to npm.cmd solved the problem! + +``` + + exec-npm-update + generate-sources + + ${uiResourcesDir} + npm.cmd + + update + + + + exec + + + +```","I faced the same issue, as answered you need to provide npm.cmd instead just npm" +40390491,"``` +for(int i = 0; i < n; i++) { + for(int j = 0; j < i; j++) { + //Code + } +} + +``` + +I know the first for-loop is O(n), but what about the second one?",2016/11/02,"['https://Stackoverflow.com/questions/40390491', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6442096/']","This problem happened because the angular version I am using is 1.5. + +changing the executable from npm to npm.cmd solved the problem! + +``` + + exec-npm-update + generate-sources + + ${uiResourcesDir} + npm.cmd + + update + + + + exec + + + +```","If you like to run the shell or command prompt commands irrespective of environment. I am talking about npm.cmd (windows), npm.sh (linux) parts. + +**Downgrade the maven-exec-plugin to Version 1.4.0** so that you can just mention (For e.g.) + +``` +npm +ng + +```" +46905636,"I need some condition on insert statement to prevent unauthorized insertions. +I wrote something like this: + +``` +INSERT INTO `fund` (amount,description) + SELECT 1000,'Some description' + WHERE 12 IN (SELECT id FROM users WHERE allow_add=1) + +``` + +Where 12 is the id of current user. +But mysql process stopped unexpectedly! +I use XAMPP with MySQL version: 5.5.5-10.1.13-MariaDB. +Note that I ran this code before this in SQL Server without any problem. +Any Idea?",2017/10/24,"['https://Stackoverflow.com/questions/46905636', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5259185/']","From users and Where exists work so maybe a bug with in? + +``` +MariaDB [sandbox]> delete from t where att = 3; +Query OK, 2 rows affected (0.04 sec) + +MariaDB [sandbox]> +MariaDB [sandbox]> select * from t; ++------+------+ +| id | att | ++------+------+ +| 1 | 1 | +| 1 | 2 | +| 2 | 0 | ++------+------+ +3 rows in set (0.00 sec) + +MariaDB [sandbox]> +MariaDB [sandbox]> insert into t(id,att) + -> select 4,3 + -> from users + -> where id = 1; +Query OK, 1 row affected (0.05 sec) +Records: 1 Duplicates: 0 Warnings: 0 + +MariaDB [sandbox]> +MariaDB [sandbox]> +MariaDB [sandbox]> select * from t; ++------+------+ +| id | att | ++------+------+ +| 1 | 1 | +| 1 | 2 | +| 2 | 0 | +| 4 | 3 | ++------+------+ +4 rows in set (0.00 sec) + +MariaDB [sandbox]> +MariaDB [sandbox]> insert into t(id,att) + -> select 4,3 + -> where exists (select 1 from users where id = 1); +Query OK, 1 row affected (0.02 sec) +Records: 1 Duplicates: 0 Warnings: 0 + +MariaDB [sandbox]> +MariaDB [sandbox]> select * from t; ++------+------+ +| id | att | ++------+------+ +| 1 | 1 | +| 1 | 2 | +| 2 | 0 | +| 4 | 3 | +| 4 | 3 | ++------+------+ +5 rows in set (0.00 sec) + +```","Add semicolon(;) to your query, and what `desc` is doing in query. It will describe the table structure and its attributes." +46905636,"I need some condition on insert statement to prevent unauthorized insertions. +I wrote something like this: + +``` +INSERT INTO `fund` (amount,description) + SELECT 1000,'Some description' + WHERE 12 IN (SELECT id FROM users WHERE allow_add=1) + +``` + +Where 12 is the id of current user. +But mysql process stopped unexpectedly! +I use XAMPP with MySQL version: 5.5.5-10.1.13-MariaDB. +Note that I ran this code before this in SQL Server without any problem. +Any Idea?",2017/10/24,"['https://Stackoverflow.com/questions/46905636', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5259185/']","With thanks to [P.Salmon answer](https://stackoverflow.com/a/46906663/5259185), I found the solution. It seems that MySQL needs FROM statement in conditional SELECT, unlike the SQL Server. So, I add a temporary table name as below: + +``` +INSERT INTO `fund` (amount,description) +SELECT 1000,'Some description' +FROM (SELECT 1) t +WHERE 12 IN (SELECT id FROM users WHERE allow_add=1) + +```","Add semicolon(;) to your query, and what `desc` is doing in query. It will describe the table structure and its attributes." +46905636,"I need some condition on insert statement to prevent unauthorized insertions. +I wrote something like this: + +``` +INSERT INTO `fund` (amount,description) + SELECT 1000,'Some description' + WHERE 12 IN (SELECT id FROM users WHERE allow_add=1) + +``` + +Where 12 is the id of current user. +But mysql process stopped unexpectedly! +I use XAMPP with MySQL version: 5.5.5-10.1.13-MariaDB. +Note that I ran this code before this in SQL Server without any problem. +Any Idea?",2017/10/24,"['https://Stackoverflow.com/questions/46905636', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5259185/']","From users and Where exists work so maybe a bug with in? + +``` +MariaDB [sandbox]> delete from t where att = 3; +Query OK, 2 rows affected (0.04 sec) + +MariaDB [sandbox]> +MariaDB [sandbox]> select * from t; ++------+------+ +| id | att | ++------+------+ +| 1 | 1 | +| 1 | 2 | +| 2 | 0 | ++------+------+ +3 rows in set (0.00 sec) + +MariaDB [sandbox]> +MariaDB [sandbox]> insert into t(id,att) + -> select 4,3 + -> from users + -> where id = 1; +Query OK, 1 row affected (0.05 sec) +Records: 1 Duplicates: 0 Warnings: 0 + +MariaDB [sandbox]> +MariaDB [sandbox]> +MariaDB [sandbox]> select * from t; ++------+------+ +| id | att | ++------+------+ +| 1 | 1 | +| 1 | 2 | +| 2 | 0 | +| 4 | 3 | ++------+------+ +4 rows in set (0.00 sec) + +MariaDB [sandbox]> +MariaDB [sandbox]> insert into t(id,att) + -> select 4,3 + -> where exists (select 1 from users where id = 1); +Query OK, 1 row affected (0.02 sec) +Records: 1 Duplicates: 0 Warnings: 0 + +MariaDB [sandbox]> +MariaDB [sandbox]> select * from t; ++------+------+ +| id | att | ++------+------+ +| 1 | 1 | +| 1 | 2 | +| 2 | 0 | +| 4 | 3 | +| 4 | 3 | ++------+------+ +5 rows in set (0.00 sec) + +```","It is not a proper way to authorize insertions in database. Instead, you can use programming based solution for this problem. + +In PHP, a proper solution could be:- + +``` +if ($user->allow_add == 1){ //where $user is the User instance for current user + $sql->query(""INSERT INTO `fund` (amount,desc) VALUES(1000,'Some desc')""); +} + +```" +46905636,"I need some condition on insert statement to prevent unauthorized insertions. +I wrote something like this: + +``` +INSERT INTO `fund` (amount,description) + SELECT 1000,'Some description' + WHERE 12 IN (SELECT id FROM users WHERE allow_add=1) + +``` + +Where 12 is the id of current user. +But mysql process stopped unexpectedly! +I use XAMPP with MySQL version: 5.5.5-10.1.13-MariaDB. +Note that I ran this code before this in SQL Server without any problem. +Any Idea?",2017/10/24,"['https://Stackoverflow.com/questions/46905636', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5259185/']","With thanks to [P.Salmon answer](https://stackoverflow.com/a/46906663/5259185), I found the solution. It seems that MySQL needs FROM statement in conditional SELECT, unlike the SQL Server. So, I add a temporary table name as below: + +``` +INSERT INTO `fund` (amount,description) +SELECT 1000,'Some description' +FROM (SELECT 1) t +WHERE 12 IN (SELECT id FROM users WHERE allow_add=1) + +```","It is not a proper way to authorize insertions in database. Instead, you can use programming based solution for this problem. + +In PHP, a proper solution could be:- + +``` +if ($user->allow_add == 1){ //where $user is the User instance for current user + $sql->query(""INSERT INTO `fund` (amount,desc) VALUES(1000,'Some desc')""); +} + +```" +46905636,"I need some condition on insert statement to prevent unauthorized insertions. +I wrote something like this: + +``` +INSERT INTO `fund` (amount,description) + SELECT 1000,'Some description' + WHERE 12 IN (SELECT id FROM users WHERE allow_add=1) + +``` + +Where 12 is the id of current user. +But mysql process stopped unexpectedly! +I use XAMPP with MySQL version: 5.5.5-10.1.13-MariaDB. +Note that I ran this code before this in SQL Server without any problem. +Any Idea?",2017/10/24,"['https://Stackoverflow.com/questions/46905636', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5259185/']","From users and Where exists work so maybe a bug with in? + +``` +MariaDB [sandbox]> delete from t where att = 3; +Query OK, 2 rows affected (0.04 sec) + +MariaDB [sandbox]> +MariaDB [sandbox]> select * from t; ++------+------+ +| id | att | ++------+------+ +| 1 | 1 | +| 1 | 2 | +| 2 | 0 | ++------+------+ +3 rows in set (0.00 sec) + +MariaDB [sandbox]> +MariaDB [sandbox]> insert into t(id,att) + -> select 4,3 + -> from users + -> where id = 1; +Query OK, 1 row affected (0.05 sec) +Records: 1 Duplicates: 0 Warnings: 0 + +MariaDB [sandbox]> +MariaDB [sandbox]> +MariaDB [sandbox]> select * from t; ++------+------+ +| id | att | ++------+------+ +| 1 | 1 | +| 1 | 2 | +| 2 | 0 | +| 4 | 3 | ++------+------+ +4 rows in set (0.00 sec) + +MariaDB [sandbox]> +MariaDB [sandbox]> insert into t(id,att) + -> select 4,3 + -> where exists (select 1 from users where id = 1); +Query OK, 1 row affected (0.02 sec) +Records: 1 Duplicates: 0 Warnings: 0 + +MariaDB [sandbox]> +MariaDB [sandbox]> select * from t; ++------+------+ +| id | att | ++------+------+ +| 1 | 1 | +| 1 | 2 | +| 2 | 0 | +| 4 | 3 | +| 4 | 3 | ++------+------+ +5 rows in set (0.00 sec) + +```","Try This: + +``` +INSERT INTO `fund` (amount,desc) +SELECT 1000 as amt,'Some desc' as des FROM users WHERE allow_add=1 LIMIT 12 + +```" +46905636,"I need some condition on insert statement to prevent unauthorized insertions. +I wrote something like this: + +``` +INSERT INTO `fund` (amount,description) + SELECT 1000,'Some description' + WHERE 12 IN (SELECT id FROM users WHERE allow_add=1) + +``` + +Where 12 is the id of current user. +But mysql process stopped unexpectedly! +I use XAMPP with MySQL version: 5.5.5-10.1.13-MariaDB. +Note that I ran this code before this in SQL Server without any problem. +Any Idea?",2017/10/24,"['https://Stackoverflow.com/questions/46905636', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5259185/']","With thanks to [P.Salmon answer](https://stackoverflow.com/a/46906663/5259185), I found the solution. It seems that MySQL needs FROM statement in conditional SELECT, unlike the SQL Server. So, I add a temporary table name as below: + +``` +INSERT INTO `fund` (amount,description) +SELECT 1000,'Some description' +FROM (SELECT 1) t +WHERE 12 IN (SELECT id FROM users WHERE allow_add=1) + +```","Try This: + +``` +INSERT INTO `fund` (amount,desc) +SELECT 1000 as amt,'Some desc' as des FROM users WHERE allow_add=1 LIMIT 12 + +```" +45023388,"how to convert .txt to .csv using shell script ?? + +Input + +``` +A B 10 C d e f g +H I 88 J k l m n +O P 3 Q r s t u + +``` + +Expected Output - After 4 blank, don't change to ',' + +``` +A,B,10,C,d e f g +H,I,88,J,k l m n +O,P,3,Q,r s t u + +``` + +I was trying but can't handle ""d e f g"" + +``` +$ cat input.txt | tr -s '[:blank:]' ',' > output.txt + +```",2017/07/11,"['https://Stackoverflow.com/questions/45023388', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5088324/']","The `np.nonzero` command will give you the indices of all non-zero elements. So if you just want to exclude the last column, I'd do: + +``` +import numpy as np +x_orig = np.array([(1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0), + (1, 5, 9, 10, 2, 0, 0, 0, 0, 0, 1)]) +row, col = np.nonzero(x_orig[:,:-1]) # these are the indices +row, col +>> (array([0, 0, 0, 1, 1, 1, 1, 1]), array([0, 1, 2, 0, 1, 2, 3, 4])) + +``` + +Now if you *only* want the last non-zero item you can do something like: + +``` +keep_max = [] +for i in range(x_orig.shape[0]): + keep_max.append([i, col[row == i][-1]]) +>> keep_max # again these are the indices of the last non-zero element for each row +[[0, 2], [1, 4]] # i.e. 1st row-3rd element, 2nd row-5th element + +```","Example data: + +``` +train_data = [1,5,9,10,2,0,0,0,0,0,1] + +``` + +If you're looking for a one-liner: + +``` +max([i for i, x in enumerate(train_data[:-1]) if x != 0]) + +``` + +If you're looking for efficiency, you can start from the front or end (depending on if you're expecting more or less zeros than other values) and see when the zeros start/end. + +``` +for i, x in enumerate(train_data): + if x == 0: + i = i - 1 + break + +``` + +Note that `i` must be decremented when the first `0` is encountered to get the index of the last nonzero element." +44387,"In terms of the future of the trust network where there will be an increasing number of fit-for-purpose blockchains such as ones for proof of asset, proof of identity, proof of ownership etc., will there be a wallet to store all of an individual's blockchain needs? + +Much like our conventional wallet now storing our cash, driver's license, credit cards and affinity cards. Is the BIP32 ""standard"" moving in this direction?",2016/05/26,"['https://bitcoin.stackexchange.com/questions/44387', 'https://bitcoin.stackexchange.com', 'https://bitcoin.stackexchange.com/users/36005/']","There is no technological reason preventing the creation of a single application that communicates with several peer-to-peer blockchain networks, and manages private keys for all of them. If a blockchain-based future is eminent, then there will be a need for both personal wallets and point-of-sale systems that handle multiple blockchains. That means that someone will almost certainly create them. + +Right now, I don't think the need is high enough, but I'm sure someone has started building one anyways.","Probably need a domain addressing scheme. Where domains are like: + +* Bitcoin +* Amazon digital media library +* Apple iTunes media library +* Joe Blog's digital art library +* Government digital cryptocurrency + +Where each domain implements their own blockchain. Allowing us the ability to store all our rights in a wallet or wallets of our choice." +44387,"In terms of the future of the trust network where there will be an increasing number of fit-for-purpose blockchains such as ones for proof of asset, proof of identity, proof of ownership etc., will there be a wallet to store all of an individual's blockchain needs? + +Much like our conventional wallet now storing our cash, driver's license, credit cards and affinity cards. Is the BIP32 ""standard"" moving in this direction?",2016/05/26,"['https://bitcoin.stackexchange.com/questions/44387', 'https://bitcoin.stackexchange.com', 'https://bitcoin.stackexchange.com/users/36005/']","The Exodus Project might be of interest: +It's a multi-currency desktop wallet with shapeshift (altcoin exchange) already built-in. You can already download a beta version of it, official launch is going to be this summer according to the projects homepage. + +I can't find an example better than right now, but I think there have been other multi-currency online wallets around for a while. Exodus however is the first dektop multi-currency wallet I know of.","There is no technological reason preventing the creation of a single application that communicates with several peer-to-peer blockchain networks, and manages private keys for all of them. If a blockchain-based future is eminent, then there will be a need for both personal wallets and point-of-sale systems that handle multiple blockchains. That means that someone will almost certainly create them. + +Right now, I don't think the need is high enough, but I'm sure someone has started building one anyways." +44387,"In terms of the future of the trust network where there will be an increasing number of fit-for-purpose blockchains such as ones for proof of asset, proof of identity, proof of ownership etc., will there be a wallet to store all of an individual's blockchain needs? + +Much like our conventional wallet now storing our cash, driver's license, credit cards and affinity cards. Is the BIP32 ""standard"" moving in this direction?",2016/05/26,"['https://bitcoin.stackexchange.com/questions/44387', 'https://bitcoin.stackexchange.com', 'https://bitcoin.stackexchange.com/users/36005/']","The Exodus Project might be of interest: +It's a multi-currency desktop wallet with shapeshift (altcoin exchange) already built-in. You can already download a beta version of it, official launch is going to be this summer according to the projects homepage. + +I can't find an example better than right now, but I think there have been other multi-currency online wallets around for a while. Exodus however is the first dektop multi-currency wallet I know of.","Probably need a domain addressing scheme. Where domains are like: + +* Bitcoin +* Amazon digital media library +* Apple iTunes media library +* Joe Blog's digital art library +* Government digital cryptocurrency + +Where each domain implements their own blockchain. Allowing us the ability to store all our rights in a wallet or wallets of our choice." +35315756,"Im trying to prevent keyboard from open when showing search view using mSearchItem.expandActionView() + +Clearing focus from the search view doesn't work: + +``` +mSearchItem.getActionView().clearFocus(); + +``` + +Any help would be appreciated",2016/02/10,"['https://Stackoverflow.com/questions/35315756', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1039477/']","**Update:** + +The `pull` process will now automatically resume based on which layers have already been downloaded. This was implemented with . + +**Old:** + +There is no `resume` feature yet. However there are [discussions](https://github.com/docker/docker/issues/6928) around this feature being implemented with docker's download manager.","Try this + +`ps -ef | grep docker` + +Get PID of all the `docker pull` command and do a `kill -9` on them. Once killed, re-issue the `docker pull :` command. + +This worked for me!" +35315756,"Im trying to prevent keyboard from open when showing search view using mSearchItem.expandActionView() + +Clearing focus from the search view doesn't work: + +``` +mSearchItem.getActionView().clearFocus(); + +``` + +Any help would be appreciated",2016/02/10,"['https://Stackoverflow.com/questions/35315756', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1039477/']","**Update:** + +The `pull` process will now automatically resume based on which layers have already been downloaded. This was implemented with . + +**Old:** + +There is no `resume` feature yet. However there are [discussions](https://github.com/docker/docker/issues/6928) around this feature being implemented with docker's download manager.","Docker's code isn't as updated as the moby in development repository on github. People have been having issues for several years relating to this. I had tried to manually use several patches which aren't in the upstream yet, and none worked decent. + +The github repository for moby (docker's development repo) has a script called download-frozen-image-v2.sh. This script uses bash, curl, and other things like JSON interpreters via command line. It will retrieve a docker token, and then download all of the layers to a local directory. You can then use 'docker load' to insert into your local docker installation. + +It does not do well with resume though. It had some comment in the script relating to 'curl -C' isn't working. I had tracked down, and fixed this problem. I made a modification which uses a "".headers"" file to retrieve initially, which has always returned a 302 while I've been monitoring, and then retrieves the final using curl (+ resume support) to the layer tar file. It also has to loop on the calling function which retrieves a valid token which unfortunately only lasts about 30 minutes. + +It will loop this process until it receives a 416 stating that there is no resume possible since it's ranges have been fulfilled. It also verifies the size against a curl header retrieval. I have been able to retrieve all images necessary using this modified script. Docker has many more layers relating to retrieval, and has remote control processes (Docker client) which make it more difficult to control, and they viewed this issue as only affecting some people on bad connections. + +I hope this script can help you as much as it has helped me: + +Changes: +fetch\_blob function uses a temporary file for its first connection. It then retrieves 30x HTTP redirect from this. It attempts a header retrieval on the final url and checks whether the local copy has the full file. Otherwise, it will begin a resume curl operation. The calling function which passes it a valid token has a loop surrounding retrieving a token, and fetch\_blob which ensures the full file is obtained. + +The only other variation is a bandwidth limit variable which can be set at the top, or via ""BW:10"" command line parameter. I needed this to allow my connection to be viable for other operations. + +Click [here](https://pastebin.com/jWNbhUBd) for the modified script. + +In the future it would be nice if docker's internal client performed resuming properly. Increasing the amount of time for the token's validation would help tremendously.. + +Brief views of change code: + +``` +#loop until FULL_FILE is set in fetch_blob.. this is for bad/slow connections + while [ ""$FULL_FILE"" != ""1"" ];do + local token=""$(curl -fsSL ""$authBase/token?service=$authService&scope=repository:$image:pull"" | jq --raw-output '.token')"" + fetch_blob ""$token"" ""$image"" ""$layerDigest"" ""$dir/$layerTar"" --progress + sleep 1 + done + +``` + +Another section from fetch\_blob: + +``` +while :; do + #if the file already exists.. we will be resuming.. + if [ -f ""$targetFile"" ];then + #getting current size of file we are resuming + CUR=`stat --printf=""%s"" $targetFile` + #use curl to get headers to find content-length of the full file + LEN=`curl -I -fL ""${curlArgs[@]}"" ""$blobRedirect""|grep content-length|cut -d"" "" -f2` + + #if we already have the entire file... lets stop curl from erroring with 416 + if [ ""$CUR"" == ""${LEN//[!0-9]/}"" ]; then + FULL_FILE=1 + break + fi + fi + + HTTP_CODE=`curl -w %{http_code} -C - --tr-encoding --compressed --progress-bar -fL ""${curlArgs[@]}"" ""$blobRedirect"" -o ""$targetFile""` + if [ ""$HTTP_CODE"" == ""403"" ]; then + #token expired so the server stopped allowing us to resume, lets return without setting FULL_FILE and itll restart this func w new token + FULL_FILE=0 + break + fi + + if [ ""$HTTP_CODE"" == ""416"" ]; then + FULL_FILE=1 + break + fi + + sleep 1 + done + +```" +35315756,"Im trying to prevent keyboard from open when showing search view using mSearchItem.expandActionView() + +Clearing focus from the search view doesn't work: + +``` +mSearchItem.getActionView().clearFocus(); + +``` + +Any help would be appreciated",2016/02/10,"['https://Stackoverflow.com/questions/35315756', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1039477/']","Docker's code isn't as updated as the moby in development repository on github. People have been having issues for several years relating to this. I had tried to manually use several patches which aren't in the upstream yet, and none worked decent. + +The github repository for moby (docker's development repo) has a script called download-frozen-image-v2.sh. This script uses bash, curl, and other things like JSON interpreters via command line. It will retrieve a docker token, and then download all of the layers to a local directory. You can then use 'docker load' to insert into your local docker installation. + +It does not do well with resume though. It had some comment in the script relating to 'curl -C' isn't working. I had tracked down, and fixed this problem. I made a modification which uses a "".headers"" file to retrieve initially, which has always returned a 302 while I've been monitoring, and then retrieves the final using curl (+ resume support) to the layer tar file. It also has to loop on the calling function which retrieves a valid token which unfortunately only lasts about 30 minutes. + +It will loop this process until it receives a 416 stating that there is no resume possible since it's ranges have been fulfilled. It also verifies the size against a curl header retrieval. I have been able to retrieve all images necessary using this modified script. Docker has many more layers relating to retrieval, and has remote control processes (Docker client) which make it more difficult to control, and they viewed this issue as only affecting some people on bad connections. + +I hope this script can help you as much as it has helped me: + +Changes: +fetch\_blob function uses a temporary file for its first connection. It then retrieves 30x HTTP redirect from this. It attempts a header retrieval on the final url and checks whether the local copy has the full file. Otherwise, it will begin a resume curl operation. The calling function which passes it a valid token has a loop surrounding retrieving a token, and fetch\_blob which ensures the full file is obtained. + +The only other variation is a bandwidth limit variable which can be set at the top, or via ""BW:10"" command line parameter. I needed this to allow my connection to be viable for other operations. + +Click [here](https://pastebin.com/jWNbhUBd) for the modified script. + +In the future it would be nice if docker's internal client performed resuming properly. Increasing the amount of time for the token's validation would help tremendously.. + +Brief views of change code: + +``` +#loop until FULL_FILE is set in fetch_blob.. this is for bad/slow connections + while [ ""$FULL_FILE"" != ""1"" ];do + local token=""$(curl -fsSL ""$authBase/token?service=$authService&scope=repository:$image:pull"" | jq --raw-output '.token')"" + fetch_blob ""$token"" ""$image"" ""$layerDigest"" ""$dir/$layerTar"" --progress + sleep 1 + done + +``` + +Another section from fetch\_blob: + +``` +while :; do + #if the file already exists.. we will be resuming.. + if [ -f ""$targetFile"" ];then + #getting current size of file we are resuming + CUR=`stat --printf=""%s"" $targetFile` + #use curl to get headers to find content-length of the full file + LEN=`curl -I -fL ""${curlArgs[@]}"" ""$blobRedirect""|grep content-length|cut -d"" "" -f2` + + #if we already have the entire file... lets stop curl from erroring with 416 + if [ ""$CUR"" == ""${LEN//[!0-9]/}"" ]; then + FULL_FILE=1 + break + fi + fi + + HTTP_CODE=`curl -w %{http_code} -C - --tr-encoding --compressed --progress-bar -fL ""${curlArgs[@]}"" ""$blobRedirect"" -o ""$targetFile""` + if [ ""$HTTP_CODE"" == ""403"" ]; then + #token expired so the server stopped allowing us to resume, lets return without setting FULL_FILE and itll restart this func w new token + FULL_FILE=0 + break + fi + + if [ ""$HTTP_CODE"" == ""416"" ]; then + FULL_FILE=1 + break + fi + + sleep 1 + done + +```","Try this + +`ps -ef | grep docker` + +Get PID of all the `docker pull` command and do a `kill -9` on them. Once killed, re-issue the `docker pull :` command. + +This worked for me!" +46187201,"This is a homotopy of the json file I always used to read through `boost::property_tree::json_parser::read_json` + +And it was always working. + +``` +/**********************************************/ +/* the title */ +/**********************************************/ + +{ + ""garden"": { + ""side1"": { + ""treeA1"": ""apple"", + ""treeA2"": ""orange"", + ""treeA3"": ""banana"", + }, + ""side2"": { + ""treeB1"": ""orange"", + ""treeB2"": ""palm"", + ""treeB3"": ""cherry"", + } + }, + ""house"": """" +} + +``` + +I upgraded my boost version from `1.58.0` to `1.65.0` and now I receive an exception because of the comments. When I remove the comments, everything is fine. + +Am I making a mistake somewhere or is it a bug in the new version of boost?",2017/09/13,"['https://Stackoverflow.com/questions/46187201', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4623526/']","Comments are not JSON. + +The old parser did have them, but didn't properly support unicode. + +Here's the message in [the release notes for Boost 1.59.0](http://www.boost.org/users/history/version_1_59_0.html): + +> +> Property Tree: +> +> +> * A new JSON parser with full Unicode support. +> * **Breaking +> change:** The new parser does not support comments or string +> concatenation in JSON files. These features were non-standard +> extensions of the old parser but their removal could break code which +> was relying on them. +> +> +>","The [official JSON standard](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf) does not define a syntax for comments ([here's the reason why](http://youtu.be/-C-JoyNuQJs?t=48m53s)). + +Support for comments is implemented (or not) on a per-parser basis. It was probably something that Boost once supported for convenience but later removed for compliance (I'm speculating, as I don't use Boost myself). + +If Boost no longer supports comments, you will have to strip them out before parsing. There are plenty of 3rd party implementations for that very purpose. See [Can comments be used in JSON?](https://stackoverflow.com/questions/244777/) for suggestions." +1862965,"I am writing a web service client in C# and do not want to create and serialize/deserialize objects, but rather send and receive raw XML. + +Is this possible in C#?",2009/12/07,"['https://Stackoverflow.com/questions/1862965', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/226682/']","Yes - you can simply declare the inputs and outputs as `XmlNode`'s + +``` +[WebMethod] +public XmlNode MyMethod(XmlNode input); + +```","You can have your web service method return a string containing the xml, but do heed the comment above about making things more error-prone." +1862965,"I am writing a web service client in C# and do not want to create and serialize/deserialize objects, but rather send and receive raw XML. + +Is this possible in C#?",2009/12/07,"['https://Stackoverflow.com/questions/1862965', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/226682/']","You can use the System.Net classes, such as HttpWebRequest and HttpWebResponse to read and write directly to an HTTP connection. + +Here's a basic (off-the-cuff, not compiled, non-error-checking, grossly oversimplified) example. May not be 100% correct, but at least will give you an idea of how it works: + +``` +HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create(url); +req.ContentLength = content.Length; +req.Method = ""POST""; +req.GetRequestStream().Write(Encoding.ASCII.GetBytes(content), 0, content.Length); +HttpWebResponse resp = (HttpWebResponse) req.getResponse(); +//Read resp.GetResponseStream() and do something with it... + +``` + +This approach works well. **But** chances are whatever you need to do can be accomplished by inheriting the existing proxy classes and overriding the members you need to have behave differently. This type of thing is best reserved for when you have no other choice, which is not very often in my experience.","You can have your web service method return a string containing the xml, but do heed the comment above about making things more error-prone." +1862965,"I am writing a web service client in C# and do not want to create and serialize/deserialize objects, but rather send and receive raw XML. + +Is this possible in C#?",2009/12/07,"['https://Stackoverflow.com/questions/1862965', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/226682/']","Here is part of an implementation I just got running based on John M Gant's example. It is important to set the content type request header. Plus my request needed credentials. + +``` +protected virtual WebRequest CreateRequest(ISoapMessage soapMessage) +{ + var wr = WebRequest.Create(soapMessage.Uri); + wr.ContentType = ""text/xml;charset=utf-8""; + wr.ContentLength = soapMessage.ContentXml.Length; + + wr.Headers.Add(""SOAPAction"", soapMessage.SoapAction); + wr.Credentials = soapMessage.Credentials; + wr.Method = ""POST""; + wr.GetRequestStream().Write(Encoding.UTF8.GetBytes(soapMessage.ContentXml), 0, soapMessage.ContentXml.Length); + + return wr; +} + +public interface ISoapMessage +{ + string Uri { get; } + string ContentXml { get; } + string SoapAction { get; } + ICredentials Credentials { get; } +} + +```","You can have your web service method return a string containing the xml, but do heed the comment above about making things more error-prone." +53200172,"I am learning Hibernate (beginner here). I wanted to know how the saveOrUpdate method does a comparison of records in the table and data hold in object which is in transient state. + +Example code snippet: + +``` +package com.crudoperations; + +import org.hibernate.Session; + +import org.hibernate.SessionFactory; + +import org.hibernate.Transaction; + +import org.hibernate.cfg.Configuration; + +import org.hibernate.service.ServiceRegistry; + +import org.hibernate.service.ServiceRegistryBuilder; + +import com.beans.Student; + +public class CRUDMain { + +public static void main(String[] args) { + + Configuration cfg = new Configuration(); + + cfg.configure(""hibernate.cfg.xml""); + + ServiceRegistryBuilder service = new ServiceRegistryBuilder(); + + ServiceRegistry sRegitry = service.applySettings(cfg.getProperties()).buildServiceRegistry(); + + SessionFactory sf = cfg.buildSessionFactory(sRegitry); + + Session session = sf.openSession(); + + Transaction tx = session.beginTransaction(); + + Student stud = new Student(); + + stud.setId(101); + + stud.setSname(""abc""); + + stud.setEmail(""abc@gmail.com""); + + stud.setMarks(89); + + // System.out.println(""invoking save() method.""); + + // int pk = (Integer) session.save(stud); + + // System.out.println(""PK:""+pk); + + System.out.println(""invoking saveOrUpdate() method.""); + + session.saveOrUpdate(stud); + + tx.commit(); + +} + +}; + +package com.beans; + +public class Student { + +private int id; + +private String sname; + +private String email; + +private int marks; + +public Student() { } + +public int getId() { + + return id; + +} + +public void setId(int id) { + + this.id = id; + +} + +public String getSname() { + + return sname; + +} + +public void setSname(String sname) { + + this.sname = sname; + +} + +public String getEmail() { + + return email; + +} + +public void setEmail(String email) { + + this.email = email; + +} + +public int getMarks() { + + return marks; + +} + +public void setMarks(int marks) { + + this.marks = marks; + +} + +} + +``` + +I have read that using saveOrUpdate() first selects the record from the database and compares the selected data with data in stud object. If it matches no insertion happens but if it doesn't match then data in stud object is inserted. How does the comparison happen since we haven't overridden the equals method in Student pojo. Table contains data with: + +``` +id=101, name=abc, email=abc@gmail.com, marks=89 + +``` + +Thanks in advance.",2018/11/08,"['https://Stackoverflow.com/questions/53200172', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5281658/']","You have a local dependency that you are trying to install. + +`""internal-edge-render"": ""file:/root/.m2/repository/pl/chilldev/internal/internal-edge-render/0.1.2/internal-edge-render-0.1.2.tar.gz""` + +Docker is unaware of it's path. Either install the dependency from npm or mount the directory into docker. Assuming the latter is no option... + +Unfortunately the logs don't really help in that case.","Setting the docker network to ""host"" fixed this and other issues for me. + +``` + docker build . --network host + +```" +159052,"As described in answers to this [question](https://tex.stackexchange.com/questions/35240/special-arrangement-of-subfigures/35243?noredirect=1#comment363076_35243), the following code: + +``` +\documentclass{memoir} +\newsubfloat{figure} +\begin{document} +\begin{figure}[H] +\centering% +\begin{tabular}{lr} +\begin{tabular}{c}% +\subbottom[A]{\rule{0.3\linewidth}{100pt}} \\ +\subbottom[B]{\rule{0.3\linewidth}{100pt}} +\end{tabular} +& +\subbottom[C]{\rule{0.6\linewidth}{230pt}} +\end{tabular} +\caption{D}% +\end{figure} +\end{document} + +``` + +Leads to significant misalignment. How do I fix it? + +![enter image description here](https://i.stack.imgur.com/u2YGJ.png)",2014/02/07,"['https://tex.stackexchange.com/questions/159052', 'https://tex.stackexchange.com', 'https://tex.stackexchange.com/users/512/']","Use `b` for the optional argument in the inner tabular: + +``` +\documentclass{memoir} +\newsubfloat{figure} +\begin{document} +\begin{figure}[H] +\centering% +\begin{tabular}{@{}lr@{}} +\begin{tabular}[b]{c}% +\subbottom[A]{\rule{0.3\linewidth}{100pt}} \\ +\subbottom[B]{\rule{0.3\linewidth}{100pt}} +\end{tabular} +& +\subbottom[C]{\rule{0.6\linewidth}{230pt}} +\end{tabular} +\caption{D}% +\end{figure} +\end{document} + +``` + +![enter image description here](https://i.stack.imgur.com/VtbIf.png) + +I'd however, suggest `minipage`s of fixed height inside the `tabular` (again, with `b`ottom alignment): + +``` +\documentclass{memoir} +\newsubfloat{figure} +\begin{document} +\begin{figure}[H] +\centering% +\begin{tabular}{@{}lr@{}} +\begin{minipage}[c][230pt][b]{0.3\linewidth}% +\subbottom[A]{\rule{\linewidth}{100pt}}\\[9.5pt] +\subbottom[B]{\rule{\linewidth}{100pt}} +\end{minipage} +& +\begin{minipage}[c][230pt][b]{0.6\linewidth}% +\subbottom[C]{\rule{\linewidth}{230pt}} +\end{minipage} +\end{tabular} +\caption{D}% +\end{figure} +\end{document} + +``` + +![enter image description here](https://i.stack.imgur.com/HpAZw.png)","Just for fun. For some reason, the first subbottom has a 5pt smaller top margin than all subsequent subbottoms. + +``` +\documentclass{memoir} +\usepackage{tikz} + +\newsubfloat{figure} +\begin{document} +\begin{figure}[H] +\centering% +\begin{tikzpicture} +\path +(0,0) node(C){\subbottom[C]{\rule{0.6\linewidth}{230pt}}} +(C.north west) +(0,5pt) node[below left] +{\subbottom[A]{\rule{0.3\linewidth}{100pt}}} +(C.south west) node[above left] +{\subbottom[B]{\rule{0.3\linewidth}{100pt}}}; +\end{tikzpicture} +\caption{D}% +\end{figure} +\end{document} + +``` + +![figure](https://i.stack.imgur.com/5COTl.png)" +34129459,"i'm asking for parsers, +On the server side (cloud code), is there a way to call a function defined in other function ? Function should not be called on the client + +``` +Parse.Cloud.define(""getProfiles"", function(request, response) {..}) + +Parse.Cloud.define(""otherFunction', function(request){ + +//call to getProfiles }) + +```",2015/12/07,"['https://Stackoverflow.com/questions/34129459', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2420289/']","This can be solved with dev policy. I keep in the habit of using `Parse.Cloud.define` as the means of wrapping a function for external invocation, always building and naming them as follows... + +``` +// this is just a ""wrapper"" for the simple JS function +Parse.Cloud.define(""getProfiles"", function(request, response) { + // the only thing I allow to happen here is: + // 1) unwrap params... + var param = request.params.param; + // 2) call an unwrapped function by the same name (this assumes it returns a promise) + getProfiles(param).then(function(result) { + // invoke response success and error + response.success(result); + }, function(error) { + response.error(error); + }); +}); + +// always have an unwrapped function named identically +function getProfiles(param) { + // do some work and (usually) return a promise +} + +``` + +Other functions in the cloud, wrapped or unwrapped, can now call the unwrapped function directly.","[Cloud code documentation](https://parse.com/docs/cloudcode/guide) recommends to call defined functions as follows: + +You can use `Parse.Cloud.run`. + +``` +Parse.Cloud.run(""getProfiles "", { + //here you can pass the function request parameters + userId: user.id +}).then(function(result) { + //here you will handle the returned results (if function returned response.success()) + console.log(result); +}, function(error) { + //handle errors if called function returned response.error() + console.error(error); +}); + +``` + +Hope it helps" +14309502,"In auto-fill-mode, I want emacs to auto-fill paragraph with hanging indentation, like this: + +``` +This is an example of hanging indented + paragraph. The first line is indented + less than the following lines in a + paragraph. + +Another paragraph starts from here, and + lines are broken. + +``` + +How to do this?",2013/01/13,"['https://Stackoverflow.com/questions/14309502', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1261870/']","You can achieve the effect you want automatically by putting the following lines into you .emacs file: + +```lisp +(setq adaptive-fill-function '(lambda () "" "")) + +``` + +The string at the end of the line is the width of the hanging indent.",Simply indent the second line manually. Then when you hit `M-q` the whole paragraph will be indented the way you want. +14309502,"In auto-fill-mode, I want emacs to auto-fill paragraph with hanging indentation, like this: + +``` +This is an example of hanging indented + paragraph. The first line is indented + less than the following lines in a + paragraph. + +Another paragraph starts from here, and + lines are broken. + +``` + +How to do this?",2013/01/13,"['https://Stackoverflow.com/questions/14309502', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1261870/']",Simply indent the second line manually. Then when you hit `M-q` the whole paragraph will be indented the way you want.,"You can do this interactively using `M-x set-fill-prefix`, bound by default to `C-x .` (that's a period, or full-stop, after the C-x). + +Manually, *only once*, indent the second line of a single paragraph, and while your cursor (point) is at that position, press `C-x .`. All auto-fills from now on will indent anything past the first line accordingly. + +In order to reset the behavior, move your cursor the beginning of a line and invoke `C-x .` again. + +As a bonus, you aren't restricted to having this fill prefix be limited to spaces. For example you could include comment symbols or vertical lines or your $PS1. + +You may also be interested in `M-x auto-fill-mode` which toggles *automatic* line-wrapping and justification. That will save you from having to manually selecting regions and typing `M-q`. + +If you really want to get fancy, you can write your own custom function for this, and set variable `normal-auto-fill-function` to point to your function." +14309502,"In auto-fill-mode, I want emacs to auto-fill paragraph with hanging indentation, like this: + +``` +This is an example of hanging indented + paragraph. The first line is indented + less than the following lines in a + paragraph. + +Another paragraph starts from here, and + lines are broken. + +``` + +How to do this?",2013/01/13,"['https://Stackoverflow.com/questions/14309502', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1261870/']","You can achieve the effect you want automatically by putting the following lines into you .emacs file: + +```lisp +(setq adaptive-fill-function '(lambda () "" "")) + +``` + +The string at the end of the line is the width of the hanging indent.","You can do this interactively using `M-x set-fill-prefix`, bound by default to `C-x .` (that's a period, or full-stop, after the C-x). + +Manually, *only once*, indent the second line of a single paragraph, and while your cursor (point) is at that position, press `C-x .`. All auto-fills from now on will indent anything past the first line accordingly. + +In order to reset the behavior, move your cursor the beginning of a line and invoke `C-x .` again. + +As a bonus, you aren't restricted to having this fill prefix be limited to spaces. For example you could include comment symbols or vertical lines or your $PS1. + +You may also be interested in `M-x auto-fill-mode` which toggles *automatic* line-wrapping and justification. That will save you from having to manually selecting regions and typing `M-q`. + +If you really want to get fancy, you can write your own custom function for this, and set variable `normal-auto-fill-function` to point to your function." +70045,"I'm making a Time card app that keeps track of employee hours. What I would like to know, and this is an etiquette question concerning overtime hours, is: + +If an employee works past midnight on the last day of the work week, and the employee has worked over 40 hours, should the extra hours worked past midnight be calculated to the completed week's overtime hours, or added to the next week's total as overtime hours? + +on the first hand, working past midnight on the last day of the week is in reality working on the next week, and on second hand if you are working past midnight it is still technically the last day of the weeks shift, + +What would be the proper way to go about this?",2016/06/18,"['https://workplace.stackexchange.com/questions/70045', 'https://workplace.stackexchange.com', 'https://workplace.stackexchange.com/users/52936/']","**Ask a potential customer** + +We cannot safely answer this question for you for a number of reasons. As such the best place to go for this type of information is to ask multiple potential customers (preferably in different types of industries, and at least one that does government contracts) and ask them how they handle this case. Also it is safe to say since this is about labor charging that there are a whole bunch more special case rules that are likely country and state specific that can impact your app, which we cannot help with. + +**Make it configurable** + +The likely answer you will find from asking potential customers is all of the above and ways you did not even think of were valid. In some special circumstances it could be at the end of the week those hours count as normal hours to next week. Other cases it could be overtime for the current week, or it could be overtime hours for next week. As such make your app configurable so that the customer can choose how the heck they want to handle the case. Problem that will likely arise with this is a customer might assume that since your app allows them to do it, it must be legal (which it could easily not be).","This is a good question because it doesn't just impact software development. It means that you will have to understand the labor laws for the jurisdictions involved. + +It isn't just the end of the pay period. If there are night and weekend pay differentials and an employee reports for work at 11:00 PM which pay rate are they paid? What happens if they are called in for emergency work? What happens if they end work in lower rate period? what happens if they end in a higher rate period? + +Even if your options follow the law, some union agreements and contracts may specify other rules. + +The best approach is to make the settings part of the business rules, and they have to be configurable, with some predefined sets of rules that will cover most cases." +13346165,"I'd like to know what is the best way to add overall height to the accordion example in the link below. + +I would like to make the `ul` sub-menu class taller, I would want the extra space to show as just empty with no list elements. + + + +I think it is possible by adding another tag like a div around the `ul`, but I am wondering if there's an easier way in CSS?",2012/11/12,"['https://Stackoverflow.com/questions/13346165', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/359958/']","``` +.accordion li:target > .sub-menu { + min-height: 908px; //add your height here + background: red; //add a background color what you would like + } + +``` + +i made this + +``` + min-height: 908px; + +``` + +just for an example","You wouldn't increase the size of the `ul` sub-menu class, rather each individual `a` tag. + +Like so: + +``` +.accordion li > a { + height: 64px; // was 32px; +} + +``` + +This would double the height of each `a` tag, in turn increasing the height of `li` and ultimately the `ul`" +19243275,"I have been trying to update an iOS client app now for the past 2 weeks, unfortunately it has been rejected twice as Apple say that it crashes on iOS7. Apple have sent me the following crash report. + +``` +Incident Identifier: C213974C-73E2-42C4-A2AA-E4C2A454319E +CrashReporter Key: 2c5d5176cc4387265bd86c427bf138d2b0acfe38 +Hardware Model: xxx +Process: Twlight Sports [502] +Path: /var/mobile/Applications/2B9ED7B5-787E-48ED-AAEC-3DEF87A86C67/Twlight Sports.app/Twlight Sports +Identifier: com.twilightsports.twilightsports +Version: 1.2 (1.2) +Code Type: ARM (Native) +Parent Process: launchd [1] + +Date/Time: 2013-09-27 15:22:18.784 -0700 +OS Version: iOS 7.0 (11A465) +Report Version: 104 + +Exception Type: EXC_BREAKPOINT (SIGTRAP) +Exception Codes: 0x0000000000000001, 0x00000000e7ffdefe +Triggered by Thread: 0 + +Dyld Error Message: + Library not loaded: /Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit + Referenced from: /var/mobile/Applications/2B9ED7B5-787E-48ED-AAEC-3DEF87A86C67/Twlight Sports.app/Twlight Sports + Reason: image not found + Dyld Version: 324 + +Binary Images: +0x2beed000 - 0x2bf0d78a dyld armv7 /usr/lib/dyld + +``` + +I removed all references to `SenTestingKit` in my project and submitted the app update again. +A week later I received the exact same crash report from Apple. + +I then created an `AdHoc` very of the same binary I sent to Apple and deployed this onto my iPhone 4S and iPad 2. Both devices work fine without crashing. + +I have appealed the rejection hoping Apple will test the app again, they have however rejectd the appeal simply stating that it is still crashing and not offering any more help. At the moment I am at a loss because I cannot replicate the crash and therefore cannot fix it. + +I also have CocoaPods running in my workspace, with the Kiwi TDD pod installed. This has references to But the Pods Build target does not have SenTestingKit.framework in its Link Binary With Libraries![No SenTestingKit framework](https://i.stack.imgur.com/0p4mL.png)",2013/10/08,"['https://Stackoverflow.com/questions/19243275', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2857808/']","The information you posted is very limited, however I'd start with the following steps: + +1. You xxx'ed the hardware model, but the crash may be hardware specific and it may happen only on the hardware you did not test. +2. Same with the os, you may have tested on 7.0.1 or 7.0.2, but according to the crash report it happens on 7.0 so make sure you test on that. +3. Do yourself a favour and start using TestFlight for crash reporting, you will not have to rely on people sending you crash reports, instead the crash reports will be sent to you automatically and symbolicated. +4. When you test your app on your hardware, make sure you test the release configuration. There are many things that can go wrong when the release build is optimised, so testing the release is the only sensible option here. +5. Did you get any warnings during validation? If yes maybe you should take them seriously? + +I assume the app doesn't launch but crashes on launch. It this case I'm not sure if the TestFlight will help you much, instead I think there might be a difference between your Debug and Release configurations that causes the SenTestKit to be used by the later.","I faced similar problem where app was working fine in my device but rejected by apple. +It was saying some file in a package was corrupted. +When I set the permission for read, write and execute for all users and submitted the app again, it was approved. +It might be one of the reason in your case. Please try by setting permission and re-create binary and submit it." +19243275,"I have been trying to update an iOS client app now for the past 2 weeks, unfortunately it has been rejected twice as Apple say that it crashes on iOS7. Apple have sent me the following crash report. + +``` +Incident Identifier: C213974C-73E2-42C4-A2AA-E4C2A454319E +CrashReporter Key: 2c5d5176cc4387265bd86c427bf138d2b0acfe38 +Hardware Model: xxx +Process: Twlight Sports [502] +Path: /var/mobile/Applications/2B9ED7B5-787E-48ED-AAEC-3DEF87A86C67/Twlight Sports.app/Twlight Sports +Identifier: com.twilightsports.twilightsports +Version: 1.2 (1.2) +Code Type: ARM (Native) +Parent Process: launchd [1] + +Date/Time: 2013-09-27 15:22:18.784 -0700 +OS Version: iOS 7.0 (11A465) +Report Version: 104 + +Exception Type: EXC_BREAKPOINT (SIGTRAP) +Exception Codes: 0x0000000000000001, 0x00000000e7ffdefe +Triggered by Thread: 0 + +Dyld Error Message: + Library not loaded: /Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit + Referenced from: /var/mobile/Applications/2B9ED7B5-787E-48ED-AAEC-3DEF87A86C67/Twlight Sports.app/Twlight Sports + Reason: image not found + Dyld Version: 324 + +Binary Images: +0x2beed000 - 0x2bf0d78a dyld armv7 /usr/lib/dyld + +``` + +I removed all references to `SenTestingKit` in my project and submitted the app update again. +A week later I received the exact same crash report from Apple. + +I then created an `AdHoc` very of the same binary I sent to Apple and deployed this onto my iPhone 4S and iPad 2. Both devices work fine without crashing. + +I have appealed the rejection hoping Apple will test the app again, they have however rejectd the appeal simply stating that it is still crashing and not offering any more help. At the moment I am at a loss because I cannot replicate the crash and therefore cannot fix it. + +I also have CocoaPods running in my workspace, with the Kiwi TDD pod installed. This has references to But the Pods Build target does not have SenTestingKit.framework in its Link Binary With Libraries![No SenTestingKit framework](https://i.stack.imgur.com/0p4mL.png)",2013/10/08,"['https://Stackoverflow.com/questions/19243275', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2857808/']","You can examine your app binary with `otool` before re-submitting to know whether or not it links `SenTestingKit`. `otool -L` will list the linked libraries for a Mach-O binary. + +For example, Xcode links: + +``` +% otool -L /Applications/Xcode.app/Contents/MacOS/Xcode +/Applications/Xcode.app/Contents/MacOS/Xcode: + /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 20.0.0) + @rpath/DVTFoundation.framework/Versions/A/DVTFoundation (compatibility version 1.0.0, current version 3532.0.0) + @rpath/DVTKit.framework/Versions/A/DVTKit (compatibility version 1.0.0, current version 3546.0.0) + @rpath/IDEFoundation.framework/Versions/A/IDEFoundation (compatibility version 1.0.0, current version 3569.0.0) + @rpath/IDEKit.framework/Versions/A/IDEKit (compatibility version 1.0.0, current version 3591.0.0) + /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1052.0.0) + /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) + /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) + /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1247.0.0) + +``` + +You can run this on your app store binary by creating an App Store build, copying the `.ipa` to a folder somewhere. Rename the `.ipa` to `.zip`. Open the `.zip` file, then run `otool -L` on the binary inside the app, probably something like this: (this is iBooks) + +``` +% cd iBooks\ 3.1.3/Payload/iBooks.app +% otool -L iBooks +iBooks: + /usr/lib/liblockdown.dylib (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/StoreKit.framework/StoreKit (compatibility version 1.0.0, current version 1.0.0) + /System/Library/PrivateFrameworks/Celestial.framework/Celestial (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/AssetsLibrary.framework/AssetsLibrary (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 992.0.0) + /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 2372.0.0) + /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics (compatibility version 64.0.0, current version 600.0.0) + /System/Library/PrivateFrameworks/iTunesStoreUI.framework/iTunesStoreUI (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/MediaPlayer.framework/MediaPlayer (compatibility version 1.0.0, current version 1.0.0) + /System/Library/PrivateFrameworks/iTunesStore.framework/iTunesStore (compatibility version 1.0.0, current version 1.0.0) + /System/Library/PrivateFrameworks/StoreServices.framework/StoreServices (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/QuartzCore.framework/QuartzCore (compatibility version 1.2.0, current version 1.8.0) + /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices (compatibility version 1.0.0, current version 14.0.0) + /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport (compatibility version 1.0.0, current version 29.0.0) + /System/Library/PrivateFrameworks/WebKit.framework/WebKit (compatibility version 1.0.0, current version 536.26.0) + /System/Library/Frameworks/CoreData.framework/CoreData (compatibility version 1.0.0, current version 419.0.0) + /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore (compatibility version 1.0.0, current version 536.26.0) + /System/Library/Frameworks/CFNetwork.framework/CFNetwork (compatibility version 1.0.0, current version 609.0.0) + /System/Library/PrivateFrameworks/WebCore.framework/WebCore (compatibility version 1.0.0, current version 536.26.0) + /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) + /System/Library/PrivateFrameworks/Bom.framework/Bom (compatibility version 2.0.0, current version 189.0.0) + /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) + /System/Library/Frameworks/CoreText.framework/CoreText (compatibility version 1.0.0, current version 1.0.0) + /usr/lib/libAccessibility.dylib (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices (compatibility version 1.0.0, current version 40.0.0) + /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 9.6.0) + /System/Library/Frameworks/MessageUI.framework/MessageUI (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/AVFoundation.framework/AVFoundation (compatibility version 1.0.0, current version 2.0.0) + /System/Library/Frameworks/ImageIO.framework/ImageIO (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration (compatibility version 1.0.0, current version 499.0.0) + /System/Library/Frameworks/Security.framework/Security (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox (compatibility version 1.0.0, current version 359.0.0) + /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 49.1.0) + /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) + /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0) + /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 173.8.0) + /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 793.0.0) + +``` + +And look for `SenTestingKit` in the list for your app's binary.","I faced similar problem where app was working fine in my device but rejected by apple. +It was saying some file in a package was corrupted. +When I set the permission for read, write and execute for all users and submitted the app again, it was approved. +It might be one of the reason in your case. Please try by setting permission and re-create binary and submit it." +19243275,"I have been trying to update an iOS client app now for the past 2 weeks, unfortunately it has been rejected twice as Apple say that it crashes on iOS7. Apple have sent me the following crash report. + +``` +Incident Identifier: C213974C-73E2-42C4-A2AA-E4C2A454319E +CrashReporter Key: 2c5d5176cc4387265bd86c427bf138d2b0acfe38 +Hardware Model: xxx +Process: Twlight Sports [502] +Path: /var/mobile/Applications/2B9ED7B5-787E-48ED-AAEC-3DEF87A86C67/Twlight Sports.app/Twlight Sports +Identifier: com.twilightsports.twilightsports +Version: 1.2 (1.2) +Code Type: ARM (Native) +Parent Process: launchd [1] + +Date/Time: 2013-09-27 15:22:18.784 -0700 +OS Version: iOS 7.0 (11A465) +Report Version: 104 + +Exception Type: EXC_BREAKPOINT (SIGTRAP) +Exception Codes: 0x0000000000000001, 0x00000000e7ffdefe +Triggered by Thread: 0 + +Dyld Error Message: + Library not loaded: /Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit + Referenced from: /var/mobile/Applications/2B9ED7B5-787E-48ED-AAEC-3DEF87A86C67/Twlight Sports.app/Twlight Sports + Reason: image not found + Dyld Version: 324 + +Binary Images: +0x2beed000 - 0x2bf0d78a dyld armv7 /usr/lib/dyld + +``` + +I removed all references to `SenTestingKit` in my project and submitted the app update again. +A week later I received the exact same crash report from Apple. + +I then created an `AdHoc` very of the same binary I sent to Apple and deployed this onto my iPhone 4S and iPad 2. Both devices work fine without crashing. + +I have appealed the rejection hoping Apple will test the app again, they have however rejectd the appeal simply stating that it is still crashing and not offering any more help. At the moment I am at a loss because I cannot replicate the crash and therefore cannot fix it. + +I also have CocoaPods running in my workspace, with the Kiwi TDD pod installed. This has references to But the Pods Build target does not have SenTestingKit.framework in its Link Binary With Libraries![No SenTestingKit framework](https://i.stack.imgur.com/0p4mL.png)",2013/10/08,"['https://Stackoverflow.com/questions/19243275', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2857808/']","Well..... + +To fix the issue I basically had to remove CocoaPods from my workspace, Remove the test target and test scheme, I resubmited the app last Thursday and it has just been accepted today. + +It was a pretty desperate attempt at a fix and I think the culprit was the fact that Apple was running the test scheme on my project which I didnt properly setup. After removing the Kiwi Cocoapods looks like it fixed whatever was requesting the SenTestingKit framework","I faced similar problem where app was working fine in my device but rejected by apple. +It was saying some file in a package was corrupted. +When I set the permission for read, write and execute for all users and submitted the app again, it was approved. +It might be one of the reason in your case. Please try by setting permission and re-create binary and submit it." +19243275,"I have been trying to update an iOS client app now for the past 2 weeks, unfortunately it has been rejected twice as Apple say that it crashes on iOS7. Apple have sent me the following crash report. + +``` +Incident Identifier: C213974C-73E2-42C4-A2AA-E4C2A454319E +CrashReporter Key: 2c5d5176cc4387265bd86c427bf138d2b0acfe38 +Hardware Model: xxx +Process: Twlight Sports [502] +Path: /var/mobile/Applications/2B9ED7B5-787E-48ED-AAEC-3DEF87A86C67/Twlight Sports.app/Twlight Sports +Identifier: com.twilightsports.twilightsports +Version: 1.2 (1.2) +Code Type: ARM (Native) +Parent Process: launchd [1] + +Date/Time: 2013-09-27 15:22:18.784 -0700 +OS Version: iOS 7.0 (11A465) +Report Version: 104 + +Exception Type: EXC_BREAKPOINT (SIGTRAP) +Exception Codes: 0x0000000000000001, 0x00000000e7ffdefe +Triggered by Thread: 0 + +Dyld Error Message: + Library not loaded: /Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit + Referenced from: /var/mobile/Applications/2B9ED7B5-787E-48ED-AAEC-3DEF87A86C67/Twlight Sports.app/Twlight Sports + Reason: image not found + Dyld Version: 324 + +Binary Images: +0x2beed000 - 0x2bf0d78a dyld armv7 /usr/lib/dyld + +``` + +I removed all references to `SenTestingKit` in my project and submitted the app update again. +A week later I received the exact same crash report from Apple. + +I then created an `AdHoc` very of the same binary I sent to Apple and deployed this onto my iPhone 4S and iPad 2. Both devices work fine without crashing. + +I have appealed the rejection hoping Apple will test the app again, they have however rejectd the appeal simply stating that it is still crashing and not offering any more help. At the moment I am at a loss because I cannot replicate the crash and therefore cannot fix it. + +I also have CocoaPods running in my workspace, with the Kiwi TDD pod installed. This has references to But the Pods Build target does not have SenTestingKit.framework in its Link Binary With Libraries![No SenTestingKit framework](https://i.stack.imgur.com/0p4mL.png)",2013/10/08,"['https://Stackoverflow.com/questions/19243275', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2857808/']","You can examine your app binary with `otool` before re-submitting to know whether or not it links `SenTestingKit`. `otool -L` will list the linked libraries for a Mach-O binary. + +For example, Xcode links: + +``` +% otool -L /Applications/Xcode.app/Contents/MacOS/Xcode +/Applications/Xcode.app/Contents/MacOS/Xcode: + /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 20.0.0) + @rpath/DVTFoundation.framework/Versions/A/DVTFoundation (compatibility version 1.0.0, current version 3532.0.0) + @rpath/DVTKit.framework/Versions/A/DVTKit (compatibility version 1.0.0, current version 3546.0.0) + @rpath/IDEFoundation.framework/Versions/A/IDEFoundation (compatibility version 1.0.0, current version 3569.0.0) + @rpath/IDEKit.framework/Versions/A/IDEKit (compatibility version 1.0.0, current version 3591.0.0) + /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1052.0.0) + /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) + /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) + /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1247.0.0) + +``` + +You can run this on your app store binary by creating an App Store build, copying the `.ipa` to a folder somewhere. Rename the `.ipa` to `.zip`. Open the `.zip` file, then run `otool -L` on the binary inside the app, probably something like this: (this is iBooks) + +``` +% cd iBooks\ 3.1.3/Payload/iBooks.app +% otool -L iBooks +iBooks: + /usr/lib/liblockdown.dylib (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/StoreKit.framework/StoreKit (compatibility version 1.0.0, current version 1.0.0) + /System/Library/PrivateFrameworks/Celestial.framework/Celestial (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/AssetsLibrary.framework/AssetsLibrary (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 992.0.0) + /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 2372.0.0) + /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics (compatibility version 64.0.0, current version 600.0.0) + /System/Library/PrivateFrameworks/iTunesStoreUI.framework/iTunesStoreUI (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/MediaPlayer.framework/MediaPlayer (compatibility version 1.0.0, current version 1.0.0) + /System/Library/PrivateFrameworks/iTunesStore.framework/iTunesStore (compatibility version 1.0.0, current version 1.0.0) + /System/Library/PrivateFrameworks/StoreServices.framework/StoreServices (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/QuartzCore.framework/QuartzCore (compatibility version 1.2.0, current version 1.8.0) + /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices (compatibility version 1.0.0, current version 14.0.0) + /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport (compatibility version 1.0.0, current version 29.0.0) + /System/Library/PrivateFrameworks/WebKit.framework/WebKit (compatibility version 1.0.0, current version 536.26.0) + /System/Library/Frameworks/CoreData.framework/CoreData (compatibility version 1.0.0, current version 419.0.0) + /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore (compatibility version 1.0.0, current version 536.26.0) + /System/Library/Frameworks/CFNetwork.framework/CFNetwork (compatibility version 1.0.0, current version 609.0.0) + /System/Library/PrivateFrameworks/WebCore.framework/WebCore (compatibility version 1.0.0, current version 536.26.0) + /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) + /System/Library/PrivateFrameworks/Bom.framework/Bom (compatibility version 2.0.0, current version 189.0.0) + /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) + /System/Library/Frameworks/CoreText.framework/CoreText (compatibility version 1.0.0, current version 1.0.0) + /usr/lib/libAccessibility.dylib (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices (compatibility version 1.0.0, current version 40.0.0) + /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 9.6.0) + /System/Library/Frameworks/MessageUI.framework/MessageUI (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/AVFoundation.framework/AVFoundation (compatibility version 1.0.0, current version 2.0.0) + /System/Library/Frameworks/ImageIO.framework/ImageIO (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration (compatibility version 1.0.0, current version 499.0.0) + /System/Library/Frameworks/Security.framework/Security (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox (compatibility version 1.0.0, current version 359.0.0) + /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 49.1.0) + /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) + /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0) + /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 173.8.0) + /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 793.0.0) + +``` + +And look for `SenTestingKit` in the list for your app's binary.","The information you posted is very limited, however I'd start with the following steps: + +1. You xxx'ed the hardware model, but the crash may be hardware specific and it may happen only on the hardware you did not test. +2. Same with the os, you may have tested on 7.0.1 or 7.0.2, but according to the crash report it happens on 7.0 so make sure you test on that. +3. Do yourself a favour and start using TestFlight for crash reporting, you will not have to rely on people sending you crash reports, instead the crash reports will be sent to you automatically and symbolicated. +4. When you test your app on your hardware, make sure you test the release configuration. There are many things that can go wrong when the release build is optimised, so testing the release is the only sensible option here. +5. Did you get any warnings during validation? If yes maybe you should take them seriously? + +I assume the app doesn't launch but crashes on launch. It this case I'm not sure if the TestFlight will help you much, instead I think there might be a difference between your Debug and Release configurations that causes the SenTestKit to be used by the later." +19243275,"I have been trying to update an iOS client app now for the past 2 weeks, unfortunately it has been rejected twice as Apple say that it crashes on iOS7. Apple have sent me the following crash report. + +``` +Incident Identifier: C213974C-73E2-42C4-A2AA-E4C2A454319E +CrashReporter Key: 2c5d5176cc4387265bd86c427bf138d2b0acfe38 +Hardware Model: xxx +Process: Twlight Sports [502] +Path: /var/mobile/Applications/2B9ED7B5-787E-48ED-AAEC-3DEF87A86C67/Twlight Sports.app/Twlight Sports +Identifier: com.twilightsports.twilightsports +Version: 1.2 (1.2) +Code Type: ARM (Native) +Parent Process: launchd [1] + +Date/Time: 2013-09-27 15:22:18.784 -0700 +OS Version: iOS 7.0 (11A465) +Report Version: 104 + +Exception Type: EXC_BREAKPOINT (SIGTRAP) +Exception Codes: 0x0000000000000001, 0x00000000e7ffdefe +Triggered by Thread: 0 + +Dyld Error Message: + Library not loaded: /Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit + Referenced from: /var/mobile/Applications/2B9ED7B5-787E-48ED-AAEC-3DEF87A86C67/Twlight Sports.app/Twlight Sports + Reason: image not found + Dyld Version: 324 + +Binary Images: +0x2beed000 - 0x2bf0d78a dyld armv7 /usr/lib/dyld + +``` + +I removed all references to `SenTestingKit` in my project and submitted the app update again. +A week later I received the exact same crash report from Apple. + +I then created an `AdHoc` very of the same binary I sent to Apple and deployed this onto my iPhone 4S and iPad 2. Both devices work fine without crashing. + +I have appealed the rejection hoping Apple will test the app again, they have however rejectd the appeal simply stating that it is still crashing and not offering any more help. At the moment I am at a loss because I cannot replicate the crash and therefore cannot fix it. + +I also have CocoaPods running in my workspace, with the Kiwi TDD pod installed. This has references to But the Pods Build target does not have SenTestingKit.framework in its Link Binary With Libraries![No SenTestingKit framework](https://i.stack.imgur.com/0p4mL.png)",2013/10/08,"['https://Stackoverflow.com/questions/19243275', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2857808/']","You can examine your app binary with `otool` before re-submitting to know whether or not it links `SenTestingKit`. `otool -L` will list the linked libraries for a Mach-O binary. + +For example, Xcode links: + +``` +% otool -L /Applications/Xcode.app/Contents/MacOS/Xcode +/Applications/Xcode.app/Contents/MacOS/Xcode: + /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 20.0.0) + @rpath/DVTFoundation.framework/Versions/A/DVTFoundation (compatibility version 1.0.0, current version 3532.0.0) + @rpath/DVTKit.framework/Versions/A/DVTKit (compatibility version 1.0.0, current version 3546.0.0) + @rpath/IDEFoundation.framework/Versions/A/IDEFoundation (compatibility version 1.0.0, current version 3569.0.0) + @rpath/IDEKit.framework/Versions/A/IDEKit (compatibility version 1.0.0, current version 3591.0.0) + /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1052.0.0) + /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) + /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) + /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1247.0.0) + +``` + +You can run this on your app store binary by creating an App Store build, copying the `.ipa` to a folder somewhere. Rename the `.ipa` to `.zip`. Open the `.zip` file, then run `otool -L` on the binary inside the app, probably something like this: (this is iBooks) + +``` +% cd iBooks\ 3.1.3/Payload/iBooks.app +% otool -L iBooks +iBooks: + /usr/lib/liblockdown.dylib (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/StoreKit.framework/StoreKit (compatibility version 1.0.0, current version 1.0.0) + /System/Library/PrivateFrameworks/Celestial.framework/Celestial (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/AssetsLibrary.framework/AssetsLibrary (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 992.0.0) + /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 2372.0.0) + /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics (compatibility version 64.0.0, current version 600.0.0) + /System/Library/PrivateFrameworks/iTunesStoreUI.framework/iTunesStoreUI (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/MediaPlayer.framework/MediaPlayer (compatibility version 1.0.0, current version 1.0.0) + /System/Library/PrivateFrameworks/iTunesStore.framework/iTunesStore (compatibility version 1.0.0, current version 1.0.0) + /System/Library/PrivateFrameworks/StoreServices.framework/StoreServices (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/QuartzCore.framework/QuartzCore (compatibility version 1.2.0, current version 1.8.0) + /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices (compatibility version 1.0.0, current version 14.0.0) + /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport (compatibility version 1.0.0, current version 29.0.0) + /System/Library/PrivateFrameworks/WebKit.framework/WebKit (compatibility version 1.0.0, current version 536.26.0) + /System/Library/Frameworks/CoreData.framework/CoreData (compatibility version 1.0.0, current version 419.0.0) + /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore (compatibility version 1.0.0, current version 536.26.0) + /System/Library/Frameworks/CFNetwork.framework/CFNetwork (compatibility version 1.0.0, current version 609.0.0) + /System/Library/PrivateFrameworks/WebCore.framework/WebCore (compatibility version 1.0.0, current version 536.26.0) + /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) + /System/Library/PrivateFrameworks/Bom.framework/Bom (compatibility version 2.0.0, current version 189.0.0) + /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) + /System/Library/Frameworks/CoreText.framework/CoreText (compatibility version 1.0.0, current version 1.0.0) + /usr/lib/libAccessibility.dylib (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices (compatibility version 1.0.0, current version 40.0.0) + /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 9.6.0) + /System/Library/Frameworks/MessageUI.framework/MessageUI (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/AVFoundation.framework/AVFoundation (compatibility version 1.0.0, current version 2.0.0) + /System/Library/Frameworks/ImageIO.framework/ImageIO (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration (compatibility version 1.0.0, current version 499.0.0) + /System/Library/Frameworks/Security.framework/Security (compatibility version 1.0.0, current version 1.0.0) + /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox (compatibility version 1.0.0, current version 359.0.0) + /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 49.1.0) + /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) + /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0) + /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 173.8.0) + /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 793.0.0) + +``` + +And look for `SenTestingKit` in the list for your app's binary.","Well..... + +To fix the issue I basically had to remove CocoaPods from my workspace, Remove the test target and test scheme, I resubmited the app last Thursday and it has just been accepted today. + +It was a pretty desperate attempt at a fix and I think the culprit was the fact that Apple was running the test scheme on my project which I didnt properly setup. After removing the Kiwi Cocoapods looks like it fixed whatever was requesting the SenTestingKit framework" +10452173,"I'm a beginner in SQL and I have the following problem in SQL. + +I need an SQL query that would calculate the difference between two continuous rows having the same value in field [idpersone] and regroupe them into a single row. + +For example I need to transform my table to the desired data as shown below: + +``` +Table data: +idLigne | idperson | statut +--------|----------|------- + L1 1 A + L2 1 B + L3 1 A + L4 1 B + L5 2 A + L6 2 B + L7 3 A + L8 3 B + +Desired output: +idLigne | idpersonne | firstLighe | secondLigne +--------|------------|------------|------------ + L2-L1 1 L1 L2 + L4-L3 1 L3 L4 + L6-L5 2 L5 L6 + L8-L7 2 L7 L8 + +```",2012/05/04,"['https://Stackoverflow.com/questions/10452173', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1374633/']","The niaive solution is this... + +I'm not sure what you want to do if there are three records for the same `idperson`. Or what to do if to sequential records have different idperson. + +``` +WITH + sequenced_data +AS +( + SELECT + ROW_NUMBER() OVER (PARTITION BY idperson ORDER BY idLigne) AS sequence_id, + * + FROM + myTable +) +SELECT + * +FROM + myTable as firstLigne +LEFT JOIN + myTable as secondLigne + ON secondLigne.idperson = firstLigne.idperson + AND secondLigne.sequence_id = firstLigne.sequence_id + 1 +WHERE + (firstLigne.sequence_id % 2) = 1 + +```","I cannot exactly infer the intent of your query. But here it goes: + +``` +with a as +( + select *, + (row_number() over(order by idLigne, idperson) - 1) / 2 as pair_number + from tbl +) +select + max(idligne) + '-' + min(idligne) as idLigne, + min(idperson) as idpersonne, + min(idLigne) as firstlighe, max(idLigne) as secondLigne +from a +group by pair_number + +``` + +Output: + +``` +IDLIGNE IDPERSONNE FIRSTLIGHE SECONDLIGNE +L2-L1 1 L1 L2 +L4-L3 1 L3 L4 +L6-L5 2 L5 L6 +L8-L7 3 L7 L8 + +``` + +Live test: " +10452173,"I'm a beginner in SQL and I have the following problem in SQL. + +I need an SQL query that would calculate the difference between two continuous rows having the same value in field [idpersone] and regroupe them into a single row. + +For example I need to transform my table to the desired data as shown below: + +``` +Table data: +idLigne | idperson | statut +--------|----------|------- + L1 1 A + L2 1 B + L3 1 A + L4 1 B + L5 2 A + L6 2 B + L7 3 A + L8 3 B + +Desired output: +idLigne | idpersonne | firstLighe | secondLigne +--------|------------|------------|------------ + L2-L1 1 L1 L2 + L4-L3 1 L3 L4 + L6-L5 2 L5 L6 + L8-L7 2 L7 L8 + +```",2012/05/04,"['https://Stackoverflow.com/questions/10452173', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1374633/']","You might try something like this: + +``` +DECLARE @MyTable TABLE(idLigne VARCHAR(2), idperson INT, statut CHAR(1)); + +INSERT INTO @MyTable VALUES ('L1',1,'A') +, ('L2',1,'B') +, ('L3',1,'A') +, ('L4',1,'B') +, ('L5',2,'A') +, ('L6',2,'B') +, ('L7',3,'A') +, ('L8',3,'B') + +; WITH a AS ( + SELECT idLigne=t2.idLigne+'-'+t1.idLigne + , idpersonne=t1.idperson + , firstLigne=t1.idLigne + , secondLigne=t2.idLigne + , r1=ROW_NUMBER()OVER(PARTITION BY t1.idLigne ORDER BY t2.idLigne) + , r2=ROW_NUMBER()OVER(PARTITION BY t2.idLigne ORDER BY t1.idLigne) + FROM @MyTable t1 + INNER JOIN @MyTable t2 ON t1.idperson=t2.idperson AND t1.statut='A' AND t2.statut='B' +) +SELECT idLigne + , idpersonne + , firstLigne + , secondLigne +FROM a WHERE r1=r2 +GO + +``` + +Result: + +![enter image description here](https://i.stack.imgur.com/tlDJX.jpg)","I cannot exactly infer the intent of your query. But here it goes: + +``` +with a as +( + select *, + (row_number() over(order by idLigne, idperson) - 1) / 2 as pair_number + from tbl +) +select + max(idligne) + '-' + min(idligne) as idLigne, + min(idperson) as idpersonne, + min(idLigne) as firstlighe, max(idLigne) as secondLigne +from a +group by pair_number + +``` + +Output: + +``` +IDLIGNE IDPERSONNE FIRSTLIGHE SECONDLIGNE +L2-L1 1 L1 L2 +L4-L3 1 L3 L4 +L6-L5 2 L5 L6 +L8-L7 3 L7 L8 + +``` + +Live test: " +31409868,"I am trying to write some c# code to interact with Outlook 2010. I am currently using [this example from Microsoft](https://msdn.microsoft.com/en-us/library/office/ff184617.aspx). + +My code follows: + +``` +using System; +using System.Text; // StringBuilder +using System.Diagnostics; // Debug + +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; + +using Outlook = Microsoft.Office.Interop.Outlook; + +namespace DirectReports +{ + public class Program + { + private void GetManagerDirectReports() + { + Outlook.AddressEntry currentUser = Application.Session.CurrentUser.AddressEntry; + //Outlook.AddressEntry currentUser = Outlook.Application.Session.CurrentUser.AddressEntry; + if (currentUser.Type == ""EX"") + { + Outlook.ExchangeUser manager = currentUser.GetExchangeUser().GetExchangeUserManager(); + if (manager != null) + { + Outlook.AddressEntries addrEntries = + manager.GetDirectReports(); + if (addrEntries != null) + { + foreach (Outlook.AddressEntry addrEntry + in addrEntries) + { + Outlook.ExchangeUser exchUser = addrEntry.GetExchangeUser(); + StringBuilder sb = new StringBuilder(); + sb.AppendLine(""Name: "" + exchUser.Name); + sb.AppendLine(""Title: "" + exchUser.JobTitle); + sb.AppendLine(""Department: "" + exchUser.Department); + sb.AppendLine(""Location: "" + exchUser.OfficeLocation); + Debug.WriteLine(sb.ToString()); + } + } + } + } + } + } +} + +``` + +The Microsoft example mentions ""If you use Visual Studio to test this code example, you must first add a reference to the Microsoft Outlook 15.0 Object Library component"". I am working in Visual Studio Express 2013 for Windows Desktop. I did not see a version 15.0 object library, but added the version 14.0 one instead (which I think it the right one for Outlook 2010 anyways): + +![references included](https://i.stack.imgur.com/zqMbg.png) + +When I attempt a build, I get the following error: + +``` +The name 'Application' does not exist in the current context + +``` + +I read a couple of references that indicate `Application` should be part of the above object libraries, but obviously it is not working here. Can someone please suggest what I am doing wrong?",2015/07/14,"['https://Stackoverflow.com/questions/31409868', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2683104/']","You can create a new `Application` object: + +``` +var appOutlook = new Microsoft.Office.Interop.Outlook.Application(); + +``` + +And then use it as: + +``` +Outlook.AddressEntry currentUser = appOutlook.Session.CurrentUser.AddressEntry; + +```","You are using the wrong project. +When you create a new project in Visual studio, use The Outlook Add-in template. +(Templates -> Visual C# -> Office -> Outlook). + +In this code they Application.Session wil work like you expect. + +Or you should create a new application object like this. +var outlook = new Microsoft.Office.Interop.Outlook.Application(); +And use outlook.Session." +31409868,"I am trying to write some c# code to interact with Outlook 2010. I am currently using [this example from Microsoft](https://msdn.microsoft.com/en-us/library/office/ff184617.aspx). + +My code follows: + +``` +using System; +using System.Text; // StringBuilder +using System.Diagnostics; // Debug + +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; + +using Outlook = Microsoft.Office.Interop.Outlook; + +namespace DirectReports +{ + public class Program + { + private void GetManagerDirectReports() + { + Outlook.AddressEntry currentUser = Application.Session.CurrentUser.AddressEntry; + //Outlook.AddressEntry currentUser = Outlook.Application.Session.CurrentUser.AddressEntry; + if (currentUser.Type == ""EX"") + { + Outlook.ExchangeUser manager = currentUser.GetExchangeUser().GetExchangeUserManager(); + if (manager != null) + { + Outlook.AddressEntries addrEntries = + manager.GetDirectReports(); + if (addrEntries != null) + { + foreach (Outlook.AddressEntry addrEntry + in addrEntries) + { + Outlook.ExchangeUser exchUser = addrEntry.GetExchangeUser(); + StringBuilder sb = new StringBuilder(); + sb.AppendLine(""Name: "" + exchUser.Name); + sb.AppendLine(""Title: "" + exchUser.JobTitle); + sb.AppendLine(""Department: "" + exchUser.Department); + sb.AppendLine(""Location: "" + exchUser.OfficeLocation); + Debug.WriteLine(sb.ToString()); + } + } + } + } + } + } +} + +``` + +The Microsoft example mentions ""If you use Visual Studio to test this code example, you must first add a reference to the Microsoft Outlook 15.0 Object Library component"". I am working in Visual Studio Express 2013 for Windows Desktop. I did not see a version 15.0 object library, but added the version 14.0 one instead (which I think it the right one for Outlook 2010 anyways): + +![references included](https://i.stack.imgur.com/zqMbg.png) + +When I attempt a build, I get the following error: + +``` +The name 'Application' does not exist in the current context + +``` + +I read a couple of references that indicate `Application` should be part of the above object libraries, but obviously it is not working here. Can someone please suggest what I am doing wrong?",2015/07/14,"['https://Stackoverflow.com/questions/31409868', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2683104/']","You can create a new `Application` object: + +``` +var appOutlook = new Microsoft.Office.Interop.Outlook.Application(); + +``` + +And then use it as: + +``` +Outlook.AddressEntry currentUser = appOutlook.Session.CurrentUser.AddressEntry; + +```","Add the following line at the beginning of the file: + +``` + using Microsoft.Office.Interop.Outlook; + +``` + +Or just prepend any Outlook object declaration with the Outlook alias. + +You may find the [C# app automates Outlook (CSAutomateOutlook)](https://code.msdn.microsoft.com/office/CSAutomateOutlook-a3b7bdc9) sample project helpful." +31409868,"I am trying to write some c# code to interact with Outlook 2010. I am currently using [this example from Microsoft](https://msdn.microsoft.com/en-us/library/office/ff184617.aspx). + +My code follows: + +``` +using System; +using System.Text; // StringBuilder +using System.Diagnostics; // Debug + +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; + +using Outlook = Microsoft.Office.Interop.Outlook; + +namespace DirectReports +{ + public class Program + { + private void GetManagerDirectReports() + { + Outlook.AddressEntry currentUser = Application.Session.CurrentUser.AddressEntry; + //Outlook.AddressEntry currentUser = Outlook.Application.Session.CurrentUser.AddressEntry; + if (currentUser.Type == ""EX"") + { + Outlook.ExchangeUser manager = currentUser.GetExchangeUser().GetExchangeUserManager(); + if (manager != null) + { + Outlook.AddressEntries addrEntries = + manager.GetDirectReports(); + if (addrEntries != null) + { + foreach (Outlook.AddressEntry addrEntry + in addrEntries) + { + Outlook.ExchangeUser exchUser = addrEntry.GetExchangeUser(); + StringBuilder sb = new StringBuilder(); + sb.AppendLine(""Name: "" + exchUser.Name); + sb.AppendLine(""Title: "" + exchUser.JobTitle); + sb.AppendLine(""Department: "" + exchUser.Department); + sb.AppendLine(""Location: "" + exchUser.OfficeLocation); + Debug.WriteLine(sb.ToString()); + } + } + } + } + } + } +} + +``` + +The Microsoft example mentions ""If you use Visual Studio to test this code example, you must first add a reference to the Microsoft Outlook 15.0 Object Library component"". I am working in Visual Studio Express 2013 for Windows Desktop. I did not see a version 15.0 object library, but added the version 14.0 one instead (which I think it the right one for Outlook 2010 anyways): + +![references included](https://i.stack.imgur.com/zqMbg.png) + +When I attempt a build, I get the following error: + +``` +The name 'Application' does not exist in the current context + +``` + +I read a couple of references that indicate `Application` should be part of the above object libraries, but obviously it is not working here. Can someone please suggest what I am doing wrong?",2015/07/14,"['https://Stackoverflow.com/questions/31409868', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2683104/']","You are using the wrong project. +When you create a new project in Visual studio, use The Outlook Add-in template. +(Templates -> Visual C# -> Office -> Outlook). + +In this code they Application.Session wil work like you expect. + +Or you should create a new application object like this. +var outlook = new Microsoft.Office.Interop.Outlook.Application(); +And use outlook.Session.","Add the following line at the beginning of the file: + +``` + using Microsoft.Office.Interop.Outlook; + +``` + +Or just prepend any Outlook object declaration with the Outlook alias. + +You may find the [C# app automates Outlook (CSAutomateOutlook)](https://code.msdn.microsoft.com/office/CSAutomateOutlook-a3b7bdc9) sample project helpful." +158578,"I am attempting to solve two differential equations. The solution gives equations that have branch cuts. I need to choose appropriate branch cuts for my boundary conditions. How do I find the correct ones? + +The differential equations and the boundary conditions are + +``` +ClearAll[a, b, x, ω, ν, U]; +eqns = { + ω b[x] - ν (a'')[x] == 0, + U ω - ω a[x] - ν (b'')[x] == 0 + }; +bc1 = {a[0] == 0, b[0] == 0}; +bc2 = {a[∞] == U, b[∞] == 0}; + +``` + +The boundary condition bc2 is ambitions and does not work if put into `DSolve`. However, with just boundary condition bc1 we can get a solution. + +``` +sol = {a[x], b[x]} /. + DSolve[Join[eqns, bc1], {a[x], b[x]}, {x, 0, ∞}] + +``` + +The solution is long and contains terms like (-1)^(3/4) which suggests four branch cuts. There are also constants of integration C[2] and C[4]. By playing around I find I can get a tidy solution by making substitutions and simplifying. I have replace C[2] with a normalised c[2] and similar for C[4]. I have replaced x with a normalised `η` I don't think I have significantly changed the problem. + +``` +subs = { x -> η /Sqrt[2] Sqrt[ν]/Sqrt[ω], + C[2] -> U Sqrt[2] Sqrt[ω]/Sqrt[ν] c[2], + C[4] -> U Sqrt[2] Sqrt[ω]/Sqrt[ν] c[4]}; +sol1 = Simplify[First@sol /. subs] + +``` + +The solution is + +``` +{1/4 E^((-(1/2) - I/2) η) + U (-1 + 4 E^((1/2 + I/2) η) - (1 - I) c[2] + + E^((1 + I) η) (-1 + (1 - I) c[2] - (1 + I) c[4]) + + E^η (-1 + (1 + I) c[2] - (1 - I) c[4]) - + E^(I η) (1 + (1 + I) c[2] - (1 - I) c[4]) + (1 + I) c[4]), + 1/4 E^((-(1/2) - I/2) η) + U (-I - (1 + I) c[2] + + I E^(I η) (1 + (1 + I) c[2] - (1 - I) c[4]) - (1 - I) c[4] + + E^((1 + I) η) (-I + (1 + I) c[2] + (1 - I) c[4]) + + E^η (I + (1 - I) c[2] + (1 + I) c[4]))} + +``` + +We now have several exponential terms and we can collect them as follows + +``` +cc = Collect[sol1, {U, E^_}, Simplify] + +{U (1 + 1/ + 4 E^((1/2 + I/2) η) (-1 + (1 - I) c[2] - (1 + I) c[4]) + + 1/4 E^((1/2 - I/2) η) (-1 + (1 + I) c[2] - (1 - I) c[4]) + + 1/4 E^((-(1/2) + I/ + 2) η) (-1 - (1 + I) c[2] + (1 - I) c[4]) + + 1/4 E^((-(1/2) - I/2) η) (-1 - (1 - I) c[2] + (1 + I) c[4])), + U (1/4 E^((-(1/2) - I/ + 2) η) (-I - (1 + I) c[2] - (1 - I) c[4]) + + 1/4 I E^((-(1/2) + I/ + 2) η) (1 + (1 + I) c[2] - (1 - I) c[4]) + + 1/4 E^((1/2 + I/2) η) (-I + (1 + I) c[2] + (1 - I) c[4]) + + 1/4 E^((1/2 - I/2) η) (I + (1 - I) c[2] + (1 + I) c[4]))} + +``` + +The first solution should go to U and the second to 0 for large `η` . I can see I have positive and negative real parts to the exponential powers. Here is where I get lost. How can I choose values for c[2] and c[4] to give me the solutions I need? Note that the solutions I need will make the solution for `a` go to U and the solution for `b` go to 0 as `x -> Infinity`. + +Thanks + +**Edit** + +xzczd has come up with a solution that is only a few lines long. That is probably the way to go. His/Her method starts afresh and uses the sine transform which suppresses growing solutions. This got me thinking about Laplace transforms and as xzczd states we can't use them directly because they don't allow for boundary conditions at infinity. However, we can use them on the solution I obtained and then remove those parts of the solutions that are exponentially growing. Thus we take the Laplace transform of the solutions. + +``` +lapT = LaplaceTransform[cc, η, s] // FullSimplify + +{(U (1 + 4 s^3 c[2] + 2 s c[4]))/(s + 4 s^5), + (2 U (s - c[2] + 2 s^2 c[4]))/(1 + 4 s^4)} + +``` + +which are simple solutions. Now we have to find the roots of the denominators and identify which have real parts greater than zero. These roots will give rise to exponentially growing terms. + +``` +rts = Union[Flatten[s /. Solve[Denominator[#] == 0, s] & /@ lapT]] +rtsp = Select[rts, Re[#] > 0 &] + +{0, -((-1)^(1/4)/Sqrt[2]), (-1)^( + 1/4)/Sqrt[2], -((-1)^(3/4)/Sqrt[2]), (-1)^(3/4)/Sqrt[2]} + +{(-1)^(1/4)/Sqrt[2], -((-1)^(3/4)/Sqrt[2])} + +``` + +The residues of the terms with unwanted roots must be set to zero. We can find the residues and set them to zero as follows. + +``` +res = Flatten@ + Table[Residue[lapT[[n]], {s, #1}] == 0 & /@ rtsp, {n, Length@lapT}] + +``` + +This gives rise to four equations in our two unknowns c[2] and c[4]. I was slightly worried by this but we get two solutions easily. (There must be repeated equations that Mthematica can deal with.) + +``` +solc = Solve[res, {c[2], c[4]}] // Simplify + +{{c[2] -> 1/2, c[4] -> -(1/2)}} + +``` + +Which is a pleasingly simple result. The inverse transform gives the solution to the differential equations. + +``` +InverseLaplaceTransform[ lapT /. First@solc, + s, η] // FullSimplify + +{U - E^(-η/2) U Cos[η/2], -E^(-η/2) U Sin[η/2]} + +``` + +This may be useful but is messy. If anyone is interested in this method I will post it as an answer with more detail. I can't at the moment due to workload but let me know.",2017/10/25,"['https://mathematica.stackexchange.com/questions/158578', 'https://mathematica.stackexchange.com', 'https://mathematica.stackexchange.com/users/12558/']","This problem can be solved with the help of Fourier sine transform. + +Notice Fourier sine transform has the following property: + +$$ +\mathcal{F}\_t^{(s)}\left[f''(t)\right](\omega)=-\omega^2 \mathcal{F}\_t^{(s)}[f(t)](\omega)+\sqrt{\frac{2}{\pi }} \omega f(0) +$$ + +as long as $f(\infty)=0$ and $f'(\infty)=0$. So we first transform your equation a bit to make the b.c. at infinity zero: + +``` +{neweq, newbc1, newbc2} = {eqns, bc1, bc2} /. a -> (A@# + U &) // Simplify +(* {{ω b[x] == ν A''[x], ω A[x] + ν b''[x] == 0}, + {U + A[0] == 0, b[0] == 0}, + {A[∞] == 0, b[∞] == 0}} *) + +``` + +Now we can use `FourierSinTransform` to solve the problem: + +``` +fst = FourierSinTransform[#, x, w] &; + +tneweq = neweq /. head_[x] :> fst@head@x /. First@Solve[newbc1, {A@0, b@0}] + +tsol = Solve[tneweq, {fst@A[x], fst@b[x]}][[1, All, -1]] +(* {-((Sqrt[2/π] U w^3 ν^2)/(w^4 ν^2 + ω^2)), + -((Sqrt[2/π] U w ν ω)/(w^4 ν^2 + ω^2))} *) + +``` + +> +> **Remark** +> +> +> I've made the transform on the equations in a quick but non-general way, for a general approach, check [this +> post](https://mathematica.stackexchange.com/a/71393/1871). +> +> +> + +The last step is to transform back: + +``` +{sola[x_], solb[x_]} = + InverseFourierSinTransform[tsol, w, x] + {U, 0} // Simplify + +``` + +When $\omega>0$ and $\nu>0$ (I guess it's probably the case, right? ), the solution can be simplified to the following: + +$$a(x)=U-U e^{-x \sqrt{\frac{\omega }{2 \nu }}} \cos \left(x \sqrt{\frac{\omega }{2 \nu }}\right)$$ +$$b(x)=-U e^{-x \sqrt{\frac{\omega }{2 \nu }}} \sin \left(x \sqrt{\frac{\omega }{2 \nu }}\right)$$ + +Finally, a plot for $\omega=1$, $\nu=2$, $U=3$: + +``` +Block[{ω = 1, ν = 2, U = 3}, + Plot[{sola[x], solb@x}, {x, 0, 15}, GridLines -> {None, {{U, Dashed}}}]] + +``` + +![Mathematica graphics](https://i.stack.imgur.com/Gr9G3.png)","I'm not really sure I understood your question right. Do you mean something like this? + +Your solutions: + +``` +eq = {U (1 + + 1/4 E^((1/2 + I/2) \[Eta]) (-1 + (1 - I) c[2] - (1 + I) c[4]) + + 1/4 E^((1/2 - I/2) \[Eta]) (-1 + (1 + I) c[2] - (1 - I) c[4]) + + 1/4 E^((-(1/2) + I/2) \[Eta]) (-1 - (1 + I) c[2] + (1 - I) c[4]) + + 1/4 E^((-(1/2) - I/2) \[Eta]) (-1 - (1 - I) c[2] + (1 + I) c[4])), + U (1/4E^((-(1/2) - I/2) \[Eta]) (-I - (1 + I) c[2] - (1 - I) c[4]) + 1/4 I E^((-(1/2) + I/2) \[Eta]) (1 + (1 + I) c[2] - (1 - I) c[4]) ++ 1/4 E^((1/2 + I/2) \[Eta]) (-I + (1 + I) c[2] + (1 - I) c[4]) ++1/4 E^((1/2 - I/2) \[Eta]) (I + (1 - I) c[2] + (1 + I) c[4]))} + +``` + +Some random values for $c[i]$: + +``` +rule = Table[c[i] -> 2*i, {i, 1, 4}] +(*-> {c[1] -> 2, c[2] -> 4, c[3] -> 6, c[4] -> 8}*) + +``` + +Replace the $c[i]$: + +``` +eq /. rule +(*->{(1 + (3/4 + 3 I) E^((-(1/2) - I/2) \[Eta]) + (3/4 - + 3 I) E^((-(1/2) + I/2) \[Eta]) - (5/4 - + 3 I) E^((1/2 - I/2) \[Eta]) - (5/4 + + 3 I) E^((1/2 + I/2) \[Eta])) U, ((-3 + (3 I)/ + 4) E^((-(1/2) - I/2) \[Eta]) - (3 + (3 I)/ + 4) E^((-(1/2) + I/2) \[Eta]) + (3 + (5 I)/ + 4) E^((1/2 - I/2) \[Eta]) + (3 - (5 I)/ + 4) E^((1/2 + I/2) \[Eta])) U}*) + +``` + +Since there aren't any $c[1]$ and $c[3]$ no value is assigned. + +Update +====== + +Since I don't know how to enter this correctly below your comment: + +``` +{c[2], c[4]} /.Solve[Limit[cc[[1]], x -> Infinity] == U +&& Limit[cc[[2]], x -> Infinity] == 0, {c[2], c[4]}] // FullSimplify +(*-> {-((Sin[\[Eta]] + Sinh[\[Eta]])/(2 Cos[\[Eta]] - 2 Cosh[\[Eta]])),(-Sin[\[Eta]] + Sinh[\[Eta]])/(2 (Cos[\[Eta]] - Cosh[\[Eta]]))}*) + +```" +88406,"Im studying Complexity Theory and i have a question. +What principle establishes that every NP problem can be solved by a deterministic turing machine in a exponential time ?",2018/02/21,"['https://cs.stackexchange.com/questions/88406', 'https://cs.stackexchange.com', 'https://cs.stackexchange.com/users/84677/']","Excellent question! Nondeterminism first appears (so it seems) in a classical paper of Rabin and Scott, [Finite automata and their decision problems](http://www.cse.chalmers.se/~coquand/AUTOMATA/rs.pdf), in which the authors first describe finite automata as a better abstract model for digital computers than Turing machines, and then define several extensions of the basic model, including nondeterministic finite automata. They seem to be completely unaware of what is bothering you. For them, nondeterminism is a way of reducing the number of states, and of simplifying the proofs of various closure properties. + +Indeed, when simulating finite automata on an actual digital computer, NFAs can be simulated directly, by keeping track of the set of reachable states at any given point. This could be more efficient than converting the NFA to a DFA, especially if typically not many states are reachable. + +Just as NFAs are equivalent to DFAs but are more state-efficient, so NTMs are equivalent to DTMs but are more time-efficient (here TM is short for *Turing machine*). However, in contrast to NFAs, there is no known way to efficiently simulate nondeterministic Turing machines on a digital computer (this is essentially the P vs NP question). Why then do we care about nondeterministic Turing machines? + +There might be several reasons (for example, by analogy to complexity hierarchies in descriptive set theory and in recursion theory), but I think the most appealing one is the complexity class NP, whose natural definition is via nondeterministic Turing machines (there are other equivalent definitions using only deterministic Turing machines, which verify that an input belongs to the language using a polynomial length witness). It remains to convince you why NP is important. + +Let's think of P as the set of (decision) problems which can be solved efficiently (there are various problems with this point of view, but let's ignore them). Some problems seem to be beyond P, for example [SAT](https://en.wikipedia.org/wiki/Boolean_satisfiability_problem) (here we encounter another problem which we ignore: SAT seems to be solvable efficiently on practical influences). How can we tell that SAT is not in P? The best answer we have found for this question is this: + +> +> SAT is in P if and only if Maximum Clique is in P if and only if Minimum Vertex Cover is in P if and only if ... +> +> +> + +Individually, each of these problems seems hard, and this multitude makes the case more convincing for their inherent difficulty. It's enough to accept that one of SAT, Maximum Clique, Minimum Vertex Cover is difficult, and then it follows that all the rest are also difficult. + +Where do the problems SAT, Maximum Clique, Minimum Vertex Cover come from? They are *NP-complete* problems, intuitively the ""hardest"" problems in NP (with respect to polynomial time reductions). So what the class NP allows us to do is to isolate a large class of problems which seem difficult. + +Now some problems, like the halting problem, are provably difficult; in fact, uncomputable. But these problems are *too difficult*: the halting problem is much harder than SAT, so the fact that the halting problem is difficult has no bearing on SAT. Problems in NP are on the one hand not insanely difficult, and on the other hand some of them do seem too hard to solve efficiently. + +Indeed, NP is only the first rung in a ladder of difficulty known as the [polynomial hierarchy](https://en.wikipedia.org/wiki/Polynomial_hierarchy), which as mentioned before is inspired by other hierarchies such as the arithmetical hierarchy and the Borel hierarchy. In some sense, NP comes up naturally in this context, as the polynomially bounded version of the arithmetical hierarchy. (For another take, check out [descriptive complexity theory](https://en.wikipedia.org/wiki/Descriptive_complexity_theory).) + +Finally, what about NPDAs? Why should we care about them? In a sense, we shouldn't, since in practice, most context-free languages we come in contact with (as grammars of programming languages) are deterministic context-free, and in fact belong to even more restricted subclasses. The importance of NPDAs lies in their equivalence with general context-free grammars: a language is context-free if and only if it is accepted by some NPDA. Since context-free grammars can be parsed efficiently, this also shows that NPDAs can be simulated efficiently by digital computers.","Nondeterministic systems aren't unrealistic at all: + +1. *Computer science* should actually be called *computing science*: it deals with computation, not with computers. (To study computers, study electrical engineering.) Most computational systems we need to describe and analyze in computer science aren't computers. E.g. Facebook is not a computer, and it is highly nondeterministic. What is more, any interactive system is naturally described as a nondeterministic system: the system doesn't determine the outcome of choices left to the user, the user does, and the user isn't part of the system, so in a description of the system, such choices are nondeterministic. +2. Modern computers aren't deterministic, either. They have many components (e.g. multiple CPUs) performing computational activities in parallel, and outcomes may be affected by timing and/or the occurrence of non-predetermined events. +3. Even single CPU cores aren't deterministic these days; they pretend to be, but [that pretense may fail](https://en.wikipedia.org/wiki/Spectre_(security_vulnerability)). + +Generally speaking, nondeterminism is the norm, not the exception, and it certainly isn't ""unrealistic"". + +However, you're probably referring to a specific use of the term: nondeterministic automata as used in complexity theory. + +When used in complexity theory, nondeterministic automata are used to describe *search* problems: they describe how to find a solution to the problem while omitting the exact method of scanning through the solution space to find one (which isn't part of the problem, but of the method chosen to solve it). + +Once again, there is nothing ""unrealistic"" about systems that are subject to choices they don't control. Most systems are. It's the fiction of equating computing with strictly sequential machines that is unrealistic. It's a highly simplified, idealized notion of computing that practice doesn't always live up to." +88406,"Im studying Complexity Theory and i have a question. +What principle establishes that every NP problem can be solved by a deterministic turing machine in a exponential time ?",2018/02/21,"['https://cs.stackexchange.com/questions/88406', 'https://cs.stackexchange.com', 'https://cs.stackexchange.com/users/84677/']","Excellent question! Nondeterminism first appears (so it seems) in a classical paper of Rabin and Scott, [Finite automata and their decision problems](http://www.cse.chalmers.se/~coquand/AUTOMATA/rs.pdf), in which the authors first describe finite automata as a better abstract model for digital computers than Turing machines, and then define several extensions of the basic model, including nondeterministic finite automata. They seem to be completely unaware of what is bothering you. For them, nondeterminism is a way of reducing the number of states, and of simplifying the proofs of various closure properties. + +Indeed, when simulating finite automata on an actual digital computer, NFAs can be simulated directly, by keeping track of the set of reachable states at any given point. This could be more efficient than converting the NFA to a DFA, especially if typically not many states are reachable. + +Just as NFAs are equivalent to DFAs but are more state-efficient, so NTMs are equivalent to DTMs but are more time-efficient (here TM is short for *Turing machine*). However, in contrast to NFAs, there is no known way to efficiently simulate nondeterministic Turing machines on a digital computer (this is essentially the P vs NP question). Why then do we care about nondeterministic Turing machines? + +There might be several reasons (for example, by analogy to complexity hierarchies in descriptive set theory and in recursion theory), but I think the most appealing one is the complexity class NP, whose natural definition is via nondeterministic Turing machines (there are other equivalent definitions using only deterministic Turing machines, which verify that an input belongs to the language using a polynomial length witness). It remains to convince you why NP is important. + +Let's think of P as the set of (decision) problems which can be solved efficiently (there are various problems with this point of view, but let's ignore them). Some problems seem to be beyond P, for example [SAT](https://en.wikipedia.org/wiki/Boolean_satisfiability_problem) (here we encounter another problem which we ignore: SAT seems to be solvable efficiently on practical influences). How can we tell that SAT is not in P? The best answer we have found for this question is this: + +> +> SAT is in P if and only if Maximum Clique is in P if and only if Minimum Vertex Cover is in P if and only if ... +> +> +> + +Individually, each of these problems seems hard, and this multitude makes the case more convincing for their inherent difficulty. It's enough to accept that one of SAT, Maximum Clique, Minimum Vertex Cover is difficult, and then it follows that all the rest are also difficult. + +Where do the problems SAT, Maximum Clique, Minimum Vertex Cover come from? They are *NP-complete* problems, intuitively the ""hardest"" problems in NP (with respect to polynomial time reductions). So what the class NP allows us to do is to isolate a large class of problems which seem difficult. + +Now some problems, like the halting problem, are provably difficult; in fact, uncomputable. But these problems are *too difficult*: the halting problem is much harder than SAT, so the fact that the halting problem is difficult has no bearing on SAT. Problems in NP are on the one hand not insanely difficult, and on the other hand some of them do seem too hard to solve efficiently. + +Indeed, NP is only the first rung in a ladder of difficulty known as the [polynomial hierarchy](https://en.wikipedia.org/wiki/Polynomial_hierarchy), which as mentioned before is inspired by other hierarchies such as the arithmetical hierarchy and the Borel hierarchy. In some sense, NP comes up naturally in this context, as the polynomially bounded version of the arithmetical hierarchy. (For another take, check out [descriptive complexity theory](https://en.wikipedia.org/wiki/Descriptive_complexity_theory).) + +Finally, what about NPDAs? Why should we care about them? In a sense, we shouldn't, since in practice, most context-free languages we come in contact with (as grammars of programming languages) are deterministic context-free, and in fact belong to even more restricted subclasses. The importance of NPDAs lies in their equivalence with general context-free grammars: a language is context-free if and only if it is accepted by some NPDA. Since context-free grammars can be parsed efficiently, this also shows that NPDAs can be simulated efficiently by digital computers.","A complexity class is a set of problems (or languages) that can be solved on a given computational model with constraints on the use of resources (such as time and/or space for sequential computations). Therefore, it's pretty easy do define a complexity class. However, it's hard instead to define a *meaningful* complexity class, since the class + +* must capture a genuine computational phenomenon; +* must contain natural and relevant problems; +* should be ideally characterized by natural +problems; +* should be robust under variations in model of computation; +* should be possibly closed under operations (such as complement etc). + +Regarding nondeterminism and the class NP in particular, it captures an important computational feature of many problems: *exhaustive search* works. Note that this has nothing to do with efficiency in solving a problem: indeed, we will never solve a problem by using a brute force approach. The class also includes many natural, practical problems. + +Besides the technical details (a non deterministic Turing Machine has a transition relation instead of a transition function, so that given the current configuration there can be several next configurations; moreover, for the nondeterministic Turing Machine there is an asymmetric accept/reject criterion), nondeterminism is usually explained, consistently with this perspective, in terms of an *oracle* that magically guesses a solution if one exists (it's like having a parallel computer spawning infinitely many processes, with each process in charge of verifying a possible solution)." +25645859,"I want to index each element of a list using an array. For example, I want to use `list[arr] = 1`, where `arr` is an array instead of `list[ind] = 1` where `ind` is a number index. Using Dictionary data structure does the job, but creation of the dictionary is time consuming. Is there any other way I can do the above?",2014/09/03,"['https://Stackoverflow.com/questions/25645859', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2445465/']","Using [Feature Context](https://github.com/techtalk/SpecFlow/wiki/FeatureContext), you could probably have each sentence start with something like this... + +``` +Given Previous tests did not fail + +``` + +In that sentence, you verify the current feature context doesn't have a false value. That might look something like this... + +``` +bool testsPass = FeatureContext.Current[""TestsPass""]; +Assert.IsTrue(testsPass); + +``` + +You would have to remember to set this value before any assert. Off hand, that might look something like this... + +``` +bool testPassed = //something to test +FeatureContext.Current[""testsPass""] = testPassed; +Assert.IsTrue(testPassed); + +``` + +As the comment said, typically it's not a good idea to expect scenarios to always run in a particular order. Depending on the runner, they may not do as expected. + +Note: on second look, a BeforeScenario might work better but I would still suggest using a @serial tag or something to indicate that's what it's doing.","I don't know if stopping the entire feature run is possible, after all really all that specflow does is generate tests in the framework of your choice which are then run by some test runner. No unit test runner I know will allow a complete abort of all other tests if one fails. But that doesn't mean that what you want isn't possible. + +I can think of a way to 'fake' what you want, but its a bad idea. you could set some sort of flag in the AfterScenario (like creating a file on the disk or setting a mutex) and then checking for this flag in the BeforeScenario and failing fast (with a message like 'skipping test as previous failure detected') if the flag exists. You could clear the flag on the BeforeFeature to ensure that the tests always start clean. + +Like I said I think this is a bad idea and you should really reconsider how your tests work. + +Based on the extra information given in your last comment it seems that even though you recreate your db for the feature and then run multiple scenarios on the clean db, actually each scenario needs its own clean database. Could you not create a new database for each scenario and then have a single scenario create all the data it needs in its given and then test only a single thing? This seems much more scalable and maintainable in the long term to me. + +I have done something similar to this before and created a new database for each scenario and it has worked ok." +52118492,"After a user has been authenticated i need to call 2 functions (`AsyncStorage.setItem` and `setAPIAuthorization`) followed by 2 redux actions (`LOAD_USER` and `SET_SESSION_USER`). How would I achieve this based off the attempt below? Or should I create redux actions for both functions also? + +``` +const loginUserEpic = (action$, state$) => + action$.pipe( + ofType('LOGIN_USER'), + mergeMap(() => + from(axios.post(`/auth`, {})).pipe( + mergeMap(response => + of( + AsyncStorage.setItem('id_token', response.data.token), + setAPIAuthorization(response.data.token), + { + type: 'LOAD_USER' + }, + { + type: 'SET_SESSION_USER', + user: response.data.user + } + ) + ), + catchError(error => console.log(error)) + ) + ) + ); + +``` + +Thanks to Anas below, here is the update that I am using to achieve what i want. Successful so far. After I store the `id_token` it is included in the header of any subsequent api calls. For this reason I need to ensure that the `id_token` is saved before calling `LOAD_USER` which is an api call. + +``` +const loginUserEpic = (action$, state$) => + action$.pipe( + ofType('LOGIN_USER'), + mergeMap(() => + from(axios.post(`/auth`, {})).pipe( + mergeMap(response => { + return new Observable(observer => { + AsyncStorage.setItem('id_token', response.data.token); + setAPIAuthorization(response.data.token); + observer.next( + { + type: 'LOAD_USER' + }, + { + type: 'SET_SESSION_USER', + user: response.data.user + } + ); + }); + }), + catchError(error => console.log(error)) + ) + ) + ); + +```",2018/08/31,"['https://Stackoverflow.com/questions/52118492', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7909095/']","Setting the session storage is a side effect. +So better to do it in a [tap](https://www.learnrxjs.io/operators/utility/do.html), + +Your epic should only return actions as output (actions In, actions Out). If you do it that way, redux will complain that you're not returning plain actions. + +I will still create action creator for `{ type: 'LOAD_USER' }` and `{ type: 'SET_SESSION_USER'}` just because it's cleaner. + +``` +const loginUserEpic = (action$, state$) => + action$.pipe( + ofType('LOGIN_USER'), + mergeMap(() => + from(axios.post('/auth', {})).pipe( + tap((response) => { + AsyncStorage.setItem('id_token', response.data.token) + setAPIAuthorization(response.data.token) + }), + mergeMap(response => + of( + { + type: 'LOAD_USER', + }, + { + type: 'SET_SESSION_USER', + user: response.data.user, + } + ) + ), + catchError(error => console.log(error)) + ) + ) + ) + +```","another simple way is to use `switchMap` + +``` +switchMap(() => [ + { + type: 'LOAD_USER', + }, + { + type: 'SET_SESSION_USER', + user: response.data.user, + } +]) + +``` + +It automatically wrap result into observables as long as it's an array. So you no longer need to `of()` it. I use it quite a lot in my project." +974151,"If I have a Windows 10 workstation, I can use something like `wmic qfe list` or `Get-Hotfix` to show all the installed updates on that system. How can I prove, that the list of updates installed, are really all that is a available to be installed? I'm running into questions from compliance about how do I know Windows hasn't screwed up when it says there are no other available updates and how can I match a master list of available updates against a list of what's installed. Thanks for the help.",2019/07/05,"['https://serverfault.com/questions/974151', 'https://serverfault.com', 'https://serverfault.com/users/530533/']","The [Microsoft Security Update Guide](https://portal.msrc.microsoft.com/en-us/security-guidance) can be used to acquire a list of security KB articles indicating security updates for a specific windows build. + +Almost all security updates installed on the system are part of a Latest Cumulative Update (LCU). + +By searching the KB articles found in the Security Update Guide, against the [Microsoft Update Catalog](https://www.catalog.update.microsoft.com/) a list of all cumulative update patches, that have been replaced by other cumulative update patches can be found. In this way, a specific KB article mentioned in the Microsoft Security Update Guide can be traced back to a current cumulative update. + +When querying Windows 10 for hotfixes using `wmic qfe list` or `Get-Hotfix` the behavior appears to be to only list the latest cumulative update package installed.","You can refer to the offical product documentation: . + +Unfortunately, it seems to be quite difficult to find a list of all minor updates apart from major product releases; however, there are several unofficial pages which track them, such as this one: . + +There is also the Microsof Update Catalog (), where you can look up all available updates for a given Windows version; but you need to pinpoint a specific Windows 10 release. F.e. if you search for ""Windows 10 1903"" (current version), this is what you get: . + +Generally speaking, the latest cumulative update for a given Windows 10 release should include all previous updates; but some updates are released outside the CU line and need to be applied separately." +63925843,"Say, I have a dataframe with three columns: + +``` +Year Sales Income +1 100 30 +2 200 20 +3 NA 10 +4 300 50 +5 NA -20 + +``` + +I want to get all the 'Year' that has a particular value in 'Sales', ignoring other columns. For example, if I ask for NA, I should get: + +``` +Year Sales +3 NA +5 NA + +``` + +Please note there is no Income in the above data frame.",2020/09/16,"['https://Stackoverflow.com/questions/63925843', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13434461/']","We can use `base R` with `subset` + +``` +subset(df, is.na(Sales), select = c('Year', 'Sales')) +# Year Sales +#3 3 NA +#5 5 NA + +``` + +### data + +``` +df <-structure(list(Year = 1:5, Sales = c(100L, 200L, NA, 300L, NA +), Income = c(30L, 20L, 10L, 50L, -20L)), class = ""data.frame"", + row.names = c(NA, -5L)) + +```","You can try with `base R`. In a dataframe you can index by rows (left to `,`) and by columns (right to `,`) inside the brackets. So, you can specify the conditions, in this case `NA` in `Sales` and then select the variables like `Year` and `Sales`. Here the code: + +``` +#Code +df[is.na(df$Sales),c('Year','Sales')] + +``` + +Output: + +``` + Year Sales +3 3 NA + +``` + +Some data used: + +``` +#Data +df <- structure(list(Year = 1:4, Sales = c(100L, 200L, NA, 300L), Income = c(30L, +20L, 10L, 50L)), class = ""data.frame"", row.names = c(NA, -4L)) + +```" +63925843,"Say, I have a dataframe with three columns: + +``` +Year Sales Income +1 100 30 +2 200 20 +3 NA 10 +4 300 50 +5 NA -20 + +``` + +I want to get all the 'Year' that has a particular value in 'Sales', ignoring other columns. For example, if I ask for NA, I should get: + +``` +Year Sales +3 NA +5 NA + +``` + +Please note there is no Income in the above data frame.",2020/09/16,"['https://Stackoverflow.com/questions/63925843', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13434461/']","We can use `base R` with `subset` + +``` +subset(df, is.na(Sales), select = c('Year', 'Sales')) +# Year Sales +#3 3 NA +#5 5 NA + +``` + +### data + +``` +df <-structure(list(Year = 1:5, Sales = c(100L, 200L, NA, 300L, NA +), Income = c(30L, 20L, 10L, 50L, -20L)), class = ""data.frame"", + row.names = c(NA, -5L)) + +```","you can use the %in% subsetting which has to be declared before. I usually use these in ggplot directly. hope they work independently too. For example: + +``` +col11 <- c(""c11"", ""c12"") +typecol2 <- c(""c22"", ""c24"") +data_new <- subset(data old, (col1 %in% col11) & (col2 %in% typecol2)) + +```" +101775,"I'm working on a software development project that requires me to send signals to a device via an RS-232 port. Sadly the included utilities for transferring to and from the device would not work for mass distribution, so I'm left to writing my own. The included documentation doesn't really give any examples of the device's packet structure, and I would like to examine the packets sent to and from their included software package. + +Is there a good program that would allow me to monitor packets coming to and from the serial port? Free is preferred, but not required.",2010/01/28,"['https://superuser.com/questions/101775', 'https://superuser.com', 'https://superuser.com/users/-1/']","[**Portmon**](http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx), from Sysinternals, will do what you need: + +> +> Portmon is a utility that monitors and +> displays all serial and parallel port +> activity on a system. It has advanced +> filtering and search capabilities that +> make it a powerful tool for exploring +> the way Windows works, seeing how +> applications use ports, or tracking +> down problems in system or application +> configurations. +> +> +> + +![enter image description here](https://i.stack.imgur.com/GCDjb.gif)"," or +" +62625506,"After adding an extension target to Xcode project and trying to run it on iOS 14, I'm getting an error: + +`SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 ""Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}."" UserInfo={NSLocalizedDescription=Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}., NSUnderlyingError=0x7f9bac015910 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}}} Domain: DTXMessage Code: 1` + +Any idea what is going wrong?",2020/06/28,"['https://Stackoverflow.com/questions/62625506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4083045/']","If you have 2 widgets within your target, comment out the widget(s) you arent currently testing + +``` +@main +struct Widgets: WidgetBundle +{ + @WidgetBundleBuilder + var body: some Widget + { + Widget1() +// Widget2() + } +} + +```","I ran into the exact same issue. + +For me it happens when I ran an extension widget from an M1 computer. + +Turns out the issue was I was running Xcode with Rosetta, turning that off fixed it for me. + +To enable / disable rosetta: + +1. Right click on the Xcode app +2. Click on `Get Info` +3. Untick `Open using Rosetta` +4. Clean project => Restart Xcode" +62625506,"After adding an extension target to Xcode project and trying to run it on iOS 14, I'm getting an error: + +`SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 ""Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}."" UserInfo={NSLocalizedDescription=Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}., NSUnderlyingError=0x7f9bac015910 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}}} Domain: DTXMessage Code: 1` + +Any idea what is going wrong?",2020/06/28,"['https://Stackoverflow.com/questions/62625506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4083045/']",For me it was that my device was on iOS 14.1 and the Deployment Target was set to 14.3 for the widget target. The solution was to update the Deployment Target to match your device or lower. The Deployment Target setting is in the General tab and under Deployment Info (in my case I set it to 14.0).,"Try to go to Setting -> General -> Profiles & Device Management -> Trust your cert, +and then rebuild and rerun app." +62625506,"After adding an extension target to Xcode project and trying to run it on iOS 14, I'm getting an error: + +`SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 ""Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}."" UserInfo={NSLocalizedDescription=Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}., NSUnderlyingError=0x7f9bac015910 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}}} Domain: DTXMessage Code: 1` + +Any idea what is going wrong?",2020/06/28,"['https://Stackoverflow.com/questions/62625506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4083045/']","This happened to me after moving my entitlements file from the root directory into the widget's directory. I tried [this answer](https://stackoverflow.com/a/62669069/467209) but the problem persisted. + +I had to manually install the widget on the Home Screen. After that running from Xcode worked again.","As mentioned here , setting *New Build System* in *File -> Workspace/Project settings* (for both *Shared* and *Per User* settings) seems to do the trick. You won't get rid of the warning, but the widget **might** (see notes) run. + +Note 1 - even after this change, there seems to be about 30 % chance that it wont run. Just hit Run again ‍♂️. (*Debug Navigator* stuck on *Waiting to Attach*) + +Note 2 - sometimes this doesn't work altogether. Setting *Build System* to *Legacy* and back to *New* worked for me ‍♂️. + +Note 3 - running on device is so far without these problems (iOS 14 beta 7) + +Tested on Xcode 12 beta v6." +62625506,"After adding an extension target to Xcode project and trying to run it on iOS 14, I'm getting an error: + +`SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 ""Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}."" UserInfo={NSLocalizedDescription=Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}., NSUnderlyingError=0x7f9bac015910 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}}} Domain: DTXMessage Code: 1` + +Any idea what is going wrong?",2020/06/28,"['https://Stackoverflow.com/questions/62625506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4083045/']","**If the extension target you added was for a Widget...** + +I did follow some of the suggestions here and restarted my phone to some success but the error kept happening over and over, and restarting my phone is intrusive and takes kind of a long time. For me, the workaround when I get this popup error is to.. + +**1. On my iPhone, I find the Widget I'm working on and delete it by pressing and holding the widget until it gives me the option to remove it from my device.** + +**2. In Xcode, I build and run the Widget Scheme again, and no more error!** + +It's a little faster, and I don't have to restart my phone. + +**Note: If for some reason that doesn't work, I switch my build Scheme back to my iPhone Scheme, build and run, then change the Scheme back to my widget Scheme, and that usually does the trick.**","I ran into the exact same issue. + +For me it happens when I ran an extension widget from an M1 computer. + +Turns out the issue was I was running Xcode with Rosetta, turning that off fixed it for me. + +To enable / disable rosetta: + +1. Right click on the Xcode app +2. Click on `Get Info` +3. Untick `Open using Rosetta` +4. Clean project => Restart Xcode" +62625506,"After adding an extension target to Xcode project and trying to run it on iOS 14, I'm getting an error: + +`SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 ""Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}."" UserInfo={NSLocalizedDescription=Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}., NSUnderlyingError=0x7f9bac015910 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}}} Domain: DTXMessage Code: 1` + +Any idea what is going wrong?",2020/06/28,"['https://Stackoverflow.com/questions/62625506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4083045/']","For me the problem was the excluded `arm64` architecture for `any iOS simulator` on the widget target build settings (Added because of my M1 development device). + +When removing this excluded architecture, the widget is running without any problem.","Try to go to Setting -> General -> Profiles & Device Management -> Trust your cert, +and then rebuild and rerun app." +62625506,"After adding an extension target to Xcode project and trying to run it on iOS 14, I'm getting an error: + +`SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 ""Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}."" UserInfo={NSLocalizedDescription=Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}., NSUnderlyingError=0x7f9bac015910 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}}} Domain: DTXMessage Code: 1` + +Any idea what is going wrong?",2020/06/28,"['https://Stackoverflow.com/questions/62625506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4083045/']","For me the problem was the excluded `arm64` architecture for `any iOS simulator` on the widget target build settings (Added because of my M1 development device). + +When removing this excluded architecture, the widget is running without any problem.","This happened to me after moving my entitlements file from the root directory into the widget's directory. I tried [this answer](https://stackoverflow.com/a/62669069/467209) but the problem persisted. + +I had to manually install the widget on the Home Screen. After that running from Xcode worked again." +62625506,"After adding an extension target to Xcode project and trying to run it on iOS 14, I'm getting an error: + +`SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 ""Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}."" UserInfo={NSLocalizedDescription=Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}., NSUnderlyingError=0x7f9bac015910 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}}} Domain: DTXMessage Code: 1` + +Any idea what is going wrong?",2020/06/28,"['https://Stackoverflow.com/questions/62625506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4083045/']","I ran into the exact same issue. + +For me it happens when I ran an extension widget from an M1 computer. + +Turns out the issue was I was running Xcode with Rosetta, turning that off fixed it for me. + +To enable / disable rosetta: + +1. Right click on the Xcode app +2. Click on `Get Info` +3. Untick `Open using Rosetta` +4. Clean project => Restart Xcode","As mentioned here , setting *New Build System* in *File -> Workspace/Project settings* (for both *Shared* and *Per User* settings) seems to do the trick. You won't get rid of the warning, but the widget **might** (see notes) run. + +Note 1 - even after this change, there seems to be about 30 % chance that it wont run. Just hit Run again ‍♂️. (*Debug Navigator* stuck on *Waiting to Attach*) + +Note 2 - sometimes this doesn't work altogether. Setting *Build System* to *Legacy* and back to *New* worked for me ‍♂️. + +Note 3 - running on device is so far without these problems (iOS 14 beta 7) + +Tested on Xcode 12 beta v6." +62625506,"After adding an extension target to Xcode project and trying to run it on iOS 14, I'm getting an error: + +`SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 ""Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}."" UserInfo={NSLocalizedDescription=Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}., NSUnderlyingError=0x7f9bac015910 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}}} Domain: DTXMessage Code: 1` + +Any idea what is going wrong?",2020/06/28,"['https://Stackoverflow.com/questions/62625506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4083045/']","**If the extension target you added was for a Widget...** + +I did follow some of the suggestions here and restarted my phone to some success but the error kept happening over and over, and restarting my phone is intrusive and takes kind of a long time. For me, the workaround when I get this popup error is to.. + +**1. On my iPhone, I find the Widget I'm working on and delete it by pressing and holding the widget until it gives me the option to remove it from my device.** + +**2. In Xcode, I build and run the Widget Scheme again, and no more error!** + +It's a little faster, and I don't have to restart my phone. + +**Note: If for some reason that doesn't work, I switch my build Scheme back to my iPhone Scheme, build and run, then change the Scheme back to my widget Scheme, and that usually does the trick.**","This happened to me after moving my entitlements file from the root directory into the widget's directory. I tried [this answer](https://stackoverflow.com/a/62669069/467209) but the problem persisted. + +I had to manually install the widget on the Home Screen. After that running from Xcode worked again." +62625506,"After adding an extension target to Xcode project and trying to run it on iOS 14, I'm getting an error: + +`SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 ""Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}."" UserInfo={NSLocalizedDescription=Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}., NSUnderlyingError=0x7f9bac015910 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}}} Domain: DTXMessage Code: 1` + +Any idea what is going wrong?",2020/06/28,"['https://Stackoverflow.com/questions/62625506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4083045/']",For me it was that my device was on iOS 14.1 and the Deployment Target was set to 14.3 for the widget target. The solution was to update the Deployment Target to match your device or lower. The Deployment Target setting is in the General tab and under Deployment Info (in my case I set it to 14.0).,"I ran into the exact same issue. + +For me it happens when I ran an extension widget from an M1 computer. + +Turns out the issue was I was running Xcode with Rosetta, turning that off fixed it for me. + +To enable / disable rosetta: + +1. Right click on the Xcode app +2. Click on `Get Info` +3. Untick `Open using Rosetta` +4. Clean project => Restart Xcode" +62625506,"After adding an extension target to Xcode project and trying to run it on iOS 14, I'm getting an error: + +`SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 ""Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}."" UserInfo={NSLocalizedDescription=Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}., NSUnderlyingError=0x7f9bac015910 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 ""Failed to get descriptors for extensionBundleID (***)"" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}}} Domain: DTXMessage Code: 1` + +Any idea what is going wrong?",2020/06/28,"['https://Stackoverflow.com/questions/62625506', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4083045/']",For me it was that my device was on iOS 14.1 and the Deployment Target was set to 14.3 for the widget target. The solution was to update the Deployment Target to match your device or lower. The Deployment Target setting is in the General tab and under Deployment Info (in my case I set it to 14.0).,"As mentioned here , setting *New Build System* in *File -> Workspace/Project settings* (for both *Shared* and *Per User* settings) seems to do the trick. You won't get rid of the warning, but the widget **might** (see notes) run. + +Note 1 - even after this change, there seems to be about 30 % chance that it wont run. Just hit Run again ‍♂️. (*Debug Navigator* stuck on *Waiting to Attach*) + +Note 2 - sometimes this doesn't work altogether. Setting *Build System* to *Legacy* and back to *New* worked for me ‍♂️. + +Note 3 - running on device is so far without these problems (iOS 14 beta 7) + +Tested on Xcode 12 beta v6." +938470,"I am writing an optimization expression and in the constraints part, I want to limit the number of non-zero entries of the vector to a certain number R. + +Suppose if the vector is M dimensional, then I would like to have R entries to be non-zero and (M-R) entries to be zero. I want to have a vector expression or multiply of add or any function which I can write in the constraint part that ensure certain amount of non-zero entries or certain amount of zero entries. + +I know how to limit the entries to certain number of 1s. If you equate the square of the norm of the vector to the value of R, you would limit the non-zero entries to R provided the vector only contains 0 and 1. However in case I have real numbers and zeros and I want to limit the number of non-zero entries, what could be the vector expression of function ?",2014/09/20,"['https://math.stackexchange.com/questions/938470', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/176651/']","You are looking for the 0-norm, which is exactly the number of non-zero elements in a vector. So your constraint looks like + +$$ +\| x\|\_0 \leq R +$$ + +However, the term norm here is used loosely, since the 0-norm is not really a norm (it does not satisfy triangle inequality). In fact, the constraint above is non-convex, and problems involving the minimization of 0-norm are NP-hard. + +Still, under certain conditions, the 0-norm can be relaxed into 1-norm (which is much easier to deal with), without changing the solution to the optimization problem (see compressive sensing). Whether this applies to your case depends on the structure of your optimization problem.","It is a bit problematic to say that exactly $R$ should be non-zero, because then you have to define first what constitutes non-zero in your model (is $10^{-15}$ nonzero? If so, you will have massive problems to express this as it is essentially numerical noise to a numerical solver) + +If you mean *at most* $R$ elements non-zero then it is easily described, when $0\leq x \leq 1$, as $x\leq \delta, \sum \delta \leq R$ where $\delta$ is a binary vector of length $M$. + +BTW, strict inequalities are not possible in practice. You would have to write that as a strict inequality using a margin $0\leq x \leq 1-\epsilon$ where $\epsilon$ is a small constant, but large enough not to drown in the general numerical tolerances of the solver (somewhere around $10^-7$ typically)" +83838,"Why is ntfs-3g not included anymore in Ubuntu 11.10? + +Now I can't write to my NTFS partition. + +Just curiosity, why the change?",2011/11/29,"['https://askubuntu.com/questions/83838', 'https://askubuntu.com', 'https://askubuntu.com/users/11928/']","AFAIK `ntfs-3g` is included in the default Ubuntu installation, because the virtual `ubuntu-standard` package depends on it. You've probably uninstalled it by mistake. + +Check the output of + +``` +dpkg -l ntfs* + +``` + +If you see something like **rc** for the package, you've uninstalled it. + +EDIT: + +From your comments it looks like you installed `ntfsprogs`. If that is true, then by installing it you automatically uninstalled `ntfs-3g`, as these two packages are in conflict (in Oneiric). `ntfs-3g` now provides the functionality of `ntfsprogs` so it's not needed.","[NTFS-3G](http://en.wikipedia.org/wiki/NTFS-3G) ***is*** still included in Ubuntu 11.10. (See information about `ntfs-3g` in Oneiric [here](http://packages.ubuntu.com/oneiric/ntfs-3g) and [here](https://launchpad.net/ubuntu/+source/ntfs-3g).) I am using it on two Ubuntu 11.10 machines at this very moment! + +While the NTFS filesystem was developed by Microsoft for use in their proprietary Windows operating system, there is nothing proprietary in `ntfs-3g`, and `ntfs-3g` is completely independent of any ""restricted extras"" package. + +`ntfs-3g` is also still installed by default in Ubuntu 11.10. In the very unlikely event that it has become uninstalled, you can reinstall it by installing the `ntfs-3g` package. + +If you uninstalled `ntfs-3g`, you would no longer be able to mount NTFS volumes and write to them. (You would then be using the older NTFS driver which only had experimental--and generally not safe--support for writing to NTFS filesystems.) But in practice, problems mounting and writing to NTFS volumes in Ubuntu are not caused by `ntfs-3g` being missing--they are caused by other, more subtle, things going wrong. Fortunately, they are rare, virtually always correctable, and usually fixable with relative ease. + +I recommend that you post a new question detailing information about the drive you are having trouble mounting (including its size, make, and model). If this is not an external drive but is instead a partition on the same drive as your Ubuntu system, then specify its size (if you know it or can find out), whether or not it has Windows installed on it and if so what version of Windows, and specifically how you installed Ubuntu. Make sure to indicate if writing to the partition is the only problem you're having, or if you are also unable to mount it and/or read it. If you are able to mount the drive, you should include the output of the `mount` command (run just like that, with no arguments) in the Terminal." +83838,"Why is ntfs-3g not included anymore in Ubuntu 11.10? + +Now I can't write to my NTFS partition. + +Just curiosity, why the change?",2011/11/29,"['https://askubuntu.com/questions/83838', 'https://askubuntu.com', 'https://askubuntu.com/users/11928/']","[NTFS-3G](http://en.wikipedia.org/wiki/NTFS-3G) ***is*** still included in Ubuntu 11.10. (See information about `ntfs-3g` in Oneiric [here](http://packages.ubuntu.com/oneiric/ntfs-3g) and [here](https://launchpad.net/ubuntu/+source/ntfs-3g).) I am using it on two Ubuntu 11.10 machines at this very moment! + +While the NTFS filesystem was developed by Microsoft for use in their proprietary Windows operating system, there is nothing proprietary in `ntfs-3g`, and `ntfs-3g` is completely independent of any ""restricted extras"" package. + +`ntfs-3g` is also still installed by default in Ubuntu 11.10. In the very unlikely event that it has become uninstalled, you can reinstall it by installing the `ntfs-3g` package. + +If you uninstalled `ntfs-3g`, you would no longer be able to mount NTFS volumes and write to them. (You would then be using the older NTFS driver which only had experimental--and generally not safe--support for writing to NTFS filesystems.) But in practice, problems mounting and writing to NTFS volumes in Ubuntu are not caused by `ntfs-3g` being missing--they are caused by other, more subtle, things going wrong. Fortunately, they are rare, virtually always correctable, and usually fixable with relative ease. + +I recommend that you post a new question detailing information about the drive you are having trouble mounting (including its size, make, and model). If this is not an external drive but is instead a partition on the same drive as your Ubuntu system, then specify its size (if you know it or can find out), whether or not it has Windows installed on it and if so what version of Windows, and specifically how you installed Ubuntu. Make sure to indicate if writing to the partition is the only problem you're having, or if you are also unable to mount it and/or read it. If you are able to mount the drive, you should include the output of the `mount` command (run just like that, with no arguments) in the Terminal.","I found out that ntfsprogs has write support for NTFS. And thus it replaces ntfs-3g. + +But this package is still a bit buggy and sometimes it doesn't work so you can't create new folders and files on the NTFS filesystems. + +So it is working on a random base xD. + +In Ubuntu things should be tested more properly. Because they just replaced a working package with a buggy one." +83838,"Why is ntfs-3g not included anymore in Ubuntu 11.10? + +Now I can't write to my NTFS partition. + +Just curiosity, why the change?",2011/11/29,"['https://askubuntu.com/questions/83838', 'https://askubuntu.com', 'https://askubuntu.com/users/11928/']","AFAIK `ntfs-3g` is included in the default Ubuntu installation, because the virtual `ubuntu-standard` package depends on it. You've probably uninstalled it by mistake. + +Check the output of + +``` +dpkg -l ntfs* + +``` + +If you see something like **rc** for the package, you've uninstalled it. + +EDIT: + +From your comments it looks like you installed `ntfsprogs`. If that is true, then by installing it you automatically uninstalled `ntfs-3g`, as these two packages are in conflict (in Oneiric). `ntfs-3g` now provides the functionality of `ntfsprogs` so it's not needed.","I found out that ntfsprogs has write support for NTFS. And thus it replaces ntfs-3g. + +But this package is still a bit buggy and sometimes it doesn't work so you can't create new folders and files on the NTFS filesystems. + +So it is working on a random base xD. + +In Ubuntu things should be tested more properly. Because they just replaced a working package with a buggy one." +43408454,"In Primefaces I would like to expand a ``, when i click on its label, not when i click on the little triangle. +Cant find any .xhtml document, but found that nodes are created this way: + +``` +... +final TreeNode parentNode = this.addNode(false, ""Parent"", this.root, targetView1); //first parameter means start expanded or not +this.addNode(, ""ChildNode"", parentNode, ""targetView2""); +... + +``` + +Is it possible? Thank you.",2017/04/14,"['https://Stackoverflow.com/questions/43408454', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4419468/']","Just in case anyone is interested in a solution that I believe @Kukeltje is referring to here is my interpretation: + +XHTML: + +``` + + + + + + + +``` + +Bean: + +``` +public void onNodeSelect(NodeSelectEvent event) { + if (event.getTreeNode().isExpanded()) { + //closes if it is open. + event.getTreeNode().setExpanded(false); + } else { + //open if it is closed. + collapsingORexpanding(event.getTreeNode(), false);//this is so all children are closed under this node. trust me, you want this... + event.getTreeNode().setExpanded(true); + } +} + +public void collapsingORexpanding(TreeNode n, boolean option) { + if (n.getChildren().isEmpty()) { + n.setSelected(false); + } else { + for (TreeNode s : n.getChildren()) { + collapsingORexpanding(s, option); + } + n.setExpanded(option); + n.setSelected(false); + } +} + +```","Add [selection](https://www.primefaces.org/showcase/ui/data/tree/selection.xhtml) to your viewer: + +``` +[(selection)]=""selectedTreeNode"" +(onNodeSelect)=""onNodeSelect($event)"" + +``` + +Define your value in your controller: + +`selectedTreeNode: TreeNode;` + +Handle `onNodeSelect()`: + +``` +onNodeSelect(event: any) { + this.selectedTreeNode.expanded = !this.selectedTreeNode.expanded; +} + +``` + +Cheers!" +43408454,"In Primefaces I would like to expand a ``, when i click on its label, not when i click on the little triangle. +Cant find any .xhtml document, but found that nodes are created this way: + +``` +... +final TreeNode parentNode = this.addNode(false, ""Parent"", this.root, targetView1); //first parameter means start expanded or not +this.addNode(, ""ChildNode"", parentNode, ""targetView2""); +... + +``` + +Is it possible? Thank you.",2017/04/14,"['https://Stackoverflow.com/questions/43408454', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4419468/']","Just in case anyone is interested in a solution that I believe @Kukeltje is referring to here is my interpretation: + +XHTML: + +``` + + + + + + + +``` + +Bean: + +``` +public void onNodeSelect(NodeSelectEvent event) { + if (event.getTreeNode().isExpanded()) { + //closes if it is open. + event.getTreeNode().setExpanded(false); + } else { + //open if it is closed. + collapsingORexpanding(event.getTreeNode(), false);//this is so all children are closed under this node. trust me, you want this... + event.getTreeNode().setExpanded(true); + } +} + +public void collapsingORexpanding(TreeNode n, boolean option) { + if (n.getChildren().isEmpty()) { + n.setSelected(false); + } else { + for (TreeNode s : n.getChildren()) { + collapsingORexpanding(s, option); + } + n.setExpanded(option); + n.setSelected(false); + } +} + +```","The easiest way is to add some JavaScript to trigger the triangle on node click: + +``` + `, when i click on its label, not when i click on the little triangle. +Cant find any .xhtml document, but found that nodes are created this way: + +``` +... +final TreeNode parentNode = this.addNode(false, ""Parent"", this.root, targetView1); //first parameter means start expanded or not +this.addNode(, ""ChildNode"", parentNode, ""targetView2""); +... + +``` + +Is it possible? Thank you.",2017/04/14,"['https://Stackoverflow.com/questions/43408454', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4419468/']","The easiest way is to add some JavaScript to trigger the triangle on node click: + +``` + ..1.. +.0... .11.. +.#... .#... + +``` + +This one can be used if and only if the square consists of ones in the original matrix and there were zeros in the mask(it means that we pick this square). +The other one is: + +``` +..#.. ..#.. +.##.. -> ..#.. +.#... .#0.. +.#... .#... + +``` + +This one is always applicable. It means that we do pick this 2x2 square. +When we are done with one row, we can proceed to the next one: + +``` +..#.. ..#0. +..#.. -> ..#.. +..#.. ..#.. +.##.. ..#.. + +``` + +There are at most two transitions from each state, so the total time complexity is `O(n * m * 2 ^ n)`. The answer the maximum among all masks and shifts for the last row." +28071829,"Given a rectangle consisting of 1's and 0's, how can I find the maximum number of non-overlapping 2x2 squares of 1's? + +Example: + +``` +0110 +1111 +1111 + +``` + +The solution would be 2. + +I know it can be solved with Bitmask DP; but I can't really grasp it - after playing with it for hours. How does it work and how can it be formalised?",2015/01/21,"['https://Stackoverflow.com/questions/28071829', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1327559/']","I wanted to point out that the graph we get by putting vertices at the centers of squares and joining them when they overlap is *not* claw-free: + +If we take (in the full plane) a 2x2 square and three of the four diagonally overlapping 2x2 squares, they form the induced subgraph + +``` +• • + \ / + • + / +• + +``` + +This is a claw, meaning that any region containing those squares corresponds to a non-claw-free graph.","edit 20:18, there is a counterexample posted by @ILoveCoding + +My intuition says, that this will work. I am unable to prove it since I'm not advanced enough. I can't think of any counterexample though. +I will try describe the solution and post the code, please correct me if my solution is wrong. + +First we load input to an array. +Then we create second array of the same size and for every possible placing of 2x2 square we mark 1 in the second array. For the example posted by OP this would look like below. + +``` +0 1 0 0 +1 1 1 0 +0 0 0 0 + +``` + +Then for every 1 in second array we calculate the number of neighbours (including diagonals) + 1 (because if it doesn't have any neighbours we have to still see it as 1). We set those new numbers to the array. Now it should look like this. + +``` +0 4 0 0 +3 4 3 0 +0 0 0 0 + +``` + +Then for every non-zero value in the array we check whether it has any neighbour with bigger or equal value. If it has then move on since it can't be in the solution. +If we don't find any such value then it will be in the solution. We have to reset to zero every neighbour of the original value (because it can't be in the solution, it would overlap the solution. + +So the first such number found should be 2 on the left. After processing it the array should look like following. + +``` +0 0 0 0 +3 0 3 0 +0 0 0 0 + +``` + +When we check the other 3 situation is the same. + +We end up with non-zero values in the array indicating where top left corners of 2x2 squares are. + +If you need the numer of them just traverse the array and count non-zero elements. + +Another example + +``` +1111 -> 1 1 1 0 -> 4 6 4 0 -> 4 0 4 0 +1111 -> 1 1 1 0 -> 6 9 6 0 -> 0 0 0 0 +1111 -> 1 1 1 0 -> 6 9 6 0 -> 6 0 6 0 +1111 -> 1 1 1 0 -> 6 9 6 0 -> 0 0 0 0 +1111 -> 1 1 1 0 -> 4 6 4 0 -> 4 0 4 0 +1111 -> 0 0 0 0 -> 0 0 0 0 -> 0 0 0 0 + +``` + +The code I write can be found here +" +6094828,"is it possible to upload a video to Facebook via the Graph API, using the Javascript SDK? + +something like this... + +``` +FB.api('/me/videos', 'post', {message: ""Test"", source: ""@http://video.link.goes/here.flv"", access_token: ""token""}, function(response) { + console.log(response) +}); + +``` + +now I know that this won't work, but is there a way to achieve something like this using the Graph API and Javascript SDK? + +If not, would it be safe to use the old REST api to upload the video clip?.. since it is going to be deprecated soon. + +Thanx in advance!",2011/05/23,"['https://Stackoverflow.com/questions/6094828', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/270311/']","Yes, you can do this posting data to an iframe like [here](https://stackoverflow.com/a/5455783/1107651), or you can use [jQuery File Upload](http://blueimp.github.com/jQuery-File-Upload/) . +The problem is you can't get response from iframe, using plugin you can use a page handle. +Example: + +``` +
+ + + + +
+ + + +```",The question is very similar to the one asked here: [Facebook new javascript sdk- uploading photos with it!](https://stackoverflow.com/questions/4264599/facebook-new-javascript-sdk-uploading-photos-with-it). +12739,"We use pop accounts as a backup when our server or internet connection is down. We've recently upgraded to sbs 2008. + +I've added our backup pop accounts via the SBS console pop conenctor. When i hit retreive now it give me an error. + +in the event log the error is described as: + +``` +The TCP/IP connection with the '[pop sever]' server was terminated while +trying to access the '[email@email.com]' mailbox. The cause may be +server problems, network problems, a long period of inactivity, a +connection time limit, or incorrect connection settings. + +``` + +This only happens if there is a message in the account. if the account is empty it gives no error and says completed successfully. +The message can be any size and it still throws this error. It times out in under a minute. + +Looking at the pop verbose logs it gets as far as the downloading message stage before it times out. ie it authenticates, checks how many messages there are and begins the download. + +I know it's not a firewall issue because i the relevant ports are open on the hardware filewall and the server. + +I can download the mail from these pop accounts when i set one up in outlook directly. + +I also don't think it's a virus scanning problem as I have this problem even if i disable Symantec Endpoint Protection 11 on the server- which is what we use. + +any ideas anyone?",2009/05/27,"['https://serverfault.com/questions/12739', 'https://serverfault.com', 'https://serverfault.com/users/3955/']","Download the network monitor from and use it to watch the connection to the POP3 server. + +POP3 is a simple protocol and POP3 commands are plain text. In the output from the network monitor you'll be able to see the commands sent by your server and the responses from the POP3 server. It should be easy to see exactly what the problem is. + +The latest version of the network monitor is a bugger to use, but the help is reasonably good and has examples. + +JR + +----8<---- +Response to Charlie's comment: + +I doubt the segment lost is significant. TCP is a fault tolerant protocol and even if packets were lost TCP will correct the loss. + +If the trace actually shows the mail then the POP3 connector is getting as far as downloading the message. The packet before the mail should be a packet from your server to the POP3 server with the RETR command in it. The POP3 server responds to RETR by sending the mail. After the packet with the mail in, your server should send a DELE command, then finally a QUIT. + +If there are no packets after the mail is sent to your server, that suggests your server is failing to spot the end of the message so it's hung waiting. This rings a faint bell with SBS 2003. I have only a faint recollection of this, but I'm fairly sure I've seen something similar in 2003 and that was due to the anti-virus. Someone had installed an AV that processed mail downloads and that was interfering with the connector. + +Have you considered uninstalling the AV from the server to see if that helps? We've only done a couple of SBS 2008 installs, and only one of those uses the POP3 connector, but it does work. As a last resort I have actually written a POP3 downloader that I'd be happy to pop on Sourceforge.",I would recommend (if you havent already) trying a differnt pop3 account on seperate host if possible to rule out any problems either with the host or some kind of incompatibility between the two. +12739,"We use pop accounts as a backup when our server or internet connection is down. We've recently upgraded to sbs 2008. + +I've added our backup pop accounts via the SBS console pop conenctor. When i hit retreive now it give me an error. + +in the event log the error is described as: + +``` +The TCP/IP connection with the '[pop sever]' server was terminated while +trying to access the '[email@email.com]' mailbox. The cause may be +server problems, network problems, a long period of inactivity, a +connection time limit, or incorrect connection settings. + +``` + +This only happens if there is a message in the account. if the account is empty it gives no error and says completed successfully. +The message can be any size and it still throws this error. It times out in under a minute. + +Looking at the pop verbose logs it gets as far as the downloading message stage before it times out. ie it authenticates, checks how many messages there are and begins the download. + +I know it's not a firewall issue because i the relevant ports are open on the hardware filewall and the server. + +I can download the mail from these pop accounts when i set one up in outlook directly. + +I also don't think it's a virus scanning problem as I have this problem even if i disable Symantec Endpoint Protection 11 on the server- which is what we use. + +any ideas anyone?",2009/05/27,"['https://serverfault.com/questions/12739', 'https://serverfault.com', 'https://serverfault.com/users/3955/']","You need to do this in the exchange console: + +set-connector ""pop3 connector name"" -ConnectionTimeout hours:minutes:seconds +set-connector ""pop3 connector name"" -ConnectionIdleTimeout hours:minutes:seconds + +This will increase the amount of time it will take before exchange assumes that the connector has become idle - even if the connector is still busy downloading mails. This is especially necessary if the server has a slow connection to the internet and/or they regularly receive large mails which might cause the connector to timeout. + +This fixed my problem. I hope it fixes yours! + +Regards, + +Andrew",I would recommend (if you havent already) trying a differnt pop3 account on seperate host if possible to rule out any problems either with the host or some kind of incompatibility between the two. +7629550,"I'm using rsync `--link-dest` to preform a differential back up of my computer. After each backup, I'd like to save out a log of the new/changed files. Is this possible? If so, how would I do it?",2011/10/02,"['https://Stackoverflow.com/questions/7629550', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/597864/']","Answer from the rsync mailing list: + +Use `--itemize-changes`","Here's another answer [from the mailing list](https://lists.samba.org/archive/rsync/2011-October/026974.html). There's a script by Kevin Korb: + +> +> If you want something you can run after the fact here is a tool I wrote +> a while back that does a sort of diff across 2 --link-dest based backups: +> +> +> +> +> +> It will also tell you what files were not included in the newer backup +> which --itemize-changes will not since it doesn't actually --delete +> anything. The program is written in perl so it should be easy enough to +> tweak it if it doesn't do exactly what you want. +> +> +>" +7629550,"I'm using rsync `--link-dest` to preform a differential back up of my computer. After each backup, I'd like to save out a log of the new/changed files. Is this possible? If so, how would I do it?",2011/10/02,"['https://Stackoverflow.com/questions/7629550', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/597864/']","Answer from the rsync mailing list: + +Use `--itemize-changes`","For referance you can also compare using rsync to do a dryrun between hardlinked backup directories to see how they are changed. + +``` +rsync -aHin day_06_*/ day_05_* 2>&1 | grep -v '^\.d' + +``` + +Shows files that are added, removed, or renamed//moved. + +The later only happens if you have a re-linking program relinking files that were renamed/moved. That can be important if you say had simply renamed a directory (rsync backup breaks the links in that case)." +29621214,"I have a form with different input fields.So for very minute , the data entered by the user needs to be automatically stored in the database. Once the request is submitted , it will be directed to the struts file where the database interactions will be carried out . + +What i have tried, I had set the timeout function to run every time the page is loaded + +``` +var timer; +$(document).ready(function() { +timer = setTimeout(""autosave()"", 60000); +}); + +``` + +And in the autosave function , i am trying to post the input data to the designated URL + +``` +jQuery('form').each(function() { + jQuery.ajax({ + url: ""http://localhost:7002/submitStudent.do?requestType=auto&autosave=true"", + data: jQuery(this).serialize(), + type: 'POST', + success: function(data){ + if(data && data == 'success') { + alert(""data saved""); + }else{ + } + } + }); + }); +} + } + +``` + +And once the request is sent to the struts , it will be processed based on the requesttype and the data will be submitted. + +But in my case , data doesn't get saved. + +Kindly share your suggestions on what i am doing wrong and any other ways to do it ? + +Thanks for your valuable suggestion and time.. + +FYI , i am a beginner in Jquery and ajax technologies + +JSFIDDLE : [jsfiddle](http://jsfiddle.net/jegadeesb/o0c3rmp3/1/)",2015/04/14,"['https://Stackoverflow.com/questions/29621214', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1099079/']","I have made a [fiddle](http://jsfiddle.net/o0c3rmp3/5/) according to your requirement. + +``` +var timer; + +var fun = function autosave() { + alert(); + jQuery('form').each(function () { + jQuery.ajax({ + url: ""http://localhost:7002/submitStudent.do?autosave=true"", + data: jQuery(this).serialize(), + type: 'POST', + success: function (data) { + if (data && data == 'success') { + alert(""data saved""); + } else {} + } + }); + }); +} +$(document).ready(function () { + setTimeout(fun, 1000); + //setInterval(fun,1000); +}); + +``` + +You need to focus on two methods `setTimeout` and `setInterval`. setTimeout will call `autosave()` after 1 second of DOM loading but only once. `setInterval` will call `autosave()` after every 1 second repeatedly. You can read it [here](http://www.w3schools.com/jsref/met_win_settimeout.asp). + +> +> The `setTimeout()` method calls a function or evaluates an expression +> after a specified number of milliseconds. **Tip: The function is only executed once. If you need to repeat execution, use the `setInterval()` method.** +> +> +> + +For more details on your ajax request you need to look at the console(F12) errors.","I recommend that you use [ajaxForm](http://malsup.com/jquery/form/#api) plugin + +and in the autosave function just fire $('form').submit(); + +this is the fast and good way" +68944559,"Consider these series: + +```py +>>> a = pd.Series('abc a abc c'.split()) +>>> b = pd.Series('a abc abc a'.split()) +>>> pd.concat((a, b), axis=1) + 0 1 +0 abc a +1 a abc +2 abc abc +3 c a + +>>> unknown_operation(a, b) +0 False +1 True +2 True +3 False + +``` + +The desired logic is to determine if the string in the left column is a substring of the string in the right column. `pd.Series.str.contains` does not accept another Series, and `pd.Series.isin` checks if the value exists in the other series (not in the same row specifically). I'm interested to know if there's a vectorized solution (not using `.apply` or a loop), but it may be that there isn't one.",2021/08/26,"['https://Stackoverflow.com/questions/68944559', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9918345/']","Let us try with `numpy` `defchararray` which is vectorized + +``` +from numpy.core.defchararray import find +find(df['1'].values.astype(str),df['0'].values.astype(str))!=-1 +Out[740]: array([False, True, True, False]) + +```","IIUC, + +``` +df[1].str.split('', expand=True).eq(df[0], axis=0).any(axis=1) | df[1].eq(df[0]) + +``` + +Output: + +``` +0 False +1 True +2 True +3 False +dtype: bool + +```" +68944559,"Consider these series: + +```py +>>> a = pd.Series('abc a abc c'.split()) +>>> b = pd.Series('a abc abc a'.split()) +>>> pd.concat((a, b), axis=1) + 0 1 +0 abc a +1 a abc +2 abc abc +3 c a + +>>> unknown_operation(a, b) +0 False +1 True +2 True +3 False + +``` + +The desired logic is to determine if the string in the left column is a substring of the string in the right column. `pd.Series.str.contains` does not accept another Series, and `pd.Series.isin` checks if the value exists in the other series (not in the same row specifically). I'm interested to know if there's a vectorized solution (not using `.apply` or a loop), but it may be that there isn't one.",2021/08/26,"['https://Stackoverflow.com/questions/68944559', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9918345/']","IIUC, + +``` +df[1].str.split('', expand=True).eq(df[0], axis=0).any(axis=1) | df[1].eq(df[0]) + +``` + +Output: + +``` +0 False +1 True +2 True +3 False +dtype: bool + +```","I tested various functions with a randomly generated Dataframe of 1,000,000 5 letter entries. + +Running on my machine, the averages of 3 tests showed: + +zip > v\_find > to\_list > any > apply + +0.21s > 0.79s > 1s > 3.55s > 8.6s + +Hence, i would recommend using zip: + +``` +[x[0] in x[1] for x in zip(df['A'], df['B'])] + +``` + +or vectorized find (as proposed by BENY) + +``` +np.char.find(df['B'].values.astype(str), df['A'].values.astype(str)) != -1 + +``` + +My test-setup: + +``` + def generate_string(length): +return ''.join(random.choices(string.ascii_uppercase + string.digits, k=length)) + +A = [generate_string(5) for x in range(n)] +B = [generate_string(5) for y in range(n)] +df = pd.DataFrame({""A"": A, ""B"": B}) + +to_list = pd.Series([a in b for a, b in df[['A', 'B']].values.tolist()]) + +apply = df.apply(lambda s: s[""A""] in s[""B""], axis=1) + +v_find = np.char.find(df['B'].values.astype(str), df['A'].values.astype(str)) != -1 + +any = df[""B""].str.split('', expand=True).eq(df[""A""], axis=0).any(axis=1) | df[""B""].eq(df[""A""]) + +zip = [x[0] in x[1] for x in zip(df['A'], df['B'])] + +```" +68944559,"Consider these series: + +```py +>>> a = pd.Series('abc a abc c'.split()) +>>> b = pd.Series('a abc abc a'.split()) +>>> pd.concat((a, b), axis=1) + 0 1 +0 abc a +1 a abc +2 abc abc +3 c a + +>>> unknown_operation(a, b) +0 False +1 True +2 True +3 False + +``` + +The desired logic is to determine if the string in the left column is a substring of the string in the right column. `pd.Series.str.contains` does not accept another Series, and `pd.Series.isin` checks if the value exists in the other series (not in the same row specifically). I'm interested to know if there's a vectorized solution (not using `.apply` or a loop), but it may be that there isn't one.",2021/08/26,"['https://Stackoverflow.com/questions/68944559', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9918345/']","Let us try with `numpy` `defchararray` which is vectorized + +``` +from numpy.core.defchararray import find +find(df['1'].values.astype(str),df['0'].values.astype(str))!=-1 +Out[740]: array([False, True, True, False]) + +```","I tested various functions with a randomly generated Dataframe of 1,000,000 5 letter entries. + +Running on my machine, the averages of 3 tests showed: + +zip > v\_find > to\_list > any > apply + +0.21s > 0.79s > 1s > 3.55s > 8.6s + +Hence, i would recommend using zip: + +``` +[x[0] in x[1] for x in zip(df['A'], df['B'])] + +``` + +or vectorized find (as proposed by BENY) + +``` +np.char.find(df['B'].values.astype(str), df['A'].values.astype(str)) != -1 + +``` + +My test-setup: + +``` + def generate_string(length): +return ''.join(random.choices(string.ascii_uppercase + string.digits, k=length)) + +A = [generate_string(5) for x in range(n)] +B = [generate_string(5) for y in range(n)] +df = pd.DataFrame({""A"": A, ""B"": B}) + +to_list = pd.Series([a in b for a, b in df[['A', 'B']].values.tolist()]) + +apply = df.apply(lambda s: s[""A""] in s[""B""], axis=1) + +v_find = np.char.find(df['B'].values.astype(str), df['A'].values.astype(str)) != -1 + +any = df[""B""].str.split('', expand=True).eq(df[""A""], axis=0).any(axis=1) | df[""B""].eq(df[""A""]) + +zip = [x[0] in x[1] for x in zip(df['A'], df['B'])] + +```" +34957630,"Attempting to implement the basic JavaPoet example (see below) in a Android ActivityWatcher class from LeakCanary: + +``` +.addModifiers(Modifier.PUBLIC, Modifier.STATIC) + +``` + +The Modifier.PUBLIC and Modifier.STATIC, and the other .addModifiers statement produce the Android Studio error + +> +> addModifiers (javax.lang.model.element.modifier...) in Builder can not be applied to (int, int) +> +> +> + +and the following gradle error: + +``` +:Machine-android:compileDebugJava + +``` + +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:58: error: cannot access Modifier + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + ^ + class file for javax.lang.model.element.Modifier not found +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:65: error: method addModifiers in class Builder cannot be applied to given types; + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + ^ + required: Modifier[] + found: int,int + reason: varargs mismatch; int cannot be converted to Modifier +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:73: error: cannot access Filer + javaFile.writeTo(System.out); + ^ + class file for javax.annotation.processing.Filer not found +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:172: error: method addModifiers in class Builder cannot be applied to given types; + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + ^ + required: Modifier[] + found: int,int + reason: varargs mismatch; int cannot be converted to Modifier +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:179: error: method addModifiers in class Builder cannot be applied to given types; + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + ^ + required: Modifier[] + found: int,int + reason: varargs mismatch; int cannot be converted to Modifier +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:187: error: cannot access Path + javaFile.writeTo(System.out); + ^ + class file for java.nio.file.Path not found +Note: C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\internal\MachineInternals.java uses or overrides a deprecated API. +Note: Recompile with -Xlint:deprecation for details. +Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output +6 errors + +FAILED + +FAILURE: Build failed with an exception. + +* What went wrong: +Execution failed for task ':Machine-android:compileDebugJava'. + +> +> Compilation failed; see the compiler error output for details. +> +> +> +* Try: +Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. + +BUILD FAILED + +Total time: 6.881 secs + +and here's the error from messages: + +``` +:machine-android:compileDebugJava + +``` + +C:\AAAmachine\machine-master\machine-android\src\main\java\com\bmp\ActivityWatcher.java +Error:(58, 15) error: cannot access Modifier +class file for javax.lang.model.element.Modifier not found +Error:(65, 15) error: method addModifiers in class Builder cannot be applied to given types; +required: Modifier[] +found: int,int +reason: varargs mismatch; int cannot be converted to Modifier +Error:(73, 19) error: cannot access Filer +class file for javax.annotation.processing.Filer not found +Error:(172, 15) error: method addModifiers in class Builder cannot be applied to given types; +required: Modifier[] +found: int,int +reason: varargs mismatch; int cannot be converted to Modifier +Error:(179, 15) error: method addModifiers in class Builder cannot be applied to given types; +required: Modifier[] +found: int,int +reason: varargs mismatch; int cannot be converted to Modifier +Error:(187, 19) error: cannot access Path +class file for java.nio.file.Path not found +Note: C:\AAAmachine\machine-master\machine-android\src\main\java\com\bmp\internal\machineInternals.java uses or overrides a deprecated API. +Note: Recompile with -Xlint:deprecation for details. +Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output +Error:Execution failed for task ':machine-android:compileDebugJava'. + +> +> Compilation failed; see the compiler error output for details. +> Information:BUILD FAILED +> Information:Total time: 6.881 secs +> Information:7 errors +> Information:0 warnings +> Information:See complete output in console +> +> +> + +Here's the gist of the source code using the basic example from the readme.md file from JavaPoet: + +``` +package com.bmp; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.app.Application; +import android.content.Context; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.preference.PreferenceManager; +import android.util.Log; +import android.view.ViewGroup; + +import com.bmp.util.eventbus.FabricLogEvent; +import com.squareup.javapoet.JavaFile; +import com.squareup.javapoet.MethodSpec; +import com.squareup.javapoet.TypeSpec; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.Modifier; + +import de.greenrobot.event.EventBus; + +import static android.os.Build.VERSION.SDK_INT; +import static android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH; +import static com.bmp.Preconditions.checkNotNull; + +@TargetApi(ICE_CREAM_SANDWICH) public final class ActivityWatcher { + + public static void installOnIcsPlus(Application application, RefWatcher refWatcher) { + if (SDK_INT < ICE_CREAM_SANDWICH) { + // If you need to support Android < ICS, override onDestroy() in your base activity. + return; + } + + ActivityWatcher activityWatcher = new ActivityWatcher(application, refWatcher); + activityWatcher.watchActivities(); + + MethodSpec main = MethodSpec.methodBuilder(""main"") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns(void.class) + .addParameter(String[].class, ""args"") + .addStatement(""$T.out.println($S)"", System.class, ""Hello, JavaPoet!"") + .build(); + + TypeSpec helloWorld = TypeSpec.classBuilder(""HelloWorld"") + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + .addMethod(main) + .build(); + + JavaFile javaFile = JavaFile.builder(""com.bmp.helloworld"", helloWorld) + .build(); + + try { + javaFile.writeTo(System.out); + } catch (IOException e) { + e.printStackTrace(); + } + + FileWriter fileWriter = null; + try { + fileWriter = new FileWriter(new File(""com.bmp.newclass.java"")); + } catch (IOException e) { + e.printStackTrace(); + } +} + +``` + +Could it be related to the physical file name to be written?",2016/01/22,"['https://Stackoverflow.com/questions/34957630', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2312175/']",Change your imports to `import javax.lang.model.element.Modifier`. If you can’t import this package change your project’s module configuration from the Android SDK to the Java SDK.,"In your Android project, create a single Java module for code use JavaPoet. + +suce as ![select the java library](https://i.stack.imgur.com/evkaO.png) + +In this module, your `build.gradle` file should be like this: + +``` +apply plugin: 'java' + +sourceCompatibility = ""1.7"" +targetCompatibility = ""1.7"" +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.squareup:javapoet:1.7.0' +} + +``` + +![the build.gradle in the java library](https://i.stack.imgur.com/M1H1V.png)." +34957630,"Attempting to implement the basic JavaPoet example (see below) in a Android ActivityWatcher class from LeakCanary: + +``` +.addModifiers(Modifier.PUBLIC, Modifier.STATIC) + +``` + +The Modifier.PUBLIC and Modifier.STATIC, and the other .addModifiers statement produce the Android Studio error + +> +> addModifiers (javax.lang.model.element.modifier...) in Builder can not be applied to (int, int) +> +> +> + +and the following gradle error: + +``` +:Machine-android:compileDebugJava + +``` + +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:58: error: cannot access Modifier + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + ^ + class file for javax.lang.model.element.Modifier not found +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:65: error: method addModifiers in class Builder cannot be applied to given types; + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + ^ + required: Modifier[] + found: int,int + reason: varargs mismatch; int cannot be converted to Modifier +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:73: error: cannot access Filer + javaFile.writeTo(System.out); + ^ + class file for javax.annotation.processing.Filer not found +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:172: error: method addModifiers in class Builder cannot be applied to given types; + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + ^ + required: Modifier[] + found: int,int + reason: varargs mismatch; int cannot be converted to Modifier +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:179: error: method addModifiers in class Builder cannot be applied to given types; + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + ^ + required: Modifier[] + found: int,int + reason: varargs mismatch; int cannot be converted to Modifier +C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\ActivityWatcher.java:187: error: cannot access Path + javaFile.writeTo(System.out); + ^ + class file for java.nio.file.Path not found +Note: C:\AAAMachine\Machine-master\Machine-android\src\main\java\com\bmp\internal\MachineInternals.java uses or overrides a deprecated API. +Note: Recompile with -Xlint:deprecation for details. +Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output +6 errors + +FAILED + +FAILURE: Build failed with an exception. + +* What went wrong: +Execution failed for task ':Machine-android:compileDebugJava'. + +> +> Compilation failed; see the compiler error output for details. +> +> +> +* Try: +Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. + +BUILD FAILED + +Total time: 6.881 secs + +and here's the error from messages: + +``` +:machine-android:compileDebugJava + +``` + +C:\AAAmachine\machine-master\machine-android\src\main\java\com\bmp\ActivityWatcher.java +Error:(58, 15) error: cannot access Modifier +class file for javax.lang.model.element.Modifier not found +Error:(65, 15) error: method addModifiers in class Builder cannot be applied to given types; +required: Modifier[] +found: int,int +reason: varargs mismatch; int cannot be converted to Modifier +Error:(73, 19) error: cannot access Filer +class file for javax.annotation.processing.Filer not found +Error:(172, 15) error: method addModifiers in class Builder cannot be applied to given types; +required: Modifier[] +found: int,int +reason: varargs mismatch; int cannot be converted to Modifier +Error:(179, 15) error: method addModifiers in class Builder cannot be applied to given types; +required: Modifier[] +found: int,int +reason: varargs mismatch; int cannot be converted to Modifier +Error:(187, 19) error: cannot access Path +class file for java.nio.file.Path not found +Note: C:\AAAmachine\machine-master\machine-android\src\main\java\com\bmp\internal\machineInternals.java uses or overrides a deprecated API. +Note: Recompile with -Xlint:deprecation for details. +Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output +Error:Execution failed for task ':machine-android:compileDebugJava'. + +> +> Compilation failed; see the compiler error output for details. +> Information:BUILD FAILED +> Information:Total time: 6.881 secs +> Information:7 errors +> Information:0 warnings +> Information:See complete output in console +> +> +> + +Here's the gist of the source code using the basic example from the readme.md file from JavaPoet: + +``` +package com.bmp; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.app.Application; +import android.content.Context; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.preference.PreferenceManager; +import android.util.Log; +import android.view.ViewGroup; + +import com.bmp.util.eventbus.FabricLogEvent; +import com.squareup.javapoet.JavaFile; +import com.squareup.javapoet.MethodSpec; +import com.squareup.javapoet.TypeSpec; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.Modifier; + +import de.greenrobot.event.EventBus; + +import static android.os.Build.VERSION.SDK_INT; +import static android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH; +import static com.bmp.Preconditions.checkNotNull; + +@TargetApi(ICE_CREAM_SANDWICH) public final class ActivityWatcher { + + public static void installOnIcsPlus(Application application, RefWatcher refWatcher) { + if (SDK_INT < ICE_CREAM_SANDWICH) { + // If you need to support Android < ICS, override onDestroy() in your base activity. + return; + } + + ActivityWatcher activityWatcher = new ActivityWatcher(application, refWatcher); + activityWatcher.watchActivities(); + + MethodSpec main = MethodSpec.methodBuilder(""main"") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns(void.class) + .addParameter(String[].class, ""args"") + .addStatement(""$T.out.println($S)"", System.class, ""Hello, JavaPoet!"") + .build(); + + TypeSpec helloWorld = TypeSpec.classBuilder(""HelloWorld"") + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + .addMethod(main) + .build(); + + JavaFile javaFile = JavaFile.builder(""com.bmp.helloworld"", helloWorld) + .build(); + + try { + javaFile.writeTo(System.out); + } catch (IOException e) { + e.printStackTrace(); + } + + FileWriter fileWriter = null; + try { + fileWriter = new FileWriter(new File(""com.bmp.newclass.java"")); + } catch (IOException e) { + e.printStackTrace(); + } +} + +``` + +Could it be related to the physical file name to be written?",2016/01/22,"['https://Stackoverflow.com/questions/34957630', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2312175/']",Change your imports to `import javax.lang.model.element.Modifier`. If you can’t import this package change your project’s module configuration from the Android SDK to the Java SDK.,"**I find this way can work** +---------------------------- + +this just is Android studio bug . Android studio code check error for that . +add this code in your build.gradle in your moudle ,or your app module ,that error will go gone! + +``` +implementation 'org.checkerframework:checker:2.1.10' + +``` + +add this one ,and the processor module will work + +The whole build.gralde like this: + +``` +apply plugin: 'java-library' +repositories { + mavenCentral() +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.squareup:javapoet:1.11.1' + implementation 'com.google.auto.service:auto-service:1.0-rc6' + implementation 'org.checkerframework:checker:2.1.10' + + api project(':baseAnnotation') +} + +sourceCompatibility = ""1.7"" +targetCompatibility = ""1.7"" + +tasks.withType(JavaCompile) { + options.encoding = ""UTF-8"" +} + +``` + +### the important is + +``` +implementation 'org.checkerframework:checker:2.1.10' + +``` + +this is caputure of my android studio show +------------------------------------------ + +![](https://raw.githubusercontent.com/lixiaodaoaaa/publicSharePic/master/%E7%B2%98%E8%B4%B4%E7%9A%84%E5%9B%BE%E7%89%872019_11_26_16_56.png) + +remember only add this to your build.grale (app or moudle both work for you ) +this error just code check error ,just android studio app check error + +``` + implementation 'org.checkerframework:checker:2.1.10' + provided project(':processAnnotation') + annotationProcessor project("":processAnnotation"") + +``` + +processAnnotation is my process Module ." +18329849,"I wants to convert PDF file pages into a series of images in wpf application . + +Please help me. + +Thanks & Regards + +Anupam mishra",2013/08/20,"['https://Stackoverflow.com/questions/18329849', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1838025/']","GhostScript is a powerful tool (FREE and open source) that can convert PDF documents into image files: [Download GhostScript from sourceforge](http://sourceforge.net/projects/ghostscript/) + +This is command line tool; from .NET it can be invoked by calling Process.Start.","There are lot of libraries that can serve your purpose - + +* [ABC PDF](http://www.websupergoo.com/abcpdf-1.htm) +* [PDF Focus .Net](http://www.sautinsoft.net/help/pdf-to-word-tiff-images-text-rtf-csharp-vb-net/index.aspx#) +* [PDF Clown](http://www.stefanochizzolini.it/en/projects/clown/) (Open Source)" +14530375,"I have a Handsontable table filled with data and already rendered + +After checking the cells, I have located a couple of cells of interest and would like to color them - is there a good way to do this using the Handsontable code? + +Please note this is after loading and rendering the table + +Edit: + +The table is rendered with basic options: + +``` +$container.handsontable({ + startRows: 8, + startCols: 6, + rowHeaders: true, + colHeaders: true, + minSpareRows: 1, + minSpareCols: 1, + //contextMenu: false, + cells: function (row, col, prop) { + } + }); + +``` + +And the data is loaded via Ajax, decode\_file.php reads an excel sheet and returns data as JSON: + +``` + $.ajax({ + url: ""decode_file.php"", + type: 'GET', + success: function (res) { + handsontable.loadData(res.data); + console.log('Data loaded'); + }, + error: function (res) { + console.log(""Error : "" + res.code); + } + }); + +``` + +After loading the data, the user clicks a ""Process"" button and the code looks for a cell with the text ""Hello world"". Let's say the code finds the text ""Hello World"" in cell **row 4/col 5** and changed the background color of cell **row 4/col 5** to **red**",2013/01/25,"['https://Stackoverflow.com/questions/14530375', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/150878/']","The homepage provides a good example for your purpose: + + + +Just modify the condition (in this case upper/left corner). + +``` +cells: function (row, col, prop) { + if (row === 0 && col === 0) { + return {type: {renderer: greenRenderer}}; + } +} + +``` + +and you're done.","1. get the coordinates of the selected cell(s) using handsontable('getSelected') +2. if the selection is not empty : + +a. loop on all cells to gather each cell's renderer using handsontable('getCellMeta') and meta.renderer, then store them in an array (this should be done only once) + +b. update the table using handsontable(""updateSettings"") and cellProperties.renderer : + + * for cells within the selected coordinates, apply the chosen renderer and update the renderer's name in the 2.a. array + * for all other cells, apply the stored renderer" +14530375,"I have a Handsontable table filled with data and already rendered + +After checking the cells, I have located a couple of cells of interest and would like to color them - is there a good way to do this using the Handsontable code? + +Please note this is after loading and rendering the table + +Edit: + +The table is rendered with basic options: + +``` +$container.handsontable({ + startRows: 8, + startCols: 6, + rowHeaders: true, + colHeaders: true, + minSpareRows: 1, + minSpareCols: 1, + //contextMenu: false, + cells: function (row, col, prop) { + } + }); + +``` + +And the data is loaded via Ajax, decode\_file.php reads an excel sheet and returns data as JSON: + +``` + $.ajax({ + url: ""decode_file.php"", + type: 'GET', + success: function (res) { + handsontable.loadData(res.data); + console.log('Data loaded'); + }, + error: function (res) { + console.log(""Error : "" + res.code); + } + }); + +``` + +After loading the data, the user clicks a ""Process"" button and the code looks for a cell with the text ""Hello world"". Let's say the code finds the text ""Hello World"" in cell **row 4/col 5** and changed the background color of cell **row 4/col 5** to **red**",2013/01/25,"['https://Stackoverflow.com/questions/14530375', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/150878/']","The homepage provides a good example for your purpose: + + + +Just modify the condition (in this case upper/left corner). + +``` +cells: function (row, col, prop) { + if (row === 0 && col === 0) { + return {type: {renderer: greenRenderer}}; + } +} + +``` + +and you're done.","One a bit strange method that I'm using, and it actually fast and works fine: + +``` +afterRender: function(){ + render_color(this); +} + +``` + +ht is the instance of the handsontable, and render\_color: + +``` +function render_color(ht){ + for(var i=0;i"").addClass(""testwrapper"").appendTo(somethingwrapper); + var test1wrapper= $(""
"").addClass(""test One"").appendTo(testwrapper); + var test2rapper= $(""
"").addClass(""test Two"").appendTo(testwrapper); + var test3wrapper= $(""
"").addClass(""test Three"").appendTo(testwrapper); + +
+
+
+ +``` + +JSON: + +``` +function dummytestJSON(){ + testJSON = { + ""Test"" : + [ + { + ""img"" : ""../img/test1.png"", + ""title"" : ""Test1"", + ""description"" : ""you have notification"", + ""time"" : ""2 mins ago"" + }, + { + ""img"" : ""../img/test2.png"", + ""title"" : ""Test2"", + ""description"" : ""you have alerts"", + ""time"" : ""4 mins ago"" + }, + { + ""img"" : ""../img/test3.png"", + ""title"" : ""Test3"", + ""description"" : ""you have notifications"", + ""time"" : ""9 mins ago"" + } + ] + }; + //console.log(testJSON .Test_); + return JSON.stringify(testJSON ); + } + +``` + +Script: + +``` +function updateTest(){ + console.log(""updating test""); + //console.log(testJSON); + dummytestJSON(); + var testwrapper = [""Test One"",""Test Two"",""Test Three""]; + for(var test in testJSON.Test_){ + console.log(testJSON.Test_[test].title); + + var text = $(""

"").text(testJSON.Test_[test ].title).appendTo(""#""+testwrapper [test ]); + + } + +} + +```",2017/02/20,"['https://Stackoverflow.com/questions/42342207', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7592295/']","i see this corrections: + +The method dummytestJSON(), needs to return clean JSON , return testJSON; + +And in method updateTest: + +``` +function updateTest(){ + console.log(""updating test""); + //console.log(testJSON); + var Test_ = dummytestJSON(); + var testwrapper = [""Test One"",""Test Two"",""Test Three""]; + for(var test in Test_){ + console.log(Test_[test].title); + + var text = $(""

"").text(Test_[test ].title).appendTo(""#""+testwrapper [test ]); + + } + +} + +```","Try: + +``` +

+
+
+ +``` + +Then use + +``` +document.getElementById('div_1').innerHTML = ... + +``` + +to set the contents." +43876071,"hi there i got a php code from some tutorial but i can't understand the use of [] in front of the variables, can someone explain this code please. + +``` +$text= ""KKE68TSA76 Confirmed on 30/03/17 at 2:12PM Ksh100.00 received from 254786740098""; + } + $mpesa =explode("" "", $text); + $receipt=$mpesa[0]; // Code + $pesa=$mpesa[5]; // + $p = explode(""h"", $pesa); + $decimal=$p[1]; // Amount with decimal + $dc = explode(""."", $decimal); + $koma=$dc[0]; // Payment + $ondoa = explode("","", $koma); + $kwanza=$ondoa[0]; // Payment + $pili=$ondoa[1]; // Payment + $payment=$kwanza.$pili; + $phone=$mpesa[8]; // Phone + +```",2017/05/09,"['https://Stackoverflow.com/questions/43876071', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7778161/']","The [ ] is an array position. Exploding $mpesa turns that string of text into an array split by every space. $mpesa[0] is array position one, containing KKE68TSA76, $mpesa[1] contains Confirmed.. etc","The [ ] us an array positioner, so it indicates the position of an element in the list/array. + +But what are arrays? + +> +> An array is a special variable, which can hold more than one value at +> a time. - [W3Schools](https://www.w3schools.com/php/php_arrays.asp) +> +> +> + +``` +$array = array( + ""Item 1"", // Position 0 + ""Item 2"", // Position 1 + ""Item 3"" // Position 2 +); + +echo $array[0]; // THIS WILL OUTPUT: ""Item 1"". +echo $array[1]; // THIS WILL OUTPUT: ""Item 2"". +echo $array[2]; // THIS WILL OUTPUT: ""Item 3"". + +``` + +I hope this can be useful." +37904174,"Good day! I'm having a struggle to aligned the jumbtron to my calendar icon. And the elements of the jumbtron is not inside of it. Can someone help me how to solve this? Ideas? i just started studying bootstrap and css. + +Here's the picture. + +[![enter image description here](https://i.stack.imgur.com/Inz3W.png)](https://i.stack.imgur.com/Inz3W.png) + +here is my html code. + +``` +
+
+
+
+

Upcoming Events

+
+
+ August +

28

+
+
+
+

Sample Title

+

IT Thesis defense

+
7:00 AM - 8:00 PM
+
+
+
+
+ August +

28

+
+
+
+ August +

28

+
+
+
+

Latest News

+
+
+
+
+
+ +``` + +here is my css + +``` +#event { + color: #a92419; +} +hr.carved { + clear: both; + float: none; + width: 100%; + height: 2px; + border: none; + background: #ddd; + background-image: -webkit-gradient( + linear, + left top, + left bottom, + color-stop(0.5, rgb(126,27,18)), + color-stop(0.5, rgb(211,45,31)) + ); + background-image: -moz-linear-gradient( + center top, + rgb(126,27,18) 50%, + rgb(211,45,31) 50% + ); +} +.date { + display: block; + width: 60px; + height: 60px; + margin-bottom: 20px; + background: #fff; + text-align: center; + font-family: 'Helvetica', sans-serif; + position: relative; +} +.date .month { + background: #a92419; + display: block; + padding-bottom: 5px; + padding-top: 5px; + color: #fff; + font-size: 10px; + font-weight: bold; + border-bottom: 2px solid #a92419; + box-shadow: inset 0 -1px 0 0 #a92419; +} + +.date .day { + display: block; + margin: 0; + padding-bottom: 10px; + padding-top: 5px; + text-align: center; + font-size: 20px; + color:#a92419; + box-shadow: 0 0 3px #ccc; + position: relative; +} + +.date .day::after { + content: ''; + display: block; + height: 95%; + width: 96%; + position: absolute; + top: 3px; + left: 2%; + z-index: -1; + box-shadow: 0 0 3px #ccc; +} + +.date .day::before { + content: ''; + display: block; + height: 90%; + width: 90%; + position: absolute; + top: 6px; + left: 5%; + z-index: -1; +} +.jumbotron { + width: 300px; + height: 100px; + margin:none; +} +.jumbotron p { + font-size:12px; +} + +```",2016/06/19,"['https://Stackoverflow.com/questions/37904174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5438871/']","You can use [cron](https://en.wikipedia.org/wiki/Cron). + +`crontab -e` to create schedule and run scripts as root, or +`crontab -u [user] -e` to run as a specific user. + +at the bottom you can add +`0 * * * * cd /path/to/your/scrapy && scrapy crawl [yourScrapy] >> /path/to/log/scrapy_log.log` + +`0 * * * *` makes the script runs hourly, and I believe you can find more details about the settings online.","You can run your spider with the JOBDIR setting, it will save your requests loaded in the scheduler + +``` +scrapy crawl somespider -s JOBDIR=crawls/somespider-1 + +``` + +" +21188760,"``` +g = Goal.objects.filter(Q(title__contains=term) | Q(desc__contains=term)) + +``` + +How can I add to my `filter` that `user=request.user`? + +This doesn't work: + +``` +g = Goal.objects.filter(user=request.user, Q(title__contains=term) | Q(desc__contains=term)) + +``` + +Models: + +``` +class Goal(models.Model): + user = models.ForeignKey(User) + title = models.CharField(max_length=255) + desc = models.TextField() + +```",2014/01/17,"['https://Stackoverflow.com/questions/21188760', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3207076/']","Keyword arguments (`user=request.user`) must come **after** non keyword arguments (your Q object). + +Either switch the order in your filter: + +``` +Goal.objects.filter(Q(title__contains=term) | Q(desc__contains=term), user=request.user) + +``` + +or chain two `filter()` calls together + +``` +Goal.objects.filter(user=request.user).filter(Q(title__contains=term) | Q(desc__contains=term)) + +```","``` +g = Goal.objects.filter(Q(user__iexact=request.user) & Q(title__contains=term) | Q(desc__contains=term)) + +``` + +Use & in place of Python and operator" +21188760,"``` +g = Goal.objects.filter(Q(title__contains=term) | Q(desc__contains=term)) + +``` + +How can I add to my `filter` that `user=request.user`? + +This doesn't work: + +``` +g = Goal.objects.filter(user=request.user, Q(title__contains=term) | Q(desc__contains=term)) + +``` + +Models: + +``` +class Goal(models.Model): + user = models.ForeignKey(User) + title = models.CharField(max_length=255) + desc = models.TextField() + +```",2014/01/17,"['https://Stackoverflow.com/questions/21188760', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3207076/']","Keyword arguments (`user=request.user`) must come **after** non keyword arguments (your Q object). + +Either switch the order in your filter: + +``` +Goal.objects.filter(Q(title__contains=term) | Q(desc__contains=term), user=request.user) + +``` + +or chain two `filter()` calls together + +``` +Goal.objects.filter(user=request.user).filter(Q(title__contains=term) | Q(desc__contains=term)) + +```","According to django [docs](https://docs.djangoproject.com/en/1.11/topics/db/queries/). + +Lookup functions can mix the use of Q objects and keyword arguments. However, if a Q object is provided, it must precede the definition of any keyword arguments." +44029064,"How to create new array from slicing the existing array by it's key? + +for example my input is : + +``` +var array = [{""one"":""1""},{""one"":""01""},{""one"":""001""},{""one"":""0001""},{""one"":""00001""}, +{""two"":""2""},{""two"":""02""},{""two"":""002""},{""two"":""0002""},{""two"":""00002""}, +{""three"":""3""},{""three"":""03""},{""three"":""003""},{""three"":""0003""},{""three"":""00003""}, +{""four"":""4""},{""four"":""04""},{""four"":""004""},{""four"":""0004""},{""four"":""00004""}, +{""five"":""5""},{""five"":""05""},{""five"":""005""},{""five"":""0005""},{""five"":""00005""} ]; + +``` + +my output should be : + +``` +var outPutArray = [ + {""one"" : [""1"",""01"",""001"",""0001"",""00001""]}, + {""two"":[""2"",""02"",""002"",""0002"",""00002""]}, + {""three"":[""3"",""03"",""003"",""0003"",""00003""]}, + {""four"":[""4"",""04"",""004"",""0004"",""00004""]}, + {""five"":[""5"",""05"",""005"",""0005"",""00005""]} +] + +``` + +is there any short and easy way to achieve this in `javascript`?",2017/05/17,"['https://Stackoverflow.com/questions/44029064', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2024080/']","You can first create array and then use `forEach()` loop to add to that array and use `thisArg` param to check if object with same key already exists. + +```js +var array = [{""one"":""1"",""abc"":""xyz""},{""one"":""01""},{""one"":""001""},{""one"":""0001""},{""one"":""00001""},{""two"":""2""},{""two"":""02""},{""two"":""002""},{""two"":""0002""},{""two"":""00002""},{""three"":""3""},{""three"":""03""},{""three"":""003""},{""three"":""0003""},{""three"":""00003""},{""four"":""4""},{""four"":""04""},{""four"":""004""},{""four"":""0004""},{""four"":""00004""},{""five"":""5""},{""five"":""05""},{""five"":""005""},{""five"":""0005""},{""five"":""00005"",""abc"":""xya""} ]; + +var result = []; +array.forEach(function(e) { + var that = this; + + Object.keys(e).forEach(function(key) { + if(!that[key]) that[key] = {[key]: []}, result.push(that[key]) + that[key][key].push(e[key]) + }) +}, {}) + +console.log(result); +```","``` +var outputArray=[array.reduce((obj,el)=>(Object.keys(el).forEach(key=>(obj[key]=obj[key]||[]).push(el[key])),obj),{})]; + +``` + +Reduce the Array to an Object,trough putting each Arrays object key to the Object as an Array that contains the value. + +" +29035230,"I'm trying to connect my c# client to my c server. +The client is on Windows and the server on Linux. + +The server runs without errors but the client can't connect, the connection times out. + +c server: + +``` +int main() +{ +int socketid; +int clientid = 0; +char bufer[1024]; +struct sockaddr_in serv_addr, client_addr; +memset(&serv_addr, 0, sizeof(serv_addr)); +int addrlen = sizeof(client_addr); + +printf(""Start\n""); + +if((socketid = socket(AF_INET, SOCK_STREAM, 0)) < 0){ + printf(""Error ceating socket!\n%s"", strerror(errno)); + getchar(); + return 0; +} +printf(""S0cket created\n""); +serv_addr.sin_family = AF_INET; +serv_addr.sin_addr.s_addr = INADDR_ANY; +serv_addr.sin_port = 802; + +if(bind(socketid, (struct sockaddr*) &serv_addr, sizeof(serv_addr)) < 0){ + printf(""%s\n"", strerror(errno)); + getchar(); + return 0; +} +printf(""Bindend\n""); +listen(socketid, 0); +printf(""Listening\n""); + +printf(""Entering loop\n""); +while(1) +{ + sleep((50)*1000); + clientid = accept(socketid, (struct sockaddr*) &client_addr, &addrlen); + if(clientid > 0){printf(""accepted"");}else{printf(""error"");} +} +} + +``` + +C# client: + +``` +void btnClick(object Sender, EventArgs e) +{ + TcpClient client = new TcpClient(); + client.Connect(""192.168.1.102"", 802); +} + +``` + +What's wrong? + +Thanks in advance",2015/03/13,"['https://Stackoverflow.com/questions/29035230', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3870191/']","This has been standardized, [proposal 2764: Forward declaration of enumerations (rev. 3)](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf) allowed the forward declaration of enums if you specify the underlying type, whereas before this was not possible. + +The main reason is that when the underlying type is not specified the size is implementation defined and can depend on the enumerator values. From the draft C++11 standard section `7.2` *[dcl.enum]*: + +> +> For an enumeration whose underlying type is not fixed, the underlying +> type is an integral type that can represent all the enumerator values +> defined in the enumeration. If no integral type can represent all the +> enumerator values, the enumeration is ill-formed. It is +> implementation-defined which integral type is used as the underlying +> type except that the underlying type shall not be larger than int +> unless the value of an enumerator cannot fit in an int or unsigned +> int. If the enumerator-list is empty, the underlying type is as if the +> enumeration had a single enumerator with value 0. +> +> +> + +When passing by value it makes sense that not knowing the underlying type is an issue, but why is it an issue when it is a pointer or reference? This matters since apparently on some architectures, *char\** and *int\** can have different sizes as mentioned in this [comp.lang.c++ discussion: GCC and forward declaration of enum](http://compgroups.net/comp.lang.c++/gcc-and-forward-declaration-of-enum/1005825): + +> +> [...] While on most architectures it may not be an issue, on some +> architectures the pointer will have a different size, in case it is a +> char pointer. So finally our imaginary compiler would have no idea +> what to put there to get a ColorsEnum\*[...] +> +> +> + +We have the following stackoverflow answer for reference which describes the case where [char\* can be larger than int\*](https://stackoverflow.com/a/15832757/1708801), which backs up the assertion in the discussion above. + +Some [more details on the possible sizes of pointers](http://c-faq.com/null/machexamp.html) it looks like `char *` and `void *` are the two main exceptions here and so other object pointers should not have the same issues. So it seems like this case ends up being unique to enums.","It's a difference in design goals. + +Forward declaring a class creates an incomplete type that can be used opaquely in pointers/references. This is a very useful property. + +An incomplete enum type is not that useful. However being able to declare an enum without declaring what constants are inside that enum **is** useful. The complexity that comes from an incomplete enum type can be avoided by requiring that the size must be specified. + +So my best guess is that compiler implementers were kept in mind when this feature was designed, and the committee found that the increased complexity of incomplete enums was not worth the benefits." +33749645,"Hello friends i want to generate csv file in my application in following format +[![enter image description here](https://i.stack.imgur.com/cooVj.png)](https://i.stack.imgur.com/cooVj.png) + +Whne in android i get followign type csv +[![enter image description here](https://i.stack.imgur.com/hfwnM.png)](https://i.stack.imgur.com/hfwnM.png) + +My code is a follows. + +``` +private class ExportDatabaseCSVTask extends AsyncTask{ + + File exportDir; + File filerootAccount; + String mStringGenerateFileName=""""; + CSVWriter csvWrite; + @Override + public void onPreExecute() { + + mCustomProgressDialog=new CustomProgressDialog(getActivity()); + mCustomProgressDialog.show(""""); + + } + public Boolean doInBackground(final String... args){ + + try { + + if (mStringCurrentState.equalsIgnoreCase(""Month"")) { + + if (mAllMethods.isSDCARDPResent()==true) { + exportDir = new File(getExternalStorageDirectory()+""/Month""); + + } + else { + exportDir = new File(getActivity().getCacheDir() ,""/Month""); + + } + + if (!exportDir.exists()) { + exportDir.mkdirs(); + } + mStringGenerateFileName=String.valueOf(mTextViewChoiseTitle.getText().toString().trim())+"".csv""; + + filerootAccount = new File(exportDir, mStringGenerateFileName); + System.out.println(""filerootAccount ""+filerootAccount.toString()); + + System.out.println(""mStringGenerateFileName ""+mStringGenerateFileName); + filerootAccount.createNewFile(); + + csvWrite = new CSVWriter(new FileWriter(filerootAccount)); + + String Title=""Financial Report for ""+mTextViewTitle.getText().toString().trim(); + csvWrite.writeNext(Title); + String Title1=""Property Address : ""+mStringPropertyAddress; + csvWrite.writeNext(Title1); + ListmListAccount=new ArrayList(); + CartData acc=new CartData(); + + String Title11=""Month : ""+mTextViewChoiseTitle.getText().toString().trim(); + csvWrite.writeNext(Title11); + // this is the Column of the table and same for Header of CSV file + String arrStracc[] ={""Unit"",""Type"",""Income"",""Expense""}; + csvWrite.writeNext(arrStracc); + + CartData acc1=new CartData(); + if (mArrayListFinRentDatas.size()>0) { + for (int i = 0; i < mArrayListFinRentDatas.size(); i++) { + acc1.setAmount(mAllMethods.AmountForamte(mArrayListFinRentDatas.get(i).getRent_amount())); + acc1.setEtype(mArrayListFinRentDatas.get(i).getIncome_cat()); + mListAccount.add(acc1); + + String arrStr[] ={mArrayListFinRentDatas.get(i).getUnit_name(), mArrayListFinRentDatas.get(i).getIncome_cat(),mAllMethods.AmountForamte(mArrayListFinRentDatas.get(i).getRent_amount())}; + csvWrite.writeNext(arrStr); + } + + } + + if (mArrayListFinExpenseDatas.size()>0) { + for (int i = 0; i < mArrayListFinExpenseDatas.size(); i++) { + acc.setAmount(mAllMethods.AmountForamte(mArrayListFinExpenseDatas.get(i).getE_amount())); + System.out.println(""Types ""+mArrayListFinExpenseDatas.get(i).getExpense_cat()); + acc.setEtype(mArrayListFinExpenseDatas.get(i).getExpense_cat()); + mListAccount.add(acc); + + String arrStr[] ={mArrayListFinExpenseDatas.get(i).getUnit_name(), mArrayListFinExpenseDatas.get(i).getExpense_cat(),"""",mAllMethods.AmountForamte(mArrayListFinExpenseDatas.get(i).getE_amount())}; + csvWrite.writeNext(arrStr); + } + + } + + String arrStr4[] ={ ""Total"","""",mAllMethods.AmountForamte(mStringFinalTotalIncome),mAllMethods.AmountForamte(mStringFinalTotalExpense) }; + csvWrite.writeNext(arrStr4); + + ListmListAccount16=new ArrayList(); + CartData acc161=new CartData(); + double profit=0.0; + profit=Double.parseDouble(mStringFinalTotalIncome)-(Double.parseDouble(mStringFinalTotalExpense) ); + if (profit <0) { + double p= Math.abs(profit); + acc161.setEtype(""Total Profit / Loss ""); + acc161.setAmount(String.valueOf(p)); + + mListAccount16.add(acc161); + + for(int index=0; index < mListAccount16.size(); index++) + { + acc161=mListAccount16.get(index); + String arrStr[] ={ acc161.getEtype(),"""","""",""Loss"" ,mAllMethods.AmountForamte(acc161.getAmount())}; + csvWrite.writeNext(arrStr); + } + } + else if (profit ==0) { + acc161.setEtype(""Total Profit / Loss ""); + acc161.setAmount(""0.00""); + mListAccount16.add(acc161); + + for(int index=0; index < mListAccount16.size(); index++) + { + acc161=mListAccount16.get(index); + String arrStr[] ={ acc161.getEtype(),"""","""","""" ,mAllMethods.AmountForamte(acc161.getAmount())}; + csvWrite.writeNext(arrStr); + } + } + + else { + acc161.setEtype(""Total Profit / Loss ""); + acc161.setAmount(String.valueOf(profit)); + mListAccount16.add(acc161); + for(int index=0; index < mListAccount16.size(); index++) + { + acc161=mListAccount16.get(index); + + String arrStr[] ={ ""Total Profit / Loss"","""", """","""",mAllMethods.AmountForamte(acc161.getAmount())}; + csvWrite.writeNext(arrStr); + } + } + + } + + csvWrite.close(); + return true; + } + catch (IOException e){ + Log.e(""MainActivity"", e.getMessage(), e); + return false; + } + } + + @Override + public void onPostExecute(final Boolean success) { + + mCustomProgressDialog.dismiss(""""); + if (success){ + System.out.println(""Expeort""); + Toast.makeText(getActivity(), ""Financial report exported successfully."", Toast.LENGTH_SHORT).show(); + } + else { + mAllMethods.ShowDialog(getActivity(), ""Suceess"", ""Export failed!"", ""OK""); + } + } +} + +``` + +My issue is i want my csv format text with bold and bigger size and also with different color as per first image so how can i make it possible ? your all suggestions are appreciably.",2015/11/17,"['https://Stackoverflow.com/questions/33749645', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1461486/']","use these lines of code for using **HttpURLConnection** + +For sending the request parameter are as:- + +``` + Uri.Builder builder = new Uri.Builder() + .appendQueryParameter(""phone"", number) + .appendQueryParameter(""password"", password) + .appendQueryParameter(""device_login"",value); + +``` + +And for the getting the request parameter in the post method of connectionUrl are as follow:- + +``` +URL url = new URL(myurl); + HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); + urlConnection.setReadTimeout(30000); + urlConnection.setConnectTimeout(30000); ; + String query = builder.build().getEncodedQuery(); + + System.out.println(""REQUEST PARAMETERS ARE==="" + query); + urlConnection.setRequestMethod(""POST""); + urlConnection.setDoInput(true); + urlConnection.setDoOutput(true); + + urlConnection.connect(); + + //Send request + DataOutputStream wr = new DataOutputStream ( + urlConnection.getOutputStream ()); + wr.writeBytes (query); + wr.flush (); + wr.close (); + + //Get Response + InputStream isNew = urlConnection.getInputStream(); + BufferedReader rd = new BufferedReader(new InputStreamReader(isNew)); + + String line; + response = new StringBuffer(); + while((line = rd.readLine()) != null) { + response.append(line); + + } + rd.close(); + + System.out.println(""Final response====""+response); + +```","There might be more than one issue but a big one is you never send the request, all you are doing is creating the request and setting up the parameters + +you need to do a + +``` +conn.connect(); + +``` + +or + +``` +conn.getInputStream(); + +``` + +or any number of things you can do to send the request and get the information you require + +AFTER you write your params" +56803873,"I have the following code + +``` +declare +l_clob clob; +l_line varchar2(32767); +l_field varchar2(32767); +l_line_start pls_integer := 1; +l_line_end pls_integer := 1; +l_field_start pls_integer := 1; +l_field_end pls_integer := 1; +begin + select response_clob + into l_clob + from xxhr.xxhr_web_service_response + where response_id = 290; + -- Loop through lines. + loop + l_line_end := dbms_lob.instr(l_clob, chr(10), l_line_start, 1); + l_line := dbms_lob.substr(l_clob, l_line_end - l_line_start + 1, l_line_start); + -- If this is a line with fields and not web service garbage. + if substr(l_line, 1, 1) = '""' then + l_field_start := 2; + -- Loop through fields. + loop + l_field_end := instr(l_line, chr(9), l_field_start, 1); + l_field := substr(l_line, l_field_start, l_field_end - l_field_start); + dbms_output.put(l_field || ','); + l_field_start := l_field_end + 1; + exit when l_field_end = 0; + end loop; + dbms_output.put_line(''); + end if; + l_line_start := l_line_end + 1; + exit when l_line_end = 0; + end loop; +end; + +``` + +with which I'm trying to parse this `clob` test data: + +``` +LINE_TEXT +""PERSON_ID_NUMBER 30000 1223445454"" +""PERSON_DOB 30000 01-01-1900"" + +``` + +The `clob` data is `tab` separated and has a `chr(10)` at the end. I'm not familiar with `regexp_instr`, but currently I'm only using `instr` to search for the `tab` separators; so it's missing the end of line field and producing: + +``` +PERSON_ID_NUMBER,30000,, +PERSON_DOB,30000,, + +``` + +How can I change the `instr` into a `regexp_instr` to also look for the end of line character in addition to the `tab` and then correctly pick up the last field? + +I need the function to be performant, since it is parsing large files.",2019/06/28,"['https://Stackoverflow.com/questions/56803873', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/941397/']","To delete a file from a zip file, try this. I am demonstrating on how to delete one file. Feel free to amend it to suit your needs + +**Logic:** + +1. Use `.MoveHere` to move the file to user's temp directory. This will remove the file from the zip file +2. Delete the file from the temp directory + +**Code: (Tried and Tested)** + +``` +Option Explicit + +Private Declare Function GetTempPath Lib ""kernel32"" Alias ""GetTempPathA"" _ +(ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long + +Private Const MAX_PATH As Long = 260 + +Sub Sample() + Dim zipFile, oShellApp, fileToDelete, fl + + zipFile = ""C:\Users\routs\Desktop\Desktop.zip"" + fileToDelete = ""Tester.xlsm"" + + Set oShellApp = CreateObject(""Shell.Application"") + + For Each fl In oShellApp.Namespace(zipFile).Items + If fl.Name = fileToDelete Then + oShellApp.Namespace(TempPath).MoveHere (fl) + End If + Next fl + + Kill TempPath & fileToDelete +End Sub + +'~~> Function to get the user's temp path +Function TempPath() As Variant + TempPath = String$(MAX_PATH, Chr$(0)) + GetTempPath MAX_PATH, TempPath + TempPath = Replace(TempPath, Chr$(0), """") +End Function + +``` + +**Alternative** + +1. Add all relevant files to the zip +2. After that in a loop check the file size and if it is within acceptable limits, add optional files one by one.","Using the Hints from above answer by Siddharth. This little piece of code worked. + +**Fortunately you can pass path of a folder inside the Zip to `NameSpace` directly and loop through it's files.** + +Using path as `C:\-----\Test.Zip\Folder\Folder` + +So this worked Beautifully. + +``` +Dim oApp As Object +Dim fl As Object +Set oApp = CreateObject(""Shell.Application"") + + For Each fl In oApp.Namespace(""C:\Users\mohit.bansal\Desktop\Test\Test.zip\Test\Password Removed Files"").items + 'Path to a folder inside the Zip + oApp.Namespace(""C:\Users\mohit.bansal\Desktop\Test\abc\"").MoveHere (fl.Path) + Next + +```" +51011048,"I have that class: + +``` +public class DNDRunner { + private NotificationManager mNoMan; + + public DNDRunner(Context context) { + mNoMan = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + } + + public void run(String param) { + mNoMan.setZenMode(Integer.parseInt(param), null, ""DNDRunner""); + } +} + +``` + +And i call run method by reflection using: + +``` +try { + Class mRunner = Class.forName(runner); + Constructor constructor = mRunner.getConstructor(new Class[]{Context.class}); + Object object = constructor.newInstance(new Object[]{mContext}); + Method run = mRunner.getMethod(""run"", new Class[]{String.class}); + run.invoke(object, new Object[]{value}); +} catch (Exception e) { + Log.e(TAG, ""Runner"", e); +} + +``` + +but i get: + +``` +java.lang.NoSuchMethodException: [class android.content.Context] +at java.lang.Class.getConstructor0(Class.java:2320) +at java.lang.Class.getConstructor(Class.java:1725) + +``` + +what i'm doing wrong? the constructor is obviously there + +**UPDATE:** + +Testing with: + +``` +private void executeRunner() { + try { + Class mRunner = Class.forName(runner); + Constructor constructor = mRunner.getDeclaredConstructor(Context.class); + Log.d(TAG, ""Is public constructor? "" + Modifier.isPublic(constructor.getModifiers())); + Object object = constructor.newInstance(mContext); + Method run = mRunner.getDeclaredMethod(""run"", String.class); + run.invoke(object, value); + } catch (Exception e) { + Log.e(TAG, ""Runner"", e); + } +} + +``` + +But i get the same error: + +``` +06-25 20:24:44.703 2420 2420 E OmniAction: Runner +06-25 20:24:44.703 2420 2420 E OmniAction: java.lang.NoSuchMethodException: [class android.content.Context] +06-25 20:24:44.703 2420 2420 E OmniAction: at java.lang.Class.getConstructor0(Class.java:2320) +06-25 20:24:44.703 2420 2420 E OmniAction: at java.lang.Class.getDeclaredConstructor(Class.java:2166) +06-25 20:24:44.703 2420 2420 E OmniAction: at org.omnirom.omnilib.actions.OmniAction.executeRunner(OmniAction.java:148) +06-25 20:24:44.703 2420 2420 E OmniAction: at org.omnirom.omnilib.actions.OmniAction.execute(OmniAction.java:89) +06-25 20:24:44.703 2420 2420 E OmniAction: at org.omnirom.omnibrain.EventService.execOmniActions(EventService.java:302) +06-25 20:24:44.703 2420 2420 E OmniAction: at org.omnirom.omnibrain.EventService.execOnConnectActions(EventService.java:257) +06-25 20:24:44.703 2420 2420 E OmniAction: at org.omnirom.omnibrain.EventService.-wrap5(Unknown Source:0) +06-25 20:24:44.703 2420 2420 E OmniAction: at org.omnirom.omnibrain.EventService$2.onReceive(EventService.java:189) +06-25 20:24:44.703 2420 2420 E OmniAction: at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52497(LoadedApk.java:1313) +06-25 20:24:44.703 2420 2420 E OmniAction: at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4) +06-25 20:24:44.703 2420 2420 E OmniAction: at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39) +06-25 20:24:44.703 2420 2420 E OmniAction: at android.os.Handler.handleCallback(Handler.java:790) +06-25 20:24:44.703 2420 2420 E OmniAction: at android.os.Handler.dispatchMessage(Handler.java:99) +06-25 20:24:44.703 2420 2420 E OmniAction: at android.os.Looper.loop(Looper.java:164) +06-25 20:24:44.703 2420 2420 E OmniAction: at android.app.ActivityThread.main(ActivityThread.java:6499) +06-25 20:24:44.703 2420 2420 E OmniAction: at java.lang.reflect.Method.invoke(Native Method) +06-25 20:24:44.703 2420 2420 E OmniAction: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) +06-25 20:24:44.703 2420 2420 E OmniAction: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) +06-25 20:24:44.705 1692 1697 I zygote64: Do full code cache collection, code=507KB, data=308KB + +``` + +Weird .... :( + +I can't understand how it can find the class but it can't read the constructor. + +I'm cleaning all the references to previous code before build again: + +``` +find out/ -name *OmniBrain* -exec rm -rf {} + + +```",2018/06/24,"['https://Stackoverflow.com/questions/51011048', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1382894/']","1. Because cm are too big. You'd have to work with floats, which means you'd need to round all the time. They wanted something smaller. Also, the first devices were 160 dpi, do 1dp=1px which was convenient at the time (now very few devices ship at mdpi so this advantage is gone). It also just so happens to match the dpi of the iphone, rounded to the nearest 10 (iphone was 163 dpi), so measurements were what mobile devs were used to making easy conversions. +2. Its based on the physical dimensions. There can be some discrepancy, but in practice there isn't. If you have an image that is a little too small, the amount of distortion you get from stretching the tiny amount is negligible. The other major use of dp is in padding, and there the slight rounding errors are unnoticable as long as you're consistent on a single device.","1. As said by @Gabe Sechan, cm are too big (even mm). Contrary to cm, conversion to pixels is based on density category rather than exact density of the screen, which avoids rounding issues you'd have with cm to px (factor of 1.5x, 2x, 3x, etc rounds much better than an ""arbitrary"" ppi). +2. Yes. Conversion of dp to px is based on the density bucket the screen belongs to (mdpi, hdpi, xhdpi, etc) rather than the exact physical ppi. Bitmap graphics of an app are categorized by buckets, so for measurement consistency the dp is converted based on the density bucket rather than the real ppi. The drawback is that unlike a unit such as cm, the measurements are not guaranteed to be the same physical size on every screen ([example of such inconsistency)](https://stackoverflow.com/questions/9906520/android-which-ui-element-size-unit-to-use-if-dp-not-working/22713840). + +References: + +[Why aren't standard physical length units like mm used for touch UI layout?](https://stackoverflow.com/questions/19526525/why-arent-standard-physical-length-units-like-mm-used-for-touch-ui-layout) + +[Why “dp-to-pixel” ratio changes with the screen density, but not necessarily in direct proportion](https://stackoverflow.com/questions/9907842/why-dp-to-pixel-ratio-changes-with-the-screen-density-but-not-necessarily-in)" +7434865,"I want to do something like + +```vim +let colors = execute("":highlight"") + +``` + +This is obviously incorrect; all I can do is `execute("":highlight"")` which will open a window, but what I really need is to get the contents of that window into a variable — much like a `system()` call would do for external commands. Can this be done?",2011/09/15,"['https://Stackoverflow.com/questions/7434865', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/45959/']","There is a command called `:redir` that is specifically designed to +capture the output of one or more commands into a file, a register, or +a variable. The latter option is what we want in this case: + +``` +:redir => colors +:silent highlight +:redir END + +``` + +To see the complete list of the ways to invoke the command, refer to +`:help :redir`. See also [my answer](https://stackoverflow.com/a/5961837/254635) to the question “[Extending +a highlighting group in Vim](https://stackoverflow.com/q/5172323/254635)” for another practical use of `:redir`.","``` +let colors = lh#askvim#exe(':hi') + +``` + +[Which](https://github.com/LucHermitte/lh-vim-lib/blob/master/autoload/lh/askvim.vim#L59) just encapsulates [`:redir`](http://vimhelp.appspot.com/various.txt.html#%3aredir). Or even better: + +``` +let colors = lh#askvim#execute(':hi') + +``` + +[which](https://github.com/LucHermitte/lh-vim-lib/blob/master/autoload/lh/askvim.vim#L73) returns the result as a list variable, either through `:redir` if we have no choice, or through [`execute()`](http://vimhelp.appspot.com/eval.txt.html#execute%28%29) when it's defined. This new approach is to be prefered as it has less undesired side effects." +1390990,"Lets say I have the following array in JavaScript: + +``` +var skins = new Array('Light', 'Medium', 'Dark'); + +``` + +How would I go about checking to see what ID in that array (0, 1, or 2) has a matching value to a string I give it. So for example, if I look at a string of 'Medium', I should be returned the ID 1.",2009/09/07,"['https://Stackoverflow.com/questions/1390990', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/115182/']","You can use [Array.indexOf](http://eveloper.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/indexOf): + +``` +var index = skins.indexOf('Medium'); // 1 + +``` + +This function has been introduced in [JavaScript 1.6](https://developer.mozilla.org/en/New_in_JavaScript_1.6), but you can include it for compatibility with old browsers. + +Here is the algorithm used by Firefox: + +``` +if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function(elt /*, from*/) { + var len = this.length >>> 0; + + var from = Number(arguments[1]) || 0; + from = (from < 0) + ? Math.ceil(from) + : Math.floor(from); + if (from < 0) + from += len; + + for (; from < len; from++) { + if (from in this && + this[from] === elt) + return from; + } + return -1; + }; +} + +```","``` +Array.prototype.lastIndex= function(what){ + var L= this.length; + while(L){ + if(this[--L]=== what) return L; + } + return -1; +} + +Array.prototype.firstIndex= function(what){ + var i=0, L= this.length; + while(i + +Its like PostGIS is for PostgreSQL. All your SQLite functionality will work perfectly and unchanged, and you'll get spatial functions too." +6548940,"I have an SQLite database, which does not support trig functions. I would like to sort a set of lat,lng pairs in my table by distance as compared to a second lat,lng pair. I'm familiar with the standard haversine distance formula for sorting lat,lng pairs by distance. + +In this case I don't care particularly for precision, my points are separated by large distances, so I don't mind rounding off the distances by treating curves as straight lines. + +My question, is there a generally accepted formula for this kind of query? Remember no trig functions!",2011/07/01,"['https://Stackoverflow.com/questions/6548940', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/475329/']","If your points are within reasonable distance of each other (i.e. not across half the world, and not across the date line), you can make a correction for the difference between latitude and longitude (as a longitude degree is shorter, except at the Equator), and then just calculate the distance as if the earth was flat. + +As you just want to sort the values, you don't even have to use the square root, you can just add the squares of the differences. + +Example, where `@lat` and `@lng` is your current position, and `2` is the difference correction: + +``` +select * +from Points +order by (lat - @lat) * (lat - @lat) + ((lng - @lng) * 2) * ((lng - @lng) * 2) + +``` + +You can calculate the difference correction for a specific latitude as `1 / cos(lat)`. + +--- + +Cees Timmerman came up with this formula which also works across the date line: + +``` +pow(lat-lat2, 2) + pow(2 * min(abs(lon-lon2), 360 - abs(lon-lon2)), 2) + +```","Change ""\*"" with ""/"" works for me: + +select \* +from Points +order by (lat - @lat) \* (lat - @lat) + ((lng - @lng) / 2) \* ((lng - @lng) / 2)" +6548940,"I have an SQLite database, which does not support trig functions. I would like to sort a set of lat,lng pairs in my table by distance as compared to a second lat,lng pair. I'm familiar with the standard haversine distance formula for sorting lat,lng pairs by distance. + +In this case I don't care particularly for precision, my points are separated by large distances, so I don't mind rounding off the distances by treating curves as straight lines. + +My question, is there a generally accepted formula for this kind of query? Remember no trig functions!",2011/07/01,"['https://Stackoverflow.com/questions/6548940', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/475329/']","If you want proper spatial data in your model then use SpatiaLite, a spatially-enabled version of SQLite: + + + +Its like PostGIS is for PostgreSQL. All your SQLite functionality will work perfectly and unchanged, and you'll get spatial functions too.",You could always truncate the [Taylor series expansion](http://en.wikipedia.org/wiki/Cosine#Series_definitions) of sine and use the fact that sin^2(x)+cos^2(x)=1 to get the approximation of cosine. The only tricky part would be [using Taylor's theorem to estimate the number of terms that you'd need for a given amount of precision](http://en.wikipedia.org/wiki/Taylor%27s_theorem#Explicit_formulae_for_the_remainder). +6548940,"I have an SQLite database, which does not support trig functions. I would like to sort a set of lat,lng pairs in my table by distance as compared to a second lat,lng pair. I'm familiar with the standard haversine distance formula for sorting lat,lng pairs by distance. + +In this case I don't care particularly for precision, my points are separated by large distances, so I don't mind rounding off the distances by treating curves as straight lines. + +My question, is there a generally accepted formula for this kind of query? Remember no trig functions!",2011/07/01,"['https://Stackoverflow.com/questions/6548940', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/475329/']",You could always truncate the [Taylor series expansion](http://en.wikipedia.org/wiki/Cosine#Series_definitions) of sine and use the fact that sin^2(x)+cos^2(x)=1 to get the approximation of cosine. The only tricky part would be [using Taylor's theorem to estimate the number of terms that you'd need for a given amount of precision](http://en.wikipedia.org/wiki/Taylor%27s_theorem#Explicit_formulae_for_the_remainder).,"Change ""\*"" with ""/"" works for me: + +select \* +from Points +order by (lat - @lat) \* (lat - @lat) + ((lng - @lng) / 2) \* ((lng - @lng) / 2)" +6548940,"I have an SQLite database, which does not support trig functions. I would like to sort a set of lat,lng pairs in my table by distance as compared to a second lat,lng pair. I'm familiar with the standard haversine distance formula for sorting lat,lng pairs by distance. + +In this case I don't care particularly for precision, my points are separated by large distances, so I don't mind rounding off the distances by treating curves as straight lines. + +My question, is there a generally accepted formula for this kind of query? Remember no trig functions!",2011/07/01,"['https://Stackoverflow.com/questions/6548940', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/475329/']","If you want proper spatial data in your model then use SpatiaLite, a spatially-enabled version of SQLite: + + + +Its like PostGIS is for PostgreSQL. All your SQLite functionality will work perfectly and unchanged, and you'll get spatial functions too.","Change ""\*"" with ""/"" works for me: + +select \* +from Points +order by (lat - @lat) \* (lat - @lat) + ((lng - @lng) / 2) \* ((lng - @lng) / 2)" +23051085,"Is there any way that I can create a program where it gives input to another file and and collects its output? + +The best that google give me is this. And I tried to recreate (read: copying the code in some unknown manner (read: stabbing in the dark)) + +And I got this + +``` +import time +string=""file.py"" +process=subprocess.Popen(string,stdin=subprocess.PIPE,stdout=subprocess.PIPE); +process.stdin.write(""3 5"") +time.sleep(1) +print process.stdout.read() + +``` + +And it gives me error + +``` + File ""D:\Pekerjaan non website\IO\reader.py"", line 3, in + process=subprocess.Popen(string,stdin=subprocess.PIPE,stdout=subprocess.PIPE); +NameError: name 'subprocess' is not defined + +``` + +Can anybody tell me how to create that program. ( + +Note: I have no knowledge in this kind of program I/O or subprocess + +Note: It's up to you. Where you will explain this from my code or throw my code away and explain this from zero. + +Thank you beforehand. + +(PS: If my previous statement is confusing. My point is simple: Can you teach me? :))",2014/04/14,"['https://Stackoverflow.com/questions/23051085', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2872852/']","[subprocess](https://docs.python.org/2/library/subprocess.html) is a stdlib module that you need to import (the same way `time` is) - so you just need to: + +``` +import subprocess + +``` + +some time before you try to use the functions in it (usually, you want to do this near the top of your code, right underneath your current `import time`).","In addition to lvc's answer you should consider using [Popen.communicate()](https://docs.python.org/library/subprocess.html#subprocess.Popen.communicate). something like, + +``` +import subprocess +string=""file.py"" +process=subprocess.Popen(string,stdin=subprocess.PIPE,stdout=subprocess.PIPE) +res=process.communicate(""3 5"") +print res[0] + +``` + +In this way you don't have to use that sleep command.it'll Wait for process to terminate and return a tuple as (stdoutdata, stderrdata)." +59642732,"I have a Rails app which uses db `my_database_development` in my `config/database.yml`: + +``` +development: + <<: *default + database: my_database_development + +``` + +Works correctly when I run `rails server`. + +Now I want to use another db, so I change my `config/database.yml`: + +``` +development: + <<: *default + database: my_prev_database + +``` + +Now when I run `rails server`, they give me an `ActiveRecord::PendingMigrationError. To resolve this issue, run: bin/rails db:migrate RAILS_ENV=development`. When I run that command, `my_prev_database` gets cleared. I don't want that to happen. I want to use `my_prev_database` and all the data it has (which I backed up from somewhere) + +How can I switch database in Rails effectively? + +Thank you!",2020/01/08,"['https://Stackoverflow.com/questions/59642732', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3943491/']","When you switch database, you will have new `schema_migrations` table. In new database, `schema_migrations` is empty so Rails will think you have `pending_migration`. I think you need to re-migrate in your new database. You can use some feature like database dump to migrate date from old database to new database","I am now unable to replicate the problem above. (Not sure why, maybe I was copying over my database incorrectly.) + +Also, a possible resolution was to copy tables over individually from `my_prev_database` to `my_database_development` + +Note for anyone troubleshooting similar problems: +The commenters mentioned that, + - Running `rails db:migrate` shouldn't delete database data" +333882,"One problem that has always bothered me is the limitations of computers in studying math. With a chaotic dynamical system, for example, we know *mathematically* that they possess trajectories that never repeat themselves. But *computationally*, it seems that such an orbit can never be realized (since given the finite number of values that a computer can work with, periodicity seems inevitable). Yet, people study chaos with computers. They use mathematics of course, but considering the role that computers play in helping us gain intuition of complex systems, I wonder if there are aspects of a system we might totally miss by using computers in such a fashion. + +Thanks, +Jack",2013/03/18,"['https://math.stackexchange.com/questions/333882', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/62659/']","Numerical simulation of dynamic systems is indeed hard. + +One difficulty is that +it is implemented using floating-point arithmetic, +which is subject to rounding errors. +For chaotic dynamical systems, +the ones that have strange attractors, +rounding errors are potentially serious, +because +orbits starting at nearby points can diverge from each other exponentially. +Sometimes, +this strong sensitivity to initial conditions +does not affect the overall picture, +because numerically computed orbits are *shadowed* by exact orbits +that capture the typical behavior of the system. +However, +the truth is that +rounding errors affect numerical simulations of dynamical systems in +very complex ways [1]. +Well-conditioned dynamical systems may display chaotic numerical behavior [2,3]. +Conversely, +numerical methods can suppress chaos in some chaotic dynamical systems [3]. +*(Text extracted from [4].)* + +Nevertheless, there are computational methods for studying dynamical systems that work reliably even in the presence of rounding errors. See the work of Warwick Tucker, Zbigniew Galias, Pawel Pilarczyk, and others. + +[1] Corless, What good are numerical simulations of chaotic dynamical systems? *Comput. Math. Appl.* **28** (1994) 107–121. [MR1300684](http://www.ams.org/mathscinet-getitem?mr=1300684) + +[2] Adams et al., Computational chaos may be due to a single local error. *J. Comput. Phys.* **104** (1993) 241–250. [MR1198231](http://www.ams.org/mathscinet-getitem?mr=1198231) + +[3] Corless et al., Numerical methods can suppress chaos, *Physics Letters A* **157** (1991) 127-36. [DOI 10.1016/0375-9601(91)90404-V](http://www.sciencedirect.com/science/article/pii/037596019190404V) + +[4] Paiva et al., Robust visualization of strange attractors using affine arithmetic, *Computers & Graphics* **30** (2006), no. 6, 1020-1026. [DOI 10.1016/j.cag.2006.08.016](http://www.sciencedirect.com/science/article/pii/S0097849306001543)","It's a valid concern, and I have a historical anecdote to match it. When Mandelbrot published the first picture of the Mandelbrot set, the image was of poor quality due to the state of informatics back then. Seeing what he thought where ""speck of dusts"" on the picture, his editor erased them. Since then we obtained much better pictures of course, and we know that these specks of dust are ""islands"" that are linked to the main body of the Mandelbrot set by ""hairs"" of empty interior (which were not very visible in Mandelbrot's picture). + +The point is, computers are a tool to guide your intuition but you should not rely solely on them. Think of imperfect computer pictures/simulation as drawing a surface instead of a n-manifold : it helps understanding what is going on, but it works *together* with a more rigorous understanding of the objects you are manipulating. Otherwise you are indeed bound to make mistakes." +333882,"One problem that has always bothered me is the limitations of computers in studying math. With a chaotic dynamical system, for example, we know *mathematically* that they possess trajectories that never repeat themselves. But *computationally*, it seems that such an orbit can never be realized (since given the finite number of values that a computer can work with, periodicity seems inevitable). Yet, people study chaos with computers. They use mathematics of course, but considering the role that computers play in helping us gain intuition of complex systems, I wonder if there are aspects of a system we might totally miss by using computers in such a fashion. + +Thanks, +Jack",2013/03/18,"['https://math.stackexchange.com/questions/333882', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/62659/']","Numerical simulation of dynamic systems is indeed hard. + +One difficulty is that +it is implemented using floating-point arithmetic, +which is subject to rounding errors. +For chaotic dynamical systems, +the ones that have strange attractors, +rounding errors are potentially serious, +because +orbits starting at nearby points can diverge from each other exponentially. +Sometimes, +this strong sensitivity to initial conditions +does not affect the overall picture, +because numerically computed orbits are *shadowed* by exact orbits +that capture the typical behavior of the system. +However, +the truth is that +rounding errors affect numerical simulations of dynamical systems in +very complex ways [1]. +Well-conditioned dynamical systems may display chaotic numerical behavior [2,3]. +Conversely, +numerical methods can suppress chaos in some chaotic dynamical systems [3]. +*(Text extracted from [4].)* + +Nevertheless, there are computational methods for studying dynamical systems that work reliably even in the presence of rounding errors. See the work of Warwick Tucker, Zbigniew Galias, Pawel Pilarczyk, and others. + +[1] Corless, What good are numerical simulations of chaotic dynamical systems? *Comput. Math. Appl.* **28** (1994) 107–121. [MR1300684](http://www.ams.org/mathscinet-getitem?mr=1300684) + +[2] Adams et al., Computational chaos may be due to a single local error. *J. Comput. Phys.* **104** (1993) 241–250. [MR1198231](http://www.ams.org/mathscinet-getitem?mr=1198231) + +[3] Corless et al., Numerical methods can suppress chaos, *Physics Letters A* **157** (1991) 127-36. [DOI 10.1016/0375-9601(91)90404-V](http://www.sciencedirect.com/science/article/pii/037596019190404V) + +[4] Paiva et al., Robust visualization of strange attractors using affine arithmetic, *Computers & Graphics* **30** (2006), no. 6, 1020-1026. [DOI 10.1016/j.cag.2006.08.016](http://www.sciencedirect.com/science/article/pii/S0097849306001543)","The set of nonlinear systems that can be understood analytically is a measure zero set. Numerical experiments, and numerical algorithms, are a necessary tool in the study of these systems. But I agree that there is a need for more robust numerical tools for studying complex systems. + +Anyways, regarding chaotic sets, the ""set-oriented"" Perron-Frobenius operator-theoretic approach to numerically studying the densities and probability distributions on these systems rather than individual trajectories has been quite successful. See work by G.Froyland, M. Dellnitz, I. Mezic etc. On the other hand, topological quantities such as topological entropy are robust to numerical errors and don't rely on exact computation of trajectories, e.g. see work by P. Boyland etc. So there are other ways of understanding these systems than just numerically tracking individual trajectories." +34175959,"I was debugging a watch kit extension app with notification in the device and watch. +Then the watch app runs with the notification, and should start the companion app in the iPhone using WCSession, the iPhone prints only this in the log. +What can the problem to run the app. All settings are default offered by Xcode. The iPhone app is an old app, now I added watchkit extension. +using watchos 2 and iOS 9.1. Min target iOS 6.0 + +``` +iPhone SpringBoard[61] : [FBSystemService] Error launching com.appId: Disabled (5) + +```",2015/12/09,"['https://Stackoverflow.com/questions/34175959', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/312627/']","I had to remove this from the plist file. + +``` +UIApplicationExitsOnSuspend + + +```",Check the value for `WKCompanionAppBundleIdentifier` in your info.plist for watch kit app. It should match the bundle identifier of your application +31799751,"I have two lists of phone numbers. 1st list is a subset of 2nd list. I ran two different algorithms below to determine which phone numbers are contained in both of two lists. + +* Way 1: + + + Sortting 1st list: Arrays.sort(FirstList); + + Looping 2nd list to find matched element: If Arrays.binarySearch(FistList, 'each of 2nd list') then OK +* Way 2: + + + Convert 1st list into HashMap with key/valus is ('each of 1st list', Boolean.TRUE) + + Looping 2nd list to find matched element: If FirstList.containsKey('each of 2nd list') then OK + +It results in Way 2 ran within 5 seconds is faster considerably than Way 1 with 39 seconds. I can't understand the reason why. + +I appreciate your any comments.",2015/08/04,"['https://Stackoverflow.com/questions/31799751', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1517270/']",Because hashing is *O(1)* and binary searching is *O(log N)*.,"Look at the source code for HashMap: it creates and stores a hash for each added (key, value) pair, then the containsKey() method calculates a hash for the given key, and uses a very fast operation to check if it is already in the map. So most retrieval operations are very fast." +31799751,"I have two lists of phone numbers. 1st list is a subset of 2nd list. I ran two different algorithms below to determine which phone numbers are contained in both of two lists. + +* Way 1: + + + Sortting 1st list: Arrays.sort(FirstList); + + Looping 2nd list to find matched element: If Arrays.binarySearch(FistList, 'each of 2nd list') then OK +* Way 2: + + + Convert 1st list into HashMap with key/valus is ('each of 1st list', Boolean.TRUE) + + Looping 2nd list to find matched element: If FirstList.containsKey('each of 2nd list') then OK + +It results in Way 2 ran within 5 seconds is faster considerably than Way 1 with 39 seconds. I can't understand the reason why. + +I appreciate your any comments.",2015/08/04,"['https://Stackoverflow.com/questions/31799751', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1517270/']","`HashMap` relies on a very efficient algorithm called 'hashing' which has been in use for many years and is reliable and effective. Essentially the way it works is to split the items in the collection into much smaller groups which can be accessed extremely quickly. Once the group is located a less efficient search mechanism can be used to locate the specific item. + +Identifying the group for an item occurs via an algorithm called a 'hashing function'. In Java the hashing method is `Object.hashCode()` which returns an `int` representing the group. As long as `hashCode` is well defined for your class you should expect `HashMap` to be very efficient which is exactly what you've found. + +There's a very good discussion on the various types of `Map` and which to use at [Difference between HashMap, LinkedHashMap and TreeMap](https://stackoverflow.com/questions/2889777/difference-between-hashmap-linkedhashmap-and-treemap) + +My shorthand rule-of-thumb is to always use `HashMap` unless you can't define an appropriate `hashCode` for your keys or the items need to be ordered (either natural or insertion).","Look at the source code for HashMap: it creates and stores a hash for each added (key, value) pair, then the containsKey() method calculates a hash for the given key, and uses a very fast operation to check if it is already in the map. So most retrieval operations are very fast." +31799751,"I have two lists of phone numbers. 1st list is a subset of 2nd list. I ran two different algorithms below to determine which phone numbers are contained in both of two lists. + +* Way 1: + + + Sortting 1st list: Arrays.sort(FirstList); + + Looping 2nd list to find matched element: If Arrays.binarySearch(FistList, 'each of 2nd list') then OK +* Way 2: + + + Convert 1st list into HashMap with key/valus is ('each of 1st list', Boolean.TRUE) + + Looping 2nd list to find matched element: If FirstList.containsKey('each of 2nd list') then OK + +It results in Way 2 ran within 5 seconds is faster considerably than Way 1 with 39 seconds. I can't understand the reason why. + +I appreciate your any comments.",2015/08/04,"['https://Stackoverflow.com/questions/31799751', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1517270/']",Because hashing is *O(1)* and binary searching is *O(log N)*.,"Way 1: + +* Sorting: around `O(nlogn)` +* Search: around `O(logn)` + +Way 2: + +* Creating HashTable: `O(n)` for small density (no collisions) +* Contains: `O(1)`" +31799751,"I have two lists of phone numbers. 1st list is a subset of 2nd list. I ran two different algorithms below to determine which phone numbers are contained in both of two lists. + +* Way 1: + + + Sortting 1st list: Arrays.sort(FirstList); + + Looping 2nd list to find matched element: If Arrays.binarySearch(FistList, 'each of 2nd list') then OK +* Way 2: + + + Convert 1st list into HashMap with key/valus is ('each of 1st list', Boolean.TRUE) + + Looping 2nd list to find matched element: If FirstList.containsKey('each of 2nd list') then OK + +It results in Way 2 ran within 5 seconds is faster considerably than Way 1 with 39 seconds. I can't understand the reason why. + +I appreciate your any comments.",2015/08/04,"['https://Stackoverflow.com/questions/31799751', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1517270/']",Because hashing is *O(1)* and binary searching is *O(log N)*.,"`HashMap` relies on a very efficient algorithm called 'hashing' which has been in use for many years and is reliable and effective. Essentially the way it works is to split the items in the collection into much smaller groups which can be accessed extremely quickly. Once the group is located a less efficient search mechanism can be used to locate the specific item. + +Identifying the group for an item occurs via an algorithm called a 'hashing function'. In Java the hashing method is `Object.hashCode()` which returns an `int` representing the group. As long as `hashCode` is well defined for your class you should expect `HashMap` to be very efficient which is exactly what you've found. + +There's a very good discussion on the various types of `Map` and which to use at [Difference between HashMap, LinkedHashMap and TreeMap](https://stackoverflow.com/questions/2889777/difference-between-hashmap-linkedhashmap-and-treemap) + +My shorthand rule-of-thumb is to always use `HashMap` unless you can't define an appropriate `hashCode` for your keys or the items need to be ordered (either natural or insertion)." +31799751,"I have two lists of phone numbers. 1st list is a subset of 2nd list. I ran two different algorithms below to determine which phone numbers are contained in both of two lists. + +* Way 1: + + + Sortting 1st list: Arrays.sort(FirstList); + + Looping 2nd list to find matched element: If Arrays.binarySearch(FistList, 'each of 2nd list') then OK +* Way 2: + + + Convert 1st list into HashMap with key/valus is ('each of 1st list', Boolean.TRUE) + + Looping 2nd list to find matched element: If FirstList.containsKey('each of 2nd list') then OK + +It results in Way 2 ran within 5 seconds is faster considerably than Way 1 with 39 seconds. I can't understand the reason why. + +I appreciate your any comments.",2015/08/04,"['https://Stackoverflow.com/questions/31799751', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1517270/']","`HashMap` relies on a very efficient algorithm called 'hashing' which has been in use for many years and is reliable and effective. Essentially the way it works is to split the items in the collection into much smaller groups which can be accessed extremely quickly. Once the group is located a less efficient search mechanism can be used to locate the specific item. + +Identifying the group for an item occurs via an algorithm called a 'hashing function'. In Java the hashing method is `Object.hashCode()` which returns an `int` representing the group. As long as `hashCode` is well defined for your class you should expect `HashMap` to be very efficient which is exactly what you've found. + +There's a very good discussion on the various types of `Map` and which to use at [Difference between HashMap, LinkedHashMap and TreeMap](https://stackoverflow.com/questions/2889777/difference-between-hashmap-linkedhashmap-and-treemap) + +My shorthand rule-of-thumb is to always use `HashMap` unless you can't define an appropriate `hashCode` for your keys or the items need to be ordered (either natural or insertion).","Way 1: + +* Sorting: around `O(nlogn)` +* Search: around `O(logn)` + +Way 2: + +* Creating HashTable: `O(n)` for small density (no collisions) +* Contains: `O(1)`" +50493197,"currently, I'm practicing solidity. However, I'm a little confused about accessing a private variable in a contract. + +For example here; + +``` +address private a; +address private b; +mapping (bytes32 => uint) public people; +mapping (bytes32 => mapping(address => uint)) public listOfEmp; +bytes32[] public list; +bytes32 private z; + +``` + +I can access 'a' with + +``` +web3.eth.getStorageAt(""0x501..."", 0) + +``` + +How can I access 'z' here? From a different contract. + +Thank you",2018/05/23,"['https://Stackoverflow.com/questions/50493197', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6181020/']","You can access the storage of your contract even if it's private. + +Try this: + +``` +web3.eth.getStorageAt(""0x501..."", 5) + +``` + +If you want to access the map or array, check this document for layout of state variables: + +By the way, you should always use getProof to validate the value.","I don't believe you can. A private variable is meant to only be used within the contract in which it is defined. +See here: " +50493197,"currently, I'm practicing solidity. However, I'm a little confused about accessing a private variable in a contract. + +For example here; + +``` +address private a; +address private b; +mapping (bytes32 => uint) public people; +mapping (bytes32 => mapping(address => uint)) public listOfEmp; +bytes32[] public list; +bytes32 private z; + +``` + +I can access 'a' with + +``` +web3.eth.getStorageAt(""0x501..."", 0) + +``` + +How can I access 'z' here? From a different contract. + +Thank you",2018/05/23,"['https://Stackoverflow.com/questions/50493197', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6181020/']","Think of Ethereum as a process running on your machine or remotely. Using `web3.eth.getStorageAt` you read data from the process memory. In the same way you can read the data of every program on your computer. + +On other hands, high level programming languages like Java, C++ or Solidity frequently define access rules on variables and functions (private, protected, etc). But these rules only hold in the context of the program execution. For Solidity that context is the execution of transaction. + +It means that the private field is private only for other contracts trying to read it. But can be read by external (and pretty low-level) API's like `web3.eth.getStorageAt`.","I don't believe you can. A private variable is meant to only be used within the contract in which it is defined. +See here: " +50493197,"currently, I'm practicing solidity. However, I'm a little confused about accessing a private variable in a contract. + +For example here; + +``` +address private a; +address private b; +mapping (bytes32 => uint) public people; +mapping (bytes32 => mapping(address => uint)) public listOfEmp; +bytes32[] public list; +bytes32 private z; + +``` + +I can access 'a' with + +``` +web3.eth.getStorageAt(""0x501..."", 0) + +``` + +How can I access 'z' here? From a different contract. + +Thank you",2018/05/23,"['https://Stackoverflow.com/questions/50493197', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6181020/']","You can access the storage of your contract even if it's private. + +Try this: + +``` +web3.eth.getStorageAt(""0x501..."", 5) + +``` + +If you want to access the map or array, check this document for layout of state variables: + +By the way, you should always use getProof to validate the value.","Think of Ethereum as a process running on your machine or remotely. Using `web3.eth.getStorageAt` you read data from the process memory. In the same way you can read the data of every program on your computer. + +On other hands, high level programming languages like Java, C++ or Solidity frequently define access rules on variables and functions (private, protected, etc). But these rules only hold in the context of the program execution. For Solidity that context is the execution of transaction. + +It means that the private field is private only for other contracts trying to read it. But can be read by external (and pretty low-level) API's like `web3.eth.getStorageAt`." +68885669,"I have RGBA image from canvas and I use typedArray to remove alpha channel. + +``` +// data - arr from canvas. + +// [1,2,3,255, 1,2,3,255, 1,2,3,255,] +// R G B A R G B A R G B A + + const delta = 4; + const length = data.length; + const newLength = length - length / delta; + + const rgbArr = new Uint8Array(newLength); + + let j = 0; + + for (i = 0; i < data.length; i = i + delta) { + rgbArr[j] = data[i]; // R + rgbArr[j + 1] = data[i + 1]; // G + rgbArr[j + 2] = data[i + 2]; // B + j = j + 3; + } + + // rgbArr [1,2,3, 1,2,3, 1,2,3] + +``` + +I copy every 3 bytes to new Uint8Array. Can I do it in more optimized way without byte copying?",2021/08/22,"['https://Stackoverflow.com/questions/68885669', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2497351/']","Looks like your solution is pretty good. At least none of the alternatives I came up with so far comes anywhere close in performance. Run the snippet to see for yourself. + +**Updated** with Justin's suggestion using `.filter` -- elegant but not faster. + +```js +const data = new Uint8Array(1e8); + +const delta = 4; +const length = data.length; +const newLength = length - length / delta; + +const rgbArr = new Uint8Array(newLength); + +let j = 0; + +console.time('first'); +for (i = 0; i < data.length; i = i + delta) { + rgbArr[j] = data[i]; // R + rgbArr[j + 1] = data[i + 1]; // G + rgbArr[j + 2] = data[i + 2]; // B + j = j + 3; +} +console.timeEnd('first'); + +j = 0; +console.time('set'); +const rgbArr2 = new Uint8Array(newLength); +for (i = 0; i < data.length; i = i + delta) { + rgbArr2.set(data.slice(i, i+2), j); + j = j + 3; +} +console.timeEnd('set'); + +console.time('filter'); +data.filter((el,i) => { + return i % 4 !== 4 - 1 +}) +console.timeEnd('filter'); + +j = 0; +console.time('copyWithin'); +for (i = 0; i < data.length; i = i + delta) { + data.copyWithin(j, i, i+2); + j = j + 3; +} +console.timeEnd('copyWithin'); +``` + +Results: + +``` +first: 102.900ms +set: 1185.700ms +filter: 2779.800ms +copyWithin: 415.100ms + +```","filter would be good here + +```js +let array = new Uint8Array([1,2,3,255,1,2,3,255,1,2,3,255,1,2,3,255]) + +let filtered = array.filter((el,i) => { + return i % 4 !== 4 - 1 +}) + +console.log(filtered) +```" +16158995,"hi all ive been up all night trying to get this work, im trying to test the `$year` value against the date to make sure that it is not less than the current date + +here is my code at the moment it doesn't seem to work im not sure what im doing wrong + +``` + public function checkDateField($month, $day, $year) + { + if (!is_numeric($month) || !is_numeric($day) || !is_numeric($year) || !checkdate($month, $day, $year)< date(""m-d-y"")) { + $msg = '*Invalid date'; + + } + return $msg; + } + +```",2013/04/23,"['https://Stackoverflow.com/questions/16158995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2228587/']","you can run the example by providing a path to the arm-linux-gnueabi shared libs using the -L flag. + +``` +qemu-arm -L /usr/arm-linux-gnueabi/ + +``` + +also make sure the LD\_LIBRARY\_PATH is not set. + +``` +unset LD_LIBRARY_PATH + +```","``` +$ export QEMU_LD_PREFIX=/usr/arm-linux-gnueabi + +``` + +This works for me. +It's basically the same thing as: + +``` +$ qemu-arm -L /usr/arm-linux-gnueabi/ + +``` + +You can add it to the ~/.bashrc file so you don't have to type it everytime you open the terminal." +16158995,"hi all ive been up all night trying to get this work, im trying to test the `$year` value against the date to make sure that it is not less than the current date + +here is my code at the moment it doesn't seem to work im not sure what im doing wrong + +``` + public function checkDateField($month, $day, $year) + { + if (!is_numeric($month) || !is_numeric($day) || !is_numeric($year) || !checkdate($month, $day, $year)< date(""m-d-y"")) { + $msg = '*Invalid date'; + + } + return $msg; + } + +```",2013/04/23,"['https://Stackoverflow.com/questions/16158995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2228587/']","you can run the example by providing a path to the arm-linux-gnueabi shared libs using the -L flag. + +``` +qemu-arm -L /usr/arm-linux-gnueabi/ + +``` + +also make sure the LD\_LIBRARY\_PATH is not set. + +``` +unset LD_LIBRARY_PATH + +```","If you want to run **ARM** without Linux, then you need a different compiler (at least). `arm-linux-gnueabi-gcc` is a compiler for **Linux**. The compiler and `libc` are intimately linked. You will need a `newlib` compiler with a portability layer for *qemu*.[porting newlib](http://wiki.osdev.org/Porting_Newlib) + +See: [Balau](http://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/) and [Google newlib+qemu](https://www.google.ca/search?q=newlib+qemu). A `newlib` port is hosted at [Github](https://github.com/balau/arm-sandbox/tree/master/qemu-newlib) and seems to the same as the *Balau* blog. + +Typically a non-Linux gcc is called `arm-none-eabi-gcc`. The prefix *arm-none-eabi-* is recognized by some configure scripts." +16158995,"hi all ive been up all night trying to get this work, im trying to test the `$year` value against the date to make sure that it is not less than the current date + +here is my code at the moment it doesn't seem to work im not sure what im doing wrong + +``` + public function checkDateField($month, $day, $year) + { + if (!is_numeric($month) || !is_numeric($day) || !is_numeric($year) || !checkdate($month, $day, $year)< date(""m-d-y"")) { + $msg = '*Invalid date'; + + } + return $msg; + } + +```",2013/04/23,"['https://Stackoverflow.com/questions/16158995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2228587/']","you can run the example by providing a path to the arm-linux-gnueabi shared libs using the -L flag. + +``` +qemu-arm -L /usr/arm-linux-gnueabi/ + +``` + +also make sure the LD\_LIBRARY\_PATH is not set. + +``` +unset LD_LIBRARY_PATH + +```","A variant, which worked for me, was to pass the loader library directly and to specify the required library paths using the loader parameter `--library-path`. For example: + +``` +$ TOOLCHAIN_ROOT=/usr/local/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/arm-linux-gnueabihf +$ qemu-arm $TOOLCHAIN_ROOT/libc/lib/ld-linux-armhf.so.3 --library-path $TOOLCHAIN_ROOT/libc/lib/arm-linux-gnueabihf:/$TOOLCHAIN_ROOT/lib ./my_executable + +``` + +Or equivalently export `LD_LIBRARY_PATH` instead of using `--library-path`." +16158995,"hi all ive been up all night trying to get this work, im trying to test the `$year` value against the date to make sure that it is not less than the current date + +here is my code at the moment it doesn't seem to work im not sure what im doing wrong + +``` + public function checkDateField($month, $day, $year) + { + if (!is_numeric($month) || !is_numeric($day) || !is_numeric($year) || !checkdate($month, $day, $year)< date(""m-d-y"")) { + $msg = '*Invalid date'; + + } + return $msg; + } + +```",2013/04/23,"['https://Stackoverflow.com/questions/16158995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2228587/']","I also met this problem when running a C program with assembly code. My solution is to build the executable with the option ""-static"", for instance + +``` +arm-linux-gnueabi-gcc -static -g main.c square.s + +``` + +Then + +``` +qemu-arm a.out + +``` + +will not report the error saying ""can not find the /lib/ld-linux.so.3"". + +The only drawback is that the executable could be with a large size. But it's helpful when you just want to test your code. + +Of course, you can go with the method from Balau(see artless noise's answer). But if you don't want to feel frustrated by something like ""UART serial ports"" in this step, which is only to run a simple ""test"" function, go for a try of my fix.","A variant, which worked for me, was to pass the loader library directly and to specify the required library paths using the loader parameter `--library-path`. For example: + +``` +$ TOOLCHAIN_ROOT=/usr/local/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/arm-linux-gnueabihf +$ qemu-arm $TOOLCHAIN_ROOT/libc/lib/ld-linux-armhf.so.3 --library-path $TOOLCHAIN_ROOT/libc/lib/arm-linux-gnueabihf:/$TOOLCHAIN_ROOT/lib ./my_executable + +``` + +Or equivalently export `LD_LIBRARY_PATH` instead of using `--library-path`." +16158995,"hi all ive been up all night trying to get this work, im trying to test the `$year` value against the date to make sure that it is not less than the current date + +here is my code at the moment it doesn't seem to work im not sure what im doing wrong + +``` + public function checkDateField($month, $day, $year) + { + if (!is_numeric($month) || !is_numeric($day) || !is_numeric($year) || !checkdate($month, $day, $year)< date(""m-d-y"")) { + $msg = '*Invalid date'; + + } + return $msg; + } + +```",2013/04/23,"['https://Stackoverflow.com/questions/16158995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2228587/']","``` +$ export QEMU_LD_PREFIX=/usr/arm-linux-gnueabi + +``` + +This works for me. +It's basically the same thing as: + +``` +$ qemu-arm -L /usr/arm-linux-gnueabi/ + +``` + +You can add it to the ~/.bashrc file so you don't have to type it everytime you open the terminal.","A variant, which worked for me, was to pass the loader library directly and to specify the required library paths using the loader parameter `--library-path`. For example: + +``` +$ TOOLCHAIN_ROOT=/usr/local/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/arm-linux-gnueabihf +$ qemu-arm $TOOLCHAIN_ROOT/libc/lib/ld-linux-armhf.so.3 --library-path $TOOLCHAIN_ROOT/libc/lib/arm-linux-gnueabihf:/$TOOLCHAIN_ROOT/lib ./my_executable + +``` + +Or equivalently export `LD_LIBRARY_PATH` instead of using `--library-path`." +16158995,"hi all ive been up all night trying to get this work, im trying to test the `$year` value against the date to make sure that it is not less than the current date + +here is my code at the moment it doesn't seem to work im not sure what im doing wrong + +``` + public function checkDateField($month, $day, $year) + { + if (!is_numeric($month) || !is_numeric($day) || !is_numeric($year) || !checkdate($month, $day, $year)< date(""m-d-y"")) { + $msg = '*Invalid date'; + + } + return $msg; + } + +```",2013/04/23,"['https://Stackoverflow.com/questions/16158995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2228587/']","If you want to run **ARM** without Linux, then you need a different compiler (at least). `arm-linux-gnueabi-gcc` is a compiler for **Linux**. The compiler and `libc` are intimately linked. You will need a `newlib` compiler with a portability layer for *qemu*.[porting newlib](http://wiki.osdev.org/Porting_Newlib) + +See: [Balau](http://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/) and [Google newlib+qemu](https://www.google.ca/search?q=newlib+qemu). A `newlib` port is hosted at [Github](https://github.com/balau/arm-sandbox/tree/master/qemu-newlib) and seems to the same as the *Balau* blog. + +Typically a non-Linux gcc is called `arm-none-eabi-gcc`. The prefix *arm-none-eabi-* is recognized by some configure scripts.","A variant, which worked for me, was to pass the loader library directly and to specify the required library paths using the loader parameter `--library-path`. For example: + +``` +$ TOOLCHAIN_ROOT=/usr/local/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/arm-linux-gnueabihf +$ qemu-arm $TOOLCHAIN_ROOT/libc/lib/ld-linux-armhf.so.3 --library-path $TOOLCHAIN_ROOT/libc/lib/arm-linux-gnueabihf:/$TOOLCHAIN_ROOT/lib ./my_executable + +``` + +Or equivalently export `LD_LIBRARY_PATH` instead of using `--library-path`." +16158995,"hi all ive been up all night trying to get this work, im trying to test the `$year` value against the date to make sure that it is not less than the current date + +here is my code at the moment it doesn't seem to work im not sure what im doing wrong + +``` + public function checkDateField($month, $day, $year) + { + if (!is_numeric($month) || !is_numeric($day) || !is_numeric($year) || !checkdate($month, $day, $year)< date(""m-d-y"")) { + $msg = '*Invalid date'; + + } + return $msg; + } + +```",2013/04/23,"['https://Stackoverflow.com/questions/16158995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2228587/']","I also met this problem when running a C program with assembly code. My solution is to build the executable with the option ""-static"", for instance + +``` +arm-linux-gnueabi-gcc -static -g main.c square.s + +``` + +Then + +``` +qemu-arm a.out + +``` + +will not report the error saying ""can not find the /lib/ld-linux.so.3"". + +The only drawback is that the executable could be with a large size. But it's helpful when you just want to test your code. + +Of course, you can go with the method from Balau(see artless noise's answer). But if you don't want to feel frustrated by something like ""UART serial ports"" in this step, which is only to run a simple ""test"" function, go for a try of my fix.","If you want to run **ARM** without Linux, then you need a different compiler (at least). `arm-linux-gnueabi-gcc` is a compiler for **Linux**. The compiler and `libc` are intimately linked. You will need a `newlib` compiler with a portability layer for *qemu*.[porting newlib](http://wiki.osdev.org/Porting_Newlib) + +See: [Balau](http://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/) and [Google newlib+qemu](https://www.google.ca/search?q=newlib+qemu). A `newlib` port is hosted at [Github](https://github.com/balau/arm-sandbox/tree/master/qemu-newlib) and seems to the same as the *Balau* blog. + +Typically a non-Linux gcc is called `arm-none-eabi-gcc`. The prefix *arm-none-eabi-* is recognized by some configure scripts." +16158995,"hi all ive been up all night trying to get this work, im trying to test the `$year` value against the date to make sure that it is not less than the current date + +here is my code at the moment it doesn't seem to work im not sure what im doing wrong + +``` + public function checkDateField($month, $day, $year) + { + if (!is_numeric($month) || !is_numeric($day) || !is_numeric($year) || !checkdate($month, $day, $year)< date(""m-d-y"")) { + $msg = '*Invalid date'; + + } + return $msg; + } + +```",2013/04/23,"['https://Stackoverflow.com/questions/16158995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2228587/']","you can run the example by providing a path to the arm-linux-gnueabi shared libs using the -L flag. + +``` +qemu-arm -L /usr/arm-linux-gnueabi/ + +``` + +also make sure the LD\_LIBRARY\_PATH is not set. + +``` +unset LD_LIBRARY_PATH + +```","I also met this problem when running a C program with assembly code. My solution is to build the executable with the option ""-static"", for instance + +``` +arm-linux-gnueabi-gcc -static -g main.c square.s + +``` + +Then + +``` +qemu-arm a.out + +``` + +will not report the error saying ""can not find the /lib/ld-linux.so.3"". + +The only drawback is that the executable could be with a large size. But it's helpful when you just want to test your code. + +Of course, you can go with the method from Balau(see artless noise's answer). But if you don't want to feel frustrated by something like ""UART serial ports"" in this step, which is only to run a simple ""test"" function, go for a try of my fix." +16158995,"hi all ive been up all night trying to get this work, im trying to test the `$year` value against the date to make sure that it is not less than the current date + +here is my code at the moment it doesn't seem to work im not sure what im doing wrong + +``` + public function checkDateField($month, $day, $year) + { + if (!is_numeric($month) || !is_numeric($day) || !is_numeric($year) || !checkdate($month, $day, $year)< date(""m-d-y"")) { + $msg = '*Invalid date'; + + } + return $msg; + } + +```",2013/04/23,"['https://Stackoverflow.com/questions/16158995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2228587/']","``` +$ export QEMU_LD_PREFIX=/usr/arm-linux-gnueabi + +``` + +This works for me. +It's basically the same thing as: + +``` +$ qemu-arm -L /usr/arm-linux-gnueabi/ + +``` + +You can add it to the ~/.bashrc file so you don't have to type it everytime you open the terminal.","I solved the problem by copying the following libraries into /lib but I believe there should be a way better solution rather than this nasty solution I invented! + +``` +sudo cp /usr/arm-linux-gnueabi/lib/ld-linux.so.3 /lib +sudo cp /usr/arm-linux-gnueabi/lib/libgcc_s.so.1 /lib +sudo cp /usr/arm-linux-gnueabi/lib/libc.so.6 /lib + +``` + +Please let me know if there are other better solutions as I am interested to know." +16158995,"hi all ive been up all night trying to get this work, im trying to test the `$year` value against the date to make sure that it is not less than the current date + +here is my code at the moment it doesn't seem to work im not sure what im doing wrong + +``` + public function checkDateField($month, $day, $year) + { + if (!is_numeric($month) || !is_numeric($day) || !is_numeric($year) || !checkdate($month, $day, $year)< date(""m-d-y"")) { + $msg = '*Invalid date'; + + } + return $msg; + } + +```",2013/04/23,"['https://Stackoverflow.com/questions/16158995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2228587/']","I solved the problem by copying the following libraries into /lib but I believe there should be a way better solution rather than this nasty solution I invented! + +``` +sudo cp /usr/arm-linux-gnueabi/lib/ld-linux.so.3 /lib +sudo cp /usr/arm-linux-gnueabi/lib/libgcc_s.so.1 /lib +sudo cp /usr/arm-linux-gnueabi/lib/libc.so.6 /lib + +``` + +Please let me know if there are other better solutions as I am interested to know.","A variant, which worked for me, was to pass the loader library directly and to specify the required library paths using the loader parameter `--library-path`. For example: + +``` +$ TOOLCHAIN_ROOT=/usr/local/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/arm-linux-gnueabihf +$ qemu-arm $TOOLCHAIN_ROOT/libc/lib/ld-linux-armhf.so.3 --library-path $TOOLCHAIN_ROOT/libc/lib/arm-linux-gnueabihf:/$TOOLCHAIN_ROOT/lib ./my_executable + +``` + +Or equivalently export `LD_LIBRARY_PATH` instead of using `--library-path`." +32376066,"I have `registertemptable` in `Apache Spark` using `Zeppelin` below: + +``` +val hvacText = sc.textFile(""..."") + +case class Hvac(date: String, time: String, targettemp: Integer, actualtemp: Integer, buildingID: String) + +val hvac = hvacText.map(s => s.split("","")).filter(s => s(0) != ""Date"").map( + s => Hvac(s(0), + s(1), + s(2).toInt, + s(3).toInt, + s(6))).toDF() + +hvac.registerTempTable(""hvac"") + +``` + +After I have done with my queries with this temp table, how do I remove it ? + +I checked all docs and it seems I am getting nowhere. + +Any guidance ?",2015/09/03,"['https://Stackoverflow.com/questions/32376066', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5296786/']","**Spark 2.x** + +For temporary views you can use [`Catalog.dropTempView`](https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.catalog.Catalog@dropTempView%28viewName:String%29:Boolean): + +``` +spark.catalog.dropTempView(""df"") + +``` + +For global views you can use [`Catalog.dropGlobalTempView`](https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.catalog.Catalog@dropGlobalTempView%28viewName:String%29:Boolean): + +``` +spark.catalog.dropGlobalTempView(""df"") + +``` + +Both methods are safe to call if view doesn't exist and, since Spark 2.1, return boolean indicating if the operation succeed. + +**Spark 1.x** + +You can use [`SQLContext.dropTempTable`](https://spark.apache.org/docs/1.6.0/api/scala/index.html#org.apache.spark.sql.SQLContext): + +``` +scala.util.Try(sqlContext.dropTempTable(""df"")) + +``` + +It can be still used in Spark 2.0, but delegates processing to `Catalog.dropTempView` and is safe to use if table doesn't exist.","If you want to remove your temp table on zeppelin, try like this. + +``` +sqlc.dropTempTable(""hvac"") + +``` + +or + +``` +%sql DROP VIEW hvac + +``` + +And you can get the informations you need from spark API Docs()" +32376066,"I have `registertemptable` in `Apache Spark` using `Zeppelin` below: + +``` +val hvacText = sc.textFile(""..."") + +case class Hvac(date: String, time: String, targettemp: Integer, actualtemp: Integer, buildingID: String) + +val hvac = hvacText.map(s => s.split("","")).filter(s => s(0) != ""Date"").map( + s => Hvac(s(0), + s(1), + s(2).toInt, + s(3).toInt, + s(6))).toDF() + +hvac.registerTempTable(""hvac"") + +``` + +After I have done with my queries with this temp table, how do I remove it ? + +I checked all docs and it seems I am getting nowhere. + +Any guidance ?",2015/09/03,"['https://Stackoverflow.com/questions/32376066', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5296786/']","**Spark 2.x** + +For temporary views you can use [`Catalog.dropTempView`](https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.catalog.Catalog@dropTempView%28viewName:String%29:Boolean): + +``` +spark.catalog.dropTempView(""df"") + +``` + +For global views you can use [`Catalog.dropGlobalTempView`](https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.catalog.Catalog@dropGlobalTempView%28viewName:String%29:Boolean): + +``` +spark.catalog.dropGlobalTempView(""df"") + +``` + +Both methods are safe to call if view doesn't exist and, since Spark 2.1, return boolean indicating if the operation succeed. + +**Spark 1.x** + +You can use [`SQLContext.dropTempTable`](https://spark.apache.org/docs/1.6.0/api/scala/index.html#org.apache.spark.sql.SQLContext): + +``` +scala.util.Try(sqlContext.dropTempTable(""df"")) + +``` + +It can be still used in Spark 2.0, but delegates processing to `Catalog.dropTempView` and is safe to use if table doesn't exist.","in new ver (2.0 and latest) of spark. +one should use: `createOrReplaceTempView` in place of `registerTempTable` (depricated) +and corresponding method to deallocate is: `dropTempView` + +``` +spark.catalog.dropTempView(""temp_view_name"") //drops the table + +```" +32376066,"I have `registertemptable` in `Apache Spark` using `Zeppelin` below: + +``` +val hvacText = sc.textFile(""..."") + +case class Hvac(date: String, time: String, targettemp: Integer, actualtemp: Integer, buildingID: String) + +val hvac = hvacText.map(s => s.split("","")).filter(s => s(0) != ""Date"").map( + s => Hvac(s(0), + s(1), + s(2).toInt, + s(3).toInt, + s(6))).toDF() + +hvac.registerTempTable(""hvac"") + +``` + +After I have done with my queries with this temp table, how do I remove it ? + +I checked all docs and it seems I am getting nowhere. + +Any guidance ?",2015/09/03,"['https://Stackoverflow.com/questions/32376066', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5296786/']","**Spark 2.x** + +For temporary views you can use [`Catalog.dropTempView`](https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.catalog.Catalog@dropTempView%28viewName:String%29:Boolean): + +``` +spark.catalog.dropTempView(""df"") + +``` + +For global views you can use [`Catalog.dropGlobalTempView`](https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.catalog.Catalog@dropGlobalTempView%28viewName:String%29:Boolean): + +``` +spark.catalog.dropGlobalTempView(""df"") + +``` + +Both methods are safe to call if view doesn't exist and, since Spark 2.1, return boolean indicating if the operation succeed. + +**Spark 1.x** + +You can use [`SQLContext.dropTempTable`](https://spark.apache.org/docs/1.6.0/api/scala/index.html#org.apache.spark.sql.SQLContext): + +``` +scala.util.Try(sqlContext.dropTempTable(""df"")) + +``` + +It can be still used in Spark 2.0, but delegates processing to `Catalog.dropTempView` and is safe to use if table doesn't exist.","You can use sql drop table/view statement to remove it like below + +``` +spark.sql(""drop view hvac""); + +```" +32376066,"I have `registertemptable` in `Apache Spark` using `Zeppelin` below: + +``` +val hvacText = sc.textFile(""..."") + +case class Hvac(date: String, time: String, targettemp: Integer, actualtemp: Integer, buildingID: String) + +val hvac = hvacText.map(s => s.split("","")).filter(s => s(0) != ""Date"").map( + s => Hvac(s(0), + s(1), + s(2).toInt, + s(3).toInt, + s(6))).toDF() + +hvac.registerTempTable(""hvac"") + +``` + +After I have done with my queries with this temp table, how do I remove it ? + +I checked all docs and it seems I am getting nowhere. + +Any guidance ?",2015/09/03,"['https://Stackoverflow.com/questions/32376066', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5296786/']","If you want to remove your temp table on zeppelin, try like this. + +``` +sqlc.dropTempTable(""hvac"") + +``` + +or + +``` +%sql DROP VIEW hvac + +``` + +And you can get the informations you need from spark API Docs()","You can use sql drop table/view statement to remove it like below + +``` +spark.sql(""drop view hvac""); + +```" +32376066,"I have `registertemptable` in `Apache Spark` using `Zeppelin` below: + +``` +val hvacText = sc.textFile(""..."") + +case class Hvac(date: String, time: String, targettemp: Integer, actualtemp: Integer, buildingID: String) + +val hvac = hvacText.map(s => s.split("","")).filter(s => s(0) != ""Date"").map( + s => Hvac(s(0), + s(1), + s(2).toInt, + s(3).toInt, + s(6))).toDF() + +hvac.registerTempTable(""hvac"") + +``` + +After I have done with my queries with this temp table, how do I remove it ? + +I checked all docs and it seems I am getting nowhere. + +Any guidance ?",2015/09/03,"['https://Stackoverflow.com/questions/32376066', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5296786/']","in new ver (2.0 and latest) of spark. +one should use: `createOrReplaceTempView` in place of `registerTempTable` (depricated) +and corresponding method to deallocate is: `dropTempView` + +``` +spark.catalog.dropTempView(""temp_view_name"") //drops the table + +```","You can use sql drop table/view statement to remove it like below + +``` +spark.sql(""drop view hvac""); + +```" +20344535,"Here is the sample code. Since there is not source to backtrack given a code get the pattern. + +``` +ResultSet rs = stmt.executeQuery(""SELECT a, b, c FROM Table1""); + + while (rs.next()) { + int x = rs.getInt(""a""); + String s = rs.getString(""b""); + float f = rs.getFloat(""c""); + } + +``` + +I think this is some pattern, has a name and has more applications which I am unaware about. Let me know the pattern name ?",2013/12/03,"['https://Stackoverflow.com/questions/20344535', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2458372/']","A ResultSet is an instance of the [Iterator](http://en.wikipedia.org/wiki/Iterator_pattern) pattern. But not the `java.util.Iterator` interface. + +[Iterator as ArrayList http://ts1.mm.bing.net/th?id=H.4589598971789992&pid=15.1](http://ts1.mm.bing.net/th?id=H.4589598971789992&pid=15.1)","the patten name is ""Iterator Pattern""." +5384157,"I have zero experience with OpenGL and a small amount of experience with Objective-C, but I'm fairly decent with C++. What resources should I be looking at to start learning how to use OpenGL within Objective-C? + +I read somewhere at some point that starting out with NSOpenGLView is a good start.",2011/03/21,"['https://Stackoverflow.com/questions/5384157', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/657850/']","Given your affinity for C++, [this](http://iphone-3d-programming.labs.oreilly.com/) will probably be the most appealing resource for you. It covers OpenGL ES 1.1 and 2.0, so you'll get all you need to know. + +Personally, I really enjoy [this set of tutorials](http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html), which avoid C++ and are quite well written. It only covers 1.1, but that may be an easier place to start anyway.",[NeHe's tutorials](http://nehe.gamedev.net/) include full Cocoa versions of all the early tutorials. +5384157,"I have zero experience with OpenGL and a small amount of experience with Objective-C, but I'm fairly decent with C++. What resources should I be looking at to start learning how to use OpenGL within Objective-C? + +I read somewhere at some point that starting out with NSOpenGLView is a good start.",2011/03/21,"['https://Stackoverflow.com/questions/5384157', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/657850/']","Honestly, you're probably not going to need to know much Objective-C for dealing with OpenGL, just C. OpenGL is C-based, so you don't need to learn anything new, language-wise, to deal with it. Objective-C knowledge is only really necessary when you plan on using Cocoa to build up your interface. Even then, the language is not hard to pick up if you're coming from a solid C / C++ background. + +I highly recommend the book [iPhone 3D Programming](http://oreilly.com/catalog/9780596804831?cmp=il-orm-ofps-iphone3d) that Matt's first resource is based on. Even though you're asking about desktop OpenGL, and this book covers OpenGL ES, much is shared between the two APIs. The book does a great job of starting with simple concepts and fundamentals, and then building to more advanced topics like environment mapping and custom shaders. The author uses C++ as his base language for the book, so you should be familiar with even the most complex code he shows. OpenGL ES is effectively a subset of OpenGL, so almost everything translates across to the desktop. + +Within a desktop Cocoa application, you have two ways of presenting OpenGL content: NSOpenGLView and CAOpenGLLayer. The former is an older NSView subclass that you can customize to place your rendering code within. The latter is a Core Animation CALayer that also acts as an OpenGL rendering target, but it give you a little more flexibility in how you can overlay other items on top of the OpenGL content. Getting the display set up for your OpenGL rendering will not take a lot of effort, with most of your time being spent on your OpenGL code. + +You might want to pick apart some of Apple's sample applications, such as [GLSL Showpiece](http://developer.apple.com/library/mac/#samplecode/GLSLShowpiece/Introduction/Intro.html#//apple_ref/doc/uid/DTS10003935), [Cocoa OpenGL](http://developer.apple.com/library/mac/#samplecode/CocoaGL/Introduction/Intro.html#//apple_ref/doc/uid/DTS10004501), [GLEssentials](http://developer.apple.com/library/mac/#samplecode/GLEssentials/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010104), and [CubePuzzle](http://developer.apple.com/library/mac/#samplecode/CubePuzzle/Introduction/Intro.html#//apple_ref/doc/uid/DTS10000521), among the other OpenGL examples they have in the developer center.","Given your affinity for C++, [this](http://iphone-3d-programming.labs.oreilly.com/) will probably be the most appealing resource for you. It covers OpenGL ES 1.1 and 2.0, so you'll get all you need to know. + +Personally, I really enjoy [this set of tutorials](http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html), which avoid C++ and are quite well written. It only covers 1.1, but that may be an easier place to start anyway." +5384157,"I have zero experience with OpenGL and a small amount of experience with Objective-C, but I'm fairly decent with C++. What resources should I be looking at to start learning how to use OpenGL within Objective-C? + +I read somewhere at some point that starting out with NSOpenGLView is a good start.",2011/03/21,"['https://Stackoverflow.com/questions/5384157', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/657850/']","Honestly, you're probably not going to need to know much Objective-C for dealing with OpenGL, just C. OpenGL is C-based, so you don't need to learn anything new, language-wise, to deal with it. Objective-C knowledge is only really necessary when you plan on using Cocoa to build up your interface. Even then, the language is not hard to pick up if you're coming from a solid C / C++ background. + +I highly recommend the book [iPhone 3D Programming](http://oreilly.com/catalog/9780596804831?cmp=il-orm-ofps-iphone3d) that Matt's first resource is based on. Even though you're asking about desktop OpenGL, and this book covers OpenGL ES, much is shared between the two APIs. The book does a great job of starting with simple concepts and fundamentals, and then building to more advanced topics like environment mapping and custom shaders. The author uses C++ as his base language for the book, so you should be familiar with even the most complex code he shows. OpenGL ES is effectively a subset of OpenGL, so almost everything translates across to the desktop. + +Within a desktop Cocoa application, you have two ways of presenting OpenGL content: NSOpenGLView and CAOpenGLLayer. The former is an older NSView subclass that you can customize to place your rendering code within. The latter is a Core Animation CALayer that also acts as an OpenGL rendering target, but it give you a little more flexibility in how you can overlay other items on top of the OpenGL content. Getting the display set up for your OpenGL rendering will not take a lot of effort, with most of your time being spent on your OpenGL code. + +You might want to pick apart some of Apple's sample applications, such as [GLSL Showpiece](http://developer.apple.com/library/mac/#samplecode/GLSLShowpiece/Introduction/Intro.html#//apple_ref/doc/uid/DTS10003935), [Cocoa OpenGL](http://developer.apple.com/library/mac/#samplecode/CocoaGL/Introduction/Intro.html#//apple_ref/doc/uid/DTS10004501), [GLEssentials](http://developer.apple.com/library/mac/#samplecode/GLEssentials/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010104), and [CubePuzzle](http://developer.apple.com/library/mac/#samplecode/CubePuzzle/Introduction/Intro.html#//apple_ref/doc/uid/DTS10000521), among the other OpenGL examples they have in the developer center.",[NeHe's tutorials](http://nehe.gamedev.net/) include full Cocoa versions of all the early tutorials. +59770828,"How can I create a script of inserts for my sybase to oracle Migration? The Migration wizard only gives me the option to migrate procedures and triggers and such. But there is no select for just tables. When I try to migrate tables offline and move data. the datamove/ folder is empty. I would also want to only migrate specific tables (ones with long identifiers) because i was able to migrate the rest with Copy to Oracle. +I must also note that i do not want to upgrade to an new version of oracle. Currently on ~12.1 so i need to limit the identifiers. + +How can I get the offline scripts for table inserts?",2020/01/16,"['https://Stackoverflow.com/questions/59770828', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10847608/']","You can find solution for your problem in the following codesandbox + + +Change prop names as it fits your code base, but the logic is solid","You could do something like this, using the state hook in the App component + +``` +export default function App() { + const items = [ + { id: 1, title: 'First Accordion', content: 'Hello' }, + { id: 2, title: 'Click me', content: 'Hello 2' }, + { id: 3, title: 'Third Accordion Accordion', content: 'Hello 3' }, + ] + + const [selectedItem, setSelectedItem] = useState(1) + + const handleClick = id => { + setSelectedItem(id) + } + return ( +
+ {items.map(x => { + return ( + +

{x.title}

+
+ ) + })} +
+ ); +} + +``` + +Then your accordion component is a bit simpler + +``` +class Accordion extends React.Component { + accToggle() { + this.props.onClick(this.props.id); + } + + sectionClasses() { + let classes = ""accordion""; + classes += this.props.open ? "" sec-on"" : """"; + classes += ""sec-underway""; + + return classes.trim(); + } + + render() { + return ( +
+
+

{this.props.title}

+
+ +
+
+ +
{this.props.children}
+
+ ); + } +} + +Accordion.defaultProps = { + open: false +}; + +Accordion.propTypes = { + id: PropTypes.number.isRequired, + children: PropTypes.any, + onFocus: PropTypes.func, + progress: PropTypes.oneOfType([ + PropTypes.number, + PropTypes.string, + PropTypes.bool + ]), + title: PropTypes.string, + open: PropTypes.bool +}; + +export default Accordion; + +``` + +The accordion calls a function on the app component, which updates the state and the display logic is passed down in the props" +353015,"Specifically, when a post is flagged as **in need of moderator intervention** what does it mean? + +A while ago, this happened: + +--- + +[![enter image description here](https://i.stack.imgur.com/lPfVU.png)](https://i.stack.imgur.com/lPfVU.png) + +--- + +Little backstory: + +I asked a question which was *related* to a question supplied in the comments but did not answer me. Following that, I received a private feedback to review if that answers my questions or not. Obviously, I clicked on no and pressed submit. Also notified the user who marked it as duplicate and edited the question to make it look pointed towards the author's intent(me). After a few hours, I saw my post taken down as a [duplicate] and **Comments on the post deleted?**. Upon flagging the post for moderator intervention, it was declined with the above message. No *custom comments* were put as well. + +This of course looks like a custom message, but was my flag a standard one? + +--- + +I have read the thread +[What are acceptable reasons for flagging as ""Requires Moderator attention""?](https://meta.stackexchange.com/questions/10848/what-are-acceptable-reasons-for-flagging-as-requires-moderator-attention) + +but unfortunately it's a continuation to : +[Is ""Please Vote to Close"" a valid use for Flag - Requires Moderation Attention](https://meta.stackexchange.com/questions/10781/is-please-vote-to-close-a-valid-use-for-flag-requires-moderation-attention) + +and has answers which genuinely could not address what I have asked.",2020/08/14,"['https://meta.stackexchange.com/questions/353015', 'https://meta.stackexchange.com', 'https://meta.stackexchange.com/users/826559/']","I've looked through a few of your flags and I think you need to rethink how flags work on our sites and what moderators are and do. + +Flags - particularly moderator attention flags - are designed to draw attention of the moderators when there is something that needs special treatment. These are generally rare flags and users should attempt to use the standard flags first as some of these are given to community members to review rather than the very few moderators on the site. + +A question getting closed or marked as a duplicate is not generally something a moderator should be asked to look into. If you want to understand why a post was closed or get a post reopened, flag to reopen the post or go to the per-site meta for the site you're using at the time - so if you're on [Physics](https://physics.stackexchange.com/), go to [Physics Meta](https://physics.meta.stackexchange.com/). On some sites, you may also be able to talk to other users about it in chat. + +If you see comments deleted - firstly, question whether they were necessary. Comments aren't intended to be permanent, so it's quite common for them to be removed by moderators... and users can, themselves remove their own comments, so it's possible that mods had nothing to do with it at all. Again, if you have questions about comments being removed, go to meta, don't use flags. + +Additionally, our sites are community edited, so edits are normal. If you find an edit changes your question drastically in a way you didn't intend, you're able to roll it back but don't get into a ""rollback war"" with someone who is repeatedly editing your post. Try to understand why the edits were made and whether they are making your post easier to understand or adding missing details. If you can, engage them in the comments to understand the edits they're making or take it to Meta to discuss if it's a bigger issue. + +All in all, use chat and meta more, use flags less. Moderators are not generally going to unilaterally reopen your questions when they get closed - that's for the community to decide, so start communicating with the community, not the moderators.","> +> Also notified the user who marked it as duplicate and edited the question to make it look pointed towards the author's intent(me). +> +> +> + +That's unfortunate, but the correct procedure here is to [edit your question to clarify why it's not a duplicate](https://meta.stackexchange.com/q/194476/295232). That's something you **need** to do yourself, not the task of ♦ moderators. Why? Because if everybody would do that, the workload for them would be unbearable. Therefore, a moderator flag is not warranted for these cases. Perhaps the response you got isn't entirely appropriate, but since your flag message is rather vague, chances are the moderator didn't understand what you wanted them to do. + +> +> Comments on the post deleted? +> +> +> + +The ""Does this answer your question"" comment is automatically deleted when the question is closed as a duplicate. If you clarified why you think it's not a duplicate in the comments, please edit that information into the question itself; comments are [temporary by nature](/help/privileges/comment) and are sometimes cleaned up." +60485133,"I got to find that we could read the contents of a file into a std::vector like this: + +``` + ifstream fin(..., ios::in); + std::vector buf( + std::istreambuf_iterator(fin), + std::istreambuf_iterator()); + +``` + +Will this method cause plenty of memory reallocation like when I call `buf.push_back();` for many times? What is the fastest or best method to read a file into a `std::vector`? + +Edit: +By the way, I find there is a method to read a file into a stringstream: + +``` +stringstream ss; +ifstream fin(..., ios::in); +fin >> ss.rdbuf(); + +``` + +Will this method have same problem of memory reallocating ?",2020/03/02,"['https://Stackoverflow.com/questions/60485133', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10132474/']","[`std::istreambuf_iterator`](https://en.cppreference.com/w/cpp/iterator/istreambuf_iterator) is an input iterator, so the distance between begin and end is not known in advance. There will be several reallocations during the constructor, unless the file is very small. For a random access iterator the distance would be known and in such case the constructor could avoid the extra memory allocations. + +If you roughly know the size of the file, you can use [`reserve()`](https://en.cppreference.com/w/cpp/container/vector/reserve) before reading: + +``` +std::vector buf; +buf.reserve(file_size); +buf.insert(buf.end(), std::istreambuf_iterator(fin), + std::istreambuf_iterator()); + +```","Vector keeps the data allocated sequentially. +When a new element is added it may have no memory free after the last element, then it need to move all the data to a place in memory where it has enough room to the old and new data. + +The best solution is give a buffer to vector with the follow command: vector::reserve(size); + +Your code could be: + +``` +std::vector buf; +buf.reserve(10000); +buf.assign(std::istreambuf_iterator(fin), + std::istreambuf_iterator()); +buf.shrink_to_fit(); //free the unused memory + +```" +66880148,"I have a custom function and I would like to evaluate its media performance. For this, I would like to loop by executing my function a certain number of times. I want to do this because I see that the runtime is very unstable. + +A typical execution measuring the execution time would look something like this + +``` +@time my_function() + +``` + +or + +``` +@time begin +my_function() +end + +``` + +In this particular case, I only visualize the execution time, but I don't know how to register the execution time to allocate the time for each iteration in a vector. For example, I would like something like this + +``` +vector_time = 1:100 +for i in 1:100 + @time my_function() + vector_time[i] = get_time_i # register the time of the i-th iteration +end + +```",2021/03/31,"['https://Stackoverflow.com/questions/66880148', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/12005038/']",Try [`@elapsed`](https://docs.julialang.org/en/v1/base/base/#Base.@elapsed) instead to get the execution time in seconds.,"If you are timing multiple sections of your code at once, you can also use [TimerOutputs.jl](https://github.com/KristofferC/TimerOutputs.jl), which I've found to be very convenient. It automatically computes average runtimes and % total runtime." +593683,"Sometimes it's quite confusing when it comes to determining how to answer a probability question. Confusions always arise as of whether I should multiply/add or make conditional the probabilities. For example the following: + +> +> Consider influenza epidemics for two parent heterosexual families. +> Suppose that the probability is 15% that at least one of the parents +> has contracted the disease. The probability that the father has +> contracted influenza is 10% while that the mother contracted the +> disease is 9%. What is the probability that both contracted influenza +> expressed as a whole number percentage? +> +> +> + +Let P(F) = Probability that father catches it; P(M) for mother. + +I thought the P(both catch it) = P(F)P(M), but the answer is P(at least 1 catch it)= P(F)+P(M)-P(F AND M) and solve for P(F AND M). + +My first question is that: I find it particularly difficult to differentiate between addition or multiplication rule when it comes to probabilities from independent events. + +My second question is that: I'm also thinking if I'm to use P(at least 1 catch it)= P(F)+P(M)-P(F AND M), I would have make something like: P(at least 1 catch it)= P(F)P(NOT M)+P(M)P(NOT F)+P(F AND M). But it seems the P(F AND M) from two cases are not equivalent? Aren't these 2 expressions representing the same thing? + +My third question, even when I calculate P(at least 1 catch it) = 1-P(both not catching it) = 1-P(NOT F)\*P(NOT M), P(at least 1 catch it) does not equal to .15 given in the question. What's wrong with my calculation? + +Are there any rules in governing which approach to use when solving a probability problem?",2022/10/27,"['https://stats.stackexchange.com/questions/593683', 'https://stats.stackexchange.com', 'https://stats.stackexchange.com/users/331633/']","Let's follow up on GlenB's advice and make those [Venn diagrams](https://en.m.wikipedia.org/wiki/Venn_diagram). We do this below with the heterosexual stereotype colours representing mother sick with red/pink and dad sick with blue. + +[![Venn diagram intro](https://i.stack.imgur.com/2tPUI.jpg)](https://i.stack.imgur.com/2tPUI.jpg) + +With the two variables mother and father you can create 4 different disjoint situations. + +``` + father sick and not mom sick +not father sick and mom sick + father sick and mom sick +not father sick and not mom sick + +``` + +It is with those 4 situations that you can perform additive computations. + +Intuitively you want to figure out how much the two situations mom sick and father sick overlap (those two may not need to be jisjoint) + +[![different overlap](https://i.stack.imgur.com/xr1J1.jpg)](https://i.stack.imgur.com/xr1J1.jpg) + +Your formula + +> +> but the answer is P(at least 1 catch it)= P(F)+P(M)-P(F AND M) and solve for P(F AND M) +> +> +> + +Stems from the following algebra + +[![algebra solution](https://i.stack.imgur.com/j9e5t.jpg)](https://i.stack.imgur.com/j9e5t.jpg) + +You can compare it to a situation with 4 unknowns (the area's/probability of the 4 disjoint pieces) and you try to figure out the values by means of 4 equations. You know + +``` +mom sick +0.09 = P(mom sick & not dad sick) + P(mom sick & dad sick) + +dad sick +0.10 = P(mom sick & dad sick) + P(not mom sick & dad sick) + +one or more sick +0.15 = P(mom sick & dad sick) + P(not mom sick & dad sick) + P(mom sick & dad sick) + +total probability must be one +1.00 = P(mom sick & dad sick) + P(not mom sick & dad sick) + P(mom sick & dad sick) + P(not mom sick & not dad sick) + +``` + +One final figure to explain the product and sum rule: + +[![explanation sum and product rule](https://i.stack.imgur.com/zkt8y.jpg)](https://i.stack.imgur.com/zkt8y.jpg) + +* When events are disjoint then you can use summation $$P(A \text{ or } B) = P(A) + P(B)$$ note that 'father sick' and 'mom sick' do not meed to be disjoint events. You still get a sum of those events in your solution, but that is due to algebra where we combine multiple equations. +* When events are independent then you can use the product $$P(A \text{ and } B) = P(A) \cdot P(B)$$ The independence means that the ratio's of the area's/probabilities are unaffected by the other variable. In the image you see the ratio's of 'mom sick' for different states of 'dad sick' whether or not dad is sick the ratio remains the same.","> +> My first question is that: I find it particularly difficult to differentiate between addition or multiplication rule when it comes to probabilities from independent events. +> +> +> + +That's not a question (you don't ask anything), but the answer to what I assume is your implied question is simple: there *isn't an addition rule* for independent events. + +The ""addition rule"" $P(A \text{ or } B) = P(A)+P(B)$ is for *mutually exclusive events*. + +Draw a Venn diagram, from which it's obvious why there's another term there for non-mutually exclusive events (representing the overlap which gets counted twice, once in A and once in B, whereupon you must then subtract one of the overlaps back off again). + +> +> My third question, even when I calculate P(at least 1 catch it) = 1-P(both not catching it) = 1-P(NOT F)\*P(NOT M), P(at least 1 catch it) does not equal to .15 given in the question. What's wrong with my calculation? +> +> +> + +Note that the multiplication rule requires independence. + +Did you make sure the events whose probability you multiplied were independent? + +--- + +Rules for union (""OR"") and intersection (""AND"") are: + +(i) $P(A \text{ or } B) = P(A) + P(B) - P(A \text{ and } B)$ + +(ii) $P(A \text{ and } B) = P(A)\times P(B|A)$ $\:$ ([General product rule](https://en.wikipedia.org/wiki/Chain_rule_%28probability%29#Two_events)) + +*If* you have mutually exclusive events, the third term on the RHS in (i) is $0$, whence ""addition rule for mutually exclusive events"". + +*If* you have independent events, the second term on the RHS in (ii) is equal to $P(B)$, whence ""multiplication rule for independent events""." +32126987,"Where can i find tutorials about advanced borders and box-shadows in css? + +I discovered shape of css but cant explanation this: + +```css +#space-invader{ + + box-shadow: + 0 0 0 1em red, + 0 1em 0 1em red, + -2.5em 1.5em 0 .5em red, + 2.5em 1.5em 0 .5em red, + -3em -3em 0 0 red, + 3em -3em 0 0 red, + -2em -2em 0 0 red, + 2em -2em 0 0 red, + -3em -1em 0 0 red, + -2em -1em 0 0 red, + 2em -1em 0 0 red, + 3em -1em 0 0 red, + -4em 0 0 0 red, + -3em 0 0 0 red, + 3em 0 0 0 red, + 4em 0 0 0 red, + -5em 1em 0 0 red, + -4em 1em 0 0 red, + 4em 1em 0 0 red, + 5em 1em 0 0 red, + -5em 2em 0 0 red, + 5em 2em 0 0 red, + -5em 3em 0 0 red, + -3em 3em 0 0 red, + 3em 3em 0 0 red, + 5em 3em 0 0 red, + -2em 4em 0 0 red, + -1em 4em 0 0 red, + 1em 4em 0 0 red, + 2em 4em 0 0 red; + + background: red; + width: 1em; + height: 1em; + overflow: hidden; + + margin: 50px 0 70px 65px; + } +``` + +```html +
+``` + +[Link](https://css-tricks.com/examples/ShapesOfCSS/) + +Can anyone explain me how it works? +Are this for all browsers? + +Thanx.",2015/08/20,"['https://Stackoverflow.com/questions/32126987', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5230154/']","You could use a mutex (one per car). + +Lock: before changing location of the associated car + +Unlock: after changing location of the associated car + +Lock: before getting location of the associated car + +Unlock: after done doing work that relies on that location being up to date","There are several ways to do this. Which way you choose depends a lot on the number of cars, the frequency of updates and position requests, the expected response time, and how accurate (up to date) you want the position reports to be. + +The easiest way to handle this is with a simple mutex (lock) that allows only one thread at a time to access the data structure. Assuming you're using a dictionary or hash map, your code would look something like this: + +``` +Map Cars = new Map(...) +Mutex CarsMutex = new Mutex(...) + +Location GetLocation(carKey) +{ + acquire mutex + result = Cars[carKey].Location + release mutex + return result +} + +``` + +You'd do that for Add, Remove, Update, etc. Any method that reads or updates the data structure would require that you acquire the mutex. + +If the number of queries far outweighs the number of updates, then you can do better with a reader/writer lock instead of a mutex. With an RW lock, you can have an unlimited number of readers, OR you can have a single writer. With that, querying the data would be: + +``` +acquire reader lock +result = Cars[carKey].Location +release reader lock +return result + +``` + +And Add, Update, and Remove would be: + +``` +acquire writer lock +do update +release writer lock + +``` + +Many runtime libraries have a concurrent dictionary data structure already built in. .NET, for example, has `ConcurrentDictionary`. With those, you don't have to worry about explicitly synchronizing access with a Mutex or RW lock; the data structure handles synchronization for you, either with a technique similar to that shown above, or by implementing lock-free algorithms. + +As mentioned in comments, a relational database can handle this type of thing quite easily and can scale to a very large number of requests. Modern relational databases, properly constructed and with sufficient hardware, are surprisingly fast and can handle huge amounts of data with very high throughput. + +There are other, more involved, methods that can increase throughput in some situations depending on what you're trying to optimize. For example, if you're willing to have some latency in reported position, then you could have position requests served from a list that's updated once per minute (or once every five minutes). So position requests are fulfilled immediately with no lock required from a static copy of the list that's updated once per minute. Updates are queued and once per minute a new list is created by applying the updates to the old list, and the new list is made available for requests. + +There are *many* different ways to solve your problem." +32126987,"Where can i find tutorials about advanced borders and box-shadows in css? + +I discovered shape of css but cant explanation this: + +```css +#space-invader{ + + box-shadow: + 0 0 0 1em red, + 0 1em 0 1em red, + -2.5em 1.5em 0 .5em red, + 2.5em 1.5em 0 .5em red, + -3em -3em 0 0 red, + 3em -3em 0 0 red, + -2em -2em 0 0 red, + 2em -2em 0 0 red, + -3em -1em 0 0 red, + -2em -1em 0 0 red, + 2em -1em 0 0 red, + 3em -1em 0 0 red, + -4em 0 0 0 red, + -3em 0 0 0 red, + 3em 0 0 0 red, + 4em 0 0 0 red, + -5em 1em 0 0 red, + -4em 1em 0 0 red, + 4em 1em 0 0 red, + 5em 1em 0 0 red, + -5em 2em 0 0 red, + 5em 2em 0 0 red, + -5em 3em 0 0 red, + -3em 3em 0 0 red, + 3em 3em 0 0 red, + 5em 3em 0 0 red, + -2em 4em 0 0 red, + -1em 4em 0 0 red, + 1em 4em 0 0 red, + 2em 4em 0 0 red; + + background: red; + width: 1em; + height: 1em; + overflow: hidden; + + margin: 50px 0 70px 65px; + } +``` + +```html +
+``` + +[Link](https://css-tricks.com/examples/ShapesOfCSS/) + +Can anyone explain me how it works? +Are this for all browsers? + +Thanx.",2015/08/20,"['https://Stackoverflow.com/questions/32126987', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5230154/']","I'd answer with: + +Try to make threading an external concept to your system yet make the system as modular and encapsulated as possible at the same time. It will allow adding concurrency at later phase at low cost and in case the solution happens to work nicely in a single thread (say by making it event-loop-based) no time will have been burnt for nothing.","There are several ways to do this. Which way you choose depends a lot on the number of cars, the frequency of updates and position requests, the expected response time, and how accurate (up to date) you want the position reports to be. + +The easiest way to handle this is with a simple mutex (lock) that allows only one thread at a time to access the data structure. Assuming you're using a dictionary or hash map, your code would look something like this: + +``` +Map Cars = new Map(...) +Mutex CarsMutex = new Mutex(...) + +Location GetLocation(carKey) +{ + acquire mutex + result = Cars[carKey].Location + release mutex + return result +} + +``` + +You'd do that for Add, Remove, Update, etc. Any method that reads or updates the data structure would require that you acquire the mutex. + +If the number of queries far outweighs the number of updates, then you can do better with a reader/writer lock instead of a mutex. With an RW lock, you can have an unlimited number of readers, OR you can have a single writer. With that, querying the data would be: + +``` +acquire reader lock +result = Cars[carKey].Location +release reader lock +return result + +``` + +And Add, Update, and Remove would be: + +``` +acquire writer lock +do update +release writer lock + +``` + +Many runtime libraries have a concurrent dictionary data structure already built in. .NET, for example, has `ConcurrentDictionary`. With those, you don't have to worry about explicitly synchronizing access with a Mutex or RW lock; the data structure handles synchronization for you, either with a technique similar to that shown above, or by implementing lock-free algorithms. + +As mentioned in comments, a relational database can handle this type of thing quite easily and can scale to a very large number of requests. Modern relational databases, properly constructed and with sufficient hardware, are surprisingly fast and can handle huge amounts of data with very high throughput. + +There are other, more involved, methods that can increase throughput in some situations depending on what you're trying to optimize. For example, if you're willing to have some latency in reported position, then you could have position requests served from a list that's updated once per minute (or once every five minutes). So position requests are fulfilled immediately with no lock required from a static copy of the list that's updated once per minute. Updates are queued and once per minute a new list is created by applying the updates to the old list, and the new list is made available for requests. + +There are *many* different ways to solve your problem." +26499775,"I'm trying to use GMP with C++11, but apparently it's not allowed to use mpz\_class in constexpr functions because mpz\_class is not a literal type. + +``` +#include +#include +using namespace std; + +constexpr mpz_class factorial(mpz_class n) +{ + if (n == 0) return 1; + else return n * factorial(n - 1); +} + +int main() +{ + cout << factorial(20); +} + +``` + +Is it possible?",2014/10/22,"['https://Stackoverflow.com/questions/26499775', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4168350/']","Instagram says: + +> +> Note that we do not include an expiry time. Our access\_tokens have no explicit expiry, though your app should handle the case that either the user revokes access or we expire the token after some period of time. In this case, your response’s meta will contain an “error\_type=OAuthAccessTokenError”. In other words: do do not assume your access\_token is valid forever. +> +> +> + +If the token is somehow expired then they request for a new one, but that should be a rare case as instagram says they do no include an expiry time. + +For more [info read this](http://instagram.com/developer/authentication/). Hope this helps.. :)","First you have to get the access token and save that access token in your app, access token is not valid forever, so you should implement and handle this on your application follow this tutorial for login with instagram using oauth and its implementation on app side +" +53116406,"When I am working on the subdirectory of a git-repo, I should change dir to the parent to issue commands like + +``` +$ cd ..; git add .; git commit -m ""2018-11-02 17:58:09"" ; cd - +[master 0984351] 2018-11-02 17:58:09 + 12 files changed, 558 insertions(+), 13 deletions(-) + +``` + +Change to parent dir, commit changes and change back + +How could I commit directly under the child directory?",2018/11/02,"['https://Stackoverflow.com/questions/53116406', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7301792/']","In our official documentation for Kubernetes filter we have an example about how to make your Pod suggest a parser for your data based in an annotation: + +","Look at this configmap: + + + +The nginx parser should be there: + +``` +[PARSER] + Name nginx + Format regex + Regex ^(?[^ ]*) (?[^ ]*) (?[^ ]*) \[(?