CNF2 = { φ | φ is a satisfiable CNF-formula in which each variable appears at most 2 times}. Show CNF2 is in P

CNF2 = { φ | φ is a satisfiable CNF-formula in which each variable appears at most 2 times}. Show CNF2 is in P.

I found this solution:

We use the method of resolution to take the variables out one by one. First, observe that if the variable x appears only as x or only as ¬x in the formula, or if it appears only once, we can satisfy whatever clauses it takes part of and thus exclude x and these clauses. On the other hand, if x and ¬x are both clauses for some variable, we know our formula is not satisfiable. So the interesting case is when we have x in one clause, c+, and ¬x in another, c−, such that (c+, c−) 6= (x, ¬x). Call the remaining part of the formula r. We claim that c+ ∧ c− ∧ r is satisfiable if and only if c ∧ r is satisfiable, where c is the disjunction of all literals from c+ and c− that are not x or ¬x. Indeed, given a satisfying assignment of c+ ∧ c− ∧ r, some literal in either c+ or c− has to be satisfied, because we can’t have both x and ¬x be satisfied. Thus, forgetting the assignment of x, we get a satisfying assignment of c ∧ r. Conversely, given a satisfying assignment of c ∧ r, some literal different from x and ¬x will be satisfied in either c+ or c−; the other one can be satisfied by assigning x in an appropriate way. Thus, we have a procedure to decide satisfiability of a CNF2 formula φ efficiently: reduce the number of variables by the methods described above; if there is no contradiction along the way and you get to the empty formula, then φ is satisfiable. Otherwise, it is not.

Why is there not a control about to check if each variable appears at most 2 times?

What happens if a 2nd-level spell appears in (or is added to) a character’s spell list as a 1st-level spell?

In the latest Unearthed Arcana: Class Feature Variants, one of the [many] included additions/changes is the addition of a few spells to the Ranger’s spell list. One of these changes is to add the 2nd-level spell, Aid, to the Ranger’s spell list as a 1st-level spell.

Assuming, for the sake of argument, that this isn’t just an obvious typo in playtest material, and actually constitutes a serious, intentional design decision:
How would this be adjudicated? Would Rangers be able to cast the Aid spell using only a 1st-level spell slot?

Button appears in two important locations and feels redundant

I’m building a log in page but ran into an issue with my nav bar. As you can see the “Log In” button appears in two locations.

What’s the best way to approach this? To me it looks odd to have it shown twice, yet its a necessary part of the nav bar.

I can correct this by removing the button for just that page…but then that feels like a complicated solution because it requires modifying template code with an if statement.

What should be done here instead?

enter image description here

C++ OpenGL man appears where I click

I have a program to display a man scratching his head on an openGL window. I am wanting to make it so that where ever I click on the window, that is where the man will appear. If I right click on the man he will appear in that position with a different color.

Here is my code:


include // include GLUT library



std::string input; void drawPoints() {

//axis labels glColor3f(0, 0, 0); glRasterPos2i(155, -5); glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_10, 'X'); glRasterPos2i(-5, 155); glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_10, 'Y');  glPointSize(5); glBegin(GL_POINTS); // use points to form X-/Y-axes        // change drawing color to black for (int x = -150; x <= 150; x++) // draw X-axis     glVertex2i(x, 0); for (int y = -150; y <= 150; y++) // draw Y-axis     glVertex2i(0, y); glEnd();      static GLubyte smiley[] = /* 16x16 smiley face */ {   0x01, 0x80, 0, 0,  ///1   0x03, 0xE0, 0, 0,   0x01, 0xFF, 0x80, 0,   0x00, 0x3f, 0x80, 0,   0x70, 0x00, 0x80, 0,  ///2   0xFC, 0x00, 0x80, 0,   0x1f, 0x80, 0x80, 0,   0x03, 0xC0, 0xC0, 0,   0x00, 0xC1, 0x80, 0, //3   0x00, 0xC1, 0x80, 0,   0x00, 0xc1, 0x80, 0,   0x00, 0xc3, 0, 0,   0x00, 0xC3, 0, 0, //4   0x00, 0x86, 0, 0,   0x00, 0x86, 0, 0,   0x00, 0x8c, 0, 0 ,     0x00, 0x8c, 0, 0,//5     0x01, 0x8c, 0, 0,     0x01, 0x9c, 0, 0,     0x01, 0x9c, 0, 0,     0x01, 0x9c, 0, 0,//6     0x01, 0xDC, 0, 0,     0x01, 0xDC, 0, 0,     0x01, 0xFC, 0, 0,     0x01, 0xFC, 0x10, 0,//7     0x01, 0xFE, 0x70, 0,     0x01, 0xFE, 0xC0, 0,     0x03, 0xFF, 0x80, 0,     0x03, 0xFF, 0, 0,//8     0x03, 0xFF, 0, 0,     0x03, 0xFD, 0xFC, 0,     0x03, 0xF8, 0x3, 0,//////////     0x03, 0xF8, 0x3, 0,//9     0x03, 0xF8, 0x6, 0,     0x03, 0xF8, 0xC, 0,     0x03, 0xF8, 0x18, 0,     0x03, 0xFc, 0x70, 0,//10/////     0x03, 0xFC, 0xE0, 0,     0x01, 0xFD, 0xC0, 0,     0x01, 0xFF, 0xC0, 0,/////     0x01, 0xFF, 0x80, 0,//11     0x03, 0xFF, 0, 0,     0x07, 0xBE, 0, 0,     0x0F, 0x98, 0, 0,     0x0F, 0x30, 0, 0,//12     0x1E, 0x3c, 0, 0,     0x3c, 0x7f, 0, 0,     0x38, 0x7f, 0x80, 0,     0x70, 0x7f, 0xc0, 0,//13     0x63, 0xFF, 0xE0, 0,     0x60, 0x7f, 0xF0, 0,     0xE0, 0x3f, 0xF0, 0,/////     0xE0, 0x1f, 0xF0, 0,//14     0xE0, 0x1f, 0xF0, 0,     0xF0, 0x0F, 0xF0, 0,     0x3f, 0xF7, 0xF0, 0,     0x01, 0xF3, 0xF0, 0,//5///     0x00, 0x10, 0x1c, 0,     0x00, 0x18, 0x06, 0,     0x00, 0x0F, 0x06, 0,     0x00, 0x06, 0x01, 0,//5////     0x00, 0x00, 0x01, 0xc0,     0x00, 0x00, 0, 0x20,     0x00, 0x00, 0, 0x20,     0x00, 0x00, 0, 0xE0,//5     0x00, 0x00, 0, 0,     0x00, 0x00, 0, 0,     0x00, 0x00, 0, 0, };   glMatrixMode(GL_PROJECTION);  /*  * This bitmap is aligned to 4-byte boundaries…  */  glPixelTransferi(GL_UNPACK_ALIGNMENT, 4);  glColor3f(1.0, 0.0, 0.0); glRasterPos2i(0, 0); glBitmap(32, 72, 8.0, 8.0, 0.0, 0.0, smiley); 


//*********************************************************************************** void myInit() { glClearColor(1, 1, 1, 0); // specify a background clor: white gluOrtho2D(-200, 200, -200, 200); // specify a viewing area }

//*********************************************************************************** void myDisplayCallback() { glClear(GL_COLOR_BUFFER_BIT); // draw the background

drawPoints();  glFlush(); // flush out the buffer contents 


//*********************************************************************************** int main(int argc, char** argv) {
glutInit(& argc, argv);

glutInitWindowSize(400, 400);               // specify a window size glutInitWindowPosition(100, 0);         // specify a window position glutCreateWindow("Simple Point Drawing");   // create a titled window  myInit();                                   // setting up  glutDisplayFunc(myDisplayCallback);     // register a callback  glutMainLoop();                         // get into an infinite loop  return 0; 


AJAX content that only appears while the customizer is open

While this is likely specifically a WooCommerce issue, it still applies here. I am using the AJAX add-to-cart feature, so, upon clicking “add to cart,” items should be added to the cart (this part works) as well as have a message appear that confirms the product was added to the cart (this part doesn’t), all while not reloading the page.

The weird thing is that the “X was added to your cart” only ever appears when I am in the customizer, and not while viewing the page normally. Even upon inspecting the page I can see that the container for the message is there, but contains no content, so it’s not simply being hidden. Has anyone seen this before or are there any troubleshooting steps I should be taking to figure out why it only behaves properly with the customizer open?

USB bluetooth controller still appears even though hardware no longer present

Machine is running 16.04 LTS, current on updates.

I had an IOGear USB bluetooth adapter. Worked reasonably well. At one point I pulled it out to give to my son. Like a fool I just yoinked it out hot. Now I have a replacement, a IOGear GBU521 (which I think was the same as the original). I can’t get it to work, and I am suspecting it’s because the machine insists the previous adapter is still present.

Here is lsusb:

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 007 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supply Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 002: ID 046d:c517 Logitech, Inc. LX710 Cordless Desktop Laser Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 009 Device 002: ID 05e3:0612 Genesys Logic, Inc.  Bus 009 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 008 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 003: ID 058f:6362 Alcor Micro Corp. Flash Card Reader/Writer Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 002: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0 Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 

and hciconfig:

hci0:   Type: BR/EDR  Bus: USB     BD Address: 00:02:72:C8:AC:34  ACL MTU: 1021:8  SCO MTU: 64:1     UP RUNNING      RX bytes:1038 acl:0 sco:0 events:63 errors:0     TX bytes:4962 acl:0 sco:0 commands:63 errors:0 

bluetoothctl list shows:

Controller 00:02:72:C8:AC:34 khym [default] 

The remove command in bluetoothctl does nothing (says “not available”).

I tried wiping the entries in /var/lib/bluetooth, but the entry for the phantom controller keeps returning. I also found and removed the firmware file /lib/firmware/brcm/BCM20702A1-0a5c-21e8.hcd.

Boot messages include:

Sep 12 23:11:17 khym kernel: Bluetooth: hci0: BCM: chip id 63 Sep 12 23:11:17 khym kernel: Bluetooth: hci0: khym Sep 12 23:11:17 khym kernel: Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000 Sep 12 23:11:17 khym kernel: bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0a5c-21e8.hcd failed with error -2 Sep 12 23:11:17 khym kernel: Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0a5c-21e8.hcd not found 

When I plug in the new adapter I get an appropriate entry in lsusb and hciconfig, but the gnome bluetooth panel doesn’t recognize it.

I’m thinking since the original controller worked without trouble, if I can get the machine to forget about it the new one should come up without further trouble.

A couple other notes: – This machine is somewhat old (core 2 duo) and currently has a dead CMOS battery so I get corrupted memory messages in my boot logs. Everything else works fine so I believe that isn’t relevant – Machine is using nvidia drivers for graphics (I know that was an issue years ago but is it still?)

I did a fair bit of searching, tried to infer where things are and how files should be based on posts of people getting their btusb to be recognized, but I haven’t come across anyone with the opposite problem!

Thanks in advance for any suggestions for further diagnosis!


“Grub loading… Welcome to grub” banner appears before grub bootloader loads

I have a dual boot system with kali and ubuntu. One week ago I did a system update with apt upgrade but interrupted it because kali did not respond if I moved the mouse. Now, when I start my laptop, there is the banner Grub loading... Welcome to grub!. The banner was not there before the update. Actually I did not experienced problems or damages so far but it is really annoying for me. Can I remove it or is it possible that the banner is sign for a possible damage?