Radishrain

Things pertaining to life: plants and animals, gardening, cooking, food, botany, zoology, farming, ranching, wildlife, genetics, plant breeding, software, media, etc.
Radishrain by Radishrain @ in Announcements
I made the forum colors white on black instead of the opposite, today—because I invert my colors, and I have to uninvert them every time I go to my site for it to be dark. I figure other people might have the same problem.
Would you rather the theme be dark?
Radishrain by Radishrain @ in Software
https://medium.com/nerd-for-tech/how-to-install-unsupported-bluetooth-5-0-dongle-on-linux-4bf34aa99fed

The above link might be insightful in getting newer adapters to work for Linux.

Be careful when picking an adapter--not just because they're not all advertised for Linux use, but because some of them aren't particularly for computers; they're just for transmitting/receiving audio from 3.5mm audio jacks and stuff. Even some of the ones with male USB ports on seem to be like that. Try searching for one with no buttons that works with a mouse or keyboard, or try searching for one that is integrated with a Wi-Fi card.

I ordered one of the day I wrote this post (I'm editing the next day), which has the same chipset mentioned in that link. My computer (which currently has Xubuntu 22.04.1 on it) appears to already have the driver for that chipset, however (that's why I ordered this particular device); it uses Bluetooth 5.1. Here's a link to the product:

https://www.walmart.com/ip/USB-Bluetooth-5-1-Adapter-Bluetooth-USB-Transmitter-Speakers-Keyboard-Mouse-Printer-Receiver-for-PC-Win-7-8-10-11/1425764465

I'm hoping to let you know if it works.

If the links are broken, check them on archive.org.
Radishrain by Radishrain @ in Software
https://docs.python.org/3.10/tutorial/datastructures.html

Here's a link where it talks about list comprehensions.

List comprehensions are when you do such as `myList=[v+2 for v in anotherList]`. What this does is make `myList` equal to a new list wherein every item of `anotherList` has been incremented by two.

List comprehensions must be contained within a list, a set, or some such, or Python won't recognize the syntax.

You can replace `anotherList` with such as `range(5)`. However, ranges seem to be special in that the first item of the newly created list will be 0 instead of 2 (if you did `[v+2 for v in range(5)]`; I suppose that's for convenience, since that's probably what people want.

The first part, (where I put `v+2` in the initial example) doesn't actually need to include `v` (it can be something like 55); no, you can't assign values in that place; so, this is invalid: `[v+=2 for v in range(5)]`.

What list comprehensions do is iterate through the loop (`for v in anotherList`) much as usual, and then assign the value placed before it to each iteration (so, `[55 for v in anotherList]` will just replace every value (in the new list) with `55`.

If this whole list comprehension thing seems strange to you, apparently it's very much like something done in mathematics. So, that's probably why they do it like this in Python. However, I found it to be very confusing for many years, personally, and just wished people would write out the full thing. Speaking of that, here's what the full thing looks like (for `myList=[v+2 for v in anotherList]`):

v=0
myList=[]
for v in anotherList:
    myList.append(v+2)
del v #Either that, or the scope of v just ends

Anyway, for me, for a long time, it seemed a rarely enough used feature that when I needed to remember what it did, I had forgotten (and I didn't remember they were called list comprehensions to look them up). However, just about everyone else who programmed in Python did it a lot; so, it was kind of frustrating. I considered it a short way of obfuscating code for programmers of other languages.

Oh, just for the record, you can use strings, and probably other stuff instead of integers:
>>> l=["hello", "Earth is a"]
>>>[s+" world" for s in l]
['hello world', 'Earth is a world']
Radishrain by Radishrain @ in Software
Today, I learned the hard way that it really isn't a good idea to type the following, and say yes to the prompt that follows without paying much attention to what it says it's going to uninstall along with it (I knew better, a lot better, but I was irritated, and was in a risk-taking mood):

sudo apt-get remove python3

Apparently, it'll uninstall basically your whole computer, and take a long time doing it (and it won't let you stop it so you can collect your losses with ctrl+c; even if you close the terminal window, it still keeps on doing it, somehow keeping the resource lock on the package manager--and then if you manually turn your computer off and turn it on again, somehow XFCE has been replaced with Kodi, and there's no way to change it). At least it lets you log in (to Kodi) with different users, though.

Anyway, so, as a result of that, I'm downloading the latest version of Xubuntu (I had an older version anyway--hence trying to update my Python version--so . . .)

And the next time I compile the latest Python version, I'm not planning to do a sudo make install unless I make it rename the command to something besides python3. Yikes. I figured there'd be an option on update-alternatives --config python3 where I could change it back to the old one before it did much damage (but nope--the old one was just plain gone). So, that's why I uninstalled python3 (because I was just going to reinstall it to see if it put the command back).

At least I got to eat some good pizza while all this was going on.
New Post
feeds Feeds
Feedback, Links, Privacy, Rules, Support, About