Show newer

@lupyuen

The issue here is not that Javascript can respond to events -- that's a useful feature. The problem is that JavaScript has access to the clipboard. When did they add that feature? Who's numb-skull idea was that? Can they read the clipboard as well? That'd be a huge security issue as well.

I can see no legitimate purpose to allowing JavaScript on a web page to have access to the clipboard.

@Acer

There are no value indicators on the y-axis, so we don't know if the bottom of the chart is zero or if the chart actually shows a narrow price range. The volume indicator shows an increase in volume at the time of movement and at other points before and after the movement, however, that also it difficult to judge because the chart is only for a few days so we can't tell if that volume is typical for that stock.

Where did this chart come from? Did you create it yourself?

"Any questions, gentlemen?"

A short clip from "Beyond the Time Barrier" (1960)

My Answer (spoilers) 

@mc

OMG!

I wanted to do a really inefficient one using BASH string parameter expansion, but you already got me beat with that one.

@Acer @Xiaopang

Honk is also what is done to a horn.

adj. horny

Which ties in with ky and xxx.

But don't ever use honk as an adjective.

My Answer (spoilers) 

@mc

Just for fun here's a solution in BASH...

n=0;for ((i=1;i<=1000;i++)); do n=$((n+(i*(i+1)/2)));echo "$i - $n";done

Prints the solution for the first 1000 days.

BASH has exponentiation (**) but this shows to how it would be done without it -- (n^2+n)/2 becomes n(n+1)/2.

Again, I'm sure there must be some shortcut for this, but I can't figure one out.

Also, I looked up "arithmetic progression" and this doesn't fit the definition (each number differs by a fixed amount). It looks like an exponential function or maybe an "arithmetico–geometric sequence".

My Answer (spoilers) 

@mc

I guessed it was some kind of series that was likely well-known to mathematicians, but the term "arithmetic progression" didn't come mind at all. Now that you've said it, yeah, it's a progression and it's additive (arithmetic), so it makes sense.

As I said, I'm not a math person. My last algebra class was when Nixon was still in office! I'm surprised I even remembered how to do the simple algebra in that solution.

You're forgiven, of course.

Have a happy new year.

My Answer (spoilers) 

@mc

>"when I execute the line it stalls indefinitely."

AWK is designed to mostly process text, either from a file or from stdin (standard input). It's a text stream processor.

If you specify a file name, it takes input from that file; if you don't specify a file name, it takes input from stdin. As it's presented in the toot, there is no file name so it takes input from stdin, in this case from the keyboard.

So when it "stalls" just enter numbers in your keyboard and it will spit out the answers.

You can also specify a list of numbers (one per line) for input in a file like this:

awk ‘n=0;{for (i=1; i<=$1; i++) n=n+(i^2+i)/2;print n}’ numbers.txt

and it will spit out the answers for all of the numbers from the file "numbers.txt". The "$1" in the code is the parameter for the first input field of a line from the input -- in this case just the one field, the number you input from stdin.

(For what AWK was designed for, I'm surprised it had an exponent function.)

Explanation (spoilers) 

****** Spoiler *****

The rhetorical issue with this is that the words "speed" and "electricity" are are imprecise terms.

Usually the word "electricity" is referring to the electromagnetic signal or wave that flows through the wires, not the actual charge carriers -- especially in the context of telephone wires.

The word "speed" is not accurate because when we say "speed of electricity" we're usually referring to the *velocity* in a direction along the wire.

So, most people reading the statement would think that it's referring to the signal velocity (or wave velocity, or field velocity) which is typically on the order of about 50%-90% of c, depending on the type of wire.

However, the electrons in the wire actually move, on average, very slowly along the wire, about 1mm per second or slower. This is the drift velocity of the electrons.
(Also, each individual electron moves on it's own in mostly random directions within the wire, which is a much higher speed than the drift velocity.)

So "the speed of electricity" can be interpreted as the drift velocity, which is very slow.

Another rhetorical gimmick was that the statement said, "less than 5% of the speed of light" which seems to imply that the speed being referred to is very fast, which it is not. It's referring to the drift velocity.

So the statement in the toot is technically true, because 1mm/s is slower than 5% of c.

c = speed of light in vacuum
DC = direct current
AC = alternating current

Show thread

@trinsec

>"I guess that counts for most things."

Maybe.

At the macro level that's true, but things are composed of other smaller things. The small things often travel at relativistic speeds; photons, quarks...

I'm not sure how many of each elemental particle there is in the universe or what speeds they all typically travel at, but it may be that most things travel near the speed of light.


The truth is...

The speed of electricity through a copper telephone wire is less than 5% of the speed of light.

= A statement that is logically or literally true (or partly true), but seems to imply something that isn’t true or is just plain weird. (for rhetoric, logic or propaganda studies… or just for fun)

(photo Attribution: Rembert Satow, wikimedia commons File:Birds_on_telephone_wires_at_Beeston,_Nottinghamshire.jpg)

My Answer (spoilers) 

@mc

Here's the solution in awk:

awk 'n=0;{for (i=1; i<=$1; i++) n=n+(i^2+i)/2;print n}'

I don't know if there is a mathematical shortcut for the whole function -- I couldn't figure one out. But I did figure out a shortcut for the summation of a sequence of numbers...

If you add the first and last numbers in the series, you get 1+n. The same for the second number plus second to last number, etc., because they increment/decrement respectively. If you keep going, you meet in the middle of the sequence -- half way. So, the sum of all the numbers is the same as n+1 multiplied by half the number of numbers in the sequence, or (n+1)(n/2). I tested it and it works with an odd number also. A little algebra, (n+1)(n/2)=(n^2+n)/2. (I also found this on the internet, so I know it's right.) If you write it using a language that doesn't have an exponent function, you could just use (n+1)(n/2). (In fact, that might be more efficient/faster, I didn't test it.)

So, using that shortcut, it's just a simple loop to "sum the sums". If you use a language with a summation function it would be even easier.

Without the shortcut you got to nest loops or use an array or something.

(ps - I'm not really a programmer, i.e., I don't do it for a living, but I answered the "call" anyway.)

@freemo

There's an asterisk at the bottom of the page...

"* Former presidents are not exempt."

@mc

I first went to Mathlab, but then thought it would be more fun to use something completely unsuited to the task, like AWK or BASH.

Are you looking for code for a function similar to the hard-coded solution in your example, or are you looking for some kind of mathematical shortcut using factorials or calculus or something?

(I'm not a math gal but I'm sure this must be a well-known series in mathematics, with the name of some old mathematician tacked on to it.)

@trinsec

I'm reading about it just now...

The book was published in 1982, the film 1989, way past my time of an age to be concerned with children's stories.

Show older
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.