qid
int64
1
74.6M
question
stringlengths
45
24.2k
date
stringlengths
10
10
metadata
stringlengths
101
178
response_j
stringlengths
32
23.2k
response_k
stringlengths
21
13.2k
40,390,491
``` 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! ``` <execution> <id>exec-npm-update</id> <phase>generate-sources</phase> <configuration> <workingDirectory>${uiResourcesDir}</workingDirectory> <executable>npm.cmd</executable> <arguments> <argument>update</argument> </arguments> </configuration> <goals> <goal>exec</goal> </goals> </execution> ```
I faced the same issue, as answered you need to provide npm.cmd instead just npm
40,390,491
``` 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! ``` <execution> <id>exec-npm-update</id> <phase>generate-sources</phase> <configuration> <workingDirectory>${uiResourcesDir}</workingDirectory> <executable>npm.cmd</executable> <arguments> <argument>update</argument> </arguments> </configuration> <goals> <goal>exec</goal> </goals> </execution> ```
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.) ``` <executable>npm</executable> <executable>ng</executable> ```
46,905,636
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.
46,905,636
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.
46,905,636
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')"); } ```
46,905,636
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')"); } ```
46,905,636
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 ```
46,905,636
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 ```
45,023,388
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.
44,387
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.
44,387
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: <http://www.exodus.io> 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 <https://www.omniwallet.org> 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.
44,387
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: <http://www.exodus.io> 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 <https://www.omniwallet.org> 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.
35,315,756
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 <https://github.com/moby/moby/pull/18353>. **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 <image>:<tag>` command. This worked for me!
35,315,756
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 <https://github.com/moby/moby/pull/18353>. **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 ```
35,315,756
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 <image>:<tag>` command. This worked for me!
46,187,201
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.
1,862,965
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.
1,862,965
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.
1,862,965
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.
53,200,172
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("[email protected]"); 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 protected], 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 ```
159,052
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)
34,129,459
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
14,309,502
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.
14,309,502
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.
14,309,502
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.
70,045
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.
13,346,165
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. <http://vtimbuc.net/gallery/pure-css3-accordion-menu-tutorial/> 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`
19,243,275
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 <b37cba000c7d3f8ea414f060d45ce144> /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.
19,243,275
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 <b37cba000c7d3f8ea414f060d45ce144> /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.
19,243,275
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 <b37cba000c7d3f8ea414f060d45ce144> /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.
19,243,275
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 <b37cba000c7d3f8ea414f060d45ce144> /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.
19,243,275
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 <b37cba000c7d3f8ea414f060d45ce144> /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
10,452,173
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: <http://www.sqlfiddle.com/#!3/26371/20>
10,452,173
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: <http://www.sqlfiddle.com/#!3/26371/20>
31,409,868
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.
31,409,868
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.
31,409,868
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.
158,578
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]]))}*) ```
88,406
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.
88,406
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).
25,645,859
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.
52,118,492
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.
974,151
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: <https://docs.microsoft.com/en-us/windows/release-information>. 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: <https://pureinfotech.com/windows-10-version-release-history>. There is also the Microsof Update Catalog (<https://catalog.update.microsoft.com>), 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: <https://catalog.update.microsoft.com/v7/site/Search.aspx?q=windows%2010%201903>. 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.
63,925,843
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)) ```
63,925,843
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)) ```
101,775
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)
<http://www.kmint21.com/serial-port-monitor/> or <https://iftools.com/start/index.de.php>
62,625,506
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
62,625,506
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.
62,625,506
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 <https://developer.apple.com/forums/thread/651611>, 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.
62,625,506
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
62,625,506
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.
62,625,506
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.
62,625,506
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 <https://developer.apple.com/forums/thread/651611>, 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.
62,625,506
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.
62,625,506
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
62,625,506
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 <https://developer.apple.com/forums/thread/651611>, 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.
938,470
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)
83,838
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.
83,838
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.
83,838
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.
43,408,454
In Primefaces I would like to expand a `<p:treeNode>`, 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: ``` <p:tree value="#{Bean.rootNode}" var="node" style="width: 100%" id="tree" selectionMode="single"> <p:treeNode id="node"> <h:outputText value="#{node.name}" /> </p:treeNode> <p:ajax event="select" update=":form:tree" listener="#{Bean.onNodeSelect}" /> </p:tree> ``` 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!
43,408,454
In Primefaces I would like to expand a `<p:treeNode>`, 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: ``` <p:tree value="#{Bean.rootNode}" var="node" style="width: 100%" id="tree" selectionMode="single"> <p:treeNode id="node"> <h:outputText value="#{node.name}" /> </p:treeNode> <p:ajax event="select" update=":form:tree" listener="#{Bean.onNodeSelect}" /> </p:tree> ``` 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: ``` <p:tree onNodeClick="$(node).find('.ui-tree-toggler').click();" ... ``` You may also want to apply the following style to get a hand symbol while hovering: ``` .ui-tree-toggler ~ .ui-treenode-label { cursor:pointer; } ```
43,408,454
In Primefaces I would like to expand a `<p:treeNode>`, 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: ``` <p:tree onNodeClick="$(node).find('.ui-tree-toggler').click();" ... ``` You may also want to apply the following style to get a hand symbol while hovering: ``` .ui-tree-toggler ~ .ui-treenode-label { cursor:pointer; } ```
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!
32,678
I've heard the British term "half seven" (or "half nine," "half five", etc) used to tell time. I can't remember though if it means 6:30 or 7:30 (i.e. half *an hour before* seven, or half *past* seven)? I'm American and have never heard another American use the phrase, but apparently it's very common in the UK.
2011/07/04
['https://english.stackexchange.com/questions/32678', 'https://english.stackexchange.com', 'https://english.stackexchange.com/users/10378/']
*Half seven* is the same as *half past seven*, with *past* simply missing. It's **7:30**.
Americans say "half *past* seven". I've never heard anyone say "half *before* seven" nor have I heard an American say "*half seven*". It does lead to odd situations. My German wife has a very good English friend. She learned the difference between "half seven" and "*halbsieben*" when they both showed up on time yet an hour apart.
32,678
I've heard the British term "half seven" (or "half nine," "half five", etc) used to tell time. I can't remember though if it means 6:30 or 7:30 (i.e. half *an hour before* seven, or half *past* seven)? I'm American and have never heard another American use the phrase, but apparently it's very common in the UK.
2011/07/04
['https://english.stackexchange.com/questions/32678', 'https://english.stackexchange.com', 'https://english.stackexchange.com/users/10378/']
*Half seven* is the same as *half past seven*, with *past* simply missing. It's **7:30**.
Half past 7 means 7:30 it's also a slang term for "crazy" or "insane". There is an American battle rapper who goes by Half Past 7 because of the slang meaning.
32,678
I've heard the British term "half seven" (or "half nine," "half five", etc) used to tell time. I can't remember though if it means 6:30 or 7:30 (i.e. half *an hour before* seven, or half *past* seven)? I'm American and have never heard another American use the phrase, but apparently it's very common in the UK.
2011/07/04
['https://english.stackexchange.com/questions/32678', 'https://english.stackexchange.com', 'https://english.stackexchange.com/users/10378/']
Americans say "half *past* seven". I've never heard anyone say "half *before* seven" nor have I heard an American say "*half seven*". It does lead to odd situations. My German wife has a very good English friend. She learned the difference between "half seven" and "*halbsieben*" when they both showed up on time yet an hour apart.
Half past 7 means 7:30 it's also a slang term for "crazy" or "insane". There is an American battle rapper who goes by Half Past 7 because of the slang meaning.
44,322
I am a senior Python developer. Recently I came across to the need of fully understanding how bitcoin works on it's core. The Internet is full of explanations and tutorials for regular folks and even dummies. You can get familiarized with it pretty well if all you care is basic understanding, so that you could start using it. But I am in a different business here... I want to know exactly what data is being sent to the net on every event of bitcoin currency? How it's being sent? How it's being received? What exact calculations and code is being executed on miners? What code is executed on wallet owners... etc? Can somebody come up with a decent programmer oriented step by step explanation/tutorial on this?
2016/05/24
['https://bitcoin.stackexchange.com/questions/44322', 'https://bitcoin.stackexchange.com', 'https://bitcoin.stackexchange.com/users/35934/']
The book Mastering Bitcoin would be a good solid start (although it might not answer **all** your questions). It is also available for [free](https://github.com/bitcoinbook/bitcoinbook).
The [Developer Documentation](https://bitcoin.org/en/developer-documentation) may also be of use.
44,322
I am a senior Python developer. Recently I came across to the need of fully understanding how bitcoin works on it's core. The Internet is full of explanations and tutorials for regular folks and even dummies. You can get familiarized with it pretty well if all you care is basic understanding, so that you could start using it. But I am in a different business here... I want to know exactly what data is being sent to the net on every event of bitcoin currency? How it's being sent? How it's being received? What exact calculations and code is being executed on miners? What code is executed on wallet owners... etc? Can somebody come up with a decent programmer oriented step by step explanation/tutorial on this?
2016/05/24
['https://bitcoin.stackexchange.com/questions/44322', 'https://bitcoin.stackexchange.com', 'https://bitcoin.stackexchange.com/users/35934/']
The book Mastering Bitcoin would be a good solid start (although it might not answer **all** your questions). It is also available for [free](https://github.com/bitcoinbook/bitcoinbook).
You should also check out the free Princeton Bitcoin textbook: [Bitcoin and Cryptocurrency Technologies](https://d28rh4a8wq0iu5.cloudfront.net/bitcointech/readings/princeton_bitcoin_book.pdf).
44,322
I am a senior Python developer. Recently I came across to the need of fully understanding how bitcoin works on it's core. The Internet is full of explanations and tutorials for regular folks and even dummies. You can get familiarized with it pretty well if all you care is basic understanding, so that you could start using it. But I am in a different business here... I want to know exactly what data is being sent to the net on every event of bitcoin currency? How it's being sent? How it's being received? What exact calculations and code is being executed on miners? What code is executed on wallet owners... etc? Can somebody come up with a decent programmer oriented step by step explanation/tutorial on this?
2016/05/24
['https://bitcoin.stackexchange.com/questions/44322', 'https://bitcoin.stackexchange.com', 'https://bitcoin.stackexchange.com/users/35934/']
The [Developer Documentation](https://bitcoin.org/en/developer-documentation) may also be of use.
You should also check out the free Princeton Bitcoin textbook: [Bitcoin and Cryptocurrency Technologies](https://d28rh4a8wq0iu5.cloudfront.net/bitcointech/readings/princeton_bitcoin_book.pdf).
28,071,829
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.
If you build a graph where every node represents a 2x2 square of 1's and there is an edge between two nodes if they overlap, then the problem is now: find the maximum independent set in this graph.
28,071,829
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.
Here is a dynamic programming solution. 1. The state is `(row number, mask of occupied cells, shift position)`. It looks like this: ``` ..#.. .##.. .#... .#... ``` In this case, the row number is 2(I use zero-bases indices), the mask depends on whether we take a cell with `#` or not, the shift position is 1. The number of states is `O(n * m * 2 ^ n)`. The value of a state is the maximum number of picked 2x2 squares. The base case is `f(1, 0, 0) = 0`(it corresponds to the first row and no 2x2 squares picked so far). 2. The transitions are as follows: ``` ..#.. ..#.. .00.. -> ..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.
28,071,829
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 <http://ideone.com/Wq1xRo>
6,094,828
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: ``` <form id="fileupload" action="https://graph-video.facebook.com/me/videos" method="POST" enctype="multipart/form-data"> <input type="hidden" name="access_token" value="user_access_token"> <input type="text" name="title"> <input type="text" name="description"> <input type="file" name="file"> <!-- name must be file --> </form> <script type="text/javascript"> $('#fileupload').fileupload({ dataType: 'json', forceIframeTransport: true, //force use iframe or will no work autoUpload : true, //facebook book response will be send as param //you can use this page to save video (Graph Api) object on database redirect : 'http://pathToYourServer/videos?video=%s' }); </script> ```
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).
12,739
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 protected]]' 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 <http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=983b941d-06cb-4658-b7f6-3088333d062f> 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.
12,739
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 protected]]' 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.
7,629,550
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: > > > <http://sanitarium.net/unix_stuff/rspaghetti_backup/diff_backup.pl.txt> > > > 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. > > >
7,629,550
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).
29,621,214
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
68,944,559
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 ```
68,944,559
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'])] ```
68,944,559
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'])] ```
34,957,630
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).
34,957,630
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 .
18,329,849
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)
14,530,375
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: <http://handsontable.com/demo/renderers.html> 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
14,530,375
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: <http://handsontable.com/demo/renderers.html> 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<ht.countRows();i++){ for(var p=0;p<ht.countCols();p++){ cell_color = "#000"; font_color = "#fff"; $(ht.getCell(i,p)).css({"color": font_color, "background-color": cell_color}) } } } ```
4,343,424
$$\frac{1}{y} \frac{\text{d}y}{\text{d}x} = \frac{1}{x}$$ The way I solve this: for all $x$ in $(-\infty,0)$ $\ln |y| = \ln |x| + A$ where $A$ is a real constant (since we know antiderivatives are separated by a constant) $|y| = B|x|$ where $B$ is a positive constant equals $\exp(A)$ $y= Bx$ or $-Bx$ It seems to me $y =Cx$ where $C$ is a real non-zero constant that equals either $B$ or $-B$. Since it seems like if $y$ is equal to $+$ or $-Bx$ for the entire interval $(-\infty,0)$, then it must be only $+Bx$ or $-Bx$ i.e. $Cx$ for some subinterval. If it is $+Bx$, then for values outside and near this interval, they must also be $+Bx$ since we know $y$ is continuous and $x$ is not zero. Vice versa. But I don't know how to prove this. How to prove $y = Cx$ for $(-\infty, 0)$? If that is the case, then I can write the general form of the differential equation picewisely as $y=C\_1x$ for $(-\infty,0)$, $C\_2x$ for $(0,\infty)$, where $C\_1$ and $C\_2$ are non-zero reals.
2021/12/28
['https://math.stackexchange.com/questions/4343424', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/840119/']
The first point of confusion here is that you antidifferentiatied $$\frac{y'}{y}=\frac1{x}$$ to $$\ln(|y|)=\ln(|x|)+A,$$ but this is not entirely correct. The antiderivatives of $\frac1{t}$ are given by the piecewise, $$\ln(-t)+A;\,\forall{t\lt0}$$ $$\ln(t)+A;\,\forall{t\gt0}.$$ Taking this into account, you should have $$\ln(-y)=\ln(-x)+A$$ or $$\ln(y)=\ln(-x)+B.$$ This translates to $$y(x)=\exp(A)x$$ or $$y(x)=-\exp(B)x.$$ The second point of is in interpreting the "or." The two solutions we have here are that $y(x)=c\_0x$ with $c\_0\gt0,$ or that $y(x)=c\_1x$ with $c\_1\lt0.$ You could not have both happening simultaneously in all of $(-\infty,0).$ Your question is, how do you prove it? Well, notice that the equation must be satisfied everywhere. But it cannot be satisfied if there are jump discontinities, which occur if you have a constant of one kind in one subinterval, and a constant of some other kind everywhere else. You can show that if $$f(x)=\begin{cases}Ax&x\leq{C}\\Bx&x\gt{C}\end{cases},$$ then $f$ is not even differentiable at $C$ unless $A=B.$ You can prove it just using the definition of the derivative. The method for solving the equation, when done properly, already implies this, though, so in practice, you would not need to prove it.
Consider the DE in its explicit normal form $\frac{dy}{dx}=\frac{y}{x}$. The difference is that the equation is now defined for $y=0$, inside the quadrants the solutions remain the same. As an ODE, this equation is singular or not defined on the line $x=0$. Thus the solutions on $(-\infty,0)$ and $(0,+\infty)$ are separate, with separate integration constants. For the solution as ODE one need not care much of how they connect at $x=0$. $y=0$ is a solution of the explicit ODE, or outside the domain for the original equation. Thus no other solution can change its sign, trivially by not being able to leave its quadrant, or by the uniqueness property of the Picard-Lindelöf (-Cauchy-Lipschitz) theorem on existence and uniqueness. As the sign is fixed, it is determined by the initial condition, one could write $$ \frac{x}{x\_0}=\frac{y}{y\_0}. $$
24,232,234
After surfing the web about cookies and session I am creating a simple login in nodejs using express with cookie/session using redis as my data storage. What do you think is the best way to handle cookies/session after the user logs in? I also have these question in my mind: 1. How do i prevent using userA cookie to inject to userB's browser? 2. Do I need to check the value of the cookies before performing any process? 3. Using `cookieParser` is it safe that the connect.sid is unique in every browser? 4. `app.use(session({secret: 'secretkey', key: 'quser'}));` what is this `secret` all about? I can't make up my mind on how i'm gonna use them in a proper way. Thanks guys.
2014/06/15
['https://Stackoverflow.com/questions/24232234', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2717352/']
A common pattern is to create a QObject-derived class and make `connect_client` a slot in that class. Connect statement will look like `...clicked.connect(my_object.connect_client)`. In this case you can store any data in the object (e.g. `self.abapclient = abapclient`) and use it later when you like. `main` will have access to the object and therefore its properties and methods. However this is no use for you because main will always be busy executing `app.exec_()`. At the time `connect_client` is called, you can no longer perform any actions in `main`. Basically, all work should be done in slots, and it's convenient to put slots in a class so they can store a program state in object properties and share access to it.
You could pass the object as argument to the slot. Just give the class of object that is sent to connected slots as part of the `pyqtSignal`, like `pyqtSignal(YourClass)`. More details are provided in @HansHermans answer at [PyQt signal with arguments of arbitrary type / PyQt\_PyObject equivalent for new-style signals](https://stackoverflow.com/questions/4523006/pyqt-signal-with-arguments-of-arbitrary-type-pyqt-pyobject-equivalent-for-new).
42,342,207
I'm quite new to JSON. What im trying to do is i have JSON with 3 objects in it and i want to put each objects into its respective (there's 3 div). The code below doesn.t append anything to the HTML: ``` var testwrapper= $("<div/>").addClass("testwrapper").appendTo(somethingwrapper); var test1wrapper= $("<div/>").addClass("test One").appendTo(testwrapper); var test2rapper= $("<div/>").addClass("test Two").appendTo(testwrapper); var test3wrapper= $("<div/>").addClass("test Three").appendTo(testwrapper); <div class="Test One"></div> <div class="Test Two"></div> <div class="Test Three"></div> ``` 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 = $("<p/>").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 = $("<p/>").text(Test_[test ].title).appendTo("#"+testwrapper [test ]); } } ```
Try: ``` <div class="Test One" id="div_1"></div> <div class="Test Two" id="div_2"></div> <div class="Test Three" id="div_3"></div> ``` Then use ``` document.getElementById('div_1').innerHTML = ... ``` to set the contents.
43,876,071
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.
37,904,174
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. ``` <div class="events"> <div class="container"> <div class="row"> <div class= "col-sm-4 col-xs-25"> <h4 id="event"><i class="fa fa-calendar" aria-hidden="true"></i> Upcoming Events</h4> <hr class="carved"> <div class="date"> <span class="month">August</span> <h1 class="day">28</h1> </div> <div class="container"> <div class="jumbotron"> <h4>Sample Title</h4> <p>IT Thesis defense</p> <h6>7:00 AM - 8:00 PM</h6> </div> </div> <hr class="divider"> <div class="date"> <span class="month">August</span> <h1 class="day">28</h1> </div> <hr class="divider"> <div class="date"> <span class="month">August</span> <h1 class="day">28</h1> </div> </div> <div class= "col-sm-8 col-xs-25"> <h4 id="event"><i class="fa fa-newspaper-o" aria-hidden="true"></i> Latest News</h4> <hr class="carved"> </div> </div> </div> </div> ``` 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 ``` <https://doc.scrapy.org/en/latest/topics/jobs.html>
21,188,760
``` 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
21,188,760
``` 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.
44,029,064
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. <http://jsbin.com/leluyaseso/edit?console>
29,035,230
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.
33,749,645
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<String, Void, Boolean>{ 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); List<CartData>mListAccount=new ArrayList<CartData>(); 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); List<CartData>mListAccount16=new ArrayList<CartData>(); 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
56,803,873
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 ```
51,011,048
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: <init> [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: <init> [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)
7,434,865
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.
1,390,990
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<L){ if(this[i]=== what) return i; ++i; } return -1; } ```