Consider the data below.  account     product sales  account1    prod1   10.0 account1    prod1   15.0 account1    prod1   12.0 account1    prod1   5.0 account1    prod1   78.0 account1    prod1   45.0 account1    prod1   34.0 account1    prod1   9.0 account1    prod1   19.0 account1    prod2   12.0 account1    prod2   11.0 account1    prod2   14.4 account1    prod2   6.0 account1    prod2   93.6 account1    prod2   54.0 account1    prod2   25.0 account1    prod2   7.0 account1    prod2   22.8 account2    prod3   23.0   Now i want to iterate through the unique products and want to return the comma separated list of sales for unique products.  I want the output to be like   i.e   Prod1  12.0, 16.0, 45.0, 38.0, 69.0, 42.0, 45.0, 65.0, 28.0, 95.0, 35.0, 25.0  Prod2  12.0, 16.0, 45.0, 38.0, 69.0, 42.0, 45.0, 65.0, 28.0, 95.0, 35.0, 25.0   where this 2nd row is the comma separated list of sales for that product.  What is the best way to achieve this in sql server 2008r2 ?  Should i use cursor ?
I'm trying to migrate a MySQL-based app over to Microsoft SQL Server 2005 (not by choice, but that's life).  In the original app, we used almost entirely ANSI-SQL compliant statements, with one significant exception -- we used MySQL's group_concat function fairly frequently.  group_concat, by the way, does this: given a table of, say, employee names and projects...  SELECT empName, projID FROM project_members;   returns:  ANDY   |  A100 ANDY   |  B391 ANDY   |  X010 TOM    |  A100 TOM    |  A510   ... and here's what you get with group_concat:  SELECT      empName, group_concat(projID SEPARATOR ' / ')  FROM      project_members  GROUP BY      empName;   returns:  ANDY   |  A100 / B391 / X010 TOM    |  A100 / A510   So what I'd like to know is: Is it possible to write, say, a user-defined function in SQL Server which emulates the functionality of group_concat?   I have almost no experience using UDFs, stored procedures, or anything like that, just straight-up SQL, so please err on the side of too much explanation :)
How should I cite a website URL? How do I restore the sources.list file? I accidentally removed my /etc/apt/sources.list file. Is it hosted by Canonical somewhere so I can re-add it to the system? It's a bit of an emergency, so I hope someone can provide a quick answer. Some people love creating or fostering the creation of events that are noisy, chaotic and fun, such as parties, arguments, reunions, etc. Sometimes there's a negative connotation to this (like in provoking an argument), but sometimes there is not (like in organising a big, noisy party).  The word I'm looking for would be the English equivalent to the Spanish armadanzas, just in case this is helpful.  Any ideas? Will I die if I lose enough life to kill me from an effect that also heals me? What happens if I dip below 1 life from an effect that will also heal me after the damage is dealt?  For example:   If I bolt myself while I'm at 3 or less with a  on the board? Will I die while at 3 or less if I -2 , targeting myself? Will I die if a creature with my  on it damages me? Will I die if I target myself with enough damage to 'kill' me with a ?   and so on and so forth. You get the idea. I'm pretty sure there's a relatively simple answer that I just don't know about. More informative flagging history for comments My server is constantly being attacked I am fairly new to the system administration world. I've been working on an application recently and when I check my application server logs, I constantly get various IP addresses trying to ssh into my server by brute force. Here is an example of my server log:   Feb 14 04:07:20 foodwiz3 sshd[1264]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key Feb 14 04:07:21 foodwiz3 sshd[1264]: reverse mapping checking getaddrinfo for coenamor.columbiansabbatical.com [23.249.167.223] failed - POSSIBLE BREAK-IN ATTEMPT! Feb 14 04:07:21 foodwiz3 sshd[1264]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=23.249.167.223  user=root Feb 14 04:07:23 foodwiz3 sshd[1264]: Failed password for root from 23.249.167.223 port 32997 ssh2 Feb 14 04:07:23 foodwiz3 sshd[1264]: Received disconnect from 23.249.167.223: 11: Bye Bye [preauth] Feb 14 04:13:04 foodwiz3 sshd[1289]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key Feb 14 04:13:05 foodwiz3 sshd[1289]: reverse mapping checking getaddrinfo for coenamor.columbiansabbatical.com [23.249.167.223] failed - POSSIBLE BREAK-IN ATTEMPT! Feb 14 04:13:05 foodwiz3 sshd[1289]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=23.249.167.223  user=root Feb 14 04:13:07 foodwiz3 sshd[1289]: Failed password for root from 23.249.167.223 port 41562 ssh2   Is this something that is fairly normal, or should I be worried/doing something about it? Start Bounty has a different colour This may be me being silly, but has the start a bounty text colour changed?  I distinctly remember it being the same colour as the add comment text? How does equality $\mathfrak{m}^\mathfrak{m} = 2^\mathfrak{m}$ in $\sf{ZF}$ relate to the axiom of choice? Usually, the equality $\mathfrak{m}^\mathfrak{m} = 2^\mathfrak{m}$ for infinite cardinal $\mathfrak{m}$ is proved like that: $$ 2^\mathfrak{m} \leqslant \mathfrak{m}^\mathfrak{m} \leqslant (2^\mathfrak{m})^\mathfrak{m} = 2^{\mathfrak{m} \cdot \mathfrak{m}} = 2^\mathfrak{m} $$ The last step relies much on the axiom of choice, because the fact $\mathfrak{m}\cdot\mathfrak{m} = \mathfrak{m}$ does. Moreover,  states that in $\sf{ZF}$ this fact is equivalent to $\sf{AC}$.  Note, by a cardinal I mean an equipollence class of an arbitrary set, not necessarily admitting a well-ordering.  That has motivated my question: what can we say about relationship of the initial equality and the axiom of choice in pure $\sf{ZF}$?    To avoid question about definition of cardinals without $\sf{AC}$, we may consider the following statement instead:     For any infinite set $X$ exists a bijection $\; F \, \colon X^X \rightarrow 2^X$   where $X^X$ is the set of all functions from $X$ to $X$, $\; 2^X = \mathcal P(X)$ is the power set, and an infinite set is such that cannot be bijectively mapped onto a finite ordinal. Keyboard language keeps changing in Windows 10 So I recently did a clean install of Windows 10 English. I configured it to have English UI language but Norwegian keyboard. I have several problems with that setup:   The keyboard language keeps switching to English constantly I can't see the language bar nor the language toggle popup when I swap:     I have bound the Norwegian keyboard layout to Shift+Alt+0 and that works, but it's annoying to have to do that every 5 minutes. Also I find it weird that I can't see the language bar neither on the desktop nor on the toolbar.  Anyone have any idea of what might be wrong?  Here are some screenshots of my settings:          P.S. The only time I see the language toggle popup is actually when I'm logged out in the lock screen and press Win+Space. Nothing happens if I do that after being logged in. More than a decade ago, I read a short story about a small group of people at the end of the world. The story was premised on some sort of mass-produced device which took ambient heat and turned it into power. The devices had been overused, and now the world was freezing.   I think the people were essentially bandits; the main character may have been a woman who lured men to her house and killed them for their body heat? There was also a strong implication that one person she had done this to was an alien who had come to warn that the devices were destroying the world.  I think the story was in a hardbound collection, and I think the collection was from the late 70's or very early 80's.  (Calling it a "short story" is just meant to distinguish it from a full novel — it may have actually been a novella or similar.) Ok, so I'm such a newbie to Ubuntu and I bought a Windows 8 pre-installed laptop last month.  I updated to Windows 8.1 and then I thought about installing Ubuntu as a dual boot so I could mess around and learn more about it.   So I followed a Youtube tutorial (  ) and I got my stuff working fine.   The first few times I booted I got the GRUB menu instead of my default HP Boot OS Manager, and I was able to select my OS.   So I went to sleep and the next day I turned on my computer and the GRUB menu did not show up. I tried several times and it didn't automatically show up.  In order for me to see the GRUB menu I had to turn on my PC and on start had to press ESC to pause startup and press F9 to get boot options. Then from there I had to pick from OS Boot, Ubuntu, Ubuntu (Yes there were two Ubuntus available) and a default EFI file thingy.   When I click the first Ubuntu I get the GRUB Menu (I was too scared to try the second in case I screwed my laptop up) and I can safely load Ubuntu from there and use it (although I do have to increase my brightness every time I load Ubuntu because it somehow reduces my brightness to complete darkness on boot)  So my problem here is why isn't my GRUB showing on boot, after it worked on the first day?   My laptop is a HP TouchSmart j-078CA.  EDIT 1: FYI I just switched to Ubuntu LiveCD to check my Installation and found out that one of my partition is flagged as msftres. Here is a screenshot of my GParted on a LiveCD: Why is the space between words in my source code listing so big? I used the following code to list my java code, but the it looks like there's too much space between words. What can I do?  % source code listing \usepackage{listings} \usepackage{color} \usepackage{xcolor}  \usepackage{caption}  % citation style \usepackage{apacite} \DeclareCaptionFont{white}{\color{white}} \DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}  \begin{document} \begin{lstlisting}[label=some-code,caption=bind to service call] bindService(new Intent(this, Recognizer.class), recConnection, Context.BIND_AUTO_CREATE); \end{lstlisting} \end{document}   The snapshot of what I got. The code not completely shown, and space too wide, in function bindService. What is the safest, quick way to defrost chicken? Microwave? Running water over it? How to determine if string contains specific substring within the first X characters I want to check whether Value1 below contains "abc" within the first X characters. How would you check this with an if statement?  var Value1 = "ddabcgghh";  if (Value1.Contains("abc")) {     found = true; }   It could be within the first 3, 4 or 5 characters. A better answer was posted long after accepting another. Should I accept the new one? Correct spelling of Polish surname Dziubenofska? My Polish grandmothers last name was Dziubenofska, but I know that's not how it is spelt! I'm looking for the proper spelling.   Can you help find it for me?  She came over to Ellis Island and they changed it on her to dziuk. This is only a prefix to the full name. I recently bought a new laptop with following configuration   CPU: Intel i5 2450 RAM: 8 GB DDR3 GPU: NVIDIA GeForce GTX 520 1GB   I've setup a virtual machine using VirtualBox with Windows 7 as guest. I want to use my (host's) graphics card in it but the virtual machine is only showing 128 MB of video memory.  I am using Bumblebee and start the virtual machine using   $ optirun VBoxManage startvm "Windows 7"   Please suggest me how should I use my graphics card for 3D acceleration in virtual machine. Elsarticle - Abstract two columns wide I am currently trying to create an article in elsarticle style, twocolumn. The title and text end up in two columns, the abstract however is made two columns wide. Any ideas what I am doing wrong? Obviously I want my abstract to also be only in the first column.  \documentclass[a4paper,10pt,twocolumn,preprint]{elsarticle}  \usepackage{lipsum}  \journal{TexExchange}   \begin{document}     \begin{frontmatter}       \title{Two-column abstract}       \begin{abstract}         \lipsum[1]      \end{abstract}       \begin{keyword}        abstract      \end{keyword}    \end{frontmatter}   \section{Outline}    \lipsum[2-3]  \end{document} Is there a way to export large multi-layered Illustrator file to Photoshop?  When I export with preserve layers and text edit-ability, the complex layers are flattened. I've reorganized my layers to have simple groupings but that's time consuming.  Is there a more effective way of doing this? Or script to automate it? Origins of Tension First of all, I have a confusion about the definition and idea of Tension. For example, in my Physics Textbook, the idea of tension is written like this: &quot;Let's say there is a wire with a cross-section area of A and its length is $L_o$. If I hang the wire from a point and hang a weight of W on the other end of the wire, it will generate a repulsive force of T. This T is called the Tension Force.&quot; For me, this only explains to me what force will we call tension force, but it doesn't quite explain to me what is exactly this Tension force or where it originates from. Also, I have been doing pulley problems (Figuring out the acceleration of weights hanging from pulleys)  by first labeling all of the tension forces by $T_1$, $T_2$, and then doing some math with them to get my answer. But It bugs me that I am using these tension force values without even knowing where they came from or what they are. My idea was, maybe Tension force comes from the intermolecular bonds between the molecules of the rope, rubber or wire, etc. But even then, I have some different situational questions. For example:  Why you can't push a rope, copper wire against a wall?  What happens when I pull on two ends of a wire with 2 different forces?  Does the force increase proportionally to the applied force? Why does the wire break after a certain amount of force is exceeded.?  Does the idea of tension apply to everyday objects,(for example, a coffee mug, glass pane, etc). If it does, can I use something like a heat map or 3D equation to describe the tension in every point of the object? [Edit: more concisely, is there a mathematical way to show the various amounts of tension forces on a 2D (like a metal sheet) and 3D objects (like a football ) instead of a 1D object(like a string)].  If I take a metallic object like a paperclip or a thin wire. I can bend It multiple times and it eventually breaks into two pieces. I used to do this to pull of capacitors from old circuit boards. But does it happen with things like ropes or paper? If not, why it doesn't happen? ( Maybe it has something to do with intermolecular forces and the various internal stresses?)  Let's say I have an iron bar and I have thrown it out into space. Does that iron bar have equal stress distribution or still uneven or will the stress on all points become zero? (Is there even such thing as zero stress?)