Skip to main content

bazkie 👩🏼‍💻 bitplanes 🎵 reshared this.


Nothing makes you hate cars more than living on a busy street, forced to listen to their din day in and day out. >:(

Cities Aren't Loud: Cars Are Loud — Not Just Bikes

Urban noise is a common problem, and the vast majority of it is created by motor vehicles. Noise is far too often dismissed as a minor nuisance, rather than the legitimate health issue that it is.

The book "Curbing Traffic" has a chapter about the health impacts of noise pollution. I explore the research in the book, and visit Delft, the city that is highlighted in the book as being a shining example of what can happen when noise pollution is taken seriously.

This video explores the problem that farting cars, farting motorcycles, and farting mopeds create in our cities.

#FuckCars #urbanism

in reply to Neil E. Hodges

every time I contemplate "upgrading" the stock exhaust on my bike, I remember it's already louder than a car exhaust.

Most car exhausts, anyway. Not the M3 that my neighbour across the road drives.

in reply to Neil E. Hodges

The last place I lived was originally on a country road and was generally pretty quiet. But growing up population of the nearby city meant more and more traffic, and subdivisions (one was which ended up against my back property line). By the time I moved, the area had become solidly suburbia and the road became a major secondary road and quite noisy

bazkie 👩🏼‍💻 bitplanes 🎵 reshared this.


From here:

There is no 'free' market, and there never has been. The 'free' market is predicated on the belief that all players will act honestly, and make informed choices based on available information. This is a completely false assumption, and has been proven so time after time.

It completely ignores human nature whereby someone will always lie, cheat, and steal to achieve their own ends -- this is what we see here.

Industry players will always form cartels and collude in anti-consumer behavior -- price fixing being the prime example.

Without someone to keep corporations in line, the market would steadily skew to all of the power being in the hands of a few.

There is no such thing as a 'free' market, and there simply never has been. It's a utopian myth which can never be true.

People who go around spouting about the 'free' market are either naive, self deluded, or actively lying.

#capitalism

in reply to Neil E. Hodges

damn, so we've had 11 years of this very thing getting worse.

when will people get it?! people keep voting for these pro corporate parties and it's depressing

in reply to bazkie 👩🏼‍💻 bitplanes 🎵

Said parties have both rigged it to be this way and have convinced the people that this is the only way it can ever be. :(
in reply to Neil E. Hodges

well, the same is happening here in the Netherlands. people have been voting the neoliberals into power for decades, despite things going to shit, and other parties being available here.

it's the propaganda that's working; most people still believe that free market capitalism is great, and it will take a lot more downfall before they understand it's shit.

Neil E. Hodges reshared this.

in reply to bazkie 👩🏼‍💻 bitplanes 🎵

@bazkie same in UK, but I think its also because neoliberalism provided short term gains - a young adult working in the skilled trades or the remaining middle level office jobs which exist and haven't been outsourced/replaced by AI can afford to get a used Audi on finance and just about run it - they get scared of green/left parties as they think "tax will go up and petrol will be £2/2€ a litre again" and that's a powerful paranoia (especially if they are in a long term relationship and have now got kids to feed/fund through school)
in reply to bazkie 👩🏼‍💻 bitplanes 🎵

@bazkie about 10 years ago when I had learned just enough Dutch to read sites where younger folk hung out (and chat to them) I learned a fair few thought all the bicycles, good public transport (which folk in UK often envy!) and the high cost of learning to drive (which is same as UK) was imposed by "big government/EU" and they wanted to have cars just like young people in UK, enjoyed watching Top Gear and thought folk in UK and USA had more "freedom" (and those youths would be 30-40+ by now, many with families of their own)

At least you are highly unlikely to get Nexit as everyone can see the mess the UK is now in 5 years later..

in reply to Alex@rtnVFRmedia Suffolk UK

@vfrmedia UK has been a lovely warning sign for us indeed!

..tho people have been voting far right the past few years despite Trump, so maybe most people don't really understand warning signs 😅

and about that dutch youth; keep in mind we've had neoliberal rule for decades now, so the whole "free market good, nationalization bad" has been really hammered in.

not sure if we'll get rid of it in my lifetime tbh. but most of the lovely social policies we have left stem from the more progressive governing we had before I was born 😅

btw why did you learn dutch? (maybe I asked before)

in reply to bazkie 👩🏼‍💻 bitplanes 🎵

@bazkie I moved to Suffolk, which is not /that/ far from the Netherlands (especially at the point of Lowestoft which is the furthest Eastern part of England) and has many cultural and trade links with NL, also I am a former radio pirate and was always curious about the pirate radio scene there and started listening to the stations and wanted to learn the language (piratenzenders are quite surreal, with 3 different languages of music and songs which are a mix of synthpop/disco, country and western and seashanties 😁 )
in reply to Alex@rtnVFRmedia Suffolk UK

@vfrmedia ohh right I think you mentioned that before! those piratenzenders sure are something else :D it's funny how it combines, eh, "rural culture" with everything else!
in reply to Alex@rtnVFRmedia Suffolk UK

I love pirate radio!

I don't know if it's actually a pirate station, here's an FM broadcaster near Quinault Lake here that plays all kinds of odds and ends with weird stuff in between. It might fall under LPFM, but I doubt the FCC would hassle them anyway since it's in the middle of nowhere and low power.

in reply to Neil E. Hodges

@vfrmedia what's LPFM?

I wonder if maybe the FCC is a bit more relaxed these days since people listen to FM radio less (or well, I imagine that they do)

in reply to Neil E. Hodges Neil E. Hodges reshared this.

the "free market" is to economics what the frictionless spherical cow is to high school physics.

The very existence of corporations means there is no free market. Corporations are a legal construct of governments that grants a business (and later even a mere collection of assets) status as a district entity separated to some degree from the owners and workers within.

As such, there is no choice between "government vs corporations" because they are *two sides of the same coin*...it is all one big hegemony.

We have all been thoroughly conditioned to think otherwise for a couple of centuries now. It is thoroughly ingrained the minds of everyone in the "free world" that corporations are the capitalist free market and government is the socialist planned economy but that is pure BS.

The biggest economies in the world have arrived in the same place from two different directions...the US being a corporatocratic regime and China practising state capitalism.

As such deregulation just means re-regulation.


in reply to Neil E. Hodges

≠ PHYSICAL REMOVAL WILL BE REQUIRED ≠ is ignored

Neil E. Hodges doesn't like this.



Found something interesting out the hard way. #Python
from string import Formatter

a = 0
b = 1

print(f"{a or b}")  # Works
print("{a or b}".format(a=0, b=1))  # Does not work
print(Formatter().format("{a or b}", a=0, b=1))  # Does not work
in reply to Neil E. Hodges

Makes sense, but I definitely see the potential for confusion there!


The #Python standard library sure is something. :P #programming

(This is in the types module.)

try:
    raise TypeError
except TypeError as exc:
    TracebackType = type(exc.__traceback__)
    FrameType = type(exc.__traceback__.tb_frame)
This entry was edited (1 year ago)

Tech Cyborg reshared this.


Neil E. Hodges reshared this.


I used to love #Python, but dealing with the honestly kind of scary #multiprocessing library was a reminder of the #GIL #threading situation really hurts working with #parallelism. 😰🫠

I've started learning #Kotlin after honestly really enjoying the threading library it provides. It's so's easy to work with when you understand it! 😀 (I would prefer to stay away from some of the #Java conventions after working with them for so long. 👍) #JVM #programming


Had quite the time working on a personal project recently. It changed my life forever.
  • Learned the hard way that the (default on most POSIX) fork context is bad news.
  • Wrote a Unix domain datagram based log infrastructure.
  • Wrote an algorithm that operates kind of like concurrent.futures.as_completed(), except it has a priority queue and doesn't eagerly load the list of futures.
  • Discovered that it's possible to overload concurrent.futures.ProcessPoolExecutor with futures, preventing any actual background processing after a point.
  • Got TONS of practice optimizing stuff for large datasets.
  • Learned that taking breaks is important for reasons than most people are aware of.
  • My life was permanently altered by this project. I basically nerd-sniped myself.

#Python #programming


This entry was edited (1 year ago)

reshared this



Had quite the time working on a personal project recently. It changed my life forever.

  • Learned the hard way that the (default on most POSIX) fork context is bad news.
  • Wrote a Unix domain datagram based log infrastructure.
  • Wrote an algorithm that operates kind of like concurrent.futures.as_completed(), except it has a priority queue and doesn't eagerly load the list of futures.
  • Discovered that it's possible to overload concurrent.futures.ProcessPoolExecutor with futures, preventing any actual background processing after a point.
  • Got TONS of practice optimizing stuff for large datasets.
  • Learned that taking breaks is important for reasons than most people are aware of.
  • My life was permanently altered by this project. I basically nerd-sniped myself.

#Python #programming


Never, ever, use the fork context in multiprocessing. :blobfoxsweating: POSIX OSes (aside from macOS) have that as the default. :blobfoxangrylaugh: Always use the spawn context! :blobfoxdead:

Of course, unless you have an extreme edge case. :blobfoxgoogly: (Yes, the names are funny. :blobfoxgooglytrash: )

#Python #multiprocessing


Tech Cyborg reshared this.

in reply to Neil E. Hodges

This whole mess got me thinking seriously about learning #Kotlin, since it would eliminate needing to use IPC to make use of multiple CPU cores. (Yes, I actually like the #JVM, but don’t want to boilerplate myself to death with #Java. :P )

I’ll probably still look into learning Kotlin, but not for this project.


Shannon Prickett reshared this.


botocore.exceptions.ClientError: An error occurred (BadDigest) when calling the PutObject operation (reached max retries: 4): The Content-MD5 you specified did not match what we received.

The Content-MD5 header was generated by botocore (not me) and the file didn't change. What is happening? D': #Python #Amazon #AWS

reshared this



Is 2 GB too large for an #SQLite database performance-wise? 🤔 #Python

reshared this



Having to make heavy use of complicated multiprocessing libraries because of the #GIL is peak #Python. :(

Tech Cyborg reshared this.



This apparently doesn't work correctly. When I tried it, a bunch of log lines were duplicated. 😞

class LzmaFileHandler(FileHandler):
    def _open(self) -> IO[str]:
        return lzma.open(
            self.baseFilename,
            self.mode,
            encoding=self.encoding,
            errors=self.errors,
        )

I had to switch it to this to get it to work:
class CompressionAlgorithm(Enum):
    lzma = "lzma"
    gzip = "gzip"
    bzip2 = "bzip2"


def _compressed_handler(
    opener: Callable[[Path, str], IO[str]],
    filename: Path,
    mode: str = "at",
) -> logging.Handler:
    stream = opener(filename, "at")
    stream.reconfigure(write_through=True)
    atexit.register(stream.close)
    return StreamHandler(stream)
 
 
COMPRESSION_HANDLERS: Mapping[CompressionAlgorithm, Callable[[Path, str], logging.Handler]] = {
    CompressionAlgorithm.lzma: partial(_compressed_handler, lzma.open),
    CompressionAlgorithm.gzip: partial(_compressed_handler, gzip.open),
    CompressionAlgorithm.bzip2: partial(_compressed_handler, bz2.open),
}

Also, lzma buffers a ton in memory before writing, so it didn't really work for my purpose. Even bz2 didn't work, so I had to use gzip. 🙃

#Python

Tech Cyborg reshared this.



With more than one item, the context managers are processed as if multiple with statements were nested:
with A() as a, B() as b:
    SUITE

is semantically equivalent to:

with A() as a:
    with B() as b:
        SUITE

You can also write multi-item context managers in multiple lines if the items are surrounded by parentheses. For example:

with (
    A() as a,
    B() as b,
):
    SUITE

:O #Python

Tech Cyborg reshared this.

in reply to Neil E. Hodges

Non-GC languages with destructors: "Look what they need to mimic a fraction of our power!"

Sam Levine reshared this.


Anyone know how to read tar files from a pipe in #Python? I'm getting this error when using tarfile.open(path, mode="r|"):
  File "lib/python3.12/tarfile.py", line 690, in read
    self.fileobj.seek(offset + (self.position - start))
  File "lib/python3.12/tarfile.py", line 522, in seek
    raise StreamError("seeking backwards is not allowed")
tarfile.StreamError: seeking backwards is not allowed

reshared this

in reply to Neil E. Hodges

It looks like to write over a pipe, open the file first and pass the handle to tarfile. Might work for reading too?
https://stackoverflow.com/a/25333193
in reply to Neil E. Hodges

The solution ended up being replacing intar.extractfile(info.name) with intar.extractfile(info). 👍

reshared this



Tried using the CFFI library with libmtp to put together a script for grabbing photos off my phone, but libmtp didn't like #Android's custom flavor of MTP. Ended up just wrapping aft-mtp-cli instead. 👍 #Python



PEP 703 – Making the Global Interpreter Lock Optional in CPython


CPython’s global interpreter lock (“GIL”) prevents multiple threads from executing Python code at the same time. The GIL is an obstacle to using multi-core CPUs from Python efficiently. This PEP proposes adding a build configuration (--disable-gil) to CPython to let it run Python code without the global interpreter lock and with the necessary changes needed to make the interpreter thread-safe.


#python #programming #gil

Andrew Sterian reshared this.



I was originally annoyed by this, but I think it's probably for the best. #python #linux
% sudo pip install python-magic
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Arch-packaged Python package,
    create a virtual environment using 'python -m venv path/to/venv'.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-Arch packaged Python application,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. Make sure you have python-pipx
    installed via pacman.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

in reply to Neil E. Hodges

how did we get to the point when we're surprised that a repository includes the latest version of a tool released "just" half a year ago? Now I see why people talk that much about #NixOS.
in reply to gram

@orsinium I know somebody who is very disappointed that bookworm doesn't have golang 1.20 when it was released "months ago". I think I can see why - bookworm was already partially frozen then. But explaining this doesn't help.

On the other hand it does look like golang 1.20 got into nixos 23.05, if I am reading this correctly.

@gram
in reply to gram

@orsinium

Thats quite fast for debian.
And that being fast for debian, is the mainreasen to not use debian on the desktop. (Which I did for a very long time btw.)

@gram

Neil E. Hodges reshared this.


I think I found a #Python #bug today. If you try to do a csv.writer.writerow() and one of the strings (not bytes) in the row contains a null character in it, and you are using a csv.Dialect with escapechar set to None, it will result in this condition evaluating to true when it shouldn't. That will almost immediately result in the need to escape, but no escapechar set exception being thrown. #programming

reshared this



Fixing the GIL with from concurrent.futures import ProcessPoolExecutor. #Python

Neil E. Hodges reshared this.


Learned a new #Python trick on the job:
@contextmanager
def func(…):
    resource = …
    try:
        yield resource
    finally:
        …

#programming

reshared this