HNHacker News
TopNewBestAskShowJobs

xaedes

1,010 karma · joined November 21, 2014

submissionscomments
xaedes··on Simple test reveals if your mental images are more vivid than other people's
To put things in perspective:

The actual survey result says that most experience simple shapes (60%).

39% saw colors other than red and black.

24% report very vivid colorful and complex images.

25% didn't see anything (answer "No").

(doesn't add up to 100% because multiple options could be selected)

A quick internet search reveals 1-3% of people have aphantasia.

I wouldn't rely too much on the results of this test w.r.t. aphantasia.

xaedes··on GitHub Copilot: Your AI Pair Programmer
I use TabNine for this. It also uses a (probably smaller) language model trained on code and looks at the code in your project for completions. The models are run local by default. They also have a cloud option for bigger models.
xaedes··on Bear plus snowflake equals polar bear
Please not. That would be the tower to Babel. Afterwards we are all just going bla bla and don't understand each other at all, because everyone invents its own funny secret emoji language.
xaedes··on On Comments in Code
By the powers of compilers computers got the ability to read code. To leverage their powers we need to write code which the computer (~ program, aka compiler) understands. I write code for the compiler to read and translate. And yea, also for humans. But not exclusively. The compiler is not a human. It is only made by humans, like the computer.
xaedes··on ALiEn – a GPU-accelerated artificial life simulation program
Reminds me of ParticleLife (for example [1]), which has much simpler, but more random rules. There also emerge lots of interesting organism, but I rarely see replicators.

I used this as inpiration and to learn about Unity ECS and made a 3D version with WebGL support [2]; native builds obviously have much better performance. But it is all CPU-only. Anyway. What I found very interesting is dynamically switching between 2d and 3d. Most organisms survive the dimensional increase or reduction and just reconfigure itself to a similar structure.

[1] https://fnky.github.io/particle-life/ [2] https://particlelife-3d-unity-ecs.github.io/

xaedes··on Rotations with quaternions
You can use bezier splines (https://ibiblio.org/e-notes/Splines/bezier.html). These just use linear interpolation, multiple times. In the case of quaternions replace the linear interpolations with quaternion slerps and you get quadratic bezier splines over orientations.
xaedes··on Rotations with quaternions
When switching target orientation while already approaching one I would use quadratic bezier splines to get a smooth switch (https://ibiblio.org/e-notes/Splines/bezier.html). These just use linear interpolation, multiple times. In the case of quaternions replace the linear interpolations with quaternion slerps and you get quadratic bezier splines over orientations.
xaedes··on Rotations with quaternions
Noooo, I didn't clarify enough.

Represent your axes with the actual angles. These probably correspond to motor position or revolutions.

Use the quaternions only when you want an orientation for these angles.

Maybe you want to know in which direction the PTU is pointing for a particular set of motor positions, or axis angles. Compute the kinematic chain by multiplying the quaternions corresponding to each axis in the order they are physically applied, but multiply from right to left. Your final result is one quaternion representing the direction the PTU is pointing at. (You could also use 3x3 matrices or other representations) Depending on your physical configuration one of the Euler angle variants (Tait–Bryan angles is another term to search for) could perfectly describe your case and you could just use these to store the angles and compute the orientation.

If you don't actually need the final orientation, then you can omit the quaternions altogether.

If you have orientations as input and need to control the motors so the PTUs are pointing in the required direction: I would compute the current orientation of the PTU. Then compute a trajectory of quaternions interpolating from the current orientation to the target orientation (use quaternion slerp for interpolation). Then at each timestep you compute the required motor positions using inverse kinematics [1].

It is a common problem that multiple motor positions are possible and actually an unfinished research problem. Now that I wrote this, I think this might be the problem you are encountering.

For PTU I think it would be ok to try to recover the current target angles from the target quaternions of the trajectory using one of the Euler configurations. There are papers [2] listing all together, so one can try which is correct. Having a configuration chosen there is still the problem of multiple solutions. In this case use the one closest to the actual current angles. For cases when all angles are possible for an axis, use the current angle as target (i.e. motor doesn't change). When you then have an target angle use `wrapToPiSeq` to get an equivalent angle close the current actual angle as input for the motor controller.

[1] https://en.wikipedia.org/wiki/Inverse_kinematics In computer animation and robotics, inverse kinematics is the mathematical process of calculating the variable joint parameters needed to place the end of a kinematic chain, such as a robot manipulator or animation character's skeleton, in a given position and orientation relative to the start of the chain.

[2] In the past I used this (but be careful in which direction they apply the transformations, I stumbled over this): Diebel, J. (2006). Representing attitude: Euler angles, unit quaternions, and rotation vectors. Matrix, 58(15-16), 1-35. https://www.astro.rug.nl/software/kapteyn/_downloads/fa29752...

xaedes··on Rotations with quaternions
I meant when you want to compute the final orientation (lets ignore position): Each axis results in some orientation change which can be expressed as a quaternion. The final orientation can then be computed by combining the quaternions into one quaternion. This is very similar to the computation of forward kinematics (https://en.wikipedia.org/wiki/Forward_kinematics) for robots, which just have additional translations for the transformations.

As said before you still want to retain the actual angles somewhere.

Depending on your physical configuration one of the Euler angle variants (Tait–Bryan angles is another term to search for) could perfectly describe your case and you could just use these to store the angles. Euler angles can also be converted to quaternion. But you can't recover the original used angles from the quaternion alone because of the 2pi wrapping of angles.

For others still wondering why quaternion or orientation alone won't suffice, here is a different example: Imagine an axis which can rotate more than only one revolution, i.e. can have angles like 4 pi, for example motorized volume knobs. An orientation alone can't represent that as it wraps the angles to 2pi. User manually turns the knob to two full revolutions (4pi) and then increases the value by remote control, which results in motorized knob to rotate. Should the knob turn back to nearly zero revolutions (rotate back 4pi) plus the increase? No, it should rotate to 4pi+increase.

By the way, when you have internally stored the "multi revolution" angle and have a sensor reading in range [0..2pi[ you can recover an multi revolution angle equivalent to the sensor reading with wrapToPiSeq( angle in radians before, sensor reading).

  # to equivalent angle in [0,2pi[ range
  def wrapTo2Pi(rad): 
    return rad % (2*pi)

  # to equivalent angle in ]-pi,pi] range
  def wrapToPi(rad):
    return wrapTo2Pi(rad + pi) - pi
  
  # angle difference between rad0 and rad1, in range ]-pi,pi]
  def angleDiff(rad0, rad1):
    r0 = wrapToPi(rad0)
    r1 = wrapToPi(rad1)
    return wrapToPi(r1-r0)
  
  # rad1 to equivalent angle so the jump from rad0won't be greater than |PI|
  def wrapToPiSeq(rad0, rad1):
    r0 = wrapToPi(rad0)
    r1 = wrapToPi(rad1)
    diff = wrapToPi(r1-r0)
    return rad0+diff
xaedes··on Rotations with quaternions
If you have actual, possibly motorized, physical rotation axes to keep track of, then of course you need to keep track of the actual angles of each separate rotation, somewhere.

Compressing it all into one orientation may work for some use cases, but generally one should not expect that. Similarily one wouldn't try to represent all of the axes of a KuKa arm robot with just one orientation. You need info about the individual axes when you want to control it.

Your company can still use quaternions to represent the rotations of each axis, tho. Might help in convincing them going forward, as they don't have to let go of them (they are good fellas actually).

xaedes··on SpaceX ISS Docking Simulator Autopilot in Elixir
Yet another autopilot (in javascript):

https://gist.github.com/xaedes/de252d992dab0ca9c38867197f38f...

xaedes··on There’s no such thing as a tree, phylogenetically
> In a physical system it is related to how many arrangements of atoms/molecules/things there can be that would result in the system being in the state you can see.

Mind if I ask follow-up question, what is a "state"?

Doesn't the entropy change when I change my definition of the state? If I go to the extreme and there is only one kind of state, an actual arrangement of particles, fields etc., the entropy would be the same of each and everything (one possible arrangement per state).

Does that make entropy an entirely subjective measure?

xaedes··on Bugs allowed hackers to dox John Deere tractor owners
For comparison: A regular buck (the animal) may have something around the 160000 kcal.
xaedes··on Show HN: Litmaps – Visual Research Discovery Tool
Pretty amazing! Is there an option to display the articles in "year - title" instead of "author, year" format?

Imho this would give a much better overview over the topics and research itself.

With "author, year" format it feels like a tool to analyse citation networks and how people cite each other; more about the social aspect than about the content of the articles.

xaedes··on Handles are the better pointers (2018)
"pointer is not giving you much information about the availability of the data behind it"

"elaborate on this with an actual concrete example"

The pointer may get invalidated, for example by reallocation of the underlying data structure:

    #include <iostream>
    #include <vector>

    struct ItemPrinter
    {
        int* ptr;
        void print()
        {
            std::cout << (*ptr) << std::endl;
        };
    };

    int main()
    {
        std::vector<int> items{1};
        ItemPrinter foo{&(items[0])};
        while(items.size()<1000)
        {
            foo.print();
            items.push_back(2);
        }
    }
When push_back exceeds the vector capacity, it needs to reallocate and `foo.ptr` gets invalidated.

Output when executed via http://cpp.sh/

  1
  0
  1
  1
  35557904
  35557904
xaedes··on The Asteroid That Killed the Dinosaurs Created the Amazon Rain Forest
Here is another one which relates it to the passing of our solar system throught the galactic plane: "Sun's Movement Through Milky Way Regularly Sends Comets Hurtling, Coinciding With Mass Life Extinctions", 2008

https://www.sciencedaily.com/releases/2008/05/080502092145.h...

``The Cardiff team found that we pass through the galactic plane every 35 to 40 million years, increasing the chances of a comet collision tenfold. Evidence from craters on Earth also suggests we suffer more collisions approximately 36 million years. Professor William Napier, of the Cardiff Centre for Astrobiology, said: "It's a beautiful match between what we see on the ground and what is expected from the galactic record."

The periods of comet bombardment also coincide with mass extinctions, such as that of the dinosaurs 65 million years ago. Our present position in the galaxy suggests we are now very close to another such period.´´

----

Edit: There are also papers which relates it to passing through spiral arms (different cycle).

xaedes··on Fish Doorbell
What a nice idea. I mean one could probably automate the button with machine learning (it just needs to look for fish). But damn, it is wholesome to manually watch and help them.

Here is the link to the live stream with the "door bell" button.

https://visdeurbel.nl/

xaedes··on Icecream: Never use print() to debug again in Python
For one, people not using emacs, or whatever editor it would be, can use it.
xaedes··on You can handle The Diamond with CMake
I like to have a meta project with the root CMakeLists.txt.

In this meta project I either just add_subdirectory all necessary components manually, or I use Findxyz.cmake scripts for each module with that "header guard". They check if target is already defined, if not they add_subdirectory the required component.

For each component (i.e. cmake project) I can then just find_package (module mode) all dependencies and target_link them. Like any other dependency.

For consistency reasons I like to put cmake find modules for all external (installed) library as well and then let the find modules use find_package in config mode for installed libraries, and add_subdirectory for my own components, or for projects I want to include with source and build along with the other stuff. This way I have one point where I can control the source of all dependencies.

Another way would be to just install all components as libraries in the system with proper cmake config files for find_package in config mode. I dont like to clutter my system with all kinds of application specific libraries, so that is not the way for me.

xaedes··on Self-Driving Cars Will Stop for Police, Roll Windows Down, Unlock Doors
“Waymo’s cars are designed to pullover if they detect a police or emergency vehicle flashing from up to 100 feet away. After stopping, the car is unlocked and the windows roll down automatically, allowing Waymo’s support team to interact with law enforcement representatives via an intercom system.”

That sounds like they stop based on visual detection. Makes it a bit too easy to get robbed or worse, doesnt it? A bad actor just has to trigger the right responses and the victim is absolutely unprotected. Not even the car doors will protect.

xaedes··on GPT-3 tries pickup lines
Imagine the bot would be actually good at it and the human on the other side falls in love with it. Only to later find out it was a machine all along. Depending on the mental stability of this human, the results may be devastating. But at least we have a bot that passes a turing test.
xaedes··on The human brain grew as a result of the extinction of large animals: new paper
"convert nuclear fusion directly into food" You mean like plants, fruits and vegetables do?
xaedes··on Milky Way, 12 years, 1250 hours of exposures and 125 x 22 degrees of sky
If we would find a huge natural mirror or similar - far away, maybe we would be able to see our past earth still populated with dinosaurs.
xaedes··on Finding Mona Lisa in the Game of Life
Regarding the speed of GoL itself:

The JAX implementation of GoL he used should be able to do 10 billion cells / second

http://www.bnikolic.co.uk/blog/python/jax/2020/04/19/game-of...

> Speed of execution

> Looking into speed of execution was not a primary goal, but in case people are interested initial: study suggests this code will do about 10 billion cells / second on the Google Colab GPU runtime.

For comparision this simple numba optimized GoL propagation function achieves roughly one billion cells per second on CPU (i7-9700K):

    @numba.jit
    def propagate_jit(arr, result):
        h, w = arr.shape

        for y in range(1,h-1):
            for x in range(1,w-1):
                result[y,x] = arr[y,x]
                num_neighbors = (
                    arr[y-1,x-1] + arr[y-1,x] + arr[y-1,x+1] +
                    arr[y,x-1] + arr[y,x] + arr[y,x] +
                    arr[y+1,x-1] + arr[y+1,x] + arr[y+1,x+1]
                )
                if num_neighbors == 3:
                    result[y,x] = 1
                elif num_neighbors < 2 or num_neighbors > 3:
                    result[y,x] = 0

    arr = np.random.randint(0,2,(700,480))
    arr2 = arr.copy()
    %timeit propagate_jit(arr, arr2)
    # 333 µs ± 2.64 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
    700*480*1e6/333
    # 1009009009.009009
Btw: The not numba optimized implementation will run in 806ms on my system. The optimization gives a speedup of over 2400.
xaedes··on The Global Population Crisis That Never Was
> How do the "Precursors" get around evolution?

One way would be to apply selection pressure over time and let the people experience "numerous tribe-ending disasters" as one other commenter said. Then there is no need for these "Precursors" in this theory, it could very well just be all natural.

xaedes··on A fake company to play around with spammers and you can use it too
"The benefit of this is that you won't have to chase people, or go from one person to another to find someone who can help you."

Brilliant

xaedes··on Ask HN: Why aren't you coding?
I was in one of these for a few months. Strangely enough, changing all my editors color schemes from darkmode to whitemode helped me to overcome it. Over time I went back to darkmode for the most part.

Maybe it is similar to working from a different place? (e.g. coding sitting in park instead of the same old office day-in day-out)

xaedes··on First 3-D-printed rib-eye steak is unveiled
Maybe it is just the paywall, but the washingtonpost article only gives me a few words.

Here is an actual article with more info about this.

https://alephfarms.medium.com/aleph-farms-and-the-technion-r...

---

edit: turns out it was the paywall, here it is from google cache

https://webcache.googleusercontent.com/search?q=cache:RAyAsX...

xaedes··on The visitor pattern is essentially the same thing as Church encoding
Python:

    import math

    def Circle(x, y, r):
        return (lambda visitCircle, visitRectangle : visitCircle(x, y, r))

    def Rectangle(x, y, w, h):
        return (lambda visitCircle, visitRectangle : visitRectangle(x, y, w, h))

    def area(shape):
        return shape(
            lambda x, y, r    : math.pi * r * r,
            lambda x, y, w, h : w * h
        )

    exampleCircle = Circle(2, 1.4, 4.5)
    exampleRectangle = Rectangle(1.3, 3.1, 10.3, 7.7)

    print(area(exampleCircle))
    print(area(exampleRectangle))
    # 63.61725123519331
    # 79.31
xaedes··on WhatsApp loses millions of users after terms update
Getting into matrix is kinda hard. The whole website is full with tech jargon. The presentation needs to be MUCH more user friendly.
← PreviousPage 5 of 17Next →