How to present boolean options along with selecting exactly 1 of them as “primary”?

I have a situation in a web browser where I have a number (let’s say 3-10) of alternatives to present to the user.

  • The end user must choose at least one of these options to be enabled
  • The end user must choose exactly one of the enabled options to be the “primary” option.

I’m not sure how best to do this, though. Here’s a contrived situation about a stew that might help illustrate this better:

enter image description here

There are 7 potential ingredients, the user has to enable or disable each of them (cries out for a checkbox) but at least one of them has to be enabled; and exactly one of them must be the primary ingredient (cries out for a radio button).

  • If I choose a dumb form with no constraint checking, this is easy to implement, but they could choose Beef, Pork, and Carrots as the enabled ingredients and then Potatoes as the primary ingredient (which is a problem since they did not check the Potatoes box among the enabled ingredients)

  • Or I could put the primary ingredient first, then allow them to select secondary ingredients, and force the primary ingredient to be selected in the list of secondary ingredients (beef in the example below) and not allow it to be unselected. Not too hard to implement in HTML / Javascript, but then there’s some trickiness… what if I start with the UI state below, then select the primary ingredient as Onions, then as Chicken, and then Pork? What happens to the checkboxes for Onions, Chicken, and Beef?

enter image description here

Both of these options require duplicating the list twice.

  • Or I could try to use some kind of multichoice slider to select the primary ingredient… which would eliminate the need to duplicate the list… but this isn’t a built-in HTML feature and I’d have to roll my own or try to apply some 3rd-party UI element.

  • Or I could place a radiobutton and a checkbox in front of each ingredient (radiobutton for primary ingredient, checkbox to enable non-primary ingredients) which is compact and simple in presentation, but most likely confusing in semantics.

Any suggestions?

How to use GPG to pass along encrypted content and double encrypt

Say I have a document. I want to encrypt it, then give it to my friend, and I don’t want them to be able to decrypt it. I want them to encrypt it again using their GPG system. Then to decrypt it my friend has to first decrypt it, send it to me, and I decrypt it.

How do I do that roughly with the GPG CLI? I am confused because there are 3 interrelated elements.

gpg --encrypt --sign --armor -r person@email.com -r foo@bar.com name_of_file 
  • encrypt
  • sign
  • recipients

I amnot sure how they all relate or what they do exactly. Do I just encrypt it without signing and without recipients, pass it to my friend and they encrypt it without signing or adding recipients?

Using OAuth2 with JWT, should a client pass along unused refresh tokens on a logout call?

I have a system with an OAuth2 authorization server. It hands out JWT access tokens and refresh tokens (the latter only to the mobile app client).

We don’t persist access tokens (as is normal with JWT) but we do persist the (hashed) refresh tokens together with some meta data to be able to revoke them so that users can log out other devices. We also only allow a single use for refresh tokens, the new request also gives back a new refresh token.

The OAuth2 login server itself uses regular basic auth with sessions. The user wants to be able to logout (single devices/clients) here. So of course I have to invalidate the session itself. But ideally I want to remove the refresh token that this client still has as well. The problem is that I don’t know that refresh token. A particular user could in theory have request multiple of them with their code request. The refresh token is also not normally passed in requests (only the access token)

Should I ask the clients (which are currently all under our own development) to send along their unused refresh tokens? Even if they ‘forget’ their refresh tokens locally, it still seems better if I also delete them on the server so they don’t linger around until their expiry time. Note I do know all the refresh tokens currently in use for a certain account but I don’t want to just delete them all because that would mean all devices are logged out. We also save some user agent-like info with the refresh tokens so users can use that to manually logout other devices, but it seems like a bad idea to try to perform string matching on those to automate that process.

Unable to install Ubuntu along with Windows 10, HP Omen Laptop

So I have crawled around the web for 2 days now, only to notice that I’m not the only one with this problem and 2 not a single person really knows how to fix this. This is not a single good guide or video out there to solve this problem so here we go…

Computer Specs: https://support.hp.com/us-en/document/c05609719

I upgraded to 16g of ram and installed a Samsung 970 pro SSD

secure boot = disabled

TPM = Available / disabled

SGX = disabled

Legacy boot = disabled

I have installed ubuntu on a live usb, i have verified the install and checked for bad blocks on the USB (3.0)

So when i insert the usb, the standard Grub loader comes up. I scrolled down to install ubuntu, and press E.

then i go to the end of the following line:

linux /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash —

I have tried the follow additional commands:

nouveau.modeset=0

acpi=off

modprobe.blacklist=nouveau

nomodeset

None of this at any given time have worked. Currently after I press F10 I am getting an error saying:

failed to claim resource 1. platform device creation failed: -16

My understanding is that it has something to do with NVIDIA drivers, please help.

PS. Ubuntu why haven’t you fixed this yet. It’s been a plague since 16.04.

Ubuntu 18.04 LTS along side Windows 10 not showing up MSI X470 GAMING PRO (MS-7B79)

I have an HDD Previously of 1 TB which has Windows 10 installed.

Today, I got a new WB SSD 1TB.

To install windows first on SSD, I removed HDD and installed windows 10 and created 2 partitions on WB SSD.

Now when I try to boot I get directly booted into the new OS, fair.

Next I have tried installing ubuntu 18.04 lts, i have selected 2nd partition which was ~465 gb and installed successfully.

Then after restarting i was expecting to show boot menu to allow me to select 3 os

Listed:

  • 1st SSD’s Windows 10
  • 2nd SSD’s Ubuntu 18.04 LTS
  • 3rd HDD’s Window 10

I have disabled fast boot option from Power Setting and verified that Secure Boot is Disabled in Bios settings.

To enter:

  • Delete while booting
  • Advance-> Windows 8.1/ 10 WHQL Support is disabled (i have researched here for how to do it https://forum-en.msi.com/index.php?topic=287491.0)

Some people have suggested on various forums to run this command from cmd as administrative

command: bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi

I have restarted and still not able to get it working.

The fun part is while booting if i press F11 to see boot option i get to see all of them listed followed by Enter Setup option. I have tried logging in newly installed ubuntu and it works flawlessly.

My bcdedit command output after editing is as below:

C:\Windows\system32>bcdedit  Windows Boot Manager -------------------- identifier              {bootmgr} device                  partition=\Device\HarddiskVolume2 path                    \EFI\UBUNTU\GRUBX64.EFI description             Windows Boot Manager locale                  en-US inherit                 {globalsettings} default                 {current} resumeobject            {564500db-e222-11e9-a9a6-e69b1900e4bb} displayorder            {current} toolsdisplayorder       {memdiag} timeout                 30  Windows Boot Loader ------------------- identifier              {current} device                  partition=C: path                    \Windows\system32\winload.efi description             Windows 10 locale                  en-US inherit                 {bootloadersettings} recoverysequence        {564500dd-e222-11e9-a9a6-e69b1900e4bb} displaymessageoverride  Recovery recoveryenabled         Yes isolatedcontext         Yes allowedinmemorysettings 0x15000075 osdevice                partition=C: systemroot              \Windows resumeobject            {564500db-e222-11e9-a9a6-e69b1900e4bb} nx                      OptIn bootmenupolicy          Standard 

Here is the current state of my pc from windows os’s view:

enter image description here

Info:

  • C: is Windows on SSD
  • E: Ubuntu on SSD(I dont know why it is shoing like that or rather not show at all)
  • G: Windows on HDD

Please help me and let me know what am I doing wrong.

Writing an sql query for name of the youngest student(s) from the ‘Computer Science’ department along with the total marks obtained by him (them).”

I have been given a table of students data and I have to write query for the following:

Retrieve the name of the youngest student(s) from the ‘Computer Science’ department along with the total marks obtained by him (them).

The database schema are as follows:

depts( deptcode char(3) primary key, deptname char(70) not null); 
students( rollno number(2) primary key, name varchar(50), bdate date check(bdate < TO_DATE('2004-01-01','YYYY-MM-DD')), deptcode char(3) references depts(deptcode) on delete cascade, hostel number check(hostel<20), parent_inc number(8,1)); 
crs_regd( crs_rollno number(2) references students(rollno) on delete cascade, on delete cascade, marks number(5,2), primary key(crs_rollno)); 

I wrote the query as

select name, bdate, sum(marks) from students s inner join crs_regd c on s.rollno=c.crs_rollno inner join ( select name, min(bdate) as bdate from students st, depts d where st.deptcode=d.deptcode and d.deptname="Computer Science") x on x.name=s.name and x.bdate=s.bdate; 

but it gives the error as identifier is too long in the line

where st.deptcode=d.deptcode and d.deptname="Computer Science") x

I think the problem is in joining the join of two tables with already joined two tables as the error points out. Correct me if I am wrong. If the query is incorrect please inform.

Also, if there is a way to write this query please discuss. If any other information needed please drop a comment below.

Best way to divide CPU along all sql instances on 1 server

I have a physical server with 40 CPU’s (hyperthreaded) with 2 numa nodes. On this server i have 20 sql instances installed and i need to make sure each sql instance have some dedicated cpu assigned into. The problem is that sometimes one or more of the instances are using all of the cpu’s and then about 4 or 5 instances are out of CPU resources and failing. What is the best way to spread cpu along all of the instances so each instance have some at the minimum?

Thank you