qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
49,547,744
I am trying to deploy Lambda functions using AWS Cloud9. When I press deploy, all of my functions are deployed/synced at the same time rather than just the one I selected when deploying. Same thing when right clicking on the function and pressing deploy. I find this quite annoying and wondering if there is any work aro...
2018/03/29
[ "https://Stackoverflow.com/questions/49547744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4718413/" ]
When you click deploy Cloud9 runs `aws cloudformation package` and `aws cloudformation deploy` on your `template.yaml` file in the background. (source: I developed the Lambda integration for AWS Cloud9). Because all your files are bundled into one serverless application and there is only one CloudFormation stack they ...
In AWS Cloud9, Lambda functions are created within serverless applications and are therefore deployed via CloudFormation. With CloudFormation, the whole stack is deployed at once, so all functions are deployed together (see [this discussion](https://github.com/awslabs/serverless-application-model/issues/125) for more i...
33,402,360
I am attempting to create a random number generator for any number of numbers in a line and then repeating those random numbers until a "target" number is reached. The user will enter both the number of numbers in the sequence and the sequence they are shooting for. The program will run the random numbers over and ove...
2015/10/28
[ "https://Stackoverflow.com/questions/33402360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5344823/" ]
The issue with your comparison is that you're testing `Target` which is a string against `num` which is a list of integers. That will never match, no matter what integers and what string you're dealing with. You need to compare two like-types to get a meaningful result. It looks like you wanted your `getTarget` functi...
Your problem is because one of your numbers is a list and the other is a string from input. Change Target to get an `int` ``` def getTarget(): Target =int(input("What is your target sequence?")) return Target ``` Change lotteryNo to get an `int` ``` def lotteryNo(Range): import random integer = 0 ...
38,356,333
Another beginners question here, coming from Delphi you always have access to another forms controls but in my early days with C# / Visual Studio I am faced with a problem which is proving more difficult than it should be. I have been getting started by writing a simple notepad style application, I have my main form a...
2016/07/13
[ "https://Stackoverflow.com/questions/38356333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4645457/" ]
The `editLineNumber` control is private. You can change it to be public, but that's discouraged. Instead, create a property in `GoToForm` that returns the value you want. ``` public string LineNumber { get { return this.editLineNumber.Text; } } ``` Now you can just reference your new property: ``` if (dialogRe...
Especially if you're new to C# and WinForms, don't touch designer code with a 10 foot pole. As Grant Winney said, use a property: ``` public string GetLineNumberText { get { return this.editLineNumber.Text; } } ``` It should be mentioned that it's important to be aware of the directional nature of forms. That is...
29,845,218
I,m trying to write a regex to check if the given string is like a + b, 2 + a + b, 3 + 6 \* 9 + 6 \* 5 + a \* b, etc... Only + and \* operators. I tried `if (str.matches("(\\d|\\w \\+|\\*){1,} \\d|\\w"))` Unfortunately it only handles cases like 3 \* 7 ... (numeric \* numeric). Waiting for your answers, thanks fo...
2015/04/24
[ "https://Stackoverflow.com/questions/29845218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4807032/" ]
Put `*` and `+` inside a character class. ``` str.matches("\\w(?:\\s[+*]\\s\\w)+"); ``` [DEMO](https://regex101.com/r/dI4uH0/2)
This will handle cases of simple and chained calculations ``` [0-9A-Za-a]*( ){0,}([+-/*]( ){0,}[0-9A-Za-a]*( ){0,})* ``` This would match, for example * 1+2 * 1 + 2 * 1 + a \* 14 / 9 (You can change the operators you want by updating `[+-/*]`)
66,436,586
I have the below list :- ``` someList = ["one","three","four","five","six","two"] ``` I want to change position of "two" i.e after "one" and rest string should be shifted as they are. Expected Output : - > > someList = ["one","two","three","four","five","six",] > > >
2021/03/02
[ "https://Stackoverflow.com/questions/66436586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8048800/" ]
You can pop 2 from current index and insert to new index ```py l.insert(1, l.pop(-1)) ```
You can use unpacking to redistribute ``` a,c,d,e,b = ["one","three","four","five","six","two"] someList= [a,b,c,d,e] someList ```
12,331,968
I have code like this I need to access the `mysample` variable of static class `InnerClass` in the `getInnerS()` method which is inside the the `NestedClass`. I tried accessing it by creating a new object for `InnerClass` but i am getting `java.lang.StackOverflowError`. ``` public class NestedClass{ private Strin...
2012/09/08
[ "https://Stackoverflow.com/questions/12331968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1604151/" ]
In `InnerClass` constructor: ``` NestedClass a = new NestedClass(); ``` So, you create a new `NestedClass`, which creates a new `InnerClass`, which creates itself its own `NestedClass`, with the corresponding `InnerClass`.... No wonder the stackoverflow. If you want to access the enclosing class, you should use (i...
With this solution member class is `static`. For better comparison you might read [Static class declarations](http://www.javaworld.com/javaqa/1999-08/01-qa-static2.html) *Static nested classes (description)* Static nested classes do not have access to non-static fields and methods of the outer class, which in some ...
12,331,968
I have code like this I need to access the `mysample` variable of static class `InnerClass` in the `getInnerS()` method which is inside the the `NestedClass`. I tried accessing it by creating a new object for `InnerClass` but i am getting `java.lang.StackOverflowError`. ``` public class NestedClass{ private Strin...
2012/09/08
[ "https://Stackoverflow.com/questions/12331968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1604151/" ]
``` NestedClass a = new NestedClass(); ``` in static InnerClass class creates an instance of the NestedClass and as InnerClass is static this is a loop. InnerClass does not need to be static, this should work ``` public class NestedClass { private String outer = "Outer Class"; //NestedClass instance variable Nested...
With this solution member class is `static`. For better comparison you might read [Static class declarations](http://www.javaworld.com/javaqa/1999-08/01-qa-static2.html) *Static nested classes (description)* Static nested classes do not have access to non-static fields and methods of the outer class, which in some ...
4,402,482
I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with... ``` $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookma...
2010/12/09
[ "https://Stackoverflow.com/questions/4402482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197606/" ]
You need to add the RDS instance as an additional server listed on PHPMyAdmin while granting the host PHPMyAdmin access to your RDS instance. More details from this blog post on [How to remotely manage an Amazon RDS instance with PHPMyAdmin](http://blog.benkuhl.com/2010/12/how-to-remotely-manage-an-amazon-rds-instance...
If you can connect from the cli using `mysql -h ENDPOINT -u USERNAME -p` but not from PHPMyAdmin or your own web scripts, don't forget to [tell selinux to let your web server talk to the network](https://wiki.centos.org/TipsAndTricks/SelinuxBooleans#line-44) :) ``` sudo setsebool -P httpd_can_network_connect=1 ```
4,402,482
I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with... ``` $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookma...
2010/12/09
[ "https://Stackoverflow.com/questions/4402482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197606/" ]
You need to add the RDS instance as an additional server listed on PHPMyAdmin while granting the host PHPMyAdmin access to your RDS instance. More details from this blog post on [How to remotely manage an Amazon RDS instance with PHPMyAdmin](http://blog.benkuhl.com/2010/12/how-to-remotely-manage-an-amazon-rds-instance...
``` sudo nano /etc/phpmyadmin/config.inc.php --ADD LINES BELOW THE PMA CONFIG AREA AND FILL IN DETAILS-- $i++; $cfg['Servers'][$i]['host'] = '__FILL_IN_DETAILS__'; $cfg['Servers'][$i]['port'] = '3306'; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Serv...
4,402,482
I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with... ``` $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookma...
2010/12/09
[ "https://Stackoverflow.com/questions/4402482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197606/" ]
You need to add the RDS instance as an additional server listed on PHPMyAdmin while granting the host PHPMyAdmin access to your RDS instance. More details from this blog post on [How to remotely manage an Amazon RDS instance with PHPMyAdmin](http://blog.benkuhl.com/2010/12/how-to-remotely-manage-an-amazon-rds-instance...
I use ubuntu shell to access Amazon RDS. first of all go to ubuntu root ``` sudo -i ``` to do this use amazon RDS end user URL ``` mysql -h gelastik.cqtbtepzqfhu.us-west-2.rds.amazonaws.com -u root -p ```
4,402,482
I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with... ``` $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookma...
2010/12/09
[ "https://Stackoverflow.com/questions/4402482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197606/" ]
First try this : **mysql -h xxxxx.xxxxxxx.xx-xx-2.rds.amazonaws.com -u root -p** // Your RDS server. If it waits and doesn't prompt for the password then you would need to check security group and add 3306 outbound to your Web Tier.
If you can connect from the cli using `mysql -h ENDPOINT -u USERNAME -p` but not from PHPMyAdmin or your own web scripts, don't forget to [tell selinux to let your web server talk to the network](https://wiki.centos.org/TipsAndTricks/SelinuxBooleans#line-44) :) ``` sudo setsebool -P httpd_can_network_connect=1 ```
4,402,482
I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with... ``` $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookma...
2010/12/09
[ "https://Stackoverflow.com/questions/4402482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197606/" ]
You need to add the RDS instance as an additional server listed on PHPMyAdmin while granting the host PHPMyAdmin access to your RDS instance. More details from this blog post on [How to remotely manage an Amazon RDS instance with PHPMyAdmin](http://blog.benkuhl.com/2010/12/how-to-remotely-manage-an-amazon-rds-instance...
Try to connect from the mysql command line (http://dev.mysql.com/doc/refman/5.1/en/mysql.html) and see what's this utility returns you. I found it's easier to debug that way. ``` mysql -hMY-DB.us-east-1.rds.amazonaws.com -uMASTER-USER -pPASSWORD ``` If that's doesn't work, it means your amazon RDS security aren't co...
4,402,482
I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with... ``` $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookma...
2010/12/09
[ "https://Stackoverflow.com/questions/4402482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197606/" ]
``` sudo nano /etc/phpmyadmin/config.inc.php --ADD LINES BELOW THE PMA CONFIG AREA AND FILL IN DETAILS-- $i++; $cfg['Servers'][$i]['host'] = '__FILL_IN_DETAILS__'; $cfg['Servers'][$i]['port'] = '3306'; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Serv...
If you can connect from the cli using `mysql -h ENDPOINT -u USERNAME -p` but not from PHPMyAdmin or your own web scripts, don't forget to [tell selinux to let your web server talk to the network](https://wiki.centos.org/TipsAndTricks/SelinuxBooleans#line-44) :) ``` sudo setsebool -P httpd_can_network_connect=1 ```
4,402,482
I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with... ``` $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookma...
2010/12/09
[ "https://Stackoverflow.com/questions/4402482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197606/" ]
I found most of the answers in this question lack explanation. To add RDS server in phpMyAdmin installed in EC2, you can first login to your EC2 via SSH. Then, issue the following command to edit the Config file of phpMyAdmin (use `vi`, `nano` or any other favorite text editing tool): ``` sudo vi /etc/phpMyAdmin/confi...
If you can connect from the cli using `mysql -h ENDPOINT -u USERNAME -p` but not from PHPMyAdmin or your own web scripts, don't forget to [tell selinux to let your web server talk to the network](https://wiki.centos.org/TipsAndTricks/SelinuxBooleans#line-44) :) ``` sudo setsebool -P httpd_can_network_connect=1 ```
4,402,482
I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with... ``` $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookma...
2010/12/09
[ "https://Stackoverflow.com/questions/4402482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197606/" ]
``` sudo nano /etc/phpmyadmin/config.inc.php --ADD LINES BELOW THE PMA CONFIG AREA AND FILL IN DETAILS-- $i++; $cfg['Servers'][$i]['host'] = '__FILL_IN_DETAILS__'; $cfg['Servers'][$i]['port'] = '3306'; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Serv...
First try this : **mysql -h xxxxx.xxxxxxx.xx-xx-2.rds.amazonaws.com -u root -p** // Your RDS server. If it waits and doesn't prompt for the password then you would need to check security group and add 3306 outbound to your Web Tier.
4,402,482
I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with... ``` $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookma...
2010/12/09
[ "https://Stackoverflow.com/questions/4402482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197606/" ]
In Debian Lenny using the phpmyadmin from the repo add this to /etc/phpmyadmin/config.inc.php : ``` $i++; $cfg['Servers'][$i]['host'] = 'xxxxx.xxxxxxxxxx.us-east-1.rds.amazonaws.com'; $cfg['Servers'][$i]['port'] = '3306'; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][...
You need to add the RDS instance as an additional server listed on PHPMyAdmin while granting the host PHPMyAdmin access to your RDS instance. More details from this blog post on [How to remotely manage an Amazon RDS instance with PHPMyAdmin](http://blog.benkuhl.com/2010/12/how-to-remotely-manage-an-amazon-rds-instance...
4,402,482
I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with... ``` $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookma...
2010/12/09
[ "https://Stackoverflow.com/questions/4402482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197606/" ]
In Debian Lenny using the phpmyadmin from the repo add this to /etc/phpmyadmin/config.inc.php : ``` $i++; $cfg['Servers'][$i]['host'] = 'xxxxx.xxxxxxxxxx.us-east-1.rds.amazonaws.com'; $cfg['Servers'][$i]['port'] = '3306'; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][...
First try this : **mysql -h xxxxx.xxxxxxx.xx-xx-2.rds.amazonaws.com -u root -p** // Your RDS server. If it waits and doesn't prompt for the password then you would need to check security group and add 3306 outbound to your Web Tier.
139,990
If an algorithm for $SAT$ runs in $O(n^{\log n})$ time, and if $L$ belongs to $\mathsf{NP}$, is there an algorithm for $L$ that runs in $O(n^{\log n})$ time?
2021/05/06
[ "https://cs.stackexchange.com/questions/139990", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/136310/" ]
As $\mathrm{SAT}$ is $\mathrm{NP}$-complete, we know that there is a polytime reduction from our language $L$ to $\mathrm{SAT}$. However, this reduction can involve a polynomial blowup of the input size. This means that an input $w$ to $L$ could be mapped to a formula $\phi\_w$ such that $|\phi\_w| \approx |w|^k$ for s...
Since any input x for L can be reduced to SAT in O(|x|^c) time, the created SAT instance will have size at most n=O(|x|^c). So the n^(lg n)-time algorithm for SAT will be an |x|^O(lg |x|)-time algorithm for L.
8,305,527
What is a regular expression to allow letters only, with no spaces or numbers, with a length of 20 characters? Some examples of acceptable usernames: ``` ask1kew supacool sec1entertainment ThatPerson1 Alexking ``` Some examples of unacceptable usernames: ``` No_problem1 a_a_sidkd Thenamethatismorethen20charactersl...
2011/11/29
[ "https://Stackoverflow.com/questions/8305527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/604023/" ]
This should work if you're limiting yourself to ASCII: ```none /\A[a-z0-9]{,20}\z/i ``` That will also match an empty string though so you might want to add a lower limit (5 in this example): ```none /\A[a-z0-9]{5,20}\z/i ``` If you wanted to be adventurous and allow non-ASCII letters and you're using Ruby 1.9 th...
`^[a-zA-Z0-9]{1,20}$` `{1,20}` is `{min, max}` so you could set it to `{5,20}` to limit it to minimum of 5 chars and a max of 20.
37,938,413
Is there a function or something in laravel which I can use to make first letter uppercase in breadcrumbs? This is what I'm using right now but in my links and routes are all lowercase letters and if I go and try to update all will be very time consuming.. ``` <ul class="breadcrumb"> <li> <i class="glyphicon gl...
2016/06/21
[ "https://Stackoverflow.com/questions/37938413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Yes and no. It is not possible at the time of writing, if you want to do it only with browser client side javascript, because twitter does not allow cross site requests. Browsers execute javascript code in a sandbox environment, which does not allow you to do a request to another domain as yours, except the 3rd par...
If you check the twitter's api documentation, you can see how to do the login. I think your question is how insert a plugin to login similar than facebook but I think they don't did any library. When the user clicks the loggin button you must send a post request to twitter to get the oauth\_token: Example: POST reque...
37,938,413
Is there a function or something in laravel which I can use to make first letter uppercase in breadcrumbs? This is what I'm using right now but in my links and routes are all lowercase letters and if I go and try to update all will be very time consuming.. ``` <ul class="breadcrumb"> <li> <i class="glyphicon gl...
2016/06/21
[ "https://Stackoverflow.com/questions/37938413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you mean only JavaScript and HTML on the client, there are some third party libraries. Auth0 is popular and has [instructions for Twitter](https://auth0.com/docs/connections/social/twitter). Another possible solution is to use Firebase auth. It has a [JavaScript API which can be used as follows](https://firebase.g...
If you check the twitter's api documentation, you can see how to do the login. I think your question is how insert a plugin to login similar than facebook but I think they don't did any library. When the user clicks the loggin button you must send a post request to twitter to get the oauth\_token: Example: POST reque...
37,938,413
Is there a function or something in laravel which I can use to make first letter uppercase in breadcrumbs? This is what I'm using right now but in my links and routes are all lowercase letters and if I go and try to update all will be very time consuming.. ``` <ul class="breadcrumb"> <li> <i class="glyphicon gl...
2016/06/21
[ "https://Stackoverflow.com/questions/37938413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This javascript snippet is a working example of how to do this. You can try it and tweak it: <https://jsfiddle.net/s3egg5h7/43/> As pointed out, a Javascript-only solution requires a 3rd-party service, in this case <https://oauth.io>. Even if you do not want to use the 3rd-party service, the snippet is useful since y...
If you check the twitter's api documentation, you can see how to do the login. I think your question is how insert a plugin to login similar than facebook but I think they don't did any library. When the user clicks the loggin button you must send a post request to twitter to get the oauth\_token: Example: POST reque...
37,938,413
Is there a function or something in laravel which I can use to make first letter uppercase in breadcrumbs? This is what I'm using right now but in my links and routes are all lowercase letters and if I go and try to update all will be very time consuming.. ``` <ul class="breadcrumb"> <li> <i class="glyphicon gl...
2016/06/21
[ "https://Stackoverflow.com/questions/37938413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Yes and no. It is not possible at the time of writing, if you want to do it only with browser client side javascript, because twitter does not allow cross site requests. Browsers execute javascript code in a sandbox environment, which does not allow you to do a request to another domain as yours, except the 3rd par...
This javascript snippet is a working example of how to do this. You can try it and tweak it: <https://jsfiddle.net/s3egg5h7/43/> As pointed out, a Javascript-only solution requires a 3rd-party service, in this case <https://oauth.io>. Even if you do not want to use the 3rd-party service, the snippet is useful since y...
37,938,413
Is there a function or something in laravel which I can use to make first letter uppercase in breadcrumbs? This is what I'm using right now but in my links and routes are all lowercase letters and if I go and try to update all will be very time consuming.. ``` <ul class="breadcrumb"> <li> <i class="glyphicon gl...
2016/06/21
[ "https://Stackoverflow.com/questions/37938413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you mean only JavaScript and HTML on the client, there are some third party libraries. Auth0 is popular and has [instructions for Twitter](https://auth0.com/docs/connections/social/twitter). Another possible solution is to use Firebase auth. It has a [JavaScript API which can be used as follows](https://firebase.g...
This javascript snippet is a working example of how to do this. You can try it and tweak it: <https://jsfiddle.net/s3egg5h7/43/> As pointed out, a Javascript-only solution requires a 3rd-party service, in this case <https://oauth.io>. Even if you do not want to use the 3rd-party service, the snippet is useful since y...
4,022,426
I am new to Iphone.How to create file browser in iphone ? I wish to show all the files and folders in the iphone.How to do this?
2010/10/26
[ "https://Stackoverflow.com/questions/4022426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/482568/" ]
Unless you are on a jailbroken phone, your app can only access files within its own "sandbox". There are [three folders](http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/RuntimeEnvironment/RuntimeEnvironment.html#//apple_ref/doc/uid/TP40007072-CH2-SW12) your app can acc...
If you are producing this for the App Store, I would suggest against exposing such a control even for your application's data. It violates the Human Interface Guidelines and most likely will be rejected. From the [iPad Human Interface Guidelines](http://developer.apple.com/library/ios/#documentation/general/conceptual...
9,735,164
How can I make `find` apply my shell's defined functions and aliases inside its *exec* parameter? For example I have defined a function analogous to **bzip2** but using **7z**: > > function 7zip() { for f in $@; do ls -alF "$f"; 7za a -t7z -m0=lzma > -mx=9 -mfb=64 -md=64m -ms=on "$f.7z" "$f" && touch -r "$f" "$f.7z...
2012/03/16
[ "https://Stackoverflow.com/questions/9735164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1069375/" ]
You can export a function definition with: ``` export -f 7zipi ``` but using an indentifier whose name begins with a number is asking for trouble. Try changing the name to something sensible. (eg "f7zipi", or "\_7zipi")
Being the impatient coder than I am, for now I changed it around to multiple lines with: ``` hitlist=$(find . -mtime +7 -name "G*.html") 7zipi $hitlist |awk ' !x[$0]++' ``` That *awk* bit at the end there btw is so that the output only prints lines not seen before yet, so that it doesn't clutter with a zillion line...
9,735,164
How can I make `find` apply my shell's defined functions and aliases inside its *exec* parameter? For example I have defined a function analogous to **bzip2** but using **7z**: > > function 7zip() { for f in $@; do ls -alF "$f"; 7za a -t7z -m0=lzma > -mx=9 -mfb=64 -md=64m -ms=on "$f.7z" "$f" && touch -r "$f" "$f.7z...
2012/03/16
[ "https://Stackoverflow.com/questions/9735164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1069375/" ]
You can export a function definition with: ``` export -f 7zipi ``` but using an indentifier whose name begins with a number is asking for trouble. Try changing the name to something sensible. (eg "f7zipi", or "\_7zipi")
Seems that not every `find` will accept a function as an argument for `--execdir`. It did not work for me either in the original form or using `export -f`. However, if your make a script out of your function, it will work ``` find . -mtime +7 -name "G*.html" -execdir /path/to/script_7zipi {} + ```
9,735,164
How can I make `find` apply my shell's defined functions and aliases inside its *exec* parameter? For example I have defined a function analogous to **bzip2** but using **7z**: > > function 7zip() { for f in $@; do ls -alF "$f"; 7za a -t7z -m0=lzma > -mx=9 -mfb=64 -md=64m -ms=on "$f.7z" "$f" && touch -r "$f" "$f.7z...
2012/03/16
[ "https://Stackoverflow.com/questions/9735164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1069375/" ]
Being the impatient coder than I am, for now I changed it around to multiple lines with: ``` hitlist=$(find . -mtime +7 -name "G*.html") 7zipi $hitlist |awk ' !x[$0]++' ``` That *awk* bit at the end there btw is so that the output only prints lines not seen before yet, so that it doesn't clutter with a zillion line...
Seems that not every `find` will accept a function as an argument for `--execdir`. It did not work for me either in the original form or using `export -f`. However, if your make a script out of your function, it will work ``` find . -mtime +7 -name "G*.html" -execdir /path/to/script_7zipi {} + ```
9,735,164
How can I make `find` apply my shell's defined functions and aliases inside its *exec* parameter? For example I have defined a function analogous to **bzip2** but using **7z**: > > function 7zip() { for f in $@; do ls -alF "$f"; 7za a -t7z -m0=lzma > -mx=9 -mfb=64 -md=64m -ms=on "$f.7z" "$f" && touch -r "$f" "$f.7z...
2012/03/16
[ "https://Stackoverflow.com/questions/9735164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1069375/" ]
All four of these command works just fine with the function call. Adjust your find specs as need be.. They all cater for spaces in file names. Personally, I can't see the point of shelling out to another bash instance, but I've included two versions which call bash. ``` IFS=$'\n'; f=($(find /tmp -maxdepth 1 -name "$U...
Being the impatient coder than I am, for now I changed it around to multiple lines with: ``` hitlist=$(find . -mtime +7 -name "G*.html") 7zipi $hitlist |awk ' !x[$0]++' ``` That *awk* bit at the end there btw is so that the output only prints lines not seen before yet, so that it doesn't clutter with a zillion line...
9,735,164
How can I make `find` apply my shell's defined functions and aliases inside its *exec* parameter? For example I have defined a function analogous to **bzip2** but using **7z**: > > function 7zip() { for f in $@; do ls -alF "$f"; 7za a -t7z -m0=lzma > -mx=9 -mfb=64 -md=64m -ms=on "$f.7z" "$f" && touch -r "$f" "$f.7z...
2012/03/16
[ "https://Stackoverflow.com/questions/9735164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1069375/" ]
All four of these command works just fine with the function call. Adjust your find specs as need be.. They all cater for spaces in file names. Personally, I can't see the point of shelling out to another bash instance, but I've included two versions which call bash. ``` IFS=$'\n'; f=($(find /tmp -maxdepth 1 -name "$U...
Seems that not every `find` will accept a function as an argument for `--execdir`. It did not work for me either in the original form or using `export -f`. However, if your make a script out of your function, it will work ``` find . -mtime +7 -name "G*.html" -execdir /path/to/script_7zipi {} + ```
34,352,840
I am using an extendible hash and I want to have strings as keys. The problem is that the current hash function that I am using iterates over the whole string/key and I think that this is pretty bad for the program's performance since the hash function is called multiple times especially when I am splitting buckets. *...
2015/12/18
[ "https://Stackoverflow.com/questions/34352840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4484809/" ]
You should prefer to use `std::hash` unless measurement shows that you can do better. To limit the number of characters it uses, use something like: ``` const auto limit = min(key.length(), 16); for(unsigned i = 0; i < limit; i++) ``` You will want to experiment to find the best value of 16 to use. I would ...
You can directly use `std::hash`[link](http://en.cppreference.com/w/cpp/string/basic_string/hash "std::hash") instead of implementing your own function. ``` #include <iostream> #include <functional> #include <string> size_t hash(const std::string& key) { std::hash<std::string> hasher; return hasher(key); } i...
34,352,840
I am using an extendible hash and I want to have strings as keys. The problem is that the current hash function that I am using iterates over the whole string/key and I think that this is pretty bad for the program's performance since the hash function is called multiple times especially when I am splitting buckets. *...
2015/12/18
[ "https://Stackoverflow.com/questions/34352840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4484809/" ]
You should prefer to use `std::hash` unless measurement shows that you can do better. To limit the number of characters it uses, use something like: ``` const auto limit = min(key.length(), 16); for(unsigned i = 0; i < limit; i++) ``` You will want to experiment to find the best value of 16 to use. I would ...
> > I am using an extendible hash and I want to have strings as keys. > > > As mentioned before, use `std::hash` until there is a good reason not to. > > The problem is that the current hash function that I am using iterates over the whole string/key and I think that this is pretty bad... > > > It's an under...
34,352,840
I am using an extendible hash and I want to have strings as keys. The problem is that the current hash function that I am using iterates over the whole string/key and I think that this is pretty bad for the program's performance since the hash function is called multiple times especially when I am splitting buckets. *...
2015/12/18
[ "https://Stackoverflow.com/questions/34352840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4484809/" ]
> > I am using an extendible hash and I want to have strings as keys. > > > As mentioned before, use `std::hash` until there is a good reason not to. > > The problem is that the current hash function that I am using iterates over the whole string/key and I think that this is pretty bad... > > > It's an under...
You can directly use `std::hash`[link](http://en.cppreference.com/w/cpp/string/basic_string/hash "std::hash") instead of implementing your own function. ``` #include <iostream> #include <functional> #include <string> size_t hash(const std::string& key) { std::hash<std::string> hasher; return hasher(key); } i...
3,412,699
Suppose you have the product of two expressions: $ 2^5$ \* $ 2^2$, the result will be : $ 2^{5+2}$ = $ 2^7$. This is because we know the exponent rule that if they have the same base, we can add the power. Is there a way to express the product of two expressions of different bases and powers into 1 expression with one ...
2019/10/28
[ "https://math.stackexchange.com/questions/3412699", "https://math.stackexchange.com", "https://math.stackexchange.com/users/711602/" ]
No, the definition you gave is correct. Take for example $\mathbb N$ with discrete metric. Of course $\mathbb N$ is dense in it self. If you use $\mathcal B(x\_0,\varepsilon )\setminus \{x\_0\}$ instead of $\mathcal B(x\_0,\varepsilon )$, then when $\varepsilon <1$ and $n\in\mathbb N$, you'll get $$\mathcal B(n,\vareps...
To rephrase the definition given, $$ \forall x\_0 \in B,\ \forall \varepsilon > 0,\ \exists a \in A,\ d(x\_0,a) < \varepsilon $$ where $d$ is the metric. If $x\_0 \in A$ already, then that's fine. But what's more interesting is that points of $B \setminus A$ also have points of $A$ arbitrarily close to them.
40,734,246
Consider the following (simplified) example where two lambda functions call each other, one of which also takes another function as an argument. I need to use lambda functions, since the functions also pass modified, nested functions between each other. ``` #include <iostream> using namespace std; auto f = [](int n,...
2016/11/22
[ "https://Stackoverflow.com/questions/40734246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4114626/" ]
You need to capture the lambda inside `g` (or vice versa). `g` and `f` are variables which are **pointing** to a (unnamed) function. Making these lambdas doesn't make sense. Lambdas work best when you need a function in local scope. You will have to convert at-least one of them as a function and do a forward-declare fo...
Use std::function to address the issue. ``` #include <functional> #include <iostream> std::function<int(int)> f; std::function<int(int)> g; int main() { f = [](int n) { if(n >= 5) return n; return g(n+1); }; g = [](int n) { if(n >= 5) return n; return f(n+1); }; ...
40,734,246
Consider the following (simplified) example where two lambda functions call each other, one of which also takes another function as an argument. I need to use lambda functions, since the functions also pass modified, nested functions between each other. ``` #include <iostream> using namespace std; auto f = [](int n,...
2016/11/22
[ "https://Stackoverflow.com/questions/40734246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4114626/" ]
You need to capture the lambda inside `g` (or vice versa). `g` and `f` are variables which are **pointing** to a (unnamed) function. Making these lambdas doesn't make sense. Lambdas work best when you need a function in local scope. You will have to convert at-least one of them as a function and do a forward-declare fo...
The type of a lambda is not well defined, so there isn't a straightfoward answer. I prefer @bashrc's answer, but if you insist on having two lambdas, this variation might do the job: ``` extern int (*f)(int n); auto g = [](int n) { if (n >= 5) return n; return f(n + 1); }; int (*f)(int n) = [](int n) { i...
40,734,246
Consider the following (simplified) example where two lambda functions call each other, one of which also takes another function as an argument. I need to use lambda functions, since the functions also pass modified, nested functions between each other. ``` #include <iostream> using namespace std; auto f = [](int n,...
2016/11/22
[ "https://Stackoverflow.com/questions/40734246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4114626/" ]
You need to capture the lambda inside `g` (or vice versa). `g` and `f` are variables which are **pointing** to a (unnamed) function. Making these lambdas doesn't make sense. Lambdas work best when you need a function in local scope. You will have to convert at-least one of them as a function and do a forward-declare fo...
This works on my machine: ``` #include <functional> #include <iostream> #include <stdio.h> using namespace std; extern function<int(int, function<int(int)>)> g; auto f = [](int n, function<int(int)> h) { if (n >= 5) return n; cout << "h is some function " << h(4.0) << endl; auto func = [h](int m) { retu...
1,701
Throughout both my academic and professional career I've encountered situations where in such roles (as most of us would have), where as a happy go lucky graduate who doesn't know it all (but thought I did) would attend meetings and I wouldn't know what certain industry terminology meant or understood certain aspects o...
2017/08/12
[ "https://interpersonal.stackexchange.com/questions/1701", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/2167/" ]
**Note**: as the question specifically aims at meetings, this answer aligns to that scenario. You'll have to weigh up the problems you face, either look attentive and eager to learn by overcoming your fear of looking stupid or keep doing what you're currently doing. But, my advice is if someone knows and you don't, **...
When is it OK to ask "stupid" questions? Whenever you need to! You're absolutely right that it is very common for people to find themselves in these situations. The reason for that is that no one will know everything as soon as they begin (a new job, project, class, etc.). And *that* is why there is no reason at all t...
1,701
Throughout both my academic and professional career I've encountered situations where in such roles (as most of us would have), where as a happy go lucky graduate who doesn't know it all (but thought I did) would attend meetings and I wouldn't know what certain industry terminology meant or understood certain aspects o...
2017/08/12
[ "https://interpersonal.stackexchange.com/questions/1701", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/2167/" ]
**Note**: as the question specifically aims at meetings, this answer aligns to that scenario. You'll have to weigh up the problems you face, either look attentive and eager to learn by overcoming your fear of looking stupid or keep doing what you're currently doing. But, my advice is if someone knows and you don't, **...
In your shoes, besides thinking about "when" to ask, I would think about *who* to ask. Your instinct of waiting until you are "offline" to ask is a good one. Unless you absolutely "need to" (you are one of the principal participants), you don't want to ask questions in front of a lot of people at a meeting. So the ot...
1,701
Throughout both my academic and professional career I've encountered situations where in such roles (as most of us would have), where as a happy go lucky graduate who doesn't know it all (but thought I did) would attend meetings and I wouldn't know what certain industry terminology meant or understood certain aspects o...
2017/08/12
[ "https://interpersonal.stackexchange.com/questions/1701", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/2167/" ]
**Note**: as the question specifically aims at meetings, this answer aligns to that scenario. You'll have to weigh up the problems you face, either look attentive and eager to learn by overcoming your fear of looking stupid or keep doing what you're currently doing. But, my advice is if someone knows and you don't, **...
Your question seems to be directed towards meetings specifically, and not so much towards a classroom/group setting ... that being said, I suggest you ask for an agenda in advance for the meetings to which you are attending. Meetings should have an agenda anyway to keep people on task and efficient. This will give y...
1,701
Throughout both my academic and professional career I've encountered situations where in such roles (as most of us would have), where as a happy go lucky graduate who doesn't know it all (but thought I did) would attend meetings and I wouldn't know what certain industry terminology meant or understood certain aspects o...
2017/08/12
[ "https://interpersonal.stackexchange.com/questions/1701", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/2167/" ]
In your shoes, besides thinking about "when" to ask, I would think about *who* to ask. Your instinct of waiting until you are "offline" to ask is a good one. Unless you absolutely "need to" (you are one of the principal participants), you don't want to ask questions in front of a lot of people at a meeting. So the ot...
When is it OK to ask "stupid" questions? Whenever you need to! You're absolutely right that it is very common for people to find themselves in these situations. The reason for that is that no one will know everything as soon as they begin (a new job, project, class, etc.). And *that* is why there is no reason at all t...
1,701
Throughout both my academic and professional career I've encountered situations where in such roles (as most of us would have), where as a happy go lucky graduate who doesn't know it all (but thought I did) would attend meetings and I wouldn't know what certain industry terminology meant or understood certain aspects o...
2017/08/12
[ "https://interpersonal.stackexchange.com/questions/1701", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/2167/" ]
In your shoes, besides thinking about "when" to ask, I would think about *who* to ask. Your instinct of waiting until you are "offline" to ask is a good one. Unless you absolutely "need to" (you are one of the principal participants), you don't want to ask questions in front of a lot of people at a meeting. So the ot...
Your question seems to be directed towards meetings specifically, and not so much towards a classroom/group setting ... that being said, I suggest you ask for an agenda in advance for the meetings to which you are attending. Meetings should have an agenda anyway to keep people on task and efficient. This will give y...
6,825,198
I have a large text string and about 200 keywords that I want to filter out of the text. There are numerous ways todo this, but I'm stuck on which way is the best: 1) Use a for loop with a gsub for each keyword 3) Use a massive regular expression Any other ideas, what would you guys suggest
2011/07/26
[ "https://Stackoverflow.com/questions/6825198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340939/" ]
A massive regex is faster as it's going to walk the text only once. Also, if you don't need the text, only the words, at the end, you can make the text a Set of downcased words and then remove the words that are in the filter array. But this only works if you don't need the "text" to make sense at the end (usually fo...
Create a hash with each valid keyword as key. ``` keywords = %w[foo bar baz] keywords_hash = Hash[keywords.map{|k|[k,true]}] ``` Assuming all keywords are 3 letters or more, and consist of alphanumeric characters or a dash, case is irrelevant, and you only want each keyword present in the text returned once: ``` ke...
15,843,230
i have an XML that we were able to generate using HAPI libraries and use XSL to change the format of the XML. I am using the following template. The current template looks at the OBX.5 segment for a digital value and then interprets the OBX6 (units of measure). However I am trying to also interpret the OBX6 when they c...
2013/04/05
[ "https://Stackoverflow.com/questions/15843230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/552782/" ]
**Use**: ``` tokenize(hl7:CE.1, '\^')[1] ``` **Here is a simple XSLT 2.0 - based verification:** ``` <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:template match="OBX.6"> <x...
I also found that HAPI can be tweaked to delimit within the segments by line terminator, `|` for segment terminator and `^` for field terminator. This helped immensely The corresponding xsl looks like: ``` <xsl:template match="hl7:OBX.6[matches(./../hl7:OBX.5, '^\d+(\.\d+)?$') ]"> <xsl:if test="hl7:CE.1[ index-...
2,653,047
So I'm trying to register for the MPMoviePlayerDidExitFullscreenNotification notification in my universal app (iPhone and iPad). Problem is, OS 3.1.3 doesn't support this notification, and just crashes. I've tried version checking, like so: ``` if ([MPMoviePlayerController instancesRespondToSelector:@selector(setSho...
2010/04/16
[ "https://Stackoverflow.com/questions/2653047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310175/" ]
Since MPMoviePlayerDidExitFullscreenNotification is a symbol, it must be known at (dynamic) link time for any versions. Run time check doesn't help. To solve this, you need to delay loading of this to run time. You could use `dlsym`: ``` NSString* x_MPMoviePlayerDidExitFullscreenNotification = dlsym(RTLD_DEFAULT, "...
To answer your actual question: You should be able to register for any notification without crashing. As Kenny says, it's a symbol, so the correct registration for 3.2 is; ``` [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerDidFinish:) name:MPMoviePlayerDidExitFullscreenNotification ob...
2,653,047
So I'm trying to register for the MPMoviePlayerDidExitFullscreenNotification notification in my universal app (iPhone and iPad). Problem is, OS 3.1.3 doesn't support this notification, and just crashes. I've tried version checking, like so: ``` if ([MPMoviePlayerController instancesRespondToSelector:@selector(setSho...
2010/04/16
[ "https://Stackoverflow.com/questions/2653047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310175/" ]
Since MPMoviePlayerDidExitFullscreenNotification is a symbol, it must be known at (dynamic) link time for any versions. Run time check doesn't help. To solve this, you need to delay loading of this to run time. You could use `dlsym`: ``` NSString* x_MPMoviePlayerDidExitFullscreenNotification = dlsym(RTLD_DEFAULT, "...
This also works: ``` if (&MPMoviePlayerDidExitFullscreenNotification) { } ``` Note you have to check the address of the symbol otherwise you will get a crash.
2,653,047
So I'm trying to register for the MPMoviePlayerDidExitFullscreenNotification notification in my universal app (iPhone and iPad). Problem is, OS 3.1.3 doesn't support this notification, and just crashes. I've tried version checking, like so: ``` if ([MPMoviePlayerController instancesRespondToSelector:@selector(setSho...
2010/04/16
[ "https://Stackoverflow.com/questions/2653047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310175/" ]
Since MPMoviePlayerDidExitFullscreenNotification is a symbol, it must be known at (dynamic) link time for any versions. Run time check doesn't help. To solve this, you need to delay loading of this to run time. You could use `dlsym`: ``` NSString* x_MPMoviePlayerDidExitFullscreenNotification = dlsym(RTLD_DEFAULT, "...
I needed exactly this but I did prefer using `dlsym` as KennyTM suggested, however, I needed to do a small change for it to work so I guess that was a bug (please correct me if I'm wrong). This is the code snippet I'm using which works great: ``` NSString* x_MPMoviePlayerDidExitFullscreenNotification = *(NSString**)dl...
2,653,047
So I'm trying to register for the MPMoviePlayerDidExitFullscreenNotification notification in my universal app (iPhone and iPad). Problem is, OS 3.1.3 doesn't support this notification, and just crashes. I've tried version checking, like so: ``` if ([MPMoviePlayerController instancesRespondToSelector:@selector(setSho...
2010/04/16
[ "https://Stackoverflow.com/questions/2653047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310175/" ]
This also works: ``` if (&MPMoviePlayerDidExitFullscreenNotification) { } ``` Note you have to check the address of the symbol otherwise you will get a crash.
To answer your actual question: You should be able to register for any notification without crashing. As Kenny says, it's a symbol, so the correct registration for 3.2 is; ``` [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerDidFinish:) name:MPMoviePlayerDidExitFullscreenNotification ob...
2,653,047
So I'm trying to register for the MPMoviePlayerDidExitFullscreenNotification notification in my universal app (iPhone and iPad). Problem is, OS 3.1.3 doesn't support this notification, and just crashes. I've tried version checking, like so: ``` if ([MPMoviePlayerController instancesRespondToSelector:@selector(setSho...
2010/04/16
[ "https://Stackoverflow.com/questions/2653047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310175/" ]
This also works: ``` if (&MPMoviePlayerDidExitFullscreenNotification) { } ``` Note you have to check the address of the symbol otherwise you will get a crash.
I needed exactly this but I did prefer using `dlsym` as KennyTM suggested, however, I needed to do a small change for it to work so I guess that was a bug (please correct me if I'm wrong). This is the code snippet I'm using which works great: ``` NSString* x_MPMoviePlayerDidExitFullscreenNotification = *(NSString**)dl...
21,951,969
In Eclipse, there is an option Export -> JAR File. Then we select desirable classes which want to export to output jar. How can we do that in IntelliJ?
2014/02/22
[ "https://Stackoverflow.com/questions/21951969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361910/" ]
I don't know if you need this answer anymore, but I had the same issue today and I figured out how to solve it. Please, follow these steps: 1. File -> Project Structure (Ctrl + Alt + Shift + S); 2. Go to the "Artifacts" Menu -> click on the "+" button -> JAR -> From modules with dependencies... 3. Select the module yo...
You can use Ant to do that. 1. Create your Ant project. 2. Drag and drop ant file to Ant Build view. 3. Execute the task to generate the .jar file. [![ IntelliJ Ant Build view](https://i.stack.imgur.com/MyNEw.png)](https://i.stack.imgur.com/MyNEw.png) ``` <?xml version="1.0" encoding="utf-8"?> <project name="CustomJ...
36,502,572
``` function convertToRoman(num) { //seperate the number in to singular digits which are strings and pass to array. var array = ("" + num).split(""), arrayLength = array.length, romStr = ""; //Convert the strings in the array to numbers array = array.map(Number); //Itterate over every number i...
2016/04/08
[ "https://Stackoverflow.com/questions/36502572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5950725/" ]
It seems to me your problem is in the use of `array.indexOf(array[i])` to calculate the power. Guess what, if you have the same value in your array twice, **the first found index is returned**, not the index of your *current* element. Guess what the index of your current element actually is? → `i` No need for `ind...
Because Javascript uses function closures and your loop doesn't reset the values by default, in other words the variables inside the for still exists outside of it.
36,502,572
``` function convertToRoman(num) { //seperate the number in to singular digits which are strings and pass to array. var array = ("" + num).split(""), arrayLength = array.length, romStr = ""; //Convert the strings in the array to numbers array = array.map(Number); //Itterate over every number i...
2016/04/08
[ "https://Stackoverflow.com/questions/36502572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5950725/" ]
It seems to me your problem is in the use of `array.indexOf(array[i])` to calculate the power. Guess what, if you have the same value in your array twice, **the first found index is returned**, not the index of your *current* element. Guess what the index of your current element actually is? → `i` No need for `ind...
Variables declared as `var` inside a `for` loop are not reset on each iteration, it has nothing to do with the `switch`. Try pasting this into your console - ``` for (var i = 1; i <= 10; i++) { console.log('before', i, j); var j = i * 10; console.log('after', i, j); } ``` Note that on the first loop, th...
28,828,145
I got a table named "Stock" as shown below. ``` +-----------+--------------+---------------+---------+ | client_id | date | credit | debit| +-----------+--------------+---------------+---------+ | 1 | 01-01-2015 | 50 | 0 | | 2 | 01-01-2015 | 250 | ...
2015/03/03
[ "https://Stackoverflow.com/questions/28828145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4608311/" ]
Here how you can do it.. ``` select s.client_id, s.date, s.op_balance as Open_Balance, s.credit, s.debit, s.balance from ( select t.client_id, t.date, t.credit, t.debit, @tot_credit := if(@prev_client = t.client_id, @tot_credit + t.credit,t.credit) as tot_cred, @tot_debit := if(@prev_client = t.client_...
First of all set two variables for open balance and balance; ``` mysql> set @balance = 0; mysql> set @openBalance = 0; ``` then set id variable ``` mysql> set @id := (select client_id from Stock order by client_id asc limit 1); ``` and now run this query ``` select client_id,date,IF(client_id=@id,@balance:=@bal...
3,241,286
The problem is to solve this: $$a^2 + b^2 =c^4 \text{ }a,b,c\in \Bbb{N}\text{ }a,b,c<100$$ My idea: To see this problem I at first must see idea with Pythagorean triplets, and to problem is to find hypotheses of length square number. Is there any easier approach to this problem?
2019/05/27
[ "https://math.stackexchange.com/questions/3241286", "https://math.stackexchange.com", "https://math.stackexchange.com/users/259483/" ]
I think, the way with using Pythagorean triplets is the best. Let $\gcd(a,b,c)=1$. Thus, there are natural $m$ and $n$ with different parity such that $m>n$ and $\gcd(m,n)=1$ and $a=2mn,$ $b=m^2-n^2$. Thus, $c^2=m^2+m^2$ and by the same way there are naturals $p$ and $q$ with a different parity, such that $p>q$, $\g...
All Solutions are $$(a=7\land b=24\land c=5)\lor (a=15\land b=20\land c=5)\lor (a=20\land b=15\land c=5)\lor (a=24\land b=7\land c=5)\lor (a=28\land b=96\land c=10)\lor (a=60\land b=80\land c=10)\lor (a=80\land b=60\land c=10)\lor (a=96\land b=28\land c=10)$$
3,241,286
The problem is to solve this: $$a^2 + b^2 =c^4 \text{ }a,b,c\in \Bbb{N}\text{ }a,b,c<100$$ My idea: To see this problem I at first must see idea with Pythagorean triplets, and to problem is to find hypotheses of length square number. Is there any easier approach to this problem?
2019/05/27
[ "https://math.stackexchange.com/questions/3241286", "https://math.stackexchange.com", "https://math.stackexchange.com/users/259483/" ]
I think, the way with using Pythagorean triplets is the best. Let $\gcd(a,b,c)=1$. Thus, there are natural $m$ and $n$ with different parity such that $m>n$ and $\gcd(m,n)=1$ and $a=2mn,$ $b=m^2-n^2$. Thus, $c^2=m^2+m^2$ and by the same way there are naturals $p$ and $q$ with a different parity, such that $p>q$, $\g...
We need to find Pythagorean triples where the hypotenuse is already a square. We can certainly use $5\*(3,4,5)=(15,20,25)$ or $20\*(3,4,5)=(60,80,100)$ but we can also use the following formula to find one or more triples for a given hypotenuse, if they exist. For any $C,m$ that yields an integer, we have the $m,n$ we ...
3,241,286
The problem is to solve this: $$a^2 + b^2 =c^4 \text{ }a,b,c\in \Bbb{N}\text{ }a,b,c<100$$ My idea: To see this problem I at first must see idea with Pythagorean triplets, and to problem is to find hypotheses of length square number. Is there any easier approach to this problem?
2019/05/27
[ "https://math.stackexchange.com/questions/3241286", "https://math.stackexchange.com", "https://math.stackexchange.com/users/259483/" ]
I think, the way with using Pythagorean triplets is the best. Let $\gcd(a,b,c)=1$. Thus, there are natural $m$ and $n$ with different parity such that $m>n$ and $\gcd(m,n)=1$ and $a=2mn,$ $b=m^2-n^2$. Thus, $c^2=m^2+m^2$ and by the same way there are naturals $p$ and $q$ with a different parity, such that $p>q$, $\g...
> > $a^2 + b^2 =c^4 \quad a,b,c\in \Bbb{N}\quad a,b,c<100$ > > > and > > Can you please comment how you get this solutions? > > > The involved numbers are so small we can compute everything by hand and without brute-force search or such: Due to $a, b < 100$ we have $c^4=a^2+b^2 < 2\cdot 100^2$ and thus $$c...
41,411,432
Simple Code: ``` <div id="right"> <h2>Zamiana jednostek temperatury</h2> temperatura w <sup>o</sup>Celsjusza<br> <input type="text" id="cyfry" name="cyfry"><br> <button onclick="fahrenheit()">Fahrenheit</button> <button onclick="kelwin()">Kelwin</button> <span id="w...
2016/12/31
[ "https://Stackoverflow.com/questions/41411432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7361359/" ]
You should use document.getElementById **not** Document.getElementById . Heres a working solution. Hope it helps! ```js function fahrenheit(){ var x=document.getElementById("cyfry"); parseInt(x); x = (x*1,8)+32; document.getElementById("wynik").innerHTML=x; } function kelwin(){ var x=documen...
JavaScript is a case sensitive language. You have to use the uncapitalized `document`, not `Document`
15,760,336
These two views are inside of `RelativeLayout`. The IDE throws an error there is no `@id/et_pass`, but if I set `@+id/et_pass` it is OK. Why is that? ``` <ImageView android:id="@+id/devider_zero" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/et_pass...
2013/04/02
[ "https://Stackoverflow.com/questions/15760336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397991/" ]
You did not allocate any memory for the pointer to point at. You can do so like this: ``` int *a = malloc(sizeof(*a)); ``` or like this: ``` int value; int *a = &value; ``` If you allocate with `malloc` then you'll want to call `free` on the pointer when you are finished using it. Accessing an uninitialized poin...
In `int* a;` `a`'s default value is garbage, and points to an invalid memory, you can't assign to that. And assignment like `*a=20;` this is causes an undefined behavior at run time. (syntax wise code is correct so compiled) you may some time get a seg-fault too. either do: ``` int i; int *a = &i; // a points to a...
15,760,336
These two views are inside of `RelativeLayout`. The IDE throws an error there is no `@id/et_pass`, but if I set `@+id/et_pass` it is OK. Why is that? ``` <ImageView android:id="@+id/devider_zero" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/et_pass...
2013/04/02
[ "https://Stackoverflow.com/questions/15760336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397991/" ]
You did not allocate any memory for the pointer to point at. You can do so like this: ``` int *a = malloc(sizeof(*a)); ``` or like this: ``` int value; int *a = &value; ``` If you allocate with `malloc` then you'll want to call `free` on the pointer when you are finished using it. Accessing an uninitialized poin...
You have `wild pointer`, either assign memory to it using `malloc` ``` int* a = malloc(sizeof(int)); ``` or use a stack variable ``` int b = 0; int *a = &b; *a=20; ```
15,760,336
These two views are inside of `RelativeLayout`. The IDE throws an error there is no `@id/et_pass`, but if I set `@+id/et_pass` it is OK. Why is that? ``` <ImageView android:id="@+id/devider_zero" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/et_pass...
2013/04/02
[ "https://Stackoverflow.com/questions/15760336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397991/" ]
You did not allocate any memory for the pointer to point at. You can do so like this: ``` int *a = malloc(sizeof(*a)); ``` or like this: ``` int value; int *a = &value; ``` If you allocate with `malloc` then you'll want to call `free` on the pointer when you are finished using it. Accessing an uninitialized poin...
The problem is in your assignment \*a = 20. You can't allocate a value to a pointer variable like that. int b = 20; a = &b Thanks, Santhosh
15,760,336
These two views are inside of `RelativeLayout`. The IDE throws an error there is no `@id/et_pass`, but if I set `@+id/et_pass` it is OK. Why is that? ``` <ImageView android:id="@+id/devider_zero" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/et_pass...
2013/04/02
[ "https://Stackoverflow.com/questions/15760336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397991/" ]
In `int* a;` `a`'s default value is garbage, and points to an invalid memory, you can't assign to that. And assignment like `*a=20;` this is causes an undefined behavior at run time. (syntax wise code is correct so compiled) you may some time get a seg-fault too. either do: ``` int i; int *a = &i; // a points to a...
You have `wild pointer`, either assign memory to it using `malloc` ``` int* a = malloc(sizeof(int)); ``` or use a stack variable ``` int b = 0; int *a = &b; *a=20; ```
15,760,336
These two views are inside of `RelativeLayout`. The IDE throws an error there is no `@id/et_pass`, but if I set `@+id/et_pass` it is OK. Why is that? ``` <ImageView android:id="@+id/devider_zero" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/et_pass...
2013/04/02
[ "https://Stackoverflow.com/questions/15760336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397991/" ]
In `int* a;` `a`'s default value is garbage, and points to an invalid memory, you can't assign to that. And assignment like `*a=20;` this is causes an undefined behavior at run time. (syntax wise code is correct so compiled) you may some time get a seg-fault too. either do: ``` int i; int *a = &i; // a points to a...
The problem is in your assignment \*a = 20. You can't allocate a value to a pointer variable like that. int b = 20; a = &b Thanks, Santhosh
65,854,355
I'm doing a project and I'm having problems moving files into different subfolders. So for example, I have 2 files in the main folder, I want to read the first line, and if the first line has the word "Job", then I will move to the subfolder (main\_folder/files/jobs). My code looks like this: ``` # Get all file names ...
2021/01/23
[ "https://Stackoverflow.com/questions/65854355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11639529/" ]
You're getting the error because you're trying to move move the file that you have open for reading inside the `with` statement. The following avoids that by moving the call to `move_files()` so it isn't called until the file has been closed. ``` # Read files and separate them def categorize_files(files): for file...
Your file is being Used, Just close the program that it uses in the Taskmanager.
65,854,355
I'm doing a project and I'm having problems moving files into different subfolders. So for example, I have 2 files in the main folder, I want to read the first line, and if the first line has the word "Job", then I will move to the subfolder (main\_folder/files/jobs). My code looks like this: ``` # Get all file names ...
2021/01/23
[ "https://Stackoverflow.com/questions/65854355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11639529/" ]
The error happens because you are trying to move a file while it is active and being read inside the `with` statement. The problem should be fixed if you un-indent the `if` statement by one layer. This should close the file and allow it to be moved. Here is the code: ``` # Read files and separate them def categorize_f...
Your file is being Used, Just close the program that it uses in the Taskmanager.
65,854,355
I'm doing a project and I'm having problems moving files into different subfolders. So for example, I have 2 files in the main folder, I want to read the first line, and if the first line has the word "Job", then I will move to the subfolder (main\_folder/files/jobs). My code looks like this: ``` # Get all file names ...
2021/01/23
[ "https://Stackoverflow.com/questions/65854355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11639529/" ]
The easiest solution is just to unindent the `if` block in your program. ``` # Get all file names in the directory def file_names(): files = [file for file in listdir(source_dir) if file.endswith('csv')] return files # Read files and separate them def categorize_files(files): for file in files: w...
Your file is being Used, Just close the program that it uses in the Taskmanager.
65,854,355
I'm doing a project and I'm having problems moving files into different subfolders. So for example, I have 2 files in the main folder, I want to read the first line, and if the first line has the word "Job", then I will move to the subfolder (main\_folder/files/jobs). My code looks like this: ``` # Get all file names ...
2021/01/23
[ "https://Stackoverflow.com/questions/65854355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11639529/" ]
The error happens because you are trying to move a file while it is active and being read inside the `with` statement. The problem should be fixed if you un-indent the `if` statement by one layer. This should close the file and allow it to be moved. Here is the code: ``` # Read files and separate them def categorize_f...
You're getting the error because you're trying to move move the file that you have open for reading inside the `with` statement. The following avoids that by moving the call to `move_files()` so it isn't called until the file has been closed. ``` # Read files and separate them def categorize_files(files): for file...
65,854,355
I'm doing a project and I'm having problems moving files into different subfolders. So for example, I have 2 files in the main folder, I want to read the first line, and if the first line has the word "Job", then I will move to the subfolder (main\_folder/files/jobs). My code looks like this: ``` # Get all file names ...
2021/01/23
[ "https://Stackoverflow.com/questions/65854355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11639529/" ]
The easiest solution is just to unindent the `if` block in your program. ``` # Get all file names in the directory def file_names(): files = [file for file in listdir(source_dir) if file.endswith('csv')] return files # Read files and separate them def categorize_files(files): for file in files: w...
You're getting the error because you're trying to move move the file that you have open for reading inside the `with` statement. The following avoids that by moving the call to `move_files()` so it isn't called until the file has been closed. ``` # Read files and separate them def categorize_files(files): for file...
14,138,188
[the error and the class http://puu.sh/1ITnS.png](http://puu.sh/1ITnS.png) When I name the class file Main.class, java says it has the wrong name, and when I name it shop.Main.class it says that the main class can't be found. Can anyone help? ``` package shop; import java.text.DecimalFormat; public class Main { ...
2013/01/03
[ "https://Stackoverflow.com/questions/14138188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1774214/" ]
keep it Main.class and try `java shop.Main` from command line in java folder
compile: ~/java> javac shop/Main.java run: ~/java> java shop.Main
14,138,188
[the error and the class http://puu.sh/1ITnS.png](http://puu.sh/1ITnS.png) When I name the class file Main.class, java says it has the wrong name, and when I name it shop.Main.class it says that the main class can't be found. Can anyone help? ``` package shop; import java.text.DecimalFormat; public class Main { ...
2013/01/03
[ "https://Stackoverflow.com/questions/14138188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1774214/" ]
keep it Main.class and try `java shop.Main` from command line in java folder
You should be careful to place classes in correct folders if compiling manually (package name equals folder name on disk). I recommend using an IDE (Eclipse and Netbeans are both good and free choices). Your example will work if you place Main.class in folder called "shop" and then from project root folder execute "ja...
14,138,188
[the error and the class http://puu.sh/1ITnS.png](http://puu.sh/1ITnS.png) When I name the class file Main.class, java says it has the wrong name, and when I name it shop.Main.class it says that the main class can't be found. Can anyone help? ``` package shop; import java.text.DecimalFormat; public class Main { ...
2013/01/03
[ "https://Stackoverflow.com/questions/14138188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1774214/" ]
Execute these commands: ``` cd .. java shop.Main ``` You can't run java code from inside a package you are trying to reference.
compile: ~/java> javac shop/Main.java run: ~/java> java shop.Main
14,138,188
[the error and the class http://puu.sh/1ITnS.png](http://puu.sh/1ITnS.png) When I name the class file Main.class, java says it has the wrong name, and when I name it shop.Main.class it says that the main class can't be found. Can anyone help? ``` package shop; import java.text.DecimalFormat; public class Main { ...
2013/01/03
[ "https://Stackoverflow.com/questions/14138188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1774214/" ]
compile: ~/java> javac shop/Main.java run: ~/java> java shop.Main
You should be careful to place classes in correct folders if compiling manually (package name equals folder name on disk). I recommend using an IDE (Eclipse and Netbeans are both good and free choices). Your example will work if you place Main.class in folder called "shop" and then from project root folder execute "ja...
14,138,188
[the error and the class http://puu.sh/1ITnS.png](http://puu.sh/1ITnS.png) When I name the class file Main.class, java says it has the wrong name, and when I name it shop.Main.class it says that the main class can't be found. Can anyone help? ``` package shop; import java.text.DecimalFormat; public class Main { ...
2013/01/03
[ "https://Stackoverflow.com/questions/14138188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1774214/" ]
Execute these commands: ``` cd .. java shop.Main ``` You can't run java code from inside a package you are trying to reference.
You should be careful to place classes in correct folders if compiling manually (package name equals folder name on disk). I recommend using an IDE (Eclipse and Netbeans are both good and free choices). Your example will work if you place Main.class in folder called "shop" and then from project root folder execute "ja...
44,135,248
I am trying to retrieve data from excel and put them into the following format in python: ``` dataset={ 'User A': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5, 'Just My Luck': 3.0, 'Superman Returns': 3.5, ...
2017/05/23
[ "https://Stackoverflow.com/questions/44135248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7677413/" ]
The `pandas` module makes this pretty easy: ``` import pandas as pd df = pd.read_excel('workbook.xlsx', index_col=0) dataset = df.to_dict() ``` In this code the `pd.read_excel` function collects all data from the excel file and stores it into a pandas [DataFrame](https://pandas.pydata.org/pandas-docs/stable/dsintro....
Another way is through openpyxl: ``` from openpyxl import Workbook wb = load_workbook(filename = 'workbook.xlsx') sheet_ranges = wb['cell range'] values = sheet_ranges['cell locations'].values() data = values.to_dict() ```
28,645
I'm developing a finite volume solver for the simple twodimensional advection equation with constant velocities $u, v$ and constant mesh spaces $\Delta x$: $$ \frac{\partial \rho}{\partial t} + u \frac{\partial \rho}{\partial x} + v \frac{\partial \rho}{\partial y} = 0$$ where $u,v > 0$. According to [this lecture](h...
2018/01/18
[ "https://scicomp.stackexchange.com/questions/28645", "https://scicomp.stackexchange.com", "https://scicomp.stackexchange.com/users/26461/" ]
Oscillations is a natural result of higher-order approximations near discontinuities/shocks for hyperbolic conservation laws. Recall that the finite-difference approximations you have listed are generally derived using truncated Taylor expansions, which requires a degree of smoothness which is not present in your model...
Each numerical scheme can have a different stability condition, so you can not use the single one as suggested by the page in Wikipedia. Simply try a smaller time step and if your code is correct you should obtain a stable solution for enough small time step. I am on phone so i can not check it and write it in a mathem...
28,645
I'm developing a finite volume solver for the simple twodimensional advection equation with constant velocities $u, v$ and constant mesh spaces $\Delta x$: $$ \frac{\partial \rho}{\partial t} + u \frac{\partial \rho}{\partial x} + v \frac{\partial \rho}{\partial y} = 0$$ where $u,v > 0$. According to [this lecture](h...
2018/01/18
[ "https://scicomp.stackexchange.com/questions/28645", "https://scicomp.stackexchange.com", "https://scicomp.stackexchange.com/users/26461/" ]
It turns out that the main problem here was that I thought just naively extending the 1D advection $$ \rho^{n+1}\_{i} = \rho^n\_{i} + u\frac{\Delta t}{\Delta x}(\rho^n\_{i-1/2} - \rho^n\_{i+1/2}) $$ to 2D just by adding the $y$ term like this: $$ \rho^{n+1}\_{i,j} = \rho^n\_{i,j} + u\frac{\Delta t}{\Delta x}(\rho^n\_...
Each numerical scheme can have a different stability condition, so you can not use the single one as suggested by the page in Wikipedia. Simply try a smaller time step and if your code is correct you should obtain a stable solution for enough small time step. I am on phone so i can not check it and write it in a mathem...
28,645
I'm developing a finite volume solver for the simple twodimensional advection equation with constant velocities $u, v$ and constant mesh spaces $\Delta x$: $$ \frac{\partial \rho}{\partial t} + u \frac{\partial \rho}{\partial x} + v \frac{\partial \rho}{\partial y} = 0$$ where $u,v > 0$. According to [this lecture](h...
2018/01/18
[ "https://scicomp.stackexchange.com/questions/28645", "https://scicomp.stackexchange.com", "https://scicomp.stackexchange.com/users/26461/" ]
Oscillations is a natural result of higher-order approximations near discontinuities/shocks for hyperbolic conservation laws. Recall that the finite-difference approximations you have listed are generally derived using truncated Taylor expansions, which requires a degree of smoothness which is not present in your model...
A numerical scheme can be unconditionally unstable, conditionally stable and unconditionally stable. You would want the later two. I would recommend that you learn to do **Von-Neumann stability analysis** for numerical schemes. You learn it once. And you can find yourself the stability status of any arbitrary gov...
28,645
I'm developing a finite volume solver for the simple twodimensional advection equation with constant velocities $u, v$ and constant mesh spaces $\Delta x$: $$ \frac{\partial \rho}{\partial t} + u \frac{\partial \rho}{\partial x} + v \frac{\partial \rho}{\partial y} = 0$$ where $u,v > 0$. According to [this lecture](h...
2018/01/18
[ "https://scicomp.stackexchange.com/questions/28645", "https://scicomp.stackexchange.com", "https://scicomp.stackexchange.com/users/26461/" ]
It turns out that the main problem here was that I thought just naively extending the 1D advection $$ \rho^{n+1}\_{i} = \rho^n\_{i} + u\frac{\Delta t}{\Delta x}(\rho^n\_{i-1/2} - \rho^n\_{i+1/2}) $$ to 2D just by adding the $y$ term like this: $$ \rho^{n+1}\_{i,j} = \rho^n\_{i,j} + u\frac{\Delta t}{\Delta x}(\rho^n\_...
A numerical scheme can be unconditionally unstable, conditionally stable and unconditionally stable. You would want the later two. I would recommend that you learn to do **Von-Neumann stability analysis** for numerical schemes. You learn it once. And you can find yourself the stability status of any arbitrary gov...
28,645
I'm developing a finite volume solver for the simple twodimensional advection equation with constant velocities $u, v$ and constant mesh spaces $\Delta x$: $$ \frac{\partial \rho}{\partial t} + u \frac{\partial \rho}{\partial x} + v \frac{\partial \rho}{\partial y} = 0$$ where $u,v > 0$. According to [this lecture](h...
2018/01/18
[ "https://scicomp.stackexchange.com/questions/28645", "https://scicomp.stackexchange.com", "https://scicomp.stackexchange.com/users/26461/" ]
It turns out that the main problem here was that I thought just naively extending the 1D advection $$ \rho^{n+1}\_{i} = \rho^n\_{i} + u\frac{\Delta t}{\Delta x}(\rho^n\_{i-1/2} - \rho^n\_{i+1/2}) $$ to 2D just by adding the $y$ term like this: $$ \rho^{n+1}\_{i,j} = \rho^n\_{i,j} + u\frac{\Delta t}{\Delta x}(\rho^n\_...
Oscillations is a natural result of higher-order approximations near discontinuities/shocks for hyperbolic conservation laws. Recall that the finite-difference approximations you have listed are generally derived using truncated Taylor expansions, which requires a degree of smoothness which is not present in your model...
21,107,057
Is it possible automatically add `Access-Control-Allow-Origin` header to all responses which was initiated by ajax request (with header `X-Requested-With`) in Pyramid?
2014/01/14
[ "https://Stackoverflow.com/questions/21107057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/813758/" ]
I've solved the problem using `set_request_factory`: ``` from pyramid.request import Request from pyramid.request import Response def request_factory(environ): request = Request(environ) if request.is_xhr: request.response = Response() request.response.headerlist = [] request.response....
I could send file with Ajax from a server to another server : ``` import uuid from pyramid.view import view_config from pyramid.response import Response class FManager: def __init__(self, request): self.request = request @view_config(route_name='f_manager', request_method='POST', renderer='json') ...
21,107,057
Is it possible automatically add `Access-Control-Allow-Origin` header to all responses which was initiated by ajax request (with header `X-Requested-With`) in Pyramid?
2014/01/14
[ "https://Stackoverflow.com/questions/21107057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/813758/" ]
I've solved the problem using `set_request_factory`: ``` from pyramid.request import Request from pyramid.request import Response def request_factory(environ): request = Request(environ) if request.is_xhr: request.response = Response() request.response.headerlist = [] request.response....
Here is another solution: ``` from pyramid.events import NewResponse, subscriber @subscriber(NewResponse) def add_cors_headers(event): if event.request.is_xhr: event.response.headers.update({ 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', }) ```
21,107,057
Is it possible automatically add `Access-Control-Allow-Origin` header to all responses which was initiated by ajax request (with header `X-Requested-With`) in Pyramid?
2014/01/14
[ "https://Stackoverflow.com/questions/21107057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/813758/" ]
I've solved the problem using `set_request_factory`: ``` from pyramid.request import Request from pyramid.request import Response def request_factory(environ): request = Request(environ) if request.is_xhr: request.response = Response() request.response.headerlist = [] request.response....
I fixed this with add some headers to response, by create a response callback: `pyramid.events.NewResponse` **cors.py** ``` from pyramid.security import NO_PERMISSION_REQUIRED def includeme(config): config.add_directive( 'add_cors_preflight_handler', add_cors_preflight_handler) config.add_route_predi...
21,107,057
Is it possible automatically add `Access-Control-Allow-Origin` header to all responses which was initiated by ajax request (with header `X-Requested-With`) in Pyramid?
2014/01/14
[ "https://Stackoverflow.com/questions/21107057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/813758/" ]
There are several ways to do this: 1) a custom request factory like drnextgis showed, a NewRequest event handler, or a tween. A tween is almost certainly not the right way to do this, so I won't show that. Here is the event handler version: ``` def add_cors_headers_response_callback(event): def cors_headers(reques...
I could send file with Ajax from a server to another server : ``` import uuid from pyramid.view import view_config from pyramid.response import Response class FManager: def __init__(self, request): self.request = request @view_config(route_name='f_manager', request_method='POST', renderer='json') ...
21,107,057
Is it possible automatically add `Access-Control-Allow-Origin` header to all responses which was initiated by ajax request (with header `X-Requested-With`) in Pyramid?
2014/01/14
[ "https://Stackoverflow.com/questions/21107057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/813758/" ]
There are several ways to do this: 1) a custom request factory like drnextgis showed, a NewRequest event handler, or a tween. A tween is almost certainly not the right way to do this, so I won't show that. Here is the event handler version: ``` def add_cors_headers_response_callback(event): def cors_headers(reques...
Here is another solution: ``` from pyramid.events import NewResponse, subscriber @subscriber(NewResponse) def add_cors_headers(event): if event.request.is_xhr: event.response.headers.update({ 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', }) ```
21,107,057
Is it possible automatically add `Access-Control-Allow-Origin` header to all responses which was initiated by ajax request (with header `X-Requested-With`) in Pyramid?
2014/01/14
[ "https://Stackoverflow.com/questions/21107057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/813758/" ]
There are several ways to do this: 1) a custom request factory like drnextgis showed, a NewRequest event handler, or a tween. A tween is almost certainly not the right way to do this, so I won't show that. Here is the event handler version: ``` def add_cors_headers_response_callback(event): def cors_headers(reques...
I fixed this with add some headers to response, by create a response callback: `pyramid.events.NewResponse` **cors.py** ``` from pyramid.security import NO_PERMISSION_REQUIRED def includeme(config): config.add_directive( 'add_cors_preflight_handler', add_cors_preflight_handler) config.add_route_predi...
21,107,057
Is it possible automatically add `Access-Control-Allow-Origin` header to all responses which was initiated by ajax request (with header `X-Requested-With`) in Pyramid?
2014/01/14
[ "https://Stackoverflow.com/questions/21107057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/813758/" ]
I fixed this with add some headers to response, by create a response callback: `pyramid.events.NewResponse` **cors.py** ``` from pyramid.security import NO_PERMISSION_REQUIRED def includeme(config): config.add_directive( 'add_cors_preflight_handler', add_cors_preflight_handler) config.add_route_predi...
I could send file with Ajax from a server to another server : ``` import uuid from pyramid.view import view_config from pyramid.response import Response class FManager: def __init__(self, request): self.request = request @view_config(route_name='f_manager', request_method='POST', renderer='json') ...
21,107,057
Is it possible automatically add `Access-Control-Allow-Origin` header to all responses which was initiated by ajax request (with header `X-Requested-With`) in Pyramid?
2014/01/14
[ "https://Stackoverflow.com/questions/21107057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/813758/" ]
I fixed this with add some headers to response, by create a response callback: `pyramid.events.NewResponse` **cors.py** ``` from pyramid.security import NO_PERMISSION_REQUIRED def includeme(config): config.add_directive( 'add_cors_preflight_handler', add_cors_preflight_handler) config.add_route_predi...
Here is another solution: ``` from pyramid.events import NewResponse, subscriber @subscriber(NewResponse) def add_cors_headers(event): if event.request.is_xhr: event.response.headers.update({ 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', }) ```
811,624
I saw this definition in one of the computer science book but I am unable to recall the theorem name. Can someone please provide the reference? $$\lim\_{n \to \infty} \frac{f(n)}{g(n)} = c > 0$$ means there is some $n\_{0}$ beyond which the ratio is always between $\frac{1}{2}c$ and $2c$.
2014/05/27
[ "https://math.stackexchange.com/questions/811624", "https://math.stackexchange.com", "https://math.stackexchange.com/users/20411/" ]
Since $\|A\| = 1$, using the Neumann series we can indeed invert $A - \lambda I$ when $|\lambda|>1$. For $|\lambda|<1$, the sequence $x\_n = \lambda^n$ lies in the kernel of $A-\lambda I$ and it is not invertible. Then the conclusion follows by recalling that the spectrum of a bounded operator is always closed.
First note that $A$ is an isometry, so $\|A\| = 1$. Hence $\sigma(A)$ lies in the closed unit ball of the complex plane $C$. Define the adjoint of $A : X \rightarrow Y$ to be $A^\* : Y^\* \rightarrow X^\*$ such that $A^\*(\alpha)(x) = \alpha(Ax)$ where $\alpha \in Y^\*$ and $x \in X$ (here $X,Y$ are Banach spaces). Th...
811,624
I saw this definition in one of the computer science book but I am unable to recall the theorem name. Can someone please provide the reference? $$\lim\_{n \to \infty} \frac{f(n)}{g(n)} = c > 0$$ means there is some $n\_{0}$ beyond which the ratio is always between $\frac{1}{2}c$ and $2c$.
2014/05/27
[ "https://math.stackexchange.com/questions/811624", "https://math.stackexchange.com", "https://math.stackexchange.com/users/20411/" ]
Notice that $\|Ax\| \le \|x\|$. So $\sigma(A)$ is contained in the closed unit disk $D^{c}$. To find the resolvent $(A-\lambda I)^{-1}$, try to solve $(A-\lambda I)x = y$ for $x$, and see if it can be done. First, see if there are any eigenfunctions $Ax=\lambda x$. If there were such an $x$, then $|\lambda| \le 1$ and ...
Since $\|A\| = 1$, using the Neumann series we can indeed invert $A - \lambda I$ when $|\lambda|>1$. For $|\lambda|<1$, the sequence $x\_n = \lambda^n$ lies in the kernel of $A-\lambda I$ and it is not invertible. Then the conclusion follows by recalling that the spectrum of a bounded operator is always closed.
811,624
I saw this definition in one of the computer science book but I am unable to recall the theorem name. Can someone please provide the reference? $$\lim\_{n \to \infty} \frac{f(n)}{g(n)} = c > 0$$ means there is some $n\_{0}$ beyond which the ratio is always between $\frac{1}{2}c$ and $2c$.
2014/05/27
[ "https://math.stackexchange.com/questions/811624", "https://math.stackexchange.com", "https://math.stackexchange.com/users/20411/" ]
Notice that $\|Ax\| \le \|x\|$. So $\sigma(A)$ is contained in the closed unit disk $D^{c}$. To find the resolvent $(A-\lambda I)^{-1}$, try to solve $(A-\lambda I)x = y$ for $x$, and see if it can be done. First, see if there are any eigenfunctions $Ax=\lambda x$. If there were such an $x$, then $|\lambda| \le 1$ and ...
First note that $A$ is an isometry, so $\|A\| = 1$. Hence $\sigma(A)$ lies in the closed unit ball of the complex plane $C$. Define the adjoint of $A : X \rightarrow Y$ to be $A^\* : Y^\* \rightarrow X^\*$ such that $A^\*(\alpha)(x) = \alpha(Ax)$ where $\alpha \in Y^\*$ and $x \in X$ (here $X,Y$ are Banach spaces). Th...
44,702,855
We are trying to run rbenv on El-Capitan 10.11.6. When we try to run rbenv command in the terminal we got the following error message: ``` command not found ``` We googled how to solve that issue and one possible solution is to add the "rbenv" to the system PATH, we followed the steps stated in [this link](http://ar...
2017/06/22
[ "https://Stackoverflow.com/questions/44702855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3732958/" ]
Assuming your source is stored in `exampleScriptFile`: ```js // polyfill const fs = { readFileSync() { return 'console.log(`${EXAMPLE_3}`);'; } }; // CONSTANTS const EXAMPLE_1 = 'EXAMPLE_1'; const EXAMPLE_2 = 'EXAMPLE_2'; const EXAMPLE_3 = 'EXAMPLE_3'; const exampleScriptFile = fs.readFileSync('./exampleScript...
While what you're describing can be done with `eval` as @PatrickRoberts demonstrates, that doesn't extend to `executeJavaScript`. The former runs in the caller's context, while the latter triggers an IPC call to another process with the contents of the code. Presumably this process doesn't have any information on the ...
422,828
I need to make the word "Table" within paragraph clickable. I have tried this [When referencing a figure, make text and figure name clickable](https://tex.stackexchange.com/questions/230828/when-referencing-a-figure-make-text-and-figure-name-clickable). But I got "???" instead. [![enter image description here](https:...
2018/03/23
[ "https://tex.stackexchange.com/questions/422828", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/156895/" ]
Automatic way, see the `\autoref` feature of `hyperref`: ``` from the \autoref{tab:first} ``` Manually with `\hyperref`: ``` from the \hyperref[tab:first]{Table \ref*{tab:first}} ```
Thanks to @Heiko and @Christian I got what I want. ``` \documentclass{article} \usepackage[colorlinks]{hyperref} \usepackage[nameinlink,noabbrev]{cleveref} \usepackage{array} \usepackage{multirow} \usepackage{makecell} \begin{document} here text here text here text here text here \au...
1,032,510
This is an exercise in *Naive Set Theory* by P. R. Halmos. > > If $\text{card }A=a$, what is the cardinal number of the set of all > one-to-one mappings of $A$ onto itself? What is the cardinal number of > the set of all countably infinite subsets of $A$? > > > It is easy to see that, for the first question, ...
2014/11/21
[ "https://math.stackexchange.com/questions/1032510", "https://math.stackexchange.com", "https://math.stackexchange.com/users/119490/" ]
No. Counterexample: $c=1$ and $f(x)=k>0$ for all $x$.
Consider $f(x)=\frac{x^{\frac{1}{c}-1}}{c}$.
1,032,510
This is an exercise in *Naive Set Theory* by P. R. Halmos. > > If $\text{card }A=a$, what is the cardinal number of the set of all > one-to-one mappings of $A$ onto itself? What is the cardinal number of > the set of all countably infinite subsets of $A$? > > > It is easy to see that, for the first question, ...
2014/11/21
[ "https://math.stackexchange.com/questions/1032510", "https://math.stackexchange.com", "https://math.stackexchange.com/users/119490/" ]
No. Counterexample: $c=1$ and $f(x)=k>0$ for all $x$.
@Eric, If your question is only : is it true that $f=0$ almost everywhere, you have get the counterexample. But if your question is what can we said about $f,$ follow me: From $\frac{1}{x}\int\_{0}^{x}f(t)dt=cf(x),$ for all $x>0,$ we get $$ \int\_{0}^{x}f(t)dt=cxf(x),\ x>0. $$ Assume that $f$ is continuous. By the Fun...
56,565,986
I have a dataframe with full of ip addresses. I have a list of ip address that I want to remove from my dataframe. I wanted to have a new dataframe "filtered\_list" after all the ip addresses are removed according to "lista". I saw an example at [How to use NOT IN clause in filter condition in spark](https://stackov...
2019/06/12
[ "https://Stackoverflow.com/questions/56565986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9272452/" ]
You could use the except method on dataframe. ``` var df = Seq("119.73.148.227", "42.61.124.218", "42.61.66.174", "118.201.94.2","118.201.149.146", "119.73.234.82", "42.61.110.239", "58.185.72.118", "115.42.231.178").toDF("ipAddress") var lista = Seq("119.73.148.227", "118.201.94.2").toDF("ipAddress") var onlyWanted...
`isin` takes varargs, not `List`. You'd have to spread your list into seperate elements using `:_*` ascription: ``` var filtered_list = df.filter(col("ipAddress").isin(lista: _*)) ```
316,791
I am getting the following error when I try to connect to a Minecraft server: [![Connection refused: no further information](https://i.stack.imgur.com/31C7S.jpg)](https://i.stack.imgur.com/31C7S.jpg) This is all servers, not just one. The error says: > > io.netty.channel.AbstractChannel$AnnotatedConnectException: ...
2017/08/23
[ "https://gaming.stackexchange.com/questions/316791", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/195593/" ]
I have the same error on my local network, it looks like a firewall issue on the host/server side. For me, to troubleshoot I used [nmap](https://nmap.org/). The LAN game showed up in multiplayer as 10.0.0.21:49299. nmap reported that port from that IP as closed/filtered; i.e. a firewall issue. To confirm it is a firew...
It looks like it has something to do with Firewall **not** allowing traffic to the 1.12.jar file located in C:\Users\user\AppData\Roaming.minecraft\versions(version). I assume that when you say you have "Altered the Firewall" you mean that you *only* allowed connections to the Java.exes but **NOT** the actual 1.12.ja...
20,848,810
I've read many articles and posts about executing NAnt scripts using TFS build, none of which have satisfied my needs. I have a NAnt script that has been developed over the years to automatically build, test and deploy our websites to an internal staging and external demo environments. Usually, the team has been so s...
2013/12/30
[ "https://Stackoverflow.com/questions/20848810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/767428/" ]
Here is how you can do it: 1) Download Nant.exe from <http://sourceforge.net/projects/nant/files/> and check-in the bin directory which has Nant.exe. 2) Create a msbuild file (say msbuild.proj) with following code(change Path) and check-in the file. ``` <Project xmlns="http://schemas.microsoft.com/developer/msbuild/...
We have a similar problem. For one of our projects we just want to run a DOS command for the build. What I did was create a custom build template that just runs a DOS command. The template has Arguments for the App to Run, App Arguments, and App Working Directory. Here is what the whole template looks like in the desi...
36,294,466
UDF: ``` bigquery.defineFunction( 'newdate', // Name of the function exported to SQL [], // Names of input columns [ {name: 'date', type: 'timestamp'} , {name: 'datestr', type: 'string'} ], function newDate(row, emit) { var date = new Date(); // curre...
2016/03/29
[ "https://Stackoverflow.com/questions/36294466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2259571/" ]
That's an unfortunate oversight on our part. Many Google servers run using Pacific time (semi-jokingly referred to as "Google standard time"). When launching BigQuery, we tried to standardize on UTC instead, but we missed this case. We may try to find an opportunity to fix it, but unfortunately we risk breaking existi...
Don't know rationale for running in Pacific time zone, but you just ignore the system time zone, and use UTC time in your code. E.g. use `datestr: date.toUTCString()` instead of `datestr: date + ''`.
62,753,397
I write button.xml and qweb in **manifest**.py but it not worked. button.xml (static/src/xml/button.xml) ``` <?xml version="1.0" encoding="UTF-8"?> <templates> <t t-extend="ListView.buttons"> <t t-jquery="button.o_list_button_add" t-operation="after"> <button name="xxx" type="button" t-if='wid...
2020/07/06
[ "https://Stackoverflow.com/questions/62753397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13876116/" ]
The first thing I notice is that you are iterating through `i in range(0, int(pages))`, however, the pages only start on line 1 (line 0 consists of n & q). So your for loop should like more like (you also want to do +1 because you want to count the last page, otherwise python only goes 'uptil but not including'): ```...
Could you try this? ```py with open("encyin.txt") as f: parts = next(f).split() pages = int(parts[0]) questions = int(parts[1]) counts = [] # capture counts for _ in range(pages): num_pages = int(next(f)) counts.append(num_pages) # answer questions for _ in range(questio...
69,139,132
I'm using the weightloss dataset: ``` structure(list(id = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L), .Label = c("1", "2", "3", "4", "5", "6",...
2021/09/11
[ "https://Stackoverflow.com/questions/69139132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16631565/" ]
``` Icon( Icons.add_circle_outline, color: Colors.white, size: 30, ), ``` You can use flutter built in icon.
try this: ``` Container( width: 24, height: 24, child: OutlinedButton( onPressed: () { print('xxx'); }, child: Icon( Icons.add, color: Colors.grey, ), styl...
39,559,845
I have the following transaction: ``` typedef enum {READ = 0, WRITE = 1} direction_enum; //Transaction class axi_transaction extends uvm_sequence_item(); bit id = 0; //const bit [31:0] addr; bit [2:0] size = 0'b100;//const direction_enum rw; bit [31:0] transfers [$]; //factory registration `u...
2016/09/18
[ "https://Stackoverflow.com/questions/39559845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6465067/" ]
You cannot add arguments to the class constructor when using the UVM factory. In general this is not good OOP programing practice for re-use because if you do add arguments to either the base class or extended class, you have to modify every place where the class gets constructed. A better option is to use the uvm\_co...
You can use uvm\_config\_db class for initialisation. You can set the value using following syntax. And then you can get that value inside the constructor of that class. ``` uvm_config_db#(int)::set(this,“my_subblock_a”,“max_cycles”,max_cycles) uvm_config_db#(int)::get(this,“”, “max_cycles”,max_cycles) ``` For mor...