text:
Q: Copy selected row data when click on row in listview and value send to new activity for display as textview Hiiii  I want when i should click the row data , it seems to copy the value of row and pass to another activity for display as textview. I am taking data by single row values from table using mysql. A "Hope of Help" will be appreciated from your side PLEASE !!
//MainActivity.java
import java.io.BufferedReader;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HTTP;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.widget.TextView;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.net.ParseException;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;
/*
 * @author Firzan Ghulam
 */
public class MainActivity extends Activity{
    JSONArray jArray;
    String result = null;
    InputStream is = null;
    StringBuilder sb = null;
    ArrayList<String> al = new ArrayList<String>();
    String targetmonth;

    int responseCode;
    int listItemCount=0;
    ListView listview ;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);
        listview = (ListView) findViewById(R.id.listView1);

        new LoadData().execute();

         // listening to single list item on click
        listview.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view,
              int position, long id) {

              // selected item
              String product = ((TextView) view).getText().toString();

              // Launching new Activity on selecting single List Item
              Intent i = new Intent(getApplicationContext(), SingleListItem.class);
              // sending data to new activity
              i.putExtra("product", product);
              startActivity(i);

          }
        });

    }

    private class LoadData extends AsyncTask<Void, Void, Void>   {
        private ProgressDialog progressDialog;
        @Override
        // can use UI thread here
        protected void onPreExecute() {
        this.progressDialog = ProgressDialog.show(MainActivity.this, ""," Can you just see your roof...");
        }
        @Override
        protected void onPostExecute(final Void unused) {
            try{

                     listview.setAdapter(new DataAdapter(MainActivity.this,al.toArray(new String[al.size()])));

                     this.progressDialog.dismiss();

                }
                catch(Exception e){
                    Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
                }
        }
        @Override
        protected Void doInBackground(Void... params) {
        // TODO Auto-generated method stub
            // HTTP post
                    try {
                        ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
                        HttpClient httpclient = new DefaultHttpClient();
                        try{
                        HttpPost httppost = new HttpPost("http://palaknehazz.com/app/ap.php");

                        StringEntity se = new StringEntity("envelope",HTTP.UTF_8);
                        httppost.setEntity(se);
                        HttpParams httpParameters = new BasicHttpParams();
                        // Set the timeout in milliseconds until a connection is established.
                        int timeoutConnection = 3000;
                        HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
                        // Set the default socket timeout (SO_TIMEOUT)
                        // in milliseconds which is the timeout for waiting for data.
                        int timeoutSocket = 3000;
                        HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);

                        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                        HttpResponse response = httpclient.execute(httppost);
                        HttpEntity entity = response.getEntity();
                        is = entity.getContent();
                        }
                        catch(Exception e){
                            Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
                        }
                        //buffered reader
                        try{
                        BufferedReader reader = new BufferedReader(new InputStreamReader(
                                is, "iso-8859-1"), 80);
                        sb = new StringBuilder();
                        sb.append(reader.readLine() + "\n");
                        String line = "0";
                        while ((line = reader.readLine()) != null) {
                            sb.append(line + "\n");
                        }
                        is.close();
                        result = sb.toString();

                        System.out.println("Magu data aagaya"+result);
                        }
                        catch(Exception e){
                            Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
                        }
                        try{
                        jArray = new JSONArray(result);
                        JSONObject json_data = null;
                        for (int i = 0; i < jArray.length(); i++) {
                            json_data = jArray.getJSONObject(i);
                            //targetamount=json_data.getString("targetamount");
                            targetmonth=json_data.getString("targetmonth");
                            //targetyear = json_data.getString("targetyear");
                            al.add(targetmonth);
                            //al1.add(targetyear);
                            //al2.add(targetamount);

                            //listItemCount=al2.size();
                        }
                    }
                    catch(JSONException e){
                        Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
                    }
                    } catch (ParseException e) {
                    //  Log.e("log_tag", "Error in http connection" + e.toString());
                        Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
                    }
                     catch (Exception e) {
                            //  Log.e("log_tag", "Error in http connection" + e.toString());
                                Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
                            }

            return null;
        }

    }

}

//Data Adapter
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
public class DataAdapter extends BaseAdapter {
    Context mContext;
    private LayoutInflater mInflater;
    String targetmonth;
    String[] month;

    public DataAdapter(Context c, String[] month) {
        this.month = month;

        mContext = c;
        mInflater = LayoutInflater.from(c);
    }
    public int getCount() {
        return month.length;
    }
    public Object getItem(int position) {
        return position;
    }
    public long getItemId(int position) {
        return position;
    }
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.customgrid, parent, false);
            holder = new ViewHolder();
            holder.month = (TextView) convertView
                    .findViewById(R.id.targetmonth);

            if (position == 0) {
                convertView.setTag(holder);
            }
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        try {

            holder.month.setText(month[position]);

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return convertView;
    }
    static class ViewHolder {
        TextView month;

    }

}

//SingleListItem
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

public class SingleListItem extends Activity{
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.meter);

        TextView txtProduct = (TextView) findViewById(R.id.product_label);

        Intent i = getIntent();
        // getting attached intent data
        String product = i.getStringExtra("product");
        // displaying selected product name
        txtProduct.setText(product);

    }
}

//Logcat error
05-14 22:48:02.644: D/dalvikvm(461): GC_CONCURRENT freed 56K, 2% free 14428K/14663K, paused 8ms+6ms
05-14 22:48:03.051: D/gralloc_goldfish(461): Emulator without GPU emulation detected.
05-14 22:48:05.121: I/System.out(461): Magu data aagaya[{"id":"1","targetmonth":"Karan is a intelligegnt guy if you know what i mean haha frieds plays very important role i TV serial life i believe hahaha i mean who guess for being myself"},{"id":"2","targetmonth":"He's the unpredictable foolish man you are looking forward for seriously"},{"id":"3","targetmonth":"Same here you are looking"}]
05-14 22:48:08.294: D/AndroidRuntime(461): Shutting down VM
05-14 22:48:08.294: W/dalvikvm(461): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
05-14 22:48:08.341: E/AndroidRuntime(461): FATAL EXCEPTION: main
05-14 22:48:08.341: E/AndroidRuntime(461): java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.TextView
05-14 22:48:08.341: E/AndroidRuntime(461):  at com.demo.php.listview.MainActivity$LoadData$1.onItemClick(MainActivity.java:94)
05-14 22:48:08.341: E/AndroidRuntime(461):  at android.widget.AdapterView.performItemClick(AdapterView.java:292)
05-14 22:48:08.341: E/AndroidRuntime(461):  at android.widget.AbsListView.performItemClick(AbsListView.java:1058)
05-14 22:48:08.341: E/AndroidRuntime(461):  at android.widget.AbsListView$PerformClick.run(AbsListView.java:2514)
05-14 22:48:08.341: E/AndroidRuntime(461):  at android.widget.AbsListView$1.run(AbsListView.java:3168)
05-14 22:48:08.341: E/AndroidRuntime(461):  at android.os.Handler.handleCallback(Handler.java:605)
05-14 22:48:08.341: E/AndroidRuntime(461):  at android.os.Handler.dispatchMessage(Handler.java:92)
05-14 22:48:08.341: E/AndroidRuntime(461):  at android.os.Looper.loop(Looper.java:137)
05-14 22:48:08.341: E/AndroidRuntime(461):  at android.app.ActivityThread.main(ActivityThread.java:4340)
05-14 22:48:08.341: E/AndroidRuntime(461):  at java.lang.reflect.Method.invokeNative(Native Method)
05-14 22:48:08.341: E/AndroidRuntime(461):  at java.lang.reflect.Method.invoke(Method.java:511)
05-14 22:48:08.341: E/AndroidRuntime(461):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-14 22:48:08.341: E/AndroidRuntime(461):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-14 22:48:08.341: E/AndroidRuntime(461):  at dalvik.system.NativeStart.main(Native Method)

A: in your main Activity change
// selected item
              String product = ((TextView) view).getText().toString();

by
// selected item
              String product = ((TextView) view.findViewById(R.id.targetmonth)).getText().toString();


text:
Q: Maven Build error while using pom version 3.0.1 on my Spring boot Java project on IntelliJ I am using maven pom version 3.0.1 and while building getting errors as below. I installed the certificate also in VDI of my java folder. Can you please help on this?
Cannot resolve plugin org.apache.maven.plugins:maven-compiler-plugin:3.10.1

Cannot resolve plugin org.apache.maven.plugins:maven-surefire-plugin:2.22.2

Cannot resolve plugin org.apache.maven.plugins:maven-deploy-plugin:2.8.2

Cannot resolve plugin org.apache.maven.plugins:maven-clean-plugin:3.2.0

Cannot resolve plugin org.apache.maven.plugins:maven-resources-plugin:3.3.0

Cannot resolve plugin org.apache.maven.plugins:maven-jar-plugin:3.3.0

Cannot resolve plugin org.apache.maven.plugins:maven-install-plugin:3.0.1

Cannot resolve plugin org.apache.maven.plugins:maven-site-plugin:3.3

Cannot resolve plugin org.apache.maven.plugins:maven-compiler-plugin:3.8.0

Cannot resolve plugin org.springframework.boot:spring-boot-maven-plugin:2.1.4.RELEASE

Cannot resolve plugin org.apache.maven.plugins:maven-surefire-plugin:2.22.2

Cannot resolve plugin org.apache.maven.plugins:maven-deploy-plugin:2.8.2

Cannot resolve plugin org.apache.maven.plugins:maven-clean-plugin:3.1.0

Cannot resolve plugin org.apache.maven.plugins:maven-resources-plugin:3.1.0

Cannot resolve plugin org.apache.maven.plugins:maven-jar-plugin:3.1.1

Cannot resolve plugin org.apache.maven.plugins:maven-install-plugin:2.5.2

Cannot resolve plugin org.apache.maven.plugins:maven-site-plugin:3.7.1

I java spring boot project with the pom version 3.0.1 and i installed the certificate also in VDI of my java folder. Still same issue on my IntelliJ IDE.
Could you please help on this?

redpajama_set_name: RedPajamaStackExchange


text:
Q: What exactly is the difference between @parallel and pmap? As the title states: what exactly is the difference between @parallel and pmap? I don't mean the obvious one's a macro for a loop and the other works on functions, I mean how exactly does their implementation differ and how should I use this knowledge to choose between them?
The reason I ask is that a lot of the applications I write could use either construct: I could write a loop and calculate something with @parallel, or wrap what would have been in the loop into a function and call pmap on that. I have been following the advice of using @parallel for things which are quick to evaluate and pmap for calls where each task takes much longer (as it states in the documentation), but I feel that if I have a better understanding of what it's doing I'd be able to make better choices.
For example: does @parallel divide up the work before evaluating? I noticed that if I run a parallel loop where each inner call takes a random amount of time, @parallel can take a long time because at the end I have very few processes still working. pmap on the same microtests doesn't seem to have this: is pmap re-distributing the work as needed?
Other questions like this all stem from my ignorance of what exactly how pmap differs from @parallel.

A: @parallel will take the jobs to be done and divy them up amongst available workers right away.  Note in the ?@parallel we get The specified range is partitioned ... across all workers. pmap by contrast, will start each worker on a job.  Once a worker finishes with a job, it will give it the next available job.  It is similar to queue based multiprocessing as is common in python, for instance.  Thus, it's not so much a case of "redistributing" work but rather of only giving it out at the right time and to the right worker in the first place.
I cooked up the following example which I believe illustrates this.  In this somewhat silly example, we have two workers, one of which is slow and the other of which is twice as fast.  Ideally, we would want to give the fast worker twice as much work as the slow worker.  (or, more realistically, we would have fast and slow jobs, but the principal is the exact same).  pmap will accomplish this, but @parallel won't.
For each test, I initialize the following:
addprocs(2)

@everywhere begin
    function parallel_func(idx)
        workernum = myid() - 1
        sleep(workernum)
        println("job $idx")
    end
end

Now, for the @parallel test, I run the following:
@parallel for idx = 1:12
    parallel_func(idx)
end

And get back print output:
julia>  From worker 2:  job 1
    From worker 3:  job 7
    From worker 2:  job 2
    From worker 2:  job 3
    From worker 3:  job 8
    From worker 2:  job 4
    From worker 2:  job 5
    From worker 3:  job 9
    From worker 2:  job 6
    From worker 3:  job 10
    From worker 3:  job 11
    From worker 3:  job 12

It's almost sweet.  The workers have "shared" the work evenly.  Note that each worker has completed 6 jobs, even though worker 2 is twice as fast as worker 3.  It may be touching, but it is inefficient.
For for the pmap test, I run the following:
pmap(parallel_func, 1:12)

and get the output:
From worker 2:  job 1
From worker 3:  job 2
From worker 2:  job 3
From worker 2:  job 5
From worker 3:  job 4
From worker 2:  job 6
From worker 2:  job 8
From worker 3:  job 7
From worker 2:  job 9
From worker 2:  job 11
From worker 3:  job 10
From worker 2:  job 12

Now, note that worker 2 has performed 8 jobs and worker 3 has performed 4.  This is exactly in proportion to their speed, and what we want for optimal efficiency.  pmap is a hard task master - from each according to their ability.
Thus, the recommendations in the Julia docs make sense.  If you have small simple jobs then it is more likely that these issues with@parallel won't cause problems.  For bigger or more complex jobs though, pmap has advantages.


text:
Q: Balance weight of a php script between apache and os I wanted to balance a massive process on a web app by letting it to run on the OS instead of Apache. I could do it by shell executing the process but, i think better to get others opinion as well in this situation. Here is the scenario;

*

*User log-in to the app

*Click process

*Continue processing on the server while letting the user to carry out his/her normal activities.
Note: User should not be Interrupted by the process, should be a parallel process.

A: Consider starting separate process on server that will be running continuously, will receive work units from PHP scripts, execute them and return results back.  PHP script and this process may use database to exchange work units, so when PHP have some work, it insert work description into the database.  When separate process is ready to work, it queries database for pending work units, marks them in database as being processed.  Later, then processing is done, it marks work unit in database as finished and attaches processing result to it.


text:
Q: Database Project to Drop Database before deploy? Is it possible to get VS to drop the destination database before a deploy?
I've tried adding a post deploy script to the project, but it always comes back with active connections.

A: You'll need to look up the Always recreate database option in the properties of the database project -> Deploy -> Deployment configuration file -> Edit Dialog.
Another option "Drop objects that exist in the target database but not in the schema" can also be useful to you.

A: You should check the Always re-create database option under publish.
DB Project -> Right Click -> Publish -> Advanced


text:
Q: Change Text in header layout of the Expandable List when Child is clicked what I actually need is when I click a radio button in the child view I want the text in that radio button to be set to the selected_child TextView in the header layout. I have tried many ways. But i cannot identify the parent view uniquely inside the getChildView method, Can any one help me with this ?
I have expandable list header layout like below.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="start"
    android:layoutDirection="ltr"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:id="@+id/lblListHeader"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="5dp"
            android:paddingLeft="16dp"
            android:paddingTop="@dimen/activity_horizontal_margin"
            android:text="This is a text"
            android:textColor="@color/black_background"
            android:textSize="@dimen/letter_small" />

        <TextView
            android:id="@+id/selected_child"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingBottom="@dimen/activity_horizontal_margin"
            android:paddingLeft="16dp"
            android:text="Test text"
            android:textSize="@dimen/letter_small" />

    </LinearLayout>

</LinearLayout>

In my child view I generate radio buttons dynamically like below
@Override
public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {

    LayoutInflater inflater = LayoutInflater.from(context);
    convertView = inflater.inflate(R.layout.expandable_child_radio_layout, parent, false);

    final RadioGroup radioGroup = (RadioGroup) convertView.findViewById(R.id.radio_group1);
    radioGroup.removeAllViews();
    radioGroup.setFocusable(false);
    final RadioButton[] rb = new RadioButton[listDataChild.get(this.listOptionsHeader.get(groupPosition)).size()];
    radioGroup.setOrientation(RadioGroup.VERTICAL);
    for (int i = 0; i < listDataChild.get(this.listOptionsHeader.get(groupPosition)).size(); i++) {
        rb[i] = new RadioButton(context);
        final String childText = (String) getChild(groupPosition, i);
        rb[i].setText(childText);
        rb[i].setId(i + 100);
        rb[i].setTag("radio-child " + childText);
        fontUtils.changeFontOfRadioButtontoOpenSansRegular(rb[i]);
        rb[i].setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getResources().getDimension(R.dimen.letter_small));
        radioGroup.addView(rb[i]);
        final int finalI = i;
        rb[i].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                System.out.println("implementation goes here");
            }
        });
    }
    return convertView;
}


text:
Q: Extracting a string after pattern PostgreSQL So I have a column like the following:
diagnosis

715.16 oSTEOARTHRITIS, LOWER-LEG
715.17 - OSTEOARTHRITIS, ANKLE AND FOOT
715.90 oSTEOARTHRITIS, UNSPECIFIED
716.10 - TRAUMATIC ARTHROPATHY - UNSPECIFIED

Some entries have initial dashes, some do not. Some have dashes later in the string.
I'd like to select the substring (in itallics) with the pattern:
(any chars)(dash)(space)(any alphanumeric)(the rest of the string)
OR
(any chars)(space)(any alphanumeric)(the rest of the string)
My query goes:
select substring(diagnosis from '% #"\w%#"' for '#') from TableICDdict;
but it just returns all the rows with empty strings in them (no errors). Any ideas on how to actually output the extracted substrings?
Thanks

A: Use regexp_replace() to skip all characters preceding first space (and the space) and ltrim() to skip additional '- ' strings:
with t(diagnosis) as (values
    ('715.16 oSTEOARTHRITIS, LOWER-LEG'),
    ('715.17 - OSTEOARTHRITIS, ANKLE AND FOOT'),
    ('715.90 oSTEOARTHRITIS, UNSPECIFIED'),
    ('716.10 - TRAUMATIC ARTHROPATHY - UNSPECIFIED'))
select ltrim(regexp_replace(diagnosis, '.*? (.*)', '\1'), '- ') result
from t;

               result
-------------------------------------
 oSTEOARTHRITIS, LOWER-LEG
 OSTEOARTHRITIS, ANKLE AND FOOT
 oSTEOARTHRITIS, UNSPECIFIED
 TRAUMATIC ARTHROPATHY - UNSPECIFIED
(4 rows)


text:
Q: MySQL não conectando conecta por erro em socket Boa tarde amigos, após ter instalado corretamente o MySQL 5.7 no meu Ubuntu 16.04, ao tentar conectar ao banco, recebo uma mensagem de erro falando que não foi possível conectar através do socket.
Executo: mysql -u root -p
E logo em seguida, recebo o erro:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

No diretório /var/run/mysqld/mysqld.sock não existe o arquivo com extensão .sock
Já desinstalei e instalei, tentei com a versão 5.6 e nada tem funcionado. Alguma sugestão?
Obrigado!

A: Conforme essa resposta do SOen, um problema comum que causa o ERROR 2002 é instalar o mysql-client ao invés do mysql-server.
No ubuntu você pode instalar o pacote mysql-server com:
sudo apt-get install mysql-server

Outra possibilidade é que o serviço do mysql não tenha sido inicializado. Em versões recentes do Ubuntu você pode fazer isso com:
sudo start mysql

Finalmente é possível que seu mysql não esteja escutando na combinação de endereço / porta padrão (127.0.0.1:3306). Nesse caso você tem duas opções:

*

*Editar suas configurações no arquivo my.cnf

*Especificar o endereço e porta esperados na hora de conectar:
mysql -h [ip/host] -P [porta] -u root -p [database]

A: Ola! tive um problema parecido com este

"ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)"

então eu comentei a linha sock=/var/run/mysqld/mysqld.sock em /etc/asterisk/cdr_mysql.conf e resolveu.


text:
Q: how to use code igniter email in a contact page (core php) called as a wordpress page? how to use code igniter email in a contact page (core php) called as a wordpress page. i can make it wordpress free & stand alone php file if its required.the problem with core php mail is it sends all the mails right into the junk/spam folder.
if(!$error)

 {
    //trim($_POST[your_name])." sent you a message from ".get_option("blogname")." website "." on subject "

    $headers = "From: ".trim($_POST[your_name])." <".trim($_POST[your_email]).">\r\nReply-To:".trim($_POST[your_email])."\r\n" ;

    $headers .=  'MIME-Version: 1.0' . "\r\n";

    $headers .=  'mailed-by: hisham@rainhopes.com' . "\r\n";

    $headers .= "X-Priority: 2\nX-MSmail-Priority: high";

  //$headers .= 'From: abc@yahoo.com' . "\r\n";

     $email = mail(get_option("admin_email"),trim($_POST[your_subject]),stripslashes(trim($_POST[your_message])),$headers);
}

  }

A: mail() function does not provide any assistance for making use of popular features such as HTML-based emails and attachments into the mailbox.
I suggest the PHPMailer librairy, the most robust and pupular php mail library.
EDIT this code should do the job
if(!$error){
    require 'path/to/PHPMailerAutoload.php';
    $mail = new PHPMailer;

    $mail->setFrom(trim($_POST[your_name]));
    $mail->addReplyTo(trim($_POST[your_email]));
    $mail->addAddress(get_option("admin_email"));
    $mail->addCC(get_option("admin2_email_something"));

    $mail->isHTML(true);   // Set email format to  HTML

    $mail->Subject = trim($_POST[your_subject]);
    $mail->Body    = stripslashes(trim($_POST[your_message]));

    if(!$mail->send()) {
         echo 'Message could not be sent.';
         echo 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
        echo 'Message has been sent';
    }
}

A: fixed all the trouble.. just put this one after the header parameter..
$email = mail(get_option("admin_email"),trim($_POST[your_subject]),stripslashes(trim($_POST[your_message])),$headers, "-fsender@domain.com");


text:
Q: Getting rid of files from domain name using PHP I have the following URLs:
http://website.com/folder1/file.php
http://website.com/folder2/file.html

I want to know if there is any way in PHP that will let me hide the files and their extensions so the URLs will look like this:
http://website.com/folder1/
http://website.com/folder2/

I know this is possible using htaccess and mod_rewrite but I want to do it using PHP only.

A: ok I found the answer :
<? echo dirname("http://website.com/folder1/file.php"); ?>

so the url will look like this :
http://website.com/folder1/

A: dirname removes the last part of the URL.
To remove a specific string at the end of the URL if it exists, use rtrim:
$url = rtrim($url, 'file.php');
// http://website.com/folder/
$url = rtrim($url, '/');
// http://website.com/folder

A: Or a way via file extension detection:
function removeFilenameFromURL($url)
{
    $urlPath = pathinfo($url);

    // Remove if the URL has an file extension
    if (isset($urlPath['extension'])) {
        $lastPos = strripos($url, "/");
        $url = substr($url, 0, $lastPos + 1);
    }

    return $url;
}

echo dirname("https://localhost/subdir/index.php") . "
";
echo removeFilenameFromURL("https://localhost/subdir/index.php") . "
";
echo phpversion();

OUTPUT:
https://localhost/subdir
https://localhost/subdir/
7.4.23

This always ensures a trailing slash.
ATTENTION:
With dirname() function on PHP 7.4 the trailing slash is gone ... (changing behavior on different PHP versions??)


text:
Q: Play json parse missing field as empty array Using play-json 2.3
How do i parse this
{i: 0}

into this
case class A(i: Int, s: Seq[Int])

i would very much like to reuse Json.format macro
at the moment it gives me "missing path s"
UPD:
i ended up writing a custom format and pimping it onto JsPath:
implicit class JsPathExtensions(path: JsPath) {
  //return mzero if the path is missing
  def lazyFormatNullableM[T: Monoid](f: => Format[T]): OFormat[T] = OFormat(path.lazyReadNullable(f).map(_.orZero), new OWrites[T] {
    override def writes(o: T) = path.lazyWriteNullable(f).writes(o.some)
  })
}

A: If the path is missing, I don't see any way to utilize the macro without changing the class. In which case, you can define Reads using json combinators and use the macro for Writes.
import play.api.libs.json._
import play.api.libs.functional.syntax._

implicit val reads: Reads[A] = (
    (__ \ "i").read[Int] and
    (__ \ "s").read[Seq[Int]].orElse(Reads.pure(Nil))
)(A.apply _)

implicit val writes: Writes[A] = Json.writes[A]

The json macros only cover a very limited range of use cases, and it's inevitable that you'll run into a case where you must write your own Reads or Writes.

A: The easiest way to utilise the Json.format[A] macro would be to slightly alter your definition of A:
case class A(i: Int, s: Option[Seq[Int]])

The usage of an Option here is pretty clear and you can map over it and do lots of good things, but if you really want to treat s like it's an empty collection, you could enhance your case class a little more:
case class Foo(i: Int, s: Option[Seq[Int]]) {
  lazy val theSeq:Seq[Int] = s.getOrElse(Seq[Int]())
}

Now if you access theSeq, there is absolutely no difference between incoming JSON that omitted s and JSON that supplied an empty array for s.


text:
Q: Узнать город и дату рождения Получаю данные вместо города [object Object] и вместо даты рождения undefined все остальное нормально выводиться.
В чем особенность,подскажите.
    $(function output(){

 function gotData( data){
    var i, post, html="";
    if( !data  ||  !data.response  ||  !data.response.items) {
        console.error( "VK returned some crap:", data);
        return;
    }
    for( i=0; i<data.response.items.length; i++) {
       info = data.response.items[i];
        html += '
'+info.city+info.sex+info.sex+info.first_name+info.bdate+'
';

    }
    $('#v').html(html);
};

$.ajax({
    url: "https://api.vk.com/method/groups.getMembers",
    data: {
        group_id: "habr",
        fields:"city,sex,sex",
        v: "5.27",
        offset:0,
        count:5
    },
    dataType: "jsonp",
    success: gotData,
});
});

A: Как вам уже подсказали, пользуйтесь console.log для отладки.
info.city - объект, название города хранится в поле title.
И внизу у вас ошибка в указании запрашиваемых полей.
function gotData...
    html += '
' + info.city.title + info.sex + info.first_name + info.bdate + '
';
...
ajax...
    fields:"city, sex, bdate",
...

A: Не у всех указан bdate, поэтому может выводить undefined

info.city.title + " " + info.first_name + " " + info.bdate + " " + info.sex

data: {
  group_id: "habr",
  fields:"city,sex,bdate",
  v: "5.27",
  offset:0,
  count:5
}


text:
Q: creating newline in javascript using "\n" character I am writing a very basic code in javascript and I'm looking forward to use "\n" for newline but it seems to not be working.
I have seen alternate solutions in other posts, but I wonder why is "\n" not working here.
Here's my code.

welcome to java script

A: The newline character (\n) breaks line within a string not in the document.
To break the line in the document you have to use the HTML
 element.

welcome to java script

A: "\n" works in text files.You are writing to the DOM in HTML; the DOM recognizes

Use that instead.


text:
Q: python and error I"ndentationError" I have a sequence as follows:
>gnl|GNOMON|230560472.m Model predicted by Gnomon on Homo sapiens unplaced genomic scaffold, alternate assembly HuRef DEGEN_1103279082069, whole genome shotgun sequence (NW_001841731.1)
GCCGGCGTTTGACCGCGCTTGGGTGGCCTGGGACCCTGTGGGAGGCTTCCCCGGCGCCGAGAGCCCTGGC
TGACGGCTGATGGGGAGGAGCCGGCGGGCGGAGAAGGCCACGGGCTCCCCAGTACCCTCACCTGCGCGGG
ATCGCTGCGGGAAACCAGGGGGAGCTTCGGCAGGGCCTGCAGAGAGGACAAGCGAAGTTAAGAGCCTAGT
GTACTTGCCGCTGGGAGCTGGGCTAGGCCCCCAACCTTTGCCCTGAAGATGCTGGCAGAGCAGGATGTTG
TAACGGGAAATGTCAGAAATACTGCAAGCAAACTGAAAACAACCCATCCATGTAGGAAAGAATAACACGG
ACTACACACTATGAGGAAACCACAGGGGAGTTTCAGGCCAGTCAGCTTTTGATCTTCAACTTTATAACTT
TCACCTTAGGATATGACGAGCCCACCGGAGTTTCAAAAATGGTATCATTTTGTATCAGGCTTGTTTTTTA
CACTCTTGGTTTCTCACAGAGATAGGTGGTTTCTCCTTAAAATCGAACATTTATATGATGCATTTTACTG
TAGTTACTATCAGAAAAGTTAGTTTTCCCAAATTTAAGTTCACTCTGGGGTACTATAGCGTGAATGTAGT
TCATTCTGTTGAGCTAGTTGTTCATGTTAGTGTAGTTCACATATTTATCTGGAACTCAAAAATGAGGGGT
TGAGAGGGGAAGCTAAAATTCAAAACATGTCCAAATATATAATTTTAATATTTTACTTTATATTTAAAAT
AGAAAAGCAATTGATTCTAGAATTAGACTAATTGCTAGCATTGCTAGGATATATAAAATGAAGCTGAATG
TTTTAACTCTGGAATTTTTCTGAATAGTCTAAGAAATAAGGCTGAAGTGTATCACTTGCCTTAAGTTTAC
TTTTGCGTGTGTGTTTTAATTTTGTTCAGTGGGGCTTTCACTTAAAAAAAAAACCATAATATTATTACCT
GGATAAAAAATACAGCTGAAAGTAGATCACTTTATCTTTAAGCAGAAGGATGGAAATAGAAGAATTTTAA
GAATGTATTGGTTGAAAAACATCTATATTATTTTATTTTTATTTCTCTTCTTGTGGGAGTAAAATAATTT
CCAACCAAATCAGTCCACCTAGATTATACACTGTTCAGTTTGTTTTCTGCCCTGCAGCACAAGCAATAAC
CAGCAGAGACTGGAACCACAGCTGAGGCTCTGTAAATGAGTTGACTGCTAAGGACTTCATGGGGATATTA
ACCTGGGGCATTAAGAGAATCAACATGCTAAAGTACTTGGAGACAGCTCTGTAATGTTTTATGAGGTTTT
TTGTTTTTTTTTTTTGAGACAGAGTCTTGCACTGTCGCCCAGGCTGG

I try to translate it to protein. I used other posts to do so, but I get several error when i run it.
The code is as follows:
import re
from itertools import takewhile
from collections import Counter

    # prints how many start and stop codons are in the sequence

   pat = re.compile(r"(TAA|TGA|TAG|ATG)") #additional space required!
   c = re.findall(pat,sequence) #additional space required!
   print(Counter(c)) #additional space required!

    3)]
    print(len(codons))
    print(trimmed_sequence)
    print(codons)

    # Take all codons until first stop codon
    coding_sequence  =  takewhile(lambda x: x not in stop_codons and len(x) == 3 , codons)

    return "{0}_".format(protein_sequence)

I first cd to desktop in terminal (Mac) then I run
python the name of the code.py or python -t the name of the code
both situation I get error for example
File "translate_dna2.py", line 34
    start = sequence.find('ATG')
    ^
IndentationError: unexpected indent
the same for stop_codones etc

A: On line with 'codontable' (line 6) you have a missing space. Should be:
def (...) :
----codontable

The proper indent for Python is one tabulation = 4 spaces. Also here:
----pat = re.compile(r"(TAA|TGA|TAG|ATG)")
----c = re.findall(pat,sequence)
----print(Counter(c))

Every dash means one space.

A: One of Python's main strengths is the availability of a huge number of high quality libraries for just about anything.  A good package for bioinformatics is Biopython.  You have a FASTA record.  Save it to a file called "seq.fa", then do the following (after installing Biopython ofc):
import Bio.SeqIO

with open("seq.fa") as f:
    record = Bio.SeqIO.parse(f, "fasta").next()
prot_seq = record.seq.translate()
print prot_seq.tostring()


text:
Q: Homepage constantly refreshes after adding Facebook Login button I just added the Facebook login button to my site and it refreshes the page every second.
This happens on FF but not Chrome or IE.
Here is the home page: http://comehike.com/
Any idea why this might be happening?
Here is a test page that has the problem: http://www.comehike.com/index_alex.php

A: You're calling FB.login() called before calling FB.init()


text:
Q: Crash when attempting to install 32bit delphi service on 2008 r2 I have an old 32bit delphi application (with no source code), that is used as a windows service. It runs fine on windows 2003 32bit.
I do not know if it has been created as a service originally, or converted to one later on. It is supposed to get installed to the server using a /install flag on the command line.
When attempting to install it on a Windows 2008 R2 virtual machine, I am getting an APPCRASH event in the event log.
The service is supposed to read a blob from a remote SQL Server instance and write it out to the local HD. It also reads some initialization data from the registry.
Is there any way I can install this application as a service on windows 2008 r2 64bit?
If not, are there any workarounds I can try?
What are your suggestions?

A: We've written quite a few of those Delphi 32-bits services ourselves, and the only thing that actually helps us "debug" the services running on servers (64-bit included) without the source code is Sysinternal's (now Microsoft Technet) Process Monitor.
In your specific case, I'd download Process Monitor (it's a simple executable) and run it and then set it up to filter only your service's .exe application. Look around for it's docs, but this is actually a very simple filter.
Keep Process Monitor running (filtered) on both machines while you start the service. Compare results from Process Monitor. I bet you have something like a missing registry key, or a missing directory or permission which causes the Delphi app to raise and Exception. This should be easy to spot on Process Monitor. Even more if you have a working machine to compare to.

A: I had the same problem, but Ricardo Pardini's hint with Process Monitor was the solution, I found out that the service (even at the time of just installing it) was looking for a dbExpress DLL which was not in the application directory nor in the search path. Copying the DLLs into the same folder resolved the problem.

A: Without access to the application or any trace why it might crash I can only offer some general ideas for what might help.
If it's just a POS (Plain Old Service ;) ) you can follow the instructions here http://support.microsoft.com/kb/251192 to manually install it as a service. That way you will get around a failing install routine if the application itself works.
You can also try to run it using the compatibility mode. Old Delphi applications can benefit a lot from this.

A: also ms has several app compatibilty updates to r2, so if you haven't hit windows update and download.
also can you run the app directly without the /install parameter?

A: It's probably trying to read something from the 64 bit version of windows rather than the 32 bit version of windows.  Make sure that you have the 32 bit sql server client installed and functioning properly.  Other than that post the appcrash which should tell you which DLL to put in wow32.

A: We have decided to keep running on a 32bit OS in the meantime and rewrite this app in .NET...

A: You didn't mention anything about UAC.  Disable UAC altogether and try it again.


text:
Q: qt - QNetworkConfigurationManager::configurationAdded signal not working I have two environments (DEV and PROD). Both are linux running Connman as network manager. In my DEV environment the signal configurationAdded is working properly when I plug/unplug ethernet cable. On the other hand, in PROD env, with computer with the same hw specifications, this signal is not emitted. My question in this topic is: which it is based Qt, in particular QtNetwork, to emit this signal? What their depenedencies? I am assuming that I have any missing dependencies in PROD env by wich this is not working properly.
I have read this QNetworkConfigurationManager::configurationChanged signal not getting called for ETHERNET config changes but in this question the user is asking for windows, not for linux. In any case it was not resolved.
EDIT: Checking QNetworkConfigurationManager::capabilities, the result in DEV environment is QFlags(0x1|0x10|0x20|0x40) while in PROD env is QFlags() (empty). So this can be a problem with QtNetwork backend in PROD env.

A: The issue is that app binary not getting right plugins path. In this case, the plugin needed is bearer. You can check this debugging with QLibraryInfo::location(QLibraryInfo::PluginsPath). If your path is not right, you can solve it using qt.conf file or setting paths. Both methods are specified in this Qt documentation article


text:
Q: Test Coverage For Page parameters is not covering     public with sharing class LeadEventCreation {

    public PageReference doSave() {
        insert objL;
        objL.recordTypeId = apexpages.currentPage().getparameters().get('id');// these lines are not covering showing in red colour
        update objL;                                                          // these lines are not covering showing in red colour

        objE.whoId = objL.id;                                                 // these lines are not covering showing in red colour
        insert objE;                                                          // these lines are not covering showing in red colour
        return (new pagereference('/'+objL.id).setredirect(true));            // these lines are not covering showing in red colour
    }

    public Lead objL{get;set;}
    public Event objE{get;set;}
    public LeadEventCreation(){
        objL = new Lead();
        objE = new Event();
    }
}
    @isTest
    private static void mytestclass()
    {
        test.startTest();
            LeadEventCreation objLEC= new LeadEventCreation ();
                try{
                objLEC.doSave();
                }
                catch(exception e){}

                lead obj1= new lead();
                obj1.LastName= 'test name';
                try{
                insert obj1;
                }
                catch(exception e){}

                lead obj2= new lead();
                obj2.LastName= 'test name1';
                try{
                update obj2;
                }
                catch(exception e){}
                ApexPages.currentPage().getParameters().put('id','nytest');
        test.stopTest();
    }
}

A: It looks likely that the line:
        insert objL;

Is causing an exception and since you have:
        try{
        objLEC.doSave();
        }
        catch(exception e){}

You are swallowing the exception and not seeing what the issue is and the test is not going any further for doSave().
You would need to prevent the exception to allow doSave() to finish, i.e. ensure that the Lead is inserted correctly/without failure.


text:
Q: HtmlInputCheckBox Not Check when Selected I'm trying to check a :checked state of checkbox but it's not registering as checked when debugging my code. From what I've read on other stackoverflow articles, the following code should work. Unless there's something I'm missing?
C#:
protected void MarkAsRead(object sender, EventArgs e)
        {
            foreach (RepeaterItem aItem in rptInbox.Items)
            {
                HtmlInputCheckBox chkDisplayTitle = (HtmlInputCheckBox)aItem
                                                         .FindControl("chkDisplayTitle");
                if (chkDisplayTitle.Checked)
                {
                    var messageid = chkDisplayTitle.Value;
                }
            }
       }

HTML:
<input id="chkDisplayTitle" type="checkbox" class="i-checks" runat="server"
       value='<%# Eval("MessageId")%>' />

Repeater:
 <asp:Repeater ID="rptInbox" runat="server">
                        <ItemTemplate>
                            <tr class="<%# Eval("MessageRead")%>">

                                    <input id="chkDisplayTitle" type="checkbox" runat="server" value='<%# Eval("MessageId")%>' />

                                <a href="mail_detail.aspx?id=<%# Eval("MessageId")%>"><%# Eval("FromUser")%>
                                <a href="mail_detail.aspx?id=<%# Eval("MessageId")%>"><%# Eval("Subject")%>
                                <%# Eval("Attachment")%>
                                <%# Eval("MessageDateTime")%>

                        </ItemTemplate>
                    </asp:Repeater>


text:
Q: Ubuntu 20.04 freezes whilst using Teams through Google Chrome browser I've only just installed Ubuntu 20.04 (around 5 days ago, so pretty clean install) and when I used MS Teams through the browser it was working ok to start with, then about 20 or 30 minutes into the meeting my whole OS GUI froze and I couldn't use anything.
As I was about to present in the meeting I did a hard reboot to try and get back in to the meeting, which I did, however it then later crashed again. This time I left it and eventually, after about 15 minutes, a "Sorry, Ubuntu 20.04 has experienced an internal error" dialog showed up and the GUI was unfrozen.
I've attached the "All" logs and the "Important" logs, as well as a screen grab from the crash dialog.
The 2nd crash (which these logs relate to) happened at 13:54.
Any help isolating the problem will be greatly appreciated! Thanks.
Edit:
Crash report:

All logs:
14:05:32 dbus-daemon: [session uid=1000 pid=1425] Successfully activated service 'org.gnome.gedit'
14:05:27 systemd: systemd-hostnamed.service: Succeeded.
14:05:24 packagekitd: daemon quit
14:05:08 systemd: Started Tracker metadata database store and lookup manager.
14:05:08 dbus-daemon: [session uid=1000 pid=1425] Successfully activated service 'org.freedesktop.Tracker1'
14:05:08 systemd: Starting Tracker metadata database store and lookup manager...
14:05:08 dbus-daemon: [session uid=1000 pid=1425] Activating via systemd: service name='org.freedesktop.Tracker1' unit='tracker-store.service' requested by ':1.1' (uid=1000 pid=1421 comm="/usr/libexec/tracker-miner-fs " label="unconfined")
14:04:56 systemd: Started Hostname Service.
14:04:56 dbus-daemon: [system] Successfully activated service 'org.freedesktop.hostname1'
14:04:56 systemd: Starting Hostname Service...
14:04:56 dbus-daemon: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.144' (uid=1000 pid=9420 comm="/usr/bin/gnome-logs --gapplication-service " label="unconfined")
14:04:14 systemd: systemd-hostnamed.service: Succeeded.
14:04:03 cat: [3118:7:0504/140403.396715:ERROR:h264_bitstream_parser.cc(206)] Streams with pred_weight_table unsupported.
14:03:44 systemd: Started Hostname Service.
14:03:44 dbus-daemon: [system] Successfully activated service 'org.freedesktop.hostname1'
14:03:44 cat: [3118:16:0504/140344.418153:ERROR:h264_bitstream_parser.cc(206)] Streams with pred_weight_table unsupported.
14:03:44 systemd: Starting Hostname Service...
14:03:44 dbus-daemon: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.141' (uid=1000 pid=9420 comm="/usr/bin/gnome-logs --gapplication-service " label="unconfined")
14:03:44 cat: [3118:7:0504/140344.338203:ERROR:h264_bitstream_parser.cc(206)] Streams with pred_weight_table unsupported.
14:03:43 systemd: systemd-hostnamed.service: Succeeded.
14:03:43 cat: [3118:6:0504/140343.833562:ERROR:h264_bitstream_parser.cc(206)] Streams with pred_weight_table unsupported.
14:03:13 nautilus: Called "net usershare info" but it failed: Failed to execute child process "net" (No such file or directory)
14:03:13 cat: [3118:3:0504/140313.789132:ERROR:h264_bitstream_parser.cc(206)] Streams with pred_weight_table unsupported.
14:03:13 systemd: Started Hostname Service.
14:03:13 dbus-daemon: [system] Successfully activated service 'org.freedesktop.hostname1'
14:03:13 cat: [3118:7:0504/140313.757584:ERROR:h264_bitstream_parser.cc(206)] Streams with pred_weight_table unsupported.
14:03:13 systemd: Starting Hostname Service...
14:03:13 dbus-daemon: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.139' (uid=1000 pid=9620 comm="/usr/bin/nautilus --gapplication-service " label="unconfined")
14:03:13 cat: [3118:3:0504/140313.691478:ERROR:h264_bitstream_parser.cc(206)] Streams with pred_weight_table unsupported.
14:03:13 dbus-daemon: [session uid=1000 pid=1425] Successfully activated service 'org.gnome.Nautilus'
14:03:13 cat: [3118:19:0504/140313.372877:ERROR:h264_bitstream_parser.cc(206)] Streams with pred_weight_table unsupported.
14:03:13 dbus-daemon: [session uid=1000 pid=1425] Activating service name='org.gnome.Nautilus' requested by ':1.135' (uid=1000 pid=6870 comm="/usr/bin/gnome-shell " label="unconfined")

Important logs:
13:57:27 kernel: nouveau 0000:01:00.0: fifo: fault 00 [READ] at 0000000000013000 engine 07 [HOST0] client 07 [HUB/HOST_CPU] reason 02 [PTE] on channel 2 [007f8db000 Xorg[1508]]
13:57:27 kernel: nouveau 0000:01:00.0: fifo: fault 00 [READ] at 0000000000013000 engine 07 [HOST0] client 07 [HUB/HOST_CPU] reason 02 [PTE] on channel 2 [007f8db000 Xorg[1508]]
13:57:27 kernel: nouveau 0000:01:00.0: Xorg[1508]: failed to idle channel 2 [Xorg[1508]]
13:57:12 kernel: nouveau 0000:01:00.0: Xorg[1508]: failed to idle channel 2 [Xorg[1508]]
13:56:27 kernel: nouveau 0000:01:00.0: fifo: fault 00 [READ] at 0000000000013000 engine 07 [HOST0] client 07 [HUB/HOST_CPU] reason 02 [PTE] on channel 2 [007f8db000 Xorg[1508]]
13:56:27 kernel: nouveau 0000:01:00.0: Xorg[1508]: failed to idle channel 2 [Xorg[1508]]
13:56:12 kernel: nouveau 0000:01:00.0: Xorg[1508]: failed to idle channel 2 [Xorg[1508]]
13:55:26 pulseaudio: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.
13:55:26 kernel: nouveau 0000:01:00.0: fifo: fault 00 [READ] at 0000000000013000 engine 07 [HOST0] client 07 [HUB/HOST_CPU] reason 02 [PTE] on channel 2 [007f8db000 Xorg[1508]]
13:55:26 kernel: nouveau 0000:01:00.0: fifo: fault 00 [READ] at 0000000000013000 engine 07 [HOST0] client 07 [HUB/HOST_CPU] reason 02 [PTE] on channel 2 [007f8db000 Xorg[1508]]
13:55:26 kernel: nouveau 0000:01:00.0: Xorg[1508]: failed to idle channel 2 [Xorg[1508]]
13:55:26 pulseaudio:   boundary     : 6206523236469964800
13:55:11 kernel: nouveau 0000:01:00.0: Xorg[1508]: failed to idle channel 2 [Xorg[1508]]
13:55:11 kernel: nouveau 0000:01:00.0: Xorg[1508]: failed to idle channel 2 [Xorg[1508]]
13:54:32 kernel: nouveau 0000:01:00.0: fifo: fault 00 [READ] at 00000088a1003000 engine 1b [CE2] client 00 [HUB/VIP] reason 07 [WO_VIOLATION] on channel -1 [1a24ce00000 unknown]
13:54:32 kernel: nouveau 0000:01:00.0: fifo: SCHED_ERROR 0a [CTXSW_TIMEOUT]
13:31:22 pulseaudio: GetManagedObjects() failed: org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.bluez': timed out (service_start_timeout=25000ms)
13:31:03 gdm-session-wor: gkr-pam: unable to locate daemon control file
13:30:53 kernel: hid-generic 0003:0D8C:0134.0006: No inputs registered, leaving
13:30:53 kernel: x86/cpu: VMX (outside TXT) disabled by BIOS

A: I am a terrible person to tell you this, but have you tried it into Microsoft Edge beta on Ubuntu. I've had a couple of run in with some users on Microsoft Teams on google Chrome on Windows OS and same issue occured. Although not in Microsoft Edge (chromium).
https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-beta/microsoft-edge-beta_91.0.864.15-1_amd64.deb


text:
Q: What are the buffs in this vanilla wow screenshot? What are buffs in the vanilla wow screenshot shown below?
I know two of them: the purple paw is Mark of the Wild, and the blue lightning cloud is Arcane Intellect. What are the others?

A: In order from left to right, top to bottom they are:

*

*Greater Blessing of Salvation, a legacy Paladin buff that reduced threat generation by 30%.

*Divine Spirit, a Priest buff that (at the time) provided a flat +Spirit buff. Thanks to Mark B for providing proof.

*Power Word: Fortitude, a Priest buff that increases Stamina. At the time, it was a flat +Stamina buff.

*Arcane Intellect, a legacy Mage spell that was a shorter, reagent-free version of Arcane Brilliance. It granted a flat +Intellect buff, but was made obsolete when the reagent cost was removed from Arcane Brilliance.

*Fire Resistance Aura, a Paladin aura that increases Fire Resistance.

*Aspect of the Hawk, a legacy Hunter aura that increased Attack Power by a flat amount.

*Resist Fire, a buff you got by using Mind Control on the Scarshield Spellbinder mobs in LBRS/UBRS. Many Raids used this for Molten Core and Blackwing Lair.

*Gift of the Wild, the group version of Mark of the Wild.

*Greater Blessing of Wisdom, a Paladin buff that increases mana regeneration by a fixed amount per 5 seconds.

*Greater Blessing of Kings, a legacy Paladin buff that increased all stats.

*Greater Blessing of Light, a legacy Paladin buff that increased the effect of any Paladin's Holy Light and Flash of Light healing spells.


text:
Q: OpenVPN client error : Failed to configure TLS context I got this errors when trying to start my openvpn client:
Tue Nov 28 15:28:03 2017 us=942328 OpenVPN 2.3.14 arm-poky-linux-gnueabi [SSL] [LZO] [EPOLL] [MH] [IPv6] built on Sep  6 2017
Tue Nov 28 15:28:03 2017 us=942837 library versions: LibreSSL 2.5.0, LZO 2.09
Tue Nov 28 15:28:03 2017 us=943095 WARNING: file '/etc/openvpn/auth.txt' is group or others accessible
Tue Nov 28 15:28:03 2017 us=951558 WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
Tue Nov 28 15:28:03 2017 us=951835 PO_INIT maxevents=4 flags=0x00000002
Tue Nov 28 15:28:04 2017 us=452047 Failed to configure TLS context
Tue Nov 28 15:28:04 2017 us=452305 Exiting due to fatal error

It is not a firewall issue since I deactivated to be sure.
I used the same configuration on another ARM client and it is working.
Here is the config file:
dev tun
tls-client
remote myRemoteIP 1194
pull
proto udp
script-security 2
ca /etc/openvpn/ca.crt
comp-lzo
reneg-sec 0
cipher AES-256-CBC
auth SHA1
auth-user-pass  /etc/openvpn/auth.txt
log-append /var/log/openvpn.log
verb 9

any ideas what is going wrong? thanks


text:
Q: How do I create a folder for special downloads I am 70 years old and brand new to Ubuntu. I am currently running v16.04.
I want to download music scores to a folder that is dedicated to that type of file.
Please, how do I do this?
Please keep in mind that I know nothing about Linux or Ubuntu. Please give clear and precise instructions.

A: In Firefox go to Edit > Preferences in the menu bar and under the General tab go to Downloads and change the option from Save files to to Always ask me where to save files.

Now when you click to download a file and select the Save File option a Window will appear where you can select the directory you wish to save the file to.


text:
Q: StreetViewPanorama.getLocation always return null. I am Using StreetViewPanorama View in my Activity.
Initially I set the position for StreetViewPanorama using.
streetViewPanorama.setPosition(new LatLng(25.1305784, 55.1170592));

but after I try to get Nearer PanoIds for that location then it always return null Value following is the code which i write:
StreetViewPanoramaLocation location = streetViewPanorama.getLocation();

Log.d("test","LocaTion:"+location);
if (location != null && location.links != null) {

       Log.d("test","size:"+location.links.length);

            streetViewPanorama.setPosition(location.links[0].panoId);
 }

please help me,Thanks in advance.

A: The location sometimes returns null value because it might have not been loaded. Just check if it exists. From another post
 @Override
 public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) {
 mPanorama.setOnStreetViewPanoramaChangeListener(new StreetViewPanorama.OnStreetViewPanoramaChangeListener() {
      @Override
      public void onStreetViewPanoramaChange(StreetViewPanoramaLocation   streetViewPanoramaLocation) {
        if (streetViewPanoramaLocation != null && streetViewPanoramaLocation.links != null) {
            // location is present
        } else {
            // location not available
        }
    }
  });


text:
Q: find the 10's complement of given number Question

Find the $10$'s complement of decimal number $00,000,000$

My Approach

$r^{'s}$ complement of $N$=$r^{n}-N$

where $n$= number of digitin $N$
Now $10^{'s}$ complement of $00,000,000$=
$10^{8}-00,000,000=100,000,000$
Everywhere answer is $00,000,000$
Am i Wrong?
Please help me out!

A: $-0=0$ so you would like the tens complement to be $0$.  If you have eight digits of $0$s you don't store the ninth digit so ignore the leading $1$.


text:
Q: how come i can't populate textarea with , by the way im using ajax this is the ajax im using,
$.ajax({
type: "POST",
url: "../../Ajax/<?php echo $exercise_num ?>",
data: "user_input=" + user_input,
success: function(resp){
//output
 $("#message").text(resp);
}
});
}

and when i try to populate $("#message").text(resp) with
public function pb3()
{
$num1 = 10;
$num2 = 7;
echo "$num1 + $num2 = "; echo $num1 + $num2;echo "
hi";
}

my html code:
Message:
the output:
Message: 10 + 7 = 17
 hi;
or is there any way to use br in the textarea of font?

A: You can't have html inside a textarea.  It won't be interpreted properly, and it should be escaped to prevent injection.  You want to use a newline:
echo "\n\nhi";

A: Try this :
$("#message").text(resp.replace("
", "\n"));
ref : http://www.w3schools.com/jsref/jsref_replace.asp

A: you can replace
 with \n ,
main thing is you cannot put html tags on textarea value
$.ajax({
type: "POST",
url: "../../Ajax/<?php echo $exercise_num ?>",
data: "user_input=" + user_input,
success: function(resp){
//output
    $("#message").text(resp.split("
").join("\n"));
}
});
}


text:
Q: jquery-ui-1.8.14.custom.css Problem I have Jquery-UI on my localhost site,everything was fine 3 or 4 days but today this error is appearing: syntax error
css/jquery-ui-1.8.14.custom.css
Line 13 . This is where firebug says is the error: .ui-helper-hidden{ display: none; }

A: You probably have something like
<script type="text/javascript" src="/css/smoothness/jquery-ui-1.8.15.custom.css"></script>

Instead of
<link rel="stylesheet" type="text/css" href="/css/smoothness/jquery-ui-1.8.15.custom.css"/>


text:
Q: Random Click Count on Left Click With Mouse I'm hoping someone can help me out with this, because the effects are driving me crazy.  Basically, left-clicking with my mouse delivers a random number of clicks each time.  Sometimes there's no click, sometimes one, and sometimes multiple in rapid succession.  This makes it nearly impossible to do most things, as something as simple as closing a tab in Chrome could lead to clearing out a bunch of tabs in rapid succession.
I know it's not the mouse, as I've swapped multiple mice onto this computer, and every one shows the same symptoms.  I tried both using a USB bar and plugging the mice into the computer directly, and I've swapped between USB ports, and that doesn't change anything.  I'm not sure what else to try to fix this problem; nothing I've found in Windows seems to have any kind of effect on this.

A: We can try to troubleshoot the issue as below:

*

*Put the mouse on another computer to see if there is such a problem.

*Does the computer have other mouse devices set up, such as a touchpad, stylus, etc.

*Try uninstalling the mouse in the device manager, reloading the mouse driver.

*Update the motherboard driver according to the model of the computer


text:
Q: QtQuick: cannot playback any video on embedded linux I cross compiled Qt 5.2.1 for TI AM335x board using the toolchain provided by TI together with their SDK 6.00.00.
Unluckily I am not able to reproduce any video in QML...
The debug console tells:
defaultServiceProvider::requestService(): no service found for – "org.qt-project.qt.mediaplayer"

Is there something that I am missing in cross-compilation? maybe some dependencies?
Can somebody help me in determining what I am missing?
You can find here my cross-compilation configuration and here the full trace of messages produced by the application when setting the environment variable QT_DEBUG_PLUGIN

A: You are missing a QtMultimedia backend that can actually play audio. Either it is not installed into the correct directory, or it was not built. Since your log output says that one backend (an audio capture one) was found, I'd rule out an installation problem.
You need to rebuild your QtMultimedia with the proper dependencies in place. For example, when gstreamer is found when building QtMultimedia, a GStreamer backend plugin will be built. The Qt documentation has a list of available backends.
When you build QtMultimedia, it will actually tell you what libraries it found, which is an indication of which backends will be built. Here is an example output when running qmake on QtMultimedia for desktop Linux - which built a gstreamer backend for me:
Running qmake /home/thomas/src/qt/qtmultimedia-stable ...
Info: creating cache file /home/thomas/build/qt/qtmultimedia-stable/.qmake.cache
Checking for openal... no
Checking for alsa... yes
Checking for pulseaudio... no
Checking for gstreamer... yes
Checking for gstreamer_photography... no
Checking for gstreamer_encodingprofiles... yes
Checking for gstreamer_appsrc... yes
Checking for resourcepolicy... no


text:
Q: Trouble linking module to javafx.base Receiving error when running application
module javafx.base cannot access class Model.Country (in module rbrod.scheduleapp) because module rbrod.scheduleapp does not open Model to javafx.base
File Structure:
main >
 java >
  Controller
  Database
  DBAccess
  Model
  rbrod.scheduleapp
 resources >
   fxml

module-info.java structure
module rbrod.scheduleapp {
    requires javafx.controls;
    requires javafx.fxml;
    requires java.sql;
    requires mysql.connector.j;

    opens rbrod.scheduleapp to javafx.fxml;
    opens Controller to javafx.fxml;
    opens Model to javafx.fxml;

    exports rbrod.scheduleapp;
}

Tried adding "opens Controller to javafx.fxml" amd "opens Model to javafx.fxml" to module-info.java


text:
Q: Show that if a linear transformation sends bases to bases, then it is bijective. I want to show that if a linear transformation sends bases to bases, then it is bijective.
I have the idea, but can't find a way to prove this.
Can someone help me or give a me a hint?

A: Let $\{x_1, \ldots, x_n\}$ be a basis in the domain such that $\{Ax_1, \ldots, Ax_n\}$ is a basis in the codomain.
For injectivity, we wish to prove that $A$ has trivial kernel. Assume $Ax = 0$ and write $x = \sum_{i=1}^n \alpha_ix_i$. We have
$$0 = Ax = A\left(\sum_{i=1}^n \alpha_ix_i\right) = \sum_{i=1}^n \alpha_i Ax_i$$
which implies $\alpha_1 = \cdots = \alpha_n = 0$ since $\{Ax_1, \ldots, Ax_n\}$ is linearly independent. Hence $x = 0$.
For surjectivity, any $y$ in the codomain can be written as a linear combination $y = \sum_{i=1}^n \alpha_i Ax_i$ since $\{Ax_1, \ldots, Ax_n\}$ spans the codomain. Then
$$A\left(\sum_{i=1}^n \alpha_ix_i\right) = \sum_{i=1}^n \alpha_i Ax_i = y$$
so $y$ is in the image of $A$.
Hence $A$ is bijective.

A: I assume that we consider finite dimensional spaces to keep the notation approachable. That said, the proof can be extended to the case of arbitrary dimension without too much effort.
Suppose that $T:V \to W$. Let $\{v_1,\dots,v_n\}$ be a basis of $V$. By the information in the question, $\{T(v_1),\dots,T(v_n)\}$ is a basis of $W$. I claim that there is a unique linear transformation $S$ for which
$$
S(Tv_j) = v_j, \quad j = 1,\dots, n.
$$
In particular: because $\{T(v_1),\dots,T(v_n)\}$ is a basis, there is indeed such a linear transformation, and $S$ is uniquely specified by this condition.
With that, it suffices to note that $S \circ T$ and $T \circ S$ are identity maps. Since $T$ has an inverse, it must be bijective.


text:
Q: phpmyadmin: Cannot login with a user who is not root (Access denied for user + PHP was built without openssl extension, can't send password encrypted) Problem
I cannot login to phpmyadmin with a user who is not the root-user.
Description
I installed a Webserver with XAMPP, a MySQL-Server 8.0.12 with the Community-Installer and phpMyAdmin 4.8.2 (PHP 7.2.8).
Logging in to phpmyadmin with the root-user works fine.
I added a new user in the MySQL Workbench:

Username: web
     Authentication Type: Standard
     Limits To Hosts Matching: localhost
     Password: strongpassword

I try to login from the same machine.
But when I do one of the following things, I get the later listed errors.

*

*Trying to login with a incorrect password or a incorrect username

*Trying to login to any user who is not root (even when the password is correct)

Cannot log in to the MySQL server
mysqli_real_connect(): PHP was built without openssl extension, can't send password encrypted
mysqli_real_connect(): (HY000/1045): Access denied for user 'web'@'localhost' (using password: YES)

Extract from my config.inc.php
$cfg['blowfish_secret'] = 'longstringwithmanyletters';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;

I have now row like "user" or "password" or "extension".
What I tried already using the search function

*

*I have only one MySQL open

*I changed localhost to 127.0.0.1

*I changed auth_type from cookie to http

*I added the row $cfg['Servers'][$i]['extension'] = 'mysqli';

*I added the rows $cfg['Servers'][$i]['user'] = 'root'; and $cfg['Servers'][$i]['password'] = 'myrealrootpassword';

*I deleted and editeted new users multiple times (in phpmyadmin with my root-user and in the MySQL Workbench)

*I tried the phpmyadmin 5.0+ snapshot

My thoughts
Maybe it has something to do with SSL (i have no SSL) or with the MySQL-extension because when I enter a incorrect password, I get a MySQL-error instead of a "wrong password"-error. But however the root user works.
Edit #1
I added the following code to the config.inc.php:
$cfg['Servers'][$i]['ssl'] = true;

Now the error "mysqli_real_connect(): PHP was built without openssl extension, can't send password encrypted" is no longer showing up. The other errors are still there.
Different problem which might belong to this one
When I try to create a user in the phpmyadmin interface (User Accounts > Add User Account), the user gets created but without any password an with the following error:

1064 - 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 'REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_' at line 1

The SQL code:
CREATE USER 'peter'@'localhost' IDENTIFIED WITH caching_sha2_password AS '***';
GRANT USAGE ON *.* TO 'peter'@'localhost' REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;

This is why I created the new users in MySQL Workbench.


text:
Q: Buttons appearing above softKeyboard when edditing text i'm developing an android app using relative layouts and all these stuff...
The structure is the following one:
<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"
    android:isScrollContainer="false"
    tools:context=".RegistryHotel" >

    <!-- FOOTER BAR -->

    <Button
        android:id="@+id/buttonRegisterLater"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_alignParentBottom="true"
        android:background="@drawable/toolbar_register"
        android:text="@string/registerLater"
        android:textColor="@color/white"
        android:textSize="15sp"
        android:textStyle="bold" />

    <Button
        android:id="@+id/buttonRegister"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_above="@id/buttonRegisterLater"
        android:layout_marginBottom="2dp"
        android:background="@drawable/toolbar_register"
        android:text="@string/register"
        android:textColor="@color/white"
        android:textSize="15sp"
        android:textStyle="bold" />

    <!-- TITLE -->

    <TextView
        ... />

    <!-- NAME -->

    <TextView
    ... />

    <EditText
        ... />

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:layout_below="@id/registerFormName"
        android:background="@android:color/darker_gray" />

    <!-- EMAIL -->

    <TextView
        ... />

    <EditText
        ... />

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:layout_below="@id/registerFormName"
        android:background="@android:color/darker_gray" />

    <!-- HOTEL -->

    <TextView
        ... />

    <EditText
        ... />

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:layout_below="@id/registerFormEmail"
        android:background="@android:color/darker_gray" />

    <!-- TERMS OF SERVICE -->

    <LinearLayout
        android:id="@+id/linearListAndCheck"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:layout_marginTop="1dp"
        android:layout_below="@id/registerFormHotel"
        android:layout_above="@id/buttonRegister">

        <ListView
            android:id="@+id/listPossibleHotels"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:layout_marginTop="2dp"
            android:background="@color/white"
            android:visibility="invisible" />

        <TextView
            android:id="@+id/registerFormInfo"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="bottom"
            android:paddingLeft="20dp"
            android:paddingRight="20dp"
            android:paddingTop="30dp"
            android:layout_weight="1"
            android:text="@string/registerFormInfo"
            android:textSize="13sp"
            android:textStyle="bold" />

        <CheckBox
            android:id="@+id/registerFormTermsOfService"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dp"
                        android:layout_marginRight="20dp"
            android:checked="true"
            android:text="@string/registryTermsOfService" />

    </LinearLayout>

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:layout_below="@id/registerFormHotel"
        android:background="@android:color/darker_gray"
        android:paddingLeft="20dp" />

</RelativeLayout>

The issue is that when I start to write in the third EditText (HOTEL), both buttons appear above the SoftKeyboard hiding the ListView where I must sow the query result.
Any idea about how is this happening??
Thank you very much.

A: the reason for this is android:layout_alignParentBottom="true". you should to convert relative layout to linearlayout, and for footer you should to use 'android:gravity="bottom"'
you should to do like below conversion of your code to linearlayout
<LinearLayout 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"
android:isScrollContainer="false"
android:orientation="vertical"
tools:context=".RegistryHotel" >

<!-- TITLE -->

<TextView
    ... />

<!-- NAME -->

<TextView
... />

<EditText
    ... />

<View
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:background="@android:color/darker_gray" />

<!-- EMAIL -->

<TextView
    ... />

<EditText
    ... />

<View
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:background="@android:color/darker_gray" />

<!-- HOTEL -->

<TextView
    ... />

<EditText
    ... />

   <View
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:layout_below="@id/registerFormHotel"
    android:background="@android:color/darker_gray"
    android:paddingLeft="20dp" />

 <!-- TERMS OF SERVICE -->

<LinearLayout
    android:id="@+id/linearListAndCheck"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_marginTop="1dp">

    <ListView
        android:id="@+id/listPossibleHotels"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="5"
        android:layout_marginTop="2dp"
        android:background="@color/white"
        android:visibility="invisible" />

    <TextView
        android:id="@+id/registerFormInfo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="bottom"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:paddingTop="30dp"
        android:layout_weight="1"
        android:text="@string/registerFormInfo"
        android:textSize="13sp"
        android:textStyle="bold" />

    <CheckBox
        android:id="@+id/registerFormTermsOfService"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:checked="true"
        android:text="@string/registryTermsOfService" />

</LinearLayout>

<!-- FOOTER BAR -->

<Button
    android:id="@+id/buttonRegisterLater"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    android:background="@drawable/toolbar_register"
    android:text="@string/registerLater"
    android:textColor="@color/white"
    android:textSize="15sp"
    android:gravity="bottom"
    android:textStyle="bold" />

<Button
    android:id="@+id/buttonRegister"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    android:layout_marginBottom="42dp"
    android:gravity="bottom"
    android:background="@drawable/toolbar_register"
    android:text="@string/register"
    android:textColor="@color/white"
    android:textSize="15sp"
    android:textStyle="bold" />

 </LinearLayout>

After that please don't forget to add windowSoftInputMode in activity tag like below.
 <activity
        android:name="com.test.MainActivity"
        android:configChanges="orientation|keyboardHidden|screenSize|keyboard"
        android:label="@string/app_name"
        android:windowSoftInputMode="adjustPan" >

A: Declare this in manifest of your particular activity tag.
<activity
android:windowSoftInputMode="adjustPan"
 />


text:
Q: correct coding structure in React.js? I'm new to react and I'm still using the life cycle methods, so my question is since componentDidMount() acts like a constructor I'm planning to initialize everything there:
render() {
        return (

                Done
                {
                    this.props.done.map((d) => (

                    <div className={`done ${this.state.isActive ? 'active' : ''}`} id={this.props.done.id}
                    onClick={(e) => {
                        this.props.setTaskID(d.id);
                        this.setToActive(e); //3.Call <-----
                        this.props.arrowStyleToDone();
                    }}>

                    ))
                }

        )
    }

    setToActive  //1.Declare <----
    componentDidMount() {
        //2.Initialize  <-----
        this.setToActive = (e) => {
            if(!e.target.classList.contains('active')) {
                e.currentTarget.classList.add('active');
                e.currentTarget.classList.add('border-done')
                this.props.closeAllTasks();
                this.props.closeAllDoing();
            } else {
                e.currentTarget.classList.remove('active');
                e.currentTarget.classList.remove('border-done')
                this.props.disableArrowButton();
            }
        }
    }
}

My idea is that if I declare everything inside the class which looks very ugly in my opinion, but then initializing everything on componentDidMount() instead of putting everything inside the render(), my web app will be faster because it won't need to declare and initialize everything every render.
Is this correct? and should I put the declaring and initialization on top of render()? but the componenDidMount() is called after the initial render.

A:
and should I put the declaring and initialization on top of render()

Typically the render function is put at the end of your class

but then initializing everything on componentDidMount() my web app will be faster because it won't need to declare and initialize everything every render.

I don't think you understand how React/classes work... If you do
class MyComponent extends React.Component {
  someFunc() {
    ...
  }

  render() {
    ...
  }
}

the someFunc function isn't re-declared every render. If you are worried about this binding issues, you can just do
class MyComponent extends React.Component {
  constructor() {
    this.someFunc = this.someFunc.bind(this);
  }

  someFunc() {
    ...
  }

  render() {
    ...
  }
}


text:
Q: Adding a meta box fields to child theme options page I created a custom options page for may theme using this code:
add_action( 'admin_menu', 'jrl_add_admin_menu' );
function jrl_add_admin_menu()
{
    add_menu_page('Options', 'Options', 'manage_options', 'functions','custom_options','dashicons-welcome-learn-more');
}
function custom_options()
{
?>

Options

Add Informations.

        <form method="post" action="options.php" enctype="multipart/form-data">
            <?php wp_nonce_field('update-options') ?>

  Title:
  <input type="text" name="jrlname" size="45" value="<?php echo get_option('jrlname'); ?>" />

  Title Abbreviation:
  <input type="text" name="abr" size="45" value="<?php echo get_option('abr'); ?>" />

  Publisher:
  <input type="text" name="pub" size="45" value="<?php echo get_option('pub'); ?>" />

<input type="submit" name="Submit" value="Save Options"  />

            <input type="hidden" name="action" value="update" />
            <input type="hidden" name="page_options" value="jrlname,abr,pub" />
        </form>

<?php
}
function load_custom_wp_admin_style() {
    wp_register_style( 'custom_wp_admin_css', get_stylesheet_directory_uri() . '/functions/options.css', false, '1.0.0' );
    wp_enqueue_style( 'custom_wp_admin_css' );
}
add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );

I need to add a repeater field to this options page. I found a method to add meta box to custom taxonomy using this code from (https://github.com/bainternet/Tax-Meta-Class):
require_once( get_stylesheet_directory() . '/Tax-meta-class/Tax-meta-class.php' );
$rep = array(
   'id' => 'demo_meta_box',
   'title' => 'Demo Meta Box',
   'pages' => array('category'),
   'context' => 'normal',
   'fields' => array(),
   'local_images' => false,
   'use_with_theme' => true
);
$my_meta = new Tax_Meta_Class($rep);
$repeater_fields[] = $my_meta->addText('re_text_field_id',array('name'=> 'My Text '),true);
$repeater_fields[] = $my_meta->addTextarea('re_textarea_field_id',array('name'=> 'My Textarea '),true);
$repeater_fields[] = $my_meta->addCheckbox('re_checkbox_field_id',array('name'=> 'My Checkbox '),true);
$repeater_fields[] = $my_meta->addImage('image_field_id',array('name'=> 'My Image '),true);
 $my_meta->addRepeaterBlock('re_',array('inline' => true, 'name' => 'This is a Repeater Block','fields' => $repeater_fields));
$my_meta->Finish();

How can I use this last code to add the meta box to the options page & not to a taxonomy?
I tried to add the code to the first one changing :
'pages' => array('category'), to 'pages' => array('functions'), where functions is the slug of my custom options page but nothing happened, no fields displayed in the options page. Am I missing something here? Any help please?


text:
Q: How to delete all my progress in Fruit Ninja? I would like to reset all my progress, achievements and objects from Fruit Ninja. I've tried deleting it and then reinstalling it again, but I still have all my stuff.
So, how could I reset the game so that it's like I've never played before?

A: When deleting the app, you are prompted if you want to remove the app data from Game Center.

Choosing Remove will remove this data and subsequently reinstalling the app will start a fresh container for the app data.


text:
Q: How to speed up the function DelaunayTriangulation? First define a function meshGrid to generate some points:
meshGrid[{x1_, x2_, y1_, y2_}, h0_] :=
  With[{yh0 = h0*Sqrt[3.]/2},
    Array[{(#1 - 1)*h0 + x1 + (1 + (-1)^#2) h0/4, (#2 - 1)*yh0 +
        y1} &, Ceiling@{(x2 - x1)/h0, (y2 - y1)/yh0}]]~Flatten~1;

p = meshGrid[{-1, 1, -1, 1}, 0.05];

The computing time of DelaunayTriangulation:
Needs["ComputationalGeometry`"];
DelaunayTriangulation[p] // Timing // First

In my computer it gives 18.533s
Matlab saves much time if does the same thing:

====================================Update=====================================
@halirutan really made a great attempt to point the way, but I failed to compile and didn't get the right answer, maybe I should learn something before. Here I find another way in this blogpost, which also relates to Qhull but easier to implement. You can get more infomation from here. Before changing anything, two files need to be downloaded, one is mPower, from which we need is mPower.m, another one is Qhull.
You can get the rest steps from that blog, only step two is worthy of note:
step 2: download qhull for windows, you may need to change the name, and put it into the folder C:\qhull. Then Copy all the *.exe files in bin folder and paste them in folder qhull, errors will occur without this step.

A: Fast Delaunay triangulations are sorely missing from Mathematica. I really hope the next version will have them.
To complement the other excellent answers, here's how to access MATLAB's CGAL based Delaunay triangulator (delaunay) from Mathematica:
First, install the MATLink package. Now load it and set up the delaunay function:
Needs["MATLink`"]
OpenMATLAB[]

delaunay = Composition[Round, MFunction["delaunay"]];

Now you can simply evaluate delaunay[points] to get the triangles, represented as point indices.
Note: in MATLAB, delaunay, which is based on CGAL, is faster than delaunayn which is based on Qhull.
Disclaimer: I'm one of the authors of MATLink.  The reason why I posted this answer is that I have referenced this question more than once and I wanted to give one more practically usable and fast method.

A: Version 10 (which is at the moment publicly accessible through the Programming Cloud) includes the DelaunayMesh and VoronoiMesh functions.
They work for 1D, 2D or 3D point sets.  Example:
points = RandomReal[1, {100,2}];

mesh = DelaunayMesh[points]

Now various properties of the triangulation can be queried using mesh["some-property"].  Available properties can be listed using mesh["Properties"].

A: Short answer
Yes, it is possible to speed up the Delaunay-triangulation and make it as fast as it is in Matlab.
If you are not afraid of some setup-work, then one possibility is to use a package which calls a c-implementation of the Delaunay-triangulation. One package I know is qh-math which is available in the Wolfram-library:

This package includes source code and support files needed to create a MathLink-based interface to the Qhull library (http://www.qhull.org) algorithm for Delaunay Triangulation. The sources are based on work done originally by Alban Tsui at the Imperial College of Science, Technology and Medicine.

And btw, this is exactly what Matlab is using: http://www.qhull.org/html/qh-faq.htm#math
Usage
I assume the program qh-math.exe is located in my download-folder. For your system you have to change this in the Install call. The usage is pretty easy. First you Install the MathLink program and after this you can call qDelaunayTriangulation[..] like a normal Mathemtatica function:
lnk = Install["/home/patrick/Downloads/qh-math/qh-math.exe"];

And then you can triangulate your points
meshGrid[{x1_, x2_, y1_, y2_}, h0_] :=
  With[{yh0 = h0*Sqrt[3.]/2},
    Array[{(#1 - 1)*h0 + x1 + (1 + (-1)^#2) h0/4, (#2 - 1)*yh0 +
        y1} &, Ceiling@{(x2 - x1)/h0, (y2 - y1)/yh0}]]~Flatten~1;
p = meshGrid[{-1, 1, -1, 1}, 0.05];

{t, del} = AbsoluteTiming[qDelaunayTriangulation[p]];

On my machine this took only t=0.032471 seconds. The the result looks nice
Graphics[MapIndexed[{ColorData[29, First[#2]],
    Polygon[#1]} &, (Part[p, #] & /@ del)]]

Please note that the output is different from DelaunayTriangulation. This version really gives a triangle index list like {{5, 6, 2}, {10, 7, 4}, {1, 5, 6},....
Freshly compiled qh-math.exe for Windows
Due to the great efforts of @Oleksandr R. we have now compiled versions of qh-math.exe and all the commandline tools from qhull. Please download a zip with all files for your system:

*

*qhull.zip for 64bit Windows

*qhull.zip for 32bit Windows
Compiling your own qh-math
I'm on Linux here and since there is no executable program included I had to compile it by myself. Since it can happen, that your program does not work (it's kind of old) you may have to compile it for your machine too. Therefore, I explain it step by step
Compiling: First you download the archive with the sources and unpack it. The following steps all takes place in the terminal. On Windoze you may want to do this in Visual Studio or with Cygwin.
First I store the path-name to my dev-directory of MathLink in a variable
MROOT="/usr/local/Wolfram/Mathematica/8.0/SystemFiles/Links/MathLink/\
 DeveloperKit/Linux-x86-64/CompilerAdditions/"

Then I had to install the qhull development files. Here, I could use my package manager, while on other systems you may need to download and install it from the home page of qhull.
sudo apt-get install libqhull-dev

Then you go into the unpacked folder of qh-math and use mprep of Mathematica to process the template file
$MROOT/mprep -o qh-math.tm.c qh-math.tm

Now you can compile the sources into a MathLink program
gcc -I${MROOT} -L${MROOT} -I/usr/include/qhull -lqhull -lML64i3 -lm \
 -lpthread -lrt -lstdc++ qh-math.c qh-math.tm.c

If you use a recent version of qhull you have to rename the variable in qh-math.c
char qh_version[] = "qh-math.c 2000/7/6";

into maybe qh_version_blub. Otherwise it clashes with a definition in the qhull lib.
The final MathLink program qh-math.exe is now ready to use in this directory.

A: Try:
Graphics`Mesh`MeshInit[]
mo = Delaunay[mypts];
faces = mo@"FaceCoordinates"

then Polygon[faces] is the triangulation.

A: As J.M. suggested in a comment, the Delaunay function in Graphics`Mesh can be used for this, though my method for getting the data out is somewhat unsatisfying.
The Delaunay function will take a list of points in 2D and return a MeshObject. Looking at the InputForm of the MeshObject one can see a list of the original points and a list of integer triplets corresponding to the points making up each triangle. Perhaps one of the functions in the package will extract this data from the MeshObject but I couldn't find it. Nor could I extract the relevant parts using normal expression manipulations. I resorted to converting the InputForm to a string in order to replace MeshObject with List.
The code is not as fast as the other solutions, but it is much quicker than the ComputationalGeometry triangulation. It runs in about 0.3 seconds on my PC.
p = meshGrid[{-1, 1, -1, 1}, 0.05];

Graphics`Mesh`MeshInit[];

extractTriangulation[mo_] :=
 ToExpression[StringReplace[ToString[InputForm[mo]], "MeshObject" -> "List"]][[3, 2]]

del = extractTriangulation@Delaunay@p;

Graphics[{EdgeForm[Black], FaceForm[], GraphicsComplex @@ MapAt[Polygon, del, 2]}]

A: I found the answer by Szabolcs really useful in finding the answer to the same question, so I thought I'd just leave the exact way to do it here in case someone stumbles across it like I did. The speed boost is very good - I'd been relying on this function to get the output I needed and for a list of about 3000 points it was taking about 20 seconds on my machine using DelaunayTriangulation and about 0.1 for the below equivalent!
points=RandomReal[1,{100,2}];
vertexadjacency = DelaunayMesh[points]["VertexVertexConnectivity"]


text:
Q: Perl keyword say is not working in version 5.14.4 My Perl version is 5.14.4, but the function say is not working. What might be wrong?

A: For backwards compatibility reasons, it's not available by default. You could use
CORE::say(...);          # Requires Perl 5.16.

but it's probably better to add one of the following:
use feature qw( say );   # Requires Perl 5.10.
use v5.10;               # All 5.10 features including "say".
use 5.010;               # Same as previous.
use v5.14;               # All 5.14 features including "say".
use 5.014;               # Same as previous.

This is documented.


text:
Q: Reading connection string defined in web.config from Windows service I am trying to read connection string defined in web.config from a Windows service. The site name is MySite and is hosted on IIS at http://localhost:31000 and physical path is C:\inetpub\wwwroot\MySite
Problem is following code always reads connection string from system level machine.config and not this site's web.config. I have tried different settings and code but same result. What am I doing wrong?
var configFile = new FileInfo(@"C:\inetpub\wwwroot\MySite\web.config");
var vdm = new System.Web.Configuration.VirtualDirectoryMapping(configFile.DirectoryName, true, configFile.Name);
var wcfm = new System.Web.Configuration.WebConfigurationFileMap();
wcfm.VirtualDirectories.Add("/", vdm);
Configuration config = System.Web.Configuration.WebConfigurationManager.OpenMappedWebConfiguration(wcfm, "/");
ConnectionStringsSection csSection = config.ConnectionStrings;
for (int i = 0; i < ConfigurationManager.ConnectionStrings.Count; i++)
{
  ConnectionStringSettings cs = csSection.ConnectionStrings[i];

  if (cs.Name == 'SQLServerConnectionString')
    return cs.ConnectionString;
}

A: According to your description, I suggest you could try to use System.Xmllibrary to read the config file and use select method to select the connection string node in the config file.
More details, you could refer to below codes:
        XmlDocument xdoc = new XmlDocument();
        xdoc.Load(@"The path");
        XmlNodeList xnodes = xdoc.SelectSingleNode("/configuration/connectionStrings").ChildNodes;
        foreach (XmlNode item in xnodes)
        {
            if (item.Attributes[0].Value == "ConnectionString")
            {
                Console.WriteLine(item.Attributes[1].Value);
            }
        }

Result:

A: It should be much simpler. This is all you should need to read a connection string from the web.config file.
<ConnectionStrings>
 <add name="SQLServerConnectionString" connectionString="" />
</ConnectionStrings>

var connectionString = ConfigurationManager.ConnectionStrings["SQLServerConnectionString"].ConnectionString;


text:
Q: How to regurlarly update an output without closing it with Python? I would like to know if it's possible to update an output (data, graphic) obtained with a Python script without closing this output ?
For example, let's say, I want to scrape some stock exchange to follow the fluctuation in real time. I scrape those data and it show me, for example in an excel file, or a graphic, those data in real time, regurlarly updated.
But it would be tedious if the output file would close ar each update. So I wonder if it's possible to do this in a way where the output will be showing the evolution of the data, updated in real time, without closing it ? It could b an excel file, or a plotly graph, I don't know, I just want to know if there any way to do this kind of task with Python ?


text:
Q: S3 resource Acces forbidden after upload with Laravel I am using Laravel 9 and uploading files on S3.
I have created my bucket on S3.
I am doing this to upload the file:
$path = Storage::disk('s3')->put("/{$school->s3_container}/users", new File('resizedFile'));

I see the file in my bucket. But when I try to access to it via my browser, I have a 403.
I have declared "public" the access on this bucket.
So where is my error?

A: I found a solution.
In S3 services:

*

*disable the option 'Block all the public access'

In Laravel, filesystems.php, add some parameters in the definition of your disk :

*

*'throw' => true,  This help me to find the error

*'visibility' => 'public'
So my disk looks like this:
's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'endpoint' => env('AWS_ENDPOINT'),
            'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
            'throw' => true,
            'visibility' => 'public'
        ],


text:
Q: creating new lists by adding elements of lists Suppose I have the following two lists:
a = ['hello ', 'goodbye ']
b = ['tom', 'dick', 'harry']

I would like to create two new lists with out put as follows:
['hello tom', 'hello dick', 'hello harry']
['goodbye tom', 'goodbye dick', 'goodbye harry']

what would be the most pythonic way to do this? my guess is there is something more elegant and efficient than a nested loop, but given that a or b could be different sizes, does this require a dictionary?

A: You could produce those in a nested list comprehension:
[['{} {}'.format(greeting, name) for name in b] for greeting in a]

That produces a list of lists:
>>> a = ['hello ', 'goodbye ']
>>> b = ['tom', 'dick', 'harry']
>>> [['{} {}'.format(greeting, name) for name in b] for greeting in a]
[['hello  tom', 'hello  dick', 'hello  harry'], ['goodbye  tom', 'goodbye  dick', 'goodbye  harry']]


text:
Q: Why is there a space between strings when using the 'paste' function in R? I have used a separator When I input the following paste command:
rdsfile<-paste("Eobs","tmean","_81_10.rds",sep="")

I get: "Eobstmean_81_10.rds"
When I change the equals sign to the arrow usually used in R:
rdsfile<-paste("Eobs","tmean","_81_10.rds",sep<-"")

I get: "Eobs tmean _81_10.rds " (Note the space between "Eobs" and "tmean" and again between "tmean" and "_81_10.rds"
What is causing this to happen?

A: Parameters in functions should be assigned with an equals sign as in your first example so that you get your desired output.
What you are doing in your second example is to create a global object called sep with value "". You can easily check this by looking into your environment. Or simply type sep into the console.
But this global object sep is not used in the paste function, so the paste function falls back to its default, which is using a space (" ") as the separator.
Long story short: don't use <- for parameter assignments in functions.


text:
Q: laravel get session data and order by latest I'm working on a session data with Laravel and I can store sessions into a variable and retrieving the whole data. But my problem is I want to order the session to the latest 5 id's from the session stored.
Storing session
session()->push('products.recently_viewed', $product->getKey());

Retrieving session
$ids = session()->get('products.recently_viewed');
$recently_viewed = Product::whereIn('id', $ids)->get();

The retrieving is working fine, I only want to get the latest 5 id's from the session products.recently_viewed
e.g.
data from sessions
[1,3,7,6,8,9,11,2]

data I want to get
[2,11,9,8,6]

A: You need array_slice and array_reverse
$items = array_reverse(array_slice($yourSessionArray, -5));

-5 means "start at five elements before the end of the array".
the reverse will reverse the order of the array so the last is first.


text:
Q: CSS3 inline layout is not working I am having a problem with css3 inline layout, Please see this website footer  social icons are not coming inline
http://www.seoindiarank.com/
Please help me, Need help indeed!

A: You have a lot of
 tags there. They are meant to be generating new lines. Please remove all the
 tags from the footer.

A: just remobe
 tag from code; and give some padding for better look


text:
Q: How to represent a positively and negatively sloped simple moving average on pinescript I'm in the starting phases of creating my own strategy using pine script. The long condition for the strategy is that the simple moving averages must be positively sloped and the short condition is the opposite. So far I have:
outA = ta.sma(close, 15)
outB = ta.sma(close, 30)

plot(outA, color=color.yellow, title="SMA(15)")
plot(outB, color=color.blue, title="SMA(30)")

A: Check if the current moving average value is larger than the previous moving average value, to see if the slope is positive. You can see if it is positive by typing outA > outA[1] //current > previous
Here is an example where the line is coloured green if the slope is positive:

Code:
//@version=5
indicator("sma slope")

outA = ta.sma(close, 15)

positiveSlopeA = outA > outA[1]
colorA = positiveSlopeA ? color.green : color.red //positive slope -> green, else red
plot(outA, color=colorA, title="SMA(15)")