text:
Q: People who do not drink tea Is there a specific term that can be used for the people who do not drink tea or coffee like there is vegetarian in case of meat?

A: The short answer to your question is no, there is no specific term for people who do not drink tea or coffee. The general term for someone who avoids something is abstainer.

abstainer, noun.

*

*a person who abstains from something regarded as improper or unhealthy, especially the drinking of alcoholic beverages.

*a person who abstains from anything.

  abstain, verb (used without object).

*

*to hold oneself back voluntarily, especially from something regarded as improper or unhealthy (usually followed by from)

A: There is a word you can use, but it is not an established word:
teatotaller
This is based on the same-sounding word
teetotaller
which is someone who abstains from alcohol (link to Oxford dictionary online).

A: As commented by some users, there is no established word or term for someone who doesn't drink tea or coffee.
People who avoid consuming carbohydrates are called "carb-shunner" and you can consider using a tea-shunner and coffee-shunner.
The word shunner means

someone who avoids or keeps away from someone or something.

Or non-drinker of coffee (tea) could be used.
[Yourdictionary.com]


text:
Q: is it possible to create an image from an url i have an url="http://some url";
Is it possible to create an image of the url using php?
I tried using imagecreatefromjpeg but it accepts only image file as the input and not the url like "http://"

A: I'm not sure what you mean - do you mean create an image of the page
itself?  Then yes, it's possible.  All you need to do is parse the html,
fetch any css and parse it, add in images and process any javascript in
the page.
Of course, it might take you a few years to build such an application,
but it can be done.  And at the end you'll have a browser written in
php, which will be quite slow.

A: If you need to take a snapshot of a web url using just php you need an external tool like cutycapt.
It is quite invasive for a server (you need an X environment) but it the easiest solution to go at present.

A: If you want to create an image with your url text in it then use something like, imagefttext, for more visit php.net/imagefttext, in case you want to take a screenshot of the webpage at given url, go to this SO link: Command line program to create website screenshots (on Linux)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Change select to ui-select with ngRepeat filters I am using plain HTML select boxes to filter ngRepeat results, like so:
<select ng-model="theFilter.choice">
    <option value="">Any</option>
    <option value="Yes">Yes</option>
    <option value="No">No</option>
</select>

<select ng-model="theFilter.otherChoice">
    <option value="">Any</option>
    <option value="Yes">Yes</option>
    <option value="No">No</option>
</select>

{{ item.showMe }}

{{ item.amIDeleted }}

This works as intended.  But, like we all know the styling of the Browser select box is not very nice, so I am trying to replace the normal select boxes with ui-select select boxes, but these select boxes do not work correctly.
See plunker here
When the ui-select is changed first, nothing happens.  But when the select box is selected first, the ui-select becomes available to use.  I can then use both ui-select and the HTML5 select box.  But I only want to use the ui-select.
My question is: Is there any way that I can use the ui-select instead of the normal select box to filter my results?

A: You can try like this working plunker example of ui-select with filter option of your example scenario:
Controller:
$scope.theFilter = {
    showMe: $scope.options[0].showMe,
    amIDeleted: $scope.options[0].amIDeleted
};


text:
Q: Firebase function doesnt update, function returned undefined Im trying with this firebase function to update the author.
 exports.updateCourseName = functions.firestore
    .document('courses/{courseId}')
    .onUpdate((change, context) => {
      const newValue = change.after.data().name;
      const previousValue = change.before.data().name;
      const course1Id = context.params.courseId;

      if(newValue != previousValue){

        admin
        .firestore().collection("set").where("course.id", "==", course1Id)
        .get()
        .then((querySnapshot) => {
          if (!querySnapshot.empty) {
         //       doc.data().author = newValue
                querySnapshot.docs[0].course
                .update({author : newValue
                })
          }
        })
        .catch((error) => {
            console.log("Error changing Author name in courses", error);
        });
      }
    })

I dont get an error in the Logs but   Function returned undefined, expected Promise or value What am I doing wrong?

A: The error message is pretty damn explicit, there: Function returned UNDEFINED, expected Promise or value.
The incomplete code fragment you show DOESN'T RETURN ANYTHING. Try:
return admin
     .firestore().collection("set").where("course.id", "==", course1Id)
...etc, etc...

A: You need to terminate a Cloud Function when all the asynchronous work is completed, see the doc. In the case of a background triggered Cloud Function (e.g. Cloud Firestore function onUpdate trigger) you must return the entire chain of promises returned by the asynchronous method calls.
exports.updateCourseName = functions.firestore
    .document('courses/{courseId}')
    .onUpdate((change, context) => {
      const newValue = change.after.data().name;
      const previousValue = change.before.data().name;
      const course1Id = context.params.courseId;

      if(newValue != previousValue){

        return admin   // <== See the return here
        .firestore().collection("set").where("course.id", "==", course1Id)
        .get()
        .then((querySnapshot) => {
          if (!querySnapshot.empty) {
         //       doc.data().author = newValue
                return querySnapshot.docs[0].course  // <== See the return here AND see below
                .update({author : newValue
                })
          } else  {
               return null;   // <== See here: we indicate to the CF that it can be cleaned up
          }
        })
        .catch((error) => {
            console.log("Error changing Author name in courses", error);
            return null;
        });
      } else  {
        return null;   // <== See here: we indicate to the CF that it can be cleaned up
      }
    });

HOWEVER, it is not clear to me what you want to do with:
querySnapshot.docs[0].course.update({author : newValue})

What is exactly course? The update() method is a method of a DocumentReference.
You probably want to do
querySnapshot.docs[0].ref.update({author : newValue})


text:
Q: Div id to the input value I have a div

This prints an id for each product on the page. Ex: 26588
How do I assign it to a hidden input value ?
<input name="" id="deger" type="hidden" value="

">

Not like of course :=)

A: First off all I think you question ambiguous and what ever you are trying to achieve through this kind of tag might not be a good way to do. I suggest you to look for alternative ways if possible.
<input name="" id="deger" type="hidden" value="

">

But if you insist this can be easily done. Treat the value like any other string value you would insert inside a div but this time you will need to escape the quote character as below
$("#deger").val('

');

A: Try this
$('#deger').val($('#force_id').text());

see the code snippet below

function doIt() {
  $('#deger').val($('#force_id').text());
}

// Just for testing what happens
var degerEl = document.getElementById('deger');
var resultEl = document.getElementById('result');
var doItBtn = document.getElementById('doItBtn');
doItBtn.addEventListener('click', doItOnClickCallback);
setResultElValue();

function doItOnClickCallback() {
  doIt();
  setResultElValue();
}

function setResultElValue() {
  resultEl.value = degerEl.outerHTML;
}

<input name="" id="deger" type="hidden" value="">

26588

<button id="doItBtn">Do it</button>

<textarea readonly id="result" style="font-family:monospace;width:400px"></textarea>


text:
Q: Prove that $B$ is basis of Topology on $X\times Y$ Please check my proof; this proof is my first proof about topology.
I was asked to prove the following:
Let $B_{1}$ be basis of topology $T_{1}$, $B_{2}$ be basis of topology $T_{2}.$ The Set $X\times Y$ consist of all order pair $(x,y)$ with $x\in X$ and $y\in Y$. Let $B$ be the collection of all subsets of $X\times Y$ consisting of $B_{1}\times B_{2}$ where $B_{1} \in B_{1}$ and $B_{2}\in B_{2}$. Prove that $B$ is basis of a topology on $X\times Y$
1
Consider it satisfy first condition
since $(x,y)\in B$
since all $x\in B_{1}$ and all $y\in B_{2}$ then $B$ is all collection of union of order pair that have component from $B_{1}$ and $B_{2}$
therefore it's satisfy first condition
2.condition 2
Suppose $C_{1}\subseteq B$ $C_{2}\subseteq B$  and let $(x_{1},y_{1})\in C_{1}$ and $(x_{1},y_{1})\in C_{2}$
there exist some $C_{3}$ that contain $(x_{1},y_{1})$
therefore it's satisfy second condition

A: You check that $\mathcal{B}_1 \times \mathcal{B}_2$ is a base for some topology on $X \times Y$, but you have to check it is a base for the product topology, so for every $O$ open in the product topology and every $(x,y) \in O$ you have to find a set of the form $B_1 \times B_2, B_1 \in \mathcal{B}_1, B_2 \in \mathcal{B}_2$ such that $$(x,y) \in B_1 \times B_2 \subseteq O$$
This you can do because you first note that there must be an "open box" $O_1 \times O_2$ in $X \times Y$ with $O_1$ open in $X$ and $O_2$ open in $Y$, such that
$$(x,y) \in O_1 \times O_2 \subseteq O$$
by the definition of the product topology. Now we apply the fact that $\mathcal{B}_1$ is a base for $X$ to find $B_1 \in \mathcal{B}_1$ with $x \in B_1 \subseteq O_1$. Also, as $\mathcal{B}_2$ is a base for $Y$ we have $B_2 \in \mathcal{B}_2$ such that $y \in B_2 \subseteq O_2$.
Now $B_1 \times B_2$ is as required.

A: Choose $(x,y)\in X×Y$ then there exists $U\in \mathscr B_1$ and there exists $V\in \mathscr B_2$ such that $x\in U\ and\ y\in V$. Then $(x,y)\in U×V \in \mathscr B$.
Choose two elements $U_1×V_1, U_2×V_2 \in \mathscr B$ both containing the element $(x_1,y_1)\in X×Y$ then $x_1\in U_1\cap U_2$ and $ y_1\in V_1\cap V_2$ , therefore there exists an element of $\mathscr B_1$ say, $ W_1(\subseteq U_1\cap U_2)$ containing $x_1$ and there exists an element of $\mathscr B_2$ say, $W_2(\subseteq V_1\cap V_2)$ containing $y_1$. Therefore $(x_1,y_1)\in W_1×W_2 \subseteq (U_1\cap U_2)×(V_1\cap V_2)$. Also we have $ W_1×W_2\in \mathscr B$.Note that $(U_1\cap U_2)×(V_1\cap V_2)=(U_1×V_1)\cap (U_2×V_2)$.


text:
Q: Firebase onWrite function to return data to client I know that callable functions can be used to return data to the web browser but I am using a onWrite() trigger function, after which I want to open a toast on the user's browser.
How do I get some data back to the client?

A: Firebase database triggers can't return data to the client app.  They are executed asynchronously in the background, and are not even guaranteed to execute immediately.   Only callable and HTTP type triggers can return data.


text:
Q: django-discover-runner and XML reports? I have a working Django app which has been successfully using unittest-xml-reporting to produce XML reports from my unittests.
However, the project is growing rapidly and I want to break up my tests into separate files within each app. I therefore installed django-discover-runner which finds all my test files and runs them successfully.
However, django-discover-runner does not produce XML reports, which I need (for Bamboo).
I've found this:
http://www.stevetrefethen.com/blog/Publishing-Python-unit-test-results-in-Jenkins.aspx
and have tried to implement that suggestion (in each of my test.py files), but no XML is produced.
How can I use both django-discover-runner and unittest-xml-reporting to discover my tests and produce XML reports?

A: Since this question was asked, the unittest-xml-reporting project has added support for the new Django DiscoverRunner class. You can just set the test runner in your Django settings file:
TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner'

It will run the same tests as the DiscoverRunner would.

A: So it turns out that the solution to this is much easier than I expected. For any other n00bs who may be looking to do this:
The short answer is that I simply cobbled together the two test runners provided by django-discover-runner and unittest-xml-reporting into a custom test runner:
from django.conf import settings
from django.test.utils import setup_test_environment, teardown_test_environment
import xmlrunner
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.test.simple import DjangoTestSuiteRunner, reorder_suite
from django.utils.importlib import import_module

try:
    from django.utils.unittest import defaultTestLoader
except ImportError:
    try:
        from unittest2 import defaultTestLoader  # noqa
    except ImportError:
        raise ImproperlyConfigured("Couldn't import unittest2 default "
                               "test loader. Please use Django >= 1.3 "
                               "or go install the unittest2 library.")

### CUSTOM RUNNER NAME
class myTestRunner(DjangoTestSuiteRunner):
    ### THIS SECTION FROM UNITTESTS-XML-REPORTING
    def build_suite(self, test_labels, extra_tests=None, **kwargs):
        suite = None
        root = getattr(settings, 'TEST_DISCOVER_ROOT', '.')
        top_level = getattr(settings, 'TEST_DISCOVER_TOP_LEVEL', None)
        pattern = getattr(settings, 'TEST_DISCOVER_PATTERN', 'test*.py')

        if test_labels:
            suite = defaultTestLoader.loadTestsFromNames(test_labels)
            # if single named module has no tests, do discovery within it
            if not suite.countTestCases() and len(test_labels) == 1:
                suite = None
                root = import_module(test_labels[0]).__path__[0]

        if suite is None:
            suite = defaultTestLoader.discover(root,
                pattern=pattern, top_level_dir=top_level)

        if extra_tests:
            for test in extra_tests:
                suite.addTest(test)

        return reorder_suite(suite, (TestCase,))

    ###THIS SECTION FROM DJANGO-DISCOVER-RUNNER
    def run_tests(self, test_labels, extra_tests=None, **kwargs):
        """
        Run the unit tests for all the test labels in the provided list.
        Labels must be of the form:
         - app.TestClass.test_method
        Run a single specific test method
         - app.TestClass
        Run all the test methods in a given class
         - app
        Search for doctests and unittests in the named application.

        When looking for tests, the test runner will look in the models and
        tests modules for the application.

        A list of 'extra' tests may also be provided; these tests
        will be added to the test suite.

        Returns the number of tests that failed.
        """
        setup_test_environment()

        settings.DEBUG = False

        verbosity = getattr(settings, 'TEST_OUTPUT_VERBOSE', 1)
        if isinstance(verbosity, bool):
            verbosity = (1, 2)[verbosity]
        descriptions = getattr(settings, 'TEST_OUTPUT_DESCRIPTIONS', False)
        output = getattr(settings, 'TEST_OUTPUT_DIR', '.')

        suite = self.build_suite(test_labels, extra_tests)

        old_config = self.setup_databases()

        result = xmlrunner.XMLTestRunner(
            verbosity=verbosity, descriptions=descriptions,
            output=output).run(suite)

        self.teardown_databases(old_config)
        teardown_test_environment()

        return len(result.failures) + len(result.errors)

This should be saved somewhere suitable within your project. In your test settings file (test_settings.py - as per django-discover-runner instructions), set the Test Runner:
TEST_RUNNER = '<your-django-project>.customTestRunner.myTestRunner'

You would then use (again, as per django-discover-runner instructions):
django-admin.py test --settings=myapp.test_settings

This solution allows me to use django-discover-runner's features to discover all the test files across my project - specified by django-discover-runner's TEST_DISCOVER_PATTERN option - and still output XML reports as required by Bamboo. Big thanks to the authors of the original code:
django-discover-runner
unittest-xml-reports


text:
Q: Convergent squence in topology Please,
I consider this topological space $(E,\tau)$ where $\tau=\{G\subset E, ~\text{card}~ (E\setminus G)~\text{countable}\}\cup\{\emptyset\}$
How to prove that a sequence $(x_n)$ is convergent in $(E,\tau)$ if and only if $(x_n)$ is stable ??

We say that $(x_n)$ is stable if $\exists~ n_0$ such that $n\geq n_0,
 x_n= a $

Please help me
thank you

A: I'm going to assume that by stable sequence you mean a sequence that is eventually constant: there is an $m\in\Bbb N$ such that $x_n=x_m$ for all $n\ge m$. I expect that you can prove that such a sequence converges in any space.
Now suppose that $\langle x_n:n\in\Bbb N\rangle$ is a sequence in $E$ that converges to $x$.
HINT: Let $A=\{x_n:x_n\ne x\}$. What can you say about the set $X\setminus A$?


text:
Q: Data validation for file and formatting the output I'm trying to code a program to determine if different kinds of errors appear in a given file. I'm going to post my entire code, because I honestly have no idea where I'm going wrong here. It's just abending on me. The data validation is 2100-error-checking.
   IDENTIFICATION DIVISION.
   PROGRAM-ID. ASSIGNMENT1.
   AUTHOR.  AARON.

  ******************************************************************
   ENVIRONMENT DIVISION.
  *  defines the external files - an input file and output file
   INPUT-OUTPUT SECTION.
   FILE-CONTROL.

       SELECT DATVAL02 ASSIGN TO DATAIN
          FILE STATUS IS EF-STATUS.

       SELECT REPORT-FILE ASSIGN TO DATAOUT
          FILE STATUS IS PF-STATUS.

   DATA DIVISION.

   FILE SECTION.
   FD DATVAL02.
   01 SALES-RECORD.
       05 RECORD-CODE   PIC XX.
       05 FILLER        PIC X.
       05 VEND-NUM      PIC X(8).
       05 DATE-DUE.
            05 YEAR-DUE      PIC XX.
            05 MONTH-DUE     PIC XX.
            05 DAY-DUE       PIC XX.
       05 VEND-NAME     PIC X(20).
       05 FILLER        PIC XXX.
       05 AMT-DUE       PIC S9(6)V99.

   FD REPORT-FILE.
   01 REPORT-RECORD                PIC X(80).

   WORKING-STORAGE SECTION.

   01 FLAGS-AND-ACCUMLATORS.
       05 VALID-RECORDS     PIC S99 VALUE 0.
       05 INVALID-RECORDS   PIC S99 VALUE 0.
       05 EF-STATUS       PIC 99  VALUE 0.
       05 PF-STATUS       PIC 99  VALUE 0.
       05 A-ERROR           PIC X VALUE SPACE.
       05 C-ERROR           PIC X VALUE SPACE.
       05 E-ERROR           PIC X VALUE SPACE.
       05 F-ERROR           PIC X VALUE SPACE.
       05 B-ERROR           PIC X VALUE SPACE.
       05 D-ERROR           PIC X VALUE SPACE.
       05 G-ERROR           PIC X VALUE SPACE.
       05 H-ERROR           PIC X VALUE SPACE.
       05 I-ERROR           PIC X VALUE SPACE.
       05 A-AST             PIC XX VALUE SPACES.
       05 BC-AST            PIC X(8) VALUE SPACES.
       05 D-AST             PIC XX VALUE SPACES.
       05 E-AST             PIC XX VALUE SPACES.
       05 F-AST             PIC XX VALUE SPACES.
       05 G-AST             PIC X(15) VALUE SPACES.
       05 H-AST             PIC X(15) VALUE SPACES.
       05 I-AST             PIC X(8) VALUE SPACES.
       05 END-OF-FILE      PIC XXX VALUE "NO".
       05 ERROR-FLAG        PIC XXX VALUE SPACES.
       05 ERROR-FLAG2       PIC XXX VALUE SPACES.
       05 ERROR-FILLER      PIC XXX VALUE SPACES.
       05 VC                PIC XX VALUE "VC".
       05 NOO               PIC XX VALUE "NO".
       05 D-CHECK           PIC S9999999V99.
       05 DAY-DUE-NUM       PIC 99.
       05 MONTH-DUE-NUM     PIC 99.

   01 HEADING-LINE-1.
       05           PIC X(15) VALUE SPACES.
       05           PIC X(24) VALUE
            "VENDOR RECORD VALIDATION".
       05           PIC X(24) VALUE SPACES.
       05           PIC X(6)  VALUE
            "PAGE 1".

   01 HEADING-LINE-2.
       05           PIC XX VALUE
            "RC".
       05           PIC X VALUE SPACE.
       05           PIC X(8) VALUE
            "VENDOR #".
       05           PIC XX VALUE SPACES.
       05           PIC X(8) VALUE
            "DATE DUE".
       05           PIC XX VALUE SPACES.
       05           PIC X(11) VALUE
            "VENDOR NAME".
       05           PIC X(6) VALUE SPACES.
       05           PIC X(10) VALUE
            "AMOUNT DUE".
       05           PIC XXX VALUE SPACES.
       05           PIC X(16) VALUE
            "-- ERROR CODES--".

    01 DETAIL-LINE.
       05 RECORD-CODE-OUT           PIC XX.
       05                           PIC X VALUE SPACE.
       05 VEND-NUM-OUT              PIC X(8).
       05                           PIC XX VALUE SPACES.
       05 YEAR-DUE-OUT              PIC XX.
       05 MONTH-DUE-OUT             PIC XX.
       05 DAY-DUE-OUT               PIC XX.
       05                           PIC XX VALUE SPACES.
       05 VEND-NAME-OUT             PIC X(20).
       05                           PIC XX VALUE SPACES.
       05 AMT-DUE-OUT               PIC 999,999.99.
       05                           PIC XX VALUE SPACES.
       05 A-ERROR-OUT               PIC X VALUE SPACES.
       05                           PIC XX VALUE SPACES.
       05 B-ERROR-OUT               PIC X VALUE SPACE.
       05                           PIC XX VALUE SPACES.
       05 C-ERROR-OUT               PIC X VALUE SPACE.
       05                           PIC XX VALUE SPACES.
       05 D-ERROR-OUT               PIC X VALUE SPACE.
       05                           PIC XX VALUE SPACES.
       05 E-ERROR-OUT               PIC X VALUE SPACE.
       05                           PIC XX VALUE SPACES.
       05 F-ERROR-OUT               PIC X VALUE SPACE.
       05                           PIC XX VALUE SPACES.
       05 G-ERROR-OUT               PIC X VALUE SPACE.
       05                           PIC XX VALUE SPACES.
       05 H-ERROR-OUT               PIC X VALUE SPACE.
       05                           PIC XX VALUE SPACES.
       05 I-ERROR-OUT               PIC X VALUE SPACE.

   01 ASTERISK-LINE.
       05 A-AST-OUT                 PIC XX VALUE SPACES.
       05                           PIC X VALUE SPACE.
       05 BC-AST-OUT                PIC X(8) VALUE SPACES.
       05                           PIC XX VALUE SPACES.
       05 D-AST-OUT                 PIC XX VALUE SPACES.
       05                           PIC X VALUE SPACE.
       05 E-AST-OUT                 PIC XX VALUE SPACES.
       05                           PIC X VALUE SPACE.
       05 F-AST-OUT                 PIC XX VALUE SPACES.
       05                           PIC XX VALUE SPACES.
       05 G-AST-OUT                 PIC X(15) VALUE SPACES.
       05                           PIC XX VALUE SPACES.
       05 I-AST-OUT                 PIC X(8) VALUE SPACES.
       05                           PIC XX VALUE SPACES.
       05 H-AST-OUT                 PIC X(8) VALUE SPACES.

   01 RECORD-TOTALS.
       05                           PIC X(16) VALUE
            "VALID RECORDS: ".
       05 VALID-RECORDS-OUT         PIC 99.
       05                           PIC XX VALUE SPACES.
       05                           PIC X(17) VALUE
            "INVALID RECORDS: ".
       05 INVALID-RECORDS-OUT       PIC 99.

   PROCEDURE DIVISION.

   1000-MAIN-CONTROL.
       PERFORM 2000-INITIALIZE.
       PERFORM UNTIL END-OF-FILE = "YES"
         READ DATVAL02
           AT END
             MOVE "YES" TO END-OF-FILE
           NOT AT END
             PERFORM 2100-ERROR-ROUTINE
             IF ERROR-FLAG = "YES"
                PERFORM 2500-PROCESS
                PERFORM 3000-PROCESS
                PERFORM 4200-REINITILIZE
             END-IF
             IF ERROR-FLAG = "NO"
                PERFORM 2500-PROCESS
             END-IF
         END-READ
       END-PERFORM.
       PERFORM 4000-PROCESS.
       PERFORM 4500-TERMINATE.
       STOP RUN.

   2000-INITIALIZE.
       OPEN INPUT DATVAL02.
       OPEN OUTPUT REPORT-FILE.

       WRITE REPORT-RECORD         FROM HEADING-LINE-1.
       WRITE REPORT-RECORD         FROM HEADING-LINE-2.

   2100-ERROR-ROUTINE.
       MOVE "NO"                   TO ERROR-FLAG.
       MOVE "NO"                   TO ERROR-FLAG2.

       IF VEND-NUM = SPACES
           MOVE "YES"              TO ERROR-FLAG
           MOVE "********"         TO BC-AST-OUT
           MOVE "B"               TO B-ERROR-OUT
       END-IF.

       IF VEND-NUM IS NOT NUMERIC AND ERROR-FLAG = NOO
           MOVE "YES"              TO ERROR-FLAG
           MOVE "********"        TO BC-AST-OUT
           MOVE "C"                TO C-ERROR-OUT
       END-IF.

       IF RECORD-CODE IS NOT = VC
           MOVE "YES"              TO ERROR-FLAG
           MOVE "**"               TO A-AST-OUT
           MOVE "A"                TO A-ERROR-OUT
       END-IF.

       IF DATE-DUE IS NOT NUMERIC
           MOVE "YES"              TO ERROR-FLAG2
           MOVE "YES"              TO ERROR-FLAG
           MOVE "**"               TO D-AST-OUT
           MOVE "D"               TO D-ERROR-OUT
           MOVE "**"              TO E-AST-OUT
           MOVE "**"              TO F-AST-OUT
       END-IF.

       IF DATE-DUE = 0 AND ERROR-FLAG2 = NOO
          IF AMT-DUE IS > 0
              MOVE "YES"           TO ERROR-FLAG
              MOVE "YES"           TO ERROR-FLAG2
              MOVE "**"           TO D-AST-OUT
              MOVE "D"             TO D-ERROR-OUT
              MOVE "**"           TO E-AST-OUT
              MOVE "**"           TO F-AST-OUT
          END-IF
       END-IF.

       MOVE DAY-DUE TO DAY-DUE-NUM.
       MOVE MONTH-DUE TO MONTH-DUE-NUM.

       IF DAY-DUE-NUM > 31 OR DAY-DUE < 0 AND ERROR-FLAG2 = NOO
           MOVE "YES"              TO ERROR-FLAG
           MOVE "**"              TO E-AST-OUT
           MOVE "E"                TO E-ERROR-OUT
       END-IF.

       IF MONTH-DUE-NUM > 12 OR < 1 AND ERROR-FLAG2 = NOO
           MOVE "YES"              TO ERROR-FLAG
           MOVE "**"             TO F-AST-OUT
           MOVE "F"                TO F-ERROR-OUT
       END-IF.

       IF VEND-NAME = SPACES
           MOVE "YES"              TO ERROR-FLAG
           MOVE "***************"               TO G-AST-OUT
           MOVE "G"                TO G-ERROR-OUT
       END-IF.

       IF VEND-NAME(1:1) IS EQUAL TO SPACE
           MOVE "YES"              TO ERROR-FLAG
           MOVE "***************"         TO H-AST-OUT
           MOVE "H"                TO H-ERROR-OUT

       IF AMT-DUE IS NOT NUMERIC
           MOVE "YES"              TO ERROR-FLAG
           MOVE "********"               TO I-AST-OUT
           MOVE "I"               TO I-ERROR-OUT
       END-IF.

       IF ERROR-FLAG = "YES"
            ADD 1 TO INVALID-RECORDS
       END-IF.

       IF ERROR-FLAG = "NO"
           ADD 1 TO VALID-RECORDS
       END-IF.

   2500-PROCESS.
       MOVE RECORD-CODE    TO RECORD-CODE-OUT.
       MOVE VEND-NUM       TO VEND-NUM-OUT.
       MOVE YEAR-DUE       TO YEAR-DUE-OUT.
       MOVE MONTH-DUE      TO MONTH-DUE-OUT.
       MOVE DAY-DUE        TO DAY-DUE-OUT.
       MOVE VEND-NAME      TO VEND-NAME-OUT.
       MOVE AMT-DUE        TO AMT-DUE-OUT.

       WRITE REPORT-RECORD FROM DETAIL-LINE.

   3000-PROCESS.
       WRITE REPORT-RECORD FROM ASTERISK-LINE.

   4000-PROCESS.
       MOVE VALID-RECORDS      TO VALID-RECORDS-OUT.
       MOVE INVALID-RECORDS    TO INVALID-RECORDS-OUT.
       WRITE REPORT-RECORD     FROM RECORD-TOTALS.

   4200-REINITILIZE.
       MOVE A-ERROR            TO A-ERROR-OUT.
       MOVE B-ERROR            TO B-ERROR-OUT.
       MOVE C-ERROR            TO C-ERROR-OUT.
       MOVE D-ERROR            TO D-ERROR-OUT.
       MOVE E-ERROR            TO E-ERROR-OUT.
       MOVE F-ERROR            TO F-ERROR-OUT.
       MOVE G-ERROR            TO G-ERROR-OUT.
       MOVE H-ERROR            TO H-ERROR-OUT.
       MOVE I-ERROR            TO I-ERROR-OUT.
       MOVE A-AST              TO A-AST-OUT.
       MOVE BC-AST             TO BC-AST-OUT.
       MOVE D-AST              TO D-AST-OUT.
       MOVE E-AST              TO E-AST-OUT.
       MOVE F-AST              TO F-AST-OUT.
       MOVE G-AST              TO G-AST-OUT.
       MOVE H-AST              TO H-AST-OUT.
       MOVE I-AST              TO I-AST-OUT.
       MOVE ERROR-FILLER       TO ERROR-FLAG.
       MOVE ERROR-FILLER       TO ERROR-FLAG2.
       MOVE A-AST              TO DAY-DUE-NUM.
       MOVE A-AST              TO MONTH-DUE-NUM.
   4500-TERMINATE.
       CLOSE DATVAL02, REPORT-FILE.

Data in looks as such...
VC 10045380051005ABC ELECTRONICS        00001298
VT         000000                       00020000

Looking to achieve this
XX 9AAA9999  99/99/99       SHIFTED      12A 4GL 78   A   C   E F   H I
** ********     ** **  ***************   *** *** **

where * are under errors in the data. And letters show what errors are found.

A: In your latest version, you have made a group item (DATE-DUE) but you have not adjusted the level-numbers for the other date fields which are subordinate to it. I have made those three level 10. To use SYSIN data to be convenient for me, I added a 32-byte FILLER to the end of the input record.
I compile, gets an RC/CC of 4, so the linkedit/binder runs.
I used this data from your other question:
VC 10045380051005ABC ELECTRONICS        00001298
VC         050926XYZ COMPANY            00R00549
VT 12348760051115QUALITY ASSURANCE CO   00400053
VC A14BCF80051201                       00100930
And got this output, with no abend:
               VENDOR RECORD VALIDATION                        PAGE 1
RC VENDOR #  DATE DUE  VENDOR NAME      AMOUNT DUE   -- ERROR CODES--
VC 10045380  051005  ABC ELECTRONICS       000,012.98
VC           050926  XYZ COMPANY           009,005.49     B
   ********
VT 12348760  051115  QUALITY ASSURANCE CO  004,000.53  A
**
VC A14BCF80  051201                        001,009.30        C           G  H
   ********            ***************            ********
VALID RECORDS:  01  INVALID RECORDS: 03

I have pasted the data from your other question.
Note, if your actual data is incorrect, you may get an abend with the amount field.
Note also what has happened to the R in the amount field. You haven't validated that for NUMERIC.

I have now compiled and run your program with the two corrections (the VALUE clauses for the two counts, and the END-READ). Here is the output:
               VENDOR RECORD VALIDATION                        PAGE 1
RC VENDOR #  DATE DUE  VENDOR NAME      AMOUNT DUE   -- ERROR CODES--
VC 10045380  051005  ABC ELECTRONICS       000,01298
VT        0  000000                        000,20000     B
   ********
VALID RECORDS:  01  INVALID RECORDS: 01

I used a fixed-length file, as I don't have access to your actual file, which must be variable-length (it is good to be explicit in the FD, then you don't get those I-informational messages at the end of your compile).
You still have some things to sort out, but the program is running and producing output. If you make those code changes and still have problems, then it is your file that is in error.
You have a very frustrating problem which seems to be down to the "environment". You need to be able to see your compile listings. If the compile fails (RC/CC above 4) then your linkedit/binder step won't run, and you won't get a new executable program. I think that is your problem, but you need help from your tutor to sort out how to find the compile listing and confirm that there are no errors.
I have not used Rational Developer and don't know if you are using zPDT or are compiling on the Mainframe or how you'd look at the compiler output in either case from your Rational Developer session.
Your code is basically OK for a learner, and probably has been for a couple of days. You have been struggling with a problem not directly to do with the code, but to do with not knowing your program had compile errors. Basically, except for a couple of typos, it was there.
When you do get it running in your environment, update your Code Review question please.

A really good thing to know is what compile produced the version of the program that you ran, whether or not it abended.
You can display the date and time that the program was compiled:
   WORKING-STORAGE SECTION.
   01  W-WHEN-COMPILED                      PIC X(8)BX(8).
   ...

Before doing anything else, other than identifying that it is the first time in a CALLed sub-program, something like this:
   MOVE WHEN-COMPILED                TO W-WHEN-COMPILED
   DISPLAY
           "Program XXXXXXXX compiled on "
           W-WHEN-COMPILED

The output you get will be the date/time from the actual compile of that program, matching exactly to the date/time on the compile listing.
I've used code like that, and recommended it to others, for over 30 years, and it has saved shed-loads of time.
There is also an intrinsic FUNCTION, WHEN-COMPILED. This is the same, but with a four-digit year. Since for the forseeable future the CC in the year will be 20 you can chose which one to do. Both are resolved at compile-time, and impact on run-time will be minimal.

You have no END-READ. This gives you an E-level diagnostic from the compile, a Return-Code/Condition-Code of 8, and you linkedit/binder step following probably hasn't run (have a look at the COND for the step in file 2 of the spool for your job).
Here is your code as a reminder:
 PERFORM UNTIL END-OF-FILE = "YES"
     READ DATVAL02
       AT END
         MOVE "YES" TO END-OF-FILE
       NOT AT END
         PERFORM 2100-ERROR-ROUTINE
         IF ERROR-FLAG = "YES"
            PERFORM 2500-PROCESS
            PERFORM 3000-PROCESS
         END-IF
         IF ERROR-FLAG = "NO"
            PERFORM 2500-PROCESS
         END-IF
   END-PERFORM.

Here is what it could look like with the END-READ:
 PERFORM UNTIL END-OF-FILE = "YES"
     READ DATVAL02
       AT END
         MOVE "YES" TO END-OF-FILE
       NOT AT END
         PERFORM 2100-ERROR-ROUTINE
         IF ERROR-FLAG = "YES"
            PERFORM 2500-PROCESS
            PERFORM 3000-PROCESS
         END-IF
         IF ERROR-FLAG = "NO"
            PERFORM 2500-PROCESS
         END-IF
       END-READ
   END-PERFORM

Since no new program has been linked, you are running the old program still and getting the old error still.

You are adding to non-binary fields which you have not given an initial value.
   05 VALID-RECORDS     PIC S99.
   05 INVALID-RECORDS   PIC S99.

   IF ERROR-FLAG = "YES"
        ADD 1 TO INVALID-RECORDS
   END-IF.

   IF ERROR-FLAG = "NO"
       ADD 1 TO VALID-RECORDS
   END-IF.

Without an initial value (either from a VALUE clause, or a MOVE or even the dread INITIALIZE), the value is undefined and is unlikely to be valid for a zoned-decimal field, so S0C7.
Have a look at this: https://stackoverflow.com/a/17102485/1927206 to see if you can work out from that exactly where it is failing in your program.

Program which compiles clean, with RC 0 and no diagnostic messages, and runs without abend:
   ID DIVISION.
   PROGRAM-ID. VARA.
   ENVIRONMENT DIVISION.
   INPUT-OUTPUT SECTION.
   FILE-CONTROL.

       SELECT DATVAL02 ASSIGN TO DATAIN
          FILE STATUS IS EF-STATUS.

       SELECT REPORT-FILE ASSIGN TO DATAOUT
          FILE STATUS IS PF-STATUS.

   DATA DIVISION.

   FILE SECTION.
   FD DATVAL02 RECORDING MODE F.
   01 SALES-RECORD.
       05 RECORD-CODE   PIC XX.
       05 FILLER        PIC X.
       05 VEND-NUM      PIC X(8).
       05 YEAR-DUE      PIC 99.
       05 MONTH-DUE     PIC 99.
       05 DAY-DUE       PIC 99.
       05 VEND-NAME     PIC X(20).
       05 FILLER        PIC XXX.
       05 AMT-DUE       PIC S9(6)V99.
       05  FILLER PIC X(32).

   FD REPORT-FILE RECORDING MODE F.
   01 REPORT-RECORD                PIC X(80).

   WORKING-STORAGE SECTION.
   01  W-WHEN-COMPILED             PIC X(8)BX(8).

   01 FLAGS-AND-ACCUMLATORS.
       05 VALID-RECORDS     PIC S99 VALUE ZERO.
       05 INVALID-RECORDS   PIC S99 VALUE ZERO.
       05   EF-STATUS       PIC 99  VALUE 0.
       05   PF-STATUS       PIC 99  VALUE 0.
       05 A-ERROR           PIC X VALUE SPACE.
       05 C-ERROR           PIC X VALUE SPACE.
       05 E-ERROR           PIC X VALUE SPACE.
       05 F-ERROR           PIC X VALUE SPACE.
       05 B-ERROR           PIC X VALUE SPACE.
       05 D-ERROR           PIC X VALUE SPACE.
       05 G-ERROR           PIC X VALUE SPACE.
       05 H-ERROR           PIC X VALUE SPACE.
       05 I-ERROR           PIC X VALUE SPACE.
       05 A-AST             PIC XX VALUE SPACES.
       05 BC-AST            PIC X(8) VALUE SPACES.
       05 D-AST             PIC XX VALUE SPACES.
       05 E-AST             PIC XX VALUE SPACES.
       05 F-AST             PIC XX VALUE SPACES.
       05 G-AST             PIC X(15) VALUE SPACES.
       05 I-AST             PIC X(8) VALUE SPACES.
       05  END-OF-FILE      PIC XXX VALUE "NO".
       05 ERROR-FLAG        PIC XXX VALUE SPACES.
       05 ERROR-FLAG2       PIC XXX VALUE SPACES.
       05 VC                PIC XX VALUE "VC".
       05 NOO               PIC XX VALUE "NO".
       05 D-CHECK           PIC S9999999V99.

   01 HEADING-LINE-1.
       05           PIC X(15) VALUE SPACES.
       05           PIC X(24) VALUE
            "VENDOR RECORD VALIDATION".
       05           PIC X(24) VALUE SPACES.
       05           PIC X(6)  VALUE
            "PAGE 1".

   01 HEADING-LINE-2.
       05           PIC XX VALUE
            "RC".
       05           PIC X VALUE SPACE.
       05           PIC X(8) VALUE
            "VENDOR #".
       05           PIC XX VALUE SPACES.
       05           PIC X(8) VALUE
            "DATE DUE".
       05           PIC XX VALUE SPACES.
       05           PIC X(11) VALUE
            "VENDOR NAME".
       05           PIC X(6) VALUE SPACES.
       05           PIC X(10) VALUE
            "AMOUNT DUE".
       05           PIC XXX VALUE SPACES.
       05           PIC X(16) VALUE
            "-- ERROR CODES--".

   01 DETAIL-LINE.
       05 RECORD-CODE-OUT           PIC XX.
       05                           PIC X VALUE SPACE.
       05 VEND-NUM-OUT              PIC 9(8).
       05                           PIC XX VALUE SPACES.
       05 YEAR-DUE-OUT              PIC XX.
       05 MONTH-DUE-OUT             PIC XX.
       05 DAY-DUE-OUT               PIC XX.
       05                           PIC XX VALUE SPACES.
       05 VEND-NAME-OUT             PIC X(20).
       05                           PIC XX VALUE SPACES.
       05 AMT-DUE-OUT               PIC 999,999.99.
       05                           PIC XX VALUE SPACES.
       05 A-ERROR-OUT               PIC X.
       05                           PIC XX VALUE SPACES.
       05 B-ERROR-OUT               PIC X.
       05                           PIC XX VALUE SPACES.
       05 C-ERROR-OUT               PIC X.
       05                           PIC XX VALUE SPACES.
       05 D-ERROR-OUT               PIC X.
       05                           PIC XX VALUE SPACES.
       05 E-ERROR-OUT               PIC X.
       05                           PIC XX VALUE SPACES.
       05 F-ERROR-OUT               PIC X.
       05                           PIC XX VALUE SPACES.
       05 G-ERROR-OUT               PIC X.
       05                           PIC XX VALUE SPACES.
       05 H-ERROR-OUT               PIC X.
       05                           PIC XX VALUE SPACES.
       05 I-ERROR-OUT               PIC X.

   01 ASTERISK-LINE.
       05 A-AST-OUT                 PIC XX.
       05                           PIC X VALUE SPACE.
       05 BC-AST-OUT                PIC X(8).
       05                           PIC XX VALUE SPACES.
       05 D-AST-OUT                 PIC XX.
       05                           PIC X VALUE SPACE.
       05 E-AST-OUT                 PIC XX.
       05                           PIC X VALUE SPACE.
       05 F-AST-OUT                 PIC XX.
       05                           PIC XX VALUE SPACES.
       05 G-AST-OUT                 PIC X(15).
       05                           PIC XX VALUE SPACES.
       05 I-AST-OUT                 PIC X(8).
       05                           PIC XX VALUE SPACES.
       05 H-AST-OUT                 PIC X(8).

   01 RECORD-TOTALS.
       05                           PIC X(16) VALUE
            "VALID RECORDS: ".
       05 VALID-RECORDS-OUT         PIC 99.
       05                           PIC XX VALUE SPACES.
       05                           PIC X(17) VALUE
            "INVALID RECORDS: ".
       05 INVALID-RECORDS-OUT       PIC 99.

   PROCEDURE DIVISION.

   1000-MAIN-CONTROL.
       MOVE WHEN-COMPILED         TO W-WHEN-COMPILED
       DISPLAY
               "TEST PROGRAM COMPILED ON "
               W-WHEN-COMPILED
       PERFORM 2000-INITIALIZE.
       PERFORM UNTIL END-OF-FILE = "YES"
         READ DATVAL02
           AT END
             MOVE "YES" TO END-OF-FILE
           NOT AT END
             PERFORM 2100-ERROR-ROUTINE
             IF ERROR-FLAG = "YES"
                PERFORM 2500-PROCESS
                PERFORM 3000-PROCESS
             END-IF
             IF ERROR-FLAG = "NO"
                PERFORM 2500-PROCESS
             END-IF
         END-READ
       END-PERFORM.
       PERFORM 4000-PROCESS.
       PERFORM 4500-TERMINATE.
       STOP RUN.

   2000-INITIALIZE.
       OPEN INPUT DATVAL02.
       OPEN OUTPUT REPORT-FILE.

       WRITE REPORT-RECORD         FROM HEADING-LINE-1.
       WRITE REPORT-RECORD         FROM HEADING-LINE-2.

   2100-ERROR-ROUTINE.
       MOVE "NO"                   TO ERROR-FLAG.
       MOVE "NO"                   TO ERROR-FLAG2.

       IF VEND-NUM = SPACES
           MOVE "YES"              TO ERROR-FLAG
           MOVE "********"         TO BC-AST-OUT
           MOVE "B"                TO B-ERROR-OUT
       END-IF.

       IF ERROR-FLAG = "YES"
            ADD 1 TO INVALID-RECORDS
       END-IF.

       IF ERROR-FLAG = "NO"
           ADD 1 TO VALID-RECORDS
       END-IF.

   2500-PROCESS.
       MOVE RECORD-CODE    TO RECORD-CODE-OUT.
       MOVE VEND-NUM       TO VEND-NUM-OUT.
       MOVE YEAR-DUE       TO YEAR-DUE-OUT.
       MOVE MONTH-DUE      TO MONTH-DUE-OUT.
       MOVE DAY-DUE        TO DAY-DUE-OUT.
       MOVE VEND-NAME      TO VEND-NAME-OUT.
       MOVE AMT-DUE        TO AMT-DUE-OUT.

       WRITE REPORT-RECORD FROM DETAIL-LINE.

   3000-PROCESS.
       WRITE REPORT-RECORD FROM ASTERISK-LINE.

   4000-PROCESS.
       MOVE VALID-RECORDS      TO VALID-RECORDS-OUT.
       MOVE INVALID-RECORDS    TO INVALID-RECORDS-OUT.
       WRITE REPORT-RECORD     FROM RECORD-TOTALS.

   4500-TERMINATE.
       CLOSE DATVAL02, REPORT-FILE.


text:
Q: Requirements for TFJS on GPU: Trying to Compare the performance of TFJS-node and TFJS-node-GPU I tried to use an NVIDIA GeForce RTX 1080Ti GPU PC Card to work with TFJS and followed the hardware and software requirements as stated in the documentation, but I could not see a drastic difference in performance yet. Seems like it's ignoring the GPU.
I am unsure if I'm following the correct guidelines as the above documentation seems like it's for Tensorflow Python.
Do I need to do some more settings for using the GPU version of TensorFlow.js node?

A: Difference in performance is massive in anything but trivial tasks (where CPU is faster simply because it takes time to get ops and data to&from GPU)
Like you said, its probably not using GPU to start with - which is most commonly due to cuda issues (its non-trivial to get cuda installation & versions right).
Increase tensorflow logging info: export TF_CPP_MIN_LOG_LEVEL=0 before running node app, you should see something like this in the output when its using GPU:
tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 9575 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 3060, pci bus id: 0000:01:00.0, compute capability: 8.6

If you don't see that, go back to docs and make sure cuda is installed correctly.


text:
Q: How to expand node with Sigmajs and Neo4j database (doubleclick Mouse event)? I'm using the Sigma.js library to create a webapp on top of a Neo4j graph database.
So, I have my graph with nodes and edges and I would like to expand nodes by double click event with javascript.
Can you help me to do this?
Thank you so much
sigma.neo4j.cypher(
    {url :'http://localhost:7474', user: 'neo4j', password: 'neo4j'},
    'MATCH (n)-[r]->(m) RETURN n,r,m LIMIT 100' ,
    {container:'graph-container'},

    function (s) {
        s.graph.nodes().forEach(function (node){

            if (node.neo4j_labels[0] === "Movies"){
            node.label = node.neo4j_data['movie'];
            node.color = '#68BDF6';
            node.size = 26;
            node.type = "star";
          }

            else if (node.neo4j_labels[0] === "Personn"){
            node.label = node.neo4j_data['personn'];
            node.type = "diamond";
            node.color = '#303A2B';
            node.size = 12;
          }

            console.log(s.graph.nodes());
            s.settings('touchEnabled', true);
            s.settings('mouseEnabled', true);
            s.settings('defaultEdgeLabelSize', 18);
            s.settings('defaultNodeLabelSize', 18);
            s.settings('animationsTime', 1000);

        s.graph.edges().forEach(function(e) {
                    //e.type = 'curvedArrow';
                    //e.color='#F00';
                e.originalColor = e.color;
                e.type = "curvedArrow";
                e.size=2;

                    // e.label = neo4j_type;
                //console.log(s.graph.edges())
            });

            s.refresh();

   });

A: You have to bind the sigma event doubleClickNode like this :
s.bind("doubleClickNode", function(e) {
    var node = e.data.node;
    var query = 'MATCH (n)-[r]-(m) WHERE id(n)=' + node.id+ ' RETURN n,r,m';
    sigma.neo4j.cypher(
      neo4jConfig,
      query,
      function(graph) {
        // adding node if not existing
        graph.nodes.forEach(function (node){
            if(s.graph.nodes(node.id) === undefined) {
            s.graph.addNode(node);
          }
        });
        // adding edge if not existing
        graph.edges.forEach(function (edge){
            if(s.graph.edges(edge.id) === undefined) {
            s.graph.addEdge(edge);
          }
        });

       // apply style
        applyStyle(s);
      }
    );

  });

My complete example is available here : https://jsfiddle.net/sim51/qkc0g58o/34/
Before to use it, you need to accept Neo4j SSL certificate, by opening this link https://localhost:7473/browser and adding a security exception


text:
Q: Display order of a SQL Query without order by clause I am writing a simple query in SQL Server:
Select
    EmpId, EmpName, Sal
from
    Emp
where
    EmpId in (10,9,5,7,3,8);

I want to get the output in a same order which is given i.e; 10,9,5,7,3,8
Actually whatever I'll give the result will display with given order without
order by ascending or descending.
How can I do that? Please help.

A: You can use a table variable to pass the inputs. You must insert the records into this table variable in the desired order.
Declare @empids table(id int identity(1,1),empid int)
insert into @empids values(10),(9),(5),(7),(3),(8)

Select e.EmpId,e.empname,e.sal from Emp e
join @empids t on  e.EmpId = t.empid
order by t.id

Try this.

A: You can use CHARINDEX function in an odd way: search for the id in the comma separated list and order the result by the position.
Consider this list for example 10,9,5,7,3,8... the substring 10 appears at 1st position while 9 appears at 4th. Just order by the substring position.
CREATE TABLE Emp
    (EmpId int, EmpName varchar(100), Sal int)
;

INSERT INTO Emp
    (EmpId, EmpName, Sal)
VALUES
    (1, 'John', NULL),
    (2, 'Jane', NULL),
    (3, 'Smith', NULL),
    (4, 'Doe', NULL),
    (5, 'Ben', NULL),
    (6, 'Steve', NULL),
    (7, 'Andrew', NULL),
    (8, 'Simon', NULL),
    (9, 'Jack', NULL),
    (10, 'Allen', NULL)
;

SELECT
    EmpId, EmpName, Sal
FROM
    Emp
WHERE
    EmpId in (10,9,5,7,3,8)
ORDER BY
    CHARINDEX(CONCAT(',', EmpId, ','), CONCAT(',', '10,9,5,7,3,8', ','))
;

Result:
EmpId | EmpName | Sal
------+---------+-----
10    | Allen   | NULL
9     | Jack    | NULL
5     | Ben     | NULL
7     | Andrew  | NULL
3     | Smith   | NULL
8     | Simon   | NULL

A: No way to do this natively.
Try:
SELECT EmpId,EmpName,Sal
FROM Emp
WHERE EmpId IN (10,9,5,7,3,8)
ORDER BY CASE EmpId
    WHEN 10 THEN 1
    WHEN 9 THEN 2
    WHEN 5 THEN 3
    WHEN 7 THEN 4
    WHEN 3 THEN 5
    WHEN 8 THEN 6
    ELSE 7
END;

A: You can do this dynamically if your list is a comma-delimited-string. First, you must have a splitter function. Here is the DelimitedSplit8k written by Jeff Moden:
CREATE FUNCTION [dbo].[DelimitedSplit8K](
    @pString VARCHAR(8000), @pDelimiter CHAR(1)
)
RETURNS TABLE WITH SCHEMABINDING AS
RETURN
WITH E1(N) AS (
    SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL
    SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1
)
,E2(N) AS (SELECT 1 FROM E1 a, E1 b)
,E4(N) AS (SELECT 1 FROM E2 a, E2 b)
,cteTally(N) AS(
    SELECT TOP (ISNULL(DATALENGTH(@pString), 0)) ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) FROM E4
)
,cteStart(N1) AS(
    SELECT 1 UNION ALL
    SELECT t.N+1 FROM cteTally t WHERE SUBSTRING(@pString, t.N, 1) = @pDelimiter
),
cteLen(N1, L1) AS(
SELECT
    s.N1,
    ISNULL(NULLIF(CHARINDEX(@pDelimiter, @pString, s.N1),0) - s.N1, 8000)
FROM cteStart s
)
SELECT
    ItemNumber = ROW_NUMBER() OVER(ORDER BY l.N1),
    Item       = SUBSTRING(@pString, l.N1, l.L1)
FROM cteLen l

Then, you declare the list of empIds as csv string and use the splitter:
DECLARE @empIds VARCHAR(MAX) = '10,9,5,7,3,8';

SELECT e.EmpId, e.EmpName, e.Sal
FROM Emp e
INNER JOIN dbo.DelimitedSplit8K(@empIds, ',') s
    ON s.Item = l.EmpId
ORDER BY s.ItemNumber

A: Following query will give you the exact result (without order by):
SELECT EmpId,EmpName,Sal
FROM Emp
WHERE EmpId IN (10)
union all
SELECT EmpId,EmpName,Sal
FROM Emp
WHERE EmpId IN (9)
union all
SELECT EmpId,EmpName,Sal
FROM Emp
WHERE EmpId IN (5)
union all
SELECT EmpId,EmpName,Sal
FROM Emp
WHERE EmpId IN (7)
union all
SELECT EmpId,EmpName,Sal
FROM Emp
WHERE EmpId IN (3)
union all
SELECT EmpId,EmpName,Sal
FROM Emp
WHERE EmpId IN (8)

A: If Ids is a variable passed as input parameter to a stored procedure, you can split it using CTE.
--@inputIDs VARCHAR(300) => '10,9,5,7,3,8'

;WITH MyIds AS
(
    SELECT 1 AS Position, CONVERT(INT, LEFT(@inputIds, CHARINDEX(',', @inputIDs)-1)) AS MyId,
        RIGHT(@inputIds, LEN(@inputIds) - CHARINDEX(',', @inputIDs)) AS Remainder
    WHERE CHARINDEX(',', @inputIDs)>0
    UNION ALL
    SELECT Position +1  AS Position, CONVERT(INT, LEFT(Remainder, CHARINDEX(',', Remainder)-1)) AS MyId,
        RIGHT(Remainder, LEN(Remainder) - CHARINDEX(',', Remainder)) AS Remainder
    FROM MyIds
    WHERE CHARINDEX(',', Remainder)>0
    UNION ALL
    SELECT Position +1 AS Position, CONVERT(INT, Remainder) AS MyId,
        NULL AS Remainder
    FROM MyIds
    WHERE CHARINDEX(',', Remainder)=0
)
SELECT e.EmpId, e.EmpName, e.Sal
FROM Emp AS e INNER JOIN MyIds AS a ON e.EmpId = a.MyId
ORDER BY a.Position

A: The simplest way to achieve this is probably to use a table-valued constructor as a table expression containing the ids with a sort value, then order on this value:
Select
    Emp.EmpId, Emp.EmpName, Emp.Sal
from
        Emp
    Inner Join
        (
            Values
                (10, 1),
                (9, 2),
                (5, 3),
                (7, 4),
                (3, 5),
                (8, 6)
        )
        EmpIds (EmpId, Sort)
            On
                Emp.EmpId = EmpIds.EmpId
Order By
    EmpIds.Sort Asc


text:
Q: How to access constants from objects' methods with the Python C API? I have a follow up for another question. That question is about how to access constants added to a C extension module for Python.
To paraphrase that question and answer, if you added constants RED and BLUE to your module in the initialization function like this:
PyMODINIT_FUNC
PyInit_mymodule(void)
{
    PyObject* module = PyModule_Create(&Module);

    // ...

    PyModule_AddStringConstant(module, "BLUE", "blue");
    PyModule_AddStringConstant(module, "RED", "red");

    return module;
}

then you can access them, e.g. to return them from a function, like this (bearing in mind that you must increment reference counts if necessary):
// Get module dict. This is a borrowed reference.
PyObject* module_dict = PyModule_GetDict(module);

// Get BLUE constant. This is a borrowed reference.
PyObject* BLUE = PyDict_GetItemString(module_dict, "BLUE");

// Get RED constant. This is a borrowed reference.
PyObject* RED = PyDict_GetItemString(module_dict, "RED");

That works great if you have a pointer to the module object, which was the case in the linked question.
My question is, how do you do this if you don't have a pointer to the module object? For example, if the current function is an object's method, the self pointer you have is for that object, not the module (and I haven't been able to find a way to get the module from the object):
static PyObject * Foo_get_color(FooObject *self) {
    // How do I get the module object here?
    PyObject *module_dict = PyModule_GetDict(/* ??? */);

    PyObject *color = NULL;
    if (self->color == RED) {
        color = PyDict_GetItemString(module_dict, "RED");
        Py_INCREF(color);
    } else if (self->color == BLUE) {
        color = PyDict_GetItemString(module_dict, "BLUE");
        Py_INCREF(color);
    }

    return color;
}

A: If you have a module definition (struct PyModuleDef) you can just call PyState_FindModule. I am asuming your struct is named Module as in your example, so it will look like this:
PyObject * your_function() {
    PyObject *module = PyState_FindModule(&Module);
    PyObject* module_dict = PyModule_GetDict(module);
    ...
}

The FindModule documentation says that you need to add the module to the interpreter state as follows:
PyMODINIT_FUNC
PyInit_mymodule(void)
{
    PyObject* module = PyModule_Create(&Module);
    PyState_AddModule(module, &Module);
    ...


text:
Q: Replace \ from string I want to remove "" from the below string, and for that I am using
String orderDetailsDb =  "[{\"productId\":\"2814ff15-2fcf-4dc8-bf90-032e77a73e6b \",\"productName\":\"Garlic Oil 30 Capsules\",\"quantity\":6,\"price\":63.06,\"discount\":0,\"discountedPrice\":63.06,\"rowPrice\":\"\",\"gtinCode\":\"9324917000603\",\"accountNumber\":\"50138\",\"isPromo\":\"\"}]"

orderDetailsDb.replaceAll("\\", "");

but this is throwing
java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
 ^
        at java.util.regex.Pattern.error(Unknown Source)
        at java.util.regex.Pattern.compile(Unknown Source)
        at java.util.regex.Pattern.<init>(Unknown Source)
        at java.util.regex.Pattern.compile(Unknown Source)

A: If you want to remove the " in your string you can replace the " but you have to escape it because of course it would close the string in your argument.
orderDetailsDb.replaceAll("\"", "")

or better use just replace
orderDetailsDb.replace("\"", "")

because replaceAll uses regex internally and you don't need a regex expression here.
the \ " in your strings are not there, they are just used to escape the "


text:
Q: Does this have multiple meanings?
Why does she sing her sad songs for me, I'm not the one
  To tenderly bring her soft sympathy I've just begun
  To see my way clear and it's plain, if I stop I will fall
  I can lay down a tear for her pain, just a tear and that's all.

It is a Townes Van Zandt song.
I see three meanings:

I'm not the one to tenderly bring her soft sympathy.

And:

To tenderly bring her soft sympathy I've just begun

And:

I've just begun to see my way clear

Am I confused or misunderstanding the things or is it a really intentional double meaning?

A: Well, you as the listener have the ability to decide for yourself how to interpret it.
I'll say this, though—as a native speaker speaking from intuition, your interpretation doesn't seem very likely to me.  It seems like the song is written with the following sentences in mind:

Why does she sing her sad songs for me?
  I'm not the one to tenderly bring her soft sympathy.
  I've just begun to see my way clear, and it's plain that if I stop I will fall.
  I can lay down a tear for her pain, I can lay down just a tear and that's all that I can lay down.

But meaning isn't set in stone. The meaning in the song is what you find in it.  If you want to read it the other way, feel free :-)

A: You'll often encounter these sorts of broken lines in poetry or music because it helps to maintain a particular rhythm, pattern, or rhyme scheme. Consider students reading lines from Shakespeare, pausing unnaturally at the end of each line, vs an actor who reads through to the end of sentence so its meaning is clear.
In your example above, you'll notice the AA-BB rhyme scheme at the end of the lines, which is likely why they're wrapped as they are.
I'd agree w/Snailboat's interpretation as to where punctuation & obvious breaks would be if it were prose, but as stated you can also search for deeper meaning if you want. Playing with double meanings and alternate interpretations can be what makes it interesting.
On one hand, the singer is saying "Why me? I'm not the one she wants. I finally see my path to get clear of her and I can't stop now, so all she gets from me is a tear & nothing more."
On the other hand, even though he's "not the one," maybe he'd like to be and has "just begun" to care about her. Or he did before & is trying not to fall for her again. Maybe he's conflicted and torn in 2 directions by his feelings, just as the lines he speaks are torn down the middle.


text:
Q: Question on circle related to chords and arcs In the following figure how do I prove that arc AC +arc BD= arc CB +arc AD=semicircle.Given that chords intersect at $90^o$.

A: $90^\circ=\angle AOC=\frac{\mathrm{arc}AC+\mathrm{arc}BD}{2}$. Also $90^\circ=\angle COB=\frac{\mathrm{arc}CB+\mathrm{arc}AD}{2}$. Thus the firs part is shown.
On the other hand, since $180^\circ=\mathrm{arc}AC+\mathrm{arc}BD$, thus the sum of this arcs is an arc of a half of circunference. This proves the second part.


text:
Q: Not all parameters get sent in jquery ajax call I have a strange error where my jquery ajax request doesn't submit all the parameters.
$.ajax({
    url: "/ajax/doAssignTask",
    type: 'GET',
    contentType: "application/json",
    data: {
        "just_a_task": just_a_task,
        "fb_post_date": fb_post_date,
        "task_fb_postId": task_fb_postId,
        "sedia_task_guid": sedia_task_guid,
        "itemGuid": itemGuid,
        "itemType": itemType,
        "taskName": taskName,
        "assignedToUserGuid": assignedToUserGuid,
        "taskDescription": taskDescription
    },
    success: function(data, status) {
        //success code
    },
    error: function(xhr, desc, err) {
        //error code
    }
});

But using firebug (and debugging) I can see that only these variables are posted:
assignedToUserGuid
itemGuid
itemType
just_a_task
taskDescription
taskName

It's missing fb_post_date, task_fb_postId, and sedia_task_guid
I have no idea what would cause it to post only some items and not others? Anyone know?
Data is sent to asp.net controller that returns jsonresult (hence the contentType)
Any help is appreciated. Thanks!

A: What you should to to help with coding and debug is move the JSON data to a variable... ie, then you can easily see what is inside the variable before posting
var myData = {
    just_a_task: just_a_task,
    fb_post_date: fb_post_date,
    task_fb_postId: task_fb_postId,
    sedia_task_guid: sedia_task_guid,
    itemGuid: itemGuid,
    itemType: itemType,
    taskName: taskName,
    assignedToUserGuid: assignedToUserGuid,
    taskDescription: taskDescription
};
var jsonData = $.toJSON(myData);

$.ajax({
    url: "/ajax/doAssignTask",
    type: "GET",
    contentType: "application/json",
    dataType: "json",
    data: jsonData,
    success: function(data, status) {
        //success code
    },
    error: function(xhr, desc, err) {
        //error code
    }
});

Though I dont have time to run the code, could be the speech marks in the JSON. That should be out as its native JavaScript

A: You could try some things such as:

*

*See if all variables have values

*Try to remove the "_" from the variable's names

A: Check for special characters in your data values (, { } [ ] " '). You have to escape those characters for JSON to work.
Hope this helps.

A: in the interest of a sanity check, try adding a beforeSend to your options and ensure the values are being sent and go from there....
e.g.
.ajax({
    beforeSend: function (xhr) {
  // this==the options for this ajax request
  if(! fb_post_date || !task_fb_postId || ! sedia_task_guid){
    alert("BORKED!");
  }
},
....


text:
Q: ios7/8 transparent navigation bar I know this was answered, but I have some problem, I'm using this solution: link
The only change is that I'm using this in my viewcontroller so replaced self with navigationController!
My problem: the navigation bar is black, not transparent. Am I missing something?
I'm using swift with xcode6.1 and deployment target ios 7.1
Thank you in advance!
EDIT: (code as requested)
override func viewDidLoad() {
    super.viewDidLoad()
    //Transparent navigation bar
    navigationController!.navigationBar.translucent = true
    navigationController!.navigationBar.shadowImage = UIImage()
    navigationController!.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
    /////
    //other stuff
}

A: The problem was that in the view controller, the extend under top bar was disabled.


text:
Q: What third party development tools are available for SharePoint 2010? What is a list of third party tools available to support SharePoint 2010 developers?
One answer per tool please so the community can vote.

A: This question has been up several times before
For SP2007, which still applies for most tools
List of SharePoint development tools
The most important 3rd party tool is without doubt Community Kit for SharePoint CKS:DEV that extends the Visual Studio Studio integrated tools for SharePoint development.

A: The most important (for me) would be WSPBuilder: http://wspbuilder.codeplex.com/
Can't do proper Sharepoint development without it. Well, can, but it will be much slower.

A: The Imtech Create Page Layout Extenstion (SP2010) can be put to good use also: http://visualstudiogallery.msdn.microsoft.com/en-us/990bd0c8-a55b-4643-a35d-88136594c3d9
Off-course, most of the Imtech solutions are very good for Sharepoint development.


text:
Q: How to find element in selenium python using id and class in div How to find element in selenium python using both id and class in div and then click it:

I am using the following code:
arrow = driver.find_element_by_xpath('//div[@id="abc"][@class="xyz"]')
arrow.click()

But I am getting error as:
NoSuchElementException: Message: Unable to locate element: {"method":"xpath","selector":"//div[@id=\"abc\"][@class=\"xyz\"]"}

A: Use below:-
arrow = driver.find_element_by_xpath('//div[@id="abc" and @class="xyz"]')
arrow.click()

Here in XPath "and" operator is being used to combine id and class together
Hope it will help you :)

A: Try Using  this:    div[@id="abc" and @class="xyz"]'


text:
Q: Could not connect to mongod from mongo shell when auth enabled (on ubuntu) System: ubuntu 14.04
mongodb 3.0.3 tar ball is downloaded from mongodb download center
connected to mongodb without auth, then from mongo shell, created a user for 'test' db. following is the command.
db.createUser({user: "user1",
               pwd: "test123",
               roles: [ { role: "readWrite", db: "test" }
 ]})

Verified that user details in admin db. Following is the command & result:
> db.system.users.findOne({user:'user1'})
{
    "_id" : "testdb.user1",
    "user" : "user1",
    "db" : "testdb",
    "credentials" : {
        "SCRAM-SHA-1" : {
            "iterationCount" : 10000,
            "salt" : "kNfOd1vs+QT+ueH7SI6Vzw==",
            "storedKey" : "JCesIKSW1pb74ddo2Y19rEO1GVY=",
            "serverKey" : "d87Sb1htoD5K8zecAy73JPZyHdc="
        }
    },
    "roles" : [
        {
            "role" : "readWrite",
            "db" : "test"
        }
    ]
}

Now exit from the mongo shell, killed the mongod.
Started the mongodb with auth, following is the command.
$ ./mongod --auth

Connected to mongo shell as usual, see the below:
$ ./mongo
MongoDB shell version: 3.0.3
connecting to: test
> show collections
2016-05-11T22:33:46.302+0530 E QUERY    Error: listCollections failed: {
    "ok" : 0,
    "errmsg" : "not authorized on test to execute command { listCollections: 1.0 }",
    "code" : 13
}
    at Error (<anonymous>)
    at DB._getCollectionInfosCommand (src/mongo/shell/db.js:646:15)
    at DB.getCollectionInfos (src/mongo/shell/db.js:658:20)
    at DB.getCollectionNames (src/mongo/shell/db.js:669:17)
    at shellHelper.show (src/mongo/shell/utils.js:625:12)
    at shellHelper (src/mongo/shell/utils.js:524:36)
    at (shellhelp2):1:1 at src/mongo/shell/db.js:646
> db.auth({user:'user1', pwd:'test123'})
1
> use test
switched to db test
> db.collone.insert({name:'firstcollection'})
WriteResult({ "nInserted" : 1 })
> show collections
collone
system.indexes
> db.collone.find()
{ "_id" : ObjectId("5733669fb7d44cd444ebf028"), "name" : "firstcollection" }
> exit
bye

When i tried to do the authentication while starting the mongo shell, getting authentication failed error. See below:
$ ./mongo test -u 'user1' -p 'test123' --authenticationDatabase 'admin'
MongoDB shell version: 3.0.3
connecting to: test
2016-05-11T22:37:21.559+0530 E QUERY    Error: 18 Authentication failed.
    at DB._authOrThrow (src/mongo/shell/db.js:1266:32)
    at (auth):6:8
    at (auth):7:2 at src/mongo/shell/db.js:1266
exception: login failed

All this is just a POC that i'm trying to do.
Once it's success, my target is to connect from mongoose client(from Node.js app) to mongod.
The following command from a stackoverflow post can help me to set up connection from mongoose to mongod with auth.


text:
Q: Pandas Groupby : Get all rows for an ID for the earliest date (large dataset with many ID's) I have a df frame with monthly values for an ID and its associated columns. There are "groups" of rows for an ID and the month.  THere may be up to 12 months of data for each ID.
I want all the rows of data for all ID's where the month is the earliest date for each ID
The data looks like
    +-------+----+--------+-------------+-------------+----------+
| index | ID |  Date  |      X      |      Y      | Category |
+-------+----+--------+-------------+-------------+----------+
|     0 |  1 | 1/1/18 | 0.118758835 | 0.954677438 | A        |
|     1 |  1 | 1/1/18 | 0.148103273 | 0.976617504 | B        |
|     2 |  1 | 1/1/18 | 0.365541214 | 0.551642346 | C        |
|     3 |  1 | 1/2/18 | 0.405002687 | 0.343279097 | A        |
|     4 |  1 | 1/2/18 | 0.130580643 | 0.144486528 | B        |
|     5 |  1 | 1/2/18 | 0.395113106 | 0.113118681 | C        |
|     6 |  2 | 1/1/18 | 0.425580038 | 0.725166189 | A        |
|     7 |  2 | 1/1/18 | 0.889677796 | 0.386824338 | B        |
|     8 |  2 | 1/1/18 | 0.835311629 | 0.363802849 | C        |
|     9 |  2 | 1/2/18 | 0.8375818   | 0.769265522 | A        |
|    10 |  2 | 1/2/18 | 0.648162611 | 0.075286355 | B        |
|    11 |  2 | 1/2/18 | 0.639060695 | 0.791222309 | C        |
+-------+----+--------+-------------+-------------+----------+

I am wondering if I  can use Groupby to process the data to output
    +-------+----+--------+-------------+-------------+----------+
| index | ID |  Date  |      X      |      Y      | Category |
+-------+----+--------+-------------+-------------+----------+
|     0 |  1 | 1/1/18 | 0.118758835 | 0.954677438 | A        |
|     1 |  1 | 1/1/18 | 0.148103273 | 0.976617504 | B        |
|     2 |  1 | 1/1/18 | 0.365541214 | 0.551642346 | C        |
|     6 |  2 | 1/1/18 | 0.425580038 | 0.725166189 | A        |
|     7 |  2 | 1/1/18 | 0.889677796 | 0.386824338 | B        |
|     8 |  2 | 1/1/18 | 0.835311629 | 0.363802849 | C        |
+-------+----+--------+-------------+-------------+----------+

``
N.B have left the index numbers in the output df as the same to show the rows I want to get
Note: There are varying numbers of Categories for each ID i.e. can't just get n rows - must use the earliest month for each ID
I have written a python loop that iterates thru each id and then selects the rows with the earliest date but with a large 2+ GB dataset it is very slow.  Hope this is enough information.
If Groupby is not suitable, then other approaches welcome
Update:
I have done some more investigation on this and come up with a solution
see StackOverflow Pandas groupby rank date time
Use groupby and rank to create a DateRank column at the ID level
  df['DateRank'] = df.groupby('ID')['Date'].rank(method='dense', ascending=True)

filter on rank 1 (first entries)
xdf = df[df['DateRank'] == 1.0 ]
Remove the ranking column
xdf.drop('DateRank', axis=1, inplace=True)
print the dataframe
xdf

A: The function below will return the smallest value grouped by ID and Category
df=df.groupby(["ID","Category"], group_keys=False).apply(lambda g: g.nsmallest(1, "Date"))

A: First you should create a month column. Then return the row with the smallest month value in each [ID, Category] group.
Computation
df['month'] = df['Date'].map(lambda x: int(x.split("/")[1])) # get month
df = df.groupby(["ID","Category"])['month'].nsmallest(1) # get earliest month for each ID+category observation

Output
print(df.to_string())
  index ID    Date            X            Y Category  month
0     0  1  1/1/18  0.118758835  0.954677438        A      1
1     1  1  1/1/18  0.148103273  0.976617504        B      1
2     2  1  1/1/18  0.365541214  0.551642346        C      1
6     6  2  1/1/18  0.425580038  0.725166189        A      1
7     7  2  1/1/18  0.889677796  0.386824338        B      1
8     8  2  1/1/18  0.835311629  0.363802849        C      1


text:
Q: MS Access sub form not showing all results I have form in which there is sub-form. Sub-form displays data on the basis of one of the value in main form. Currently sub-form displays data for some records and for others it is not showing. When i remove condition, value are displayed and i can see master value and child value are same. Any suggestion would be highly appreciated.
below is the form:


text:
Q: Using a delegate in class field? Sometimes I see something similar to this inside a C# class:
private CultureInfo _culture = () => Thread.CurrentThread.CurrentCulture;

I tried this but it does not compile ... My questions are:

*

*How should I change this to compile?

*What is the difference between this code and:
private CultureInfo _culture = Thread.CurrentThread.CurrentCulture;
Thank You,
Miguel

A: If you use
private Func<CultureInfo> _culture = () => Thread.CurrentThread.CurrentCulture;

you get the current culture info for the actual thread at the actual moment.
Istead if you do
private CultureInfo _culture = Thread.CurrentThread.CurrentCulture;

you always get the culture info from the thread in which it was initialized at the time it was initialized.
As an improvement use a property to encapsulate _culture after using the function initialisation:
private CultureInfo Culture
{
    get { return _culture(); }
}

This gives you a member variable like usage.

A: use this..
private Func<CultureInfo> _culture = () => Thread.CurrentThread.CurrentCulture;


text:
Q: Verificar se campo é igual a zero na base de dados Como se faz uma query que verifica na base de dados se um campo é igual a zero (em PHP OOP)?

A: Tente a seguinte query:
SELECT campos FROM tabela WHERE campo = 0 -- Caso o campo seja numérico

SELECT campos FROM tabela WHERE campo LIKE '0' -- Caso o campo seja varchar

Para referenciar no PHP, você precisará fazer todo o "ritual":
<?php
// Cria a conexão
$host  = 'localhost'; // Endereço do servidor
$banco = 'meu_banco'; // Nome do banco de dados
$login = 'meu_login'; // Login no banco de dados
$senha = 'e_a_senha'; // Senha do banco de dados
$query = 'SELECT campos FROM tabela WHERE campo = 0';

try {
    // Conecta ao banco
    $pdo = new PDO('mysql:host='.$host.';dbname='.$banco, $login, $senha);

    // Prepara a consulta
    $consulta = $pdo->prepare($query);
    // Executa a consulta no banco
    $consulta->execute();
    // Faça o que for necessário com os dados
} catch (PDOException $ex) {
    exit('Erro ao carregar o banco de dados.');
}
?>

A: Tenta fazer assim, um IF.
$sql = "select * from tabela where campo = 'sua variavel';
$sth = $db->prepare($sql);
$sth->execute();
$record = $sth->fetch();
if ($sth->fetchColumn() > 0){
 //faz isso
}
else{
   faz isso...
}


text:
Q: problem relating two tables for get same id mysql I have problems to relate the columns of two tables
this is my table1 structure
where I want to relate the identify column to the id of table 2

this is my table2 structure

this is my query
$id             = (!empty($_GET['id']) ? $_GET['id'] : 0);
    $example1       = (!empty($_REQUEST['example1']) ? $_REQUEST['example1'] : '');
    $example2 = (!empty($_REQUEST['example2']) ? $_REQUEST['example2'] : '');
    $consult  = "SELECT a.id, a.user, a.date, a.action
    FROM table1 a
    INNER JOIN table2 b on b.idwork = $id
    WHERE module = 'Activity ".$idexample1."|".$idexample2."' AND identifier = $id ORDER BY id DESC ";

I get this after run my query
SELECT a.id, a.user, a.date, a.action
        FROM table1 a
        INNER JOIN table2 b on b.id = 244
        WHERE module = 'activity 1|98' AND identificador = 244 ORDER BY id DESC

what I try is to relate and make is that $id be the same identifier number

A: The join should be based ON the equality of the columns b.id and    a.identifier:
SELECT a.id, a.user, a.date, a.action
FROM table1 a INNER JOIN table2 b
ON b.id = a.identifier
WHERE a.module = 'activity 1|98' AND b.idwork = 244
ORDER BY a.identifier DESC

I used also the WHERE clause from your code and changed the column names to the ones of your sample data.


text:
Q: Automatic scrolling to keep child element in the center I have a parent div called lyricpadding, and inside I have a lot of
's with a unique ID. Anyways, what I need to do us, by using preferably Jquery or Javascript or CSS, is to keep the
 marked with the class of highlighted in the middle of the parent container, but I don't want it to stretch over the whole thing, I just want the text to be centered by an automatic scroll until it gets to the bottom. So the div with the class highlighted will always be visible, preferably in the center.

A: Here is a jQuery example. It uses position absolute and then adjusts according to the scroll position and window size. See this fiddle.
HTML:

Highlighted

Other

Other

Other

Other

CSS:
.lyricpadding
{
    height:1000px;
    width:100%;
    background-color:lightblue;
}
.highlighted
{
    display:inline-block;
    position:absolute;
}

jQuery:
function positionMiddle()
{
    var $highlighted = $('.highlighted');
    $highlighted.css({
        left: ($(window).width() - $highlighted.outerWidth())/2,
        top: $(window).scrollTop() + ($(window).height() - $highlighted.outerHeight())/2
    });
}

$(window).resize(function(){
   positionMiddle();
});

$(window).scroll(function(){
   positionMiddle();
});

// To initially run the function:
positionMiddle();


text:
Q: Function for probability distribution approximation of a compound random variable In the book (Klugman et al, 2019) on can see the

Example 9.12. The number of claims has a Poisson–ETNB distribution with
Poisson parameter  = 2 and ETNB parameters  = 3 and  = 0.2. The
claim size distribution has probabilities
0.3, 0.5, and 0.2 at 0, 10, and 20, respectively. Determine the total claims distribution recursively.

I have solved this example with the actuar package in R. My code is below:
library(actuar)

fx = c(0.3, 0.5, 0.2)
size = 0.2
prob = 0.25
x.scale = 10
lambda = 2

Fs <- aggregateDist("recursive",
                     model.freq = "zero-truncated negative binomial",
                     model.sev = fx, size=0.2, prob=0.25, x.scale = x.scale)

fx <- diff(Fs)

Fs <- aggregateDist("recursive", model.freq = "poisson",
                    model.sev = fx, lambda = lambda)

On can see the recursive method was used in the aggregateDist() function. This is the Panjer recursion.
For comparison one can use the next output:
diff(Fs(0:4))
[1] 0.11968449 0.12076747 0.10089972 0.08696367

Question. I am looking for an analog of the aggregateDist() function  in the Mathematica.


text:
Q: Ordering by model method I have a Opening Times table, and I need to sort the items according to the "opening time", so it will show 'open now', and then 'closed now' items. But I can't filter by a model method.
models.py
class Company(ImageBaseModel):
    class Meta:
        verbose_name = _(u"Empresa")
        verbose_name_plural = _(u"Empresas")
        ordering = ('order',)
    user                            = ForeignKey('auth.User', verbose_name=_(u"Responsável"), null=True, blank=True)

    # Admin fields
    slug            = SlugField(verbose_name=_(u'Slug / URL'), blank=True, null=True)
    order           = PositiveIntegerField(verbose_name=_(u"Ordem"), null=True, blank=True)

    def __unicode__(self):return u'%s'%self.title
    def get_address(self):
        if self.cep and self.address and self.city and self.number: return True

    def isopen(self):
        now = datetime.now()
        nowTime = time(now.hour, now.minute, now.second)
        ohs = self.opening_times.filter(company__slug=self.slug)
        status = False
        for oh in ohs:
            is_open = False
            # start and end is on the same day
            if oh.weekday == now.isoweekday() and oh.fromHour <= nowTime and nowTime <= oh.toHour:
               is_open = oh

            # start and end are not on the same day and we test on the start day
            if oh.weekday == now.isoweekday() and oh.fromHour <= nowTime and ((oh.toHour < oh.fromHour) and (nowTime < datetime.time(23, 59, 59))):
                is_open = oh

            # start and end are not on the same day and we test on the end day
            if (oh.weekday == (now.isoweekday()-1)%7 and oh.fromHour >= nowTime and oh.toHour >= nowTime and oh.toHour < oh.fromHour):
                is_open = oh
                #print " 'Special' case after midnight", oh

            if is_open is not False:
                status = True
        return status
    def hasOt(self): #have opening times registry
        return len(self.opening_times.all()[:1]) == 1

class OpeningHours(Model):
    class Meta:
        verbose_name = _(u"Horário de Abertura")
        verbose_name_plural = _(u"Horários de Abertura")
        unique_together = ('company', 'weekday')
    company = ForeignKey(Company, related_name="opening_times", verbose_name=_(u"Empresa"))
    weekday = IntegerField(choices=WEEKDAYS, verbose_name=_(u"Dia da Semana"))
    fromHour = TimeField(verbose_name=_(u"Abre ás:"), null=True, blank=True)
    toHour = TimeField(verbose_name=_(u"Fecha ás:"), null=True, blank=True)

    def __unicode__(self):
        return "%s %s (%s - %s)" % (self.company, self.weekday, self.fromHour, self.toHour)

views.py
def home(request):
    companies       = Company.objects.filter(published=True).order_by('opening_times')
    food_companies  = companies.all()[0:5] #here I'll have to filter only food companies open now.

I need to something like food_companies.order_by('open_now_first'), but I don't know how can I do that.

A: order_by is applied at the database level (ie in the raw SQL) so you can't call a function with it. You can get all your food_companies and sort them using isopen as a key, though. Something like:
sorted_companies = sorted(food_companies.objects.all(),
                          key=lambda food_company: food_company.isopen())


text:
Q: Replacing the Element with specific attribute and its value

lorem ipsum lorem ipsums ipsum ipsume lorem

how to replace the  tag with  so the out put will be like this.

    lorem ipsum lorem ipsums ipsum ipsume lorem

A: This will replace all <font and </font with <abbr and </abbr.
var p = document.getElementsByTagName("p")[0]; // assume this is the first P in the document
var p.innerHTML = p.innerHTML.replace(/(<|<\/)font/g, "$1abbr")

A: Finds all font tags within any  p, and replaces it with an abbr with the style attribute and text copied over.
$("p font").each(function() {
    var font = $(this);

    var abbr = $("", {
        style: font.attr("style"),
        text: font.text()
    });

    font.replaceWith(abbr);
});

A: Maybe you can use the getAttributes plugin to copy your attributes:
var attributes =$.getAttributes($(YOURTAG));
$(YOURTAG).replaceWith($('' + YOURTAG.innerHTML + '');
$(YOURTAG).attr(attributes);

Note: I'm sorry but I didn't test this one...

A: This should do the trick.
$('p').each(
     function(){
          $(this).html($(this).html().replace(/(<|<\/)font/g, "$1abbr"));
     }
);

A: I've come with this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title></title>

lorem ipsum lorem ipsums ipsum ipsume lorem

There may be a more straightforward way but this seems to work.


text:
Q: Distributed transaction among services in a microservice system, using spring-cloud
The current situation
Got a project using: spring-boot, spring-cloud, postgresql, as a microservice system.
There are 2 services, say SA and SB, they operate on 2 RDBMS databases respectively, say DA and DB.
Now, there is an operation contains 2 sub steps:

*

*Http client would make a request to service SA, to save a record RA, into DA.

*Then, SA send a request to service SB, to save a record RB, into DB.

As a whole, the 2 sub steps should either both commit, or both rollback.

Analysis

*

*If move both operations into a single service, then could use Spring's distributed transaction to sovled it with JTA (based on 2PC protocol).

*But here, the 2 operations are in 2 services, and they communicated via http REST protocol. Maybe could use mq + compensation to solve this, but I am not sure is there a better approach.

The questions are

*

*In this case, does JTA (based on 2PC protocol) still work?

*If not, what is the preferred solution?
Possible solutions I can guess:

*

*Refactor code to move the 2 operations into a single service.

*Implementat the mq + compensation architecture to support this.

A: Maybe this project is helpful for you https://github.com/apache/servicecomb-pack
Apache ServiceComb Pack is an eventually data consistency solution for micro-service applications. ServiceComb Pack currently provides TCC and Saga distributed transaction co-ordination solutions by using Alpha as a transaction coordinator and Omega as an transaction agent


text:
Q: .h: No such file or directory YOCTO/Openembedded I am trying to compile a simple PJSIP program with Yocto/Openembedded. And I have this error : fatal error: pjsua-lib/pjsua.h: No such file or directoryHere is my Makefile:
all: simple_pjsua

simple_pjsua: simple_pjsua.c
    $(CC) -o $@ $< `pkg-config --cflags --libs libpjproject`

clean:
    rm -f simple_pjsua.o simple_pjsua

And here is my simplepjsua_2.6.bb:
DESCRIPTION = "Open source SIP stack and media stack for presence, im/instant \
               messaging, and multimedia communication"
SECTION = "libs"
HOMEPAGE = "http://www.pjsip.org/"
# there are various 3rd party sources which may or may not be part of the
# build, there license term vary or are not explicitely specified.
LICENSE = "CLOSED"

PR = "r0"

SRC_URI = "file://simple_pjsua.c \
           file://Makefile \
           file://README.txt"

S = "${WORKDIR}/"

do_compile() {
    cd ${S}
    #to prevent libpjproject.PC not found error
    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
    oe_runmake
}

do_install() {
        install -m 0755 -d ${D}${bindir} ${D}${docdir}/simple_pjsua
        install -m 0755 ${S}/simple_pjsua ${D}${bindir}
        install -m 0755 ${WORKDIR}/README.txt ${D}${docdir}/simple_pjsua
}

I tried adding INC=-I/usr/include/pjsua-lib/ in the  Makefile but nothing changed.. And if I want to compile it on my computer with make it's working.
What can I do?
EDIT :
I tried adding export LD_LIBRARY_PATH=/usr/include in do_compile() in the bb file. Same issue

A: You're linking against host libraries which really isn't the right thing to do unless you're building a native package (which you are not).
You need to make a recipe for pjsip to build and install that, and then this recipe should DEPEND on that.

A: make sure that /usr/include/pjsua-lib/pjsua.h file exist.
# INC=-I/usr/include/pjsua-lib # not ok
INC=-I/usr/include


text:
Q: Action of the spin covariant derivative on gamma matrices? How does the spin covariant derivative $\nabla^S_{\mu}$ act on gamma matrices satisfying: $\{\gamma^{\mu},\gamma^{\nu}\} = g^{\mu\nu}$, i.e.
$$\nabla^S_{\mu}\gamma^{\nu} = ?$$
where $\nabla^S := \partial + \omega^S$ is the spin covariant derivative associated to the spin connection $\omega^S$ on the spinor bundle $S \rightarrow M$.

A: The question is not clearly stated, but if appropriately interpreted it does make sense.
Let $S$ be a spinor bundle over a pseudo-Riemannian manifold $(M,g)$, whose bundle of Clifford algebras is denoted by $Cl(M,g)$. Since $S$ is a spinor bundle, there exists a morphism of bundles of associative, unital algebras:
$\gamma \colon Cl(M,g)\to End(S)$
to the endomorphisms of $S$. Let $\left\{ e_{\mu}\right\}$ be a local orthonormal frame of $TM$ over $U\subset M$. Using the injection $TM\subset Cl(M,g)$ we can apply $\gamma$ to  $\left\{ e_{\mu}\right\}$:
$\gamma_{\mu} := \gamma(e_{\mu})\in End_U(S)\, ,$
obtaining what the physicists usually call the gamma matrices $\gamma_{\mu}$. Therefore, the gamma matrices are nothing but local sections of the endomorphism bundle of the spinor bundle obtained by Clifford multiplication with respect to an orthonormal frame.
Now, let $\nabla^S$ be a connection on $S$. To the question "how does $\nabla^S$ acts on the gamma matrices?" the answer is simple: it acts through the connection induced by $\nabla^S$ on the endomorphism bundle of $S$ by the usual formula, since we just saw that the gamma matrices are local sections of the endomorphism bundle of $S$. A more interesting question would be: Is $\nabla^S$ a module derivation with respect to Clifford multiplication?, that is, is the following formula satisfied:
$\nabla^S (\gamma(x) (\xi)) = (\nabla^S \gamma(x)) (\xi) + \gamma(x) (\nabla^S  \xi) $
for all $x\in \Gamma(Cl(M,g))$ and $\xi\in \Gamma(S)$?. Here I am denoting by the same symbol the connection in $S$ and the induced connection on the endomorphism bundle. A more interesting situation happens when $\nabla^S$ is the lift of a metric connection $\nabla$ on $(M,g)$, which is the usual case in many applications. In this case, the natural question would be: is the following formula
$\nabla^S (\gamma(v) (\xi)) = ( \gamma(\nabla v)) (\xi) + \gamma(v) (\nabla^S  \xi) $
satisfied for all $v\in \mathfrak{X}(M)\subset \Gamma(Cl(M,g))$ and $\xi\in \Gamma(S)$? That is, we wonder if $\nabla^S$ is a module derivation with respect to Clifford multiplication and in addition:
$\nabla^S \gamma(v) = \gamma(\nabla v)$
for all $v\in \mathfrak{X}(M)$. If both these conditions are satisfied, $\nabla^S$ is usually called a Clifford connection. For the case of $S$ being a spinor bundle associated to a spin structure and $\nabla^S$ being the lift of the Levi-Civita connection $\nabla$, one can see that $\nabla^S$ is indeed a Clifford connection and thus:
$\nabla^S\gamma_{\mu} = \nabla^S\gamma(e_{\mu}) = \gamma(\nabla e_{\mu}) = \mathcal{A}_{\mu\nu} \otimes \gamma( e_{\nu}) = \mathcal{A}_{\mu\nu} \otimes \gamma_{\nu}$
where $\nabla e_{\mu} = \mathcal{A}_{\mu\nu} \otimes e_{\nu}$. Hence, the gamma matrices behave as vectors (or one-forms) with respect the Levi-Civita connection when applying $\nabla^S$ and this tells you how the "spin covariant derivative" $\nabla^S$ acts on gamma matrices in the case of a Clifford connection lifting the Levi-Civita connection, which is probably the situation of interest for the OP.

A: You may take a look at this paper (https://inspirehep.net/literature/144424), especially relations (6.7) and (6.10) where discuss covariant derivative of gamma matrices.


text:
Q: What exactly will hiding my router's SSID achieve and can all of my devices connect to it? To expand on the title, if I hide my SSID, does this mean devices (excluding advanced network tools) will not be able to see it in a normal WIFI search, or does it mean something else?
Also, if I do hide this, will all of the following devices (which connect fine at the moment) be able to connect okay?

*

*Windows 7 laptop

*Mac OS X (10.6) laptop

*Android 2.3 phone

*iPhone 4

Many thanks! :)

A: Hiding your SSID actually accomplishes very little. Most wireless sniffing tools (Kismet/Kismac) are trivially able to see your SSID anyway. Not broadcasting your SSID does make it harder to configure your devices. They will not be able to manually detect encryption type.


text:
Q: set up jest testing for lit with typescript, microbundle I started today to migrate our web components to lit-html but when i tried to run the first test i get the following error message
SyntaxError: Cannot use import statement outside a module

> 1 | import {LitElement, html, css, svg} from "lit";
    | ^
  2 | import {property} from 'lit/decorators.js';
  3 |

with a pointer to lit\index.js
from searching the web i learned that i need to configure jest so lit will get precompiled by babel but so far no solution i found worked for me.
i made my .babelrc to a babel.config.js with following config:
module.exports = {
    "presets": [
        [
            "@babel/preset-env"
        ]
    ],
    "plugins": [
        ["transform-react-jsx", {"pragma": "h"}],
        "inline-svg"
    ]
}

(the transform-react-js option is needed since we have a few wrapper components )
jest.config.js has following options set:
module.exports = {
    preset: 'ts-jest',
    testEnvironment: 'jest-environment-jsdom',
    roots: [
        '<rootDir>/src',
    ],
    collectCoverageFrom: [
        '<rootDir>/src/**/*.tsx',
        '<rootDir>/src/**/*.ts',
        '!<rootDir>/src/test/**',
        '!<rootDir>/src/**/*.d.ts',
    ],
    coverageReporters: [
        'text-summary',
        'html',
        'lcov',
        'clover',
    ],
    coverageDirectory: './coverage/',
    collectCoverage: true,
    moduleDirectories: [
        'src',
        'node_modules',
    ],
    moduleFileExtensions: [
        'js',
        'ts',
        'tsx',
    ],
    moduleNameMapper: {
        '\\.(css)$': '<rootDir>/src/test/stubs/css.js',
    },
    snapshotSerializers: [
        'enzyme-to-json/serializer',
    ],
    snapshotResolver: '<rootDir>/src/test/snapshot-resolver.js',
    globals: {
        'ts-jest': {
            tsconfig: {
                allowJs: true,
            },
        },
    },
    setupFilesAfterEnv: [
        '<rootDir>/src/test/jest-setup.js',
    ],
    transform: {"^.+\\.(js|ts)x?$": 'ts-jest'},
    transformIgnorePatterns: ['node_modules/(?!(lit-element|lit-html|lit|@lit)/)'],
};

i tried a few other options for transformIgnorePatterns including passing every lit package seperately in an array with no success
did i miss an important option?

A: whelp. turned out i had to adjust the transformignorePatterns to:
transformIgnorePatterns: ['node_modules/(?!lit-element|lit-html|lit|@lit/)']
(no parenthesis around the lit packages)
found the answer here, where OP could only make it work with
(?!${['lit-element', 'lit-html', 'lit', '@lit'].join('|')})


text:
Q: Can't add reference to HttpBaseProtocolFilter I am coding a tool in C# with Visual Studio 2015 that queries a webserver and need authentification against a IBM webseal. Therefor I read in the internet it is possible to do the authentification with a HttpBaseProtocolFilter. But I cannot use it in my program as there is an error. "The Type- or namespacename 'HttpBaseProtocolFilter' was not found (missing using or assembly directive?)"
The documentation under https://learn.microsoft.com/en-us/uwp/api/windows.web.http.filters.httpbaseprotocolfilter says
Namespace:    Windows.Web.Http.Filters
Assemblies:   Windows.Web.Http.Filters.dll, Windows.dll
But I cannot find it in the IDE under  -  (hope I translated it correctly).
Hope you got a hint where to look for it.