text:
Q: How can I retrieve all Tweets and attributes for a given user using Python? I am attempting to retrieve data from Twitter, using Tweepy for a username typed at the command line. I'm wanting to extract quite a bit of data about the status and user,so have come up with the following:
Note that I am importing all the required modules ok and have oauth + keys (just not included it here) and filename is correct, just been changed:
# define user to get tweets for. accepts input from user
user = tweepy.api.get_user(input("Please enter the twitter username: "))

# Display basic details for twitter user name
print (" ")
print ("Basic information for", user.name)
print ("Screen Name:", user.screen_name)
print ("Name: ", user.name)
print ("Twitter Unique ID: ", user.id)
print ("Account created at: ", user.created_at)

timeline = api.user_timeline(screen_name=user, include_rts=True, count=100)
    for tweet in timeline:
        print ("ID:", tweet.id)
        print ("User ID:", tweet.user.id)
        print ("Text:", tweet.text)
        print ("Created:", tweet.created_at)
        print ("Geo:", tweet.geo)
        print ("Contributors:", tweet.contributors)
        print ("Coordinates:", tweet.coordinates)
        print ("Favorited:", tweet.favorited)
        print ("In reply to screen name:", tweet.in_reply_to_screen_name)
        print ("In reply to status ID:", tweet.in_reply_to_status_id)
        print ("In reply to status ID str:", tweet.in_reply_to_status_id_str)
        print ("In reply to user ID:", tweet.in_reply_to_user_id)
        print ("In reply to user ID str:", tweet.in_reply_to_user_id_str)
        print ("Place:", tweet.place)
        print ("Retweeted:", tweet.retweeted)
        print ("Retweet count:", tweet.retweet_count)
        print ("Source:", tweet.source)
        print ("Truncated:", tweet.truncated)

I would like this eventually to iterate through all of a user's tweets (up to the 3200 limit). First things first though. So far though I have two problems, I get the following error message regarding retweets:
Please enter the twitter username: barackobamaTraceback (most recent call last):
  File " usertimeline.py", line 64, in <module>
    timeline = api.user_timeline(screen_name=user, count=100, page=1)
  File "C:\Python32\lib\site-packages\tweepy-1.4-py3.2.egg\tweepy\binder.py", line 153, in _call
    raise TweepError(error_msg)
tweepy.error.TweepError: Twitter error response: status code = 401
Traceback (most recent call last):
  File "usertimeline.py", line 42, in <module>
    user = tweepy.api.get_user(input("Please enter the twitter username: "))
  File "C:\Python32\lib\site-packages\tweepy-1.4-py3.2.egg\tweepy\binder.py", line 153, in _call
    raise TweepError(error_msg)
tweepy.error.TweepError: Twitter error response: status code = 404

Passing the username as a variable seems to be a problem also:
Traceback (most recent call last):
  File " usertimleline.py", line 64, in <module>
    timeline = api.user_timeline(screen_name=user, count=100, page=1)
  File "C:\Python32\lib\site-packages\tweepy-1.4-py3.2.egg\tweepy\binder.py", line 153, in _call
    raise TweepError(error_msg)
tweepy.error.TweepError: Twitter error response: status code = 401

I've isolated both these errors, i.e. they aren't working together.
Forgive my ignorance, I am not too hot with Twitter APIs but am learning pretty rapidly. Tweepy documentation really does suck and I've done loads of reading round on the net, just can't seem to get this fixed. If I can get this sorted, i'll be posting up some documentation.
I know how to transfer the data into an MySQL db once extracted (it will do that, rather than print to screen) and manipulate it so that I can do stuff with it, it is just getting it out that I am having the problems with. Does anyone have any ideas or is there another method I should be considering?
Any help really appreciated. Cheers
EDIT:
Following on from @Eric Olson's suggestion this morning; I did the following.
1) Created a completely brand new set of Oauth credentials to test.
2) Copied code across to a new script as follows:
Oauth
consumer_key = "(removed)"
consumer_secret = "(removed)"
access_key="88394805-(removed)"
access_secret="(removed)"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)
api=tweepy.API(auth)

# confirm account being used for OAuth
print ("API NAME IS: ", api.me().name)
api.update_status("Using Tweepy from the command line")

The first time i run the script, it works fine and updates my status and returns the API name as follows:
>>>
API NAME IS:  Chris Howden

Then from that point on I get this:
Traceback (most recent call last):
  File "C:/Users/Chris/Dropbox/Uni_2012-3/6CC995 - Independent Studies/Scripts/get Api name and update status.py", line 19, in <module>
    api.update_status("Using Tweepy frm the command line")
  File "C:\Python32\lib\site-packages\tweepy-1.4-py3.2.egg\tweepy\binder.py", line 153, in _call
    raise TweepError(error_msg)
tweepy.error.TweepError: Twitter error response: status code = 403

The only reason I can see for it doing something like this is that it is rejecting the generated access token. I shouldn't need to renew the access token should I?

A: If you're open to trying another library, you could give rauth a shot. There's already a Twitter example but if you're feeling lazy and just want a working example, here's how I'd modify that demo script:
from rauth import OAuth1Service

# Get a real consumer key & secret from https://dev.twitter.com/apps/new
twitter = OAuth1Service(
    name='twitter',
    consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',
    consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',
    request_token_url='https://api.twitter.com/oauth/request_token',
    access_token_url='https://api.twitter.com/oauth/access_token',
    authorize_url='https://api.twitter.com/oauth/authorize',
    base_url='https://api.twitter.com/1/')

request_token, request_token_secret = twitter.get_request_token()

authorize_url = twitter.get_authorize_url(request_token)

print 'Visit this URL in your browser: ' + authorize_url
pin = raw_input('Enter PIN from browser: ')

session = twitter.get_auth_session(request_token,
                                   request_token_secret,
                                   method='POST',
                                   data={'oauth_verifier': pin})

params = {'screen_name': 'github',  # User to pull Tweets from
          'include_rts': 1,         # Include retweets
          'count': 10}              # 10 tweets

r = session.get('statuses/user_timeline.json', params=params)

for i, tweet in enumerate(r.json(), 1):
    handle = tweet['user']['screen_name'].encode('utf-8')
    text = tweet['text'].encode('utf-8')
    print '{0}. @{1} - {2}'.format(i, handle, text)

You can run this as-is, but be sure to update the credentials! These are meant for demo purposes only.
Full disclosure, I am the maintainer of rauth.

A: You're getting 401 response, which means "Unauthorized."  (see HTTP status codes)
Your code looks good.  Using api.user_timeline(screen_name="some_screen_name") works for me in the old example I have lying around.
I'm guessing you either need to authorize the app, or there is some problem with your OAuth setup.
Maybe you found this already, but here is the short code example that I started from: https://github.com/nloadholtes/tweepy/blob/nloadholtes-examples/examples/oauth.py


text:
Q: Remove Keys in json array in PHP I have this
[{"cname":"NCPB"},{"cname":"NBK"}]

Which I'm getting from json_encode
on mysql result
How can I achive this  ["NCPB","NBK"]    From JSON OBJECT ABOVE.

A: I guess I can answer this without seeing your exact code. Basically, you're currently fetching your query results with something like this and using json_encode on the result of that:
while ($row = $query->some_fetch_method()) {
    $results[] = $row;               // you're building an array of associative arrays
}
echo json_encode($results);

Instead, just fill the results array with that specific column instead of the entire row.
while ($row = $query->some_fetch_method()) {
    $results[] = $row['cname'];      // you need to build an array of strings instead
}
echo json_encode($results);

You should get the array of query results into the format you want before you use json_encode. Otherwise, you'll have to decode the JSON string you just made, reformat the result of that, and reencode it:
 $json = json_encode(array_column(json_decode($json), 'cname'));

or use some weird regex or something. It doesn't seem to make sense to undo what you've already done, though.
If you don't get what I mean, edit your question to add the code that fetches your query results, and I'll show you an example based on your exact code, but this should give you the general idea.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Comparing fields to allow action I want to stop the user continuing if certain criteria are not met.
I have a table with a 'Quote Status' Field and a 'Customer PO Number' field. I want to make sure if the quote status is changed to "accepted" the Customer PO Number field is completed.
I tried various ways at various points of validation (field updates and user exits).
The basic code.
= IIf([Quote Status] = "Accepted" And [Customer PO Number] IsNull Then
 = MsgBox "Please complete Customer PO Number before setting Status to Accepted"

A: checking isnull would be IsNull(fieldName) and your If is wrong too.
try this
If([Quote Status] = "Accepted" And nz([Customer PO Number],"") = "") Then
    MsgBox "Please complete Customer PO Number before setting Status to Accepted"
End If

Note:
avoid having spaces in your field names.


text:
Q: How to dynamically add objects to scene? I have to write a program in which i should be able to click a button "add cube" and there will be added as many cubes as I want into the scene. I must be able to select any of them and move around. I managed to create one (hardcoded) cube and apply scaling and translation to it.
I tried to create a class "cube" and invoke intitialization and render as part of an object but didnt work as expected. Here is the working example for one cube and its transformations (note only the scaling and translation work)
HTML:

<head>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
  <title>Lab 0</title>

  <script id="vertex-shader" type="x-shader/x-vertex">

    attribute  vec4 vPosition;
    attribute  vec4 vColors;
    varying vec4 fragColor;

    uniform vec3 theta;
    uniform float coeff;
    uniform vec3 trCoeff;

    uniform mat4 modelView;
    uniform mat4 projection;

    vec3 angles = radians( theta );
    void main() {

      vec3 angles = radians( theta );
      vec3 c = cos( angles );
      vec3 s = sin( angles );

      // Remeber: thse matrices are column-major
      mat4 rx = mat4( 1.0,  0.0,  0.0, 0.0,
      0.0,  c.x,  s.x, 0.0,
      0.0, -s.x,  c.x, 0.0,
      0.0,  0.0,  0.0, 1.0 );

  mat4 ry = mat4( c.y, 0.0, -s.y, 0.0,
      0.0, 1.0,  0.0, 0.0,
      s.y, 0.0,  c.y, 0.0,
      0.0, 0.0,  0.0, 1.0 );

  mat4 rz = mat4( c.z, s.z, 0.0, 0.0,
      -s.z,  c.z, 0.0, 0.0,
      0.0,  0.0, 1.0, 0.0,
      0.0,  0.0, 0.0, 1.0 );

  mat4 sc = mat4(
    coeff, 0, 0, 0,
    0, coeff, 0, 0,
    0, 0, coeff, 0,
    0, 0, 0, 1
  );

  mat4 tr = mat4(
    1, 0, 0, 0,
    0, 1, 0, 0,
    0, 0, 1, 0,
    trCoeff.x, trCoeff.y, trCoeff.z, 1
  );

    fragColor = vColors;
    //projection * modelView *
    gl_Position =  tr * rz * ry * rx * sc * vPosition;
    }
  </script>

  <script id="fragment-shader" type="x-shader/x-fragment">
    precision mediump float;
    varying vec4 fragColor;

    void main() {
      gl_FragColor = vec4(fragColor);
    }
  </script>

  <script type="text/javascript" src="webgl-utils.js"></script>
  <script type="text/javascript" src="initShaders.js"></script>
  <script type="text/javascript" src="MV.js"></script>
  <script type="text/javascript" src="shape0.js"></script>
</head>

<body>
  <canvas id="gl-canvas" width="512" height="512">
    Oops ... your browser doesn't support the HTML5 canvas element
  </canvas>
</body>
<p> </p>
<button id="xButton">Rotate X</button>
<button id="yButton">Rotate Y</button>
<button id="zButton">Rotate Z</button>
<button id="stopButton">Stop Fucking Rotation</button>
<p> </p>

<button id="sUpButton">Scale Up</button>
<button id="sDownButton">Scale Down</button>
<p> </p>

<button id="leftButton">Left</button>
<button id="rightButton">Right</button>
<button id="upButton">Up</button>
<button id="downButton">Down</button>
<button id="closeButton">Closer</button>
<button id="furtherButton">Further</button>

<p> </p>
<button id="Button1">Increase Z</button>
<button id="Button2">Decrease Z</button>
<button id="Button3">Increase R</button>
<button id="Button4">Decrease R</button>

<p> </p>
<button id="Button5">Increase theta</button>
<button id="Button6">Decrease theta</button>
<button id="Button7">Increase phi</button>
<button id="Button8">Decrease phi</button>
<p> </p>

</html>

JS:
"use strict"

var canvas;
var gl;

var thetaRot = [10, 10, 10];
var thetaLoc;
var coeff = 1;
var coeffLoc;
var trCoeff = [0, 0, 0];
var trCoeffLoc;

var flag = true;
var axis = 0;

var xAxis = 0;
var yAxis = 1;
var zAxis = 2;

var near = 0.3;
var far = 3.0;
var radius = 4.0;
var theta = 0.0;
var phi = 0.0;
var dr = 5.0 * Math.PI / 180.0;

var fovy = 45.0;  // Field-of-view in Y direction angle (in degrees)
var aspect;       // Viewport aspect ratio

var mvMatrix, pMatrix;
var modelView, projection;
var eye;
const at = vec3(0.0, 0.0, 0.0);
const up = vec3(0.0, 1.0, 0.0);

var coord = {
  // For cube
  '1': vec3(0.1, 0.1, 0.1),
  '2': vec3(0.5, 0.1, 0.1),
  '3': vec3(0.5, 0.1, 0.5),
  '4': vec3(0.1, 0.1, 0.5),
  '5': vec3(0.1, 0.5, 0.1),
  '6': vec3(0.1, 0.5, 0.5),
  '7': vec3(0.5, 0.5, 0.5),
  '8': vec3(0.5, 0.5, 0.1),

}

var vertices = [
  // For cube
  coord[4], coord[3], coord[2],
  coord[2], coord[4], coord[1],
  coord[1], coord[2], coord[5],
  coord[5], coord[8], coord[2],
  coord[2], coord[3], coord[8],
  coord[8], coord[3], coord[7],
  coord[7], coord[3], coord[4],
  coord[4], coord[7], coord[6],
  coord[6], coord[4], coord[1],
  coord[1], coord[5], coord[6],
  coord[6], coord[7], coord[8],
  coord[8], coord[6], coord[5],

]

var colors = [
  // each face of the cube
  0, 0, 1, 1.0,
  0, 0, 1, 1.0,
  0, 0, 1, 1.0,
  0, 0, 1, 1.0,
  0, 0, 1, 1.0,
  0, 0, 1, 1.0,

  0, 1, 0, 1.0,
  0, 1, 0, 1.0,
  0, 1, 0, 1.0,
  0, 1, 0, 1.0,
  0, 1, 0, 1.0,
  0, 1, 0, 1.0,

  0, 0.7, 1, 1.0,
  0, 0.7, 1, 1.0,
  0, 0.7, 1, 1.0,
  0, 0.7, 1, 1.0,
  0, 0.7, 1, 1.0,
  0, 0.7, 1, 1.0,

  0.5, 0, 1, 1.0,
  0.5, 0, 1, 1.0,
  0.5, 0, 1, 1.0,
  0.5, 0, 1, 1.0,
  0.5, 0, 1, 1.0,
  0.5, 0, 1, 1.0,

  1, 0, 0, 1.0,
  1, 0, 0, 1.0,
  1, 0, 0, 1.0,
  1, 0, 0, 1.0,
  1, 0, 0, 1.0,
  1, 0, 0, 1.0,

  0.2, 0, 1, 1.0,
  0.2, 0, 1, 1.0,
  0.2, 0, 1, 1.0,
  0.2, 0, 1, 1.0,
  0.2, 0, 1, 1.0,
  0.2, 0, 1, 1.0,

]

// add vertices for cone

window.onload = init;

function init() {
  canvas = document.getElementById("gl-canvas");

  gl = WebGLUtils.setupWebGL(canvas);

  if (!gl) { alert("WebGL isn't available"); }

  aspect = canvas.width / canvas.height;

  var program = initShaders(gl, "vertex-shader", "fragment-shader");
  gl.useProgram(program);

  gl.enable(gl.DEPTH_TEST);

  var bufferId = gl.createBuffer();
  gl.bindBuffer(gl.ARRAY_BUFFER, bufferId);
  gl.bufferData(gl.ARRAY_BUFFER, 50000, gl.STATIC_DRAW);
  gl.bufferSubData(gl.ARRAY_BUFFER, 0, flatten(vertices));

  var vPosition = gl.getAttribLocation(program, "vPosition");
  gl.vertexAttribPointer(vPosition, 3, gl.FLOAT, false, 0, 0);
  gl.enableVertexAttribArray(vPosition);

  var bufferColor = gl.createBuffer();
  gl.bindBuffer(gl.ARRAY_BUFFER, bufferColor);
  gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(colors), gl.STATIC_DRAW);

  var vColors = gl.getAttribLocation(program, "vColors");
  gl.vertexAttribPointer(vColors, 4, gl.FLOAT, false, 4 * Float32Array.BYTES_PER_ELEMENT, 0);
  gl.enableVertexAttribArray(vColors);

  thetaLoc = gl.getUniformLocation(program, "theta");

  document.getElementById("xButton").onclick = function () {
    flag = false
    axis = xAxis;
  };
  document.getElementById("yButton").onclick = function () {
    flag = false
    axis = yAxis;
  };
  document.getElementById("zButton").onclick = function () {
    flag = false
    axis = zAxis;
  };
  document.getElementById("stopButton").onclick = function () {
    flag = true;
  };

  document.getElementById("sUpButton").onclick = function () {
    coeff += 0.1;
  };
  document.getElementById("sDownButton").onclick = function () {
    coeff -= 0.1;
  };

  document.getElementById("leftButton").onclick = function () {
    trCoeff[0] -= 0.1;
  };
  document.getElementById("rightButton").onclick = function () {
    trCoeff[0] += 0.1;
  };
  document.getElementById("upButton").onclick = function () {
    trCoeff[1] += 0.1;
  };
  document.getElementById("downButton").onclick = function () {
    trCoeff[1] -= 0.1;
  };
  document.getElementById("closeButton").onclick = function () {
    trCoeff[2] += 0.1;
  };
  document.getElementById("furtherButton").onclick = function () {
    trCoeff[2] -= 0.1;
  };

  modelView = gl.getUniformLocation(program, "modelView");
  projection = gl.getUniformLocation(program, "projection");

  document.getElementById("Button1").onclick = function () { near *= 1.1; far *= 1.1; };
  document.getElementById("Button2").onclick = function () { near *= 0.9; far *= 0.9; };
  document.getElementById("Button3").onclick = function () { radius *= 2.0; };
  document.getElementById("Button4").onclick = function () { radius *= 0.5; };
  document.getElementById("Button5").onclick = function () { theta += dr; };
  document.getElementById("Button6").onclick = function () { theta -= dr; };
  document.getElementById("Button7").onclick = function () { phi += dr; };
  document.getElementById("Button8").onclick = function () { phi -= dr; };

  coeffLoc = gl.getUniformLocation(program, "coeff");
  trCoeffLoc = gl.getUniformLocation(program, "trCoeff");

  render();
}

function render() {
  gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);

  if (!flag) {
    thetaRot[axis] += 2.0;
  }
  gl.uniform3fv(thetaLoc, thetaRot);
  gl.uniform1f(coeffLoc, coeff);
  gl.uniform3fv(trCoeffLoc, trCoeff);

  eye = vec3(radius * Math.sin(theta) * Math.cos(phi),
    radius * Math.sin(theta) * Math.sin(phi), radius * Math.cos(theta));
  mvMatrix = lookAt(eye, at, up);
  pMatrix = perspective(fovy, aspect, near, far);

  gl.uniformMatrix4fv(modelView, false, flatten(mvMatrix));
  gl.uniformMatrix4fv(projection, false, flatten(pMatrix));

  gl.drawArrays(gl.TRIANGLES, 0, vertices.length);

  requestAnimFrame(render);
}

I expect managing to add an infinite amount of object (or until I run out of ram) to the scene and to apply transformations to one at a time.

A: WebGL just draws pixels. It doesn't have a concept of a "Scene" and "objects". All of that is 100% up to you. How you represent objects and how you represent the scene is completely up to you. One example
const scene = [];

function addNewObjectToScene() {
  const obj = {
     x: Math.random() * 400,
     y: Math.random() * 400,
  };
  scene.push(obj);
}

Now add a button or a timer or whatever you want to call addNewObjectToScene
In your own code you'd have a render or drawScene function that goes over your "scene" and draws each object
function render() {
   for (const object of scene) {
     gl.useProgram(whateverShaderProgramCurrentObjectNeeds);

     // setBuffersAndAttributes for object
     // for each attribute in object
     //   gl.bindBuffer(gl.ARRAY_BUFFER, bufferForThisAttribute)
     //   gl.enableVertexAttribArray(locationForThisAttrubute);
     //   gl.vertexAttribPointer(locationForThisAttibute, other settings for this attribute)

     // set any uniforms. This is probably where you'd use x and y from the code above
     // example:
     //   gl.uniform2f(offsetUniformLocation, object.x, object.y);

     // now draw
     // gl.drawArrays or gl.drawElements with how ever many vertices are in the current object.

   }
}

How you organize your "scene" and what's in your objects is entire up to you. Three.js makes a scene from an object called THREE.Object3D each of which contains array of "children". This forms a scene graph.
Other apps do different things.
Being able to select one is also way too big a topic. What does "select" mean. Can you have an HTML <select> form where you pick from a dropdown list which object you want to select? Maybe there is an <input type="text"> element where you type the name of the object you want to select?
If you want to click on objects, well now you've got a way too broad of a topic to cover. You could store collision data for each object. You could compute the position of each triangle your data makes and see if the mouse hit. You could use GPU picking where you draw the scene with each object in a different color using different shaders and then look at the pixel under the mouse to see what color it is effectively telling you want object was chosen. But all of this is dependent on how you created your scene.
Suggest you read some tutorials on WebGL and on drawing multiple things and maybe a scene graph


text:
Q: HTML input for number and special text - user friendly In my html form the inputtag is supposed to be a number (so I specify number type), but some numbers have special meanings. Like the expiry in days input tag can have any number of days but if user wants to specify No Expiry I expect 0 as input so to convey that I show placeholder text
1, 2, 30, 0 (No Expiry) etc.

It doesn't seem user friendly as input can have some number initially, which hides the message and can confuse the user.
Also, I need to take input a number but also allow the user following value:
Unlimited
I don't want user to type this. What is best way to handle this?

A: Sounds like a dropdown would work if you don't have to use input tag. As you mentioned that you don't want user to type. So a simple dropdown would be like this:
<select>
  <option value="0">No Expiry</option>
  <option value="Unlimited">Unlimited</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <!-- more option -->
  <option value="3">3</option>
</select>

You can see the effect here: https://jsfiddle.net/nx1Lt86g/


text:
Q: What is the alternative for modern experience "most viewed item"? I know that classic experience has this option where you can see the most viewed items inside a document library.
What is the equivalent of this feature inside modern experience document library?
We have thousands of files, and only a few of them are frequently used. Views and filtering are used but don't really solve this problem.
Is there a way so the default of Document Library shows only the most used items and not thousands of other items that are rarely used?
Keeping in mind that I can't know which items are mostly used due to the fact that our Sharepoint online has a of of users

A: You can add a Highlighted Content Webpart to a modern page. with these settings:
Content

*

*Source: this site

*Type: Documents

*Document Type: any

Filter and sort

*

*Filter: leave blank

*Sort by: Most viewed

If you need to target specific library only, you can use these settings:

*

*Custom query

Query

*

*Source: This site

*Query text (KQL): ContentTypeId:0x0101* path:"https://contoso.sharepoint.com/Shared Documents/*"

*Sort by: Most viewed


text:
Q: jQuery - cannot get value of dynamically added checkbox Using php, I add checkboxes:

<input type="checkbox" name="team-members[]" value="5">

And I can get the id when the checkbox is selected:
$('input[name="team-members[]"]').click(function(){
    alert($(this).val());
});

I can add a checkbox to the array via ajax:

<input type="checkbox" name="team-members[]" value="9">

But when I click the dynamically added checkbox - the alert does not fire.
There are no js errors in the console.
How do I get the id of the new checkbox when it is clicked?

A: For all dynamically added elements you need to use the .on() method and not .click():

$(document).on('click', 'input[name="team-members[]"]', function() {
    alert($(this).val());
});

function addCheckBox() {
    let div = $('.member');
    let chkBx = document.createElement('input');
    chkBx.type = "checkbox";
    chkBx.name = "team-members[]";
    chkBx.value = "10";

    div.append(chkBx);
}

addCheckBox();

<input type="checkbox" name="team-members[]" value="5">

You can find a good explanation of why this is necessary here.


text:
Q: Bizzare behaviour of ESP32 websocket webserver when not connected to the internet I am working on a project that uses the ESP32 C3 dev board and runs a webserver with dns, and comunicates with the client via websocket. here is the arduino code (the part of it relevent to the webserver):
#include <math.h>
#include <Arduino.h>
#include <WiFi.h>
#include <WebServer.h>
#include <WiFiClient.h>
#include <time.h>
#include "SPIFFS.h"
#include <FS.h>
#include <EEPROM.h>
#include <ArduinoOTA.h>
#include <WiFiUdp.h>
#include <ESPmDNS.h>
#include <WebSocketsServer.h>
#include <DNSServer.h>
#include <NTPClient.h>
#include <Adafruit_NeoPixel.h>
#include <driver/adc.h>

WebServer server(8000);
DNSServer dnsServer;
WebSocketsServer webSocket = WebSocketsServer(81);
WiFiServer server2(80);
IPAddress apIPDNS(8,8,4,4);

IPAddress testIP1(192,168,1,4);
IPAddress testIP2(192,168,1,5);

WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP);

IPAddress apIP(192, 168, 4, 3);
IPAddress netMsk(255, 255, 255, 0);

uint8_t* data;

void onWebSocketEvent(uint8_t num,
                      WStype_t type,
                      uint8_t * data1,
                      size_t length) {

  // Figure out the type of WebSocket event
  switch(type) {
    // Client has disconnected
    case WStype_DISCONNECTED:
      Serial.printf("[%u] Disconnected!\n", num);
      break;

    // New client has connected
    case WStype_CONNECTED:
      {
        IPAddress ip = webSocket.remoteIP(num);
     //   Serial.printf("[%u] Connection from ", num);
     //   Serial.println(ip.toString());
      }
      break;

    // Echo text message back to client
    case WStype_TEXT:
          data = data1;
          parsedata();
      break;
    case WStype_BIN:
    case WStype_ERROR:
    case WStype_FRAGMENT_TEXT_START:
    case WStype_FRAGMENT_BIN_START:
    case WStype_FRAGMENT:
    case WStype_FRAGMENT_FIN:
    default:
      break;
  }
}

void setup() {
  Serial.begin(115200);
  EEPROM.begin(512);
  time_now = millis();

  WiFi.mode(WIFI_AP_STA);
  WiFi.softAPConfig(testIP1, testIP1, netMsk);
  WiFi.softAP(ssid, password);
  WiFi.hostname("esp32server");
  WiFi.begin(sta_ssid, sta_password);
  dnsServer.start(53, "*", WiFi.softAPIP());
  Serial.println("connecting to wifi1...");
  delay(6000);
   if(WiFi.status() == WL_CONNECTED) { current_connected_wifi = String(sta_ssid); current_connected_password = String(sta_password);Serial.println("connected to:" + current_connected_wifi);}
   else {WiFi.begin(sta_ssid2, sta_password2);delay(6000);Serial.println("connecting to wifi2...");

     if(WiFi.status() == WL_CONNECTED) {  current_connected_wifi = String(sta_ssid2); current_connected_password = String(sta_password2);Serial.println("connected to:" + current_connected_wifi);}
     else {WiFi.begin(sta_ssid3, sta_password3);delay(6000);
     Serial.println("connecting to wifi3...");

      if(WiFi.status() == WL_CONNECTED) {  current_connected_wifi = String(sta_ssid3); current_connected_password = String(sta_password3);Serial.println("connected to:" + current_connected_wifi);}
      else { Serial.println("NO INTERNET"); WiFi.disconnect();dnsServer.start(53, "*", WiFi.softAPIP());}
     }
   }

   SPIFFS.begin();
   MDNS.begin("espserver");

  server.on("/", handle_root);
  server.on("/Chart",HTTP_GET, handle_chart);
  server.on("/Style",HTTP_GET, handle_chartcss);
  server.on("/mark",HTTP_GET, handle_img);
  server.on("/nonet",HTTP_GET, handle_img2);
  server.on("/wifilogo",HTTP_GET, handle_img3);
  server.on("/adressip", handle_adressip);
  server.on("/maxcoff", handle_maxcoff);
  server.on("/request", handle_request);
  server.on("/mintime", handle_mintime);
  server.on("/maxtime", handle_maxtime);
  server.on("/dailychart", handle_dailychart);
  server.on("/hourlychart", handle_hourlychart);
   server.on("/monthlychart", handle_monthlychart);
  server.on("/cumulative", handle_cumulative);
  server.on("/monthly", handle_monthly);
  server.on("/SSIDnames", handle_SSIDnames);
  server.on("/getmaxenergy", handle_maxenergy);
  server.begin();
  webSocket.begin();
  webSocket.onEvent(onWebSocketEvent);
  server2.begin();
  MDNS.addService("http", "tcp", 80);
}

void loop() {
 WiFiClient client = server2.available();
 dnsServer.processNextRequest();
 server.handleClient();
  webSocket.loop();
  delay(20);
}

quick explenation:
when the ESP32 starts, it checks if it can connect to the internet with any of the 3 saved credentials from eeprom (sta_ssid, sta_password). If it manages to connect with any of them, the webserver can be accesed either when connecting to the wifi of the ESP or on the network that the ESP32 is connected to. When it is unable to find a a network it can only be accesed when connected to the wifi AP of the ESP32. The webserver is accesed from either 192.168.1.4:8000 or espserver.local:8000.
This works great regardless of internet access. When i connect to the webserver i send my html and javascript code to the client and then establish a websocket connection. When the esp doesnt have internet acces the websocket connection works fine, and packets get recieved within milieconds, worst case scenario a couple of them take 2 seconds to arrive.
HOWEVER, when the ESP is not connected to the internet, the packets get stuck on pending and take forever to arive (even 10 seconds), or dont arive at all. Its almost like the webserver is too busy, even tho it has far less to do compered to when it is connected to the internet.
My question is, do i have to use a special function to disconect the webserver from the internet (where WiFi.disconect() is not enough?) or how can I make the WebServer library work better to not lose any packets?
(i have tried using the asynch websocket library, however it does not work on my specific chipset (esp32 c3) so i have to make it work with this library)

A: I figured it out. the problem was as some people hinted, that the wifi status was 1, which meant it was constantly trying to reconnect (and using cpu time). I used WiFi.disconnect(true); to disconnect the wifi if it didnt connect to any network during setup. that solved the problem.


text:
Q: What were the objects Rey was salvaging in the Star Destroyer hangar? In The Force Awakens, Rey is shown salvaging components from cylindrical structures in a crashed Star Destroyer's hangar. Is there any information (cue the TFA Visual Dictionary, Incredible Cross-Sections, etc.) on the function of those components and what they're called?

A: UPDATE: According to the Force Awakens: Visual Dictionary they were "Capacitor Bearings". Quite why a capacitor needs a bearing isn't explained.

The script describes them as "various mechanisms"

A metal sheet is pulled open to reveal the wrapped up faceof A SCAVENGER, perhaps alien, in GOGGLES, FACE MASK and GLOVES.
  Backpack with a STAFF strapped to it. Uses TOOLS to remove various
  MECHANISMS from inside the wall. We are in an upside-down, canted
  CORRIDOR. The Scavenger finds a valuable piece, drops it in a SATCHEL.

The Junior novelisation is similarly enlightening, referring to them as "various components"

She hung on to the wall of a demolished destroyer and used her tools
  to wiggle free various components that rust hadn't devoured. The ship
  was a treasure trove of metal sheeting and military-grade tech that,
  if given a proper cleaning, could fetch Rey a meal or two at Niima
  Outpost.

The Official Novelisation is just about as forthcoming, noting that they're "small devices"

Wielding an assortment of tools, the scavenger was excising an
  assortment of small devices from one metal wall. One after another,
  bits of booty found their way into the satchel that hung below the
  slender figure.
When the satchel was full, the scavenger secured it shut and commenced
  a perilous descent, avoiding sharp projections and threatening gaps in
  the wall. Arriving at the bottom of the metallic canyon, the figure
  hefted a piece of larger salvage recovered earlier and then, laboring
  under the double load, headed toward a distant slit of sunlight.


text:
Q: Order of dates is not chronological in ggplot2 I'm trying to make a graph to depict a population over a period of time. However, the dates are not in chronological order. In the imported CSV the dates are all correct and in order. However, once the code below is run, the graph presented does not have the dates in the correct order. The starting date is in the middle and the ending date is on the left of the starting date. Is there any way I can fix it?
sumc <- aggregate(ex2$C, bu=list(ex2$Date, ex2$Temp), FUN=sum)
colnames(sumc) <- c("Date", "Temperature", "Individuals")
ggplot(data= sumc, aes(x=Date, y=Individuals, group=Temperature, colour=Temperature )) + geom_line() + theme(plot.title = element_text(face="bold")
    ,plot.background = element_blank()
    ,panel.background = element_blank()
    ,panel.grid.major = element_blank()
    ,panel.grid.minor = element_blank()
    ,panel.border = element_blank()
    ,axis.line = element_line(colour="black", size=1)
    ,axis.text.x = element_text(colour="black", size=10)
    ,axis.text.y = element_text(color="black", size=8)
    ,axis.title.x = element_text(colour="black", size=10, face="bold", vjust=-.2)
    ,axis.title.y = element_text(color="black", size=10, face="bold", vjust=1.2)
    ,legend.text=element_text(size=8))

This image is the population over time. But as you can see the dates on the x axis are incorrect and off:

A: Convert to a Date class:
sumc$Date = as.Date(sumc$Date, format = "%m/%d%/Y")

Then your same plotting code will work just fine.
See ?as.Date or strptime for details about the conversion or the format argument.

A: If your dates are imported in the correct order in the data frame, use
sumc$Date <- factor(sumc$Date, ordered = T)
prior to plotting. This will make them as ordered factors based on the order they appear, and ggplot will understand that it has to keep them that way.
Edit: if the dates are not ordered, you can order them and save to a vector:
dates <- unique(sort(sumc$Date))
sumc$Date <- factor(sumc$Date, labels = dates,  ordered = T)

A: Another way if your dates are imported in the correct order is to use
sumc$Date <- factor(sumc$Date, levels = unique(sumc$Date))

before plotting.


text:
Q: Having trouble interpolating a polynomial using Newton's Method Given the data:
Find an interpolating polynomial using Newton's method.
I am a bit confused on how to do this. I think it should be fairly simple.. Here is what I have so far:
$p_0(x) = -1$
$p_1(x) = p_0(x) + c(x_1 - x_0) \implies -1 + C(2 - 1)$
which $= -1 + C = \frac{-1}{3} \implies C = \frac{2}{3}$
so $p_1(x) = -1 + \frac{2}{3} x$ .. Is this the correct approach? & Also if it is, what is the next step?
would it be:
$p_2(x) = p_1(x) + C(x_2 - x_0)(x_2 - x_1)$
$p_2(x) = -1 + \frac{2}{3} x + C(2.5 - 1)(2.5 - 2)$ ? Then solve for $C$?
Thanks in advance

A: Following the method from our previous discussion, we use divided differences to find $p_4(x)=f[x_0]+f[x_1](x-x_0)+f[x_2](x-x_0)(x-x_1)+f[x_3](x-x_0)(x-x_1)(x-x_2)$
We know that $p(1)=-1=f[x_0]$, $p(2)=-1/3$, $p(2.5)=3/32$, $p(3)=4/3$, and $p(4)=25$.
$$p[1,2]=\frac{-1/3+1}{1}=\frac{2}{3}=f[x_1]$$
$$p[2,2.5]=\frac{3/32+1/3}{0.5}=\frac{41}{48}$$
$$p[2.5,3]=\frac{4/3-3/32}{0.5}=\frac{119}{48}$$
$$p[3,4]=\frac{25-4/3}{1}=\frac{71}{3}$$
$$p[1,2,2.5]=\frac{41/48-2/3}{1.5}=1/8=f[x_2]$$
$$p[2,2.5,3]=\frac{119/48-41/48}{1}=\frac{13}{8}$$
$$p[2.5,3,4]=\frac{71/3-119/48}{1.5}=\frac{113}{8}$$
$$p[1,2,2.5,3]=\frac{13/8-1/8}{2}=\frac{3}{4}=f[x_3]$$
$$p[2,2.5,3,4]=\frac{113/8-13/8}{2}=\frac{25}{4}$$
$$p[1,2,2.5,3,4]=\frac{25/4-3/4}{3}=\frac{11}{6}=f[x_3]$$
Thus, $p_4(x)=-1+\frac{2}{3}(x-1)+\frac{1}{8}(x-1)(x-2)+\frac{3}{4}(x-1)(x-2)(x-2.5)+\frac{11}{6}(x-1)(x-2)(x-2.5)(x-3)$
Verifying...
$p_4(1)=-1\,\checkmark$
$p_4(2)=-1+\frac{2}{3}(1)=-\frac{1}{3}\,\checkmark$
$p_4(2.5)=-1+\frac{2}{3}(1.5)+\frac{1}{8}(1.5)(0.5)=\frac{3}{32}\,\checkmark$
$p_4(3)=-1+\frac{2}{3}(2)+\frac{1}{8}(2)(1)+\frac{3}{4}(2)(1)(0.5)=\frac{4}{3}\,\checkmark$
$p_3(4)=-1+\frac{2}{3}(3)+\frac{1}{8}(3)(2)+\frac{3}{4}(3)(2)(1.5)+\frac{11}{6}(3)(2)(1.5)(1)=25\,\checkmark$


text:
Q: What is the derivative of $f (\mathrm X) = \mathrm X^3$? Let $E = M_{3}(\mathbb{R})$ and $f: E \rightarrow E$ which $f(X) = X^3$ is $f^{'}(X)H = 3X^2 H$ the derivative for this function?
I tried to prove that $r(H) \rightarrow 0$ where $r(H) = -X^3 + (X+H)^3 - 3X^2 H$ but i dont get in anywhere.

A: The directional derivative of $f (\mathrm X) = \mathrm X^3$ in the direction of $\mathrm V$ is
$$\lim_{t \to 0} \frac{1}{t} \left( f (\mathrm X + t \mathrm V) - f (\mathrm X) \right) = \lim_{t \to 0} \frac{1}{t}\left( (\mathrm X + t \mathrm V)^3 - \mathrm X^3 \right)$$
Since
$$(\mathrm X+ t \mathrm V)^3 = \mathrm X^3 + t (\mathrm X^2 \mathrm V + \mathrm X \mathrm V \mathrm X + \mathrm V \mathrm X^2) + t^2 (\mathrm X \mathrm V^2 + \mathrm V \mathrm X \mathrm V + \mathrm V^2 \mathrm X) + t^3 \mathrm V^3$$
we obtain
$$\lim_{t \to 0} \frac{1}{t} \left( f (\mathrm X + t \mathrm V) - f (\mathrm X) \right) = \mathrm X^2 \mathrm V + \mathrm X \mathrm V \mathrm X + \mathrm V \mathrm X^2$$
If $\mathrm X$ and $\mathrm V$ commute, then $\mathrm X^2 \mathrm V + \mathrm X \mathrm V \mathrm X + \mathrm V \mathrm X^2 = 3 \mathrm X^2 \mathrm V$.

A: If you're looking for a Fréchet derivative approach, we're looking for a bounded, linear map $A_X : E \to E$ that satisfies the following limit:
$$ \lim_{ V \to 0\text{ in } M_{3}(\Bbb{R})} \dfrac{\|f(X+V)-f(X)-A_{X}V \|_E}{\|V\|_E} = 0 $$
The argument of the limit can be re-written as: $$ \dfrac{\| X^2\color{red}{V} + X\color{red}{V}X + XV^2 + \color{red}{V}X^2 + VXV + V^3 - A_{X}V\|_{E}}{\|V\|_E} $$
We're looking for a map $A_X$ that's $\color{red}{ \text{linear in $V$} }$ so we can hazard a guess that: $$ A_{X}V = X^2V + XVX + VX^2 $$ By successive applications of the triangle inequality (in the numerator) and using the operator norm for a matrix that represents the linear map $\| \cdot \|_E = \| \cdot \|_{\text{op}}$ the result should follow.

 It'll help with cancellation where you want terms going to $0$ that for linear maps $A$ & $B$: $$ \| AB \|_{\text{op}} \leqslant \|A\|_{\text{op}} \|B\|_{\text{op}} $$


text:
Q: Move file after some process in Mule File must be moved after successful transaction

A: See https://docs.mulesoft.com/mule-user-guide/v/3.8/file-connector, there you find "Move to Pattern" and "Move to Directory".
The file is moved when close() is called on the stream (don't forget to switch streaming on).
You will need two small Java classes:

*

*The first has to replace the "byte array to String" and reads the stream to a String (whithout closing the stream). Apache commons has methods for this purpose.

*The second (behind your transactional, executed only when transaction was successfull) has to close to stream.

Store the stream in a flow variable, so you can return the String in the payload.
Bye the way: When you read the stream into the String, us the correct encoding.


text:
Q: Programming Java Enterprise and Spring. with SpringTool Suite Hello to the whole community.
I am a new beginner in programming Java EE and precisely with Spring.
I'm running Spring Tool Suite to create a Maven and Tomcat 7 application as Server but my Database is created with HSQLDB.
To be able to communicate with the data base via my application, I used hibernate but after the execution I get an error here:
{GRAVE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: No persistence units parsed from {classpath*:META-INF/persistence.xml}
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:750)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5110)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5633)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1694)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1684)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: No persistence units parsed from {classpath*:META-INF/persistence.xml}
    at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.obtainDefaultPersistenceUnitInfo(DefaultPersistenceUnitManager.java:655)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.determinePersistenceUnitInfo(LocalContainerEntityManagerFactoryBean.java:358)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:307)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
    ... 21 more

sept. 21, 2017 12:42:18 PM org.apache.catalina.core.StandardContext listenerStart
GRAVE: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: No persistence units parsed from {classpath*:META-INF/persistence.xml}
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:750)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5110)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5633)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1694)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1684)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: No persistence units parsed from {classpath*:META-INF/persistence.xml}
    at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.obtainDefaultPersistenceUnitInfo(DefaultPersistenceUnitManager.java:655)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.determinePersistenceUnitInfo(LocalContainerEntityManagerFactoryBean.java:358)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:307)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
    ... 21 more

sept. 21, 2017 12:42:18 PM org.apache.catalina.core.StandardContext startInternal
GRAVE: One or more listeners failed to start. Full details will be found in the appropriate container log file
sept. 21, 2017 12:42:19 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
AVERTISSEMENT: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [171] milliseconds.}

Persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="java.sun.com/xml/ns/persistence"; xmlns:xsi="w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="java.sun.com/xml/ns/persistence java.sun.com/xml/ns/persistence/persistence_2_0.xsd">;
<persistence-unit name="unit">
   <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
</persistence-unit>
</persistence>


text:
Q: Any good approximations for Stirling numbers? Are there any good approximations for Stirling numbers which are less computationally intensive? To be a bit more specific, assuming a particular parametrization of the generalized Stirling numbers:
$S(a,b;-1,-d,0)=\frac{1}{b!(-d)^b}\sum^{b}_{j=0}(-1)^{b-j}{b \choose j}\prod_{k=0}^{a-1}(k-jd)$
This is very computationally expensive. I know that we can replace all factorials/gammas using the Stirling approximation, but that only is a good asymptotic approximation. Any pointers, ideas, appreciated.


text:
Q: cant display the input value using jquery. I tried to get the value but there is nothing to show-up pls help me. thanks this is my code:
var nameid = $("#idname").val();
var fname = $("#fname").val();
var loc = $("#loc").val();

 this is the inputs:
<input type="text" name="fname"  id="fname" />
<input type="text" name="loc"  id="loc" />

when i alert the two input value it will return empty.

A: Your code is working.
Html:
<input type="text" name="fname"  id="fname" />
<input type="text" name="loc"  id="loc" />
<button id="btn">
Show entered
</button>

Js:
$("#btn").on("click", function(e){
    var fname = $("#fname").val();
    var loc = $("#loc").val();
    alert('fname='+fname);
  alert('loc='+loc);
});

Check jsFiddle.

A: <input type="text" name="fname"  id="fname" value="1" />
<input type="text" name="loc"  id="loc" value="2" />
$(function(){
var nameid = $("#idname").val();
var fname = $("#fname").val();
var loc = $("#loc").val();
alert(fname);
alert(loc);
})


text:
Q: Alternatives to classification trees, with better predictive (e.g: CV) performance? I am looking for an alternative to Classification Trees which might yield better predictive power.
The data I am dealing with has factors for both the explanatory and the explained variables.
I remember coming across random forests and neural networks in this context, although never tried them before, are there another good candidate for such a modeling task (in R, obviously)?

A: For multi-class classification, support vector machines are also a good choice. I typically use the the R kernlab package for this.
See the following JSS paper for a good discussion: http://www.jstatsoft.org/v15/i09/

A: I think it would be worth giving a try to Random Forests (randomForest); some references were provided in response to related questions: Feature selection for "final" model when performing cross-validation in machine learning; Can CART models be made robust?. Boosting/bagging render them more stable than a single CART which is known to be very sensitive to small perturbations. Some authors argued that it performed as well as penalized SVM or Gradient Boosting Machines (see, e.g. Cutler et al., 2009). I think they certainly outperform NNs.
Boulesteix and Strobl provides a nice overview of several classifiers in Optimal classifier selection and negative bias in error rate estimation: an empirical study on high-dimensional prediction (BMC MRM 2009 9: 85). I've heard of another good study at the IV EAM meeting, which should be under review in Statistics in Medicine,

João Maroco, Dina Silva, Manuela Guerreiro, Alexandre de Mendonça. Do
  Random Forests Outperform Neural
  Networks, Support Vector Machines and
  Discriminant Analysis classifiers? A
  case study in the evolution to
  dementia in elderly patients with
  cognitive complaints

I also like the caret package: it is well documented and allows to compare predictive accuracy of different classifiers on the same data set. It takes care of managing training /test samples, computing accuracy, etc in few user-friendly functions.
The glmnet package, from Friedman and coll., implements penalized GLM (see the review in the Journal of Statistical Software), so you remain in a well-known modeling framework.
Otherwise, you can also look for association rules based classifiers (see the CRAN Task View on Machine Learning or the Top 10 algorithms in data mining for a gentle introduction to some of them).
I'd like to mention another interesting approach that I plan to re-implement in R (actually, it's Matlab code) which is Discriminant Correspondence Analysis from Hervé Abdi. Although initially developed to cope with small-sample studies with a lot of explanatory variables (eventually grouped into coherent blocks), it seems to efficiently combine classical DA with data reduction techniques.
References

*

*Cutler, A., Cutler, D.R., and Stevens, J.R. (2009). Tree-Based Methods, in High-Dimensional Data Analysis in Cancer Research, Li, X. and Xu, R. (eds.), pp. 83-101, Springer.

*Saeys, Y., Inza, I., and Larrañaga, P. (2007). A review of feature selection techniques in bioinformatics. Bioinformatics, 23(19): 2507-2517.

A: As already mentioned Random Forests are a natural "upgrade" and, these days, SVM are generally  the recommended technique to use.
I want to add that more often than not switching to SVM yields very disappointing results. Thing is, whilst techniques like random trees are almost trivial to use, SVM are a bit trickier.
I found this paper invaluable back when I used SVM for the first time (A Practical Guide to Support Vector Classication) http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf
In R you can use the the e1071 package for SVM, it links against the de facto standard (in free software at least!) libSVM library.

A: It's important to bear in mind that there's no one algorithm that's always better than others. As stated by Wolpert and Macready, "any two algorithms are equivalent when their performance is averaged across all possible problems." (See Wikipedia for details.)
For a given application, the "best" one is generally one that is most closely aligned to your application in terms of the assumptions it makes, the kinds of data it can handle, the hypotheses it can represent, and so on.
So it's a good idea to characterise your data according to criteria such as:

*

*Do I have a very large data set or a modest one?

*Is the dimensionality high?

*Are variables numerical (continuous/discrete) or symbolic, or a mix, and/or can they be transformed if necessary?

*Are variables likely to be largely independent or quite dependent?

*Are there likely to be redundant, noisy, or irrelevant variables?

*Do I want to be able to inspect the model generated and try to make sense of it?

By answering these, you can eliminate some algorithms and identify others as potentially relevant, and then maybe end up with a small set of candidate methods that you have intelligently chosen as likely to be useful.
Sorry not to give you a simple answer, but I hope this helps nonetheless!

A: Its worth to take a look at Naive Bayes classifiers.  In R you can perform Naive Bayes classification in the packages e1071 and klaR.


text:
Q: Cassandra 1.1 - Setup for 24GB RAM and Row Cache I would like to tune Cassandra for heavy read scenario with skinny rows (5-50 columns). The idea is to use row cache, and enable key cache just in case - when data is to large for row cache.
I have dual Intel Xeon server with 24GB RAM (3 in ring, two data centers - gives 6 machines in total)
Those are changes that I've made to default configuration:
cassandra-env.sh
#JVM_OPTS="$JVM_OPTS -ea"
MAX_HEAP_SIZE="6G"
HEAP_NEWSIZE="500M"

cassandra.yaml
# do not persist caches to disk
key_cache_save_period: 0
row_cache_save_period: 0

key_cache_size_in_mb: 512
row_cache_size_in_mb: 14336
row_cache_provider: SerializingCacheProvider

The idea it to dedicate 6GB to Cassandra JVM, 0.5GB to key cache (out of 6GB heap), and 14GB to row cache as off-heap.
OS has still 4GB which should be enough, since there is running only one JVM process and it should have overhead of max 2GB.
Is this setup optimal? Any hints?
Thanks,
Maciej

A: I'm using 1.1.6 version.
SerializingCacheProvider will save cache data at Native Heap area.
That area is not for GC inspect. so It will not be occurred GC.
Your row_cache_size_in_mb setting is for SerializingCache's reference object.
That reference is saved using FreeableMemory(It is in 1.1.x. but after 1.2, it changed).
In other words, Your real cache value is not calculated when calculating row_cache_size_in_mb.
At the result If you want to calculate row_cache_size_in_mb, try to set from minimal size.
In my case, when I set 500mb, each node was using 2G old gen.(in according to deal which data set)

A: Run the heapspace_calculator and use the suggested value as an initial heap configuration. Monitor your heap usage with "nodetool info".
Try to use short column names and merge columns when possible.

A: This setup works just fine - I've tested it.


text:
Q: Use current year as range validation in DataAnnotations [Range(1900, DateTime.Now.Year, ErrorMessage = "Please enter a valid year")]

This doesn't work.  For "DateTime.Now.Year" it tells me
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

A: You can create your own RangeUntilCurrentYearAttribute that extends the RangeAttribute.
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public class RangeUntilCurrentYearAttribute : RangeAttribute
{
    public RangeUntilCurrentYearAttribute(int minimum) : base(minimum, DateTime.Now.Year)
    {
    }
}

And use it like this:
public class Foo
{
    [RangeUntilCurrentYear(1900, ErrorMessage = "Please enter a valid year")]
    public int Year { get; set; }
}

A: Modified from MSDN.
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public class YearRangeAttribute : ValidationAttribute
{
    private int m_min;
    private Range m_range;

    public YearRangeAttribute(int min)
    {
        m_min = min
        m_range = new Range(min, DateTime.Now.Year);
    }

    public override bool IsValid(object value)
    {
        return m_range.IsValid(value)
    }

    public override string FormatErrorMessage(string name)
    {
        return m_range.FormatErrorMessage(name);
    }
}

Disclaimer: This is untested, free-hand code.


text:
Q: use getObject() from forge-api npm, how to make the return result as a download link? I am using forge-api getObject() to download the excel from BIM360 hub. I set up express sever in the backend and make the call in the frontend.
I could get the result of the object and it looks like this:

So my question is:
How can I convert the result as a download link correctly? I could download the excel, but the excel can not be opened...

My code looks like this:
backend:

frontend:

A: I think all you need to modify in your backend code is to return content.body, instead of content
See e.g. https://github.com/Autodesk-Forge/forge-derivatives-explorer/blob/master/routes/data.management.js#L296
It might even be better if you generated a pre-signed URL for the file and passed that to the client. In that case, the file would not be downloaded to your server first and then to the client, but directly to the client in a single step.
https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectName-signed-POST/


text:
Q: finding highlighted(preselcted) text using xpath or css In following 2 snippets of html  code, I'm trying to create xpath or css for finding if span(Element1 in snippet 1 and Element 2 in snippet 2) are highlighted(preselected) when page is loaded
Snippet 1:

      Element1

Snippet 2:

    Element 2 Text

A: If the treSelected class attribute value denotes that it is preselected, then the following XPATH statement would work:
span[parent::li[contains(@class,'treSelected')]]

It will match on span elements who's parent is an li element that contains a class attribute that contains 'treSelected'.


text:
Q: prefix classes in angular ui-select I am using angular ui-select dropdown in my website. The theme I am using is selectize. During run time the elements are prefixed with either ui-select or selectize. Since I already have the styles existing for one page, the new select dropdown also takes the same styles. Is it possible to prefix the classes so that i can have different styles for each pages?

A: I'm not sure if it is possible to prefix the classes as you say, but you could use descendant css selectors to separate your styles.
.someContainerClass .ui-select {  }


text:
Q: Regex to read prop file entry does not capture group properly I have to parse a property file having key value pair and some of the lines may be commented (! or # , both are valid).
Exa:
key1 val1
Key2 val2
#key3 val3
 # key4 val4
# It does not have = symbol
# Spaces can be any where.
...

If line is not commented then read key and value as matcher's group values. I used following RegEx and code snippet but its not capturing keys and values as expected:
    String inputs[] = {
            "key1 val1",
            "Key2 val2",
            "#key3 val3",
            " # key4 val4"
    };

    Pattern PATTERN = Pattern.compile("^(\\s*[^#!]\\s*)(\\w*)\\s+(\\w*).*$");
    for (int i = 0; i < inputs.length; i++) {

        System.out.println("Input: " + inputs[i]);
        Matcher matcher = PATTERN.matcher(inputs[i]);
        if(matcher.matches()) {
            int groupCount = matcher.groupCount();
            if(groupCount > 0) {
                for (int j = 1; j <= groupCount; j++) {
                    System.out.println(j + " " +  matcher.group(j));
                }
            } else {
                System.out.println(matcher.group());
            }

        } else {
            System.out.println("No match found.");
        }
        System.out.println("");
    }

Here is the output:
Input: key1 val1
1 k
2 ey1
3 val1

Input: Key2 val2
1 K
2 ey2
3 val2

Input: #key3 val3
No match found.

Input:  # key4 val4
No match found.

My thinking was:
^           - Start of line
(\\s*[^#!]\\s*) - space(s) followed by NO # or ! followed by space(s)
(\\w*)      - Key
\\s+        - spaces(s)
(\\w*)      - Value
.*          - Anything
$           - End of line

Please help me to understand what is wrong here.
Why it's capturing first character of key as a group?

A: You don't have to check for no # or !. You can simply do: /^(?<key>\w+)\s*(?<value>.*)/gm
Javafied regex: ^(?<key>\\w+)\\s*(?<value>.*) (use the multiline option)
Demo+explanation: http://regex101.com/r/aM0xK1

A: I'm not gonna give you the solution, but I will give you the answers to your questions:
(\\s*[^#!]\\s*) <- this is why is capturing the first chracter. And you have 2 options:

*

*Use a non capturing group (?:Hi, im a non capturing group) (See the (?: ))
Ps: Using a non capturing group will increase the internal pointer of the regex, so it's not really what you want. So better use the second option.

*Use the lookbehind and watch if the character before X is a #!
As a third solution use Java Properties files With this pretty example.

A: Input: key1 val1
1 k
2 ey1
3 val1

this is correct based on your regex.
(\\s*[^#!]\\s*) this is the group1.

it means, matching a single character, not #, not !. there could be spaces before and after the character. so for the first line in your prop file. "k" is the character.
you may want to check negative look behind. it is Zero-Width Assertions.
for example like this: (group 2 would be the key)
^\s*(?!<#|!)\s*(\w*).....

hope it helps...


text:
Q: Código para abrir link nova aba com contador não tenho experiencia nenhuma com programação, gostaria de uma ajuda: encontrei esse código na internet:

Link vai expirar em...

mas esse código faz a função de redirecionar para o link informado após um tempo determinado no contador.
Eu gostaria de um código que abrisse o link informado numa nova aba, mantendo a aba atual aberta, após um tempo determinado no contador.
Desde já agradeço

A: Para abrir numa nova aba (ou pop-up) utilize o window.open:
window.open("https://google.com");

Pode ver mais informações em https://developer.mozilla.org/en-US/docs/Web/API/Window/open.

No seu caso inclua o window.open dentro da função redirecionar.

A: Um erro simples que notei neste código, é que o contador não para no momento em que chega a zero. E continua imprimindo na tela -1, -2, -3... Infinitamente.
O seu problema já foi solucionado pelos colegas, então vou citar apenas a parte do contador.
Crie uma condição para a sua função contar() já que ela é chamada pela função redirecionar, a cada 1 segundo. Um simples if checando se o contador é maior ou igual a zero já resolve, pois após chegar a zero será redirecionado, mas a função ainda iria chamar o contar(), porém como o contador seria menor que zero, então ele não cai mais dentro do seu if e não imprime mais na tela.
Segue função modificada:
function contar() {
    if (contador >= 0) {
        document.getElementById('contador').innerHTML = contador;
        contador--;
    }
}

Código completo:

Link vai expirar em...

A: Pra deixar tudo bem simples pra você, que não tem contato com programação.
Basta mudar o valor da variável seu_link, para o link que você deseja que seja aberto em uma nova guia.

Link vai expirar em...


text:
Q: Journey builder custom activity app accessing Data Extension field values dynamically I have a query regarding marketing cloud custom journey builder app.
This question might look similar and tried but the solution ins't working might be something wrong with my execution. Please correct me here.
Have created an custom app and tried accessing email address from DE through journey builder which was successful accessed but when trying to access other fields, I am not able to do so.
I cannot use DE name to access the fields, since DE and its columns can be different in multiple journeys.
So to solve this, I am asking user to give the column name in popup form text box, then on saving the journey by user customActivity.js is mapping the columns to access the fields given text box dynamically.
Here is my code in customActivity.js on save function to access email address which is working fine.
"email": "{{InteractionDefaults.Email}}"

similarly while access other fields it not working like for example.
"firstname": "{{InteractionDefaults.firstname}}"

* firstname is the exactly same column name in DE which is not accessible.

I believe, email address is accessible because journey builder setting in Default Email Address section where in I have to select email attribute from entry source (in my case DE)
Also I have done contact builder mapping with DE column.
Can you please help me with this issue and tell me the correct way to access other fields of DE through custom journey builder app without using the name of DE.
Thanks
Pritam More

A: Your assumption about the Interaction Defaults is correct. To access entry data you need the Journey/Interaction Context.
This developer documentation page describes how it works.
I hope this helps.


text:
Q: How to Generate Tables columns and rows in PHP from 2 arrays
Apologies to all those who might feel offended or pissed by my question we all learn everyday.
I want to be able to generate a table that will look like what i have in this picture from this two different arrays also shown on the table.
I can generate a normal table with a foreach loop but in this case it becoming confusing and i have not been able to try anything tangible.  So any help will be appreciated .
example raw array
$data1 = array(
     '0' => array('time'=> '1.00pm', 'reading' =>'271', 'machine'=>'machine1'),
     '1' => array('time'=> '2.00pm', 'reading' =>'261', 'machine'=>'machine1'),
     '2' => array('time'=> '3.00pm', 'reading' =>'172', 'machine'=>'machine1'),
     '3' => array('time'=> '4.00pm', 'reading' =>'300', 'machine'=>'machine1'),
     '4' => array('time'=> '5.00pm', 'reading' =>'142', 'machine'=>'machine1')
    );
$data2 = array(
     '0' => array('time'=> '1.00pm', 'reading' =>'500', 'machine'=>'machine2'),
     '1' => array('time'=> '2.00pm', 'reading' =>'432', 'machine'=>'machine2'),
     '2' => array('time'=> '3.00pm', 'reading' =>'109', 'machine'=>'machine2'),
     '3' => array('time'=> '4.00pm', 'reading' =>'44', 'machine'=>'machine2'),
     '4' => array('time'=> '5.00pm', 'reading' =>'18', 'machine'=>'machine2')
    );

so any help will be appreciated

A: Well, this answer contains all the tables
<?php
$data1 = array(
 '0' => array('time'=> '1.00pm', 'reading' =>'271', 'machine'=>'machine1'),
 '1' => array('time'=> '2.00pm', 'reading' =>'261', 'machine'=>'machine1'),
 '2' => array('time'=> '3.00pm', 'reading' =>'172', 'machine'=>'machine1'),
 '3' => array('time'=> '4.00pm', 'reading' =>'300', 'machine'=>'machine1'),
 '4' => array('time'=> '5.00pm', 'reading' =>'142', 'machine'=>'machine1')
);
$data2 = array(
 '0' => array('time'=> '1.00pm', 'reading' =>'500', 'machine'=>'machine2'),
 '1' => array('time'=> '2.00pm', 'reading' =>'432', 'machine'=>'machine2'),
 '2' => array('time'=> '3.00pm', 'reading' =>'109', 'machine'=>'machine2'),
 '3' => array('time'=> '4.00pm', 'reading' =>'44', 'machine'=>'machine2'),
 '4' => array('time'=> '5.00pm', 'reading' =>'18', 'machine'=>'machine2')
);

echo $data1[0]['machine'];
echo '
';
echo '
';
echo "Time	";
echo "reading	";
echo '
';

foreach ($data1 as $key => $value) {
  echo "
";
  echo "" . $value['time'] . "	";
  echo "" . $value['reading'] . "	";
  echo "
";
}

echo '
';

echo '
';
    echo $data2[0]['machine'];
    echo '
';
    echo '
';
    echo "Time	";
    echo "reading	";
    echo '
';

    foreach ($data2 as $key => $value) {
      echo "
";
      echo "" . $value['time'] . "	";
      echo "" . $value['reading'] . "	";
      echo "
";
    }
    echo '
';

    echo '
';

    echo '
';
            echo '
';

            echo "
";
            echo "machin	";
            foreach ($data1 as $key => $value) {
              echo "" . $value['time'] . "	";
            }
            echo "
";

            echo "
";
            echo "machine1	";
            foreach ($data1 as $key => $value) {
              echo "" . $value['reading'] . "	";
            }
              echo "
";

              echo "
";
              echo "machine2	";
                foreach ($data1 as $key => $value) {
              echo "" . $data2[$key]['reading'] . "	";
            }
            echo "
";
            echo '
';

            echo '
';

            echo '
';

                    echo '
';
                    echo '
';
                    echo "Time	";
                    echo "machine1	";
                    echo "machine2	";
                    echo '
';

                    foreach ($data2 as $key => $value) {
                      echo "
";
                      echo "" . $value['time'] . "	";
                      echo "" . $data1[$key]['reading'] . "	";
                      echo "" . $value['reading'] . "	";
                      echo "
";
                    }
                    echo '
';

                    echo '
';

 ?>

A: You can try this for the desired result
$header = ['machine','1.00pm','2.00pm','3.00pm','4.00pm','5.00pm'];
$html = "

";
for($i=0; $i<count($header); $i++){
  $html.= "".$header[$i]."	";
}
$html .= "
";
$res = [
    array_merge(
        array_unique(array_column($data1,'machine')),
        array_column($data1, 'reading','time')
    ),
    array_merge(
        array_unique(array_column($data2,'machine')),
        array_column($data2, 'reading','time')
    )
];
foreach($res as $key => $value){
 $html  .= "
";
 foreach($header as $ikey => $ivalue){
    $index = ($ivalue == 'machine') ? 0 : $ivalue;
    $html .= "".$res[$key][$index]."	";
 }
 $html  .= "
";
}
$html .= "
";

Pattern II.
$header = ['time','machine1','machine2'];
$html = "

";
for($i=0; $i<count($header); $i++){
  $html.= "".$header[$i]."	";
}
$res = [
  array_merge(
    array_column($data1, 'reading','time')
 ),
 array_merge(
    array_column($data2, 'reading','time')
 )
];
for($i=0;$i<count($res)-1;$i++){
    foreach($res[$i] as $key => $value){
     $html .= '
';
     $html .= ''.$key.'	';
     $html .= ''.$res[$i][$key].'	';
     $html .= ''.$res[$i+1][$key].'	';
    $html .= '
';
 }
}
echo $html;


text:
Q: Turning off or tuning the Higgs field What would happen to the Universe if we turned off the Higgs field?
(Remark: "turning off the Higgs field" means to set its v.e.v. to zero-today its value is about 246 GeV.)

*

*Would the Z,W bosons be massive?

*Would atoms form?

*Would vacuum energy be zero?

Bonus:  What advantages could we obtain if we could manipulate the Higgs field as we manipulate the electromagnetic field by tuning its v.e.v. as we wished? That is, imagine we were clever enough to change the Higgs v.e.v. to any finite value we wished. What could it be useful for?

A: The HIggs field appears with spontaneous symmetry breaking

The photon , the particle involved in the electromagnetic interaction, along with the W and Z provide the necessary pieces to unify the weak and electromagnetic interactions. With masses around 80 and 90 Gev, respectively, the W and Z were the most massive particles seen at the time of discovery while the photon is massless. The difference in masses is attributed to spontaneous symmetry breaking as the hot universe cooled. The theory suggests that at very high temperatures where the equilibrium kT energies are in excess of 100 GeV, these particles are essentially identical and the weak and electromagnetic interactions were manifestations of a single force. The question of how the W and Z got so much mass in the spontaneous symmetry breaking is still a perplexing one. The symmetry-breaking mechanism is called a Higgs field, and requires a new boson, the Higgs boson to mediate it.

So the question really asks if one can control the symmetry breaking energy , when the higgs field appears as the electromagnetic and weak coupling constants run into each other.
It is maybe good to think about an analogue in classical physics, a magnet:

When the magnet is strongly magnetized in one direction, it would be hard to guess that the underlying interaction is actually symmetric under rotation. The magnetic field from the magnet is certainly very different if it is rotated 90 degrees, or 180 degrees. The underlying symmetry can only be seen if the energy of the system is raised - heating the magnet to its Curie temperature would remove the directional magnetic field and restore the rotational symmetry of the material.

I find  that the Curie temperature can  be a function of directions :

In an anisotropic ferromagnet the Curie temperature is a function of the direction of the magnetization. The Curie temperature is high in easy directions, and can drop quite low in harder directions for an anisotropy energy comparable to the exchange energy. Magnetization curves as a function of temperature also depend upon the orientation. In sufficiently hard directions, the magnetization drops from a large value precipitously to zero at the Curie temperature.

This last allows one to imagine that the v.e.v. of 246GeV might be negotiable for some width, i.e. in some specific boundary conditions,  but the balances that lead to symmetry breaking have to hold in order to observe the world we observe and have encoded into the standard model. So turning off for the whole  universe will both not be possible or desirable ( well it did happen in the       Big Bang history at o.1 ns) .  Maybe some of these compactified dimensions from strings  would give a handle to explore changes in v.e.v. s  , if we ever are experimentally sure they exist  ;) and can experiment with them. (i.e. allow to modify the boundary conditions that define the electroweak parameters for some specific experiment)
At the moment we have to pursue higher energy experiments with leptons in order to get a handle with enough accuracy to explore differences in coupling constants while approaching the unification energy. This last for the electroweak unification into one coupling constant is at a scale of 10^12 GeV .

A: A phase transition has been predicted in many models. For details try.
http://arxiv.org/abs/1306.3234
It seems like this may be cancelled out though if Higgs bosons are made of techni-quarks.


text:
Q: PHP mp3 stream making trouble at joining point I have an audio stream, some audio file in hdd and some in online and code is,
<?php
ignore_user_abort(true);
set_time_limit(0);
$mime_type = "audio/mpeg";
header("Content-type: {$mime_type}");

$files[0] = "audio/abc def.mp3";
$files[1] = "http://www.bootstrap-template.com/templates/HTML5//300111377/audio/mp3/FrankSinatra-BarbaraStraizand-Crush.mp3";
$files[3] = "audio/ghij.mp3";
$files[4] = "http://193.111.141.116:8888/stream";
/*print_r(headers_list());
print_r(get_headers($files[3]));
print_r(getallheaders());
exit();*/
while (true)
{
    foreach ($files as $key => $value)
    {
        $filename = $value;
        if($fh = fopen("$filename","r"))
        {
            while (!feof($fh))
            {
                echo fgets($fh);
            }
            fclose($fh);
        }

    }
}

with Firefox it works fine (not in chrome and have not tested in other browsers) at the time of first song. It creates noise at the break point on 1st and second track and continues, at the time of 3rd track again it creates noise and not continues. There is nothing in error log. I am Using HTML5 player.
purpose of this script is, to make stream running if $file[4] stops

A: you can use html5 player to play your files. in chrome use there builtin flash player uc browser as same. in Firefox use adobi flash. in this coz you can't play your files.


text:
Q: Mismatch function header  submitButton.addTarget(self, action: (self.submitButtonDown(_: , completion:  )), for: .touchUpInside)

results in Expected expression in list of expressions
function is
func submitButtonDown(_ sender: AnyObject?, completion: (Bool) -> Void) {

Should I include the closure inside for it to work?

A: The addTarget method is asking for a selector (not a block or function reference) so you cannot use it the way you're trying to.
The easiest way to trigger a callback on button tap is to assign the callback block to an instance variable and invoke that from a standard button tap handler.
var onTapCallback: ((success: Bool) -> Void)?

func submitButtonDown(_ sender: AnyObject?) {
    self.onTapCallback?(true)
}


text:
Q: why "knife zero converge " request password I've set -x root ,why zhengdong@192.168.10.181,and requst password,
I also tried knife zero bootstrap 192.168.10.181 -x root -i ~/.ssh/id_rsa --sudo
it doesn't work
Screenshot shared below:

A: If your SSH key(s) are not accepted it will fall back to a password automatically.


text:
Q: Tool for determining performance bottleneck I am using my early 2011 MacBook Pro for iOS development, Photoshop work, and the like, and it is at times quite sluggish. Is there a tool that I can just run for a day, and then look at the statistics it produces to identify the performance bottleneck?
I am considering either buying more RAM (I have 8 currently, would get 16) or an SSD (I currently have the stock HDD).

A: The tools I would use are:

*

*Activity Monitor

*Instruments (run from Xcode)

*vm_stat 900

*io_stat 900

*top -u -s 900

*sysdiagnose - shift+control+option+command+. (or run sudo sysdiagnose)

The two stat commands and top all run in a terminal window and snapshot 15 minute intervals of activity. The stat ones log the statistics. I'd run the sysdiagnose command sparingly, perhaps once at the start of the period, once when the OS seems exceptionally slow and once at the end.
The easiest to manage is Activity monitor and I'd focus on making sure nothing is occupying the CPU that you don't feel should be taking a lot of resources and the balance of RAM - what percentage is wired what percentage is wired+active.

A: The bottleneck of your system is HIGHLY specific to the application of your Mac. Here are some examples:

*

*A video game rig is almost always bottled necked by the graphics
card, as video games don't require much disk access or CPU computing.

*Casual use, like loading applications and files, is likely
bottlenecked by file access speed.

*Development and A/V production requires a mix of most computer specifications, but there isn't an "automatic" application to determine it for you.
Here is how I would determine the bottleneck:

*

*Take a look at your RAM usage. A nice free way to do so is opening Activity Monitor, right clicking the dock icon, and selecting "Show Memory Usage" under the "Dock Icon" sub-menu. If your RAM (excluding "inactive" memory) is frequently high (for example, 80%), then perhaps it'd be worth upgrading. If you only ever used half of your 8GB of RAM, adding on 8 more GB wouldn't impact performance.

*Similarly, keep an eye on your disk activity (from activity monitor). Benchmark your Mac's HDD (so you learn it's Read/Write max speeds) and compare the disk activity you observe to the maximum capability of the drive. If you frequently hit the max, then perhaps it's SSD upgrade time.

I would recommend the SSD upgrade. Apart from the obvious file I/O speed boost, if you use too much memory, your SSD would make for much better swap space than your current HDD.


text:
Q: Azure Logic app - Twilio connector How to configure Twilio connector with HTTP listener in azure for to invoke messaging service

A: Please elaborate your question (is there any problem occurs?), because Twilio connector can be connected just with the Key/Password.
If you need to invoke Mobile App, then you should add HTTP Listener with the needed verb selected (get,post, etc).


text:
Q: How to get popup on button click via plugin at admin side in Magento 2
I have "New Add Product" button at Sales->Order->Create New Order
which I added through plugin.
My di is at: etc/adminhtml
As
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<type name="Magento\Sales\Block\Adminhtml\Order\Create\Items">
    <plugin name="vendor-module-order-create-items-block" type="Vendor\Module\Plugin\Order\Create\Items" sortOrder="100" />
</type>
</config>

My plugin class is:
class Items
{
public function afterGetButtonsHtml(\Magento\Sales\Block\Adminhtml\Order\Create\Items $subject, $result)
{
    $url = 'http://www.google.com';
    $result .= $subject->getLayout()->createBlock(
            \Magento\Backend\Block\Widget\Button::class
        )->setData(
            ['label'=>'New Add Products', 'type'=>'button', 'id'=> 'add_new_products', 'class' => 'action-secondary action-add', 'on_click'=>"window.location.href='" . $url . "'"]
        )->toHtml();
    return $result;
}
}

I want to create popup like this on 'New Add Products' button click (This is in M1)

I need to know how to add popup code in plugin class? as there are many solutions available but mostly are executed by template files.


text:
Q: No se visualiza la imagen guardada desde Ckeditor 4 en laravel 9 Estoy utilizando la libreria Ckeditor4 en laravel con el plugin easyimage para subir la imagen mas fácil, no el que trae por defecto ckeditor.
El problema que tengo es que a la hora de visualizar la imagen que he guardo en el campo de ckeditor no la muestra
Ejemplo: guardo un registro

*

*En el servidor si guarda la imagen:

*En el campo de la BD donde guardo los datos de ckeditor en la imagen guarda la ruta de la imagen errada y con una palabra "blob" al principio de la ruta, la verdad no se su significado.

*Al visualizar lo guardado desde la interfaz y abro consola me muestra estos errores:

Mis rutas:
<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Evento\AnalisisController;
use App\Http\Controllers\CKEditorController;

        Route::group(['middleware' => ['role:Admin|Lider|Coordinador']], function () {

            Route::prefix('analisis')->group(function () {

                Route::get('/form-analisis{evento}', [AnalisisController::class, 'formGestionar'])->name('eventos.form-gestionar');
                Route::get('/form-grabar{evento}', [AnalisisController::class, 'formGrabar'])->name('eventos.form-grabar');
                Route::post('/gestionar', [AnalisisController::class, 'gestionar'])->name('eventos.gestionar');
                Route::post('/grabar', [AnalisisController::class, 'grabar'])->name('analisis.grabar');
                Route::post('ckeditor/upload', [CKEditorController::class,'upload'])->name('ckeditor.image-upload');
                Route::get('/ver/{analisis}', [AnalisisController::class, 'verAnalisis'])->name('analisis.show');

            });
        });

Este es el formulario donde capturo los datos con el ckeditor:
<form action="{{ route('eventos.gestionar') }}" method="POST" autocomplete=off enctype="multipart/form-data">
   @csrf
   {{-- probando con ckeditor --}}

            Descripción en orden cronológico de lo sucedido *

            <textarea class="form-control" name="descripcion_londres"></textarea>

         <input type="hidden" name="evento_id" value="{{ $evento->id }}">
         <button type="submit" class="btn btn-success col-xs-4" id="guardar">Guardar</button>
         Cancelar

</form>

Controlador donde guardo los datos:
use Illuminate\Http\Request;
use App\Models\ProtocoloLondres;

public function gestionar(Request $request)
{
    if ($request->descripcion_londres != null) {

        $protocolo_londres              = new ProtocoloLondres();
        $protocolo_londres->descripcion = $request->descripcion_londres;
        $protocolo_londres->save();

    }
}

Controlador donde guardo la imagen que recibo en ckeditor
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class CKEditorController extends Controller
{
    public function upload(Request $request)
    {
        if ($request->hasFile('upload')) {

            //get filename with extension
            $filenamewithextension = $request->file('upload')->getClientOriginalName();

            //get filename without extension
            $filename = pathinfo($filenamewithextension, PATHINFO_FILENAME);

            //get file extension
            $extension = $request->file('upload')->getClientOriginalExtension();

            //filename to store
            $filenametostore = $filename.'_'.time().'.'.$extension;

            //Upload File
            $request->file('upload')->move('public/img/eventos', $filenametostore);

            $CKEditorFuncNum = $request->input('protocolo_londres');
            $url = asset('public/img/eventos/'.$filenametostore);
            $message = 'File uploaded successfully';
            $result = "";

            // Render HTML output
            @header('Content-type: text/html; charset=utf-8');
            echo $result;
        }
    }
}

Código para ver el registro guardado desde la interfaz:
 {{-- probando con ckeditor --}}

                                Descripción en orden cronológico de lo
                                    sucedido
                                <textarea class="form-control" name="descripcion_londres" id="descripcion_londres" rows="3"> {!! $analisis->descripcion_londres !!}</textarea>

He investigado y no encuentro la solución.


text:
Q: Python brentq problems I'm using lmfit to find confidence intervals for a fit but it keeps giving me an error every so often: ValueError: f(a) and f(b) must have different signs
Here is a minimal working example (run it a few times to get the error):
import lmfit
import numpy as np

def residual(p, X):
        a1, a2, t1, t2 = [i.value for i in p.values()]
        return a1*np.exp(-x/t1)+a2*np.exp(-x/t2)-y

if __name__ == '__main__':
    x = np.linspace(0.3,10,100)
    y = 3*np.exp(-x/2.)-5*np.exp(-x/10.)+0.2*np.random.randn(x.size)
    p = lmfit.Parameters()
    p.add_many(('a1', 5), ('a2', -5), ('t1', 2), ('t2', 5))
    mi = lmfit.minimize(residual, p, args=(x,))
    lmfit.printfuncs.report_fit(mi.params, show_correl=False)
    ci, trace = lmfit.conf_interval(mi, sigmas=[0.68,0.95], trace=True, verbose=False)
    lmfit.printfuncs.report_ci(ci)

Why does it do this? Is there a work around?
Thanks

A: I don't know a specific answer or workaround.
I would report it as an issue https://github.com/lmfit/lmfit-py/issues .
The confidence intervals are calculated by finding the point at which the profile likelihood equals a value. This requires to find the zero or root of a nonlinear function.
This method provides usually more accurate confidence intervals than relying on the local derivatives, like scipy's curve_fit for example.
It is in general tricky to specify bounds for scipy's brentq that work for all cases. My guess is that the default bounds are too tight for your example.
I only have a general idea about the method but don't know the specific code in lmfit.


text:
Q: How do inject array of implementations into constructor in PHP How do inject array of implementations into class through constructor. I am sharing the link which is c#. I want to achieve the same in php.
How to achieve same in php.
public interface IFoo { }
public class FooA : IFoo {}
public class FooB : IFoo {}

public class Bar
{
    //array injected will contain [ FooA, FooB ]
    public Bar(IFoo[] foos) { }
}

public class MyModule : NinjectModule
{
    public override void Load()
    {
        Bind<IFoo>().To<FooA>();
        Bind<IFoo>().To<FooB>();
        //etc..
    }
}

https://stackoverflow.com/a/13383476/1844634
Thanks in advance.

A: PHP does not support generics duo to run-time performance difficulty.
So there are no way to explain that you expect all interfaces via definition of contractor. So you have to configure DI container manually. To explicitly tell that your class needs all classes that support some kind of interface.
Laravel for configuration use ServiceProvider to do all kind of configuration:
In the class \App\Providers\AppServiceProvider you can configure creation of your class.

    public function register(): void
    {
        // to configure implementation for an interface or abstract class
        // you can only configure one implementation for interface
        $this->app->bind(\App\IFoo::class, \App\FooA::class);

        // or 'tag' several implementation for one string tag.
        $this->app->tag([\App\FooA::class, \App\FooB::class], \App\IFoo::class);

        $this->app->bind(\App\Bar::class, function(\Illuminate\Contracts\Foundation\Application $container){
            // get all tagged implementations
            $foos = $container->tagged(\App\IFoo::class);

            return new \App\Bar($foos);
        });
    }

A:
You may need to use Tagging. For example,
  perhaps you are building a report aggregator that receives an array of
  many different Report interface implementations. After registering the
  Report implementations, you can assign them a tag using the tag
  method:

$this->app->bind('App\Reports\MemoryReportInterface', 'App\Reports\MemoryReportImplementation');
$this->app->bind('App\Reports\SpeedReportInterface', 'App\Reports\SpeedReportImplementation');

$this->app->tag(['App\Reports\MemoryReportInterface', 'App\Reports\MemoryReportInterface'], 'reports');

Once the services have been tagged, you may easily resolve them all
  via the tagged method:

$this->app->bind('ReportAggregator', function ($app) {
    return new ReportAggregator($app->tagged('reports'));
});

Usage
<?php

namespace ...;

/**
 *
 */
class ReportAggregator
{
    private $reports;

    function __construct($reports)
    {
        $this->reports = $reports;
    }

    public function getReports() {
        return $this->reports;
    }
    //...
}


text:
Q: I am looking forward to ....? (followed by a Gerund)? I know, that

I am looking forward to hearing from you.

is correct.
But I am not sure, if this holds also for other verbs?
So is

I am looking forward to taste your cookies.

or is

I am looking forward to tasting your cookies.

correct?

A: It is indeed. In each case, you need an object, so you need a noun or noun phrase:

I am looking forward to the holidays.

So in order to make a verb serve you must use the gerund.

I am looking forward to taking some time off.


text:
Q: _Static_assert with __has_include I wanna make macro, that checks that file is "includable".
Something like this:
#define CHECK(__file)    \
    _Static_assert( __has_include(__file), "Error")
CHECK("header.h");

But it produces errors like
f.c:28:3: __has_include must be used within a preprocessing directive
f.c:28:3: Implicit declaration of function '__has_include' is invalid in C99
f.c:28:3: Static_assert expression is not an integral constant expression

Is this even possible? Or maybe there is different solution that will give similar result?
Thanks for any help!

A: If all fails (and you can hardly argue with: "__has_include must be used within a preprocessing directive"), throw another layer of indirection at it:
h_assert(){
    for h; do
printf '
#if !__has_include("%s")
_Static_assert(0,"__has_include(\"%s\")");
#endif
' "$h" "$h"
    done
}
h_assert foo.h bar.h baz.h #Generate the header assertions with a POSIX shell


text:
Q: How to delete row at dynamic tableView Swift Here is my problem. I have a users array, and im checking if user phone number is in address book i want to show user in tableView.
 override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

    return users.count
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) as! UserCell

    let user = users[indexPath.row]
    let contact = searchForContactUsingPhoneNumber(phoneNumber: user.phoneNumber!)
    if contact == true {
        cell.textLabel?.text = user.name
        cell.detailTextLabel?.text = user.phoneNumber
        cell.backgroundColor = UIColor(r: 35, g: 35, b: 35)
        cell.textLabel?.textColor = UIColor.white
        cell.detailTextLabel?.textColor = UIColor.white

        if let profileImageUrl = user.profileImageUrl {
        cell.profileImageView.loadImageUsingCacheWithUrlString(profileImageUrl)

        } else {
            tableView.deleteRows(at: [indexPath], with: .automatic)
            tableView.reloadData()
        }
    }
    return cell
}

Here is what i have. Its deleting a user row if phone number is NOT in address book but it leaves white row instead.

A: You shouldn't modify the number of cells in the table, or reload the tableview, in your cellForRowAt. It's better to filter the users array first and use the resulting, filtered array as the data source instead.
Sort of like
let usersWithPhoneNumbers = users.filter { $0.profileImageUrl != nil && searchForContactUsingPhoneNumber(phoneNumber: $0.phoneNumber!) }

and then use the usersWithPhoneNumbers array in your numberOfRows and cellForRow methods instead.


text:
Q: Java: why Thread.sleep() and yield() are static? Why sleep() and yield() methods are defined as static methods in java.lang.Thread class?

A: If you call the yield or sleep method, it applies to whichever thread is currently executing, rather than any specific thread - you don't have to specify which thread is currently running to free up the processor.
similar thread in this forum

A: The code would only execute when someXThread was executing, in which case telling someYThread to yield would be pointless. So since the only thread worth calling yield on is the current thread, they make the method static so you won't waste time trying to call yield on some other thread.

A: The same reason is why stop() and suspend() methods are deprecated. Intrusion in thread's state from outside is dangerous and can cause unpredictable result. And if sleep is not static, for example, how do you think interruption from it will happen?

A: They are static so that overriding concept can be avoided i.e.
When they are called with parent class reference to hold child class object like situation it implements Method Hiding concept and not overriding due to Static method nature, i.e parent class(here thread class) method will run which have the complete functionality of sleep and yield.
http://i.stack.imgur.com/goygW.jpg

A: This is because whenever you are calling these methods, those are applied on the same thread that is running.
   You can't tell another thread to perform some operation like, sleep() or wait. All the operation are performed on the thread which is being executed currently.

A: Both sleep and yield methods are native. To understand better from above answers I made two classes ClassA and ClassB with same static method. I invoked method of other class to check its behavior. So we can call other class' static method.
So may be there is other reason behind making sleep method static.
public class ClassA {

    public static void method(){
        System.out.println("Inside ClassA method");
    }

    public static void main(String[] args) {
        method();
        ClassB classb = new ClassB();
        classb.method();
    }
}

    public class ClassB {
    public static void method(){
        System.out.println("Inside ClassB method");
    }

}

A: I know I am late to this party, (blame my parent :-))
I would like to answer this using proof by contradiction.
Let's say sleep method is not static so you can call sleep on any other thread object.
Let's say there are two threads, thread A and thread B. Now consider two possible scenarios in the context of sleep method, the same applies to yield as well.

*

*System having single processor has only one thread active at a time, so if thread A calls sleep on thread B object i.e. B.sleep(), B is not in execution, as currently executing thread is thread A, so calling sleep on non-executing method is pointless.

*A responsible programmer would never define sleep inside a synchronized block, or when a thread is holding a lock. But let's say thread A calls sleep method on thread B just when thread B is holding a lock(or inside a synchronized block), thread B would go to sleep holding lock which is totally undesirable.

These are just a few situations which forced jvm to not allowed thread to call sleep on another thread obect.