text:
Q: Wireless card not working? (Broadcom 4311) I have recently installed ubuntu 14.04 on one of my laptops. Since I found it working a lot faster and efficiently than windows, I decided to install it on my older, x32 hp Pavilion dv6000.
I installed 14.10 onto it, but during the installation I realized that it wouldn't let me connect to any wifi (I am using ethernet instead).
I had a look at many tutorials that claimed to solve the problem (for example: Installing Broadcom Wireless Drivers ) and this is what the terminal threw back at me.
lspci -nn -d 14e4:
02:00.0 Network controller [0280]: Broadcom Corporation BCM4311 802.11b/g WLAN [14e4:4311] (rev 01)
$ sudo apt-get purge bcmwl-kernel-source
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
I get this error whenever I try a command that has anything to do with my wireless driver.
So I tried to run sudo dpkg --configure -a
$ sudo dpkg --configure -a
Configuring bcmwl-kernel-source (6.30.223.248+bdcom-0ubuntu1) ...
Removing old bcmwl-6.30.223.248+bdcom DKMS files...
-------- Uninstall Beginning --------
Module:  bcmwl
Version: 6.30.223.248+bdcom
Kernel:  3.16.0-25-generic (i686)
Status: Before uninstall, this module version was ACTIVE on this kernel.
wl.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.16.0-25-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.
depmod..........
DKMS: uninstall completed.

Deleting module version: 6.30.223.248+bdcom
completely from the DKMS tree.
Done.
Loading new bcmwl-6.30.223.248+bdcom DKMS files...
Building only for 3.16.0-25-generic
Building for architecture i686
Building initial module for 3.16.0-25-generic
Done.
wl:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.16.0-25-generic/updates/dkms/
depmod..........
DKMS: install completed.
Then it just stays on "DKMS: install completed." although the process does not end.
When I tried to end the process (^C)
I got this:
dpkg: error processing package bcmwl-kernel-source (--configure):
subprocess installed post-installation script was interrupted
There was an error while processing:
 bcmwl-kernel-source
Any help would be appreciated.
Thanks

A: With a temporary internet connection:
sudo apt-get update
sudo apt-get purge bcmwl-kernel-source
sudo apt-get install firmware-b43-installer

Reboot and tell us if your wireless is working.

A: Or you could use the open source b43 driver which works just fine with your 4311 chip.  You just need to add the linux-firmware-nonfree package for the firmware. And most important, clean out all the other broadcom stuff you installed.  Much of that will suppress the working of the b43 driver.  Check for any exact lines like "blacklist b43" in any files in /etc/modprobe.d and delete them. At least that's how it used to work, things do change and I no longer have a machine with such a chip.  The firmware should be put into /lib/firmware/b43, if nothing shows up, you probably need to fall back to the b43-fwcutter package to "cut" out the firmware from a broadcom driver.  Search around here for solutions, there are many.  The proprietary drivers started having problems several years ago and I'm not sure they were ever solved.


text:
Q: How to set the connection string for DbProviderFactory connections? I am trying to use my default connection string for connections but getting:
Access denied for user ''@'172.18.0.1'
No idea what host that is, I've never declared it.
Code:
DbProviderFactories.RegisterFactory("System.Data.MySql", MySqlConnectorFactory.Instance);
serviceCollection.AddSingleton(DbProviderFactories.GetFactory("System.Data.MySql"));

In appsettings.json I have this which I want it to pick up:
{
  "ConnectionStrings": {
    "Default": "Server=...;User=...;Password=...;Database=...;Allow User Variables=true;",
    "RabbitMq": "amqp://a:b@h:1"
  }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Print SimpleXMLElement object I have a SimpleXMLElement like this:
SimpleXMLElement Object ( [trailer] => SimpleXMLElement Object (
[title] => This is the title
[link] => http://example.com
[trailer_id] => 60373
[embed] => SimpleXMLElement Object ( ) ) )

I've google for two hours now, and couldn't find how to print the "trailer_id".
Could anybody point me in the right direction?

A: They are objects, try:
echo $xml->trailer->trailer_id;


text:
Q: Trying to deploy Confluence on Glassfish 4 So I'm trying to deploy Confluence as a WAR on Glassfish 4 (Using Oracle JDK 7). The WAR deploys just fine except I get the following errors when trying to load the page in my browser:
Could not load bootstrap from environment
No server id found.
NoSuchMethodError:com.google.common.cache.CacheBuilder.maximumSize(I)Lcom/google/common/cache/CacheBuilder;

Any thoughts as to what could cause this?


text:
Q: AVAudioPlayer and UIImagePickerController no more volume rocker my problem is that I am using AVAudioPlayer to playback sound.
Everything fine till this point!
If I add a UIImagePickerController with sourceType UIImagePickerControllerSourceTypeCamera,
my volume rockers wont show up anymore.
Any idea?


text:
Q: Система оцениваний в опроснике Есть текстовый файл, содержащий 10 вопросов, по три варианта ответа к каждому вопросу.
На первой строчке находятся ответы в таком формате:
1 1 1 2 3 1 1 1 1 3

где (1-А, 2-Б, 3-В).
В приложении есть окно, в которое выводится содержимое текстового файла (кроме первой строки с ответами), также в этом окне находятся 10 групп, состоящих из 3 кнопок (RadioButton), то есть 30 кнопок, по три на каждый вопрос.
Как сделать сравнение ответов с первой строки текстового файла с нажатыми пользователем кнопками и вывести ответ по типу:
Правильно-7 из 10.

main.py
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QFileDialog, QLabel

from newrules import Ui_Form as Ui_NewRules  # + Ui_NewRules
from form import Ui_Form as Ui_OpenTest  # + Ui_OpenTest
class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(715, 639)
        Form.setStyleSheet("background-color: rgb(16, 209, 235)")
        self.label = QtWidgets.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(10, 10, 571, 621))
        font = QtGui.QFont()
        font.setPointSize(8)
        self.label.setFont(font)
        self.label.setStyleSheet("background-color: rgb(255, 255, 255);\n"
                                 "color: rgb(216, 209, 235);")
        self.label.setObjectName("label")
        self.pushButton = QtWidgets.QPushButton(Form)
        self.pushButton.setGeometry(QtCore.QRect(590, 540, 111, 91))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.pushButton.setFont(font)
        self.pushButton.setStyleSheet("background-color: rgb(255, 255, 255);\n"
                                      "color: rgb(16, 209, 235);")
        self.pushButton.setObjectName("pushButton")
        self.layoutWidget = QtWidgets.QWidget(Form)
        self.layoutWidget.setGeometry(QtCore.QRect(590, 90, 111, 41))
        self.layoutWidget.setObjectName("layoutWidget")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.layoutWidget)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_2.setObjectName("verticalLayout_2")

        self.label_3 = QtWidgets.QLabel(self.layoutWidget)
        self.label_3.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_3.setObjectName("label_3")
        self.verticalLayout_2.addWidget(self.label_3)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.radioButton_4 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_4.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_4.setObjectName("radioButton_4")
        self.horizontalLayout_2.addWidget(self.radioButton_4)
        self.radioButton_5 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_5.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_5.setObjectName("radioButton_5")
        self.horizontalLayout_2.addWidget(self.radioButton_5)
        self.radioButton_6 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_6.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_6.setObjectName("radioButton_6")
        self.horizontalLayout_2.addWidget(self.radioButton_6)
        self.verticalLayout_2.addLayout(self.horizontalLayout_2)
        self.layoutWidget_2 = QtWidgets.QWidget(Form)
        self.layoutWidget_2.setGeometry(QtCore.QRect(590, 140, 111, 41))
        self.layoutWidget_2.setObjectName("layoutWidget_2")
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.layoutWidget_2)
        self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.label_4 = QtWidgets.QLabel(self.layoutWidget_2)
        self.label_4.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_4.setObjectName("label_4")
        self.verticalLayout_3.addWidget(self.label_4)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.radioButton_7 = QtWidgets.QRadioButton(self.layoutWidget_2)
        self.radioButton_7.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_7.setObjectName("radioButton_7")
        self.horizontalLayout_3.addWidget(self.radioButton_7)
        self.radioButton_8 = QtWidgets.QRadioButton(self.layoutWidget_2)
        self.radioButton_8.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_8.setObjectName("radioButton_8")
        self.horizontalLayout_3.addWidget(self.radioButton_8)
        self.radioButton_9 = QtWidgets.QRadioButton(self.layoutWidget_2)
        self.radioButton_9.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_9.setObjectName("radioButton_9")
        self.horizontalLayout_3.addWidget(self.radioButton_9)
        self.verticalLayout_3.addLayout(self.horizontalLayout_3)
        self.layoutWidget_3 = QtWidgets.QWidget(Form)
        self.layoutWidget_3.setGeometry(QtCore.QRect(590, 190, 111, 41))
        self.layoutWidget_3.setObjectName("layoutWidget_3")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.layoutWidget_3)
        self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.label_5 = QtWidgets.QLabel(self.layoutWidget_3)
        self.label_5.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_5.setObjectName("label_5")
        self.verticalLayout_4.addWidget(self.label_5)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.radioButton_10 = QtWidgets.QRadioButton(self.layoutWidget_3)
        self.radioButton_10.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_10.setObjectName("radioButton_10")
        self.horizontalLayout_4.addWidget(self.radioButton_10)
        self.radioButton_11 = QtWidgets.QRadioButton(self.layoutWidget_3)
        self.radioButton_11.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_11.setObjectName("radioButton_11")
        self.horizontalLayout_4.addWidget(self.radioButton_11)
        self.radioButton_12 = QtWidgets.QRadioButton(self.layoutWidget_3)
        self.radioButton_12.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_12.setObjectName("radioButton_12")
        self.horizontalLayout_4.addWidget(self.radioButton_12)
        self.verticalLayout_4.addLayout(self.horizontalLayout_4)
        self.layoutWidget_4 = QtWidgets.QWidget(Form)
        self.layoutWidget_4.setGeometry(QtCore.QRect(590, 240, 111, 41))
        self.layoutWidget_4.setObjectName("layoutWidget_4")
        self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.layoutWidget_4)
        self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_5.setObjectName("verticalLayout_5")
        self.label_6 = QtWidgets.QLabel(self.layoutWidget_4)
        self.label_6.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_6.setObjectName("label_6")
        self.verticalLayout_5.addWidget(self.label_6)
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.radioButton_13 = QtWidgets.QRadioButton(self.layoutWidget_4)
        self.radioButton_13.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_13.setObjectName("radioButton_13")
        self.horizontalLayout_5.addWidget(self.radioButton_13)
        self.radioButton_14 = QtWidgets.QRadioButton(self.layoutWidget_4)
        self.radioButton_14.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_14.setObjectName("radioButton_14")
        self.horizontalLayout_5.addWidget(self.radioButton_14)
        self.radioButton_15 = QtWidgets.QRadioButton(self.layoutWidget_4)
        self.radioButton_15.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_15.setObjectName("radioButton_15")
        self.horizontalLayout_5.addWidget(self.radioButton_15)
        self.verticalLayout_5.addLayout(self.horizontalLayout_5)
        self.layoutWidget_5 = QtWidgets.QWidget(Form)
        self.layoutWidget_5.setGeometry(QtCore.QRect(590, 290, 111, 41))
        self.layoutWidget_5.setObjectName("layoutWidget_5")
        self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.layoutWidget_5)
        self.verticalLayout_6.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        self.label_7 = QtWidgets.QLabel(self.layoutWidget_5)
        self.label_7.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_7.setObjectName("label_7")
        self.verticalLayout_6.addWidget(self.label_7)
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.radioButton_16 = QtWidgets.QRadioButton(self.layoutWidget_5)
        self.radioButton_16.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_16.setObjectName("radioButton_16")
        self.horizontalLayout_6.addWidget(self.radioButton_16)
        self.radioButton_17 = QtWidgets.QRadioButton(self.layoutWidget_5)
        self.radioButton_17.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_17.setObjectName("radioButton_17")
        self.horizontalLayout_6.addWidget(self.radioButton_17)
        self.radioButton_18 = QtWidgets.QRadioButton(self.layoutWidget_5)
        self.radioButton_18.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_18.setObjectName("radioButton_18")
        self.horizontalLayout_6.addWidget(self.radioButton_18)
        self.verticalLayout_6.addLayout(self.horizontalLayout_6)
        self.layoutWidget_6 = QtWidgets.QWidget(Form)
        self.layoutWidget_6.setGeometry(QtCore.QRect(590, 340, 111, 41))
        self.layoutWidget_6.setObjectName("layoutWidget_6")
        self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.layoutWidget_6)
        self.verticalLayout_7.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_7.setObjectName("verticalLayout_7")
        self.label_8 = QtWidgets.QLabel(self.layoutWidget_6)
        self.label_8.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_8.setObjectName("label_8")
        self.verticalLayout_7.addWidget(self.label_8)
        self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.radioButton_19 = QtWidgets.QRadioButton(self.layoutWidget_6)
        self.radioButton_19.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_19.setObjectName("radioButton_19")
        self.horizontalLayout_7.addWidget(self.radioButton_19)
        self.radioButton_20 = QtWidgets.QRadioButton(self.layoutWidget_6)
        self.radioButton_20.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_20.setObjectName("radioButton_20")
        self.horizontalLayout_7.addWidget(self.radioButton_20)
        self.radioButton_21 = QtWidgets.QRadioButton(self.layoutWidget_6)
        self.radioButton_21.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_21.setObjectName("radioButton_21")
        self.horizontalLayout_7.addWidget(self.radioButton_21)
        self.verticalLayout_7.addLayout(self.horizontalLayout_7)
        self.layoutWidget_7 = QtWidgets.QWidget(Form)
        self.layoutWidget_7.setGeometry(QtCore.QRect(590, 390, 111, 41))
        self.layoutWidget_7.setObjectName("layoutWidget_7")
        self.verticalLayout_8 = QtWidgets.QVBoxLayout(self.layoutWidget_7)
        self.verticalLayout_8.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_8.setObjectName("verticalLayout_8")
        self.label_9 = QtWidgets.QLabel(self.layoutWidget_7)
        self.label_9.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_9.setObjectName("label_9")
        self.verticalLayout_8.addWidget(self.label_9)
        self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_8.setObjectName("horizontalLayout_8")
        self.radioButton_22 = QtWidgets.QRadioButton(self.layoutWidget_7)
        self.radioButton_22.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_22.setObjectName("radioButton_22")
        self.horizontalLayout_8.addWidget(self.radioButton_22)
        self.radioButton_23 = QtWidgets.QRadioButton(self.layoutWidget_7)
        self.radioButton_23.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_23.setObjectName("radioButton_23")
        self.horizontalLayout_8.addWidget(self.radioButton_23)
        self.radioButton_24 = QtWidgets.QRadioButton(self.layoutWidget_7)
        self.radioButton_24.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_24.setObjectName("radioButton_24")
        self.horizontalLayout_8.addWidget(self.radioButton_24)
        self.verticalLayout_8.addLayout(self.horizontalLayout_8)
        self.layoutWidget_8 = QtWidgets.QWidget(Form)
        self.layoutWidget_8.setGeometry(QtCore.QRect(590, 440, 111, 41))
        self.layoutWidget_8.setObjectName("layoutWidget_8")
        self.verticalLayout_9 = QtWidgets.QVBoxLayout(self.layoutWidget_8)
        self.verticalLayout_9.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_9.setObjectName("verticalLayout_9")
        self.label_10 = QtWidgets.QLabel(self.layoutWidget_8)
        self.label_10.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_10.setObjectName("label_10")
        self.verticalLayout_9.addWidget(self.label_10)
        self.horizontalLayout_9 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_9.setObjectName("horizontalLayout_9")
        self.radioButton_25 = QtWidgets.QRadioButton(self.layoutWidget_8)
        self.radioButton_25.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_25.setObjectName("radioButton_25")
        self.horizontalLayout_9.addWidget(self.radioButton_25)
        self.radioButton_26 = QtWidgets.QRadioButton(self.layoutWidget_8)
        self.radioButton_26.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_26.setObjectName("radioButton_26")
        self.horizontalLayout_9.addWidget(self.radioButton_26)
        self.radioButton_27 = QtWidgets.QRadioButton(self.layoutWidget_8)
        self.radioButton_27.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_27.setObjectName("radioButton_27")
        self.horizontalLayout_9.addWidget(self.radioButton_27)
        self.verticalLayout_9.addLayout(self.horizontalLayout_9)
        self.layoutWidget_9 = QtWidgets.QWidget(Form)
        self.layoutWidget_9.setGeometry(QtCore.QRect(590, 490, 111, 41))
        self.layoutWidget_9.setObjectName("layoutWidget_9")
        self.verticalLayout_10 = QtWidgets.QVBoxLayout(self.layoutWidget_9)
        self.verticalLayout_10.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_10.setObjectName("verticalLayout_10")

        self.label_11 = QtWidgets.QLabel(self.layoutWidget_9)
        self.label_11.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_11.setObjectName("label_11")
        self.verticalLayout_10.addWidget(self.label_11)
        self.horizontalLayout_10 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_10.setObjectName("horizontalLayout_10")
        self.radioButton_28 = QtWidgets.QRadioButton(self.layoutWidget_9)
        self.radioButton_28.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_28.setObjectName("radioButton_28")
        self.horizontalLayout_10.addWidget(self.radioButton_28)
        self.radioButton_29 = QtWidgets.QRadioButton(self.layoutWidget_9)
        self.radioButton_29.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_29.setObjectName("radioButton_29")
        self.horizontalLayout_10.addWidget(self.radioButton_29)
        self.radioButton_30 = QtWidgets.QRadioButton(self.layoutWidget_9)
        self.radioButton_30.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_30.setObjectName("radioButton_30")
        self.horizontalLayout_10.addWidget(self.radioButton_30)
        self.verticalLayout_10.addLayout(self.horizontalLayout_10)

        self.widget = QtWidgets.QWidget(Form)
        self.widget.setGeometry(QtCore.QRect(590, 40, 111, 41))
        self.widget.setObjectName("widget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.widget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")

        self.label_2 = QtWidgets.QLabel(self.widget)
        self.label_2.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_2.setObjectName("label_2")
        self.verticalLayout.addWidget(self.label_2)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")

        self.radioButton = QtWidgets.QRadioButton(self.widget)
        self.radioButton.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton.setObjectName("radioButton")
        self.horizontalLayout.addWidget(self.radioButton)

        self.radioButton_2 = QtWidgets.QRadioButton(self.widget)
        self.radioButton_2.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_2.setObjectName("radioButton_2")
        self.horizontalLayout.addWidget(self.radioButton_2)

        self.radioButton_3 = QtWidgets.QRadioButton(self.widget)
        self.radioButton_3.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_3.setObjectName("radioButton_3")
        self.horizontalLayout.addWidget(self.radioButton_3)

        self.verticalLayout.addLayout(self.horizontalLayout)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "Form"))
        self.label.setText(_translate("Form", "TextLabel"))
        self.pushButton.setText(_translate("Form", "Завершить тест"))
        self.label_3.setText(_translate("Form", "№2"))
        self.radioButton_4.setText(_translate("Form", "А"))
        self.radioButton_5.setText(_translate("Form", "Б"))
        self.radioButton_6.setText(_translate("Form", "В"))
        self.label_4.setText(_translate("Form", "№3"))
        self.radioButton_7.setText(_translate("Form", "А"))
        self.radioButton_8.setText(_translate("Form", "Б"))
        self.radioButton_9.setText(_translate("Form", "В"))
        self.label_5.setText(_translate("Form", "№4"))
        self.radioButton_10.setText(_translate("Form", "А"))
        self.radioButton_11.setText(_translate("Form", "Б"))
        self.radioButton_12.setText(_translate("Form", "В"))
        self.label_6.setText(_translate("Form", "№5"))
        self.radioButton_13.setText(_translate("Form", "А"))
        self.radioButton_14.setText(_translate("Form", "Б"))
        self.radioButton_15.setText(_translate("Form", "В"))
        self.label_7.setText(_translate("Form", "№6"))
        self.radioButton_16.setText(_translate("Form", "А"))
        self.radioButton_17.setText(_translate("Form", "Б"))
        self.radioButton_18.setText(_translate("Form", "В"))
        self.label_8.setText(_translate("Form", "№7"))
        self.radioButton_19.setText(_translate("Form", "А"))
        self.radioButton_20.setText(_translate("Form", "Б"))
        self.radioButton_21.setText(_translate("Form", "В"))
        self.label_9.setText(_translate("Form", "№8"))
        self.radioButton_22.setText(_translate("Form", "А"))
        self.radioButton_23.setText(_translate("Form", "Б"))
        self.radioButton_24.setText(_translate("Form", "В"))
        self.label_10.setText(_translate("Form", "№9"))
        self.radioButton_25.setText(_translate("Form", "А"))
        self.radioButton_26.setText(_translate("Form", "Б"))
        self.radioButton_27.setText(_translate("Form", "В"))
        self.label_11.setText(_translate("Form", "№10"))
        self.radioButton_28.setText(_translate("Form", "А"))
        self.radioButton_29.setText(_translate("Form", "Б"))
        self.radioButton_30.setText(_translate("Form", "В"))
        self.label_2.setText(_translate("Form", "№1"))
        self.radioButton.setText(_translate("Form", "А"))
        self.radioButton_2.setText(_translate("Form", "Б"))
        self.radioButton_3.setText(_translate("Form", "В"))

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(763, 544)
        MainWindow.setMinimumSize(QtCore.QSize(0, 0))
        font = QtGui.QFont()
        font.setPointSize(18)
        MainWindow.setFont(font)
        MainWindow.setStyleSheet("background-color: rgb(16, 209, 235);\n"
                                 "")
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.layoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.layoutWidget.setGeometry(QtCore.QRect(30, 48, 711, 441))
        self.layoutWidget.setObjectName("layoutWidget")
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.layoutWidget)
        self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.text_zagolovok = QtWidgets.QTextBrowser(self.layoutWidget)
        self.text_zagolovok.setMaximumSize(QtCore.QSize(16777215, 100))
        self.text_zagolovok.setBaseSize(QtCore.QSize(0, 100))
        self.text_zagolovok.setStyleSheet("background-color: rgb(255, 255, 255);\n"
                                          "color: rgb(16, 209, 235);")
        self.text_zagolovok.setObjectName("text_zagolovok")
        self.verticalLayout_3.addWidget(self.text_zagolovok)
        self.verticalLayout_2 = QtWidgets.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")

class LastWindow(QtWidgets.QWidget, Ui_Form):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

class NewRules(QtWidgets.QWidget, Ui_NewRules):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        self.pushButton_3.clicked.connect(self.write_file)
        self.pushButton_4.clicked.connect(self.start_test)

        self.answers = None  # +++
        self.questions = None  # +++
        self.lastWindow = LastWindow()  # +++
        self.lastWindow.pushButton.clicked.connect(self.finish_test)  # +++
        self.rb_answers = {  # +++
            0: [self.lastWindow.radioButton,
                self.lastWindow.radioButton_2,
                self.lastWindow.radioButton_3],
            1: [self.lastWindow.radioButton_4,
                self.lastWindow.radioButton_5,
                self.lastWindow.radioButton_6],
            2: [self.lastWindow.radioButton_7,
                self.lastWindow.radioButton_8,
                self.lastWindow.radioButton_9],
            3: [self.lastWindow.radioButton_10,
                self.lastWindow.radioButton_11,
                self.lastWindow.radioButton_12],
            4: [self.lastWindow.radioButton_13,
                self.lastWindow.radioButton_14,
                self.lastWindow.radioButton_15],
            5: [self.lastWindow.radioButton_16,
                self.lastWindow.radioButton_17,
                self.lastWindow.radioButton_18],
            6: [self.lastWindow.radioButton_19,
                self.lastWindow.radioButton_20,
                self.lastWindow.radioButton_21],
            7: [self.lastWindow.radioButton_22,
                self.lastWindow.radioButton_23,
                self.lastWindow.radioButton_24],
            8: [self.lastWindow.radioButton_25,
                self.lastWindow.radioButton_26,
                self.lastWindow.radioButton_27],
            9: [self.lastWindow.radioButton_28,
                self.lastWindow.radioButton_29,
                self.lastWindow.radioButton_30],
        }

    def write_file(self):
        fileName, _ = QFileDialog.getOpenFileName(
            self,
            'Open File',
            '',
            '*.txt'
        )
        if not fileName:
            msg = QtWidgets.QMessageBox.information(
                self, 'Внимание', 'Добавте файл с тестом')
            return

        with open(fileName, "r", encoding='utf-8') as f:
            self.answers = f.readline()
            self.questions = f.readlines()

    def start_test(self):
        if self.answers is None:
            msg = QtWidgets.QMessageBox.information(
                None, 'Внимание', 'Добавте файл с тестом')
            return

        self.newRules = NewRules()

        self.newRules.push_btn_starttest.clicked.connect(self.window4)  # !!! +++

        self.newRules.show()
        self.hide()

    def window4(self):
        if self.questions is None:
            msg = QtWidgets.QMessageBox.information(
                self, 'Внимание', 'Добавте файл с тестом')
            return
        self.lastWindow.show()
        self.newRules.hide()

        self.lastWindow.label.clear()
        self.lastWindow.label.setFont(QtGui.QFont('TimesNewRoman', 15))
        for line in self.questions:
            self.lastWindow.label.setText(self.lastWindow.label.text() + line)

    def finish_test(self):
        answers = self.answers.split()
        # print(f'def finish_test(self): {answers}')

        self.lastWindow.label.clear()
        for i, q in enumerate(self.questions):
            # print(f'question: {i+1} -- {q}')
            answer = answers[i]

            rbs = self.rb_answers[i]
            rb_answer = '\tВы не отвечали на этот вопрос.\n'
            for j, rb in enumerate(rbs):
                if rb.isChecked():
                    if answer == str(j + 1):
                        rb_answer = '\tОтвет правильный.\n'
                    else:
                        rb_answer = '\tОтвет НЕ правильный.\n'
                    break
            self.lastWindow.label.setText(
                self.lastWindow.label.text() + q + rb_answer)

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    w = MainWindow()
    w.show()
    sys.exit(app.exec_())

A: Я полностью переделал форму class Ui_Form(object).

*

*виджеты вставлены в менеджер компоновки (попробуйте изменять размеры этого окна);

*QRadioButton добавлены в QButtonGroup.

Очень внимательно смотрите как вам заполнять файл.txt
Вам надо сделать вставку:
<br>

111.txt
2 1 1 2 3 1 1 1 1 3
Как называется группа файлов, которая хранится отдельной группой и имеет собственное имя? <br>     А Байт Б Каталог В Дискета
<br>Вопрос  2 ... <br>     А Байт Б Каталог В Дискета
<br>Вопрос  3 ... <br>     А Байт Б Каталог В Дискета
<br>Вопрос  4 ... <br>     А Байт Б Каталог В Дискета
<br>Вопрос  5 ... <br>     А Байт Б Каталог В Дискета
<br>Вопрос  6 ... <br>     А Байт Б Каталог В Дискета
<br>Вопрос  7 ... <br>     А Байт Б Каталог В Дискета
<br>Вопрос  8 ... <br>     А Байт Б Каталог В Дискета
<br>Вопрос  9 ... <br>     А Байт Б Каталог В Дискета
<br>Вопрос 10 ... <br>     А Байт Б Каталог В Дискета

main.py
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QFileDialog, QLabel
from q1496576_newrules import Ui_Form as Ui_NewRules

class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(800, 640)
        Form.setStyleSheet("background-color: rgb(16, 209, 235)")

        self.label = QtWidgets.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(10, 10, 571, 621))
        font = QtGui.QFont()
        font.setPointSize(8)
        self.label.setFont(font)
        self.label.setStyleSheet("background-color: rgb(255, 255, 255);\n"
                                 "color: rgb(16, 09, 35);")
        self.label.setObjectName("label")

        self.pushButton = QtWidgets.QPushButton(Form)
        self.pushButton.setGeometry(QtCore.QRect(590, 540, 111, 91))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.pushButton.setFont(font)
        self.pushButton.setStyleSheet("background-color: rgb(255, 255, 255);\n"
                                      "color: rgb(16, 209, 235);")
        self.pushButton.setObjectName("pushButton")

        self.layoutWidget = QtWidgets.QWidget(Form)
        self.layoutWidget.setGeometry(QtCore.QRect(590, 90, 111, 41))
        self.layoutWidget.setObjectName("layoutWidget")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.layoutWidget)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_2.setObjectName("verticalLayout_2")

        self.label_2 = QtWidgets.QLabel(self.layoutWidget)
        self.label_2.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_2.setObjectName("label_2")
        self.verticalLayout_2.addWidget(self.label_2)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")

        self.radioButton = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton.setObjectName("radioButton")
        self.horizontalLayout.addWidget(self.radioButton)

        self.radioButton_2 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_2.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_2.setObjectName("radioButton_2")
        self.horizontalLayout.addWidget(self.radioButton_2)

        self.radioButton_3 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_3.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_3.setObjectName("radioButton_3")
        self.horizontalLayout.addWidget(self.radioButton_3)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
# +++ vvvvv
        self.bg1 = QtWidgets.QButtonGroup(self.layoutWidget)
        self.bg1.addButton(self.radioButton)
        self.bg1.addButton(self.radioButton_2)
        self.bg1.addButton(self.radioButton_3)
# +++ ^^^^^

        self.label_3 = QtWidgets.QLabel(self.layoutWidget)
        self.label_3.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_3.setObjectName("label_3")
        self.verticalLayout_2.addWidget(self.label_3)

        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.radioButton_4 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_4.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_4.setObjectName("radioButton_4")
        self.horizontalLayout_2.addWidget(self.radioButton_4)
        self.radioButton_5 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_5.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_5.setObjectName("radioButton_5")
        self.horizontalLayout_2.addWidget(self.radioButton_5)
        self.radioButton_6 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_6.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_6.setObjectName("radioButton_6")
        self.horizontalLayout_2.addWidget(self.radioButton_6)
        self.verticalLayout_2.addLayout(self.horizontalLayout_2)
# +++ vvvvv
        self.bg2 = QtWidgets.QButtonGroup(self.layoutWidget)
        self.bg2.addButton(self.radioButton_4)
        self.bg2.addButton(self.radioButton_5)
        self.bg2.addButton(self.radioButton_6)
# +++ ^^^^^ и так далее

#        self.label_4 = QtWidgets.QLabel(self.layoutWidget_2)
        self.label_4 = QtWidgets.QLabel(self.layoutWidget)              # +++

        self.label_4.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_4.setObjectName("label_4")
#        self.verticalLayout_3.addWidget(self.label_4)
        self.verticalLayout_2.addWidget(self.label_4)                   # +++

        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.radioButton_7 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_7.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_7.setObjectName("radioButton_7")
        self.horizontalLayout_3.addWidget(self.radioButton_7)
        self.radioButton_8 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_8.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_8.setObjectName("radioButton_8")
        self.horizontalLayout_3.addWidget(self.radioButton_8)
        self.radioButton_9 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_9.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_9.setObjectName("radioButton_9")
        self.horizontalLayout_3.addWidget(self.radioButton_9)

#        self.verticalLayout_3.addLayout(self.horizontalLayout_3)
        self.verticalLayout_2.addLayout(self.horizontalLayout_3)           # +++
        self.bg3 = QtWidgets.QButtonGroup(self.layoutWidget)
        self.bg3.addButton(self.radioButton_7)
        self.bg3.addButton(self.radioButton_8)
        self.bg3.addButton(self.radioButton_9)

        self.label_5 = QtWidgets.QLabel(self.layoutWidget)
        self.label_5.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_5.setObjectName("label_5")
        self.verticalLayout_2.addWidget(self.label_5)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.radioButton_10 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_10.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_10.setObjectName("radioButton_10")
        self.horizontalLayout_4.addWidget(self.radioButton_10)
        self.radioButton_11 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_11.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_11.setObjectName("radioButton_11")
        self.horizontalLayout_4.addWidget(self.radioButton_11)
        self.radioButton_12 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_12.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_12.setObjectName("radioButton_12")
        self.horizontalLayout_4.addWidget(self.radioButton_12)
        self.verticalLayout_2.addLayout(self.horizontalLayout_4)
        self.bg4 = QtWidgets.QButtonGroup(self.layoutWidget)
        self.bg4.addButton(self.radioButton_10)
        self.bg4.addButton(self.radioButton_11)
        self.bg4.addButton(self.radioButton_12)

        self.label_6 = QtWidgets.QLabel(self.layoutWidget)
        self.label_6.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_6.setObjectName("label_6")
        self.verticalLayout_2.addWidget(self.label_6)
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.radioButton_13 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_13.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_13.setObjectName("radioButton_13")
        self.horizontalLayout_5.addWidget(self.radioButton_13)
        self.radioButton_14 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_14.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_14.setObjectName("radioButton_14")
        self.horizontalLayout_5.addWidget(self.radioButton_14)
        self.radioButton_15 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_15.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_15.setObjectName("radioButton_15")
        self.horizontalLayout_5.addWidget(self.radioButton_15)
        self.verticalLayout_2.addLayout(self.horizontalLayout_5)
        self.bg5 = QtWidgets.QButtonGroup(self.layoutWidget)
        self.bg5.addButton(self.radioButton_13)
        self.bg5.addButton(self.radioButton_14)
        self.bg5.addButton(self.radioButton_15)

        self.label_7 = QtWidgets.QLabel(self.layoutWidget)
        self.label_7.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_7.setObjectName("label_7")
        self.verticalLayout_2.addWidget(self.label_7)
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.radioButton_16 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_16.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_16.setObjectName("radioButton_16")
        self.horizontalLayout_6.addWidget(self.radioButton_16)
        self.radioButton_17 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_17.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_17.setObjectName("radioButton_17")
        self.horizontalLayout_6.addWidget(self.radioButton_17)
        self.radioButton_18 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_18.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_18.setObjectName("radioButton_18")
        self.horizontalLayout_6.addWidget(self.radioButton_18)
        self.verticalLayout_2.addLayout(self.horizontalLayout_6)
        self.bg6 = QtWidgets.QButtonGroup(self.layoutWidget)
        self.bg6.addButton(self.radioButton_16)
        self.bg6.addButton(self.radioButton_17)
        self.bg6.addButton(self.radioButton_18)

        self.label_8 = QtWidgets.QLabel(self.layoutWidget)
        self.label_8.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_8.setObjectName("label_8")
        self.verticalLayout_2.addWidget(self.label_8)
        self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.radioButton_19 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_19.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_19.setObjectName("radioButton_19")
        self.horizontalLayout_7.addWidget(self.radioButton_19)
        self.radioButton_20 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_20.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_20.setObjectName("radioButton_20")
        self.horizontalLayout_7.addWidget(self.radioButton_20)
        self.radioButton_21 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_21.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_21.setObjectName("radioButton_21")
        self.horizontalLayout_7.addWidget(self.radioButton_21)
        self.verticalLayout_2.addLayout(self.horizontalLayout_7)
        self.bg7 = QtWidgets.QButtonGroup(self.layoutWidget)
        self.bg7.addButton(self.radioButton_19)
        self.bg7.addButton(self.radioButton_20)
        self.bg7.addButton(self.radioButton_21)

        self.label_9 = QtWidgets.QLabel(self.layoutWidget)
        self.label_9.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_9.setObjectName("label_9")
        self.verticalLayout_2.addWidget(self.label_9)
        self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_8.setObjectName("horizontalLayout_8")
        self.radioButton_22 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_22.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_22.setObjectName("radioButton_22")
        self.horizontalLayout_8.addWidget(self.radioButton_22)
        self.radioButton_23 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_23.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_23.setObjectName("radioButton_23")
        self.horizontalLayout_8.addWidget(self.radioButton_23)
        self.radioButton_24 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_24.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_24.setObjectName("radioButton_24")
        self.horizontalLayout_8.addWidget(self.radioButton_24)
        self.verticalLayout_2.addLayout(self.horizontalLayout_8)
        self.bg8 = QtWidgets.QButtonGroup(self.layoutWidget)
        self.bg8.addButton(self.radioButton_22)
        self.bg8.addButton(self.radioButton_23)
        self.bg8.addButton(self.radioButton_24)

        self.label_10 = QtWidgets.QLabel(self.layoutWidget)
        self.label_10.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_10.setObjectName("label_10")
        self.verticalLayout_2.addWidget(self.label_10)
        self.horizontalLayout_9 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_9.setObjectName("horizontalLayout_9")
        self.radioButton_25 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_25.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_25.setObjectName("radioButton_25")
        self.horizontalLayout_9.addWidget(self.radioButton_25)
        self.radioButton_26 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_26.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_26.setObjectName("radioButton_26")
        self.horizontalLayout_9.addWidget(self.radioButton_26)
        self.radioButton_27 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_27.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_27.setObjectName("radioButton_27")
        self.horizontalLayout_9.addWidget(self.radioButton_27)
        self.verticalLayout_2.addLayout(self.horizontalLayout_9)
        self.bg9 = QtWidgets.QButtonGroup(self.layoutWidget)
        self.bg9.addButton(self.radioButton_25)
        self.bg9.addButton(self.radioButton_26)
        self.bg9.addButton(self.radioButton_27)

        self.label_11 = QtWidgets.QLabel(self.layoutWidget)
        self.label_11.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_11.setObjectName("label_11")
        self.verticalLayout_2.addWidget(self.label_11)
        self.horizontalLayout_10 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_10.setObjectName("horizontalLayout_10")
        self.radioButton_28 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_28.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_28.setObjectName("radioButton_28")
        self.horizontalLayout_10.addWidget(self.radioButton_28)
        self.radioButton_29 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_29.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_29.setObjectName("radioButton_29")
        self.horizontalLayout_10.addWidget(self.radioButton_29)
        self.radioButton_30 = QtWidgets.QRadioButton(self.layoutWidget)
        self.radioButton_30.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.radioButton_30.setObjectName("radioButton_30")
        self.horizontalLayout_10.addWidget(self.radioButton_30)
        self.verticalLayout_2.addLayout(self.horizontalLayout_10)
        self.bg10 = QtWidgets.QButtonGroup(self.layoutWidget)
        self.bg10.addButton(self.radioButton_28)
        self.bg10.addButton(self.radioButton_29)
        self.bg10.addButton(self.radioButton_30)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "Form"))
        self.label.setText(_translate("Form", "TextLabel"))
        self.pushButton.setText(_translate("Form", "Завершить тест"))
        self.label_3.setText(_translate("Form", "№2"))
        self.radioButton_4.setText(_translate("Form", "А"))
        self.radioButton_5.setText(_translate("Form", "Б"))
        self.radioButton_6.setText(_translate("Form", "В"))
        self.label_4.setText(_translate("Form", "№3"))
        self.radioButton_7.setText(_translate("Form", "А"))
        self.radioButton_8.setText(_translate("Form", "Б"))
        self.radioButton_9.setText(_translate("Form", "В"))
        self.label_5.setText(_translate("Form", "№4"))
        self.radioButton_10.setText(_translate("Form", "А"))
        self.radioButton_11.setText(_translate("Form", "Б"))
        self.radioButton_12.setText(_translate("Form", "В"))
        self.label_6.setText(_translate("Form", "№5"))
        self.radioButton_13.setText(_translate("Form", "А"))
        self.radioButton_14.setText(_translate("Form", "Б"))
        self.radioButton_15.setText(_translate("Form", "В"))
        self.label_7.setText(_translate("Form", "№6"))
        self.radioButton_16.setText(_translate("Form", "А"))
        self.radioButton_17.setText(_translate("Form", "Б"))
        self.radioButton_18.setText(_translate("Form", "В"))
        self.label_8.setText(_translate("Form", "№7"))
        self.radioButton_19.setText(_translate("Form", "А"))
        self.radioButton_20.setText(_translate("Form", "Б"))
        self.radioButton_21.setText(_translate("Form", "В"))
        self.label_9.setText(_translate("Form", "№8"))
        self.radioButton_22.setText(_translate("Form", "А"))
        self.radioButton_23.setText(_translate("Form", "Б"))
        self.radioButton_24.setText(_translate("Form", "В"))
        self.label_10.setText(_translate("Form", "№9"))
        self.radioButton_25.setText(_translate("Form", "А"))
        self.radioButton_26.setText(_translate("Form", "Б"))
        self.radioButton_27.setText(_translate("Form", "В"))
        self.label_11.setText(_translate("Form", "№10"))
        self.radioButton_28.setText(_translate("Form", "А"))
        self.radioButton_29.setText(_translate("Form", "Б"))
        self.radioButton_30.setText(_translate("Form", "В"))
        self.label_2.setText(_translate("Form", "№1"))
        self.radioButton.setText(_translate("Form", "А"))
        self.radioButton_2.setText(_translate("Form", "Б"))
        self.radioButton_3.setText(_translate("Form", "В"))

class Ui_MainWindow(object):
    ...

class LastWindow(QtWidgets.QWidget, Ui_Form):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
# +++ vvvvvvv
        self.pushButton.setMinimumHeight(41)
        self.label.setWordWrap(True)                                # !!! +++

        self.layout = QtWidgets.QGridLayout(self)                   # !!! +++
        self.layout.addWidget(self.label, 0, 0, 4, 5)
        self.layout.addWidget(self.layoutWidget, 0, 5, 3, 1)
        self.layout.addWidget(self.pushButton, 3, 5, 1, 1)
# +++ ^^^^^^^

class NewRules(QtWidgets.QWidget, Ui_NewRules):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):

    ...

    def window4(self):
        if self.questions is None:
            msg = QtWidgets.QMessageBox.information(
                self, 'Внимание', 'Добавте файл с тестом')
            return
        self.lastWindow.show()
        self.newRules.hide()

        self.lastWindow.label.clear()
        self.lastWindow.label.setFont(QtGui.QFont('TimesNewRoman', 10))    # + 10 ?
        for line in self.questions:
            self.lastWindow.label.setText(self.lastWindow.label.text() + line)

    def finish_test(self):
        answers = self.answers.split()
        self.lastWindow.label.clear()

        correct_answers = 0                                             # +++
        all_answers = 0                                                 # +++

        for i, q in enumerate(self.questions):
            # print(f'question: {i+1} -- {q}')
            answer = answers[i]

            rbs = self.rb_answers[i]
# +++                    vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
            rb_answer = '<br>     Вы не отвечали на этот вопрос.\n'
            for j, rb in enumerate(rbs):
                if rb.isChecked():
                    if answer == str(j + 1):
# +++                                vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
                        rb_answer = '<br>     Ответ правильный.\n'
                        correct_answers += 1                         # +++
                    else:
# +++                                vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
                        rb_answer = '<br>     Ответ НЕ правильный.\n'
                    break

            self.lastWindow.label.setText(
                self.lastWindow.label.text() + q + rb_answer)

# +++ vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
            all_answers += 1                                         # +++

        if correct_answers / all_answers * 100 >= 70:
            text = 'Отличный результат.'
        elif correct_answers / all_answers * 100 >= 50:
            text = 'Удовлетворительный результат.'
        else:
            text = 'Попробуйте тест пройти еще раз.'

        msg = QtWidgets.QMessageBox.information(
            self,
            'Рузультат',
            f'Правильно - {correct_answers} из {all_answers}. \n{text}.')

#        self.lastWindow.pushButton.setEnabled(False)                # +++
# +++ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    w = MainWindow()
    w.show()
    sys.exit(app.exec_())

A: Попробуйте так:
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QFileDialog, QLabel

from q1496576_newrules import Ui_Form as Ui_NewRules  #
#from form import Ui_Form as Ui_OpenTest  #

class Ui_Form(object):
    ...

class Ui_MainWindow(object):
    ...

class LastWindow(QtWidgets.QWidget, Ui_Form):
    ...

class NewRules(QtWidgets.QWidget, Ui_NewRules):
    ...

class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):

    ...

    def finish_test(self):
        answers = self.answers.split()
        # print(f'def finish_test(self): {answers}')

        self.lastWindow.label.clear()

        correct_answers = 0                                          # +++
        all_answers = 0                                              # +++

        for i, q in enumerate(self.questions):
            # print(f'question: {i+1} -- {q}')
            answer = answers[i]

            rbs = self.rb_answers[i]
            rb_answer = '\tВы не отвечали на этот вопрос.\n'
            for j, rb in enumerate(rbs):
                if rb.isChecked():
                    if answer == str(j + 1):
                        rb_answer = '\tОтвет правильный.\n'
                        correct_answers += 1                         # +++
                    else:
                        rb_answer = '\tОтвет НЕ правильный.\n'
                    break

            self.lastWindow.label.setText(
                self.lastWindow.label.text() + q + rb_answer)

# +++ vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
            all_answers += 1                                         # +++

        if correct_answers / all_answers * 100 >= 70:
            text = 'Отличный результат.'
        elif correct_answers / all_answers * 100 >= 50:
            text = 'Удовлетворительный результат.'
        else:
            text = 'Попробуйте тест пройти еще раз.'

        msg = QtWidgets.QMessageBox.information(
            self,
            'Рузультат',
            f'Правильно - {correct_answers} из {all_answers}. \n{text}.')

#        self.lastWindow.pushButton.setEnabled(False)                # +++
# +++ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    w = MainWindow()
    w.show()
    sys.exit(app.exec_())


text:
Q: Meteor JS: Cron job that parses XML I have a cron job setup in Meteor (https://github.com/tmeasday/meteor-cron).
Here is my code:
var onetKeys = ["17-0000.00",
          "27-0000.00",
          "37-0000.00",
          "13-0000.00",
          "21-0000.00",
          "15-0000.00",
          "47-0000.00",
          "25-0000.00",
          "45-0000.00",
          "35-0000.00",
          "29-0000.00",
          "49-0000.00",
          "23-0000.00",
          "19-0000.00",
          "11-0000.00",
          "43-0000.00",
          "39-0000.00",
          "51-0000.00",
          "33-0000.00",
          "41-0000.00",
          "53-0000.00"];

console.log("[+] ==== Cron Jobs ====");

Meteor.startup(function(){

  cron = new Cron();

  cron.addJob(500, function(){

    var params = [], finalUrl;

    $.each(onetKeys, function(i, onet){
      params.push("onet=" + onet);
      params.push("cn=100");
      params.push("rs=1&re=500");
      finalUrl = params.join("&");

      Meteor.call('retrieveJobs', finalUrl, function(error, results){
        console.log('GOT JOBS');
        $('job', results.content).each(function(){
          var jvid = $(this).find('jvid').text();
          if(!Jobs.findOne({jvid: jvid})) {
            options = {}
            options.title = $(this).find('title').text();
            options.company = $(this).find('company').text();
            options.address = $(this).find('location').text();
            options.url = $(this).find('url').text();
            options.jvid = jvid;
            options.dateacquired = $(this).find('dateacquired').text();
            var id = createJob(options);
            console.log("Job Created: " + id);
          }
        });
      });
    });
  })
})

The code above is in project_root/cron.js which will execute with the client. I am needing to move this out to the server, but am not sure how to process XML without the help of jQuery (sad, I know). Any good examples of how to parse XML in JavaScript without jQuery?

A: Search here: https://www.npmjs.org/search?q=xml.
There are
several
Node.js
XML
parsers
out there. Pick the one that suits you and use it.


text:
Q: How can I get rid of all the extra numbers in this return date from react-date-picker? I am trying to just show the Month and Day but I am getting "Tue Oct 22 2019 00:00:00 GMT-0700 (Mountain Standard Time)". When using "react-date-picker", how can I just have it return ex: "Tue Oct 22 2019" without resorting to truncating the text?
<DatePicker
  name="date"
  onChange={this.handleDate}
  value={this.state.date}
  format="M-dd"
/>

A: This is what you're looking for - toLocaleDateString()

const today = new Date();

console.log(today); // "2019-10-17T04:38:49.459Z"

console.log(today.toLocaleDateString("en-US")); // 10/17/2019

` - Returns the second (0-59).
Additionally, JavaScript Date has several methods allowing you to extract its parts:
getFullYear() - Returns the 4-digit year
getMonth() - Returns a zero-based integer (0-11) representing the month of the year.
getDate() - Returns the day of the month (1-31).
getDay() - Returns the day of the week (0-6). 0 is Sunday, 6 is Saturday.
getHours() - Returns the hour of the day (0-23).
getMinutes() - Returns the minute (0-59).`
There are a few more, but these are the important ones.
May I also suggest exploring the moment.js library.


text:
Q: clikjacking Implementation issue I have added the following meta tag to avoid clickjacking in my website.
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">

But it throws "Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-CwE3Bg0VYQOIdNAkbB/Btdkhul49qZuwgNCMPgNY5zw='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback."

A: Add
style-src 'unsafe-inline' 'self'
Or move the inline CSS to an external file. However, it's incredibly common to allow inline styles even though there is some risk involved.


text:
Q: height:auto? height:initial? or height:inherit? I have a small question: I have an element whose height is fixed to height: 50px; I put a media-queries when the device is lower than 600px, this same element has a height that adapts to the behavior of its children, which are in flex-wrap: wrap, What would you put this parent in: height: auto ? Height: initial? Or height: inherit? Why?

A: In your case you could use either height: auto or height: initial, as the height property's default/initial value is auto.
height: inherit means it will inherit the value of its parents height, which might, or might not, be a value that will make it size to its content.
Read more here about the height property:

*

*https://developer.mozilla.org/en/docs/Web/CSS/height
Read more here about the initial value:

*

*https://developer.mozilla.org/en-US/docs/Web/CSS/initial_value


text:
Q: Domain whitelisting in Kubernetes DNS Service Can I use Kubernetes dns service to whitelist the domains for my pods? I want to restrict the outgoing (egress) calls using Kubernetes dns service. if I can achieve this, can someone let me know the steps required to implement this.
Note: I see in my default pods that coredns pod is already present with image: rancher/coredns-coredns:1.8.3. I understand that it comes default with k3s.
PS: I have already explored calico and other network policy but they are not fulfilling my requirement.


text:
Q: Usin case expression to wrap result in Haskell Suppose I have some type
data Result = Fail | Success deriving (Show)

expressing result of some operation and another arbitrary type
data MyData

and some function which processes the data
someAction :: MyData -> Result
someAction = if ... then Success else Fail

I need a wrapper function formatAction which calls someAction with MyData and formats the result of processing using case statement. Something like that:
formatAction :: MyData -> String
formatAction = let res = someAction in
  case res of
    Success -> "OK"
    Fail -> "Fail"

It's not a valid code, but I can't undestand how to use result of the function with 'case' expression. Any idea?
Actually I meant a piece of code like that:
data Result = Fail | Success

data SomeData = SDS | SDF

doSomeWork' :: SomeData -> Result
doSomeWork' SDS = Success
doSomeWork' _ = Fail

processData :: SomeData -> String
processData = let res = doSomeWork' in
    case res of
        Success -> "OK"
        Fail -> "Fail"

It doesn't compile with the message:
D:\Work\Haskell\revRange.hs:16:17:
    Couldn't match expected type SomeData -> Result'
                with actual typeResult'
    In the pattern: Success
    In a case alternative: Success -> "OK"
    In the expression:
      case res of {
        Success -> "OK"
        Fail -> "Fail" }
D:\Work\Haskell\revRange.hs:16:28:
    Couldn't match expected type SomeData -> String'
                with actual type[Char]'
    In the expression: "OK"
    In a case alternative: Success -> "OK"
    In the expression:
      case res of {
        Success -> "OK"
        Fail -> "Fail" }
D:\Work\Haskell\revRange.hs:17:17:
    Couldn't match expected type SomeData -> Result'
                with actual typeResult'
    In the pattern: Fail
    In a case alternative: Fail -> "Fail"
    In the expression:
      case res of {
        Success -> "OK"
        Fail -> "Fail" }
D:\Work\Haskell\revRange.hs:17:25:
    Couldn't match expected type SomeData -> String'
                with actual type[Char]'
    In the expression: "Fail"
    In a case alternative: Fail -> "Fail"
    In the expression:
      case res of {
        Success -> "OK"
        Fail -> "Fail" }
Just can't catch how to match the result to the patterns.

A: You may need to add the function parameter
formatAction :: MyData -> String
formatAction d =
  case someAction d of
    Success -> "OK"
    Fail -> "Fail"


text:
Q: Sending two Content-Security-Policy headers I current have an nginx server that is sending the Content-Security-Policy header, however I've read that apparently IE only supports "X-Content-Security-Policy".
Would it be a good idea to send both Content-Security-Policy and X-Content-Security-Policy headers with requests or will this create conflicts? Would it instead be a good idea to use a conditional statement to send the correct header for the correct browser-based on the user agent?

A: Because user agents (browsers) ignore headers they do not understand, as long as the effect of the headers are the same you will not experience problems by providing both.  Do whichever you find more expedient.  Best practice would be to behave conditionally based on the user agent identification, but I can't think of any reason why this would actually be necessary.


text:
Q: Perl substitution fails with multiline I have two web pages, one page has been created by hand, the other has been published with visual studio 2010 (.aspx). I want to modify the content of these files, replacing a bunch of script tags by a single script tag. To achieve this goal, I simply run some Perl code from a batch file. Here is the Perl code and the HTML before and after substitution :
Perl in a batch :
perl -pi.backup -e "s/<!--\s*<pack>\s*-->.*?<!--\s*<\/pack>\s*-->/<script src=\"pack.js\"><\/script>/s" file.aspx

HTML input :
<!-- <pack> -->
<script src="file1.js" type="text/javascript"></script>
<script src="file2.js" type="text/javascript"></script>
<!-- </pack> -->

HTML output :
<script src="pack.js"></script>

Everything works fine for the hand created file, while the generated file is not updated unless all lines are gathered into one. I guess the issue comes from linebreaks but I can't figure out why it does work only for the first file since the code is exactly the same.

A: Your problem is that running Perl with the -p switch causes it to execute the code for each line and print the result.  Thus the regex is only seeing one line of the file at a time, and is never able to match the entire pattern.
You could do something like this:
perl -i.backup -e "undef $/; $_=<>; s/<!--\s*<pack>\s*-->.*?<!--\s*<\/pack>\s*-->/<script src=\"pack.js\"><\/script>/s; print" file.aspx

It slurps the whole file into $_, then performs your substitution and prints the result to the same file.


text:
Q: Oracle SQL Stored Procedure missing expression error I am writing a stored procedure that is a dynamic sequel statement to write from one intermediate table to another table. I'm pretty new at writing sql and stored procedures especially. I tried add parameters within my statement but kept receiving this error:
ORA-00936: missing expression
ORA-06512: at "ECH_ETL_BATCH_ID.LOOKUP_TABLE_INSERT", line 26
ORA-06512: at line 14
Process exited.
I took out the parameters and hardcoded in values to just try to get it to work but I'm still receiving the same errors.
Any suggestions?
create or replace PROCEDURE
LOOKUP_TABLE_INSERT
(
P_SOURCE_DB IN VARCHAR2
, P_SOURCE_TABLE IN VARCHAR2
, P_TARGET_DB IN VARCHAR2
, P_TARGET_TABLE IN VARCHAR2
, P_COLUMN_NAME IN VARCHAR2
) AS
l_sql_statement VARCHAR2(1000);
BEGIN

l_sql_statement :=
'INSERT INTO ECH_ETL_BATCH_ID.C_S_LU_PTY_ROLE_TP' ||
'(PKEY_SRC_OBJECT, VERSION_SEQ, TIMELINE_ACTION, LAST_UPDATE_DATE, SRC_ROWID,
HUB_STATE_IND, ROLE_TP) ' ||
' SELECT MISSING_VALUES AS PKEY_SRC_OBJECT' ||
', 1 as VERSION_SEQ' ||
', 0 as TIMELINE_ACTION' ||
', INSERT_TS as LAST_UPDATE_DATE' ||
', MISSING_VALUES as "SRC_ROWID"' ||
', 1 as "HUB_STATE_IND"' ||
', MISSING_VALUES as ROLE_TP' || --P_COLUMN_NAME ||
' FROM ECH_ETL_BATCH_ID.Ref_Intermediate ' ||
WHERE COLUMN_NM =' || ''||ROLE_TP||'' ||
'AND LOOKUP_TBL_NM =' || ''||C_S_LU_PTY_ROLE_TP||'';
dbms_output.put_line(l_sql_statement);
EXECUTE IMMEDIATE l_sql_statement;
COMMIT;
END;

EXECUTE IMMEDIATE l_sql_statement;
COMMIT;
END;

A: your problem is in the where condition . remove the ||
If you do a dbms_output.putline(); you ll get the statment
To add the single quotes check the solution below
the reason of error:
INSERT INTO ECH_ETL_BATCH_ID.C_S_LU_PTY_ROLE_TP
  (PKEY_SRC_OBJECT,
   VERSION_SEQ,
   TIMELINE_ACTION,
   LAST_UPDATE_DATE,
   SRC_ROWID,
   HUB_STATE_IND,
   ROLE_TP)
  SELECT MISSING_VALUES AS PKEY_SRC_OBJECT,
         1              as VERSION_SEQ,
         0              as TIMELINE_ACTION,
         INSERT_TS      as LAST_UPDATE_DATE,
         MISSING_VALUES as "SRC_ROWID",
         1              as "HUB_STATE_IND",
         MISSING_VALUES as ROLE_TP
    FROM ECH_ETL_BATCH_ID.Ref_Intermediate
   WHERE COLUMN_NM = || ROLE_TP ||
     AND LOOKUP_TBL_NM = || C_S_LU_PTY_ROLE_TP ||

The solution :
create or replace PROCEDURE
LOOKUP_TABLE_INSERT
(
P_SOURCE_DB IN VARCHAR2
, P_SOURCE_TABLE IN VARCHAR2
, P_TARGET_DB IN VARCHAR2
, P_TARGET_TABLE IN VARCHAR2
, P_COLUMN_NAME IN VARCHAR2
) AS
l_sql_statement VARCHAR2(1000);
BEGIN

l_sql_statement :=
'INSERT INTO ECH_ETL_BATCH_ID.C_S_LU_PTY_ROLE_TP' ||
'(PKEY_SRC_OBJECT, VERSION_SEQ, TIMELINE_ACTION, LAST_UPDATE_DATE, SRC_ROWID,
HUB_STATE_IND, ROLE_TP) ' ||
' SELECT MISSING_VALUES AS PKEY_SRC_OBJECT' ||
', 1 as VERSION_SEQ' ||
', 0 as TIMELINE_ACTION' ||
', INSERT_TS as LAST_UPDATE_DATE' ||
', MISSING_VALUES as "SRC_ROWID"' ||
', 1 as "HUB_STATE_IND"' ||
', MISSING_VALUES as ROLE_TP' || --P_COLUMN_NAME ||
' FROM ECH_ETL_BATCH_ID.Ref_Intermediate ' ||
' WHERE COLUMN_NM =''' ||ROLE_TP||''
' AND LOOKUP_TBL_NM =''' ||C_S_LU_PTY_ROLE_TP|''' ';
dbms_output.put_line(l_sql_statement);
EXECUTE IMMEDIATE l_sql_statement;
COMMIT;
END;
/

A: The dynamic statement your (edited) code generates is:
INSERT INTO ECH_ETL_BATCH_ID.C_S_LU_PTY_ROLE_TP(PKEY_SRC_OBJECT, VERSION_SEQ, TIMELINE_ACTION, LAST_UPDATE_DATE, SRC_ROWID,
HUB_STATE_IND, ROLE_TP)  SELECT MISSING_VALUES AS PKEY_SRC_OBJECT, 1 as VERSION_SEQ, 0 as TIMELINE_ACTION, INSERT_TS as LAST_UPDATE_DATE, SELECT MISSING_VALUES as "SRC_ROWID", 1 as "HUB_STATE_IND", MISSING_VALUES as ROLE_TP FROM ECH_ETL_BATCH_ID.Ref_Intermediate  WHERE COLUMN_NM =||ROLE_TP|| AND LOOKUP_TBL_NM =||C_S_LU_PTY_ROLE_TP||

or split onto multiple lines and annotated to show the issues it has:
INSERT INTO ECH_ETL_BATCH_ID.C_S_LU_PTY_ROLE_TP(PKEY_SRC_OBJECT, VERSION_SEQ,
  TIMELINE_ACTION, LAST_UPDATE_DATE, SRC_ROWID, HUB_STATE_IND, ROLE_TP)
SELECT MISSING_VALUES AS PKEY_SRC_OBJECT
, 1 as VERSION_SEQ
, 0 as TIMELINE_ACTION
, INSERT_TS as LAST_UPDATE_DATE
, SELECT MISSING_VALUES as "SRC_ROWID"
--^^^^^^
, 1 as "HUB_STATE_IND"
, MISSING_VALUES as ROLE_TP
FROM ECH_ETL_BATCH_ID.Ref_Intermediate
WHERE COLUMN_NM =||ROLE_TP|| AND LOOKUP_TBL_NM =||C_S_LU_PTY_ROLE_TP||
--               ^^       ^^                    ^^                  ^^

You have a few problems with that; mostly that you have sets of || embedded in the generated statement in odd places, but also that you have an extra SELECT.
This might be closer to what you want, including escaped single quotes for your embedded string literals:
l_sql_statement :=
'INSERT INTO ECH_ETL_BATCH_ID.C_S_LU_PTY_ROLE_TP' ||
'(PKEY_SRC_OBJECT, VERSION_SEQ, TIMELINE_ACTION, LAST_UPDATE_DATE, SRC_ROWID, HUB_STATE_IND, ROLE_TP) ' ||
' SELECT MISSING_VALUES AS PKEY_SRC_OBJECT' ||
', 1 as VERSION_SEQ' ||
', 0 as TIMELINE_ACTION' ||
', INSERT_TS as LAST_UPDATE_DATE' ||
', MISSING_VALUES as "SRC_ROWID"' ||
', 1 as "HUB_STATE_IND"' ||
', MISSING_VALUES as ROLE_TP' ||
' FROM ECH_ETL_BATCH_ID.Ref_Intermediate ' ||
' WHERE COLUMN_NM = ''ROLE_TP''' ||
' AND LOOKUP_TBL_NM = ''C_S_LU_PTY_ROLE_TP''';

which generates (split again):
INSERT INTO ECH_ETL_BATCH_ID.C_S_LU_PTY_ROLE_TP(PKEY_SRC_OBJECT, VERSION_SEQ,
  TIMELINE_ACTION, LAST_UPDATE_DATE, SRC_ROWID, HUB_STATE_IND, ROLE_TP)
SELECT MISSING_VALUES AS PKEY_SRC_OBJECT
, 1 as VERSION_SEQ
, 0 as TIMELINE_ACTION
, INSERT_TS as LAST_UPDATE_DATE
, MISSING_VALUES as "SRC_ROWID"
, 1 as "HUB_STATE_IND"
, MISSING_VALUES as ROLE_TP
FROM ECH_ETL_BATCH_ID.Ref_Intermediate
WHERE COLUMN_NM = 'ROLE_TP'
AND LOOKUP_TBL_NM = 'C_S_LU_PTY_ROLE_TP'

You can split the string assignment across lines, which would simplify things a bit as it would reduce (or at the moment, remove) the string concatenation:
l_sql_statement :=
'INSERT INTO ECH_ETL_BATCH_ID.C_S_LU_PTY_ROLE_TP
(PKEY_SRC_OBJECT, VERSION_SEQ, TIMELINE_ACTION, LAST_UPDATE_DATE,
  SRC_ROWID, HUB_STATE_IND, ROLE_TP)
SELECT MISSING_VALUES AS PKEY_SRC_OBJECT
, 1 as VERSION_SEQ
, 0 as TIMELINE_ACTION
, INSERT_TS as LAST_UPDATE_DATE
, MISSING_VALUES as "SRC_ROWID"
, 1 as "HUB_STATE_IND"
, MISSING_VALUES as ROLE_TP
FROM ECH_ETL_BATCH_ID.Ref_Intermediate
WHERE COLUMN_NM = ''ROLE_TP''
AND LOOKUP_TBL_NM = ''C_S_LU_PTY_ROLE_TP''';

or you could use the alternative quoting mechanism to avoid having to escape the single quotes.
When creating a dynamic statement, start with a valid static one and work backwards; and use dbms_output to display the final generated string so you can verify it and if necessary run it manually.
Of course, this doesn't need to be dynamic at all, but from your original question you intend to use the procedure arguments in a subquery at some point.

To use procedure parameters instead of the string literals you had to start with, you can concatenate those in:
l_sql_statement :=
'INSERT INTO ECH_ETL_BATCH_ID.C_S_LU_PTY_ROLE_TP
(PKEY_SRC_OBJECT, VERSION_SEQ, TIMELINE_ACTION, LAST_UPDATE_DATE,
  SRC_ROWID, HUB_STATE_IND, ROLE_TP)
SELECT MISSING_VALUES AS PKEY_SRC_OBJECT
, 1 as VERSION_SEQ
, 0 as TIMELINE_ACTION
, INSERT_TS as LAST_UPDATE_DATE
, MISSING_VALUES as "SRC_ROWID"
, 1 as "HUB_STATE_IND"
, MISSING_VALUES as ROLE_TP
FROM ECH_ETL_BATCH_ID.Ref_Intermediate
WHERE COLUMN_NM = ' || P_COLUMN_NAME || '
AND LOOKUP_TBL_NM = ' || P_TARGET_TABLE;

or preferably use bind variables:
l_sql_statement :=
'INSERT INTO ECH_ETL_BATCH_ID.C_S_LU_PTY_ROLE_TP
(PKEY_SRC_OBJECT, VERSION_SEQ, TIMELINE_ACTION, LAST_UPDATE_DATE,
  SRC_ROWID, HUB_STATE_IND, ROLE_TP)
SELECT MISSING_VALUES AS PKEY_SRC_OBJECT
, 1 as VERSION_SEQ
, 0 as TIMELINE_ACTION
, INSERT_TS as LAST_UPDATE_DATE
, MISSING_VALUES as "SRC_ROWID"
, 1 as "HUB_STATE_IND"
, MISSING_VALUES as ROLE_TP
FROM ECH_ETL_BATCH_ID.Ref_Intermediate
WHERE COLUMN_NM = :COLUMN_NAME
AND LOOKUP_TBL_NM = :TARGET_TABLE';

EXECUTE IMMEDIATE l_sql_statement USING P_COLUMN_NAME, P_TARGET_TABLE;

This still doesn't need to be dynamic though.


text:
Q: Leaflet: Pan, center, zoom map to marker location I'm new to Leaflet and having fun with it so far. I have an interactive map with 170 or so markers around the world. Each marker has a title in the popup.  I'd also like to add a "zoom to" link inside of the popup.  When the user clicks zoom to, I would like the map to center on the marker and zoom in to a certain zoom level (see image)
The markers are being generated in PHP as a marker array with the title, and lat/longs, and injected into a javascript var called "items."
    for (var i = 0; i < items.length; i++) {
        marker = new L.marker([items[i][1],items[i][2]])
            .bindPopup(items[i][0])
            .addTo(map);
    }

A: *

*Keep your markers in an associative array (index must be unique).

*Put put a link in your popup text to call a function passing this index as argument.

*In your javascript function use panTo or flyTo
Here is some pseudo code:
var markersById = {};

for (var i = 0; i < items.length; i++) {
  marker = new L.marker([items[i][1],items[i][2]])
      .bindPopup('Center on map')
      .addTo(map);

  markersById[i] = marker;
}

function centerMapOnPost(markerId) {
    map.panTo(markersById[markerId].getLatLng());
}


text:
Q: Quandl import error in Python 3 I'm using Python 3.6.3 on Windows 10 and Quandl module in my pip list, but I get the following error:
import quandl
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    import quandl
  File "C:\Users\Kamal\AppData\Local\Programs\Python\Python36-32\lib\quandl\__init__.py", line 3, in <module>
    from .api_config import ApiConfig

ModuleNotFoundError: No module named 'quandl.api_config'

A: Try pip3 install quandl. If you have python2 installed, there may be a mismatch in symlinks related to pip.


text:
Q: Lightbox effect in Parallax site (single page site) I have made a parallax website using the skrollr plugin.
I want to enable a ligtbox effect to display a gallery. (currently using the fancybox plugin)
What happens is that the fancybox overlay is applied to the whole body, which is about 15000px high and I have to manually scroll to the middle of the page to see the picture pop-up.  (i hope im making sense to people who have worked with skrollr)
I have tried rendering the fancybox on another div, with fixed position but it seems to screw it up.
Are there any work arounds to fixing this?
Some other lightbox plugin that will render on an fixed position overlay, stable regardless to scroll position or body width?(i dont need it to be extremely fancy)


text:
Q: Does cron jobs per se represent a significant burden on a modern system? I'd like to run a pretty simple script (is there a dir with name x in dir y if so move it to dir z–and x will only be there about once a day) every 15 seconds or so (one minute divided into 4*15 seconds). Does running cron jobs like that (where the scripts they run are not resource intensive) have a non-neglible negative impact on performance, stability or anything else?

A: To answer the question in the title, no, most system do not experience much of a burden from running cron jobs. Much of the automated tasks that occur on a modern Unix system are kicked off by cron jobs.
Things such as rotating logs, and regenerating index files used by man are all kicked off via cron jobs.
If you're curious take a look in any of the directories under /etc/cron*. There are bound to be examples there which will shed light on how these things are accomplished on your system.

A: First the minimum resolution for cron is 1 minute. So every 15 seconds isn't going to happen. If you really need every 15 seconds then you need to re-think your strategy.
Next, cron just runs  tasks at a certain time. If the task is resource intensive then it will be in cron as well. If it's not then it won't be. cron adds (almost) NO overhead what so ever, because of the way it hands off the command to be run.
Finally running a task via cron every 1 minute is rather silly. Anacron (which runs back log cron tasks from when your computer is down, or sleeping) will run all the tasks in sequence when it thinks it needs to.
You will be much better served by running that task every 1 minute around the time the file should show up.  Or even once ever 10 mins.
There is no need to run the task  1,440 times just to catch a file that you know is only going to be there once a day.
If your task is so critical that it sees that file instantly then use something else. Otherwise I advise slowing down the task frequency to something more tuned to your needs.
That being said, if you really want to use cron for this, it won't add any more overhead then just running it via command line, but man will your email box be full.

A: The correct tool to use in this case is called inotify. It is a part of the linux kernel, and its purpose is to notify programs of changes to filesystems. It can be configured in a number of different ways, and is almost certainly suitable for what you are trying to do.

A: Often-spawned processes are always a risk of resources starving for the system, but precautions measures (such as limits) can be put as well.
P. S. In case you're really keen on efficiency for this very task you can use inotify approach instead.


text:
Q: soapui free version assertions request = response I will pass any memberid or active card for matching to verify activecard(cardno) matches memberid passed.
 Request:
 <MemberID>${Property Looper#memberid}</MemberID>
 <CardNo>${Property Looper#ActiveCard}</CardNo>

Expected result:
 <ReturnMessage>Cardno not found</ReturnMessage>

OR
 <ReturnMessage>SUCCESS</ReturnMessage>

How to put assertions to check if the member id in request will check matching with response? contains and not contains assertions seems like not working that well for this condition?
and i want the test to be passed even if the matching failed as the ultimate goal is to make sure the error is not from the data (the test pass regardless the return status) but the application.  Thanks
Edit:
after running the step
Edit 2:
after running script assertion
custom property added

A: You can use Script Assertion to achieve the same.
Based on the description, the assertion should be able to handle both below cases :

*

*some case, you may expect card not found

*some case, you may expect SUCCESS
Define test case level custom property, say EXPECTED_MESSAGE and provide appropriate expected value depending on the case.
Add below script assertion for the SOAP Request test step.
//Check if the response is received
assert context.response, 'Response is empty or null'

//Parse the response and find the ReturnMessage value
def actualMessage = new XmlSlurper().parseText(context.response).'**'.find{it.name() == 'ReturnMessage'}?.text()
log.info "Return message from response: $actualMessage"

//Read the expected message from custom property
def expectedMessage = context.expand('${#TestCase#EXPECTED_MESSAGE}')

//Verify with actual value
assert actualMessage == expectedMessage

A: Let us assume the output is like
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ReturnMessage>SUCCESS</ReturnMessage>
</soap:Body>
</soap:Envelope>

you can use the below script assertion
def groovyUtils = new  com.eviware.soapui.support.GroovyUtils(context)
def response = groovyUtils.getXmlHolder("First Step#Response")

String x = response.getNodeValue("//*[local-name()='ReturnMessage']")

 if(x.contains("Cardno not found" ) || x.contains("SUCCESS"))
 {
  log.info "Success"
 }
 else
{
log.info " Fail"
}

output is
Sat Oct 28 15:22:02 IST 2017:INFO:Success

Rao's approach is also correct. Its just that if you are following that approach you have to have 2 expected result custom properties since you have 2 properties.
You may have to use if condition before assertion as 1 assertion will fail because your results would be either "Cardno not found" or "SUCCESS"
2 Changes you might have to make in the script. replace 'First Step' with the name of your teststep
change the getNodeValue step to reach the actual place


text:
Q: QT: QTableView read cell content I'm writing a small program with QT creator (QT 5.2.1) under Windows 7 (32 bit) and I'm having problems reading the informations stored in a TableView. My application has 3 elements, a TableView to store text data, a TextBrowser to show info and a buttom.
I modified the TableView properties: when the user selects with the mouse a cell, the full row is selected and multiple row selection is not allowed.
The user select a row and when the buttom is pressed, I would like to read the content of a specific TableView cell and show it in a TextBrowser. In particular, I would like to know the row index of the selected row and read the content of the cell with that row index and a specific column index (example 2).
The pseudo-code is this:
void my_program::on_pushButton_clicked()

{
    ui->textBrowser->append("button pressed");
    QItemSelectionModel *select = ui->tableView->selectionModel();
    int index_row = select->selectedRows();
    int index_column = 2;
    char cell_data[30] = ??[index_row][index_column]
    ui->textBrowser->append(cell_data);
}

The main problem is that select->selectedRows() returns a QModelIndex that is a collection of indexs and I do not know how to convert it to int (since multiple selection are not allowed, it should have only one element).
I would be glad if someone can suggest me a way to proceed.
Thanks
  Francesco
edit:
Hi Bogdan, thanks a lot!! I succeed to read the cell content by using
ui->textBrowser->append(ui->tableView->model()->data(ui->tableView->model()->index(2,5)).toString());

this give me the content of the cell in position 2,5.
not sure if this is the best way or not but it works !!.
Can you be a bit more precise about how to iterate the QModeIndexList ? thanks :)

A: selectedRows() returns QModelIndexList, thus you need to iterate over it and call QModelIndex::data() to get stored data.


text:
Q: current image not deleting from array I stored multiple images in database. And i fetched the images using SQLite and added these to array. When i click the button it displays the array of images under scrollview. In scrollview when i click particular image it goes to center of the screen. Center of the screen images having another imageview. When i delete particular image from array, the current image is not deleting.
code:
SQLiteManager:
Table name: SimpleTbl
  id    sm     descrip        photo
    1      sm1    ok            BLOB(size:2345)

    2      sm2    ok1            BLOB(size:3245)

    3      sm3    ok2            BLOB(size:4535)

.h file:
@interface Mysof : NSObject{
    NSInteger sofId;
    NSString *sof;
    NSString *rating;
    UIImage *photo;
}

@property (nonatomic,retain)NSString *sofa;
@property (nonatomic, assign) NSInteger sofaId;
@property (nonatomic, retain)NSString *rating;
@property (nonatomic, retain) UIImage *photo;

.m file:
- (NSMutableArray *) getMylists{
    NSMutableArray *sArray = [[NSMutableArray alloc] init];
    @try {
        NSFileManager *fileMgr = [NSFileManager defaultManager];
        NSString *dbPath = [[[NSBundle mainBundle] resourcePath ]stringByAppendingPathComponent:@"Sample.sqlite"];
        BOOL success = [fileMgr fileExistsAtPath:dbPath];
        if(!success)
        {
            NSLog(@"Cannot locate database file '%@'.", dbPath);
        }
        if(!(sqlite3_open([dbPath UTF8String], &db) == SQLITE_OK))
        {
            NSLog(@"An error has occured.");
        }

      ;

        const char *sql = "SELECT * FROM SimpleTbl";

        NSLog(@"sql is %s", sql);

        sqlite3_stmt *sqlStatement;
        if(sqlite3_prepare(db, sql, -1, &sqlStatement, NULL) != SQLITE_OK)
        {
            NSLog(@"Problem with prepare statement");
        }

        //
        while (sqlite3_step(sqlStatement)==SQLITE_ROW) {
            Mysof *Mylist = [[Mysof alloc]init];
            Mylist.sofId = sqlite3_column_int(sqlStatement, 0);
            Mylist.sof = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,1)];
            Mylist.rating = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement, 2)];
            const char *raw = sqlite3_column_blob(sqlStatement, 3);
            int rawLen = sqlite3_column_bytes(sqlStatement, 3);
            NSData *data = [NSData dataWithBytes:raw length:rawLen];
            Mylist.photo = [[UIImage alloc] initWithData:data];
            [sArray addObject:Mylist];
        }
    }
    @catch (NSException *exception) {
        NSLog(@"An exception occured: %@", [exception reason]);
    }
    @finally {
        return sArray;
    }

}

Then viewcontroller i display the fetching image to imageview via button click:
-(void)click:(id)sender{

for (int i = 0; i<[self.arraysofs count]; i++ ) {
            NSLog(@"index %d",i);

          //  imgView1=[[UIButton alloc]initWithFrame:CGRectMake(20+(i*74), 500, 72, 72)];

            imgView1=[[UIButton alloc]initWithFrame:CGRectMake(20+(i*74), 0, 72, 72)];

            Width = Width + 20+(i*74);

            [imgView1 setTag:i+1];

            [imgView1 addTarget:self action:@selector(arraysofsClicked:) forControlEvents:UIControlEventTouchUpInside];

            [imgView1 setImage:((Mysof *)[self.arraysofs objectAtIndex:i]).photo forState:UIControlStateNormal];

            [scrollview addSubview:imgView1];

          //  [myScroll addSubview:imgView1];

        }

}

It displays the center of the screen:
-(void)arraysofsClicked:(id)sender{

 NSLog(@"button %d is clicked.", [sender tag]-1);

    mmageView=[[UIImageView alloc]initWithFrame:CGRectMake(50,50,150,150)];

    [mmageView setUserInteractionEnabled:YES];

     [mmageView setImage:((Mysof *) [self.arraysofs objectAtIndex:[sender tag]-1]).photo];

    [self.view addSubview:mmageView];

UILongPressGestureRecognizer *dblongpress=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(dblongPress:)];

    [mmageView addGestureRecognizer:dblongpress];

}

Long press for deleting images from center of the screen:
-(void)dblongPress:(UILongPressGestureRecognizer*)sender{

   //  NSLog(@"button %d is clicked.", [send tag]-1);

   // [mmageView setImage:((Mysof *) [self.sofas objectAtIndex:[send tag]-1]).photo];

    [mmageView removeFromSuperview];

  }

If two images on the center of the screen, when i click first images the second is removing.

A: The imageview you are seeing after deleting is the older one which you added earlier. This is because every time you press the button, it calls -(void)arraysofsClicked, and a new instance of the imageview is added there.
Solution is:
put this in viewDidLoad
mnageView = nil;

& Change this method
-(void)arraysofsClicked:(id)sender{

// chcek is mnageView is initialized before or not
if(mmageView == nil) {

    mmageView=[[UIImageView alloc]initWithFrame:CGRectMake(50,50,150,150)];

    [mmageView setUserInteractionEnabled:YES];

    [self.view addSubview:mmageView];

    UILongPressGestureRecognizer *dblongpress=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(dblongPress:)];

    [mmageView addGestureRecognizer:dblongpress];

}

// change image here
[mmageView setImage:((Mysof *) [self.arraysofs objectAtIndex:[sender tag]-1]).photo];

}

declare the mnageView globally in case you are not doing so. but from your code it seems you are declaring it globally.


text:
Q: merging train and test datasets into one using tensorflow I am working with the classic titanic dataset and trying to apply NNs. My data comes already split into train and dev sets. However, I want to merge the datasets together for many things (for example, my own splitting, etc..)
Is there a way I can merge both datasets?
I have looked around and only found information about how to split a dataset, but I was unable to find how to merge them back together.
Any help?
A MWE is provided below!
from __future__ import absolute_import,division,print_function,unicode_literals
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline

from IPython.display import clear_output
from six.moves import urllib
import tensorflow.compat.v2.feature_column as fc
import tensorflow as tf
import seaborn as sns

# URL address of data
TRAIN_DATA_URL = "https://storage.googleapis.com/tf-datasets/titanic/train.csv"
TEST_DATA_URL = "https://storage.googleapis.com/tf-datasets/titanic/eval.csv"

# Downloading data
train_file_path = tf.keras.utils.get_file("train.csv", TRAIN_DATA_URL)
test_file_path  = tf.keras.utils.get_file("eval.csv", TEST_DATA_URL)
# Reading data
data_train = pd.read_csv(train_file_path)
data_test  = pd.read_csv(test_file_path)

MY_DATA= MERGE HERE????? # merge(data_train,data_test)??

A: I assume data_train and data_test have the same number of columns and the column names are the same. Then just do
merged_df= pd.concat([data_train, data_test], axis=0)


text:
Q: Easiest way to format a number with thousand separators to an NSString according to the Locale I can't seem to find an easy way to do it. The exact thing I need is:
[NSString stringWithFormat:@"%d doodads", n];

Where n is an int. So for 1234 I'd want this string (under my locale):
@"1,234 doodads"

Thanks.

A: For 10.6 this works:
NSNumberFormatter* numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4];
[numberFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
NSString *numberString = [numberFormatter stringFromNumber: [NSNumber numberWithInteger: i]];

And it properly handles localization.

A: I have recently discovered this one-liner:
[@1234567 descriptionWithLocale:[NSLocale currentLocale]];  // 1,234,567

Or in Swift 2:
1234567.descriptionWithLocale(NSLocale.currentLocale())     // 1,234,567

Swift 3/4:
(1234567 as NSNumber).description(withLocale: Locale.current)

Formatted per the question:
[@(n) descriptionWithLocale:[NSLocale currentLocale]];

Formatted without Objective-C literals:
[[NSNumber numberWithInt:n] descriptionWithLocale:[NSLocale currentLocale]];

This is the solution I was looking for when I asked the question. Available since iOS 2.0 and OS X 10.0, documented to return a string version of the number formatted as per the locale provided. stringValue is even documented to use this method but passing nil.
Seeing as it is my question and this fits my answer best, I am tempted to change the tick, but it seems cruel. Update I changed the tick, this answer is the answer.

A: The below doesn't address the locale, but it is a better way (in my opinion) of setting the thousand separator on the number formatter.
NSNumberFormatter *numberFormat = [[[NSNumberFormatter alloc] init] autorelease];
numberFormat.usesGroupingSeparator = YES;
numberFormat.groupingSeparator = @",";
numberFormat.groupingSize = 3;

A: Todd Ransom answered this perfectly.
I would just like to add (in a separate comment, so I can show some nicely formatted code), that if you plan to do this regularly, it's worth creating an NSString helper class.
So, create yourself an NSStringHelper.h containing this:
#import <Foundation/Foundation.h>

@interface NSString (NSStringHelper)

+(NSString*)formatWithThousandSeparator:(NSInteger)number;

@end

..and an NSStringHelper.m file containing this:
#import "NSStringHelper.h"

@implementation NSString (NSStringHelper)

+(NSString*)formatWithThousandSeparator:(NSInteger)number
{
    //  Format a number with thousand seperators, eg: "12,345"
    NSNumberFormatter* numberFormatter = [[NSNumberFormatter alloc] init];
    [numberFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4];
    [numberFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
    NSString *result = [numberFormatter stringFromNumber:[NSNumber numberWithInteger:number]];
    return result;
}

@end

This gives you the perfect way to reuse this code in future projects.
 #import "NSStringHelper.h"

 NSInteger numOfUsers = 12345;
 NSString* strNumberOfUsers = [NSString formatWithThousandSeparator:numOfUsers];

Cool, hey ?
Again, apologies for reposting Todd's answer (which was exactly what I was looking for !), but this is a great way to solve the problem, and have it ready to be used in your future XCode projects.

A: Use an NSNumberFormatter.


text:
Q: How to make text in the body ends two lines before the page numbering in Latex? I want left margin of 1.5 inch and all other margins to be 1 inch. Page numbering should be 1 inch above the bottom of the page. The text of the body should end two lines before the page numbering.
I used geometry Package.
\geometry{a4paper,top = 1in,bottom = 1in,left = 1.5in,right = 1in}

I guess the page numbering margin is defined by the bottom margin. I am having trouble in making main body text ends two lines before the page numbering.
Can we do that using geometry package?


text:
Q: Nougat device crashes, Marshmallow doesn't - NullPointerException on MenuItem I've been developing an app in a Marshmallow 6.0 phone. Today, I ran it in a Nougat 7.0 phone and everything was ok. Changed one line of xml code ('selectableItemBackground' to 'selectableItemBackgroundBorderless' in a LinearLayout) and got an NPE on an unrelated MenuItem ("Attempt to invoke interface method 'android.view.MenuItem android.view.MenuItem.setIcon(int)' on a null object reference") here:
public void updateSpeakerIcon() {
        if (mIsSpeakerOn) {
            mSpeakerIcon.setIcon(R.drawable.speaker);
            setVolumeControlStream(AudioManager.STREAM_MUSIC);
        } else {
            mSpeakerIcon.setIcon(R.drawable.earphone);
            setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
        }
    }

I'm using a ViewPager; this method is declared in the activity that contains it; the fragments call this method in their onResume callback.
mSpeakerIcon is 'found' in the onCreateOptionsMenu callback, in the same activity:
@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.qmenu, menu);
        mSpeakerIcon = menu.findItem(R.id.toggle_speaker);
        return true;
    }

I've changed the one line back to what it was but, of course, it did not fix the problem. Ran the app once again in the 6.0 device and there's no error.
Any ideas? Thanks in advance!