text:
Q: ReactJS Kanban Board Drag and Drop without using external libraries I am creating a Kanban Board in ReactJS. All the stages are stored as a JSON with their respective tasks. I want to be able to drag and drop a task to a given stage headline in order to move it from one stage to another.
This is my Kanban Board:

When I drag and drop a task over a headline I am unable to get the correct stage. I have tried to log it but the data given for the const handleOnDragOver to the log is just "undefined":

DragAndDropDemo() :: handleOnDragOver() :: e.target.name=undefined
e.target.value=undefined

ReactJS Code:
import { useEffect, useState } from "react";

export function DragAndDropDemo() {

  /* Stages with tasks */
  const [stages, setStages] = useState([
    {
        name: "todo",
        bgcolor: "green",
        tasks: [
            {name: "Integrate Slack"}
        ]
    },
    {
        name: "wip",
        bgcolor: "yellow",
        tasks: [
            {name: "Learn Angular"},
            {name: "React"}
        ]
    },
    {
        name: "complete",
        bgcolor: "orange",
        tasks: [
            {name: "Vue"}
        ]
    }
  ]);

  /* Handle Drag and Drop */
  const handleOnDragStart = e => {
    console.log("DragAndDropDemo() :: handleOnDragStart() :: e.target.name="  + e.target.name + " e.target.value="  + e.target.value)

  };
  const handleOnDragOver = e => {
    console.log("DragAndDropDemo() :: handleOnDragOver() :: e.target.name="  + e.target.name + " e.target.value="  + e.target.value)
  };
  const handleOnDrop = e => {
    console.log("DragAndDropDemo() :: handleOnDrop() :: e.target.name="  + e.target.name + " e.target.value="  + e.target.value)
  };

  return (

    {stages.map((stage_item, stage_index) => {
        const tasks = stage_item["tasks"];
        return (

{stage_item.name}

            {tasks.map((task_item, task_index) => {
                return(

{task_item.name}

                );
            })}

        )
      })}

    );
}

export default DragAndDropDemo;

A: You should use the dataTransfer property on the start event: https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API#define_the_drags_data
So to for example pass the dragged elements id to the drop event you can do use the setData function of the dataTransfer object in the start event handler and then use the getData in the drop event handler. Like this:
 import { useCallback, useEffect, useState } from "react";

export function DragAndDropDemo() {
  /* Stages with tasks */
  const [stages, setStages] = useState([
    {
      name: "todo",
      bgcolor: "green",
      tasks: [{ name: "Integrate Slack" }]
    },
    {
      name: "wip",
      bgcolor: "yellow",
      tasks: [{ name: "Learn Angular" }, { name: "React" }]
    },
    {
      name: "complete",
      bgcolor: "orange",
      tasks: [{ name: "Vue" }]
    }
  ]);

  /* Handle Drag and Drop */
  const handleOnDragStart = (e) => {
    console.log("start", e);
    e.dataTransfer.setData("application/my-app", e.target.id);

    console.log(
      "DragAndDropDemo() :: handleOnDragStart() :: e.target.name=" +
        e.target.name +
        " e.target.value=" +
        e.target.value
    );
  };

  const handleOnDragOver = (e) => {
    e.preventDefault();
    e.dataTransfer.dropEffect = "move";

    console.log(
      "DragAndDropDemo() :: handleOnDragOver() :: e.target.name=" +
        e.target.name +
        " e.target.value=" +
        e.target.value
    );
  };

  const handleOnDrop = (e) => {
    e.preventDefault();

    const data = e.dataTransfer.getData("application/my-app");
    console.log("data", data);

    console.log(
      "DragAndDropDemo() :: handleOnDrop() :: e.target.name=" +
        e.target.name +
        " e.target.value=" +
        e.target.value
    );
  };

  return (

      {stages.map((stage_item, stage_index) => {
        const tasks = stage_item["tasks"];
        return (

 handleOnDragOver(e)}
              onDrop={handleOnDrop}
              style={{
                border: "#000 1px dashed",
                padding: "10px",
                margin: "1px"
              }}
            >
              {stage_item.name}

            {tasks.map((task_item, task_index) => {
              return (

{task_item.name}

              );
            })}

        );
      })}

  );
}

export default DragAndDropDemo;


text:
Q: What's the geometric intuition of the determinant of a covariance matrix? As explained in intuition of determinant : we know that determinant is the how the volume is scaled when the matrix is regarded as a projection.
Now, if we narrow down the definition of the matrix here: assuming that it is a covariance matrix, i.e., positive semi definitive  and symmetric, will there be any new characteristics/intuition of determinant.
As per Ben's comments:
In a 2D space, covariance matrix represents an ellipse, which captures the distribution of a vector of 2 random variables. In such a context, what does determinant say about these 2 variables?

A: If $\rho_{ij}=\operatorname{Cov}(X_i,\,X_j)$ and $Y_i:=R_{ij}X_j$ for a rotation matrix $R$ then $\operatorname{Cov}(Y_i,\,Y_j)=R_{ik}\rho_{kl}R^T_{lj}$, which for a suitable choice of $R$ is diagonal. So $\det\rho$ is the determinant of this diagonal matrix, i.e. the product of variances of the $Y_i$. This rotation places Cartesian axes along the axes of the ellipse associated with $\rho$, so the rotation-invariant determinant, being a product of eigenvalues, is proportional to the ellipse's area. (Needless to say, in higher dimensions I'd be talking about a hyperellipsoid's measure, hypervolume, volume, or whatever term you prefer.)

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to check which notification id is clicked? My application is receiving GCM notifications. I have different type of notifications and at some point the user can have more than one notification in the status bar. However I need to know which one exactly he clicked on. In the GCM onMessage Im setting them with
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        manager.notify(Integer.parseInt(notification_id), notification);

I need to get that notification_id after the click on the notification. I am pretty sure that's something simple but I couldnt find any info about it.
Here are the onMessage from GCMIntentService
@Override
protected void onMessage(Context context, Intent data) {
    String content_title;
    String content_text;
    String event_id;
    String content_info;
    String url;
    String match_id;
    // Message from PHP server
    content_title = data.getStringExtra("content_title");
    content_text = data.getStringExtra("content_text");
    content_info = data.getStringExtra("content_info") + "'";
    event_id = data.getStringExtra("event_id");
    match_id = data.getStringExtra("match_id");
    url = data.getStringExtra("url");
    NOTIFICATION_URL = url;

    // Open a new activity called GCMMessageView
    Intent intent = new Intent(this, GCMMessageView.class);
    // Pass data to the new activity
    intent.putExtra("message", content_title);
    intent.putExtra("url", url);
    // Starts the activity on notification click
    PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);

    Options opts = new Options();
    opts.inDither = true;
    opts.inScaled = false;

    /* Flag for no scalling */
    // Create the notification with a notification builder
    Notification notification = new NotificationCompat.Builder(this)
            .setSmallIcon(drawable_small).setLargeIcon(drawable_big)
            .setWhen(System.currentTimeMillis()).setTicker(content_title)
            .setContentTitle(content_title).setContentInfo(content_info)
            .setContentText(content_text).setContentIntent(pIntent)
            .getNotification();
    // Remove the notification on click
    notification.ledARGB = 0xff00ff00;
    notification.ledOnMS = 300;
    notification.ledOffMS = 1000;
    notification.flags |= Notification.FLAG_SHOW_LIGHTS;
    notification.flags |= Notification.FLAG_AUTO_CANCEL;

    NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    manager.notify(Integer.parseInt(match_id), notification);

    try {
        Uri notification2 = RingtoneManager
                .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Ringtone r = RingtoneManager.getRingtone(getApplicationContext(),
                notification2);
        r.play();
    } catch (Exception e) {
    }

    {
        // Wake Android Device when notification received
        PowerManager pm = (PowerManager) context
                .getSystemService(Context.POWER_SERVICE);
        final PowerManager.WakeLock mWakelock = pm.newWakeLock(
                PowerManager.FULL_WAKE_LOCK
                        | PowerManager.ACQUIRE_CAUSES_WAKEUP, "GCM_PUSH");
        mWakelock.acquire();

        // Timer before putting Android Device to sleep mode.
        Timer timer = new Timer();
        TimerTask task = new TimerTask() {
            public void run() {
                mWakelock.release();
            }
        };
        timer.schedule(task, 5000);
    }

}

And there`s the on click
String msg;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();
    if (intent.hasExtra("url"))
        msg = intent.getExtras().getString("url");
    Log.e("URL", msg);
    setContentView(R.layout.activity_main);

    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(msg
            + "?device_id="
            + GCMIntentService.DEVICE_REGISTRATION_ID.toString()));
    startActivity(browserIntent);

    // Toast.makeText(getApplicationContext(),
    // GCMIntentService.DEVICE_REGISTRATION_ID, Toast.LENGTH_LONG).show();
}

A: You can go through the below code, You have to ser Notification object as per your need.
    String appname = context.getResources().getString(R.string.app_name);
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    Notification notification;

    Intent intent = new Intent(context, NotificationActivity.class);

    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra("message", YOUR_DATA);

    int requestID = (int) System.currentTimeMillis();
    PendingIntent contentIntent = PendingIntent.getActivity(context, requestID,
            intent, 0);

    if (currentapiVersion < android.os.Build.VERSION_CODES.HONEYCOMB) {
        notification = new Notification(icon, message, when);
        notification.setLatestEventInfo(context, appname, message,
                contentIntent);
        notification.flags = Notification.FLAG_AUTO_CANCEL;
        notificationManager.notify((int) when, notification);

    } else {
        NotificationCompat.Builder builder = new NotificationCompat.Builder(
                context);
        notification = builder.setContentIntent(contentIntent)
                .setSmallIcon(icon).setTicker(appname).setWhen(when)
                .setAutoCancel(true).setContentTitle(appname)
                .setContentText(message).build();

        notificationManager.notify((int) when, notification);

    }

When user click on any notification, it will re-direct to NotificationActivity class.
In this activity, in OnCreate() method you can get your data that is set.
 Intent intent = getIntent();
if (intent.hasExtra("message"))
        String msg = intent.getExtras().getString("message");

I think it will help.


text:
Q: android ksoap2 stackoverflow error I'm just trying to perform a simple web service data pull with my web service that I created. When I go to run the program it crashes on me. I have searched for the problem and have had no luck can somebody please help me?
public void getMessage() {
    private final String NAMESPACE = "http://tempuri.org/";
    private final String URL = "http://10.19.9.148/RFID/Service1.asmx";
    private final String SOAP_ACTION = "http://tempuri.org/HelloWorld";
    private final String METHOD_NAME = "HelloWorld";
    private String TAG = "SOAP";

    private static String message;

    //Create request
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    //Property which holds input parameters
    PropertyInfo messagePI = new PropertyInfo();
    //Set Name
    messagePI.setName("Practice");
    //Set Value
    messagePI.setValue(messagePI);
    //Set dataType
    messagePI.setType(String.class);
    //Add the property to request object
    request.addProperty(messagePI);
    //Create envelope
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.dotNet = true;
    //Set output SOAP object
    envelope.setOutputSoapObject(request);
    //Create HTTP call object
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    try {
        //Invoke web service
        androidHttpTransport.call(SOAP_ACTION, envelope);
        //Get the response
        SoapObject result = (SoapObject) envelope.bodyIn;
        //Assign it to fahren static variable
       // message = response.toString();

        if(result !=null){
            tv.setText(result.getProperty(0).toString());
        }

        //tv.setText("" + results);

    } catch (Exception e) {
        tv.setText(e.getMessage());
        //e.printStackTrace();
    }
}

When I step through it in debug mode it errors out at the line androidHttpTransport.call(SOAP_ACTION, envelope);And then shows this on my log cat
07-09 07:32:11.309: E/AndroidRuntime(8343): FATAL EXCEPTION: main
07-09 07:32:11.309: E/AndroidRuntime(8343): java.lang.StackOverflowError
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.String._getChars(String.java:1040)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:155)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:215)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serialization.PropertyInfo.toString(PropertyInfo.java:219)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at java.lang.StringBuffer.append(StringBuffer.java:203)
07-09 07:32:11.309: E/AndroidRuntime(8343):     at org.ksoap2.serializatio

A: import java.net.SocketException;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.R.string;
import android.content.Context;
import android.util.Log;

public class Services {
    private static String SOAP_ACTION;
    private static String METHOD_NAME;
    private static String NAMESPACE = "http://tempuri.org/";

    private static String URL = "xyz";

    private static Context mContext;

    // Register User
    public static String Register(Context context, String StudentCode,
            ) {

        SOAP_ACTION = "http://tempuri.org/Register";
        METHOD_NAME = "Register";

        mContext = context;
        String result = null;

        // Ack
        Log.e("method", "Register");

        try {
            SoapPrimitive responses = null;
            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

            // Property PassCode
            PropertyInfo piStudentCode = new PropertyInfo();
            piStudentCode.setName("sPassCode");
            piStudentCode.setValue(StudentCode);
            piStudentCode.setType(string.class);
            request.addProperty(piStudentCode);

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                    SoapEnvelope.VER11);
            envelope.dotNet = true;
            envelope.setOutputSoapObject(request);
            HttpTransportSE andHttp = new HttpTransportSE(URL);

            try {
                andHttp.call(SOAP_ACTION, envelope);
                responses = (SoapPrimitive) envelope.getResponse();

            } catch (SocketException ex) {
                Log.e("Register SE ex", ex.toString());
                ex.printStackTrace();
            } catch (Exception e) {
                Log.e("Register ex", e.toString());
                e.printStackTrace();
            }

            result = responses.toString();
        } catch (Exception e) {
            e.printStackTrace(System.err);
            Log.e("Register main ex", e.toString());
        }

        return result;
    }

The way i used, Hope it may help you too


text:
Q: Add Appointment to Exchange Calendar from ASP.NET MVC Intranet Application I have got an ASP.NET MVC 4 Intranet Application.
The application uses the windows authentication for authenticating users.
I can get the Username with User.Identity.Name. This contain the domain name and username (MyDomain\Username).
I now want to add an appointment to the users calender via the Exchange Web Service API.
I can do this like the following:
var service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
        service.Credentials = new WebCredentials(Settings.MyAccount, Settings.MyPassword);
        service.Url = new Uri(Settings.ExchangeServer);

var appointment = new Microsoft.Exchange.WebServices.Data.Appointment(service);
appointment.Subject = setAppointmentDto.Title;
appointment.Body = setAppointmentDto.Message;
appointment.Location = setAppointmentDto.Location;

 ...

appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);

This adds an appointment for the user specified in the credentials.
I do not have the password for the currently logged in user.
Since I am using Windows Authentication (Active Directory Account), is there a way to somehow use this authentication information to use the Exchange Web service with the account of the user who uses the web application?
Because of security it is not possible to retrieve the user's password from Active Directory.
Is there another way of doing this?
Is it possible to create an appointment for another user as the user who uses the service?
Greetings
Alexander

A: You have two options for setting the Credentials.
// Connect by using the default credentials of the authenticated user.
service.UseDefaultCredentials = true;

or
// Connect by using the credentials of user1 at contoso.com.
service.Credentials = new WebCredentials("user1@contoso.com", "password");

Source for the above and full info is here http://msdn.microsoft.com/EN-US/library/office/ff597939(v=exchg.80).aspx
Microsoft also recommends using Autodiscover to set the URL endpoint
// Use Autodiscover to set the URL endpoint.
service.AutodiscoverUrl("user1@contoso.com");

If you wanted to create an appointment for another user you would use
appointment.RequiredAttendees.Add("user2@contoso.com");

or
appointment.OptionalAttendees.Add("user3@contoso.com");

Depending if they were required or optional.
However, this changes the appointment to a meeting. The meeting request is just an appointment with attendees.


text:
Q: how to export two gridview results one by one in mail thru c# asp.net I need to send two gridview output to mail using asp.net c#. Following code works fine and mail sent successfully. Whats the issue is, two gridview outputs are placed one by one without any line break. I need to give a line break after gridview1 gvPendingStatus and then to show gridview2 gvProductionTrend. How can be done. Plz help me out.
    StringBuilder sb = new StringBuilder();
    string MailSturcture;

    using (System.IO.StringWriter sw = new StringWriter())
    {
        using (HtmlTextWriter hw = new HtmlTextWriter(sw))
        {
            gvPendingStatus.RenderControl(hw);
            gvProductionTrend.RenderControl(hw);
            System.IO.StringReader sr = new StringReader(sw.ToString());
            sb.AppendFormat(sw.ToString());
            //  other Mail informations goes here...
            }
        }

You can see both the gridviews are touched each other and I want the line break after Prakash Kumar row.

A: Try the following
gvPendingStatus.RenderControl(hw);
hw.Write("<br>");
gvProductionTrend.RenderControl(hw);

or
gvPendingStatus.RenderControl(hw);
hw.WriteBreak();
gvProductionTrend.RenderControl(hw);


text:
Q: Swift doing async automatically func detect(image: CIImage) {
        guard let model = try? VNCoreMLModel(for: Inceptionv3().model) else {
            fatalError("Loading CoreML Model failed.")
        }

        let request = VNCoreMLRequest(model: model) { (request, error) in
            guard let results = request.results as? [VNClassificationObservation] else {
                fatalError("Model failed to process image")
            }
            print(results)
        }
        print("First")

        let handler = VNImageRequestHandler(ciImage: image)

        do {
            print("Second")
            try handler.perform([request])
            print("Third")
        } catch {
            print(error)
        }

    }

In this example, what gets printed in console is:
First,
Second,
"Results",
Third
So my question is,
why does this code work even though handler.perform function is not inside the request completion handler?
This seems different to NodeJS where the data in "request" variable is not ready when it reaches handler.perform.

A: It seems there is nothing async here. According to https://developer.apple.com/documentation/vision/vnimagerequesthandler/2880297-perform

Returns true if all requests were scheduled and performed. If the return value is false, check the error parameter.

Hence, if the function returns, all requests have been scheduled and performed.

A: perform will:

The function returns after all requests have either completed or failed.

Since the requests are completed before it returns, it is synchronous. The completion handler you passed to VNCoreMLRequest will be called before perform returns. Its return value also indicates whether all the requests have succeeded. If it returns before all the requests have completed, how does it know whether all of them have succeeed? :D
Because of perform's synchronous nature, you should run it on another dispatch queue, so as to not block the main queue, like Apple did in all their sample code (1, 2):
DispatchQueue.global(qos: .userInitiated).async {
    do {
        try imageRequestHandler.perform(requests)
    } catch let error as NSError {
        print("Failed to perform image request: \(error)")
        self.presentAlert("Image Request Failed", error: error)
        return
    }
}

Remember to switch back to the main queue when you are in the completion handler.


text:
Q: Link between tunneling rate and conductivity Generally speaking, in the theory of single-electron tunneling events (one electron tunneling through a quantum well), the rate under which this event occurs is calculated using Fermi's Golden Rule, and the result based on the different of energy between initial and final state of the electron $\Delta F=F_f-F_i,$ is given by:
$$
\Gamma(\Delta F) \propto \frac{-\Delta F}{1-e^{\Delta F/k_B T}} \tag{1}
$$
Moreover, in (particle, or pn-junction) systems where conductivity stems from single electron tunneling events, the conductance between a pair of particles is often taken to decay exponentially as a function of distance between the two $g_{ij}\propto e^{-d_{ij}}$.
My question is, how do get to the latter given that we know the rate given by $(1)$? In other words, starting from the functional form of Eq. $(1)$ could we have predicted that conductivity via single e-tunneling must decay exponentially as function of distance?

A: To be frank, I don't think you are proposing a good method for understanding tunneling. If you want to understand the exponential dependence, then just treat transmission thru a square barrier the same way you would for a step potential, and the exponential dependence becomes quite clear. Moreover, I disagree with your assertion that a pn-junction (diode?) works by tunneling. A standard pn-junction diode does not work by tunneling (altho a Zener diode does).
However, I'll try to approach tunneling using Fermi's golden rule.
First, I must disagree with your characterization of Fermi's golden rule. I'm not sure where you got your first Formula, but that looks like some temperature-dependent equation that was derived from Fermi's golden rule in some particular situation. Tunneling thru a barrier isn't really a temperature-dependent phenomena (unless you add in phonon-assisted tunneling and the likes, which is a much higher level of complicated), so I don't think your first equation is relevant to the current discussion.
Fermi's golden rule is often stated as it is on wikipedia
$$\Gamma_{i \to f} = \left|\left<i\right|H^\prime\left|f\right>\right|^2 \rho$$
This says, roughly, that the scattering rate due to a perturbation $H^\prime$ from an initial state $\left|i\right>$ to a final state $\left|f\right>$ is proportional to $\left|\left<i\right|H^\prime\left|f\right>\right|^2$.
This is not normally where you would start to talk about tunneling in the context of conductivity and transport because Fermi's golden rule is derived using first order perturbation theory, and for transport problems, your barrier is often a large feature, not a perturbation.
Never the less, I think that you can start with Fermi's golden rule if you have a weak potential to tunnel thru, altho it's a little awkward. Suppose your potential is zero with the exception of a single, small square barrier, and you treat that single square barrier as the perturbation $H^\prime$. Without the barrier, you would have modes that look like $e^{\pm ikx}$, and we can label those states by their wavenumber. Those are the unperturbed states. The probability of reflection from the barrier would be something like $\left|\left<k\right|H^\prime\left|-k\right>\right|^2$ --- i.e. the initial state is right traveling with some $k$, and the final state is left traveling (i.e. back scattered) with the same $k$. The larger $H^\prime$ (i.e. a taller or wider barrier), the larger the reflection probability. You might be able show an exponential dependence (altho I'm not certain). The rate of transmission would be something like $1 - \left|\left<k\right|H^\prime\left|-k\right>\right|^2$.
Note that I don't think that you can write the transmission as $\left|\left<k\right|H^\prime\left|k\right>\right|^2$ because I don't think that Fermi's golden rule really applies there. Fermi's golden rule is for calculating the rate out of scattering out of some state into another, not for the rate of one state into itself.


text:
Q: Why JSTL-JSF2 not work fine when exists metadata converter in the view in JSF 2 The button invoke the action method only when in the JSF view I delete JSTL code, I know that it is abour lifecycle but I dont understand the cause/problem. I like to comprime because it ocurrs this behavior.
view code work fine
    <f:metadata>
<f:viewParam name="idAsociacion" value="#{msgUsuario.asociacion}" converter="#
               {asociacionConverter}"
        converterMessage="#msg['aplicacion.asociacion.error.converter']}" required="true"
        requiredMessage="#{msg['aplicacion.asociacion.error.required']}" />
<f:viewParam name="idMsg" value="#{msgUsuario.mensajeRespondido}" converter="#
     {mensajeConverter}" converterMessage="#{msg['aplicacion.mensaje.error.converter']}"
     required="true" requiredMessage="#{msg['aplicacion.mensaje.error.required']}" />
    </f:metadata>

    <ui:decorate template="/WEB-INF/templates/mainUsuario-template.xhtml">
    <ui:define name="title">
    <h:outputFormat value="#{msg['usuario.escribirMsj.title']}">
        <f:param value="#{msgUsuario.asociacion.nombre}" />
    </h:outputFormat>
    </ui:define>

    <ui:param name="descripcionView" value="#{msg['usuario.escribirMsj.descripcion']}" />

     <ui:define name="content">
<h:panelGroup layout="block"
          id="escribirMensajeContainer"styleClass="escribirMensajeContainer">
    <h:form>
        <p:panelGrid>
        <p:row>
        <p:column>
        <h:outputLabel for="texto" value="#{msg['usuario.escribirMsj.mensaje']}"
                 styleClass="labelInput" />
        </p:column>
        </p:row>

        <p:row>
        <p:column>
        <p:inputTextarea  autoResize="true" cols="80" rows="15" id="texto"
             maxlength="500" value="#{msgUsuario.texto}">

        </p:inputTextarea>
            </p:column>
        </p:row>

        <p:row>
    <p:column>
    <h:message for="texto" id="messageMensajeError" styleClass="messageError" />
    </p:column>
        </p:row>

        <p:row>
             <p:column>
    <p:commandButton action="#{msgUsuario.enviar}"
               alt="#{msg['usuario.escribirMsj.alt.enviar']}" tabindex="2" title="#
      {fn:replace(msg['usuario.escribirMsj.title.enviar'],0,msgUsuario.asociacion.nombre)}"
       value="#{msg['usuario.escribirMsj.enviar']}" />
</p:column>
    </p:row>
    </p:panelGrid>
    </h:form>
    </h:panelGroup>
    </ui:define>
    </ui:decorate>
    </html>

But if I add JSTL how I show below. The view render fine because the message is not responsed but the button never invoke the action method and the view reload.
      <c:choose>
      <c:when test="#{msgUsuario.mensajeRespondido.respondido==false}">
        <h:form>
        <p:panelGrid>
        <p:row>
        <p:column>
        <h:outputLabel for="texto" value="#{msg['usuario.escribirMsj.mensaje']}"
                 styleClass="labelInput" />
        </p:column>
        </p:row>

        <p:row>
        <p:column>
        <p:inputTextarea  autoResize="true" cols="80" rows="15" id="texto"
             maxlength="500" value="#{msgUsuario.texto}">

        </p:inputTextarea>
            </p:column>
        </p:row>

        <p:row>
    <p:column>
    <h:message for="texto" id="messageMensajeError" styleClass="messageError" />
    </p:column>
        </p:row>

        <p:row>
             <p:column>
    <p:commandButton action="#{msgUsuario.enviar}"
               alt="#{msg['usuario.escribirMsj.alt.enviar']}" tabindex="2" title="#
      {fn:replace(msg['usuario.escribirMsj.title.enviar'],0,msgUsuario.asociacion.nombre)}"
       value="#{msg['usuario.escribirMsj.enviar']}" />
</p:column>
    </p:row>
    </p:panelGrid>
    </h:form>
    </c:when>
    <c:otherwise>
         <h:outputText value="MESSAGE RESPONSED" />
    </c:otherwise>
    </c:choose>

Note: Converts work fine in two case.
ManagedBean code
  @ManagedBean(name="msgUsuario")
  @ViewScoped
  public class EscribirMensajeUsuarioView implements Serializable {

private static final long serialVersionUID = 1L;
private static final Logger logger=Logger.getLogger(EscribirMensajeUsuarioView.class);

private Asociacion asociacion;

private Mensaje mensajeRespondido;

private Usuario usuario;

private String texto;

private boolean usuarioBloqueado;

@ManagedProperty(value="#{mensajeBO}")
private MensajeBO mensajeBo;

@ManagedProperty(value="#{usuarioBO}")
private UsuarioBO usuarioBo;

/* Never invoked with JSTL code in the view */

public String enviar(){
    logger.info("EscribirMensajesUsuarioView.enviar");

    TipoMensaje tipoMensaje=null;
    Mensaje mensaje=this.mensajeRespondido;

    .................
            .................
            .................
      }

/* Getters and Setters */
   }

I read this Balusc's comment
"JSF and JSTL doesn't run in sync as you'd expect from the coding. JSTL runs during build time of the view (when the JSF component tree is to be populated) and JSF runs during render time of the view component tree (when HTML output is to be generated). You can visualize it as follows: JSTL runs first from top to bottom and then hands over the result to JSF which in turn runs from top to bottom again."
I understand this in dinamyc datatable for example, but not in this case. Because JSTL render fine the view being that mensajeRepetido exit in the JSF tree, but button doesnt invoke the method.However the view reload and mensajeRepetido exits again by the converter.
Kind regards.

A: Your problem is caused because you're binding JSTL attributes to a view scoped managed bean property. This works only if partial state saving is turned off. With partial state saving turned on (as by default), JSTL attributes gets its own second instance of the view scoped bean (with all properties set to default!) and not the instance which is stored in JSF view state and is been used by JSF components.
Just use JSF component's rendered attribute instead the usual way and use JSTL only to control the building the view, not to control the rendering of the view.
<h:form rendered="#{not msgUsuario.mensajeRespondido.respondido}">
    ...
<h:form>
<h:panelGroup rendered="#{msgUsuario.mensajeRespondido.respondido}">
     <h:outputText value="MESSAGE RESPONSED" />
</h:panelGroup>

See also:

*

*JSTL in JSF2 Facelets... makes sense?

*Communication in JSF 2.0 - @ViewScoped fails in taghandlers


text:
Q: ViewResult class result not work when i submit a form method post for redirect to another view when i sumit a form  i want redirect to another page with viewresult class.
this is my filter code :
 [ValidateSpamFilter(duration: 60, isAddress: false, keepRequestinCache: true)]
    // HttpPost Method For Submit Form . you can add comment by this method .
    [System.Web.Mvc.HttpPost]
    public ActionResult AddComment(CommentAddDTO Comments)

and
 filterContext.Result = new ViewResult { ViewName = "~/Error/Index"  };

this just work for actionresutland partialviewresult GET methods.
But i want uses for actionresutland Post Method . Because i submit a form method and i get below Error

'~/Error/Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:\r\n~/Error/Index"


text:
Q: Short Circuit Variable Assignment at least one varible is known to be defined I have some code here involving short circuit assignment:
// varibleA: object | undefined
// varibleB: object | undefined
if(varibleA || varibleB){
   const selectedVarible: object = varibleA || varibleB;
 //ERROR Type "object | undefined is not assignable to type object.
}

This seems to me that if either varA or varB is defined, then the short circuit assignment should always return a defined object. This might be because the short circuit asignment handles this like an else and will always at least assign the second varible (B), which has type object | undefined. If this is the case how do I get around this? Thank you

A: TypeScript's control flow analysis works better with variables (or properties of variables) and not with general expressions.  That means you could first store varibleA || varibleB into its own variable, and then check it:
// varibleA: object | undefined
// varibleB: object | undefined
const selectedVariable = varibleA || varibleB; // still object | undefined
if (selectedVariable) {
  // now selectedVariable is known to be object
  console.log(selectedVariable.toString()); // no error
}

Hope that helps.  Good luck!


text:
Q: Export real-time data from scada wincc to google sheets Is there a way to connect realtime data from wincc scada to google sheets?

A: It is possible to do so using VB Scripts which are very similar to VBA.
Here is a link from someone who did the same from an Excel sheet: How to write to a "Google Spreadsheet" from Excel 2003 VBA.
You can use the VB Script to create almost the same structure (without strong types) and populate the value fields with your tag values, qualities and anything else.


text:
Q: multithreaded using _beginthreadex passing parameters Visual Studio C++ 2008
I am using threads. However, I have this warnings and not sure what I am doing wrong.
1. unsigned int (__stdcall *)(void *) differs in levels of indirection from 'void *(__stdcall *)(void *)'
2. _beginthreadex different types for formal and actual parameters 3

/* Function prototype */
void* WINAPI get_info(void *arg_list)

DWORD thread_hd;
DWORD thread_id;

/* Value to pass to the function */
int th_sock_desc = 0;

/* Create thread */
thread_hd = _beginthreadex(NULL, 0, get_info, (void*) th_sock_desc, 0, &thread_id);
if(thread_hd == 0)
{
    /* Failed to create thread */
    fprintf(stderr, "[ %s ] [ %s ] [ %d ]\n", strerror(errno), __func__, __LINE__);
    return 1;
}

A: the Thread function that you pass to _beginthreadex has a different prototype than the one you pass to _beginthread
uintptr_t _beginthread(
   void( *start_address )( void * ),
   unsigned stack_size,
   void *arglist
);
uintptr_t _beginthreadex(
   void *security,
   unsigned stack_size,
   unsigned ( *start_address )( void * ),
   void *arglist,
   unsigned initflag,
   unsigned *thrdaddr
);

It's the same as what CreateThread expects,
DWORD WINAPI ThreadProc(
  __in  LPVOID lpParameter
);

So you need to change the function signature of your thread proc to
unsigned WINAPI get_info(void *arg_list)

remove WINAPI and change the return type.
Edit :
WINAPI is actually needed, the docs show the wrong prototype for _beginthredex, but they explicitly state that __stdcall is needed.  Your problem is just the return type. Also, the error message, says that __stdcall is expected, so that settles it.


text:
Q: VisualCode - Suggestion Estou iniciando um projeto utilizando JavaScript, no qual o suggestion (Ctrl + Space) não está funcionando completamente.
Ao colocar "." ou a apertar Ctrl + Space ele só mostra uma única opção (de forma resumida) e não vejo as demais propriedades que um objeto ou vetor pode ter. Parece que mostra de forma resumida.
Como configurar para mostrar todas opções de propriedades ao apertar a tecla?
Configuração do VSCode (setting.json)
"editor.quickSuggestions": true,
"editor.suggestOnTriggerCharacters": true,
"editor.wordBasedSuggestions": true,

A: Acesse a aba de plugins dentro do VSCode e procure por IntelliSense, esse varia de linguagem para linguagem... existem uns para PHP, Unity, JS, C# (E outros).
Tente procurar um de seu agrado, abra a configuração dos plugins estilo IntelliSense e lá você pode escolher a quantidade de resultados que o VS mostra!
Lembrando que aqui você pode baixar plugins para as linguagens que você for usar, isso ajuda o VS a reconhecer os codigos e snippets dessa linguagem.
Tente procurar por VS Code IntelliSense.


text:
Q: Converting Infopath 2007 to Infopath 2014 We are migrating from MOSS 2007 to SharePoint Online 2013.  We have some InfoPath 2007 forms we would like to migrate.
Any suggested way to approach these? Have not tried but what happens if you open an InfoPath 2007 for in Infoapth 2014?  I would also imagine all the data connections and AD logic will be broken at a minimum.
Easier to just redesign from scratch?

A: Probably easier to just use a tool like Sharegate to migrate them over http://en.share-gate.com. Otherwise some of them might still work depending on what you are doing with these forms.
How many do you have? You might just want to rebuild them in some cases as you say.


text:
Q: Sort by the largest value across multiple columns What would be the most efficient way to sort a query by looking at the largest column value in each row?
For example:
Dan | 5 | 0 | 3
Moe | 0 | 9 | 2
Joe | 3 | 3 | 8

Sorting this dataset should return: Moe, Joe, Dan
My dataset is more complicated than above so I am trying to avoid any combination of subqueries with group by max.

A: You could use CROSS APPLY:
SELECT *
FROM tab t
CROSS APPLY (SELECT MAX(col) c FROM (VALUES(t.col1),(t.col2),(t.col3)) sub(col)) s
ORDER BY s.c DESC;

DBFiddle Demo
Output:
┌──────┬──────┬──────┬──────┬───┐
│ name │ col1 │ col2 │ col3 │ c │
├──────┼──────┼──────┼──────┼───┤
│ Moe  │    0 │    9 │    2 │ 9 │
│ Joe  │    3 │    3 │    8 │ 8 │
│ Dan  │    5 │    0 │    3 │ 5 │
└──────┴──────┴──────┴──────┴───┘

EDIT

Great answer. I don't suppose there's a way to do this for an arbitrary number of columns (without dsql) is there?

There is a way without dynamic SQL:
SELECT DISTINCT t.*, c.s
FROM tab t
CROSS APPLY (VALUES(CAST((SELECT t.* for XML RAW) AS xml))) B(XMLData)
CROSS APPLY (SELECT MAX(a.value('.','INT') ) s
             FROM B.XMLData.nodes('/row')  AS C1(n)
             CROSS APPLY C1.n.nodes('./@*') AS C2(a)
             WHERE a.value('local-name(.)','varchar(100)') LIKE 'col%'
                     -- filtering based on name
                     -- it is also possible to JOIN and filter
                     -- based on metadata like sys.columns
               ) C
ORDER BY s DESC;

DBFiddle Demo

A: I almost never sort on the database.
In this case, where the sorting is complicated, and more complex than the model you presented, I typically take the data out of the database and sort it in code.
I have always been rewarded by increased performance when I do this.
Its much cheaper to sort 8000000 rows in memory than it is in the database.
Since your data model is complex, writing an algorithm to sort this is more flexible than having to write sql - you can write code that is resistant to schema change, and will continue to obey your rules.


text:
Q: Can I share 'cache' or 'tmp' directory via itunes share? I want to share 'cache' or 'tmp' directory via itunes share... is that possible? if yes then how?
I know I can share 'documents' directory by setting UIFileSharingEnabled true in info.plist. Just want to know how to share 'cache' or 'tmp' directory.
Can someone atleast answer in Yes or No?? will be much appreciated!

A: No, thats not possible. You can only share files in the documents folder with iTunes.
I tried to create symbolic links in the document folder to files in other directories and that didn't work either.


text:
Q: Unable to build docker image with tensorflow 2.0 I have to build a docker image with tensorflow==2.0.0 but while issuing the build command I am getting the below error
Could not find a version that satisfies the requirement tensorflow==2.0.0 (from -r requirements.txt (line 6)) (from versions: 0.12.1, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.8.0, 1.9.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.12.2, 1.12.3, 1.13.1, 1.13.2, 1.14.0)
No matching distribution found for tensorflow==2.0.0 (from -r requirements.txt (line 6))

Earlier a few months ago I didn't have any issue, I have compiled the image using the same command
Dockerfile
FROM --platform=linux/amd64 ubuntu:18.04

RUN apt-get update \
    && apt-get install -y apt-utils \
    python3.6 \
    python3-pip \
    libsm6 \
    libxext6 \
    libxrender-dev \
    net-tools \
    iputils-ping \
    nano

WORKDIR /app
COPY . /app

RUN pip3 install -r requirements.txt

requirements.txt
Flask==1.1.2
gunicorn==20.1.0
Pillow==5.4.1
numpy==1.18.1
opencv-contrib-python==3.4.2.16
tensorflow==2.0.0

A: Upgrading pip before installing the dependencies from requirements.txt solves the problem
RUN python3 -m pip install --upgrade pip


text:
Q: puppet ignoring configuration I've set up a puppet (3.7.2) master server on a Debian 8 Jessie box, but somehow the config directives I've written get ignored:
[14:24:43|root@puppetmaster:~] cat /etc/puppet/puppet.conf
[master]
server=puppetmaster

This is a very basic config, yet it fails to take into account my directive. If I start the master:
[14:33:54|root@puppetmaster:~] puppet master ; puppet config print |grep ^server
server = puppet

Same goes if I try to start it with arguments :
[14:35:29|root@puppetmaster:~] puppet master --server puppetmaster ; puppet config print |grep ^server
server = puppet

Same result if I try the above under the puppet user.
I just don't see what I might be missing.
Thanks

A: There's a number of issues with what you're trying to do.

*

*the 'server' configuration item only makes sense in the 'agent'
context; setting it under [master] has no useful effect

*The documentation for "puppet config print" claims it works in 'agent'    mode, although I'm not 100% sure that's correct (it doesn't seem to actually work that way)

Interestingly, you can also use the "configprint" option, e.g.:
sudo puppet agent --configprint server
or
sudo puppet master --configprint server
and see what happens; for me it behaves the way I'd actually expect (returning the relevant value from [agent] and [master] respectively)
I would suggest "configprint" is doing what you need and you should use that instead of 'config print'


text:
Q: Python regex to PHP? I'm trying to convert a Python script into PHP.
The following 2 regular expressions work in Python:
'/\*\*([\w\n\(\)\[\]\.\*\'\"\-#|,@{}_<>=:/ ]+?)\*/'
'(?:\* ([\w\d\(\),\.\'\"\-\:#|/ ]+)|(?<= @)(\w+)(?: (.+))?)'

...however, if I try to run them in PHP I get:
Warning: preg_match_all() [function.preg-match-all]: Unknown modifier ']'

How come?

A: PCRE (including preg_match_all) requires a pattern boundary.  You need to wrap the entire pattern in /, @, #, %, or many other possible options.  I suggest % as it doesn't look like you are using it in either pattern, that is:
%(?:\* ([\w\d\(\),\.\'\"\-\:#|/ ]+)|(?<= @)(\w+)(?: (.+))?)%

A: The reason is that PHP expects delimiters around its regexes, so it treats the first and second slash as delimiters and tries to parse what follows as modifiers.
Surround your regex with new delimiters and try again (I also removed some unnecessary backslashes):
'%/\*\*([\w\n()\[\].*\'"#|,@{}_<>=:/ -]+?)\*/%'
'%(?:\* ([\w\d(),.\'"\:#|/ -]+)|(?<= @)(\w+)(?: (.+))?)%'

Hint: Use RegexBuddy to do these things. It will take a regex written in language A and convert it to language B for you.


text:
Q: How to filter contents of SNS message in lambda while posting to slack I created a Cloudwatch alert to send a notification to SNS whenever the state of the container changes. The SNS then triggers the Lambda function in order to post the alert to slack.
The problem I have is that there is too much information in the Message. I want to choose a few fields such as availabilityZone, name, lastStatus, desiredStatus and connectivity.
Here is my lambda function.
#!/usr/bin/python3.6
import urllib3
import json
http = urllib3.PoolManager()
def lambda_handler(event, context):
    url = "https://hooks.slack.com/services/XXXXXXXXXXXX"
    msg = {
        "channel": "#XXXXX",
        "username": "XXXXX",
        "text": event['Records'][0]['Sns']['Message'],
        "icon_emoji": ""
    }

    encoded_msg = json.dumps(msg).encode('utf-8')
    resp = http.request('POST',url, body=encoded_msg)

Here is what I get in slack.
{"version":"0","id":"641aaafc-d51d-cd4f-0ab8-92a53455345","detail-type":"ECS Task State Change","source":"aws.ecs","account":"123456789","time":"2020-09-16T22:18:47Z","region":"us-west-2","resources":["arn:aws:ecs:us-west-2:123456789:task/2b9f7454b-db7c-4af3-8aa8-4234234234f"],"detail":{"attachments":[],"availabilityZone":"us-west-2a","clusterArn":"arn:aws:ecs:us-west-2:123456789:cluster/clustername","containerInstanceArn":"arn:aws:ecs:us-west-2:123456789:container-instance/454545-6ebe-4cca-8d39-068468cf6fe4","containers":[{"containerArn":"arn:aws:ecs:us-west-2:123456789:container/dfgdf4-b5de-4171-b395-fdfdfgdfg545","lastStatus":"RUNNING","name":"TaskName","image":"123456789.dkr.ecr.us-west-2.amazonaws.com/imagename,"imageDigest":"sha256:35c86c84ff4e2965dfgdfgdfgdfgbb978d406e668411b849df8d1a6122d247c4f7a832","runtimeId":"818d6f8b811bdfgdfgdfgdfg317bf24bdfeb3a915e3a7cd9ec2416c48b","networkBindings":[{"bindIP":"0.0.0.0","containerPort":80,"hostPort":2082,"protocol":"tcp"}],"taskArn":"arn:aws:ecs:us-west-2:123456789:task/2b9f7a6b-db7c-4aferera8-e548eaa8403f","networkInterfaces":[],"cpu":"512","memory":"1024","memoryReservation":"102"}],"createdAt":"2020-09-15T16:49:28.597Z","launchType":"EC2","cpu":"512","memory":"102","desiredStatus":"STOPPED","group":"service:dServiceName","lastStatus":"RUNNING","overrides":{"containerOverrides":[{"name":"TaskName"}]},"connectivity":"CONNECTED","connectivityAt":"2020-09-15T16:49:28.597Z","pullStartedAt":"2020-09-15T16:49:29.712Z","startedAt":"2020-09-15T16:49:30.712Z","startedBy":"ecs-svc/5345345345345","stoppingAt":"2020-09-16T22:18:47.075Z","pullStoppedAt":"2020-09-15T16:49:29.712Z","stoppedReason":"Scaling activity initiated by (deployment ecs-svc/345345345345345)","updatedAt":"2020-09-16T22:18:47.075Z","taskArn":"arn:aws:ecs:us-west-2:123456789:task/345345dgfg-db7c-4af3-8aa8-e548eaa8403f","taskDefinitionArn":"arn:aws:ecs:us-west-2:123456789:task-definition/TaskDefinication:9","version":3}}


text:
Q: Is that a problem with plugins versions? Vue 3 after using "vue create" command I get these versions in package.json:
  "dependencies": {
    "core-js": "^3.6.5",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },

Is that normal?
Here are the versions in vue ui:
imgur
@vue-cli latest version installed

A: It just normal, basically $sudo vue create generates latest version available
which in this case is 4.5.15, talking about the stable release it must be somewhere around 2.6.14
#vue.js #vuejs3


text:
Q: 4 GB DDR2 vs 2 GB DDR 3 I 'm going to purchase new PC. due to my budget limit either i can purchase 2 x 2GB = 4GB DDR 2 or 2 GB Single stick DDR 3.
Will 2 GB DDR 3 will give almost same performane compare to 4 GB DDR 2?
In future I will upgrade RAM upto 8 GB
Which option would be better for me for now and why?

A: You'll not even notice a difference between DDR2 and DDR3 speeds. I recommend to go for 4GB DDR2.

A: Since you're planing to upgrade, get DDR3. The price of DDR3 and DDR2 is generally on par at this point as the industry sifts to DDR3 manufacturing.
If possible (perhaps with a marginally additional cost), try to get 1 DDR3 stick so you can just buy another one to match later instead of replacing both.
DDR3 is the near future!

A: At worst DDR3 is the same speed as DD2; at best it's over twice as fast.
You're RAM capacity requirements are likely to be an issue with most PCs needing 2+ GB for common activities these days


text:
Q: Can an RxJS 5 Observable source be stopped by another down the chain? RxJS 5 Angular 2 RC4 app written in Typescript 1.9:
I have two observables in a chain. I would like, if a condition is met in the 2nd, for the first to be completed immediately.  My efforts seem unnecessarily complex. In the example below, I try to stop the first observable after it has emitted 3 values:
source = Observable.interval(1000)
        .do(()=>this.print("*******EMITTING from Source*******"))
        .switchMap(count => {
            if(count<3){ //just pass along the value
                return Observable.create(observer=>{
                    observer.next(count);observer.complete()
                })
            }
            else{ //abort by issuing a non-productive observable
                return Observable.create(observer=>
                    observer.complete()
                )
            }
        })
this.source.subscribe(count=>this.print('Ouput is '+count);

Here is the output:
*******EMITTING from Source*******
Output is 0
*******EMITTING from Source*******
Output is 1
*******EMITTING from Source*******
Output is 2
*******EMITTING from Source*******
*******EMITTING from Source*******
*******EMITTING from Source*******

So, functionally I get the result I want because the wider script stops getting notifications after three outputs. However, I'm sure there is a better way. My problems are:

*

*The upstream observable continues to emitting forever. How can I stop it?

*I'm creating a new observable down the chain on every emission. Shouldn't I be able to just pass along the first 3 values but abort or complete the chain on the 4th?

A: You can use take operator to do it.take takes the first N events and completes the stream.
this.source = Observable.interval(1000)
  .do(()=>this.print("*******EMITTING from Source*******"))
  .take(3);
this.source.subscribe(count=>this.print('Ouput is '+count);

Your example's stream doesn't complete because switchMap's outer stream doesn't complete when inner streams complete. switchMap() is equal to map().switch(). In your example, the map part emits observables like:

*

*next(0), complete()

*next(1), complete()

*next(2), complete()

*complete()

*complete()

*complete()

*complete()

*...(continues infinitely)...

And the switch part switches those observables and keeps waiting for upcoming observables.
EDIT
Your example also could be written as:
source = Observable.interval(1000)
        .do(()=>this.print("*******EMITTING from Source*******"))
        .takeWhile(count => count < 3);

EDIT 2
Regarding your comment, if you want to terminate the stream if the inner stream emits true:
source = Observable.interval(1000)
        .do(()=>this.print("*******EMITTING from Source*******"))
        .switchMap(count => createSomeObservable(count))
        .takeWhile(x => x !== true);


text:
Q: Powers of the golden ratio Let $\phi$ be the golden ratio. I'm tasked to prove by other means than induction that $x$ in the next equation $$\phi^n =\phi F_n +x,$$ is actually a Fibonacci number.
I have tried to apply Binet's formula to $\phi^n -\phi F_n$:
\begin{align} \phi^n -\phi F_n &= \phi^n -\phi \left(\dfrac{\phi^n -\left(-\frac{1}{\phi}\right)^n}{\sqrt{5}}\right)\\ &=\phi^n -\frac{\phi^{n+1} -\left(-\frac{1}{\phi}\right)^n \phi}{\sqrt{5}}\\ &=\frac{\sqrt{5} \phi^n -\phi^{n+1} +\left(-\frac{1}{\phi}\right)^n \phi}{\sqrt{5}}. \end{align}
But then I got stuck. Could you please help me?

A: Starting from $$\phi^n -\phi F_n,$$ then plug $$F_n \equiv \frac{1}{\sqrt{5}} (\phi^n -\varphi^n)$$ where $$\phi =\frac{1+\sqrt{5}}{2}, \qquad \varphi =\frac{1-\sqrt{5}}{2},$$ and use properties of $\phi$ and $\varphi$, namely, that $$1-\frac{1}{\sqrt{5}}\phi = -\frac{1}{\sqrt{5}}\varphi, \qquad \phi \varphi=-1,$$ to compute another Fibonacci number.

 $$\phi^n -\phi F_n =\phi^n -\phi \cdot \tfrac{1}{\sqrt{5}}(\phi^n -\varphi^n) =\phi^n -\tfrac{1}{\sqrt{5}} \phi^{n+1} +\tfrac{1}{\sqrt{5}} \phi \varphi^n \\ =\left(1-\tfrac{1}{\sqrt{5}} \phi\right)\phi^n +\tfrac{1}{\sqrt{5}}\phi \varphi^n =-\tfrac{1}{\sqrt{5}} \varphi \phi^n +\tfrac{1}{\sqrt{5}} \phi \varphi^n \\ =-\varphi \phi \cdot \tfrac{1}{\sqrt{5}} \left(\phi^{n-1} -\varphi^{n-1} \right) =\tfrac{1}{\sqrt{5}} \left( \phi^{n-1} -\varphi^{n-1} \right) =F_{n-1}.$$

A: $$
\phi F_n = \phi\frac{\phi^n - \bar{\phi}^n}{\phi - \bar{\phi}}
=\frac{\phi^{n+1} - \phi\bar{\phi}^n}{\phi - \bar{\phi}}
=\frac{\phi^{n+1} + \phi\bar{\phi}^{n-1}}{\phi - \bar{\phi}}
$$
$$
\phi F_n +F_k
=\frac{\phi^{n+1} + \phi\bar{\phi}^{n-1}+\phi^k - \bar{\phi}^k}{\phi - \bar{\phi}}
$$
and $ \phi F_n +F_k = \phi^n$ if and only if
$$
=\frac{\phi^{n+1} + \phi\bar{\phi}^{n-1}+\phi^k - \bar{\phi}^k}{\phi - \bar{\phi}} = \phi^n
$$
or
$$
\phi^{n+1} + \phi\bar{\phi}^{n-1}+\phi^k - \bar{\phi}^k = \phi^{n+1} - \phi^n\bar{\phi}= \phi^{n+1}+\phi^{n-1}
$$
Setting $k=n-1$ gives the result you desire.


text:
Q: Requirements for the inner product in Hilbert space I was reading the following text about the mathematical foundations of quantum mechanics when I stumbled upon the following conditions that the inner product must satisfy:

I woud like to understand why the above conditions must be satisfied, and resolve some seeming conflicts.

*

*I always associated the inner product in quantum mechanics with an overlap integral, this notion would intuitively imply that it should be symmetric in exchange of $\psi$ and $\omega$ because the overlap of the two functions should not be a function of how I label them. Why do I require the complex part of the inner product to be anti-symmetric with respect to swapping of the arguments?

*I understand that choosing it to be linear in its second argument is just a matter of convention and it makes the Dirac notation work nicer, as operators can then act on the elements to the right.

*Again, this is not clear to me why I should require the inner product to be antilinear in its first argument. Is it just because it is a necessary requirement to satisfy the condition 4 below?

*This makes sense.
I would be very glad if someone could explain the reason for the first condition to me, as it seems mystifying to me why it is necessary to impose it.

A: *

*The inner product between $\psi(x)$ and $\phi(x)$ is
$$ \int \phi^\ast(x)\psi(x)\mathrm{d}x,$$
otherwise the inner product of $\psi$ with itself would not be $\int \lvert \psi\rvert^2$ but $\int \psi^2 $ which would not necessarily be real. This is an "overlap integral", just not the naive $\int \phi\psi$ you were probably thinking of.

*If you do not require anti-linearity, then for $I(\psi,\psi)$ real, $I(\alpha\psi,\alpha\psi)$ for some complex number $\psi$ would be $\alpha^2 I(\psi,\psi)$ instead of $\lvert \alpha \rvert^2 I(\psi,\psi)$, which again would not be necessarily real, but for an inner product we want the inner product of a vector with itself to be real.


text:
Q: Reading a string of unknown length from a file I need to read a text file that's in this format:
n k
S1
S2
S3
.
.
.
Sn

N being and integer, and S's being strings. Now, as far as I've seen a string cannot be read with fscanf function, but rather an array of char's has to be used.
The problem is that I need to set the length of the character array even though I have no way of knowing how long a word will be:
in = fopen("01.in", "r");

int N, k;

fscanf(in, "%d %d", &N, &k);

for (int i=0; i<N; i++){
    char temp[100];
    fscanf(in, "%s", temp);
}

So is there a way to maybe use vectors or something?
Or maybe in the off case that this problem cannot be solved, can I convert a string of chars into a string, and then create a vector of strings?

A: Why not use std::ifstream and std::getline something like this:
std::ifstream in("01.in");

int N, k;

if(!(in >> N >> k))
{
    std::cerr << "Error reading file!" << '\n';
    return EXIT_FAILURE;
}

std::string line; // read lines into this

int i = 0;
while(i < N && std::getline(in, line))
{
    // deal with line here

    ++i; // keep track
}

A: The first step towards code sanity here is to stop using char arrays and start using std::string instead. The big difference between the two is that an array's size is set in stone at compile time, whereas a std::string's initial size can be can be chosen at runtime, and it can also grow and shrink while the program runs.

Now, as far as I've seen a string cannot be read with fscanf function,
  but rather an array of char's has to be used.

Since C++11, that's not strictly true. std::strings are in many ways compatible with C functions. For example, you can safely get a pointer to the underlying buffer with &s[0]. Therefore, you could technically do this:
std::string temp(100, '\0');
fscanf(in, "%s", &temp[0]);

But that has not gotten us far. Apart from some other bad things about this "solution" (unidiomatic, undefined behaviour if too many characters are read, wasteful if too few characters are read), as you can see, the original problem still persists; the number 100 is hard-coded in the program. This is the real problem, as you have also said in the comment you added:

What I mean is what if I get a string that's longer than 100 characters?

The answer to that is: Just don't use fscanf anymore. Use std::ifstream along with the std::getline function. std::getline reads a whole line, i.e. everything until the next line break, and stores the result in a std::string. Size and memory management are all handled automatically for you:
std::ifstream is("01.in");
std::string temp;
std::getline(is, temp);


text:
Q: How to escape single quotes in RLIKE Hive? Double single quotes not working I would like to escape the single quote in RLIKE input. I used double single quotes like so:
SELECT * FROM TABLE
WHERE column RLIKE 'o''brien'

But it returned the results with "obrien" rather than "o'brien". I tried "\\'" instead of double single quotes too, but that doesn't work either. So what is the correct escape character for single quote?

A: Three methods:
1 Put the whole regexp into double-quotes, single quote is shielded inside double-quotes:
where column rlike "o'brien"

See also: https://stackoverflow.com/a/66175603/2700344
2 Use unicode \u0027
where column rlike 'o\\u0027brien'

3 Use HEX \x27
where column rlike 'o\\x27brien'

Using \\x or \\u codes you can check any special character if you know it's code.

A: You can just use =:
WHERE column = 'o''brien'

I'm not sure why you are using RLIKE unless you intent:
WHERE column LIKE '%o''brien%'


text:
Q: VBScript find path folder then input path into text txt file I have been trying to find and write a vbscript that enables me to find a filepath and then insert it's location into a text.txt file
For example:
click on Find.vbs
window opens to search for folder or drive
select c:\test folder
are you sure you want to select c:\test folder? prompt
click yes button
in the text.txt file
the word driveselect changes to c:\test
I found this that opens the window and then lets me select a file, it then opens a msgbox to show the file name, but will not select a folder only
Set wShell=CreateObject("WScript.Shell")
Set oExec=wShell.Exec("mshta.exe ""about:<input type=file id=FILE>
<script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""")
sFileSelected = oExec.StdOut.ReadLine
wscript.echo sFileSelected

there are a few codes that i found to change the text in a word file, but not text file with input.
any help would be greatly appreciated.
thanks

A: You can use the Excel Application's FileDialog to select a folder.
Dim FolderName, msg, msgResponse

Do
    FolderName = getSelectedFolderPath
    msg = "Are you sure you want to select " & vbCrLf & FolderName & "?"
    msgResponse =  MsgBox(msg, vbYesNo,"")
Loop Until Len(FolderName) = 0 Or msgResponse = vbYes

Function getSelectedFolderPath
    Const msoFileDialogFolderPicker = 4
    Dim xlApp
    Set xlApp = CreateObject("Excel.Application")
    With xlApp.FileDialog(msoFileDialogFolderPicker)
        .Show
        If .SelectedItems.Count > 0 Then
            getSelectedFolderPath = .SelectedItems(1)
        End If
    End With
    xlApp.Quit
End Function


text:
Q: Efficiency and memory requirements of DataViewModel and Room Database When implementing a Room ORM for sqlite databases, I am following the practise of making

*

*a singleton AppDatabase class extending RoomDatabase

*a Repository class with getters and setters interacting with AppDatabase's Entities and LiveData containing Entities.

*a DataViewModel extending AndroidViewModel and providing access to the Repository fields.

Whenever i need asynchronous access to the data, I observe the LiveData that is provided by the Repository. My question is about the memory requirements of DataViewModel.

*

*Should there only be one DataViewModel class in the application?

*Should there only be one instance of DataViewModel?

*If yes, then what about unnecessary data in the DataViewModel? For example, my constructor looks like:
public DataViewModel(@NonNull Application application) {
super(application);
repository = new Repository(application);
allCategories = repository.getAllCategories();
allAvgPoints = repository.getAllAvgRoundPoints();
avgPoints = repository.getAvgPoints();
numberOfBronzeMedals = repository.getBronzeMedals();
numberOfSilverMedals = repository.getSilverMedals();
numberOfGoldMedals = repository.getGoldMedals();

}
Now assume allCategories represents a large dataset that I seldom need access to. Does it make sense to have this in one single DataViewModel, or does it not affect performance until i actually access the allCategories field?
Right now I have one DataViewModel instance per fragment and I only have one DataViewModel class. Does this result in performance issues or unnecessary data being processed?
TLDR; I don't want to process large datasets unnecessarily. How can DataViewModel be setup to accomplish this?


text: Q: MWFeedParser Enclosures with Images I have a pretty standard MWFeedParser project, except that instead of working with tableviews, I am working with collectionviews. To simplify things, I have the URL of the image I am trying to display in the enclosure part of the RSS feed. So if I call the url of item.enclosures, it will give the urls of the images. From there, how would I be able to display each image for each item in a CollectionView? I have the title and summary going to a UITextView, and I have a UIImageView all set up. Any ideas?


text:
Q: Why am i getting doubled frequency for chirp spectrogram I wrote this code to generate linear fmcw chirps:
def generate_fmcw(BW, Tc, Fs, initial_phase=0, num_chirps=2, delay=0):
        t = np.arange(0, Tc-1/Fs, 1 / Fs)
        nsamples = len(t)
        w = 2 * pi * np.linspace(0, BW, nsamples)
        return np.tile(np.cos(w * (t-delay) + initial_phase), num_chirps)

When using:
BW = 1e6
Tc = 2e-3
Fs = 2e6
num_chirps = 1

and this spectrogram function using scipy and pyplot:
import matplotlib.pyplot as plt
from scipy import signal

def display_spectrogram(s,fs):
    f, t, Sxx = signal.spectrogram(s, fs,mode='magnitude')
    plt.pcolormesh(t, f, Sxx)
    plt.ylabel('Frequency [Hz]')
    plt.xlabel('Time [sec]')
    plt.show()

I get some undersampling behaviour:
a = generate_fmcw(BW, Tc,Fs,num_chirps=1)
display_spectrogram(a,Fs)

undersampled fmcw chirp
But when I use :
Fs = 4e6

I get double max frequency I wanted (which was BW):
double frequency
Why am I getting this weird behaviour? I am using the right sampling frequency according to nyquist theorem...

A: To create a time-varying frequency such as a linear chirp, the argument to cos must be the integral of the time-varying frequency. Another way to say it is: for a function θ(t), the instantaneous frequency of cos(θ(t)) is θ'(t) (the derivative of θ(t)). Your expression is basically equivalent to c*(t-d)**2 + i, and the derivative of that is 2*c*t - c*d, hence the doubling of the frequency.  The solution is to adjust the argument of cos so that the derivative of the expression is the desired time-varying frequency.
Also, you be might interested in scipy.signal.chirp.


text:
Q: using jsp to check username and password Hello i'm learning a bit JSP and i have a problem with the code below. I create one index.jsp file and try to run it with eclipse or directly with Tomcat 6.0. I always get a error for the line "if (name.equals("user") && password.equals("1234"))". The error is
java.lang.NullPointerException. I would be glad for any advise.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
          "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

  <title>Practice</title>

Practice

Please enter your name and the password.

<form method="post" action="">

Name
<input type="text" name="name" size="80" />

Password
<input type="text" name="password" size="80" />

<input type="submit" value="Send" />
<input type="reset" value="Reset" />

</form>

<%-- Testing name and password. --%>
<% String name = request.getParameter("name");
   String password = request.getParameter("password");
   if (name.equals("user") && password.equals("1234"))
     {
%>

Your Input is correct!

<%   }
   else if (!name.equals(""))
     {
%>

Please enter your name!

<%   }

   else if (!password.equals(""))
     {
%>

Please enter your password!

<%   }

   else if (!name.equals("") && !password.equals(""))
     {
%>

Please enter your name and your password!

<%   }

   else
     {
%>

Your input is not correct!

<%   }
%>

A: This is the wrong approach.
The JSP scriptlet code (the code in <% %> things) will always be executed immediately whenever the page is been requested, regardless of if it's been requested by a normal GET request (link, bookmark, etc) or a POST form submit.
On the initial request which should display the empty form, the code get executed as well and in an attempt to grab the request parameters, all it gets is null. Since you cannot invoke any methods on null, you will get a NullPointerException.
The easiest workaround to let it execute only on a form submit is to check if the request method is POST.
<%
    if (request.getMethod().equalsIgnoreCase("POST")) {
        // The form is been submitted. Put your code here.
    }
%>

Normally, when the form is submitted, the input fields which are not filled in will end up as empty strings, not as null. However, to make the code more robust, it's recommended to check for null anyway.
The correct solution to prevent NullPointerException is to check if the reference is not null before attempting to access it.
    if (name != null && !name.equals("user")) {
        // ...
    }

Alternatively, you can also wrap the references since "user" is guaranteed not null.
    if (!"user".equals(name)) {
        // ...
    }

However, scriptlets (raw Java code inside JSP files) are a bad practice. The normal practice is to let the form submit to a Servlet. You can then just override the doPost() method and write code there. You can learn anything about servlets in the [servlets] tag info page here.

A: This is not a direct answer to why your jsp is giving you null pointer exceptions, but one way you can avoid them in your code when doing string comparisons against string literals (which won't solve your situation in the long run is to do something like this:
if("1234".equals(password)){
...
}

This way if password is null you get a false instead of a NPE.


text:
Q: RegEx space between [a-z] and [0-9] I am almost there, but I'm stuck. I got this:
string99 <- c("Foo  /10", "Foo Bar 7 / 0", "FooBar 25 / 5", "I do 156 / ")
#> [1] "Foo /10"     "Foo Bar 7 / 0" "FooBar 25 / 5" "I do 156 / "
gsub("[^[:alnum:][:space:]]",",",string99)
#> [1] "Foo  ,10"      "Foo Bar 7 , 0" "FooBar 25 , 5" "I do 156 , "

but what I would like is to get this,
gsub(magic)
#> [1] "Foo, ,10"     "Foo Bar,7 , 0" "FooBar,25 , 5" "I do,156 , "

The extra white space± is not too important, as I'm reading with a read.csv from here, but that first comma, only when it's before a number is driving me up the wall. So, I need two commas in each string.
Update, Wiktor Stribiżew linked to some code below that gives this result:
gsub("^\\D*?\\K(?=\\d+|/)|[^[:alnum:][:space:]]",",",string99, perl=TRUE)
#> [1] "Foo  ,/10"      "Foo Bar ,7 , 0" "FooBar ,25 , 5" "I do ,156 , "

even closer, but there's some forward slash, /, happening in "Foo  ,/10", I guess it's about substituting that for a ,.

A: You may use
string99 <- c("Foo  /10", "Foo Bar 7 / 0", "FooBar 25 / 5", "I do 156 / ")
gsub("^([^\\d/]*)|[^[:alnum:][:space:]]","\\1,",string99, perl=TRUE)

or
gsub("^([^\\d/]*)|[^\\w\\s]","\\1,",string99, perl=TRUE)

See the R demo and a regex demo.
Pattern details

*

*^ - start of string

*([^\\d/]*) - Capturing group #1 (referenced to from the replacement pattern using the \1 placeholder): any 0+ chars other than digit and /

*| - or

*[^\\w\\s] - any non-word and non-whitespace char.


text:
Q: How do I improve this email address validation method? I have a form called sub_form with 2 inputs, one of the inputs is an email address, the other is a choice from a dropdown menu. The Javascript below checks if the email address is valid, and also prints the values of both the inputs to the console log.
The problem is, when an incorrect email is entered, it shows the error message but still prints to the console.
How can I fix this so that the inputs only print to console if a valid email is entered?

<!-- validator -->
$('#sub_form').bootstrapValidator({live: 'disabled',
 fields: {
 email: {
  validators: {
   emailAddress: {
     message: 'Invalid email' } }},}});

<!--print to console-->
document.getElementById('sub_form').onsubmit = function(){
       console.log(document.getElementById('email').value);
       console.log(document.getElementById('dropdown').value);
       return false;
}

A: Per my comment on the question, this validation library as far as I've been able to tell is an older version of the one here.  My company happens to use the same one, so I've been using that site a lot for reference.  Just replace mentions of the "formValidation" method with "bootstrapValidator", and events use the "bv" namespace instead of "fv".
The validator should provide some methods for checking its valid state.  You could use:
var validator = $('#sub_form').data('bootstrapValidator');
if (validator.isValidField('email')) {
  console.log(document.getElementById('email').value);
}

See here for more info.


text:
Q: Google Distance Matrix Api in accurate results I am implementing google.maps.DistanceMatrixService()
When I test I am getting a weird anomaly and it is not consistent. As I am driving towards to destination I am hitting a button that checks my distance. each time I hit the button it shows that my distance is getting closer (shorter) then out of the blue the distance jumps up (clearly not an accurate reading) as soon as I hit the button again it is back to normal.
Does anyone have any insight to this anomaly or issue?
here is my code. I am using Vue.js
googleMapsMatrix(lat1, lon1, lat2, lon2) {

    let origin = new google.maps.LatLng(lat2, lon2);
    let destination = new google.maps.LatLng(lat1, lon1);
    let service = new google.maps.DistanceMatrixService();

    service.getDistanceMatrix({
        origins: [origin],
        destinations: [destination],
        travelMode: 'DRIVING',
        // transitOptions: TransitOptions,
        // drivingOptions: DrivingOptions,
        unitSystem: google.maps.UnitSystem.IMPERIAL,
        // avoidHighways: Boolean,
        // avoidTolls: Boolean,
    }, (response, status) => (this.googleMatrixCallback(response, status, lat2, lon2) ));

},
googleMatrixCallback(response, status, lat2, lon2) {
    console.log(response, status, lat2, lon2)
}


text:
Q: Please help me to solve a task in combinatorics. Please help me to solve this task:
A)How many different 4 digit numbers is possible ti create from this digits: 1,2,4,5,7,8,9?
B)How many of them will be odd and even?

The answers is A)840 B)360,480
I got stuck with B I can;t understand how they got 360 and 480.

A: For a) The first digit can be any one of 7, the second is any one of remaining 6 etc. Thus the number of 4 digit numbers is $7 \times 6 \times 5 \times 4 = 840$. For b) the last digit has 4 choices (1,5,7,9). The other three digits can be filled in $6 \times 5 \times 4$. Hence the number of odd numbers is 480. Even numbers are remaining $840 - 480 = 360$.


text:
Q: No server runtime environment for GlassFish on eclipse kepler? I am using Eclipse Kepler and GlassFish tools plungin. After I upgraded the latest version of GlassFish tools (6.5.0.201405081811) and other eclipse components, the Server Runtime Environment for GlassFish is gone.
The Server Runtime Environment only has Apache, Basic, JBoss and ObjectWeb. I can't start up GF server in eclipse anymore.
I am using JDK1.6 to startup eclipse, I don't know whether this is the root cause.

A: I ran into this same problem.  Un-installing, then re-installing the glassfish tools did the trick for me.


text:
Q: Icons are not displaying in Android application I am complete newbie when it comes to Android applications. Please bear with me. I am trying to make an menu options bar but somehow the icons are not displaying.
I had looked for answers to this question on stackoverflow and the answer that I came across was "On Android 3.0+, the preferred approach for the options menu (a spillover menu in the action bar) will not show icons. If you have android targetSdkVersion of 11 or higher, icons will never show up in menus on Android 3.0+. The icons will show up if you promote an options menu item to be a toolbar button, and the icons will show up on Android 1.x/2.x devices." I am sorry but I am not sure what that means. Can someone please direct me in the right direction? Any help will be appreciated!
I am not sure what I am doing incorrectly. Here is my code so far.
MainActivity.java
package com.example.useoptionsmenu;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends Activity {

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.about:
    startActivity(new Intent(this, About.class));
    return true;
    case R.id.help:
    startActivity(new Intent(this, Help.class));
    return true;
    default:
    return super.onOptionsItemSelected(item);
    }
}

}

main.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

<item
    android:id="@+id/action_settings"
    android:orderInCategory="100"
    android:showAsAction="never"
    android:title="@string/action_settings"/>
<item
    android:id="@+id/about"
    android:showAsAction="always"
    android:orderInCategory="1"
    android:icon="@drawable/ic_action_about"
    android:title="About"/>
<item
    android:id="@+id/help"
    android:showAsAction="always"
     android:orderInCategory="2"
    android:icon="@drawable/ic_action_help"
    android:title="Help"/>

</menu>

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.useoptionsmenu"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="18" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.useoptionsmenu.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.useoptionsmenu.About"
        android:label="@string/title_activity_about" >
    </activity>
    <activity
        android:name="com.example.useoptionsmenu.Help"
        android:label="@string/title_activity_help" >
    </activity>
</application>

</manifest>

A: You have to add this to the item you want to display in the header:
    android:showAsAction="ifRoom"

so that your menu will be:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

<item
    android:id="@+id/action_settings"
    android:orderInCategory="100"
    android:showAsAction="ifRoom"
    android:title="@string/action_settings"/>
<item
    android:id="@+id/about"
    android:showAsAction="ifRoom"
    android:orderInCategory="1"
    android:icon="@drawable/ic_action_about"
    android:title="About"/>
<item
    android:id="@+id/help"
    android:showAsAction="ifRoom"
     android:orderInCategory="2"
    android:icon="@drawable/ic_action_help"
    android:title="Help"/>

</menu>

remove the line android:showAsAction="ifRoom" from the item you won't display in your header.


text:
Q: Background image does not extend to full width on tablet I am attempting responsive design.
Link here: http://truewizard.com.au/buildzone/v2/
I have attached an image of the issue from my nexus.
I think it may have something to do with this line of code:
 <meta name="viewport"
  content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />

Any ideaS?
CSS:
                body,html {
                padding:0px;
                margin:0px;
                height:100%;
                }
            body {
            background:#0f0f0f;
            font-family: "Calibri", Georgia, sans-serif;
            font-size:14px;
            line-height:30px;
            color:#bdbdbd;
            }

            a {
            text-decoration:none;

            }

            /* Clearfix */

            .clearfix:after {
                content: ".";
                display: block;
                clear: both;
                visibility: hidden;
                line-height: 0;
                height: 0;
            }

            .clearfix {
                display: inline-block;
            }

            html[xmlns] .clearfix {
                display: block;
            }

            * html .clearfix {
                height: 1%;
            }

            /*Header*/

            #title_bar #logo {
            float: left;
            }

            #title_bar #phone-number {
            float: right;
            }

            #banner {
            background:url(images/banner.jpg) no-repeat;
            }

            #banner .container {
            position:relative;
            }

            .learn_more {
            font-size:18px;
            display:inline-block;
            padding-right:15px;
            background:url(images/learn_more_arrow.png) no-repeat right center;
            }

            .learn_more a {
            color:#63d1ff;
            }

            /*service Tabs*/

            .tab_body {
            position:relative;
            }

            .tab_body img {
            margin:0 auto;
            display:block;
            position:relative;
            top:25%;
            }

            /*Main Wrap*/

            #main_wrap {
            padding-top:40px;
            }

            #quote_form {
            width:385px;
            height:409px;
            background:url(images/quote_form.jpg) no-repeat;
            padding:90px 40px 0 30px;
            }

            #quote_form input {
            width:276px;
            height:27px;
            background:#1f1e1e;
            border:1px solid #282828;
            color:#bdbdbd;
            }

            #quote_form textarea {
            background:#1f1e1e;
            border:1px solid #282828;
            width:272px;
            height:200px;
            }

            #quote_form #quote_form_submit {
            color:#bdbdbd;
            background:#3c3c3c;
            cursor:pointer;
            }

            #quote_form fieldset {
            border:0;
            }

            #quote_form td {
            padding:2px 0 2px 0;
            }

            #quote_form .quote_form_label {
            padding-right:20px;
            }

            .highlight_text {
            color:#25aae1;
            font-size:18px;
            }

            #main_wrap .highlight_text {
            margin:0;
            }

            h3 {
            color:#fff;
            margin:0;
            padding:0;
            font-size:14px;
            }

            .tab_title {
            text-align:center;
            height:37px;
            padding-top:5px;
            }

            #testomonials_box {
            height:433px;
            clear:both;
            }

            #testomonials_bg {
            height:331px;
            background:url(images/testomonials_box.jpg);
            }

            #clients_say {
            height:62px;
            padding-top:40px;
            }

            /*slideshow*/

            #slides {
            position:relative;
            height:331px;
            }

            .slides_container {
            height:273px;

            }

            .slides_container div {
            display:block;

            }

            .testomonial_text {

            margin-top:40px;
            text-align:center;
            }

            .testomonial_text p {
            text-align:right;
            padding-right:50px;
            }

            .pagination {
            margin:0;
            padding:0;
            height:11px;
            overflow:hidden;
            width:84px;
            margin:0 auto;
            }

            .pagination li {
            float:left;
            padding:0 5px 0 5px;
            list-style:none;
            }

            .pagination li a {
            background:url(images/pagination.png) no-repeat;
            width:11px;
            height:11px;
            display:block;
            padding-top:15px;
            }

            /*footer*/

            #footer {
            background:url(images/footer_bg.gif) repeat-x;
            height:400px;
            }

            @media screen and (min-width: 960px) {

                    #banner {
                    height:613px;
                    }

                    #refreshing_approach {
                    margin:50px auto 10px auto;
                    }

                    #desc {
                    color:#fff;
                    font-size:18px;
                    width:640px;
                    padding-left:60px;
                    }

                    .container {
                    width:960px;
                    margin:0 auto;
                    }

                    #title_bar {
                    height:67px;
                    background:#1f1f1f;
                    }

                    #service_tabs {
                    height:200px;
                    position:absolute;
                    /*top:413px;*/
                    top:413px;
                    }

                    #web_design_tab {
                    width:210px;
                    height:200px;
                    margin-right:40px;
                    float:left;
                    }

                    #web_design_tab img{

                    }

                    #print_design_tab {
                    width:210px;
                    height:200px;
                    margin-right:40px;
                    float:left;
                    }

                    #ecommerce_tab {
                    width:210px;
                    height:200px;
                    margin-right:40px;
                    float:left;
                    }

                    #internet_marketing_tab {
                    width:210px;
                    height:200px;
                    float:left;
                    }

                    .tab_title {
                    width:210px;
                    background:#1f1f1f;
                    }

                    .tab_body {
                    height:158px;
                    width:210px;
                    background:#2f2e2e;
                    }

                    #left_box {
                    float:left;
                    width:460px;
                    }

                    #right_box {
                    float:right;
                    width:460px;
                    padding:10px 0 30px 0;
                    }

                    .testomonial_text {
                    width:960px;
                    font-size:40px;
                    line-height:50px;
                    }

            }

            @media screen and (min-width: 760px) and (max-width:959px) {

                    #banner {
                    height:960px;
                    width:100%;
                    }

                    #refreshing_approach {
                    margin:80px auto 10px auto;
                    max-width:100%;
                    }

                    #desc {
                    color:#fff;
                    font-size:18px;
                    width:640px;
                    padding-left:60px;
                    }

                    .container {
                    width:760px;
                    margin:0 auto;
                    }

                    #title_bar {
                    height:67px;
                    background:#1f1f1f;
                    }

                    #service_tabs {
                    height:547px;
                    position:absolute;
                    top:500px;
                    width:680px;
                    margin:0 auto;
                    padding:0 40px 0 40px;
                    }

                    #web_design_tab {
                    width:320px;
                    height:200px;
                    margin-right:40px;
                    float:left;
                    margin-bottom:40px;
                    }

                    #print_design_tab {
                    width:320px;
                    height:200px;
                    margin-right:0px;
                    float:left;
                    }

                    #ecommerce_tab {
                    width:320px;
                    height:200px;
                    margin-right:40px;
                    float:left;
                    margin-bottom:40px;
                    }

                    #internet_marketing_tab {
                    width:320px;
                    height:200px;
                    margin-right:0px;
                    float:left;
                    }

                    .tab_title {

                    width:320px;
                    background:#1f1f1f;
                    }

                    .tab_body {
                    height:158px;
                    width:320px;
                    background:#2f2e2e;
                    }

                    #left_box {
                    padding:0 40px 0 40px;
                    }

                    #right_box {
                    padding:0 40px 0 40px;
                    }

                    #quote_form {
                    margin:50px auto;
                    }

                    .testomonial_text {
                    width:760px;
                    font-size:35px;
                    line-height:35px;
                    }

            }

A: If you want to stretch it use background-size:100% 100%. If it's not proportional with the original image then use one of the sizes on 'auto' - background-image:100% auto;

A: I know you're not asking for a javascript fix, but here is a sample I made that addresses what you need:
Fiddle Here
$(document).ready(function () {
    $('html').css({
        "background-size": $(window).width() + "px" + " " + $(window).height() + "px"
    });
    $('html').show();
});

$(window).resize(function () {
    $('html').css({
        "background-size": $(window).width() + "px" + " " + $(window).height() + "px"
    });
});

It grabs the screen size on load and resize and adjusts the background to fit.

A: Ok, the background image is on a div not in the body, and have a fixed height.
Consider using width: 100% and/or a display(block, or inline with float), on the #banner

A: The background image is too small to get fit in the screen, you need a bigger image of do repeat of the background image like :
background: url(images/banner.jpg) repeat;

A: Did you already tried to use responsive solutions such as AnyStretch: https://github.com/danmillar/jquery-anystretch ?
This issue happens because the device is trying to preserve the aspect ratio.