Consider the following object:  var obj = {   name: "pete",   funct : function () { console.log("I am", this); } }   When binding obj.funct to an event handler, this looses its reference to the object, it now refers to the global object (window).  so, this does not work properly:  $(window).bind("keypress", obj.funct);   How can I archieve that this still points to my object when it is called by an event handler?

I have created a 'control' using jQuery and used jQuery.extend to assist in making it as OO as possible.  During the initialisation of my control I wire up various click events like so  jQuery('#available input',              this.controlDiv).bind('click', this, this.availableCategoryClick);   Notice that I am pasing 'this' as the data argument in the bind method. I do this so that I can get at data attached to the control instance rather from the element that fires the click event.   This works perfectly, however i suspect there is a better way  Having used Prototype in the past, I remember a bind syntax that allowed you to control what the value of 'this' was in the event.  What is the jQuery way?


Question: Find the sum of the series:   $$\cos^3 \alpha +\cos^3 {3\alpha} + \cos^3 {5\alpha}+\ldots+\cos^3 {(2n-1)\alpha}$$   The book from which this question was taken says that the answer is $$\dfrac{3\sin{n\alpha}\cos{n\alpha}}{4\sin\alpha}+\dfrac{\sin{3n\alpha}\cos{3n\alpha}}{4\sin{3\alpha}}.$$  My attempt to solve this question: $$\text{Let S be the trigonometric series,}$$ $$\cos {3\theta} = 4\cos^3\theta-3\cos\theta \implies 4\cos^3 \theta=\cos{3\theta}+3\cos\theta$$ Applying formula on $\cos^3\theta$, $$4S = 3\cos\alpha + \cos3\alpha +3\cos3\alpha + \cos9\alpha+\ldots+3\cos{(2n-1)\alpha}+\cos{(6n-3)\alpha}$$ $$4S= 3(\cos \alpha + \cos 3\alpha+\cos5\alpha+\ldots)+(\cos3\alpha + \cos9\alpha+\ldots)$$ Applying the summation of cosine formula, $$4S= 3\frac{\sin{n\alpha}}{\sin\alpha}\cdot\cos{(\alpha+(n-1)\alpha)}+?$$  So my problem is I don't know how to apply the formula for the second series (denoted by '?') for a fixed number of terms $n$ or should I treat it as a general and separate series.  To clarify my doubt again, what I am asking is that would the $(2n-1)$ affect the formula for the second series (denoted by '?').  My working here looks most probably correct but if there is any mistake please correct it.

Question: Find the sum of the series:   $$\cos^3 \alpha +\cos^3 {3\alpha} + \cos^3 {5\alpha}+....+\cos^3 {(2n-1)\alpha}$$   The book from which this question was taken says that the answer is $\frac{3\sin{n\alpha}\cos{n\alpha}}{4\sin\alpha}+\frac{\sin{3n\alpha}\cos{3n\alpha}}{4\sin{3\alpha}}$.  My attempt to solve this question: $$\text{Let S be the trigonometric series,}$$ $$\cos {3\theta} = 4\cos^3\theta-3\cos\theta \implies 4\cos^3 \theta=\cos{3\theta}+3\cos\theta$$ Applying formula on $\cos^3\theta$,.. $$4S = 3\cos\alpha + \cos3\alpha +3\cos3\alpha + \cos9\alpha+...+3\cos{(2n-1)\alpha}+\cos{(6n-3)\alpha}$$ $$4S= 3(\cos \alpha + \cos 3\alpha+\cos5\alpha+...)+(\cos3\alpha + \cos9\alpha+..)$$ Applying the summation of cosine formula, $$4S= 3\frac{\sin{n\alpha}}{\sin\alpha}\cdot\cos{(\alpha+(n-1)\alpha)}+?$$  So my problem is I don't know how to apply the formula for the second series (denoted by '?') for a fixed number of terms $n$ or should I treat it as a general and separate series.  To clarify my doubt again, what I am asking is that would the $(2n-1)$ affect the formula for the second series (denoted by '?').  My working here looks most probably correct but if there is any mistake please correct it.


I'm trying to use jQuery to select and copy the text inside the h2 element when i double click the h2 element. (this is with no jQuery involved at all, just the default selecting in browers)  The issue i'm running into is that when i double click it selects less then what i want it to select. when i click 3 times it just selects the whole page.   This is my first post so I don't really know what code I should provide. And I don't have any jQuery written for this yet.  html:
Owl PvP

play.owlpvp.net

shop

forums

staff

Server

What is the best way to copy text to the clipboard (multi-browser)? I have tried: function copyToClipboard(text) {     if (window.clipboardData) { // Internet Explorer         window.clipboardData.setData("Text", text);     } else {         unsafeWindow.netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");         const clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);         clipboardHelper.copyString(text);     } }  But in Internet Explorer it gives a syntax error. In Firefox, it says unsafeWindow is not defined. A nice trick without using :


Is there an option how to remove or disable scroll listener after reaching certain point on page? I'm not interested in load browser by listener when I don't need it anymore.   In my case a want to someway stop this whole particular function below after calls loadMore(load_btn);  The function:  $(window).scroll(function(){     var load_btn = $('.js-load-more.auto-load:not(.loading)');     var scroll = $(window).scrollTop();     var height = $(window).height();     var btn_top = $(load_btn).offset().top;     var launch_pos = btn_top - (height - (height*0.1));      if (scroll > launch_pos) {         $(load_btn).removeClass('auto-load');         loadMore(load_btn);     } });

I have an input type="image". This acts like the cell notes in Microsoft Excel. If someone enters a number into the text box that this input-image is paired with, I setup an event handler for the input-image. Then when the user clicks the image, they get a little popup to add some notes to the data.  My problem is that when a user enters a zero into the text box, I need to disable the input-image's event handler. I have tried the following, but to no avail.  $('#myimage').click(function { return false; });


I deleted a few hundred files using del /S.  My backup failed, and I need to recover as many of these as possible - preferably without taking the hard drive out and using another machine.  The directory the files were in still exists.

I have already had the same problem before. On that occasion, I found a program that could scan my entire hard drive for string pieces so I could recover it. Unfortunately I don't remember the name of the program. It had to access the hard drive data directly, normal searches won't get any data from the hard drive before formatting.


I want to use find but sort the results reverse chronologically as with ls -ltr. Is this possible through any combo of flags or pipelines?

I want to solve the problem 'list the top 10 most recent files in the current directory over 20MB'.  With ls I can do:  ls -Shal |head   to get top 10 largest files, and:  ls -halt |head   to get top 10 most recent files  With find I can do:  find . -size +20M   To list all files over 20MB in the current directory (and subdirectories, which I don't want).  Is there any way to list the top ten most recent files over a certain size, preferably using ls?


I am completely new to Ubuntu and I must say AskUbuntu and you folks are of great help. So now when I have started installing and playing with apps, my question is what is the best place to install/download apps? Like in Windows it usually goes under your C: drive and then you manage it under Program Files. Linux structure is quite different with a different folder hierarchy. I have attached the directory structure of my machine as well. I thought this question would help lot of beginners.

Occasionally I install applications manually, rather than using apt or another package manager.   What location (/usr/, /usr/local/, /opt/, /home/, etc.) is suggested by "best practices" for the installation of user applications?


Let $V$ be the linear space of all real functions continuous on $[a, b]$. If $f\in V, g=T(f)$ means that $$g(x)=\int_a^b f(t)\sin(x-t)\,dt\hspace{1 cm} for\ a\le x\le b$$  Then, the nullity and rank of such a transformation?  Attempt: Let $g(x)=0 \implies g(x)$ is the constant function $0 $.  $\implies 0 = \int_a^b f(t)\sin(x-t)\,dt$  Could anyone please tell me how to move forward from here?  Thank you very much for your help in this regard.

Let $V$ be the linear space of all real functions continuous on $[a, b]$. If $f\in V, g=T(f)$ means that $$g(x)=\int_a^b f(t)\sin(x-t)\,dt\hspace{1 cm} for\ a\le x\le b$$  We can see this as a linear transformation $T: V\to V$ the linearity of which is easy to show.$\\$ Now how do you compute the nullity and rank of this transformation?  I'm rather new to linear algebra so I'd appreciate it if you include lots of detail and explanation in your answer. Thank you in advance.  P.S: the final answer is infinite nullity and 2nd rank (according to the back of the book).  From calculus II by Tom M. Apostol - page 36


Usually we can use the upwards arrow key to get the previous command. But that does not always work, it can happen that you get the ASCII sequence instead ("^[[A...") but I also wonder if there was this functionality at older keyboards which did not have the arrow key, how did it work in those days?  Is or was there another way?

I know I can use Up to iterate through previous commands. Running the last command simply involves Up + Enter. However, I was thinking of buying the  as I spend a lot of time in vim.  This keyboard has no arrow keys, and the only way I know how to get this kind of behaviour is by pressing Ctrl + R and beginning to repeat my previous command.  Is there an easy way to emulate Up + Enter in an UNIX terminal without the arrow keys?


I used to use "Gadwin print screen" on Windows where I could just press a shortcut and a predefined screen area would get saved to a folder (no questions asked), which is very helpful while doing lengthy online courses .  I have switched to Ubuntu and I need an alternative. I have installed Shutter and managed to create a shortcut that can trigger the "selection" tool and auto save the picture, but the problem is I need to re-position the predefined selection area (which is positioned on lower right of screen by default), and shutter doesn't remember the previous position, which is time consuming in my usage scenario where hundreds of screen shots are taken.

I am running Lubuntu desktop 12 and I am looking for a tool that can take screenshots of a certain area from the command line.   I have tried out Shutter. It works but, when I run the command  it generates warnings ( Wnck-WARNING **: Unhandled action type). I think the tool might be designed to run under GNOME and might not be compatible with Lubuntu. The screenshot is taken successfully, but the command hangs, which is something I cannot work with.  So what is a good screenshot tool that    Runs from the command line Can capture a certain area of the desktop     I like to add that scrot, the tool Lubuntu ships with, does not have the option to crop certain coordinates, but only an interactively user-defined area which is not what I'm looking for.


Is there a place where the different updates to StackExchange are documented?   I've found some annoucements in the blog and in different posts but I don't want to miss something important and so a condensed timeline or a log that has it all in the same place without too much chit-chat would be amazing. Iterations like adding chatrooms, badges, privileges, etc.

This is an unofficial list/changelog of new features and various changes to Stack Overflow and the Stack Exchange network.  It is maintained by the community, while a Stack Exchange employee changes the accepted answer to ensure that the latest changes remain on top (given default user settings).  To see the list in reverse chronological order (latest entry on top), .  For those adding new features here: please post only feature changes that affect the whole network and have some global impact. i.e. bug fixes don't belong here, nor do mobile app updates.


I have a <s:file> tag inside the form which generates a HTML <input type="file">. When I submit the form via form submission (e.g. submit button, etc.) everything works fine in the action method. However, when I change my code to:  $.ajax({     url: "actionClass!actionMethodA.action",     type: "POST",     error: function(XMLHttpRequest, textStatus, errorThrown) {                 alert('Error ' + textStatus);                 alert(errorThrown);                 alert(XMLHttpRequest.responseText);             },     data: $(form).serialize(),     success: function(data) {                 ...             } });   In the backend, the file field is always null.  The file field is defined in  the action class as follow (with setter and getter):  private File impFileUrl;   Is it because now the form is serialized so that the file field can no longer be set properly in the backend?

I would like to upload a file asynchronously with jQuery.     $(document).ready(function () {     $("#uploadbutton").click(function () {         var filename = $("#file").val();          $.ajax({             type: "POST",             url: "addFile.do",             enctype: 'multipart/form-data',             data: {                 file: filename             },             success: function () {                 alert("Data Uploaded: ");             }         });     }); });  File <input type="file" id="file" name="file" size="10"/> <input id="uploadbutton" type="button" value="Upload"/>     Instead of the file being uploaded, I am only getting the filename. What can I do to fix this problem?


I am building an Eldritch Knight fighter/War wizard multiclass character for D&D 5e. The eldritch knight has a limited pool of spells known, but does not have to prepare them; the wizard, on the other hand, needs to prepare his spells each day.  Are the spells known from the Eldritch Knight part of my character and can be cast without preparing them? Or am I now stuck preparing spells like a normal wizard?  For example, as a level 3 Eldritch Knight I know 3 spells, and I do not have to prepare them to cast them. Then I take a level of wizard; as a 1st-level wizard, you get a spellbook containing 6 spells, and can only prepare a number of spells to be cast from this book equal to Int modifier + wizard level.  For example, if my character has an Intelligence score of 14, he could prepare 3 spells as a wizard, but he already knows 3 other spells from being an Eldritch Knight that don't need to be prepared to be cast, at least as far as I understand the rules.  Is my character now limited to preparing spells only, or does he keep his Eldritch Knight spells as always being able to be cast?

I'm making level 5 character, Rogue 3 (Arcane Trickster) Wiz 2 (Conjuration).  I can't find anything in the handbook explaining how (if?) the Arcane Trickster needs to prepare his spells in any way.  The way I read it, I would end up with my Wiz-3-worth of 'prepared spells', and then all of my Arcane Trickster spells would just be 'always prepared'. Is this correct?


This  morning my bro told me “I will tell a joke” but my sister said “I will crack a joke.”   I am confused. which one is right or why?

Cracking jokes is to me the most familiar contextual usage of this term.  Why would anyone say they were cracking jokes, not just telling jokes?


I'm stuck at the Steel Mill in Joker's Funland trying to beat the Joker, inmates and Titans.  I can't figure out how to beat the Titans.  I'm playing the Xbox 360. How do I beat them?

In Batman: Arkham City, there are big brutes that are fought, and the biggest of them all are Titans who've become big because of the TITAN formula. To attack them, one must stun them with three stuns in a row (ultra-stun) or hitting them with an explosion from explosive gel before striking them in a sort of beatdown. It takes multiple repetitions of this to finish them off with the final strike activating a sort of cinematic. They can only be struck a certain amount of times before they rampage and must be re-stunned to be successfully hit again.   How many strikes does it take to take down a Titan? How many repetitions (of stun then strikes) does it take to take down a Titan?


I was asked to evaluate the indefinite integral $\int \frac{dx}{2 + \sin x}$. I got the result as  $$ \int \frac{dx}{2 + \sin x } = \frac{2}{\sqrt{3}} \arctan \bigg( \frac{2\tan(\frac{x}{2}) + 1}{\sqrt{3}} \bigg) + C $$ $f(x) = 2 + \sin x$ is continuous for all $x \in \mathbb{R}$, though its anti-derivative is discontinuous at $x = (2k + 1) \pi$ and thus non differentiable at $x = (2k + 1)\pi$ for $k \in \mathbb{Z}$. Does this mean the indefinite integral is invalid at $x = \pi$ and its multiples?

I use tangent half-angle substitution to calculate this indefinite integral: $$ \int \frac{1}{2+\sin x}\,dx = \frac{2}{\sqrt{3}}\tan^{-1}\frac{2\tan \frac{x}{2}+1}{\sqrt{3}}+\text{constant}. $$  Wolfram Alpha also give the same answer. However, $\frac{2}{\sqrt{3}}\tan^{-1}\frac{2\tan \frac{x}{2}+1}{\sqrt{3}}$ is discontinuous on $(n+1)\pi$ where $n$ is any integer. Why is an anti-derivative of a continuous function discontinuous?


I will be travelling soon to the US from Jakarta. I have both US and Indonesian passports. Indonesia does not recognize dual citizenship, yet the US requires me to enter and exit the US with my US passport. My flight have 4 hour stop at Taipei, so can I exit the immigration and enter using Indonesia passport while in Taipei? then enter Indonesia using Indonesian passport?

I am a citizen of two different countries, and have two passports.  How should I use my passports when traveling?


Let $A,B\in \mathbb{R}^{n\times n}$. $\exists a_{i,j},b_{k,l} \not = 0$.$$A \times B = O$$ ($O$-zero matrix). Prove $$rgA + rgB \le n$$ My attempt: as rows of matrix $AB$ are linear combinations of rows $B$, so we have $$a_{i1}B_{1}+ \ldots +a_{in}B_{n}= \theta, i=\overline{1,n},$$ $B_1, \ldots ,B_n$ - rows of matrix $B$. As $A$ is non-zero matrix there is $B_s$, which is linear combination of other rows of $B$, hence system $B_1, \ldots ,B_n$ is linearly dependent, so $rgB < n$. And I got stuck. Is there a way to imrove that estimate?

Let $A,B\in M_n(\mathbb{R})$ such that $AB=0$. Prove that   $$\mathrm{rank}(A)+\mathrm{rank}(B)\leq n.$$   From the given information, I only know that $\mathrm{rank}(AB)=0$.


Classically, an electron can be in any orbit around the nucleus of an atom. Then what determines the typical atomic size? When we talk about atomic size it can be anything from some finite value to infinity as the electrons can be excited to any value in accordance with the conservation of angular momentum?

For example, would it be possible to excite a hydrogen atom so that it's the size of a tennis ball? I'm thinking the electron would break free at some point, or it just gets practically harder to keep the electron at higher states as it gets more unstable. What about in theoretical sense?  What I know is that the atomic radius is related to the principal quantum number $n$. There seems to be no upper limit as to what $n$ could be (?), which is what led me to this question.


Let's say I have a variable and I want to print 5 significant digits after I multiplied it by 1000. zsh can do it:  zsh$ x=2.8026407e+00 zsh$ printf "%.5g\n" "$(( 1000*${x} ))" zsh> 2802.6   Can bash do it as well?  bash$ x=2.8026407e+00 bash$ printf "%.5g\n" "$(( 1000*${x} ))" bash> bash: 1000*2.8026407e+00 : syntax error: invalid arithmetic operator (error token is ".8026407e+00 ")   I think there is no way to make native bash understand floating point operations, is there? I know I can use e.g. awk, but I was wondering if bash could do this at all or not.  (I'm not surprised that bash cannot handle floats, but that zsh can!)

Using echo "20+5" literally produces the text "20+5".  What command can I use to get the numeric sum, 25 in this case?  Also, what's the easiest way to do it just using bash for floating point? For example, echo $((3224/3807.0)) prints 0 :(.  I am looking for answers using either the basic command shell ('command line') itself or through using languages that are available from the command line.


Could you tell me if there is any difference in meaning or usage between "four week from today" and "in four weeks"? For example:     What are you guys doing four weeks from today?      What are you guys doing in four weeks?   I cannot see any difference between the two. If there is any, could you tell me which one is more common?

I have seen some examples about using "in" with time expressions. They give some examples as shown below:     I will leave for vacation in a month. (Exactly one month from now I   will go on vacation.)      We’ll be there in an hour.  (Exactly one hour will go by and then we   will arrive.)   But these comments confused me. Then I looked the usage of "in" up in a dictionary and it says about usage of "in" with time expressions :"before or at the end of a particular period". I think the comments and the definition in the dictionary contradict each other?    I have examples of mine:     1- Dinner will be ready in ten minutes. (Maybe dinner will be   ready at the 5th minute? or 8th. Does it strictly mean dinner will be   ready at the end of the ten minutes?)      2- My letter arrived in two days. ( Does that mean it took   exactly two days to arrive? or Could it be just one day because he/she   doesnt remember the exact time?)      3- Imagine you are on the first day of a month and your friend says:   I will be going outside the country in this month. (Does that mean he/she could go tomorrow or ten days later or at the end of the   month?)      4- He can run a mile in 5 minutes. ( Does that mean he has to   spent entire 5 minutes to run a mile? Could it be 4 or 4.5 minutes?)


I am new to java. I am trying it use sequential search and binary search. I can load the array successfully, but my searches error out. I do not see what i am doing wrong. Are both of my methods having any issues?  package stu.paston.program6;  import java.io.FileInputStream; import java.io.IOException; import java.util.Scanner; import java.util.InputMismatchException;  public class InventoryData  {   private int[] invData = new int[200]; private int count = 0;  InventoryData(){}//Constructor  public void loadArray() {     double partNum;     double price;   try {     String filename = "inventoryPricing.dat";     Scanner infile = new Scanner (new FileInputStream(filename));      while (infile.hasNextInt())     {         invData[count] = infile.nextInt();         partNum = infile.nextDouble();         price = infile.nextDouble();          ++count;     }     infile.close();   }   catch (IOException ex)     {     count = -1;     ex.printStackTrace();     }   }  public int seqSearch(int[] invData, int value) { for (int i : invData) { if (i==value) {     return i; } } return -1; }    public int binSearch(int[] invData, int value, int first, int last) {  if (first > last)      return  -1;  int middle = (first + last) / 2;  if (invData[middle] == value)     return middle;  else if (invData[middle] > value)     return binSearch(invData, value, first, middle-1);  else     return binSearch(invData, value, middle+1, first); }  public int getCount() { return count; }   public int getOneDataNum(int index) { if (index >=0 && index < count)     return invData[index]; else      return -1; }    }// End InventoryData    package stu.paston.program6;  import java.util.Scanner;  public class MainClass  {  public static void main(String[] args)  {     InventoryData productData = new InventoryData();     Scanner myScanner = new Scanner(System.in);     int index;      productData.loadArray();      System.out.println("What is the part number you are looking for ->");      index= myScanner.nextInt();      if (productData.seqSearch(null, index)>=0)         System.out.printf("Sequential fount part number #d and the price is                                         %d", index, productData.seqSearch(null, index));     else          System.out.printf("Sequential did not find part number %d", index);     if (productData.binSearch(null, index, index, index)<=0)                                                                System.out.printf("\nBinary fount part number #d and the price is %d",   index, productData.binSearch(null, index, index, index));     else         System.out.printf("\nBinary did not find part number %d", index);     myScanner.close();   }   }

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


I'm confused by this sentence:  One of my best friends band is playing tonight.  What is it that happens here, is the possessive marker completely dropped? From what I understand:  I can't add an 's since "one of" refers to the group of friends I can't add s' (friends') since the band is only one person's band.

Possible Duplicate:          What is the correct way of these two sentences?   The queen of England's crown The queen's of England crown   Strictly linguistically, sentence 2 should be the correct one, since the crown belongs to the queen and not to England but it sounds really awkward to pronounce.


Let X1, X2 be a random sample of size 2, drawn from the standard Cauchy distribution. How can you prove that the sample mean is also Cauchy distributed? I know how to do it by using the characteristic function, but we are asked to do it by using the following integral identity: $1/\pi * \int_{-\infty}^{\infty} arctan(2x - y) / (1 + y^2) dy = arctan(x)$ I know that $f(x)= 1/(\pi (1 + y^2))$ and $F(x) = arctan(x)/\pi + 0.5$. From there on I’m really stuck. Any help would be greatly appreciated, thank you in advance! A follow up question is proof by induction that the sample mean of a random sample of size n also has a (standard) Cauchy distribution. The first step of the induction proof is showing that it's true for, for example, n=2. I don't know how to continue from there on.

Is there any method to show that the sum of two independent Cauchy random variables is Cauchy? I know that it can be derived using Characteristic Functions, but the point is, I have not yet learnt Characteristic Functions. I do not know anything about Complex Analysis, Residue Theorem, etc.   I would want to prove the statement only using Real Calculus. Feel free to use Double Integrals if you please.   On searching, I found . However, I was wondering if I could get some help directly on the convolution formula:  $$f_Z(z)=\int_{-\infty}^\infty f_X(x)f_Y(z-x)\,dx=\int_{-\infty}^\infty\frac{1}{\pi^2}.\frac{1}{1+x^2}.\frac{1}{1+(z-x)^2}dx\tag{1}$$  Here I have supposed that $X,Y$ are Independent Standard Cauchy. But I think the general formula can be derived easily after some substitutions. I need some help on how to proceed from $(1)$.  EDIT: Just as what the hint in the hyperlink said, I got the answer using that hint. However, I am not quite sure that the hint is algebraically correct. Maybe there has been some typing mistake in the book.


Is it appropriate to ? To me, it seems to be somewhat at odds with the goal of SO.

I've just seen a user profile page which contains the following text:     Donations are welcome via Paypal. Paypal account is the same as my email address.   There's no context to suggest this has anything to do with supporting the user's favourite cause - it's a direct request for money.  Is this acceptable?


I downloaded Pokébank and I was able to transfer Pokémon from X to Sun but I can't transfer Pokémon from Sun to X. How do I trade from Sun back to X?

Title says it all, I don't see confirmation in  and a cursory google search seemed to say assume no and speculate about the pokemon bank.


I am looking for a cron replacement which could run subsecond schedule, is there have any "still alive" project which serve this purpose?  Currently running Ubuntu 14

Question  I'd like to be able to run a UNIX command precisely every second over a long time period.  I need a solution, which does not lag behind after a certain time, because of the time the command itself needs for execution. sleep, watch, and a certain python script all failed me in this regard.  On the microcontroller's such as the  I'd do that through hardware clock interrupts. I'd like to know whether there is a similar time-precise shell script solution. All the solutions which I found within StackExchange.com, resulted in a noticeable time lag, if run over hours. See details below.  Practical purpose / application  I want to test whether my network connection is continuously up by sending timestamps via nc (netcat) every 1 second.  Sender:  precise-timestamp-generator | tee netcat-sender.txt | nc $receiver $port   Receiver:  nc -l -p $port > netcat-receiver.txt   After completion, compare the two logs:  diff netcat-sender.txt netcat-receiver.txt   The diffs would be the untransmitted timestamps. From this I would know at what time my LAN / WAN / ISP makes troubles.     Solution SLEEP  while [ true ]; do date "+%Y-%m-%d %H:%M:%S" ; sleep 1; done | tee timelog-sleep.txt   Gets a certain offset over time, as the command within the loop also takes a little time.  Precision  cat timelog-sleep.txt  2012-07-16 00:45:16 [...] 2012-07-16 10:20:36   Seconds elapsed: 34520  wc -l timelog-sleep.txt   Lines in file: 34243  Precision summarized:   34520-34243 = 277 timing problems 34520/34243 = 1.008 = 0.8 % off   Solution REPEAT PYTHON  Found at:   repeat.py 1 "date '+%Y-%m-%d %H:%M:%S'" >> timelog-repeat-py.txt   Supposed to avoid the time offset, but fails to do so.  Precision  wc -l timelog-repeat-py.txt  2012-07-16 13:42:44 [...] 2012-07-16 16:45:24   Seconds elapsed: 10960  wc -l timelog-repeat-py.txt   Lines in file: 10859  Precision summarized:   10960-10859 = 101 timing problems 10960/10859 = 1.009 = 0.9 % off   Solution WATCH  watch -n 1 "date '+%Y-%m-%d %H:%M:%S' >> ~/Desktop/timelog-watch.txt"   Precision  wc -l timelog-watch.txt 2012-07-16 11:04:08 [...] 2012-07-16 13:25:47   Seconds elapsed: 8499  wc -l timelog-watch.txt   Lines in file: 8366  Precision summarized:   8499-8366 = 133 timing problems. 8499/8366 = 1.016 = 1.6 % off.


I have Been watching hollywood movies since 2005 but never saw a film where actor dance in beautiful garden and make love.whereas in Indian cinema most film earn from there music.Why there is no concept of music in between scenes in Hollywood. Does this has something to decrease movie length and in indian cinema Mostly Movies always have a title track.

Unlike Hollywood movies, Bollywood movies are quite different, because they're usually mixed with masala i.e dance, song and love sequences. This is the case in most films which are released in various languages in India.  Can someone explain, Why do Bollywood movies have song and dance sequences?


I have a WPF and winform application both in C#. I invoke wpf app from winform app by using   ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = @"C:\wpfapp.exe"; startInfo.Arguments = data; //string result data from webservice; Process.Start(startInfo);   This is ok and i am able to run the wpf ui from winform with the parameters that has been sent as arguments. But now i have a problem. now i want to update the message in the running wpf window.  Already the wpf window is run and showing the message. Later i want to send another message to that same wpf window. how we can achieve that ?  if (ProgramIsRunning(exepath)) {     // here we need to add the code to send message to the same wpf window. } else {     ProcessStartInfo startInfo = new ProcessStartInfo();     startInfo.FileName = @"C:\wpfapp.exe";     startInfo.Arguments = data; // string result data from webservice;     Process.Start(startInfo); }   Please help.

I want to create a communication between a parent and a child process, both written in C#. It should be asynchronous, event-driven. I don't want to run a thread in every process to handle the very rare communication. What is the best solution for it?


So after installing ubuntu 18.04, it asked me to update(don't know exactly what). Of course, I restarted the computer and began updating. However, as of now about 3 hours have already passed and I'm stuck with the ubuntu logo and the five orange - and white dots trading places.  Can I view how the update progresses or should I just restart?  Edit: Restarting apparently fixed the problem, don't know what or why happened as I made sure to check the box to have all updates installed at the start.

I am trying to boot Ubuntu on my computer.  When I boot Ubuntu, it boots to a black screen.  How can I fix this? Table of Contents:


I am getting a NullPointerException running my java code.  Both lines in this method are getting the error:      public void draw(Graphics g){     g.drawImage(bg, 0, 0, 50, 0, null);     g.drawImage(a.getImage(), 0, 0, 50, 0, null); }   bg is declared like so:   bg = new ImageIcon("D:\\Eclipse\\Workspace\\Game\\src\\GameTest1\\back.png").getImage();   a is this:   private Animations a;   code:  package GameTest1;  import java.awt.Image; import java.util.ArrayList;  public class Animations {      private ArrayList scenes;     private int sceneIndex;     private long movieTime;     private long totalTime;      //CONSTRUCTOR     public Animations(){         scenes = new ArrayList();         totalTime = 0;         start();     }     //adds screen to array list and adds time to things     public synchronized void addScene(Image i, long t){          totalTime += t;         scenes.add(new OneScene(i, totalTime) );     }     //start animation from beginning     public synchronized void start(){         movieTime = 0;         sceneIndex = 0;     }     //change scenes     public synchronized void update(long timePassed){         if(scenes.size() > 1){             movieTime += timePassed;             if(movieTime >= totalTime){                 movieTime = 0;                 sceneIndex = 0;             }             while(movieTime > getScene(sceneIndex).endTime){                 sceneIndex++;             }         }     }     //get current scene(image)     public synchronized Image getImage(){         if(scenes.size() == 0){             return null;         }else{             return getScene(sceneIndex).pic;         }     }     //get scene     private OneScene getScene(int x){         return (OneScene)scenes.get(x);     }     /////////////PRIVATE CLASSCEPTION///////////////     private class OneScene{     Image pic;     long endTime;      public OneScene(Image pic, long endTime){         this.pic = pic;         this.endTime = endTime;     }  } }   I know what a nullPointerException is, so please do not link me to a post describing what one is. My problem is I can't see what is causing the error.

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


I am new to ArcGIS and not familiar with it. I want to interpolate heights in a DEM file using ArcGIS? Is it possible? Actually, I want to write a C# code that will read the height from DEM file for given coordinates, and if the height is missing then I will perform interpolation and return the height.  I want to use ArcGIS interpolation algorithms instead of writing my own.

Does ArcGIS API provide interpolation functions, like if I want to interpolate from my own set of values?    I know that ArcGIS provides functions for interpolation like IDW, Spline and Kriging etc, but can I use those functions to interpolate against my own dataset?


I made a rough model of a 4-legged animal. I did it using a mirror modifier to mirror the left and right sides of the animal. In object mode, I right clicked on my animal and chose "Shade Smooth". Results: Wireframe mode:  Solid mode:  Why is there a discoloration in the center of the animal? Rendered mode:  So there is discoloration in solid mode because there is a ridge and depression in that area... But what is the cause of the ridge and depression? According to my wireframe, there is no depression in that area. The render is wrong. The head is supposed to be smooth.

While rendering a mesh with smooth shading on, I get a dark region/shadow on certain faces. The effect is more evident when smooth shading is applied to a mesh containing ngons, with the ngons turning black when rendered.   The blackening effect is visible in the viewport too.  How can I solve this problem?


Why is the plural of 'nemesis' "nemeses" and not 'nemesii'?  and how does one pronounce "nemeses" different from "nemesis"?

Looking at the , it indicates that the plural is either bases or baseis.  It looks like the rare  comes from the Greek, but the common  just refers back to basis and that does not explain the plural etymology.  Is there a standard rule at work here, or is this just an exceptional case that arose over time by convention?


I have added nginx ppa with the following command on my digital ocean VPS ubuntu 20.04 sudo add-apt-repository ppa:nginx/stable But my apt update fails with the following message.  root@graceful-tundra:~# sudo add-apt-repository ppa:nginx/stable This PPA contains the latest Stable Release version of the nginx web server software. Only Non-End-of-Life Ubuntu Releases are supported in this PPA Development releases of Ubuntu are not officially supported by this PPA, and uploads for those will not be available until Beta releases for those versions  More info:  Press [ENTER] to continue or Ctrl-c to cancel adding it. Get:1  focal-security InRelease [107 kB] Get:2  focal InRelease [265 kB] Hit:3  main InRelease Hit:4  focal-updates InRelease Hit:5  focal-backports InRelease Ign:6  focal InRelease Err:7  focal Release   404 Not Found [IP: 91.189.95.83 80] Reading package lists... Done E: The repository 'http://ppa.launchpad.net/nginx/stable/ubuntu focal Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.  What does this mean? The nginx ppa have no 20.04 compatible version?

When updating, I get the following error message:   W: The repository 'http://ppa.launchpad.net/mc3man/trusty-media/ubuntu xenial Release' does not have a Release file.   Here, I find another statement on this error:   This recommends removing certain PPAs; and, I'm not sure if I should do that since it might mean not getting the updates that I need.    Is this what I should do?


The spell negative energy flood says:  "You send ribbons of negative energy at one creature you can see within range. Unless the target is undead, it must make a Constitution saving throw, taking 5d12 necrotic damage on a failed save, or half as much damage on a successful one. A target killed by this damage rises up as a zombie at the start of your next turn. The zombie pursues whatever creature it can see that is closest to it. Statistics for the zombie are in the Monster Manual. If you target an undead with this spell, the target doesn’t make a saving throw. Instead, roll 5d12. The target gains half the total as temporary hit points"  It does not specify the creature must be humanoid nor the size of the creature. However, it implies the new zombie's stats must be in the MM. Can a tarrasque be animated by this spell's effect?

The spell  (XGtE pg. 163) states:  A target killed by this damage rises up as a zombie at the start of your next turn.  And also,  Statistics for the  are in the Monster Manual.  This seems to imply that the creature killed rises as a zombie with exactly the statistics stated in the Monster Manual. If I kill a gargantuan (or anything larger than medium) creature with Negative Energy Flood, does it rise as a medium sized zombie?


I have submitted a paper to IEEE transactions on knowledge and data engineering (TKDE). Until now, it has been 7 months and the status of my paper is still "Under Review". It has stayed in the same status from the first day of the submission. I have sent an email to the admin of the journal, and she replied to me that the paper was being processed. I have waited more than 1 month without any update.   Has anyone experienced the same situation? What should I do? Many thanks.

I submitted a paper to a journal, and I suspect that it is handled too slowly.   How can I decide whether my suspicion is correct? What handling times should I expect? Given some expected handling times, when should I act? How much leeway should I give? How should I act? Whom should I contact and what should I (roughly) write?   Note that I am interested on how I should approach this situation in general, and do not seek specific numbers for my specific situation. I am therefore looking for general answers that are independent of such factors as the field or individual journal (but mention them if they are relevant factors).  This is a canonical question on this topic as per . Due to its nature, it is rather broad and not exemplary for a regular question on this site. Please feel free to improve this question.


When I try to run gnuplot I get the following error.  sean@DESKTOP-EGDC4UU:/mnt/c/Users/Seang/Desktop/Microgen_CFD/OpenFOAM/SST$ gnuplot          G N U P L O T         Version 5.0 patchlevel 3    last modified 2016-02-21          Copyright (C) 1986-1993, 1998, 2004, 2007-2016         Thomas Williams, Colin Kelley and many others          gnuplot home:     http://www.gnuplot.info         faq, bugs, etc:   type "help FAQ"         immediate help:   type "help"  (plot window: hit 'h')  Terminal type set to 'qt' gnuplot> plot x,sin(x) QXcbConnection: Could not connect to display Could not connect to existing gnuplot_qt. Starting a new one. QXcbConnection: Could not connect to display  Warning: slow font initialization gnuplot>

I searched around, and currently there are two methods suggested; installing an enhancement for Windows Subsystem for Linux and installing an XServer.  I want to know which method is the most hassle-free (easy to install AND to use), and which one is less memory-heavy.  I just want Synaptic and CMake. Why couldn't that be a builtin feature?


Decades ago I read a book in which the plot revolved around a horribly addictive drug in an alien civilization. I think the drug was used by a ruling conglomerate to control citizens. Once they were hooked it was a lifetime addiction, and the conglomerate was the only place the drug could be obtained. The plot twist showed the drug the aliens were hooked on were Earth cigarettes smuggled off planet by alien drug smugglers.  Does anyone know the book and author?

A few years back, I found a book in the library. It was in the English section so I presume it was never translated into Serbian, which is my mother language. I also remember it had colorful covers and it looked so beat down and so old that it has to be from at least '70 or '80.  As for the plot I remember the following:   It was from an alien perspective The main protagonist was an alien cop in search of drugs The setting was on a human planet (I presume Earth, but I could be wrong since I don't remember whether the humans had colonized more planets) I think the main protagonist had friends on said planet    Edit: I remembered two more things    Drug is something we use every day, possibly coffee, sugar or tobacco  Alien is annoyed how cold planet is


e.g,  foo1 foo2 foo10 foo100   rather than  foo1 foo10 foo100 foo2   Update: not interested in coding the sort myself (although that's interesting in its own right), but having the database to do the sort for me.


I'd like to know if there is anything for this in English which is roughly:      Shoot many arrows, one will fit.    I am from India and we have an idiom dedicated to it in Hindi but I, literally, searched the whole internet but failed to get anything similar in English. It can meaningfully be said as:      Try every option available, one will surely succeed.    Do you have any magical idiom/proverb or magic word for it that Google is trying to hide from me?

I made up an idiom that I think describes what I want to say quite nicely:     "If one shoots enough arrows at the target, one is sure to hit the bull's eye."   An actual English idiom I know of that is close in meaning is:     "Throw enough mud at the wall and some of it will stick"   However, the conceptual image is not as matching, and according to  it has a second meaning:     If enough (perhaps false or reckless) accusations are made against someone, his reputation will suffer, whether or not this is deserved.   But I want the idiom to paint a positive image. For example, I would say the idiom when I help someone remember something by giving it a shot in the dark and getting it right miraculously after some guesses.  What is the English idiom I'm looking for?


In chapter 5 of Eloquent Javascript () there is an example that I'm having a hard time wrapping my head around.     function greaterThan(n) {   return m => m > n; } let greaterThan10 = greaterThan(10); console.log(greaterThan10(11)); // → true     I get the initial call of the function and assigning n to 10. It's when it's called a second time I don't understand how 11 would get passed to the variable m (wouldn't the parameter still be n? I almost want to think it would overwrite 10 with 11).   When I do alert(greaterThan10) it shows m => m > n which I was also confused as to why it wouldn't show n as 10.

How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?  I have seen  given on Wikipedia, but unfortunately it did not help.


I just wrote an answer to a question and it was automatically converted to a comment for being 'trivial'. What are the criteria of a trivial answer?  The answer was posted here but has since been edited to exclude a link.  I'd prefer if the answer to this question was not specific to what happened to me, but rather to explain in general what might be considered a trivial answer.

I posted an answer (pointing to another question already asked) but when I hit submit, I saw my answer appear as a comment to the question instead.   I tried it a couple of times and still the same result. The answer gets eaten up and is transformed into a comment.   Is this a bug?


I have researched a little on  (LQG), but all I got were very ambiguous explanations about loops and nodes that all end with mathematical equations.  If someone could give me a non-mathematical, clear idea of LQG, I would really appreciate it.

Of course, assuming your grandmother is not a theoretical physicist.  I'd like to hear the basics concepts that make LQG tick and the way it relates to the GR. I heard about spin-networks where one assigns Lie groups representations to the edges and intertwining operators to the nodes of the graph but at the moment I have no idea why this concept should be useful (except for a possible similarity with gauge theories and Wilson loops; but I guess this is purely accidental). I also heard that this spin-graph can evolve by means of a spin-foam which, I guess, should be a generalization of a graph to the simplicial complexes but that's where my knowledge ends.  I have also read the  but I don't find it very enlightening. It gives some motivation for quantizing gravity and lists some problems of LQG but (unless I am blind) it never says what LQG actually is.  So, my questions:        Try to give a simple description of fundamentals of Loop Quantum Gravity.   Give some basic results of the theory. Not necessary physical, I just want to know what are implications of the fundamentals I ask for in 1.   Why is this theory interesting physically? In particular, what does it tell us about General Relativity (both about the way it is quantized and the way it is recovered from LQG).


I currently have a computer equipped with a quad core Intel Core i5 430M / 2.26 GHz.   I noticed that the clock speed of the CPU to be higher than most of the i7 Haswell processors which are about 2GHz.   Are the newer processors better performance-wise than the older processors? If so, why and how are newer processors with slower clock speeds better than older CPUs with a faster clock speed?

Why, for example, would a 2.66 GHz dual-core Core i5 be faster than a 2.66 GHz Core 2 Duo, which is also dual-core?  Is this because of newer instructions that can process information in fewer clock cycles? What other architectural changes are involved?     This question comes up often and the answers are usually the same. This post is meant to provide a definitive, canonical answer for this question. Feel free to edit the answers to add additional details.


Of course Darth Vader seems to embrace the Light Side just before his death, but he also began his training on the Light Side under Qui-Gonn and Obi-Wan. Kylo Ren also admits to "struggling" with the Light Side, but he was      trained by Luke Skywalker.   So we see that some Jedi go over to the Dark Side (Count Dooku is an example where there is no apparent "regret"). Are there any examples of Force users who begin with the Dark Side but embrace the Light Side? If not, why do all the defections seem to go one way?

I have heard of a ton of Jedi who have turned to the Dark Side and became a Sith (Exar Kun, Darth Malak). I've even heard of a few Jedi who have turned to the Dark Side and then found their way back to the Light (Revan, Anakin, Qel-Droma). But I cannot seem to recall any Sith who turned to the Light Side. I think I might have read of one, but I cannot remember the name or story.  Are there any Sith who have turned to the Light? Hell, have there even been any Sith that have turned to the Light Side and then returned to the shadows of the Dark Side?


I want to disable suspend because my VPS goes into suspend and I cannot access it.  How I can do that?

I am getting a web server setup at home on an older AMD 2400+ desktop. I have Ubuntu 11.04 installed and running however, after a time, I can no longer browse to the server. When I go to the keyboard and press a key, everything magically works again.   I have looked through the BIOS and I am not seeing any power saving features enabled. Is there anything like that in Ubuntu? Can it be disabled?  I don't have any GUI installed. This is console only.


I've tried a couple different kinds of basic bread recipes (both active dry and instant yeast) and no matter how closely to the letter I follow the recipe, I can't seem to get the dough to rise in the time suggested in the recipe. It takes so much longer and I fear the longer rise time makes changes the taste of the bread (and serves as an I convenience to my timing, though I guess that's slightly less important). I'm starting to wonder if my room temperature might be slowing down the rise time? My house this time of year is usually mid to high 70's and I will try to put the dough in sunlight if it's shining that day.   Any thoughts on what I'm doing wrong and how I can help my dough rise quicker?  Edit: Ok, after attempting the suggestions in the answer below, I still cannot get my bread to rise. This is an oatmeal sandwich loaf which I was able to get a great 1st rise (doubled in bulk after 2 hours sitting in the sun), but the second is taking longer. After 2 hours, this is the best I got:      Not to mention that I suck at kneading because I can never get the dough smooth. These both have visible folds on the top which will inevitably burn in the oven... When I leave the dough for the 1st rise, I spray the top with oil to hold in the moisture and cover with a lint-free linen. But when I split the dough and press the gases out, the top is always a bit dried out and slightly hardened. This makes forming it into loaves difficult and leaves this fold on top. I am told that handling it too much after the first rise is not good and will make the 2nd rise take that much longer. Maybe I'm wrong a out that?   Warm equipment, super warm day today (80+ degrees and super sunny), I did use sugar and butter and allowed for a longer rise. This recipe called for 1tbs instant yeast and I even threw in an extra 1/4tbs for good measure. I made sure the salt and yeast were not mixed in together. But I just can't seem to make my breads light and fluffy. They are always small and dense. What gives? I'm so frustrated :(

While making some focaccia this afternoon, my wife said, "sure the house is 'warm'; it'll be fine." One hour later, no rising. It may be worth noting that our house is 66F. So we stuck it in a warm oven and it rose just fine. It turned out fine, I'm just glad we weren't trying to get it done for a meal.   So the question is, how warm does dough need to be to rise properly?


Stack Exchange network sites are extremely successful, and they have obviously a huge future.  We all know the story of Google Adsense and how much frankly they pay publishers. Google Adsense shows ads automatically from the content and keywords of the page, no coding required, they will pay monthly.  Stack Exchange sites can make literally millions of dollars monthly from small, non-disturbing Adsense ads, why don't they show them?

Some time ago, we announced that . This has gone well and we're extremely thankful to everyone for their support and feedback. Because it has been successful so far, we're going to be extending the program to the majority of our graduated sites. Well, we've pretty much already done that, but there are quite a few sites that have ads enabled, yet still display nothing. The thing is, we don't really have an abundance of clients offering products that a  would find relevant, but Amazon has stand mixers, a selection of super fine chinois, deliciously sharp cutlery and enough cast iron to fill the Gulf Of Mexico with . Beginning as early as this week (week of 5 February 2018), our ad team is going to be hand selecting affiliate ads to be displayed on select sites. The use of inventory will of course depend on the availability of relevant ads to display which means:  Some sites might see very few, if any ads. Some topics simply don't come remotely close to orbiting anything worth advertising. Furthermore, while graduated, some sites simply don't have enough activity for ads to make sense.  Since these are hand-selected, it could take a while for ads to appear initially.  These would of course yield to inventory from clients if clients had products that were relevant to any given topic.   Nothing changes when it comes to the . If you're used to occasionally seeing a community promotion ad, you'll just notice that you'll also occasionally see an ad for something that is likely to be of interest to someone interested in the topic that your site covers. In fact, to be clear, this is simply a continuation of the announcement we made in November of 2016. We just wanted folks to know that we're going to be continuing the program where there's good potential to show relevant advertisements, even if we don't have clients lined up with a demand for it. Where can I give feedback about a certain ad on [site]? Open a meta post on your per-site meta and let us know. Please remember, the bulk of advertisements are an effort to get something small back from folks that hit the sites through search engines and are extremely unlikely to ever become contributors. Their soufflé stopped falling, and we'll probably never see them again. Maybe we can get a few bucks once they realized that copper ions help egg whites stiffen properly and buy a bowl or a proper bloom whisk. However, you're the experts on these topics and we're very likely going to listen to you. What sites, specifically? Are any sites exempt? If you're a former Stack Exchange 1.0 site and / or subsequently joined the network under a special charter, nothing changes - don't panic :) For the rest, we're just extending what we're currently doing with ads on graduated sites to also include those where there's an opportunity to make sensible use of affiliate ads. If a site has less than 15k (average) daily visits, or fewer than roughly 50k combined total posts - it might not yet be time to invest in selecting ads to be shown there. But, part of this exercise is also seeing what works best. I don't really have feedback, just some suggestions Ads aren't just an opportunity to sell stuff, they're an opportunity to really show people that we understand a given topic. That, of course, makes suggestions from people that do that stuff every day quite valuable. Post on your per-site meta and our community / ad critters will take a look. Questions? Comments? Kvetches? Let us know in an answer or comment below. If anything about the plan changes, we'll update this post to let folks know.


I've been set homework to create a calculator on python that uses currency rather than just normal numbers. This is what i have so far:   `#python calculator  import math  def add(x, y):     return x+y  def subtract(x, y):     return x-y  def multiply(x, y):     return x*y  def divide(x, y):     return x/y  print('select option') print('1.add') print('2.subtract') print('3.multiply') print('4.divide')  choice = input('enter choice (1/2/3/4): ')  if choice > '4':     print('invalid choice, try again')  num1=float(input('enter first number: ')) num2=float(input('enter second number: '))  if choice == '1':     print(num1, '+',num2, '=', add(num1,num2)) elif choice == '2':     print(num1, '-',num2, '=', subtract(num1,num2)) elif choice == '3':     print(num1, '*', num2, '=', multiply(num1,num2)) elif choice == '4':     print(num1, '/', num2, '=', divide(num1,num2))`   Can you help me to change the input into currency form and then my output too please?  P.S i'm quite new to python to please keep it as simple as possible

I am looking to format a number like 188518982.18 to £188,518,982.18 using Python.  How can I do this?


I'm a complete beginner to php. My code has a feedback form that sends data to mysql. I'm not sure how to secure this against SQL injection. I would love your help.  Here is the code:    <?php     if(isset($_POST["send_message"])){       $hostname='localhost';       $username='';       $password='';        try {         $dbh = new PDO("mysql:host=$hostname;dbname=dbname",$username,$password);         $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);           $message = $_POST['message'];         $sql = "INSERT INTO tbl_contact (message) VALUES ('$message')";          if ($dbh->query($sql)) {           include "thanks.php";         } else{           echo "<script type= 'text/javascript'>alert('Data not successfully Inserted.');</script>";         }          $dbh = null;       } catch(PDOException $e) {         echo $e->getMessage();       }     } ?>   Update: I'm trying to use prepared statements and bind parameters but I get an: Uncaught Error: Call to undefined method PDOStatement::bind_param().  Here is the updated code:  <?php if(isset($_POST["send_message"])){     $dbConnection = new PDO('mysql:dbname=sondagg9_submit;host=localhost;charset=utf8', 'sondagg9_travadm', 'Mc%F}SrGk5m5#t<Crb4?');     $dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);     $dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);     $stmt = $dbConnection->prepare('INSERT INTO tbl_contact (message) VALUES (?)');     $stmt->bind_param('s', $message);     $message = $_POST['message'];     $stmt->execute();     $result = $stmt->get_result();     } ?>   SOLVED: Thanks to your comments, I've been able to solve the issue this way:  <?php if(isset($_POST["send_message"])){     $dbConnection = new PDO('mysql:dbname=sondagg9_submit;host=localhost;charset=utf8', 'sondagg9_travadm', 'Mc%F}SrGk5m5#t<Crb4?');     $dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);     $dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);     $message = $_POST['message'];     $stmt = $dbConnection->prepare('INSERT INTO tbl_contact (message) VALUES (:message)');     $stmt->execute([ 'message' => $_POST['message'] ]);     } ?>

If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening?


This is on Windows 7 x64 if that makes any difference.   says to Disable Automatic Syncing in the Preferences, but that option is grayed out for me.   Is there a way to do this with iPad?

Is there any way to prevent iTunes from starting under XP when an iPhone is plugged in?  Using iTunes v 9.  Usually I just want to charge my phone and don't want iTunes to start.  Note: Exact  of this question - except this is for v9 on Windows.  The answer in the related question doesn't work for me.


I am stuck on the following problem:      I have to determine the sum of the series  $$\sum_{n=1}^{\infty}\frac{n+1}{2^n}$$   My Attempt: $$\sum_{n=0}^{\infty}\frac{n+1}{2^n}=\sum_{n=0}^{\infty}\frac{1}{2^n}+\sum_{n=0}^{\infty}\frac{n}{2^n}=\frac{1}{1-\frac12}+\sum_{n=0}^{\infty}\frac{n}{2^n}=2+\sum_{n=0}^{\infty}\frac{n}{2^n}$$.  So,I am stuck on determining the value of $\,\,\sum_{n=0}^{\infty}\frac{n}{2^n}$.   Can someone point me in the right direction? Thanks in advance for your time.

How can I evaluate $$\sum_{n=1}^\infty\frac{2n}{3^{n+1}}$$? I know the answer thanks to , but I'm more concerned with how I can derive that answer. It cites tests to prove that it is convergent, but my class has never learned these before. So I feel that there must be a simpler method.  In general, how can I evaluate $$\sum_{n=0}^\infty (n+1)x^n?$$


I want to add the edge to the private linked-list edges from the class Vertex. Please help me to solve this function. I get this error:     Exception in thread "main" java.lang.NullPointerException     at   sample.Vertex.setEdges(Vertex.java:19)    at   sample.Main.main(Main.java:24)   Vertex.java  package sample;  import java.util.LinkedList; import java.util.List;       public class Vertex {         private String label;        private LinkedList<Integer> edges;          public void setLabel(String label) {             this.label = label;          }}  //        public void setEdges(Edge e) { // //            edges.add(e); //        }}   Edge.java  public class Edge {          private Vertex destination;         private double weight;      public void setWeight(double weight) {         this.weight = weight;     }      public void setDestination(Vertex destination) {         this.destination = destination;     }      public double getWeight() {         return weight;     }      public Vertex getDestination() {         return destination;     }   }   Main.java  public class Main {        //  Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));              public static void main(String[] args) {                 // creating the graph A --1.0--> B                 Vertex n = new Vertex();                 n.setLabel("A");                 Vertex b = new Vertex();                 b.setLabel("B");                 Edge e = new Edge();                 e.setDestination(b);                 e.setWeight(1.0); //                n.setEdges(e);                  // returns the destination Node of the first Edge double weight = e.getWeight(); System.out.print(e);                 System.out.print(n);                 // returns the weight of                 // the first Edge             }       public static void main2(String[] args) {         launch(args);     } }

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


I am having canvas inside two div tags. I am try to draw with pencil on the canvas but i am not able get start at exact mouse pointer location here is code CSS  div.ot_whiteboard  {  display: block;  background-color: #DCD9CD;  margin: 0 auto;  padding: 10px;  position: relative;  } canvas.canvas_test{  height:100%;  width:100%; position:relative;     }   JS  var mainCanvas =document.getElementById('canvas_test');  var previousMousePos,mousePos,paint=false;     mainCanvas.addEventListener("mousemove",draw,false);   mainCanvas.addEventListener("mousedown",startdraw,false);   mainCanvas.addEventListener("mouseup",stopdraw,false);   function startdraw(event){   paint=true;  previousMousePos = getMousePos(event);  } function draw(event){ if(paint){  mousePos = getMousePos(event); var mainCanvas = document.getElementById('canvas_test'); var ctx = mainCanvas.getContext('2d');  console.log(" X position :"+ previousMousePos.x);   console.log(" X position :"+ mousePos.x);  console.log(" Y position :"+ previousMousePos.y);  console.log(" Y position :"+ mousePos.y);  ctx.strokeStyle = "black";        ctx.lineWidth = 2;        ctx.beginPath();        ctx.moveTo(previousMousePos.x, previousMousePos.y);        ctx.lineTo(mousePos.x, mousePos.y);        ctx.stroke();        ctx.closePath();    previousMousePos = mousePos;  } } function stopdraw(event){   paint=false;  previousMousePos = getMousePos(event);  }  function getMousePos(evt) {                 var obj=document.getElementById("canvas_test");         var top = 0;         var left = 0;         while (obj) {             top += obj.offsetTop;             left += obj.offsetLeft;             obj = obj.offsetParent;         }         // return relative mouse position         var mouseX = evt.clientX - left + this.pageXOffset;         var mouseY = evt.clientY - top + this.pageYOffset;         return {             x:mouseX,             y:mouseY         };     }   HTML

  <canvas id="canvas_test" class="canvas_test"></canvas>
     Could you please help me to get the exact pointer of mouse co-ords

What's the simplest way to add a click event handler to a canvas element that will return the x and y coordinates of the click (relative to the canvas element)?  No legacy browser compatibility required, Safari, Opera and Firefox will do.


I would like to make sure that my Windows 2008 servers are hardened against DDOS attacks.  There is a Microsoft Technet article on , but it was last revised in January 2006. There is another article (somewhat duplicative) specifically for , but I can't find one for Windows Server 2008.  Does anyone know if these protections are already in place in Windows Server 2008's TCP/IP stack or if they are still relevant?  I found a portion of a book on Safari called Windows Server 2008 TCP/IP Protocols and Services that :     TCP in Windows Server 2008 and Windows   Vista use SYN attack protection to   prevent a SYN attack from overwhelming   the computer.   and      TCP in Windows Server 2008 and Windows   Vista no longer supports the   TcpMaxConnectResponseRetransmissions,   SynAttackProtect, TcpMaxHalfOpen, and   TcpMaxHalfOpenRetried registry values.   ...but I can't find a mention of the other registry values nor a second source for this information.

This is a  about DoS and DDoS mitigation.   I found a massive traffic spike on a website that I host today; I am getting thousands of connections a second and I see I'm using all 100Mbps of my available bandwidth.  Nobody can access my site because all the requests time out, and I can't even log into the server because SSH times out too!  This has happened a couple times before, and each time it's lasted a couple hours and gone away on its own.  Occasionally, my website has another distinct but related problem: my server's load average (which is usually around .25) rockets up to 20 or more and nobody can access my site just the same as the other case.  It also goes away after a few hours.  Restarting my server doesn't help; what can I do to make my site accessible again, and what is happening?  Relatedly, I found once that for a day or two, every time I started my service, it got a connection from a particular IP address and then crashed.  As soon as I started it up again, this happened again and it crashed again.  How is that similar, and what can I do about it?


I know that I am that person :D  With all seriousness, I am pretty sure there is a word for it, and I have seen it, but i forgot it.

My original question was "Is there a legitimate word for 'a balancer'?" but I think it's a little hard to understand...  Let's just say there is a person, and most of the time, he is in the minority. It can be very simple, such as: he simply hates a song everybody likes (and vice versa), or he has a very long list of 'underrated movies'. I guess he has a different (if not eccentric) taste comparing to most people..  On the other hand, he often does things that most people would refuse to do, too (whether he wants to or not). For example, most people wouldn't buy damaged goods, but he would. You can say he is sacrificing himself. To his mind, "If everybody wants perfection than who will care for the damaged?" or "There are certain people who would only accept the best, so there must be people who accept the worse, coexisting with the former."  This person does things that most people would never do, he stays in the minority so other people can be in the majority => some sort of "balancer"? You know, since he balances everything.. So, is there a word for people like him?  I know this is a long shot but please help me if you can, thank you!


I need to construct a real function with is exactly C^2 (that is, it is continuous and 2 times differentiable but it is not 3 times differentiable) such that its first derivative never vanishes.  I tried   x^5 Sin(1/x) + Exp(x)  x^(5/2) + Exp(x)  |x|^3 + Exp(x)  all these functions are exactly C^2, but their first derivatives vanish in some point(s).  :(

I need to construct a real function with is exactly $C^2$ (that is, it is continuous and two times differentiable but it is not three times differentiable) such that its first derivative never vanishes.  I tried  $x^5 \sin(\frac{1}{x}) + \exp(x)$  $x^{\frac{5}{2}} + \exp(x)$  ${|x|}^3 + \exp(x)$  all these functions are exactly $C^2$, but their first derivatives vanish in some point(s). :(


I have prepared a scientific manuscript for a Springer journal in LaTeX (The Springer template defines "svjour3" document class). After a review process, the editor ask me to change some parts of the paper and submit again for the second review process. In Microsoft Word, revising is defined as "track change". This feature highlights the changes within the document. I just want to know if LaTeX has a similar feature like track change in MS Word?  If not, what's the best way to highlight changes in a LaTeX document?

I am writing a scientific paper with my collaborator. We have submitted a version to a journal and now we got a review from them, so we need to fix a few things. In Microsoft Word there is the option to "track changes", which displays the deleted text as crossed out and the new text bolded (if I remember the details correctly). Is there a way to achieve a similar result in LaTeX?  I was thinking to create a new file for the revised version and then write a script which would basically compare the two files and make the differences either bold or crossed out before sending it to latex. Is there a tool that already does it?


I  received the following question. It's also in Chapter 2 of Spivak's book on Differential  Geometry, Volume 1.     Given a smooth connected manifold $M$, prove that between any two points $p,q \in M$, there  exists a smooth curve $c : [0,1] \to M$ such that $c(0) = p, c(1) = q$. Furthermore, $c$ can be chosen to be one-one.   How I propose to do  this problem is as follows : I would like to find a common chart(open  neighbourhood homeomorphic to $\mathbb R^n$) containing $p$ and $q$. This is  done as follows : take a chart $C_p$ containing $p$, and take a path connecting $p$ and $q$ (This must exist by the definition of a manifold as a second countable Hausdorff space, but I'm unable to say why). Around this path, consider a contractible neighbourhood $N$ (Can I do this?). Now, $N \cup C_p$ is a chart containing $p$ and $q$.   Therefore, since this neighbourhood is homeomorphic to $\mathbb R^n$, I can find a 1-1 smooth path connecting the images of $p$ and $q$ in $\mathbb R^n$ (this is a standard  property of $\mathbb R^n$, easily provable), and pulling this back into $M$ gives me the $c$ I desire, which is also $1-1$.  Is this correct?  EDIT : This question is different from a proposed duplicate, given in the comment below, since here I am attempting the question in a  way different from how it been done in the duplicate, and furthermore I  am asking for a  critique of my attempts, not the answer itself. When  I am confident, I will answer  this question myself and close it.

I have two questions which pertain to differentiability, connectivity and path connectivity. Ocasionally, I will encounter an author who defines connectivity in the following way:   An open subset $U$ of $\mathbb{R}^n$ is said to be connected if and only if given two points $a$ and $b$ of $U$ there exists a differentiable mapping $\phi: \mathbb{R} \rightarrow U$ such that $\phi(0) = a$ and $\phi(1) = b$.   This particular example is from Edward's Advanced Calculus of Several Variables p 84. Now, this is obviously not the standard definition we learn from topology which has nothing to do with differentiability but rather whether there exists two nonempty open subsets that comprise a separation. It also seems to me that what the author is really defining what it means for a space to be "smoothly path connected", which of course implies connectivity and, it seems to me, considerably more.  My first question is: Is "smoothly path connected", as defined above actually equivalent to "connected", in the topological sense, in $\mathbb{R}^n$?  Next, in Vector Calculus by Baxandall and Liebeck on p 150 the authors state the existence of a continuous path $\alpha$ from the closed interval $[0,1]$ to an open subset $D$ of $\mathbb{R}^n$ where $\alpha (0) = a \in D$ and $\alpha(1) = b \in D$ guarantees the existence of a differentiable path with the same properties. This claim is stated without proof.   My second question is: Can someone provide a reference to a proof of the above claim or explain why it is so?


As mentioned in the title, I'm trying to boot ubuntu on my windows 10 desktop but can't as I get this message: "Initramfs unpacking failed: Decoding failed". Please may you help me solve this issue so so I'm able to boot Ubuntu!

I just installed Ubuntun 20.04 on a Dell Latitude 7400 on DualBoot. I had to remove the RST as mentioned on this post :  It works but now I need to test 5 or more times to boot. After the grub screen, most of the time i have a black screen. Sometimes I have this error : Initramfs unpacking failed: Decoding failed And then it starts.  here is a file called initramfs.conf cat /etc/initramfs-tools/initramfs.conf MODULES=most  BUSYBOX=auto  COMPCACHE_SIZE=""  COMPRESS=lz4   DEVICE=  NFSROOT=auto RUNSIZE=10%


The spell has a somatic and material component, can it be cast without someone knowing you are casting a spell?

Some spells have somatic and vocal components, that's well known.  How loud must a wizard talk? How obvious/wide should his gestures be?  Some spells that would be awesome would be fairly limited if you need to shout them (ex: mage hand, range 30ft).


When computing loss functions, people use $(target-actual)^2$. They sqaure it to prevent any negative loss. But we can even use $|(target-actual)|$ to prevent any negative loss. So, why do people prefer the first option more than the second?

Calculating absolute values is much more efficient than calculating squares. Is there any advantage, then, to using the latter as a cost function over the former? Squares are easier to treat analytically, but in practice that doesn't matter.


I don't know where to start with this one:  Let $f(z)=\sum_{n=0}^{\infty}{a_nz^n}$ be a series with radius of convergence $1$. a) Prove that $\frac{1}{2\pi}\int_0^{2\pi}{|f(re^{i\theta})|^2}d\theta=\sum_{n=0}^{\infty}{|a_n|^2r^{2n}}$ for all $0<r<1$.  If I plug the $f(z)$ expression into the integral, I have the square of a sum and I don't know if it's the easiest way to solve it. I'd appreciate any hint. Thanks for your time.

Let $f(z)=\sum_{n=0}^{\infty}a_nz^n$ with radius of convergence equals to $R$. Show that for every $r<R$:  $$\frac{1}{2\pi}\int_{0}^{2\pi}|f(re^{it})|^2dt=\sum_{n=0}^{\infty}|a_n|^2r^{2n}$$  I tried this:  $$\int_{0}^{2\pi}|f(re^{it})|^2dt=\int_{0}^{2\pi}f(re^{it})\overline{f(re^{it})}dt=\int_{0}^{2\pi}\sum_{n=0}^{\infty}a_nr^ne^{int}\sum_{n=0}^{\infty}\overline{a_n}r^ne^{-int}dt= \int_{0}^{2\pi}{\sum_{n=0}^{\infty}\sum_{k=0}^{n}}a_k\overline{a_{n-k}}r^ne^{int}$$  But this is about it. Any ideas?  Thanks!


/give @p diamond_sword 1 0 {AttributeModifiers:[{AttributeName:"generic.attackDamage",Name:"generic.attackDamage",Amount:100000000,Operation:2,UUIDLeast:669718,UUIDMost:872863}],HideFlags:0}   That command is giving the output of:  Syntax error: Unexpected "," at "unt:100000000>>,<<Operation:"   What is going on?  Bedrock Edition

This question was recently split into different questions for each workaround. See   meta posts for more information.   Can you use NBT tags in commands? I’ve tried commands that normally work in Java Edition like: give @s minecraft:planks 30 1 {display:{Lore:["Wooden planks"]}} give @s stone_pickaxe{Unbreakable:1b} give @s item_frame{EntityTag:{Invisible:1b}} summon villager ~ ~ ~ {Offers:{Recipes:[{buy:{id:"emerald",Count:5b},sell:{id:"diamond_sword"}}]}} summon tnt ~ ~ ~ {Fuse:20s}


This question is a competition-math related problem.   Show that for no positive integer $n$ can both $n+3$ and $n^2 + 3n + 3$ be perfect cubes.  Is there a way to solve the above problem without induction? Any help is appreciated. Thanks.

I have to prove that for any positive integer $n$ at least one of $n+3$ and $n^2+3n+3$ is not a perfect cube. Is there a methodical way to solve this problem?  I managed to solve it by contradiction, trying to force it into some sort of algebraic identity.  The solution I found is as follows:     If $n+3$ and $(n^2+3n+3)$ are both cubes then the product is a cube. The product is $n^3+6n^2+12n+9=(n+2)^3+1$. There are no two positive cubes with distance one between them, this is the contradiction.   For some reason this seems rather artificial, it makes me think that if one wished to make a very hard problem like this then he could look for much more complicated identities, and then actually finding the contradiction would be a lot harder. Is there a "safer" way to tackle these problems, without having to rely on "luck". (Of course it is not 100% luck because practice makes you a lot faster at finding the way to put together the expression)


Can you give an example of a relation that is symmetric and transitive, but not reflexive?   By definition,   $R$, a relation in a set $X$, is reflexive if and only if $\forall x\in X$, $x\,R\,x$.  $R$ is symmetric if and only if $\forall x, y\in X$,  $x\,R\,y\implies y\,R\,x$. $R$ is transitive if and only if $\forall x, y, z\in X$, $x\,R\,y\land y\,R\,z\implies x\,R\,z$.    I can give a relation $\leqslant$, in a set of real numbers, as an example of reflexive and transitive, but not symmetric. But I can't think of a relation that is symmetric and transitive, but not reflexive.

Definition: Given a set $X$, a relation $R$ on $X$ is any subset of $X\times X$.  A relation $R$ on $X$ is said to be  reflexive if $(x,x) \in R$ for all $x \in X$, irreflexive if $(x,x) \not\in R$ for all $x \in X$, transitive if $(x,y) \in R$ and $(y,z) \in R$ implies that $(x,z)\in R$, intransitive (or antitransitive) if $(x,y) \in R$ and $(y,z) \in R$ implies that $(x,z)\not\in R$, symmetric if $(x,y) \in R$ implies that $(y,x) \in R$, antisymmetric if $(x,y) \in R$ and $(y,x) \in R$ implies that $x=y$.   Given any combination of the properties listed above, is there a nontrivial (i.e. nonempty) relation which satisfies that combination of properties?


How is the ordering of answers done?  in  question, there are 2 answers as I am writing this question. This  having 40 votes is not on the top instead another  having less votes.  How is the ordering of answers done?

I just realized that answers that have 0 scores are ordered before other answers that have one or more votes. Is this a new feature to promote new answers or a bug?  Examples        Pictures


From the MTG rules:     302.6. A creature's activated ability with the tap symbol or the untap symbol in its activation cost can't be activated unless the creature   has been under its controller's control continuously since his or her   most recent turn began. A creature can't attack unless it has been   under its controller's control continuously since his or her most   recent turn began. This rule is informally called the "summoning   sickness" rule.   Do I correctly understand then that other abilities, such as the 's ability can be used immediately after being placed onto the battlefield?     {1}{B}, Sacrifice a creature: Target player loses 1 life and you gain   1 life.

Note: this is intended to be a canonical question about summoning sickness.  "Summoning sickness", broadly, is the rule that stops you from attacking or paying {T} costs with a creature that you just played. But how exactly does it work? How does it interact with other rules and effects?  For example, if I'm trying to figure out how a creature is affected:   Does the status matter (tapped/untapped, face down/face up, etc.)? What if it came into play, but I didn't cast it? What if it's a token? What if it was on the battlefield when my turn started, but it wasn't a creature? What if it stops being a creature? What if it's a creature and also another card type? What if it's a double-faced card that just transformed? What if it changes control? What if it's a copy of another creature? Which of the creature's activated abilities can I use? Are any of its other abilities affected? Can I tap the creature to pay a cost that is not a {T} cost?   (These examples are primarily taken from questions about summoning sickness that have already been asked on the site)


My neighbor had company in the US from Colombia. They incurred hospital bills that they never paid. My neighbor is wondering if the US can deny his family's visitor visas the next time they visit?

While on vacation in the US last year, my wife and I was in a traffic accident. My wife had to spend more than a week in hospital before we could fly home. Our insurance is covering everything, but we keep receiving more bills in the mail. We are forwarding the bills to our insurance company, who tells us that they are taking care of them, but they are probably not paying them immediately (I expect there are a lot of paperwork involved). We can see that some of the invoices have strange addresses on them and have taken a long time to reach us, so we are a bit worried that there might be others that haven't reached us yet.  Also, since the accident was partly my fault, I received a ticket for careless driving, which I have paid.  We are going back to the US in a few weeks on vacation. Can any of this give us problems in immigration or elsewhere? Is there anything we should do or special papers we should bring?


I am creating an exam using the exam class. To conform with the standard format, I need to be able to count the number of questions (which can be done using \numquestions) and display them as words (i.e. 1 --> one, 2 --> two etc). I have tried using fmtcount but I can;t get the two packages to work together. Any help would be greatly appreciated! Here is a MWE:  \documentclass{exam}  \begin{document}  \section*{Here are \numquestions\ questions}  \begin{questions}     \question This is the first question.     \question This is the second question. \end{questions}  \end{document}   I would like the \numquestions in the section title to be in words (i.e two) instead of just the number 2.   Thanks!

This is a wild one: can anyone write a code that converts a number into the corresponding word? e.g.:  4 -> 'four' 31 -> 'thirty-one'   and so on. Obviously, it is not enough to build an array in which you can store the numbers and the word associated with it and then just print instead of the number the stored word. What complicates matters more, are numbers like 11 ('eleven'). I intend to use it for numbering equations. So, anybody up to it?


I want Ctrl+Alt+B bring up a browser.  Ctrl+Alt+Delete is handy.  Can I set up Ctrl+Alt+B to bring up a browser (either default or specific)?

I want to change the key bindings on some of the keys on my keyboard.  I want some to run commands and others to activate different keys.  What applications can I use to do this?      Index:       (from within System Settings)             I'm still looking for answers using dconf and any other method.


Hi i want to curve my logo-text vector around A circle, like this:    With this (my logo):   But my logo is a premade vector, not text file, so each letter is its own SHAPE/Path or whatever you call it. So i want to arrange it around a circle perfectly like the powerhouse logo  how could i do this? thanks in advance

If I have some text that is expanded, how can I distribute it along a path?  For example, if I'd like to have the Stack Exchange logo follow an arc    Using an Envelope Distort, well, distorts the logo:    Instead, I am looking to achieve something more like this:    Is this possible once the text has been outlined/expanded?


I want to run PCA on a set of data, but I'd like to weigh each row of the input matrix(i.e. each data point) based on how recent it is. In other words, in my calculations of the PCs, I'd like more recent data points to be more important. How can I achieve this?

After some searching, I find very little on the incorporation of observation weights/measurement errors into principal components analysis. What I do find tends to rely on iterative approaches to include weightings (e.g., ). My question is why is this approach necessary? Why can't we use the eigenvectors of the weighted covariance matrix?


I played a variant of Solitaire long ago (20+ years) but don't remember the name of it or the specific rules.  It was played with a single deck of cards, which you held in your hand face down. You drew 4 cards face up, keeping them in that same hand. Cards were removed / discarded through some matching criteria (which I don't remember), and if no cards could be removed, new cards were drawn one at a time. Each time a new card was drawn, the matching criteria were applied again. This repeated until the deck was empty. You won if you were left with no cards in your hand.  I remember it being quite difficult to win, but it was neat in that you didn't need a table or other flat surface. The game was played entirely in your hand(s).

You start flipping cards over one at a time and holding them in one hand. When you have two cards of the same suit that are separated by two other cards (e.g. 4♣ 2♦ 7♥ 10♣), you discard the middle two. When two cards of the same value are separated by two other cards (e.g. 4♣ 2♦ 7♥ 4♥), you discard all four.  This game is neither Accordion nor Royal Marriage, but bears similarities to both. Somebody else  on Yahoo Answers five years ago and the response was unsatisfactory.  If someone can identify this game, I would also like to know what happens when you finish with two cards left: do you win, as in Royal Marriage, or not?


I've detected some packages that breaks my configuration (like light-locker, evince, etc...)   How can I prevent these packages to be able to install via apt-get install in my system (Debian) with the provided error reason?

TL;DR  Question: How can I disallow installing of the package intel-microcode in the future? With my bad memory, I may try installing it someday, again.    Long story  Yesterday, I installed the intel-microcode package on Linux Mint 18.3 using driver-manager.  Problem: in this laptop's case, it causes a complete system freeze.  Reproducible: Yes, after each boot.  When: Every time the system boots up. More specifically, sometimes at loading initramfs, more often very soon after login (up to some 5 minutes).    Kernel: 4.13.0-38-generic.  Hardware: not old but not new laptop Lenovo IdeaPad Z50-70, exact model 59-432384.  BIOS: 9BCN31WW.  Note for BIOS upgrade: Since Lenovo provides BIOS upgrades for Windows only, I can't upgrade. The latest BIOS is dated 24 Sep 2015, which is long time ago anyways, .  CPU: i7-4510U, .  dmidecode, relevant CPU part:  Processor Information         Socket Designation: U3E1         Type: Central Processor         Family: Core i7         Manufacturer: Intel(R) Corporation         ID: 51 06 04 00 FF FB EB BF         Signature: Type 0, Family 6, Model 69, Stepping 1         Flags:                 FPU (Floating-point unit on-chip)                 VME (Virtual mode extension)                 DE (Debugging extension)                 PSE (Page size extension)                 TSC (Time stamp counter)                 MSR (Model specific registers)                 PAE (Physical address extension)                 MCE (Machine check exception)                 CX8 (CMPXCHG8 instruction supported)                 APIC (On-chip APIC hardware supported)                 SEP (Fast system call)                 MTRR (Memory type range registers)                 PGE (Page global enable)                 MCA (Machine check architecture)                 CMOV (Conditional move instruction supported)                 PAT (Page attribute table)                 PSE-36 (36-bit page size extension)                 CLFSH (CLFLUSH instruction supported)                 DS (Debug store)                 ACPI (ACPI supported)                 MMX (MMX technology supported)                 FXSR (FXSAVE and FXSTOR instructions supported)                 SSE (Streaming SIMD extensions)                 SSE2 (Streaming SIMD extensions 2)                 SS (Self-snoop)                 HTT (Multi-threading)                 TM (Thermal monitor supported)                 PBE (Pending break enabled)         Version: Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz         Voltage: 0.7 V         External Clock: 100 MHz         Max Speed: 2600 MHz         Current Speed: 1900 MHz         Status: Populated, Enabled         Upgrade: Socket BGA1168         L1 Cache Handle: 0x000B         L2 Cache Handle: 0x000C         L3 Cache Handle: 0x000D         Serial Number: To Be Filled By O.E.M.         Asset Tag: To Be Filled By O.E.M.         Part Number: To Be Filled By O.E.M.         Core Count: 2         Core Enabled: 2         Thread Count: 4         Characteristics:                 64-bit capable                 Multi-Core                 Hardware Thread                 Execute Protection                 Enhanced Virtualization                 Power/Performance Control     Temporary solution: I was lucky, that one time the computer booted fine and I was fast enough to uninstall this package, again, through driver-manager.


I know that this question may be a bit trivial but just curious about it. I know that according to grammar, “six-week course” is the right form. But when I replace “six” with the number 6, I read that both “6 week course” and “6-week course” are pretty common, so a bit confused about which is grammarly correct and which may be better. Thanks!

What is the correct way of saying this:        I have completed three years of a six years course.   I have completed three years of a six-years course?      And also, should it be 'six year' or 'six years' here?


In high school, we are taught that we do not have $2i < 3i$, i.e., the complex number system is not an ordered field.   (Real number, for example, is an ordered field. For example, $2 < 3$).  Why?      My comment to this is because in the complex corrdinate, in $Re-Im$ coordinate, the concept of complex number is somewhat a rotation around the origin.

Show that there doesn't exist a relation $\succ$ between complex numbers such that (i) For any two complex numbers $z,w$, one and only one of the following is true: $z\succ w,w\succ z,$ or $z=w$ (ii) For all $z_1,z_2,z_3\in\mathbb{C}$ the relation $z_1\succ z_2$ implies $z_1+z_3\succ z_2+z_3$. (iii) For all $z_1,z_2,z_3\in\mathbb{C}$ with $z_3\succ 0$, then $z_1\succ z_2$ implies $z_1z_3\succ z_2z_3$.  Suppose $i\succ 0$. From (iii) we have $i^2\succ 0$, so $-1\succ 0$, so applying (ii) we get $0\succ 1$. But repeating (iii) on $-1\succ 0$ we get $1\succ 0$, a contradiction. So either $i=0$ or $0\succ i$. How can I proceed from here?


While writing a report, I need to decide on which of the following two constructions is correct/more appropriate.        The characters of A in B are of course assumed known.   The characters of A in B are of course assumed to be known.      My issue is with the ending of the sentence (The initial parts are technical).

The baby seems happy/comfortable. The baby seems to be happy/comfortable.   Are these both correct? If both are correct, what are the differences between them?


You, 4 other people, and a dog are in a room. You have a bunch of tennis balls in the center of the room. When no one is looking except for the dog, you give one tennis ball to the dog and then you divide the remaining tennis balls into 5 equal piles. You take one of the piles and hide it somewhere else in the room. Each of the 4 other people in the room do this to the remaining stash of tennis balls in the center (1 for the dog, 1/5 of the remaining for them). You again give one tennis ball to the dog after all four people have done the same and divide the remaining tennis balls evenly among all 4 people and you. There are no more balls left. What is the minimum number of tennis balls that could have been in the center of the room at the beginning?

Five sailors and a monkey were shipwrecked on a deserted island, and they spent the first day gathering coconuts for food, piled them all up together and went to bed. But when they were all asleep one sailor woke up, and he thought that there might be a row about dividing the coconuts in the morning, so he decided to take his share. He divided the coconuts into five piles. He had one coconut leftover, and he gave that to the monkey, and he hid his pile and put the rest back together. By and by the next sailor woke up and did the same thing. And he had one leftover, and he gave it to the monkey. And all five sailors did the same thing one after another. Each taking a fifth of the coconuts in the pile, and each having one leftover for the monkey. In the morning they divided the coconuts that were left and they came out in five equal shares and one coconut leftover and gave that to the monkey. How many coconuts were there in the beginning?


I have to get the first element of an array., but it is possible that the element is empty; If the element is empty I put an empty field (I am trying to generate a pdf)  Here is my code now:  public void makePdf(Long id) throws IOException {     Candidacy ca = candidacyRepository.findOne(id);      cos.beginText();      cos.showText(        ca.getInterviews().stream().map(Interview::getAgency).map(Agency::getAgencyName).collect( Collectors.toList()).get(0)!=null?ca.getInterviews().stream().map(Interview::getAgency).map(Agency::getAgencyName).collect( Collectors.toList()).get(0):""));       cos.endText(); }   So I will wish not to prevent the generation of the pdf. Thank you very much for your support!  UPDATE  Sorry for the lack of precision: I also sort on the date.  public void makePdf(Long id) throws IOException {         Candidacy ca = candidacyRepository.findOne(id);          cos.beginText();          cos.showText(            ca.getInterviews().stream().sorted((a,b)-> a.getInterviewDate().compareTo(b.getInterviewDate())).sorted((a,f)->f.getInterviewDate().compareTo(a.getInterviewDate())).sorted((b,f)->b.getInterviewDate().compareTo(f.getInterviewDate())).map(Interview::getAgency).map(Agency::getAgencyName).collect( Collectors.toList()).get(0)!=null?ca.getInterviews().stream().sorted((a,b)-> a.getInterviewDate().compareTo(b.getInterviewDate())).sorted((a,f)->f.getInterviewDate().compareTo(a.getInterviewDate())).sorted((b,f)->b.getInterviewDate().compareTo(f.getInterviewDate())).map(Interview::getAgency).map(Agency::getAgencyName).collect( Collectors.toList()).get(0):""));           cos.endText();     }   I get a NullPointerException:/ Thank you for you help

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


could someone help me out with this diagram? Which package would you advice and what would the code look like? Thank you in advance.

What packages do you use and recommend for creating graphics in your LaTeX documents?     As this is a community wiki post, please add your package to the accepted answer (or add a comment, and someone with >100 rep will add it to the CW answer), and include a brief description of what differentiates it from others and how it can be used (GUI drawing tool which generates code, type in raw text, or generates image for inclusion in document).   We'll eventually sort these answers under headings.


Hello i have a script where i have an textarea with the meta description and i have a input text field where i put the keyword. Then i print the matches and i have so far made this script:  var countDescription = tinymce.get('myTextEditor').getContent(); var count =  (countDescription.match(/is/g) || []).length;   And it works great, but my problem is instead of matching the word "is" i want it to match my string "u"  I have tried something like:  var count =  (countDescription.match("/" +u, "/g") || []).length;   But it really doesnt work..  Hope someone can help me out.

I would like to create a String.replaceAll() method in JavaScript and I'm thinking that using a regex would be most terse way to do it.  However, I can't figure out how to pass a variable in to a regex.  I can do this already which will replace all the instances of "B" with "A".  "ABABAB".replace(/B/g, "A");   But I want to do something like this:  String.prototype.replaceAll = function(replaceThis, withThis) {     this.replace(/replaceThis/g, withThis); };   But obviously this will only replace the text "replaceThis"...so how do I pass this variable in to my regex string?