Jump to content

Wikipedia:Reference desk/Archives/Computing/2020 November 26

From Wikipedia, the free encyclopedia
Computing desk
< November 25 << Oct | November | Dec >> Current desk >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


November 26[edit]

Formatting on another wiki[edit]

Hello! I just posted a question at the Help Desk and was told I should post it here as well. It's about doing some wiki editing off-Wikipedia, specifically for Weezerpedia. Thank you! --Jasondanielboxer (talk) 00:32, 26 November 2020 (UTC)[reply]

Better link: Wikipedia:Help desk/Archives/2020 November 26#Off-Wikipedia editing questionTamfang (talk) 03:41, 30 November 2020 (UTC)[reply]

Python coding question[edit]

Let's say that I have this specific Python code:

class President(object):
    def _init_(self, age):
        self.age = age
        self.name = None
    def get_age(self):
        return self.age
    def get_name(self):
        return self.name
    def set_age(self, newAge):
        self.age = newAge
    def set_name(self, newName=""):
        self.name = newName
    def _str_(self):
        return "President:"+str(self.name)+":"+str(self.age)

What would it take to get:

"President: George Washington: 67" (as in, the contents of "_str_(self)") returned to me? Futurist110 (talk) 05:56, 26 November 2020 (UTC)[reply]

  • The answer to the question as asked is p._str_() where p is an adequately-defined instance of the class.
However, I wager that what you really want is print(p) to return this string, in which case you should use def __str__(self): ... instead of def _str_(self): .... Note the double underscores. See the documentation about that special method. TigraanClick here to contact me 08:52, 26 November 2020 (UTC)[reply]

Linux/KDE Plasma Bluetooth handling for audio devices[edit]

Hi there. I have Ubuntu 18.04.5 running KDE Plasma, on an old ASUS motherboard with an Intel i5-2400.

I recently dug up a 3.5mm-jack Bluetooth audio transceiver. It works a treat with my Android tablet, passing both microphone and speaker data to my plugged-in wired earphones.

However, on Plasma, I use the GUI Bluetooth manager to connect to the Belkin Q78 device, and it pairs just fine. Then I check the audio devices available to switch to. It's not there! I don't know how to refresh the list, either. Mostly stuff just populates in there by itself. So how can I even troubleshoot this? I don't know where the logs might be, or how to interpret them. Is it a BT layer or a Pulseaudio layer issue? SOS! 2600:8800:1880:902:5604:A6FF:FE38:4B26 (talk) 19:51, 26 November 2020 (UTC)[reply]

Hi IP, for me when I connect your bluetooth driver on Linux should automatically create a PulseAudio sink to use, that's what's listed under KDE's sound options. PulseAudio is a massive pain but you should check that it's being recognised as an audio device, and that your user might require extra privileges? There could be a whole number of issues that are hard to diagnose, but you should look up on askubuntu.com, somebody has definitely had the same issue as you at one time or another. Ed talk! 12:00, 27 November 2020 (UTC)[reply]
Maybe check https://askubuntu.com/questions/239209/no-sound-from-bluetooth-headset-but-its-detected - that might contain an answer for you? Ed talk! 12:01, 27 November 2020 (UTC)[reply]
Thanks Ed! Well, pavucontrol doesn't see the device either. I ran the a2dp script and its output is Cannot find `bluez_card.88_C6_26_D1_DB_09` using `pactl list cards short`. Retrying 11 more times ad nauseam. pulseaudio -k, which I've tried before, gives me no love. I've added the bluez PPA, which is usually a good idea; I'll reboot and letchoo know. 2600:8800:1880:902:5604:A6FF:FE38:4B26 (talk) 14:42, 27 November 2020 (UTC)[reply]
I have decided that this is an issue with my user account's pulseaudio config, because the other accounts on the machine are working OK. I have done a few things to kill/restart the daemon, to purge and reinstall the apt packages, and to rm -rf ~/.config/pulse but now it's a bit worse: no speaker icon in my plasmashell panel at all. So... oops. 2600:8800:1880:902:5604:A6FF:FE38:4B26 (talk) 15:04, 27 November 2020 (UTC)[reply]
Resolved
per this thread 2600:8800:1880:902:5604:A6FF:FE38:4B26 (talk) 15:45, 27 November 2020 (UTC)[reply]

Impossible or not?[edit]

Is it cryptographically possible to design a system without a single point of trust (like bitcoin) that asks the citizens if they want a particular war that is a secret ballot if nays exceed yeas yet somehow allows the identity of the yeas to be figured out if yeas exceed nays and a draft lottery becomes necessary so that the yeas of age 18 to 39 or whatever become the first lottery pool? Sagittarian Milky Way (talk) 23:00, 26 November 2020 (UTC)[reply]

Any system that enables the identities of any voter(s) to be figured out is not a secret ballot. -- Jack of Oz [pleasantries] 01:50, 27 November 2020 (UTC)[reply]
If you could somehow incentivize the yeas to try to decrypt the votes and the nays to add computational difficulty and use a method where whoever has over half the computing power wins then that's almost this except there's no way to make sure the computing power per vote is the same for both sides. Is there some cryptologic trick around this? Sagittarian Milky Way (talk) 03:51, 27 November 2020 (UTC)[reply]
One possible approach is to use a threshold cryptosystem using public-key cryptography combined with key escrow. The private key is distributed over the members of the escrow body, about which later. Each yea-voter's identity, after salting it, is encrypted with the public key; the list of cryptids (encrypted identities) is stored securely in a vault, with an "air gap" so as not to allow on-line penetration attempts. When the time has come for the lottery, the vault is opened and the requisite number is selected randomly from the list of cryptids and handed over to the key-holding body, which decrypts each cryptid, thereby revealing each selected yea-voter's clear identity. The key-holding body could be a trusted group of individuals of size n, say supreme-court justices, each of which has only part of the private key, so that a qualified majority m (the "threshold") is needed to form the complete key. This can be achieved in many ways, one being the use of an error correction code in which a bitstream is turned into n concurrent bitstreams such that at any position only m need to be received in uncorrupted form to reconstruct the bit at that position; before distribution, then, at each position, nm of the bits – chosen at random from the vector of n bits at that position – are corrupted intentionally. This can be combined with cloaking by XORed combinations of one-time pads to ensure that any colluding group of partial-key holders can obtain no information whatsoever as long as they fall short of the required threshold.  --Lambiam 07:30, 27 November 2020 (UTC)[reply]
This does not yet meet the requirement of guaranteed secrecy if the yeas did not have it. In that case, do not store any information; just throw all data away.  --Lambiam 07:36, 27 November 2020 (UTC)[reply]
  • I suspect the scheme is not possible without some trust in election officials (see Lambiam's last step of "throw all data away if some condition occurs"). You have to define carefully what "secret ballot" means; using the definitions of this abstract, what you would like is that the ballot (or parts of the ballots) be only "confidential" if yes wins but "untraceable" if no wins. The trouble is that if ballots are untraceable (i.e. the branch of the procedure if "no" wins), you cannot audit the result (i.e. you have no way to detect vote-rigging). TigraanClick here to contact me 15:16, 27 November 2020 (UTC)[reply]
    A ballot can consist of two physically separable parts, one for recording the vote, and one (for yea votes) for the voter's identity. If the vote fails, the identity parts can be removed and discarded while the parts recording the votes are retained for audits.  --Lambiam 01:40, 28 November 2020 (UTC)[reply]
As an aside, in UK general (and probably local) elections, when you arrive at the polling both and they check you are on the list of voters for that polling station, they cross your name off the list (to say you have voted) and write the number of the voting slip they hand to you down beside your name. Therefore they have the ability to identify voting slips to individuals, but I don't think it is ever used and the actual vote is considered a secret ballot. -- SGBailey (talk) 13:24, 28 November 2020 (UTC)[reply]
In NZ, for general elections they do the same thing, but the number of the voting slip is used to remove the votes of anyone who voted more than once [1] [2] [3] [4] (see 22 and 27-29). As I understand it, to preserve ballot secrecy [5], the person who removes the votes is not supposed to know the identity of the voter who's ballots they are removing. For special declaration votes, they do come in 2 parts. The declaration is in one envelope and the ballot paper in another. (See 20 to 21 of the last source.) If the declaration is rejected, the ballot paper is never opened. (If it's okay, I assume the envelope is added to a pile to be opened and counted by someone who never saw the declarations.) Local elections are a little different as they are all mail ballots and no declaration is required it it's a standard mail ballot paper sent back. Nil Einne (talk) 17:06, 28 November 2020 (UTC)[reply]