Debug log getting truncated
Need to get logfile smaller
The "equal angles" law of refection on a flat mirror is a macroscopic phenomenon. To put it in anthropomorphic terms, how do individual photons know the orientation of the mirror so as to bounce off in the correct direction? What is the difference between const_iterator and non-const iterator in the C++ STL? What is the difference between a const_iterator and an iterator and where would you use one over the other? Show that function $f$ has a continuous extension to $[a,b]$ iff $f$ is uniformly continuous on $(a,b)$ Let $E \subset F \subset X$ and $f:E\rightarrow Y$. We say that the function $g:F\rightarrow Y$ is an extension of $f$ if $g(x) = f(x)$ for all $x \in E$.   Let $f: (a, b) \rightarrow \mathbb{R}$. Show that $f$ has a continuous extension to $[a, b]$ if and only if $f$ is uniformly continuous on $(a, b)$.   $(X,d)$ is a metric space.  Hint: To prove $\Leftarrow$ start by showing that $f$ maps Cauchy sequences to Cauchy sequences. Then how should you define $g(a)$ and $g(b)$?  The $\Rightarrow$ part of the proof was quite simple, but even with the hint, the other way seems a bit difficult. Doesn't the first part of the "hint" follow from the way we defined $f$? If so, how do I prove this? Help/Hints appreciated! This code is part of a larger code that generates an Arithmetic Quiz, although the code I have show below just saves the score that the user got on the test and their name. When saving the code it checks if the user has taken the quiz before. If the user has taken the quiz before it saves it as 'Older Score' or 'Oldest Score', however if the user has not taken the quiz before it generates a new row for them. Additionally it works out the average score and highest score for all users it has the data for. For my task I'm supposed to make the code as short as possible.  name = ""+first_name+" "+last_name rows_data = [] class_file_names = ['Class 1.csv', 'Class 2.csv', 'Class 3.csv'] scan = open(class_file_names[int(math_class)-1], 'r+') rows = csv.reader(scan) for row in rows:     rows_data.append(row) scan.close() class_file_names=['Class 1.csv', 'Class 2.csv', 'Class 3.csv'] csvfile=open(class_file_names[int(math_class)-1], 'w', newline="") fieldnames = ['Student Name', 'Oldest Score', 'Older Score', 'Latest Score', 'Average', 'Highest'] writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() nameFound=False for x in rows_data[1:]:     if x[0] == name:         x[3]=x[2]         x[2]=x[1]         x[1]=str(score)         x[4]=(int(x[1])+int(x[2])+int(x[3]))/3         x[5]=max(x[1],x[2],x[3])         nameFound=True     writer.writerow({'Student Name': x[0], 'Oldest Score': x[3], 'Older Score': x[2], 'Latest Score': x[1], 'Average': x[4], 'Highest' : x[5]})  if nameFound==False:     writer.writerow({'Student Name': name, 'Latest Score': score, 'Older Score': '0', 'Oldest Score': '0', 'Average': score, 'Highest': score}) csvfile.close() input("Test complete! Press anything to close.") A friend asked me last week how to enumerate or list all variables within a program/function/etc. for the purposes of debugging (essentially getting a snapshot of everything so you can see what variables are set to, or if they are set at all). I looked around a bit and found a relatively good way for Python:   #!/usr/bin/python                                                                                                                                                                                                                            foo1 = "Hello world" foo2 = "bar" foo3 = {"1":"a",         "2":"b"} foo4 = "1+1"  for name in dir():     myvalue = eval(name)     print name, "is", type(name), "and is equal to ", myvalue   which will output something like:   __builtins__ is &lt;type 'str'&gt; and is equal to  &lt;module '__builtin__' (built-in)&gt; __doc__ is &lt;type 'str'&gt; and is equal to  None __file__ is &lt;type 'str'&gt; and is equal to  ./foo.py __name__ is &lt;type 'str'&gt; and is equal to  __main__ foo1 is &lt;type 'str'&gt; and is equal to  Hello world foo2 is &lt;type 'str'&gt; and is equal to  bar foo3 is &lt;type 'str'&gt; and is equal to  {'1': 'a', '2': 'b'} foo4 is &lt;type 'str'&gt; and is equal to  1+1   I have so far found a partial way in PHP (courtesy of ) but it only lists all variables and their types, not the contents:   &lt;?php // create a few variables $bar = 'foo'; $foo ='bar'; // create a new array object $arrayObj = new ArrayObject(get_defined_vars()); // loop over the array object and echo variables and values for($iterator = $arrayObj-&gt;getIterator(); $iterator-&gt;valid(); $iterator-&gt;next())         {         echo $iterator-&gt;key() . ' =&gt; ' . $iterator-&gt;current() . '&lt;br /&gt;';         } ?&gt;   So I put it to you: how do you list all variables and their contents in your favorite language?    Edit by : I propose this question follows the spirit of a little "". If you do not agree, just edit and remove the tag and the link. I've taken multivariate calculus and am wondering if I can see a specific function where the order of taking the partial derivative matters. I've been told that there are some exceptions where $ \dfrac{\partial ^2 f}{\partial x \partial y} \ne \dfrac{\partial ^2 f}{\partial y \partial x} $, so I'm curious to see what this looks like.  EDIT: And why would this true? How can I create a new extensible symbol? Given an arbitrary thin vertical symbol, can I create a new math delimiter from it (and if so, how)?   Edit: Ideally, I would like to be able to create an extensible symbol, either built out an existing normal symbol, or even made from scratch.  Edit 2: I am pretty sure that what I am after is an explanation of how to create a .tfm file for an extensible symbol (which Werner's answer describes the general structure of, but not how to make one).    For example, let's say I wanted to use the \dagger () or \wr () symbol as a delimiter, and write expressions like    \[\left\ldagger \sum_{n=1}^\infty a_n \right\rdagger\]   where the symbol scaled appropriately. Would there be any distinction between declaring a symmetric delimiter (like \vert), as opposed to one that has inherently different "left" and "right" versions like [ and ]?  Now, even being unaware of the inner workings of TeX, I imagine that there has to be lots of information in the fonts for how a delimiter is to be scaled in different situations, and if I try to make my own delimiter, this information won't be present. Would I need to get deep into FontForge or equivalent to achieve my custom delimiters, or is there an easier way? Does a charged particle accelerating in a gravitational field radiate? A charged particle undergoing an acceleration radiates photons.  Let's consider a charge in a freely falling frame of reference.  In such a frame, the local gravitational field is necessarily zero, and the particle does not accelerate or experience any force. Thus, this charge is free in such a frame. But, a free charge does not emit any photons. There seems to be a paradox. Does a freely falling charge in a gravitational field radiate? My friend recently received a new digital drawing tablet (Wacom Intuos Pro). Among other features, there is a hole that resembles a charm hole found on mobile phones:    Other parts of the package (e.g. pen) do not have such holes, so it isn't possible to attach them using a band. What is the purpose of this hole? Is it just for attaching various charms and such? Breaking an equation cluster that does not fit on the rest of page across two pages A hidden process, what it is? [root@datacenteronline ~]# ssh root@192.168.1.172 Last login: Wed Apr 17 09:55:45 2013 from 192.168.1.187 [root@localhost ~]# ls /proc/ | grep 2266 [root@localhost ~]# cd /proc/2266 [root@localhost 2266]# ls attr             cpuset   limits      net            root       statm autogroup        cwd      loginuid    numa_maps      sched      status auxv             environ  maps        oom_adj        schedstat  syscall cgroup           exe      mem         oom_score      sessionid  task clear_refs       fd       mountinfo   oom_score_adj  smaps      wchan cmdline          fdinfo   mounts      pagemap        stack coredump_filter  io       mountstats  personality    stat [root@localhost 2266]# ls -al /proc/2266 total 0 dr-xr-xr-x   7 apache apache 0 Apr 17 09:45 . dr-xr-xr-x 266 root   root   0 Apr 17 09:11 .. dr-xr-xr-x   2 apache apache 0 Apr 17 09:45 attr -rw-r--r--   1 root   root   0 Apr 17 09:45 autogroup -r--------   1 root   root   0 Apr 17 09:45 auxv -r--r--r--   1 root   root   0 Apr 17 09:45 cgroup --w-------   1 root   root   0 Apr 17 09:45 clear_refs -r--r--r--   1 root   root   0 Apr 17 09:45 cmdline -rw-r--r--   1 root   root   0 Apr 17 09:45 coredump_filter -r--r--r--   1 root   root   0 Apr 17 09:45 cpuset lrwxrwxrwx   1 root   root   0 Apr 17 09:45 cwd -&gt; / -r--------   1 root   root   0 Apr 17 09:45 environ lrwxrwxrwx   1 root   root   0 Apr 17 09:45 exe -&gt; /usr/local/apache2/bin/httpd dr-x------   2 root   root   0 Apr 17 09:45 fd dr-x------   2 root   root   0 Apr 17 09:45 fdinfo -r--------   1 root   root   0 Apr 17 09:45 io -rw-------   1 root   root   0 Apr 17 09:45 limits -rw-r--r--   1 root   root   0 Apr 17 09:45 loginuid -r--r--r--   1 root   root   0 Apr 17 09:45 maps -rw-------   1 root   root   0 Apr 17 09:45 mem -r--r--r--   1 root   root   0 Apr 17 09:45 mountinfo -r--r--r--   1 root   root   0 Apr 17 09:45 mounts -r--------   1 root   root   0 Apr 17 09:45 mountstats dr-xr-xr-x   6 apache apache 0 Apr 17 09:45 net -r--r--r--   1 root   root   0 Apr 17 09:45 numa_maps -rw-r--r--   1 root   root   0 Apr 17 09:45 oom_adj -r--r--r--   1 root   root   0 Apr 17 09:45 oom_score -rw-r--r--   1 root   root   0 Apr 17 09:45 oom_score_adj -r--r--r--   1 root   root   0 Apr 17 09:45 pagemap -r--r--r--   1 root   root   0 Apr 17 09:45 personality lrwxrwxrwx   1 root   root   0 Apr 17 09:45 root -&gt; / -rw-r--r--   1 root   root   0 Apr 17 09:45 sched -r--r--r--   1 root   root   0 Apr 17 09:45 schedstat -r--r--r--   1 root   root   0 Apr 17 09:45 sessionid -r--r--r--   1 root   root   0 Apr 17 09:45 smaps -r--r--r--   1 root   root   0 Apr 17 09:45 stack -r--r--r--   1 root   root   0 Apr 17 09:45 stat -r--r--r--   1 root   root   0 Apr 17 09:45 statm -r--r--r--   1 root   root   0 Apr 17 09:45 status -r--r--r--   1 root   root   0 Apr 17 09:45 syscall dr-xr-xr-x  29 apache apache 0 Apr 17 09:45 task -r--r--r--   1 root   root   0 Apr 17 09:45 wchan   Cound anyone tell me what it is? Automatic vacuum fails with `ERROR: XX000: cache lookup failed for type 0` I've been noticing something like this popping up every 15 seconds in my server logs:  2020-01-30 21:10:30 UTC::@:[24969]:ERROR: XX000: cache lookup failed for type 0 2020-01-30 21:10:30 UTC::@:[24969]:CONTEXT: automatic vacuum of table "myschema.mytable" 2020-01-30 21:10:30 UTC::@:[24969]:LOCATION: get_typlenbyval, lsyscache.c:2036   When I manually run a VACUUM ANALYZE myschema.mytable; it runs without any error, and the error in my logs goes away. However, inevitably, it returns again at some point.   The table in question is defined as follows:  tfs_dev=&gt; \d myschema.mytable;                                                    Table "myschema.mytable"    Column    |   Type    | Collation | Nullable |                                  Default -------------+-----------+-----------+----------+---------------------------------------------------------------------------  level       | text      |           | not null |  id          | integer   |           | not null | nextval('myschema.mytable_id_seq'::regclass)  text_id     | text      |           |          |  name        | text      |           |          |  geom        | geometry  |           |          |  valid_dates | tstzrange |           |          | tstzrange(NULL::timestamp with time zone, NULL::timestamp with time zone)  adjacent    | integer[] |           |          |  valence     | integer   |           |          |  color       | smallint  |           |          | 0 Indexes:     "mytable_pkey" PRIMARY KEY, btree (level, id)     "mytable_text_id_key" UNIQUE CONSTRAINT, btree (text_id)     "mytable_gix" gist (level, geom, id, text_id, name)     "mytable_spgix" spgist (geom)     "mytable_text_id_ix" btree (text_id, level, id, name) Referenced by:     TABLE "otherschema.othertable" CONSTRAINT "othertable_mytable_fk" FOREIGN KEY (level, level_id) REFERENCES myschema.mytable(level, id)     TABLE "otherschema.othertable2" CONSTRAINT "othertable2_mytable_fk" FOREIGN KEY (level, level_id) REFERENCES myschema.mytable(level, id)   Many other posts with a similar error seem to be about a foreign data wrapper, which is present in this database, but not with this table/schema. Why do we use Root Mean Square (RMS) values when talking about AC voltage What makes it a good idea to use RMS rather than peak values of current and voltage when we talk about or compute with AC signals. C++11: defining function on std::array Is there any way to get real-time compilation for LaTeX? I would really love to have a software or tool which provided real time compilation of my LaTeX document (to be able to see the final pdf or dvi document as I type the latex code), especially for when I am drawing pictures using tikZ. So far, I know of two things, but none of them work for me. They are:   : This is only for tikZ, which would be perfect for me, but unfortunately as far as I know it only works with Ubuntu and Debian, and I use Mac OS X (so I have never actually tried it, though I did dig a lot to see whether I would be able to install on my mac and from what I see it is really what I want - I am even considering installing Ubuntu just to use it!). : This is a minor mode for Emacs. It was extremely hard to get it to work on the mac (see my quest ), and it is not all that fast. The speed is not all that big of a deal for me, but the fact that it does not work with tikZ pictures is (the nodes all collapse in one point so that the words are all one on the top of the other).   So my question is: is there a software ideally like KtikZ or another type of editor which provides real-time compilation and that I can use on my mac? I guess if you know of a Windows/Linux option I would also like to know, and the same for a way to set up a script to get the document compiled every 5 seconds or so (I am sure I have seen this written somewhere, but I don't know whether I can do it with a mac or whether it is editor/pdf viewer dependent), but what I really want is a software/tool which would work with a mac.  To be clear, I am not after something like LyX, that is, I am not after a WYSIWYG-type thing, but rather something where I can type real LaTeX and see my code, but have at the same time another window showing me the pdf (or dvi) file compiled. We have played a 7-team competition, all seven teams met, we eliminated the team with the lowest points. After that the remaining six teams played knock out games and the three winning teams will go direct to semi-finals.  We decided that 4 teams should be picked to go for semi-final and that the best loser will join the other three to make it four teams to battle at the semi-final and final.  During the quarter final games, one team is beaten 2-0, another is beaten 3-0 and the third team is beaten in a penalty shoot-out by 4-0.  Now should you want a best loser to join the other three teams making four teams to play in the semi-final, who among these three teams would be in the best losers position. Unless I missed something key during Descent 1/2, how is it that the Borg are once again a collective? There is a remote Windows server on a private network which I can connect to via Remote Desktop Connection.  I would like to be able to make TCP/IP connections from my computer to other computers on that server's network.  Remote Desktop Connection makes it possible to share printers, drives, and other local resources through the connection.  Is there any way to "tunnel" a TCP/IP connection via RDC?  I'd like something similar to the port-forwarding provided by SSH.  I don't see any way to do this via RDC, but I'm hoping the capability is there and I just don't know about it. Is there any difference between "color" and "colour"? What is the difference between color and colour? What is the difference between a linear and a circular polarizer? When I bought my polarizer, a friend told me that I should get a circular one, because the linear ones can mess with the autofocus. Is this true? What should each be used for?