text:
Q: How should I UpdateOne multiple values with a form? This is where I want to try to edit every single value, using a single bottom to send all the data.
ack.imgur.com/S5jg1.png
This is my form. My idea was to put a hidden input value that every document has, DescripcionBusqueda.
<form
  action="/EdicionMaterialesPost"
  method="POST"
  enctype="multipart/form-data"
>
  <% for (var a = 0; a < materiales.length; a++) { %>

      <%=materiales[a].Descripcion%>
      <input
        type="text"
        class="form-control"
        placeholder="Descripcion"
        id="Descripcion"
        name="Descripcion"
      />
      <input
        type="hidden"
        class="form-control"
        id="DescripcionBusqueda"
        name="DescripcionBusqueda"
        value="<%=materiales[a].Descripcion%>"
      />

      <%=materiales[a].Codigo%>
      <input
        type="text"
        class="form-control"
        placeholder="Codigo"
        id="Codigo"
        name="Codigo"
      />

      <%=materiales[a].Unidad%>
      <input
        type="text"
        class="form-control"
        placeholder="Unidad"
        id="Unidad"
        name="Unidad"
      />

      <%=materiales[a].PrecioUnitario%>
      <input
        type="number"
        class="form-control"
        placeholder="PrecioUnitario"
        id="PrecioUnitario"
        name="PrecioUnitario"
      />

      <%=materiales[a].Familia%>
      <input
        type="text"
        class="form-control"
        placeholder="Familia"
        id="Familia"
        name="Familia"
      />

      <%=materiales[a].SubFam%>
      <input
        type="text"
        class="form-control"
        placeholder="SubFam"
        id="SubFam"
        name="SubFam"
      />

  <% } %>
  <button type="submit" id="sendMessageButton">Guardar Cambios</button>
</form>

And here is where I try to UpdateOne, I was thinking about using a for "With the "descriptionBusqueda" as index 0, will only UpdateOne documents (req.body.Myinputname) with index 0". And input without value won't be changed... but everything becomes chaos.
Can I have some help with my logic?
const material = require('../models/materiales.js');
const path = require('path');

module.exports = async (req, res) => {
  for (i = 0; i < req.body.DescripcionBusqueda.length; i++) {
    await material.updateOne(
      { Descripcion: req.body.DescripcionBusqueda[i] },
      {
        $set: {
          Descripcion: req.body.Descripcion[i],
          Codigo: req.body.Codigo[i],
          Unidad: req.body.Unidad[i],
          PrecioUnitario: req.body.PrecioUnitario[i],
          Familia: req.body.Familia[i],
          SubFam: req.body.SubFam[i],
        },
      },
      { upsert: false }
    );
  }

  res.redirect('/');
};

Example of my doc
_id ObjectoId('6396d947f3a8a9fa8c3c7727')
Descripcion:"Angulo 1/8" x 1 1/4" de 6.10 mts. (1.50 kg/mt)"
Codigo:"AA-03"
Unidad:"Pza."
PrecioUnitario:260.84
Familia:"Aceros"
SubFam:"Angulos"
__v:0

A: You will have to check the form for changed data and programmatically construct the $set component of the update.  Your logic with the iteration is correct; there is no way (with update()) to update a bunch of different docs in MongoDB with different variations of $set in one call.   Your logic will end up something like the following.   If you don't have marker vars like DescripcionCHANGED that is OK; you will just have to compare before-and-after versions using your hidden vars.

    for(i=0; i<req.body.DescripcionBusqueda.length;i++){
        var sdoc = {};
        if(req.body.DescripcionCHANGED[i]) {
          sdoc['Descripcion'] = req.body.Descripcion[i]
        }
        if(req.body.CodigoCHANGED[i]) {
          sdoc['Codigo'] = req.body.Codigo[i]
        }
        if(req.body.UnidadCHANGED[i]) {
          sdoc['Unidad'] = req.body.Unidad[i]
        }
        //  etc. etc.....

        material.updateOne(
                {Descripcion:req.body.DescripcionBusqueda[i]},
                {$set: sdoc},
                { upsert: false });
    }


text:
Q: Python NLTK: generate() function cannot be used I shouldn't be getting this error. This has worked before and any tutorial goes over this in the same way and it works. Please help.
import nltk
from nltk.book import *

text3.generate()

AttributeError                            Traceback (most recent call last)
<ipython-input-2-e0816ba18b61> in <module>()
----> 1 text3.generate()

AttributeError: 'Text' object has no attribute 'generate'

print sys.version #my python version
2.7.8 |Anaconda 2.0.1 (x86_64)| (default, Aug 21 2014, 15:21:46)
[GCC 4.2.1 (Apple Inc. build 5577)]

A: The fourth note in the first online chapter of the NLTK book says that:

The generate() method is not available in NLTK 3.0 but will be
  reinstated in a subsequent version

redpajama_set_name: RedPajamaStackExchange


text:
Q: Enabling a button from another form and closing the form I have Form1 and Form2
Form1 I have a button that is disabled, but if I click on the menustrip on Form1 I go to Form2. On Form2 I log into a database. After I logged in successfully, I want Form2 to close and I want the button on Form1 to be enabled.
Here is my code:
private void button1_Click(object sender, EventArgs e)
{
    SqlConnection connection = new SqlConnection(@"...");
    SqlCommand command = new SqlCommand("SELECT * FROM UserT WHERE UserName ='" +
        textBox1.Text + "' AND password ='" +
        textBox2.Text + "'",
        connection);

    connection.Open();
    SqlDataReader reader = null;
    reader = command.ExecuteReader();
    if (reader.Read())
    {
        MessageBox.Show("Welcome " + reader["UserName"].ToString());
        Form1 lfm = new Form1();
        lfm.button1.Enabled = true;
        Form2 fm = new Form2();
        fm.Close();
    }
    else
    {
        MessageBox.Show("Username and password " +
            textBox1.Text + "does not exist");
    }
}

A: Open your second form using ShowDialog, then use the DialogResult returned by the ShowDialog Function to enable the Button in your first form when you close the second form

A: You are creating new instance of the Form1. Don't do that, instead you need to show the Form2 as dialog and set the dialog result as OK.
Like this
Form1 -
Button1_Click()
{
Form2 frm2 = new Form2();
if(frm2.ShowDialog() == DialogResult.OK)
{
button1.Enabled = true;
}
}

or
button1.Enabled = form2.ShowDialog() == DialogResult.OK;

And in the Form2, after successful login set the DialogResult as OK.
if(reader.Read())
{
DialogResult = DialogResult.OK;
Close(); //It may not required.
}

A: You should not create another anstances of Form1 and Form2. Instead, you shoud have a public property of Form1, so you can enable your button. like shown in the code below :
//Form 2
public Form1 MyMainForm {get; set;}

private void button1_Click(object sender, EventArgs e)
{
    //Your code ...

    if (reader.Read())
    {
        MessageBox.Show("Welcome " + reader["UserName"].ToString());

        MyMainForm.button1.Enabled = true;

        //If you are already id Form2
        this.Close();
    }
    else
    {
        MessageBox.Show("Username and password " +
            textBox1.Text + "does not exist");
    }
}

And you set this MyMainForm when calling the Form2 from Form1. Like this :
Form2 f = new Form2() {MyMainForm = this};

PS : The access modifier of you button shoud be public.


text:
Q: Microservice Communication: Enforce RPC? I have the opinion that each method in a service should only do one small step of a larger task, delegate a result to the successive step/method and terminate. No matter if this next method lives in the same service or not, it is always triggered via inter-service routing (message queue, service discovery + REST call, whatever ...) and thus perhaps handled by a different instance. Never should the method be called directly by default, unless selectively enabled.
I know, network communication is slower by orders of magnitude and complex tasks with a lot of steps will run milliseconds slower, but this is the only way I see that ensures that

*

*each step is implemented stateless so that it can - if needed - be replaced in a different technology with no overhead

*failure handling is least expensive as waiting for a response or doing a successive step in the same process increases the chance to loose intermediate step results if that process dies for whatever reason

*definite failure rate is reduced as it is easier and more predictable to implement a standardized failure handling centrally than on method level

Do you think I'm overseeing something and what is your opinion?

A: The downside to using the message queue for communication between smaller and smaller functions is that the 'orchestration' of those messages becomes more and more complex.
What you gain by having smaller units of code to test and debug you lose in the opaqueness of the routing of the various messages.

*

*What happens if message X times out or is received twice?

*Should services A and B both listen for message Y?

*We have upgraded service C, how many legacy messages are in the pipeline prior to it that need to be processed before we can switch off the old version?

*Something happens to the message queue server/service, maybe an AWS availability zone goes down? how does this affect our in-progress chains of communication.

At some point this complexity becomes more than the saving you make with the shorter code.
I am generally in favour of Message Queues and Routing. But I've seen it taken to the n'th degree a couple of times and there is definitely a point where it becomes unmanageable, even if it seems super cool and all working when you first develop it.
If anything the error handling is much more complex than a simple in process method call. I'm surprised you pick that out as a positive.


text:
Q: Dynamically created nested Div's not rendering JavaScript I have a piece of JavaScript which is meant to be dynamically creating a nested set of Div's in my application. The parent Div is being created just fine, however the inner Div is not rendering at all.
Any help would be great!
JavaScript:
function createWindow()
{
    var note_window = document.createElement("div");
    note_window.setAttribute("id", "note_window");
    note_window.setAttribute("class", "notification-window");
    note_window.style.visibility = 'visible';

    var title = document.createElement("div");
    title.setAttribute("id", "title");
    title.setAttribute("class", "col-md-12");
    title.innerHTML = "Notifications";
    note_window.appendChild(title);

    var navbar = document.getElementById("navbar");
    navbar.appendChild(note_window);
}

Rendered HTML:

    Text

Desired HTML:

    Text

        More Text

EDIT:
Thanks for your help guys, I have partly answered my own question...
Further down in my code there is another function which edits the contents of note_window.
    if (document.getElementById("note_window") == null)
    {
        createWindow();
        if (getNotifications() == null) {
            note_window.innerHTML = "Text"
        }
    }

When I comment out the code for setting the innerHTML, both Div's render correctly... Now the question is... Why!?

A: Are you looking for this?

var note_window;
var title;
function createWindow()
{
    note_window = document.createElement("div");
    note_window.setAttribute("id", "note_window");
    note_window.setAttribute("class", "notification-window");
    note_window.style.visibility = 'visible';
    //note_window.innerHTML = "Text";

    title = document.createElement("div");
    title.setAttribute("id", "title");
    title.setAttribute("class", "col-md-12");
    title.innerHTML = "Notifications";
    note_window.appendChild(title);

    var navbar = document.getElementById("navbar");
    navbar.appendChild(note_window);
}

function getNotifications() {
  return null;
}

if (document.getElementById("note_window") == null)
    {
        createWindow();
        if (getNotifications() == null) {
          var text = document.createTextNode('Text');
          title.parentNode.insertBefore(text, title);
        }
    }

some content

A: Or this (in case everything needs to be created dynamically via JavaScript):
http://plnkr.co/edit/3pNmY3UnqbgZWpSFVH66?p=preview
function createWindow()
    {
        var note_window = document.createElement("div");
        var title = document.createElement("div");
        var navbar = document.createElement("div");

        note_window.setAttribute("id", "note_window");
        note_window.setAttribute("class", "notification-window");
        note_window.style.visibility = 'visible';

        title.setAttribute("id", "title");
        title.setAttribute("class", "col-md-12");
        title.innerHTML = "Notifications";

        navbar.setAttribute("id", "navbar");
        note_window.appendChild(title);
        navbar.appendChild(note_window);
        document.getElementsByTagName('body')[0].appendChild(note_window);
    }

And the HTML markup

A: Your code seems to be working for me, I've just modified the text to match to your example.  I have a jsfiddle https://jsfiddle.net/yye4dsqm/3/
function createWindow() {
  var note_window = document.createElement("div");
  note_window.setAttribute("id", "note_window");
  note_window.setAttribute("class", "notification-window");
  note_window.style.visibility = 'visible';
  note_window.innerHTML = 'Text';
  var title = document.createElement("div");
  title.setAttribute("id", "title");
  title.setAttribute("class", "col-md-12");
  title.innerHTML = "More Text";
  note_window.appendChild(title);

var navbar = document.getElementById("navbar");
  navbar.appendChild(note_window);
}

createWindow();

A: Seems so simple now...
In my edit I mention that I am setting the innerHTML of the parent DIV, this is then overriding the entire child DIV with text. Setting a break point after the initial creation shows the elements rendered correctly.
I wasn't seeing it before as I was only looking at the elements after the call had been made to set the innerHTML.
Thanks guys!
Outside perspective always helps! :)


text:
Q: How to organize some Utils files in AngularJS to call from app.config? I need to configure AngularJS - set default $http headers. In my case i need to generate some of them. To make this i need to call some reusable function from Utils service.
As app.config doesn't support services injection how can i organize my code to enable this injection?
app.service('Utils', function(){
    this.generateGuid(){}
});

app.config(['Utils', function(Utils){
    //...
}]);

Or should i create my own custom js files with raw functions?

A: If the Utils service doesn't require any other services, you could write it as a provider like this:
app.provider('Utils', function () {
  this.generateGuid = function () {};

  this.$get = function () {
    return this; // a provider instance and service instance will be the same object.
  };
});

then inject a provider instance in app.config:
app.config(function (UtilsProvider) {
    UtilsProvider.generateGuid();
});

to use in app.run() or controllers, just inject a service instance as usual:
app.controller('FooController', function (Utils) {
    Utils.generateGuid();
});

Hope this helps.


text:
Q: Control of running Thread using multiple threading concept of java I just want to start and stop the thread when return key is pressed.
Here thread is stopped fine but i cant Start that thread again please help.
Also explain me the use of volatile keyword .Is it helpful for me to over come this problem.
public class Sync extends Thread{

    public boolean meth= true;
    public void run(){
        while(meth){
            System.out.println("hello");
            try {

                Thread.sleep(1000);
            } catch (InterruptedException ex) {

            }
           }
    }
    public void shutdown(){
       meth=false;
    }
    public void startup(){
        meth=true;
    }

}

MAIN CLASS``
    package com.Sync;

import java.util.Scanner;

public class SyncMain {
    public static void main(String[] arg) throws InterruptedException{
        Sync hi= new Sync();
        hi.start();
        System.out.println("press enter to stop");

        Scanner d= new Scanner(System.in);

        d.nextLine();
        hi.shutdown();
        System.out.println("press enter to start");
        d.nextLine();
        hi.startup();

    }

}

OUTPUT
   run:
press enter to stop
hello
hello
hello
hello

press enter to start

BUILD SUCCESSFUL (total time: 6 seconds)

A: Thread's are not re-entrant, that is, once they exit the run method, they can't be restarted, you need to create a new instance.
One solution would be to create a new instance of Sync and start it, but a  better solution, based on you code might, be to use a wait lock to "pause" the thread and the allow it to resume, for example...
public static class Sync implements Runnable {

    private AtomicBoolean keepRunning = new AtomicBoolean(true);
    private AtomicBoolean pause = new AtomicBoolean(false);

    private ReentrantLock lckPause = new ReentrantLock();
    private Condition conPause = lckPause.newCondition();

    public void run() {
        while (keepRunning.get() && !Thread.currentThread().isInterrupted()) {
            while (pause.get() && !Thread.currentThread().isInterrupted()) {
                lckPause.lock();
                try {
                    System.out.println("Paused");
                    conPause.await();
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
                } finally {
                    lckPause.unlock();
                }
            }
            if (!Thread.currentThread().isInterrupted()) {
                System.out.println("hello");
                try {

                    Thread.sleep(1000);
                } catch (InterruptedException ex) {

                }
            }
        }
    }

    public void setPaused(boolean paused) {
        if (pause.get() != paused) {
            pause.set(paused);
            if (!paused) {
                lckPause.lock();
                try {
                    conPause.signal();
                } finally {
                    lckPause.unlock();
                }
            }
        }
    }

    public void terminate() {
        keepRunning.set(false);
        setPaused(false);
    }

}

This basically sets up two loops, one to keep the thread running until it's "terminated" and one to trap the "pause" condition...
Then you could do something like...
public static void main(String[] args) {
    Sync hi = new Sync();
    Thread t = new Thread(hi);
    t.start();

    Scanner d = new Scanner(System.in);
    System.out.println("press enter to pause");
    d.nextLine();
    hi.setPaused(true);
    System.out.println("press enter to resume");
    d.nextLine();
    hi.setPaused(false);
    System.out.println("press enter to terminate");
    d.nextLine();
    hi.terminate();

    try {
        t.join();
    } catch (InterruptedException ex) {
        ex.printStackTrace();
    }

    System.out.println("Has terminated");
}

to simply run it...
You should note that it's generally discouraged to extend directly from Thread  and it is generally encouraged to use a separate Runnable, there are many reasons, but one which you will find most useful in future is Runnable is more widely supported in different parts of the API (like the Executors API) making it a much more flexible option
Have a look at the Concurrency Trail for more details, in particular Lock Objects


text:
Q: How to test changing effects of climate change in two different periods of forest growth I want to model the effect of different climate change predictor variables (drought, heatwaves...) in two different rates of change (response variables) of forest growth (periods: year1990 - year2000, year2000 - year2010). A total of three differente censuses were developed to obtain de data (1990, 2000, 2010) The main hypothesis is that those variables of climate change are affecting differently in those two rates of changes.
I'd like to know if somebody has a suggestion about how to create a model, or maybe two different models, to test how these variables are affecting the response variable and if the climate change variables changed between periods.
Thanks in advance.


text:
Q: Tokio select macro conditions and arm evaluation I have a code that needs to be read from several TcpStream. One of these TcpStream will always be there, but another may or may not.
I wrote the code before and (naively) used conditions on tokio select macro. Unfortunately, I quickly learned that the macro will first evaluate the arm (to get the future) and only after that will check a condition and based on this condition will either start the future or skip it.
As a result, as I run this code I will get:
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/main.rs:16:35
use tokio::io::AsyncReadExt;
use tokio::net::TcpStream;

#[tokio::main]
async fn main() {
    let mut stream1 : TcpStream = TcpStream::connect("info.cern.ch:80").await.unwrap();
    let mut stream2 : Option<TcpStream> = None;
    let mut buf = vec![0_u8; 1024];
    let mut buf2 = vec![0_u8; 1024];

    tokio::select! {
        result = stream1.read(&mut buf) => {
            // do something here
        }

        result = stream2.as_mut().unwrap().read(&mut buf2), if stream2.is_some() => {
            // do somethihng here
        }
    }

}

The question which I have is how to handle this?
I stumbled on following ideas and I am not happy about any of these

*

*Add if statement. If stream2.is_some() then have select with two arms, otherwise select with one mark. This works but results in quite ugly code duplication

*I looked into FutureUnordered direction. However, taking into account that the above code will be executed in the loop, I bailed out from this approach, because it didn't like that I try to borrow things as mutable in the loop.

*I was thinking to have a "fake" TcpStream, just to remove Option<> part. However, it also looks ugly.
I am looking for some way that will allow me to keep this select! over Option

A: You can wrap the handling of the optiona stream into another future, maybe returning a custom error. Then pattern match on successful reads:
use tokio::io::AsyncReadExt;
use tokio::net::TcpStream;
use std::io::{Error, ErrorKind};

#[tokio::main]
async fn main() {
    let mut stream1 : TcpStream = TcpStream::connect("info.cern.ch:80").await.unwrap();
    let mut stream2 : Option<TcpStream> = None;
    let mut buf = vec![0_u8; 1024];
    let mut buf2 = vec![0_u8; 1024];

    let read2 = async move {
        match stream2 {
            Some(mut stream) => stream.read(&mut buf2).await,
            _ => Err(Error::new(ErrorKind::Other, "No available stream")),
        }
    };

    tokio::select! {
        result = stream1.read(&mut buf) => {
            // do something here
        }

        Ok(result) = read2 => {
            // do somethihng here
        }
    }

}

Playground
If you do not like the custom error, you can rewrap everything in an Option<Result> and pattern match everything:
...
    let read2 = async move {
        match stream2 {
            Some(mut stream) => Some(stream.read(&mut buf2).await),
            None => None,
        }
    };

    tokio::select! {
        result = stream1.read(&mut buf) => {
            // do something here
        }

        Some(result) = read2 => {
            // do somethihng here
        }
    }
...

Playground


text:
Q: Best way to track a point on canvas I've a canvas with a circle at x|y (eg. x:100, y:90) like this:

Now I rotate the canvas with canvas.rotate() around center:

What is the best way to get the absolute position of the circle after rotation?

A: This is a trigonometry problem
Understand that in your original non-rotated canvas, the point is at a certain angle and a certain length from center... Polar coordinates. Then when the canvas is rotated, it is still at that same location, relative to the canvas, so it's absolute position has the same length from center, with angle = original angle plus the rotation on the container canvas.
Do you remember your trigonometry? ;)


text:
Q: How to use DSL query from Kibana dev-tools in visualisation? I have successfully aggregated and queried a particular content I needed in Kibana Dev Tools. However, I need this information in a tabular form either as CSV or PDF. For this, I need to run the DSL query I constructed in Dev Tools in visualisation tool of Kibana. However, I am not able to do it.
I tried copying the DSL to the Lucene query text box on the top part of the visualisation page and also tried within the add filter option. Both way it returns an error.
The query that works in Dev Tools:
{

  "query": {
    "bool": {
       "must": [
        { "match": { "start_datetime":"1569868200" }}
      ]
    }
  },
  "aggs" : {
        "state_location" : {
            "terms": {
                "field" : "state_location"
            },
            "aggs": {
                "stakeholder_category": {
                    "terms": {
                        "field": "stakeholder_category"
                    },
                    "aggs": {
                        "coverage_category": {
                            "terms": {
                            "field": "category_paragraph_name.keyword"
                            }
                        }
                    }
                }
            }
        }
    }
}

Expecting to get the result on visualisation screen as a table, so that I can export it to CSV or PDF.

A: The search bar in the discovery bar doesn't work with the json-syntax of a search request towards the REST-API. Instead it uses a simple lucene syntax.
However, you still can edit your search in the discovery manually:
You should be able to see a button with the label "Inspect" like in the following figure.

Note that the look & feel of Kibana got a significant update, so depending of the version you are using, you will find the Inspect button somewhere else in the discovery)
By hitting the button, a right-sided pane will show up with three tabs (Statistics, Request and Response). In the Request-section you can paste your query. Be sure NOT to past the root "query"-node of your json.

Hope, this will help you :-)


text:
Q: Persistant Oracle Connection/Queue based Insertion? I am using custom api as database logger for auditlog. I need to use either persistent connection to database or queue based implementation (such that insertion is performed in bulk and other requests do not get disturbed and it must be threadsafe). Any ideas how I might achieve this?
Database: Oracle
Logger Responsibility: Only insertion


text:
Q: How to convert this SQL to Laravel query builder code? Here is my SQL:
select
  m.id,
  m.first_name,
  GROUP_CONCAT(mt.name) membership_types
from
  members m
  left join expert_memberships em on em.member_id = m.id
  left join membership_types mt on mt.id = em.membership_type_id
group by
  m.id,
  m.first_name

A: Use This:
 $members = DB::table('members')
    ->leftJoin('expert_memberships', 'members.id', '=', 'expert_memberships.member_id')
    ->leftJoin('membership_types', 'membership_types.id', '=', 'expert_memberships.membership_type_id')
    ->select('members.id', 'members.first_name', DB::raw('GROUP_CONCAT(membership_types.name) membership_types'))
    ->groupBy('members.id', 'members.first_name')
    ->get();

group_concat you have pass as DB::raw otherwise it will not work in select.


text:
Q: classic asp site randomly hangs IIS6 We have a classic ASP site that connects to a SOAP server.  We have not been able to figure out what causes the website to hang.  When we see that the website is hanging we simply restart the soap server and the website works fine(until the next time it hangs).  I want to mention that when the website hangs I can get to any page on the server that has .html or .htm extension, but any page that has an .asp extension will simply clock.

A: Fire up performance monitor, select Active Server Pages category and watch the Requests Executing counter.
You will likely see that over time this increases.  You have threads hanging waiting for incomplete calls to the SOAP Server.  Eventually ASP runs out of threads (usually 25 threads per CPU).  After that subsequent requests to ASP get queued waiting for a thread to come free, which it never does.


text:
Q: Why is Tangential Speed unaffected by a change in Centripetal Force? When we rotate a mass in circular motion the centripetal force due to which the object moves in a circular path . But when we started to move our hand more fastly then we observe that tangential speed is also increasing so why we say that tangential speed is not effected by centripetal force?
Why does tangential speed do change when there is increase in centripetal force?

A: When you move your hand you move the center of the circle so the motion is not purely circular anymore. The tension in the string will have a component tangent to the instantaneous trajectory. The motion is circular only if you keep the rotation center fixed. Then the speed will slowly decerase due to frictions. To maintain the speed constant (and not just to increase it) you move the other end of the string (the one in your hand) so that the direction of the string is not exactly normal to the instantaneous tangent to the trajectory.

A: If we make an object move faster along the same circular path, we must apply a tangential force component to give it a tangential acceleration. But because the object is moving faster it has to be supplied with a greater  inward radial (centripetal) force component if it is to keep moving along the same path.
So the increase in tangential speed is related to the increase in centripetal force, but it is a tangential force, not the change in centripetal force, that physically causes the change in tangential speed.
Example: a puck on a flat air-table is travelling at speed $v_1$ in a circular path (of radius $r_1$), kept on that path by a string attached to the puck, passing through a small frictionless hole in the table at the centre of the circle and held by a hand underneath the table.
We can indeed make the puck go faster by pulling the cord with a slightly greater force than $mv_1\,^2/r_1$. Surely that means that increasing the centripetal force makes the car go faster? No. Increasing the pull shortens the horizontal part of the string and makes the puck go (faster than $v_1$) in a path of decreasing distance from the hole. But while the string is being shortened, the puck is spiralling inwards, rather than going in a circular path. The pull (approximately $mv^2/r$) of the string isn't at right angles to the puck's velocity, but there is a component ($m\frac{v^2}r \times\frac{-dr}{v\ dt}$) of the pull parallel to the velocity, and this is what makes the puck go faster!
[For completeness... If we equate the tangential force, $m\frac{v^2}r \times\frac{-dr}{v\ dt}$, to $m\frac{dv}{dt}$, simplify, separate variables and integrate between limits we get
$$v_2 r_2=v_1 r_1.$$ This can be deduced (much more easily) from the conservation of angular momentum, showing the 'tangential force' treatment to be correct.]

A: $$W = \int \vec{F} \cdot \vec{dr}$$
$$W = \int [\vec{F} \cdot \vec{v}] dt$$
The centripetal  force is perpendicular to the velocity in circular motion.
$$\vec{F} \cdot \vec{v} = 0$$
Thus
$$W=0$$
meaning no work is done, thus its speed is constant
Rotating our hand does not provide a force purely in the centripetal direction, we move our hand either side of the center of rotation causing a component that DOES do work on the object, hence why it speeds up.

A:
why we say that tangential speed is not effected by centripetal force

Not true. It does affect tangential speed. Tangential speed in terms of vector algebra:
$$\vec{v} = \vec {\Omega} \times \vec {r}.$$
$\vec{\Omega}$ is the angular velocity vector. Centripetal force produces thge angular velocity vector, which in turn, by the vector cross product, changes tangential velocity at every time moment. Velocity is vector; it has magnitude AND direction. If just direction changes, it means that the overall velocity vector changes too—i.e. the velocity vector can be split into magnitude and direction (unit vectors) parts:
$$ \vec {v} = v_x\cdot \vec {\imath} + v_y\cdot \vec{\jmath} + v_z\cdot \vec{k} $$
Where $\vec{\imath}$, $\vec{\jmath}$, and $\vec{k}$ are the $x$, $y$, and $z$ Cartesian axis unit directions.


text:
Q: Should I open up a class's instance variables just for test validation? I'm new to BDD, and I'm finding alot of instances where I'm adding instance variables to attr_accessor only so that my tests have an easy way to validate whether they are in the state that they should be in.  But this feels a little dirty because no other class needs this information, and so I'm only making it public for the tests.  Is this standard or a sign of bad design?
For example I have a collection class which stores an object, and then commits it to a batch array.  At the end of the import, the batch array is used to make a batch insert into the database.  But there is no need to check on the state of the batch at any point.  But in testing I'm wanting to make sure that the batch is in the state that I think it is, and so am opening up that variable for inspection.  Is the fact that it's not being checked within the code the real problem?

A: Is using instance_variable_get an option for you?
>> class Foo
..   def initialize
..     @foo = 'bar'
..     end
..   end #=> nil
>> Foo.new.instance_variable_get(:@foo) #=> "bar"

A: DON'T Do That!
This is going too deep. See the comments from @Andy and @Michael in the thread on the other 'accepted' answer
Don't write unit tests that look inside the code unit.  If it's not something you can see from the external interfaces to the object then it doesn't need to be unit tested.  You are going past how the code behaves into how it implements that behavior, and you don't want tests that go down to that level as they don't provide any real value in terms of proving that the code does what it should.
Just consider how many tests you might have to update if someone re-factors that code and in order to make it more readable changes the internal names of things.. or maybe finds a better way of doing whatever and all the instance variables get altered..  The code unit could still be working perfectly fine, but the unit tests would fail..
Alternatively if a change was made that adjusts how the internal variables report out to the interface, the code could effectively be broken, but the tests that are looking at the internal values of the instance variables would not report any failure.


text:
Q: How to move "The shipping and billing addresses are the same" checkbox to billing step in Magento 2 In my website,On one page checkout, the "My billing and shipping address are the same" section is showing after the payment method. I want it to show below the Billing address. The payment method will stay at its own place. I just want to move the checkbox into the billing address section.
How can I achieve this?

A: Check the magento default settings:
Stores -> Configuration -> Sales -> Checkout -> Checkout Options

Set Display Billing Address On to Payment Page


text:
Q: homology group of $(T^2\times I)/\sim$ Let $T^2$ be the $2$-torus, $S_1\times S_1$, where $S_1=\{z\in \mathbb{C}:|z|=1\}\subset \mathbb{C}$. And the equivalence relation of $T^2\times I$ is defined as
$$ (z,\zeta,1)\sim (z,z^2\zeta,0)$$
where $I$ is the unit interval. Let $X$ be the quotient space of $T^2\times I$ by $\sim$, i.e. $X=(T^2\times I)/\sim$. I want to find the homology groups of $X$. The computation by myself is
$$H_n(X)=0 (n\geq 4),H_3(X)\cong \mathbb{Z},H_2(X)\cong \mathbb{Z}^2,H_1(X)\cong \mathbb{Z}^2\times \mathbb{Z}/2\mathbb{Z},H_0(X)\cong \mathbb{Z}$$
I want you to confirm my computation and teach me your method if you can. Thank you for your help.

A: I think your answer is correct.  The space $X$ is a mapping torus, and there is a long exact sequence relating the homology of $X$ with the homology of $T^2$ and the gluing map.  See Hatcher, example 2.48 for an explanation of this sequence.  Since I suspect that this might be the method you've used, I'll be brief and highlight only the important parts.
Let $f: T^2 \to T^2$ be the map $(z,\zeta) \mapsto (z, z^2 \zeta)$.  In this case, the long exact sequence takes the form $$\cdots \to H_n T^2 \xrightarrow{1-f_*} H_n T^2 \to H_n X \to H_{n-1} T^2 \to \cdots.$$
The homology groups of the torus $T^2$ are $\mathbb{Z}$, $\mathbb{Z}^2$, and $\mathbb{Z}$ in dimensions $0$, $1$, and $2$ respectively, so it remains to compute the effect of the map $f$ in homology.
The induced map $f_*$ is the identity on $H_0$ since the degree of $f$ is $1$, and it is also the identity on $H_2$ since for example it preserves "volume".  If $a$ represents the $z$-copy of $S^1$ in $T^2 \cong S^1 \times S^1$ and $b$ the $\zeta$-copy, then on $H_1$, $f_*$ is the map $a \mapsto a$ and $b \mapsto 2a + b$.
So in the long exact sequence, the map $1 - f_*$ is
\begin{align*}
\cdots \to H_0 T^2 &\xrightarrow{0} H_0 T^2 \to \cdots \\
\cdots \to H_1 T^2 &\xrightarrow{\substack{a \mapsto 0  \\ b \mapsto 2a}} H_1 T^2 \to \cdots \\
\cdots \to H_2 T^2 &\xrightarrow{0} H_2 T^2 \to \cdots.
\end{align*}
Computing the kernels and cokernels of these maps, we find that $H_0 X \cong H_0 T^2 \cong \mathbb{Z}$ and $H_3 X \cong H_2 T^2 \cong \mathbb{Z}$.  Moreover, $H_1$ and $H_2$ sit in short exact sequences
\begin{align*}
0 \to \mathbb{Z} \oplus \mathbb{Z}/2 \to &H_1 X \to \mathbb{Z} \to 0 \\
0 \to \mathbb{Z} \to &H_2 X \to \mathbb{Z} \to 0.
\end{align*}
Since $\mathbb{Z}$ is projective, there are no nontrivial extensions, so $H_1 X \cong \mathbb{Z} \oplus \mathbb{Z} \oplus \mathbb{Z}/2$ and $H_2 X \cong \mathbb{Z} \oplus \mathbb{Z}$.  Of course, since $X$ is 3-dimensional, $H_{>3} X = 0$.


text:
Q: How to select data from database and return it via a WCF service? I have a stored procedure that gets the Filename and Path (2 columns) from the database. I need to make a WCF service that returns the data into a format that any application that uses the service can use like a List<string> or something along the lines.
What's the best way to go about this (design and implementation-wise)?
Here's what I tried doing via Dapper ORM, but I'm not sure if it will work as intended.
public IEnumerable<dynamic> RetrieveIncompletedFiles(int type)
{
    try
    {
        using (_connection = new SqlConnection(_sqlConnectionString))
        {
            _connection.Open();
            var files = _connection.Query("SelectIncompletedFilesByFiletypeFromAsyncFileProcessingQueue", new { Filetype = type }, commandType: CommandType.StoredProcedure);
            return files;
        }
    }
    catch (Exception ex)
    {
        return null;
    }
}

A: That will almost certainly not work as expected. WCF wants to work against a known schema and a simple data type, typically a List<SomeType> where SomeType is a public class that is marked as a [DataContract] with [DataMember] elements. Fortunately, the dapper part of this should be as easy as:
 public List<SomeType> RetrieveIncompletedFiles (int type)
{
    using (connection = new SqlConnection(_sqlConnectionString))
    {
        return connection.Query<SomeType>("SelectIncompletedFilesByFiletypeFromAsyncFileProcessingQueue", new { Filetype = type }, commandType: CommandType.StoredProcedure).AsList();
    }
}

A: EDIT: I finally got it working using the above code after struggling a lot with references on the client side. I had to configure the service reference settings. I had to change collection type from array to list and also uncheck "reuse reference", if I didn't uncheck, I got a lot of errors in Reference.cs, which made it a pain to work with on the client side.
List<AsyncFileProcessorService.FilenameAndPath> filenameAndPaths = processor.RetrieveIncompletedFiles(filetype);


text:
Q: In WordPress how can I restrict access to xmlprc to specific ip/host I have a WordPress site on my server. I'm developing an application, hosted on the same server, that integrate with WordPress through xml-rpc (in this moment I can't use Rest API) managing posts, taxonomies and so on.
How can I restrict access to xmlrpc service only to my application/server?

A: If you are running on Apache server you can just write a rule in the server configuration file to only allow access from your IP address, something like this:
# Deny the access of xmlrpc.php
<FilesMatch "xmlrpc\.php">
        order deny,allow
        Deny from all
        Allow from 192.168.1.2
</FilesMatch>


text:
Q: The new flagging dialog gets in the way The old flagging dialog box politely "stepped aside" or wasn't so big that it prevented a quick re-scan of a post and possibly a copy/paste of things in the post you wanted to highlight to the mods.
The improved flagging dialog hides the post being flagged. Now, with all these new flagging options, it's sometimes necessary to have a quick re-read to make sure you're picking the flag reason that matches best. If you've started typing in the "other" box, then you have to select/copy, close the dialog, re-read, re-open, etc, etc.
It kinda gets in the way.
It would be nice if the box

*

*were moved down a bit, to directly under the last line of text in a post (provided there was space available, perhaps); or

*were draggable so users could move it out of the way
This is also a problem with similar dialogs such as the closure dialog. It's particularly problematic with the Close as Duplicate Dialog as it's quite possible you'll want to review the question or click links to suggested duplicates in the comments, which might be blocked by the big overlay.

A: A possible alternative that I used for my AutoComment script is to add a 'seethrough' link. When you hover over it, you can 'see through' the popup.

A: Browsers have gotten sufficiently not garbage in the (checks) two years since this request came in that we revisited it as part of the other dialog changes.
Starting with the next build the flagging and closing popups will be dragable (the "title" at the top is the handle in both cases).

A: This requires pulling in a large jQuery UI dependency, and given that I think jQuery UI is pretty crappy and bloated.. unlikely.


text:
Q: Error in remote connection in SQL Server when connecting the client to the server I am making a system in which my database will be used on LAN. For that I made all the step and make a test.udl file for testing the client message to the server
when I pressed on the test connection on the client PC, it shows the following error:

10/06/2019 15:26:46,Logon,Unknown,Login failed for user 'DESKTOP-4F7O4EQ\Guest'. Reason: Could not find a login matching the name provided. [CLIENT: 192.168.0.100]
  10/06/2019 15:26:46,Logon,Unknown,Error: 18456 Severity: 14 State: 5.

A: Seems your application trying to connect SQL Server via windows authentication which usually goes through the user that currently active in application or service account of the application, i'm not sure why the local guest trying to authenticate.
You may want verify the connection string, if no luck, test with SQL Authenticated user that got appropriate access on the SQL Server.
Further references on SQL Authentication:
Ref1
Ref2

A: Do verify the connection string in the db properties file or so. It should be like the format:driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
url=jdbc:sqlserver://localhost:1433;databaseName=xxxx;
user=xxxx
pass=xxxx


text:
Q: Failing creation of bean in spring this is the log
and this are the entries in my xml file..
 <bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
    <constructor-arg ref="marshaller"/>
    <constructor-arg ref="marshaller"/>
  </bean>

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter#0' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter]: Constructor threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter.<init>(Lorg/springframework/oxm/Marshaller;Lorg/springframework/oxm/Unmarshaller;)V" the class loader (instance of weblogic/utils/classloaders/ChangeAwareClassLoader) of the current class, org/springframework/ws/server/endpoint/adapter/GenericMarshallingMethodEndpointAdapter, and the class loader (instance of java/net/URLClassLoader) for resolved class, org/springframework/ws/server/endpoint/adapter/MarshallingMethodEndpointAdapter, have different Class objects for the type org/springframework/oxm/Marshaller used in the signature
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:254)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
    at javax.servlet.GenericServlet.init(GenericServlet.java:241)
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
    at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
    at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
    at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused By: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter]: Constructor threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter.<init>(Lorg/springframework/oxm/Marshaller;Lorg/springframework/oxm/Unmarshaller;)V" the class loader (instance of weblogic/utils/classloaders/ChangeAwareClassLoader) of the current class, org/springframework/ws/server/endpoint/adapter/GenericMarshallingMethodEndpointAdapter, and the class loader (instance of java/net/URLClassLoader) for resolved class, org/springframework/ws/server/endpoint/adapter/MarshallingMethodEndpointAdapter, have different Class objects for the type org/springframework/oxm/Marshaller used in the signature

help me to resolve the issue
Thanks in advance ..

A: From the error message it looks like a 'transitive dependency' problem. To put that in plain English lets call a library a dependency. A transitive dependency would be a library that the library is using to do its job.
Problems can occur when two libraries are expecting a different version of some common library.
Also, it could be the application server that is providing this library and making it visible to the main class loader. In this case you may be able to find the offending jar, take it out and just use the app server version. Try taking out the spring-oxm jar and seeing if the required classes are provided by the server.
It can help to have a library manager to set up all the jars for you.


text:
Q: Trying to concatenate dataframes with numpy and recursion I have a list of pandas dataframes, which I am trying to concatenate into one dataframe using recursion and numpy.
def recur(framelist, index=0, result=0):

    if index == len(framelist)-1:
        return result

    else:
        return recur(np.concatenate((framelist[index],framelist[index+1])))

My intention with the above is to pass the dataframe list to the recur function.
The base case is when the end of the list is reached.
the functionality is to concat all pairs of dataframes
However I get an error that 0 dimensional arrays cannot be concatenated

A: To work out what's going on it's a good idea to walk through it step by step.
You say your initial call to recur passes in a list of panda dataframes. You don't show the creation of them, but let's say they're something like...
framelist = [
    pd.DataFrame(np.array([1, 2, 3])),
    pd.DataFrame(np.array([4, 5])),
    pd.DataFrame(np.array([6, 7])),
    pd.DataFrame(np.array([8]))
    ]

So, first time through it concatenates the first two entries from framelist as numpy arrays.
[[1], [2],  [3]]  and [[4], [5]]

This will result in a numpy ndarray which looks like:
[[1], [2], [3], [4], [5]]

This result is passed into recur() as the new framelist
Second time through it concatenates the first two entries from framelist.
[1] and [2]

This will result in a numpy array which looks like:
[1, 2]

This result is passed into recur() as the new framelist
Third time through it concatenates the first two entries from framelist.
1 and 2

These are simply numbers, not arrays, so you see the error '0 dimensional arrays cannot be concatenated'
Here's an example of how to do the concatenation with recursion. You don't need to keep track using any kind of index parameter. Just keep taking the first off the list and pass the remainder into recur. When you get to the point where there's only 1 left in the list, that gets passed back up and concatenated with the previous one. The result is passed back up and concatenated with the previous one, etc.
def recur(framelist):
    # keep going until there's just 1 left.
    if len(framelist) == 1:
        return framelist[0]

    return np.concatenate((framelist[0], recur(framelist[1:])))

print(recur(framelist))


text:
Q: Best way to get client's connection speed using java I want to know what is the best way to calculate the download speed of the clients using Java.
I have searched on the internet and found that I have to download a file from the server and calculate the time before and after the download completes and to make it more specific - repeat this action for 3 times so I can have an average time.
For me, the problem above doesn't work well, for localhost I got the results let's say close to reality but from server the results are a lot lower. I made a page filled with js,css(the size that I want to test), before enters calculate the startDate from the extended Action class(using struts) and on the 'onLoad()' event I made an ajax submit in which I got the endDate.StartDate-EndDate gave me the time...I forgot to mention, I set also that my jsp page isn't cached.
Do you know other solutions?
Thanks,
Luisa

A: On Linux you could just run the following from the command line.
time wget <some-url>

This will give you the elapsed time for the GET request as the "real" time.  Of course, this gives you just the time taken to fetch the page contents.  It won't tell give you the time for loading any images, stylesheets, scripts, etc that the page pulls in, or the time taken to render the page or execute any embedded javascript.

... for localhost I got the results let's say close to reality but from server the results are a lot lower.

Your previous method may actually have been giving you true results.  It is not unusual for access via "localhost" to work faster than remote access, especially if there are slow network links, web proxies, etc in the route from the client to the server.


text:
Q: Can't get sympy to solve a hard equation (Python, sympy) I am trying to solve a difficult equation with sympy in Python. The problem is that is does find an answer and hangs instead.
I'm using the following code to get an answer:
from numpy import pi, e
from sympy import symbols, solve, sin, cos, sqrt, log, atan, re

I_p   = 50000
mu_0  = 4*pi*10**-7
m_s   = 2.402
n_cond= 2
f     = 50
a_s   = 0.1
d     = 0.03624
kappa = 1.999999999
kappa = max(1.1, kappa)
tau = (-2*pi*f/3  *  log((kappa-1.02)/0.98))**-1
gamma = atan(2*pi*f*tau)
v1 = f/(sin(pi/n_cond)) * sqrt((a_s-d)*m_s/(mu_0/(2*pi) * (I_p/n_cond)**2 * (n_cond-1)/a_s))
v2_sym    = symbols('v2_sym', real=True, rational=False)
T_pi      = v1/(f*sqrt(v2_sym))
v2_eval   = fun_v2(pi, f, T_pi, gamma, tau)
v2        = solve(f*T_pi*sqrt(v2_eval)-v1)

With fun_v2() defined as:
def fun_v2(pi, f, T_pi, gamma):
    """See A7 for the formula for v2 in NEN-EN-IEC 60865-1:2012"""
    part1 = 1 - (sin(4*pi*f*T_pi-2*gamma)+sin(2*gamma))/(4*pi*f*T_pi)
    part2 = f*tau/(f*T_pi)*(1-e**-(2*f*T_pi/(f*tau)))*(sin(gamma))**2
    part3 = 8*pi*f*tau*sin(gamma)/(1+(2*pi*f*tau)**2)
    part4 = 2*pi*f*tau*cos(2*pi*f*T_pi-gamma)/(2*pi*f*T_pi)
    part5 =            sin(2*pi*f*T_pi-gamma)/(2*pi*f*T_pi)
    part6 = e**(-f*T_pi/(f*tau))
    part7 = (sin(gamma)-2*pi*f*tau*cos(gamma))/(2*pi*f*T_pi)
    v2    = part1 + part2 - part3 * ((part4 + part5) * part6 + part7)

The actual problem that I am trying to solve is given in this document, which I found online. So basically I need to have a function that gives the value of v2, with v1 and kappa as inputs.
Does anyone know why this problem occurs?

A: You are trying to solve v2_eval for v2. Since v2 is the only free symbols of the expression, you are looking for a numerical result, hence sympy's solve is not the right tool for this job. SymPy's nsolve allows us to find a numerical solution, but it requires an initial guess. Since this is a 1D case, to find a good initial guess we can plot the expression:
from sympy import plot, nsolve
expr = f*T_pi*sqrt(v2_eval)-v1
plot(expr, (v2_sym, 0, 10))

From the picture we can see that there is a root somewhere around 2: this is our initial guess. Finally:
nsolve(expr, v2_sym, 2)
# out: 1.89685608221466

A final note: you mixed numpy and sympy to create the expression. You were lucky, as usually it creates problems. Always use sympy to create symbolic expression (use sympy's E for the exponential number, and sympy's pi).


text:
Q: How to reshape a 2d array to 3d matrix in R? I am new to R language, therefore need your assistance.
I have a 2D array of dimension 256* 149.
I want to reshape this 2d array into a 3d matrix in R..therefore the output dimension of the reshaped array will be 1616149.
Looking forward to your help. Thanks in advance.


text:
Q: Exporting bounding area only via ArcGIS Pro? I use ArcGIS Pro to export a layout as jpg format image.
I just wonder if any tools in ArcGIS pro can help me export the polygon area only and remove or symbolize the rest area as grey?
My quick thought is that it may not directly operate on the basemap because so far I didn't find any easy tool to either symbolize the out-of-bound area into grey or other style to distinguish it from the bounding area.
I guess if I need to copy the map view into an imagery first and then dealing with it as an image file and crop it further.

A: I thought that I had seen a new feature in ArcGIS Pro 2.3 to be able to designate a polygon feature to act as a graphic clip on a map frame.
However, when I looked just now I found that it was not there.
What you can do is to digitize a polygon to act as a graphic clip on a map frame and this is described in the Modify a map frame help:

On the Insert tab, in the Map Frames group, click the Reshape
  drop-down menu, choose a draw tool, and then draw a new shape on your
  existing map frame.

I have looked some more and found that you can use a polygon feature to graphically click a Map (not a Map Frame) as long as you are using ArcGIS Pro 2.3.0 or later.
To test this I:

*

*Created a test project using the Map template

*Added a feature class (AfricanCountries) with polygons for each country in Africa (and turned it off so that I could see the Topographic basemap underneath

*Opened the Properties of the Map to its Clip Layers tab

*Changed No clipping to Clip to the outline of features

*Chose to Get shape from the outline of: AfricanCountries by double-clicking it, them clicked Apply and OK

*On the Share tab of the Ribbon I chose Export Map

*Set Save as type: JPEG and clicked Export

This is the result:

To export from a Layout instead just insert this graphically clipped Map into a Map Frame.


text:
Q: R identifying new user IDS based on date I have a dataset of 2 years of user text messages - 2015 and 2016 (135,000). I am trying to identify new users to this program for February 2016 (based on subscriber_id and entity=="subscribe-online").
The wrinkle is that a new user is one where the subscriber_id has not occurred in the data within the past 12 months. So, for example, if I have the following sample data:
created              subscriber_id   cellnum   entity          message  msgtxt
2015-21-01 14:03:00   15855        7788826943   tip             100     end
2015-07-12 14:03:00   15839        7788815940   tip             24      tip 24
2015-08-12 14:03:00   15839        7788815940   stop            99      stop
2016-01-01 14:05:00   15800        2508816941   tip             25      tip 25
2016-02-01 16:05:00   15800        2508816941   tip             26      tip 26
2016-03-01 14:05:00   15800        2508816941   tip             27      tip 27
2016-01-02 14:03:00   15855        7788826943  subscribe-online  1      msg 1
2016-01-02 14:03:00   15839        7788815940  subscribe-online  1      msg 1

15855 and 15839 both subscribe on February 1. I want to be able to assign 15855 as a new user based on the fact that the last occurrence of the subscriber_id 15855 was on Jan 21, 2015 - more than 12 months. I would like to assign 15839 as a repeat user since their last occurrence was on December 8th, 2015 (less than 12 months).
The created (date) field is in POSIXct, format. I have been trying to understand loops and sapply and tapply to see how I could use this here. Any help would be greatly appreciated. Thanks.

A: Here is a potential solution using dplyr
library(dplyr)

df <- data.frame(created = c("2015-21-01 14:03:00","2015-12-07 14:03:00","2015-12-08 14:03:00","2016-01-01 14:05:00","2016-02-01 16:05:00","2016-03-01 14:05:00","2016-01-02 14:03:00","2016-01-02 14:03:00"),
                 subscriber_id = c(15855,15839,15839,15800,15800,15800,15855,15839),
                 cellnum = c(7788826943,7788815940,7788815940,2508816941,2508816941,2508816941,7788826943,7788815940),
                 entity = c("tip","tip","stop","tip","tip","tip","subscribe-online","subscribe-online"),
                 message = c("100","24","99","25","26","27","1","1"),
                 msgtxt = c("end","tip 24","stop","tip 25 ","tip 26 ","tip 27 ","msg 1","msg 1"),
                 stringsAsFactors = FALSE
                )

df$created <- as.POSIXct(df$created, format = "%Y-%d-%m %H:%M:%S")

df <- df %>%
      arrange(subscriber_id, created) %>%
      group_by(subscriber_id) %>%
      mutate(new_user = if_else(entity != "subscribe-online", NA, if_else(as.numeric(difftime(created, lag(created), units = "days") > 365) == TRUE, TRUE, NA)))


text:
Q: In spring xml config,how to automatically get the current bean's ID value? I use quartz in spring xml,  I have many config like above config~~
I want to known ,automatically get the id value of the current bean
Not every time I hand-written the value of the current bean!!
<bean id="openBaiduTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail">
        <bean p:targetObject-ref="baiduManager" p:targetMethod="createOpenBaiDu" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean" />
    </property>
    <property name="cronExpression" value="#{p_schedule['openBaiduTrigger.cronExpression']}" />
</bean>


text:
Q: Avoid a freeze when attempting to delete a file I have an application where we replace an "artproj" file for our application by writing changes to a separate file and then removing the original file and renaming the new one. It generally works well, but sometimes, it gets "stuck" on the delete, going nowhere, with no option to abort the call within Visual Studio when debugging. Looking at Process Explorer, it looks like my application has a handle on the file at that point, but so does explorer.exe. In fact, when I exit the application, explorer.exe still has three handles on it with the same process ID. I can only guess that's why the delete, which uses FileInfo.Delete, doesn't go through.
Here is the deletion procedure:
private static Exception InternalSafeKill(FileInfo TargetFile)
{
    try
    {
        TargetFile.Attributes = FileAttributes.Normal;
        TargetFile.Delete();
        return null;
    }
    catch (Exception ex)
    {
        return ex;
    }
}

Is there any way to avoid this sort of conflict? To detect it before the call? To safely escape it in some way when detected?


text:
Q: calculate n days ahead rolling average I have the following dataset:
date <- StockData[1:10,2]
x <- c(2,4,2,3,5,1,6,2,3,4)
df <- as.data.frame(cbind(x,date))
df

   x       date
1  2 2019-06-28
2  4 2019-07-01
3  2 2019-07-02
4  3 2019-07-03
5  5 2019-07-04
6  1 2019-07-05
7  6 2019-07-08
8  2 2019-07-09
9  3 2019-07-10
10 4 2019-07-11

Now I want to create a new column with the 5 (n) days ahead rolling average, so the dataset looks as following:
   x       date five.day.average
1  2 2019-06-28              3.2
2  4 2019-07-01              3
3  2 2019-07-02              3.4
4  3 2019-07-03              3.4
5  5 2019-07-04              3.4
6  1 2019-07-05              3.2
7  6 2019-07-08              NA
8  2 2019-07-09              NA
9  3 2019-07-10              NA
10 4 2019-07-11              NA

In other words, I want a formula/function that does the same thing as rollmean in package zoo, but instead of back in time, future in time ( since k in rollmean cannot be negative).
Thank you in advance!

A: An option is frollmean from data.table
library(data.table)
setDT(df)[, five.day.average := frollmean(x, 5, align = 'left')]
df
#    x       date five.day.average
# 1: 2 2019-06-28              3.2
# 2: 4 2019-07-01              3.0
# 3: 2 2019-07-02              3.4
# 4: 3 2019-07-03              3.4
# 5: 5 2019-07-04              3.4
# 6: 1 2019-07-05              3.2
# 7: 6 2019-07-08               NA
# 8: 2 2019-07-09               NA
# 9: 3 2019-07-10               NA
#10: 4 2019-07-11               NA

Or with rollmean from zoo
rollmean(df$x, 5, align = 'left', fill = NA)
#[1] 3.2 3.0 3.4 3.4 3.4 3.2  NA  NA  NA  NA

data
df <- structure(list(x = c(2L, 4L, 2L, 3L, 5L, 1L, 6L, 2L, 3L, 4L),
    date = c("2019-06-28", "2019-07-01", "2019-07-02", "2019-07-03",
    "2019-07-04", "2019-07-05", "2019-07-08", "2019-07-09", "2019-07-10",
    "2019-07-11")), class = "data.frame", row.names = c("1",
"2", "3", "4", "5", "6", "7", "8", "9", "10"))

A: In base you can use filter to get a rolling average. To make it looking ahead rev can be used.
rev(filter(rev(df$x), rep(1/5, 5), sides=1))
# [1] 3.2 3.0 3.4 3.4 3.4 3.2  NA  NA  NA  NA


text:
Q: MYSQL pivot table create I've tried various tutorials and examples how to make a dynamic pivot table, and I cant make it work. Every time I am getting some sql error.
Can someone help me how to make dynamic pivot table. I am new, and I guess I will make a filter search by attributes easy when I make pivot table first. Here are my tables:
Table 1 name: table_items
------------------------------
| item_id |   title    | ... |
------------------------------
|    1    |  item 1    | ... |
------------------------------
|    2    |  item 2    | ... |
------------------------------

Table 2 name: table_item_options
-----------------------------
| option_id |   option_name |
-----------------------------
|    1      |     Color     |
-----------------------------
|    2      |     Size      |
-----------------------------

Table 3 name: table_attributes
--------------------------------------------------
| attribute_id |   option_id    | attribute_name |
--------------------------------------------------
|      1       |       1        |      Blue      |
--------------------------------------------------
|      2       |       1        |      Red       |
--------------------------------------------------
|      3       |       2        |      XL        |
--------------------------------------------------
|      4       |       1        |      Green     |
--------------------------------------------------
|      5       |       2        |      L         |
--------------------------------------------------

Table 4 name: table_item_attributes
------------------------------------------------------
| assigned_id |  item_id  | option_id | attribute_id |
------------------------------------------------------
|      1      |     1     |     1     |      1       |
------------------------------------------------------
|      1      |     1     |     1     |      2       |
------------------------------------------------------

Any help is much appreciated
What I want is to make a product filter for items by its attributes. As I understood it is best possible to make a pivot table, and to avoid duplicate results bu joining tables.
All first columns are primary keys, and with autoincrement.
EDIT:
At this point, using inner join , I create one big table, and in Select clause I put " WHERE attribute_id = '2' ". (Which means Select all Red) , but like this I can use only one filter.
So I have a problem that I cant use more than one filter from attribute_id column, and I want to filter by more attributes (other color, other size, city,  etc..)
So how can I do this using pivot table ? My intention is to dinamicly create columns which would be option.name from (table_item_options) and to populate it with attribute_id or attribute_name, so I can use more filters
for example:
-----------------------------------------------------
| item_id |  ...  | color    | size | City  | etc.. |
------------------------------------------------------
|      1  |  ... | 1(or Red) | L    | A     | ...   |
------------------------------------------------------
|      1  |  ... | 2(or Blue)| XL   | B      | ...  |
------------------------------------------------------

In table like this, If I Select * .. where color = red , I will be able to filter this table by another column, eg:  Where city = a
I hope it is more clear now.


text:
Q: Dynamically add the Matrix/GridView based on the values from the TextBox in C# I wanted to ask some questions regarding some requirements. My client want that when he clicks on a Button, a form should be displayed asking the user to add the number of rows and columns.After adding those a matirx/gridview should be displayed according to the size that the user has entered.
The main problem is that I have used a TableLayoutPanel and its not changing the size of the rows and columns.
     public void set(int rows, int columns)
    {
        this.SuspendLayout();
        tableLayoutPanel1.RowCount = rows;
        tableLayoutPanel1.ColumnCount = columns;
        tableLayoutPanel1.Controls.Add(new ComboBox());
        //tableLayoutPanel1.Controls.Add( NewRackControl() rack());
        this.ResumeLayout();
        //this.Refresh();

    }

*

*What will be best to add a GridView or a TableLayoutPanel?

*How can I change the number of rows and columns.

*Thirdly if a user enter text to any of the position of that gridview how I will be able to take the position of that paticular row or column and then save it into the Database ?

A: Instead of using TableLayoutPanel please use DataGridView
the Selected Rows from different popped form can be passed between 2 forms and update can be done to the working Grid-view.

*

*The changes required (like Sizes, Color, Icons ,Highlighting, etc)
can be Done in Gridview.

*You can change the no of rows & columns dynamically by changing properties(visibility & items) of it.

*yes, you can save the changes made in view back to database and this is one of famus features provided by updateble event.

Please use DataGridView this is best for your Problem.


text:
Q: Managing Ubuntu 14.04 clients alternative landscape We are migrating some Windows pc's to Linux (Ubuntu 14.04).
For Windows we have a tool to manage those devices:

*

*checking invetory on pc's (which software is installed)

*pushing software to the clients (batch / bash scripts)

*taking over the pc's

I saw that Ubuntu has a tool called landscape.
Is there a free opensource alternative for this? Which is capable of the things I described?

A: I have found a tool called CFEngine which can be used for free for up to 25 clients.

A: Options to manage multiple Ubuntu servers are tracked in this question Options for managing multiple Ubuntu installations together


text:
Q: Android (API 10) Fragment error I have a problem with running SupportMapFragment on Android (API 10) here is what I get from  logcat:
02-22 02:16:09.516    1132-1202/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.lge.android.calendar.wid
02-22 03:50:54.214  15767-15767/? E/ActivityThread﹕ Service com.koushikdutta.rommanager.DownloadService has leaked IntentReceiver com.clockworkmod.billing.ClockworkModBillingClient$8@4054cb08 that was originally registered here. Are you missing a call to unregisterReceiver()?
    android.app.IntentReceiverLeaked: Service com.koushikdutta.rommanager.DownloadService has leaked IntentReceiver com.clockworkmod.billing.ClockworkModBillingClient$8@4054cb08 that was originally registered here. Are you missing a call to unregisterReceiver()?
            at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:756)
            at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:551)
            at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:817)
            at android.app.ContextImpl.registerReceiver(ContextImpl.java:804)
            at android.app.ContextImpl.registerReceiver(ContextImpl.java:798)
            at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:318)
            at com.clockworkmod.billing.ClockworkModBillingClient.checkPurchase(ClockworkModBillingClient.java:890)
            at com.koushikdutta.rommanager.Helper.checkClockworkBilling(Helper.java:334)
            at com.koushikdutta.rommanager.Helper.isPremium(Helper.java:359)
            at com.koushikdutta.rommanager.DownloadService.checkForUpdates(DownloadService.java:624)
            at com.koushikdutta.rommanager.DownloadService.onStartCommand(DownloadService.java:713)
            at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2039)
            at android.app.ActivityThread.access$2800(ActivityThread.java:117)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:994)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:130)
            at android.app.ActivityThread.main(ActivityThread.java:3683)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:507)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:861)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:619)
            at dalvik.system.NativeStart.main(Native Method)
02-22 10:10:36.187    1132-1352/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.google.android.apps.uplo
02-22 10:11:03.367    1132-1370/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.lge.android.worldclock.w
02-22 10:17:27.607   1038-11211/? E/SuperExtractor﹕ File not supported
02-22 10:17:28.630    1038-1277/? E/SuperExtractor﹕ File not supported
02-22 10:17:36.090    1132-1261/? E/ResourceType﹕ Style contains key with bad entry: 0x0101039c
02-22 10:17:36.237    1132-4329/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.lge.android.worldclock.w
02-22 10:17:36.387   1038-14442/? E/SuperExtractor﹕ File not supported
02-22 10:17:37.000  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x0101039c
02-22 10:17:37.657  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x0101039c
02-22 10:17:38.917   1038-14442/? E/SuperExtractor﹕ File not supported
02-22 10:17:40.590  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x01010336
02-22 10:17:40.590  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x01010338
02-22 10:17:40.590  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x0101033a
02-22 10:17:40.590  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x01010359
02-22 10:17:40.697  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x0101039c
02-22 10:17:41.527    1038-1038/? E/SuperExtractor﹕ File not supported
02-22 10:17:41.737  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x0101039c
02-22 10:17:42.130  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x01010336
02-22 10:17:42.130  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x01010338
02-22 10:17:42.130  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x0101033a
02-22 10:17:42.130  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x01010359
02-22 10:17:42.270  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x0101039c
02-22 10:17:42.687   1038-11210/? E/SuperExtractor﹕ File not supported
02-22 10:17:45.007  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x0101039c
02-22 10:17:45.177  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x0101039c
02-22 10:17:46.257    1038-1038/? E/SuperExtractor﹕ File not supported
02-22 10:17:47.727    1038-1277/? E/SuperExtractor﹕ File not supported
02-22 10:17:49.227   1038-11211/? E/SuperExtractor﹕ File not supported
02-22 10:17:54.600    1038-1277/? E/SuperExtractor﹕ File not supported
02-22 10:17:57.427    1038-1128/? E/SuperExtractor﹕ File not supported
02-22 10:17:57.450   1038-11210/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 3, volume 0.000000, delay 0
02-22 10:17:57.450   1038-11210/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 12, volume 0.000000, delay 0
02-22 10:17:57.500   1038-19084/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 3, volume 0.100000, delay 500
02-22 10:17:57.500   1038-19084/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 12, volume 0.100000, delay 500
02-22 10:17:58.587    1038-1128/? E/SuperExtractor﹕ File not supported
02-22 10:17:58.597    1038-1128/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 3, volume 0.000000, delay 0
02-22 10:17:58.597    1038-1128/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 12, volume 0.000000, delay 0
02-22 10:17:58.807   1038-19086/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 3, volume 0.100000, delay 500
02-22 10:17:58.807   1038-19086/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 12, volume 0.100000, delay 500
02-22 10:18:05.087   1038-11211/? E/SuperExtractor﹕ File not supported
02-22 10:18:35.120    1132-1370/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.lge.android.worldclock.w
02-22 10:18:45.517  29533-29533/? E/wpa_supplicant﹕ WEXT: STOP when iface is UP
02-22 10:18:45.887    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 0 because Mobile Data Disabled
02-22 10:18:45.887    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 2 because Mobile Data Disabled
02-22 10:18:45.887    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 3 because Mobile Data Disabled
02-22 10:18:45.887    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 4 because Mobile Data Disabled
02-22 10:18:45.887    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 5 because Mobile Data Disabled
02-22 10:18:48.017   1132-16702/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.google.android.apps.uplo
02-22 10:18:51.717    1331-1331/? E/SIM_STK﹕ Inititating Monitor
02-22 10:20:15.127    1331-1331/? E/SIM_STK﹕ SPN: BA-EronetPLMN: ERONET
02-22 10:20:15.127    1331-1331/? E/SIM_STK﹕ showspn: trueshowPlmn: false
02-22 10:20:15.127    1331-1331/? E/SIM_STK﹕ Before Posting Intent, country_sim = BA   operator_Sim = Eronet
02-22 10:20:15.127    1331-1331/? E/SIM_STK﹕ ShowSpn = true   Plmn = false
02-22 10:20:29.387    1132-1199/? E/Tethering﹕ active iface (usb0) reported as added, ignoring
02-22 10:22:21.417    1132-1199/? E/Tethering﹕ active iface (usb0) reported as added, ignoring
02-22 10:23:24.337    1331-1331/? E/SIM_STK﹕ SPN: BA-EronetPLMN: ERONET
02-22 10:23:24.337    1331-1331/? E/SIM_STK﹕ showspn: trueshowPlmn: false
02-22 10:23:24.337    1331-1331/? E/SIM_STK﹕ Before Posting Intent, country_sim = BA   operator_Sim = Eronet
02-22 10:23:24.337    1331-1331/? E/SIM_STK﹕ ShowSpn = true   Plmn = false
02-22 10:23:27.227    1132-1199/? E/Tethering﹕ active iface (usb0) reported as added, ignoring
02-22 10:23:51.739    1331-1331/? E/SIM_STK﹕ Inititating Monitor
02-22 10:24:35.767    1132-1199/? E/Tethering﹕ active iface (usb0) reported as added, ignoring
02-22 10:24:57.237    1132-1199/? E/Tethering﹕ active iface (usb0) reported as added, ignoring
02-22 10:26:27.237    1132-1199/? E/Tethering﹕ active iface (usb0) reported as added, ignoring
02-22 10:27:12.567    1132-1199/? E/Tethering﹕ active iface (usb0) reported as added, ignoring
02-22 10:27:57.237    1132-1199/? E/Tethering﹕ active iface (usb0) reported as added, ignoring
02-22 10:28:05.117  29533-29533/? E/wpa_supplicant﹕ ioctl[SIOCSIWSCAN]
02-22 10:28:07.317   1132-29539/? E/﹕ dhcp_do_request:: DHCP result prop_value is ok
02-22 10:28:07.317   1132-29539/? E/WifiStateTracker﹕ [dhcp handler] release sWiFiDhcpWakeLock
02-22 10:28:10.477    1132-1138/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.lge.android.worldclock.w
02-22 10:28:10.707   5456-19771/? E/TalkProvider﹕ replaceContactWithContactId: contactId==0!!! dvasic1@gmail.com, acct=1
02-22 10:28:10.707   5456-19771/? E/TalkProvider﹕ insert presence failed for account=1 username=dvasic1@gmail.com client_type=2 status= cap=0 priority=0 mode=3
02-22 10:28:20.707  29533-29533/? E/wpa_supplicant﹕ WEXT: STOP when iface is UP
02-22 10:28:20.707    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 0 because Mobile Data Disabled
02-22 10:28:20.707    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 2 because Mobile Data Disabled
02-22 10:28:20.707    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 3 because Mobile Data Disabled
02-22 10:28:20.707    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 4 because Mobile Data Disabled
02-22 10:28:20.707    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 5 because Mobile Data Disabled
02-22 10:28:21.467    1132-1350/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.google.android.apps.uplo
02-22 10:28:51.788    1331-1331/? E/SIM_STK﹕ Inititating Monitor
02-22 10:29:09.147  29533-29533/? E/wpa_supplicant﹕ ioctl[SIOCSIWSCAN]
02-22 10:29:11.257    1038-1277/? E/SuperExtractor﹕ File not supported
02-22 10:29:11.397   1132-29539/? E/﹕ dhcp_do_request:: DHCP result prop_value is ok
02-22 10:29:11.397   1132-29539/? E/WifiStateTracker﹕ [dhcp handler] release sWiFiDhcpWakeLock
02-22 10:29:12.860   5456-19974/? E/TalkProvider﹕ replaceContactWithContactId: contactId==0!!! dvasic1@gmail.com, acct=1
02-22 10:29:12.860   5456-19974/? E/TalkProvider﹕ insert presence failed for account=1 username=dvasic1@gmail.com client_type=2 status= cap=0 priority=0 mode=3
02-22 10:29:27.237    1132-1199/? E/Tethering﹕ active iface (usb0) reported as added, ignoring
02-22 10:29:34.677  20019-20019/? E/dalvikvm-heap﹕ Creating VM heap of size start:2097152 max:268435456 base:0x40011000
02-22 10:29:38.900  20056-20056/? E/dalvikvm-heap﹕ Creating VM heap of size start:2097152 max:268435456 base:0x4002d000
02-22 10:29:41.477   1477-20061/? E/RJ﹕ START DB REFRESH
02-22 10:29:42.937  20074-20074/? E/dalvikvm-heap﹕ Creating VM heap of size start:2097152 max:268435456 base:0x40011000
02-22 10:29:47.897  20105-20105/app.sercas.dev E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{app.sercas.dev/app.sercas.dev.map}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
            at android.app.ActivityThread.access$1500(ActivityThread.java:117)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:130)
            at android.app.ActivityThread.main(ActivityThread.java:3683)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:507)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:861)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:619)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:213)
            at android.app.Activity.setContentView(Activity.java:1663)
            at app.sercas.dev.map.onCreate(map.java:17)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
            at android.app.ActivityThread.access$1500(ActivityThread.java:117)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:130)
            at android.app.ActivityThread.main(ActivityThread.java:3683)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:507)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:861)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:619)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/app.sercas.dev-1.apk]
            at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
            at android.view.LayoutInflater.createView(LayoutInflater.java:471)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:213)
            at android.app.Activity.setContentView(Activity.java:1663)
            at app.sercas.dev.map.onCreate(map.java:17)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
            at android.app.ActivityThread.access$1500(ActivityThread.java:117)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:130)
            at android.app.ActivityThread.main(ActivityThread.java:3683)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:507)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:861)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:619)
            at dalvik.system.NativeStart.main(Native Method)
02-22 10:29:51.557    1477-1477/? E/AllAppsWorkspace﹕ ***Start*** init Horizontal Grid View, instance id=com.lge.launcher.AllAppsWorkspace@405655b0
02-22 10:29:51.837    1477-1477/? E/AllAppsWorkspace﹕ ***End*** init Horizontal Grid View
02-22 10:29:52.607   1132-22422/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.google.android.partnerse
02-22 10:29:52.967    1132-1132/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.google.android.apps.maps
02-22 10:29:54.137    1132-1380/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.google.android.googlequi
02-22 10:29:54.667    1132-1370/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.lge.android.worldclock.w
02-22 10:29:54.827   1132-22421/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.google.android.apps.maps
02-22 10:30:09.857   1132-31400/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.lge.android.worldclock.w
02-22 10:30:09.907   1038-11210/? E/SuperExtractor﹕ File not supported
02-22 10:30:10.127  15486-20271/? E/ActivityThread﹕ Failed to find provider info for com.facebook.wakizashi.provider.MessagesForegroundProvider
02-22 10:30:10.127  15486-20271/? E/ActivityThread﹕ Failed to find provider info for com.facebook.katana.provider.MessagesForegroundProvider
02-22 10:30:11.208  15486-15486/? E/dalvikvm﹕ Could not find class 'com.facebook.ui.c.d', referenced from method com.facebook.ui.c.c.c
02-22 10:30:11.267  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x0101039c
02-22 10:30:11.497   1038-11210/? E/SuperExtractor﹕ File not supported
02-22 10:30:11.537   1038-11210/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 3, volume 0.000000, delay 0
02-22 10:30:11.537   1038-11210/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 12, volume 0.000000, delay 0
02-22 10:30:12.467  15486-20271/? E/ActivityThread﹕ Failed to find provider info for com.facebook.wakizashi.provider.MessagesForegroundProvider
02-22 10:30:12.477  15486-20271/? E/ActivityThread﹕ Failed to find provider info for com.facebook.katana.provider.MessagesForegroundProvider
02-22 10:30:12.517  15486-20271/? E/ActivityThread﹕ Failed to find provider info for com.facebook.wakizashi.provider.MessagesForegroundProvider
02-22 10:30:12.517  15486-20271/? E/ActivityThread﹕ Failed to find provider info for com.facebook.katana.provider.MessagesForegroundProvider
02-22 10:30:12.617  15486-20271/? E/ActivityThread﹕ Failed to find provider info for com.facebook.wakizashi.provider.MessagesForegroundProvider
02-22 10:30:12.617  15486-20271/? E/ActivityThread﹕ Failed to find provider info for com.facebook.katana.provider.MessagesForegroundProvider
02-22 10:30:12.807   1038-11210/? E/SuperExtractor﹕ File not supported
02-22 10:30:15.807   1038-20287/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 3, volume 0.100000, delay 500
02-22 10:30:15.807   1038-20287/? E/AudioPolicyManagerBase﹕ setStreamVolume() for output 1 stream 12, volume 0.100000, delay 500
02-22 10:30:20.807  15486-15486/? E/ResourceType﹕ Style contains key with bad entry: 0x0101039c
02-22 10:30:21.090    1038-1128/? E/SuperExtractor﹕ File not supported
02-22 10:30:56.037    1132-1199/? E/Tethering﹕ active iface (usb0) reported as added, ignoring
02-22 10:30:57.237    1132-1199/? E/Tethering﹕ active iface (usb0) reported as added, ignoring
02-22 10:31:01.657  29533-29533/? E/wpa_supplicant﹕ WEXT: STOP when iface is UP
02-22 10:31:01.697    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 0 because Mobile Data Disabled
02-22 10:31:01.697    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 2 because Mobile Data Disabled
02-22 10:31:01.697    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 3 because Mobile Data Disabled
02-22 10:31:01.697    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 4 because Mobile Data Disabled
02-22 10:31:01.697    1132-1269/? E/ConnectivityService﹕ not failing over to mobile type 5 because Mobile Data Disabled
02-22 10:31:04.377    1132-1138/? E/ActivityManager﹕ heap conf. property name string trimmed: hs.com.google.android.apps.uplo

Activity:
public class map extends FragmentActivity {
GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.map_view);
    mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
}
}

map_view.xml:
<?xml version="1.0" encoding="utf-8" ?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
class="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />

Any help would be greatly apreciated.
EDIT:
Manifest.xml
    <?xmlversion="1.0"encoding="utf-8"?>
<manifestxmlns:android="http://schemas.android.com/apk/res/android"
package="app.sercas.dev"
android:versionCode="1"
android:versionName="1.0">

<uses-permissionandroid:name="android.permission.INTERNET"/>
<uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permissionandroid:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>

<uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION"/>

<uses-featureandroid:glEsVersion="0x00020000"android:required="true"/>

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

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">

<activity
android:name="app.sercas.dev.map"
android:label="@string/app_name">
<intent-filter>
<actionandroid:name="android.intent.action.MAIN"/>

<categoryandroid:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<meta-dataandroid:name="com.google.android.maps.v2.API_KEY"android:value="AIzaS***********Fg0"/>
<meta-dataandroid:name="com.google.android.gms.version"android:value="@integer/google_play_services_version"/>
</application>

</manifest>

I have edited the file to include manifest file.

A: u have to add this permission into ur manifest file
<permission
        android:name="app.sercas.dev.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

<uses-permission android:name="app.sercas.dev.permission.MAPS_RECEIVE"/>

I think this is u r missing.After adding this if ur problem is not solved then check ur API-Key is correct or not which u have generated using ur computer's SHA-1 fingerprint;app.sercas.dev.

A: inside your map_view.xml, change:
class="com.google.android.gms.maps.SupportMapFragment"

to:
android:name="com.google.android.gms.maps.SupportMapFragment"

A: Try this for map_view.xml, works for me that way:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".map" >

    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment" />

</RelativeLayout>

A: Finally got it to work should read the log errors carefilly found this:
The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4030500 but found 4.

So I changed the integer value on meta tag:
<meta-data android:name="com.google.android.gms.version" android:value="@integer/gp_version" />

With the value 4030500 and now it works thanks @kaushik for the help if I had not read the logcat the right way wouldnt have found this :)