I have a python script that calculates a variety of numbers for me in a loop. For example, in every loop it calculates: Time: Number of events: Number of errors:  I have created a .txt file to keep track of lifelong statistics. I want the script to add to the text file every time it completes a loop. For example, let's say when I first start the script, the text file looks like: Time: 60 Number of events: 10 Number of errors: 5  Now I run the script and in one loop it calculates 30 time, 3 events, and 1 error. I want it to update the text file so that it reads: Time: 90 Number of events: 13 Number of errors: 6  Is this possible?
I'm using Python, and would like to insert a string into a text file without deleting or copying the file. How can I do that?
MacBook Pro 2020 Fan Issues I recently purchased a MacBook Pro 2020 13&quot; (1.4 GHz, 8GB Ram, i5). For some reason, when I open Chrome and watch Twitch my computers fans turn on and go crazy. After opening Activity Monitor, I noticed that Google Chrome Helper (Renderer) uses around 50-80% of my CPU. Also, sometimes when I run code on my MacBook Pro, the fans turn on when the program is compiling/running but slow down a few minutes after terminating the program. Also, when watching Twice on Safari, the fans don't come on. However, around 50-60% of the CPU is still being used. Should I be concerned about the CPU usage (I am nervous because I only recently purchased the laptop)? How can I port forward with iptables? if I write,  #!/bin/bash echo "foo"   or  #!/bin/sh echo "foo"   both yields same. I have seen some scripts starting with #!/bin/sh or #!/bin/bash. Is there any difference between them? Is there any problem if the last name prints first than the first name on an air ticket? Is there any problem if the last name prints first then the first name in international air ticket? Is it possible for a physical object to have an irrational length? I read about Java's type erasure .  When does type erasure occur? At compile time or runtime? When the class is loaded? When the class is instantiated?  A lot of sites (including the official tutorial mentioned above) say type erasure occurs at compile time. If the type information is completely removed at compile time, how does the JDK check type compatibility when a method using generics is invoked with no type information or wrong type information?  Consider the following example: Say class A has a method, empty(Box&lt;?&nbsp;extends&nbsp;Number&gt;&nbsp;b). We compile A.java and get the class file A.class.  public class A {     public static void empty(Box&lt;? extends Number&gt; b) {} }     public class Box&lt;T&gt; {}   Now we create another class B which invokes the method empty with a non-parameterized argument (raw type): empty(new Box()). If we compile B.java with A.class in the classpath, javac is smart enough to raise a warning. So A.class has some type information stored in it.  public class B {     public static void invoke() {         // java: unchecked method invocation:         //  method empty in class A is applied to given types         //  required: Box&lt;? extends java.lang.Number&gt;         //  found:    Box         // java: unchecked conversion         //  required: Box&lt;? extends java.lang.Number&gt;         //  found:    Box         A.empty(new Box());     } }   My guess would be that type erasure occurs when the class is loaded, but it is just a guess. So when does it happen? Can anyone provide me with (or point me to) real life gravitational lensing data that I can plug in to the first equation on this page (the standard lensing equation):   together with the luminous mass and distance to the galaxy(s).  I've looked for papers online and have not found any simple data that can be readily plugged in to the equation (I am not familiar with the details of how exactly the lensing is measured and have gotten lost in the mountains of data in the papers).  Thanks Suppose I have a 6 GB page file on an SSD and another 6 GB page file on a traditional mechanical 5400rpm SATA drive.  Does Windows take into account the difference in the performance characteristics between the two drives when deciding which page file to use?  If it matters, I'm asking about Windows 7 and higher.  I reviewed this  but it doesn't appear to factor in the case of dissimilar storage speeds. Is there any way to tell the compiler, inside the main file body, how to find the class? I would like to use a class that belongs not found in my MiKTeX database. I know I might as well pick up this class and put it in some directory inside the base and update MiKTeX, but I do not want to do that. What I want is to organize it into a subdirectory within the same directory as my main tex file. However, when compiling the tex file, the class is not found. Of course, if I put the direct class in the same directory as the main file I will solve the problem, but that's not what I want. So, I ask: Is there any way to tell the compiler, inside the main file body, how to find the class?  Note: I'm using MiKTeX as an example, but I'm really having the problem in overleaf. There was a revtex upgrade from version 4.1 to 4.2. However, overleaf does not find revtex4-2.cls, which is, in fact, the class I'd like to use.  Below, I show an example of how I would like to organize the files. Note that the class is in a subdirectory. How to draw a shaded sphere? Intel Corporation Device [8086:0d4f] is not supported on Ubuntu 18.04.3 I am currently unable to install ubuntu server 18.04.03 LTS on the latest intel NUC10i7FNH.  Ubuntu always states both network adapters as unclaimed. The previous version (NUC8i7BEH) has the same network controller I219-V and worked like a charm.  *-network:0 UNCLAIMED      description:  Network controller      product: Intel Corporation      vendor: Intel Corporation      physical id: 14.3      ...   Without network it is not even possible to follow most suggestions how to get it enabled, because it is impossible to fetch new packages from internet.  Here are some more information as requested:  The output from: modprobe -v e1000e &amp;&amp; dmesg | grep e10   [ 3447.889394] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k [ 3447.889395] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.   The output from: sudo lspci -knn  00:1f.6 Ethernet controller [0200]: Intel Corporation Device [8086:0d4f]     Subsystem: Intel Corporation Device [8086:2081] 01:00.0 PCI bridge [0604]: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge 2C 2018] [8086:15e7] (rev 06)    For me this looks somehow, as the kernal driver would not be in use :-/  Here are a few more information i got from playiung around with 19.10 desktop version.  [    0.000000] Linux version 5.3.0-29-generic (buildd@lcy01-amd64-024) (gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)) #31-Ubuntu SMP Fri Jan 17 17:27:26 UTC 2020 (Ubuntu 5.3.0-29.31-generic 5.3.13)   output from lshw:    *-network:0        Beschreibung: Kabellose Verbindung        Produkt: Intel Corporation        Hersteller: Intel Corporation        Physische ID: 14.3        Bus-Informationen: pci@0000:00:14.3        Logischer Name: wlp0s20f3        Version: 00        Seriennummer: c8:09:a8:9c:cd:e0        Breite: 64 bits        Takt: 33MHz        Fähigkeiten: pm msi pciexpress msix bus_master cap_list ethernet physical wireless        Konfiguration: broadcast=yes driver=iwlwifi driverversion=5.3.0-29-generic firmware=48.4fa0041f.0 ip=192.168.178.109 latency=0 link=yes multicast=yes wireless=IEEE 802.11        Ressourcen: iomemory:600-5ff irq:16 memory:6023114000-6023117fff   The output from: modprobe -v e1000e &amp;&amp; dmesg | grep e10  [    2.357430] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k [    2.357430] e1000e: Copyright(c) 1999 - 2015 Intel Corporation. [    2.357616] e1000e 0000:00:1f.6: Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode [    2.562796] e1000e 0000:00:1f.6 0000:00:1f.6 (uninitialized): registered PHC clock [    2.634139] e1000e 0000:00:1f.6 eth0: (PCI Express:2.5GT/s:Width x1) 1c:69:7a:60:44:f0 [    2.634140] e1000e 0000:00:1f.6 eth0: Intel(R) PRO/1000 Network Connection [    2.634258] e1000e 0000:00:1f.6 eth0: MAC: 13, PHY: 12, PBA No: FFFFFF-0FF [    2.634991] e1000e 0000:00:1f.6 eno1: renamed from eth0 [    5.103285] checking generic (4000000000 e10000) vs hw (4000000000 10000000) [   15.806697] e1000e: eno1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None    output from lspci:  00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet Connection (10) I219-V [8086:0d4f]     DeviceName:  LAN     Subsystem: Intel Corporation Ethernet Connection (10) I219-V [8086:2081]     Kernel driver in use: e1000e     Kernel modules: e1000e Is it possible to "upgrade" from a 32bit to a 64bit installation? what is the C++/CLI syntax to subscribe for events? I'm updating some old Managed C++ code with lines like this:  instanceOfEventSource-&gt;add_OnMyEvent(      new EventSource::MyEventHandlerDelegate(this, MyEventHandlerMethod) );   where   EventSource is the class that publishes events instanceOfEventSource is an instance of that class EventSource::MyEventHandlerDelegate is the delegate type for the event MyEventHandlerMethod is a (non-static) method within the current class (of which "this" is an instance) with the signature matching EventSource::MyEventHandlerDelegate   What is the right syntax for this in C++/CLI? Don't count non-printing characters, HTML comments or other content not displayed toward minimum character requirements How to test API integration in marketing cloud? I have created a API package under Setup -> Installed Packages.   I have created API Integration component for the package .I have the below basic details for the component.   Client Id Client Secret Authentication Base URI REST Base URI   I want to test the created API package using any tool( Postman or other API testing tools).  I was able to find API integration testing links for SFDC but not for the Marketing Cloud.   What is the redirect URL to be used in the API package? I have created an API integration package of Integration type ( Web APP)   In web app properties, what is the redirect URL to be provided? Not able to execute a .sh file: /bin/bash^M: bad interpreter I wanted to execute a shell script:  -rwxr-x--x 1 root root   17234 Jun  6 18:31 create_mgw_3shelf_6xIPNI1P.sh   I tried to do a standard procedure, but I got this error:  ./create_mgw_3shelf_6xIPNI1P.sh  localhost 389 -l /opt/fews/sessions/AMGWM19/log/2013-06-06-143637_CLA-0  DEBUG   cd/etc/opt/ldapfiles/ldif_in ; ./create_mgw_3shelf_6xIPNI1P.sh  localhost 389 -l /opt/fews/sessions/AMGWM19/log/2013-06-06-143637_CLA-0 **ERROR  sh: ./create_mgw_3shelf_6xIPNI1P.sh: /bin/bash^M: bad interpreter: No such file or directory**   What does it mean? I was doing this as the root user under the root group.  Does it mean that the file does not have the correct permission for the root user? Do the druid's uses of the Wild Shape feature recharge while still in Wild Shape?  Say a 10th-level Circle of the Moon Druid spends two uses of Wild Shape to transform into an Air Elemental, whose form she can stay in for the next 5 hours. After 2 hours, she takes a short rest, but does not drop the Wild Shape. She has another couple of hours to keep the Air Elemental form.  My main concern: Does she get her two uses of Wild Shape back with that short rest? Or, does she have to drop the Air Elemental form first before taking the short rest to recharge Wild Shape? A local IP address (RFC 1918) on my network that is not … local I've noticed an IP address today on my network (192.168.15.1) which when visited actually goes to a page that has a router webconfig page (Not my router)  The puzzling thing is that i tried traceroute 192.168.15.1 which said that the distance between me and that host is 9 hops, whereas the distance between me and any other computer on my home network is 2 hops away (My computer --> Router --> Host)   Can someone please explain what's going on here ?  tracert output:  Tracing route to 192.168.15.1 over a maximum of 30 hops    1    &lt;1 ms    &lt;1 ms    &lt;1 ms  192.168.1.1   2    47 ms    51 ms    49 ms  [163.121.171.123]   3     *        *        *     Request timed out.   4   128 ms     *        *     163.121.211.134.dnet.net [163.121.211.134 ]   5     *      134 ms   126 ms  10.37.242.18   6    94 ms    90 ms    95 ms  10.35.2.157   7   178 ms   254 ms   206 ms  10.32.8.107   8    85 ms    57 ms   318 ms  10.35.0.186   9   215 ms   241 ms   230 ms  192.168.15.1  Trace complete. Multi-Question Questions: How Best to Handle Them? Sometimes I come across a question on SO that is actually a number of questions all in one. If these &quot;sub-questions&quot; are closely related, it's not a problem. But if they are only weakly related (or not at all) it gets ugly. I'm now (ironically or hypocritically) going to ask a few questions of my own for the community to respond to:  Do you consider a question made up of a number of weakly-related sub-questions &quot;inappropriate&quot;? Why or why not? How many is too many sub-questions? What do you think is the best way to deal with such questions?  As an example,  I had some discussion about with another user. I will add a more complete version of my response in an answer below, but in short I felt that this question should be closed and many of the questions asked separately. Geiger and Marsden's experiment led Rutherford to believe that the positive charge and most of the mass of the atom was concentrated in a small region. I understand what led him to conclude the way the positive charge is positioned in the atom. But how did he conclude that most of the mass was in a small region (the nucleus)?  How did the distribution of the mass matter after all? Given that the electric force is greater than the gravitational force by many magnitudes, the force between the positice charge and the electrons was predominantly electric.   So how did Rutherford conclude that most of the mass is in the nucleus?