text:
Q: Extension methods (class) or Visitor Pattern When setting out good design, which would you choose, extension methods or the visitor pattern?.
Which is easier to design for, when should you use an extension method over a visitor pattern and vice verso?
Is there any good valid reason to use an extension method over a visitor class, apart from syntactical sugar to aid in program readability?
How would you design for a system that incorporates extension methods, would you classify them in a UML diagram?
namespace ExtensionMethods
{
    public static class MyExtensions
    {
        public static int WordCount(this String str)
        {
            return str.Split(new char[] { ' ', '.', '?' },
                             StringSplitOptions.RemoveEmptyEntries).Length;
        }
    }
}

I may have the wrong pattern, it looks like a visitor pattern from the code above. So I think my comparison holds up.
Some code, I would say that the extension method looks like a visitor pattern.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    #region Interfaces

    public interface IFred
    {
        string Data
        {
            get;
            set;
        }

        string doSomething();
    }

    public interface IBob
    {
        string Data
        {
            get;
            set;
        }
    }

    #endregion

    #region fred stuff

    public partial class Fred : IFred
    {

        public string doSomething()
        {
            return this.Data + " is really cool";
        }

        public string Value()
        {
            throw new NotImplementedException();
        }

    }

    public partial class Fred
    {
        public string Data
        {
            get;
            set;
        }
    }

    #endregion

    #region bob stuff

    public class BobData : IBob
    {
        public string Data
        {
            get;
            set;
        }
    }

    public class BobData2 : IBob
    {
        private string pData;
        public string Data
        {

            get
            {
                return pData + " and then some!";
            }
            set
            {
                pData = value;
            }
        }
    }

    public class BobVisitor
    {
        public string dosomething(IBob bobData)
        {
            Console.WriteLine(bobData.Data);
            return "ok";
        }

        public string dosomethingOnlyToBob(BobData bobData)
        {
            Console.WriteLine("hello bob version 1");
            return "ok";
        }

        public string dosomethingOnlyToBob2(BobData2 bobData)
        {
            Console.WriteLine("hello bob version 2");
            return "ok";
        }

    }

    #endregion

    public static class Visitor
    {
        public static string visit(this IBob bobObj)
        {
            Console.WriteLine(bobObj.Data);
            return "ok";

        }

        public static string visit(this IFred fredObj)
        {
            Console.WriteLine(fredObj.Data);
            return "ok";
        }
    }

    class Program
    {
        static void Main(string[] args)
        {

            //Another way of abstracting methods from data, using Partial Classes.
            var fredObj = new Fred();
            fredObj.Data = "fred data";
            fredObj.doSomething();

            //Create the bob classes version 1 and 2
            var bobObj = new BobData();
            bobObj.Data = "bob data";

            var bob2Obj = new BobData2();
            bob2Obj.Data = "bob 2 data";

            //using the bobVisitor Class
            var bobVisitor = new BobVisitor();

            bobVisitor.dosomething(bobObj);
            bobVisitor.dosomething(bob2Obj);

            bobVisitor.dosomethingOnlyToBob(bobObj);
            bobVisitor.dosomethingOnlyToBob2(bob2Obj);

            //using the extension methods in the extension class
            bobObj.visit();
            fredObj.visit();

            Console.Read();
        }
    }
}

A: You probably should be comparing the visitor pattern against the template method pattern, as those are two things you can compare and contrast.
Comparing the visitor pattern with extension methods is like comparing a car with a bicycle sprocket.
In any case, extension methods are useful anywhere a non virtual method is useful, with the added bonus that you don't need to own the type to define an extension method.
Both the template method and visitor pattern are design patterns intended to operate over trees of objects. The "classic" definition of both requires a virtual method in each "node type" in the object tree. However, it is possible to implement both using non virtual methods if necessary. There are some limitations, such as access to private and protected members, but ignoring that, either pattern can be implemented with extension methods.
The template method pattern works by adding a virtual method for an operation to each type in the object tree, with "aggregate nodes" calling into to the method on their contained nodes.
An example might be a "print" method for an expression tree.
public class Node
{
   abstract void print();
}

public class AddExpression : Node {
    Node Left;
    Node Right;

    virtual void print() {
        Left.Print();
        Console.WriteLine("+");
        Right.Print();
    }
}

This has a major benefit, in that adding new node types only requires incremental effort. Only the new types need to be changed. It has a drawback, however, in that adding new operations requires editing every single type.
The visitor pattern generalizes template methods into a single method called accept that takes a visitor object as a parameter. It looks something like:
interface Visitor {
    void VisitAdd(AddExpression e);
    void VisitSubtract(SubtractExpression e);
}
abstract class Node {
    abstract void Accept(Visitor v);
}
class AddExpression : Node {
    //...
    virtual void Accept(Visitor v) {
        Left.Accept(v);
        v.VisitAdd(this);
        Right.Accept(v);
    }
}

This has the opposite tradeoffs. Adding new operations only requires writing one new class, but adding a new type requires editing every operation.
The classic advice is to use template method when the operations are (relatively fixed) but new object types can be added frequently. Similarly, visitors should be used when the object typed are fixed, but new operations can be added frequently,
If both change equally, then your decision should be based on balancing:

*

*Clarity (template methods are easier to understand, and avoid the overhead of double dispatch).

*Reuse (visitors factor common traversal code into a single place).

A: Extension methods aren't a pattern.  They are just some language syntax which makes code easier to read.
Visitor pattern is an entire different beast.  I don't really know why you are comparing the two.


text:
Q: Как записать воспроизводимый звук в файл? У меня есть программа для Android с клавишами (UI-Button). На них наложен C#-код для воспроизведения заданных звуков.
Мне нужно создать новую кнопку, которая при нажатии будет активировать запись звука воспроизводимого при нажатии на клавиши и сохранять результат в выбранную папку.
Код для клавиш:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.Events;

public class Keys : MonoBehaviour, IPointerDownHandler {

    public AudioClip Sound;

    public Button button { get { return GetComponent<Button>(); } }
    public AudioSource source { get { return GetComponent<AudioSource>(); } }

    public void OnPointerDown(PointerEventData eventData)
    {
        ((IPointerDownHandler)button).OnPointerDown(eventData);
        source.PlayOneShot(Sound);
    }

    private void Start()
    {
        gameObject.AddComponent<AudioSource>();
        source.clip = Sound;
        source.playOnAwake = false;
    }

}

A: void Start () {
    string [] dev = Microphone.devices;
    string micro = dev[0];

   /* foreach (string a in dev)
    {
        Debug.Log(a);
    }
    вывод всех микрофонов в консоль, если приспичит потестить на коспе
    */
    Microphone.Start(micro,false,10, 44100);

    //micro - микрофон выбирает самый первый в списке
    //false - стоит ли продолжать запись после 10 сек
    //10 - сек время воспроизведения
    //44100 - Частота дискретизации аудиоклипа
    //так же применимо для source
    source = Microphone.Start(micro,false,10, 44100);
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: In python's tkinter, how can I make a Label such that you can select the text with the mouse? In python's tkinter interface, is there a configuration option that will change a Label such that you can select the text in the Label and then copy it to the clipboard?
EDIT:
How would you modify this "hello world" app to provide such functionality?
from Tkinter import *

master = Tk()

w = Label(master, text="Hello, world!")
w.pack()

mainloop()

A: Made some changes to the above code:
from tkinter import *

master = Tk()

w = Text(master, height=1)
w.insert(1.0, "Hello, world!")
w.pack()

# if tkinter is 8.5 or above you'll want the selection background
# to appear like it does when the widget is activated
# comment this out for older versions of Tkinter
w.configure(bg=master.cget('bg'), relief="flat")

w.configure(state="disabled")

mainloop()

The relief needs to be flat in order for it to look like an ordinary part of the display. :)

A: You can make texts which are selectable using either Text or Entry
I really find both useful, using text can be really helpful! Here I show you a code of Entry:
from tkinter import *
root = Tk()
data_string = StringVar()
data_string.set("Hello World! But, Wait!!! You Can Select Me :)")
ent = Entry(root,textvariable=data_string,fg="black",bg="white",bd=0,state="readonly")
ent.pack()
root.mainloop()

A: Tried Bryan Oakley's answer. Able to select the text but couldn't copy it to clipboard. Here is a workaround.
from Tkinter import *

def focusText(event):
   w.config(state='normal')
   w.focus()
   w.config(state='disabled')

master = Tk()

w = Text(master, height=1, borderwidth=0)
w.insert(1.0, "Hello, world!")
w.pack()

w.configure(state="disabled")

w.bind('<Button-1>', focusText)

mainloop()

We could not copy the text unless the widget gets focused. We are anyway gonna use the mouse button1 (left-click) to select the text, so binding it to a function which enables the text widget, sets focus on it, then disables it again.

A: The easiest  way is to use a disabled text widget with a height of 1 line:
from Tkinter import *

master = Tk()

w = Text(master, height=1, borderwidth=0)
w.insert(1.0, "Hello, world!")
w.pack()

w.configure(state="disabled")

# if tkinter is 8.5 or above you'll want the selection background
# to appear like it does when the widget is activated
# comment this out for older versions of Tkinter
w.configure(inactiveselectbackground=w.cget("selectbackground"))

mainloop()

You could use an entry widget in a similar manner.

A: The other answers insert text to the text box instead of replacing the text. That works when you need to change the text only for one time. However, you need to delete the line first if you need to replace it. The following code would fix this issue:
from tkinter import *

master = Tk()

w = Text(master, height=1)
w.delete(1.0, "end")
w.insert(1.0, "Hello, world!")
w.pack()

# if tkinter is 8.5 or above you'll want the selection background
# to appear like it does when the widget is activated
# comment this out for older versions of Tkinter
w.configure(bg=master.cget('bg'), relief="flat")

w.configure(state="disabled")

mainloop()


text:
Q: Concept regarding Venturi Tube-Bernoulli application I was recently studying applications of Bernoulli Equation and came across the Venturi tube. This is diagram I have used to analyse the venturimeter. I understand how we obtain the first equation using bernoulli theorem which is
$$P_1 - P_2 =(1/2)ρ(v_2^2 - v_1^2)      \tag{1}$$
and also the continuity equation
$$A_1 v_1 = A_2 v_2. \tag{2}$$
However, I am unable to process how to obtain the following third equation
$$ P_1 - P_2 = ρgh $$
where $h$ is difference in the heights of the liquid level in the two tubes and $ρ$ is density of fluid.
Lets say the atmospheric pressure at the top of each tube is $P$. Now since the fluid in the two VERTICAL tubes are at rest and not moving, their velocities are 0. Hence, if I proceeded by applying Bernoulli equation.
$$P_1 +ρ(v_1^2)/2 = ρg(h_1) + P     \tag{3}$$  and
$$P_2 + ρ(v_2^2)/2 = ρg(h_2) + P     \tag{4}$$
Here $P_1$ and $P_2$ are the pressures at the points in the tube and constriction respectively and the points are at the SAME HORIZONTAL LEVEL.
Subtracting (3) and (4) and even using (1)  does not yield me
$$P_1 - P_2 = ρgh $$
rather gives me $0 = ρg(h)$ which makes no sense whatsoever.
What am I missing here and how do I obtain the right result ?

A:
Lets say the atmospheric pressure at the top of each tube is . Now since the fluid in the two VERTICAL tubes are at rest and not moving, their velocities are 0. Hence, if I proceeded by applying Bernoulli equation.

1+ρ(21)/2=ρ(ℎ1)+     (3)

and

2+ρ(22)/2=ρ(ℎ2)+     (4)

3 and 4 are incorrect. Bernoulli theorem goes as:
1/2ρ v ^2 + ρgh + P = constant
Your equation 3 and 4 does not equate the LHS to constant but to Pressure which is incorrect.
Note that P + ρgh1 = P1 in equation 3 which gives us velocity as zero.

A: You cannot apply Bernoulli's theorem through the two lateral pressure taps (where the vertical tubes are linked to the main tube). In general, it is assumed that the pressure is continuous and the speed is clearly discontinuous at this point. (To justify the continuity of the pressure, one would have to look in detail at the nature of the flow around the hole).
For a unidirectional flow, we can show that the pressure varies as in statics in a direction perpendicular to the flow (We prove this by projecting the Euler equation perpendicular to the flow).
So you can write, as for a static fluid $P_1=P+\rho g h_1$ and $P_2=P+\rho g h_2$

A: Let the atmospheric pressure be $P_0$
Therefore
$$P_1=P_0+\rho gh_1 \quad \text{and}\quad P_2=P_0+\rho gh_2$$
Subtracting we get the required equation
$$P_1-P_2=\rho gh$$


text:
Q: Maven isn't looking for dependencies in all provided repositories I have settings.xml with custom repositories for maven:
     <repositories>
                    <repository>
                        <id>id1</id>
                        <name>name1</name>
                        <releases>
                            <enabled>false</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                            <updatePolicy>always</updatePolicy>
                            <checksumPolicy>warn</checksumPolicy>
                        </snapshots>
                        <url>url1</url>
                        <layout>default</layout>
                    </repository>
                    <repository>
                        <id>id2</id>
                        <name>name2</name>
                        <snapshots>
                            <updatePolicy>never</updatePolicy>
                        </snapshots>
                        <releases>
                            <updatePolicy>never</updatePolicy>
                        </releases>
                        <url>url2</url>
                    </repository>
                    <repository>
                        <id>id3</id>
                        <url>url3</url>
                        <snapshots>
                            <updatePolicy>never</updatePolicy>
                        </snapshots>
                        <releases>
                            <updatePolicy>never</updatePolicy>
                        </releases>
                    </repository>
                    <repository>

                        <id>id4</id>
                        <url>url4</url>
                        <snapshots>
                            <updatePolicy>never</updatePolicy>
                        </snapshots>
                        <releases>
                            <updatePolicy>never</updatePolicy>
                        </releases>
                    </repository>
<repositories>

The dependency is present in url4 repository, however when i try to mvn clean install the project it stops at 2nd url and says it cannot find it here. Why is this happening? Why is it stopping there?

A: Settings xml file contains the details for possible servers to fetch from , you still need to specify them in the projects pom.xml (by specifying at least id) the separation between settings.xml and pom.xml is done so that pom.xml will not contain any sensitive data as it is usually committed.
As for why it stops at the 2nd url im not sure it is necessarily looks by a specific order .
Another point to consider is if for some reason you have tried to resolve the dependency and it was not in the repository at that time you will have to manually delete the caching file of that dependency from your .m2 repo under your os user directory


text:
Q: SVG in HTML: Inline vs. embed When I embed a set of SVG graphics elements inline into HTML I have access to e.g. a group, say a chesspiece, via its id-attribute and can make it clickable, draggable  and so on. Very nice and straight forward.
Now I remove the SVG code from the HTML and put it into a separate file which I include via
<embed src=... />

into the HTML. This works with no apparent difference in the rendering, but now I don't have access to the group via its id-attribute any more. With
<object data=...></object>

it is the same, by the way.
What am I missing?

A: If you have your script in the html file, you want something like this...
document.getElementById("embed_or_object_id").getSVGDocument().getElementById("element_id");


text:
Q: Prove that given a triangle satisfying $8\prod \sin\frac{A}{2}=\prod \cos(A-B)$ then that triangle is equilateral. Prove that given a triangle $ABC$ satisfying $$8 \sin\frac{A}{2}\sin\frac{B}{2}\sin\frac{C}{2} = \cos(A-B)\cos(B-C)\cos(C-A)$$ then that triangle is equilateral.

A: Let $p(a,b,c)$ be the left side of your equation, and $q(a,b,c)$ be the right side, using lower case for your $A,B,C$ for no real reason. The equation is then saying that $h(a,b,c)=0$ where $h(a,b,c)=p(a,b,c)-q(a,b,c).$
Now if $a+b<\pi$ we can get a legal triangle with angles $a,b,\pi-a-b.$ Define $w(a,b)=h(a,b,\pi-a-b),$ then if your equation were to hold only for equilateral triangles, we could have $w(a,b)=0$ only for $a=b=\pi/3.$ However for example $w(0.1,0.2)=-0.7648<0$ while $w(1.1,0.2)=0.3647>0.$ This means from the intermediate value theorem there is some $c$ between $0.1$ and $1.1$ for which $w(c,0.2)=0.$ However this $c$ is not $\pi/3$ [or rather more simply, $0.2 \neq \pi/3$] so that there are triangles not equilateral which satisfy your equation.


text:
Q: PHP to download generated CSV not pushing to the browser for download I have this function which generates a CSV and stores on the server (this works fine) however it is not pushing to the browser for the user to download, can anyone see why?
It is also putting the data into multiple sections like;
invoice details
customer details
invoice items
I would prefer if this put all the data onto 1 line rather than 3 sections but not sure how to do this.
Function:
// download invoice csv sheet
if ($action == 'download_csv'){

    header("Content-type: text/csv");

    // Connect to the database
    $mysqli = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);

    // output any connection error
    if ($mysqli->connect_error) {
        die('Error : ('.$mysqli->connect_errno .') '. $mysqli->connect_error);
    }

    $tables = array('invoices', 'customers', 'invoice_items'); // array of tables need to export

    $file_name = 'invoice-export-'.date('d-m-Y').'.csv';   // file name
    $file_path = 'downloads/'.$file_name; // file path

    $file = fopen($file_path, "w"); // open a file in write mode
    chmod($file_path, 0777);    // set the file permission

    // loop for tables
    foreach($tables as $table) {
        $table_column = array();
        $query_table_columns = "SHOW COLUMNS FROM $table";

        // fetch table field names
        if ($result_column = mysqli_query($mysqli, $query_table_columns)) {
            while ($column = $result_column->fetch_row()) {
                $table_column[] = $column[0];
            }
        }

        // Format array as CSV and write to file pointer
        fputcsv($file, $table_column, ",", '"');

        $query_table_columns_data = "SELECT * FROM $table";

        if ($result_column_data = mysqli_query($mysqli, $query_table_columns_data)) {

            // fetch table fields data
            while ($column_data = $result_column_data->fetch_row()) {
                $table_column_data = array();
                foreach($column_data as $data) {
                    $table_column_data[] = $data;
                }

                // Format array as CSV and write to file pointer
                fputcsv($file, $table_column_data, ",", '"');
            }
        }
    }

    // close file pointer
    fclose($file);

    // ask either save or open
    header("Pragma: public");
    header("Expires: 0");
    header("Content-Type: application/octet-stream");
    header("Content-Disposition: attachment; filename='{$file_name}';" );
    header("Content-Transfer-Encoding: binary");

    // open a saved file to read data
    $fhandle = fopen($file_path, 'r');
    fpassthru($fhandle);
    fclose($fhandle);
    $mysqli->close();
    die;

}

JS
function downloadCSV(action) {

        jQuery.ajax({

            url: 'response.php',
            type: 'POST',
            data: action,
            dataType: 'json',
            success: function(data){
                $("#response .message").html("Success: CSV has been successfully generated and also been stored in the downloads/ directory.");
                $("#response").removeClass("alert-warning").addClass("alert-success").fadeIn();
                $("html, body").animate({ scrollTop: $('#response').offset().top }, 1000);
            },
            error: function(data){
                $("#response .message").html("Error: Oppps there has been a problem, please try again.");
                $("#response").removeClass("alert-success").addClass("alert-warning").fadeIn();
                $("html, body").animate({ scrollTop: $('#response').offset().top }, 1000);
            }
        });

    }


text:
Q: How to create Foreign Key using MySQLdb After importing MySQLdb module I go ahead and connect to MySQl Maria db:
import  MySQLdb
db = MySQLdb.connect(host="localhost", user="user", passwd="pass", db="test")

Now I want to create two tables: Writers and Readers. I want Readers to have a Foreign Key attribute "Writer_id" that would point to the corresponding Writer:
with db:
    cHandler=db.cursor()
    cHandler.execute( "CREATE TABLE Writers(Id INT PRIMARY KEY AUTO_INCREMENT)")
    cHandler.execute( "CREATE TABLE Readers(Id INT PRIMARY KEY AUTO_INCREMENT, FOREIGN KEY(Writer_id) REFERENCES Writers(Id) ) ")

But the code fails with the error:
_mysql_exceptions.OperationalError: (1072, "Key column 'x' doesn't exist in table")

Where is the error?

A: with db:
    cHandler=db.cursor()

    cHandler.execute("DROP TABLE IF EXISTS Writers")
    cHandler.execute("DROP TABLE IF EXISTS Readers")

    cHandler.execute("CREATE TABLE Writers(Id INT PRIMARY KEY AUTO_INCREMENT, name TEXT)")
    cHandler.execute("CREATE TABLE Readers(Id INT PRIMARY KEY AUTO_INCREMENT, name TEXT, Writer_id INTEGER, FOREIGN KEY(Writer_id) REFERENCES Writers(Id))")

A: you have to create writer_id in Readers table first and then set it as a foreign key after.
cHandler.execute( "CREATE TABLE Readers(Id INT PRIMARY KEY AUTO_INCREMENT, Writer_id INT ) ")
cHandler.execute( "alter table Readers
add foreign key (Writer_id)
references Writers(Id)")


text:
Q: SceneKit : SCNPhysicsBody get current velocity How can I get the current velocity of a SCNPhyisicsBody?
The velocity property does always return (0.0, 0.0, 0.0), and the physicsBody of the prensetationNode of my SCNNode is also nil.

A: You can get the "current" velocity with
physicsBody.velocity

But this is valid only within the "game loop" callbacks (updateAtTime, didApplyAnimations, didSimulatePhysics, will/didRenderScene).

A: ...in your view controller, you have to use SCNSceneRendererDelegate protocol like
class GameViewController: UIViewController,SCNSceneRendererDelegate{...

and in the viewDidLoad method set the SCNView delegate to
    scnView.delegate=self
Then you can implement for example
func renderer(renderer: SCNSceneRenderer, didRenderScene scene: SCNScene, atTime time: NSTimeInterval) {

    let scnView = self.view as! SCNView
    let scene = scnView.scene
    let compass = scene?.rootNode.childNodeWithName("ObjectName", recursively: true)

    print((compass?.physicsBody?.angularVelocity)!)
}

this works in my case.
hope it helps a bit!


text:
Q: Deploying a vanilla jhipster app on Openshift It's been more than a week since I have started to try to deploy a vanilla jhipster application on Openshift. I have tried on Openshift and also on our private corporate instance of Openshift with no success.
I have tried several ways to do it, using the generator yo jhipster:openshift or manually with specific hook.
Using the generator, I have done :
yo jhipster (std app java 7 with H2/Mysql and maven)

git init

git add --all

git commit -m "A stupid message ;)."

yo jhipster:openshift

Please find the command line to start the app
[bienvenue-nomadys.kermit.rd.francetelecom.fr repo]\> java -server      -jar target/bienvenue-0.0.1-SNAPSHOT.war      --spring.profiles.active=prod      --server.address=${OPENSHIFT_DIY_IP}      --server.port=${OPENSHIFT_DIY_PORT}      --spring.datasource.url=jdbc:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME}      --spring.datasource.username=${OPENSHIFT_MYSQL_DB_USERNAME}      --spring.datasource.password=${OPENSHIFT_MYSQL_DB_PASSWORD}
And this is the log :
[INFO] com.orange.nomadis.Application - Starting Application on node1.kermit.rd.francetelecom.fr with PID 20787 (started by 54b7c9b8c3215e291500007e in /var/lib/openshift/54b7c9b8c3215e291500007e/app-root/runtime/repo)
[DEBUG] com.orange.nomadis.Application - Running with Spring Boot v1.2.0.RELEASE, Spring v4.1.3.RELEASE
[WARN] org.springframework.core.io.support.PathMatchingResourcePatternResolver - Skipping [/var/lib/openshift/54b7c9b8c3215e291500007e/app-root/runtime/repo/target/bienvenue-0.0.1-SNAPSHOT.war] because it does not denote a directory
Processus arrêté
I don't know what's going wrong and how to trace the execution.
I have no log, nothing.
[Edit]
After changing the execution mode of the build actions_hook in /deploy/openshift/.openshift/action_hooks I have errors with liquid base and spring.
this is the log :
[INFO] com.mycompany.myapp.Application - Starting Application on ex-std-node511.prod.rhcloud.com with PID 439180 (started by 54c2066a4382ec19ee0000bb in /var/lib/openshift/54c2066a4382ec19ee0000bb/diy)
[DEBUG] com.mycompany.myapp.Application - Running with Spring Boot v1.2.0.RELEASE, Spring v4.1.3.RELEASE
[WARN] org.springframework.core.io.support.PathMatchingResourcePatternResolver - Skipping [/var/lib/openshift/54c2066a4382ec19ee0000bb/app-root/runtime/repo/target/jhipster-0.0.1-SNAPSHOT.war] because it does not denote a directory
[DEBUG] org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
[DEBUG] com.mycompany.myapp.config.AsyncConfiguration - Creating Async Task Executor
[DEBUG] com.mycompany.myapp.config.MetricsConfiguration - Registering JVM gauges
[INFO] com.mycompany.myapp.config.MetricsConfiguration - Initializing Metrics JMX reporting
[DEBUG] com.mycompany.myapp.config.DatabaseConfiguration - Configuring Datasource
[ERROR] org.springframework.boot.context.embedded.tomcat.ServletContextInitializerLifecycleListener - Error starting Tomcat context: org.springframework.beans.factory.BeanCreationException
[WARN] org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:124) [spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474) ~[spring-context-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109) [spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) [spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) [spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at com.mycompany.myapp.Application.main(Application.java:56) [classes!/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_75]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_75]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_75]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_75]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53) [jhipster-0.0.1-SNAPSHOT.war:na]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_75]
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:97) ~[spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.(TomcatEmbeddedServletContainer.java:74) ~[spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:374) ~[spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:150) ~[spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:148) [spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:121) [spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    ... 11 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.core.userdetails.UserDetailsService com.mycompany.myapp.config.SecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mycompany.myapp.repository.UserRepository com.mycompany.myapp.security.UserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#2e100c' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#2e100c': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/mycompany/myapp/config/DatabaseConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [liquibase.integration.spring.SpringLiquibase]: Factory method 'liquibase' threw exception; nested exception is liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: Could not find implementation of liquibase.logging.Logger
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:371) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1006) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.boot.context.embedded.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:176) ~[spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:141) ~[spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:136) ~[spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.ServletContextInitializerBeans.addAdaptableBeans(ServletContextInitializerBeans.java:119) ~[spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.ServletContextInitializerBeans.(ServletContextInitializerBeans.java:69) ~[spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getServletContextInitializerBeans(EmbeddedWebApplicationContext.java:216) [spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:202) ~[spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.ServletContextInitializerLifecycleListener.lifecycleEvent(ServletContextInitializerLifecycleListener.java:64) ~[spring-boot-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) ~[tomcat-embed-core-8.0.15.jar!/:8.0.15]
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) ~[tomcat-embed-core-8.0.15.jar!/:8.0.15]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5095) ~[tomcat-embed-core-8.0.15.jar!/:8.0.15]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[tomcat-embed-core-8.0.15.jar!/:8.0.15]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) ~[tomcat-embed-core-8.0.15.jar!/:8.0.15]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) ~[tomcat-embed-core-8.0.15.jar!/:8.0.15]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) ~[na:1.7.0_75]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_75]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_75]
    ... 1 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.core.userdetails.UserDetailsService com.mycompany.myapp.config.SecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mycompany.myapp.repository.UserRepository com.mycompany.myapp.security.UserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#2e100c' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#2e100c': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/mycompany/myapp/config/DatabaseConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [liquibase.integration.spring.SpringLiquibase]: Factory method 'liquibase' threw exception; nested exception is liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: Could not find implementation of liquibase.logging.Logger
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:646) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    ... 34 common frames omitted
Caused by: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.core.userdetails.UserDetailsService com.mycompany.myapp.config.SecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mycompany.myapp.repository.UserRepository com.mycompany.myapp.security.UserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#2e100c' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#2e100c': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/mycompany/myapp/config/DatabaseConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [liquibase.integration.spring.SpringLiquibase]: Factory method 'liquibase' threw exception; nested exception is liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: Could not find implementation of liquibase.logging.Logger
    at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:164) ~[spring-context-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.evaluateBeanDefinitionString(AbstractBeanFactory.java:1354) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:964) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:603) ~[spring-beans-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
    ... 36 common frames omitted
.........
lots of exceptions from here to there
.........
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/mycompany/myapp/config/DatabaseConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [liquibase.integration.spring.SpringLiquibase]: Factory method 'liquibase' threw exception; nested exception is liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: Could not find implementation of liquibase.logging.Logger
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:602)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1006)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
    ... 98 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [liquibase.integration.spring.SpringLiquibase]: Factory method 'liquibase' threw exception; nested exception is liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: Could not find implementation of liquibase.logging.Logger
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:591)
    ... 109 more
Caused by: liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: Could not find implementation of liquibase.logging.Logger
    at liquibase.logging.LogFactory.getLog(LogFactory.java:46)
    at liquibase.logging.LogFactory.getLogger(LogFactory.java:37)
    at liquibase.integration.spring.SpringLiquibase.(SpringLiquibase.java:134)
    at com.mycompany.myapp.config.DatabaseConfiguration.liquibase(DatabaseConfiguration.java:87)
    at com.mycompany.myapp.config.DatabaseConfiguration$$EnhancerBySpringCGLIB$$7370c48f.CGLIB$liquibase$1()
    at com.mycompany.myapp.config.DatabaseConfiguration$$EnhancerBySpringCGLIB$$7370c48f$$FastClassBySpringCGLIB$$cd6ab8fb.invoke()
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
    at com.mycompany.myapp.config.DatabaseConfiguration$$EnhancerBySpringCGLIB$$7370c48f.liquibase()
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 110 more
Caused by: liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: Could not find implementation of liquibase.logging.Logger
    at liquibase.servicelocator.ServiceLocator.newInstance(ServiceLocator.java:188)
    at liquibase.logging.LogFactory.getLog(LogFactory.java:44)
    ... 123 more
Caused by: liquibase.exception.ServiceNotFoundException: Could not find implementation of liquibase.logging.Logger
    at liquibase.servicelocator.ServiceLocator.findClass(ServiceLocator.java:154)
    at liquibase.servicelocator.ServiceLocator.newInstance(ServiceLocator.java:186)
    ... 124 more

A: it seems that problem is caused because the build hook wasn't  executed correctly. sometimes I have gotten a permissions problem for the build hook script. if that is the case execute the following
chmod +x .openshift/action_hooks/build
git push

A: Looks to me like maven is trying to autoConfigure your liquibase plugin. I got this error too. I didn't want liquibase to be autoConfigured so I added this just above my main() class declaration:
@EnableAutoConfiguration(exclude={LiquibaseAutoConfiguration.class})

This got rid of my error.


text:
Q: If $\lim_{x \to a}(f(x)+g(x))=\lim_{x \to a}(f(x)g(x))=0$ then $\lim_{x \to a}f(x)=\lim_{x \to a} g(x)$? Is the following true?

If $\lim_{x \to a}(f(x)+g(x))=\lim_{x \to a}(f(x)g(x))=0$ then $\lim_{x \to a}f(x)=\lim_{x \to a} g(x)$

My attempt:
Couldn't come up with a counter example. Also, solving the system
$\begin{cases} f+g=s \\fg=p \end{cases}$
for $f,g$ gives
$$\left\{\left\{f\to \frac{1}{2} \left(s-\sqrt{s^2-4 p}\right),g\to \frac{1}{2} \left(\sqrt{s^2-4 p}+s\right)\right\},\left\{f\to \frac{1}{2} \left(\sqrt{s^2-4 p}+s\right),g\to \frac{1}{2} \left(s-\sqrt{s^2-4 p}\right)\right\}\right\} $$
which seems to suggest that the limits of $f$ and $g$ at $a$ are equal. However, I'm not certain whether the square roots exist in a neighbourhood of $a$, and even if they do, I can't formulate a complete proof.
Can anyone please help me?
Thanks!


text:
Q: unicode endian puzzled me i edit three  files which have same content "你"(is you in english) in it in three different forms--gbk\utf-8\ucs-2  with gedit  named "ok1,ok2,ok3".
>>> f1 = open('ok1', 'rb').read()
>>> f2 = open('ok2', 'rb').read()
>>> f3 = open('ok3', 'rb').read()
>>> f1
'\xc4\xe3\n'
>>> f2
'\xe4\xbd\xa0\n'
>>> f3
'`O\n\x00'
>>> hex(ord("`"))
'0x60'
>>> hex(ord("O"))
'0x4f'

in fact f3 is '\x60\x4f',
but the following output confused me
>>> '\xe4\xbd\xa0'.decode("utf-8")
u'\u4f60'
>>> '\xc4\xe3'.decode("gbk")
u'\u4f60'
>>>

why only there is endian problem in ucs-2(or say unicode) ,not in utf-8,not in gbk?

A: UTF-8 and GBK store data in a sequence of bytes. It is strongly defined which byte value comes after which in these encodings. This byte order does not change with the architecture used in coding, transmission or decoding.
On the other hand, UCS-2 or the new UTF-16 store data in sequences of 2-bytes. The order of individual bytes within these 2-byte tokens is the endianness and it depends on the underlying machine architecture. Systems must have an agreement on how to identify the endianness of tokens before communicating with data encoded in UCS-2.
In your case, Unicode point U+4F60 is coded in UCS-2 as a single 2-byte token 0x4F60. Since your machine puts the least significant byte before the most significant one in memory alignment, the sequence ('0x60', '0x4F') has been put into the file. Thus, file read will yield the bytes in this order.
Python can still decode this data correctly since it will read the bytes in correct order before forming the 2-byte token:
>>> '`O\n\x00'.decode('utf-16')
u'\u4f60\n'

A: Endian-ness only applies to multi-byte words, but UTF-8 uses units of 8 bits to encode information (that's what the 8 in the name stands for). There never is the question of confusion of ordering there.
Sometimes it may need more than one of those units to encode information, but they are considered distinct. The letter A is one byte, 0x41, for example. When it has to encode a character with more bytes, it uses a leading indicator byte, followed by extra continuation bytes to capture all the information needed for that character. Logically, these are distinct units.
GBK uses a similar scheme; characters use units of 1 byte, and just like UTF-8, a second byte can be used for some of the characters.
UCS-2 (and it's successor, UTF-16) on the other hand, is a 2-byte format. It encodes information in units of 16 bits, and those 16 bits always go together. The 2 bytes in that unit belong together logically, and modern architectures treat these as one unit, and thus have made a decision in what order they are stored. That's where endianess comes in, the order of the 2 bytes in a unit is architecture dependant. In your architecture, the bytes are ordered using little-endianess, meaning that the 'smaller' byte goes first. This is why the 0x4F byte comes before the 0x60 byte in your file.
Note that python can read either big or little endian UTF-16 just fine; you can pick the endianess explicitly if there is no indicator character at the start (the Byte Order Mark, or BOM):
>>> '`O\n\x00'.decode('utf-16')
u'\u4f60\n'
>>> '`O\n\x00'.decode('utf-16-le')
u'\u4f60\n'
>>> 'O`\x00\n'.decode('utf-16-be')
u'\u4f60\n'

In the latter example the bytes have been reversed, and decoded as big-endian.


text:
Q: Deactivate key events from mouse side-buttons I'm having a similar problem to this question - I run Linux with an Apple Mouse connected which has these horrible side buttons which I press accidentally all the time. Among other things, it has revealed a bug in Thunderbird that caused it to completely wipe my IMAP inbox.
So I have to deactivate that button. The answer given in the linked question unfortunately does not fully work, because I am seeing another key event being emitted (as shown by running xev):
ButtonPress event, serial 36, synthetic NO, window 0x3200001,
    root 0x283, subw 0x3200002, time 150944932, (37,43), root:(39,148),
    state 0x0, button 8, same_screen YES

EnterNotify event, serial 36, synthetic NO, window 0x3200001,
    root 0x283, subw 0x0, time 150944840, (37,43), root:(39,148),
    mode NotifyGrab, detail NotifyInferior, same_screen YES,
    focus YES, state 0

KeymapNotify event, serial 36, synthetic NO, window 0x0,
    keys:  4294967171 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

ButtonRelease event, serial 36, synthetic NO, window 0x3200001,
    root 0x283, subw 0x3200002, time 150945092, (37,43), root:(39,148),
    state 0x0, button 8, same_screen YES

LeaveNotify event, serial 36, synthetic NO, window 0x3200001,
    root 0x283, subw 0x0, time 150944975, (37,43), root:(39,148),
    mode NotifyUngrab, detail NotifyInferior, same_screen YES,
    focus YES, state 0

Using the following entries in ~/.Xmodmap gets rid of the button-press events:
! Disable buttons 8 and 9
pointer = 1 2 3 4 5 6 7 0 0

But the key event is different. I don't see a key code, instead this enumeration of numbers under keys. The first number is hex 0xffffff83 or understood as 32-bit signed integer -125.

How do I deactivate the emission of the above mentioned key event (KeymapNotify)?

A: As @Leiaz points out, the KeymapNotify is not actually the problem. I had forgotten to re-load the mod map. The following works. Add this to ~/.Xmodmap:
! Disable button 8
pointer = 1 2 3 4 5 6 7 0 9 10 11 12

(the 8 is left out).
Then reload
xmodmap ~/.Xmodmap


text:
Q: Java Generic Methods Motivation I am reading a Java text book and the writer to show usefulness of generic types in methods use an example:
public class BoundedTypeDemo {
    public static void main(String[] args ) {
        Rectangle rectangle = new Rectangle(2, 2);
        Circle circle = new Circle(2);
        System.out.println("Same area? " +
        equalArea(rectangle, circle));
    }

    public static <E extends GeometricObject> boolean equalArea(E object1, E object2) {
        return object1.getArea() == object2.getArea();
    }
 }

This is a ridiculous example... I do not understand where is the usefulness of using generic type in this particular example cause we could use GeometricObject as the type of equalArea method's parameters


text:
Q: Removing unwanted uploads from AppEngine deployment I am working on a GWT/AppEngine project and noticed that all my GWT java classes end up in compiled form in the WEB-INF/classes/projectpackage/client/ folder of the appcfg staging directory. Not only does this create a bunch of unwanted upload-data for every deploy, but I also really would rather not share these files with the world.
Is there a way to exclude these files from the upload? A setting in Eclipse would be amazing, but, of course, an entry in appengine-web.xml would do the trick just as well...

A: You can accomplish this using Ant with the added performance benefit given by having your classes jarred.
1) run a gwt compile from eclipse
2) run something like the ant task below (easily done with eclipse using the Ant view):
 <property name="staging.dir" value="war" />

 <property name="classes.dir" value="${staging.dir}/WEB-INF/classes" />

    <target name="jarClasses">
       <delete file="${staging.dir}/WEB-INF/lib/classes.jar" />
       <echo> ${staging.dir}/WEB-INF/lib/classes.jar DELETED </echo>
       <jar destfile="${staging.dir}/WEB-INF/lib/classes.jar" basedir="${classes.dir}"
           excludes="${classes.dir}/projectpackage/client/*.*"/>
       <echo> ${staging.dir}/WEB-INF/lib/classes.jar JARRED </echo>
       <delete dir="${classes.dir}" />
       <echo> ${classes.dir} DELETED </echo>
    </target>

3) do the upload using appcfg.sh (or windows version)

A: I think the best way to do this would be to split the client and server into two projects.  The GPE likes them to be in the same project, but this has the annoying side effects of a single output folder and a single classpath.
You can't tell it to compile your output to a different folder, because then your server class files won't be delivered there!
Outside splitting the two projects apart, I think the best answer is to write a script to delete the client/ subdirectory before uploading.  We've been frustrated by the GPE deploy button for its lack of scriptability, so we switched the compile/deploy process to an ant task.
Note: WEB-INF is not publicly viewable, so you probably haven't shown your class files to the world.


text:
Q: Determine outbound https requests underlying TLS version Summary
Is there a way to trace an outbound https request to verify TLS version with Red Hat / Unix. Something similar to Fiddler or Wireshark for Windows.
Background
I have a Java Application performing an outbound request to a third-party API that is failing with an SSL handshake error. I am unable to amend the call to Java so unable to use -djavax flags. Is there something I can trace with outside of the Java App? At OS level perhaps?
Everything on the server and application is configured to use TLS 1.2 but the third-party API is still rejecting the request.
My theory is that our outbound requests are still leaving the server under TLS 1.1 or we're going out on TLS 1.2 but with an unsupported cipher.
Thanks


text:
Q: WPF MVVM LiveCharts how to show X axis Label? I'm having hard times to show some simple labels in my Cartesian Bar Charts, I'm reading a lot around but nothing seems to work for me. I'm using the MVVM pattern in my project, so this is the code I have so far..
VIEW
<lvc:CartesianChart Grid.Row="2" Series="{Binding ChartDataSets}">
    <lvc:CartesianChart.AxisX>
        <lvc:Axis LabelsRotation="20" Labels="{Binding ColumnLabels}" Position="RightTop" >
            <lvc:Axis.Separator >
                <lvc:Separator Step="1"></lvc:Separator>
            </lvc:Axis.Separator>
        </lvc:Axis>
    </lvc:CartesianChart.AxisX>
    <lvc:CartesianChart.AxisY>
        <lvc:Axis LabelFormatter="{Binding Formatter}" Position="RightTop"></lvc:Axis>
    </lvc:CartesianChart.AxisY>
</lvc:CartesianChart>

DataModel
class DataModel : INotifyPropertyChanged
{
private double value;
public double Value
{
get => this.value;
set
{
this.value = value;
OnPropertyChanged();
}
}
private string label;
public string Label
{
    get => this.label;
    set
    {
        this.label = value;
        OnPropertyChanged("Label");
    }
}

public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
    this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

}
ViewModel
class BackupStatsViewModel : INotifyPropertyChanged
{
    ChartValues<DataModel> values = new ChartValues<DataModel>();
    public SeriesCollection ChartDataSets { get; set; }
    public ObservableCollection<string> ColumnLabels { get; set; }
    public class ErrorPrt
    {
        public ErrorPrt(){
            prtName = string.Empty;
            Count = -1;
        }
        public string prtName { get; set; }
        public int Count { get; set; }
    }
    public BackupStatsViewModel()
    {
        InitializeBarChartData();
    }
    private void InitializeBarChartData()
    {

        this.ColumnLabels = new ObservableCollection<string>(values.Select(dataModel => dataModel.Label));
        var dataMapper = new CartesianMapper<DataModel>()
          .Y(dataModel => dataModel.Value)
          .Fill(dataModel => dataModel.Value > 15.0 ? Brushes.Red : Brushes.Green);

        this.ChartDataSets = new SeriesCollection
        {
          new ColumnSeries
          {
            Values = values,
            Configuration = dataMapper,
            DataLabels = true
          }

        };
    }
    public ErrorPrt[] PrtCount(List<DataRow> rows)
    {
        IEnumerable<IGrouping<string, DataRow>> grouped = rows.GroupBy(s => s.Field<string>(2));
        ErrorPrt[] err = new ErrorPrt[grouped.Count()];
        //Omitted code for sake of brevity

        ErrorPrt[] arr = err.Where(c => c != null).ToArray();

        for (int i = 0; i < arr.Count(); i++)
            values.Add(new DataModel() { Label = $"PRT {arr[i].prtName}", Value = arr[i].Count });

        return arr;
    }
 }

But as you can see no labels are shown on the X axis.. really don't know how to bypass this problem in order to go on with my work..please can anyone show me the right way?

A: Your flow looks broken:
you first initialize the chart data from the constructor by calling InitializeBarChartData(), which also initializes the ColumnLabels collection. Then you create the underlying ErrorPtr items, which are the provider of the data for the column labels.
The result is that the ColumnLabels property is empty => no labels will be displayed.
Because you add the new ErrorPtr items to the values field and this field is of type ChartValues and this collection implements INotifyCollectionChanged, the chart will reflect those changes. You were lucky here.
But because you never update the ColumnLabels property after you have created the ErrorPtr items, the initially (after calling InitializeBarChartData from the constructor) empty ColumnLabels collection remains empty.
Solution 1
Fix the flow of your data model initialization and call InitializeBarChartData after PrtCount:
public ErrorPrt[] PrtCount(List<DataRow> rows)
{
    IEnumerable<IGrouping<string, DataRow>> grouped = rows.GroupBy(s => s.Field<string>(2));
    ErrorPrt[] err = new ErrorPrt[grouped.Count()];
    //Omitted code for sake of brevity

    ErrorPrt[] arr = err.Where(c => c != null).ToArray();

    for (int i = 0; i < arr.Count(); i++)
        this.values.Add(new DataModel() { Label = $"PRT {arr[i].prtName}", Value = arr[i].Count });

    // Initialize the chat models.
    // NOW the label data (the ErrorPrt.prtName) is generated
    // and ready to be extracted from the ErrorPrt instances
    InitializeBarChartData();

    return arr;
}

Solution 2 (Recommended)
Since all involved collections implement INotifyCollectionChanged you can dynamically update every collection when new data arrives. You don't need to initialize the complete chart data like the SeriesCollection and the Mapper or the label formatter over and over again (like in Solution 1 - in case PrtCount will be called more than once).
You can continue to call InitializeBarChartData once from the constructor, like you are currently doing it.
Simply don't only update the values field, but also the ColumnLabels property:
public ErrorPrt[] PrtCount(List<DataRow> rows)
{
    IEnumerable<IGrouping<string, DataRow>> grouped = rows.GroupBy(s => s.Field<string>(2));
    ErrorPrt[] err = new ErrorPrt[grouped.Count()];
    //Omitted code for sake of brevity

    ErrorPrt[] arr = err.Where(c => c != null).ToArray();

    for (int i = 0; i < arr.Count(); i++)
    {
        var newDataModel = new DataModel() { Label = $"PRT {arr[i].prtName}", Value = arr[i].Count };

        // Here you update the column values
        // and add the new items to the existing items of previous calls
        this.values.Add(newDataModel);

        // Also update the labels whenever new column data has arrived
        this.ColumnLabels.Add(newDataModel.Label);
    }

    return arr;
}


text:
Q: Does Angular update only one DOM element or all DOM element when interpolation is used Consider that  I have a child component with the following view template in Angular2 (or 4):

 {{someproperty}}

And someproperty is a modified by the parent component using @input binding on the child. When the value of @input property changes, does the re-rendering of the child view happen at the div with the id of firstDiv or only at the  level?
In other words, does the whole shown structure get refreshed or just the span or just the text in the span?

A: Only the text node inside the span element will be updated using the renderer. Here is the relevant code snippet from the sources:
if (checkAndUpdateBinding(view, nodeDef, bindingIndex, newValue)) {
    value = text + _addInterpolationPart(...);
    view.renderer.setValue(DOMNode, value);
}

DOMNode here is the reference to the textNode.
For more details read The mechanics of DOM updates in Angular


text:
Q: How to hide text cursor without shell? I am curious, is there a way to hide the cursor right before it will be placed at the top left corner of the terminal emulator? And do it independently of terminal emulator (not modifying the source code). Is it possible to use terminfo for such purpose? Or is there something similar to .xinitrc or .bashrc, but for terminals?

A: In terminfo, that's the civis capability:
      cursor_invisible            civis     vi     make cursor invisi-
                                                   ble

e.g.,
tput civis

but while that could be applied immediately on running the terminal, there's an instant where the terminal does the Right Thing™ and shows its cursor.

A: No, there is not.
Terminal emulators do the same thing as real terminals: from the reset state the cursor starts off visible, until a control sequence is received from the host saying otherwise.  The doco of (some of) the terminals being emulated explicitly defines the reset state, including the initial cursor visibility state.
Further reading

*

*"Cursor Movement and Panning". VT420 Programmer Reference Manual.  EK-VT420-RM-002.  February 1992.  Digital.

*"Table 5–9 Terminal's Default Settings". VT510 Video Terminal Programmer Information.  EK-VT510-RM.  November 1993.  DEC.


text:
Q: whats the matter with system loads?
Possible Duplicate:
What's the difference between load average and CPU load?

Look at the image for what i am tying to ask . whats parameters of load averages and how we have to understand them ?

A: The load average represents the number of processes waiting for their turn to use the CPU(s), in the last 1, 5 and 15 minutes.
In your case, assuming you have a single CPU (single core) system:

*

*In the last minute, you had 0.54 processes waiting to use the CPU on average.

*In the last five minutes, you had 0.49 processes waiting to use the CPU on average.

*In the last fifteen minutes, on average, you could have had 0.02 more processes using the CPU before attaining the maximum capacity of the CPU.

So, in practice, a load equal to or greater than 1 on a single CPU system means that the CPU is at maximum capacity and that processes have to wait to use it. A load less than 1 means that the CPU could process extra tasks without having to queue processes.
If you have two CPUs (e.g.: dual core CPU), you could reach a load of 2 before the CPU is at its max; 4 on a quad CPU system, and so on.

A: Load averages are the average of the %ge load of the cpu for the past 'x' minutes where s is 1,5,15.In your screenshot, it tells us that the avg load on your cpu is decreasing and the maximum is 1.54 %


text:
Q: What is the number of states in the minimal DFA with input symbols {0,1,2} where 2nd last symbol is 1? four options:-

A. 8
B. 9
C. 6
D. None

can somebody please explain the answer diagrammatically..

A: The accepted answer is wrong. Consider the following minimal DFA for the language:
q    e    q'
q0   0    q0
q0   1    q1
q0   2    q0
q1   0    q2
q1   1    q3
q1   2    q2
q2   0    q0
q2   1    q1
q2   2    q0
q3   0    q2
q3   1    q3
q3   2    q2

The reason the other answer gets it wrong is because there is no real difference between symbols 0 and 2 in this language. The symbols might as well be "1" and "not 1". When you correctly realize this, the minimal number of states is indeed as the other answer points out: 2^2 = 4 states. Here's a crude diagram if that's more easy to digest.
  /------0,2--------\
 |         /---1--\ |
 v        v        \|
q0 --1-> q1 -0,2-> q2
         |          ^
         1          |
         v          |
         q3---0,2--/
        / ^
        \1/

A: B.9
Whenever the question says the nth symbol from the right side is fixed and the input language has m symbols the answer for minimal dfa is m^n . So 3^2 = 9


text:
Q: Non-Stop cronjob I got a new requirement from the business about "real time" data/statistics. They want to show how our system is performing in real time.
I am not sure how to do it but here are my thoughts:
I don't think it's possible to get the data every seconds because cronjob run at least every minute. So, without telling them, I said YES it's possible.
Now my problem is this how can I run a cronjob that get statistics on our sites (sales, impressions, cpc etc...)?
Example:
From 9h01 AM to 9h02 AM i have:

*

*41 views on product 1

*1 order

*8 referral click from clients

*2 added to wish list

From 9h02 AM to 9h03 AM i have:

*

*57 views on product 1

*0 order

*13 referral click from clients

*0 added to wish list

Total:

*

*98 views on product 1

*1 order

*21 referral click from clients

*2 added to wish list

How can i make sure I won't calculate duplicates if for some reason the database is slow and does not process information on time?
Thanks
Edit: The company has 200 employee in 3 different states which consists of sales, business analyst, tech, accounting, and executive staff and these people can read these reports.
In the last year we hired 20 employees so it will grow a little. For traffic data, it is hard to tell exactly how much data we get per minutes. The estimate is approx 2.5k to 10k per minute.
We just ordered 3 PowerEdge R510 (Intel® Xeon® E5503, 2.0Ghz, 4M Cache, 12GB Memory (3x4GB), 1333MHz Dual Rank, 4 x 300GB 15K RPM Serial-Attach SCSI 6Gbps RAID 5).

A: Here's what I recommend based on your servers/employee/data if these servers are. Because you are using 1 server (and 1 backup), the capacity of your drive should be enough for a while unless you want to archive complete data on this server. Data can grow rapidly and I would think to increase the capacity or archive the data somewhere else.
Now, because you have a lot of people that can request reporting data the main idea is to retrieve data as fast as possible to make sure you don't lock records (specially if you using myisam tables - table locking vs innodb which has row level locking).
Use your index (unique if you need) wisely and store your data as efficiently as possible using timestamp.
What you can also do is to summarize your data which can simplify your queries. Although, is not a common practice in databases since it does not respect the normal forms. You can get great performance but it's a pain to maintain.
To be honest, a cron that runs every minutes is fine since you have the time when you save the record but it is possible to get data every second. I recommend to make sure when you get a record, you mark this record as "processed" or some other status in order you don't take this record twice.
Now when you summarize your data make sure you optimize your queries and you can check also what the explain will output and then make a decision.

EDIT: Summarizing data (which does not respect the database normalization) will get you great performance since you only query records without using aggregate functions and having joins tables using minimal where clause.
Example:
98 views on product 1
1 order
21 referral click from clients
2 added to wishlist

can be:
SELECT
 views, orders, referral, whishlist
FROM
 summarize_stats_20111201 /* daily table for example */
WHERE
 `time` between 1322791200 /*2011-12-01 21:00:00*/ AND 1322791260 /*2011-12-01 21:01:00*/;

views has the total amount of views, in this example 98
orders has the total amount of orders, in this example 1
referral has the total amount of referral, in this example 21
wishlist has the total amount of wishlist, in this example 2
These are calculated data in a summary table (this is why i said "does not respect the database normalization" because you never calculate data in a RDBMS) but if you need data instantly, this is a way you can do it.

EDIT 2:
Here's a example of maintaining this solution:
You have a cronjob that maintains tables. His job is to create the table for the next day or what ever you need.
// in php
$date = date('Ymd', strtotime('+1 day')); // for daily table
$sql = 'CREATE TABLE IF NOT EXISTS the_database.summarize_stats_" . $date . ";

So when you inserts, make sure you have the right table name and you use ON DUPLICATE KEY
// in php
$sql = 'INSERT INTO TABLE summarize_stats_20111201 SET /* all the fields you need */ ON DUPLICATE KEY views = views + 1;

for example if you want to increase the view
What I also forget is if you need to query 1 week of data, you will have to create a merge  table. This way you can do something like:
SELECT
 views, orders, referral, whishlist
FROM
 summarize_stats_2011 /* yearly merge table for example */
WHERE
 `time` between 1322272800 /*2011-11-25 21:00:00*/ AND 1322791260 /*2011-12-01 21:01:00*/;

This way you don't have to UNION ALL tons of queries.

A: Save in the database the timestamp of the records, and evaluate the data according to it (for mysql http://dev.mysql.com/doc/refman/5.0/en/timestamp.html)

A: Gino, you can do something like cronjobs if you have access to your php.ini on the server. If you can set the value of max_execution_time to zero, you can make your own cronjobs that runs every second. What you need is something like this in your php.ini :
max_execution_time = 0

or set it as a runtime script in your PHP codes:
ini_set("max_execution_time",0);

The next function that you need, is sleep() function in PHP.
This function will put delay among your operations. You can use it like sleep(10);.
For more information about this function, take a look at this link.

A: This might sounds strange, but why don't you use Google Analytics for this kind of tracking tasks. With the new "live beta"
And retrieving the data using its API and perform all the fancy requirements that management may require.
Plus js and google will handle most of the load.
edit: My real point is why don't you try using the js (woopra or your own) to gather the clicks, events on the front end, and store all the stats on another database, I don't believe mixing OLAP and OLTP is a good idea on any production server. Hope that make sense.


text:
Q: Adding an graphic Interface for a Gnu/linux bash Script I try to execute a bash script which works totally fine when executed form the shell. However if I try to execute it using my grahpic menu script the execution fails. There must be a problem with the parameters, but I can't find it. For example if I try to execute option one with my gui, the correct strings are saved in the variable, but cd in option 1 won't work.
Code of my main-program which is called getList.sh
#! /bin/bash
SourcePath=$1

DestinationPath=$2

DestinationFileName=$3

Option=$4

#Option 1
#Creates a recursive list of all files in a directory and subdirectories, if the destination file already exists, the content will be overwritten
if [ $Option = 1 ]
then
                cd $DestinationPath
                ls -1Rasl $SourcePath > $PathDate

############################################################################
#Option 2
#Creates a recursive list of files in a directory and subdirectory including files in archives and prints it
elif [ $Option = 2 ]
then
                MakeFileListAndPrint

############################################################################
#Option 3
#Recursive search for a file name in all files including archives, prints all found macthes with path
else
        MakeFileList
        grep -H $SearchFile $PathDate

fi

GUI-CODE:
#! /bin/bash

SourcePath=$(zenity --entry --text "Enter your source path" --title "sourcepath" --entry-text="");
DestinationPath=$(zenity --entry --text "Enter your destination path" --title "destination path" --entry-text="");
DestinationFileName=$(zenity --entry --text "Enter your destination file name" --title "destination file name" --$

ask=`zenity --list --title="Choose your Option" --column="0" "1" "2" "3" --width=100 --height=300 --hide-header`

if [ "$ask" == "1" ]; then
    bash ./getList.sh $SourcePath $DestinationPath $DestinationFileName $ask

 fi

if [ "$ask" == "2" ]; then
    bash ./getList.sh $SourcePath $DestinationPath $DestinationFileName $ask
fi

if [ "$ask" == "3" ]; then
    SearchFile=$(zenity --entry --text "Enter your search term" --title "search term" --entry-text="");
    bash ./getList.sh $SourcePath $DestinationPath $DestinationFileName $ask $SearchFile
fi

Output with echo statements with these given parameters:
bash menu $1=~/test $2=~/Destination $3=testfile $4=1
user:~/debug$ bash menu.sh
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Sourcepath in menu is: ~/test
DestinationPath in menu is ~/Destination
Destination Filename in Menu is: testfile
option 1 is executed
DestinationPath in getList is: ~/Destination
PWD bevor change dir user/debug
./getList.sh: line 85: cd: ~/Destination: No such file or directory
PWD after change dir user/debug
./getList.sh: line 87: ~/Destination/testfile: No such file or directory
PWD after Rasl user/debug
program executed
user:~/debug$

A: Your problem is that ~ is not expanded. This works:
cd ~

But puting a tilde (~) to zenity would be returned in double-quotes, just  try this, entering just the tilde:
cd $(zenity --entry)

It is the same as
$ cd "~"
bash: cd: ~: No such file or directory

This worked for me to re-trigger the bash expansion:
x=$(zenity --entry)
cd $(eval echo $x)

However this is not safe! If the user would put some dangerous code to x, it would be evaluated! This is somewhat better:
cd $(echo $x | sed "s:~:$HOME:")

This exploits this simple difference:
$ echo ~ $HOME
/home/roman /home/roman
$ echo "~ $HOME"
~ /home/roman
$ echo '~ $HOME'
~ $HOME


text: Q: Mock VNCoreMLFeatureValueObservation for unit testing Is it possible to mock VNCoreMLFeatureValueObservation for unit tests without any dependencies? I need to adjust the featureName and featureValue. I've tried to inherit this object and override needed properties, but the object is still marked as uninitialized...


text:
Q: First "ImageView", second "RelativeLayout" - works, but first "RelativeLayout", second "ImageView" - doesn't I need to use show first buttons and only than a picture. But my app can't be started.
This is works:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
    <ImageView
    android:id="@+id/imageview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    />

    <RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1">
        <Button
        android:id="@+id/make_photo_again"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/make_photo_again_label"
        android:layout_alignParentLeft="true"
        />
        <Button
        android:id="@+id/edit_photo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/edit_photo_label"
        android:layout_alignParentRight="true"
        />
    </RelativeLayout>

</LinearLayout>

..but if I place "Image" under "RelativeLayout" the app doesn't work.
Really don't know what to do with it..
Could you tell me, why?
Any suggestions?

A: It should work if you place your imageview at the beginning of your relative layout just above the buttons then imageview will be at the back side and button will be on the imageview.
If you place your imageview at the end of your relative layout just below two buttons then imageview will be at the front and it will hide your buttons.....

A: Your XML doesn't look wrong. What errors are you getting.  Please describe.

A: try this code in xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:weightSum="2">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="0.3" >

        <Button
            android:id="@+id/make_photo_again"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:text="Save"
           />

        <Button
            android:id="@+id/edit_photo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:text="Cancel"
             />
    </RelativeLayout>

    <ImageView
        android:id="@+id/imageview"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1.7"
        android:background="@drawable/edit_box_mytime" />

</LinearLayout>


text:
Q: Natbib does not accept 'und' instead of 'and' in *.bib Natbib (Overleaf) does not accept the german 'und' instead of 'and' in the *.bib.
The result is, that only one author is mentioned.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage[round]{natbib}

...
\bibliographystyle{plainnat}
\bibliography{Expose_Bib}

A: The and in the .bib file is just a separator for multiple authors. If there are three authors, you have to write <author1> and <author2> and <author3>. It does not correspond to the separator used in the bibliography. What is used there is the responsibility of the .bst file. However, one should almost use past tense here, since nowadays most people use biblatex together with biber. This should give you the German key words automatically.


text:
Q: Can't route to another page in reactjs I am having trouble routing to another page. When clicking the route it changes the link but stays on the same. Sorry in advance I'm a beginner. Here is a picture of the website and my code for the route page.
import React from "react";

    const Blank2 = () => {
      return

Blank2

    }
    export default Blank2;

my app.js
    import React from "react";
    import { Routes ,Route } from 'react-router-dom';
    import "./App.css";
    import NavBar from "./components/NavBar/NavBar";
    import Footer from "./components/Footer/Footer";

    import VolcanoInfo from "./components/VolcanoInfo/VolcanoInfo";

    import Blank1 from "./components/Blank1/Blank1";

    import Blank2 from "./components/Blank2/Blank2";

    import Blank3 from "./components/Blank3/Blank3";

    import image from './image.jpg';

    //TODO Web Template Studio: Add routes for your new pages here.
    const App = () => {
        return (

          <React.Fragment>
            <NavBar />
            <Routes>
              <Route exact path = "/VolcanoInfo" component = { VolcanoInfo } />
              <Route path = "/Blank1" component = { Blank1 } />
              <Route path = "/Blank2" component = { Blank2 } />
              <Route path = "/Blank3" component = { Blank3 } />
            </Routes>

          </React.Fragment>
        );
    }

    export default App;

website

A: For React Router v6, there are couple of things being done wrong here. You need to replace component with element and make use of BrowserRouter or HashRouter. Also we don't need exact from react-router v6. Your code would look something like this

import {BrowserRouter} from 'react-router-dom';

...

<BrowserRouter>
   <NavBar />
   <Routes>
      <Route path = "/VolcanoInfo" element= { <VolcanoInfo /> } />
      <Route path = "/Blank1" element = { <Blank1 /> } />
      <Route path = "/Blank2" element = { <Blank2 /> } />
      <Route path = "/Blank3" element = { <Blank3 /> } />
   </Routes>

</BrowserRouter>

A: I see that you're using react-router-dom v6.
React Router Dom is actually easy to use but sometimes we can get mixed up with the older version.
Here's the link to the official v6 document on configuring routes.

*

*You need to have a <BrowserRouter> wrap over your routes.

*Instead of component attribute, v6 uses element and then pass in the component you want to route. (Ex: element={<Blank1 />})

More details in the documentation above. Hope this helps!

A: Tutorial for React Router v6 in here. And many change from v5 to v6 according to this doc :
import React from "react";
import { BrowserRouter, Routes ,Route } from 'react-router-dom';
import "./App.css";
import NavBar from "./components/NavBar/NavBar";
import Footer from "./components/Footer/Footer";

import VolcanoInfo from "./components/VolcanoInfo/VolcanoInfo";

import Blank1 from "./components/Blank1/Blank1";

import Blank2 from "./components/Blank2/Blank2";

import Blank3 from "./components/Blank3/Blank3";

import image from './image.jpg';

//TODO Web Template Studio: Add routes for your new pages here.
const App = () => {
    return (

      <BrowserRouter>

        <NavBar />
        <Routes>
          <Route path = "/VolcanoInfo" element= { <VolcanoInfo /> } />
          <Route path = "/Blank1" element= { <Blank1 />} />
          <Route path = "/Blank2" element= { <Blank2 />} />
          <Route path = "/Blank3" element= { <Blank3 />} />
        </Routes>

      </BrowserRouter>
    );
}

export default App;


text:
Q: Why the value of head.next is not null in the following code? I have a confusion in the following code:-
The Node class:-
class Node
{
  int data;
  Node next;
  Node(int n)
  {
    data=n;
    next=null;
  }
}

The LinkedList class:-
class LinkedList
{
  Node head;
  void insertLinkedList(int n)
  {
    Node newNode=new Node(n);
    if(head==null)
    {
      head=newNode;
    }
    else
    {
      Node ptr=head;
      while(ptr.next!=null)
      {
        ptr=ptr.next;
      }
      ptr.next=newNode;
    }
  }

Initially, head is null. On insertLinkedList(1) function call the situation is:-
newNode.data = 1
newNode.next = null
head.data = 1
head.next = null
After the second function call insertLinkedList(2) the expected situation is:-
newNode.data = 2
newNode.next = null
head.data = 2
head.next = null
But the actual value of head.next is not null. Instead, it is storing the reference to the first node.
Can someone help me in getting a better understanding of this?

A: After inserting second Node expected value of head.next is NOT NULL.
Node ptr=head;

Here ptr is use to refer the head node. So after first insertion
while(ptr.next!=null)

is false and it does not enter loop. After loop
ptr.next=newNode;

is executed. And it assigns head's next value as reference to the new Node. Hence head.next is not null; as expected.


text:
Q: Dynamic resource allocation for spark applications not working I am new to Spark and trying to figure out how dynamic resource allocation works. I have spark structured streaming application which is trying to read million records at a time from Kafka and process them. My application always starts with 3 executors and never increase the number of executors.
It takes 5-10 minutes to finish the processing. I thought it will increase the number of executors(up to 10) and try to finish the processing sooner, which is not happening.What am I missing here? How is this supposed to work?
I have set below properties in Ambari for Spark
spark.dynamicAllocation.enabled = true
spark.dynamicAllocation.initialExecutors = 3
spark.dynamicAllocation.maxExecutors = 10
spark.dynamicAllocation.minExecutors = 3
spark.shuffle.service.enabled = true

Below is how my submit command looks like
/usr/hdp/3.0.1.0-187/spark2/bin/spark-submit --class com.sb.spark.sparkTest.sparkTest --master yarn --deploy-mode cluster --queue default sparkTest-assembly-0.1.jar

Spark code
//read stream
val dsrReadStream = spark.readStream.format("kafka")
   .option("kafka.bootstrap.servers", brokers) //kafka bokers
   .option("startingOffsets", startingOffsets) // start point to read
   .option("maxOffsetsPerTrigger", maxoffsetpertrigger) // no. of records per batch
   .option("failOnDataLoss", "true")

 /****
 Logic to validate format of loglines. Writing invalid log lines to kafka and store valid log lines in 'dsresult'

 ****/

//write stream
val dswWriteStream =dsresult.writeStream
    .outputMode(outputMode) // file write mode, default append
    .format(writeformat) // file format ,default orc
    .option("path",outPath) //hdfs file write path
    .option("checkpointLocation", checkpointdir) location
    .option("maxRecordsPerFile", 999999999)
    .trigger(Trigger.ProcessingTime(triggerTimeInMins))

A: Just to Clarify further,

spark.streaming.dynamicAllocation.enabled=true

worked only for Dstreams API. See Jira
Also, if you set

spark.dynamicAllocation.enabled=true

and run a structured streaming job, the batch dynamic allocation algorithm kicks in, which may not be very optimal. See Jira

A: Dynamic Resource Allocation does not work with Spark Streaming
Refer this link


text:
Q: FileReader API: how to read files synchronously I am trying to read a file which is selected using an input type file on the html page. I have implemented the function to read the file and the file content is able to be read. But the actual problem is that the reading of the content of the file is being done asynchronously which allows the other functions of the script to execute. I am storing the content of the file read in an array.
While moving to the other functions the array is empty. When delay is introduced then the array has the content. Can anybody help me out in solving this problem without introducing a delay?
My code for reading the file is
var getBinaryDataReader = new FileReader();
getBinaryDataReader.onload = (function(theFile) {
return function(frEvnt)
{
  file[fileCnt]=frEvnt.target.result;
}
})(document.forms[formPos].elements[j].files[0]);

getBinaryDataReader.readAsBinaryString(document.forms[formPos].elements[j].files[0]);

Thanks in advance.

A: I think you have to do what you always have to with asynchronous call (like Ajax, too): Move the code that needs to run later into the callback that gets executed when the file has been read.
getBinaryDataReader.onload = function(theFile) {
   // theFile.target.result has your binary
   // you can move it into the array
   // (I think you are already doing this properly)
   // but then ...
   nowCallTheOtherCodeThatNeedsToRunLater();

   // or if you want to wait until all elements
   // in the array are downloaded now
   if (myArrayIsFullNow()){
      callTheCodeThatNeedsTheFullArray();
   }
   // else: do nothing, the final file to finish downloading
   // will trigger the code

}


text:
Q: Sql query of two table referring back to each other I have two tables (with column name) :
Profile (emp_id, emp_fullname)
User (emp_id, emp_name, emp_leader, leader_id)
I want to select emp_id, emp_fullname from Profile table and emp_fullname(leader) from User table.
Situation: Based on emp_id from Profile table, I would like to refer its leader_id from User table, and then get the full name of that particular leader for each of the employee from the profile table.
My question is, how to can i refer back the leader_id from User table to Profile table in order to get his or her fullname. I have try this, but it only gives the emp_id, emp_fullname but not the leader name
SELECT p.emp_id, p.emp_fullname, u.emp_fullname
FROM profile p
LEFT JOIN user u ON u.emp_id = p.emp_id

A: Presumably, leader_id refers to another user.  If so, you just need another join:
SELECT p.emp_id, p.emp_fullname, u.emp_fullname,
       ul.emp_fullname as leader_fullname
FROM profile p LEFT JOIN
     user u
     ON u.emp_id = p.emp_id LEFT JOIN
     user ul
     ON ul.emp_id = u.leader_id;


text:
Q: Post of properties in a nested list does not seem to work in spring mvc I have an Object with a main list in it and a sub list in that main list. Showing the properties in a form is no problem.
But when I post the form and one or more of the properties of the sub list are inputs (hidden or not) I get the following:
InvalidPropertyException: Invalid property 'groups[0].members[0]' of bean class [xxx.MyModelObject]: Index of out of bounds in property path 'members[0]'; nested exception is java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

I use a Freemarker (2.3.22) view. The generated html of one sub list property is:
<input type="hidden" id="groups0.members0.surName" name="groups[0].members[0].surName" value="dummyName">

Seems Ok to me. There is no problem with simple properties in the main list, like id groups0.groupName / name groups[0].groupName.
(spring version 4.1.3).

A: Check getters and setters from group and member classes


text:
Q: MSSQL subquery result to show and calculate I need show a subquery result and use this same result to calculate other value, is possible set this value in a variable in MS SQL 2008 or something like this?
exemple:
SELECT
    @test = (SELECT COUNT(*) FROM [tableTest] WHERE [tableTest].[columnA] = [tableA].[columnA]) as 'Counter'
    , (@test * 50) as 'Calc'
    , [tableA].[columnA]
FROM tableA

A: Why can't you do this. Move the subquery outside of select statement and store the result in a variable
Then use that variable for calculations.
declare @test int = (SELECT COUNT(*) FROM [tableTest])

SELECT
    @test as 'Counter'
    , (@test * 50) as 'Calc'
    , [tableA].[columnA]
FROM tableA

Update :
SELECT [Counter],
       ( [Counter] * 50 ) AS 'Calc',
       columnA
FROM   (SELECT (SELECT Count(*)
                FROM   [tableTest]
                WHERE  [tableTest].[columnA] = [tableA].[columnA]) AS 'Counter',
               [tableA].[columnA]
        FROM   tableA) A

A: you may use a cte and join on it.
with cte as (select count(*) cnt, columnA from [tableTest] group by columnA)
select
   c.cnt as 'Counter',
   c.cnt * 50 as 'Calc',
   a.columnA
from tableA a
join cte c on c.columnA = a.columnA

It could also be done with a subquery, of course
select
  a.columnA,
  c.cnt as 'Counter',
  c.cnt * 50 as 'Calc'
from tableA a
join (select columnA, count(*) as cnt
      from tableTest
      group by columnA) c
  on c.columnA = a.columnA

A: You can also use correlated sub-queries:
SELECT
   Counter = (SELECT COUNT(*) FROM tableTest t WHERE t.columnA = a.columnA),
   Calc    = (SELECT COUNT(*) FROM tableTest t WHERE t.columnA = a.columnA) * 50,
   a.columnA
FROM tableA a

It'll be optimized to be only evaluated once.

A: Try:
SELECT  t2.[Count]
       ,t2.[Count] * 50 As [Calc]
       ,[tableA].[columnA]
FROM TableA
CROSS APPLY
(
   SELECT COUNT(*) AS [Count]
   FROM TableTest
   WHERE [tableTest].[columnA] = [tableA].[columnA]
) t2