text:
Q: data is not fetched in this.state.data on GoogelChart.jsx Googlechart.jsx file :
import React, { Component } from 'react'
import ReactDOM from 'react-dom';
import { connect } from 'react-redux'
import { createHashHistory } from 'history';
import { Chart } from 'react-google-charts';
import CsvRead  from '../dynamic/CsvRead'

const customHistory = createHashHistory();

class GoogleChart extends Component {
    constructor(props) {
    super(props);

    this.state = {
      options: {
        title: 'Users Hours comparison',
        hAxis: { title: 'User'},
        vAxis: { title: 'Hours'},
        legend: 'none',
        axisTitlesPosition: 'out',
        'isStacked': true,
        colors: ['#0598d8', '#f97263'],
      },

      data :[]
    };
  }
  onDone(data){
     console.log(this.state.data);
     this.setState({data : data});
  }

  render() {
    console.log(this.state.data);
    return (
      <div><CsvRead handleFiles={this.onDone.bind(this)}  />
      <Chart
        chartType="ColumnChart"
        data = { this.state.data }
        options={this.state.options}
        graph_id="ColumnChart"
        width="100%"
        height="400px"
        legend_toggle
      />
      </div>
    );
  }
}

function select(state) {
    return {
        users: state.users
    }
}

export default connect(select)(GoogleChart);

ReadCsv.jsx file : This file is the ParentFile which returns the data.while (self.state.data) but it not parsed on GoogleChart.jsx
import React, { Component } from 'react'
import { connect } from 'react-redux'

import ReactFileReader from 'react-file-reader';
var data;
var result = [];

export default class CsvRead extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      data:[],
      homeLink: "manish"
    }

  }

  handleFiles = files => {
    var self = this;

    var reader = new FileReader();
    reader.onload = function(e) {

    var csv = reader.result;
    var lines = csv.split("\n");

    var headers=lines[0].split(",");
    for(var i=1;i<lines.length;i++){
      var obj = {};
      var currentline=lines[i].split(",");
      for(var j=0;j<headers.length;j++){
        obj[headers[j]] = currentline[j];
      }
      result.push(obj);
      }
      //return result; //JavaScript object
      result= JSON.stringify(result); //JSON
      self.setState({
            data: result
      });
      //console.log(self.state.data);
  }

  reader.readAsText(files[0]);
}
onDone(data){
  this.props.onDone(this.state.data);
}
  render() {

    return (
      <ReactFileReader handleFiles={this.handleFiles.bind(this)} fileTypes={'.csv'}>
        <button className='btn' >Upload</button>
      </ReactFileReader>
    );
  }
}

How to parse return data into GoogleChart.jsx?


text:
Q: Parse free account Class name limit? I'm new to Parse so please forgive me.  I setup a free Parse account for my iOS project I'm working on using Xcode7 and Swift 2.  Is there a limit to the number of Class Names you can create, in your free Parse account for a particular app?

A: The only limit its the storage, request, cloud jobs and data transfer as you can see here http://parse.com/pricing

redpajama_set_name: RedPajamaStackExchange


text:
Q: Unable to use callback to get response from ajax call I'm using the jQuery Validator plugin to try to check whether an email address getting entered into the form is unique after an ajax call which passes the email to a script which checks to see if the email is already in the database. I'm using a callback function to try to get the results of the ajax query but the function always returns undefined. I'm not sure what I'm doing wrong. Here is the code:
jQuery.validator.addMethod("unique", function () {
    function foo(callback) {
        $.ajax({
            type: 'POST',
            async: true,
            url: '/form_processor',
            data: 'action=email_validate&email=' + $("#email").val(),
            success: callback
        });
    }
    var return_value = foo(function (result) {

        if (result !== 'g') {
            return false;
        } else {
            return true;
        }
    });
    alert(return_value);
}, "Email address taken. Choose another.");

A: If you are using jquery validator, in built method is their to validate, So your validate code will like,
$(document).ready(function(){
   $( "#myform" ).validate({
      rules: {
        email: {
          required: true,
          email: true,
          remote: {
            url: "form_processor",
            type: "post",
            data: {
              email: function() {
                return $( "#email" ).val();
              }
            }
          }
        }
      },
    messages:
         {
         email:
             {
                required: "Please enter your email address.",
                remote: "Email already taken"
             }
         }
    });
})

In server side you have to return (print) true or false code will be (if you are using php)
<?php
$email =  $_POST['email'];
    $query = "SELECT ID FROM users WHERE user_email = "$email" LIMIT 1;";
    $results = $mysqli->query($query);
    if($results->num_rows == 0)
    {
        echo "true";  //good to register
    }
    else
    {
        echo "false"; //already registered
    }
}
else
{
    echo "false"; //invalid post var
}

?>


text:
Q: Display random content from object I saw in a project a function that promoted random values from different objects in JavaScript and display content inside HTML tag,I want to make something like that but different. When I a button to take random value
to a single object and display it inside a div.
I create some object in JS and a action when click a button display object but I don't know how to put all content inside a div and to take random information.

function deosebitProject() {
  var site_1 = {
    name: "Site 1",
    url: "https://www.google.ro/",
    description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
    site_image: ["https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg", "https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg", "https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg"]
  }

  var site_2 = {
    name: "Site 2",
    url: "https://www.google.ro/",
    description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
    site_image: ["https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg", "https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg", "https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg"]
  }

  document.write(
    '
',
    '
',
    '
',
    '
' + site_1.name + '
',
    '' + site_1.url + '',
    '
' + site_1.description + '
',
    '
',
    '
',
    '

 ',
    '
',
    '
',
    '
'
  );

  document.write(
    '
',
    '
',
    '
',
    '
' + site_2.name + '
',
    '' + site_2.url + '',
    '
' + site_2.description + '
',
    '
',
    '
',
    '

 ',
    '
',
    '
',
    '
'
  );
}
<!doctype html>

  <title>Javascript Challange 1</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce blandit, erat ac lobortis tristique, eros eros tristique enim, at imperdiet lectus orci fermentum ex. Suspendisse at nisl pretium, congue nunc sit amet, rutrum lectus. Integer eu luctus
      metus. Duis placerat finibus urna eu euismod. Vestibulum mollis viverra lacinia. Curabitur odio elit, venenatis eget congue sit amet, sagittis bibendum risus. Donec pretium id justo nec elementum. Duis interdum non ligula at imperdiet. Nunc ultricies
      ac arcu id aliquet. Ut vitae risus magna. Curabitur mollis placerat tortor, nec finibus mi elementum nec. Pellentesque vitae tortor elementum, porttitor magna sit amet, dapibus nisl. Nullam sed dolor id enim tempus porttitor. Curabitur eleifend
      condimentum nisl, id placerat purus semper sed. Nulla facilisi. Donec vehicula tempor nulla a tempor. Nulla quis rhoncus elit. Aenean sagittis auctor turpis vel pharetra. Donec est nunc, molestie sit amet ullamcorper sed, facilisis nec sapien. Mauris
      mauris quam, porta sed ante ut, egestas ultricies augue. Pellentesque ornare arcu ac vestibulum mattis. Sed nec malesuada turpis. Cras aliquam turpis nec justo tempus finibus. Morbi et luctus est.Curabitur eget malesuada neque. Lorem ipsum dolor
      sit amet, consectetur adipiscing elit. Maecenas sed sagittis arcu. Maecenas quis orci quis lorem luctus feugiat placerat in tellus.

    <button onclick="deosebitProject()">View Project</button>

A: I don't really understand whout should be random, so I started with a random project display in the container.

*

*Created an array of the project objects

*Created a function that creates the HTML to be appended to the DOM container

*Created a function that sets a random number from 0 to (project) array length, and appends the HTML to the DOM container

*Decoupled the event from the DOM by using HTML.addEventListener(), and placed the random function there (on click event)
Now, if you press the button, a random project is selected from the array, and it is displayed in the container

const arr = [{
    name: "Site 1",
    url: "https://www.google.ro/",
    description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
    site_image: ["https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg", "https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg", "https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg"]
  },
  {
    name: "Site 2",
    url: "https://www.google.ro/",
    description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
    site_image: ["https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg", "https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg", "https://adpconstruct.ro/wp-content/uploads/2019/07/poza52.jpg"]
  }
]

const projectHTML = (data) => {
  let html = ''
  html += '
'
  html += '
'
  html += '
'
  html += `<h2>${data.name}</h2>`
  html += `<a href="${data.url}">${data.url}</a>`
  html += `<p>${data.description}'</p>`
  html += '
'
  html += '
'
  data.site_image.forEach((e, i, a) => {
    html += `<img src="${data.site_image[i]}"`
    i === a.length - 1 ? html += '' : html += '
'
  })
  html += '
'
  html += '
'
  html += '
'

  return html
}

function deosebitProject(arr) {
  const r = Math.floor(Math.random() * arr.length);
  document.getElementById('content').innerHTML = projectHTML(arr[r])
}

const btn = document.getElementById('btn')
btn.addEventListener('click', function(e) {
  deosebitProject(arr)
})
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce blandit, erat ac lobortis tristique, eros eros tristique enim, at imperdiet lectus orci fermentum ex. Suspendisse at nisl pretium, congue nunc sit amet, rutrum lectus. Integer eu luctus
    metus. Duis placerat finibus urna eu euismod. Vestibulum mollis viverra lacinia. Curabitur odio elit, venenatis eget congue sit amet, sagittis bibendum risus. Donec pretium id justo nec elementum. Duis interdum non ligula at imperdiet. Nunc ultricies
    ac arcu id aliquet. Ut vitae risus magna. Curabitur mollis placerat tortor, nec finibus mi elementum nec. Pellentesque vitae tortor elementum, porttitor magna sit amet, dapibus nisl. Nullam sed dolor id enim tempus porttitor. Curabitur eleifend condimentum
    nisl, id placerat purus semper sed. Nulla facilisi. Donec vehicula tempor nulla a tempor. Nulla quis rhoncus elit. Aenean sagittis auctor turpis vel pharetra. Donec est nunc, molestie sit amet ullamcorper sed, facilisis nec sapien. Mauris mauris quam,
    porta sed ante ut, egestas ultricies augue. Pellentesque ornare arcu ac vestibulum mattis. Sed nec malesuada turpis. Cras aliquam turpis nec justo tempus finibus. Morbi et luctus est.Curabitur eget malesuada neque. Lorem ipsum dolor sit amet, consectetur
    adipiscing elit. Maecenas sed sagittis arcu. Maecenas quis orci quis lorem luctus feugiat placerat in tellus.

  <button id="btn">View Project</button>

EDIT
const projectHTML = (data) => {} is an arrow function (This is an arrow: =>). Most of the time arrow functions and traditional functions are interchangeable - most of the time!
The other difference is I used const instead of var. In this simple case this also makes no difference - const is a block-scoped variable, var is not.
data in my snippet is not a special object. I could have named it doggieDoo or anything (not reserved term, of course). this is a reserved keyword in JS.
So, basically they mean the same thing:
const projectHTML = (data) => {}
/*is the same as*/
var projectHTML = function(data) {}

I must emphasize though, that they do the same thing in this case!
You can read a lot more here:
Arrow functions vs traditional functions

*

*https://medium.com/the-non-traditional-developer/arrow-functions-vs-traditional-functions-in-javascript-8ff1a48ede12

*Are 'Arrow Functions' and 'Functions' equivalent / exchangeable?
Variable declarations:

*

*var: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var

*const: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const

*let: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let
this keyword:

*

*https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this
I think you'll get much more information by looking at the linked contents, than if I started explaining :)


text:
Q: How to stop increasing cache memory on every refresh when we are using service workers I'm trying to do some POC on service workers for my site. Assets are getting cached but on every refresh, the cache storage size keeps increasing. How do I stop it.
here is my service worker code.
importScripts('https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js');

workbox.routing.registerRoute(
  /\.(?:png|jpg|jpeg|svg|gif)$/,
  new workbox.strategies.StaleWhileRevalidate({
    cacheName: 'image-cache',
    plugins: [
      new workbox.expiration.Plugin({
        maxEntries: 1000,
        maxAgeSeconds: 365 * 24 * 60 * 60,
      })
    ],
  })
);

workbox.routing.registerRoute(
  /\.css$/,
  new workbox.strategies.StaleWhileRevalidate({
    cacheName: 'css-cache',
  })
);

workbox.routing.registerRoute(
  new RegExp('.*\.js'),
  new workbox.strategies.StaleWhileRevalidate({
      cacheName: 'js-cache',
      plugins: [
        new workbox.expiration.Plugin({
          maxEntries: 200,
          maxAgeSeconds: 365 * 24 * 60 * 60,
          purgeOnQuotaError: true
        })
      ],
    })
);

on the first refresh, the cache size is 149KB, and the second time 263KB. It is happening on chrome and in firefox sometimes it increases and sometimes decreases from the last value.


text:
Q: How to recognize selected view in onItemClick in Android I have a list view and each row of it has 3 buttons(Click able Image Views) making different actions if they are clicked.
I have a trouble with it because I don´t know how to recognize if the user click the button for delete or edit the element. I mean, How can I get the View that the user selected?
I tried with the parameters of onItemClick but I´m get stuck in there.
public void onItemClick(AdapterView<?> av, View v, int pos, long id)

Thanks.

A: I did like to work with LinearLayout and do something like this :
private void setElements() {
    for (Element elem : listElements) {
        View view = li.inflate(R.layout.item_3_object, null);//view represents a line from your list
        Button bt1 = (Button) view.findViewById(R.id.bt1);
        Button bt2 = (Button) view.findViewById(R.id.bt2);
        Button bt3 = (Button) view.findViewById(R.id.bt3);
        bt1.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                // your code
            }
        });
        // set listeners for the other buttons too
        listView.addView(view); //is the LinearLayout element to fill with lines
    }
}

A: Try adding tags to your buttons and in onClickListener call view.getTag().

A: private Button button;

button = (Button) findViewById(R.id.button1);
        button.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                        button1Action(); // do your action here
            }
        });

A: Since you want element from the ListView Row as Clickable you have define it Into your view Like this: i.e Your Adapter you are using to inflate your view
public View getView(int position, View convertView, ViewGroup parent)
    {
        ContentHolder chld=null;
        View row =  convertView;

        final int p=position;
        ContactModel rowItem = getItem(position);
        if(row==null)
        {
            chld=new ContentHolder();

            LayoutInflater inflate=(LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);

            row=inflate.inflate(textViewResourceId,null);

            chld.btn=(Button)row.findViewById(R.id.listViewButton_http);

            row.setTag(chld);

        }else{
            chld=(ContentHolder) row.getTag();
        }

        Button b1=(Button)row.findViewById(R.id.listViewButton_http);

        b1.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {

            }
        });

          //similary call your other Button here and it is DONE
    }

Hope this could help

A: The view-parameter is the one you want.
v.getId() delivers you the id of the clicked button.
For example, use:
if(v.getId() == R.id.buttonDelete) {
    //your code for delete button here
}


text:
Q: How to count the number of possible combinations list0 = ["A", "T", "C", "G"]
list1 = ["A", "T", "C", "G"]
list2 = ["A", "T", "C", "G"]
list3 = ["A", "T", "C", "G"]
for x in list0:
      for y in list1:
            for z in list2:
                  for i in list3:
                        print(x,y,z,i)

I have been trying to generate a list of combined nucleotide sequences possible from 4 possible nucleotides.
I would like to either enumerate my output to be able to determine the number of combinations possible or else generate a count.

A: You can use the formula for permutations with replacement:
num = 1
for lst in [list0, list1, list2, list3]:
    num *= len(lst)

print(num)
# 256

A: You could enumerate the output using a simple counter variable.
list0 = ["A", "T", "C", "G"]
list1 = ["A", "T", "C", "G"]
list2 = ["A", "T", "C", "G"]
list3 = ["A", "T", "C", "G"]
count = 1
for x in list0:
      for y in list1:
            for z in list2:
                  for i in list3:
                        print(count,x,y,z,i)
                        count += 1


text:
Q: Compare two columns and get the values from another column? I have an excel table with multiple columns, I need to add value for every transaction_id, how can i compare column C with column J and enter values from K into D column?
Table looks like this:

C
D
J
K

transaction_id
amount
transaction_id
amount

1

5
1000

2

1
1000

5

118
200

118

117
500

I need to match the exact transaction_id and move from the right to left amount value if transaction id is the same, how can I do that?

A: Just use VLOOKUP:

Formula in D is:
=VLOOKUP(C2,$J$2:$K$5,2,FALSE)


text:
Q: How to find the These numbers? Suppose  $n \in  N$.
$n$  can be described as the sum of square of three number's.
That is $ n = a^2 + b^2 + c^2$ .
My Question is: How to find $a, b, c$?

A: Presumably by "number" you mean nonnegative integer.
A number is the sum of two squares iff its prime factorization does not include an odd power of a prime congruent to $3 \mod 4$.
Given a number $x$ that is the sum of three squares, you can start by looking at $x-1^2, x - 2^2, \ldots$ until you find one that is the sum of two squares.
Now you just have to find those two squares...


text:
Q: Circuit for 12V relay with an optocoupler using 3V3 GPIO I am trying to design a circuit to control a G6S-2 12V relay that powers on/off a 12V device using a GPIO from an ESP32-WROVER and one PC817 optocoupler.
This is the circuit that I have come up after checking many others:

I have seen multiple circuits using, for example, a BJT but I am not sure how to calculate the resistances and which BJT to choose. Would the BC860 be a good option, given that the relay needs 11,7mA ?
As far as I can tell, an ESP32 GPIO could supply around 12mA through its 3V3 GPIO and checking that the optocoupler has an input forward voltage of 1.2V, the R1 could be 220 to provide a safe 10mA to activate the optocoupler output.
At this point I am not sure how to calculate:

*

*R2 and R3 (If this is a good circuit.)

*R4 I am not sure if it is necessary since the G6S-2 has 1.028Ohm for the 12V version.

*Q1 - Is the BC860 a good candidate or should I use another?

I have also come up with this other version, where the optocoupler is activated using a low GPIO signal:

Which one of those 2 solutions would be the best to use? Are they correct?

A: Given that you have the microprocessor ground tied to the relay circuit ground, you don't need an optocoupler at all.

*

*Throw out U1, R2, and R3.

*Connect the free end of R1 to the base of Q1.

*Change the value of R1 to 1k.

*Use an NPN transistor for Q1.

*Replace R4 with a wire.

Resulting circuit:

simulate this circuit – Schematic created using CircuitLab


text:
Q: Erro ao carregar partial view (aspnet core com Dapper) sou inciante com o uso de AspNet Core 3.0 com Dapper e estou com dificuldades para carregar uma partial view na view principal.
Quero carregar os contatos dos cliente numa lista: Cliente (view) e Contatos (partial view)
Model Clientes:
public class Cliente
{
   [Key]
   public int CodCli { get; set; }
   public string Nome { get; set; }
   public string Fantasia { get; set; }
   public string CNPJ { get; set; }

  public IEnumerable<ClienteContato> Contatos { get; set; }

}

Model Contatos:
    public class ClienteContato
    {
        public int FkCodCli { get; set; }
        public string Fantasia { get; set; }
        public string Cargo { get; set; }
        public string Nome { get; set; }
   }

Controller:
public IActionResult Details(int CliId)
        {

            using (IDbConnection db = new SqlConnection(_config.GetConnectionString("DefaultConnection")))
            {
                var query = @"SELECT * from VIE_Clientes  WHERE CodCli = @CliId;
                       SELECT * FROM VIE_ClientesContatos WHERE FkCodCli = @CliId";

                var results = db.QueryMultiple(query, new { @CliId = CliId });

                var clientes = results.ReadSingle<Cliente>();

                if (clientes != null)
                    clientes.Contatos = results.Read<ClienteContato>().ToList();

                return View(clientes);

            }
        }

View Details:
@model SIGApp.Entities.Cliente

    @{
        ViewData["Title"] = "Details";
    }

Details

Cliente

                @Html.DisplayNameFor(model => model.CodCli)

                @Html.DisplayFor(model => model.CodCli)

                @Html.DisplayNameFor(model => model.Nome)

                @Html.DisplayFor(model => model.Nome)

                @Html.DisplayNameFor(model => model.Fantasia)

                @Html.DisplayFor(model => model.Fantasia)

        Back to List

    <partial name="_teste"/>

Partial View _teste
@model IEnumerable<SIGApp.Entities.ClienteContato>

    Create New

                @Html.DisplayNameFor(model => model.FkCodCli)

                @Html.DisplayNameFor(model => model.Fantasia)

                @Html.DisplayNameFor(model => model.Cargo)

                @Html.DisplayNameFor(model => model.Nome)

@foreach (var item in Model) {

                @Html.DisplayFor(modelItem => item.FkCodCli)

                @Html.DisplayFor(modelItem => item.Fantasia)

                @Html.DisplayFor(modelItem => item.Cargo)

                @Html.DisplayFor(modelItem => item.Nome)

}

Ao executar o projeto recebo o seguinte erro:
InvalidOperationException: The model item passed into the ViewDataDictionary is of type
'SIGApp.Entities.Cliente', but this ViewDataDictionary instance requires a model item of type
'System.Collections.Generic.IEnumerable`1[SIGApp.Entities.ClienteContato]'.
Agradeço antecipadamente qualquer ajuda.
Muito Obrigado,
Marcelo

A: já descobri o que era!!!
Na Model Cliente alterei para:
 public List<ClienteContato> Contatos { get; set; }

Na View faltou o parâmetro para popular a lista:
<partial name="_Teste" for="Contatos">

E na View principal:
@model List<SIGApp.Entities.ClienteContato>

@item.Fantasia

É isso!!


text:
Q: Bash merging files (csv, tsv, txt :fixed-width) problem Goal : create a single csv file named "consolidate_data" by combining data from

*

*csv_data.csv : columns 1 to 4 from "vehicle-data.csv"

1,Thu Aug 19 21:54:38 2021,125094,car,2,VC965

2,Sat Jul 31 04:09:44 2021,174434,car,2,VC965

3,Sat Aug 14 17:19:04 2021,8538286,car,2,VC965

*

*tsv_data.csv : columns 5 to 7 from "tollplaza-data.tsv"

1       Thu Aug 19 21:54:38 2021        125094  car     2       4856    PC7C042B7

2       Sat Jul 31 04:09:44 2021        174434  car     2       4154    PC2C2EF9E

3       Sat Aug 14 17:19:04 2021        8538286 car     2       4070    PCEECA8B2

*

*fixed_width_data.csv : the two last columns from "payment-data.txt"

 1 Thu Aug 19 21:54:38 2021 125094     4856 PC7C042B7 PTE VC965
 2 Sat Jul 31 04:09:44 2021 174434     4154 PC2C2EF9E PTP VC965
 3 Sat Aug 14 17:19:04 2021 8538286    4070 PCEECA8B2 PTE VC965

What I tried so far:
cut -d"," -f1-4 vehicle-data.csv > csv_data.csv
tr "\\t" "," < tollplaza-data.tsv | cut -d',' -f5-7  > tsv_data.csv
cut -c59-68 payment-data.txt | tr " " "," > fixed_width_data.csv
paste -d',' csv_data.csv tsv_data.csv fixed_width_data.csv > consolidate_data.csv

the order of files in the paste fulfil the order of columns wanted in "consolidate_data" file
The Problem (see picture) is that i got new lines for the last two columns in "consolidate_data", I suspect the existence of the "newline" character in the tsv file but I cant see it.
#The_result_I_got :
1,Thu Aug 19 21:54:38 2021,125094,car,2,4856,PC7C042B7
,PTE,VC965
2,Sat Jul 31 04:09:44 2021,174434,car,2,4154,PC2C2EF9E
,PTP,VC965
3,Sat Aug 14 17:19:04 2021,8538286,car,2,4070,PCEECA8B2
,PTE,VC965
4,Mon Aug  2 18:23:45 2021,5521221,car,2,4095,PC3E1512A
,PTP,VC965
5,Thu Jul 29 22:44:20 2021,3267767,car,2,4135,PCC943ECD
,PTE,VC965
6,Sat Aug 14 03:57:47 2021,8411850,car,2,4680,PCC422F4D
,PTE,VC965
.
.
.
10000,Mon Aug  9 22:56:50 2021,4833266,car,2,4260,PC1A4796C,PTE,VC965

-->I noticed that last line was in the wanted format
#The_result_wanted:
1,Thu Aug 19 21:54:38 2021,125094,car,2,4856,PC7C042B7,PTE,VC965
2,Sat Jul 31 04:09:44 2021,174434,car,2,4154,PC2C2EF9E,PTP,VC965
3,Sat Aug 14 17:19:04 2021,8538286,car,2,4070,PCEECA8B2,PTE,VC965
4,Mon Aug  2 18:23:45 2021,5521221,car,2,4095,PC3E1512A,PTP,VC965
5,Thu Jul 29 22:44:20 2021,3267767,car,2,4135,PCC943ECD,PTE,VC965
6,Sat Aug 14 03:57:47 2021,8411850,car,2,4680,PCC422F4D,PTE,VC965
7,Thu Aug 12 03:41:22 2021,6064250,car,2,4702,PCDBC3AC9,PTE,VC965
8,Sun Aug 22 10:29:58 2021,6871937,van,2,4592,PC627AA14,PTE,VCD2F
9,Fri Aug  6 14:23:08 2021,2055930,car,2,4100,PCC6DD8D5,PTP,VC965

You can find data in this enter link description here
Thanks a lot ;)


text:
Q: wpf data grid - moving from one cell to another cell how to capture event when moving from one cell to another in same row.

A: You get the CurrentCellChanged event:

[...] when the value of the CurrentCell property has changed.

You'd have to check you were still on the same row, but it should do what you want.


text:
Q: Target certain CSS Classes with Gridster Plugin I'm using the Gridster plugin, where columns width are defined like this:
[data-sizex="12"] { width: ... }
[data-sizex="11"] { width: ... }
[data-sizex="10"] { width: ... }
....

I have 2 questions about this;

*

*What kind of CSS classes are these? I have never done/seen anything like this, especially in CSS.

*If I want to select all the columns from 1-12, how do I use the code? Typically I'm using something like [class*=".."] this. I don't think so I can get a format like this for the above scenario.

A: 1) These are CSS attribute selectors, to be specific these are Attribute presence and value selectors
2) If you want to select all the columns you don't have to use attribute selectors, just apply the CSS to the element. Well, for gridster plugin can replace .grid with .gs_w {  }, .gs_w[data-sizex="12"]{ } and so on in the demo jsfiddle.
.grid{
    /* Applies to all */
    background: #808080;
    color: #fff;
    border: 1px solid #eee;
    padding: 5px 10px;
}

.grid[data-sizex="12"]{
    width: 720px;
}
.grid[data-sizex="11"]{
    width: 710px;
}
.grid[data-sizex="10"]{
    width: 700px;
}
.grid[data-sizex="9"]{
    width: 690px;
}
.grid[data-sizex="8"]{
    width: 680px;
}
.grid[data-sizex="7"]{
    width: 670px;
}
.grid[data-sizex="6"]{
    width: 660px;
}
.grid[data-sizex="5"]{
    width: 650px;
}
.grid[data-sizex="4"]{
    width: 640px;
}
.grid[data-sizex="3"]{
    width: 630px;
}
.grid[data-sizex="2"]{
    width: 620px;
}
.grid[data-sizex="1"]{
    width: 610px;
}

Demo Here


text:
Q: Information provided by a bounded series to the underlying sequence If a sequence is bounded it does not say anything about the terms of the sequence i.e. convergence of the sequence. But if a series $\sum_{n=1}^{\infty}a_n$ is bounded then it gives information on the terms of the sequence i.e. convergence of the sequence $\{a_n\}$. But it can't say whether it will converge or diverge. Is it correct

A: If a series converges, then the terms in the series must converge to zero. If a series is bounded, then the terms of the series are bounded but the terms of the series may or may not converge. An easy example is the series $1 -1 + 1 -1 + 1 -1 \cdots$.


text:
Q: What is the good way to break from promise chain? I am wondering how can I properly break promise chain in JS.
In this code, I am connecting to database at first, then I am checking if collection already has some data, if not add them. Don't pay attention to some actionhero.js code..it does not matter here.
The main question is: Is it okay to break chain using throw null?
mongoose.connect(api.config.mongo.connectionURL, {})
        .then(() => {
            return api.mongo.City.count();
        })
        .then(count => {
            if (count !== 0) {
                console.log(`Amout of cities is ${count}`);
                throw null; // break from chain method. Is it okay ?
            }
            return api.mongo.City.addCities(api.config.mongo.dataPath + '/cities.json');
        })
        .then(cities => {
            console.log("Cities has been added");
            console.log(cities);
            next();
        })
        .catch(err => {
            next(err);
        })

Many thanks!

A: Despite it may seem like a clever trick and will work as You expect, I would advise against throwing non-error objects.
It would be much more predictable for other developers that will maintain this code if You throw an actual Error and handle it explicitly.
Promise
  .resolve()
  .then(() => {
    throw new Error('Already in database');
  })
  .catch(err => {
    if (err.message === 'Already in database') {
      // do nothing
    } else {
      next(err);
    }
  });


text:
Q: PHP problem with query result i have a problem with a query in a php file.
I have a query that retrieves an e-mail address, it works about right, but when it sends the email, the address is added twice.
SELECT email FROM jos_users WHERE id=$i
$i is a number that auto increments.
i have a for to check each user id to see if a email should be sent.
Any ideas?
thanks,
Sebastian

A: If your list of ids is not too long, you could use something like this:
SELECT DISTINCT email FROM jos_users WHERE id IN (5, 18, 24, ...);

If you get a packet too long error, you can either increase the packet size, use a temporary table or keep track of the emails in your PHP application. Here is an example using temporary tables:
CREATE TEMPORARY TABLE tmp (id INT);
/* insert first 50 values (or 100, or 1000, whichever fits into your packet size)*/
INSERT INTO tmp (id) VALUES (5), (18), (24) ...;
/* insert next 50 values */
INSERT INTO tmp (id) VALUES (105), (118), (124) ...;
/* more inserts until you have a temporary table containing all ids */
INSERT INTO tmp ...
INSERT INTO tmp ...
/* select */
SELECT DISTINCT email FROM jos_users INNER JOIN tmp USING (id);


text:
Q: Cakephp Helper fire Error on certain view I got something strange with my helper.
First of all, i just started to work with cakePHP, and MVC.
Maybe i do somethings wrong but can't find what.
For my app, i have to use an Xml file to handle language for my texte (i know there are many differents way to handle language, but i need to use this one).
So i create an Helper (XmlHelper.php, in View\Helper\Xmlhelper.php)
<?php
App::uses('AppHelper', 'View/Helper','Xml');

class XmlHelper extends AppHelper {
    var $xml = array();
    var $name = 'Xml';
    var $filename = '';

    public function getXml($filename, $language, $view) {
         $this->xml = Xml::toArray(Xml::build('Xml/'.$filename.'.xml')); //THE LINE
         $this->xml = $this->xml[$filename][$language][$view];
         $this->filename = $filename;
    }

    public function readXml($tags) {
        $tempXml =  $this->xml;
        foreach ($tags as $tag){
            $tempXml =  $tempXml[$tag];
        }
        return  $tempXml;
    }
}

From my controller i got :
class EventsController extends Controller {
public $helpers = array('Html', 'Form','Xml');
    public $components = array('Session');

And for most of my view everything work fine, but some other just fire
Error: Class 'Xml' not found File:
C:\wamp\www\cakephp\app\View\Helper\Xmlhelper.php Line: 11

In my view i call :
<?php $this->Xml->getXml('dico',$ln,'thanks'); ?>

<?php echo $this->Xml->readXml(array('texte'));?>

The ln is well defined.
If someone can explain me what is wrong, it will be very apreciated!

A: The problem is the XML class you're using inside your XmlHelper.
Basically, you're using App:uses(); wrong, it can only be used to include one class at a time, so you need to add another line:
App::uses('AppHelper', 'View/Helper');
App::uses('Xml', 'Path/To/Xml.php');

I can't really help you with the Path/To/Xml.php bit as I don't know where you've saved it. Should really be in the Vendors folders if it's an external library. See here for more info.


text: Q: How to support for Windows SBS 2011 OS in InstallShield installer? I have an MSI installer built in InstallShield 2015. I want to support my MSI installer for OS Windows SBS 2011. But there is no provision of this OS condition in InstallShield 2015. How to add support of this OS in MSI installer in IS 2015 ?


text:
Q: how to insert multiple line textarea value in mysql table I have a textarea and I want to insert values of that textarea to a mysql table. But I want to insert each line to each field. Like the textarea has 3 lines...each line should be inserted in 3 each field in the table. Can anyone please help me with this.
Regards,

A: Explode the value of the textarea (see PHP manual for the syntax of explode). You will end up with a string array with 3 items. Now you can process each of these items individually.
Do you really mean columns (fields) and not rows? If someone enters 100 lines in the textarea you would neet 100 columns. This is considered to be bad data design.


text:
Q: python scrapy extract data from website I want to scrape data from this page. Here is my current code:
buf = cStringIO.StringIO()
c = pycurl.Curl()
c.setopt(c.URL, "http://www.guardalo.org/99407/")
c.setopt(c.VERBOSE, 0)
c.setopt(c.WRITEFUNCTION, buf.write)
c.setopt(c.CONNECTTIMEOUT, 15)
c.setopt(c.TIMEOUT, 15)
c.setopt(c.SSL_VERIFYPEER, 0)
c.setopt(c.SSL_VERIFYHOST, 0)
c.setopt(c.USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0')
c.perform()
body = buf.getvalue()
c.close()

response = HtmlResponse(url='http://www.guardalo.org/99407/', body=body)
print Selector(response=response).xpath('//edindex/text()').extract()

It works, but I need title, video link and description as separate variables. How can I achieve this?

A: Title can be extracted using //title/text(), video source link via //video/source/@src:
selector = Selector(response=response)

title = selector.xpath('//title/text()').extract()[0]
description = selector.xpath('//edindex/text()').extract()
video_sources = selector.xpath('//video/source/@src').extract()[0]

code_url = selector.xpath('//meta[@name="EdImage"]/@content').extract()[0]
code = re.search(r'(\w+)-play-small.jpg$', code_url).group(1)

print title
print description
print video_sources
print code

Prints:
Best Babies Laughing Video Compilation 2012 [HD] - Guardalo
[u'Best Babies Laughing Video Compilation 2012 [HD]', u"Ciao a tutti amici di guardalo,quello che propongo oggi \xe8 un video sui neonati buffi con risate travolgenti, facce molto buffe,iniziamo con una coppia di gemellini che se la ridono fra loro,per passare subito con una biondina che si squaqqera dalle risate al suono dello strappo della carta ed \xe8 solo l'inizio.", u'\r\nBuone risate a tutti', u'Elia ride', u'Funny Triplet Babies Laughing Compilation 2014 [NEW HD]', u'Real Talent Little girl Singing Listen by Beyonce .', u'Bimbo Napoletano alle Prese con il Distributore di Benzina', u'Telecamera nascosta al figlio guardate che fa,video bambini divertenti,video bambini divertentissimi']
http://static.guardalo.org/video_image/pre-roll-guardalo.mp4
L49VXZwfup8

A: No need for scrapy for a single-URL fetch -- just get that single page's HTML with a simpler tool (even simplest urllib.urlopen(theurl).read()!) then analyze the HTML e.g with BeautifulSoup.  From a simple "view source" it looks like you're looking for:
<title>Best Babies Laughing Video Compilation 2012 [HD] - Guardalo</title>

(the title), one of the three:
<source src="http://static.guardalo.org/video_image/pre-roll-guardalo.mp4" type='video/mp4'>
<source src="http://static.guardalo.org/video_image/pre-roll-guardalo.webm" type='video/webm'>
<source src="http://static.guardalo.org/video_image/pre-roll-guardalo.ogv" type='video/ogg'>

(the video linkS, plural, and I can't pick one because you don't tell us which format[s] you prefer!-), and
<meta name="description" content="Ciao a tutti amici di guardalo,quello che propongo oggi è un video sui neonati buffi con risate" />

(the description).  BeautifulSoup makes it pretty trivial to get each one, e.g after the needed imports
html = urllib.urlopen('http://www.guardalo.org/99407/').read()
soup = BeautifulSoup(html)
title = soup.find('title').text

etc etc (but you'll have to pick one video link -- and I see in their sources they're mentioned as "pre-rolls" so it may be that the links to actual non-ads videos are in fact not on the page but only accessible after a log-in or whatever).


text:
Q: CSV Resultset for IN clause I am working on writing a SQL query to get data from 2 tables with inner join and need some help. Here is the scenario. I have 2 tables say A and B.
table A

Name
Value

1
Red

2
Green

3
Blue

4
Yellow

5
White

Table B

Name
Value

Shirt
1,3

Shoe
1,2,4

Sock
4,5

Now, I am trying to write a query to join these 2 tables so that when I want to get data for shirt, I would retrieve Red and Blue.
I have tried the below but it is not taking the values to be list for the IN Clause.
Test-1
SELECT Value FROM A WHERE Name IN

(
SELECT Value FROM B WHERE Name = 'Shirt'
)

Test-2
SELECT Value FROM A INNER JOIN B ON
A.Name IN B.Value
WHERE B.Name = 'Shirt'

Test-3
SELECT Value FROM A WHERE Name IN

(
SELECT CAST(Value AS VARCHAR(50)) FROM B WHERE Name = 'Shirt'
)

We are using DB2 v9.5 database and will be making an ODBC connection from our application to retrieve data.
Any suggestion would be greatly appreciated


text:
Q: Kernel/image of map between units of ring I'm somewhat confused by the following question:

Suppose $p$ is an odd prime. Show that the map $\phi : \mathbb{F}_p^* \rightarrow \mathbb{F}_p^*$ (where $\mathbb{F}_p$ is $\mathbb{Z}/p\mathbb{Z}$, and $\mathbb{F}_p^*$ denotes the set of units of  $\mathbb{F}_p$) given by $x \mapsto x^{(p-1)/2}$ has kernel of size at most $(p-1)/2$, and hence has image $\{\pm1\}$. Deduce that if $p \equiv 1 \ \text{mod} \ 4$ then $-1$ is a square modulo $p$

Firstly, it's obvious that $\mathbb{F}_p^* = \mathbb{F}_p \backslash \{0\}$ because $p$ is prime. But I'm confused how the kernel comes into this mapping because the set of units doesn't include the $0$ element - although I'm sure I'm just being dense here.
Thanks for any help

A: One way is to note that $\ker(\phi)$ is precisely the solutions to the polynomial $X^{(p-1)/2}-1\in\mathbb{F}_p[X]$, which has at most $(p-1)/2$ solutions as a polynomial of degree $(p-1)/2$ over a field. To see that there are at least $(p-1)/2$ solutions, in order to conclude $\mathrm{im}(\phi)=\{\pm 1\}$, you can use the fact that $\mathbb{F}_p^\ast$ is cyclic, and then consider the even powers of the generator.
Then from the isomorphism theorems,
$$
\mathbb{F}_p^\ast/\ker(\phi)\simeq\operatorname{im}(\phi)
$$
so that
$$
|\operatorname{im}(\phi)|=|\mathbb{F}_p^\ast/\ker(\phi)|=(p-1)/((p-1)/2))=2.
$$
But the only subgroup of order $2$ in $\mathbb{F}_p^\ast$ is necessarily $\{\pm 1\}$, as it must contain $1$ and an element of order $2$. But $-1$ is the unique element of order $2$. To see this, note any element of order $2$ is a root of $X^2-1=(X-1)(X+1)\in\mathbb{F}_p[X]$, and $\mathbb{F}_p[X]$ is an integral domain...


text:
Q: Simple test with selenium HTMLUnitDriver do not work fine, is it wrong? I am a beginner with selenium, I am doing a test but I do not understand why it does not work.
Here are my code and the following error.
 import org.openqa.selenium.*;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.htmlunit.HtmlUnitDriver;
 public class PruebaHTMLUnit {
    public static void main(String[] args) {

WebDriver driver = new HtmlUnitDriver();
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Guru99");
element.submit();
System.out.println("Page title is: " + driver.getTitle());

driver.quit();
}
}

And the error:

Build info: version: '3.5.2', revision: '10229a9', time: '2017-08-21T17:29:55.15Z'
System info: host: 'MVILLEGAS764', ip: '169.254.106.219', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version:

'1.8.0_144'
      Driver info: driver.version: HtmlUnitDriver
        at org.openqa.selenium.htmlunit.HtmlUnitDriver.findElementByName(HtmlUnitDriver.java:1293)
        at org.openqa.selenium.By$ByName.findElement(By.java:303)
        at org.openqa.selenium.htmlunit.HtmlUnitDriver$4.call(HtmlUnitDriver.java:1970)
        at org.openqa.selenium.htmlunit.HtmlUnitDriver$4.call(HtmlUnitDriver.java:1)
        at org.openqa.selenium.htmlunit.HtmlUnitDriver.implicitlyWaitFor(HtmlUnitDriver.java:1606)
        at org.openqa.selenium.htmlunit.HtmlUnitDriver.findElement(HtmlUnitDriver.java:1966)
        at org.openqa.selenium.htmlunit.HtmlUnitDriver.findElement(HtmlUnitDriver.java:754)
        at com.villegas.pruebas.PruebasRegresion.PruebaHTMLUnit.main(PruebaHTMLUnit.java:20)

A: import org.openqa.selenium.*;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.htmlunit.HtmlUnitDriver;

    public class test_Stackoverflow
    {
            public static void main(String[] args) {
                       WebDriver driver = new HtmlUnitDriver();
                driver.get("https://www.google.com");
                WebElement element = driver.findElement(By.xpath(".//*[@id='gs_htif0']"));
                element.sendKeys("Guru99");
                element.submit();
                System.out.println("Page title is: " + driver.getTitle());
                driver.quit();
            }
    }

HtmlUnitDriver was a part of Selenium version 2.53. If you are using Selenium 2.52 or earlier you don't need to download and install HtmlUnitDriver, it is already there.
But still you want to use it download it from here
https://github.com/SeleniumHQ/htmlunit-driver/releases
From 2.53 version, you need to add it separately
See this image
Try this:
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-htmlunit-driver -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-htmlunit-driver</artifactId>
    <version>2.52.0</version>
</dependency>

A: Please try this one hope it will works
 import org.openqa.selenium.*;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.htmlunit.HtmlUnitDriver;
    /**
     * Created by W3E64 on 9/15/2017.
     */
    public class testing_solution
    {
public static void main(String[] args) {
                java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.OFF);
                java.util.logging.Logger.getLogger("org.apache.http").setLevel(java.util.logging.Level.OFF);
 HtmlUnitDriver unitDriver = new HtmlUnitDriver();

 unitDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
 unitDriver.get("http://google.com");
 System.out.println("Title of the page is -> " + unitDriver.getTitle());

 WebElement searchBox = unitDriver.findElement(By.name("q"))
 searchBox.sendKeys("Selenium");
 WebElement button = unitDriver.findElement(By.name("btnG"));
 button.click();
 System.out.println("Title of the page is -> " + unitDriver.getTitle());
            }
    }

A: Instead of using submit() method use either a click on the google search button or input an Enter key in the search box. I have tried running the code above and it worked fine. I am using Selenium 3.141.59 with HtmlUnitDriver 2.36.0. The behaviour of HtmlUnitDriver varies with versions. The second method is a lot simpler and I personally prefer that:
element.sendKeys(Keys.ENTER);

Write this instead of submit and it will work fine.


text:
Q: SonarQube does not start in Linux (localhost) I am trying to install and configure sonarqube to use it in small poroyect in my machine (Ubuntu 18.04.2 LTS)  y have already download the zip Sonarqube 7.7 community edition from the oficial web and unzipped in /opt/. I tryed to do as is say in the guide from sonar and execute ./sonar.sh console  in the path /opt/sonarqube/bin/linux-x86-64 and I get problems with the log permisions .
Running SonarQube...
wrapper  | ERROR: Could not write pid file /opt/sonarqube/bin/linux-x86-64/./SonarQube.pid: Permission denied
Unable to open logfile ../../logs/sonar.log: Permission denied

So I try the same as superuser and I get
Running SonarQube...
wrapper  | --> Wrapper Started as Console
wrapper  | Launching a JVM...
jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    |
jvm 1    | 2019.04.05 19:55:48 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
jvm 1    | 2019.04.05 19:55:48 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
jvm 1    | 2019.04.05 19:55:48 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
jvm 1    | 2019.04.05 19:55:48 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
jvm 1    | 2019.04.05 19:55:48 INFO  app[][o.e.p.PluginsService] no modules loaded
jvm 1    | 2019.04.05 19:55:48 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
jvm 1    | OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
jvm 1    | 2019.04.05 19:55:51 WARN  app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 1
jvm 1    | 2019.04.05 19:55:51 INFO  app[][o.s.a.SchedulerImpl] Process [es] is stopped
jvm 1    | 2019.04.05 19:55:51 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
jvm 1    | 2019.04.05 19:55:51 INFO  app[][o.e.c.t.TransportClientNodesService] failed to get node info for {#transport#-1}{pr4ED0vsRgCYZjgn1jbLlQ}{127.0.0.1}{127.0.0.1:9001}, disconnecting...
jvm 1    | java.lang.IllegalStateException: Future got interrupted
jvm 1    |  at org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:60)
jvm 1    |  at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:34)
jvm 1    |  at org.elasticsearch.transport.ConnectionManager.internalOpenConnection(ConnectionManager.java:226)
jvm 1    |  at org.elasticsearch.transport.ConnectionManager.openConnection(ConnectionManager.java:85)
jvm 1    |  at org.elasticsearch.transport.TransportService.openConnection(TransportService.java:367)
jvm 1    |  at org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler.doSample(TransportClientNodesService.java:410)
jvm 1    |  at org.elasticsearch.client.transport.TransportClientNodesService$NodeSampler.sample(TransportClientNodesService.java:361)
jvm 1    |  at org.elasticsearch.client.transport.TransportClientNodesService.addTransportAddresses(TransportClientNodesService.java:202)
jvm 1    |  at org.elasticsearch.client.transport.TransportClient.addTransportAddress(TransportClient.java:342)
jvm 1    |  at org.sonar.application.es.EsConnectorImpl$MinimalTransportClient.<init>(EsConnectorImpl.java:108)
jvm 1    |  at org.sonar.application.es.EsConnectorImpl.buildTransportClient(EsConnectorImpl.java:89)
jvm 1    |  at org.sonar.application.es.EsConnectorImpl.getTransportClient(EsConnectorImpl.java:74)
jvm 1    |  at org.sonar.application.es.EsConnectorImpl.getClusterHealthStatus(EsConnectorImpl.java:61)
jvm 1    |  at org.sonar.application.process.EsProcessMonitor.checkStatus(EsProcessMonitor.java:90)
jvm 1    |  at org.sonar.application.process.EsProcessMonitor.checkOperational(EsProcessMonitor.java:75)
jvm 1    |  at org.sonar.application.process.EsProcessMonitor.isOperational(EsProcessMonitor.java:60)
jvm 1    |  at org.sonar.application.process.SQProcess.refreshState(SQProcess.java:161)
jvm 1    |  at org.sonar.application.process.SQProcess$EventWatcher.run(SQProcess.java:220)
jvm 1    | Caused by: java.lang.InterruptedException: null
jvm 1    |  at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1038)
jvm 1    |  at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1343)
jvm 1    |  at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:251)
jvm 1    |  at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:94)
jvm 1    |  at org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:57)
jvm 1    |  ... 17 common frames omitted
wrapper  | <-- Wrapper Stopped

I do not understand the error I get and why it does not start the sonarqube.

A: Don't try to use superuser. Just change the access rights on the complete SonarQube folder for the user you use.


text:
Q: Making interactive Angular google chart directive for integrating bubble chart Hi I am trying to make interactive google chart(bubble chart) using angular-google-chart directive version 0.1.0.
The Chart rendering is working smoothly until I want to trigger an external event on click of any bubble in chart.
My Html

JS
 $scope.handleSelect=function(selection){
                console.log(selection);
            };

            $scope.chartObject = {};
            $scope.chartObject.type = "BubbleChart";
            $scope.chartObject.displayed = true;
            $scope.chartObject.data = {
                                    "cols": [{
                                        "id": "xx",
                                        "label": "xx",
                                        "type": "xx",
                                        "p": {}
                                    }, {
                                        "id": "xx",
                                        "label": "xx",
                                        "type": "number",
                                        "p": {}
                                    }, {
                                        "id": "xx",
                                        "label": "xxx",
                                        "type": "number",
                                        "p": {}
                                    }, {
                                        "id": "",
                                        "label": "",
                                        "type": "number",
                                        "p": {}
                                    }],
                                    "rows": $scope.data
                                };
                $scope.chartObject.options = {
                                            "chartArea": {
                                                top: 10,
                                                bottom: 0,
                                                width: '82%',
                                                height: '85%'
                                            },
                                            "isStacked": "false",
                                            "height": 280,
                                            "fill": 1,
                                            "displayExactValues": true,
                                            "colorAxis": {
                                                minValue: 0,
                                                colors: ['#ff0000', '#ff5300', '#ff8900', '#ffb800', '#ffd600', '#ffe800', '#beee07', '#8edc0c', '#58ce34', '#22ac19']
                                            },
                                            "vAxis": {
                                                "title": "Support Level",
                                                "minValue": 0,
                                                "maxValue": $scope.yaxis_value,
                                                "viewWindowMode": "pretty",
                                                "gridlines": {
                                                    "count": 5
                                                },
                                                "gridlines.color": "#D3D3D3"
                                            },

                                            "hAxis": {
                                                "title": "No. Of Incident",
                                                "maxValue": $scope.xaxis_value,
                                                "gridlines": {
                                                    "count": 4
                                                },
                                                "gridlines.color": "#D3D3D3"
                                            },
                                        };
                $scope.chartObject.formatters = {};
            });

My Problem is when I am clicking any bubble chart how to get the exact row value or value that I am passing through chart.
Reference Link I have used:
    http://embed.plnkr.co/lOXTg5XRggwdctUedvfl/preview
But it is still not giving me correct value especially on consecutive clicking of bubble.
Any help is appreciated

A: I haven't found any evidence that  ng-google-chart.js library contains any issues with selection implementation.
The following example demonstrates how to get the selected value:
  $scope.seriesSelected = function (selectedItem) {

      var chartData = $scope.myChart.data;
      var value = chartData.rows[selectedItem.row].c[selectedItem.column].v; //value
      var formattedValue = chartData.rows[selectedItem.row].c[selectedItem.column].f; //formatted value
      console.log(value + ":" + formattedValue);
  };

Demo (Codepen)
From another hand, i have to mention that you are using not the latest version of angular-google-chart library.
Since  there are some changes have been made, the following example demonstrates how to bind select event in the latest version:

Demo (Codepen)

A: There are some differences in the definition of the div from the example link and the question...
From the link...

From the question (without the style attr)...

Why the custom-select? Try defining like this?


text:
Q: printing A3 in inkscape I'm trying to print a A3 inkscape project with a Brother MFC-J6920DW.
The document size and orientation are set to A3 (297X420) landscape
but when printing it comes out as a A4 containing only a part of the document.
i tried to set the printer property's size and orientation but they are greyed (orientation ) out or do not exist ( papersize )
can someone help please

A: What about File->Print->Preferences->Printing Shortcuts->Paper sizes->A4


text:
Q: PDFTOPPM -scale-to option I'm using pdftoppm to convert PDFs to PNGs. I have played with the DPI options (-r, -rx, -ry) and increased the quality of the resultant images by increasing the DPI. I see that there is also a -scale-to option. I cannot quite figure our what it means though with
"Scales the long side of each page (width for landscape pages, height for portrait pages) to fit in scale-to pixels."
So, for example, if I use
    -r 450
Then I have 450 by 450 pixels in the image. If I add
    -scale-to 100
Will it now make the image something x 100 pixels? Or what pixels are being referred to in the scale-to option? Does it interact with -r at all? Or are they separate? Thanks.
Manual page:
https://www.systutorials.com/docs/linux/man/1-pdftoppm/

A: Neil,
I believe that the -r 450 sets the density, whereas the -scale-to 1920 will actually resize the image having its longest side go to 1920 pixels and the other side will also scale maintaining the aspect ratio of the image.  So -r is kind of how blocky it will look, and -scale-to is how big the overall image will be (on one side).


text:
Q: Keep MySQL table updated I have a big user data table. This table is slow to select, grouping and ordering data and it's have date and user_id primary key.
So I want to create a 'copy of big table' but just the latest data of each user.
I tried create the new copy table where just user_id primary key. Then ON DUPLICATE KEY UPDATE
I should use trigger? How the best way to do it?

A: You can create the initial duplicate table as you describe using an INSERT statement selecting all data from the big user data table, using ON DUPLICATE KEY UPDATE.
Then you need either a recurring job to run that same INSERT statement to keep the copy table updated, or a trigger on the source table (the big user data table).
The trigger solution would include a ON INSERT trigger, and if the table is also updated you would also need a ON UPDATE trigger, and if DELETES should be handled you would also need a ON DELETE trigger.
The differences between the solutions is that

*

*the TRIGGER solution would keep the copy table updated in real time,
but if there is a lot of activity on the source table then this can
have performance impacts,

*the recurring job solution would result in a copy table that is not
always up to date but it can be run during off peak hours.

I have databases where I use both solutions, preferring the trigger version as default, and switching to the recurring job solution if needed.
Example: I use the recurring job solution where I aggregate a days worth of data in a nightly job into an aggregate table since the aggregated data will only be used when I have a full days worth of data.


text:
Q: mixed dataframe of list of character vectors into uniform dataframe I am trying to break up strings as columns using the stringr package.
> df <- dput(head(facs,3))
structure(list(geo_accession = structure(1:3, .Names = c("V2",
"V3", "V4"), .Label = c("GSM1494875", "GSM1494877", "GSM1494879",
"GSM1494881", "GSM1494883", "GSM1494885", "GSM1494887", "GSM1494889",
"GSM1494891", "GSM1494893", "GSM1494895", "GSM1494897", "GSM1494899",
"GSM1494901", "GSM1494903", "GSM1494906", "GSM1494908", "GSM1494910",
"GSM1494912", "GSM1494914", "GSM1494917", "GSM1494919", "GSM1494921",
"GSM1494923"), class = "factor"), title = structure(1:3, .Names = c("V2",
"V3", "V4"), .Label = c("2818 - Akt treated TIL - repeat 1 - mAdbID:125971",
"2818 - Akt treated TIL - repeat 2 - mAdbID:125972", "2818 - Akt treated TIL - repeat 3 - mAdbID:125973",
"2818 - Akt treated TIL - repeat 4 - mAdbID:125974", "2818 - Untreated TIL - repeat 1 - mAdbID:125975",
"2818 - Untreated TIL - repeat 2 - mAdbID:125976", "2818 - Untreated TIL - repeat 3 - mAdbID:125977",
"2818 - Untreated TIL - repeat 4 - mAdbID:125978", "3289 - Akt treated TIL - repeat 1 - mAdbID:125979",
"3289 - Akt treated TIL - repeat 2 - mAdbID:125980", "3289 - Akt treated TIL - repeat 3 - mAdbID:125981",
"3289 - Akt treated TIL - repeat 4 - mAdbID:125982", "3289 - Untreated TIL - repeat 1 - mAdbID:125983",
"3289 - Untreated TIL - repeat 2 - mAdbID:125984", "3289 - Untreated TIL - repeat 3 - mAdbID:125985",
"3289 - Untreated TIL - repeat 4 - mAdbID:125986", "3784 - Akt treated TIL - repeat 1 - mAdbID:125987",
"3784 - Akt treated TIL - repeat 2 - mAdbID:125988", "3784 - Akt treated TIL - repeat 3 - mAdbID:125989",
"3784 - Akt treated TIL - repeat 4 - mAdbID:125990", "3784 - Untreated TIL - repeat 1 - mAdbID:125991",
"3784 - Untreated TIL - repeat 2 - mAdbID:125992", "3784 - Untreated TIL - repeat 3 - mAdbID:125993",
"3784 - Untreated TIL - repeat 4 - mAdbID:125994"), class = "factor")), .Names = c("geo_accession",
"title"), row.names = c("GSM1494875", "GSM1494877", "GSM1494879"
), class = "data.frame")

Right now it's a 2 column dataframe.
> sapply(df, class)
geo_accession         title
 "factor"      "factor"

If I use str_split_fixed,
> df$title = str_split_fixed(df[,"title"], " - ", 4)
> df
           geo_accession title.1         title.2  title.3       title.4
GSM1494875    GSM1494875    2818 Akt treated TIL repeat 1 mAdbID:125971
GSM1494877    GSM1494877    2818 Akt treated TIL repeat 2 mAdbID:125972

> sapply(df, class)
geo_accession         title
 "factor"      "matrix"

What I'd like to see is a 5 column dataframe, instead of a 2 column mixed dataframe (factor, matrix).
> df
       geo_accession title1          title2   title3        title4
GSM1494875    GSM1494875   2818 Akt treated TIL repeat 1 mAdbID:125971
GSM1494877    GSM1494877   2818 Akt treated TIL repeat 2 mAdbID:125972

> sapply(df, class)
geo_accession       title.1       title.2       title.3       title.4
 "factor"      "factor"      "factor"      "factor"      "factor"

I don't know how to clean up a mixed dataframe. How can I convert this into a 5-column dataframe?

A: The output of str_split_fixed is a list of vectors.  Assigning a list to a single column is the cause of the problem.  One way is to assign it to multiple columns or otherwise, we can fix it with do.call(data.frame, i.e.
facs1 <- do.call(data.frame, facs)

Or we can use base R methods with read.csv/read.table after removing the spaces before and after the - and then cbind with the first column
facs2 <- cbind(facs[1], read.csv(text=gsub("\\s+-\\s+", "-", facs$title),
          sep="-", header=FALSE, col.names = paste0("title.", 1:4), stringsAsFactors=FALSE))
facs2
#           geo_accession title.1         title.2  title.3       title.4
#GSM1494875    GSM1494875    2818 Akt treated TIL repeat 1 mAdbID:125971
#GSM1494877    GSM1494877    2818 Akt treated TIL repeat 2 mAdbID:125972

str(facs2)
#'data.frame':   2 obs. of  5 variables:
#$ geo_accession: chr  "GSM1494875" "GSM1494877"
#$ title.1      : int  2818 2818
#$ title.2      : chr  "Akt treated TIL" "Akt treated TIL"
#$ title.3      : chr  "repeat 1" "repeat 2"
#$ title.4      : chr  "mAdbID:125971" "mAdbID:125972"

Or a compact option is cSplit from splitstackshape
library(splitstackshape)
cSplit(facs, "title", " - ")

A: You can use separate from the tidyr package:
library(tidyr)
df %>% separate(title, paste0('title',1:4) ,' - ')

           geo_accession title1          title2   title3        title4
1 GSM1494875  GSM1494875   2818 Akt treated TIL repeat 1 mAdbID:125971
2  GSM1494877 GSM1494877   2818 Akt treated TIL repeat 2 mAdbID:125972


text:
Q: windows servers and disabling the legacy protocols I'm disabling the legacy protocols on some Windows servers and I have amended the registry according to this article:
https://techcommunity.microsoft.com/t5/core-infrastructure-and-security/retire-those-old-legacy-protocols/ba-p/259396
However after I reboot the servers if I run the command:
[Net.ServicePointManager]::SecurityProtocol

it throws:
PS C:\WINDOWS\system32> [Net.ServicePointManager]::SecurityProtocol
Tls, Tls11, Tls12

so I see that Tls1.2 is now enabled but I didn't expect to see the other two still enabled. So, my question is:
is the procedure not working or is the command that I ran to check that has a different scope? Maybe the procedure works and the protocols are deactivated but that command has a different scope

A: Depends on the .NET Framework version installed.  4.7 and later will use the default security protocol configured in the OS. Earlier versions require configuration.
https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls#if-your-app-targets-a-net-framework-version-earlier-than-47


text:
Q: Need a batch program to install all manually downloaded Windows Updates .exe files I Installed new Windows 10 and installed updates. After scanning for vulnerability we wanted to install 60+ patches on 20+ machines , we downloaded those patches as exe and unable to install in all the machines manually.
I have tried some scripts which supports msu, but it fails as it is exe files.
Appreciate all the help and answers.


text:
Q: Trouble building Orchard on a Team Foundation Service Build Controller I am trying to setup a Team Foundation Service Build of Orchard and auto deploy to Azure. The structure of Orchard comes by default with the source and lib directories as siblings. The solution file does NOT directly reference the lib files.
.\lib(modules)(files)
.\src\solution.sln
.\src(projects)(files)
When executing a build on the Elastic Build of Team Foundation Service, the build errors report that none of the library files can be found. It appears that they are not being downloaded during the Get Source operation even though the workspace mapping is at the parent directory of lib and src. Without visibility into the build server, I cannot verify that.
Does anybody have any ideas on the cause?
Any way to force verify the lib files are downloaded for the build?

A: An obvious mistake on my part, some of the dlls were excluded from source control and therefore were never downloaded. :-(  A gentle reminder to verify all assumptions.


text:
Q: Azure Web Application: CDN + application service vs Blob storage If using a CDN in Azure in relation to a website/webapp (i.e an Azure application service), what are the benefits/drawbacks of using blob storage vs just using the web application as the endpoint?
For example, a simple CMS website stores all uploaded images in /uploads/myimage.jpg
Using the CDN I could set its endpoint at mywebsite.com/uploads/ or I could create a blob container, set the CMS to store the images there and set it as the origin for the CDN.
What are my considerations for choosing one over the other?

A: As Rob stated in his answer, there's not much difference, performance-wise. Here are what I consider the core differences, overall, between web app-backed CDN and blob-backed CDN:

*

*With first-hit of an object (or the hit after the cache has expired), Web App-backed CDN will have that traffic route through your web app initially. If it is a very large resource (e.g. video file), it's possible that you'll notice an intermittent performance drop due to bandwidth being consumed in an unusually-high manner (until this object is cached in CDN).  Blob storage doesn't have the same type of bandwidth limits.

*with Web App-backed CDN, you have to remember that your storage is limited by the Web App tier you've chosen. If you have 10's of GB of assets, for example, this could force you into a higher tier. With Blob storage, you'll have 500TB of total durable storage, with objects sizeable up to 4.77TB.

*Web Web App-backed CDN, the storage residing in your web app is durable, just like blob storage, until you delete your Web App. Then that storage is gone. With Blob storage, your storage would remain, even after deleting a Web App (or an entire App Service). Of course, your objects would disappear if you deleted the Storage Account...

*If you have assets that are needed in multiple web apps (or other apps hosted elsewhere), you will start to have links from one app, pointing to the assets of another app, introducing a dependency (e.g. web app A with css links to content in web app B). You'd need to carefully manage that. Or store common assets in blob storage and avoid app-to-app linkage dependencies.

*Blob storage would give you the option of locating your static assets in a different region than your web app. With web app storage, they'd always be colocated. (I'm not advocating separating content across regions; just pointing out the flexibility to do so).

*Content management for Blob storage can be done in many ways: Direct REST API calls, SDK-based calls, and many 1st- and 3rd-party tools. With Web App content, there are no such APIs and tools; you'd either have to deploy assets along with your code, or copy content from another source (e.g. blob storage) upon startup (or manually, or via scripts, or however else you choose).

A: If I understand your question, you're asking about the benefits and drawbacks of two different scenarios:

*

*Using an Azure CDN that's backed by Azure Blob Storage.

*Using an Azure CDN that hits the underlying Web App directly.

Honestly, there's not a huge difference between the two. When a request is made to your CDN for an asset, Azure will retrieve the content, cache it, and serve it. So once your CDN's cache is loaded, there's no difference between the two scenarios.
If your cache expiration headers are for a very short period of time and you're dealing with very large files and lots of requests, using Blob storage for the initial loading would be a better option to take load off of your Web App.
I'd probably start with whatever is easiest to implement for your solution and only tune if you run into problems.


text:
Q: Prestashop - Page not found after protect admin directory I'm trying to protect my PrestaShop 1.6 admin directory via cPanel - Password Protect Directories, and when I enable the protection and try to access admin throw URL I'm redirect to 404 page not found.
I have other websites with directory protection and I don't have this problem.

A: cPanel password protect should work but it is difficult to say why it is not working. But there is an alternative way. Instead of password protection, you can restrict admin area using .htaccess. Just add following in .htaccess of your admin area:
Order Deny,Allow
Deny from all
Allow from 11.22.33.44
Allow from 12.34.56.78

You can add IP range or individual IPs.


text:
Q: How to get and set data to a particular redis database index using redisTemplate? I am using redisTemplate to get and set data to Redis. In my redis server database from (0-5) is used for other purposes.I want to store data to the Database indexed 6. How I can acheive that?

A: Use the select method of in the implementation fo RedisConnectionCommands you are using:
redisConnection.select(6);

A: You could use RedisTemplate to query about keys and get values.
For example if you want to returns all fields and values of the hash stored at key use...

    RedisTemplate redisTemplate = new RedisTemplate();
    redisTemplate.setConnectionFactory(redisConnectionFactory());
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setHashKeySerializer(new StringRedisSerializer());
    redisTemplate.setHashValueSerializer(new StringRedisSerializer());
    redisTemplate.afterPropertiesSet();
    Map messageGroupMetadata = redisTemplate.opsForHash().entries("MetaData");

Or use key to get info about a MessageGroup..

     redisTemplate.opsForValue().get(K)


text:
Q: Can I search a folder for phrases contained within files (from the Windows command line)? Background: I have programming experience, but have not programmed in years.
My place of employment (a State prison) does not allow me to download programming tools/environments (internet access is severely curtailed).
I need to search the contents of a folder for phrases contained within files contained within that folder. For example, in a given (network) folder, I want to search all the MS Word docs in the folder for a phrase such as "knee brace."
Is there a way to do this -- at the command line, for example (assuming such is still available in Windows 10)? All I would need is the name of which file[s] contained the phrase provided.

A: Yes the command prompt is certainly still a viable solution in Windows 10.  Either run cmd or right click the start menu to find it.
this guide appears like it may be able to help you.

A: Use the findstr command. For example:
C:\...> findstr /S /C:"knee brace" * | more

The /S option will search the current directory and all sub-directories. If you want to save the results to a file, you can use command redirection:
C:\...> findstr /S /C:"/knee brace" * > results.txt

A: To search Word documents, I think you'll need some scripting. PowerShell is Windows built-in command/scripting environment. A great example is here.
Keith


text:
Q: RASA Chatbot Framework gives error while training :fit() got multiple values for keyword argument 'batch_size' I was trying to train the Chat Bot built with rasa using the snippet
agent.train(data,augmentation_factor=50,
        epochs=500,
        batch_size=10)

and got the following error. I Know its not rasa_core error but something related to keras probably.
rasa_core/policies/keras_policy.py", line 177, in train
    **params)
TypeError: fit() got multiple values for keyword argument 'batch_size'

I am new to bot building and never done in deep learning Project before that.Using following dependencies
rasa_core==0.12.x
keras==2.1.6

A: I had the same error and after several search I did find a solution. It is not the best solution but it can help!
Go to rasa_core\rasa_core\policies\keras_policy.py in lines 172-177 and delete epochs and batch_size arguemnts from model.fit.
Change this:
    params = self._get_valid_params(self.model.fit, **kwargs)
    self.model.fit(shuffled_X, shuffled_y,
                   epochs=self.epochs, batch_size=self.batch_size,
                   **params)

to this :
    params = self._get_valid_params(self.model.fit, **kwargs)
    self.model.fit(shuffled_X, shuffled_y,**params)

Then you can pass epochos and batch_size arguments in agent.train()
I hope it will help!

A: My friend had the same issue. He has latest version of rasa_core installed. However the keras_policy.py got similar issue. I gave him my version of keras_policy.py and he replaced it with my version and it worked. I know it is not right solution, but you can use that as work around


text:
Q: How to indent if Text is softWrapped in Flutter I'm working on an app that displays lyrics for several hymns in my native language.
Each line of the hymn is an individual Text Widget. I want the text to indent if it got softWrapped if user increases the font size to indicate that its not the next line. How can I achieve this effect?

A: Adding one or more tab escape characters "\t" to your strings may do the trick for you:
          Text("\t this is a text string that will have an indentation",),


text:
Q: JPA multi inheritance cannot create schema I have a datamodel with multiple layers of inheritance. As long as every layer contains only one class, I have no problem generating my database schema. When I add another class to the last layer, I get an exception when trying to generate the schema:
Exception Description: Predeployment of
  PersistenceUnit [JPA] failed.
Internal Exception: java.lang.NullPointerException

My datamodel is implemented as follows:
PersistentEntiy.java
@Data
@AllArgsConstructor
@NoArgsConstructor
@Getter(value = AccessLevel.PROTECTED)
@Setter(value = AccessLevel.NONE)
@MappedSuperclass
@IdClass(DatabaseId.class)
public abstract class PersistentEntity {

  @Id
  @Column(name = "ID", nullable = false)
  @NonNull
  @Setter(value = AccessLevel.NONE)
  private UUID id;

  @Id
  @Column(name = "LAST_MODIFIED", nullable = false)
  @NonNull
  @Setter(value = AccessLevel.NONE)
  private LocalDateTime lastModified;

}

Booking.java
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@Setter(AccessLevel.NONE)
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "BOOKINGS", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"TARGETCASHREGISTER", "BOOKINGNUMBER"})
})
public class Booking extends PersistentEntity {

  @Column(nullable = false, precision = 36, scale = 2)
  @DecimalMin("0.01")
  @NonNull
  private BigDecimal amount;
  @Column(nullable = false)
  @NonNull
  private String text;
  @Column(nullable = false)
  private boolean isInPayment;
  @Column(nullable = false)
  @NonNull
  private UUID targetCashRegister;
  @Column(nullable = false)
  private long bookingNumber;
  @Column(nullable = false)
  @NonNull
  private String affiliate;
  @Transient
  private boolean isAnnulated = false;

  ...
}

CashContribution.java
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@Entity
@Table(name = "CASHCONTRIBUTIONS")
public class CashContribution extends Booking {
  ...
}

Until this point everything works fine. But when adding the following class, the schema generation fails.
CashRetrieval.java
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@Entity
@Table(name = "CASHRETRIEVALS")
public class CashRetrieval extends Booking {
  ...
}

Note: This project makes heavy use of lombok annotations to generate code at compile time.
Can anyone help me fix this issue?

Edit 1: Full stacktrace
Exception in thread "main" Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.7.0.v20170811-d680af5): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with
ClassLoader: sun.misc.Launcher$AppClassLoader@18b4aac2
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.0.v20170811-d680af5): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [JPA] failed.
Internal Exception: java.lang.NullPointerException
  at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127)
  at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:115)
  at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:188)
  at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
  at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
  at com.gipa.kassenbuch.Main.<init>(Main.java:16)
  at com.gipa.kassenbuch.Main.main(Main.java:26)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.0.v20170811-d680af5): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [JPA] failed.
Internal Exception: java.lang.NullPointerException
  at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:2080)
  at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:2071)
  at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:101)
  at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:104)
  ... 5 more
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.0.v20170811-d680af5): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [JPA] failed.
Internal Exception: java.lang.NullPointerException
  at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:231)
  ... 9 more
Caused by: java.lang.NullPointerException
  at org.eclipse.persistence.internal.jpa.metadata.MetadataDescriptor.setPKClass(MetadataDescriptor.java:1846)
  at org.eclipse.persistence.internal.jpa.metadata.inheritance.InheritanceMetadata.process(InheritanceMetadata.java:244)
  at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processTableAndInheritance(EntityAccessor.java:1390)
  at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.process(EntityAccessor.java:683)
  at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage2(MetadataProject.java:1876)
  at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:575)
  at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:610)
  at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1992)
  ... 7 more

Main.java
public class Main {

  private final EntityManager manager;

  public Main () {
    EntityManagerFactory factory = Persistence.createEntityManagerFactory("JPA");
    manager = factory.createEntityManager();
  }

  public void run() {
    final DatabaseProvider provider = DatabaseProvider.getInstance();
  }

  public static void main(String[] args) {
    new Main().run();
  }

}

A: The stack trace shows it is unable to find the IdClass in the inheritance root entity. This seems a bug in the mappedsupperclass parsing which can be worked around by putting the @IdClass(DatabaseId.class) annotation on the Booking class.


text:
Q: Simple CSS spinner element wobbles while rotating I've been trying to create a simple css spinner which is shown while my page is loading by using a pseudo element overlaying a div where content will be shown.
It uses border-radius and transform: rotate() to achieve this effect but as you can see it wobbles strangely while rotating. The effect is more or less obvious depending on the screen size, zoom level and browser. I find it's most visible in MS Edge.
Example fiddle

.loading {
  width: 75vh;
  height: 100vh;
  margin: auto;
  background: white;
  position: relative;
}

.loading::after {
    border: 6vmin solid lightblue;
    border-top: 6vmin solid darkblue;
    position: absolute;
    margin-top: 5vmin;
    margin-left: 5vmin;
    width: 15vmin;
    height: 15vmin;
    content: "";
    border-radius: 50%;
    animation: spin .5s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

A: There's some weird cut going on with the border-radius
Change it to border-radius: 1000px and see what happens

A: Changing the width and height to a pixel value seems to fix the issue. It may not be the best solution, but hey, it works.
To make this appropriate for all screen sizes, you need to use @media. In the bottom of the css I have added one that changes the size if the screen size is smaller than 700px just to show you how to do it, and if you want to change the numbers around or something, you at least know how @media can be used :)
Here is the code for changing the size depending on the screen-size of the users device.
@media (max-width: 700px){
  .loading::after {
    width: 100px;
    height: 100px;
  }
}

If you want to make it different on large screens too, just swap out "max-width: 700px" with "min-width: 1500px" or a value of your choice :)
http://jsfiddle.net/hfsqebsn/5/
Again, there are probably better ways, but this works :)
Edit: I think I may have changed around some other stuff in the fiddle I linked for testing purposes, so just beware of that :P

A: This issue was driving me crazy all day. I was able to solve it personally by making the ring thicker than desired and then masking over its inner and outer portions to hide the wobble from the viewer.
Solution.
https://codepen.io/corbinmosher/pen/GRWmYjy
Solution with background coloring to help with understanding it.
https://codepen.io/corbinmosher/pen/bGqWmEj

.spinner__container {
  position: relative;
  width: 58px;
  height: 58px;

  background-color: white;
}

.spinner__ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: calc(100% - 8px);
  height: calc(100% - 8px);
  border-radius: 50%;
}

.spinner__ring:before {
  position: absolute;
  top: -1px;
  left: -1px;

  width: calc(100% + 2px);
  height: calc(100% + 2px);

  border: 10px solid lightblue;
  border-top: 10px solid blue;
  box-sizing: border-box;
  content: '';
  border-radius: 50%;
  animation: rotate-spinner 1s linear infinite;
}

.spinner__ring:after {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: calc(100% - 8px);
  height: calc(100% - 8px);

  box-sizing: border-box;
  content: '';
  border-radius: 50%;

  background-color: white;
}

.spinner__outline {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: calc(100% - 8px);
  height: calc(100% - 8px);
  border-radius: 50%;
  border: solid 2px white;
}

@keyframes rotate-spinner {
  0% {
    transform: rotate(405deg);
  }
  100% {
    transform: rotate(765deg);
  }
}

@-webkit-keyframes rotate-spinner {
  0% {
    transform: rotate(405deg);
  }
  100% {
    transform: rotate(765deg);
  }
}


text:
Q: My Code is not returning the value I expect Hi I recently decided to start learning C#, I made this quick program to get familiar with the way its written.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharpTesting
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] Names = new string[4] { "Ben", "Thor", "Zoe", "Kate" };
            Names[0] = "ben";
            Names[1] = "thor";
            Names[2] = "zoe";
            Names[3] = "kate";
            int Max = 4;
            int Current = 0;
            bool Found = false;
            Console.WriteLine("What player are you looking for?");
            string PlayerName = Console.ReadLine();
            while ((Found = false) && (Current <= Max))
            {
                if (Names[Current].Equals(PlayerName))
                {
                    Found = true;
                }else
                {
                    Current++;

                }
                Console.Write(Names[Current] + PlayerName);
            }
            if (Found == true)
            {
                Console.WriteLine("Yes, they have a top score");
                Console.Write(PlayerName);

            }
            else if (Found == false)
            {
                Console.WriteLine("No, they do not have a top score");
                Console.Write(PlayerName);
            }
            else
            {
                Console.WriteLine("ERROR");
            }
            Console.ReadKey();
        }
    }
}

Every time I run the code it returns "No, they do not have a top score" even when I enter the same string as one of the names in the array. I think the problem may be with the way im checking if the 'PlayerName' and the array Names are the same but im not sure. Any help will be much appreciated.

A: while ((Found = false) && (Current <= Max))

Should be
while ((Found == false) && (Current <= Max))

By the way, names with a capital letter at the beginning are usually for classes.

A: You need to change the if clause to this:
if (Names[Current] == PlayerName)

A: Change your while condition to:
while ((Found == false) && (Current <= Max))

A: (Found = false)

is an error. If you need a comparison use ==
  (Found == false)

= is intented to assign false value to Found variable
All you code can be replaced with
if (Names.Contains(PlayerName ) )

A: The problem is due to Capital Case.
Change the "Equals" Method with compare with the ignoreCase
if(string.Compare(PlayerName, Names[Current], true) == 0)

Anyway as other users said: Found = false is wrong.
You have to write Found == false


text:
Q: hyper link url does not open without opening referring or parent page -I have a job link
https://sjobs.brassring.com/TGWebHost/jobdetails.aspx?SID=%5eNJ9jpo3wVSbfK0NxdHECJijC2rWHbZl4%2f7afCQpgRyliOu2Weq1%2few7zT1iEt2vW&jobId=804091&type=search&JobReqLang=1&recordstart=1&JobSiteId=5011&JobSiteInfo=804091_5011&GQId=1640
-When I paste it to a browser url and hit enter, it results in
ErrMsg=NoCookieGetSessionIdForXML (The page does not load)
-However on the same browser if I open its referring or parent page
https://sjobs.brassring.com/TGWebHost/searchopenings.aspx?partnerid=25222&siteid=5011
-Then open a new tab, again on the same browser i go to the same link above
https://sjobs.brassring.com/TGWebHost/jobdetails.aspx?SID=%5eNJ9jpo3wVSbfK0NxdHECJijC2rWHbZl4%2f7afCQpgRyliOu2Weq1%2few7zT1iEt2vW&jobId=804091&type=search&JobReqLang=1&recordstart=1&JobSiteId=5011&JobSiteInfo=804091_5011&GQId=1640
this time the page is loaded successfully. I scrape the jobdetails urls (not the searchopenings url) and present them users on my own page. So can you please point me to how to achieve this? I have tried to trouble shoot and I think it may have to do with establishing session/cookies but still cant figure it all out. Thanks in advance for any help.

A: The problem is because the user is missing the appropriate cookie, as the comments and other answer says. However you don't have to go to such difficult lengths to pull in a cookie from a remote source, You can simply load a resource from that site in your html. Loading the resource will set the cookie in the users browser. This way when the user clicks on the link, they already have the cookie.
In the example below, I am loading the parent page in a hidden iframe, but if you find that an image also loads the cookie, you could just add that without bothering with an iframe.

Because the hidden iframe adds the cookie, this link works now!!


text:
Q: Entity Framework: How to select nested entity my entity hierarchy is Customer > Address > Contact. so i use this code to iterate in contact details.
Contacts CurrentContacts = null;

foreach (var existingContacts in existingCustomer.Addresses.Select(a => a.Contacts.Where(cc=> cc.ContactID==5)))
{
    CurrentContacts = existingContacts;
}

but this line CurrentContacts = existingContacts; throwing error

Cannot implicitly convert type
  'System.Collections.Generic.IEnumerable' to
  'EFTest.Contacts'. An explicit conversion exists (are you missing a
  cast?)

what is my mistake. existingContacts will have contacts related data and CurrentContacts is a variable of contact type.
so please tell me how could i do it.

A: Use SelectMany instead of Select.
Select projects each individual element and does nothing to the rest of the enumerable
.
So Addresses.Select(a=>a.Contacts.Where(...)) is an enumerable of whatever Address.Contacts.Where(...) is. Ie. you get an enumerable of enumerables.
To get a single enumerable you need to flatten this list.  Which is what SelectMany does.
That said even
foreach (var existingContacts in <some enumerable>)
{
    CurrentContacts = existingContacts;
}

Looks strange.  Unless there are other logic in the loop you could replace the loop with;
CurrentContacts= <some enumerable>.LastOrDefault();

And if you don't actually care which Contact you use, as long as it has ContactID=5;
CurrentContacts= <some enumerable>.FirstOrDefault();

A: I think you have two problems, but without seeing how the Contacts type is defined it's just a guess.
As @Taemyr points out, you need to use SelectMany instead of Select to flatten the collection of collections.
But unless Contacts is inherited from List<EFTest.Contacts> you still aren't going to be able to do the assignment, you need to change your variable declaration to:
IEnumerable<Contacts> CurrentContacts = null;


text:
Q: Error while looping through multiple tables in sql server 2008 I have this code(sql server 2008)
EXEC sp_MSforeachtable

'
IF ''?'' LIKE ''%_records%''
BEGIN

Update ? set Status = ''expired'' where expire_date_time <= getdate()
END'

When I execute this query, it updates the tables, but it displays an error like:
Msg 207, Level 16, State 1, Line 6
Invalid column name 'expire_date_time'.
Msg 207, Level 16, State 1, Line 6
Invalid column name 'expire_date_time'.
Msg 207, Level 16, State 1, Line 6
Invalid column name 'expire_date_time'.
Msg 207, Level 16, State 1, Line 6
Invalid column name 'expire_date_time'.
Msg 207, Level 16, State 1, Line 6
Invalid column name 'expire_date_time'.
Msg 207, Level 16, State 1, Line 6
Invalid column name 'expire_date_time'.

Why it is so? Can someone guide me with correct code? I want to put that code in event is it possible, so it will check the condition after particular time interval.

A: Trap the error with TRY/CATCH and RAISE (or THROW) a custom error message that includes the tablename (?) and then you'll know which table is missing the column.

A: The problem is that the IF statement isn't going to do anything to prevent SQL Server from parsing the command. For example, try:
IF 1=0
BEGIN
    SELECT blah FROM INFORMATION_SCHEMA.TABLES
END

You'll still get an error.
Also, having tables like jason_records is a pretty horrible idea.
Another way that you could accomplish this is to only do the UPDATE in dynamic code:
DECLARE
    @table_name    SYSNAME,
    @table_schema  SYSNAME,
    @sql           NVARCHAR(MAX)

DECLARE CURSOR tables_cursor FOR
SELECT TABLE_SCHEMA, TABLE_NAME
FROM
    INFORMATION_SCHEMA.TABLES T
INNER JOIN INFORMATION_SCHEMA.COLUMNS C ON
    C.TABLE_CATALOG = T.TABLE_CATALOG AND
    C.TABLE_SCHEMA = T.TABLE_SCHEMA AND
    C.TABLE_NAME = T.TABLE_NAME AND
    C.COLUMN_NAME = 'expire_date_time'
WHERE
    T.TABLE_NAME LIKE '%_records'

OPEN tables_cursor

FETCH NEXT FROM tables_cursor INTO @table_schema, @table_name

WHILE (@@FETCH_STATUS = 0)
BEGIN
    SELECT @sql = 'UPDATE ' + QUOTENAME(@table_schema) + '.' + QUOTENAME(@table_name) + ' SET status = 'expired' WHERE expire_date_time <= GETDATE()'

    EXEC (@sql)

    FETCH NEXT FROM tables_cursor INTO @table_schema, @table_name
END

CLOSE tables_cursor

DEALLOCATE tables_cursor

A: Unfortunately sp_MSforeachtable is unsupported code. It may contain bugs which will never be corrected. Try []
...
update ? set [Status] = ''expired'' where [expire_date_time] <= getdate()
...


text:
Q: JSF 2.0: Immediately render a component after hitting a radio button When the user chooses the expert radio button, I would like to render an additional outputText with "expert" as value. I tried ajax, with event,listener and render attributes but nothing works.
This is my form:
<h:form>
    <h:selectOneRadio id="rb" value="#{account.dtype}">
        <f:selectItem itemId="user" itemValue="user" itemLabel="User" />
        <f:selectItem itemId="admin" itemValue="admin" itemLabel="Admin" />
        <f:selectItem itemId="expert" itemValue="expert" itemLabel="Expert" />
        <f:ajax execute="@this" render="choice"/>
    </h:selectOneRadio>
    <br />
    <h:outputLabel id="choice" value="#{account.dtype}" rendered="#{account.dtype}=='expert'" />
</h:form>

A: The code you posted contains several errors.
First, you have an error in the EL formula that checks account.dtype: everything that's out of the curly brackets is evaluated as a pure text string, therefore your formula evaluates to the string expert=='expert' and not to a boolean value. You have to use:
<h:outputLabel id="choice" value="#{account.dtype}" rendered="#{account.dtype == 'expert'}" />

(or use eq instead of == operator)
Second, the component to be updated must exist in the DOM tree, otherwise its rendered status cannot be updated. So, wrap it in a component which is always rendered and ajax-update it instead. For example, you can update the whole form:
<f:ajax execute="@this" render="@form"/>

Finally, although this doesn't have any effect, note that the attribute itemId is not defined in the component selectItem, and will be ignored by JSF. Your IDE should have warned you about this.
See also:

*

*Why do I need to nest a component with rendered="#{some}" in another component when I want to ajax-update it?

A: Thank you, I found the problem.
The problem was that I had the xhtml page containing the form where the body was  instead of , same thing for  instead of
I also used the click ajax event instead of "execute".
Your rectifications helped me also, thank you :)