Wikipedia:Reference desk/Archives/Computing/2014 November 7

= November 7 =

The IANA, port 456, macon-tcp, and macon-udp
My question concerns the following two edits:

When I saw what looked like a normal vandalism revert on my watchlist, I looked into it. To my surprise the Internet Assigned Numbers Authority (IANA) has macon-tcp and macon-udp assigned to port 456. News to me. I would have reverted the apparent vandalism myself.

The obvious next step is to figure out what macon-tcp and macon-udp are and see what reliable sources say. I am having a heck of a time finding anything at all other than the bare fact that the IANA) assigned macon-tcp and macon-udp to port 456. Can anyone find anything on those services?

In the back of my mind I keep thinking that I may have used those names as non-public UDP/TCP placeholder values on a long-ago engineering project. I am really hoping that my temporary names didn't somehow leak out and get assigned... --Guy Macon (talk) 03:27, 7 November 2014 (UTC)


 * The IETF is a reliable source, and they publish an authoritative Service Name and Transport Protocol Port Number Registry. The contact for those 'macon' ports is listed as an anonymous Yoshinobu Inoue, with no contact information published, although he shows up in other IETF documents as an engineer from Fujitsu.
 * I can find other publications by that author - including the IPv6 Developer's Handbook for FreeBSD, but nothing mentions the macon tcp/udp protocol. You could email him to ask why he is listed as the contact in the IANA / IETF registry.
 * Nimur (talk) 04:07, 7 November 2014 (UTC)

Plotting with matplotlib, problem with legend, how to use proxy artist
I am trying to re-plot: https://en.wikipedia.org/wiki/File:Poisson_pmf.svg I am using Python 2.7, and have a problem at the "bx = plt.legend(A, " part. Trying to run it like that produces the error message: "/usr/lib/pymodules/python2.7/matplotlib/legend.py:613: UserWarning: Legend does not support [] Use proxy artist instead.

http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist

(str(orig_handle),))"

Trying to solve the problem, I went to the docs:

"Using Proxy Artist When you want to display legend for an artist not supported by matplotlib, you may use another artist as a proxy. For example, you may create a proxy artist without adding it to the axes (so the proxy artist will not be drawn in the main axes) and feed it to the legend function.: p = Rectangle((0, 0), 1, 1, fc="r") legend([p], ["Red Rectangle"])"

So, I adapted the script above, removing A and introducing: c = [plt.Circle(1, fc=col[1]), plt.Circle(1, fc=col[4]), plt.Circle(0, fc=col[10])]

However, this does not depicts the legend icons as circles, but as rectangless, although the color is right. How can I solve this problem? Whatever I do, the colored element in the legend are depicted as rectangles, and not circles. --Senteni (talk) 17:46, 7 November 2014 (UTC)


 * Believe it or not, the solution is not to use a proxy-artist (i.e., not to replace A with c and draw circles). While that's a viable work-around, it doesn't actually address the code bug; and what you're actually doing is actually creating a legend for something else that you didn't really draw in the real, visible plot.
 * The "correct answer" is (cryptically) to insert a mysterious comma earlier in your code!


 * Let's break this down. When you assigned the result of pyplot.plot to variable a, you actually set a equal to a Python tuple that contains the plot in the form of a list of plots.
 * The "legend" drawing function doesn't support a python tuple that contains a matplotlib.lines.Line2D. It actually needs a bare matplotlib.lines.Line2D object - not one that's wrapped inside a list.
 * Now, if we were blindly accepting of the first code that a search-result turns up, we'd be promulgating bad code across the rest of internet. So here's an even better solution that doesn't gratuitously add a mysterious and cryptic comma:


 * ... and I think that makes what we're doing a lot more obvious.
 * I mean, inserting a random comma (without understanding why) is a fascinating case of genetic programming: if we had an infinite number of monkeys inserting random characters at random locations into your source-code, and checking if "it got fixed," how long would it take before the code worked?
 * Nimur (talk) 19:29, 7 November 2014 (UTC)


 * I think it's better to write a, = foo(...); A.append(a) as in the original example, because it makes it clear that you expect the function to return exactly one line, and anything else will produce a runtime error so you can track down the bug. a = foo(...); A.append(a[0]) silently discards any unexpected values, and, worse, makes it look like that's what you intended to do. -- BenRG (talk) 03:30, 8 November 2014 (UTC)

ProBoards page numbers (the sequel)
Referring to this topic, I described what I was wanting to know to the people who answer ProBoards questions, and it took some effort from them to finally get the idea of what I expected. Here are the two answers I got:

It is really just that. There is a code to check where you have scrolled to on the page. Once you reach a scroll point where you have gone past where the pagination page initially sits on the page, an absolute positioning attribute gets added to stick it to the top of the page. It's not really software so to speak, just, as you mentioned before, CSS and Javascript [ jQuery ].

Fixed positioning, not absolute positioning. But the rest is right. :P

— Vchimpanzee  •  talk  •  contributions  •  19:37, 7 November 2014 (UTC)

Operations on a range in Excel
In Microsoft Excel (2013), you can perform operations on rows and also on columns. For example, I can total up (add) all of the numbers in a specific row (or in a specific column). Is it possible to perform a function (let's say, addition) for a range that includes both rows and columns? For example, let's say that I want a total of all of the values in the range from Columns A, B, C, D, and E and Rows 1, 2, 3, 4, and 5. So, that would be a "rectangle" of 25 values in 25 different cells (A1, A2, B1, B2, ... D4, D5, E4, E5). How can I total up all of the values in those 25 cells? Thanks. I am asking for a "one-step" formula. I already know that I can total up Column A, then total up Column B, and so forth with Columns C, D, and E ... and then add up all those five totals. But, I'd like to know if there is a single one-step function (as opposed to a combination of several functions with several steps) that will give the result I want? Thanks. Joseph A. Spadaro (talk) 20:04, 7 November 2014 (UTC)


 * Can't you specify a 2 dimensional range?

=SUM(A1:E5)
 * works fine in LibreOffice Calc, so I think it should in Excel too. -- Finlay McWalterᚠTalk 21:51, 7 November 2014 (UTC)


 * Hmmmmm. Never tried that.  Let me see if it works.  Thanks for the tip.    Joseph A. Spadaro (talk) 22:07, 7 November 2014 (UTC)


 * Yes, that works perfectly! Thanks!  Exactly what I was looking for.   Joseph A. Spadaro (talk) 22:10, 7 November 2014 (UTC)