HNHacker News
TopNewBestAskShowJobs

kwertzzz

153 karma · joined April 24, 2018

submissionscomments
kwertzzz··on Deep Learning Is Applied Topology
Can you give an example where theories and techniques from other fields are reinvented? I would be genuinely interested for concrete examples. Such "reinventions" happen quite often in science, so to some degree this would be expected.
kwertzzz··on Project Aardvark: reimagining AI weather prediction
I am not sure if type K thermocouple are used for meteorological air temperature measurements.

These sensors (based on thermal resistance) for example have an accuracy of 0.2 °C under typical conditions [1].

[1] https://www.ti.com/lit/ds/symlink/tmp1826.pdf?ts=17427997638...

kwertzzz··on Kissing moons may explain why Earth's moon is so large
It would also be interesting to know how the orbits became quite circular afterwards (relative to the common center of mass).
kwertzzz··on Understanding Surrogate Pairs: Why Some Windows Filenames Can't Be Read
> Not to mention that on Linux switching the locale may change the interpretation of filenames as characters, which isn’t the case with NTFS.

If you change the locale to an uninstalled one, then yes. But if the locale is installed, then I don't see a problem.

echo $LANG

# output: en_US.UTF-8

touch fusée.txt

LANG=fr_FR.UTF-8 ls

# output: 'fus'$'\303\251''e.txt'

sudo locale-gen fr_FR.UTF-8

sudo update-locale

LANG=fr_FR.UTF-8 ls

# output: fusée.txt

Are you maybe using non-UTF-8 locale?

kwertzzz··on To buy a Tesla Model 3, only to end up in hell
The article mentions also that the computers are short-circuiting. I guess that you can lose a lot of energy when there is a short circuit. Maybe with an infrared camera, one can get an idea where all the energy is wasted. Apparently the author did check that sentry was not enabled.
kwertzzz··on State of Python 3.13 performance: Free-threading
Sadly, several python projects do not use semantic versioning, for example xarray [0] and dask. Numpy can make backward incompatible changes after a warning for two releases[1]. In general, the python packaging docs do not really read as an endorsement of semantic versioning [2]:

> A majority of Python projects use a scheme that resembles semantic versioning. However, most projects, especially larger ones, do not strictly adhere to semantic versioning, since many changes are technically breaking changes but affect only a small fraction of users...

[0] https://github.com/pydata/xarray/issues/6176

[1] https://numpy.org/doc/stable/dev/depending_on_numpy.html

[2] https://packaging.python.org/en/latest/discussions/versionin...

kwertzzz··on The physics of airplane flight
I was asking myself the same question. I would love to see a derivation from e.g. the Navier Stokes equation for this. I think, intuitively, when you draw the streamlines under the rectangular wings, the applied force should be related to the curvature of the streamlines (which is larger at the beginning of the wing).

I made some simple 2D Navier-Stokes solver here where you can use the mouse to draw a section of a wing:

https://alexander-barth.github.io/FluidSimDemo-WebAssembly/

The color represents the pressure (I should add a proper color bar!)

kwertzzz··on CentOS Linux 7 will reach EOL on Sunday
So we want:

1. free/gratis Linux distribution

2. long support (~ 10 years)

3. not needing to contribute (as a community)

It seems that we can only pick two from this list (even a distribution with short support cycle needs community).

kwertzzz··on Cybercriminals pose as "helpful" Stack Overflow users to push malware
This is true, but you can inspect the package (and its dependencies) once installed and before importing it. Now it is an all manual process (with default tools, as far as I know), which contributes to the current state that only very few people inspect their packages.

It can give people also a second change to notice, e.g. the typo in the package name.

kwertzzz··on Proving Heron’s formula by complex number (2013)
Here is a "Proof of the Law of Cosines" by the same author:

https://www.tandfonline.com/doi/pdf/10.4169/amer.math.monthl...

But this time not with complex numbers.

kwertzzz··on Gnuplotlib: A gnuplot-based plotting backend for NumPy
Can you give an example of its inconsistency?

I would be genuinely interested what are the inconsistency from a Python-perspective.

I am former Matlab/Octave user. To me the julia interface of matplotlib is actually quite nice to use, but unfortunately the installation is a bit brittle.

kwertzzz··on Adam? ... is there a reason your laptop is in the fridge? (2006)
I once had an issue with my LG5 phone who entered in a boot-loop (also a common issue with LG4). I don't have a head gun, so I put it in the mainboard of the cell phone in oven for maybe 10 min at 150°C to reflow the soldering. At least I could reboot the cell phone and copy the important files. But after about an hour, it enter again the in boot loop and was broken for good.
kwertzzz··on Haskell WebAssembly in the Browser
The uncompressed wasm binary for a simple fluid simulation in julia is 5k (or 2.7k compressed):

https://alexander-barth.github.io/FluidSimDemo-WebAssembly/

But here the wasm code does only the number crunching. The visualization (and memory allocation) is all done in javascript.

kwertzzz··on Fortran
Or just use @.

julia> X = [1.,2.,3.]; f=sin;

julia> @. X = f(2 * X^2 + 6 * X^3 - sqrt(X))

kwertzzz··on Fortran
It took me awhile to get used to the dot operator, but what convinced me that it was a good choice is that also your own function can be broadcasted with function_names.(args). For example is you have a function process_a_file(in_filename,out_filename,parameter_value), then you can easily process also a list of files with process_a_file.(in_filenames,out_filenames,parameter_value) (if parameter_value is a scalar it gets broadcasted). I think that it is similar to numpy ufunc's but every function have this possibility.

A useful macro is @. which allows you to write "@. A * B * C" instead of "A .* B .* C". Also the macro avoid the creation of an intermediate vector with A times B.

kwertzzz··on What learning APL taught me about Python
Interestingly most (if not all) python examples also work in julia. Instead of using sum one can also use count, which might be more readable:

julia> count(age > 17 for age in ages)

Or even shorter:

julia> count(ages .> 17)

Under the hood many of the functions are implemented using the reduce function (similar to / in APL):

julia> reduce(+,ages .> 17)

I think many languages in data science have been influenced by APL. But sometimes this influence come from an intermediate language like matlab.

kwertzzz··on Panama Canal draught restrictions spark liner surcharges
On land, I guess we would agree that an oil spill in a pristine rain-forest is worse than a pristine desert.

If you need a quantitative measure, one can use e.g. the number of difference species per area (biodiversity) to know the area where an accident has the least impact. Or maybe the number of endangered species.

Granted, computing these metrics are however quite difficult. However, what is easy to measure from space is the amount of chlorophyll in the surface water of the ocean. Besides coastal areas, the Arctic stands out as relatively chlorophyll rich.

https://commons.wikimedia.org/wiki/File:AYool_SEAWIFS_annual...

kwertzzz··on Building a Lox Interpreter in Julia
I am wondering why the julia lox interpreter is so slow. Could it be that there is a lot of type unstable code or could it be an issue with julia's garbage collector? (I can relate to the comment that it is quite hard to find usable information from julia's profiler).
kwertzzz··on Shell script best practices, from a decade of scripting things
> This died a long time ago with the pervasive use of NPM and PIP and the likes.

When a malicious package is found on NPM or PIP, it will get removed. However, it is quite unlikely that a website will be taken town for a malicious script (or only after a long time).

I really doubt that most readers of HN would run a random script unless it comes from a source they trust (trusted enough to least to remove a malicious script in a timely fashion).

kwertzzz··on JEP draft: 64 bit object headers
Thank you for correcting this! (I get the same numbers as you for a million elements).
kwertzzz··on JEP draft: 64 bit object headers
I would genuinely interested to see how much bytes a HashMap<Integer, Integer> would have in Java (or other languages) for a million entries. If I am not mistaken in julia, this would be 151 MB in julia or 88% more than just storing the keys and values.

     julia> k = Int32.(1:1000_0000);  v = rand(Int32,1000_0000); 
     julia> dict = Dict(zip(k,v));
     julia> Base.summarysize(dict) / (2 * 4 * 1000_0000)
     1.8874391
     julia> Base.summarysize(dict)
     150995128
kwertzzz··on Ask HN: Why is Python package management still a dumpster fire?
As far as I can tell one of the arguments for wheels is that the "Installation of a C extension does not require a compiler on Linux, Windows or macOS"[0]. I also check some scipy wheel file and there are some binary libraries. If it is not via wheels, what would be the recommended way to install packages with C extensions (requiring 3rd party libraries)? To my understanding, this is why anaconda is so popular (despite not being an "official" package manager).

[0] https://pythonwheels.com/

kwertzzz··on Ask HN: Why is Python package management still a dumpster fire?
One solution that I often hear about Python packages is the use of wheels. But I am wondering how this can work when multiple package depend (directly or indirectly) on a C library like zlib. As far as I know, there is no authority that decides which zlib version should be used. So I package A uses zlib.so.1 but package B uses zlib.so.2 can both be loaded at the same time ? (the version numbers are just examples for two incompatible version numbers)
kwertzzz··on From Python to NumPy (2017)
I think the readability issue of vectorized numpy if often ignored (while readability is one of the main strength of python in my opinion). I could not resists to write the example of section 2.2 in Julia:

     using Random, BenchmarkTools
     seq = rand(0:2,10_000); sub = rand(0:2,4);
     # translation of the "readable" but slow python code 
     function_1(seq, sub) = [i for i in 1:(length(seq)-length(sub)) if view(seq,i:i+length(sub)-1) == sub];
     @btime function_1(seq, sub);
     #  93.858 μs (5 allocations: 1.98 KiB)
Which is more than twice as fast as the vectorized (and quite unreadable) python

     %timeit function_2(seq, sub) 
     215 µs ± 1.94 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
Having a JIT (like julia, numba...) has really a bit potential to improve code readability and reduce the need of vectorized numpy operations. In some cases, it can even be faster due to be better memory utilization and by computing more directly what you need.
kwertzzz··on Chinese students at Cornell “taunt” Uyghur classmate
Thank you so much for sharing this.

"And at the same time it is stated on behalf of Chancellor Hilter that these acts of violence [against Jews] by Nazis have been condemned and that official order haves been issued to prevent their recurrence"

Telling X and doing !X is not a recent invention.

kwertzzz··on Starlight.jl – A game engine written in Julia
> I’ve read some Julia source and its an awful experience trying to figure out what method is actually going to get executed because of multiple dispatch.

This is the purpose of the @which macro:

    julia> @which diag(randn(3,3))
    diag(A::AbstractMatrix) in LinearAlgebra at /opt/julia1.7.2/share/julia/stdlib/v1.7/LinearAlgebra/src/dense.jl:249
It gives you filename, line number and function signature.
kwertzzz··on The SymPy/HackerRank DMCA Incident
I would agree that if the course faculty provide significant and non-trival starter code, then publishing the solution would be a copyright violation.

Some DMCA claims do indeed mention "The repository [from the student] contains code provided to complete assignments [georgia tech]" ([1]). But the claim at [2] does not mention this. It only says "This repository contains Georgia Tech class assignment solutions." under the section "Please provide a detailed description of the original copyrighted work".

[1] https://github.com/github/dmca/blob/master/2022/04/2022-04-0...

[2] https://github.com/github/dmca/blob/master/2022/03/2022-03-1...

kwertzzz··on The SymPy/HackerRank DMCA Incident
This list of DMCA take-down at [1] is really extremely long and there are several universities that ask for instance to remove the solution of students' assignments [2]. I am wondering if a university can really claim copyright to a solution made by students and if a breach of "Georgia Tech Honor Code" (for example) is really a copyright issue. From [2] it does not seem that the assignment itself is copied to the repository. Should it be GitHub's responsibility that the students comply with their honor code?

[1] https://github.com/github/dmca [2] https://github.com/github/dmca/blob/master/2022/03/2022-03-1...

kwertzzz··on Help us collect modern Python NumPy code solutions
Would it be useful to add a Julia section?
kwertzzz··on Why We Use Julia, 10 Years Later
The list comprehension in your example is now type-stable without additional type-annotation so you can just write [x^2 for x in xs] and the compiler known that the results is a list of integers (for your example). There have been many improvements of this type in julia over the years (kudos to all who made this happen).
Page 1 of 3Next →