text:
Q: How to remove space between two containers in Flutter? I have two Containers of height 250 inside Column widget. There is no any other widget present between this two Container widget but still I can see very little space between two containers.
Here's my code...
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: Example(),
    );
  }
}

class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    double height = 250;
    TextStyle containerTextStyle = TextStyle(color: Colors.white, fontSize: 24);

    return Scaffold(
      body: Column(
        children: <Widget>[
          Container(
            height: height,
            color: Colors.black,
            child: Center(
              child: Text('Container 1', style: containerTextStyle),
            ),
          ),
          Container(
            height: height,
            color: Colors.black,
            child: Center(
              child: Text('Container 2', style: containerTextStyle),
            ),
          ),
        ],
      ),
    );
  }
}

I don't know why but if I set the height of this containers to 100 or 400 it is not showing any space between container. Did not try with many different values for height but space is visible for some value and not visible for other value.
Here's the screenshot from my phone...
Both Containers height is equal to 250

Both Containers height is equal to 400

A: Replace your scaffold with this:
return Scaffold(
  body: Column(
    children: <Widget>[
      Container(
        height: height,
        decoration: BoxDecoration(
          border: Border.all(width: 0, color: Colors.black),
          color: Colors.black,
        ),
        child: Center(
          child: Text('Container 1', style: containerTextStyle),
        ),
      ),
      Container(
        height: height,
        decoration: BoxDecoration(
          border: Border.all(width: 0, color: Colors.black),
          color: Colors.black,
        ),
        child: Center(
          child: Text('Container 2', style: containerTextStyle),
        ),
      ),
    ],
  ),
);

A: As @sukhi said,
You need to use the BoxDecoration in your Container.
But Rather than giving border Color you can simple set width of border to 0.
Like Below:
Container(
  decoration: BoxDecoration(
    color: Colors.black,
    border: Border.all(width: 0),
  ),
  height: height,
  child: Center(
    child: Text('Container 1', style: containerTextStyle),
  ),
),
Container(
  decoration: BoxDecoration(
    color: Colors.black,
    border: Border.all(width: 0),
  ),
  height: height,
  child: Center(
    child: Text('Container 2', style: containerTextStyle),
  ),
),

And Do not forget to give your color inside BoxDecoration instead of Container itself else it will throw an error.
Cannot provide both a color and a decoration
The color argument is just a shorthand for "decoration: new BoxDecoration(color: color)".

A: A bit late, but currently seems to be an open Flutter issue. My solution was similar to other answers, but as the color in my case had opacity, I had to wrap the problematic container with another container, and add the decoration to the parent container:

decoration: BoxDecoration(
             color: Colors.black, //the color of the main container
             border: Border.all(
               //apply border to only that side where the line is appearing i.e. top | bottom | right | left.
               width: 2.0, //depends on the width of the unintended line
               color: Colors.black,
             ),
           ),

As suggested from https://github.com/flutter/flutter/issues/14288#issuecomment-668795963


text:
Q: Thumbnail grid image resize issue So i'm trying to create a portfolio with an hover with text.
I tried to make it a little responsive with bootstrap, but I can't get it right how the image is centered in the div when you scaling down.
I really wanna get something like this ( https://www.weblounge.be/en/ )
With an high of 100% and a width of 100% to always show the full size of the image when resizing.
I guess I do something wrong but can't find the issue.
my buildup is

Random website

Random text

and the css
.container {
  background-color: #fff;
  padding: 100px 0px 100px 0px;
  .nopad {
    padding-left: 0px;
    padding-right: 0px;
  }
  .box {
    cursor: pointer;
    height: 400px;
    position: relative;
    overflow: hidden;
    width: 100%;
    text-align: left;
    img {
      position: absolute;
      width: 100%;
      -webkit-transition: all 300ms ease-out;
      -moz-transition: all 300ms ease-out;
      -o-transition: all 300ms ease-out;
      -ms-transition: all 300ms ease-out;
      transition: all 300ms ease-out;
    }
    .overlay {
      background: rgba(0, 0, 0, 0.7);
      position: absolute;
      left: 0;
      z-index: 100;
      opacity: 0;
      width: 100%;
      height: 100%;
      box-sizing: border-box;
      text-align: center;
      padding-top: 20%;
      -webkit-transition: all 300ms ease-out;
      -moz-transition: all 300ms ease-out;
      -o-transition: all 300ms ease-out;
      -ms-transition: all 300ms ease-out;
      transition: all 300ms ease-out;
      h5 {
        color:#fff;
        opacity: 0;
        transition-delay: 0.1s;
        transition-duration: 0.2s;
        transform: translateY(60px);
        -webkit-transform: translateY(60px);
      }
      p {
        color: #fff;
        opacity: 0;
        transition-delay: 0.2s;
        transition-duration: 0.2s;
        transform: translateY(60x);
        -webkit-transform: translateY(60px);
      }
      .button-white {
        opacity: 0;
        transition-delay: 0.2s;
        transition-duration: 0.2s;
        transform: translateY(60px);
        -webkit-transform: translateY(60px);
        margin: 0px;
      }
    }
    &:hover img {
      -webkit-transform: scale(1.05);
      -moz-transform: scale(1.05);
      -ms-transform: scale(1.05);
      -o-transform: scale(1.05);
      transform: scale(1.05);
    }
    &:hover .overlay {
      opacity: 1;
      h5 {
        opacity: 1;
        transform: translateX(0px);
        -webkit-transform: translateX(0px);
      }
      p {
        opacity: 1;
        transform: translateX(0px);
        -webkit-transform: translateX(0px);
      }
    }
  }
}

My codepen to show what is wrong:      http://codepen.io/denniswegereef/pen/MwJXde

A: You need to use the product images as a background-image in a product div:

    ...

and then change your css from .box img, to .box .product-image:
.box {
    .product-image {
        position: absolute;
        width: 100%;
        height:100%;
        -webkit-transition: all 300ms ease-out;
        transition: all 300ms ease-out;
        background-repeat: no-repeat;
        background-size: cover;
    }

    &:hover .product-image {
        -webkit-transform: scale(1.05);
        transform: scale(1.05);
    }
}

http://jsfiddle.net/8pfjdmb4/

redpajama_set_name: RedPajamaStackExchange


text:
Q: PDAL: Argument references invalid/unused stage: 'filters.voxelgrid' I am running into an error when running pdal translate on Mac OS High Sierra:
PDAL: Argument references invalid/unused stage: 'filters.voxelgrid'.

This is the command I am using based on a PDAL tutorial on thinning point cloud data:
$ pdal translate -i /Users/aaron/temp/1958-09-54.laz -o /Users/aaron/temp/1958-09-54-thinned.laz --filters.voxelgrid.leaf_x=4.5 --filters.voxelgrid.leaf_y=4.5 --filters.voxelgrid.leaf_z=4.5

Essentially, this command thins the point cloud data with a voxel grid algorithm.
I see that the filters.voxelgrid driver is enabled when I call pdal --drivers. I'm using pdal 1.6.0 which was installed using brew install pdal. I am also running pcl 1.8.1_2, which was installed by default during the brew install of pdal.
What might be causing this error and how can I resolve it?

A: pdal translate requires the filter type voxelgrid.
The correct syntax is as follows:
$ pdal translate -i /Users/aaron/temp/1958-09-54.laz -o /Users/aaron/temp/1958-09-54-thinned.laz voxelgrid --filters.voxelgrid.leaf_x=4.5 --filters.voxelgrid.leaf_y=4.5 --filters.voxelgrid.leaf_z=4.5

Same command with each parameter separated for legibility:
$ pdal translate \
-i /Users/aaron/temp/1958-09-54.laz \
-o /Users/aaron/temp/1958-09-54-thinned.laz \
voxelgrid \
--filters.voxelgrid.leaf_x=4.5 \
--filters.voxelgrid.leaf_y=4.5 \
--filters.voxelgrid.leaf_z=4.5


text:
Q: Android dependency injection issue I have 3 library in my project named-A,B,C. A is the main library where my project starts. I add C library dependency in gradle of B because I need some activities of C in my library B. Then I add B libraray in gradle of A's dependency.
After adding it "getActionBar" in my project is becomes null .
Can any one one help me out from this??


text:
Q: Passar valor por header para API NodeJS Bom dia pessoal estou com o seguindo problema, tenho uma API para ser consumida, porém ela espera um token de retorno validado internamente, esse token é passado como parâmetro via cabeçalho, porém não uso o JWT, pego um token gerado pelo banco. Minha duvida está justamente em como enviar via header essa valor, para fazer com que a API receba. Nunca fiz esse processo, o código que tenho hoje é esse.
application.get('/listarEmpresas', function(req, res) {

    var request = require('request');

    request('APIURL', function(error, response, body) {

        console.log('error:', error);
        let url = req.url
        console.log('statusCode:', response && response.statusCode);
        console.log('body:', body);
        var arrayJSON = JSON.parse(body);

    });
});

Ficarei grato quem puder me dar uma luz.

A: Você pode passar os parâmetros para a função get:
const headers = {
  token: 'TEXTO DO TOKEN',
};

const parametros = {
  url: 'APIURL',
  headers,
};

request.get(parametros)...


text:
Q: How can I eliminate section headers, while keeping the first paragraph of each section unindented? I would like to have the sections of my document to just be separated by a vertical space, with no visible section header. Furthermore, I would like the first paragraph of each section start without an indent.
I tried the following minimal working example for an \invisiblesection command, taken from this question. Unfortunately, any text that follows this \invisiblesection command gets indented:
\documentclass{article}

\newcommand\invisiblesection[1]{%
  \refstepcounter{section}%
  \addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}%
  \sectionmark{#1}}

\begin{document}

\invisiblesection{First Section}
The section header is invisible :) but the paragraph starts with an indent :(

\section{Second Section}
The section header is visible :( but the paragraph starts with no indent :)

\end{document}

Adding \noindent to the end of \invisiblesection doesn't fix this. Adding \noindent to the beginning of each new section does fix it, but I would like this to happen automatically, as it does when I use the normal section environment.

A: You can use titlesec to suppress the title; here's an example where I used fancyhdr to show that the \leftmark is correctly set.
The spacing can be adjusted with \titlespacing*{\section}... (note the asterisk).
\documentclass{article}
\usepackage{titlesec}
\makeatletter
\titleformat{\section}[block]{}{}{0pt}{\@gobble}
\makeatother

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markboth{#1}{#1}}
\fancyhf{}
\fancyhead[C]{\leftmark}
\fancyfoot[C]{\thepage}

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\section{First section}

\lipsum

\section{Second section}

\lipsum

\end{document}

A: [EDITED to respond to user request]
\documentclass{article}
\renewcommand\thesection{\noindent}
\let\svsection\section
\renewcommand\section{\vspace*{-3.5\baselineskip}\svsection}
\begin{document}

\section{}

This follows a section

Second paragraph

Third paragraph

\section{}

Paragraph after new section

second paragraph

third paragraph

\end{document}


text:
Q: Using aggregators (Min, Max, Avg) inside South migrations I want to perform annotate/aggregate inside migration, because my data needs to be prepared before schema modifications. South does not permit import aggregators fro django.db.models - it throws an error on migration application stage. So is there some way to do this in South?

A: This is kind of a worst case scenario, but one option would be to make South just exec the SQL directly for you.
From their docs: https://south.readthedocs.org/en/latest/databaseapi.html#db-execute
Getting the SQL query sometimes can be a pain, but you can make Django just give it to you from your Model.objects.filter().blahblah.blah statement
Fair warning
Messing about with a query object like this directly is bad so please don't do that in your deployed code. In this case though since .aggregate() doesn't return a QuerySet it's a bit harder to get at the actual query. With that said, to get the SQL from your query (assuming it's somewhat easy to isolate the whole thing) you can fire up a django-admin.py shell and do something like
from django.db.models import Count
import MyModel

q = MyModel.objects.all().query
q.add_aggregate(Count('pk'), MyModel, 'name', is_summary=True)
print q

It's easier for annotate
.annotate() returns a queryset directly so you don't have to muck about with .add_aggregate().
from django.db.models import Count
import MyModel

print (MyModel.objects.all()
       .annotate(c = Count('some_field'))
       .query)

Meanwhile, in South
From there you pretty much cut-n-paste that SQL into a string for your data migration, and then call db.execute. The rest of the error handling and rollback stuff is very dependent on your situation, but I'd strongly recommend writing a rollback just to be safe.


text:
Q: Unterminated `s' command I am working on a perl script that finds will take customer service information and change the service ids. The code i have now can take a 2 column csv file for reference, and swap the numbers, but when i try to use "\n" or "\|" like i need to, it will give me the `ol:
"sed: -e expression #1, char 29: unterminated `s' command"
Here's my original code that works for changing JUST the number within the quotes:
#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV; #load Text::CSV module for parsing CSV
use LWP::Simple; #load LWP module for doing HTTP get

my $file = 'sid_swap.csv'; #CSV file to parse and load
my $csv = Text::CSV->new(); #create a new Text::CSV object

open (CSV, "<", $file) or die $!; #open CSV file for parsing

while (<CSV>) {
    if ($csv->parse($_)) {

        my @columns = $csv->fields(); #parse csv files and load into an array for each row
        my $newSID = $columns[0];
        my $oldSID = $columns[1];
        system("sed -i 's/\<row SERVICE_MENU_ID=\"$oldSID\"/\<row SERVICE_MENU_ID=\"$newSID\"/g' customer_data.txt");

    } else {
        my $err = $csv->error_input;
        print "Failed to parse line: $err";
    }
}
close CSV;

And here is the new code that throws the error:
#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV; #load Text::CSV module for parsing CSV
use LWP::Simple; #load LWP module for doing HTTP get

my $file = 'sid_swap.csv'; #CSV file to parse and load
my $csv = Text::CSV->new(); #create a new Text::CSV object

open (CSV, "<", $file) or die $!; #open CSV file for parsing

while (<CSV>) {
    if ($csv->parse($_)) {

        my @columns = $csv->fields(); #parse csv files and load into an array for each row
        my $newSID = $columns[0];
        my $oldSID = $columns[1];
        system("sed -i 's/\<row SERVICE_MENU_ID=\"$oldSID\"/\n$newSID\|/g' customer_data.txt");

    } else {
        my $err = $csv->error_input;
        print "Failed to parse line: $err";
    }
}
close CSV;

Thanks for any help you can provide!

A: To debug, change system("sed ...") to die("sed ...");. You'll see you're what trying to execute
sed -i 's/<row SERVICE_MENU_ID="OLDSID"/
NEWSID|/g' customer_data.t

I guess sed doesn't like actual newlines in the middle of its arguments? That can be fixed using proper escaping, but your approach is... insane. You're processing the entire file for each row of the CSV!
open(my $CSV, "<", $file) or die $!;    # Let's not use global vars!

my %fixes;
while (<$CSV>) {
    $csv->parse($_)
        or die "Failed to parse line: ".$csv->error_input."\n";

    my ($newSID, $oldSID) = $csv->fields();
    $fixes{$oldSID} = $newSID;
}

my $pat = join "|", map quotemeta, keys(%fixes);
my $re = qr/$pat/;

{
    local @ARGV = 'customer_data.txt';
    local $^I = '';  # "perl -i" mode
    while (<>) {
        s/<row SERVICE_MENU_ID="($re)"/\n$fixes{$1}|/g;
        print;
    }
}

Doing it in one pass also solve the problem of
1111,2222
2222,3333

being the same as
1111,3333
2222,3333


text:
Q: How to pass injected bean to another injected object? I would like to do the following
public class AClass {
   @Inject
   private AnotherBean anotherBean;

   @Inject
   private AGenericClass agenericClass = new GenericClass(BClass.class,anotherBean);
}

Basically inject a bean and pass it to another bean that is also instantiated via Injection. Additionally pass another (non injected) argument to aGenericClass. The AGenericClass bean also has several @Injected beans. I know this is not possible the way I wrote it but is there a way to do it at runtime? I must say I am very new at dependency-injection via the cdi (and di in general).


text:
Q: DeleteMissing doesn't match in Association tables DeleteMissing doesn't work in Association tables:
Dataset[{<|"a" -> 1, "b" -> Missing[]|>, <|"a" -> 2,
     "b" -> 3|>}][DeleteMissing,"b"] // Normal

{Missing[], 3}

Whereas DeleteCases[_Missing] works, as does [All, "b"][DeleteMissing] and [{DeleteMissing, DeleteCases[_Missing]}, "b"] --> {{3},{3}}

A: The documentation for Dataset (and Query) indicates that DeleteMissing is a descending operator.  This means that it is applied to the original list before the "b" suboperator is applied.  Since none of the original list elements have the head Missing, the descending DeleteMissing is effectively a null operation in this case.
Original Case - DeleteMissing
What we need to do is convert the operator into an ascending operator.  We start with the original case:
ds = Dataset[{<|"a"->1,"b"->Missing[]|>,<|"a"->2,"b"->3|>}];

ds[DeleteMissing, "b"] // Normal
(* {Missing[], 3} *)

Any descending operator can be converted into an ascending operator by wrapping it with Query[...]:
ds[Query[DeleteMissing], "b"] // Normal
(* {3} *)

Pure functions are also treated as ascending:
ds[DeleteMissing[#]&, "b"] // Normal
(* {3} *)

Composing a descending operator with a preceding ascending operator will also convert it -- #& is a terse choice:
ds[#& /* DeleteMissing, "b"] // Normal
(* {3} *)

As noted in the question, performing a second query will allow the descending operator to be applied in descending fashion, but after the operations in the first query are complete:
ds[All, "b"][DeleteMissing] // Normal
(* {3} *)

DeleteCases
DeleteCases is an ascending operator, which is why it gives the desired result:
ds[DeleteCases[_Missing], "b"] // Normal
(* {3} *)

{DeleteMissing}
The {...} operator is (usually) an ascending operator.  Thus, any suboperators it contains are applied after the other query descending operators:
ds[{DeleteMissing}, "b"] // Normal
(* {{3}} *)

While tangential to the present question, note that in some circumstances the {...} operator can be considered a descending operator.  This happens if and only if the contained suboperators are all simple part operators.  For example:
{<|"a" -> 11|>, <|"a" -> 22|>, <|"a" -> 33|> } // Query[{2, 3}, "a"]
(* {22, 33} *)

This exception is made because even though part operators alter the descending structure, they do so in a well-defined fashion which is akin to filtering.  The query machinery can still infer useful properties about the result of such part filtering.  DeleteMissing is not so benign, and can change the shape of the data in ways that are more difficult to reason about up front.  The difference is that a list of part operators generates a result of fixed cardinality, whereas {DeleteMissing} generates a result of varying cardinality.  So {DeleteMissing} does not qualify for the exception and is interpreted as an ascending operator.


text:
Q: Approximation of roots using Series I am solving a fifth degree polynomial using Series. My equation looks like
    I p^5 + 2 p^4 y wo + x^2 y z^2 wo^5 - 2 p^2 y wo (x^2 wo^2 + z^2 wo^2 + 4 wo^2) -
  I p^3 (x^2 wo^2 + y^2 wo^2 + 2 z^2 wo^2 + 4 wo^2) + I p (z^4 wo^4 + x^2 wo^2 (y^2 wo^2 + z^2 wo^2) + 4 y^2 wo^2 wo^2) ==
  0

Using Solve I obtain the roots using Root
    {{p -> Root[
    wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 1]}, {p ->
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 2]}, {p ->
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 3]}, {p ->
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 4]}, {p ->
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 5]}}

Now I make approximation based on $1 \gg z \gg x \gg y$ using Series, that is
     Assuming[wo \[Element] Reals &&
  wo > 0,
 Normal[Series[
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 1], {x, 0, 1}, {y, 0, 1}, {z, 0, 2}]]];

Assuming[wo \[Element] Reals &&
  wo > 0,
 Normal[Series[
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 2], {x, 0, 1}, {y, 0, 1}, {z, 0, 2}]]]

Assuming[wo \[Element] Reals &&
  wo > 0,
 Normal[Series[
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 3], {x, 0, 1}, {y, 0, 1}, {z, 0, 2}]]]

Assuming[wo \[Element] Reals &&
  wo > 0,
 Normal[Series[
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 4], {x, 0, 1}, {y, 0, 1}, {z, 0, 2}]]]

Assuming[wo \[Element] Reals &&
  wo > 0,
 Normal[Series[
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 5], {x, 0, 1}, {y, 0, 1}, {z, 0, 2}]]]

The outputs that I get are
    -2 wo - (wo z^2)/2 + 1/4 I wo y z^2;
     -((wo z^2)/2) + y (I wo - 1/4 I wo z^2);
     (I wo x^2 y)/z^2;
     (wo z^2)/2 + y (I wo - 1/4 I wo z^2);
     2 wo + (wo z^2)/2 + 1/4 I wo y z^2;

respectively. However, when I change the sequence of the series that is,
    Assuming[wo \[Element] Reals &&
  wo > 0,
 Normal[Series[
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 1], {z, 0, 2}, {x, 0, 1}, {y, 0, 1}]]];
Assuming[wo \[Element] Reals &&
  wo > 0,
 Normal[Series[
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 2], {z, 0, 2}, {x, 0, 1}, {y, 0, 1}]]];

Assuming[wo \[Element] Reals &&
  wo > 0,
 Normal[Series[
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 3], {z, 0, 2}, {x, 0, 1}, {y, 0, 1}]]];

Assuming[wo \[Element] Reals &&
  wo > 0,
 Normal[Series[
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &, 4], {z, 0, 2}, {x, 0, 1}, {y, 0, 1}]]];

Assuming[wo \[Element] Reals &&
  wo > 0,
 Normal[Series[
   Root[wo^5 x^2 y z^2 + 4 I wo^4 y^2 #1 + I wo^4 x^2 y^2 #1 +
      I wo^4 x^2 z^2 #1 + I wo^4 z^4 #1 - 8 wo^3 y #1^2 -
      2 wo^3 x^2 y #1^2 - 2 wo^3 y z^2 #1^2 - 4 I wo^2 #1^3 -
      I wo^2 x^2 #1^3 - I wo^2 y^2 #1^3 - 2 I wo^2 z^2 #1^3 +
      2 wo y #1^4 + I #1^5 &,2], {z, 0, 2}, {x, 0, 1}, {y, 0, 1}]]];

I start to get different approximated roots. Could you please help me understand what is happening? The Series will be same in both cases but something is making it give me different results. Is there a problem with Series function, or is it because the roots have no closed form expressions?
Thank you.


text:
Q: Php regular expressions character encoding issue My regular expression wont consider accented characters thus not finding any matches when I am searching words containing ü,õ,ö or ä characters.
$data is HTML data stripped from HTML tags using strip_tags and containing words with ü, õ, ö and ä characters loaded via CURL from website with character encoding UTF-8 (as returned headers tell me);
$data = strip_tags( curl_exec('my_website_url') );
$match = preg_match( '/ü/' , $data , $matches );

I have tried using following (also with 'ISO-8859-1'):
mb_internal_encoding("UTF-8");
mb_regex_encoding('UTF-8');

or:
$data = utf8_decode($data)

Not success yet.

A: Make sure your PHP source file is UTF-8 encoded as well.
If it's for example ISO-8859-1, the ü in your preg_match directive will be a different character from the üs in your UTF-8 data.

A: You should tell PRCE that you are using UTF-8 which is done by adding u modifier -> '/ü/u'. But if possible do not put these characters directly into source code. If you change (or your editor will) encoding of the file, your code will stop working and tracing this down would be quite PITA. I'd suggest, instead of using '/ü/' directly to replace character in question with its code: '/\x{c3bc}/u' - the 0xc3bc is your letter.


text:
Q: $f$ entire function with $|f(z)| \leq 1 + |\Im z|$, is $f$ constant? Let $f: \mathbb{C} \rightarrow \mathbb{C}$ be entire such that for any $z \in \mathbb{C}$, $|f(z)| \leq 1 + |\Im(z)|$. Is $f$ constant?
I think it is linear and non-constant: For $a_{n}$ the $n$-th coefficient in the power series of $f$ about the origin [and $C_{R} := \partial D(0, R)$], we have
$$|a_{n}| \leq \frac{1}{2\pi} \int_{C_{R}} \frac{1 + |\Im(z)|}{|z|^{n+1}} dz \leq \frac{1}{2\pi} \int_{0}^{2\pi} R \cdot \frac{1 + R|\sin t|}{R^{n+1}} dt = \frac{1}{R^{n}} + \frac{2}{\pi R^{n-1}}.$$
Letting $R \rightarrow \infty$, $|a_{n}|$ will be $0$ when $n > 1$. Since I've only bounded above, I can't say anything about $a_{1}$. On the other hand, I can't find an example of a non-constant $f$ satisfying the hypothesis.

A: $$
|f(z)| \leq 1 + |\Im(z)| \le 1 + |z|
$$
implies that $f$ is (at most) linear, i.e.
$$
f(z) = a_0 + a_1 z
$$
with complex constants $a_0, a_1$. Now choose $z = x \in\Bbb R$ with $x\to \infty$ to conclude that $a_1=0$ and $f$ is constant.

A: One general tool that applies to such situations is the Phragmen–Lindelöf theorem, which extends the maximum modulus principle to unbounded domains as long as the function in question doesn't grow too fast. In this case, we have $|f(z)| \le 1$ on the boundary of the upper half plane (namely the real axis), and the growth bound is easily enough to apply Phragmen–Lindelöf, whereby $|f(z)| \le 1$ on the entire upper half plane. The same applies to the lower half plane, and so $|f(z)|\le1$ everywhere, hence is constant.


text:
Q: In "One to Many" Mapping hibernate data is getting inserted in child table while updating parent table                 import java.util.Set;
                import javax.persistence.CascadeType;
                import javax.persistence.Column;
                import javax.persistence.Entity;
                import javax.persistence.FetchType;
                import javax.persistence.Id;
                import javax.persistence.OneToMany;
                import javax.persistence.Table;

                @Entity
                @Table(name="BILLING_INFORMATION")
                public class BillingInformation {

                    @Id
                    @Column(name="BILL_NO", unique = true, nullable = false, length = 100)
                    private String bNo;

                    @Column(name="BILL_DATE", length = 100)
                    private String billDate;

                    @Column(name="PARTY_NAME", length = 100)
                    private String partyName;

                    @Column(name="SUB_TOTAL", length = 100)
                    private String subTotal;

                    @Column(name="TOTAL", length = 100)
                    private String total;

                    @OneToMany(fetch=FetchType.EAGER, mappedBy="billInformation", cascade = CascadeType.ALL,orphanRemoval=true)
                    Set<BillingItemInformation> setBillingItemInformation;

                    @OneToMany(fetch=FetchType.EAGER, mappedBy="billInformation", cascade = CascadeType.ALL,orphanRemoval=true)
                    Set<BillingTaxInformation> setBillingTaxInformation;

            ----all getters and setters----
            }

        import javax.persistence.Column;
        import javax.persistence.Entity;
        import javax.persistence.GeneratedValue;
        import javax.persistence.GenerationType;
        import javax.persistence.Id;
        import javax.persistence.JoinColumn;
        import javax.persistence.ManyToOne;
        import javax.persistence.Table;

        @Entity
        @Table(name="BILLING_ITEM_INFORMATION")
        public class BillingItemInformation {

            @Id
            @GeneratedValue(strategy=GenerationType.IDENTITY)
            @Column(name = "RECORD_ID", unique = true, nullable = false, length = 100)
            private int recordNo;

            @Column(name = "S_NO", length = 100)
            private String sNo;

            @Column(name="ITEM", length = 100)
            private String item;

            @Column(name="QTY", length = 100)
            private String qty;

            @Column(name="PRICE", length = 100)
            private String price;

            @Column(name="AMOUNT", length = 100)
            private String amount;

            @ManyToOne
            @JoinColumn(name="BILL_NO", nullable=false)
            private BillingInformation billInformation;

        ---all getters and setters----

    }

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="BILLING_TAX_INFORMATION")
public class BillingTaxInformation {

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "RECORD_ID", unique = true, nullable = false, length = 100)
    private int recordNo;

    @Column(name = "TAX_NAME", length = 100)
    private String taxName;

    @Column(name = "TAX_PERCENTAGE", length = 100)
    private String taxInPercent;

    @Column(name = "TAX_AMOUNT", length = 100)
    private String taxAmount;

    @ManyToOne
    @JoinColumn(name="BILL_NO", nullable=false)
    BillingInformation billInformation;
--------all getters and setters----
}

I just started learning hibernate from simple java jdbc and as part of our project requirement I have to maintain above three classes but when I am updating BillingInformation.java entity class object then BillingTaxInformation.java and BillingItemInformation.java class object get inserted the same object with different recordNo. Please correct me where I am doing mistake.

A: You are using cascade = CascadeType.ALL in both @OneToMany mappings of your Sets.
This means that whatever operation done on the BillingInformation entity, will be propagate also to the child BillingItemInformation and BillingTaxInformation.
That is when you

*

*PERSIST

*REFRESH

*MERGE

*REMOVE

*DETACH

.. the same would be applied to these children.
If you only want to cascade when the parent entity is

*

*PERSISTED(or saved in the hibernate language)

*and DELETED (two most common options for @OneToMany)

, but during MERGE and subsequent update, you do not want to cascade those operations to children then set-up you mappings as follows:
@OneToMany(fetch=FetchType.EAGER, mappedBy="billInformation"
          , cascade = { CascadeType.PERSIST, CascadeType.REMOVE }
          ,orphanRemoval=true)
Set<BillingItemInformation> setBillingItemInformation;

@OneToMany(fetch=FetchType.EAGER, mappedBy="billInformation"
         , cascade ={ CascadeType.PERSIST, CascadeType.REMOVE }
         ,orphanRemoval=true)
Set<BillingTaxInformation> setBillingTaxInformation;

Update
With hibernate annotation you would configure as follows:
@Cascade({CascadeType.PERSIST, CascadeType.DELETE})


text:
Q: 'Review' is not exported from './Review' I have a problem.
i created Review.jsx file.
i use rafce and I wrote the code.
I want to import it to another file, but it writes a problem.
'Review' is not exported from './Review'
in another file code from import - import { Review } from './Review';
Review and this file in the same folder
Review.jsx Code
import React from 'react';
import { Typography, List, ListItem, ListItemText } from '@material-ui/core';

const Review = ({ checkoutToken }) => {
    return (
        <>
            <Typography variant="h6" gutterBottom>Order Summary</Typography>
            <List disablePadding>
                {checkoutToken.live.line_items.map((product) => (
                    <ListItem style={{padding: '10px 0' }} key={product.name}>
                        <ListItemText primary={product.name} secondary={`Quanity: ${product.quanity}`} />
                        <Typography variant="body2">{product.line_total.formatted_with_symbol}</Typography>

                    </ListItem>
                ))}
                <ListItem style={{padding: '10px 0' }}>
                    <ListItemText primary="Total" />
                    <Typography variant="subtotal" style={{fontWeight: 700}}>
                        {checkoutToken.live.subtotal.formatted_with_symbol}
                    </Typography>

                </ListItem>
            </List>
        </>
    )
}

export default Review;

A: In Review.jsx file you need to export your function/component in a following way:
export const Review = // your function/component here;

And only then you can import it in a following way
import { Review } from './Review';


text:
Q: Friendship in nested classes C++ I am trying to understand concept of friendship in nested classes but I am not getting the concept properly. I have written a sample program to understand it but the program is not working
#include<iostream>

using namespace std;

class outerClass
{
    private:
        int a;
    public:
        class innerClass;
        bool print(innerClass);
};

class innerClass
{
    friend class outerClass;
    private:
        int b;

    public:
        innerClass() =default;

};

bool outerClass::print(outerClass::innerClass obj)
{
    cout<<"Value of b in inner class is:"<<obj.b;
}

int main()
{
    outerClass in;
    outerClass::innerClass obj;
    obj.b=5;
    in.print(obj);
}

I am getting below errors:
try.cpp: In member function 'bool outerClass::print(outerClass::innerClass)':
try.cpp:26:6: error: 'obj' has incomplete type
try.cpp:11:15: error: forward declaration of 'class outerClass::innerClass'
try.cpp: In function 'int main()':
try.cpp:34:28: error: aggregate 'outerClass::innerClass obj' has incomplete type and cannot be defined

As I read through articles on internet I learnt following points please comment on them if they are correct or not:

*

*innerClass can access all the members of outerClass by default.

*For outerClass to access private members of innnerClass we need to make outerClass as friend class to innerClass.

Please help in pointing out the mistake in code and also if the points I understood are correct.

A: The line class innerClass; within outerClass is a forward declaration to a class that you never define.
Hence outerClass::innerClass is an incomplete type.
The separate innerClass definition that starts with
class innerClass
{

is a completely different class to the forward declared class.
There's nothing wrong with your friend class outerClass; statement within the defined innerClass.

A: If you want to define innerClass outside of outerClass, here is how to do it:
class outerClass
{
    class innerClass; // forward declaration
};

class outerClass::innerClass // definition
{
};

The rest is OK, except of obj.b=5. The class outerClass is allowed to access innerClass::b, the function main() is not.

innerClass can access all the members of outerClass by default.

Right. From the standard [class.access.nest]:

A nested class is a member and as such has the same access rights as any other member.

For outerClass to access private members of innnerClass we need to make outerClass as friend class to innerClass.

Right. From the standard [class.access.nest]:

The members of an enclosing class have no special access to members of a nested class;

A: I think you are confusing with nested class and friend class
You can use friend class not using nested class and
you can use nested class not using friend class
Here are some example:
class A {};
class B {};

Here the A class knows the B class, but the B cannot know the A class. So you need to tell the A class that the B class is exist.
This doing thing, is called Forward Declaration
So:
class B;       // forward declaration
class A {};    // A knows the B
class B {};    // B knows the A


text:
Q: My SSH agent die when Jenkins finishes processing I have a job on Jenkins able to run a daemon (lsyncd) which persists after the end of the job. This daemon has to be run under an SSH agent so I installed a plugin for Jenkins able to set an SSH agent.
When I start my job all is OK, my lsyncd daemon is run and works correctly but once the job finished, it seems my SSH agent dies and my daemon is not able to work anymore.
Do you know how to tell Jenkins to keep my agent alive even after the job finishes?
Kind regards,
Ben

A: I'm assuming you're using something like the 'Publish over SSH' Plug-in.
You should use SSH to issue a command to spawn a new shell like bash instead of running the command for launching your daemon directly (not the SSH shell). Then in this bash shell run your daemon.  When it finishes, you should still have the shell active, thus the ssh agent will not terminate.
You'll need to set the timeout in the jenkins job for the SSH agent to a long timeout (or 0, which means no timeout)


text:
Q: Get SPSS data on notepad? I have data in spss.In spss i have that data according to variable.I want that data to write on notepad in the notepad on top row it display variable and under that variable corresponding punches.

A: Just export the data as a csv file using File > Save As
and choose .csv (, delimiter) or .dat (tab, \t delimiter)  as the type.


text:
Q: Input using stdin in C/C++ I have to read graph inputs (all at once) (an example below):
6 8 //no of vertices, edges
0 1 2 //connectivity from vertex 0 to vertex 1, with weight 2
0 2 1
0 4 2
1 2 4
2 3 5
3 4 5
4 1 2
4 5 5

What is the best way to read inputs dynamically. I have to read all the above content at once. I need to read it dynamically since the number of edges and vertices can change, with a maximun of 10000.
The following doesn't work:
int *twod_array;
int N,M; //no of vertices, edges
scanf("%d %d", &N, &M);
twod_array = (int *)malloc(sizeof(int)*N*M); //where N = no of rows, M = no of cols
for(i=0; i < N; i++) {
  for(j=0; j < M; j++) {
scanf("%d",&twod_array[i*M +j]);
  }
}
for(i=0; i < N; i++) {
  for(j=0; j < M; j++) {
    if(twod_array[i*M +j] == "\0") {
twod_array[i*M +j] = 0;
    }
  }
}

Also, is this the best way for graphs in C/C++ or is it better to use struct, since traversals will be done.

A: As far as loading that data in goes, there are lots of ways. One would be to make a connectivity struct, and dynamically allocate an array of those based on the number of edges value in the first line of the data file:
#include <stdio.h>
#include <stdlib.h>

struct connectivity {
    int source;
    int sink;
    int weight;
};

int main() {
    int num_verts = 0;
    int num_edges = 0;
    struct connectivity *edges = NULL;
    int i = 0;

    scanf("%d %d\n", &num_verts, &num_edges);

    edges = malloc(sizeof (struct connectivity) * num_edges);

    for (i = 0; i < num_edges; i++) {
        scanf("%d %d %d\n", &(edges[i].source),
                            &(edges[i].sink),
                            &(edges[i].weight));
    }

    // use edges here

    free(edges);
}

Also, please use more legible variable names!

A: From my experience, using an Edge struct will be very feasible to handle graph problems.
struct Edge{
    int to;
    int weight;
    Edge(int t, int w):to(t), weight(w){};
};
std::vector<vector<Edge> > graph;
int N,M; //no of vertices, edges
scanf("%d %d", &N,&M);
graph.resize(N);
int u, v, w;
for(int i = 0; i < M; i ++){
    scanf("%d %d %d", &u, &v, &w);
    graph[u].push_back(Edge(v, w));
}


text:
Q: using Concurrent Mark Sweep GC Collector? This question is based on my understanding from section Java Garbage Collectors of link
Looks like jvm by default uses "Parallel GC" on windows 7 as i confirmed it -XX:+PrintCommandLineFlags -version. This article also says

The parallel garbage collector uses multiple threads to perform the
  young generation garbage collection. This collector should be used when a lot of
  work need to be done and long pauses are acceptable

i am not sure which collector is used for tenured space collection by Parallel GC?
Also i could not think of applications where long pauses are acceptable(will cause less responsiveness). Anyone would like to less pauses for GC and make app as responsive as it can.
Then i read Concurrent Mark Sweep (CMS) Collector which collects the tenured generation
CMS says it require low pause times and can share resources with the garbage collection.
My question is should not most
of web applications use Concurrent Mark Sweep (CMS) Collector because of its responsiveness.? I am sure there must be some other factors also to make the
decision but after going thru this link to me feels like i should change the default GC type to Concurrent Mark Sweep (CMS) Collector. Any thoughts/insights?
Further i think application can be best if we use CMS Collector and parallel collector together where CMS is used for old generation and parallel fpr
younger generation

A:
i am not sure which collector is used for tenured space collection by Parallel GC?

Going off of this page, if you use the parallel GC the parallel scavenge collector is used for the young generation and the parallel mark/sweep collector is used for the old generation (aka tenured generation). So I guess the answer is "The Parallel GC is used for tenured space collection by the Parallel GC". Bit of a circular statement, but I suppose it makes sense.

Also i could not think of applications where long pauses are acceptable(will cause less responsiveness). Anyone would like to less pauses for GC and make app as responsive as it can.

"Long pause" is relative, and whether they are acceptable depends on the type of application and its use. Applications which require quick user interaction, such as games, would probably require low pause times, while applications that are long-running, have little user interaction (overnight batch jobs, processing jobs which can run for several days, possibly servers which run for long periods of time, etc.), or don't require fast user interaction (word processors? But who writes word processors in Java?) wouldn't have nearly as strict pause requirements, so pauses would be OK for those. In addition, pauses are not the only GC factor to consider, so even if pauses are OK there are other reasons that a GC with longer pauses would be chosen. I'll explain further down.

My question is should not most of web applications use Concurrent Mark Sweep (CMS) Collector because of its responsiveness.?

The CMS collector has drawbacks. In the article you mentioned, there's this line:

Normally the concurrent low pause collector does not copy or compact the live objects. A garbage collection is done without moving the live objects.

So no heap compaction would lead to heap fragmentation, which could be detrimental to performance. This post states another drawback (I'm not sure exactly how reliable this post is, but it seems to be pretty decent at a first glance):

A more important disadvantage of the CMS collector is related to the fact that it cannot be started when the Old generation heap is full. Once the Old generation is full, it is too late for the CMS and it must then fall back to the usual stop-the-world strategy (announced by a "concurrent mode failure" in the GC log).
...
The biggest disadvantage of the CMS, however, is related to the fact that it does not compact the Old generation heap. It therefore carries the risk of heap fragmentation and severe operations degradation over time.
...
It is obvious that with these settings the JVM worked well for almost 14 hours under loadtest conditions (in production and with lower load this treacherously benign period may last much longer). Then suddenly there were very long GC pauses which actually stopped the JVM for about half of the remaining time. There were not only attempts to clean up the mess in the Old generation which lasted more than 10 seconds but even New generation GC pauses were in the seconds range because the collector spent a lot of time searching for space in the Old generation when it tried to promote objects from new to Old generation.

There is more detail in the blog post, which you should probably read as there's a lot covered outside the quote here as well as some fantastic demonstrations. But the point to take away is that the CMS collector is not a one-size-fit-all collector. It has its drawbacks as well, which might cause a programmer to pick a different collector instead. Using it as the default may be OK for short-running applications, but for long-running applications such behavior would be very bad...

Further i think application can be best if we use CMS Collector and parallel collector together where CMS is used for old generation and parallel fpr younger generation

This is actually the default mode when you pass the -XX:+UseConcMarkSweepGC argument to your VM. But as stated above, you may want to really take some time to think about what collector you want to use. Picking a collector without considering your use case probably isn't a good idea. (Side note: I thought I saw some document from Oracle on how to decide what GC to use, but I can't find it any more...)
In addition, you might want to consider the shiny new G1 collector, if you have Java 7u4 or later. It's supposed to be the replacement for the CMS collector.

A:
i am not sure which collector is used for tenured space collection by
  Parallel GC?

If you don't specify the flag "-XX:+UseParallelOldGC" the jvm will choose the single threaded or the multithreaded collector based on the number of cores available on the machine, os, 32/64 bits, etc.

My question is should not most of web applications use Concurrent Mark
  Sweep (CMS) Collector because of its responsiveness.?

The problem with the CMS collector is that it does no old generation memory compaction leading to performance degradation in memory allocation and eventually to a stop the world FULL GC as with the Parallel GC.
If your web app uses a small heap(4-5GB) that is not filling up to often (1-2 times a day) and pauses of 1s/(old gen. GB) are acceptable then the Parallel GC is a good choice.
If you have larger heaps, CMS is a better option as it does not induce long stop the world pauses when collecting the old generation. But you should anyway schedule a FULL memory gc let's say once a day on off peak hours in order to do memory compaction.

Further i think application can be best if we use CMS Collector and
  parallel collector together where CMS is used for old generation and
  parallel fpr younger generation

They can't be setup to be used together: the Parallel GC and CMS. But young generation collection is parallel and stop the world with both collectors.


text:
Q: How to select the first 30 rows from a set? I am trying to pick out a column name MSISDN rom the No_Occupation table and then select the top 300 rows from the result. this is the script I used:
WITH PagingCte AS (
SELECT [Account ID],[User Name],[Last Name],[User Category],
Row_Num = Row_Number() OVER (ORDER BY [User Name])
From AllBalance_20230119)

SELECT [Account ID],[User Name],[Last Name],Row_Num
FROM PagingCte
WHERE [Account ID] IN (SELECT [MSISDN] FROM No_Occupation)
AND Row_Num BETWEEN 1 AND 300;
AND [User Category] = 'Subscriber';

But after I execute the script, I got to result shown.
What am I missing?
I tried the code below
WITH PagingCte AS (
SELECT [Account ID],[User Name],[Last Name],[User Category],
Row_Num = Row_Number() OVER (ORDER BY [User Name])
From AllBalance_20230119)

SELECT [Account ID],[User Name],[Last Name],Row_Num
FROM PagingCte
WHERE [Account ID] IN (SELECT [MSISDN] FROM No_Occupation)
AND Row_Num BETWEEN 1 AND 300;
AND [User Category] = 'Subscriber';

A: Why do you need the CTE?
You could just inner join to no occupation to eliminate non-matches and use top and order by...
SELECT TOP 300 [Account ID],[User Name],[Last Name],[User Category]
FROM AllBalance_20230119
INNER JOIN No_Occupation
 on AllBalance_20230119.[Account ID] = No_Occupation.[MSISDN]
WHERE [User Category = 'Subscriber'
ORDER BY [User Name]

or use exists since you're not returning data from no_occupation, you just need to know the account ID exists in the set..
SELECT TOP 300 [Account ID],[User Name],[Last Name],[User Category]
FROM AllBalance_20230119
WHERE [User Category = 'Subscriber'
  and exists (SELECT 1 FROM No_Occupation
              WHERE AllBalance_20230119.[Account ID] = No_Occupation.[MSISDN])
ORDER BY [User Name]

Order of operations will matter here so

*

*FROM

*where

*order by

*Select

*top

The order by occurs before the top ensuring you get those top 300 based on user name.

A: With your query, there is no guarantee that there would be a row with [User Category] = 'Subscriber' in the first 1-300 rows. Why don't you simply use TOP (SQL server it seems to be - else LIMIT):
SELECT top(300) [Account ID],[User Name],[Last Name],Row_Number() over (Order by  [User Name]) Row_Num
FROM AllBalance_20230119
WHERE [Account ID] IN (SELECT [MSISDN] FROM No_Occupation)
AND [User Category] = 'Subscriber'
order by [User Name];

A: Answer changes due the DBMS that you are using.
Anyway, you can use LIMIT keyword in order to select first n rows from a query result.
LIMIT works with a lot of DBMS as SQL Server, PostgreSQL, etc..
You can implement LIMIT in this way:
SELECT [Account ID],[User Name],[Last Name],[User Category],
Row_Num = Row_Number() OVER (ORDER BY [User Name])
From AllBalance_20230119
ORDER BY Row_Num
LIMIT 300


text:
Q: Is correct tense used?
I have talked with Tom and I found this project very interesting.

To add some context :
I talked with Tom about one hour ago via phone and he told me about the project.

A: If you're going to tell someone that you spoke with Tom about the project not long ago and your current opinion is that the project is interesting:

I've talked with Tom about the project and find it interesting.

If you don't wish to say that you find it interesting at this moment (maybe you have found a more interesting project after speaking with Mike):

I talked with Tom about the project and found it interesting.

Maybe you wish to say that you're no longer interested in Tom's project, after hearing from Mike about his more interesting project:

I talked with Tom about the project. I had found it interesting, but
  then Mike's project came along, and now I would rather work on Mike's project instead.


text:
Q: Android: how do i prevent canvas to draw the whole view when animation I hava a customized view and I draw its UI on its onDraw(Canvas canvas) method. I some case I need do some animation (anim is true)
public class GameView extends View {

//more code

@Override
protected void onDraw(Canvas canvas)
{
    canvas.drawBitmap(item.getBitmap(), item.getXY().getX(), item.getXY().getY(), null);
    canvas.drawBitmap(ResizedBitmapMapping.getHouse(), 0f, 0f, null);
    if(amin){
        canvas.save();
        canvas.rotate(currentValue);
        drawBall(canvas);
        canvas.restore();
    }
}

But the ball is very small, so only a small part of the view needs to be re-drawn. it should be a performance issue to draw the whole view. What is the right to draw such animation?

A: What your are looking for is Canvas.clipRect().
Here is a short video from Google that explains how it works and how to use it. Alternatively, you can invalidate only a region of a view with View.invalidate(int,int,int,int).


text:
Q: add multiple columns with liquibase using yml I want to add multiple columns to my database using liquibase and a yml-file.
I know that I can do this with one step using xml like this:
<changeSet author="liquibase-docs" id="addColumn-example">
    <addColumn catalogName="cat"
            schemaName="public"
            tableName="person">
        <column name="job" type="varchar(255)"/>
       <column name="designation" type="varchar(255)"/>
    </addColumn>
</changeSet>

Can I do the same in a yml-file?
- changeSet:

    id: myId
    author: malt

    changes:

      - addColumn:

        tableName: myTable

        columns:

          - column:

            name: name01

            type: decimal(21,2)

          - column:

            name: name02

            type: decimal(21,2)

This does not seem to work...
I just don't want to repeat the -addColumn-Tag again and again.
Thanks for your help!
Matthias

A: According to addColumn liquibase documentation you can do this in yaml as such (just their example):
databaseChangeLog:
   - changeSet:
       id: addColumn-example
       author: liquibase-docs
     changes:
         - addColumn:
              tableName: person
              columns:
                 name: middlename
                 type: varchar(50)

A: You almost got it right, just need an extra indent after column:
- changeSet:

    id: myId
    author: malt

    changes:

      - addColumn:

        tableName: myTable

        columns:

          - column:
 # note the indent below here!
              name: name01

              type: decimal(21,2)

          - column:

              name: name02

              type: decimal(21,2)


text:
Q: Configuring project for Java 8 in Eclipse I am attempting to set up a Jetty Webapp project in Eclipse Neon and am getting the following error:
Generated servlet error: The type java.lang.CharSequence cannot be resolved
Based on this related post and a few others, I've been led to believe this being caused by a version mismatch between Java 7 and Java 8.  The project also runs properly on other machines, which also would imply the issue is with my configuration.  The accepted answer to the linked post is to either roll back to Java 7, or change the source level of the project to 8.  Rolling back to 7 is not an option for me, as the project makes use of Java 8 features.
Im pretty sure I have everything set up for Java 8, but I'm not real experienced in Eclipse, so there could be a setting Im missing.  I have set:
in Eclipse->Preferences->Java->Compiler->Compiler compliance level: 1.8
in Project->Preferences->Java Compiler->Compiler compliance level: 1.8
in Project->Preferences->Java Build Path->Libraries the JRE System Library is 1.8.0_77
in Run->Run Configurations->Jetty Webapp:
Jetty Version is Jetty 7.6.8v20121106
JRE is Project JRE (1.8.0_77)
I have also cleaned, rebuilt, removed and reimported the project, and restarted Eclipse.
Are there any settings I am missing that might still be set to Java 7?
Or is there some other reason why I would be getting this error?
the full error message is:
org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP||PWC6197: An error occurred at line: 17 in the jsp file: /WEB-INF/jsp/dashboard/showfilters.jsp|PWC6199: Generated servlet error:|The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files||PWC6197: An error occurred at line: 17 in the jsp file: /WEB-INF/jsp/dashboard/showfilters.jsp|PWC6199: Generated servlet error:|The method replace(char, char) in the type String is not applicable for the arguments (String, String)||
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:123)

Also, the line in question is:
<a title=" <%= request.getAttribute("title").toString().replace("],", "\n") %>">


text:
Q: Making a TCP socket from scratch in C++ I'm trying to set up a simple TCP socket in C++ without using any non-standard libraries.
I want to make a client socket and a server client and pass an integer to the server from the client. Can someone give me a simple example of a server and a client class?

A: C++ does not come with a "standard library" for sockets but can of course access the standard C library for sockets.
#include <sys/socket.h>

sockaddr_in addr;
bzero(&addr, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr(destination_address_as_32bit_number);
addr.sin_port = htons(destination_port_number_as_16bit_number);

int s = socket(AF_INET, SOCK_STREAM, 0);
connect(s, &addr, sizeof(addr));

There you go...  Now you can read & write to "s" like any other file.
On the server you do it a bit different:
#include <sys/socket.h>

sockaddr_in addr;
bzero(&addr, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = 0; // bind to all interface addresses
addr.sin_port = htons(local_port_number_as_16bit_number);

int s = socket(AF_INET, SOCK_STREAM, 0);
bind(s, &addr, sizeof(addr));
listen(s, 50);  // 50 (the backlog) isn't really used on modern systems
int c = accept(s, &addr, sizeof(addr));  // addr gets info about client

An now you can read/write to "c" like any file.  "s" is the listening socket on which you do nothing but accept().


text:
Q: java.sql.SQLException: ORA-00911: invalid character Below code is showing we java.sql.SQLException. Can anyone help me in fixing this
Class.forName("oracle.jdbc.driver.OracleDriver");

String lname=request.getParameter("lastname");
String uname=request.getParameter("username");
String fname=request.getParameter("firstname");
String cemail=request.getParameter("email");
String pswd=request.getParameter("password");
String cpswd=request.getParameter("conformpassword");
String sex=request.getParameter("gender");
long phon=Long.parseLong(request.getParameter("mobile"));

Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "admin");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("insert into users values('" + uname + "','" + fname + "','"  + lname + "','" + cpswd + "',"+ phon + ",'" + cemail + "','" + sex + "');");

A: Instead of:
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("insert into users values('" + uname + "','" + fname + "','"  + lname + "','" + cpswd + "',"+ phon + ",'" + cemail + "','" + sex + "')");

I'd suggest doing the following:
PreparedStatement st = con.prepareeStatement("insert into users values(?,?,?,?,?,?,?);");
st.setString(1, uname);
st.setString(2, fname);
st.setString(3, lname);
st.setString(4, cpswd);
st.setLong(5, phon);
st.setString(6, cemail);
st.setString(7, sex);
ResultSet rs = st.executeQuery();

Your problem is not evident by your question, but using PreparedStatement as I have will prevent future problems you will encounter. I hope that helps.


text:
Q: select row in GridEx in runTime I am using the Janus GridEx control. I am using a timer to update the grid with data from the database every minute. If the user has a row selected when the data is updated from the database, how can I re-select the row after the update is complete?

A: You should store the index of the row that is selected before you refresh the grid, then set the selected row to that value after. Something like:
int row = myGrid.Row;

// Perform update

try
{
    vJanusDataGridMeasures.Row = row;
}
// The row index that was selected no longer exists.
// You could avoid this error by checking this first.
catch (IndexOutOfRangeException)
{
    // Check to see if there are any rows and if there are select the first one
    if(vJanusDataGridMeasures.GetRows().Any())
    {
        vJanusDataGridMeasures.Row = 0;
    }
}


text:
Q: Running a python script on time machine to copy files I want to get rid of all the data in my time machine backup drive and only keep the photos. So I have written a python script for that which walks through files, finds out the photos ('png', 'jpg', etc.) and then copies those to another folder on the desktop.
The problem is osx doesn't allow the script to access files in that drive. This is my script:

from os import path, getcwd, mkdir, walk
from shutil import copy2, copyfile

def klasorleri_gez(kynk, hdf):
    butun_icerik = walk(kynk, False)
    butun_icerik_liste = [i for i in butun_icerik]

    for i in range(len(butun_icerik_liste)):
        klasor = butun_icerik_liste[i]
        klasor_adresi = klasor[0]
        klasordeki_dosyalar = klasor[2]
        for dosya in klasordeki_dosyalar:
            dosya_adress = path.join(klasor_adresi, dosya)
            if '.jpg' in dosya_adress or '.png' in dosya_adress or '.jpeg' in dosya_adress:
                print('Kopyalaniyor: ', dosya_adress)
                copy2(dosya_adress, hdf)

if __name__ == "__main__":
    HEDEF_KLASOR_ISIM = 'hedef_klasor'
    KAYNAK_KLASOR_ISIM = "/Volumes/Time{}Machine/Backups.backupdb/Kerem's{}MacBook{}Pro{}(2)/".format(" ", " ", " ", " ")

    cwd = getcwd()
    hedef_klasor = path.join(cwd, HEDEF_KLASOR_ISIM)
    mkdir(hedef_klasor)
    klasorleri_gez(KAYNAK_KLASOR_ISIM, HEDEF_KLASOR_ISIM)

I have already tried to run it with sudo, sudo su and as a super user it's still not permitted. In this post and this page it is mentioned that you can run a command with arguments using /System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass, so I have run the following command:
Kerems-MacBook-Pro:Desktop base$ /System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass ls /Volumes/Time\ Machine/Backups.backupdb/Kerem's\ MacBook\ Pro\ \(2\)/
ls: : Operation not permitted

And still no luck! Does anybody know how to overcome that permission issue?
Thanks


text:
Q: Mix Entity Framework Linq with stored procedure Is it possible to mix in a single query a call with Linq to SQL and a stored procedure?
var query = from asset in this.Context.Assets
            let status =  this.Context.GetAssetAttributeLastStatusHistory(asset.idAsset)
            select new { asset, status };

Something like this, where GetAssetAttributeLastStatusHistory is a function import mapped to a stored procedure.
I want to to this in SQL and not in memory. In memory I could to a for each asset.
I need to perform pagination and filtering and it performs better if the query executes in the SQL Server.
EDIT:
This code generates an exception.
Yes I did. I get an exception. LINQ to Entities does not recognize the method 'System.Data.Objects.ObjectResult.. GetAssetAttributeLastStatusHistory(System.Nullable1[System.Guid])' method, and this method cannot be translated into a store expression.
From what I know this occurs because the Framework cannot convert that expression to an SQL Expression.
EDIT2:
It seems this is not possible. It isn't possible in RAW SQL and neither with LINQ.
Thanks for your input.

A: Give it a try, let me know if my answer is correct or not.
var query = from asset in this.Context.Assets
            join status
            this.Context.GetAssetAttributeLastStatusHistory(asset.idAsset)
            on asset.Id equals status.Id into g
            from g.DefaultIfEmpty()
            select new { asset, status };

A: As Ralph Shillington said.
It is not possible to mix EntityFramework Linq with calls to sprocs.


text:
Q: Can't refresh ListView on Android. notifyDataSetChanged() isn't working I'm trying to create a simple random number generator and everything works well, instead of updating the ListView when I generate new numbers. Array, Adapter and ListView are connected properly, cause if values are added to the array before connecting it to adapter, ListView shows them correctly. I tried different ways to clear the adapter etc., but it just make app crash. I know that before (I haven't used Kotlin for a couple of months) everything worked well when I added only adapter.notifyDataSetChanged().
I wish someone will find out what's going on.
MainActivity.kt
package com.example.randomnumber

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.*
import kotlin.random.Random
import kotlin.random.nextInt

class MainActivity : AppCompatActivity() {

    lateinit var fromTextEdit : EditText
    lateinit var toTextEdit : EditText
    lateinit var amountTextEdit : EditText
    lateinit var generatedListView: ListView
    lateinit var generateButton : Button

    var generatedArray : ArrayList<Int> = ArrayList()

    lateinit public var arrayAdapter : ArrayAdapter<Int>

    fun clickGenerate (view : View) {

        Log.i("generateButton", "Button clicked")

        generatedArray.clear()

        if (fromTextEdit.text.toString() != "" && toTextEdit.text.toString() != "" && amountTextEdit.text.toString() != "") {

            var amount = Integer.parseInt(amountTextEdit.text.toString())

            if (Integer.parseInt(fromTextEdit.text.toString()) < Integer.parseInt(toTextEdit.text.toString())) {
                Log.i("From", Integer.parseInt(fromTextEdit.text.toString()).toString())
                Log.i("To", Integer.parseInt(toTextEdit.text.toString()).toString())
                for (i in 0 until amount) {
                    generatedArray.add(
                        Random.nextInt(
                            Integer.parseInt(fromTextEdit.text.toString()),
                            Integer.parseInt(toTextEdit.text.toString()) + 1
                        )
                    )
                }
            } else {
                Toast.makeText(this, "Incorrect values", Toast.LENGTH_LONG).show()
            }
        } else {
            Toast.makeText(this, "Enter all values", Toast.LENGTH_SHORT).show()
        }

        for (i in generatedArray) {
            Log.i("Generated", i.toString())
        }

        arrayAdapter.notifyDataSetChanged()

    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        fromTextEdit = findViewById(R.id.fromEditText)
        toTextEdit = findViewById(R.id.toEditText)
        amountTextEdit = findViewById(R.id.amountEditText)
        generatedListView = findViewById(R.id.generatedListView)
        generateButton = findViewById(R.id.generateButton)

        generatedArray.add(5)
        generatedArray.add(5)
        generatedArray.add(5)
        generatedArray.add(5)
        generatedArray.add(5)
        generatedArray.add(5)

        arrayAdapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, generatedArray.toList())

        generatedListView.adapter = arrayAdapter

    }
}


text:
Q: Юнит тест это конструкция try catch? Вот это юнит тест?
try
        {
            //фокусируемся на окне (внутреннем)
            //     SetForegroundWindow(childWindow);
            //эмулируем нажатие клавиши "Вниз"
            SendKeys.SendWait("{DOWN}");
            //эмулируем нажатие клавиши "Enter"
            SendKeys.SendWait("~");
            SendKeys.SendWait("Привет.");

            //отправляем юзерам (всем)
            SendKeys.SendWait("{TAB}");
            SendKeys.SendWait("{DOWN 3}");
            SendKeys.SendWait("+{END}");
            SendKeys.SendWait("~");
        }
        catch (Exception exc)
        {
            MessageBox.Show(exc.Message);
        }

A: Нет, юнит тест это что-то вроде этого:
//пример функции, которую нужно протестировать
public int Multiple(int a, int b)
{
   return a*b;
}

//сам тест
[Test]
public void TestMultiple()
{
   int a = 5;
   int b = 6;
   int multiple = SomeClass.Multiple(a, b);
   int checkmultiple = 0;
   for (int i = 0; i < b; i++)
   {
      checkmultiple += a;
   }
   Assert.AreEqual(multiple, checkmultiple);
}

При выполнении Assert.AreEqual мы получим результат, который будет указывать на то, равны ли две переменные multiple и checkmultiple.
Та сущность, которую вы тестируете - к ней может быть несколько тестов, не обязательно только одна, а в одном тесте тоже может быть несколько Assert'ов.
Помимо AreEqual - есть и другие методы Assert для тестирования, например проверка на true/false, проверка с отрицанием, проверка на ошибку, проверка на тип, проверка на null, и другие...
Сам Assert тоже не единственный класс для тестирования.
Чем это полезно - как самый простой пример: написали метод, написали тест, прогнали тест - всё ок. Потом надо поменять тестируемый метод, внести изменения в код, прогоняете снова тесты, и тест уже может показать что вылазят ошибки, и там уже надо смотреть что делать дальше в зависимости от контекста.


text:
Q: Why io.TeeReader provide nil object value? I'm trying to run next chunk of go code to make a unique file name based on its hash and upload file to aws s3 bucket:
func PutImageToStore(f *bytes.Buffer) error {
    hasher := md5.New()
    io.TeeReader(f, hasher)
    m5 := hex.EncodeToString(hasher.Sum(nil))
    uploader := manager.NewUploader(awsS3Client)
    // put object to storage:
    result, err := uploader.Upload(context.TODO(), &s3.PutObjectInput{
            Bucket: &myS3bucket,
        Key:    &m5,
        Body:   f,
    })
    return err
}

where awsS3client and myS3bucket are defined globally and f is an upload object, i.e earlier:
file, _, _  := r.FormFile("myimage")
io.Copy(f, file)

As a result of
PutImageToStore(f)

I always get Key value (i.e. &m5) equal "d41d8cd98f00b204e9800998ecf8427e" which as I understand is a hash of nil.
The aws s3 upload is correct, the only issue is with the uploaded object name.
When I change the line
io.TeeReader(f, hasher)

to
io.Copy(hasher, f)

I get correct object name, but the object itself get corrupted and has 0 (zero) bytes.
So why I always get such a narrowed result for an object name?
What is a difference among io.Copy() and io.TeeReader in this case?
I looked at this example (What is the difference between io.TeeRearder and io.Copy?), but still do not understand my case.

A: You need to capture the io.Reader returned by io.TeeReader:
r := io.TeeReader(f, hasher)

then when you read all of r's content, it will get written also to the hasher, so:
body, err := io.ReadAll(r)

and body will contain all the bytes of the file.

You can achieve the same without an io.TeeReader since you need the whole body anyway:
body, err := io.ReadAll(f) // check err

_, err = io.Copy(hasher, bytes.Newsreader(body)) // check err


text:
Q: Динамические related_name. Как узнать? У меня есть модель-родитель:
class INote(models.Model):

    Content = models.TextField(verbose_name=u'содержание')
    Time = models.DateTimeField(auto_now=True, verbose_name=u'Время')
    From = models.ForeignKey(Profile, related_name = '%(class)s')

И потомок:
class Article(INote):
    pass

Я наследуюсь через мультитэйбл (не абстрактно).
При этом я хочу сохранить related_name для потомка, чтобы мог к нему обращаться из связанной модели согласно документации.
Согласно документации related_name для Article должно принять вид articles, но по факту работает только inote. Во всех остальных случаях получаю has not attribute. Вероятно, потому, что модель родителя не является абстрактной. Возможно ли как-либо динамически назначать related_name для потомков неабстрактной модели?


text:
Q: Why I can not output paths of the maze?Who can tell me?Please about data structures,why i can't output paths of the maze?  I use the stack to storage the information of the  current position.Read map of maze through a text file,if the position cant't pass
will be marker by "#",it is a wall.the way marker by "+". written in C++.
PS:My English is very poor.
//stack.h
#ifndef _STACK_H_
#define _STACK_H_
#include<iostream>
#include<stdlib.h>

const int SIZE = 81;
using namespace std;

typedef struct
{
    int x;
    int y;
}PosType;
typedef struct SElemType{
    int ord;//steps
    PosType seat;//coordinate
    int di;//direction
}SElemType;
typedef struct SqStack{
    SElemType *base;
    SElemType *top;
    int StackSize;
}SqStack;

void Init_S(SqStack &S)
{
    S.base = new SElemType[SIZE];
    if(!S.base)
        exit(EXIT_FAILURE);
    S.top = S.base;
    S.StackSize = SIZE;
}
bool StackEmpty(SqStack S)
{
    if(S.top = S.base)
        return true;
    return false;
}
void Push(SqStack &S,SElemType e)
{
    SElemType *newbase;
    if(S.top-S.base>=S.StackSize)
    {
        newbase = new SElemType[S.StackSize*2];
        if(!S.base)
            exit(EXIT_FAILURE);
        for(int i(0);i<S.top-S.base;i++)
            *(newbase+i) = *(S.base+i);
        delete[]S.base;
        S.base = newbase;
        S.top = S.base+S.StackSize;
        S.StackSize *= 2;
    }
    *(S.top)++ = e;
}

void Pop(SqStack &S,SElemType e)
{
    if(StackEmpty(S))
        cout<<"empty stack!\n";
    else
        e = *(--S.top);
}
#endif

//maze.cpp
#include<iostream>
#include<cstdlib>
#include<fstream>
#include"stack.h"
using namespace std;
const int m = 10;
const int n = 10;
typedef char MazeG[m][n];

void Show_MG(MazeG MG)
{

    for(int i(0);i<m;i++)
    {
        for(int j(0);j<n;j++)
        {
            cout<<MG[i][j];
        }
        cout<<"\t\n";
    }
}
PosType Next(PosType &pos,int di)
{
    PosType repos;
    switch(di)
    {
    case 0://north
        repos.x = pos.x-1;
        repos.y = pos.y;
        break;
    case 1://east
        repos.x = pos.x;
        repos.y = pos.y+1;
        break;
    case 2://south
        repos.x = pos.x+1;
        repos.y = pos.y;
        break;
    case 3://west
        repos.x = pos.x;
        repos.y = pos.y-1;
        break;
    default:
        break;
    }
    return repos;
}

int MazePath(MazeG &MG,PosType begin,PosType end)
{
    PosType curpos = begin;
    SqStack S;
    Init_S(S);
    SElemType e;
    e.ord = 0;
    do{
        if(MG[curpos.x][curpos.y]=='*')
        {
            MG[curpos.x][curpos.y] = '+';
            e.seat = curpos;
            e.di = 0;
            e.ord++;
            Push(S,e);
            if(curpos.x==end.x&&curpos.y==end.y)
            {
                cout<<"此迷宫的一条路径如下:(+标记为路径)\n";//the path of maze:
                cout<<"走了"<<e.di<<"步到达出口\n";//The number of steps walked
                Show_MG(MG);
                return 0;
            }
            else
                curpos = Next(curpos,e.di);
        }
        else
            if(!StackEmpty(S))
            {
                Pop(S,e);
                e.ord--;
                while(e.di==3&&!StackEmpty(S))
                {
                    MG[curpos.x][curpos.y] = '#';
                    Pop(S,e);
                    e.ord--;
                }
                if(e.di<3)
                {
                    e.di++;
                    Push(S,e);
                    e.ord++;
                    curpos = Next(curpos,e.di);
                }
            }
    }while(!StackEmpty(S));
    cout<<"此迷宫没有入口到出口的路径!\n";//no path of the maze
    //return -1;
}

int main()
{
    MazeG MG;
    PosType begin,end;
    begin.x = 1; begin.y = 1;
    end.x = 8; end.y = 8;
    ifstream fin;
    fin.open("file.txt");
    if(!fin.is_open())
    {
        cout<<"erorr file!!\n";
        exit(EXIT_FAILURE);
    }
    if(fin.good())
    {
        for(int i(0);i<m;i++)
            for(int j(0);j<n;j++)
                fin>>MG[i][j];
    }
    cout<<"迷宫图为:(*代表能通过)\n";//map of maze:('*' is means through)
    Show_MG(MG);
    cout<<begin.x<<begin.y<<end.x<<end.y<<endl;
    fin.close();
    MazePath(MG,begin,end);
    return 0;
}

A: This is wrong
bool StackEmpty(SqStack S)
{
    if(S.top = S.base)
        return true;
    return false;
}

It should be this
bool StackEmpty(SqStack S)
{
    if(S.top == S.base) // == not =
        return true;
    return false;
}

Use == for equality not =.

A: Now,I understand my the error of code is that I mismatch the data will be stored by stack.
I have changed my code,that's right.
//stack.h
SElemType Gettop(SqStack S)
{
     if(!Empty_S(S))
       return *(S.top-1);
}
//maze_path.cpp
    do{
            if(MG[curpos.x][curpos.y]=='*')
            {
                MG[curpos.x][curpos.y] = '+';
                e.seat = curpos;
                e.di = 0;
                e.ord++;
                Push(S,e);
                if(curpos.x==end.x&&curpos.y==end.y)
                {
                    cout<<"此迷宫的一条路径如下:(+标记为路径)\n";//the path of maze:
                    cout<<"走了"<<e.di<<"步到达出口\n";//The number of steps walked
                    Show_MG(MG);
                    return 0;
                }
                else
                    curpos = Next(curpos,e.di);
            }
            else
                if(!StackEmpty(S))
                {

                    if(e.di<3)
                    {
                        e.ord++;
                        curpos = Next(curpos,e.di);
                    }
                    else
                    {
                        MG[curpos.x][curpos.y] = '#';
                        Pop(S,e);
                        e = Gettop(S);
                    }
                }
        }while(!StackEmpty(S));


text:
Q: Connecting to MongoDb with SSL from JAVA app I have a MongoDb instance running(single instance) with SSL enabled. I am able to connect to it with RoboMongo where on SSL tab I provide the following :
CA File : /path to my certificate/testCA.pem
PEM certificate/key: /path to my key/testKey.pem

Which successfully connects. Now I'm trying to connect to the same mondodb from java app. I imported the testCA.pem into cacerts using the following command:
keytool -import -keystore cacerts -file testCA.pem -storepass changeit

and I can see a new entry added to the store. Tried to add the other key into it and it says invalid certificate. On the Java app I set system property as following:
System.setProperty ("javax.net.ssl.trustStore","C:\\Program Files\\Java\\jre1.8.0_91\\lib\\security\\cacerts");
System.setProperty ("javax.net.ssl.trustStorePassword","changeit");

and I'm getting the following error:
org.springframework.dao.DataAccessResourceFailureException: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=test.mongo.com:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.io.EOFException}}]; nested exception is com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=test.mongo.com:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.io.EOFException}}]
    at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:75)
    at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2075)
    at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1918)

What am I missing here, thanks in advance!

A: In addition to importing the CAFile.pem with the command:
(navigate to your java_home/jre/lib/security to run the commands)
1. keytool -import -trustcacerts -file testCA.pem -keystore cacerts -storepass "changeit"
I also had to export the key.pem into a pkcs12 format(default password 'changeit')
2. openssl pkcs12 -export -out mongodb.pkcs12 -in testKey.pem
and in addition to setting system property trustStore/password, keyStore/password should also be set:
System.setProperty ("javax.net.ssl.trustStore",JAVA_HOME + "\\lib\\security\\cacerts");
System.setProperty ("javax.net.ssl.trustStorePassword","changeit");
System.setProperty ("javax.net.ssl.keyStore",JAVA_HOME + "\\lib\\security\\mongodb.pkcs12");
System.setProperty ("javax.net.ssl.keyStorePassword","changeit");

A: Both the approaches mentioned below usually suggested on forums will 'work' but are not secure as they disable the host-name verification essentially negating the SSL. Hence they are not recommended especially if your code would be deployed on production:
// 1. For any HTTPS connection
    javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
        new javax.net.ssl.HostnameVerifier(){
            public boolean verify(String hostname,
                javax.net.ssl.SSLSession sslSession) {
                    if(hostname.equals("<hostname>")) {
                        return true;
                    }
                }
            });

// 2. MongoDB SSL specific
MongoClientOptions.builder().sslEnabled(true).sslInvalidHostNameAllowed(true).build();

Refer: https://wiki.openssl.org/index.php/Hostname_validation

To fix this, you'll need a certificate containing the DNS of the server as a Subject Alternative Name entry, which you can import to your JDK cacerts
Alternatively, if you want establish SSL at the application level, I'd recommend creating a SSLContext for that particular connection instead of using System.setProperty() for setting key-stores/trust-stores. This would help in avoiding conflicts if your application connects to different external services who have different SSL implementations.

Specifically for MongoDB, you would just need to append ?ssl=true at the end of the MongoDBURI after the above mentioned step. If it still doesn't work, I'd recommend updating your JDK version as per https://jira.mongodb.org/browse/JAVA-2184
Hope this helps

A: You need to configure the monog db driver to use SSL. You can do this with configuring it manually in a @Configuration class.
    public @Bean MongoClient mongo()  {
        MongoClientOptions.Builder options = MongoClientOptions.builder().sslEnabled(true);
        // add more options to the builder with your config
        MongoClient mongoClient = new MongoClient("localhost", options.build());
        return mongoClient;
    }

A: If you are using RAD with WAS local servers, you have to add the pem file to the java VM for that server.
So if you have WAS installed to X:\IBM\WASx, X:\IBM\WASx\java_17\jre is the directory that you would navigate and then execute the keytool import there.   Hope this helps others.

A: Please check below code for MongoDB Java Driver 4.x and MongoDB 3.x
Where you have to configure spring.data.mongodb.xxxx properties as per your MongoDB.
import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.mongodb.MongoClientSettings;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;

@Configuration
public class MongoClientConfig {

    @Value("${spring.data.mongodb.username}")
    private String user;

    @Value("${spring.data.mongodb.password}")
    private char[] password;

    @Value("${spring.data.mongodb.host}")
    private String host;

    @Value("${spring.data.mongodb.port}")
    private int port;

    @Value("${spring.data.mongodb.database}")
    private String database;

    @Bean
    public MongoClient mongo() {
        List<ServerAddress> hosts = Arrays.asList(new ServerAddress(host, port));
        MongoCredential credential = MongoCredential.createCredential(user, database, password);

        MongoClientSettings settings = MongoClientSettings.builder().credential(credential)
                .applyToSslSettings(builder -> builder.enabled(true))
                .applyToClusterSettings(builder -> builder.hosts(hosts)).build();
        MongoClient mongoClient = MongoClients.create(settings);
        System.out.println("====================================================================");
        System.out.println("========= MongoClientConfig: " + mongoClient.toString() + "=========");
        System.out.println("====================================================================");
        return mongoClient;
    }
}

A: *

*I download a openssl program from here
and install it

*i open a cmd in the foler of my Pem file certiface.pem
and i run a command :

DIRECTION\OpenSSL\bin\openssl pkcs12 -export -out keystore.pkcs12
-in certiface.pem

on password you put what you want example: blabla
should create a file name   keystore.pkcs12

*run the command on cmd

keytool -importkeystore -srckeystore keystore.pkcs12 -srcstoretype
PKCS12 -destkeystore keystore.jks -deststoretype JKS

on passwords i put  blabla
check that created file keystore.jks

*now my code
      System.setProperty("javax.net.ssl.keyStore", keystore.jks);
      System.setProperty("javax.net.ssl.keyStorePassword", "blabla");
      MongoClient mongoClient = MongoClients.create("mongodb+srv://YOURLINK.mongodb.net/?authSource=%24external&authMechanism=MONGODB-X509&retryWrites=true&w=majority");
      database = mongoClient.getDatabase("DatabaseName");

A: Here is a complete implementation of how to connect to MongoDB/DocDB over ssl using mongoUri and sslCertificates.
In this implementation, the application itself creates the keystore file and imports the certificate into it. So, there is no need to do any server side changes (in most cases).
https://github.com/BarathArivazhagan/spring-boot-aws-documentdb

A: As Redlab mentioned in the  code, it can be disabled for restricting ssl validation. Specially this case  comes on local setup. No extra effort required to do.
public @Bean MongoClient mongo()  {
    MongoClientOptions.Builder options = MongoClientOptions.builder().sslEnabled(false);
    // add more options to the builder with your config
    MongoClient mongoClient = new MongoClient("localhost", options.build());
    return mongoClient;
}

just I modified--
sslEnabled(true) ===> sslEnabled(false).


text:
Q: Kotlin: how to return running service instance in binder? I have working Java code for Service and trying to convert it to Kotlin.
class MyService : Service() {

    companion object MyBinder : Binder() {
        fun getService() : MyService? {
            return MyService::class.objectInstance
        }
    }

    // service implementation

}

The problem is that in activities getService() always returns null. I am sure the service is started before, I see it in logcat. I suggest this auto generated line from Java code should be different but I cannot find the solution:
return MyService::class.objectInstance

In Java code it is:
return MyService.this

A: Below code will help your
class MyService : Service() {

    inner class MyBinder : Binder() {
        fun getService() : MyService? {
            return this@MyService
        }
    }

    // service implementation

}

More info regarding this expression in Kotlin
This Expression

A: This is the short way doing it (including additionally onBind())
class MyService : Service() {

    override fun onBind(intent: Intent) = LocalBinder()

    inner class LocalBinder : Binder() {
        fun getService() = this@SensorService
    }
}


text:
Q: Internet Explorer 11 - Difficulties in Selecting Text I'm running my .NET application in Internet Explorer(Version 11) in compatibility mode. I'm using grid views to display content on my ASPX page. When I open the page and tried to select some cell or row from grid views, it is not selecting properly.
It is so difficult or impossible to select exactly the text you wanted to copy into an e-mail or a document. When you dragged the mouse to select text, you often selected adjacent paragraphs or columns also, even though you didn't want them.
Working fine with Earlier edition(IE 10) and Firefox and Chrome. I have to fix/find out why It is not working in IE 11.
Please let me know how to fix this one.

A: I think this is a "feature" in IE11 and there's no way to fix it in the code.  IE11 text selection seems to struggle once it hits any HTML structures (spans, divs).
There is a work around for users but it's a bit painful.  Press F7 to turn on caret mode, then you can select one item (double click) and then, holding down the shift key, use the cursor keys to highlight a selection.
If you have a lot of users, it would be better to implement an "Export to Excel" or "Copy to Clipboard" function than rely on text selections to get to the data.

A: IE also allows for entire field selection using CTRL+Click (Left Mouse Click).
Edge, nor Chrome allows for this superior selection technique.


text:
Q: Email clients access my webapp with changed / strange URLs For a few years now I observe a strange behaviour, most likely triggered by enduser's email clients using my webapp (Ruby on Rails system, doesn't matter tho).
I am running a mid sized business and send out thousands of mails to my customers each month who buy leads from me.
The emails include two links, one to buy the lead and the other to give feedback. There is a dynamic part in both URLs which is a UUID, example:
offer/968ec0c1-e105-4c70-95b2-fd0c799b58f3
and
feedback/968ec0c1-e105-4c70-95b2-fd0c799b58f3
Every now and then, my webapp gets accessed at the same time on both links (which makes me confident it is not the user since it is the very same second they get accessed) but with different dynamic parts in the url, so i see in my logs
offer/NGVjZjA0YT
and
feedback/NGVjZjA0YT
It is always a random string with a length of 10 chars.
So this is not a big deal since it happens only 1-2 times per week and as far as I can tell no user is really affected by this, but still I wonder what's behind this. Did any of you experience a similar thing?
Maybe an email client wants to crawl / load a preview, seeing an uuid pattern in the url and changes it because whatever?!
I disabled link click tracking in the email sending provider (sendgrid), just as a side note. So they won't / shouldn't replace the email links. Also experienced this when sending links via AWS SES.
Im just curious. Any ideas or experiences? Thanks in advance & have a great day!


text:
Q: Visualising strace output Is there a simple tool, or maybe a method to turn strace output into something that can be visualised or otherwise easier to sift through?  I am having to figure out where an application is going wrong, but stracing it produces massive amounts of data.  Trying to trace what this application and its threads are doing (or trying to do) on a larger scale is proving to be very difficult to do reading every system call.
I have no budget for anything, and we are a pure Linux shop.

A: If your problem is a network one, you could try to limit the strace output to the network related syscalls with a
strace -e trace=network your_program

A: Yes, use -c parameter to visualise count time, calls, and errors for each syscall and report summary in form of table, e.g.
$ strace -c -fp $(pgrep -n php)
Process 11208 attached
^CProcess 11208 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 83.78    0.112292          57      1953       152 stat
  7.80    0.010454          56       188           lstat
  7.79    0.010439          28       376           access
  0.44    0.000584           0      5342        32 recvfrom
  0.15    0.000203           0      3985           sendto
  0.04    0.000052           0     27184           gettimeofday
  0.00    0.000000           0         6           write
  0.00    0.000000           0      3888           poll
------ ----------- ----------- --------- --------- ----------------
100.00    0.134024                 42922       184 total

This will identify the problem without having analysing large amount of data.
Another way is to filter by specific syscalls (such as recvfrom/sendto) to visualize received data and sent, example debugging PHP process:
strace -e recvfrom,sendto -fp $(pgrep -n php) -s 1000 2>&1 | while read -r line; do
  printf "%b" $line;
done | strings

Related: How to parse strace in shell into plain text?


text:
Q: Custom commands for URLs I would like to create a latex command that adds blue color, underlines it and makes it into true-type font for URLs like this:
    \url{stackoverflow.com}

However, when using the command \newcommand it doesn't work when I do something like this:
    \newcommand{\url}{\color{blue}\texttt\underline}

Is there a way of still creating my \url command in a similar way as in the code described above?


text:
Q: Reg-Exp for 0,0.0 or 100.20 or 0.99 or 9999.99 I want to be able to allow 0 or 0.0 or 100.20 or 1000 or 0.99
I want to enter 4 digit+decimal point+2 digit
Where decimal & 2 digit are not mandatory & out of 4 digits I want to allow 1 digit too
I want the exact regex to match this.

A: /\d{1,4}(\.(\d{1,2}))?/

This says "one to four digits optionally followed by a . and one or two digits".
Surround that with \b if you want to match (and extract in the following) a word within a string:
/\b(\d{1,4}(\.(\d{1,2}))?)\b/

If you want the string to match strictly that pattern and nothing else (i.e. nothing before or after), you can anchor it with ^ and $:
/^\d{1,4}(\.(\d{1,2}))?$/


text:
Q: Solve $a z - b \bar{z}^2 - c z^2 \bar{z} = 0$ How to solve the equation
$$ a z - b \bar{z}^2 - c  z^2 \bar{z} = 0 $$
for $z \in \mathbb{C}$ where $a, b, c \in \mathbb{C}$ are known coeffients.
I want to solve for z.
I started with substituting $z = r \, \mathrm{e}^{i \theta}$ to arrive at
$$ a - b \, r \, \mathrm{e}^{-i 3 \theta} - c \, r^2 = 0 $$
but I'm not sure how to continue from here.

A: Hint: using that $\,z\bar z = |z|^2\,$ the equation can be written as:
$$
\begin{align}
a z - b \bar{z}^2 - c  z |z|^2 = 0 \\
\iff\;\; \left(a - c|z|^2\right) z = b \bar z^2 \tag{1}
\end{align}
$$
Taking conjugates on both sides:
$$
\left(\bar a - \bar c|z|^2\right) \bar z = \bar b z^2 \tag{2}
$$
Multiplying $(1) \cdot (2)\,$:
$$
\left(a - c|z|^2\right) \left(\bar a - \bar c|z|^2\right) |z|^2 = |b|^2 |z|^4 \\
\iff\;\;|z|^2 \cdot \left(|c|^2|z|^4-\left(|b|^2+a \bar c + \bar a c\right)|z|^2+|a|^2\right) = 0
$$
The latter gives the obvious root $\,z=0\,$, and the second factor is a biquadratic in $\,|z|\,$ with real coefficients. Any real positive roots can then be substituted back in $(1)$ and solved for $z$.


text:
Q: Recovering deleted Cassandra DB files I screwed up massively, and accidentally deleted some SSTable (.db) files from a Cassandra data directory.  Literal "rm -rf" style deletion.  I've been trying to recover them using foremost, but I need to know the header and footer file signatures for SSTables in order to configure foremost to do the job.
Does anyone know the header/footer file signatures?
Or, can someone give me some ideas on how I can go about recovering these?

A: Are they in your snapshots directory? Cassandra creates hardlinks to sstables in the snapshots directory precisely for this kind of scenario.