News for hackers. Stuff that matters.

kwertzzz

Re:Deep Learning Is Applied Topology on Tuesday May 20, 2025 @10:53AM (#44042320)
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.
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...

Re:Kissing moons may explain why Earth's moon is so large on Tuesday March 11, 2025 @07:30AM (#43331405)
It would also be interesting to know how the orbits became quite circular afterwards (relative to the common center of mass).
> 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?

Re:To buy a Tesla Model 3, only to end up in hell on Monday February 10, 2025 @04:16AM (#42998384)
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.
Re:State of Python 3.13 Performance: Free-Threading on Wednesday November 06, 2024 @03:34AM (#42058119)
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...

Re:The Physics of (Airplane) Flight on Monday July 01, 2024 @04:00AM (#40843544)
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!)

Re:CentOS Linux 7 will reach EOL on Sunday on Monday June 24, 2024 @09:54AM (#40776099)
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).

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.

Re:Beautiful Proof of Heron's Formula on Monday April 15, 2024 @07:15AM (#40039000)
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.

Re:Gnuplotlib: Non-Painful Plotting for NumPy on Thursday February 01, 2024 @04:27AM (#39214136)
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.

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.
Re:Haskell WebAssembly in the Browser on Monday September 25, 2023 @04:59AM (#37641098)
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.

Re:Fortran on Monday August 28, 2023 @03:23PM (#37299170)
Or just use @.

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

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

Re:Fortran on Monday August 28, 2023 @03:18PM (#37299115)
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.

Re:What Learning APL Taught Me About Python on Thursday August 17, 2023 @04:22AM (#37158698)
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.

Re:Panama Canal Draught Restrictions Spark Liner Surcharges on Wednesday August 09, 2023 @01:43AM (#37059085)
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...

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).
> 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).

Re:JEP draft: 64 bit object headers on Tuesday October 11, 2022 @09:10AM (#33162921)
Thank you for correcting this! (I get the same numbers as you for a million elements).
Re:JEP draft: 64 bit object headers on Tuesday October 11, 2022 @06:14AM (#33161485)
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
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/

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)
Re:From Python to NumPy (2017) on Friday June 10, 2022 @06:41AM (#31692257)
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.
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.

Re:Starlight.jl – A game engine written in Julia on Tuesday June 07, 2022 @05:19AM (#31651725)
> 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.
Re:The SymPy/HackerRank DMCA Incident on Thursday April 28, 2022 @08:24AM (#31191635)
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...

Re:The SymPy/HackerRank DMCA Incident on Thursday April 28, 2022 @04:40AM (#31190132)
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...

Older »