I have table with the following structure:  id | sender_mail | recipient_mail | username | subject | message | created 1    aa@test.com    bb@test.com        aaa       xxxx     yyy       10 2    bb@test.com    aa@test.com        bbb       xxxx     yyy       11 3    cc@test.com    bb@test.com        ccc       xxxx     yyy       12 4    bb@test.com    cc@test.com        bbb       xxxx     yyy       13 5    dd@test.com    gg@test.com        ddd       xxxx     yyy       14 6    gg@test.com    bb@test.com        ggg       xxxx     yyy       15   What I want is to get all unique pairs between columns sender_mail and recipient_mail where one of those columns has a value of email I'm passing in to the query. For example, if i put in bb@test.com as argument, the desired output should be:  id | sender_mail | recipient_mail | username | subject | message | created 2    bb@test.com    aa@test.com        bbb       xxxx     yyy       11 4    bb@test.com    cc@test.com        bbb       xxxx     yyy       13 6    gg@test.com    bb@test.com        ggg       xxxx     yyy       15   I tried out this SQL query:  SELECT * FROM messages AS m WHERE     m.sender_mail = 'bb@test.com' OR     m.recipient_mail = 'bb@test.com'  GROUP BY m.sender_mail, m.recipient_mail   It seemed to work when I passed the query to database directly (sequel pro). But when I put this code in a Drupal controller, an error gets thrown out:     Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]:    Syntax error or access violation: 1055 'drupal.m.username' isn't in   GROUP BY:  SELECT m.sender_mail, m.recipient_mail, m. username,   m.subject, m.message, m.created   After googling, I found out that Drupal 8 enforces ONLY_FULL_GROUP_BY for SQL.  What is the workaround for this? How do I need to alter my query?
In my custom Drupal 8 plug-in I perform such query:  $select = db_select('my_table', 'e'); $select-&gt;addField('e', 'field1');  $select-&gt;condition('field3', 'NULL', '!='); $select-&gt;condition('field4', array(11, 12, 31, 32, 33), 'IN');  $select-&gt;groupBy("e.field1"); $select-&gt;orderBy("e.field1"); $select-&gt;orderBy("e.field5"); $entries = $select-&gt;execute()-&gt;fetchAll(\PDO::FETCH_ASSOC);    And it works fine. It returns me all records grouped by field1 that meets the condition, orderered. But it returns only field1 column.  I wanted to get more columns, so I have added another $select-&gt;addField('e', 'field2'); just after first one:  $select = db_select('my_table', 'e'); $select-&gt;addField('e', 'field1'); $select-&gt;addField('e', 'field2');  $select-&gt;condition('field3', 'NULL', '!='); $select-&gt;condition('field4', array(11, 12, 31, 32, 33), 'IN');  $select-&gt;groupBy("e.field1"); $select-&gt;orderBy("e.field1"); $select-&gt;orderBy("e.field5"); $entries = $select-&gt;execute()-&gt;fetchAll(\PDO::FETCH_ASSOC);    This time I get error:     Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]: Syntax error or access violation: 1055 Użyto 'my_database.e.field2' bez umieszczenia w group by:   Which means "my_database.e.field2 has been used without putting in into group by". But I don't want to group by every column I select.  Unfortunatelly Drupal 8 added ONLY_FULL_GROUP_BY :( Then, how can I use groupBy and select more then one column at the same time?
passing values between forms (winforms) I am running k-fold cross validation on my training data, and then choosing the best set of hyper parameters, re-training on the training data and testing on a new (unseen) testing data. I am getting the following testing results (results on the unseen data):  R^2: 1.000 Adj R^2: 1.000 RMSE: 0.081 MSE: 0.007 MAE: 0.045 MAPE: 0.058   Can $R^2$ have a value of 1.00 but RMSE have a  value of 0.081? Doesn't an $R^2$ of value 1 indicate no errors at all? Why can't we see the selected reasons when there are pending close votes for a question? When users vote to close a question, the original poster can't see the selected reason why until after the question is already closed.  If they could see this information, they might be able to edit the question to make it more acceptable and averting the need to close it.  For example, the owner of this  cannot see the reason why his question is being voted to close: How to preserve detail when downscaling scanned photos? I'm mixing analog with digital photography — I tend to take better photos when I can't look at a small digital screen, unconsciously forcing me to take the picture before I shoot instead of checking afterwards if it succeeded. I also like the grain film gives me.  However, most shots aren't worth spending much time in the darkroom, and scanning them is a lot faster. I'm wondering how best to convert the film to digital.  Scanning at lower than maximum (non-interpolated) resolution of my image scanner tends to exaggerate the contrast of the grain and screw up the mid-tones because of that.1 On the other hand, the resulting size of the scans are major overkill in most cases (I don't print them at A0 size), so I want to downscale the pictures. However, the grain confuses most methods and results in loss of detail and/or loss of the characteristic grain. For example, bicubic sharper tends to result in a "bigger" grain than the original. Now, the best compromise I've found so far is simply using bilinear interpolation, but I doubt that this is the best method to preserve both overall details and the look of the grain.  In short: when processing the scanned negative, how do I "best" preserve both image quality and the characteristic look of the grain?   As Stan Rogers pointed out below, there's a difference between truly scanning the grain of the film, and scanning the "grainy" character of film at lower resolutions. This question is about the latter; Stan Rogers explains how to do the first.  I'm looking for alternatives to the standard Photoshop options to try out, and reasons for each. Is the fact that every film has a different grain characteristic a problem? Are customized advanced noise reduction methods perhaps an option?  1. I'm using a Minolta DiMAGE Scan Elite 5400, using the software provided by Minolta.  As requested, here is a scanned picture with different resize methods. Just scanned this, scanning a B&amp;W negative to get better tonality range. I turned off grain dissolver, automatic dust and scratch removal, etc, for obvious reasons. On the right the pictures are upscaled again with Nearest Neighbor. I set the 8 bit scan to 16 bits before downscaling, assuming it reduces risks of banding if I choose to mess with curves, channel mixers, etc. No other modifications (usually I first retouch dust &amp; scratches, and in the end channel mix the picture to B&amp;W, then switch to 8 bits again). How can I port forward with iptables? I want connections coming in on ppp0 on port 8001 to be routed to 192.168.1.200 on eth0 on port 8080.  I've got these two rules  -A PREROUTING  -p tcp -m tcp --dport 8001 -j DNAT --to-destination 192.168.1.200:8080  -A FORWARD -m state -p tcp -d 192.168.1.200 --dport 8080 --state NEW,ESTABLISHED,RELATED -j ACCEPT   and it doesn't work. What am I missing? I got a brand new Windows 7 machine, installed the operating system, created one account and forgot its password. What can I do?  There is no external CD, the operating system is loaded from somewhere inside the machine.  I already tried to remember passwords and tried all candidates with all possible combinations of caps lock, num lock etc. Find the first occurrence/starting index of the sub-array in C# Can you give me an example of a function which is sequentially continuous but not continuous? (I know that in first-countable spaces this is equivalent, but what about in spaces without this condition?)  Thank you :) So i was solving exercises in propositional logic lately and stumbled upon a puzzle, that goes like this:     Each inhabitant of a remote village always tells the truth or always lies. A villager will only give a "Yes" or a "No" response to a question a tourist asks. Suppose you are a tourist visiting this area and come to a fork in the road.    One branch leads to the ruins you want to visit; the other branch leads deep into the jungle. A villager is standing at the fork in the road. What one question can you ask the villager to determine which branch to take?    I intuitively guessed the answer is "If I asked you this path leads to the ruins, would you say yes?". So my questions are:   What is the name and/or source of this logical riddle? How can i corroborate my answer with mathematical rigor? How to change file encoding in NetBeans? Copy files from Network Mapped Drive I am trying to copy a file over from a mapped drive on a network to the current computer through a batch file.   I've already attempted the following below and still no results. The plan is to run a batch file to copy a file from a network drive down to the local C:\ drive.   @echo off copy H:\Videos\TargetVideo\TargetVideo.mp4 C:\Video\ locating latitude-longitude point in a piste-map with matrix transforms I am trying to plot points of a particular latitude longitude on this image of a Swiss mountainous landscape.    What I am doing is I have some 54 known location-points plotted on this image (not visible in the linked image), which is a piste map, and is therefore an artist's impression of the landscape. I found out the latitude-longitudes and also height above sea level for these 54 known points. I opened my piste map in the GIMP, and plotted the 54 points, while at the same time reading their co-ordinates in points, in the piste-map. So, I have x-y coordinates (lat-long) and z coordinate (height above sea level) for all those 54 points (so its a 3d co-ordinate system that I have), and I also have X-Y coordinates of those places in my piste-map (a 2d co-ordinate system), and I assume a Z=1 for all those points.   To locate a particular lat-long on my piste-map(I have the coordinates for this place, i.e. the lat-long but not elevation), I need to calculate their X-Y on the piste-map. My approach is, that I calculate distances between this point which is to be located and those 54 known points , and then I sort them in ascending order. The first two points in this order will be the nearest points to the one which we want to locate. Now, I find my 3rd known point, and for that, I loop over the rest of the points, to get the nearest possible point such that this point forms a triangle with the first two closest points with the point which is to be located falling inside the formed triangle. Now, I have three known points forming a triangle say triangle ABC. For these known points, I have a triangle A'B'C' in the piste map, and the point to be located lies in the latter. I figure out the transform matrix which when multiplied with the 3X3 matrix of the three known points(in this 3X3 matrix, each row corresponds to a point, with the column values x,y and z in the 3d scape) results in a 3X3 matrix of those points in the piste-map. I multiply this transform matrix calculated with a new 3X3 matrix for three points, the first one being the point to be located, and the remaining two are the last two known points in the first 3X3 matrix. This way, the first two elements of my resulting matrix are the X and Y values for the point to be located, and I proceed ahead to draw the point on the piste-map. Is this approach correct with respect to the way I am using the transform matrix? Thanks! I would really appreciate if any alternative approaches are suggested as well! Why isn't Derivative equal to NeumannValue? Where does Google Chrome automatically save pages? Often in my papers I want to mention theorems in the introduction that are introduced in more detail and proved in a later section.  I'd like to include the statement of these theorems twice over, each time numbered as the theorem would naturally appear in its later section.  My current solution (using amsthm) is, e.g.  %(in the introduction) \newtheorem*{thm:associativity}{Theorem \ref{thm:associativity}} \begin{thm:associativity} Lorem ipsum ... \end{thm:associativity}  %(in a later section) \begin{thm} \label{thm:associativity} Lorem ipsum ... \end{thm}      Can anyone think of a cleaner solution? proof that function is constant I'm annoyed by quite a simple problem in calculus (I apologize in advance if I'm not using adequate terms in English, I don't take the course in English nor am I a native speaker):  Let $f:\mathbb R\longrightarrow \mathbb R$ be a function which is continuous at $0$ and satisfies $f(x)=f(2x)\,\forall x\in\mathbb R$.  My question is how do I formally prove that for every $x&lt;0$ $f(x)=c_1$, and for every $x&gt;0$ $f(x)=c_2$, where $c_1,c_2\in \mathbb R$? After proving those two statements (or at least one of them WLOG) it would be quite easy to prove that $f(0)=c_1=c_2$ by the definition of continuity of $f(0)$ and thus $f(x)$ is constant. Those two statements are just so obvious to see that I can't think of any formal way of proving so without "cheating". Thanks in advance! Change ViewPager animation duration when sliding programmatically Counter example for $(A \times B) \cap (C \times D) = (A \cap C ) \times (B \cap D)$ Usage and origin of "sister" in expressions like "sister company, sister ship, sister site" etc The term  is often  used figuratively  to refer, for instance,  to a “sister company” for a company  within the same group, or to a “sister  site” for  sites that belong to the same family. This connotation as explained by the   means:         belonging to a pair or group of similar and related things, such as businesses, usually owned or operated by the same person or organization:         our sister company in Australia.          also, from :        You can use sister to describe something that is of the same type or is connected in some way to another thing you have mentioned.    ⇒ ...the International Monetary Fund and its sister organisation, the World Bank.   ⇒ ...Voyager 2 and its sister ship, Voyager 1.       This usage appears to be common with things that are  regarded as feminine and are associated, as if by kinship,  with other similar things that belong to the same group. An early  usage example of this is the "sister" referred to  ships:         the US battleship Missouri and her sister ship, the Wisconsin.      In other instances,  the "feminine" issue is less explicit as in the case of internet sites, so I guess this usage has to do with the fact that English is less gender specific when it comes to things or abstract entities.   Questions:    Does “sister” apply to whatever entity that belongs to the same group irrespective of its real or perceived gender? or could "brother" be used instead?  Where does this usage come from? OSX (Yosemite) Make 2 sided printing the default for *all* applications I'd like to make double-sided printing the default for all applications.  This  tells how to set it for one application, but by experimentation it only affects that application, not others.  I Googled, looked in the system prefs, looked on this site - no luck.  Is there a setting somewhere?