Better HN
topnewbestaskshowjobs
Log inSign up

gp7

180 karma · joined Jan 3, 2015 (11y ago) · 74 submissions

Submissions

comment 3y ago · link · parent

Very good youtube channel, if anyone is wondering

comment 6y ago · link · parent

A nice example of Japanese stroke order mattering are two of the katakana, ツ and シ. The difference is that the former starts at the top left and the strokes move right, then down and across to the left. The latter starts at the top left and moves down, then up and across to the right. It can be hard to tell what one you are looking at in practice if you don't know this.

I think cursive used to serve the same function, which I basically conjecture from the fact that older people tend to be significantly better at reading cursive than me.

comment 6y ago · link · parent

Fun book.

"When mass produced, the cost of self-tuning options will be small compared to the price of a quality piano. You might think that this would put piano tuners out of work but that will not be the case because the number of pianos will increase (because of this book), ..."

That's confidence in the method, right there.

comment 7y ago · link · parent

Steam only hosts the code incidentally. It manages your licenses. This is a big difference, and it's one publishers are free to work around if they wanted to.

comment 7y ago · link · parent

When you write like this a lot, you end up talking like it, too.

comment 7y ago · link · parent

The claim isn't never--it's for installing a small set of apps that you don't change for more or less the entire lifetime of your device.

comment 7y ago · link · parent

Sorry, I'm not accusing you of anything. By strided accesses I mean when you access elements of an array sequentially using some step size. Think loops with `i += stride` instead of `i++`. In the wikipedia pseudocode this is done implicitly using the 's' parameter. Notice that, in the version you implemented, you split the input into even and odd parts explicitly; you can achieve the same end by accessing the input array in a certain order as you are performing the mathematical operations. This is what the wikipedia pseudocode does. If you've seen other versions of the FFT with a bit reversal step, this is also where that comes in.

Check this out (javascript):

  function permute1(x) { 
      if (x.length == 1) return x;
      let even = [];
      let odd = []; 
      for (let i = 0; i < x.length; i += 2) { 
           even[i / 2] = x[i];
           odd[i / 2] = x[i + 1];
      }
      return [].concat(permute1(even), permute1(odd));
  }

  function permute2(x, offset, stride) {
      if (!offset) offset = 0;
      if (!stride) stride = 1;
      if (stride >= x.length) return [x[offset]];
      return [].concat(permute2(x, offset, stride * 2), permute2(x, offset + stride, stride * 2));
  }
  
  function permute3(x) {
      let result = [];
      for (let i = 0; i < x.length; i++) {
          let k = i;
          // pretend 32-bit ints
          k = ((k >> 1) & 0x55555555) | ((k & 0x55555555) << 1);
          k = ((k >> 2) & 0x33333333) | ((k & 0x33333333) << 2);
          k = ((k >> 4) & 0x0F0F0F0F) | ((k & 0x0F0F0F0F) << 4);
          k = ((k >> 8) & 0x00FF00FF) | ((k & 0x00FF00FF) << 8);
          k = ( k >> 16             ) | ( k               << 16); 
          k = k >> (64 - Math.log2(x.length));
          if (k < 0) k += x.length; // fix up due to signed ints
          result[i] = x[k];
      }
      return result;
  }
For arrays with power of two sizes, these perform the same permutation (but fail differently for non power of two sizes). Note that, with permute1, we effectively iterate over the entire input log2(n) times, so this is an O(nlogn) algorithm!

edit: also, i think i may have misunderstood the relationship between your js version and your lambdatalk version. They seem to be the same to me?

comment 7y ago · link · parent

You copy rather than use strided accesses. It's the same algorithm.

comment 7y ago · link · parent

The code is mostly equivalent to the recursive form found in the wikipedia article on the cooley-tukey algorithm. This is a good one to learn from, as its not only a simple formulation but it forms the basis of modern optimised FFTs such as FFTW (source[1], from the authors of FFTW).

As an aside, I also find the non-recursive, breadth-first, form easy to derive thru a process of code transformations of the depth-first form; explanations that start breadth-first are somewhat bewildering

[1] https://cnx.org/contents/ulXtQbN7@15/Implementing-FFTs-in-Pr...

comment 7y ago · link · parent

Just a run of the mill human interest story about the checks notes CIA????

comment 7y ago · link · parent

For people who are eager to think this is a don't-assume-gender charade: try misgendering a cis person next time you're out, and see how much they don't care. _You_ are who this is for

comment 8y ago · link · parent

Mozart had extensive education and training????

comment 8y ago · link · parent

> 4. Teach Changes of Variables

As someone who has basically no formal training in mathematics outside what's required for undergraduate computer science this is a big one. The first time I saw it I was blown away. Everyone who knows of it seems to treat it as natural as breathing, and not worth the exposition

comment 8y ago · link · parent

Two years after this post, the Linux kernel added strscpy, the api of which is equivalent to the safe strncpy in this post. Internally, it stops copying once it reaches the null terminator.

https://lwn.net/Articles/659214/

comment 8y ago · link · parent

My experience with notebooks matches the one presented here. For me the most disappointing thing is that notebooks are JSON, and not just marked up .pys. The cons of this decision outweighs the pros for me.

One thing though--one of the best books I've read, Trefethen's ATAP, was written as a collection of .m files, which when run would produce a pdf of each chapter. The .m files were filled with small formatting details that were simply omitted from the generated book. The slides suggest something equivalent is not possible with notebooks. That's unfortunate.

comment 8y ago · link · parent

Well, there was the Manhunt games, which always represented the worst side of Rockstar North to me.

comment 8y ago · link · parent

That’s fair, but my assumption was that someone reading my reply would also have read the others, and I didn’t want to repeat what has already been said.

comment 8y ago · link · parent

Time signatures are about writing and reading music. A beat being in 3 or 6 is independent from the time signature, which is whatever the transcriber thought best (you can always count a song in 6 in 3.) A piece in 4 might have pervasive use of triplets, so it would make it more readable to notate in 12/8 rather than 4/4, but there is no triplet-pervasiveness threshold for when to prefer one over the other. Likewise, it would be foolish to have the stress in a waltz occur on the 1st and 4th, then 3rd, then 2nd beat of the bar (this happens if you notate one in 4), but any enterprising composer would be able to thwart any rules you cared to come up with to codify that without much effort.

So: the time signature just describes how many times to count within a bar/measure, and what subdivision (that corresponds to a certain notation) you are counting. For communicating to another musician the rhythm of a song you'd just drop the subdivision part, because it's only relevant to notation.

comment 8y ago · link · parent

Bizarre. This is coming from someone presumably embedded in the grant-writing machine that is modern academia. How do grant proposals justify their cost, exactly? Academia would be healthier if some back slaps at the next conference was all it took I think

comment 8y ago · link · parent

I'm clever and stupid.

comment 8y ago · link · parent

Reverb of a static room at a point is as simple as that. Rooms with moving obstructions, with moving noise generators, at moving points, that's harder.

comment 9y ago · link · parent

I can't quite describe it but the use of #F00 just looks wrong to me. Over saturated somehow

comment 9y ago · link · parent

https://fgiesen.wordpress.com Most of his posts end up on the first page of hn. In fact there is one right now

http://nullprogram.com/ makes C look fun

comment 9y ago · link · parent

I've had on/off problems for a couple years now with a usb powered audio interface (focusrite 2i2) causing popping sounds from speakers--recognisable as a DC thump but happening every few hours. Once I fixed it by using a powered usb hub, but a change in PC hardware made it come back. Eventually I found a support post from the manufacturer saying that you had to use the provided USB cable, and that others weren't supported. I'd changed mine for ergonomic reasons (it's short as hell) and this turned out to be the problem.

I've been wanting to know exactly what's different about the usb cable for a while. And if other devices expecting a standard cable might have problems using it.

comment 9y ago · link · parent

C++'s rng is bad because it's very easy to set them up incorrectly, and people mostly do. See http://www.pcg-random.org/posts/cpp-seeding-surprises.html

comment 9y ago · link · parent

Compile time is a huge factor in maintainability!

comment 9y ago · link · parent

I'm glad to hear I'm not the only person who's shot themselves in the foot by following apt-gets recommendations

comment 9y ago · link · parent

Drudge is tweeting about this. Notable because it's apparently the only thing he's ever tweeted about and was simply:

  ROGER AILES DEAD

comment 9y ago · link · parent

This page crashes my chrome tab!!

Anyway, anyone interested enough in this to be reading this comment thread should go look up approximation theory and approximation practice by trefethen [0], which is a very very good book, that covers chebyshev polynomials in a very clear way. The real party trick you get out of it, though, is that by taking samples of functions at the roots of chebyshev basis polynomials and applying the discrete cosine transform, you can get a set of chebyshev coefficients to approximate a function in O(n log n) time

[0] https://people.maths.ox.ac.uk/trefethen/ATAP/

comment 9y ago · link · parent

I made the fairly stupid mistake of shadowing the x-as-input and the x being integrated over in this post, but the gist is similar
123