sum function returns inconsistent values when used with slicing
Understanding slice notation
How can I access the apache basic-auth username in a PHP script? How to install aircrack on Ubuntu 12.04 "Use self" doesn't work? I'm currently working with drivers in Blender 2.81 and want to use self but it doesn't work.   For example drive the rotation by the location, I'm adding a driver to the rotation, check the Use Self box and write self.location.x  Blender return the message: ERROR Invalid Python expression.  Have I missed something, is it a bug?  edit: $x^3+x+1$ irreducible over $\mathbb{F}_2$, $\theta$ root, compute powers of $\theta$ Problem statement:     Show that $x^3+x+1$ is irreducible over $\mathbb{F}_2$ and let $\theta$ be a root. Compute the powers of $\theta$ in $\mathbb{F}_2$.   I am having trouble computing the powers of $\theta$. $x^3+x+1$ is irreducible, since any cubic polynomial over a field is reducible if and only if it has a root in the field. Since $\mathbb{F}_2=\{0,1\}$, we see that none of these is a root of $x^3+x+1$.  To compute the powers of $\theta$, note that $\theta^3+\theta+1=0$. Hence $\theta^3=-(\theta+1)$. Is this a good enough answer for $\theta^3$?  To compute $\theta^2$, note that $\theta = -(\theta^3+1)$. Therefore, $$\theta^2=(\theta^3+1)^2 = \theta^6 + 2\theta^3 + 1 = (-\theta-1)^2-2\theta-2+1,$$ which just reduces to $\theta^2$. Any ideas for computing these powers?  Thanks! Since arrays and hashes can only contain scalars in Perl, why do you have to use the $ to tell the interpreter that the value is a scalar when accessing array or hash elements? In other words, assuming you have an array @myarray and a hash %myhash, why do you need to do:  $x = $myarray[1]; $y = $myhash{'foo'};   instead of just doing :  $x = myarray[1]; $y = myhash{'foo'};   Why are the above ambiguous?   Wouldn't it be illegal Perl code if it was anything but a $ in that place? For example, aren't all of the following illegal in Perl?  @var[0]; @var{'key'}; %var[0]; %var{'key'}; Unable to uninstall Wine apps I recently ran the iTunes 10 installer in Wine and everything seemed to go well. Then, when I tried to run it, it would constantly crash/and the appearance would be glitchy. After looking at the Wine website, it turns out that iTunes 10 has a 'garbage' rating of Wine compatability.  Now I'm trying to remove/uninstall iTunes, QuickTime, and the other applications that come default with installing iTunes (such as Bonjour, etc.). However, when I run the 'uninstaller' that wine provides for the programs, it instead executes what appears to actually be the original installer! I've tried deleting all the configuration/data files in my Wine's file-system, but to no avail.  Any help is greatly appreciated!  Edit1: After re-running the uninstall process and then rebooting, the program (iTunes 10) still remained installed. Let $A$ be a non-empty set and $n$ be the number of elements in $A$, i.e. $n:=|A|$.  I know that the number of elements of the power set of $A$ is $2^n$, i.e.  $|\mathcal{P}(A)|=2^n$.  I came across the fact that exactly half of the elements of $\mathcal{P}(A)$ contain an odd number of elements, and half of them an even number of elements.  Can someone prove this? Or hint at a proof? Commandline shortcut for current directory similar to ~ for home directory? When i use the cp or move command in a terminal window, i'm currently with bash in a certain folder like this.  NES@server:~/Desktop/dir1$   And now i wanna copy a file from here ~/anotherdir/dir2 into the current chosen folder in bash (dir1) i would use the command  cp ~/anotherdir/dir2/file ~/Desktop/dir1   does a shortcut string exist to refer to the current chosen directory? So that in this example i don't have to provide the full path to the target dir, but the command knows it should use the current chosen directory in bash? i.e. as ~ stands for the home directory? Is having a skills bar chart on a resume a good idea? Ellipse formula from points Question: Best way to derive an ellipse formula when given bunch of points (say 60 points which when connected draws an ellipse)?  Background: Using R Momocs library function  which returns confidence ellipse coordinates. Would be nice to abstract those points into a formula.  You can see my ellipse points in the image below;    Any suggestions much appreciated, Thanks How to run a specific program as root without a password prompt? I need to run something as sudo without a password, so I used visudo and added this to my sudoers file:  MYUSERNAME ALL = NOPASSWD: /path/to/my/program   Then I tried it out:  $ sudo /path/to/my/program [sudo] password for MYUSERNAME:    Why does it ask for a password? How can I run/use commands as root with a non-root user, without asking for a password? What is the best way to share/distribute Excel macro? Start a longtable in Latex at top of next page I want to use the longtable environment for a table. However, I do not know how to place it at the top of the next page, as I can do with the table environment. Do you know how to do it? How do I execute a command-line program from C# and get back the STD OUT results? Specifically, I want to execute DIFF on two files that are programmatically selected and write the results to a text box. future or present with when Do the glowing pillars in The Storm Halls do anything? I've noticed that occasionally if I shoot at (or near) the glowing red pillars they will kind of explode a bit for a second and then reform. Does this affect my attacks in any way? What about nearby enemies? Is this purely cosmetic (like pillars in other dungeons crashing down)? Pull down resistor on logic gate input I would like to use a pull-down resistor on the input of a NOT logic gate. I am using a 5V microcontroller, and I want to ensure that the input of the gate will never be floating (eg. microcontroller damage).  General information:  The logic gate I am using is a HD74LS04 inverter whose datasheet can be found . I am testing the output by placing my positive multi-meter lead on R4 and the negative lead on GND. With the digital pin floating, the output of 1Y is 4.33V. This is the expected behavior.  The logic gate requires a minimum of 2.0V for Vih. If I understand this circuit correctly, I expect the voltage at pin 1A to be 3.76V since R2 and R3 will form a voltage divider. This value seems plenty to signify a 'high' in the logic gate.  R2 exists to protect the digital pin. Ideally, I would have liked R2 to be 1KΩ. Increasing the value of R2 means I have to increase the value of R3 to maintain the same voltage divider. During testing I found that if R3 was any value over 3.3KΩ, the pin 1A would not get pulled down all the way if I left the digital pin floating.   Tests: If I disconnect everything except GND and Vcc and place the positive lead of my multi-meter on pin 1A (now floating) and the negative lead to GND, I read 1.49V. Placing a pull-down resistor (R3) on pin 1A to GND with a value of 100Ω changes the reading to 0.02V. Increasing the resistor's value to 330Ω increases the reading to 0.07V. At the value I need, 3.3KΩ, the reading increases to 0.60V. Finally, changing the resistor's value to 1MΩ increases the reading to 1.47V and actually changes the output of pin 1Y to low.  The test that uses the 3.3KΩ resistor is concerning. The reading I took (0.60V) seems to be approaching the Vil maximum of the logic gate which is 0.80V.   Questions:  This must be a trivial question, but why does an R3 value of 3.3KΩ not pull pin 1A all the way to GND? Is there a formula for determining the correct pull-down resistor value? Other answers I found on here simply state 10KΩ as a 'good' value for a pull-up resistor. I'm not sure where that value comes from or if it is applicable to a pull-down resistor.         &ndash; Schematic created using   Edit: Although Ignacio's answer technically answers the question, I thought I would share some information I found for others who may come across this question.  User 'Papabravo' on the  states that the calculation for a pull down resistor can be calculated by taking the Vil (0.8V) and dividing it by the "standard TTL load" of 1.6mA. As Ignacio pointed out, my specific logic gate can source up to 0.4mA, so the calculation would be 0.8/0.0004A which equals 2KΩ. For safety, I performed the calculation at 0.5V in order to give myself some headroom.  Other Resources: Can I use the Unity launcher icon to minimize applications/windows? Harry is a half-blood and Ginny is a pure-blood, so what does that make his children? I've been told it means they are pure-bloods but I can't be sure. What do you think? Site name gets cropped while looking at user profiles on international Stack Overflow sites