text:
Q: Pausing a loop for specific time at a specific time in R I have to run a long loop that updates some data and stores it in my company's server. The problem is that the company runs a back-up routine at midnight, and, for that, they shutdown the server for around 15 minutes.
So, given that I have to write down a file for every iteration, when the server goes down it breaks the loop.
I managed to circumvent the problem by writing the loop as follows
for(i in bills.list){
  url = paste0("ulalah",i,"/")
  # Download the data
  bill.result <- try(getURL(url)) # if there is an error try again
  while(class(bill.result)=="try-error"){
    Sys.sleep(1)
    bill.result <- try(getURL(url))
  }

# if iteration is between 23:59:00 and 23:59:40 wait 17 min to restart the loop
  if(as.numeric(format(Sys.time(), "%H%M%S")) > 235900 &
     as.numeric(format(Sys.time(), "%H%M%S")) < 235940){

    Sys.sleep(1020)

  }
  # Write the page to local hard drive
  write(bill.result, paste0("bill", i, ".txt"))

  # Print progress of download
  cat(i, "\n")
}

Problem is, by evaluating the time at all iterations, I lose some precious time. Any more efficient thoughts?

A: I think you could simply try to store date. If it fails, it might be you are inside backup window
store <- function(data, retry = 10) {
  while(retry > 0) {
    result <- try(write(data, "/some_broken_place"))
    if(class(result) == "try-error") {
      # it might be we are in the backup window
      cat("I will sleep if it turns out that it's backup time")
      if(as.numeric(format(Sys.time(), "%H%M%S")) > 235900 &
         as.numeric(format(Sys.time(), "%H%M%S")) < 235940){
        Sys.sleep(1020)
      }
      retry <- retry - 1
    }
  }
  if(retry == 0) {
    cat("Very, very bad situation - no chance to store data")
  }
}


text:
Q: PHP doesn't work in HTML I want to test some PHP code, but when I write the following code:
<!DOCTYPE html>
<html>
    <body>
        Sun
        <?php
            echo "My first PHP script!";
        ?>
        Flower
    </body>
</html>

it only displays "Sun" and "Flower".
I have XAMPP installed; XAMPP Apache and MySQL are running. Also, the extension is".php". So, do you know how to solve this problem?
Thank you!
(I am new in learning PHP)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Ajax is failing to get the content I am new to the ajax. This is the simple code i am trying to compile.
I dont know why it is not able to get the contents of the file.
Here is my code:-
<!DOCTYPE html>

Ajax

<button>Get Content</button>

please someone tell me where i am going wrong.
Thnaks in advance.
UPDATE :-
After some trial and error and i got the desired result.
I missed out declaration of datatype that is dataType:"text"
Now code is working perfectly.

A: Where is your file is located? Make sure you have text.txt file in the same location as your html page.

A: Your code works perfectly if file containing jquery code and text.txt file both are in same folder.

A: Try error handling like this:
$(document).ready(function() {
  $("button").click(function() {
    $.ajax({
      url: "text.txt",
      success: function(result) {

        $("#div1").html(result);

      },
      error: function(xhr, ajaxOptions, thrownError) {
        alert(xhr.status);
        alert(thrownError);
      }
    });
  });
});

instead of using fail


text:
Q: How to Auto Rotate User Agent and Proxies with Python Selenium How can I Auto Rotate User Agents and Proxies (in a .txt file) with Python Selenium per session? i.e when I run the code, it will auto-select one proxy and one user-agent, open up the website, perform the clicks, close and auto-select another proxy and user-agent. Running Continuously
Here is my code
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
import time

driver = webdriver.Chrome()

driver.get("https://eddykulnews.blogspot.com/")
time.sleep(4)

Website=driver.find_element(By.XPATH,'//*[@id="socialcounter"]/ul/li[1]/a')
action=ActionChains(driver)
ActionChains(driver) \
    .key_down(Keys.CONTROL) \
    .click(Website) \
    .key_up(Keys.CONTROL) \
    .perform()

Twitter=driver.find_element(By.XPATH,'//*[@id="socialcounter"]/ul/li[3]/a')
action=ActionChains(driver)
ActionChains(driver) \
    .key_down(Keys.CONTROL) \
    .click(Twitter) \
    .key_up(Keys.CONTROL) \
    .perform()

time.sleep(10)
driver.quit()


text:
Q: Populating Spinner using ArrayList in Android I have an activity in which I have to parse an XML and populate a Spinner using the parsed data.
I am done with parsing the XML. This is the method:
void parse_ExamList()
                    {

                        ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();

                        XMLParser parser = new XMLParser();
                        //String xml = parser.getXmlFromUrl(URL); // getting XML
                        Document doc = parser.getDomElement(xmlContent); // getting DOM element

                        //count_questions=2;

                        NodeList nl = doc.getElementsByTagName(KEY_EXAMSET);
                        // looping through all item nodes <item>
                        for ( int i = 0; i < nl.getLength();i++) {

//                      while(counter< nl.getLength())
//                      {
                            // creating new HashMap
                            HashMap<String, String> map = new HashMap<String, String>();

                            Element e = (Element) nl.item(i);
                            // adding each child node to HashMap key => value
                            //map.put(KEY_EXAMSET, parser.getValue(e, KEY_EXAMSET));
                            map.put(KEY_SETID, parser.getValue(e, KEY_SETID));
                            map.put(KEY_SETNAME, parser.getValue(e, KEY_SETNAME));
                            //Log.i("Set ID: ", parser.getValue(e, KEY_SETID));
                            //Log.i("Set Name: ", parser.getValue(e, KEY_SETNAME));

                            menuItems.add(map);
                        }

                    }

If you notice you can see that KEY_SETID and KEY_SETNAME to the arraylist. I have to populate the spinner with the KEY_SETNAME and the KEY_SETID will not be shown in the spinner. But if the item is clicked then the id corresponding to the name should be acquired in order to send to the server.
I have a method to populate a spinner, like this:
// add items into exam list spinner dynamically
                    public void addItemsOnExamListSpinner()
                    {
                        List<String> list = new ArrayList<String>();
                        list.add("Speed Test 150(min) PO Set-01");

                        ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
                        android.R.layout.simple_spinner_item, list);
                        dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                        exam_list_spinner.setAdapter(dataAdapter);
                    }

How should I populate the spinner with the ArrayList that is obtained while parsing the XML?
This is the full activity:
public class SpeedTestExamNameActivity extends Activity {

    Spinner exam_list_spinner;
    Button  detailsBtn;
    TextView showUser;
    String full_name;

    //variables to get response from server
    String responseBody;

    //variables required for parsing the XML
    String xmlContent=null;

 // XML node keys
    static final String KEY_EXAMSET = "ExamSet"; // parent node
    static final String KEY_SETID = "SetId";
    static final String KEY_SETNAME = "SetName";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_speed_test_exam_name);

        //checking internet connectivity to download list
        isOnline_downloadList();

        //Showing user full name after login
        full_name=getFromPreference("user_name");
        //textview to show user name
        showUser=(TextView)findViewById(R.id.speed_username_textView);
        showUser.setText("Welcome, "+full_name);
        //spinner
        exam_list_spinner = (Spinner) findViewById(R.id.speed_examlist_spinner);
        //adding items to spinners
        addItemsOnExamListSpinner();

        // onclick details button
        detailsBtn = (Button) findViewById(R.id.speed_exam_details_button);
        detailsBtn.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {

                        Toast.makeText(SpeedTestExamNameActivity.this,
                                "Exam List Spinner: "+ String.valueOf(exam_list_spinner.getSelectedItem()),
                                Toast.LENGTH_SHORT).show();

                        Intent intent = new Intent(SpeedTestExamNameActivity.this, SpeedTestActivity.class);
                        SpeedTestExamNameActivity.this.startActivity(intent);
                    }
                  });
    }

    //getting content from preferences
        public String getFromPreference(String variable_name)
        {
            String preference_return;
            SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
            preference_return = preferences.getString(variable_name,"");

           return preference_return;
        }

        //check connection
        public boolean isOnline_downloadList() {
            ConnectivityManager cm =(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo netInfo = cm.getActiveNetworkInfo();
            if (netInfo != null && netInfo.isConnectedOrConnecting()) {

                //sending request for login
                new MyAsyncTask().execute(getFromPreference("student_code"));

                return true;
            }

          //alert box to show internet connection error
            AlertDialog.Builder Internet_Alert = new AlertDialog.Builder(SpeedTestExamNameActivity.this);
            // set title
            Internet_Alert.setCancelable(false);
            Internet_Alert.setTitle("Attention!");
            Internet_Alert.setMessage("This application requires internet connectivity, no internet connection detected");
            Internet_Alert.setPositiveButton("Quit", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface arg0, int arg1)
                {
                    Intent intent = new Intent(Intent.ACTION_MAIN);
                    intent.addCategory(Intent.CATEGORY_HOME);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(intent);
                    onQuitPressed();
                }
            });

            Internet_Alert.create().show();
            return false;
        }

        //to remove application from task manager
        public void onQuitPressed() {

            int pid = android.os.Process.myPid();
            android.os.Process.killProcess(pid);
        }

        //===================================================================================================================================
        //sending student code to server to get exam list
        //===================================================================================================================================
        private class MyAsyncTask extends AsyncTask<String, Integer, Double>{

            @Override
            protected Double doInBackground(String... params) {
                // TODO Auto-generated method stub
                postData(params[0]);
                return null;
            }

            protected void onPostExecute(Double result){

                //Toast.makeText(getApplicationContext(), responseBody, Toast.LENGTH_LONG).show();
                //Log.i("response: ", responseBody);
                //processResponce(responseBody);
                //going to next activity
                xmlContent=responseBody;
                parse_ExamList();
            }

            protected void onProgressUpdate(Integer... progress){

            }

            public void postData(String student_code) {
                // Create a new HttpClient and Post Header
                HttpClient httpclient = new DefaultHttpClient();
                //HttpPost httppost = new HttpPost("http://icaerp.com/AndroidDataService/dataServiceAndroid.asmx/login");

                SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(SpeedTestExamNameActivity.this);
                  final String url_first = preferences.getString("URLFirstPart","");
                HttpPost httppost = new HttpPost(url_first+"ExamList");

                try {
                    // Data that I am sending
                    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
                    nameValuePairs.add(new BasicNameValuePair("StudentCode", student_code));
                    //nameValuePairs.add(new BasicNameValuePair("Password", passwrd));
                    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                    // Execute HTTP Post Request
                    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                    HttpResponse response = httpclient.execute(httppost);
                    responseBody = EntityUtils.toString(response.getEntity());

                    Log.d("result", responseBody);
                }
                catch (Throwable t ) {
                    //Toast.makeText( getApplicationContext(),""+t,Toast.LENGTH_LONG).show();
                    Log.d("Error Time of Login",t+"");
                }
            }
        }
        //===================================================================================================================================
        //END sending EmailAddress and Password to server
        //===================================================================================================================================

        // function to populate SPINNER with exam list from xml
                    void parse_ExamList()
                    {

                        ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();

                        XMLParser parser = new XMLParser();
                        //String xml = parser.getXmlFromUrl(URL); // getting XML
                        Document doc = parser.getDomElement(xmlContent); // getting DOM element

                        //count_questions=2;

                        NodeList nl = doc.getElementsByTagName(KEY_EXAMSET);
                        // looping through all item nodes <item>
                        for ( int i = 0; i < nl.getLength();i++) {

//                      while(counter< nl.getLength())
//                      {
                            // creating new HashMap
                            HashMap<String, String> map = new HashMap<String, String>();

                            Element e = (Element) nl.item(i);
                            // adding each child node to HashMap key => value
                            //map.put(KEY_EXAMSET, parser.getValue(e, KEY_EXAMSET));
                            map.put(KEY_SETID, parser.getValue(e, KEY_SETID));
                            map.put(KEY_SETNAME, parser.getValue(e, KEY_SETNAME));
                            //Log.i("Set ID: ", parser.getValue(e, KEY_SETID));
                            //Log.i("Set Name: ", parser.getValue(e, KEY_SETNAME));

                            menuItems.add(map);
                        }

                    }

                    // add items into exam list spinner dynamically
                    public void addItemsOnExamListSpinner()
                    {
                        List<String> list = new ArrayList<String>();
                        list.add("Speed Test 150(min) PO Set-01");

                        ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
                        android.R.layout.simple_spinner_item, list);
                        dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                        exam_list_spinner.setAdapter(dataAdapter);
                    }

}

This is the layout file:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".SpeedTestExamNameActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="30dp"
        android:text="@string/speed_choose_exam"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Spinner
        android:id="@+id/speed_examlist_spinner"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView1"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="68dp" />

    <Button
        android:id="@+id/speed_exam_details_button"
        android:layout_width="95dp"
        android:layout_height="wrap_content"
        android:layout_below="@+id/speed_examlist_spinner"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="36dp"
        android:text="@string/details" />

    <TextView
        android:id="@+id/speed_username_textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text="Name Title"
        android:textAppearance="?android:attr/textAppearanceSmall" />

</RelativeLayout>

What should I do to populate the Spinner from the Arraylist returned by the XML parsing method?

A: This is how you can go about doing it.
First, create a POJO MyObject, which has the 2 fields KEY_SETID and KEY_SETNAME and its related getter/setter. Override the toString(), to return KEY_SETNAME, as you want to display this as the item name in the Spinner.
Then create an ArrayList of your MyObject, from the HashMap you populated by parsing your XML.
Then using the sample code snippet below, populate data in your Spinner.
Spinner s = (Spinner) findViewById(R.id.SpinnerSpcial);
ArrayList<MyObject> objects = new ArrayList<MyObject>(); // This is actually the list created from the HashMap
ArrayAdapter<MyObject> adapter = new ArrayAdapter<ObjectName>(this, android.R.layout.simple_spinner_item, objects);
s.setAdapter(adapter);

Now to get the item selected, use the below code.
MyObject selectedItem = (MyObject) s.getSelectedItem(); // Object which was selected.
selectedItem.getKEY_SETID(); // This will give you the ID of the item selected. Do whatever you wish with to do.

Try it out and let me know, if you're stuck up anywhere.
Update:-
Your POJO will be like this.
public class MyObject {
    private String KEY_SETID;
    private String KEY_SETNAME;

    public String getKEY_SETID() {
        return KEY_SETID;
    }

    public void setKEY_SETID(String kEY_SETID) {
        KEY_SETID = kEY_SETID;
    }

    public String getKEY_SETNAME() {
        return KEY_SETNAME;
    }

    public void setKEY_SETNAME(String kEY_SETNAME) {
        KEY_SETNAME = kEY_SETNAME;
    }

    @Override
    public String toString() {
        return this.KEY_SETNAME; // Value to be displayed in the Spinner
    }
}

A: Tip:Try to make the code simple and working.So first,in your parsing function instead of adding a HashMap to the ArrayList .. take two arraylists and these ArrayLists should be declared at a class level.Correspondingly,fill both ArrayLists and fetch them at Spinner click.So your Activity code stands:
    public class SpeedTestExamNameActivity extends Activity {

        Spinner exam_list_spinner;
        Button  detailsBtn;
        TextView showUser;
    String full_name;
    ArrayList<String> menuItems = new ArrayList<String>();
    ArrayList<String> menuKeys = new ArrayList<String>();

    //variables to get response from server
    String responseBody;

    //variables required for parsing the XML
    String xmlContent=null;

     // XML node keys
        static final String KEY_EXAMSET = "ExamSet"; // parent node
        static final String KEY_SETID = "SetId";
        static final String KEY_SETNAME = "SetName";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_speed_test_exam_name);

        //checking internet connectivity to download list
        isOnline_downloadList();

        //Showing user full name after login
        full_name=getFromPreference("user_name");
        //textview to show user name
        showUser=(TextView)findViewById(R.id.speed_username_textView);
        showUser.setText("Welcome, "+full_name);
        //spinner
        exam_list_spinner = (Spinner) findViewById(R.id.speed_examlist_spinner);
        //adding items to spinners
        addItemsOnExamListSpinner();

        // onclick details button
        detailsBtn = (Button) findViewById(R.id.speed_exam_details_button);
        detailsBtn.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {

                        Toast.makeText(SpeedTestExamNameActivity.this,
                                "Exam List Spinner: "+

    String.valueOf(exam_list_spinner.getSelectedItem()),
                                    Toast.LENGTH_SHORT).show();
    //here you get the menuKey too
    Toast.makeText(SpeedTestExamNameActivity.this,
                                    "Exam List Spinner Key: "+ menuKeys.get(exam_list_spinner.getSelectedItemPosition()),
                                    Toast.LENGTH_SHORT).show();
                        Intent intent = new Intent(SpeedTestExamNameActivity.this, SpeedTestActivity.class);
                        SpeedTestExamNameActivity.this.startActivity(intent);
                    }
                  });
    }

    //getting content from preferences
        public String getFromPreference(String variable_name)
        {
            String preference_return;
            SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
            preference_return = preferences.getString(variable_name,"");

           return preference_return;
        }

        //check connection
        public boolean isOnline_downloadList() {
            ConnectivityManager cm =(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo netInfo = cm.getActiveNetworkInfo();
            if (netInfo != null && netInfo.isConnectedOrConnecting()) {

                //sending request for login
                new MyAsyncTask().execute(getFromPreference("student_code"));

                return true;
            }

          //alert box to show internet connection error
            AlertDialog.Builder Internet_Alert = new AlertDialog.Builder(SpeedTestExamNameActivity.this);
            // set title
            Internet_Alert.setCancelable(false);
            Internet_Alert.setTitle("Attention!");
            Internet_Alert.setMessage("This application requires internet connectivity, no internet connection detected");
            Internet_Alert.setPositiveButton("Quit", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface arg0, int arg1)
                {
                    Intent intent = new Intent(Intent.ACTION_MAIN);
                    intent.addCategory(Intent.CATEGORY_HOME);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(intent);
                    onQuitPressed();
                }
            });

            Internet_Alert.create().show();
            return false;
        }

        //to remove application from task manager
        public void onQuitPressed() {

            int pid = android.os.Process.myPid();
            android.os.Process.killProcess(pid);
        }

        //===================================================================================================================================
        //sending student code to server to get exam list
        //===================================================================================================================================
        private class MyAsyncTask extends AsyncTask<String, Integer, Double>{

            @Override
            protected Double doInBackground(String... params) {
                // TODO Auto-generated method stub
                postData(params[0]);
                return null;
            }

            protected void onPostExecute(Double result){

                //Toast.makeText(getApplicationContext(), responseBody, Toast.LENGTH_LONG).show();
                //Log.i("response: ", responseBody);
                //processResponce(responseBody);
                //going to next activity
                xmlContent=responseBody;
                parse_ExamList();
            }

            protected void onProgressUpdate(Integer... progress){

            }

            public void postData(String student_code) {
                // Create a new HttpClient and Post Header
                HttpClient httpclient = new DefaultHttpClient();
                //HttpPost httppost = new HttpPost("http://icaerp.com/AndroidDataService/dataServiceAndroid.asmx/login");

                SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(SpeedTestExamNameActivity.this);
                  final String url_first = preferences.getString("URLFirstPart","");
                HttpPost httppost = new HttpPost(url_first+"ExamList");

                try {
                    // Data that I am sending
                    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
                    nameValuePairs.add(new BasicNameValuePair("StudentCode", student_code));
                    //nameValuePairs.add(new BasicNameValuePair("Password", passwrd));
                    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                    // Execute HTTP Post Request
                    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                    HttpResponse response = httpclient.execute(httppost);
                    responseBody = EntityUtils.toString(response.getEntity());

                    Log.d("result", responseBody);
                }
                catch (Throwable t ) {
                    //Toast.makeText( getApplicationContext(),""+t,Toast.LENGTH_LONG).show();
                    Log.d("Error Time of Login",t+"");
                }
            }
        }
        //===================================================================================================================================
        //END sending EmailAddress and Password to server
        //===================================================================================================================================

        // function to populate SPINNER with exam list from xml
                    void parse_ExamList()
                    {

                        XMLParser parser = new XMLParser();
                        //String xml = parser.getXmlFromUrl(URL); // getting XML
                        Document doc = parser.getDomElement(xmlContent); // getting DOM element

                        //count_questions=2;

                        NodeList nl = doc.getElementsByTagName(KEY_EXAMSET);
                        // looping through all item nodes <item>
                        for ( int i = 0; i < nl.getLength();i++) {

//                      while(counter< nl.getLength())
//                      {

                            Element e = (Element) nl.item(i);
                            // adding each child node to HashMap key => value
                            //map.put(KEY_EXAMSET, parser.getValue(e, KEY_EXAMSET));
                            menuKeys.add( parser.getValue(e, KEY_SETID));
                            menuItems.add( parser.getValue(e, KEY_SETNAME));
                            //Log.i("Set ID: ", parser.getValue(e, KEY_SETID));
                            //Log.i("Set Name: ", parser.getValue(e, KEY_SETNAME));

                        }

                    }

                    // add items into exam list spinner dynamically
                    public void addItemsOnExamListSpinner()
                    {
                        List<String> list = new ArrayList<String>();
                        list.add("Speed Test 150(min) PO Set-01");

                        ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
                        android.R.layout.simple_spinner_item, menuItems);
                        dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                        exam_list_spinner.setAdapter(dataAdapter);
                    }

}

Note: Simple replace will do.I have only changed code in detailsBtn.setOnClickListener(new View.OnClickListener() { and your parseExamList() and just declared two ArrayLists at the class level.try it and see if you get two Toasts on Clicking details button before launching the new activity.
UPDATE: i assume that you've followed the android hive tutorial for parsing XML.Just change the getValue function with this in your XMLParser class:
public String getValue(Element item, String str) {
    NodeList n = item.getElementsByTagName(str);
    return this.getElementValue(n.item(0));
}

But in case you're not following that.. then following that tutorial to build the parser would solve your issue.Insha Allah.If i have helped you to reach a solution then please mark it as an answer

A: Spinner spinnerLocation;
spinnerLocation = (Spinner)findViewById(R.id.spinnerLocation);
    ArrayList<String> locationArray = new ArrayList<String>();
    for(int i=0;i<10;i++)
    {
        locationArray.add("value "+i);
    }
    ArrayAdapter<String> locationAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, locationArray);
            locationAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            spinnerLocation = (Spinner)findViewById(R.id.spinnerLocation);
            spinnerLocation.setAdapter(locationAdapter);
            spinnerLocation.setAdapter(locationAdapter);
            spinnerLocation.setOnItemSelectedListener(new OnItemSelectedListener() {
                int count=0;
                @Override
                public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3)
            {
                    System.out.println("whatever you wanna do");

                }
                @Override
                public void onNothingSelected(AdapterView<?> arg0) {
                    Toast.makeText(getBaseContext(),"inside no item selected ",Toast.LENGTH_SHORT).show();
                }
            });

A: I have done a workaround by changing my code xml parsing code to this:
void parse_ExamList()
{

ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();
    XMLParser parser = new XMLParser();
    Document doc = parser.getDomElement(xmlContent); // getting DOM element

    //list object to populate spinner
    List<String> list = new ArrayList<String>();

    NodeList nl = doc.getElementsByTagName(KEY_EXAMSET);
    // looping through all item nodes <item>
    for ( int i = 0; i < nl.getLength();i++) {

    // creating new HashMap
    HashMap<String, String> map = new HashMap<String, String>();

    Element e = (Element) nl.item(i);
    // adding each child node to HashMap key => value
    //map.put(KEY_EXAMSET, parser.getValue(e, KEY_EXAMSET));
    map.put(KEY_SETID, parser.getValue(e, KEY_SETID));
    map.put(KEY_SETNAME, parser.getValue(e, KEY_SETNAME));
    //adding items to spinners
    list.add("("+parser.getValue(e, KEY_SETID)+") "+parser.getValue(e, KEY_SETNAME));
    menuItems.add(map);
    }

    //populating the spinner with the list items
    ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
    android.R.layout.simple_spinner_item, list);
    dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    exam_list_spinner.setAdapter(dataAdapter);

    }

But the problem is that, both the id and name are getting displayed in the spinner, I just want to show the name and hide the id while displaying. But later I will require the id with the selected name


text:
Q: Upper bound of $\left| \sum_{n=1}^N e^{2\pi i\psi(n+1)} \right|$, where $\psi(x)$ is the digamma function Let $\psi(x)$ the digamma function, see its definition and relation with harmonic functions from this Wikipedia.

Question. I am interested about if is known how to find an upper bound of $$ \left| \sum_{n=1}^N e^{2\pi i\psi(n+1)} \right|, \tag{1}$$ as $\leq N\Delta$, where $\Delta=\Delta(N)$ is little and satisfies $\Delta(N)\to 0$ as $N\to\infty$. Thanks you in advance.

I've created this question and has no more context, to know what are the method and approach that you can use.


text:
Q: Node JS Express API Transaction i have a problem with my API transaction script, i want to send a multiple query, and use some commit to secure my transaction, but my script just work crazy and do his stuff 2 times with no logic for me.
I made 2 errors in my query (query and queryFactureReglement), when i launch my script, this is what i get :
HEY1
null false1
null false3
HEY7
HEY8
POST /reglement 200 231.449 ms - 23
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near ' '2019-11-18')' at line 1 false4
HEY2
HEY4false
HEY52
I dont understand what i did wrong, if you have an idea or a better way to do transaction.
Thanks for your help.
  //Envoie des requêtes en transaction pour rollback en cas d'erreur -----------------------------------------------------------------------------
        pool.getConnection(function (err, connection) {
            console.log("HEY1");
            //On débute la transaction
            connection.beginTransaction(function (err) {
                console.log(err + " " + flagError + 1);
                if (err && !flagError) {
                    console.log(err + " " + flagError + 2);//Transaction Error (Rollback and release connection)
                    flagError = true;
                        res.status(500).send(err);
                        //Failure
                } else {
                    console.log(err + " " + flagError + 3);
                    //Requête ajout réglement
                    try {
                        connection.query(query, null, function (err, results) {
                            console.log(err + " " + flagError + 4);
                            if (err && !flagError) {          //Query Error (Rollback and release connection)
                                console.log("HEY2");
                                connection.rollback(function () {
                                    flagError = true;
                                    res.status(500).send(err);

                                    //Failure
                                });
                            } else { //On récupère l'IDREGLEMENT si aucune erreur
                                console.log(err + " " + flagError + 5);
                                IDReglementInsert = result.insertId;
                                console.log("HEY3");
                            }
                        });
                    } catch (e) {
                        console.log("ENFIN " + e);
                    }
                    //Requête ajout Facture_Reglement
                    connection.query(queryFactureReglement, [IDReglementInsert], function (err, results) {
                        if (err && !flagError) {          //Query Error (Rollback and release connection)
                            console.log("HEY4" + flagError);
                            connection.rollback(function () {
                                flagError = true;
                                res.status(500).send(err);

                                //Failure
                            });
                            //connection.rollback(function () {
                            //Failure
                            //  });
                        } else {
                            console.log("HEY42");
                        }
                    });
                    //Requête modificaiton facture
                    connection.query(queryFacture, null, function (err, results) {
                        if (err && !flagError) {          //Query Error (Rollback and release connection)
                            console.log("HEY5");
                            //  res.status(500).send(err);
                            connection.rollback(function () {
                                flagError = true;
                                res.status(500).send(err);

                                //Failure
                            });
                        } else {

                            console.log("HEY52");
                        }
                    });
                }
            });

            if (flagError) {
                connection.release();
            } else {
                //Aucune erreur, on commit
                connection.commit(function (err) {
                    console.log("HEY7");
                    connection.release();
                    //Success
                    console.log("HEY8");
                    res.header("Access-Control-Allow-Origin", "*");
                    res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
                    res.send("IDREGLEMENT : " + IDReglementInsert);
                    //Fin de la transaction
                });
            }

A: After many test, this is my final script if you need it:
 pool.getConnection(function (err, connection) {
            connection.beginTransaction(function (err) {

                if (err) {
                    console.log(" --- error 1: " + JSON.stringify(err));
                    connection.release();
                    res.status(500).send(err);
                }
                else {
                    //Query pour l'ajout du reglement
                    connection.query(query, null, function (err, result) {
                        //Erreur detecté, on roll back les query éxecutées, on relache la connexion et on envoie le message d'erreur au navigateur
                        if (err) {
                            connection.rollback(function () {
                                //console.log(" --- error 2: " + JSON.stringify(err));
                                console.log(" --- error 2: " + query);
                                connection.release();
                                res.status(500).send(err);
                            });
                        }
                        else {
                            IDReglementInsert = result.insertId;
                            //Aucune erreur, on continue l'envoi
                            //Query pour l'ajout de la FactureReglement
                            connection.query(queryFactureReglement, [IDReglementInsert], function (err, result) {
                                  //Erreur detecté, on roll back les query éxecutées, on relache la connexion et on envoie le message d'erreur au navigateur
                                if (err) {
                                    connection.rollback(function () {
                                        console.log(" --- error 3: " + JSON.stringify(err));
                                        connection.release();
                                        res.status(500).send(err);

                                    });
                                } else {
                                    //Aucune erreur, on continue l'envoi
                                    //Query pour la modification du la facture
                                    connection.query(queryFacture, null, function (err, result) {
                                        //Erreur detecté, on roll back les query éxecutées, on relache la connexion et on envoie le message d'erreur au navigateur
                                        if (err) {
                                            connection.rollback(function () {
                                                console.log(" --- error 3: " + JSON.stringify(err));
                                                connection.release();
                                                res.status(500).send(err);
                                            });
                                        }else{
                                            //On commit car aucune erreur dans les query
                                            connection.commit(function (err) {
                                                      //Erreur detecté, on roll back les query éxecutées, on relache la connexion et on envoie le message d'erreur au navigateur
                                                    if (err) {
                                                        connection.rollback(function () {
                                                            console.log(" --- error 4: " + JSON.stringify(err));
                                                            connection.release();
                                                            res.status(500).send(err);
                                                        });
                                                    }

                                                    res.send("IDREGLEMENT : " + IDReglementInsert);

                                                    connection.release();
                                                });
                                        }
                                    });
                                }
                            });
                        }
                    });
                }
            });
        });


text:
Q: General procedure to find the determinant of an operator? I want to learn to find the determinant of an operator.
I am given an operator like
$\Sigma _{\alpha\beta}=-k^2g_{\alpha\beta}+i\theta\epsilon_{\alpha\beta\gamma} k^\gamma$
$k^2=k^μk_μ$, $g^{αβ}$ is metric tensor, theta is a constant $ϵ$ is totally anti-symmetric tensor in 3 D and $k^γ$ is a contravariant 3 vector.
Determinant is found using
$Det A = \Pi \lambda$
or
$Det A = exp(Tr ln(A))$. In my case which one should I use any why?
I tried by expanding the explicit matrix form and found the determinant of matrix which gives $k^4(k^2-\theta^2)$ which does not match with given result.


text:
Q: Cannot change row value in datagridview   void refreshtable()
    {
        var query = (from x in de.HeaderTrainingAllocations
                     join y in de.MsTrainings on x.TrainingID equals y.TrainingID
                     join z in de.MsUsers on x.UserID equals z.UserID
                  select new
                     {
                         x.AllocationID,
                         x.TrainingID,
                         z.UserName,
                         x.TrainingStartDate,
                         TrainingEndDate = System.Data.Objects.EntityFunctions.AddDays(x.TrainingStartDate, ((y.TrainingDuration - 1) * 7)),
                         y.TrainingDuration,
                         x.Capacity
                     }
                     );//get all data from tables
        dataGridView1.DataSource = query;

          for (int i = 0; i < dataGridView1.RowCount; i++)
          {
              int currentcapacity;
              Int32.TryParse(dataGridView1.Rows[i].Cells[6].Value.ToString(),out currentcapacity);

              String idA = dataGridView1.Rows[i].Cells[0].Value.ToString(); //read allocation ID on cell 0
              var cek = (from x in de.DetailTrainingAllocations

                         where x.AllocationID==idA
                         select x).Count(); //to get amount of data in table detailTransaction

              dataGridView1.Rows[i].Cells[6].Value =currentcapacity- cek;//this code won't change the value of the rows in datagridview
          }
    }

This code is working perfectly but the last code didn't work for some reason,the values in row X at column 6 didn't change at all. I have almost no solution for this in my mind.

A: This is the most direct conversion, although you really should be doing a JOIN on DetailTrainingAllocations, rather than making a loop, doing one query for each record.
 void refreshtable()
    {
        var query = (from x in de.HeaderTrainingAllocations
                     join y in de.MsTrainings on x.TrainingID equals y.TrainingID
                     join z in de.MsUsers on x.UserID equals z.UserID
                  select new
                     {
                         x.AllocationID,
                         x.TrainingID,
                         z.UserName,
                         x.TrainingStartDate,
                         TrainingEndDate = System.Data.Objects.EntityFunctions.AddDays(x.TrainingStartDate, ((y.TrainingDuration - 1) * 7)),
                         y.TrainingDuration,
                         x.Capacity
                     }
                     ).ToList();//get all data from tables
          foreach (var z in query)
          {
              var cek = (from x in de.DetailTrainingAllocations
                         where x.AllocationID==z.AllocationID
                         select x).Count(); //to get amount of data in table detailTransaction

              z.Capacity-=cek;//this code won't change the value of the rows in datagridview
          }

        dataGridView1.DataSource = query;
    }


text:
Q: My login is all working apart from not redirecting to another page Ok so my login script recognises a user that does not exist - its recognises when the password is incorrect - it moves forward when the correct information is submitted but not to the correct page despite me telling it too...
login form:
<form name="login" action="login.php" method="post">
    Username: <input type="text" name="username" />
    Password: <input type="password" name="password" />
    <input type="submit" value="Login" />
</form>

Login script:
<?
session_start(); //must call session_start before using any $_SESSION variables
$username = $_POST['username'];
$password = $_POST['password'];

$dbhost = 'localhost';
$dbname = '******';
$dbuser = '******';
$dbpass = '******'; //not really
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $conn);

$username = mysql_real_escape_string($username);
$query = "SELECT password, salt
        FROM users
        WHERE username = '$username';";
$result = mysql_query($query);
if(mysql_num_rows($result) < 1) //no such user exists
{
    header('Location: login_form.php');
    die();
}
$userData = mysql_fetch_array($result, MYSQL_ASSOC);
$hash = hash('sha256', $userData['salt'] . hash('sha256', $password) );
if($hash != $userData['password']) //incorrect password
{
    header('Location: login_form.php');
    die();
}
else
{
    validateUser(); //sets the session data for this user
}

header('Location: membersonly.php');

?>

A: So I rewrote your code a little bit. I did a few things:

*

*I converted your MySQL to MySQLi. MySQL is depreciated and will be removed. I used OOP style MySQLi, but you can do procedural style.

*I changed your query string. Sometimes SQL can get picky about formatting and sql really likes when you use the '`' character.

*Next I separated out your large hash statement. This was for readability.

*I also added an "isset" check for the salt and the password. This check just confirms that these values actually exist.

*I've added the "error" variable for "login_form.php" I would remove it at release, but it gives you as the programmer a good chance to see where your code seems to be going wrong.

*I've now also added "true" and "303" to your header area where you set the location. true is a boolean about whether or not it should override a previous set header value for Location. 303 tells the browser that it should "see other"

*Finally I added some extra headers designed to remove any chance of caching. While I do not know of any browsers that would cache your page that requests a redirect, it could happen seeing as it's all about how the browser handles it.

$username = $_POST['username'];
$password = $_POST['password'];

$dbhost = 'localhost';
$dbname = '******';
$dbuser = '******';
$dbpass = '******'; //not really

$sql_connection = new mysqli($dbhost, $dbuser, $dbpass, $dbname);

$username = mysql_real_escape_string($username);
$query = "SELECT password, salt FROM users WHERE username = '$username';";
$result = $sql_connection->query($query);
if($result->num_rows != 1) //no such user exists{
    header("Location: login_form.php");
    die();
}
$userData = $result->fetch_assoc();

if(!isset($userData['salt']) || !isset($userData['password'])){
    header("Location: login_form.php?error=MissingInformation");
    die();
}

$salt = $userData['salt'];
$password_hash = hash('sha256', $password);
$hash = hash('sha256', $salt . $password_hash);
$correct_password = $userData['password'];
if($hash != $correct_password){ // incorrect
    header('Location: login_form.php');
    die();
}else{
    validateUser(); //sets the session data for this user
}

header("Location: membersonly.php", true, 303);

Hope it helps!
Edit:
I would also recommend removing the redirect and looking at the result to make sure it's not returning a warning. If it's just a warning, your script will still execute and it will redirect, but you'll never see the error.


text:
Q: How to clone ImageSpan How to clone imagespan.
I want to use setspan() with one imagespan twice.
    ImageSpan is = new ImageSpan(this,R.mipmap.ic_launcher);
    String tx = "dfsfsfsfsfsdfsdfs";
    SpannableString ss = new SpannableString(tx);
    ss.setSpan(is,0,1, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
    ss.setSpan(CharacterStyle.wrap(is),6,7, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
    tv.setText(ss);

but the CharacterStyle.wrap is not working for imagespan.
Thank you for answering.


text:
Q: Export listbox selected items to datatable I have problems to export selected listboxitems to a datatable,I want to have multiple selected plants to a datatable,Can you please help?
   int numberofplants = 0;

        foreach (ListItem li in lbxPlants.Items)
        {
            if (li.Selected)
            {
                numberofplants++;
                DataTable dtplants = new DataTable();
                dtplants.Columns.Add("Plants");
                DataRow drplants = dtplants.NewRow();
                drplants[0] = li.Value;
                dtplants.Rows.Add(drplants);

            }
        }

A: int numberofplants = 0;

DataTable dtplants = new DataTable();
dtplants.Columns.Add("Plants");

foreach (ListItem li in lbxPlants.Items)
{
    if (li.Selected)
    {
        numberofplants++;

        DataRow drplants = dtplants.NewRow();
        drplants[0] = li.Value;
        dtplants.Rows.Add(drplants);
    }
}


text:
Q: Rails, how to use will_paginate with helper's variable and not with controller's variable I'am trying to use the will_paginate gem for the paginating my entries on my view.
But I wanted to use the variable of helper instead of controller.
Have looked various tutorials and links but not got the solution.
Please help
thanks in advance!
Lakhan


text:
Q: MySQLi database files I'm trying to do this example from W3Schools:, but I can't test it as I do not know how to place the files in the proper location.
What I have:

*

*3 Files in the folder (being "myDB" the name of the DB) C:\Program Files\MySQL\MySQL Server 5.6\data\myDB , which are: db.opt, myGuests.frm and myGuests.ibd and a SQL Dump named myDB.sql.

*The html file copied from the link I've given from W3Schools.

Which should be the folder/file structuring in order to make the html work by linking to the proper file(s)? I have installed Apache in the default port if this information is relevant (therefore I have the htdocs folder if needed).

A: You have to set The file in Apache root folder.
you can instal Wamp Server or MAMP server
Go to https://localhost/phpmyadmin
then to import your DB
after that set the file in the www/htdocs folder
http://localhost/filename.php to test the output


text:
Q: Change other options based on dropdown What I'd like to do is automatically change other dropdowns based on the answer of one specific select | option dropdown. In this case when the main dropdown changes to "Change" I'd like the other dropdowns to find the "Refused to Answer" options. (http://jsfiddle.net/sNZ5X/)
HTML

Main Select Dropdown
    <select id="master">
        <option>Do Nothing</option>
        <option>Change</option>
    </select>

Question 1
    <select class="rta">
        <option>Answer 1</option>
        <option>Answer 2</option>
        <option>Refused to Answer</option>
    </select>

Question 2
    <select class="rta">
        <option>Answer 1</option>
        <option>Answer 2</option>
        <option>Refused to Answer</option>
    </select>

JS
$( "#master" )
  .change(function () {
    var str = "Refusted to Answer";
    if $(master).selected = "Change"
    $( ".rta" ).change( str );
  })
  .change();

A: done,  heres the FIDDLE
Basically you needed to test for the value properly, and set the selected value properly. Also your string for "Refused to Answer" was spelled wrong, never would have matched.
$('#master').on('change', function() {
    if (this.value == 'Change') {
        $('.rta').val('Refused to Answer');
    }

});

A: There are some problems with your script (always check your browser console):

*

*master is not defined. I suppose you meant $('#master') instead of $(master).

*.selected is not a valid method.

*= is used for assignment. Use == for comparison

*Invalid if statement - use brackets ;)

Here's the working example on JSFiddle:
$( "#master" )
  .change(function () {
      if ($('#master option:selected').val() == "Change")
          // Assuming that last child is always 'Refused to answer'
          $('.rta option:last-child').prop('selected', true);
  })
  .change();


text:
Q: How to getGenerated id from parent table and insert into child table  try {

    currentCon = ConnectionManager.getConnection();

        psParent=currentCon.prepareStatement("insert into accommodation (type,name,price,description,username)values(?,?,?,?,?)", PreparedStatement.RETURN_GENERATED_KEYS);
        psParent.setString(1,type);
        psParent.setString(2,name);
        psParent.setFloat(3,price);
        psParent.setString(4,username);
        psParent.executeUpdate();

        accid= 0;
            rs = psParent.getGeneratedKeys();
            if (rs.next())
                accid = rs.getInt(1);

            rs.close();
            psParent.close();

        psChild=currentCon.prepareStatement("insert into room (accid, bed)values(?,?)");
        psChild.setInt(1,accid);
        psParent.setString(2,bed);
        psChild.executeUpdate();    }

after I run this, I got this error message : failed: An Exception has occurred! java.sql.SQLRecoverableException: internal error
Is there's something wrong with the code? Thank you for your help

A: Your usage of getGenereatedKeys() actually looks correct to me for Oracle, but the problem is actually with your first insert statement.  You have placeholders (and column names) for 5 columns, but you only bind 4 values.  Try something like this:
String sql = "insert into accommodation (type, name, price, description, username) ";
sql += "VALUES (?, ?, ?, ?, ?)";
String generatedColumns[] = { "ID" };
psParent = currentCon.prepareStatement(sql, generatedColumns);
psParent.setString(1, type);
psParent.setString(2, name);
psParent.setFloat(3, price);
psParent.setString(4, description);   // I ADDED THIS LINE
psParent.setString(5, username);
psParent.executeUpdate();

I am assuming that you have a variable containing a description to be inserted.  If not, then remove description and its placeholder from the prepared statement entirely, or just insert null.


text:
Q: Error in tabular code generated from Excel2LaTeX I used Excel2LaTeX to create a table in LaTeX and here is the code that gives me an error.
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{rrrrr}
    \toprule
          &       & Start date & End date & Days spent \\
    \midrule
    \multicolumn{1}{c}{\multirow{6}[12]{*}{\textbf{Background research}}} & Research which existing technologies exist for recommendation systems & 06/10/2011 & 10/10/2011 & \multicolumn{1}{c}{\multirow{6}[12]{*}{22}} \\
    \multicolumn{1}{c}{} & Investigate the problems being face by the current recommender systems & 11/10/2011 & 15/10/2011 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Learn what Semantic Web is and how the it is being implemented to solve problems & 16/10/2011 & 20/10/2011 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Investigate how semantic web is being used for recommendation systems & 16/10/2011 & 20/10/2011 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Read research papers on to find out more on work about music recommendation that has already been done in the past & 21/10/2011 & 27/10/2011 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Deliverable: Write a literature survey to summarize research findings & 21/10/2011 & 28/10/2011 & \multicolumn{1}{c}{} \\
    \multicolumn{5}{r}{}                  & \\
    \multicolumn{1}{c}{\multirow{4}[8]{*}{\textbf{Analysis \& Design}}} & Create a structured list of requirements from the problem statement & 29/10/2011 & 04/11/2011 & \multicolumn{1}{c}{\multirow{2}[4]{*}{6}} \\
    \multicolumn{1}{c}{} & Deliverable produced: Create a structured list of requirements from the problem statement & 29/10/2011 & 04/11/2011 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Begin prototyping and experimenting with Semantic Web & 05/11/2011 & 09/12/2011 & \multicolumn{1}{c}{\multirow{2}[4]{*}{34}} \\
    \multicolumn{1}{c}{} & Deliverable produced: A basic prototype of the recommender system & 05/11/2011 & 09/12/2011 & \multicolumn{1}{c}{} \\
    \multicolumn{5}{r}{}                  & \\
    \multicolumn{1}{c}{\multirow{21}[42]{*}{\textbf{Implementation}}} & \textbf{Iteration 1  - Implementing and testing core functionality of the website} &       &       &  \\
    \multicolumn{1}{c}{} & Let users register with the website & 10/12/2011 & 16/12/2011 & \multicolumn{1}{c}{\multirow{7}[14]{*}{34}} \\
    \multicolumn{1}{c}{} & Simulate users listening to songs/albums & 10/12/2011 & 16/12/2011 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Enable searching for music and playlists in the website & 17/12/2011 & 23/12/2011 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Let users create playlists and add/remove songs to them & 24/12/2011 & 30/12/2011 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Users can integrate with Facebook and find friends that are also registered on the website & 31/12/2011 & 06/01/2012 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Users can comment on a playlist and Like a playlist & 07/01/2012 & 13/01/2012 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Deliverable produced: The first iteration of the website without a recommendation system & 10/12/2011 & 13/01/2012 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & \multicolumn{4}{r}{}          & \\
    \multicolumn{1}{c}{} & \textbf{Iteration 2 - Implemented and testing core functionality of the algorithm} &       &       &  \\
    \multicolumn{1}{c}{} & Integrate Semantic Web so that recommendation algorithm can be implemented & 14/01/2012 & 20/01/2012 & \multicolumn{1}{c}{\multirow{5}[10]{*}{27}} \\
    \multicolumn{1}{c}{} & The website shall allow users to get music recommendations based on the friend's taste & 21/01/2012 & 03/02/2012 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & The website shall allow users to get music recommendations based on the user's taste & 21/01/2012 & 10/02/2012 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Deliverables produced: Algorithm for music recommendation & 14/01/2012 & 10/02/2012 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Second iteration of the website with core functionality in place & 14/01/2012 & 10/02/2012 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & \multicolumn{4}{r}{}          & \\
    \multicolumn{1}{c}{} & \textbf{Iteration 3 - Adding additional features (Could have's and Wont have's in the requirements)} &       &       &  \\
    \multicolumn{1}{c}{} & Carry out the finishing touches of the website & 11/02/2012 & 24/02/2012 & \multicolumn{1}{c}{\multirow{4}[8]{*}{13}} \\
    \multicolumn{1}{c}{} & View a feed which lets them find out what their friends are doing on the site through likes and comments & 11/02/2012 & 17/02/2012 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Allow users to subscribe to a playlist & 18/02/2012 & 24/02/2012 & \multicolumn{1}{c}{} \\
    \multicolumn{1}{c}{} & Deliverable: Final version of the website with added features & 11/02/2012 & 24/02/2012 & \multicolumn{1}{c}{} \\
    \multicolumn{5}{r}{}                  & \\
    \multicolumn{1}{c}{\multirow{2}[3]{*}{\textbf{Documentation}}} & Begin the final report & 25/02/2012 & 30/03/2012 & \multicolumn{1}{c}{\multirow{2}[3]{*}{34}} \\
    \multicolumn{1}{c}{} & Deliverable: Final report with explaining all stages of the software development cycle & 25/02/2012 & 30/03/2012 & \multicolumn{1}{c}{} \\
    \bottomrule
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%

The error I'm getting is this
! Extra alignment tab has been changed to \cr.
<template> \endtemplate
l.692 \multicolumn{5}{r}{} &
\\
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.

Anybody know what's going on?

A: This is a known bug in excel2latex, which will be fixed in version 3.2 (currently under development). Visit https://code.launchpad.net/excel2latex for version updates.

A: You have 5 columns
{rrrrr}

but you have
\multicolumn{5}{r}{}                  & \\

so that's a 5 column span then & then an empty cell so six columns,
Easiest would be to add an extra r at the top so you have 6 columns declared.


text:
Q: How to return variable as an output from SQL server 2016 R services? I have the following code
EXECUTE sp_execute_external_script
    @language = N'R',
    @script = N'

        table1 <- unserialize(Table1_Data)
        table2 <- unserialize(Table2_Data)
        df_1 <-merge(x=table1,y=table2,
              by=c("batchId","BatchTaskID"),all=TRUE)
        df_2 <- df_1 %>% filter(batchId == 5 & BatchTaskStatus == 'N') %>%
             arrange(desc(BatchTaskRunID))
        if(nrow(df_2) > 1){
        result = TRUE
        return(result)
            }
        else {
            result = FALSE
            return(result)
            }

        OutputDataSet <- result
    ',
    @params = N'@Table1_Data VARBINARY(MAX), @Table2_Data VARBINARY(MAX)',
    @Table1_Data = @Table1_Data,
    @Table2_Data = @Table2_Data
    WITH RESULT SETS (( INT ));

How to return just the flag value instead of entire data frame from OutputDataset?


text:
Q: Laravel - How can I load collection data into a table? I'm storing my data with a variable called $group_months, the following is when I dd($group_months). The numbers before the arrow representative the month, and the numbers after are the time. So 10 = October
Collection {#187 ▼
  #items: array:4 [▼
    "Comp Time Used" => Collection {#292 ▼
      #items: array:3 [▼
        10 => "12:00:00"
        11 => "09:00:00"
        "01" => "12:00:00"
      ]
    }
    "Vacation Time Used" => Collection {#322 ▼
      #items: array:1 [▼
        11 => "04:00:00"
      ]
    }
    "Sick Time" => Collection {#325 ▼
      #items: array:1 [▼
        10 => "03:15:00"
      ]
    }
    "OT Accrued" => Collection {#316 ▼
      #items: array:1 [▼
        10 => "12:00:00"
      ]
    }
  ]
}

I want to use this data and fill up my table that looks like this:

                Month
                Overtime Hours
                Compensation Hours
                Vacation
                Personal Hours
                Sick Hours

                Jan

                Feb

                Mar

                Apr

                May

                Jun

                Jul

                Aug

                Sep

                Oct

                Nov

                Dec

I'm not sure how to do this, maybe use some sort of loop? Thanks for the help.
Edit:
Storing collection as an array now:
array:4 [▼
  "Comp Time Used" => array:3 [▼
    10 => "12:00:00"
    11 => "09:00:00"
    "01" => "12:00:00"
  ]
  "Vacation Time Used" => array:1 [▼
    11 => "04:00:00"
  ]
  "Sick Time" => array:1 [▼
    10 => "03:15:00"
  ]
  "OT Accrued" => array:1 [▼
    10 => "12:00:00"
  ]
]

A: This should get you started. I would combine all the times in the controller before sending it to the view. That would make it easy. Here, if the array key exists for that month, it'll print the value for that month. If it does not exist, it won't throw an error because array_key_exists will just return false and do nothing else.

                Month
                Overtime Hours
                Compensation Hours
                Vacation
                Personal Hours
                Sick Hours

                Jan

                @if(array_key_exists(1, $group_months['Comp Time Used']))
                {{$group_months['Comp Time Used'][1]
                @else
                No time off used
                @endif

                Feb

                @if(array_key_exists(2, $group_months['Comp Time Used']))
                {{$group_months['Comp Time Used'][2]
                @else
                No time off used
                @endif


text:
Q: Hibernate entity query to Set<> My goal is to write the shortest query to get current Test by User id
My UserEntity.class part:
 @ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "result", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "test_id"))
private Set<Test> tests;

Here is the example how can i get all tests for him (my UserDAO.class):

public List<Test> getAvailableTestsById(long id){
    Query query = em.createQuery("SELECT u.tests FROM User u WHERE u.id = :id");
    query.setParameter("id", id);
    return (List<Test>)query.getResultList();
}

Now i would like to get one (for example by id) test for user. How can i do that in best way? I can write long sql query with many joins but i feel that this is not an appropriate solution. Can i use my Set in UserEntity.class to find test which i need (by id)?

A: Just get the user or load it if you are sure that the user exists, and then get the Tests of that user:
User user =  session.load(User.class, userId);

or
User user =  (User) session.get(User.class, userId);


text:
Q: Using phalcon, I have two databases, How can I select a database before $builder with modelsManager? Before this $builder, I want to set a database, what shall I do? thanks in advance!
$builder = $this->modelsManager->createBuilder()
->columns($cols)
->distinct(true)
->from($ZUC)
->leftJoin($ZU, "$ZU.user_id = $ZUC.user_id")
->leftJoin($ZSC, "$ZUC.subclass_id = $ZSC.subclass_id")
->leftJoin($ZC, "$ZC.class_id = $ZSC.class_id")
->leftJoin($ZCH, "$ZCH.order_no = $ZUC.order_no")
->where($conStr, $conArr)
->orderBy($order)

A: Change db service in di or use setReadConnectionService method in model(though not sure about this last one).

A: You can use the setSchema() method to define that, Here the reference;
Link

A: Share with you。Like this
  $zx_user_class = new ZxUserClass(); //your primary table
  $zx_user_class->setConnectionService('dbWrite'); // select databse
  $modelsManager = $zx_user_class->getModelsManager();
  $builder = $modelsManager->createBuilder()
   ->columns($cols)
   ->distinct(true)
   ->from($ZUC)
   ->leftJoin($ZU, "$ZU.user_id = $ZUC.user_id")
   ->leftJoin($ZSC, "$ZUC.subclass_id = $ZSC.subclass_id")
   ->leftJoin($ZC, "$ZC.class_id = $ZSC.class_id")
   ->leftJoin($ZCH, "$ZCH.order_no = $ZUC.order_no")
   ->where($conStr, $conArr)
   ->orderBy($order)


text:
Q: MVC3 Offline For Update Implementation I will appreciate any help on steps for an  implementation to switch an  MVC3/Razor Web Application to offline mode for maintenance. At the offline mode only a static page could be seen by the public but an administrator who is logged in should be able to view, browse and update the site fully. Ideally I want the web administrator just to tick on a value at the administrative back-end which will be registered in the database.

A: You could simply check some condition within BeginRequest in Global.asax.
protected void Application_BeginRequest()
{
    if (myDb.SiteIsOffline && !CurrentUserIsAdministrator())
        Response.Redirect("~/offline.html");
}


text:
Q: Add parentheses around numbers I have a file filled with numbers:
1 6 8 9 10 11

I want to enclose each number in parentheses so basically have the final output as:
(1) (6) (8) (9) (10) (11)

and so on.

A: Try sed:
sed -i.bak 's/[0-9]\+/(&)/g' file.txt

In this sed substitution, we are substituting [0-9]\+ i.e. successive digits with (&) i.e. parentheses around the matched digits. g means this replacement will take place for all matched patterns, otherwise it will only replace the first match.
After operation the modified file will be file.txt and the original file will be kept as file.txt.bak. Its a good practice to take backup of the original file, if you don't want to take backup just use:
sed -i 's/[0-9]\+/(&)/g' file.txt

A: Using Awk to only capture digits (will not print empty lines):
awk '{for(i=1; i<=NF; i++) if($i ~ /[[:digit:]]/) $i="("$i")"} NF{print}' file

A: xargs printf '(%d) ' <infile

Would work to get output like your example in the question from any series of of numbers under 20 or so digits a piece separated by one or more whites spaces per.


text:
Q: Pronunciation of "zounds?" I came across the sentence "Fortunately their are a variety of different offerings out there with zounds of features." Disregarding the misuse of "zounds," how would Elizabeth I have pronounced the word? To rhyme with "God's wounds?" Or otherwise?

A: If it's anything like the exclamation, it would rhyme with sounds.
EDIT: It apparently has been affected by the Great Vowel Shift.  Maybe someone else can provide a link to exactly how the 16th-17th century version of ou would have been pronounced.

A: It makes most sense to me that zounds should rhyme with wounds. When you take two words and combine them and then contract them, they retain their pronunciation.
couldn't isn't pronounced cowdn't
doesn't isn't pronounced dow-znt
bosun isn't pronounced bossun
Nevertheless, it seems both pronunciations are ok: http://en.wiktionary.org/wiki/zounds, and /zaʊndz/ appears to be more prevalent: http://dictionary.reference.com/browse/zounds
English is weird, eh?
EDIT: See Snumpy's answer. It started off as rhyming with wounds and changed during the Great Vowel Shift to rhyme with sounds

A: The fact is that back when the contaction of "God's wounds" came into being and common use, the Great Vowel Shift had yet to happen in English.  "Wounds" back then rhymed with "bounds" and "sounds" as pronounced today.  Therefore, "zounds" also rhymed with "sounds" and "bounds" and still should today.  The change in pronunciation for a "wound" in human or animal flesh occurred for that rather commonplace word, but the pronunciation of "zounds" did not change.  There are a number of people who say it should be pronounced "zoonds" because "wounds" used to be pronounced "woonds," but I think they're being pedantic.  On the rare occasion that I might say "zounds" for humorous effect -- since it is a rather outmoded expletive that now sounds quaint -- I'm going to continue to say it so it rhymes with "sounds" and "bounds."

A: I don't really see how "zounds" can rhyme with "wounds" unless you are pronouncing it

zoo-nds

Which just seems silly.
So, I would pronounce it so it rhymes with sounds.

A: Zounds should be a rhyme for Sounds, unless the context is suggesting to another way.

A: I'd think it should rhyme with "wounds" since it's a contraction of "God's wounds" referring to Jesus's wounds on the cross.
Back in the time when it was used, people would swear on God's body parts rather than his name, thus avoiding breaking the Third Commandment, "Do not take the Lord's name in vain." Essentially, it's an archaic "Holy crap!"
So it would make much more sense for it to rhyme with "wounds," since that's the word it's derived from. However, pronunciation of certain words was wonky back then, and besides, gpr already established that both pronunciations can be correct, so the argument is irrelevent.
Why, then, did I comment? Because I like to impress people with my ability to properly follow links and use Google. And because people kept saying it should rhyme with "sounds" and I wanted to argue with them, because that's what I do.

A: People mention the great vowel shift - yay! Some may have noticed there's another vowel shift happening at the moment on the streets of London.
Anyway, zounds is indeed an abbreviation of "God's wounds" and rhymes with it. What gets overlooked is that 'wounds' rhymed with 'sounds' before the great vowel shift, much the way 'wind' rhymed with 'kind'.


text:
Q: How to cache entities which do not exist I am using hibernate 5.3.7 with ehcache 3.7 and I would like to cache entities which do not exist.
Example:
I try to find an entity by id 10, if it does not exist it should return null/Optional.empty() until the cache is evicted.
The reason for this is that we store user messages in the database with region specific languages falling back to the parent language.
Example:
If I request the message button.accept for the language es_PA and it does not exist I should return the message for the language es.
So there is a high probability to get requests for entities which don't exist but should be cached.
My current configuration is this:
spring:
  jpa:
    properties:
      hibernate:
        cache:
          provider: org.ehcache.jsr107.EhcacheCachingProvider
          region:
            factory_class: jcache

And the entity class is annotated with:
@Cacheable @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)

PS: I am also using Spring boot 2.1.3

A: In that case you maybe shouldn't cache the entities but the result of the repository method.
That way you can also cache Optional


text:
Q: /usr/include missing on macOS Catalina (with Xcode 11) Follow up to the same problem on Mojave.
After upgrading to macOS Catalina, none of the C headers can be found in /usr/include. The reason for this may be found in the Xcode 10 release notes (previous version):

The Command Line Tools package installs the macOS system headers inside the macOS SDK. Software that compiles with the installed tools will search for headers within the macOS SDK provided by either Xcode at:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
or the Command Line Tools at:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
[...]
  As a workaround, an extra package is provided which will install the headers to the base system. In a future release, this package will no longer be provided. [...]

(See the link to the question above for details on this suggested workaround.)
Apparently Apple made good on their threat with Xcode 11. How can one install the C headers to /usr/include on macOS Catalina using Xcode 11?
Context: The clang python binding search the header files in /usr/include per default. According to kkurian's answer and the comment I made (in response to this question), there are multiple ways to control this behaviour, if necessary.
Related question: Can't compile C program on a Mac after upgrade to Mojave.

A: Set the CPATH environment variable in your shell (e.g., put this in your .zshrc assuming you're using zsh):
export CPATH=`xcrun --show-sdk-path`/usr/include

And then try to build your project again.
UPDATE
The OP related to how to install the headers in /usr/include, not how to point clang to the headers wherever they may be.
MacOS System Integrity Protection prevents the creation of /usr/include, even by root. See this related answer.
If you disabled SIP (not recommended) then I imagine something like
sudo ln -s `xcrun --show-sdk-path`/usr/include /usr/include

will do the trick.


text:
Q: Reduction in uncertainty " I(X;Y|Z) is interpreted as `` the reduction in uncertainty of X due to the knowledge of
Y when Z is given."
Would it make sense when talking in a geographical sense to say :
When information flow in the EU (Z) occurs the flow of interaction between the countries (I) increases due to labour flow (X) and capital flow (Y) being more dependent than before?
So I(X;Y|Z)>I(X;Y)
And also if it does make sense, which it probably doesn't then could I just add another variable to it so that V= flow of goods?
I(X;Y;V|Z)>I(X;Y;V)
Would I be saying that the interaction within the EU is larger when information flow occurs because when it does flow of goods, capital and labour are more dependent than without?

A: I cannot say if the concept of conditional mutual information $I(X;Y|Z)$ has any relation to your geographical/political situation. (I'd say it has little or no relation).
Anyway, notice that the inequality you are trying to apply
$$I(X;Y|Z)>I(X;Y)$$
contradicts the interpretation given:  if it's a "reduction in uncertainty of X due to the knowledge of Y when Z is given." then the inequality should be reversed.
Furthermore,  the inequality (in any sense) is just wrong, as the above interpretation. The conditional information can increase or decrease when conditioned to another variable - this elementary fact is mentioned in the Wikipedia.


text:
Q: How to use IDisposable to fix memory leaks I have an .net app that seems to have a memory leak issue(s). The .net service starts out around 100MB of memory, but under load it hits around 400-500MB. Most of my classes don't have unmanaged resources, and the ones that do already implement IDisposable. So my question is would slapping IDisposable on my classes help?
The 4-500 MB isn't itself concerning. The concern is there are 8 different services. Each is built using SharpArch, NServiceBus, Windsor, and NHibernate. My feeling is that there is something in one of these that is causing a problem. My concern is that the total memory of all the services is around 3.2 to 3.6 gigs of memory out of 4 gigs. It is not throwing OutOfMemory exceptions yet, but I'd like to head this off at the pass. Also I've used dotTrace, which give me some information, I'm just not sure how to act on that information

A: The answer is, almost certainly not. Have you verified that you're actually holding onto memory you shouldn't be, by profiling your service?
Bear in mind that the Garbage Collector may not necessarily release memory until it needs to, so it's not unusual for it may not be unusual for it to hit 400-500mb allocated. The point at which I'd become concerned would be when, after a [insert reasonable period of time here] of usage it's crept up further and has hit 1Gb, even though it's not been under any higher level of load.

A: Short answer: No.
Longer answer: Noooooo.
I think you knew this already - if you didn't, you wouldn't have "slapped" IDisposable on the classes that did need it - IDisposable has nothing to do with the GC. The only thing that really matters here is if you have put Finalizers (~classname) on your objects needlesslessly - this will causes them to be backed up in the single-threaded finalizer queue before they get GC'd, regardless of them containing unmanaged resources or not.

A: Measure, measure, measure
If you want to cut down memory usage for your app you need to first determine where it is being used.
You can get a rough idea by adding a few perfmon counters on "private bytes, bytes in all heaps, bytes in the large object heap, gen 1, gen 2" and so on.
If you determine you are using too much managed memory. You can break down the usage even further using a tool like .Net memory profiler or the very flexible but windbg + sos
Once you isolate where your memory is going you can look at strategies to reduce usage, it could be something as simple as replacing a Dictionary with a Cache or adding a string builder.
The solution very unlikely to be sprinkle IDisposable on everything.

A: My first concern would be to ensure that you are measuring something relevant. "Memory" can mean a lot of different things. There is an enormous difference between running out of virtual memory space and running out of RAM. There is an enormous difference between a performance problem caused by thrashing the page file and a performance problem caused by creating too much GC pressure.
If you don't understand what the relationships are between RAM, virtual memory, working set and the page file then start by doing some reading until you understand all that stuff. The way you phrased the question leads me to suspect that you believe that virtual memory and RAM are the same thing. They certainly are not.
I suspect that the arithmetic you are doing is:

*

*I have eight processes that each consume 500 million bytes of virtual address space

*I have four billion bytes of RAM

*Therefore I am about to get an OutOfMemory exception

That syllogism is completely invalid. That's the syllogism:

*

*I have eight quarts of ice cream

*I have room for nine quarts of ice cream in the freezer

*Therefore if I get two more quarts of ice cream, something is going to melt

when in fact you have an entire warehouse-sized cold storage facility next door. Remember, RAM is just a convenient fast way to store stuff near where you need it, like your fridge. If you have more stuff that needs to be stored, who cares if you run out of room locally?  You can always pop next door and put the stuff you use less frequently in long term deep freeze -- the page file. That's less convenient, but nothing melts.
You get an "out of memory" exception when a process runs out of virtual address space, not when all the RAM in the system is consumed. When all the RAM in the system is consumed, you don't get an error, you get crap performance because the operating system is spending all of its time running stuff back and forth from disk.
So, anyway, start by understanding what you are measuring and how memory in Windows works. What you should actually be looking for is:

*

*Is any process in danger of using more than two billion bytes of virtual memory on a 32 bit system? A process only gets 2GB of virtual memory (not RAM, remember, virtual memory has nothing to do with RAM: that's why its called "virtual" -- it isn't hardware) on win32 that is addressible by user code; you'll get an OOM if you try to use more.

*Is any process in danger of attempting to allocate a huge block of virtual memory such that there is no contiguous block of that size free?  Are you likely to be allocating ten million bytes of data in a single array, for example? Again, OOM.

*Is the working set -- that is, the virtual memory pages of a process that are *required to be in RAM for performance reasons -- of all processes smaller than the amount of RAM available? If not, then soon you'll get thrashing, but not an OOM.

*Is your page file big enough to handle the virtual memory pages that could be paged out to disk if RAM starts to get short?
So far none of this has anything to do with .NET. Once you've actually determined that there is a real problem - there might not be - then start investigating based on what the real problem is. Use a memory profiler to examine what the memory allocator and garbage collector are doing. See if there are huge blocks in the large object heap, or unexpectedly big graphs of live objects that cannot be collected, or what. But use good engineering principles: understand the system, use tools to investigate the actual empirical performance, experiment with changes and carefully measure their results. Don't just start randomly slapping magic IDisposable interfaces on a few classes and hope that doing so makes the problem -- if there is one -- go away.

A: If all of the classes which have unmanaged resources implement IDisposable and are properly disposed of (via using or try/finally) then adding further IDisposable implementations won't help anything.
The first problem is that you don't know why you're leaking.  Managed applications typically leak for one of the following reasons

*

*Not properly disposing of unmanaged resources

*Holding onto large object graphs of managed objects

Given the information in your question it's almost certainly #2 that is causing the problem.  You'll need to get a profiler or windbg to tell you what the actual leak is and which rooted objects are causing it.
Here is a great article by Rico to get you started

*

*http://blogs.msdn.com/b/ricom/archive/2004/12/10/279612.aspx


text:
Q: Solr: Using a wildcard on a string with whitespace  I have basically the same problem as discussed here: Solr wildcard query with whitespace, but this question was not answered.
I'm using a wildcard in a filter query on a field called "brand."
I'm having trouble when the brand name has whitespace in it.  For instance, filtering the brand "Lexington" works fine when I say fq={!tag=brand}brand:Lexing*n.  A multi-word brand like "Athentic Models" causes problems, however.  It seems double quotes must be included around the name.
When there are "s, *s don't do anything, ie brand:"Athentic Mode*" or brand:"Lexingt*", won't match anything.  Without double quotes, it does work to say brand:Authen*, with no quotes and no space, and that will match Authentic Models. But once whitespace is included in the brand name, it seems to only consider the string up to the first space when matching.
The brand field is of type
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>

which is not whitespace tokenized, to my understanding.  It is populated with a copyField from a whitespace tokenized field, though.
Is there something I can do to stop Solr from tokenizing the filter query without using double quotes?

A: Just like Rob said in his answer, I've posted an answer on my own on the question he linked to.
All you need to do is escape the space in your query (as in, customer_name:Pop *Tart --> customer_name:Pop\ *Tart).
From my experience, this method works no matter where you place the wildcard, which is backed up by how Solr claims that something like:
customer_name:Pop\ *Tart

Is parsed as:
customer_name:Pop *Tart

A: Try to change the type from string to something like text. String type is not tokenized so when there is a whitespace in a string field, it will try to match your query, including the whitespace in the field.
in the default schema file you can see this line just above the string field type
<!-- The StrField type is not analyzed, but indexed/stored verbatim. -->

using a text type should fix your problem, like text_general or a similar one.

A: I have added a possible solution back on the original question Solr wildcard query with whitespace
Note this ONLY works with trailing wildcards. I know this question example uses the wildcard within the string, but it serves to answer a specific case of the question in point.
Basically it amounts to using the FieldQParserPlugin query parser. Check my post on the original question for more details so I don't get scorn for repeating myself.


text:
Q: JAX-RS - how to get multiple representations/projections of resource? Scenario:

*

*It's a REST API using plain JavaEE 7

*There's a Person entity

*GET /persons returns a list of all persons

*GET /persons/{id} returns a single person

Now I'd like those API endpoints to return different representations of the entity:

*

*/persons should return only id, firstName, lastName

*/persons/{id} should return all fields

What I already thought about:

*

*The DTO approach: Create a PersonSummary class with only id, firstName and lastName fields. Then using Dozer (or some other mapper) to copy the fields from Person -> PersonSummary. And then returning the PersonSummary object list.

*Using javax.json.Json: Manually assemble the object to return. But that way I only get JSON, no more XML :(

*XML schema files: (Don't know if this actually could work) Write a .xsd file for every representationand let Jaxb process the resulting representation.
What I've seen so far:

*

*In Spring you can simply create an interface with all getters, that should be included. (like here ( https://spring.io/blog/2014/05/21/what-s-new-in-spring-data-dijkstra ) at the bottom).

*With Jackson, you can use @JsonView for that ( http://wiki.fasterxml.com/JacksonJsonViews ).

*Using MOXy there is @XmlNamedObjectGraphs( https://stackoverflow.com/a/19526044/1321564 ).

Is there a (simple) way to do this with JavaEE? Or is there some nice external library for that?

EDIT: Runtime annotation manipulation
What do you think about this idea (This is basically just like @JsonView from Jackson):
@XmlRootElement
public class MyClass {
  @MyViewAnnotation @MyOtherViewAnnotation
  String s1;

  String s2;

  @MyViewAnnotation
  String s3;
}

What to do with that? (pseudo code)
// resource object comes from some JAX-RS interceptor along
// with the preferred view annotation (in this case @MyViewAnnotation)

Annotation viewAnnotation = @MyViewAnnotation;

for(Field f : resource) {
  if(f.hasAnnotation(viewAnnotation)) {
    f.addAnnotation(@XmlElement);
  } else {
    f.addAnnotation(@XmlTransient);
  }
}

// return manipulated resource object back to JAX-RS

Expected results:

*

*When passing @MyViewAnnotation, it will generate @XmlElement String s1 and @XmlElement String s2. s3 will be @XmlTransient.

*When passing @MyOtherViewAnnotation, it will generate @XmlElement on s1. s2 and s3 will be @XmlTransient.
I don't know if it's possible to intercept JAX-RS processing in the right place to create a modified class and then pass that class to the normal JAX-RS processing. But that way, it could be easily done and JAX-RS could generate JSON and XML the same way.
Any ideas?

A: The only thing I can think of in JAX-RS to support this behavior is to use a custom MessageBodyWriter with a special content type, e.g. application/json+list vs application/json+details.  Then in your MessageBodyWriter serialize only those specific fields.
The Jackson views approach seems to be the one best suited for your need though, assuming you use the Jackson JAX-RS provider.  You could also use @JsonSerialize(include=NON_NULL) and simply set the other fields to null in your list view, giving you the same result.  However this is still a Jackson specific solution.
I noticed for your other two solutions, you used database centric approaches.  I'm assuming that this object is not actually in your database.


text:
Q: Failed to execute 'texImage2D' on 'WebGLRenderingContext': No function was found that matched the signature provided I'm using ionic 3 framework to build an Android and Electron Application.
Now I've to add Three.js (the version in use is the r110) in the app and I have no experience in WebGL nor three.js.
When I run the application with Electron all seems fine, but when I run the app in an android emulator with Android API 28 this error happens "Failed to execute 'texImage2D' on 'WebGLRenderingContext': No function was found that matched the signature provided."
I think the problem is that the version of chrome used by Android is "Chrome/69.0.3497.100", while in Electron is "Chrome/76.0.3809.146".
This is the part of code that use the texImage2D function
 private loadCollada() {
    const loader = new ColladaLoader();
    loader.load('assets/edo/model/model.dae', (collada) => {
      this.dae = collada.scene;
      this.dae.scale.x = this.dae.scale.y = this.dae.scale.z = 1;
      this.dae.updateMatrix();
      this.scene.add(this.dae);
    });
  }

I found in three.js library that the error is logged in three.module.js
    function texImage2D() {

        try {

            gl.texImage2D.apply( gl, arguments );

        } catch ( error ) {

            console.error( 'THREE.WebGLState:', error );

        }

    }

I don't know if it might be useful but I have also this message in my console printed so many times.
[.WebGL-0xcba04400]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering. [file:///android_asset/www/index.html]

There is a workaround or a way to fix this problem?


text:
Q: Removal of parenthesis around years from the citations in text I have an Elsevier article to submit and I've been given a Latex file. It has the following code
\documentclass[preprint,12pt]{elsarticle}

\usepackage{lineno}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\graphicspath{{./Figures/}}
\usepackage{floatrow}
\usepackage{dsfont}
\usepackage{float}
\usepackage[margin=1in]{geometry}

\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{subcaption}
\usepackage[format=hang]{caption}
\usepackage[dvipsnames]{xcolor}

\begin{document}

The manuscript is here.

\bibliography{referenceFile}
\bibliographystyle{apa}\biboptions{authoryear}

\end{document}

The references in the manuscript appear as (AuthorName (Year)) as in the picture below but I want to change it to (AuthorName, Year).

Why does this happen and how can I change it? I added all packages I'm using, in case any package clashes somehow with references.
I can't see any reference packages like biblatex or natbib. What am I missing? Or do I change the structure of any other file than the .tex?


text:
Q: Como passar um objeto dentro de um props? Estou tentando mostrar o os atributos do objeto música dentro de um componente mas ele só renderiza a lista mas não os atributos do objeto que eu passei. O que estou fazendo errado?
Objeto Musica:
function Music (banda, url, musica) {
   this.banda = banda;
   this.url = url;
   this.musica = musica;
}

Componente pra mostrar a música:
class Musica extends React.Component {
    render() {

        return (

            {this.props.banda}
             {this.props.musica}

        )
    }
}

Componente para montar a lista com as músicas:
    const music1 = new Music("Foster the people", "https://www.youtube.com/watch?v=_GMQLjzVGfw", "Houdini")
    const music2 = new Music("The Strokes", "https://www.youtube.com/watch?v=pT68FS3YbQ4", "You Only Live Once")

class Musicas extends React.Component {
    render () {
        return (

                <Musica props={music1}/>
                <Musica props={music2}/>

        );
    }

}

A: No componente Musicas, você deve definir uma outra chave que não props ou fazer o spread de todas as propriedades do objeto Music.
Deixo abaixo duas possíveis alternativas. Escolha aquela que parecer mais simples. :)
Alternativa 1: Passando uma prop music:
Uma alternativa é fazer assim:
class Musicas extends React.Component {
  render() {
    return (

          <Musica music={music1} />
          <Musica music={music2} />

    );
  }
}

E no componente Musica:
class Musica extends React.Component {
  render() {
    const { banda, url, musica } = this.props.music;

    return (

        {banda}

          {musica}

    );
  }
}

Alternativa 2: Fazendo o spread das propriedades do objeto Music
Você pode utilizar o spread operator (...) para passar todas as propriedades do objeto Music para o componente Musica:
class Musicas extends React.Component {
  render() {
    return (

          <Musica {...music1} />
          <Musica {...music2} />

    );
  }
}

E no componente Musica, basta fazer da forma como você já usava anteriormente:
class Musica extends React.Component {
  render() {
    return (

        {this.props.banda}

          {this.props.musica}

    );
  }
}

Leitura recomendada:

*

*Componentes e Props (Documentação Oficial do React);

*Operador spread (...).

A: O erro está no "objeto" Música, na verdade você não criou um objeto, mas sim uma função que não está retornando nada.
O correto seria:
function music (banda, url, musica) {
   return {
        banda: banda,
        url: url,
        musica: musica
   }
}
Para criar uma das constantes seria:
const music1 = music("Foster the people", "https://www.youtube.com/watch?v=_GMQLjzVGfw", "Houdini");
E para passar:
<Musica {...music1} />


text:
Q: How to display the selected country name from slicer when there is no data for the selected month and the selected country in power BI with the DAX I have a table with the Country and Date columns.

I have a slicer with Country and Date, now as I select the slicers for UK and May-21, it shows blank as the data is not there for May-21.

Now I always want to display the selected country whether there is data or not. I tried creating a measure using DAX, REMOVEFILTERS, and many other things but it's not working.
Any help would be appreciated.  Thanks.

A: use this code :
SELECTED COUNTRY =
var __coutries = CALCULATETABLE(values('your table name'[Country]), ALLEXCEPT('your table name','your table name'[Country]))
RETURN
    IF(COUNTROWS(__coutries) == 1, __coutries, "")

this article reveals how to manage the familly of allxxx functions.


text:
Q: Constraint not deleting in Storyboard I am unable to delete constraint in StoryBoard when not using Size classes and only using Autolayout in iOS 8.0

A: Please follow as below:-

*

*Select any one ViewController from your story board.

*Go to File Inspector.

*And uncheck Use size Classes.
One dialog box appear, and select as per your requirement.
Or Else
You can delete from ViewController also.