text:
Q: Uploading Mapbox Style (Studio) to CartoDB? My basemap made in Mapbox Studio is not uploading to CartoDB. I enter the URL and my Access Token but it just says "This URL not valid"
This is the URL, copied straight from the Mapbox "Share this style" box:
https://api.mapbox.com/styles/v1/s****/cii6i33h6009t91m148mn7y90.html?title=true&access_token=pk.eyJ1Ijoic2hhbmVnYWx3YXkiLCJhIjoiY2lpMWIwMGs5MDA2ZXQza2Zob2NjOWgwNyJ9.EtwsJtB5yhV75-fO9L1yXA#13.007195441591573/42.34777164609585/-71.09705213424535/0

A: You're getting that error because CartoDB expects a tilelayer URL not a style URL. You've created your map using Mapbox Studio which generates style URL's for use with Mapbox GL (JS or Native). If you want to get a tile URL you have to create your map in Mapbox Studio Classic:
https://www.mapbox.com/studio/classic/
Here's a good read on the differences between the new Mapbox studio and classic:
https://www.mapbox.com/help/upgrading-from-classic/


text:
Q: resource identifier xxxxxxxx has already been used in this assembly Compiling a Workflow with Visual Studio 2010 and .Net Framework 3.0 results in this CSC error:
"resource identifier xxxxxxxx has already been used in this assembly"
where xxxxxxxx is a Workflow Type in my Project.
I'm using Workflow Foundation 3.
Thanks for your help,
Tom

A: There is likely a folder in your project with some controls that should not be compiled again.
The simplest solution would be to Right-Click the folder with xxxxxxxx in it, and select "Exclude from Project"
DO NOT DELETE THE FOLDER!

A: Was getting this same issue recently in VS IDE - traced this down to the CSPROJ having the same import twice for a nuget package. If you see this - comb through your CSPROJ looking for duplicate <Import/> elements for the same asset.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Eigenvalues of matrix $A$ where $A$ is an $n$ by $n$ matrix where $a_{i,i+1} = 1 \forall i=1,2,...,n-1 $,$a_{n,1}=1$,Other remaining entries are $0$. Let $A$ be a $n$ by $n$ matrix where $n$ is odd and $n \geq 7$ , and $a_{i,i+1} = 1 \forall i=1,2,...,$ and $a_{n,1}=1$ ,additionally other entries are $0$, i.e.
$$A=\begin{bmatrix} 0 & 1 & 0 & 0 & \cdots & 0 \\
                    0 & 0 & 1 & 0 & \cdots & 0 \\
                    0 & 0 & 0 & 1 & \cdots & 0 \\
                    \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\
                    0 & 0 & 0 & 0 & \cdots & 1 \\
                    1 & 0 & 0 & 0 & \cdots & 0
\end{bmatrix}$$
Can $A$ have eigen value of $-1$, also can $A$ have an eigenvalue of multiplicity $\geq2$?
I tried that $Trace(A) = 0$ and $Det(A) = 1$ from the structure of matrix $A$ , i concluded that $0 $ cannot be an eigenvalue ,and from taking a particular case of $n=7$ I got eigenvalue of $1$, now how do i proceed ?

A: You have $A = \begin{pmatrix} 0&1&0\\0 &0&1\\1&0&0\end{pmatrix}$ for $n=3$, right?
This matrix is the transpose of the Companion matrix of a quite simple polynomial $p=x^n -1$
Since the matrix has only a single entry in every row and column, it's orthogonal and it's eigenvalues are the $n$-th roots of unity.

A: Hint: What you are describing is a special case of a Circulant matrix. A general circulant matrix takes the form
$$
\begin{pmatrix}
c_0 & c_{n-1} & \dots & c_2 & c_1 \\
c_1 & c_0 & c_{n-1} & & c_2 \\
\vdots & c_1 & c_0 & \ddots & \vdots \\
c_{n-2} & & \ddots & \ddots & c_{n-1} \\
c_{n-1} & c_{n-2} & \dots & c_1 & c_0
\end{pmatrix}
$$
and has eigenvalues
$$
\lambda_j = c_0 + c_{n-1} \omega_j + c_{n-1} \omega_j^2 + \dots + c_1 \omega_j^{n-1}, \quad j=0, \dots, n-1,
$$
where $\omega_j$ are the $n$th roots of unity.
What is $c_k, \, k=0, \dots n-1$ in your case?
What does this tell you about the eigenvalues of your matrices?

A: The set of all the matrices which are just the permutaion of the identity matrix of order $n*n$ is isomorphic to the group $S_n$.
Consider your matrix as an element of $S_n$. The matrix can be regarded as the permutation ($1$   $n$ $n-1$ $n-2$.......$2$).
This is a $n-cycle$. hence its order is $n$. That means $x^n=idt$ where $idt$ is the identity permutation.
Hence your matrix has characteristic equation $x^n-1=0$.
If $n$ is odd then $-1$ is not an eigenvalue.If $n$ is even then  $-1$ is an eigenvalue. And since these are the $n$th roots of unity they can't be repeated.


text:
Q: How to know if a URL is decoded/encoded? I am using Javascript method decodeURIComponent to decode an encoded URL. Now I am having an issue, that sometimes the URL is get encoded twice during redirection between servers, sometimes it is encoded only once.
I want to check that if the URL is still encoded after calling the method decodeURIComponent. How can I do that? Any pointer would be very helpful to me.
Update - 1
If I recursively call a method and check that if the given URL still contains "%", if it contains "%" then decode it and call the method again; and if not return it to the caller, will that work?
Update - 2
For my case I have:
callBackUrl=http%253A%252F%252Fadbc.com%252FPOSM%252Fapp%252Fpages%252Fadf.task-flow%253Fadf.tfDoc%253D%25252FWEB-INF%25252Ftask-flows%25252Fcatalog-edit-task-flow.xml%2526adf.tfId%253Dcatalog%2526_adf.ctrl-state%253Db9akorh22_9%2526articleReference%253D10C00135%2526previousView%253Dcatalog-home%2526fromUCM%253Dtrue%2526articleType%253Dposm%2526developer%253Dcentral

Now I am taking the value of the callBackUrl in my js method, then decoding it and firing window.open() with that decoded URL. the parameters are same and it has:

*

*adf.tfDoc

*adf.tfId

*articleReference

*previousView

*fromUCM

*articleType

*developer

Parameters into it. So I know there is no query string like value="%..".
Update - 3
I have written the following method:
var decodeURLRecursively = function(url) {
    if(url.indexOf('%') != -1) {
        return decodeURLRecursively(decodeURIComponent(url));
    }

    return url;
}

A: There is a simple way to konw if a URL string is encoded.
Take the initial string and compare it with the result of decoding it. If the result is the same, the string is not encoded; if the result is different then it is encoded.
I had this issue with my urls and I used this functions:
function isEncoded(uri) {
  uri = uri || '';

  return uri !== decodeURIComponent(uri);
}

So now I can use isEncoded as the discriminant in a while loop (or with recursion) to know if I need to keep calling decodeURIComponent on the string:
function fullyDecodeURI(uri){

  while (isEncoded(uri)){
    uri = decodeURIComponent(uri);
  }

  return uri;
}

This solved the problem for me of decoding urls encoded multiple times. Hope this helps.

A: Repeatedly decoding until you find no % signs will work over 99% of the time. It'll work even better if you repeatedly call so long as a match for /%[0-9a-f]{2}/i can be found.
However, if I were (for some bizarre reason) to name a file 100%achieved, that would cause a problem because %ac would be decoded to ¬, causing the decode to fail. Unfortunately there's no way to detect this case.
Ideally you should know if something is encoded more than once, and optimally you shouldn't let it happen in the first place.

A: function checkEncodeURI(str) {
 return /\%/i.test(str)
}

Test :
let url1 = "https://quora.com/unanswered/I'm-looking-for-a-Freaks-And-Friends-Fox-Glitter-Face-Hinge-Wallet-for-a-Christmas-gift-I've-searched-for-hours-online-but-no-one-seemed-to-have-it-does-anyone-know-where-I-can-find-one"
let url2 = 'https://www.quora.com/unanswered/I%E2%80%99m-looking-for-a-Freaks-And-Friends-Fox-Glitter-Face-Hinge-Wallet-for-a-Christmas-gift-I%E2%80%99ve-searched-for-hours-online-but-no-one-seemed-to-have-it-does-anyone-know-where-I-can-find-one'
let a = checkEncodeURI(url1)
console.log(a)
let b = checkEncodeURI(url2)
console.log(b)

A: you can keep decode until the string did not change:
str = "xxxxxxx"
dec_str = decode(str)
while(dec_str != str)
     str = dec_str;
     dec_str = decode(str);

A: There is really simple and fast and trusted way to know if a URL string is encoded or Not.
For Example:
decodeURIComponent(decodeURIComponent(encodeURIComponent("SWQgPSA0NjI%3D"))) <> "SWQgPSA0NjI="  ---->  Not equal to orginal value      then Already encoded
just this code:
  var encValue = encodeURIComponent(Value);
    try {
         if (decodeURIComponent(decodeURIComponent(encValue)) === Value) {
          //not encodec yet...so return encoded of val
          return encValue;
         }
       } catch (err) {
           //not encodec yet...so return encoded of val
           return encValue;
       }

 return Value  //same value returned


text:
Q: getUser() returns 0 on Web Server But Fine on Localhost I had hosted two apps a month before but today morning i have noticed that, it was not showing the UserInfo when getuser(); was executed. Just showing 0. Before it was working smoothly. Both apps not working on Web Server. But working fine on Localhost.Please help me out. I even authenticate the user and then takes to other page . Below is my code
require_once 'appinclude.php';
include_once "src/facebook.php";
$facebook = new Facebook(array(
    'appId' => $appid,
'secret' => $appsecret,
    'cookie' => true,
));
$user = $facebook->getUser();
if($user) {
try {
    $me = $facebook->api('/me','GET');
    $fname = $me['first_name'];

} catch(FacebookApiException $e) {
    error_log($e);
}
   }   else {

 $loginUrl = $facebook->getLoginUrl();
echo("<br>login url=".$loginUrl);
 }

Thanks in Advance...

A: It was firing error Curl Exception 7, unable to connect to Host and which was leadin to this problem.
Go to pico /etc/hosts and enter this line
69.171.224.34 graph.facebook.com
It may help you and also Whitelist IP range listed here
http://developers.facebook.com/docs/ApplicationSecurity/#facebook_scraper


text:
Q: Force home page to be https? I have a SSL certificate and https plugin which both work fine along with changing the Settings in the Wordpress menu to https but I have to manually enter 'https' to see the Secure version, is there a way to make the home page force, or even better become https?

A: Change the site URL to use SSL for the entire site including home page.

A: You can redirect the visitor to your SSL site using the following code (untested, may need ajusted):
function wpse58098_template_redirect() {
    if ( !is_ssl() ) {
       wp_redirect( 'https://www.mysite.com' );
    }
}
add_action( 'template_redirect', 'wpse58098_template_redirect' );

A: There is a plugin currently I'm using for my one of the wordpress site.
WordPress HTTPS (SSL)
( plugin has option to forse SSL for all. )
I personally recommend this plugin because,
Whenever you use ssl for webpages it becomes necessary to load all of its content from secured (Encrypted) servers, Otherwise It'll show a warning of partially encrypted/mixed content error to user.
The problem occurs when you link to external content such as JavaScript or Images, That plugin solve it by storing those external content to your own SSL secured server.


text:
Q: Cannot render plot inside dynamic UI, when using a shiny module Normally, Shiny has no problem generating plots from within UIs that the user calls reactively, but I've noticed that when using a shiny module to dynamically generate the UI, the plot does not appear.
Below is a minimal example of a modularized shiny app that reproduces the problem; it is supposed to generate a ui with a plot in it when the user presses the "go" button:
library("shiny")

exampleUI <- function(id, label = "example") {
        ns <- NS(id)
        tagList(   actionButton(ns("go"), "Go"),   uiOutput(ns("ui"))   )
}

ui <- fluidPage(   exampleUI("example")   )

example <- function(input, output, session) {
        observeEvent(input$go, {
                output$plot <- renderPlot(   plot(1:5, 1:5)   )
                output$ui <- renderUI(   plotOutput("plot")   )
        })
}

server <- function(input, output) {    callModule(example, "example")    }

shinyApp(ui, server)

By contrast, the non-modularized version works as expected:
ui <- fluidPage(
        tagList(   actionButton("go", "Go"),   uiOutput("ui")   )
)

server <- function(input, output) {

        observeEvent(input$go, {
                output$plot <- renderPlot(   plot(1:5, 1:5)   )
                output$ui <- renderUI(   plotOutput("plot")   )
        })
}

shinyApp(ui, server)

I would appreciate any pointers on how to make the first code block behave like the second.

A: library(shiny)

exampleUI <- function(id, label = "example") {
    ns <- NS(id)
    tagList(   actionButton(ns("go"), "Go"),   uiOutput(ns("ui"))   )
}

example <- function(input, output, session) {
    observeEvent(input$go, {
        output$plot <- renderPlot(   plot(1:5, 1:5)   )
        ns <- session$ns
        output$ui <- renderUI(   plotOutput(ns("plot"))   )
    })
}

ui <- fluidPage(   exampleUI("example")   )

server <- function(input, output, session) {
    callModule(example, "example")
}
shinyApp(ui, server)

Two things:

*

*You referred to exampleUI before defining it (In your actual example, you will probably source the module, so this shouldn't be a problem)

*When using renderUI in modules which contain input/output you need to wrap it within ns. Read the section on Using renderUI within modules for more


text:
Q: Cubulating non-compact hyperbolic manifolds
Let $X$ be a hyperbolic manifold of arbitrary dimension. When does $X$ admit a cell structure of a CAT(-1) cube complex? of a hyperbolic CAT(0) cube complex?

I suspect that the question is widely open, but I am rather interested in partial positive results in the non-compact case.


text:
Q: Building a nuget package that references a portable class library I am trying to construct a nuget package that installs a portable class library that itself that has dependencies on a collection of portable class libraries. I can create the package and install it without a problem but when I run an app with the new package installed, a .NET 4.5. class library test project, I always get the following exception:
threw exception:
 System.IO.FileNotFoundException: Could not load file or assembly
  'Microsoft.Data.Services.Client.Portable, Version=5.6.1.0, Culture=neutral, ...

My nuspec file, contains the following dependencies section.
<dependencies>
  <group targetFramework="portable-net45+wp80+win">
    <dependency id="Microsoft.Bcl" version="1.1.6"  />
    <dependency id="Newtonsoft.Json" version="6.0.2" />
    <dependency id="Microsoft.Data.Services.Client" version="5.6.1" />
    <dependency id="Microsoft.AspNet.WebApi.Client" version="5.1.1" />
  </group>
</dependencies>

I have created numerous nuget packages in the past and have never seen this issue. I am guessing it has to do with referencing the PCL versions of each library within the PCL dll that I am creating but I am clueless how to get this nuget to work properly.
What am I missing?

A: This looks like an issue with the Microsoft.Data.Services.Client NuGet package.  It is using different assembly names for the portable version as for the .NET Framework and Silverlight versions.  So your portable assembly is compiled against Microsoft.Data.Services.Client.Portable.dll, but when your NuGet package is installed into a .NET project, Microsoft.Data.Services.Client.dll is referenced instead.
Generally, a package like this should use the same assembly name on all platforms (the APIs do need to be compatible between the platforms too though).


text:
Q: Rails nested forms: assign index as value to DB I'm building a booking system for hotels and created a price model, which is accepted by the room model as nested attributes. So far so good, everything works perfectly fine. However, since I want to give the opportunity to be able to maintain price increments, I need the responding days in my price model. So basically, price: 50, 80, 120 along with days: 1, 2, 3 ...ok, so now my question: how can I achieve that the days are saved automatically in the price table, so that the user only needs to enter the price for a specific day.
I've tried to get it working with a hidden field that submits to the days column, but I couldn't fix it. As I have 20 increments generated by the controller, I've tried it with the index generated by the fields_for helper.
here's the relevant part of my controller:
def new
    @room = current_user.rooms.build
    20.times do
     increment = @room.increments.build
    end
end

And here's my view:
<%= form_for @room do |f| %>
  #...
  <%= f.fields_for :increments do |ff| %>

      <%= ff.text_field :price, placeholder: 'price' %>
      <%= ff.hidden_field :days, value: 'index'  %>

Do you have any ideas how I could achieve to get the value of my hidden_field to equal 1...20 with respect of my controller that generates 20 price fields? Do I need to write a form helper and if yes, how could I get it to add the number of days? Am I totally wrong with my approach and there is a more obvious way to achieve the same functionality? Any help highly appreciated!

A: I'm not entirely sure this is what you're asking, but could you use something like:
def new
    @room = current_user.rooms.build
    (1..20).each do |i|
      @center.increments.build(days: i)
    end
end

Or the building in a single line:
(1..20).each { |i| @center.increments.build(days: i) }
(Assigning increment in the loop isn't used anywhere, and will update to the last new increment for each element of the loop; therefore I've removed it.)
Edit: what @oscar said...

A: Do you always want to generate 20 times increments ?
well this line 20.times do is a loop. What would I do will be something like:
20.times do |t|
 increment = @center.increments.build(days: t+1) # t+1 since t starts in 0
end

In this way you set up the days at the building of the instances


text:
Q: Segfault when using Boost ASIO channels I'm trying to implement coroutine cancellation using channels in Boost::ASIO, however I'm getting segmentation faults and I can't figure out the reason.
I tried using a debugger, but it didn't tell me much, just that the segfault happens after "io_ctx->run()".
Here's my code:
boost::asio::awaitable<void> to_be_cancelled(
    boost::asio::experimental::concurrent_channel<void(boost::system::error_code, std::string)>& end,
    shared_ptr<boost::asio::io_context> io_ctx)
{
    boost::asio::ip::tcp::socket sock(*io_ctx);
    boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 8000);
    boost::asio::ip::tcp::acceptor acceptor(*io_ctx, endpoint);
    co_await
    (
        end.async_receive(boost::asio::use_awaitable_t()) ||
        acceptor.async_accept(sock, boost::asio::use_awaitable_t())
    );

    cout << "done\n";
}

boost::asio::awaitable<void> send_one_message(
    boost::asio::experimental::concurrent_channel<void(boost::system::error_code, std::string)>& channel)
{
    channel.async_send(boost::system::error_code{}, string("hello"), boost::asio::use_awaitable_t());
}

boost::asio::awaitable<void> coroutine_manager(shared_ptr<boost::asio::io_service> io_ctx)
{
    auto ch = make_shared<boost::asio::experimental::concurrent_channel<void(boost::system::error_code, std::string)>>(*io_ctx, 5);
    co_await (to_be_cancelled(*ch, io_ctx) && send_one_message(*ch));
}

int main()
{
    auto io_ctx = std::make_shared<boost::asio::io_service>(2);
    co_spawn(*io_ctx, coroutine_manager(io_ctx), boost::asio::detached);
    io_ctx->run();
}

Any help would be much appreciated.

A: I was missing a "co_await" in my "send_one_message" function, which I guess meant the string would go out of scope resulting in the receiving channel trying to access freed memory.


text:
Q: How to list all changes done to the lvm2 snapshot just like in the title, is it possible to list all changes that were saved/recorded within the snapshot?
let's assume:
I have changed /etc/network/interface 3 days ago.
On the next day, I installed a new package (let's say cuda-10 under /usr/locale/cuda-10/).
And today I deleted gparted (which was installed before the snapshot was made) with sudo apt-get remove gparted or sudo apt-get purge gparted
Is there a way to list all files affected by these actions? I am sure LVM keeps track of changes like that in one form or another (copies the to-be-changed / to-be-deleted files into the snapshot volume or sth like that), but how to list that "unformal record"? There should be a way, shouldn't there?

My configuration:
Ubuntu 18.04.1 LTS on four partitions:

*

*512 [Mib] | fat32 | flags: boot, hidden, esp

*5.00 [Gib] | ext4 | flags: hidden | mount-point: /boot

*20.00 [Gib] | linux-swap

*900.00 [Gib] | lvm2-pv | flags: lvm

*

*volume group: vg_ubuntu

*

*logic volume: lv_ubuntu: 850.00 [Gib] | ext4 | mount-point: /

*snapshot: lv_ubuntu_snap_00: 50.00 [Gib] | ext4


text:
Q: React Native: Animate scale, but make it shrink to the corner and not the center I have a View that I want to shrink to the bottom right with some margin / padding on the bottom and right sides.
I was able to make it shrink, but it shrinks to the center. The video element is the one shrinking:

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  View,
  PanResponder,
  Animated,
  Dimensions,
} from 'react-native';

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignSelf: 'stretch',
    backgroundColor: '#000000',
  },
  overlay: {
    flex: 1,
    alignSelf: 'stretch',
    backgroundColor: '#0000ff',
    opacity: 0.5,
  },
  video: {
    position: 'absolute',
    backgroundColor: '#00ff00',
    bottom: 0,
    right: 0,
    width: Dimensions.get("window").width,
    height: Dimensions.get("window").height,
    padding: 10,
  }
});

function clamp(value, min, max) {
  return min < max
    ? (value < min ? min : value > max ? max : value)
    : (value < max ? max : value > min ? min : value)
}

export default class EdmundMobile extends Component {

  constructor(props) {
    super(props);
    this.state = {
      pan: new Animated.ValueXY(),
      scale: new Animated.Value(1),
    };
  }

  componentWillMount() {
    this._panResponder = PanResponder.create({
      onMoveShouldSetResponderCapture: () => true,
      onMoveShouldSetPanResponderCapture: () => true,

      onPanResponderGrant: (e, gestureState) => {
        this.state.pan.setOffset({x: this.state.pan.x._value, y: 0});
        this.state.pan.setValue({x: 0, y: 0});
      },

      onPanResponderMove: (e, gestureState) => {
        let width = Dimensions.get("window").width;
        let difference = Math.abs((this.state.pan.x._value + width) / width);
        if (gestureState.dx < 0) {
          this.setState({ scale: new Animated.Value(difference) });
          return Animated.event([
            null, {dx: this.state.pan.x, dy: 0}
          ])(e, gestureState);
        }
      },

      onPanResponderRelease: (e, {vx, vy}) => {
        this.state.pan.flattenOffset();
        if (vx >= 0) {
          velocity = clamp(vx, 3, 5);
        } else if (vx < 0) {
          velocity = clamp(vx * -1, 3, 5) * -1;
        }

        if (Math.abs(this.state.pan.x._value) > 200) {
          Animated.spring(this.state.pan, {
            toValue: {x: -Dimensions.get("window").width, y: 0},
            friction: 4
          }).start()
          Animated.spring(this.state.scale, {
            toValue: 0.2,
            friction: 4
          }).start()
        } else {
          Animated.timing(this.state.pan, {
            toValue: {x: 0, y: 0},
            friction: 4
          }).start()
          Animated.spring(this.state.scale, {
            toValue: 1,
            friction: 10
          }).start()
        }
      }
    });
  }

  render() {
    let { pan, scale } = this.state;
    let translateX = pan.x;
    let swipeStyles = {transform: [{translateX}]};
    let videoScale = scale
    let localVideoStyles = {transform: [{scale: videoScale}]};
    return (
      <View style={styles.container}>
        <Animated.View style={[styles.video, localVideoStyles]}></Animated.View>
        <Animated.View style={[styles.overlay, swipeStyles]} {...this._panResponder.panHandlers}>
        </Animated.View>
      </View>
    );
  }
}

AppRegistry.registerComponent('EdmundMobile', () => EdmundMobile);

A: Ok I figured out one solution. Kinda hands on, but I think it provides all the customizations I need.
So instead of transforming scale, I animate the width, height, bottom, top styles by attaching them to the state and changing them in response to the pan responder stuff.
import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  View,
  PanResponder,
  Animated,
  Dimensions,
} from 'react-native';

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignSelf: 'stretch',
    backgroundColor: '#000000',
  },
  overlay: {
    flex: 1,
    alignSelf: 'stretch',
    backgroundColor: '#0000ff',
    opacity: 0.5,
  },
  video: {
    position: 'absolute',
    backgroundColor: '#00ff00',
  }
});

function clamp(value, min, max) {
  return min < max
    ? (value < min ? min : value > max ? max : value)
    : (value < max ? max : value > min ? min : value)
}

const MIN_VIDEO_WIDTH = 120;
const MIN_VIDEO_HEIGHT = 180;

export default class EdmundMobile extends Component {

  constructor(props) {
    super(props);
    this.state = {
      pan: new Animated.ValueXY(),
      width: new Animated.Value(Dimensions.get("window").width),
      height: new Animated.Value(Dimensions.get("window").height),
      bottom: new Animated.Value(0),
      right: new Animated.Value(0),
    };
  }

  componentWillMount() {
    this._panResponder = PanResponder.create({
      onMoveShouldSetResponderCapture: () => true,
      onMoveShouldSetPanResponderCapture: () => true,

      onPanResponderGrant: (e, gestureState) => {
        this.state.pan.setOffset({x: this.state.pan.x._value, y: 0});
        this.state.pan.setValue({x: 0, y: 0});
      },

      onPanResponderMove: (e, gestureState) => {
        let width = Dimensions.get("window").width;
        let difference = Math.abs((this.state.pan.x._value + width) / width);
        console.log(difference);
        if (gestureState.dx < 0) {
          const newVideoHeight = difference * Dimensions.get("window").height;
          const newVideoWidth = difference * Dimensions.get("window").width;
          if (newVideoWidth > MIN_VIDEO_WIDTH) {
            this.setState({
              width: new Animated.Value(newVideoWidth),
            });
          }
          if (newVideoHeight > MIN_VIDEO_HEIGHT) {
            this.setState({
              height: new Animated.Value(newVideoHeight),
            });
          }

          this.setState({
            bottom: new Animated.Value((1- difference) * 20),
            right: new Animated.Value((1 - difference) * 20),
          });

          return Animated.event([
            null, {dx: this.state.pan.x, dy: 0}
          ])(e, gestureState);
        }
      },

      onPanResponderRelease: (e, {vx, vy}) => {
        this.state.pan.flattenOffset();
        if (vx >= 0) {
          velocity = clamp(vx, 3, 5);
        } else if (vx < 0) {
          velocity = clamp(vx * -1, 3, 5) * -1;
        }

        if (Math.abs(this.state.pan.x._value) > 200) {
          Animated.spring(this.state.pan, {
            toValue: {x: -Dimensions.get("window").width, y: 0},
            friction: 4
          }).start()
          Animated.spring(this.state.width, {
            toValue: MIN_VIDEO_WIDTH,
            friction: 4
          }).start()
          Animated.spring(this.state.height, {
            toValue: MIN_VIDEO_HEIGHT,
            friction: 4
          }).start()
          Animated.timing(this.state.bottom, {
            toValue: 20,
          }).start()
          Animated.timing(this.state.right, {
            toValue: 20,
          }).start()
        } else {
          Animated.timing(this.state.pan, {
            toValue: {x: 0, y: 0},
          }).start()
          Animated.timing(this.state.width, {
            toValue: Dimensions.get("window").width,
            friction: 4
          }).start()
          Animated.timing(this.state.height, {
            toValue: Dimensions.get("window").height,
            friction: 4
          }).start()
          Animated.timing(this.state.bottom, {
            toValue: 0,
          }).start()
          Animated.timing(this.state.right, {
            toValue: 0,
          }).start()
        }
      }
    });
  }

  render() {
    let { pan, width, height, bottom, right } = this.state;
    let translateX = pan.x;
    let swipeStyles = {transform: [{translateX}]};
    let videoStyles = {
      width: width,
      height: height,
      bottom: bottom,
      right: right,
    };
    return (
      <View style={styles.container}>
        <Animated.View style={[styles.video, videoStyles]}></Animated.View>
        <Animated.View style={[styles.overlay, swipeStyles]} {...this._panResponder.panHandlers}>
        </Animated.View>
      </View>
    );
  }
}

AppRegistry.registerComponent('EdmundMobile', () => EdmundMobile);


text:
Q: Testing child validators This is what I have:
public class BusinessUnitIdValidator : AbstractValidator<string>
{
    public BusinessUnitIdValidator(IConfigSettings configSettings)
    {
        LovFile buidLovFile = configSettings.BuidLovFile;
        RuleFor(x => x).NotEmpty().WithMessage(ValidationResultConstants.BUSINESS_UNIT_ID_SHOULD_NOT_BE_NULL);

        When(x => !string.IsNullOrWhiteSpace(x),
            () =>
            {
                RuleFor(x => x).Must((buid) => IsValidBusinessUnitId(buidLovFile, buid)).WithMessage(ValidationResultConstants.INVALID_BUSINESS_UNIT_ID);
            });
    }
}

public class CreateCustomerRequestValidator : AbstractValidator<CreateCustomerRequest>
{
    public CreateCustomerRequestValidator(IValidator<string> _businessUnitIdValidator)
    {
        RuleFor(x => x).NotNull();
        RuleFor(x => x.BusinessUnitId).SetValidator(_businessUnitIdValidator);
   }
}

When I'm testing this through the below snippet, I'm not getting the validation message that the _businessUnitIdValidator throws.
[Fact]
public void ShouldThrowErrorsWhenValidationFails()
{
    // Arrange
    // sets one entry in the validationFailures collection
    List<ValidationFailure> validationFailures = TestUtility.GetValidationFailures();
    ValidationResult validationResultMock = new ValidationResult(validationFailures);
    _businessUnitIdValidatorMock = new Mock<IValidator<string>>();
    _businessUnitIdValidatorMock.Setup(b => b.Validate(It.IsAny<string>())).Returns(validationResultMock);
    validator = new CreateContactMethodsRequestValidator(_businessUnitIdValidatorMock.Object);

    CreateContactMethodsRequest model = new CreateContactMethodsRequest();
    var validationResult = validator.Validate(model);

    // Assert
    validationResult.IsValid.ShouldBeFalse();
    validator.ShouldHaveChildValidator(x => x.BusinessUnitId, typeof(IValidator<string>));
    validationResult.Errors.Count.ShouldBe(1);
}

Why am I not getting the error sent by the _businessUnitIdValidator? How do I get that message?

I'm using FluentValidation.AspNetCore Version="8.4.0".


text:
Q: Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect I am trying to run integration test for my project and I am using Apache Derby for that. My main classes look like
integration/pom.xml
        <plugins>
            <plugin>
                <groupId>org.carlspring.maven</groupId>
                <artifactId>derby-maven-plugin</artifactId>
                <version>1.8</version>
                <configuration>
                    <port>${derby.port}</port>
                </configuration>
                <executions>
                    <execution>
                        <id>start-derby</id>
                        <goals>
                            <goal>start</goal>
                        </goals>
                        <phase>pre-integration-test</phase>
                    </execution>
                    <execution>
                        <id>stop-derby</id>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                        <phase>post-integration-test</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.17</version>
                <configuration>
                    <includes>
                        <include>**/*.java</include>
                    </includes>
                    <groups>
                        com.learner.persistence.harness.PreIntegration
                    </groups>
                    <excludedGroups>
                        com.learner.persistence.harness.Integration
                    </excludedGroups>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>${maven-war-plugin.version}</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>${maven.cargo.version}</version>
                <configuration>
                    <container>
                        <containerId>wildfly8x</containerId>
                        <dependencies combine.children="append">
                            <dependency>
                                <groupId>org.apache.derby</groupId>
                                <artifactId>derby</artifactId>
                            </dependency>
                            <dependency>
                                <groupId>org.apache.derby</groupId>
                                <artifactId>derbyclient</artifactId>
                            </dependency>
                        </dependencies>
                        <systemProperties combine.children="append">
                            <hibernate.dialect>org.hibernate.dialect.DerbyTenSevenDialect
                            </hibernate.dialect>
                        </systemProperties>
                    </container>
                    <configuration>
                        <properties>
                            <cargo.servlet.port>9090</cargo.servlet.port>
                            <cargo.datasource.datasource.derby>
                                cargo.datasource.driver=org.apache.derby.jdbc.ClientDriver|
                                cargo.datasource.url=jdbc:derby://localhost:${derby.port}/integrationDB|
                                cargo.datasource.jndi=${datasource.jndi}|
                                cargo.datasource.username=${datasource.user}|
                                cargo.datasource.password=${datasource.password}
                            </cargo.datasource.datasource.derby>
                        </properties>
                    </configuration>
                    <deployables>
                        <deployable>
                            <properties>
                                <context>earth</context>
                            </properties>
                            <pingURL>http://localhost:9090/earth/rest/hello</pingURL>
                            <pingTimeout>36000</pingTimeout>
                        </deployable>
                    </deployables>
                </configuration>
                <executions>
                    <execution>
                        <id>start-container</id>
                        <goals>
                            <goal>start</goal>
                        </goals>
                        <phase>pre-integration-test</phase>
                    </execution>
                    <execution>
                        <id>stop-container</id>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                        <phase>post-integration-test</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>

DataSetupTest
@Category(PreIntegration.class)
public class DataSetup {
    @Rule
    public final JpaRule jpaRule = new JpaRule(JpaRule.Derby.directory, "unit-testing-pu");

    @Test
    public void setupData() throws SQLException, LiquibaseException {
        System.out.println("Setting up IT Database");
        com.learner.database.DataSetupTest.runLiquibaseUpdate(jpaRule);
    }
}

PersonsIT
@Category(Integration.class)
public class PersonsIT extends AbstractIntegrationTest {

    @Rule
    public final JpaRule jpaRule = new JpaRule(JpaRule.Derby.client, "unit-testing-pu");

    @Test
    public void testGetPersons() throws IOException {
        final Client client = ClientBuilder.newClient();
        final WebTarget webTarget = client.target("http://localhost:9090/earth/rest/persons");
        final Response response = webTarget
                .request(MediaType.APPLICATION_JSON)
                .accept(MediaType.APPLICATION_JSON).get();
        assertStatus(HttpStatus.SC_OK, response);
        final JsonNode responsePayload = parseResponse(response);
        assertEquals(5, responsePayload.size());
    }
}

DerbyClient
public class DerbyClient implements DataSourceDefinition {

    private final String database;

    public DerbyClient() {
        this("integrationDB");
    }

    public DerbyClient(@Nonnull final String database) {
        this.database = database;
    }

    @Nonnull
    public static String getPort() {
        return System.getProperty("derby.port", "1527");
    }

    @Nonnull
    @Override
    public Map<String, String> getPersistenceProperties() {
        final Map<String, String> map = new HashMap<>();
        map.put(HIBERNATE_DIALECT, EmbeddedDerby.DERBY_TEN_TEN_DIALECT);
        map.put(JAVAX_PERSISTENCE_JDBC_URL, EmbeddedDerby.JDBC_URL_PROTOCOL + "//localhost:" + getPort() + "/" + database);
        map.put(JAVAX_PERSISTENCE_JDBC_DRIVER, "org.apache.derby.jdbc.ClientDriver");
        map.put(JAVAX_PERSISTENCE_JDBC_USER, System.getProperty("datasource.user", "APP"));
        map.put(JAVAX_PERSISTENCE_JDBC_PASSWORD, System.getProperty("datasource.password", "nonemptypassword"));
        return map;
    }

    @Override
    public void before() {
    }

    @Override
    public void after() {
    }
}

When I run this module, I see
                -------------------------------------------------------
                 T E S T S
                -------------------------------------------------------
                SLF4J: Class path contains multiple SLF4J bindings.
                SLF4J: Found binding in [jar:file:/Users/harith/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
                SLF4J: Found binding in [jar:file:/Users/harith/.m2/repository/ch/qos/logback/logback-classic/1.1.2/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
                SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
                SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
                Running com.learner.integration.DataSetup
                log4j:WARN No appenders could be found for logger (com.learner.persistence.harness.DerbyDirectory).
                log4j:WARN Please initialize the log4j system properly.
                log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
                Setting up IT Database
                INFO 9/28/14 8:36 AM:liquibase: Successfully acquired change log lock
                INFO 9/28/14 8:36 AM:liquibase: Dropping Database Objects in schema: APP.APP
                INFO 9/28/14 8:36 AM:liquibase: Creating database history table with name: APP.DATABASECHANGELOG
                INFO 9/28/14 8:36 AM:liquibase: Creating database history table with name: APP.DATABASECHANGELOG
                INFO 9/28/14 8:36 AM:liquibase: Successfully released change log lock
                INFO 9/28/14 8:36 AM:liquibase: Successfully acquired change log lock
                INFO 9/28/14 8:36 AM:liquibase: Reading from APP.DATABASECHANGELOG
                INFO 9/28/14 8:36 AM:liquibase: Reading from APP.DATABASECHANGELOG
                INFO 9/28/14 8:36 AM:liquibase: Reading from APP.DATABASECHANGELOG
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/01.xml::09222014.0639::harit: Reading from APP.DATABASECHANGELOG
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/01.xml::09222014.0639::harit: Table person created
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/01.xml::09222014.0639::harit: ChangeSet liquibase/2014/01.xml::09222014.0639::harit ran successfully in 10ms
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/01.xml::09222014.0639::harit: Reading from APP.DATABASECHANGELOG
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/02.xml::09222014.0844::harit: Reading from APP.DATABASECHANGELOG
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/02.xml::09222014.0844::harit: New row inserted into person
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/02.xml::09222014.0844::harit: New row inserted into person
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/02.xml::09222014.0844::harit: New row inserted into person
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/02.xml::09222014.0844::harit: New row inserted into person
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/02.xml::09222014.0844::harit: New row inserted into person
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/02.xml::09222014.0844::harit: ChangeSet liquibase/2014/02.xml::09222014.0844::harit ran successfully in 18ms
                INFO 9/28/14 8:36 AM:liquibase: liquibase/changelog.xml: liquibase/2014/02.xml::09222014.0844::harit: Reading from APP.DATABASECHANGELOG
                INFO 9/28/14 8:36 AM:liquibase: Successfully released change log lock
                Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.988 sec - in com.learner.integration.DataSetup

                Results :

                Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

                [INFO]
                [INFO] --- maven-war-plugin:2.4:war (default-war) @ integration ---
                [INFO] Packaging webapp
                [INFO] Assembling webapp [integration] in [/Users/harith/code/IdeaProjects/others/java_ee_multiple_persistence/integration/target/integration-1.0-SNAPSHOT]
                [INFO] Processing war project
                [INFO] Webapp assembled in [64 msecs]
                [INFO] Building war: /Users/harith/code/IdeaProjects/others/java_ee_multiple_persistence/integration/target/integration-1.0-SNAPSHOT.war
                [INFO]
                [INFO] --- derby-maven-plugin:1.8:start (start-derby) @ integration ---
                [INFO] Initializing Derby server control for localhost/127.0.0.1
                [INFO] Starting the Derby server ...
                Sun Sep 28 08:36:34 PDT 2014 : Apache Derby Network Server - 10.10.1.1 - (1458268) started and ready to accept connections on port 1527
                [INFO] Derby ping-pong: [OK]
                [INFO]
            ...snipped
                [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (ServerService Thread Pool -- 54) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection
                [INFO] [talledLocalContainer]   at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:304)
                [INFO] [talledLocalContainer]   at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:311)
                [INFO] [talledLocalContainer]   at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:246)
                [INFO] [talledLocalContainer]   at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:1144)
                [INFO] [talledLocalContainer]   at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:446)
                [INFO] [talledLocalContainer]   at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:452)
                [INFO] [talledLocalContainer]   at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:420)
                [INFO] [talledLocalContainer]   at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:379)
                [INFO] [talledLocalContainer]   at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:422)
                [INFO] [talledLocalContainer]   at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:513)
                [INFO] [talledLocalContainer]   at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:142)
                [INFO] [talledLocalContainer]   at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:279) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:124) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:206) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) [hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) [hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:399) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) [hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
                [INFO] [talledLocalContainer]   at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) [jipijapa-hibernate4-3-1.0.1.Final.jar:]
                [INFO] [talledLocalContainer]   at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]
                [INFO] [talledLocalContainer]   at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]
                [INFO] [talledLocalContainer]   at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_05]
                [INFO] [talledLocalContainer]   at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:474) [wildfly-security-manager-1.0.0.Final.jar:1.0.0.Final]
                [INFO] [talledLocalContainer]   at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]
                [INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_05]
                [INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_05]
                [INFO] [talledLocalContainer]   at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_05]
                [INFO] [talledLocalContainer]   at org.jboss.threads.JBossThread.run(JBossThread.java:122)
                [INFO] [talledLocalContainer] Caused by: java.sql.SQLNonTransientConnectionException: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'integrationDB' with class loader ClassRealm[plugin>org.carlspring.maven:derby-maven-plugin:1.8, parent: sun.misc.Launcher$AppClassLoader@2503dbd3], see the next exception for details.::SQLSTATE: XSLAN
                [INFO] [talledLocalContainer]   at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:279)
                [INFO] [talledLocalContainer]   ... 32 more
                [INFO] [talledLocalContainer] Caused by: ERROR XJ040: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'integrationDB' with class loader ClassRealm[plugin>org.carlspring.maven:derby-maven-plugin:1.8, parent: sun.misc.Launcher$AppClassLoader@2503dbd3], see the next exception for details.::SQLSTATE: XSLAN
                [INFO] [talledLocalContainer]   at org.apache.derby.client.am.ClientConnection.completeSqlca(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.client.net.NetConnectionReply.parseRdbAccessFailed(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.client.net.NetConnectionReply.parseAccessRdbError(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.client.net.NetConnectionReply.parseACCRDBreply(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.client.net.NetConnectionReply.readAccessDatabase(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.client.net.NetConnection.readSecurityCheckAndAccessRdb(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.client.net.NetConnection.flowSecurityCheckAndAccessRdb(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.client.net.NetConnection.flowUSRIDPWDconnect(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.client.net.NetConnection.flowConnect(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.client.net.NetConnection.<init>(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl.newNetConnection(Unknown Source) [derbyclient-10-11-1-1.jar:]
                [INFO] [talledLocalContainer]   ... 34 more
                [INFO] [talledLocalContainer]
                [INFO] [talledLocalContainer] 08:36:43,348 WARN  [org.hibernate.engine.jdbc.internal.JdbcServicesImpl] (ServerService Thread Pool -- 54) HHH000342: Could not obtain connection to query metadata : javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/jdbc/EarthDS
                [INFO] [talledLocalContainer] 08:36:43,355 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 54) HHH000400: Using dialect: org.hibernate.dialect.DerbyTenSevenDialect
                [INFO] [talledLocalContainer] 08:36:43,365 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (ServerService Thread Pool -- 54) HHH000422: Disabling contextual LOB creation as connection was null
                [INFO] [talledLocalContainer] 08:36:43,446 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 54) HHH000397: Using ASTQueryTranslatorFactory
                [INFO] [talledLocalContainer] 08:36:44,328 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-12) Initializing Mojarra 2.2.5-jbossorg-3 20140128-1641 for context '/earth'
                [INFO] [talledLocalContainer] 08:36:45,343 INFO  [org.jboss.resteasy.spi.ResteasyDeployment] (MSC service thread 1-12) Deploying javax.ws.rs.core.Application: class com.learner.services.configuration.EarthApplication
                [INFO] [talledLocalContainer] 08:36:45,500 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-12) JBAS017534: Registered web context: /earth
                [INFO] [talledLocalContainer] 08:36:45,533 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "earth.war" (runtime-name : "earth.war")
                [INFO] [talledLocalContainer] 08:36:45,533 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "cargocpc.war" (runtime-name : "cargocpc.war")
                [INFO] [talledLocalContainer] 08:36:45,546 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
                [INFO] [talledLocalContainer] 08:36:45,547 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
                [INFO] [talledLocalContainer] 08:36:45,547 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.0.0.Final "WildFly" started in 6723ms - Started 396 of 454 services (100 services are lazy, passive or on-demand)
                -------------------------------------------------------
                 T E S T S
                -------------------------------------------------------
                Running com.learner.integration.HelloIT
                Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.513 sec <<< FAILURE! - in com.learner.integration.PersonsIT
                testGetPersons(com.learner.integration.PersonsIT)  Time elapsed: 0.513 sec  <<< ERROR!
                javax.persistence.PersistenceException: Unable to build entity manager factory
                    at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:83)
                    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
                    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
                    at com.learner.persistence.harness.JpaRule.before(JpaRule.java:104)
         ...snipped
              org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
                    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
                    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
                Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect
                    at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator$1$1.convert(BasicConnectionCreator.java:122)
                    at ...snipped
        org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
                    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
                    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
                    at com.learner.persistence.harness.JpaRule.before(JpaRule.java:104)
                    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
 ...snipped

                    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:113)
                    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:85)
                    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:54)
                    at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:134)
                    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
                    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
                    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
                Caused by: java.sql.SQLNonTransientConnectionException: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'integrationDB' with class loader ClassRealm[plugin>org.carlspring.maven:derby-maven-plugin:1.8, parent: sun.misc.Launcher$AppClassLoader@2503dbd3], see the next exception for details.::SQLSTATE: XSLAN
                    at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
                    at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
                    at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
                    at ...snipped
    org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
                    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
                    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
                    at com.learner.persistence.harness.JpaRule.before(JpaRule.java:104)
                    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
 ...snipped
                    at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
                    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:113)
                    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:85)
                    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:54)
                    at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:134)
                    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
                    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
                    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

What is the issue?

A: When you get a Derby exception: "Failed to start database ... see next exception for details", this may help: http://wiki.apache.org/db-derby/UnwindExceptionChain


text:
Q: Order queryset by JSON field of latest FK I have such models:
class Configuration(models.Model):
    @property
    def latest_value_A(self):
        return self.result_set.latest("created_time").data.get("value_A")

class Result(models.Model):
    data = models.JSONField()  # "value_A" key is present in JSON
    configuration = models.ForeignKey(Configuration, on_delete=models.CASCADE)
    created_time = models.DateTimeField()

I want to do something like Configuration.objects.order_by("latest_value_A") which obviously fails cause it's just a property and not stored in DB. But what would be the proper way of doing it?
UPDATE: I'm using PostgreSQL

A: You can use the sorted function from python. Something like:
sorted(Configuration.objects.all(), key=lambda t: t.latest_value_A)

A reference if needed:
Ordering Django queryset by a @property


text:
Q: Elastic Search cancel long running task For Elastic Search version 6.0
to cancel a running task:
POST _tasks/node_id:task_id/_cancel

I am following the same statement, but in actual it is unable to cancel the task. After running this command if I run get command to fetch all running task, the particular task don't get cancel.
If I hit cancel statement again, it gives statement that task_id is already cancelled but in reality it doesn't get cancel.

A: Calling the _tasks/<id>/_cancel endpoint only signifies to ES that the task should be cancelled. ES will then cancel the task as soon as it possibly can.
It might not be immediate, though, for instance, if you have a very complex search that takes a long time (e.g. wildcard queries with leading wildcards).
If you check the ContextIndexSearcher class and look for all places where checkCancelled.run() is called, those are the only phases when a query can be cancelled, but sometimes a phase can take a long time before being eligible for cancellation.
If your task is a search task, then you might try to leverage the timeout parameter to see if it helps (it might not always for the same reasons as mentioned above).


text:
Q: Pass Comparator in custom list Constructor, which is used to sort contents of the list I'm working on an Assignment where we're to create our own Generic Linked List. The List takes a Comparator<T> in its constructor, and we are to use the compare method of that comparator in our sorting algorithm. I've got the List working and fully tested, but I'm having issues passing a comparator type.
Keeping in mind the comparator would be passed by an end-user, how would you define and pass a comparator?
The constructor looks like:
public SorterList(final Comparator<T> comparator) {}
Thanks for any ideas!
Edit: When trying this, I get an error when creating the new SorterList object: image.
public static void main(String[] args) {
Comparator<Integer> comparator = new Comparator<Integer>() {

       public int compare(final Integer o1, final Integer o2) {

                // Ignore the simplicity of the compare
                if(o1 > o2)
                    return 0;
                else
                    return 1;

       }

    };

SorterList<Integer> intList = new SorterList<Integer>(comparator);

}


text:
Q: Transferring variable into a shell function Is there a way to use shell function that accepts variable from the bash script (or rather, transfer a variable into a shell function)?
The following procedure works just fine (Note, I'm using this procedure as part of my need to implement output redirection as explained here):
mycmd() { cat <(head -3 MyProgrammingBook.txt|awk -F "\t" '{OFS="\t"}{print "Helloworld",$0}') > outputfile.txt; };
export -f mycmd;
bsub -q short "bash -c mycmd"

However, I would like to provide the initial file name as a variable and not as hardcoded name, something such as the following, but the following doesn't work:
myinputfile="MyProgrammingBook.txt";
mycmd() { cat <(head -3 ${myinputfile}|awk -F "\t" '{OFS="\t"}{print "Helloworld",$0}') > outputfile.txt; };
export -f mycmd;
bsub -q short "bash -c mycmd"

Ultimately, mycmd() would be called inside a loop and will be utilized each time with a different variable.

A: export the variable too:
myinputfile="MyProgrammingBook.txt";
mycmd() { cat <(head -3 ${myinputfile}|awk -F "\t" '{OFS="\t"}{print "Helloworld",$0}') > outputfile.txt; };
export -f mycmd;
export myinputfile;   # Here
bsub -q short "bash -c mycmd"


text:
Q: Populate Scrapy item with more than one key : value pair Here is my code so far:
import scrapy

class FcsItem(scrapy.Item): #items.py file
    title = scrapy.Field()
    link = scrapy.Field()

#test.py file below, different file from above

import scrapy
from fcs.items import FcsItem

class FCScrape(scrapy.Spider):
    name = "FC"
    allowed_domains = ["finalcall.com"]
    start_urls = ["http://www.finalcall.com/artman/publish/Columns_4/index.shtml"]

    def parse(self, response):
        item = FcsItem()
        divs_title = response.selector.xpath('//div[@class="category-story"]')

        for title, link in zip(divs_title.xpath('.//a/text( )'), divs_title.xpath('.//a/@href')):
            item['title'] = title.extract()
            item['link'] = link.extract()

            #I'm actually trying to attach the title as a string as the key and the link as a string as the value in one dictionary.

I tried a bunch of different ways, but the problem I keep hitting is not being able to get all the key : value pairs instead of just one. How can I modify my code to achieve this?

A: How that page is setup, and how you are selecting things, all you're grabbing is one pair, in the form of a tuple.  When you do zip(divs_title.xpath('.//a/text( )'), divs_title.xpath('.//a/@href') you return a one item list of the  tag text, and a one item list of the  href content.  You zip the together, and get one item.
The (not-good) solution is to try and keep all these items in a dictionary using a Key:Value pair, as you've requested.  To do so, loop over the "category-story" divs, as they are the articles you want.  You wouldn't need to use items for this, because you don't seem to be using it as an item, anyway:
def parse(self, response):
    the_dict = {}
    for article in response.selector.xpath('//div[@class="category-story"]'):
        title = article.xpath('.//a/text( )').extract()
        link = article.xpath('.//a/@href').extract()
        the_dict[title] = link

The better solution (and what looks like your end goal) would be continue using your items, and have a pipeline handle whatever it is you want to do with this content.
def parse(self, response):
    for article in response.selector.xpath('//div[@class="category-story"]'):
        item = FcsItem()
        item['title'] = article.xpath('.//a/text( )').extract()
        item['link'] = article.xpath('.//a/@href').extract()
        yield item


text:
Q: Autocomplete textview just show the last value which I submitted into database in Android I am using a textfield for submiting some names into database by pressing a button in the main activity.In another activity I use an Autocomplete textview for showing the names.But the problem is it shows only the last name which I submitted.Here is my code for showing names in autocomplete textview:
for (Contact cn : contact) {

String[] s1=new String[]{(cn.getName())};
         ArrayAdapter<String> adapter =  new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice,s1);

         a1.setThreshold(1);
         a1.setAdapter(adapter);
}

A: Try this..
ArrayList<String> s1 = new ArrayList<String>();
    for (Contact cn : contact) {
        s1.add(cn.getName());
    }
    ArrayAdapter<String> adapter =  new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice,s1);

    a1.setThreshold(1);
    a1.setAdapter(adapter);


text:
Q: how to view events of a non primary calendar? I am using google calendar api for python for viewing events of the calendar.The following code gives the list of all the non primary calendar urls.here is the cod:
client = gdata.calendar.client.CalendarClient(source='app_name-v3')
client.ClientLogin('xyz@gmail.com', 'password', client.source)
feed = client.GetOwnCalendarsFeed()
print feed.title.text

for i, a_calendar in enumerate(feed.entry):
   print '\t%s. %s' % (i, a_calendar.title.text,)
urls = list((e.title.text, e.content.src) for e in feed.entry)
print urls

The output gives the urls of all the non primary calendars.An event can be inserted to any of these urls using
 client.InsertEvent(event, url)

but how do i view the events for each url?

A: You are using a deprecated version of the Calendar API. Please switch to v3 and then use https://developers.google.com/google-apps/calendar/v3/reference/events/insert where you replace the calendar ID with the email address of the secondary calendar.


text:
Q: Oracle row wise Sum My Oracle Employee_Expense table is as follows. Text in red is what I am expecting.

I just need to get the sum of the expenses for this four months sorted by Emp_No and Year.
Any ideas please?.

A: Just add them up and include it in your query;
SELECT   emp_no
       , year
       , january
       , february
       , march
       , april
       , (january + february + march + april) AS total
FROM     employee_expense
ORDER BY emp_no, year

That should do it unless there's something else involved that you haven't mentioned.

A: It's a poor design, months shouldn't be the columns of a table.
For scenarios where you need a generated column from other columns, what you may do is add a virtual column to the table, i.e. for Total. You then don't have to explicitly write the addition every time you query, simply query the columns and Oracle will do the addition for you.
ALTER TABLE employee_expense ADD (
     total GENERATED ALWAYS AS ( january + february + march + april )
);

Simply running this will give you the values for Total.
select * from employee_expense;


text:
Q: Line-breaks with whitespace only - rather than with special characters In relation to this question asked eight years ago; Break Lines by Whitespace Only
Is there a way to ensure lines of text are only broken onto a new line by whitespace — and not special characters such as ',' '?' '!' (as is seemingly the unicode standard)?
For example if I have a string;
jsyY!m,?s juqu8Tz~n j29@jak?ks9 2cz33#gg8*

Whilst there are four different 'word' strings in the above (separated by white-space), the browser breaks the line after '!' ',' or '?' in some circumstances — whereas I want the browser to treat that string of glyphs as a word in itself.
I have found the above thread asking a very similar question — in which it was agreed there is no way to achieve what I want without wrapping parts of the text in elements like  — which wouldn't be ideal for me as i'm generating these strings on the fly with javascript.
The question is 8 years old so I wondered if anyone knew if anything had changed in this regard? Thanks for any advice or pointers.
EDIT
This issue has been solved by iterating through the body of text in javascript, adding '' at the beginning of the string, ' ' in the place of every 'space', and  at the very end of the string. This seems to stop any part of any individual word breaking and being forced onto a new line (when having its individual glyphs replaced by special characters).


text:
Q: How can I make a Custom Potion in Minecraft Bedrock Edition? Java Edition has a feature allowing one to make potions with any effect, duration and color. Can I do this in Bedrock Edition?

A: Yes
A forewarning: This is a little bit a stretch of the term "potion", as our "potion" will be instantly consumed. This assumes you have a basic knowledge of chain command blocks and conditionals.
Approach
Spawn eggs are one of the most useful things in commands, as they allow us to tell when a player has right-clicked/tapped. We will now know when the player "drinks" our potion whenever our entitiy has spawned.
Our "Potion"
Let's get a bat spawn egg and name it "Blackout Potion". When a spawn egg is given a custom name, the entity it spawns is given that name. Now that we've established the specifics, it's easy going from here.
How
Place a repeating always active command block with the command:
effect @e[type=bat,name="Blackout Potion"] invisibility 9999 255 true

We do this as not to see the entity, as this will hide the death animation when we /kill it later. Notice we skip a /testfor - We have condensed it as this command will only return true if we find a bat by this name. Now a chain conditional always active command block with the command:
execute @e[type=bat,name="Blackout Potion"] ~ ~ ~ effect @p[r=6] night_vision 45 255

We then give this effect to the nearest player within 6 blocks of our entity. Now a chain conditional always active command block with the command:
execute @e[type=bat,name="Blackout Potion"] ~ ~ ~ effect @p[r=6] blindness 45 255

That is my second effect! If you don't know about this easter egg, follow this tutorial and you can see what happens when we mix these effects. What's actually happening here, though? We're merely adding a second effect to our potion. You can have more effects if you want, or just one. Remember the first number is how long each effect lasts, mine is 45 seconds each. The second value is the amplifier. It must be a number 0-255 (i.e. speed 30 0 = Speed I for 30 seconds, night_vision 120 4 = Night Vision V for 2 minutes).
Now a chain conditional always active command block with the command:
kill @e[type=bat,name="Blackout Potion"]

Finally, say goodbye to our bat. He is useless now as we have used all the commands on him that we want.
Notes

*

*Use different entities to have different color potions! You have a lot of options.

*This works best with gamerule domobdrops set to false, as it gives you more options. Don't want to? Just make sure the mob you use doesn't drop items (i.e. no cows, no zombies). Don't worry about XP - that only drops if a player kills a mob.

*Named spawn eggs are so useful for so many things! Think of all the different things you can do: Custom mobs, traps, structure placements... Use these, so many don't consider this amazing item!

Downsides

*

*Instantly consumed

*Must be pointed at a block to "drink"

*Doesn't actually look like a potion

*Death sounds - Squeak! Moo!

A: Following what @Penguin said. Minecraft Bedrock command blocks have changed so what they originally said won't work entirely, but I found the fix! Replace their execute command with this..
/execute at @e[type=bat,name="Blackout Potion"] run effect @p[r=6] blindness 45 255 true

and that should do it!


text:
Q: require once - PHP: set_include_path not working I've been trying to fix this for 5 hours now.
This is my current php code.
set_include_path("google-api-php-client-master/src/Google");
require_once 'Google/Client.php';
require_once 'Google/Service/YouTube.php';

The directory structure looks like this:
+/test/
    +google-api-php-client-master/
        test.php

So the php file is in the same directory as the google api folder. Unfortunately I always get an error:
Warning: require_once(Google/Client.php) [function.require-once]: failed to open stream: No such file or directory in /test/test.php on line 20

Fatal error: require_once() [function.require]: Failed opening required 'Google/Client.php' (include_path='google-api-php-client/src') in /test/test.php on line 20

I have also set the permissions for the file. I am really clueless.
EDIT: I've tried some stuff out randomly and this solution worked for me:
set_include_path("api/src/");
require_once 'Google/Client.php';
require_once 'Google/Service/YouTube.php';

A: Zend recommends this procedure:
defined('BASE_PATH')
    || define('BASE_PATH', realpath(dirname(__FILE__));

set_include_path(implode(PATH_SEPARATOR, array(
    realpath(BASE_PATH . '/Google'),
    get_include_path(),
)));

require_once 'Client.php';

Give it a try.

A: Try this
require_once 'Client.php';
require_once 'Service/YouTube.php';

A: Try commenting set_include_path() function - as it worked for me
<?php
    // Call set_include_path() as needed to point to your client library.
    include_once 'includes/session_manager.php';
    require_once 'Google/Client.php';
    require_once 'Google/Service/YouTube.php';
?>