I want to get the "mean" value of all Orders from my sharepoint list.  How do i do this?  This is my code so far:  function VisaLista() {     namn = document.getElementById("txtNamn");     var camlQuery = new SP.CamlQuery();     camlQuery.set_viewXml(     "&lt;View&gt;" +     "&lt;Query&gt;" +     "&lt;Where&gt;" +     "&lt;And&gt;" +     "&lt;Eq&gt;&lt;FieldRef Name='Title'/&gt;&lt;Value Type='Text'&gt;" + namn + "&lt;/Value&gt;&lt;/Eq&gt;" +     "&lt;Or&gt;" +     "&lt;Eq&gt;&lt;FieldRef Name='Prioritet'/&gt;&lt;Value Type='Text'&gt;Hög&lt;/Value&gt;&lt;/Eq&gt;" +     "&lt;Eq&gt;&lt;FieldRef Name='Status'/&gt;&lt;Value Type='Text'&gt;Startad&lt;/Value&gt;&lt;/Eq&gt;" +     "&lt;/Or&gt;" +     "&lt;/And&gt;" +     "&lt;/Where&gt;" +     "&lt;/Query&gt;" +     "&lt;/View&gt;");     listItems1 = list.getItems(camlQuery);     clientContext.load(listItems1);     clientContext.executeQueryAsync(OnSuccessVisa, OnFail); } function OnSuccessVisa() {     var listEnumerator = listItems1.getEnumerator();      while (listEnumerator.moveNext()) {         var currentItem = listEnumerator.get_current();         $("#Kategori1").text(currentItem.get_item('_x0072_zb6'));      } }
So I'm getting my listItems with a Camlquery, but i want to calculate the avg of the "price" rows  This is the code I've used so far:  function VisaLista() {     namn = document.getElementById("txtNamn");     var camlQuery = new SP.CamlQuery();     camlQuery.set_viewXml(     "&lt;Where&gt;" +     "&lt;And&gt;" +     "&lt;Eq&gt;&lt;FieldRef Name='Title'/&gt;&lt;Value Type='Text'&gt;" + namn + "&lt;/Value&gt;&lt;/Eq&gt;" +     "&lt;Or&gt;" +     "&lt;Eq&gt;&lt;FieldRef Name='Prioritet'/&gt;&lt;Value Type='Text'&gt;Hög&lt;/Value&gt;&lt;/Eq&gt;" +     "&lt;Eq&gt;&lt;FieldRef Name='Status'/&gt;&lt;Value Type='Text'&gt;Startad&lt;/Value&gt;&lt;/Eq&gt;" +     "&lt;/Or&gt;" +     "&lt;/And&gt;" +     "&lt;/Where&gt;");     listItems1 = list.getItems(camlQuery);     clientContext.load(listItems1);     clientContext.executeQueryAsync(OnSuccessVisa, OnFail); } function OnSuccessVisa() {     var listEnumerator = listItems1.getEnumerator();     var elmt = 0;     while (listEnumerator.moveNext()) {         var currentItem = listEnumerator.get_current();         elmt = (currentItem.get_item('_x0072_zb6'));          var sum = 0;         for (var i = 0; i &lt; elmt.length; i++) {             sum += parseInt(elmt[i], 10);         }          var avg = sum / elmt.length;          document.write("The sum of all the elements is: " + sum + " The average is: " + avg);     }     $("#Kategori1").text = "Medelvärdet för dessa ordrar: " + avg }   I am getting following error     "Cannot get the value length of null - at elmt, line 43
make tail -f exit on a broken pipe I want to watch a file until a bit of text appears  I found this answer:   but when I tried it on ubuntu, it doesn't exit:  $ echo one &gt; test.txt $ echo two &gt;&gt; test.txt $ echo three &gt;&gt; test.txt $ echo four &gt;&gt; test.txt $ cat test.txt | sed '/w/ q' one two $   works as expected.  however when I try to tail the file  $ tail -f test.txt | sed '/w/ q' one two   it never exits.  tail does not stop even though the pipe is broken.  Does anybody know how to make tail exit when sed exits? How to check a particular directory is mounted on the Linux machine. For instance there is a folder named test, I want to check if it is mounted or not. How to get client's IP address using JavaScript? Equation of a rectangle I need to graph a rectangle on the Cartesian coordinate system. Is there an equation for a rectangle? I can't find it anywhere. Can anyone tell me if I should use inspire or inspires in this phrase?     An extraordinary leader whose vision, values, integrity and boundless curiosity inspires all who follow in his footsteps. Concatenating two std::vectors Disabling submit-button until the user has completed the form How do you think about disabling the submit-button until the user has completed the form or the required fields?   I find similar questions here on ux.se and somebody answered that the user will think that the form is broken or not immediately realize whats going on.  I think hiding is not that good but a disabling (e.g. grayscale, opacity, ...) plus a short text in the button would improve usability because the user realise that he still has to fill out something.  Is there anybody with experience or examples besides the usual error-messages/validation after submitting? How to express a polar coordinate for a macro that only accepts space-separated values? \psElectricfield only accepts a coordinate in space-separated values as follows. For example, a charge of -0.1 unit at (-1,0) is written as [-0.1 -1 0]. I have attempted to write in PS notation but it still does not work.  \documentclass{article} \pagestyle{empty}  \usepackage{pst-electricfield,multido} \def\M{2}  \begin{document} \multido{\i=0+30}{12}{% \begin{pspicture*}(-\M,-\M)(\M,\M)     \psElectricfield     [         Q={[-0.1 -1 0][-0.1 1 0][0.1 !\i sin 2 mul \i cos 2 mul]}     ] \end{pspicture*}\newpage} \end{document}   How to express  a polar coordinate for a macro that only accepts space-separated values? Is there a way to get a background in CSS to stretch or scale to fill its container? Local html file AJAX Call and jQuery Woes Unity-like Dashboard for Gnome fallback? Is there any way I can run the Unity dashboard (or something similar, like Bolt for Gnome 3) in Gnome Fallback? I read a collection of Sci-Fi short stories back in the 1970's or early 80's that had one about a couple in love who kept losing each other. The book was my dad's so the story itself could be much older than that. I am very fuzzy on the details as I was young when I read it and it was so long ago. I believe the woman/girlfriend was "taken" (by some bad guy aliens??) while she was sleeping. I think it involved time travel and the man had to search through time to find her. After he found her, when he was asleep one time, he somehow was then "taken" and I think transported through time and had to fight his way back to her again. He may have been some sort of police officer. I just remember in the end, at night when they went to bed, the couple always wore handcuffs so they were never separated when they went to sleep ever again. Does this ring a bell with anyone?  (There is a possibility it is in a short story collection that also contained " The Twonky " by Lewis Padgett (1942), as I remember reading that story around the same time) Can a single molecule have a temperature? Empty Disk when trying to install dual-boot system I recently purchased an SSD to speed up my computer experience. Before, I had Windows 7 and Ubuntu in a dual-boot system. The plan was to install Windows 8 on the SSD and then set aside ~30GB for the system files of Ubuntu.  I installed Windows 8 just fine on the SSD, then I booted the Ubuntu install CD to make my partitions like always - but GParted tells me the entire SSD is unallocated. Now I am afraid I will lose my Windows installation if I try to do anything to it.  Why does GParted think there is no partition on the SSD? Shouldn't it be 4 Partitions, like the Windows installer told me?  And is it possible to ignore this and install Ubuntu on the hard disk (where it, frankly, already is) and somehow make it possible to install GRUB on the SSD to revert my dual-boot system without damaging the installed Win8? (Originally  by AJAY.)  What is the geometric, physical, or other meaning of the third derivative of a function at a point?  If you have interesting things to say about the meaning of the first and second derivatives, please do so. What does different focal length offer me? Truncate (not round) decimal places in SQL Server Say for a game with irregular hotspots (say Risk, or a strategy game like Paradox's Hearts of Iron or Crusader Kings), how do you   Define a non-rectangular hotspot of irregular shape (much like a territory on a map?), in code? What tool can you use to trace out the hotspot and import into your game? What is the algorithm for detecting if someone has clicked within such a hotspot? How do I remove the limit on PC keyboard button presses? Whenever I play a PC game with the directional keys, I can only press two buttons at a time.  For instance if I am playing a shooter like R-Type, I cannot hold down the fire button while moving diagonally at the same time.  The computer simply ignores the extra button press.  How do I remove this limit so I can shoot while moving diagonally?  This limitation seems to apply for every game.  I am running Windows 7 if it makes any difference.  I noticed the same problem back when I used Windows XP. I’ve had a good look and can’t seem to find out how to select all elements matching certain classes in one jQuery selector statement such as this:  $('.myClass', '.myOtherClass').removeClass('theclass');   Any ideas on how to achieve this? The only other option is to do  $('.myClass').removeClass('theclass'); $('.myOtherClass').removeClass('theclass');   But I’m doing this with quite a few classes, so it requires much code.