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
26,377,766
I'm trying to concatenate String values and print them, but if the last types are Strings and there is no change of type then the concatenation won't print: input.txt: ``` String 1 String 2 Number 5 Number 2 String 3 String 3 ``` awk: ``` awk ' BEGIN { tot=0; ant_t=""; } { t = $1; val=$2; #if string, concat...
2014/10/15
[ "https://Stackoverflow.com/questions/26377766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3091032/" ]
`awk` reads line by line hence it cannot determine if it is reading the last line or not. The `END` block can be useful to perform actions once the end of file has reached. To perform what you expect ``` awk '/String/{sum+=$2} /Number/{if(sum) print sum; sum=0; print $2} END{if(sum) print sum}' ``` will produce out...
Like this maybe: ``` awk -v lines="$(wc -l < /etc/hosts)" 'NR==lines{print "LAST"};1' /etc/hosts ``` I am pre-calculating the number of lines (using `wc`) and passing that into `awk` as a variable called `lines`, if that is unclear.
26,377,766
I'm trying to concatenate String values and print them, but if the last types are Strings and there is no change of type then the concatenation won't print: input.txt: ``` String 1 String 2 Number 5 Number 2 String 3 String 3 ``` awk: ``` awk ' BEGIN { tot=0; ant_t=""; } { t = $1; val=$2; #if string, concat...
2014/10/15
[ "https://Stackoverflow.com/questions/26377766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3091032/" ]
Like this maybe: ``` awk -v lines="$(wc -l < /etc/hosts)" 'NR==lines{print "LAST"};1' /etc/hosts ``` I am pre-calculating the number of lines (using `wc`) and passing that into `awk` as a variable called `lines`, if that is unclear.
Just change last line to: ``` END { print res; print tot;}' ```
26,377,766
I'm trying to concatenate String values and print them, but if the last types are Strings and there is no change of type then the concatenation won't print: input.txt: ``` String 1 String 2 Number 5 Number 2 String 3 String 3 ``` awk: ``` awk ' BEGIN { tot=0; ant_t=""; } { t = $1; val=$2; #if string, concat...
2014/10/15
[ "https://Stackoverflow.com/questions/26377766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3091032/" ]
`awk` reads line by line hence it cannot determine if it is reading the last line or not. The `END` block can be useful to perform actions once the end of file has reached. To perform what you expect ``` awk '/String/{sum+=$2} /Number/{if(sum) print sum; sum=0; print $2} END{if(sum) print sum}' ``` will produce out...
Just change last line to: ``` END { print res; print tot;}' ```
48,958,199
I am trying to send mail using Office365 mail server and have continuously run into this problem/exception with no resolution in sight. Have done numerous research on this and cannot find any post with similar issue: ``` System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.Sockets.SocketException: An ...
2018/02/24
[ "https://Stackoverflow.com/questions/48958199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2672436/" ]
The error is probably specific to your machine, because your code works using our Office365 account on our machine. Maybe on your machine port 587 is already in use. We need more detail about that `SocketException`. Determine the details of that SocketException ============================================= Inspect t...
According to the [Microsoft documentation](https://support.office.com/en-us/article/How-to-set-up-a-multifunction-device-or-application-to-send-email-using-Office-365-69f58e99-c550-4274-ad18-c805d654b4c4), it seems your smtp address is incorrect. Please change: ``` SmtpClient client = new SmtpClient("outlook.office36...
56,350,103
[![enter image description here](https://i.stack.imgur.com/0QUFZ.png)](https://i.stack.imgur.com/0QUFZ.png) I would like for only 1 user to be able to push (force push and regular push) to a certain branch, and everyone else to not have permissions to push. These are the permissions I set (with my user listed under "...
2019/05/28
[ "https://Stackoverflow.com/questions/56350103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1769217/" ]
> > Actually, that still doesn't allow the user to force push. > > > [Since Dec. 4th 2019](https://github.blog/changelog/2019-12-04-expanded-branch-protection-rules/), there is a way to grant all users with push access the ability to force-push to a protected branch by enabling `Allow force pushes`. If the CI use...
First, you will want to make the branch pull request only. The screenshot you showed will get you that. After that is done, I guess you can make one of the CI checks to be "checking if the author of the pull request is in the whitelist". Then, in the "require status check to pass before merging", add the check mentio...
3,950,846
Getting a weird segmentation fault on following code when I try to pass a number into my application on command line. ``` int offset = 3; int main(int argc, char *argv[]) { // Check for arguments to see whether there is a custom offset if (argc == 2) { // If argc == 2 then we have a offset? if...
2010/10/16
[ "https://Stackoverflow.com/questions/3950846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161570/" ]
argv[1] is already a string (of type char\*), so writing \*argv[1] dereferencing to the first byte which causes your segfault when passing that byte to atoi() and printf(). Fix it to: `offset = atoi(argv[1]);` and `printf("Offset not changed due to %s not being a number.\n", argv[1]);`
The problem is the call to atoi. It expects a string. Change it to ``` offset = atoi(argv[1]); ```
3,950,846
Getting a weird segmentation fault on following code when I try to pass a number into my application on command line. ``` int offset = 3; int main(int argc, char *argv[]) { // Check for arguments to see whether there is a custom offset if (argc == 2) { // If argc == 2 then we have a offset? if...
2010/10/16
[ "https://Stackoverflow.com/questions/3950846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161570/" ]
argv[1] is already a string (of type char\*), so writing \*argv[1] dereferencing to the first byte which causes your segfault when passing that byte to atoi() and printf(). Fix it to: `offset = atoi(argv[1]);` and `printf("Offset not changed due to %s not being a number.\n", argv[1]);`
``` #include <ctype.h> int isdigit(int c); ``` **isdigit()** expects single char to check, **argv[]** is a pointer to string (array of chars). Long story short, it won't check strings like **"1234"**, but it will check **'1'**.
3,950,846
Getting a weird segmentation fault on following code when I try to pass a number into my application on command line. ``` int offset = 3; int main(int argc, char *argv[]) { // Check for arguments to see whether there is a custom offset if (argc == 2) { // If argc == 2 then we have a offset? if...
2010/10/16
[ "https://Stackoverflow.com/questions/3950846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161570/" ]
The *real* problem with your code is that you are trying to call functions that you didn't declare (you must be using a C89/90 compiler). You call `isdigit`. You call `printf`. You call `atoi`. You call the latter two incorrectly. And the only reason the compiler cannot inform you about these functions being called inc...
The problem is the call to atoi. It expects a string. Change it to ``` offset = atoi(argv[1]); ```
3,950,846
Getting a weird segmentation fault on following code when I try to pass a number into my application on command line. ``` int offset = 3; int main(int argc, char *argv[]) { // Check for arguments to see whether there is a custom offset if (argc == 2) { // If argc == 2 then we have a offset? if...
2010/10/16
[ "https://Stackoverflow.com/questions/3950846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161570/" ]
The problem is the call to atoi. It expects a string. Change it to ``` offset = atoi(argv[1]); ```
``` #include <ctype.h> int isdigit(int c); ``` **isdigit()** expects single char to check, **argv[]** is a pointer to string (array of chars). Long story short, it won't check strings like **"1234"**, but it will check **'1'**.
3,950,846
Getting a weird segmentation fault on following code when I try to pass a number into my application on command line. ``` int offset = 3; int main(int argc, char *argv[]) { // Check for arguments to see whether there is a custom offset if (argc == 2) { // If argc == 2 then we have a offset? if...
2010/10/16
[ "https://Stackoverflow.com/questions/3950846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161570/" ]
The *real* problem with your code is that you are trying to call functions that you didn't declare (you must be using a C89/90 compiler). You call `isdigit`. You call `printf`. You call `atoi`. You call the latter two incorrectly. And the only reason the compiler cannot inform you about these functions being called inc...
``` #include <ctype.h> int isdigit(int c); ``` **isdigit()** expects single char to check, **argv[]** is a pointer to string (array of chars). Long story short, it won't check strings like **"1234"**, but it will check **'1'**.
150,964
I am trying to find the dimension of the vector space ($P\_2$ means polynomials of degree at most $2$) $$V = \{p(x) \in P\_2 \mid xp'(x) = p(x)\}.$$ However, I don't even know how to start... (Additionally, the question asks to find the basis for $V$, which I don't know how to do, but I think I might if someone tell...
2012/05/28
[ "https://math.stackexchange.com/questions/150964", "https://math.stackexchange.com", "https://math.stackexchange.com/users/17865/" ]
Consider the linear transformation $T\colon P\_2\to P\_2$ given by $T(p) = xp' - p$. You should verify that this is indeed a linear transformation. For example, if $p(x) = 3x^2 - 2x$, then $p'(x) = 6x-2$, so $xp'(x) = x(6x-2) = 6x^2-2x$. Therefore, $$T(p) = xp' - p = (6x^2-2x)-(3x^2-2x) = 6x^2-2x-3x^2+2x = 3x^2.$$ Th...
Taking an arbitrary element $p(x)=ax^2+bx+c\in V$, we see it has to satisfy the special condition $xp'(x)=p(x)$, so $x(2ax+b)=2ax^2+bx+0=ax^2+bx+c$. Then immediately $c=0$, and $2a=a$ implies that $a=0$. So the only things in $V$ are of the form $bx$ for any $b\in F$. I think you can work out a basis :)
25,930,167
getting the Tomcat log file data by giving specific dates(from and to) and display it as a file in java. Can anyone please guide me how to do this part asap. Thanks in Adavance
2014/09/19
[ "https://Stackoverflow.com/questions/25930167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4057639/" ]
You can close the socket. The peer can close the connection.
> > I thought only close() function could close the tcp connection. > > > Why would that be? TCP is a software-defined protocol. The OS can implement it however it likes. All sensible OS'es clean up all resources that a terminated process was using. Sockets will be closed as well. What good would a TCP connection ...
104,283
A few online merchants are offering special deals for using [Visa Checkout](https://usa.visa.com/pay-with-visa/visa-checkout.html?country=US&locale=en-US), a payment service similar to PayPal, so I've been trying to learn something about it before signing up. When you are on a shopping site and click the Visa Checkout ...
2015/11/01
[ "https://security.stackexchange.com/questions/104283", "https://security.stackexchange.com", "https://security.stackexchange.com/users/69230/" ]
The problem you mention is a real one. This scheme was a subject of criticism and led to a newer implementation ("3D Secure by ...", the old one unfortunately also sometimes uses this name) which is two-factor (you usually get an SMS with a code you must input on the merchant's page). You are also warned of the upcom...
> > Is this scheme secure? > > > Security is never absolute, so it's impossible to answer whether this is outright "secure". In the Visa scenario you're essentially placing your trust in newegg. Behind the scenes the Visa popup probably uses TLS, but for all intents and purposes newegg could serve you a phishing ...
36,910,778
I saw the following words in the C++ standard draft N4582: > > [over.best.ics/4] However, if the target is > > > (4.1) the first parameter of a constructor or > > > (4.2) the implicit object parameter of a user-defined conversion function > > > and the constructor or user-defined conversion function is a candid...
2016/04/28
[ "https://Stackoverflow.com/questions/36910778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5376789/" ]
You can go read [[dcl.init]/17](http://eel.is/c++draft/dcl.init#17) for the actual standardese. The "second step" here is referring to copy-initializing a variable of class type `A` from something `b` of an unrelated type. In such a case, copy-initialization happens in two steps: * Step 1: you implicitly convert `b` t...
There is only 2 ctors, one that take a reference to an existing object (no temporary) and one that takes an int. Your code produces (with additional messages): ``` int ctor user-defined conversion int ctor user-defined conversion int ctor ``` The first is the construction inside `foo`. The second is due to the fac...
45,322,370
I'm trying to use spdlog in my project. According to [spdlog docu](https://github.com/gabime/spdlog/wiki/1.-QuickStart), I just need to copy files under include folder and use a C++ 11 compiler. I copied the /include/spdlog folder to my project root folder but I'm having a lot of errors after trying to build the proje...
2017/07/26
[ "https://Stackoverflow.com/questions/45322370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6915050/" ]
As written in [spdlogs docu at the very bottom](https://github.com/gabime/spdlog/wiki/9.-CMake), you can do a ``` find_package(spdlog CONFIG) ``` This provides you the imported interface library `spdlog::spdlog`, which you can use ``` target_link_library(my_library PUBLIC spdlog::spdlog) ``` (as seen in the [spdl...
Solution was to install spdlog: ``` sudo apt-get install libspdlog-dev ``` and include using: ``` #include <spglog/spdlog.h> ``` I initially just copied spdlog to my project root and was trying to include using: ``` #include "spdlog/spdlog.h" ```
6,391,752
I need to know evertime a certain tab on my tabbar is selected to be able to set a certain `BOOL`. `viewDidLoad` does net get called every time/when I click on the tab - is there an alternative to that? I need to know this in that tab's-view's viewcontroller.
2011/06/17
[ "https://Stackoverflow.com/questions/6391752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/679277/" ]
You probably want one of these: * The [UITabBarDelegate](http://developer.apple.com/library/ios/#documentation/uikit/reference/UITabBarDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UITabBarDelegate) method `- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item` * The [UITabBarControlle...
The UITabBar does not load all the view controllers at once - it loads the first one. When you click on a tab bar button you load another controller. To receive the changes in the tab bar you can add a delegate and implement: ``` -(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {...} ```
341,471
I'm attempting to eliminate leading any leading zeroes in my date when I run the get-date cmdlet by trying: ``` $filedate = get-date -uformat "%m-%d-%Y" $filedate = $filedate.ToString().Replace("0", "") ``` this returns "01-04-2008" I want to the output to be "1-4-2008" any ideas on another way of doing this? t...
2008/12/04
[ "https://Stackoverflow.com/questions/341471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18853/" ]
``` $filedate = get-date -format "M-d-yyyy" ```
$fileDate = $fileDate.ToString("M-d-yyyy")
341,471
I'm attempting to eliminate leading any leading zeroes in my date when I run the get-date cmdlet by trying: ``` $filedate = get-date -uformat "%m-%d-%Y" $filedate = $filedate.ToString().Replace("0", "") ``` this returns "01-04-2008" I want to the output to be "1-4-2008" any ideas on another way of doing this? t...
2008/12/04
[ "https://Stackoverflow.com/questions/341471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18853/" ]
$fileDate = $fileDate.ToString("M-d-yyyy")
use format string like : ``` get-date -format yyyy/M/d ``` or get-date.tostring(yyyy/M/d)
341,471
I'm attempting to eliminate leading any leading zeroes in my date when I run the get-date cmdlet by trying: ``` $filedate = get-date -uformat "%m-%d-%Y" $filedate = $filedate.ToString().Replace("0", "") ``` this returns "01-04-2008" I want to the output to be "1-4-2008" any ideas on another way of doing this? t...
2008/12/04
[ "https://Stackoverflow.com/questions/341471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18853/" ]
``` $filedate = get-date -format "M-d-yyyy" ```
use format string like : ``` get-date -format yyyy/M/d ``` or get-date.tostring(yyyy/M/d)
92,633
Are there any world-wide known Music Certification tests that you can take to use in your resume: for example, to demonstrate basic musical abilities? I used to work in IT, where it is very common for companies like Oracle and Zend to arrange that kind of certification for a programming language or framework.
2019/12/03
[ "https://music.stackexchange.com/questions/92633", "https://music.stackexchange.com", "https://music.stackexchange.com/users/26620/" ]
Music is such a big field that it isn't really possible to answer this. There are organisations and colleges such as Berklee which have some international reputation, it can be helpful to have something from them. But in many areas, the qualification is simply showing you can do what is needed. For instance, as a jaz...
Adding to @danmcb answer: In some cases a college degree matters. E.g. in some countries Master in music is required to teach in a public school. A degree might be a plus when applying for other music related jobs. But if the focus the job is music performance, a video showing you playing will be worth more than any p...
92,633
Are there any world-wide known Music Certification tests that you can take to use in your resume: for example, to demonstrate basic musical abilities? I used to work in IT, where it is very common for companies like Oracle and Zend to arrange that kind of certification for a programming language or framework.
2019/12/03
[ "https://music.stackexchange.com/questions/92633", "https://music.stackexchange.com", "https://music.stackexchange.com/users/26620/" ]
Music is such a big field that it isn't really possible to answer this. There are organisations and colleges such as Berklee which have some international reputation, it can be helpful to have something from them. But in many areas, the qualification is simply showing you can do what is needed. For instance, as a jaz...
Generally speaking, just about every country will have music exam boards, a lot of them world wide, like ABRSM. Most have been established for many years, and the standard at any particular grade should be just that - standard. So, on a c.v., stating Grade VI clarinet ABRSM, Trinity, LCM, AMEB etc., should give a good...
92,633
Are there any world-wide known Music Certification tests that you can take to use in your resume: for example, to demonstrate basic musical abilities? I used to work in IT, where it is very common for companies like Oracle and Zend to arrange that kind of certification for a programming language or framework.
2019/12/03
[ "https://music.stackexchange.com/questions/92633", "https://music.stackexchange.com", "https://music.stackexchange.com/users/26620/" ]
There are systems of graded examinations in performance for most instruments, and for theory, designed to cover the stages from beginner to pre-college. Here's a couple of 'classical' ones [https://gb.abrsm.org/](https://gb.abrsm.org/en/) [www.trinitycollege.com/](https://www.trinitycollege.com/qualifications/music/...
Music is such a big field that it isn't really possible to answer this. There are organisations and colleges such as Berklee which have some international reputation, it can be helpful to have something from them. But in many areas, the qualification is simply showing you can do what is needed. For instance, as a jaz...
92,633
Are there any world-wide known Music Certification tests that you can take to use in your resume: for example, to demonstrate basic musical abilities? I used to work in IT, where it is very common for companies like Oracle and Zend to arrange that kind of certification for a programming language or framework.
2019/12/03
[ "https://music.stackexchange.com/questions/92633", "https://music.stackexchange.com", "https://music.stackexchange.com/users/26620/" ]
Music is such a big field that it isn't really possible to answer this. There are organisations and colleges such as Berklee which have some international reputation, it can be helpful to have something from them. But in many areas, the qualification is simply showing you can do what is needed. For instance, as a jaz...
**Nothing completely world-wide, it seems.** I'm just a hobby musician, but before joining this stack I had never heard of the type of "grades" people seem to use to measure proficiency with musical instruments. I live in **Sweden**, and it doesn't seem to be a thing here. There are entry exams you need to pass to get...
92,633
Are there any world-wide known Music Certification tests that you can take to use in your resume: for example, to demonstrate basic musical abilities? I used to work in IT, where it is very common for companies like Oracle and Zend to arrange that kind of certification for a programming language or framework.
2019/12/03
[ "https://music.stackexchange.com/questions/92633", "https://music.stackexchange.com", "https://music.stackexchange.com/users/26620/" ]
There are systems of graded examinations in performance for most instruments, and for theory, designed to cover the stages from beginner to pre-college. Here's a couple of 'classical' ones [https://gb.abrsm.org/](https://gb.abrsm.org/en/) [www.trinitycollege.com/](https://www.trinitycollege.com/qualifications/music/...
Adding to @danmcb answer: In some cases a college degree matters. E.g. in some countries Master in music is required to teach in a public school. A degree might be a plus when applying for other music related jobs. But if the focus the job is music performance, a video showing you playing will be worth more than any p...
92,633
Are there any world-wide known Music Certification tests that you can take to use in your resume: for example, to demonstrate basic musical abilities? I used to work in IT, where it is very common for companies like Oracle and Zend to arrange that kind of certification for a programming language or framework.
2019/12/03
[ "https://music.stackexchange.com/questions/92633", "https://music.stackexchange.com", "https://music.stackexchange.com/users/26620/" ]
Adding to @danmcb answer: In some cases a college degree matters. E.g. in some countries Master in music is required to teach in a public school. A degree might be a plus when applying for other music related jobs. But if the focus the job is music performance, a video showing you playing will be worth more than any p...
**Nothing completely world-wide, it seems.** I'm just a hobby musician, but before joining this stack I had never heard of the type of "grades" people seem to use to measure proficiency with musical instruments. I live in **Sweden**, and it doesn't seem to be a thing here. There are entry exams you need to pass to get...
92,633
Are there any world-wide known Music Certification tests that you can take to use in your resume: for example, to demonstrate basic musical abilities? I used to work in IT, where it is very common for companies like Oracle and Zend to arrange that kind of certification for a programming language or framework.
2019/12/03
[ "https://music.stackexchange.com/questions/92633", "https://music.stackexchange.com", "https://music.stackexchange.com/users/26620/" ]
There are systems of graded examinations in performance for most instruments, and for theory, designed to cover the stages from beginner to pre-college. Here's a couple of 'classical' ones [https://gb.abrsm.org/](https://gb.abrsm.org/en/) [www.trinitycollege.com/](https://www.trinitycollege.com/qualifications/music/...
Generally speaking, just about every country will have music exam boards, a lot of them world wide, like ABRSM. Most have been established for many years, and the standard at any particular grade should be just that - standard. So, on a c.v., stating Grade VI clarinet ABRSM, Trinity, LCM, AMEB etc., should give a good...
92,633
Are there any world-wide known Music Certification tests that you can take to use in your resume: for example, to demonstrate basic musical abilities? I used to work in IT, where it is very common for companies like Oracle and Zend to arrange that kind of certification for a programming language or framework.
2019/12/03
[ "https://music.stackexchange.com/questions/92633", "https://music.stackexchange.com", "https://music.stackexchange.com/users/26620/" ]
Generally speaking, just about every country will have music exam boards, a lot of them world wide, like ABRSM. Most have been established for many years, and the standard at any particular grade should be just that - standard. So, on a c.v., stating Grade VI clarinet ABRSM, Trinity, LCM, AMEB etc., should give a good...
**Nothing completely world-wide, it seems.** I'm just a hobby musician, but before joining this stack I had never heard of the type of "grades" people seem to use to measure proficiency with musical instruments. I live in **Sweden**, and it doesn't seem to be a thing here. There are entry exams you need to pass to get...
92,633
Are there any world-wide known Music Certification tests that you can take to use in your resume: for example, to demonstrate basic musical abilities? I used to work in IT, where it is very common for companies like Oracle and Zend to arrange that kind of certification for a programming language or framework.
2019/12/03
[ "https://music.stackexchange.com/questions/92633", "https://music.stackexchange.com", "https://music.stackexchange.com/users/26620/" ]
There are systems of graded examinations in performance for most instruments, and for theory, designed to cover the stages from beginner to pre-college. Here's a couple of 'classical' ones [https://gb.abrsm.org/](https://gb.abrsm.org/en/) [www.trinitycollege.com/](https://www.trinitycollege.com/qualifications/music/...
**Nothing completely world-wide, it seems.** I'm just a hobby musician, but before joining this stack I had never heard of the type of "grades" people seem to use to measure proficiency with musical instruments. I live in **Sweden**, and it doesn't seem to be a thing here. There are entry exams you need to pass to get...
507,192
As light is electromagnetic radiation. Then why I don't see any magnet bending light wave? Or why light doesn't diffract whenever it passes by a live wire?
2019/10/09
[ "https://physics.stackexchange.com/questions/507192", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/-1/" ]
In vacuum electromagnetic fields obey superposition to a very high degree of accuracy. A magnetic field does not have any effect on light. Light in material media *can* be affected by a magnetic field. This is known as the [Kerr effect](https://en.wikipedia.org/wiki/Kerr_effect). As for current carrying wires, these r...
Electromagnetic fields simply superpose. They don’t interact with each other. (I am ignoring quantum effects at *enormous* field strengths.) Two waves go right through each other. A wave goes right through a static field. Electromagnetic fields interact with *charges*. No charge, no interaction.
507,192
As light is electromagnetic radiation. Then why I don't see any magnet bending light wave? Or why light doesn't diffract whenever it passes by a live wire?
2019/10/09
[ "https://physics.stackexchange.com/questions/507192", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/-1/" ]
Electromagnetic fields simply superpose. They don’t interact with each other. (I am ignoring quantum effects at *enormous* field strengths.) Two waves go right through each other. A wave goes right through a static field. Electromagnetic fields interact with *charges*. No charge, no interaction.
In classical physics, electromagnetic fields and waves are additive so nothing can happen in vacuum between electromagnetic fields. They don't see each other. In quantum physics, photons theoretically DO interact. The effect is rather small even in high-energy experiments, so don't expect some visible distortion with ...
507,192
As light is electromagnetic radiation. Then why I don't see any magnet bending light wave? Or why light doesn't diffract whenever it passes by a live wire?
2019/10/09
[ "https://physics.stackexchange.com/questions/507192", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/-1/" ]
In vacuum electromagnetic fields obey superposition to a very high degree of accuracy. A magnetic field does not have any effect on light. Light in material media *can* be affected by a magnetic field. This is known as the [Kerr effect](https://en.wikipedia.org/wiki/Kerr_effect). As for current carrying wires, these r...
Roughly speaking, electric fields push and pull charges, while magnetic fields cause charges to loop around (by 'loop around' I'm saying that the magnetic fields cause the charges to accelerate at a right angle to their direction of motion). Since light doesn't have an electric charge, there is nothing for electric f...
507,192
As light is electromagnetic radiation. Then why I don't see any magnet bending light wave? Or why light doesn't diffract whenever it passes by a live wire?
2019/10/09
[ "https://physics.stackexchange.com/questions/507192", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/-1/" ]
Roughly speaking, electric fields push and pull charges, while magnetic fields cause charges to loop around (by 'loop around' I'm saying that the magnetic fields cause the charges to accelerate at a right angle to their direction of motion). Since light doesn't have an electric charge, there is nothing for electric f...
In classical physics, electromagnetic fields and waves are additive so nothing can happen in vacuum between electromagnetic fields. They don't see each other. In quantum physics, photons theoretically DO interact. The effect is rather small even in high-energy experiments, so don't expect some visible distortion with ...
507,192
As light is electromagnetic radiation. Then why I don't see any magnet bending light wave? Or why light doesn't diffract whenever it passes by a live wire?
2019/10/09
[ "https://physics.stackexchange.com/questions/507192", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/-1/" ]
In vacuum electromagnetic fields obey superposition to a very high degree of accuracy. A magnetic field does not have any effect on light. Light in material media *can* be affected by a magnetic field. This is known as the [Kerr effect](https://en.wikipedia.org/wiki/Kerr_effect). As for current carrying wires, these r...
In classical physics, electromagnetic fields and waves are additive so nothing can happen in vacuum between electromagnetic fields. They don't see each other. In quantum physics, photons theoretically DO interact. The effect is rather small even in high-energy experiments, so don't expect some visible distortion with ...
46,159,138
When a repository is cloned by using simple `git clone repo`, the master branch is automatically checked out. If after this automatic checkout, I want to delete all files checked out and turn the clone in to a bare clone, how can I achieve this? Are there configurations within the .git folder that I can modify to accom...
2017/09/11
[ "https://Stackoverflow.com/questions/46159138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4292143/" ]
`git clone --no-checkout` doesn't give a bare repository, it just leaves the work tree and index empty. `git status` after such a clone will say that all files have been staged for deletion. A bare repository is one with `core.bare = true` (and a bare repository made with `git clone --bare` will also not have any remo...
I don't get your question. In my understanding, if you want to clear a repository then after cloning delete the files you don't want and push. If you want to checkout into a new branch then use this command: ``` git checkout -b your-new-branch-name ```
2,307,384
I have two tables(entries and tags) with a many-to-many linking table. Right now, I'm making a query to retrieve all the entries that meet my criteria, and a query for each entry to retrieve the tags. Would there be a way to say, have the tags returned through a new column as an array in the first query?
2010/02/21
[ "https://Stackoverflow.com/questions/2307384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/256300/" ]
This query: ``` SELECT e.id entry_id , GROUP_CONCAT(t.txt ORDER BY t.txt) tags FROM entry e LEFT JOIN entry_tag et ON e.id = et.entry_id LEFT JOIN tag t ON et.tag_id = t.id GROUP BY e.id ``` Will return the tags as a comma-separated list. You can r...
You can use `GROUP BY` and `GROUP_CONCAT` function to get all tags at once as a concatenated string. <http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html>
39,901,749
Learning OS, it has been usually seen in any textbooks that using fork() in the parent process to create a child process, and sometimes call wait() in the parent to wait for the completion of the child. But, what happens, if I use wait() in the child? ``` #include <stdlib.h> #include <stdio.h> #include <unistd.h> #...
2016/10/06
[ "https://Stackoverflow.com/questions/39901749", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6933304/" ]
> > But, what happens, if I use wait() in the child? > > > Have you read its documentation? Especially the parts about return value and error conditions? I see that you have performed an experiment, which is good; between that and the docs, it should already be clear that if the process that calls `wait()` has no ...
You have already said what happens in your sample output, but to get more detail you have to check the `errno` value after receiving a failure code from the `wait` system call. While checking `if (errno == ECHILD)` is helpful and can be used to perform some action that may handle this error, you can also get a string (...
37,674,908
I am using phpcode to get data from form and upload it into database. But the data is not saved in database.Here 'insert\_product.php' is the file where the entire code resides and form is redirected to same page after button is clicked. Anyone can help? ``` <form action="insert_product.php" method="post" enctype="...
2016/06/07
[ "https://Stackoverflow.com/questions/37674908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4715815/" ]
If this is the entire code, I can't find something like `$con = mysqli_connect(...)` Obviously you need to connect to the database before executing any queries on it
You need to connect to database first like so: ``` $con = mysqli_connect("localhost","my_user","my_password","my_db"); ``` More on database connections [here](http://www.w3schools.com/php/func_mysqli_connect.asp). And if I was you I would start simple by first getting the connection working, then inserting data into...
88,952
I want to express that I learning some courses will give me a good vision in a specific field. Can I say like "these courses take me on the way to the statistics"?
2016/05/02
[ "https://ell.stackexchange.com/questions/88952", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/32654/" ]
Maybe you want to say > > These courses should/will get me started on my way to learning/understanding statistics. > > > We can shorten this in several ways. > > These should get me on my way > > > would be clear and idiomatic if your listener knows what you are talking about. The sense of *way* here, m...
No, that's not correct. I assume the course is about statistics, right? Maybe you could say, > > This course will give a good overview of statistics. > > > An "overview" means you will understand what the subject is about, but not be an expert. I'm not sure if that's what you want to say.
88,952
I want to express that I learning some courses will give me a good vision in a specific field. Can I say like "these courses take me on the way to the statistics"?
2016/05/02
[ "https://ell.stackexchange.com/questions/88952", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/32654/" ]
Maybe you want to say > > These courses should/will get me started on my way to learning/understanding statistics. > > > We can shorten this in several ways. > > These should get me on my way > > > would be clear and idiomatic if your listener knows what you are talking about. The sense of *way* here, m...
I think it's not idiomatic to say: These courses will take me on the way to the statistics. I think you can rephrase your sentence as follows: These courses will go a long way toward(s) learning statistics. These courses will give a good insight into statistics.
22,919,537
I would like the user to perform different tasks via HttpGet/HttpPost actions. I would like to save the Cookies so that the user only needs to login after expiration of the cookie. When traversing the internet I saw that the "PersistentCookiestore" is a good starting point. Question 1: how can I use the (apache) P...
2014/04/07
[ "https://Stackoverflow.com/questions/22919537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3143823/" ]
Not a MySQL Person but here is a sql server general solution: **DO** not do the update. I do that on multiple occasions, **using triggers to maintain the count**. This has the advantage that this type of query is super fat because no updates must be done.
Do you also have an index on C.id? I think the problem is with the WHERE CU.collection\_id = C.id which is being executed for each line (with the select count). P.S. - try checkin the execution plan, make sure it makes sense - it might be that the statistics are not current, so the plan is not using indexes at all...
22,919,537
I would like the user to perform different tasks via HttpGet/HttpPost actions. I would like to save the Cookies so that the user only needs to login after expiration of the cookie. When traversing the internet I saw that the "PersistentCookiestore" is a good starting point. Question 1: how can I use the (apache) P...
2014/04/07
[ "https://Stackoverflow.com/questions/22919537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3143823/" ]
Not a MySQL Person but here is a sql server general solution: **DO** not do the update. I do that on multiple occasions, **using triggers to maintain the count**. This has the advantage that this type of query is super fat because no updates must be done.
I would probably go with something like: ``` UPDATE collections C INNER JOIN (SELECT CU.collection_id, count(*) cu_count FROM collections_users CU) cu2 ON C.id = cu2.collection_id SET C.follower_count_summary = cu2.cu_count; ``` However I'm not in front of MySQL at the moment and can't double check this with ...
22,919,537
I would like the user to perform different tasks via HttpGet/HttpPost actions. I would like to save the Cookies so that the user only needs to login after expiration of the cookie. When traversing the internet I saw that the "PersistentCookiestore" is a good starting point. Question 1: how can I use the (apache) P...
2014/04/07
[ "https://Stackoverflow.com/questions/22919537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3143823/" ]
Your attempt will do one sub query for each row in **collections**, that's why it takes a long time. You should be able to see that with `explain update...`if you are using mysql 5.6. I think the best solution is to either maintain the counts through a trigger or to snapshot them into another table (MySQL is picky abo...
Do you also have an index on C.id? I think the problem is with the WHERE CU.collection\_id = C.id which is being executed for each line (with the select count). P.S. - try checkin the execution plan, make sure it makes sense - it might be that the statistics are not current, so the plan is not using indexes at all...
22,919,537
I would like the user to perform different tasks via HttpGet/HttpPost actions. I would like to save the Cookies so that the user only needs to login after expiration of the cookie. When traversing the internet I saw that the "PersistentCookiestore" is a good starting point. Question 1: how can I use the (apache) P...
2014/04/07
[ "https://Stackoverflow.com/questions/22919537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3143823/" ]
I would probably go with something like: ``` UPDATE collections C INNER JOIN (SELECT CU.collection_id, count(*) cu_count FROM collections_users CU) cu2 ON C.id = cu2.collection_id SET C.follower_count_summary = cu2.cu_count; ``` However I'm not in front of MySQL at the moment and can't double check this with ...
Do you also have an index on C.id? I think the problem is with the WHERE CU.collection\_id = C.id which is being executed for each line (with the select count). P.S. - try checkin the execution plan, make sure it makes sense - it might be that the statistics are not current, so the plan is not using indexes at all...
22,919,537
I would like the user to perform different tasks via HttpGet/HttpPost actions. I would like to save the Cookies so that the user only needs to login after expiration of the cookie. When traversing the internet I saw that the "PersistentCookiestore" is a good starting point. Question 1: how can I use the (apache) P...
2014/04/07
[ "https://Stackoverflow.com/questions/22919537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3143823/" ]
Your attempt will do one sub query for each row in **collections**, that's why it takes a long time. You should be able to see that with `explain update...`if you are using mysql 5.6. I think the best solution is to either maintain the counts through a trigger or to snapshot them into another table (MySQL is picky abo...
I would probably go with something like: ``` UPDATE collections C INNER JOIN (SELECT CU.collection_id, count(*) cu_count FROM collections_users CU) cu2 ON C.id = cu2.collection_id SET C.follower_count_summary = cu2.cu_count; ``` However I'm not in front of MySQL at the moment and can't double check this with ...
3,002,546
Let $(A, <)$ a arbitrary partially ordered set. ( $<$ is irreflexive and transitive) These two statements are equivalent: Every nonempty subset of $A$ that is bounded from above has a supremum in $A$ Every nonempty subset of $A$ that is bounded from below has an infimum in $A$ **My attempt**: Let the first stateme...
2018/11/17
[ "https://math.stackexchange.com/questions/3002546", "https://math.stackexchange.com", "https://math.stackexchange.com/users/321708/" ]
Suppose $S\not\in D$. Then $S$ is not a lower bound for $C$ and so there exists $c\in C$ such that $c\lt S$. This is impossible because all elements of $c$ are upper bounds for $D$ so $S$ would not be the least upper bound for $D$. This is a contradiction. Edit: There is a slight problem with this proof due to the fac...
If $\varnothing\neq C\subseteq A$ and $C$ is bounded from below, and $D:=\{d\in A\mid d\text{ is a lower bound of }C\}$ then $D$ is not empty and: $$\forall c\in C\forall d\in D\;d\leq c\tag1$$ where $d\leq c$ abbreviates $d=c\vee d<c$. Since $D$ is not empty it will have a least upper bound $s$ (I prefer a small $s$ ...
19,837,479
In my web application, where presentation tier is in JSF, i want to have button 'back to previous page' on some pages. I'm making it through URL parameters: `http://www.example.com/index.xhtml?backurl=value` for example, in mange bean i set current page A.xhtml url: ``` public String showCourse(Course c){ curre...
2013/11/07
[ "https://Stackoverflow.com/questions/19837479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2754014/" ]
In **ps\_shop\_url** table you must set `domain=localhost`, `domain_ssl=localhost` & `physical_uri=/myProject/` In **ps\_configuration** set `PS_SHOP_DOMAIN_SSL` & `PS_SHOP_DOMAIN` to `localhost` Also go at BackOffice -> Preferences -> SEO & URLs and click [Save] - this will regenerate your **.htaccess** file and wi...
A small addition to the answer provided by prestashop-developer-com For Prestashop 1.6, you just need to change the table **ps\_shop\_url** following the recommendation from prestashop-developer-com
293,927
Because while that is technically the correct spelling for each word, but as a phrase it doesn't seem to work well together. It lacks symmetry (Hipp**ie** vs. Dipp**y**) and uses the extremely rare-yet-proper Italian "bologna". Origin: The phrase is used with delightful comic effect in [*The Lego Movie*](http://www.im...
2015/12/14
[ "https://english.stackexchange.com/questions/293927", "https://english.stackexchange.com", "https://english.stackexchange.com/users/151541/" ]
> > ’Tis one thing to be tempted, Escalus, > Another thing to fall. *(Measure for Measure* 2.1.17–18) > > > The coordinate pairing of infinitives in this construction is so well established that a reader is likely to reach the end of your first sentence waiting for the other shoe to drop. Your then beginning the...
It seems that you want to use unsuccessfully two constructions combined “It is one thing to passively learn about all those various commands in JavaScript by poring over online materials. However, in order to fully appreciate how and when to use each one, I need to try them out in my own code and have them corrected b...
293,927
Because while that is technically the correct spelling for each word, but as a phrase it doesn't seem to work well together. It lacks symmetry (Hipp**ie** vs. Dipp**y**) and uses the extremely rare-yet-proper Italian "bologna". Origin: The phrase is used with delightful comic effect in [*The Lego Movie*](http://www.im...
2015/12/14
[ "https://english.stackexchange.com/questions/293927", "https://english.stackexchange.com", "https://english.stackexchange.com/users/151541/" ]
> > ’Tis one thing to be tempted, Escalus, > Another thing to fall. *(Measure for Measure* 2.1.17–18) > > > The coordinate pairing of infinitives in this construction is so well established that a reader is likely to reach the end of your first sentence waiting for the other shoe to drop. Your then beginning the...
First, it is always awkward to have anything between to and the infinitive as we were told in grammar school. Secondly, the comparison should form a somewhat sharp contrast rather than two similar but slightly different things. My example is this: "It is one thing for a person to own what he has created; it is another ...
293,927
Because while that is technically the correct spelling for each word, but as a phrase it doesn't seem to work well together. It lacks symmetry (Hipp**ie** vs. Dipp**y**) and uses the extremely rare-yet-proper Italian "bologna". Origin: The phrase is used with delightful comic effect in [*The Lego Movie*](http://www.im...
2015/12/14
[ "https://english.stackexchange.com/questions/293927", "https://english.stackexchange.com", "https://english.stackexchange.com/users/151541/" ]
> > ’Tis one thing to be tempted, Escalus, > Another thing to fall. *(Measure for Measure* 2.1.17–18) > > > The coordinate pairing of infinitives in this construction is so well established that a reader is likely to reach the end of your first sentence waiting for the other shoe to drop. Your then beginning the...
> > It is one thing to *X* but another to *Y* > > > Often means things like: * *X* may be good, but *Y* is much better (or: *X* may be bad, but *Y* is much worse) * Don't mistake *X* for *Y* * Don't overestimate *X* / let *X* impress you * Don't underestimate or disregard *Y* The author of your example sentence ...
293,927
Because while that is technically the correct spelling for each word, but as a phrase it doesn't seem to work well together. It lacks symmetry (Hipp**ie** vs. Dipp**y**) and uses the extremely rare-yet-proper Italian "bologna". Origin: The phrase is used with delightful comic effect in [*The Lego Movie*](http://www.im...
2015/12/14
[ "https://english.stackexchange.com/questions/293927", "https://english.stackexchange.com", "https://english.stackexchange.com/users/151541/" ]
"It is one thing to (blank), but another to (blank)" is a comparative structure. Taking a cue from your example, it would make more sense to say something like "It is one thing to learn passively, but another to understand the material." It's used specifically when you're comparing two things, with the second of them...
It seems that you want to use unsuccessfully two constructions combined “It is one thing to passively learn about all those various commands in JavaScript by poring over online materials. However, in order to fully appreciate how and when to use each one, I need to try them out in my own code and have them corrected b...
293,927
Because while that is technically the correct spelling for each word, but as a phrase it doesn't seem to work well together. It lacks symmetry (Hipp**ie** vs. Dipp**y**) and uses the extremely rare-yet-proper Italian "bologna". Origin: The phrase is used with delightful comic effect in [*The Lego Movie*](http://www.im...
2015/12/14
[ "https://english.stackexchange.com/questions/293927", "https://english.stackexchange.com", "https://english.stackexchange.com/users/151541/" ]
"It is one thing to (blank), but another to (blank)" is a comparative structure. Taking a cue from your example, it would make more sense to say something like "It is one thing to learn passively, but another to understand the material." It's used specifically when you're comparing two things, with the second of them...
First, it is always awkward to have anything between to and the infinitive as we were told in grammar school. Secondly, the comparison should form a somewhat sharp contrast rather than two similar but slightly different things. My example is this: "It is one thing for a person to own what he has created; it is another ...
293,927
Because while that is technically the correct spelling for each word, but as a phrase it doesn't seem to work well together. It lacks symmetry (Hipp**ie** vs. Dipp**y**) and uses the extremely rare-yet-proper Italian "bologna". Origin: The phrase is used with delightful comic effect in [*The Lego Movie*](http://www.im...
2015/12/14
[ "https://english.stackexchange.com/questions/293927", "https://english.stackexchange.com", "https://english.stackexchange.com/users/151541/" ]
"It is one thing to (blank), but another to (blank)" is a comparative structure. Taking a cue from your example, it would make more sense to say something like "It is one thing to learn passively, but another to understand the material." It's used specifically when you're comparing two things, with the second of them...
> > It is one thing to *X* but another to *Y* > > > Often means things like: * *X* may be good, but *Y* is much better (or: *X* may be bad, but *Y* is much worse) * Don't mistake *X* for *Y* * Don't overestimate *X* / let *X* impress you * Don't underestimate or disregard *Y* The author of your example sentence ...
293,927
Because while that is technically the correct spelling for each word, but as a phrase it doesn't seem to work well together. It lacks symmetry (Hipp**ie** vs. Dipp**y**) and uses the extremely rare-yet-proper Italian "bologna". Origin: The phrase is used with delightful comic effect in [*The Lego Movie*](http://www.im...
2015/12/14
[ "https://english.stackexchange.com/questions/293927", "https://english.stackexchange.com", "https://english.stackexchange.com/users/151541/" ]
It seems that you want to use unsuccessfully two constructions combined “It is one thing to passively learn about all those various commands in JavaScript by poring over online materials. However, in order to fully appreciate how and when to use each one, I need to try them out in my own code and have them corrected b...
First, it is always awkward to have anything between to and the infinitive as we were told in grammar school. Secondly, the comparison should form a somewhat sharp contrast rather than two similar but slightly different things. My example is this: "It is one thing for a person to own what he has created; it is another ...
293,927
Because while that is technically the correct spelling for each word, but as a phrase it doesn't seem to work well together. It lacks symmetry (Hipp**ie** vs. Dipp**y**) and uses the extremely rare-yet-proper Italian "bologna". Origin: The phrase is used with delightful comic effect in [*The Lego Movie*](http://www.im...
2015/12/14
[ "https://english.stackexchange.com/questions/293927", "https://english.stackexchange.com", "https://english.stackexchange.com/users/151541/" ]
> > It is one thing to *X* but another to *Y* > > > Often means things like: * *X* may be good, but *Y* is much better (or: *X* may be bad, but *Y* is much worse) * Don't mistake *X* for *Y* * Don't overestimate *X* / let *X* impress you * Don't underestimate or disregard *Y* The author of your example sentence ...
First, it is always awkward to have anything between to and the infinitive as we were told in grammar school. Secondly, the comparison should form a somewhat sharp contrast rather than two similar but slightly different things. My example is this: "It is one thing for a person to own what he has created; it is another ...
30,978,250
I use Hadoop total order partitioner and random sampler as input sampler. But when I increase my slave nodes and reduce tasks to 8, I get following error: ``` Caused by: java.io.IOException: Split points are out of order ``` I don't know the reason for this error. How can I set the number of three parameters on ...
2015/06/22
[ "https://Stackoverflow.com/questions/30978250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4974849/" ]
Two possible problems * You have duplicate keys * You are using a different comparator for the input sampler and the task on which you are running the total order partitioner You can diagnose this by downloading the partition file and examining its contents. The partitions file is the value of `total.order.partitione...
Are you sure you are generating enough keys? From the javadoc: [TotalOrderPartitioner](http://%09https://hadoop.apache.org/docs/r2.7.3/api/org/apache/hadoop/mapreduce/lib/partition/TotalOrderPartitioner.html#setConf(org.apache.hadoop.conf.Configuration)) The input file must be sorted with the same comparator and conta...
2,716,142
The error NASM gives (despite my working OS) is "invalid effective address". Now I've seen many examples of how to use LEA and I think I got it right but yet my NASM dislikes it. I tried `lea cx, [cx+9]` and it worked; `lea cx, [bx+cx]` didn't. Now if I extended my registers to 32-bits (i.e. `lea ecx, [ecx*8+ecx]`) e...
2010/04/26
[ "https://Stackoverflow.com/questions/2716142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/326280/" ]
This is because `[bx+cx]` isn't valid in any addressing mode on 16-bit x86, see this [site](http://www.ic.unicamp.br/~celio/mc404s2-03/addr_modes/intel_addr.html) for more info. `lea cx, [bx+di]` or `lea cx, [bx+si]` should work. If your code will run on 386 or later in 16bit mode, you can use `lea cx, [ecx + 9]` (ad...
These following tables for to build a postbyte shows which register can be used as an addressregister and which of them can be combine with a second addressregister(baseregister+indexregister and maybe scaling) to build an address with it. (Observed from the 16 bit address mode, where the D-flag is not set.) ``` Instr...
2,716,142
The error NASM gives (despite my working OS) is "invalid effective address". Now I've seen many examples of how to use LEA and I think I got it right but yet my NASM dislikes it. I tried `lea cx, [cx+9]` and it worked; `lea cx, [bx+cx]` didn't. Now if I extended my registers to 32-bits (i.e. `lea ecx, [ecx*8+ecx]`) e...
2010/04/26
[ "https://Stackoverflow.com/questions/2716142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/326280/" ]
`lea cx,[cx*8+cx]` doesn't work because "scale-index-base" addressing is only available with 32-bit registers. It's not a limitation of the assembler--it's a limitation of the processor.
These following tables for to build a postbyte shows which register can be used as an addressregister and which of them can be combine with a second addressregister(baseregister+indexregister and maybe scaling) to build an address with it. (Observed from the 16 bit address mode, where the D-flag is not set.) ``` Instr...
62,569,758
I want to plot line graph row my row & I want the previous line to be updated by the next line (on the same frame). Here's the example of the input: [![enter image description here](https://i.stack.imgur.com/OnJJS.png)](https://i.stack.imgur.com/OnJJS.png) Here's the code that I have: ``` def openB(): bmFile = filed...
2020/06/25
[ "https://Stackoverflow.com/questions/62569758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11229350/" ]
It's running, but just the time it takes is huge. You can check by the following code, it keeps going to print `x`'s. ```python n = 600851475143 x = 0 for i in range(2, n): if n % i == 0: if x < i: x = i print(x) ``` --- To save time, you can try the following code instead of you...
``` from tqdm.auto import tqdm n = 600851475143 x = 0 for i in tqdm(range(2,n)): if(n%i == 0): x = i print(x) ``` If using classic python, your program will last for at least 40 min, that's why you had no output. I suggest you either use numpy to go through, or add a step because I think even numbers wo...
62,569,758
I want to plot line graph row my row & I want the previous line to be updated by the next line (on the same frame). Here's the example of the input: [![enter image description here](https://i.stack.imgur.com/OnJJS.png)](https://i.stack.imgur.com/OnJJS.png) Here's the code that I have: ``` def openB(): bmFile = filed...
2020/06/25
[ "https://Stackoverflow.com/questions/62569758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11229350/" ]
It's running, but just the time it takes is huge. You can check by the following code, it keeps going to print `x`'s. ```python n = 600851475143 x = 0 for i in range(2, n): if n % i == 0: if x < i: x = i print(x) ``` --- To save time, you can try the following code instead of you...
Check this code you will save a lot of time Using `sqrt` for optimization ``` from math import sqrt def Euler3(n): x=int(sqrt(n)) for i in range(2,x+1): while n % i == 0: n //= i if n == 1 or n == i: return i return n n = int(input()) print(Euler3(n)) ``` ...
62,569,758
I want to plot line graph row my row & I want the previous line to be updated by the next line (on the same frame). Here's the example of the input: [![enter image description here](https://i.stack.imgur.com/OnJJS.png)](https://i.stack.imgur.com/OnJJS.png) Here's the code that I have: ``` def openB(): bmFile = filed...
2020/06/25
[ "https://Stackoverflow.com/questions/62569758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11229350/" ]
It's running, but just the time it takes is huge. You can check by the following code, it keeps going to print `x`'s. ```python n = 600851475143 x = 0 for i in range(2, n): if n % i == 0: if x < i: x = i print(x) ``` --- To save time, you can try the following code instead of you...
What would be more efficient is to only divide your number by actual primes. You also only need to check divisors up to the square root of the number given that any valid (integer) result will be also be a divisor (which you will already have checked if your divisor goes beyond the square root). ``` # generator to obt...
62,569,758
I want to plot line graph row my row & I want the previous line to be updated by the next line (on the same frame). Here's the example of the input: [![enter image description here](https://i.stack.imgur.com/OnJJS.png)](https://i.stack.imgur.com/OnJJS.png) Here's the code that I have: ``` def openB(): bmFile = filed...
2020/06/25
[ "https://Stackoverflow.com/questions/62569758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11229350/" ]
``` from tqdm.auto import tqdm n = 600851475143 x = 0 for i in tqdm(range(2,n)): if(n%i == 0): x = i print(x) ``` If using classic python, your program will last for at least 40 min, that's why you had no output. I suggest you either use numpy to go through, or add a step because I think even numbers wo...
What would be more efficient is to only divide your number by actual primes. You also only need to check divisors up to the square root of the number given that any valid (integer) result will be also be a divisor (which you will already have checked if your divisor goes beyond the square root). ``` # generator to obt...
62,569,758
I want to plot line graph row my row & I want the previous line to be updated by the next line (on the same frame). Here's the example of the input: [![enter image description here](https://i.stack.imgur.com/OnJJS.png)](https://i.stack.imgur.com/OnJJS.png) Here's the code that I have: ``` def openB(): bmFile = filed...
2020/06/25
[ "https://Stackoverflow.com/questions/62569758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11229350/" ]
Check this code you will save a lot of time Using `sqrt` for optimization ``` from math import sqrt def Euler3(n): x=int(sqrt(n)) for i in range(2,x+1): while n % i == 0: n //= i if n == 1 or n == i: return i return n n = int(input()) print(Euler3(n)) ``` ...
What would be more efficient is to only divide your number by actual primes. You also only need to check divisors up to the square root of the number given that any valid (integer) result will be also be a divisor (which you will already have checked if your divisor goes beyond the square root). ``` # generator to obt...
63,497,666
So I'm trying to make an on\_user\_update event and to send the message I need to fetch the channel\_id that is set as the log channel for the guild, which I sort by guild\_id, but on\_user\_update has no guild attribute. So how would I achieve my goal? Here's the code: ```py @bot.event async def on_user_update(befor...
2020/08/20
[ "https://Stackoverflow.com/questions/63497666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Although I would use @jinongun's answer in most cases, here is the solution to fixing your code. You should change `className` to `class` and `htmlFor` to `for`. **`className` and `htmlFor` are JavaScript properties.** ```css .float-input-block :first-child { border-radius: 0.8rem 0.8rem 0 0; } .float-input-block ...
I have a different idea. ```css .wrapper{ width: 120px; border: 1px solid red; border-radius: 15px; overflow: hidden; } .wrapper > .row{ height: 30px; text-align: center; background: gray; } ``` ```html <div class="wrapper"> <div class="row">1</div> <div class="row">2</div> <div class="row">1</div...
63,497,666
So I'm trying to make an on\_user\_update event and to send the message I need to fetch the channel\_id that is set as the log channel for the guild, which I sort by guild\_id, but on\_user\_update has no guild attribute. So how would I achieve my goal? Here's the code: ```py @bot.event async def on_user_update(befor...
2020/08/20
[ "https://Stackoverflow.com/questions/63497666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I just styled the containers directly with the style props: ``` <FloatInput style={{ borderRadius: '0.8rem 0.8rem 0 0' }} name="nome" label="Nome" placeholder="Nome" required value={name} onChange={(e) => { setName(e.target.value) }} /> ``` Thanks to everyone who's trying to help me. if a...
I have a different idea. ```css .wrapper{ width: 120px; border: 1px solid red; border-radius: 15px; overflow: hidden; } .wrapper > .row{ height: 30px; text-align: center; background: gray; } ``` ```html <div class="wrapper"> <div class="row">1</div> <div class="row">2</div> <div class="row">1</div...
63,497,666
So I'm trying to make an on\_user\_update event and to send the message I need to fetch the channel\_id that is set as the log channel for the guild, which I sort by guild\_id, but on\_user\_update has no guild attribute. So how would I achieve my goal? Here's the code: ```py @bot.event async def on_user_update(befor...
2020/08/20
[ "https://Stackoverflow.com/questions/63497666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Although I would use @jinongun's answer in most cases, here is the solution to fixing your code. You should change `className` to `class` and `htmlFor` to `for`. **`className` and `htmlFor` are JavaScript properties.** ```css .float-input-block :first-child { border-radius: 0.8rem 0.8rem 0 0; } .float-input-block ...
I just styled the containers directly with the style props: ``` <FloatInput style={{ borderRadius: '0.8rem 0.8rem 0 0' }} name="nome" label="Nome" placeholder="Nome" required value={name} onChange={(e) => { setName(e.target.value) }} /> ``` Thanks to everyone who's trying to help me. if a...
77,512
Is there a way to turn off the boxes around the icons in Unity? Clarification: I do **not** mean the backlight color -- there are plenty of questions about turning *that* off. I want the icons, and just the icons, to appear in the Unity bar, without any lights and shadows and borders. Can this be done?
2011/11/09
[ "https://askubuntu.com/questions/77512", "https://askubuntu.com", "https://askubuntu.com/users/11328/" ]
The launcher icon overlays such as borders and highlights can be removed quite easily by changing 4 icon overlays in Unity. 1. Make a backup of the following image files in the folder `/usr/share/unity/4/`: ``` launcher_icon_back_54.png launcher_icon_edge_54.png launcher_icon_glow_62.png launcher_icon_shine_54.png `...
It is possible, and rather simple. 1. Install compizconfig-settings-manager: ``` sudo apt-get install compizconfig-settings-manager ``` 2. Then run `about:config` in the run dialogue in Unity: press `Alt`+`F2` and enter `about:config`. 3. CCSM will pop up with the Unity plug-in open. Navigate to the experimental tab...
77,512
Is there a way to turn off the boxes around the icons in Unity? Clarification: I do **not** mean the backlight color -- there are plenty of questions about turning *that* off. I want the icons, and just the icons, to appear in the Unity bar, without any lights and shadows and borders. Can this be done?
2011/11/09
[ "https://askubuntu.com/questions/77512", "https://askubuntu.com", "https://askubuntu.com/users/11328/" ]
It is possible, and rather simple. 1. Install compizconfig-settings-manager: ``` sudo apt-get install compizconfig-settings-manager ``` 2. Then run `about:config` in the run dialogue in Unity: press `Alt`+`F2` and enter `about:config`. 3. CCSM will pop up with the Unity plug-in open. Navigate to the experimental tab...
I scripted the removal of the boxes around the applications and the one around the Ubuntu button (for 12.04): ``` cd /usr/share/unity/5 wget -O transparent54.png "https://i.stack.imgur.com/MiFpK.png" wget -O transparent62.png "https://i.stack.imgur.com/0NvP0.png" for name in squircle_shine squircle_edge squircle_base...
77,512
Is there a way to turn off the boxes around the icons in Unity? Clarification: I do **not** mean the backlight color -- there are plenty of questions about turning *that* off. I want the icons, and just the icons, to appear in the Unity bar, without any lights and shadows and borders. Can this be done?
2011/11/09
[ "https://askubuntu.com/questions/77512", "https://askubuntu.com", "https://askubuntu.com/users/11328/" ]
It is possible, and rather simple. 1. Install compizconfig-settings-manager: ``` sudo apt-get install compizconfig-settings-manager ``` 2. Then run `about:config` in the run dialogue in Unity: press `Alt`+`F2` and enter `about:config`. 3. CCSM will pop up with the Unity plug-in open. Navigate to the experimental tab...
To do this locally, we don't have to modify the files in the folder /usr/share/unity/. Instead we can just copy these files in the gtk theme folder under a folder "unity" that you create. This will override the files in /usr/share/unity/ and also, this way, a system update will not remove the change. But I have a diffe...
77,512
Is there a way to turn off the boxes around the icons in Unity? Clarification: I do **not** mean the backlight color -- there are plenty of questions about turning *that* off. I want the icons, and just the icons, to appear in the Unity bar, without any lights and shadows and borders. Can this be done?
2011/11/09
[ "https://askubuntu.com/questions/77512", "https://askubuntu.com", "https://askubuntu.com/users/11328/" ]
The launcher icon overlays such as borders and highlights can be removed quite easily by changing 4 icon overlays in Unity. 1. Make a backup of the following image files in the folder `/usr/share/unity/4/`: ``` launcher_icon_back_54.png launcher_icon_edge_54.png launcher_icon_glow_62.png launcher_icon_shine_54.png `...
I scripted the removal of the boxes around the applications and the one around the Ubuntu button (for 12.04): ``` cd /usr/share/unity/5 wget -O transparent54.png "https://i.stack.imgur.com/MiFpK.png" wget -O transparent62.png "https://i.stack.imgur.com/0NvP0.png" for name in squircle_shine squircle_edge squircle_base...
77,512
Is there a way to turn off the boxes around the icons in Unity? Clarification: I do **not** mean the backlight color -- there are plenty of questions about turning *that* off. I want the icons, and just the icons, to appear in the Unity bar, without any lights and shadows and borders. Can this be done?
2011/11/09
[ "https://askubuntu.com/questions/77512", "https://askubuntu.com", "https://askubuntu.com/users/11328/" ]
The launcher icon overlays such as borders and highlights can be removed quite easily by changing 4 icon overlays in Unity. 1. Make a backup of the following image files in the folder `/usr/share/unity/4/`: ``` launcher_icon_back_54.png launcher_icon_edge_54.png launcher_icon_glow_62.png launcher_icon_shine_54.png `...
To do this locally, we don't have to modify the files in the folder /usr/share/unity/. Instead we can just copy these files in the gtk theme folder under a folder "unity" that you create. This will override the files in /usr/share/unity/ and also, this way, a system update will not remove the change. But I have a diffe...
77,512
Is there a way to turn off the boxes around the icons in Unity? Clarification: I do **not** mean the backlight color -- there are plenty of questions about turning *that* off. I want the icons, and just the icons, to appear in the Unity bar, without any lights and shadows and borders. Can this be done?
2011/11/09
[ "https://askubuntu.com/questions/77512", "https://askubuntu.com", "https://askubuntu.com/users/11328/" ]
I scripted the removal of the boxes around the applications and the one around the Ubuntu button (for 12.04): ``` cd /usr/share/unity/5 wget -O transparent54.png "https://i.stack.imgur.com/MiFpK.png" wget -O transparent62.png "https://i.stack.imgur.com/0NvP0.png" for name in squircle_shine squircle_edge squircle_base...
To do this locally, we don't have to modify the files in the folder /usr/share/unity/. Instead we can just copy these files in the gtk theme folder under a folder "unity" that you create. This will override the files in /usr/share/unity/ and also, this way, a system update will not remove the change. But I have a diffe...
15,029
Can someone cite lines from the Torah that specify what Jews should eat during Passover? I'm aware that Jews don't eat leavened bread during Passover. Where does this rule come from?
2012/03/07
[ "https://judaism.stackexchange.com/questions/15029", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/1322/" ]
From the [Wikipedia article](http://en.wikipedia.org/wiki/Chametz#Torah_related_sources) on Chametz (leaven): > > The Torah has several commandments governing chametz during Passover: > > > * The positive commandment to remove all chametz from one's home ([Exodus 12:15](http://bibref.hebtools.com/?book=%20Exodus&ve...
It's in the book of [Shemos (Exodus), 12:18-19](http://mechon-mamre.org/p/pt/pt0212.htm)
5,954,916
I am running the following command in cpanel ``` /ramdisk/bin/php5 -q /home#/username/etc/php.ini /home#/username/public_html/sitename/subfolder/twitter.php ``` It is supposed to display search results for a certain keyword from twitter. The twitter.php file works just fine...however my impression was that setting t...
2011/05/10
[ "https://Stackoverflow.com/questions/5954916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/648927/" ]
A cronjob does not affect the browser. In order to refresh the page you could refresh the page automatically with HTML ``` <META HTTP-EQUIV="refresh" CONTENT="60"> ``` or use javascript ``` function reloadPage(){ window.location.reload(); } setTimeout ( reloadPage, 60000); ```
The page will load whatever content you tell it to load. And if the cron job updates the content somehow, then the page will load (when someone requests it) with the new content. If the cron job does not update the content, then anyone who sees the page will see the old content.
5,954,916
I am running the following command in cpanel ``` /ramdisk/bin/php5 -q /home#/username/etc/php.ini /home#/username/public_html/sitename/subfolder/twitter.php ``` It is supposed to display search results for a certain keyword from twitter. The twitter.php file works just fine...however my impression was that setting t...
2011/05/10
[ "https://Stackoverflow.com/questions/5954916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/648927/" ]
A cronjob does not affect the browser. In order to refresh the page you could refresh the page automatically with HTML ``` <META HTTP-EQUIV="refresh" CONTENT="60"> ``` or use javascript ``` function reloadPage(){ window.location.reload(); } setTimeout ( reloadPage, 60000); ```
> > when i manually refresh twitter.php in the browser i get new results...the goal is to set up an automation of this process so visitors of the site see new (processed) results every minute or so... > > > You'll need to save them somewhere (a database, a text file, etc.), then, and have `twitter.php` load them o...
5,954,916
I am running the following command in cpanel ``` /ramdisk/bin/php5 -q /home#/username/etc/php.ini /home#/username/public_html/sitename/subfolder/twitter.php ``` It is supposed to display search results for a certain keyword from twitter. The twitter.php file works just fine...however my impression was that setting t...
2011/05/10
[ "https://Stackoverflow.com/questions/5954916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/648927/" ]
> > when i manually refresh twitter.php in the browser i get new results...the goal is to set up an automation of this process so visitors of the site see new (processed) results every minute or so... > > > You'll need to save them somewhere (a database, a text file, etc.), then, and have `twitter.php` load them o...
The page will load whatever content you tell it to load. And if the cron job updates the content somehow, then the page will load (when someone requests it) with the new content. If the cron job does not update the content, then anyone who sees the page will see the old content.
57,290,446
In case I only provide a single value, are the following `sql` statements equivalent (eg in terms of performance)? ``` SELECT * FROM mytable where lastname IN(:lastnames); SELECT * FROM mytable where lastname = :lastname; ``` Background: I have service that should serve a list, and a service that serves a single res...
2019/07/31
[ "https://Stackoverflow.com/questions/57290446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1194415/" ]
i tried it on my mariaDB database on a small table with hundred of records and the query with IN is a bit slower than the first one (which is to be expected) but we are talking of 0.02 sec difference
Use This Query. It May Be Solve Your Problem. SELECT \* FROM mytable where lastname IN(SELECT lastname FROM mytable where lastname = :lastname);
57,290,446
In case I only provide a single value, are the following `sql` statements equivalent (eg in terms of performance)? ``` SELECT * FROM mytable where lastname IN(:lastnames); SELECT * FROM mytable where lastname = :lastname; ``` Background: I have service that should serve a list, and a service that serves a single res...
2019/07/31
[ "https://Stackoverflow.com/questions/57290446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1194415/" ]
Assuming your db's engine is optimised and would check if there is one value inside the IN parameters and "convert" it to an equal/do the correct operation it would still be technically longer than just a written equal. Also see [this](https://stackoverflow.com/questions/1013797/is-sql-in-bad-for-performance) about IN...
Use This Query. It May Be Solve Your Problem. SELECT \* FROM mytable where lastname IN(SELECT lastname FROM mytable where lastname = :lastname);
45,883,596
I have this text file and I need to split all words and count them. In the file I have all of the following characters ("." , "," , "!" , "?" , " " , ";" , ":" , "-"). How do I use the split() method to make sure non of those characters will be counted?
2017/08/25
[ "https://Stackoverflow.com/questions/45883596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8145320/" ]
I've had a quick go, just looping through and checking if there's a next value, then subtracting it, and dividing by 60 to get minutes: ``` $dates = ['2017-08-25 06:27:00', '2017-08-25 07:38:00', '2017-08-25 08:34:00', '2017-08-25 09:57:00']; $values = []; foreach ($dates as $index => $date) { $date = strtotime(...
Convert the strings into timestamps (seconds) using [strtotime](http://php.net/manual/en/function.strtotime.php) or [strptime](http://php.net/manual/en/function.strptime.php), then simply subtract.
45,883,596
I have this text file and I need to split all words and count them. In the file I have all of the following characters ("." , "," , "!" , "?" , " " , ";" , ":" , "-"). How do I use the split() method to make sure non of those characters will be counted?
2017/08/25
[ "https://Stackoverflow.com/questions/45883596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8145320/" ]
Even though the answer has already been accepted, I thought I'd give my input nonetheless as I feel there are other options that are more robust and clear/easier to understand. The Object-Oriented Approach ============================ PHP has a collection of native objects specifically designed to handle date calcula...
Convert the strings into timestamps (seconds) using [strtotime](http://php.net/manual/en/function.strtotime.php) or [strptime](http://php.net/manual/en/function.strptime.php), then simply subtract.
45,883,596
I have this text file and I need to split all words and count them. In the file I have all of the following characters ("." , "," , "!" , "?" , " " , ";" , ":" , "-"). How do I use the split() method to make sure non of those characters will be counted?
2017/08/25
[ "https://Stackoverflow.com/questions/45883596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8145320/" ]
I've had a quick go, just looping through and checking if there's a next value, then subtracting it, and dividing by 60 to get minutes: ``` $dates = ['2017-08-25 06:27:00', '2017-08-25 07:38:00', '2017-08-25 08:34:00', '2017-08-25 09:57:00']; $values = []; foreach ($dates as $index => $date) { $date = strtotime(...
Even though the answer has already been accepted, I thought I'd give my input nonetheless as I feel there are other options that are more robust and clear/easier to understand. The Object-Oriented Approach ============================ PHP has a collection of native objects specifically designed to handle date calcula...
10,076,104
In a Java application on a Mac, you can click the top bar and select Quit to exit the program. How can I add a listener to my JFrame to listen to this? I did a search on this and found ApplicationListener, however Eclipse puts a "cross out" in this and seems to think its deprecated or something. Specifically, I found...
2012/04/09
[ "https://Stackoverflow.com/questions/10076104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412082/" ]
The answer is to use the newer version QuitHandler, available from Apple Java extension
In Java 9, you should use the cross-platform Desktop API, as the Mac EAWT APIs have been deprecated: ``` if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); desktop.setQuitHandler(new QuitHandler() { @Override public void handleQuitRequestWith(QuitEvent evt, QuitResp...
10,076,104
In a Java application on a Mac, you can click the top bar and select Quit to exit the program. How can I add a listener to my JFrame to listen to this? I did a search on this and found ApplicationListener, however Eclipse puts a "cross out" in this and seems to think its deprecated or something. Specifically, I found...
2012/04/09
[ "https://Stackoverflow.com/questions/10076104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412082/" ]
The answer is to use the newer version QuitHandler, available from Apple Java extension
You need to register an ApplicationListener: There is a sample application available from Apple: <http://developer.apple.com/library/mac/#samplecode/OSXAdapter/Introduction/Intro.html>
10,076,104
In a Java application on a Mac, you can click the top bar and select Quit to exit the program. How can I add a listener to my JFrame to listen to this? I did a search on this and found ApplicationListener, however Eclipse puts a "cross out" in this and seems to think its deprecated or something. Specifically, I found...
2012/04/09
[ "https://Stackoverflow.com/questions/10076104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412082/" ]
For Java 7, QuitHandler is the interface to be implemented. ``` import com.apple.eawt.QuitHandler; import com.apple.eawt.Application; ``` somewhere, do the following: ``` Application macApp = Application.getApplication(); macApp.setQuitHandler(this); ``` and then , ``` @Override public void handleQuitRequestWi...
You can catch when cross out button clicked like this ``` frame.addWindowListener(new ExitListener()); ``` And then you can overwrite it like this ``` public class ExitListener extends WindowAdapter{ public void windowClosing(WindowEvent e){ //some codes } } ```
10,076,104
In a Java application on a Mac, you can click the top bar and select Quit to exit the program. How can I add a listener to my JFrame to listen to this? I did a search on this and found ApplicationListener, however Eclipse puts a "cross out" in this and seems to think its deprecated or something. Specifically, I found...
2012/04/09
[ "https://Stackoverflow.com/questions/10076104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412082/" ]
For Java 7, QuitHandler is the interface to be implemented. ``` import com.apple.eawt.QuitHandler; import com.apple.eawt.Application; ``` somewhere, do the following: ``` Application macApp = Application.getApplication(); macApp.setQuitHandler(this); ``` and then , ``` @Override public void handleQuitRequestWi...
In Java 9, you should use the cross-platform Desktop API, as the Mac EAWT APIs have been deprecated: ``` if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); desktop.setQuitHandler(new QuitHandler() { @Override public void handleQuitRequestWith(QuitEvent evt, QuitResp...
10,076,104
In a Java application on a Mac, you can click the top bar and select Quit to exit the program. How can I add a listener to my JFrame to listen to this? I did a search on this and found ApplicationListener, however Eclipse puts a "cross out" in this and seems to think its deprecated or something. Specifically, I found...
2012/04/09
[ "https://Stackoverflow.com/questions/10076104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412082/" ]
You need to register an ApplicationListener: There is a sample application available from Apple: <http://developer.apple.com/library/mac/#samplecode/OSXAdapter/Introduction/Intro.html>
You can catch when cross out button clicked like this ``` frame.addWindowListener(new ExitListener()); ``` And then you can overwrite it like this ``` public class ExitListener extends WindowAdapter{ public void windowClosing(WindowEvent e){ //some codes } } ```
10,076,104
In a Java application on a Mac, you can click the top bar and select Quit to exit the program. How can I add a listener to my JFrame to listen to this? I did a search on this and found ApplicationListener, however Eclipse puts a "cross out" in this and seems to think its deprecated or something. Specifically, I found...
2012/04/09
[ "https://Stackoverflow.com/questions/10076104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412082/" ]
The answer is to use the newer version QuitHandler, available from Apple Java extension
You can catch when cross out button clicked like this ``` frame.addWindowListener(new ExitListener()); ``` And then you can overwrite it like this ``` public class ExitListener extends WindowAdapter{ public void windowClosing(WindowEvent e){ //some codes } } ```
10,076,104
In a Java application on a Mac, you can click the top bar and select Quit to exit the program. How can I add a listener to my JFrame to listen to this? I did a search on this and found ApplicationListener, however Eclipse puts a "cross out" in this and seems to think its deprecated or something. Specifically, I found...
2012/04/09
[ "https://Stackoverflow.com/questions/10076104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412082/" ]
For Java 7, QuitHandler is the interface to be implemented. ``` import com.apple.eawt.QuitHandler; import com.apple.eawt.Application; ``` somewhere, do the following: ``` Application macApp = Application.getApplication(); macApp.setQuitHandler(this); ``` and then , ``` @Override public void handleQuitRequestWi...
To not to break compatibility with Windows and other OSes here is approach with another approach: <http://javadots.blogspot.com/2010/09/making-your-swing-app-macosx-compliant.html> Maven dependency: ``` <dependency> <groupId>org.simplericity.macify</groupId> <artifactId>macify</artifactId> <version>1.6</...
10,076,104
In a Java application on a Mac, you can click the top bar and select Quit to exit the program. How can I add a listener to my JFrame to listen to this? I did a search on this and found ApplicationListener, however Eclipse puts a "cross out" in this and seems to think its deprecated or something. Specifically, I found...
2012/04/09
[ "https://Stackoverflow.com/questions/10076104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412082/" ]
You need to register an ApplicationListener: There is a sample application available from Apple: <http://developer.apple.com/library/mac/#samplecode/OSXAdapter/Introduction/Intro.html>
To not to break compatibility with Windows and other OSes here is approach with another approach: <http://javadots.blogspot.com/2010/09/making-your-swing-app-macosx-compliant.html> Maven dependency: ``` <dependency> <groupId>org.simplericity.macify</groupId> <artifactId>macify</artifactId> <version>1.6</...
10,076,104
In a Java application on a Mac, you can click the top bar and select Quit to exit the program. How can I add a listener to my JFrame to listen to this? I did a search on this and found ApplicationListener, however Eclipse puts a "cross out" in this and seems to think its deprecated or something. Specifically, I found...
2012/04/09
[ "https://Stackoverflow.com/questions/10076104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412082/" ]
You need to register an ApplicationListener: There is a sample application available from Apple: <http://developer.apple.com/library/mac/#samplecode/OSXAdapter/Introduction/Intro.html>
In Java 9, you should use the cross-platform Desktop API, as the Mac EAWT APIs have been deprecated: ``` if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); desktop.setQuitHandler(new QuitHandler() { @Override public void handleQuitRequestWith(QuitEvent evt, QuitResp...
10,076,104
In a Java application on a Mac, you can click the top bar and select Quit to exit the program. How can I add a listener to my JFrame to listen to this? I did a search on this and found ApplicationListener, however Eclipse puts a "cross out" in this and seems to think its deprecated or something. Specifically, I found...
2012/04/09
[ "https://Stackoverflow.com/questions/10076104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/412082/" ]
The answer is to use the newer version QuitHandler, available from Apple Java extension
For Java 7, QuitHandler is the interface to be implemented. ``` import com.apple.eawt.QuitHandler; import com.apple.eawt.Application; ``` somewhere, do the following: ``` Application macApp = Application.getApplication(); macApp.setQuitHandler(this); ``` and then , ``` @Override public void handleQuitRequestWi...
22,044
After some unsuccessful uploads I ended up with a lot of loose files in craft/storage/runtime/assets/tempuploads They show up in the asset list when selecting assets for new entry. How do I remove them completely from the record? Tried manually deleting them via FTP and running "Update Asset Indexes" but that didn't ...
2017/09/19
[ "https://craftcms.stackexchange.com/questions/22044", "https://craftcms.stackexchange.com", "https://craftcms.stackexchange.com/users/7082/" ]
In Craft 2 the only real solution is to delete all the entries from craft\_assetfiles where the sourceId is set to `null`. The reason why there's no clear cache tool for these is because that might allow for deletion of Assets that were just uploaded by someone else who might be about to use them. This is really far...
If you've already deleted the actual files, you can try rebuilding the Asset Index (via Settings -> Update Asset Indexes
31,486,239
I keep getting an out of bounds error whenever i try to run my code. Does anyone know what is wrong with it? I can't seem to figure it out. ``` public class Swapper{ /** This method swaps the first and second half of the given array. @param values an array */ public void swapFirstAndSecondHalf(...
2015/07/17
[ "https://Stackoverflow.com/questions/31486239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5129272/" ]
``` int[] first = new int[values.length/2]; ``` So indexes `[0..values.length/2 - 1]` are valid for `first`. ``` for (int j=values.length/2; j<values.length; j++) { first[j] = values[j]; } ``` So with the first value of `j` being `values.length/2`, it's already out of bounds. You need to practice debugging, p...
You could have used `System.arraycopy()` instead of all the `for` looping. ``` public static void main(String[] args) throws Exception { int[] values = {1, 2, 3, 4, 5}; values = swapFirstAndSecondHalf(values); System.out.println(Arrays.toString(values)); values = new int[]{1, 2, 3, 4, 5, 6}; value...
31,486,239
I keep getting an out of bounds error whenever i try to run my code. Does anyone know what is wrong with it? I can't seem to figure it out. ``` public class Swapper{ /** This method swaps the first and second half of the given array. @param values an array */ public void swapFirstAndSecondHalf(...
2015/07/17
[ "https://Stackoverflow.com/questions/31486239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5129272/" ]
``` int[] first = new int[values.length/2]; ``` So indexes `[0..values.length/2 - 1]` are valid for `first`. ``` for (int j=values.length/2; j<values.length; j++) { first[j] = values[j]; } ``` So with the first value of `j` being `values.length/2`, it's already out of bounds. You need to practice debugging, p...
Allocating new arrays is a waste of space. Just swap the halves in-place: ``` public static void swapFirstAndSecondHalf(int[] values) { final int len = values.length / 2; final int offset = values.length - len; for (int i = 0; i < len; i++) { int temp = values[i]; values[i] = values[offset ...
40,112,335
I want to encode a powershell command (a string `(get-date).date`) to base64 in order to run it via `powershell -encodedcommand xxx`. Using the standard VBS methods (or even <https://www.base64encode.org/>) I get `KGdldC1kYXRlKS5kYXRl` which does not run. Using the following powershell script: ``` $bytes = [System.T...
2016/10/18
[ "https://Stackoverflow.com/questions/40112335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279255/" ]
PowerShell only accepts Base64 encodings of **UTF-16 LE-encoded** strings with its `-EncodedCommand` parameter. UTF-16 LE is what `Unicode` stands for in [`[System.Text.Encoding]::Unicode`](https://msdn.microsoft.com/en-us/library/system.text.encoding.unicode(v=vs.110).aspx), and it encodes the vast majority of U...
I'm not sure this will handle all your needs, but at least it matches the output indicated in your question ```vbs Function ToBase64( ByVal text ) Const adTypeText = 2 Const adTypeBinary = 1 ' Right pad each character with a null With New RegExp .Pattern = "(.)" .Global = True ...
67,242,470
I prepared an android app in android studio then I copied my whole code manually from one sys to another. But after that, getting this error. Below are my both gradle files and screenshot.(Not sure why manisfest file is not shown in android studio, this might be related) Please dont mark copy as I have tried many solut...
2021/04/24
[ "https://Stackoverflow.com/questions/67242470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6396242/" ]
Well, I just was confronted to a similar problem, and actually it's the feedback of Gradle that is really REALLY bad. It's failing because of some invalid declaration inside the "android" block. In your case, it seems that it's only because of the value you assign to `versionName` not being inside (double) quotes as a...
Another possibility is that you might be using properties of some plugin inside android tag, which is not declared as plugin. In my case I was trying to use ``` firebaseCrashlytics { // If you don't need crash reporting for your debug build mappingFileUploadEnabled false } ...
67,242,470
I prepared an android app in android studio then I copied my whole code manually from one sys to another. But after that, getting this error. Below are my both gradle files and screenshot.(Not sure why manisfest file is not shown in android studio, this might be related) Please dont mark copy as I have tried many solut...
2021/04/24
[ "https://Stackoverflow.com/questions/67242470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6396242/" ]
Well, I just was confronted to a similar problem, and actually it's the feedback of Gradle that is really REALLY bad. It's failing because of some invalid declaration inside the "android" block. In your case, it seems that it's only because of the value you assign to `versionName` not being inside (double) quotes as a...
Anything declared in the `android {}` block in your build.gradle could cause this build failure. Additional to what the other answers have mentioned, look for any non-Gradle references. For example, the cause of my build failure were these lines: ``` buildToolsVersion = '30.0.3' installation { installOptions '-d...
67,242,470
I prepared an android app in android studio then I copied my whole code manually from one sys to another. But after that, getting this error. Below are my both gradle files and screenshot.(Not sure why manisfest file is not shown in android studio, this might be related) Please dont mark copy as I have tried many solut...
2021/04/24
[ "https://Stackoverflow.com/questions/67242470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6396242/" ]
Another possibility is that you might be using properties of some plugin inside android tag, which is not declared as plugin. In my case I was trying to use ``` firebaseCrashlytics { // If you don't need crash reporting for your debug build mappingFileUploadEnabled false } ...
Anything declared in the `android {}` block in your build.gradle could cause this build failure. Additional to what the other answers have mentioned, look for any non-Gradle references. For example, the cause of my build failure were these lines: ``` buildToolsVersion = '30.0.3' installation { installOptions '-d...
207,948
> > Problem: Given a singly linked list of integers l and an integer k, remove all elements from list l that have a value equal to k. > > > My solution works, but I suspect it's not smart and optimized because I have many extra variables to solve this question. ### Node.h: ``` #ifndef NODE_H_INCLUDED #define NO...
2018/11/19
[ "https://codereview.stackexchange.com/questions/207948", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/183448/" ]
Thank you for your interest in improving your code! Please, don't be confused about amount of comments. Programming is all about mastering your skills! What's wrong with the code? =========================== You leak memory! ---------------- For each call of `new` there **must be a call** for `delete`. Otherwise obj...
Review ------ 1. ### Using meaningful names Yes, it's your teacher who named the variables, I guess. But I think, if you choose better names (say "list" and "value"), and explain him why you think a name that make sense is better, you're in the right way. 2. ### Adopt const-correctness When value don't change, you s...
12,261,206
My .xml structure may have the following data: ``` <entry id="one-string"> <class>nmWinMultiReports_main</class> <classParams>string</classParams> </entry> <entry id="multiple-elements"> <class>nmJavaScript_main</class> <classParams> <pluginid>mon...
2012/09/04
[ "https://Stackoverflow.com/questions/12261206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/996809/" ]
I made it: ``` <!ELEMENT classParams ( #PCDATA | pluginid | bla | tag )* > ```
You can achieve it by this way as well: ``` <!ELEMENT classParams ANY> ```
12,261,206
My .xml structure may have the following data: ``` <entry id="one-string"> <class>nmWinMultiReports_main</class> <classParams>string</classParams> </entry> <entry id="multiple-elements"> <class>nmJavaScript_main</class> <classParams> <pluginid>mon...
2012/09/04
[ "https://Stackoverflow.com/questions/12261206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/996809/" ]
DTDs cannot enforce the constraint you describe; the easiest way to get something like that constraint is to add a new element (call it `string`) and declare classParams as taking either `string` or the sequence of `pluginid` etc. as children: ``` <!ELEMENT string (#PCDATA) > <!ELEMENT classParams (string ...
You can achieve it by this way as well: ``` <!ELEMENT classParams ANY> ```