text:
Q: How can I create a curvy transparent circle inside a div I need to create a curvy footer. the background has to be like the picture below, but I couldn't create that transparent circular hole in my div. I tried to use the svg as the background but in bigger screens it stretches and doesn't look good.
is it any possible way to create it with pseudo elements? or any other solution?

my current implementation looks like this picture. I could make the upper curves with ::before and ::after.

here's my code for this component:

    <img *ngIf="(currentMenu === MenuItems.Home || currentMenu === MenuItems.Home1)" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAyMSAyMyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjEgMjM7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOiMzNjQ4RDE7fQ0KPC9zdHlsZT4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMi45LDE1LjN2Ny4ySDguMXYtNy4yYzAsMCwwLTAuMSwwLTAuMWMwLDAsMC0wLjEsMC0wLjFjMCwwLDAsMCwwLjEsMGMwLDAsMC4xLDAsMC4xLDBoNC40DQoJYzAuMSwwLDAuMSwwLDAuMiwwLjFDMTIuOSwxNS4yLDEyLjksMTUuMiwxMi45LDE1LjN6Ii8+DQo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMjAuNSw5LjV2MTBjMCwwLjg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cyI+DQoJLnN0MHtmaWxsOm5vbmU7c3Ryb2tlOiNDNEM0QzQ7c3Ryb2tlLXdpZHRoOjEuNTtzdHJva2UtbGluZWNhcDpyb3VuZDtzdHJva2UtbGluZWpvaW46cm91bmQ7fQ0KPC9zdHlsZT4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xLjgsNy40TDEwLDFsOC4yLDYuNGMwLjIsMC4yLDAuNCwwLjQsMC42LDAuN0MxOC45LDguNCwxOSw4LjcsMTksOXYxMGMwLDAuNS0wLjIsMS0wLjYsMS40DQoJQzE4LjEsMjAuOCwxNy41LDIxLDE3LDIxSDNjLTAuNSwwLTEtMC4yLTEuNC0wLjZDMS4yLDIwLDEsMTkuNSwxLDE5VjljMC0wLjMsMC4xLTAuNiwwLjItMC45QzEuMyw3LjgsMS41LDcuNiwxLjgsNy40TDEuOCw3LjR6Ii8+DQo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNi42LDIwLjd2LTYuOWMwLTAuMywwLjEtMC42LDAuNC0wLjljMC4yLTAuMiwwLjUtMC40LDAuOS0wLjRoNC40YzAuMiwwLDAuMywwLDAuNSwwLjENCgljMC4xLDAuMSwwLjMsMC4yLDAuNCwwLjNjMC4xLDAuMSwwLjIsMC4yLDAuMywwLjRjMC4xLDAuMSwwLjEsMC4zLDAuMSwwLjV2Ni45Ii8+DQo8L3N2Zz4NCg==" alt="">

  خانه

    <img *ngIf="currentMenu !== MenuItems.MyQr" src="data:image/svg+xml;base64,[encoded data, 4936 characters]" alt="">

  QR من

    اسکن

    <img *ngIf="currentMenu === MenuItems.Transactions" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmV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EtMS41bDAuMS0wLjFjMC44LTAuNywxLjgtMS4xLDIuOS0xLjFoNS43YzEuMSwwLDIuMSwwLjQsMi45LDEuMWMwLjUsMC40LDAuOSwxLDEuMSwxLjYNCgljMS0xLjEsMS44LTIuNSwyLjItNHMwLjQtMywwLjEtNC41Yy0wLjMtMS41LTEtMi45LTItNGMtMS0xLjItMi4zLTIuMS0zLjctMi42cy0zLTAuOC00LjUtMC42Yy0xLjUsMC4yLTMsMC43LTQuMiwxLjZzLTIuMywyLTMsMy40DQoJQzIuNSw4LjYsMi4xLDEwLjEsMi4xLDExLjZ6IE02LjcsOS4yYzAtMSwwLjMtMS45LDAuOC0yLjdDOCw1LjcsOC44LDUuMSw5LjcsNC44YzAuOS0wLjQsMS45LTAuNSwyLjgtMC4zYzAuOSwwLjIsMS44LDAuNiwyLjUsMS4zDQoJYzAuNywwLjcsMS4xLDEuNSwxLjMsMi41YzAuMiwwLjksMC4xLDEuOS0wLjMsMi44Yy0wLjQsMC45LTEsMS42LTEuOCwyLjJjLTAuOCwwLjUtMS43LDAuOC0yLjcsMC44Yy0xLjMsMC0yLjUtMC41LTMuNC0xLjQNCglDNy4yLDExLjcsNi43LDEwLjUsNi43LDkuMnogTTguNCw5LjJjMCwwLjYsMC4yLDEuMiwwLjUsMS43YzAuMywwLjUsMC44LDAuOSwxLjQsMS4yYzAuNiwwLjIsMS4yLDAuMywxLjgsMC4yDQoJYzAuNi0wLjEsMS4yLTAuNCwxLjYtMC45YzAuNC0wLjQsMC43LTEsMC45LTEuNmMwLjEtMC42LDAuMS0xLjItMC4yLTEuOGMtMC4yLTAuNi0wLjYtMS4xLTEuMi0xLjRjLTAuNS0wLjMtMS4xLTAuNS0xLjctMC41DQoJYy0wLjgsMC0xLjYsMC4zLTIuMiwwLjlTOC40LDguNCw4LjQsOS4yTDguNCw5LjJ6Ii8+DQo8L3N2Zz4NCg==" alt="">

    پروفایل

.home-page-footer {
  position: relative;
  filter: drop-shadow(0px 0px 10px rgba(0, 0, 0, 0.078));
  background-color: transparent;
  font-family: $default_font_family;
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10+ and Edge */
  user-select: none; /* Standard syntax */
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  height: 54px;
  box-sizing: border-box;
  position: fixed;
  bottom: -1px;
  width: 100%;
  max-width: 850px;
  &::before{
    content: '';
    position: absolute;
    top: -15px;
    right: 0;
    width: calc( 40% + (10% - 25px));;
    height: 20px;
    background-color: white;
    border-top-left-radius: 20px;
    border-top-right-radius: 65%;
  }
  &::after{
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    width: calc( 40% + (10% - 25px));
    height: 20px;
    background-color: white;
    border-top-right-radius: 20px;
    border-top-left-radius: 65%;
  }

  span {
      color: var(--color10);
      font-size: 12px;
      font-weight: 500;
    }

    .footer-item {
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
      justify-content: flex-end;
      position: relative;
      background-color:white;
      box-sizing: border-box;
      padding-bottom: 5px;
      .item-icon{
        height: 20px;
        width: 20px;
        margin-bottom: 2px;
        background-color: transparent;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
        img{
          height: 20px;
        }
        transition: all 1s ease;
        &.scan-qr{
          position: relative;
          width: 50px;
          height: 50px;
          border-radius: 50%;
          background-color: var(--color01);
          box-shadow: 0px 1px 10px rgba(16, 12, 183, 0.3);
          margin-top: -20px;
          z-index: 1;
        }
      }
    }
}

.footer-item.scan{
  background-color: transparent !important;
  position: relative;
  &::before{
    content: '';
    position: absolute;
    background-color: white;
    width: 50%;
    height: calc(100% - 5px);
    bottom: 0;
    right: 0;
    z-index: -1;
  }
  &::after{
    content: '';
    position: absolute;
    background-color: white;
    width: 50%;
    height: calc(100% - 5px);
    bottom: 0;
    left: 0;
    z-index: -1;
  }
}

.footer-badge{
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: var(--color12) ;
  top: -10px;
  right: -8px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  padding: 2px;
  font-size: 10px;
}

.lfooter{
  padding: 0 0 0 0 !important;
}


text:
Q: asp.net link button not working properly asp.net link button not working properly
<%@ Page Title="" Language="C#" MasterPageFile="~/Ui/MasterPage_UI.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Ui_Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

I am a returning customer

E-Mail Address:

    <asp:TextBox name="email" runat="server" ID="email"
    ValidationGroup="email" ></asp:TextBox>

    Password:

    <asp:TextBox  ID="pwd" runat="server" name="password" TextMode="Password"></asp:TextBox>

    <asp:LinkButton ID="Submit" runat="server" CssClass="button" Text="Login" onclick="Submit_Click" ValidationGroup="email" />

</asp:Content>

the dynamicly generated menu's aspx code is-->
`

Home

`

and thye cs code is-->
`public void bindmenu()
    {
        HtmlGenericControl li;
        HtmlAnchor link;
        HtmlGenericControl div;
    //for main menu
    DataTable dt = new BALCate().GetCate();
    foreach (DataRow dr in dt.Rows)
    {
        int cateid = int.Parse(dr["cate_id"].ToString());
        String cate_name = dr["cate_name"].ToString();
        li = new HtmlGenericControl("li");
        link = new HtmlAnchor();
        link.InnerText = dr["cate_name"].ToString();
        link.HRef = "CateProducts.aspx?cate_id=" + cateid + "&" + "catename=" + cate_name;
        li.Controls.Add(link);

        //for submenu
        DataTable subcate = new BALCate().GetSubCate(cateid);
        if (subcate.Rows.Count > 0)
        {
            div = new HtmlGenericControl("div");
            div.Attributes.Add("class", "sub-menu column-1");
            HtmlGenericControl sul = new HtmlGenericControl("ul");

            foreach (DataRow sdr in subcate.Rows)
            {
                int subcateid = int.Parse(sdr["subcate_id"].ToString());
                String subcatename = sdr["subcate_name"].ToString();
                HtmlGenericControl sli = new HtmlGenericControl("li");
                HtmlAnchor slink = new HtmlAnchor();
                slink.InnerHtml = sdr["subcate_name"].ToString();
                sli.Controls.Add(slink);
                slink.HRef = "SubCateProducts.aspx?subcate_id=" + subcateid + "&" + "catename=" + cate_name + "&" + "subcatename=" + subcatename;
                sul.Controls.Add(sli);

                DataTable subsubcate = new BALCate().GetSubSubCate(subcateid);
                if (subsubcate.Rows.Count > 0)
                {
                    HtmlGenericControl subdiv = new HtmlGenericControl("div");
                    subdiv.Attributes.Add("class", "sub-menu");
                    HtmlGenericControl ssul = new HtmlGenericControl("ul");

                    foreach (DataRow ssdr in subsubcate.Rows)
                    {
                        int subsubcateid = int.Parse(ssdr["subsubcate_id"].ToString());
                        String subsubcatename = ssdr["subsubcate_name"].ToString();
                        HtmlGenericControl ssli = new HtmlGenericControl("li");
                        HtmlAnchor sslink = new HtmlAnchor();
                        sslink.HRef = "SubSubCateProducts.aspx?subsubcate_id=" + subsubcateid + "&" + "catename=" + cate_name + "&" + "subcatename=" + subcatename + "&" + "subsubcatename=" + subsubcatename;
                        sslink.InnerText = ssdr["subsubcate_name"].ToString();
                        ssli.Controls.Add(sslink);
                        ssul.Controls.Add(ssli);
                    }
                    subdiv.Controls.Add(ssul);
                    sli.Controls.Add(subdiv);
                }
            }
            div.Controls.Add(sul);
            li.Controls.Add(div);
        }
        nav.Controls.Add(li);
    }
}`

actually there is also a master page, which contains DYNAMIC MENU in which data(categories and subcategories) dynamicly loaded from the database at the time of the pageload.
but the iissue is that whenever i clicking on the link button , the menu doesnt retrieve the data from the database and appears blank with the remaining static part of it.

A: Add an onclick to the button to the method that does the data retrieving.
<asp:LinkButton ID="Submit" runat="server" CssClass="button" Text="Login"
ValidationGroup="email" onclick="MethodName" />

redpajama_set_name: RedPajamaStackExchange


text:
Q: Rolling a die 1000 times. Estimate the probability $ℙ( \prod^{1000}_{n=1} X_n ≤ z^{1000})$ for real $1 < z < 6$ Rolling a die 1000 times, denoting the outcome of roll by $X_n$.
Estimate the probability  $ℙ( \displaystyle\prod^{1000}_{n=1} X_n ≤ z^{1000})$
for real $1 < z < 6$
I've taken the natural log of both sides to change the product into a sum and I've subtracted $1000*[ln(X_n)]$ and divided by $\sqrt{1000*Var(ln(X_n))}$ on both sides so that it has standard normal distribution.
I was going to use the Central Limit Theorem but as $z$ is an unknown real I think the Law of Large Numbers would be more useful but I am unsure how to go about it.
I know that with a low $z$ the value will be closer to $0$ and a high $z$ it will be closer to $1$.
Any help would be greatly appreciated!

A: You are almost done. We have
\begin{align}
\Pr\left(\prod_{n=1}^{1000}X_n \leq z^{1000}\right) &= \Pr\left(\sum_{n=1}^{1000}\ln(X_n) \leq 1000\ln (z)\right) \\
&=\Pr\left(\frac{\left(\sum_{n=1}^{1000}\ln X_n - 1000\cdot\mathsf{E}(\ln X_1)\right)}{\sqrt{1000\cdot \mathsf{var}(\ln X_1)}}\leq \frac{\sqrt{1000}\cdot(\ln z - \mathsf{E}(\ln X_1))}{\sqrt{\mathsf{var}(\ln X_1)}}\right) \\
&\approx \Phi\left(\frac{\sqrt{1000}\cdot(\ln z - \mathsf{E}(\ln X_1))}{\sqrt{\mathsf{var}(\ln X_1)}}\right)
\end{align}


text:
Q: In Perl, how do I process multiple lines Say, I have a file that has the following lines with a "TIMESTAMP" "NAME":
10:00:00  Bob
11:00:00  Tom
11:00:20  Fred
11:00:40  George
12:00:00  Bill
I want to read this file, group the names that occur in each hour on a single line, then write the revised lines to a file, for example.
10:00:00 Bob
11:00:00 Tom, Fred, George
12:00:00 Bill

A: Read the file line by line in a block like this:
while(<>) {
    # ... do something with the line in $_
    # specifically, collect the hour and name
    # ignoring malformed lines
    if (/(\d\d):\d\d:\d\d\s+(\w+)/) {
        my $hour = $1;
        my $name = $2;
    }
}

and build a hash with the first bit by inserting the following in the inner if block
$people{$hour} = $people{$hour} . ", " . $name

Finally, outside the loop, print the hash:
while ( my ($time, $names) = each(%people) ) {
    print $time . ":00:00 " . $names ."\n";
}

(This is untested, but this is the basic approach I would take.)

A: In grouped_by_hour below, for each line from the filehandle, if it has a timestamp and a name, we push that name onto an array associated with the timestamp's hour, using sprintf to normalize the hour in case one timestamp is 03:04:05 and another is 3:9:18.
sub grouped_by_hour {
  my($fh) = @_;

  local $_;
  my %hour_names;

  while (<$fh>) {
    push @{ $hour_names{sprintf "%02d", $1} } => $2
      if /^(\d+):\d+:\d+\s+(.+?)\s*$/;
  }

  wantarray ? %hour_names : \%hour_names;
}

The normalized hours also allow us to sort with the default comparison. The code below places the input in the special DATA filehandle by having it after the __DATA__ token, but in real code, you might call grouped_by_hour $fh.
my %hour_names = grouped_by_hour \*DATA;
foreach my $hour (sort keys %hour_names) {
  print "$hour:00:00 ", join(", " => @{ $hour_names{$hour} }), "\n";
}

__DATA__
10:00:00 Bob
11:00:00 Tom
11:00:20 Fred
11:00:40 George
12:00:00 Bill

Output:
10:00:00 Bob
11:00:00 Tom, Fred, George
12:00:00 Bill

A: Given that, per comments on the original question, all entries for the same hour are contiguous and the file is too large to fit into memory, I would dispense with the hash entirely - if the raw file is too big to fit in memory, then a hash containing all of its data will likely also be too large.  (Yes, it's compressing the data a bit, but the hash itself adds substantial overhead.)
My solution, then:
#!/usr/bin/env perl

use strict;
use warnings;

my $current_hour = -1;
my @names;

while (my $line = <DATA>) {
  my ($hour, $name) = $line =~ /(\d{2}):\d{2}:\d{2} (.*)/;
  next unless $hour;

  if ($hour != $current_hour) {
    print_hour($current_hour, @names);
    @names = ();
    $current_hour = $hour;
  }

  push @names, $name;
}

print_hour($current_hour, @names);

exit;

sub print_hour {
  my ($hour, @names) = @_;
  return unless @names;

  print $hour, ':00:00 ', (join ', ', @names), "\n";
}

__DATA__
10:00:00 Bob
11:00:00 Tom
11:00:20 Fred
11:00:40 George
12:00:00 Bill

A: Here's the full solution how to do it.
my @readings = (
    "10:00:00 Bob",
    "11:00:00 Tom",
    "11:00:20 Fred",
    "11:00:40 George",
    "12:00:00 Bill",
);

my %hours;

for my $line (@readings) {
    $line =~ /^(\d{2}).*?([a-zA-Z]+)/;
    push(@{$hours{$1}}, $2);
}

for my $hour (sort keys %hours) {
    print "$hour:00:00 ";
    print join ", ", @{$hours{$hour}};
    print "\n";
}

This results in:
10:00:00 Bob
11:00:00 Tom, Fred, George
12:00:00 Bill


text:
Q: jquery ace editor namespace in chrome I am working with ace9 editor, and originally everything was perfect, but I just noticed since last weeks, the editor is not working correctly in google chrome, for Firefox or IE is fine, but not in chrome, I was reading and always seems the problem is related with the monospace font but I am trying to isolate the problem in a single example, and not able to fix it yet.
Ace9 and I am using the src folder without requireJS
https://ace.c9.io/#nav=about
Here is my code, if someone could see the way to fix it.
JS
<script type="text/javascript">
    function initializeAceEditor(){
        var editor = ace.edit("editor");
        editor.setTheme("ace/theme/monokai");
        editor.getSession().setMode("ace/mode/javascript");
        editor.$blockScrolling = Infinity;
        editor.setOptions({
            maxLines: 15,
            minLines: 15
        });
    }

    $(function() {
        initializeAceEditor();
    });
</script>

HTML
<body>
    <label class="col-xs-12">Definition*
        <div id="editor" class="col-xs-12">
            function foo(items) {
                var x = "All this is syntax highlighted";
                return x;
            }
        </div>
    </label>
</body>

Unforntunatelly i cant create a jsfiddle because i cant upload all required ace files.
Any help is appreciated
Thanks

A: I hope this helps someone; finally the problem was not in the code, I had to modify the default fonts of the google chrome browser:
chrome://settings/fonts
Defining some fonts which are not Arial, and are monospace based, I set "Courier" as default and now the Ace editor is working correctly...


text:
Q: How to minimize codings? This method makes my project crowded because i have many method like this. these may only differs on name of method and to the layout that that it views. My question is how can I lesser this kind of event?
void showLevel1Quest1() {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(context.getText(R.string.question));
    LayoutInflater inflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.add_question1, null);
    builder.setView(view);
    builder.setCancelable(true);
    final AlertDialog finishDialog = builder.create();
    View closeButton = view.findViewById(R.id.close);
    closeButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View clicked) {

            if (clicked.getId() == R.id.close) {
                finishDialog.dismiss();
            }
        }
    });
    finishDialog.show();
}

A: You can place a generic method in a separate class and just pass in the id of the layout you wish to use, such as:
/**
 * makeAlertBox
 *
 * Populates an Android OS alert dialog with the passed params.
 * Only for quick messages that require no imput, other than to
 * dismiss the dialog
 *
 * @param context - The application context
 * @param title - The dialog's title
 * @param message - The dialog's message
 * @param positiveText - The OK buttons text
 */
public static void makeAlertBox(Context context, String title, String message,
        String positiveText, int layoutId)
{
    try
    {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(layoutId, null);
        new AlertDialog.Builder(context)
        .setView(view)
        .setTitle(title)
        .setMessage(message)
        .setPositiveButton(positiveText, new DialogInterface.OnClickListener()
        {
            @Override
            public void onClick(DialogInterface dialog, int which)
            {
                dialog.cancel();
            }
        })
        .setCancelable(false)
        .show();
    }
    catch(Exception ex)
    {
        Log.e("UTIL", "Caught exception while attempting to create alertdialog");
        ex.printStackTrace();
    }
}

In my code my abstract class is called Utility So I'd call:
Utility.makeAlertBox(getApplicationContext(), "Title", "Message", "Okay!", someLayoutId);

edit You can obviously get rid of the extra parameters that you don't need. I mearly copied and pasted from my workspace, as an example.
edit 2 If you plan on using this code anywhere other than an Activity, you're going to need a reference to the Context/Application. Your best bet is to use a Singleton class, that inherits from the Application class, like so:
public class myApplication extends Application
{
    private static myApplication instance;

    @Override
    public void onCreate()
    {
        instance = this;
        super.onCreate();
    }

    /**
     * getInstance
     * @return Returns the instance of this myApplication
     */
     public static myApplication getInstance()
     {
         if(instance != null)
            return instance;

         return new myApplication();
     }
}

Then when you need to access the context you can do: myApplication.getInstance() Or myApplication.getInstance().getApplicationContext()
You'll also need to update your Manifest to ensure the application is picked up:
<application
    android:name="com.YOURPACKAGE.myApplication"
    <!-- everything else. Such as Activites etc...-->
</application

Hope this helps.

A: Here you are:
void showQuest(int layoutResId) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setTitle(context.getText(R.string.question));
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(layoutResId, null);
        builder.setView(view);
        builder.setCancelable(true);
        final AlertDialog finishDialog = builder.create();
        View closeButton = view.findViewById(R.id.close);
        closeButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View clicked) {

                if (clicked.getId() == R.id.close) {
                    finishDialog.dismiss();
                }
            }
        });
        finishDialog.show();
    }

P.S. OOP rocks :)


text:
Q: Change the font-size and color of the labels on the axes/ticks in D3 Observable (no text appended) I am using this Bar Chart on D3 Observable. I need to change the font-size and color of the labels on the axes/ticks. In the previous D3 approach you could simply do this in CSS like:
text {
    fill : white;
    font-size : 22px;
}

But Observable doesn't provide the usual HTML file for placing CSS.
If you look at the file there doesn't appear to be any text appended, although in inspect element you can see the labels are indeed "text"
I tried adding style to the appended g:
svg.append("g")
  .style("fill", "white")
  .call(xAxis);

But to no avail.

A: In an Observable notebook you can add your CSS using the html method with a template literal, like this:
html`<style>
  text {
    fill : white;
    font-size : 22px;
}
  </style>`

Just create a new cell (clicking the + sign) and copy/paste the snippet above.

A: You can style the text on this chart in Observable by looking for the cells containing the XAxis and yAxis.

and...

Below the .attr("transform") lines add this line for font size:
.style("font-size", "22px")

...and this line for color:
.attr("color", "red")

Not sure why D3 decided to change .style("fill" to .attr("color"
Your cells should now look like this:
xAxis = g => g
    .attr("transform", `translate(0,${height - margin.bottom})`)
    .style("font-size", "22px")
    .attr("color", "red")
    .call(d3.axisBottom(x)
        .tickSizeOuter(0))

and...
yAxis = g => g
    .attr("transform", `translate(${margin.left},0)`)
    .style("font-size", "22px")
    .attr("color", "red")
    .call(d3.axisLeft(y))
    .call(g => g.select(".domain").remove())

Result:


text:
Q: "Disk quota exceeded" when writing to /tmp, but plenty of space (linux) i have a VPS.  It's managed with the notorious parallels plesk.
today i started seeing messages (via wordpress at first, but also from the command line shell), saying: "Disk quota exceeded".
user@machine:~$ echo aaa > /tmp/aaa
-bash: /tmp/aaa: Disk quota exceeded

but there's lots of space on the machine, and only 1 partition.
user@machine:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/vzfs             100G   24G   77G  24% /

I deleted all files from /tmp/*   but still.
I don't know anything about "vzfs", maybe maybe it's the culprit?
What could've gone wrong? and how can to fix it?
Solution!
(if you DON'T use Parallels Plesk, see @Adalee's answer)
See @deltik 's solution, relevant to Parallel's system, as in my case.
df -i   immediately gave a rediculous number of inodes:  18,446,744,069,620,218,961   which is insane for a wordpress website.
i further explored and found qmail's queue is full with inodes  (it full with some hacker's attemtps to use my machine to spam, and failure replies)
fixing qmail isn't relevant here, but my workaround is relevant:

*

*stopped qmail's service

*i wasn't able to download qmhandle to the over-quota system, so i had to

*extract and upload the script to another website,

*delete the queue with this command:

*perl <(wget -O - http://link.to.my/script.pl) -D

this way the script is running directly from the web (which is not a safe practice, but i had put the script there by myself), with command line options.
thanks @deltik for knowing and promptly recognizing this peculiar setup on the spot, and providing means to further diagnose !!!

A: "Disk quota exceeded" doesn't mean that there is no space available on your disk, but that you are not allowed to use so much space.
In general, quotas are some limits set by administrator - maximum number of processes you can run, how much space you can occupy, how many files you can have, etc. Disk quotas can be set for maximum number of inodes and disk blocks.
Try running quota and quota -g (alternatively, you can run repquota -u and repqouta -g) to see if your user is restricted in this way and how. If yes, you can edit those quotas with edquota or turn them off with quotaoff command. You might need to log in as root for this, depending on your settings.
This site covers a few examples how to work with quotas and also contains links to manual pages to useful commands.

A: You have a VZFS filesystem, which means that your VPS is a Parallels Virtuozzo virtual machine.  In Virtuozzo the hosting provider can set limits on many parameters, including what allocations you get with VZFS.
Cause: Out of Inodes (Most Common)
After years of working with hundreds of Virtuozzo VPS customers who have had the issue of being unable to create files, even though there appeared to be plenty of free space, the vast majority of them had reached their inode limit.  Run this command to see the inode allocation (Inodes), inodes used (IUsed), remaining inodes (IFree), and the percentage of inodes used (IUse%):
df -i

Having 100% inode usage happens a lot.  Common causes in my experience:

*

*Spam email bouncebacks

*Outbound spam emails queued

*A lot of inbound emails stored

*Some user setting their PHP session garbage collection (session.gc_maxlifetime) to over a hundred years

*Way too many general cache files

*Object cache enabled in the WordPress plugin W3 Total Cache

*Magento error log (a new file is generated for every error)

*Other poorly configured or poorly designed programs/scripts that make a bunch of files and forget to delete them

Troubleshooting
If you find that you are low or out of inodes but don't know where most of the them are, I have this Bash one-liner that searches the current directory and counts the inodes in at a folder depth of 1:
for i in $(find $(pwd) -maxdepth 1 -type d | sort); do echo -e "$(find "$i" | wc -l)\t: $(readlink -f "$i")"; done | sort -nr

You can keep changing the current working directory starting from / until you find the culprit using up your inode allocation.
Explanation
Your VPS is on a VZFS filesystem, which is part of Parallels Virtuozzo (not OpenVZ, which is similar and based on the same technology, but OpenVZ wouldn't be using VZFS).
Due to the way Virtuozzo stores files in VZFS, inodes are often limited more so than they would be on other filesystems like ext4 or XFS.  The host tracks all these files, and it would be advantageous to the hosting provider not to let a single VPS take up hundreds of millions of inodes.  As a result, the hosting provider may set the inode limit to be low, like 1,000,000 inodes.
After years of working with hundreds of customers who exhausted their inode allocation on Virtuozzo, these "mysterious" disk quota issues don't surprise me anymore.
Cause: Other Virtuozzo Limits
A very small percentage of the Virtuozzo VPS customers I've worked with had filesystem issues because they hit other limits.  You can see some (but not all) of the limits with this command:
cat /proc/user_beancounters

Troubleshooting
If the failcnt column has a value greater than 0 or a held column value is equal to the corresponding limit value, you have hit a limit.
You can look up what each parameter is on OpenVZ's wiki here.  A parameter may be "primary", "secondary", or "auxiliary".
You should contact your hosting provider for further assistance if you find that you cannot decrease the held count for a limit that your VPS has reached.
This answer can be expanded a lot depending on which beans were maxed out, as different limits being reached cause different symptoms.
Cause: Limit(s) Decreased After Being Hit
Regarding /proc/user_beancounters or df -i, sometimes, a Virtuozzo system administrator may decrease the limit of a parameter below the held value.
For example, if the original limit of the diskinodes parameter was 1,500,000 and you hit the limit then someone at your hosting provider sets your inode limit to 1,000,000, you would see a bizarre inode report from df -i that makes no sense.
On your end, you could see an unreasonably large number, like 18,446,744,069,620,218,961.
I consider this to be a sinister behavior from the hosting provider, especially if they don't inform you, because the unusual values you see go against the knowledge of super users who don't have experience with Virtuozzo/OpenVZ, which leads to misleading advice (example, another example).
Troubleshooting
Contact your hosting provider.  Show them what you found and work with them to get your held beans below the limit.
If they refuse to help you, ditch your hosting provider and find another one that doesn't use Virtuozzo/OpenVZ virtualization.  KVM virtualization, VMware virtualization, Xen virtualization, or bare metal servers would be subject to far fewer limits than Virtuozzo/OpenVZ.
Explanation
Your hosting provider may have been auditing or responding to an alert and found that your VPS was using up too much of a specific resource (almost always the inodes limit, which is the diskinodes parameter on their end).
An inexperienced Virtuozzo admin at the hosting provider believes that they can cap the issue by reducing the limit to something lower than the actual resource usage.  In the case of inodes, you may have a lower allocation, like 1,000,000, even though your actual current usage may be higher, like 1,500,000.
The Virtuozzo admin in their control panel would see your actual usage and the new limit, but you would see bogus numbers that are possibly very unreasonably high due to the way that Virtuozzo virtualizes.
A negligent Virtuozzo admin would not inform you of this change, which is why you should contact your hosting provider if this happens to you.


text:
Q: SpiderMonkey garbage collector If SM's GC is a conservative stack scanner, why is the example 3 "bad"? Why is "root as you go" necessary? The GC should scan the stack and observe that str1, str2 are roots, no?

A: You need to get your timeline straight.

*

*A conservative stack scanner was introduced in SpiderMonkey 1.8.5.

*The document linked above also mentions 22 March 2011 as the release date of SpiderMonkey 1.8.5.

*The documentation you linked to wasn't edited since August 2008.

In other words: you found a piece of very outdated documentation. Indeed, the tags at the bottom say: NeedsEditorialReview, NeedsTechnicalReview. Not something that you should rely on.


text:
Q: Transloadit: How can I replace audio track of a given video? I am having trouble forming the steps that would replace/set the audio track of an mp4. Here is my code:
 require "open-uri"
 transloadit = Transloadit.new(:key => ENV['TRANSLOADIT_AUTH_KEY'],:secret => ENV['TRANSLOADIT_AUTH_SECRET'])
 video_encode = transloadit.step('video_encode', '/video/encode', use: ":original",ffmpeg_stack: "v2.0.0", ffmpeg: { i: "http://www.stephaniequinn.com/Music/Allegro%20from%20Duet%20in%20C%...;", map:"1:0", vcodec:"copy", acodec:"copy"})
 store = transloadit.step('store', '/s3/store', :key => ENV['S3_ACCESS_KEY'], :secret => ENV['S3_SECRET_ACCESS_KEY'], :bucket => ENV['S3_BUCKET'])
 assembly = transloadit.assembly(:steps => [ video_encode, store ] )
 response = assembly.submit! open('http://techslides.com/demos/sample-videos/small.mp4')

I am getting this message:
 'Unable to find a suitable output format'

Could someone tell me how parametrize ffmpeg and transloadit to set the audio track of a given mp4? I tried many variations without any luck.

A: (Talking as a Transloadit cofounder) we're currently adding this feature to the /video/merge robot that you can use to replace the audio on a given input video. Should be shipping around October 2014, but we'll post it on our blog & twitter when ready.


text:
Q: Amazon SNS: JSON toasts to Windows Phones When I use the Amazon SNS console to send toast messages to a Windows Phone 8 device (i.e. with the MPNS system), I can only send messages in text format. Selecting "Use platform specific JSON message dictionaries" and sending a JSON toast never seems to get to the device. The default message that you see when you select the platform specific format is a tile notification message, and that does work.
For exmple, the following message neither gives an error nor is displayed in the device:
{
"MPNS": "<?xml version=\"1.0\" encoding=\"utf-8\"?><wp:Notification xmlns:wp=\"WPNotification\"><wp:Toast><wp:Text1>Amazon</wp:Text1><wp:Text2>hooray</wp:Text2><wp:Param>this_is/my?extra=parameter</wp:Param></wp:Toast></wp:Notification>"
}

This has been tested with a couple of devices: Lumia 620 with Windows Phone 8.0 and Lumia 1020 with 8.1 beta. I have also tried sending messages from a Java backend, but it just shows up as a raw JSON text toast ({ "MPNS": ...) again. What could possibly be wrong? The JSON is valid, the XML is well-formed... I'm at loss.

A: I have run into the same issue recently, and found a solution. The SNS documentation for MPNS does not emphasise an important step, but it can be found in the sample code and eventually in the message attributes section of the docs.

You must set two MPNS-specific MessageAttributes on the PublishRequest. Omitting them will cause the delivery to fail with no clues left to investigate: i.e. even if you enable delivery status logs with CloudWatch, providerResponse will be missing.
For reference, the attributes are the following:

*

*Attribute name: AWS.SNS.MOBILE.MPNS.Type
Possible values: token (for tile notifications), toast or raw

*Attribute name: AWS.SNS.MOBILE.MPNS.NotificationClass
Possible values: realtime*, priority, regular
(realtime worked for me)

That said, it seems that it is not possible to send custom content to MPNS using the SNS console. But using the API works, so here is an excerpt from the Java sample for using the Java SDK:
AmazonSNS snsClient = ... /* initialise the client */;

Map<String, MessageAttributeValue> notificationAttributes = new HashMap<String, MessageAttributeValue>();
notificationAttributes.put("AWS.SNS.MOBILE.MPNS.Type",
        new MessageAttributeValue()
            .withDataType("String")
            .withStringValue("token")); // or "toast" or "raw", depending on the payload
notificationAttributes.put("AWS.SNS.MOBILE.MPNS.NotificationClass",
        new MessageAttributeValue()
            .withDataType("String")
            .withStringValue("realtime"));

PublishRequest request = new PublishRequest();
request.setMessageAttributes(notificationAttributes);
request.setMessageStructure("json");

request.setTargetArn(... /* topic or endpoint ARN */);
request.setMessage(... /* JSON payload */)

snsClient.publish(request);


text:
Q: Add caption/label to easylist I want to add a caption (or a label) to a list. I figured out that I can do it with figures, but it's really messy
\documentclass{article}

\usepackage[ampersand]{easylist}
\usepackage[labelformat=empty]{caption}

\begin{document}

\begin{figure}[h!]

    \vspace{-2em} %label format leaves empty space above the caption when empty

    \hspace\caption{\textbf{This is the caption...}}
    \begin{easylist}
        & first item
        & second item
        & ...
    \end{easylist}
\end{figure}

\end{document}

I used \paragraph{...} and \subparagraph{...} before but the formatting in the compiled pdf isn't as nice

A: So I just found out that you can do:
\begin{easylist}
    \noindent\textbf{Some caption}
    & First item
    & Second item
    & ...
\end{easylist}

Which works flawlessly ... but I didn't see it mentioned anywhere


text:
Q: How do I get the results with the root resolved in python? How do I get the results with the root resolved.
a = Eq(x**3 + x**2 - 3*x + 1,0)

b = solve(a)

print(b)

results:
[1, -1 + sqrt(2), -sqrt(2) - 1]

A: Use evalf:
In [4]: [s.evalf() for s in b]
Out[4]: [1.0, 0.414213562373095, -2.41421356237309]


text:
Q: I couldn't connect to Elasticsearch with elasticsearch-php package I installed elasticsearch with docker. I can use Elasticsearch on the browser as localhost:9200.
I need to use Elasticsearch with php so i used elasticsearch/elasticsearch-php package on my project and when i try to connect Elasticsearch i usually get that error : No alive nodes found in your cluster on line 64.
There are a lots of documents about this error but no document didn't work. Maybe i couldn't.
I tried some host like that :
"http://localhost:9200/",
"localhost",
"docker_elastic_1:9200"
But these hosts are couldn't work.
Can you please help me about this error ?
My code :
$client = \Elasticsearch\ClientBuilder::create()->build();

$params = [
    'index' => 'my_index',
];

$response = $client->indices()->create($params);
print_r($response);

Error :


text:
Q: What is the formula for relativistic acceleration? $BACKGROUND:$
I was recently watching a youtube video about Unruh radiation:https://youtu.be/7cj6oiFDEXc
In this video, the host said that we need to accelerate at $10^{20}m/s^2$ to raise the temperature by $1 kelvin$.
This got me thinking about relativistic acceleration because if you accelerate at $10^{20}m/s^2$, you will pass the speed barrier in less than a second if we apply the math of Newtonian mechanics in which if you are travelling at v and you start accelerating at a then after time t your velocity will be $v+at$ which cannot be true so I want to know the relativistic formula for acceleration.
(If you are thinking that how on earth can someone talk about Unruh radiation but don't know the formula for relativistic acceleration, then let me point out that I am not a physicist, I am just a high school student who tries to learn as many things as possible from the internet. Sometimes that information can be incomplete but slowly I manage to gain the full information.)

A: The acceleration that is relevant to the Unruh radiation is what is called proper acceleration. It is the acceleration of an object as observed by an inertial frame with respect to which the object is momentarily at rest. As pointed out in the comments, an object performing such motion of constant proper acceleration performs the hyperbolic motion. As you can see in the spacetime diagram in the Wiki article on hyperbolic motion, the (spacetime) trajectory of such a particle is (surprise, surprise) a hyperbola with the light cone as its asymptote. Thus, it doesn't reach the speed of light after any finite amount of time.


text:
Q: check box in expandable listview I have an expandable listview and I have check box for both parent and child. The requirement is that if I check the checkbox of parent , then the check box of children should also get selected.Here is the code
holder.editCheck
            .setOnCheckedChangeListener(new OnCheckedChangeListener() {

                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            }

COuld any one help me with this

A: Choose the one you want:
The first one will apply the state of the parent checkbox to the child one.
    parent_checkbox.setOnClickListener(new OnClickListener() {
        public void onClick(View v)
        {
            children_checkbox.setChecked( parent_checkbox.isChecked() );
        }
    });

Or:
The second will only apply the state if the is checked. Ie. if the parent is unchecked, child keep its previous state.
    parent_checkbox.setOnClickListener(new OnClickListener() {
        public void onClick(View v)
        {
            if (parent_checkbo.isChecked()) children_checkbox.setChecked( true );
        }
    });


text:
Q: Unexpected output via shell_exec I want to write a background task. so i write a basic script for seeing the working of the shell_exec The script is as follows:
<?php
$op = shell_exec("php -v");
echo $op;
echo "back to the test.php";
?>

Output should be the php version information but it prints the following unexpected output:
back to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.phpback to the test.php

it's print my current pages content 59-60 times and sometimes with content-type:text/html I have tried using another php file output is same
Then I have tried with linux commands like date,ls it works perfectly
Please help me to sort out this problem I couldn't make out what is wrong?
I have tried out the absolute paths to php also but no difference and also use other php function like system,exec etc.
Edit Note: I have changed the exec function to shell_exec because I have missplaced this The output which i displayed below is from shell_exec
UPDATE
 I have not get the solution of the problem but got the cause of the problem there is nothing problem in a script it's because of server. I have write to support center of the server but doesn't get the response So I think this question is closed

A: Syntax for exec function is
string exec ( string $command [, array &$output [, int &$return_var ]] )

So it is second argument $output which will be filled by output of command. Still it will return array not version as string. You need to parse that data to get version.
exec("/usr/bin/php -v", $out);
print_r($out);

Also I suggest to use full path for php in exec function.

A: I think exec and those kind of functions are disabled in your php.ini . You can check it by
if(function_exists('shell_exec')) {
    echo "shell_exec is enabled";
} else {
    echo "shell_exec is disabled";
}

Open your php.ini and navigate to section disable_functions
If shell_exec is listed under there , remove it.
Then restart apache / php handler.
Also If Safe Mode is enabled this function will not be available. You need to disable it.


text:
Q: Geometry: Making the Bleed visible together with paper/margin box How can I draw a frame around the bleed, page and margin. I need this to fix some (margin/page) issues.
Consider the MWE below. This is already drawing a box around the page and margin. How can I make the bleed box visible?
Also is it possible to:

*

*Draw the bleedbox/margin box in different colors/line style?

*Not draw a box if width/height = 0 (e.g. the marginpar in MWE)?

MWE:
\documentclass{book}
\usepackage[showframe,
papersize={168mm,230mm}, % A5 + 2cm (2 times bleed)
layoutsize={148mm,210mm}, % A5
layouthoffset=10mm, % Bleed
layoutvoffset=10mm, % Bleed
lmargin=20mm,
rmargin=20mm,
tmargin=20mm,
bmargin=20mm,
marginparwidth=0mm
]{geometry}
\usepackage[a4,center,frame]{crop}
\begin{document}
(Type your content here.)
\end{document}


text:
Q: how to return double datatype inside a function with 4 decimal places? How to return double datatype with 4 decimals in a function in java ?
    public static double fun(){
    double d=2.5d;
    String s=String.format("%.4f",d);
    double ans=Double.parseDouble(s);
    return(ans); }

actual output=2.5
expected output=2.5000

A: If you are using the double for mathematical computation, using 2.5 is equivalent to 2.5000. Can you be more specific as to why you would want the latter?
If you really do need the 4 decimal places, I assume it is some sort of output formatting task, in which case you can just return the String representation directly.


text:
Q: Adding values based on the year id   product            id2     year   cost
 1  biscuits    202-55-3041     2017      2
 2  biscuits    903-36-9457     2014      2
 3  biscuits    938-33-7254     2014      2
 4  biscuits    739-29-5963     2017      2
 5  biscuits    731-49-5483     2017      2
 6  biscuits    892-15-2567     2018      2
 7  biscuits    518-79-7674     2017      2
 8  biscuits    305-63-7908     2017      2

This is my current data set the name of this data is called 'total1'
I am a beginner in R and I was wondering if there was a way to add up the cost of the product based on the year, for example;
In 2017 there were 10 biscuits sold
In 2018 there were 8 biscuits sold
I am trying to determine which is the least profitable year in terms of biscuits sold.
I apologise if this is answered elsewhere if it is direct me thank you.

A: Assuming that the number of sold items is stored in column cost, here's a simple solution using tapply:
tapply(total1$cost, total1$year, sum)
2014 2017 2018
   4   10    2

Another simple solution is by using aggregate:
Edit:
thanks to @Darren Tsai's comment, the code here is simplified:
aggregate(cost ~ year, total1, sum)
  total1$year total1$cost
1        2014           4
2        2017          10
3        2018           2


text:
Q: I have added a relationship between two existing entity but i am facing the below issues?
I have added a relationship between two existing entity but i am facing the below issues ?

reason=Can't find or automatically infer mapping model for migration,
  NSUnderlyingError=0x60000104a290 {Error Domain=NSCocoaErrorDomain
  Code=134190 \"(null)\" UserInfo={entity=Task, property=tskNotify,
  reason=Can not map from a to-many to a to-one relationship}}}"; }

I did this ,

A: If you previously installed the app - delete it and rebuild the app. The issue is because you had changed the Entity and did not implement the versions of Core Data.
If you are going to change Entity params in future after release do not forget to implement versions in your Core Data.


text:
Q: Retrieve records falling within a daily time range across a given month My table contains fields that store

*

*ticket

*sale date/time

*price

I need help on how to select only those tickets sold between 8:00 AM and 12:00 PM on a day-to-day basis for an entire month, without including any sales between 12:01 PM and 10:00 PM.

A: Try something like
SELECT SUM(Price) Total_Morning_Sales
FROM TableName
WHERE CAST(Sale AS TIME) > '07:59:59'
 AND  CAST(Sale AS TIME) < '12:00:01'
 AND  MONTH(Sale) = 5   --<-- Month Number here

A: Simple way to deal with events in given hours of day is to use DATEPART
SELECT *
FROM TicketTable
WHERE DATEPART(hh, SaleDateTime) BETWEEN 8 AND 11


text:
Q: How to get more continuity in regression forest output I am using a regression forest.
What I have noticed when I plot the quantile distribution of the forest's output is that over a long stretch of quantiles (e.g. $\tau \in [0.1,0.3]$), the output will all assume the identical number. I am guessing this comes from the sparsity of my response variable and the distributional characteristics of my features (and also the shallowness of my trees).
What are some hyperparameter settings (or other approaches) that I could use to introduce more continuity into the forest's output? The best case would be a linear model-esque output. My goal is to achieve this without wounding generalisation (which may not be possible). Some wounding of generalisation is acceptable (i.e. suboptimal hyperparameter settings) if it means I can use the model to make decisions more easily.


text:
Q: Jsoup: Can't extract img tag I'm trying to extract the image source of a few ads but I don't understand what i'm doing wrong :(
The html tag that i want to extract looks like this:

Code:
Elements pageSearchImg = page2.select("a[id^=item] > div[class=placeholder] > div[class=overflow_image] > img");
        for (int m = 0; m < pageSearchImg.size(); m++) {
                String img = pageSearchImg.get(m).attr("src");
                System.out.println(img);
        }

I guess there might be something wrong with a tag?
Edit: if i view the page source it looks like this:

                    <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="50px" height="50px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
                        <path fill="#d32f2f" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
                            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/>
                        </path>
                    </svg>


text:
Q: Why isn't my named PHP session able to be called? I've already posted something similar to this, but I redesigned the entire system. Instead of the original system I've created a separate sub domain for accounts. I'm having issues getting any variables from my named session. I'm attempting to transfer user information accross sub domains for login purposes, and tracking purposes. Anyways, here is the code.
Login Script
<?php
session_name('LoginSession');
session_set_cookie_params(0, '/', '.ueteribus.com');
session_start();
?>

That code is just the bit that tells the $_SESSION to be spread across all the domains. (Or at least it is supposed to) Anyways, the LoginSession name is where the problem comes in. If that is added in then I am unable to get anything to display using my calling scripts.
Currently I use
$_SESSION['USERNAME_ueteribus']
$_SESSION['PASSWORD_ueteribus']
$_SESSION['loginsession21']
Those are the main $SESSIONS that I use, and currently I am unable to get them displayed when giving the Cookies any specific name.
This is the current script I am using to call the actual $_SESSION by name.
<?php
session_name('LoginSession');
session_start();
echo $_SESSION['loginsession21'];
?>

That worked fine before I added the custom name for the $_SESSION.
Any help would be much appreciated as this issue has been plaguing me for a very long time, also.. When I actually head into the Cookies on my browser, I see LoginSession, but it is listed under the main domain. www.XXXX.com instead of account.xxxx.com.
No idea if that is normal or not, anyways.. Any additional information can be requested, and thank you for any assistance that you can provide.
NOTE: All the scripts and code listed above are saved on the account sub domain!
UPDATE:
I just tried this code and it still doesn't work.
<?php
session_name('LoginSession');
session_set_cookie_params(0, '/', '.ueteribus.com');
session_start();
echo $_SESSION['loginsession21'];
?>

Also I added this script to the top of each page.
<?php

session_set_cookie_params(0, '/', 'ueteribus.com');
session_start();

?>

A: My guess is that you're missing the session cookie config in your other (not Login Script) files. Just like session_name(), you need to call it on every request and before session_start() (despite what other commenters may believe).
<?php
session_name('LoginSession');
session_set_cookie_params(0, '/', '.ueteribus.com');
session_start();

// of course this line will only work if you've previously set the "loginsession21" key
echo $_SESSION['loginsession21'];
?>

Update
After making changes to either session name or cookie params, you'll need to clear out the old cookie from your browser.
You also need to make sure that the session is not started anywhere else in your code.
I would suggest moving all the session config stuff into a single file and include it at the top of every requestable page. Also remove any and all other calls to session_start().
<?php
// session_config.php

session_name('LoginSession');
session_set_cookie_params(0, '/', '.ueteribus.com');
session_start();

then, in some other script
<?php
// some_other_script.php
require_once __DIR__ . '/relative/path/to/session_config.php';


text:
Q: Progress Bar compatibility API 16 thru 23 Sorry ... newbie here. This method works great for my intended purposes but the progress bar will not close after loading on API lower than 21. So the title bar displays the name of the activity and Loading and it looks like crap. Is there a method to force close of the progress bar on the lower API's? Thanks for your time.
final Activity WebActivity = this;
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS,
            Window.PROGRESS_VISIBILITY_ON);
    webview= (WebView) findViewById(R.id.activity_main_webview);
    webview.setWebChromeClient(new WebChromeClient()
    {
        public void onProgressChanged(WebView view, int progress)
        {
            WebActivity .setTitle("Loading...");
            WebActivity .setProgress(progress * 100);
            if(progress == 100)
                WebActivity .setTitle(R.string.activity_title);
        }
    });
    webview.setWebViewClient(new WebViewClient());
    webview.getSettings().setJavaScriptEnabled(true);
    webview.loadUrl("Website URL");


text:
Q: Socket TCP C# more data than buffer What I achieve to do
I have a server sending data back to the client. The client reads data from the buffer, concatenates it an deserializes it into an object of a certain type.
The Problem
Now sometimes it happens that the loop for receiving data exits before all data is received so the data I want to deserialize is incomplete. I assume this happens, because the client processes the data too quickly. The client wants to process more data but there's none available.
This happens, when the data sent is more than the buffer can hold. The original idea was to read chunks and concatenate them but this does not always work completely.
The Idea
Is there a way to tell the client how much data should be received, so I can amend the loop and have all data received, before it is processed?
This is how my receive method basically looks like:
private void receiveData()
{
    byte[] data = new byte[8 * 1024];
    int bytesReceived;

    // list that gathers all data from all chunks
    List<byte> totalData = new List<byte>();

    do
    {
         // receive one chunk of data
         bytesReceived = clientSocket.Receive(data);

         // copying all bytes received to a byteArray of the exact size
         byte[] dataExtracted = new byte[bytesReceived];
         Array.Copy(data, dataExtracted, bytesReceived);

         // Add the byteArray to the total data received
         totalData.AddRange(dataExtracted);
    } while (clientSocket.Available > 0);

    // Do something with totalData received
}

I am looking for a way to receive all data, before I process it, but I am not sure how to do the loop or better how to set the conditions here. Any help or links to investigate more are appreciated.


text:
Q: Enumerating all permutations that are "square roots" of derangements Is there an algorithm that enumerates all permutations that are "square roots" of derangements, i.e. permutations that, when applied twice, yield a derangement?
Other information about those kind of permutations is also welcome.

A: Check out "Example 2. Permutations with no small cycles" on pg. 176 of H. Wilf's "generatingfunctionology": https://www.math.upenn.edu/~wilf/DownldGF.html. It explains, using generating functions, how the number of permutations in $\mathfrak{S}_n$ you are looking for is asymptotically $\approx \frac{1}{e^{1+1/2}} n!$, just like the number of derangements is $\approx \frac{1}{e} n!$. In general the fraction of permutations with cycles all of length $>q$ is $e^{-H_q}$ where $H_q = 1+1/2+1/3+...+1/q$.


text:
Q: Writing a CSV file in .net I have a requirement to export a dataset as a CSV file.
I have spent a while searching for a set of rules to go by and realised there are quite a few rules and exceptions when writing a CSV file.
http://knab.ws/blog/index.php?/archives/3-CSV-file-parser-and-writer-in-C-Part-1.html
http://bytes.com/topic/c-sharp/answers/236875-problems-streamwriter-output-csv
http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/0073fcbb-adab-40f0-b768-4bba803d3ccd
So now it is not a simple process of separating strings with commas, I have searched for an existing CSV writer either 3rd party or (hopefully!) included in the .net framework.
Edit: New link:
http://www.thinqlinq.com/Post.aspx/Title/LINQ-to-CSV-using-DynamicObject-and-TextFieldParser
The TextFieldParser is a VB object (can be referenced from C#) that will automatically parse CSV files. :)
I was wondering if anybody knows any handy .Net (2.0 -> 3.5 and 4.0) libraries that can be used to generate a correctly formatted CSV file.
Also, if there are any sets of rules for generating CSV files.
There are a lot of details of CSV readers and parsing CSV files, however not as many about writing (ok, I know it is just the opposite :P ).
http://www.codeproject.com/KB/database/CsvReader.aspx
Any help would be much appreciated :)
I found another article with some more detailed CSV rules:
http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm
A neat 3rd party library is Linq-to-CSV (not framework library):
http://www.codeproject.com/KB/linq/LINQtoCSV.aspx
Thanks for your help everyone.
I have decided that the best solution will be to create a simple static class that will do the special character replacement (that Chris mentioned).
If I had a need for Linq querying my CSV files, I would look at the CodeProjects implementation of Linq-to-CSV.
Thanks again :)

A: I've used filehelpers extensively and it's pretty awesome for generating CSVs.

A: CsvHelper (a library I maintain) also available via NuGet.
CsvHelper can automatically write your class objects to a file for you.
var myObj = new MyCustomClass
{
    Prop1 = "one",
    Prop2 = 2
};
var streamWriter = // Create a writer to somewhere...
var csvWriter = new CsvWriter( streamWriter );

// You can write a single record.
csvWriter.WriteRecord( myObj );

// You can also write a collection of records.
var myRecords = new List<MyCustomClass>{ myObj };
csvWriter.WriteRecords( myRecords );

A: Here is the function you can use to generate a row of CSV file from string list (IEnumerable(Of String) or string array can be used as well):
Function CreateCSVRow(strArray As List(Of String)) As String
    Dim csvCols As New List(Of String)
    Dim csvValue As String
    Dim needQuotes As Boolean
    For i As Integer = 0 To strArray.Count() - 1
        csvValue = strArray(i)
        needQuotes = (csvValue.IndexOf(",", StringComparison.InvariantCulture) >= 0 _
                      OrElse csvValue.IndexOf("""", StringComparison.InvariantCulture) >= 0 _
                      OrElse csvValue.IndexOf(vbCrLf, StringComparison.InvariantCulture) >= 0)
        csvValue = csvValue.Replace("""", """""")
        csvCols.Add(If(needQuotes, """" & csvValue & """", csvValue))
    Next
    Return String.Join(",", csvCols.ToArray())
End Function

As I think, it won't be difficult to convert from VB.NET to C#)

A: For the specifications, see http://en.wikipedia.org/wiki/Comma-separated_values

A: I know you said you found your answer, but I just wanted to give a vote for the LINQtoCSV library you mentioned.  I've used it in a couple projects and it works really well for keeping your business code clean and not concerned with details / peculiarities of the file format.
Maybe in your specific case it is not too difficult to write the exporter, but the nice thing about this library is that it is bidirectional.  If you find yourself having to consume the CSV down the road it's not much extra code, and/or it gives you a consistent library to use on future projects.

A: If there are any commas in your cell, surround the entire cell with double quotes, eg:
cell 1,cell 2,"This is one cell, even with a comma",cell4,etc

And if you want a literal double quote, do two of them, eg:
cell 1,cell 2,"This is my cell and it has ""quotes"" in it",cell 4,etc

As for dates, stick to ISO format, and you should be fine (eg yyyy-mm-dd hh:mm:ss)

A: You can use ODBC to read and write CSV files (via OdbcConnection and a suitable connection string).  This should be reasonably good for generating CSV files, and will handle things like quoting for you; however I have run into some issues when using it to read CSV files generated by other programs.

A: Another rule to add to the others: Use the commas as field separators rather than as field terminators. The reason for this is that a trailing comma at the end of a line could be ambiguous: Does it have no significance or does it signify a NULL value following it?

A: I would just like to add there's an RFC that specifies the CSV format which is what I would regard as the canonical source.

A: I found this important link which is quite neat. Haven't tried it yet, will let you know how it goes!
http://www.codeproject.com/KB/linq/LINQtoCSV.aspx
Looking more closely, this implementation essentially only uses basic rules too:
special chars = \n \" and the separator char.
if found special characters, then surround with quotes.
Replace quote with double quote.
Essentially the rules Chris mentioned.
I think the easiest way to do this is to create my helper method based on the simple rules and revise on a user-needs basis.

A: Can you use a string array and then concatenate using:
string out = "";
string[] elements = { "1", "2" };
foreach(string s in elements) { out += s + "," };
out = out.substring(0, out.Length-1);


text:
Q: Weird string stripping
Possible Duplicate:
python .rstrip removes one additional character

i have a string vtype defined as
vtype = "vidis.fit"

i want to strip the final dis.fit away, so
vtype.rstrip("dis.fit")

but the end result is v, rather than vi, the one I expected/wanted. I'm a bit confused about this, anyone?
EDIT
Thanks everyone. I guess the reason why it confused me in the first place is that, the naming of lstrip and rstrip seems suggesting some sequence, although it only matters to white spaces.

A: rstrip actually takes a sequence of characters at the end of a string to strip, not a specific string to strip.  It's removing the i because i is in the sequence of characters passed in.
For example, the order of characters in rstrip doesn't matter:
>>> vtype = "vidis.fit"
>>> vtype.rstrip("dis.fit")
'v'
>>> vtype.rstrip("ditfs.")
'v'

Nor does the number of times a character is in it:
>>> vtype.rstrip("ditffffsssss.")
'v'

As the docs specify:

The chars argument is not a suffix; rather, all combinations of its
  values are stripped

EDIT:  And for fun, if you really want to solve the "how do I remove a string at the end of a string" problem, use rfind with slicing:
>>> vtype[:vtype.rfind("dis.fit")]
'vi'

A: The "i" after "v" is removed because it's a character in 'dis.fit'. The argument to strip isn't a substring to remove, but a list of chars to remove.

A: as indicated in the other answers, rstrip takes a sequence of chars to remove, not a particular string.
"vidis.fit".replace("dis.fit", "")

will actually do what you're looking to do... unless the "dis.fit" sequence may appear more than once, or in a different position. In which case you can probably work out some regex solution.


text:
Q: Reusing functionality in angularjs controllers I have a tree renderer that displays interactive nodes. Here is a piece of such interaction:

The functions showEdit(node) and loadEdit(node) are defined from the controller. I now need to have several pages with different logic - I want different controllers that each have their own showEdit(node) and a few other specialized functions but I would like to reuse the loadEdit(node) function and many others because they are definitely common functionality.
Here is the aforementioned loadEdit(node):
$scope.loadEdit = function(node) {
    if ($scope.selectedNode != undefined) {
        $scope.selectedNode.showEdit = false
    }
    node.showEdit = true;
    $scope.selectedNode = node;
}

The common answer to reusing functionality is to make a service so I was going to make pass $scope to a service but a few people said that you shouldn't modify $scope in a service (I would love if somebody elaborated on why I shouldn't do that). Besides, all these functions are incredibly shallow and adding a layer of indirection and writing a bunch of definitions like these $scope.loadEdit = function(node) {return service.loadEdit(node, $scope.selectedNode);} wouldn't even solve the problem - if I wanted to also modify an another variable, I would have to add it to every controller that uses this service function (and the fact that javascript does not care about the amount of arguments passed makes such a task very easy to forget)
Perhaps there is some way of packaging those common functions into an object and adding them to each controller like this? Though, I wouldn't know how to distribute this object to the controllers:
angular.extend({}, FooCtrl, commonFunctionsObject);
angular.extend({}, BarCtrl, commonFunctionsObject);
angular.extend({}, BazCtrl, commonFunctionsObject);
...

Can you do this with a javascript library, perhaps? Any input is appreciated.


text:
Q: Unable to upack ISO 8583 F137 using JPOS I'm trying to introduce F137 to my ISO 8583 processing. I'm using following xml configurations in packing and unpacking the ISO message for f137.
<isofield
id="137"
length="2"
name="Application Transaction Counter"
class="org.jpos.iso.IFB_BINARY"/>

I'm able to pack the F137 where I'm able to see F137 in outgoing message,
<send>
    <isomsg direction="outgoing">

        <header>16010201E10000000000000000000000000000000000</header>
      <field id="0" value="0210"/>
      <field id="2" value="933456______7663"/>
      <field id="4" value="000000000200"/>
      <field id="7" value="0906144357"/>
      <field id="11" value="123456"/>
      <field id="12" value="144357"/>
      <field id="13" value="0906"/>
      <field id="18" value="6012"/>
      <field id="19" value="356"/>
      <field id="22" value="0911"/>
      <field id="25" value="59"/>
      <field id="28" value=" 5       "/>
      <field id="32" value="441370"/>
      <field id="37" value="727523083909"/>
      <field id="38" value="231043"/>
      <field id="39" value="00"/>
      <field id="41" value="     101"/>
      <field id="42" value="CA-IDCode-77765"/>
      <isomsg id="43">
        <!-- org.jpos.iso.packager.GenericSubFieldPackager -->
        <field id="1" value="Acceptor 11              "/>
        <field id="2" value="NW           "/>
        <field id="3" value="IN"/>
      </isomsg>
      <isomsg id="44">
        <field id="15" value="4233"/>
      </isomsg>
      <field id="48" value="          3"/>
      <field id="49" value="356"/>
      <field id="55" value="AA55AA55" type="binary"/>
      <field id="59" value="CA123700052"/>
      <field id="60" value="9100F0000500" type="binary"/>
      <isomsg id="62">
        <!-- org.jpos.iso.packager.GenericSubFieldPackager -->
        <field id="1" value="1"/>
        <field id="2" value="153621623779500"/>
        <field id="7" value="11234123412341234123412345"/>
        <field id="20" value="0000909090"/>
      </isomsg>
      <isomsg id="63">
        <!-- org.jpos.iso.packager.Base1SubFieldPackager -->
        <field id="13" value="02F0F0"/>
        <field id="19" value="210"/>
      </isomsg>
      <field id="102" value="00023830"/>
      <field id="104" value="5700040102D7D75F00761006F0F6F5F4F3F40105F1F2F3F4F50210F6F5F4F3F2F1F0F0F0F0F3F3F4F2F3F3030997998182A4848488810404A385A2A30509A289958781979699850602E2D50709A289958781979699850802F0F10A0ED985838997898595A340D58194850C09A289958781979699850D09A28995878197969985" type="dataset" />
      <field id="119" value="35623"/>
      <!-- 123{ 68{02:10, 03:12321232123, 04:123412341}} -->
      <field id="123" value="68001C0202F1F0030BF1F2F3F2F1F2F3F2F1F2F30409F1F2F3F4F1F2F3F4F1" type="dataset" />
      **<field id="137" value="1232" type="binary"/>**
    </isomsg>
  </send>

but during unpacking jpos throws following exception.
<session-error>
    <iso-exception>
      org.jpos.iso.IFB_LLHNUM: Problem unpacking field 32 (org.jpos.iso.ISOException: Field length 96 too long. Max: 11) unpacking field=32, consumed=54
      org.jpos.iso.ISOException: org.jpos.iso.IFB_LLHNUM: Problem unpacking field 32 (org.jpos.iso.ISOException: Field length 96 too long. Max: 11) unpacking field=32, consumed=54
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:265)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:420)
    at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:924)
    at org.jpos.iso.BaseChannel.receive(BaseChannel.java:692)
    at org.jpos.iso.ISOServer$Session.run(ISOServer.java:155)
    at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:72)
    </iso-exception>

Does JPOS support fields greater than F128. Btw Application works properly without F137.

A: ISO-8583 defines 128 fields. Systems that use fields beyond 128 are quite unusual, and weird (I see this sample message seems to come from Bhutan). That said, jPOS supports them.
I suggest you search the jPOS forum for the keyword 'tertiary bitmap':
https://groups.google.com/forum/#!searchin/jpos-users/tertiary$20bitmap%7Csort:date


text:
Q: How can I copy/move multiple objects from a S3 bucket within specified byte-ranges to another bucket? Hey I am trying to copy multiple objects(200,000+) from a public weather forecast bucket (NOAA GFS) to my private S3 bucket.
Each forecast file has its own index file that contains byte-ranges for different variables. From these 500 variables, only 20 of them are useful to me.
I've managed to do this with boto3 by iterating every object and extracting specified bytes. But this process was awfully slow. What could be a possible improvment?

A: You can implement it with upload_copy_part. Check details at here
CopySourceRange take a value like bytes=start-end


text:
Q: C# accessing network disk I am trying to access a network disk, with C#, I've tried doing this:
if (!Directory.Exists(path)) //With \\Server\path

OR
if (!(new FileInfo(path).Exist)) //With \\Server\path

Both tell me it does not exist.
I must say, I am running an ASP.NET site and I am trying to reach it from there, I don't know if that matters?
The thing I am trying to do is my DLL needs a path to the root directory of it's contents so I need to specify a path, the path is located in disk S but disk S is not a logical disk, it's a network disk.
We start the IIS website as an administrator of the whole domain to prevent not having privileges.

A: Server\\path\path\path

doesn't look like a correct UNC pathname to me.
\\Server\path\path\path

should be correct.
Secondly, the user account under which your IIS process runs needs to have appropriate permissions to the network location in question. The identity used is usually determined by the application pool it's in, or if your app uses impersonation it could be identifying as the client user. Either way you should be careful to only grant the permissions absolutely definitely required by the app, and no more.

A: After setting for both the pool and the website the administrator as account who starts the process, AND adding '@' and the '\'  we've managed to access the network folder (Thanks everyone!), current status: DLL says it can't find the path to it...
So ye the code we have written right now has access but the DLL says it cannot find the path, so we contacted the owner who made the DLL.

A: For Check file exist you have to use this:
if(!File.Exists("path"))

For check Folder exist you have to use this:
if (!Directory.Exists("Path"))


text:
Q: Minutes difference between two timestamps in Excel I have two timestamps as below, I would like to find the difference in minutes:
end time = 2020-08-12T10:25:50.775+04:30

start time= 2020-08-12T10:50:50.775+04:30

I want to find the difference end_time - start_time in minutes in Excel.
Thanks in advance.

A: The format is not read as a datetime in excel. Assuming the time is in cell A1, you can apply this formula =DATEVALUE(LEFT(A1,10))+TIMEVALUE(MID(A1,12,12))
You can perform arithmetic operations from the formula result i.e. Assuming start time is in Cell A2 and end time in cell B2, input into cell C2
=DATEVALUE(LEFT(B2,10))+TIMEVALUE(MID(B2,12,12))-DATEVALUE(LEFT(A2,10))+TIMEVALUE(MID(A2,12,12))


text:
Q: Android. Downloaded .docx files converting to .bin files I am trying to download .docx file. Using intent to send link to browser to make it handle URL. File is downloading. But file is in .bin sometimes without extention. My code looks like this:
        String url = documentList.get(position).getManMadeLink();
        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse(url));
        startActivity(i);

How to solve this problem? Any suggestions?


text:
Q: Two points rotating around same center but distance grows I want to achieve that two points are rotating around each other. I therefore use a rotation matrix. However I now get the problem that the distance between the points is growing (see atached video 1). The distance however should stay constant over my whole simulation.
Here is my code I use for calculating the speed:
Where p1 and p2 are the two points.
double xPos = p0.x+p1.x;
double yPos = p0.y+p1.y;
//The center between p1 and p2
xPos /=2;
yPos /=2;
//the rotating angle
double omega = 0.1;
//calculate the new positions
double x0new = xPos + (p0.x-xPos)*std::cos(omega) - (p0.y-yPos)*std::sin(omega);
double y0new = yPos + (p0.x-xPos)*std::sin(omega) + (p0.y-yPos)*std::cos(omega);
double x1new = xPos + (p1.x-xPos)*std::cos(omega) - (p1.y-yPos)*std::sin(omega);
double y1new = yPos + (p1.x-xPos)*std::sin(omega) + (p1.y-yPos)*std::cos(omega);
//the speed is exatly the difference as I integrate one timestep
p0.setSpeed(p0.x-x0new, p0.y-y0new);
p1.setSpeed(p1.x-x1new, p1.y-y1new);

I then integrate the speed exactly one timestep. What is wrong in my calculation?
Update
It seems that my integration is wrong. If I set the positions direct it works perfect. However I do not now what is wrong with this integration:
setSpeed(ux,uy){
     ux_=ux;
     uy_=uy;
}
// integrate one timestep t = 1
move(){
     x = x + ux_;
     y = y + uy_;
}

Video of my behaviour

A: At the first glance, the main reason is that you update p0 and p1 coordinates in the each iteration. That would accumulate inaccuracies, which are possibly coming from setSpeed.
Instead, you should use the constant initial coordinates p0 and p1, but increase omega angle.

A: There's nothing clearly wrong in this code, but the "speed" integration that isn't shown, suggests that you might be integrating linearly between old and new position, which would make the orbits expand when speed > nominal speed and to contract when speed < nominal_speed.
As I suspected. The integration is actually extrapolation at the line segment between point p0 and p1 which are supposed to be at a fixed distance from origin (a physical simulation would probably make the trajectory elliptical...)
Thus if the extrapolation factor would be 0, the new position would be on the calculated perimeter. If it was < 0 (and > -1), you'd be interpolating inside the expected trajectory.
         O     This beautiful ascii art is trying to illustrate the integration
        /      x is the original position, o is the new one and O is the
       / ___-----   "integrated" value and the arc is a perfect circle :)
      o--      Only at the calculated position o, there is no expansion.
   --/
  / /
 / /
| /
x


text:
Q: require js file wont execute .js file won't execute
This is part of the code in my .js file I'm trying to execute with the node. I've tried switching it all about repeatedly but I can't get it to work.
    var buffer = "";
    var log = true;

A: You need to put the whole command in quotes. Since we don't know what testone.js is supposed to do, it's hard to know how it should be called.
Nevertheless, try something more like this:
require('child_process').exec('"C:\Program Files\nodejs\node.exe" testone.js', (error, stdout, stderr) => {
    if (error) {
        console.log(error)
    }
    console.log(stdout)
});


text:
Q: EF adds null-check on parameter using nvarchar Im using EF 6.4.4 and Oracle 12.2.0.1
Table1.Id is varchar2(32), and I have a linq query like this:
string tmp = "randomtext/"
var stringList = (from t in _context.Table1
select new Model1
{
   SomeText = tmp + t.Id
}).ToList();

The sql generated adds a null-check and uses nvarchar:
select ((CASE WHEN ('randomtekst/' IS NULL) THEN N'' ELSE 'randomtekst/' END)
       || ("table1"."ID")) AS "C1"

Note the N''
This results in a ORA-12704: character set mismatch error.
I have tried adding [Required(AllowEmptyStrings = true)] on the Model1.SomeText property, and also [Column(TypeName = "VARCHAR2")] on the Table1.Id property, to no effect.
Is it possible to avoid the null check all together, or if not so, at least avoid the use of nvarchar?


text:
Q: How to check if an Id exists in within a field in a List? I am trying to think of a good way to do this, but no luck yet. So: I will have two Lists: List<Date__c> and List<Project__c>. There is a look-up relationship between Project__c to Date__c, so Project__c has a field that holds the value of a Date__c id.
Goal: To find out whether there is a Project associated with a Date or not.
This should provide more clarity:
For all dates in List<Date__c>{
    If there is a Project for this date in List<Project__c>{
        get Date info, get Project info
    }
    else{
        get Date info, null
    }
}

I read about a lot of posts that refer to copying the List data into a Set or Map and use the 'contains' method, but one of my biggest problems is how to do something like PREFERRED_COLLECTION<Project__c.Lookup_Date__c>.contains(Date__c.Id)
where PREFERRED_COLLECTION could be a Map or a Set (because those support the contains method).
And what is the best way to go about this, especially when there are a lot of records to loop on? TIA.

A: There are a number of ways of doing this, and each has it's pros and cons which depend on what you want to do with the information.
Given you already have the  2 lists, you'd probably use this approach.
Because a Date__c record can have many Project__c records you probably want to construct a Map of a Date__c Id to a set of Project__c Ids.
Assuming you have the following variables:

*

*List<Date__c> dateList

*List<Project__c> projectList
Your code could look like this:
// define a map variable that will map the Id of a Date__c to a set of Project__c records
Map<Id, Set<Id>> dateToProjectMap = new Map<Id, Set<Id>> ();

// go through the Project__c records and find the ones that have one or more Date__c records
for(Project__c proj : projectList) {

    // if we haven't initialised the Set for this Date__c Id yet, let's do that
    if(!dateToProjectMap.contains(proj.Date__c)) {
        dateToProjectMap.put(proj.Date__c, new Set<Id>());
    }

    // now add the Project__c.Id to the map
    dateToProjectMap.get(proj.Date__c).put(proj.Id);
}

This would construct a Map of the Date__c records that have at least one Project__c records. Depending on what you're trying to achieve, you could then use the contains() method to work out if a Date__c record has any Project__c children.
dateToProjectMap.containsKey(dateIdWeWant);

Alternately, if you can change the query that retrieves these records, you can add the relationship within the query itself.  See also the SOQL reference guide
You could do:
// get children within one query.  Obviosuly add in some WHERE clauses and any other fields you want
List<Date> dateList = [SELECT Id (SELECT Id, Date__c FROM Project__r) FROM Date__c];

// go through the result to get the child Project__c records
for(Date__c thisDate : dateList) {
    List<Project__c> proj = thisDate.getSObjects('Project__r');

    // handle the projects
    if(proj != null) {
        // we have at least one Project__c record.  Do whatever it is you want to do with it.
    }
}

It's hard to say what to do with the results.  It will vary depending what you're trying to achieve.


text:
Q: PowerPoint 2010 has large spaces in-between characters My PowerPoint 2010 suddenly has large spaces in-between characters and it seems like some of the styles also had this same issue. Here is a screenshot:

How can I fix this issue?

A: Probably the result of one (or both) of two things:
1) No printer driver installed and set as default (or at least no adequate printer driver as default).  If you have no other printer drivers handy, make the Microsoft XPS Document Writer the default printer.
2) The presentation calls for a font that isn't installed. Check to see what font the text boxes "think" they are, then go to Control Panel | Fonts to verify that the font really is installed in Windows.

A: I fixed it by choosing paragraphs with this problem in every slide and align it left (ctrl + L).


text:
Q: Get SQL Server result using subquery I have a Members table like this:
PersonID    FirstName   Address      City      date
---------------------------------------------------------
    3       Rasanga     Skagen 21    South     2019-01-05

and a Persons table:
PersonID  FirstName   Address     City       date
-------------------------------------------------------
   3      Rasanga     Skagen 21   South      2019-01-06
   1      Tom B.      Skagen 21   Colombo    2018-01-07
   2      Tom B.      Skagen 21   Colombo    2019-01-05

I want to get Persons that do not exists in Members table using the FirstName column. For that I'm using this query:
SELECT *
FROM Persons p
WHERE NOT EXISTS (SELECT * FROM Members m WHERE m.FirstName = p.FirstName)

When I execute above query I'm getting same FirstName and 2 records but my requirement is if there's 2 records for same name retrieve latest record using date column. Therefore above scenario it should be Tom B. with 2018-01-07 record. If both records have same date should retrieve 1 record from 2 records.
Can somebody explain how to do this?

A: You can use the left join and checking the Members.PersonId is null.
create table Members(PersonID int
, FirstName varchar(20)
, Address varchar(50)
, City varchar(50)
, Dtdate date)

insert into Members values
(3, 'Rasanga', 'Skagen 21', 'South', '2019-01-05')

Create table Persons(PersonID int
, FirstName varchar(20)
, Address varchar(50)
, City varchar(50)
, Dtdate date)

insert into Persons values
(3, 'Rasanga', 'Skagen 21', 'South', '2019-01-06'),
(1, 'Tom B.', 'Skagen 21', 'Colombo', '2018-01-07'),
(2, 'Tom B.', 'Skagen 21', 'Colombo', '2019-01-05')

Select Persons.* from Persons
left join Members on Persons.PersonID = Members.PersonID
where Members.PersonId is null

Demo
Using the not exists you can check as shown below.
SELECT Persons.*
FROM   Persons
WHERE  NOT EXISTS (SELECT 1
                   FROM  Members
                   WHERE  Persons.PersonID = Members.PersonID)

Using the in operator
SELECT * FROM Persons
WHERE PersonID NOT IN (
 SELECT PersonID FROM Members
)

To get the unique records based on the first name and date you can use the following query using ROW_NUMBER() function.
;WITH cte
AS (
    SELECT Persons.*
       ,ROW_NUMBER() OVER (
        PARTITION BY Persons.FirstName ORDER BY Persons.Dtdate DESC
        ) AS RN
    FROM Persons
    LEFT JOIN Members ON Persons.PersonID = Members.PersonID
    WHERE Members.PersonId IS NULL )
SELECT *
FROM CTE
WHERE RN = 1

Output
PersonID    FirstName  Address     City     Dtdate     RN
----------------------------------------------------------
2           Tom B.     Skagen 21   Colombo  2019-01-05  1

A: You could use a window function as
SELECT T.PersonID,
       T.FirstName,
       T.Address,
       T.City,
       T.[Date]
FROM
(
  SELECT *, ROW_NUMBER() OVER(PARTITION BY FirstName ORDER BY [Date] DESC) RN
  FROM Persons
) T
WHERE NOT EXISTS
(
  SELECT 1
  FROM Members
  WHERE FirstName = T.FirstName
) AND T.RN = 1;

Here is a db<>fiddle


text:
Q: GSON how to understand 1, on, yes as booleans true? Is it possible to parse string using GSON and convert values like '1','on','yes' as booleans true?
So, I have class:
public class OItem {
    public int id;
    public String name;
    public Boolean is_online;
 }

And then I need using GSON translate it to OItem object
String string_json = "{id:200, name: Ivan Ivan, is_online : yes}";
Gson gson = new Gson();
OInfo = gson.fromJson(string_json, OInfo.class);

How to make so that some values will be treated as true, and others as false?
Thank you.

A: That's not valid JSON. {id:200, name: "Ivan Ivan", is_online : "yes"} is valid but the name and is_online values are strings.
JSON is typed - all values are Strings, Numbers, Booleans, Objects or Lists and so that's what any (de)serializer will expect. Anything else will not be JSON and therefore you won't be able to use a JSON parser to parse it.
What you want to do is have getters in OItem that check the String value against a list of "true" values and return a normal boolean instead.


text:
Q: VHDL bidirectional testbench-UUT module I am a bit new to the VHDL world and need some guidance on something that may seem trivial to many.
That I want is to build a bidirectional Testbench-UUT module,where I would be able to control the inputs' flow given by the testbench, from my main module.
Actually,I need to say to my testbench when I am ready to process the new input.
Something like, raising a flag from my 'main' module that would enable the testbench to push a new input in.That  could possibly be controlled by an if statement, and if that flag is 'up' allow the next input to flow in.
I am fiddling around with inout ports,but haven't managed sort it out this way...
Could you please assist me, and if possible give some short example code?
G

A: One fairly straightforward way of doing this is to use wait until in your stimulus process in your testbench.  If you have a data ready signal output from the block you're testing, it just look like:
STIMULUS_PROCESS: process
    while (not loopCondition) loop
        -- Apply stimulus to the inputs
        wait until dataReady = '1';
        -- Read the outputs and repeat.
    end loop;
end process;

A: Finally,i had to include a sensitivity list in my testbench process,that would contain any flag would be useful for triggering the next input.
G


text:
Q: String written to child process corrupted? I want to execute a program in a child process. The program works when I run it directly in the terminal: It waits for some input and Control+D/EOF has to be send before it processes it.
In my code below the program does not seem to receive a string properly, it seems as if it only sees some part or nothing at all when it receives EOF which also seems to happen several times even though I only send it once.
If anyone can tell me what is going wrong here?
    int main(int argc, char** argv) {
      int pipes[2][2]; //pipe[0] read, pipe[1] write

      #define PARENT_READ_FD  ( pipes[1][0] )
      #define PARENT_WRITE_FD ( pipes[0][1] )

      #define CHILD_READ_FD   ( pipes[0][0]  )
      #define CHILD_WRITE_FD  ( pipes[1][1]  )

      // pipes for parent to write and read
      assert( (pipe(pipes[1])) == 0 );
      assert( (pipe(pipes[0])) == 0 );

      int pid = fork();
      if(pid == 0) {
          char *argv[]={"/workspace/osm/overpass/osm3s_v0.7.51/bin/osm3s_query", "--db-dir=$DB_DIR"};

          assert( (dup2(CHILD_READ_FD, STDIN_FILENO)) != -1);
          assert( (dup2(CHILD_WRITE_FD, STDOUT_FILENO)) != -1);

          close(CHILD_READ_FD);
          close(CHILD_WRITE_FD);
          close(PARENT_READ_FD);
          close(PARENT_WRITE_FD);

          execv(argv[0], argv);
      } else if(pid > 0) {
          char buffer[1000];
          int count;

          close(CHILD_READ_FD);
          close(CHILD_WRITE_FD);

          int query_size = strlen(query.c_str()) + 1;
          int succesful_write = write(PARENT_WRITE_FD, &query, query_size);
          assert(succesful_write==query_size);
          close(PARENT_WRITE_FD);

          // Read from child's stdout
          while( count = read(PARENT_READ_FD, buffer, sizeof(buffer)-1) > 0){
            cerr << buffer << endl;
          }
      } else {
        cerr << "Could not fork child process" << endl;
        exit(EXIT_FAILURE);
      }
    }

The error output from the program is for example (it changes every time the program is run):
    line 1: parse error: Unknown type "�"
    line 1: parse error: An empty query is not allowed
    line 1: parse error: Unknown type "n"
    line 1: parse error: An empty query is not allowed
    line 1: parse error: Unknown type "�"
    ...