text:
Q: Broken arrows in Tikz - Two lines block diagram I want to make a two lines block diagram, and connecting the two lines is quiet difficult for me since I am a beginner in Tikz, here is my code, the best I could do :

    \documentclass{article}
    \usepackage{schemabloc}
    \usetikzlibrary{circuits}
    \usepackage{verbatim}
    \begin{document}

        \begin{tikzpicture}[cross/.style={path picture={
                \draw[black]
                (path picture bounding box.south east) -- (path picture bounding box.north west) (path picture bounding box.south west) -- (path picture bounding box.north east);
            }}]
            \sbEntree{E}
            \sbBloc[8]{fir1}{$FIR_1$}{E}
            \sbRelier[ADC Output]{E}{fir1}
            \sbBlocL{dec1}{$\downarrow 2$}{fir1}
            \sbBlocL{fir2}{$FIR_2$}{dec1}
            \sbBlocL{dec2}{$\downarrow 2$}{fir2}

            \node[draw,circle,cross,minimum width=1 cm, right of=dec2, node distance = 5em ](mixer){};
            \sbRelier{dec2}{mixer}
            \node[above of=mixer, node distance = 5em](fi){$Sin(2\pi f_It)$};

            %   \sbBloc[12]{fir3}{$FIR_3$}{E}
            \node [draw, rectangle, minimum height=3em, minimum width=3em, below of=fir1, node distance = 5em ](fir3){$FIR_3$};
            \node [draw, rectangle, minimum height=3em, minimum width=3em, right of=fir3, node distance = 5em ](dec3){$\downarrow R_3$};
            \node [draw, rectangle, minimum height=3em, minimum width=3em, right of=dec3, node distance = 7em ](resa){Resampling};
            \sbRelier{fir3}{dec3}
            \sbRelier{dec3}{resa}

            \draw[->] (fi) -- (mixer);
            \node [ right of=mixer](a){};
            \node [ below of=a](b){};
            \node [ below of=E](c){};
            \node [ below of=c, node distance=-6pt](d){};
            \draw[->] (mixer) |- (d) ;
            \draw[->] (d) |- (fir3);
            %   \draw[-] (c) -- (d);
            \end{tikzpicture}
    \end{document}

A: Since you receive answers in above comments, this answer is more focused to off.topis issue: how to simply MWE, use up-to-date syntax, and corect names for math operators. For changes made, I use two TikZ libraries: calc and positioning. Of course in MWE below is used (only one) coordinate instead of empty nodes:
\documentclass{article}
\usepackage{schemabloc}
\usetikzlibrary{calc,
                positioning}
%\usepackage{verbatim}
    \newcommand\ppbb{path picture bounding box}

\begin{document}

\begin{tikzpicture}[
node distance = 3em and 2em,
mixer/.style = {circle, draw, minimum size=3em,
    path picture={\draw[black]  (\ppbb.south east) -- (\ppbb.north west)
                                (\ppbb.south west) -- (\ppbb.north east);},
    node contents={}
              },
block/.style = {draw, rectangle, minimum height=3em, minimum width=3em}
              ]
\sbEntree{E}
\sbBloc[8]{fir1}{$FIR_1$}{E}
\sbRelier[ADC Output]{E}{fir1}
\sbBlocL{dec1}{$\downarrow 2$}{fir1}
\sbBlocL{fir2}{$FIR_2$}{dec1}
\sbBlocL{dec2}{$\downarrow 2$}{fir2}

\node (mixer)   [mixer,right=of dec2];
\sbRelier{dec2}{mixer}
\node (fi)      [above=of mixer] {$\sin(2\pi f_It)$};

%   \sbBloc[12]{fir3}{$FIR_3$}{E}
\node (fir3) [block, below=of fir1] {$FIR_3$};
\node (dec3) [block, right=of fir3] {$\downarrow R_3$};
\node (resa) [block, right=of dec3] {Resampling};
\sbRelier{fir3}{dec3}
\sbRelier{dec3}{resa}
%
\coordinate[left=of $(fir1.west)!0.5!(fir3.west)$] (a);

\draw[->] (fi) -- (mixer);
\draw[->] (mixer) |- (a)  |- (fir3);
\end{tikzpicture}
\end{document}


text:
Q: Instana integration with create-react-app to download sourcemap for error reporting The source map for CRA is enabled by default. I have given Instana the permission to download source map from my application in production, but the errors reported are still compressed and uglified. I guess the configuration has no effect.
Referring to this doc.
When I do a curl for the source map from the terminal, it works.
My site is on HTTPS, but the doc says it makes an HTTP request.
Is that the root cause? How to fix it?
//Curl
curl 'https://{my url}/static/js/{sourcemap name}.map' -H
'cache-control: no-cache' -H
'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36'

A: Instana will use the same protocol to make the sourcemap request. The documentation example uses http, but it will work with https the same way.
The most likely reason for your problem is that the sourcemap is not readable from the public internet. In your case, the sourcemap file requires http session authentication and redirects to a login page.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Android after adding viewBinding true app can't build I've fully working application, then I've decided to migrate to viewBinding and it does not build anymore.
Here is my error -

My gradle setup -

A: It looks like you have a toggle_style.xml file in your layout directory that isn't actually a layout. You'll want to move that to the correct directory so that View Binding doesn't try to process that file.


text:
Q: finding the actions of semidirect products in GAP I am a newbie in GAP, and I couldn't find how one can find the action of a semi direct product in GAP. Can anyone help me with it?
More specifically, I am working with SmallGroup(720,774). GAP tells me that the group structure is $((C_3 \times (C_{15} \rtimes C_4)) \rtimes C_2) \rtimes C_2$, and I would like to know the actions of the three semi-direct products in the structure.
Thanks


text:
Q: Elasticsearch advanced search I find Elasticsearch gem and want to use it. For example I have:
Method in app/controller/search_controller.rb:
def search
  if params[:q].nil?
    @articles = []
  else
    @articles = Article.search params[:q]
  end
end

View at app/views/search/search.html.erb:

Articles Search

<%= form_for search_path, method: :get do |f| %>

    <%= f.label "Search for" %>
    <%= text_field_tag :q, params[:q] %>
    <%= submit_tag "Go", name: nil %>

<% end %>

  <% @articles.each do |article| %>

        <%= link_to article.title, controller: "articles", action: "show", id: article._id%>

  <% end %>

And search route at config/routes.rb:
get 'search', to: 'search#search'

I want to create advansed search.
For example, when I write #cucumber in search line, I want to get the following line: localhost:3000/tagged?tag=cucumber.
It is necessary for me to display products by tag. How to do it?

A: I will prefer to do this in your action.
tags = params[:q].present? ? params[:q].scan(/#[^ #]+/).collect{|tag| tag.gsub(/#/, '')} : []

now you can use this array of tags in search function


text:
Q: C# How to get two pictureboxes to intersect? I have an appointment for school in Visual Studio. I am working on a game. I have made 2 picture boxes. One is the runner, the other is the obstacle. I want to have an action when the runner and the obstacle intersect. Therefor I have written an pice of code, does someone know what is wrong about this code, and why it is not working? It isn't that the aren't intersecting.
private void BtnStart_Click(object sender, EventArgs e)
        {
            BtnStart.Visible = false;
            TmrObject.Start();

            if (PbObstakel1.Bounds.IntersectsWith(PbPoppetje.Bounds))
            {
                MessageBox.Show("Ur dead");
            }
        }

And this is the code in the timer:
private void TmrObject_Tick(object sender, EventArgs e)
        {
            PbObstakel1.Location = new Point(PbObstakel1.Location.X - 5, PbObstakel1.Location.Y);
        }

A: As suggested by Ralf:
private void TmrObject_Tick(object sender, EventArgs e)
{
    PbObstakel1.Location = new Point(PbObstakel1.Location.X - 5, PbObstakel1.Location.Y);

    if (PbObstakel1.Bounds.IntersectsWith(PbPoppetje.Bounds))
    {
        TmrObject.Stop();
        MessageBox.Show("Ur dead");
    }
}


text:
Q: Using ajax to load a view in codeigniter I have a view which is essentially made up of three forms, all inside their own div.
On page load I want to have the first form shown and the other two hidden and if the validation is successful then I want the first form to hide and have the second one made visible and so on.
I currently have them all working in separate views but I don't want page refreshes.
I want to do all of this using ajax so that the page doesn't refresh, I've not used ajax before so any help, tips, etc would be great. Many thanks in advance.

A: Two ways you could do this:
a) Put all forms in one view. Set the css styles of the ones you don't need to display: none; and only show one form.
b) Create controller methods to show the individual views. Use a JavaScript Framework like JQuery to show your forms with Ajax (for example with the load-function, calling your controller methods).

A: Ajax is really friendly, especially with jQuery. Read more about it here: jQuery.post()
You don't necessary need to create views for every controller functions, and you can utilize that and make ajax calls to the controller.
There are obviously different methods of doing this, but for simplicity sake, I've wrote an example here:
HTML:

   <form>
      <input type="text" name="form1_input1" id="form1_input1" />
      <input type="text" name="form1_input2" id="form1_input2" />
      <input type="button" value="Next" name="form1_next" id="form1_next" />
   </form>

   <form>
      <input type="text" name="form2_input1" id="form2_input1" />
      <input type="text" name="form2_input2" id="form2_input2" />
      <input type="button" value="Next" name="form2_next" id="form2_next" />
   </form>

   <form>
      <input type="text" name="form3_input1" id="form3_input1" />
      <input type="text" name="form3_input2" id="form3_input2" />
      <input type="button" value="Next" name="form3_next" id="form3_next" />
   </form>

JQuery:
$(document).ready(function() {
    $("#form2").hide(); // hides form2 and form3 elements on document load
    $("#form3").hide();

    $("#form1_next").click(function() {
        var form1_input1 = $("#form1_input1").val(); // retrieve values from input
        var form1_input2 = $("#form1_input2").val();
            $.post("LINK-TO-CONTROLLER", { form1_input1: form1_input1, form1_input2: form1_input2 },
               function(data){
                   $("#form1").hide();
                   $("#form2").show(); // shows form 2, hides form 1
            });
    });

    $("#form2_next").click(function() {
        var form2_input1 = $("#form2_input1").val(); // retrieve values from input
        var form2_input2 = $("#form2_input2").val();
            $.post("LINK-TO-CONTROLLER", { form2_input1: form2_input1, form2_input2: form2_input2 },
               function(data){
                   $("#form2").hide();
                   $("#form3").show(); // shows form 2, hides form 1
            });
    });

    $("#form3_next").click(function() {
        var form3_input1 = $("#form3_input1").val(); // retrieve values from input
        var form3_input2 = $("#form3_input2").val();
            $.post("LINK-TO-CONTROLLER", { form3_input1: form3_input1, form3_input2: form3_input2 },
               function(data){
                   $("#form3").hide();  // finish
                   alert("COMPLETE!");
            });
    });
});

In PHP CodeIgniter:
You would retrieve the post variables using $this->input->post("form1_input1"); etc... You do not need to return views.
function my_controller_form_one() {
    $input_one = $this->input->post("form1_input1");
    $input_two = $this->input->post("form1_input2");
    $this->my_model->doSomething($input_one, $input_two);
    return true;  // need not return anything, really. Unless you are doing server-side validation stuff.
}


text:
Q: TilePane: como criar evento individual nos botões tenho uma dificuldade em usar o TilePane, não consigo criar um evento para cada botão do array. Segue o código para vocês me ajudarem.
   `TilePane tilePane = new TilePane();
    tilePane.setPrefColumns(3); //preferred columns
    tilePane.setAlignment(Pos.CENTER);

    Button[] buttons = new Button[9];

    for (int j = 0; j < buttons.length; j++) {

        buttons[j] = new Button("" + (""), new ImageView(BUTTON_CLOSE_IMAGE));
        buttons[j].setId("btn_transparent");
        buttons[j].setPrefSize(90, 90);
        tilePane.getChildren().add(buttons[j]);

        // Aqui tenho um layout com nove botões em três colunas, mas quero que cada         //botão tenha um código diferente. como fazer isso?

    }`

A: estava errando quanto ao local em que estava colocando o evento, mas fazendo várias tentativas, acabei conseguindo:
TilePane tilePane = new TilePane();
tilePane.setPrefColumns(3); //preferred columns
tilePane.setAlignment(Pos.CENTER);

Button[] buttons = new Button[9];

for (int j = 0; j < buttons.length; j++) {

    buttons[j] = new Button("" + (""), new ImageView(BUTTON_CLOSE_IMAGE));
    buttons[j].setId("btn_transparent");
    buttons[j].setPrefSize(90, 90);
    tilePane.getChildren().add(buttons[j]);

}
 buttons[0].setOnAction(e -> System.out.print("oi")); // Minha resposta


text:
Q: Issue with jquery-ui dialog auto height I'm having an issue adjusting the jquery-ui dialog height.  I am using version 1.10.3.
My dialog initialization looks like this:
 $('#dlgOnlineChange').dialog({
    autoResize: true,
    autoOpen: false,
    modal: true,
    width: '800',
    height: 'auto',
    resizable: false,
    title: "Details"
});

When the dialog opens, height is set to auto but the dialog is not tall enough to show all of the data.  The dialog is not opened until all of the data is loaded so i'm not sure why this would be the case.
If i try to hard code a height like this:
 $('#dlgOnlineChange').dialog({
    autoOpen: false,
    modal: true,
    width: '800',
    height: '900',
    resizable: false,
    title: "Details"
});

The dialog is high enough but it still shows the scroll bar but only on the top portion of the dialog:

My modal markup looks like this:

        @using (Html.BeginForm("UpdateOnlineChange", "Contact", FormMethod.Post, new { area = "Admin", id = "frmDlgOnlineChange", @role = "form" }))
        {

                        ID

                        NAME

                        EFFECTIVE DATE

                        SUBMITTED DATE

CURRENT INFORMATION

                            HOME ADDRESS:

                            OFFICE ADDRESS:

                            MAILING ADDRESS:

                            PUBLIC ADDRESS:

                            PHONE(S):

                                Home:

                                Office:

                                Mobile:

                                Fax:

                                Other:

                            EMAIL ADDRESS(ES):

                                Primary:

                                Secondary:

                                Other:

SUBMITTED INFORMATION

                        HOME ADDRESS:

                        OFFICE ADDRESS:

                        MAILING ADDRESS:

                        PUBLIC ADDRESS:

                        PHONE(S):

                            Home:

                            Office:

                            Mobile:

                            Fax:

                            Other:

                        EMAIL ADDRESS(ES):

                            Primary:

                            Secondary:

                            Other:

        }

Can someone please help me figure out what's going on here?

A: You can get the window height instead:
$('#dlgOnlineChange').dialog({
autoResize: true,
autoOpen: false,
modal: true,
width: '800',
height: window.innerHeight,
resizable: false,
title: "Details"});

A: I added position to my dialog initialization and it's sizing correctly now.   I also removed the height. Dialog initialization now looks like this:
$('#dlgOnlineChange').dialog({
    autoOpen: false,
    modal: true,
    width: '800',
    resizable: false,
    title: "Details",
    position: [($(window).width() / 2), 150]
});

I'm not sure why this works but i'm going with it for now.  I'm definitely open for better solutions if there's one out there.


text:
Q: How to change font size at breakpoints bootstrap 5 with API (#2) A previous stack exists on this topic and seems resolved.
How to change font size at breakpoints bootstrap 5
However it doesn't work for me unfortunately as :
1 / when i put the bootstrap API code on my file i have some errors like "map" or "," or ";"
I probably not copy past the correct code. (here on bootstrap doc)
https://getbootstrap.com/docs/5.0/utilities/api/
2/ Obviously i do not have the expected generator code on my sass raw file.
Like
.fs-sm-n
.fs-md-n
.fs-lg-n
.fs-xl-n
.fs-xxl-n

where "n" is a number from 1-6
I have 2 sass files :

global.scss including (currently working):

@use "sass:map";

@import "../node_modules/bootstrap/scss/functions";

@import "../node_modules/bootstrap/scss/variables";
@import "../node_modules/bootstrap/scss/utilities";

@import "./palette";
@import "./custom";
@import "./utilities";
@import "./components";

@import "../node_modules/bootstrap/scss/bootstrap.scss"

————

A second file with personal utilities.scss file (currently working):

    $utilities: (

  "height": map-merge(

    map-get($utilities, "height"),

    (

      values: map-merge(

        map-get(map-get($utilities, "height"), "values"),

        (300: 300px, 400: 400px, 600: 600px)

      )

    )

  )

)

—————
Now which part of code i need to pick up from the api bootstrap script and paste on with sass file  ? Normally in the utilities.scss file. If so, i guess that the previous code in this file need to be readjusted with " ; " at the end ?
I let you explained me :)
Here is the bootstrap script extract :
————
ENABLE RESPONSIVE
You can enable responsive classes for an existing set of utilities that are not currently responsive by default. For example, to make the border classes responsive:
```
@import "bootstrap/scss/functions";

@import "bootstrap/scss/variables";
@import "bootstrap/scss/utilities";
$utilities: map-merge(
$utilities, (
"font-size": map-merge(

  map-get($utilities, "font-size"),

  ( responsive: true ),

),

)
);

I've replaced here border by font-size.

Thank you so much for your BIG help :)

A: Here is what I used to add breakpoint font sizes to my REACT project, contributing to help someone else who comes across this in the future.
@import "~bootstrap/scss/mixins/banner";
@include bsBanner("");

// scss-docs-start import-stack
// Configuration
@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/variables";
@import "~bootstrap/scss/maps";
@import "~bootstrap/scss/mixins";
@import "~bootstrap/scss/utilities";

// Layout & components
@import "~bootstrap/scss/root";
@import "~bootstrap/scss/reboot";
@import "~bootstrap/scss/type";
@import "~bootstrap/scss/images";
@import "~bootstrap/scss/containers";
@import "~bootstrap/scss/grid";
@import "~bootstrap/scss/tables";
@import "~bootstrap/scss/forms";
@import "~bootstrap/scss/buttons";
@import "~bootstrap/scss/transitions";
@import "~bootstrap/scss/dropdown";
@import "~bootstrap/scss/button-group";
@import "~bootstrap/scss/nav";
@import "~bootstrap/scss/navbar";
@import "~bootstrap/scss/card";

@import "~bootstrap/scss/accordion";
@import "~bootstrap/scss/breadcrumb";

@import "~bootstrap/scss/pagination";
@import "~bootstrap/scss/badge";
@import "~bootstrap/scss/alert";
@import "~bootstrap/scss/progress";
@import "~bootstrap/scss/list-group";
@import "~bootstrap/scss/close";
@import "~bootstrap/scss/toasts";
@import "~bootstrap/scss/modal";
@import "~bootstrap/scss/tooltip";
@import "~bootstrap/scss/popover";
@import "~bootstrap/scss/carousel";
@import "~bootstrap/scss/spinners";
@import "~bootstrap/scss/offcanvas";
@import "~bootstrap/scss/placeholders";

// Helpers
@import "~bootstrap/scss/helpers";

$utilities: map-merge(
  $utilities,
  (
    "font-size":
      map-merge(
        map-get($utilities, "font-size"),
        (
          responsive: true
        )
      )
  )
);

// Utilities
@import "~bootstrap/scss/utilities/api";

If anyone wants the generated CSS to paste into a non-SCSS based Bootstrap site, this should be the complete set of CSS generated by the above code with standard font sizes:
.fs-1 {
  font-size: calc(1.375rem + 1.5vw) !important;
}

.fs-2 {
  font-size: calc(1.325rem + 0.9vw) !important;
}

.fs-3 {
  font-size: calc(1.3rem + 0.6vw) !important;
}

.fs-4 {
  font-size: calc(1.275rem + 0.3vw) !important;
}

.fs-5 {
  font-size: 1.25rem !important;
}

.fs-6 {
  font-size: 1rem !important;
}

@media (min-width: 576px) {
  .fs-sm-1 {
    font-size: calc(1.375rem + 1.5vw) !important;
  }
  .fs-sm-2 {
    font-size: calc(1.325rem + 0.9vw) !important;
  }
  .fs-sm-3 {
    font-size: calc(1.3rem + 0.6vw) !important;
  }
  .fs-sm-4 {
    font-size: calc(1.275rem + 0.3vw) !important;
  }
  .fs-sm-5 {
    font-size: 1.25rem !important;
  }
  .fs-sm-6 {
    font-size: 1rem !important;
  }
}
@media (min-width: 768px) {
  .fs-md-1 {
    font-size: calc(1.375rem + 1.5vw) !important;
  }
  .fs-md-2 {
    font-size: calc(1.325rem + 0.9vw) !important;
  }
  .fs-md-3 {
    font-size: calc(1.3rem + 0.6vw) !important;
  }
  .fs-md-4 {
    font-size: calc(1.275rem + 0.3vw) !important;
  }
  .fs-md-5 {
    font-size: 1.25rem !important;
  }
  .fs-md-6 {
    font-size: 1rem !important;
  }
}
@media (min-width: 992px) {
  .fs-lg-1 {
    font-size: calc(1.375rem + 1.5vw) !important;
  }
  .fs-lg-2 {
    font-size: calc(1.325rem + 0.9vw) !important;
  }
  .fs-lg-3 {
    font-size: calc(1.3rem + 0.6vw) !important;
  }
  .fs-lg-4 {
    font-size: calc(1.275rem + 0.3vw) !important;
  }
  .fs-lg-5 {
    font-size: 1.25rem !important;
  }
  .fs-lg-6 {
    font-size: 1rem !important;
  }
}
@media (min-width: 1200px) {
  .fs-xl-1 {
    font-size: calc(1.375rem + 1.5vw) !important;
  }
  .fs-xl-2 {
    font-size: calc(1.325rem + 0.9vw) !important;
  }
  .fs-xl-3 {
    font-size: calc(1.3rem + 0.6vw) !important;
  }
  .fs-xl-4 {
    font-size: calc(1.275rem + 0.3vw) !important;
  }
  .fs-xl-5 {
    font-size: 1.25rem !important;
  }
  .fs-xl-6 {
    font-size: 1rem !important;
  }
}
@media (min-width: 1400px) {
  .fs-xxl-1 {
    font-size: calc(1.375rem + 1.5vw) !important;
  }
  .fs-xxl-2 {
    font-size: calc(1.325rem + 0.9vw) !important;
  }
  .fs-xxl-3 {
    font-size: calc(1.3rem + 0.6vw) !important;
  }
  .fs-xxl-4 {
    font-size: calc(1.275rem + 0.3vw) !important;
  }
  .fs-xxl-5 {
    font-size: 1.25rem !important;
  }
  .fs-xxl-6 {
    font-size: 1rem !important;
  }
}
@media (min-width: 1200px) {
  .fs-1 {
    font-size: 2.5rem !important;
  }
  .fs-2 {
    font-size: 2rem !important;
  }
  .fs-3 {
    font-size: 1.75rem !important;
  }
  .fs-4 {
    font-size: 1.5rem !important;
  }
  .fs-sm-1 {
    font-size: 2.5rem !important;
  }
  .fs-sm-2 {
    font-size: 2rem !important;
  }
  .fs-sm-3 {
    font-size: 1.75rem !important;
  }
  .fs-sm-4 {
    font-size: 1.5rem !important;
  }
  .fs-md-1 {
    font-size: 2.5rem !important;
  }
  .fs-md-2 {
    font-size: 2rem !important;
  }
  .fs-md-3 {
    font-size: 1.75rem !important;
  }
  .fs-md-4 {
    font-size: 1.5rem !important;
  }
  .fs-lg-1 {
    font-size: 2.5rem !important;
  }
  .fs-lg-2 {
    font-size: 2rem !important;
  }
  .fs-lg-3 {
    font-size: 1.75rem !important;
  }
  .fs-lg-4 {
    font-size: 1.5rem !important;
  }
}

Hopefully this helps someone in the future!


text:
Q: G AppScript Search Files I am trying to write a script that will allow me to search within all of google drive, including shared teams and subfolders (Many Subfolders)
With what I wrote I can't find all the files, in fact there is a discrepancy between the ones I see from the web page and the ones the script returns to me
This is just a part of the script, when the file is found, it is moved to a folder. I have several files to move, via browser it is not manageable.
function SearchFiles() {
  //Please enter your search term in the place of Letter
  var searchFor ='title contains "find ME"';
  var names =[];
  //var fileIds=[];
  var files = DriveApp.searchFiles(searchFor);
  while (files.hasNext()) {
    var file = files.next();
    //var fileId = file.getId();// To get FileId of the file
    //fileIds.push(fileId);
    var name = file.getName();
    names.push(name);

  }

  for (var i=0;i<names.length;i++){
    Logger.log(names[i]);
    //Logger.log("https://drive.google.com/uc?export=download&id=" + fileIds[i]);

  }

}

A: To find all files including the ones on Shared Drives, you need to use the Advanced Drive Service instead of DriveApp

*

*As the documentation for searchFiles(params) specifies:

Gets a collection of all files in the user's Drive

*

*On the contrary, the Advanced Drive Service based on the Drive API v2 allows you to set the parameters supportsAllDrives and includeItemsFromAllDrives to true and thus obtain results from all Drives

*To use the Advanced Drive Service, first you need to enable it following the instructions

*Then, you can use the method Files: list setting the query parameter q to title contains 'find ME'
In Apps Script it could look as following:
function SearchFiles() {
  var searchFor ='title contains "findMe"';
  var files = Drive.Files.list({supportsAllDrives: true, includeItemsFromAllDrives: true, q: searchFor}).items;
  for (var i=0; i<files.length; i++){
    Logger.log(files[i].title);
  }
}


text:
Q: How to send interrupt/ ctrl C during execution of expect script I am trying to execute some commands and one of which will not come back to console and need to explicitly bring it using ctrl+ c. After that I need to execute some more commands in that script.
expect "$ "
send "sh /root/jboss-eap-6.3/bin/standalone.sh\r"
set timeout 10

expect "$ "

I have to run other commands after executing standalone.sh script. But it will hold and not come back to console.
I tried
trap {
    send \x03
    send_user "You pressed Ctrl+C\n"
} SIGINT

.
But that also didn't worked.
Thanks in advance.

A: There are all sorts of ways to kill a process in bash. If you by some chance know the name of your (jboss eap) process you could run pkill processName, killall processName or kill pidof processName instead of trying to send key-strokes.


text:
Q: How delete object from array in mongodb? i using MongoDb and NodeJs and i have a little problem with deleting object from array of objects. Here is my code
router.route('/deleteGuestFromJam/:id').delete(function(req, res){

Jam.find({_id: req.params.id}, function(err, jam){

    jam.guests = _.without(jam.guests, _.findWhere(jam.guests, {id: req.user.id}));

    jam.save(function(err, jam) {
        if (err){
            return res.status(500).send(err)
        }
        console.log(jam.guests)
        return res.status(200).send(jam);
    });

})

And when i call this route the console give me "jam.save is not a function" error. Someone can explain me why is it happening ?. Thx for answers

A: You can use update like this
Jam.update({_id: req.params.id},
    { $pull: {
           guests: {
                  $elemMatch: { id: req.user.id }
           }
       }
     }, function(){....});

It will pull out the matched object from quests array.
See mongo docs here


text:
Q: Does crt0 load msvcrt.dll? I'm trying to figure out how are Standard C Functions like printf() loaded into memory on Windows environment.
I know that crt0.obj prepares the stack, calls int main(int argc, char **argv) and then exits the process with the exit code that main returned.
I also heard that C standard functions are located in a shared library called msvcrt.dll. I'm wondering if crt0 also loads msvcrt.dll or there is a msvcrt.lib which is also linked automatically by the compiler.
Thank you and sorry for my English :)

A: There will always be a run-time environment, such as msvcr80.dll (for Windows variants), loaded when you install your environment, what ever it is, i.e. MSVCxx, Code::Blocks with MinGW, etc.  The environment installer places .dlls containing the standard C libraries (for C environments) into your system directory, and provides all necessary static libs to link to during your builds, and header files for prototypes and defines necessary to use that environment.  You just need to set your path, (to see the.libs) and #include the right headers in your source code.
Note, for Operating systems such as Linux varieties the run-time environment is built into the OS, and incudes all shared libraries (synonymous with .dll) static libraries and .h for standard C.
Regarding your question on msvcrt.dll,  read @Eric's comment above.  Current RTEs from Microsoft use a nameing convention in the form msvcrnnn.dll  (eg. msvcr80.dll, msvcr100.dll,... and so on depending on addressing (32 or 64 bit), OS version, etc.)
Regarding your statement:  also linked automatically by the compiler.  That is completely environment dependent. If you are using Microsoft's development environment, then yes, it is likely already set up with defaults to allow your linking to work right out of the box.  If using Microsoft libraries, but from a non-Microsoft environment, paths and other environment variables need to be set in order to pick up the .lib and .h locations.
(Regarding your English:  it is better than that spoken by most of the engineers I work with.)

A: Here are some good pages for what gets linked with regards to the C runtime and the standard library (1,2,3):
crt0.obj is part of libcmt.lib, which is the CRT static library (COFF archive). You can instead choose to dynamically link the CRT by statically linking with a COFF import library, msvcrt.lib, which will cause dynamic linking with msvcr<version>.dll at runtime.
The standard library is implemented in libpcmt.lib and the dynamic version is msvcprt.lib, which will cause dynamic linking with msvcp<version>.dll at runtime.
My libcmt.lib on VS2017 does not have a crt0.obj object-file archive member and instead appears to implement mainCRTStartup in exe_main.obj and WinMainCRTStartup in exe_winmain.obj


text:
Q: Marshal Structure SizeOf error I have a load of UDTs, I'm trying to use Marshal and FileGet to read a record into a Structure.
The function is fine with the first structure which only contains a Long and an Integer, the structure is returned, no problem.
My problem starts with the second record.
I have the structure defined with the MarshalAs properties for each field:
<StructLayout(LayoutKind.Sequential)>
Public Structure typStaticData
    <MarshalAs(UnmanagedType.AsAny, SizeConst:=8)> Public DateStamp As Nullable(Of Date)       '8
    <MarshalAs(UnmanagedType.U8)> Public Farmcode As Nullable(Of Long)        '8
    <MarshalAs(UnmanagedType.AsAny, SizeConst:=8)> Public StartDate As Nullable(Of Date)       '8
    <MarshalAs(UnmanagedType.U8)> Public NoTrans As Nullable(Of Long)         '8
    <MarshalAs(UnmanagedType.Bool)> Public ClosingVisit As Nullable(Of Boolean) '1
    <MarshalAs(UnmanagedType.U1)> Public FileType As Nullable(Of Byte)        '1
    <MarshalAs(UnmanagedType.AnsiBStr)> Public Cat As String
    <MarshalAs(UnmanagedType.AsAny, SizeConst:=8)> <VBFixedArray(11)> Public VisitDates() As Nullable(Of Date)      ' (1 To 12)    ' 12 * 8
    <MarshalAs(UnmanagedType.Bool)> <VBFixedArray(11)> Public VisitDOC() As Nullable(Of Boolean)     ' (1 To 12)    ' 12 * 1
    <MarshalAs(UnmanagedType.AnsiBStr)> Public filler As String
    <MarshalAs(UnmanagedType.Currency, SizeConst:=16)> Public fillercur As Nullable(Of Decimal)    '16
    <MarshalAs(UnmanagedType.U8)> Public fillerLong As Nullable(Of Long)      '8
    <MarshalAs(UnmanagedType.AsAny, SizeConst:=8)> Public ERRDate As Nullable(Of Date)         '8
    <MarshalAs(UnmanagedType.AsAny, SizeConst:=8)> Public fillerDate1 As Nullable(Of Date)     '8
    <MarshalAs(UnmanagedType.AsAny, SizeConst:=8)> Public fillerDate2 As Nullable(Of Date)     '8
End Structure

The Subroutine to Read the data is:
   Public Sub ReadBinaryFile(ByRef outValue As Object,
                          Optional ByRef inRecordCount As Integer = 1)
    Const C_PROC_NAME = "ReadBinaryFile"
    ' remember to convert Dates from their "Long/ticks" equivalent

    If iFreeFile = 0 Then Exit Sub

    Try
        Dim recordLength As Integer = Marshal.SizeOf(outValue) '<-------------
        Dim myBytes As Byte() : ReDim myBytes(recordLength)

        FileGet(iFreeFile, myBytes, inRecordCount)
        BuildStr(myBytes, outValue.GetType, outValue)
        inRecordCount += 1
    Catch ex As Exception
        If gDebug Then Console.WriteLine(CODE_MODULE & "-" & C_PROC_NAME & ": " & ex.Message)
        oERR.LogFileError(inModule:=CODE_MODULE,
                          inRoutine:=C_PROC_NAME,
                          inEX:=ex, inErr:=Err)
        If gDebug Then Stop
    End Try
End Sub

The error I keep getting, and can't get past is:
ReadBinaryFile: Type 'Claims32.modStaticData+typStaticData[]' cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed.

I've tried several different

Where am I going wrong here, and what else do I need to do?


text:
Q: Centering buttons within a div I can't seem to center the social media buttons. the all-soc-share class right now is empty. How should I center them in css? (its a hassle to provide a fiddle)
The HTML code

                           Tweet

The CSS
.soc-share{
    float: left;
    margin-right: 30px;
}

A: Not sure why you have the float left in there.  Try this:
.soc-share{
    display: inline-block;
    margin-right: 30px;
}

.all-soc-share{
    width: 100%;
    text-align: center;
}

And here's a fiddle:
https://jsfiddle.net/qaq9r4fs/

A: You could do it in pure css by providing
.theclasstocenter {
      margin-left:auto;
 }

Or you could download bootstrap and center those social buttons with the custom class
"text-center."


text: Q: By mistake deleted Android sdk folder and when I try to install new software in eclipse it's showing all are installed By mistake deleted Android sdk folder and when I try to install new software in eclipse using android adt - https://dl-ssl.google.com/android/eclipse/ it's showing all items are installed.Its asking to browse sdk folder which I deleted


text:
Q: How to export specific fields of powershell output to csv? I have recently started using powershell and struggling to achieve something.
I am calling an API in my powershell script, and the output is a list of reports, where each report has a set of properties like reportID, reportname, workspaceId etc.
I need to export this entire output to csv in a proper table format, and also export only one property (workspaceId) of each report to another csv file.
If someone is aware of how to do this, please help.
Below is a part of my script:
$reports = Invoke-PowerBIRestMethod -Url 'https://api.powerbi.com/v1.0/myorg/admin/reports?$top=10' -Method Get
$reports | Out-File -Path "D:\2709\PS4.csv"

A: #to export all properties
$reports | export-csv "D:\2709\PS4.csv"

#to export a selection of properties
$reports | select-object -property workspaceId  | export-csv "D:\2709\PS4.csv"

ok I see, $reports contains a json. in principle you can convert the json to csv by doing this:
ConvertFrom-Json -InputObject $reports | export-csv "D:\2709\PS4.csv"

But this gives you only a usefull output if the structure is flat. If thats not the case we have to flattern the structure first before we can export it as csv.


text:
Q: Uploaded file is corrupt I'm trying to upload a cropped image via client using fetch. The upload process works, the file size seems to be correct too but the uploaded image is corrupt and appears to be a white 16x16 square on the server. The file won't open when I download it (damaged or corrupt). I'm struggling to understand what I'm doing wrong. The back-end is Drupal.
Uploading files directly from an input using the same postFile function works without a problem.
const toFile = (blob) => {
    blob.lastModifiedDate = new Date();
    blob.name = 'cropped.png';
    return blob;
}

const onCropperCrop = () => {
    const imageElement = cropperRef?.current;
    const cropper = imageElement?.cropper;

    cropper.getCroppedCanvas().toBlob((blob) => {
        const file = toFile(blob);
        onCrop(file);
    });
};

const onCrop = (file) => postFile(params);

export const postFile = async (
  _file,
  _uri,
  _xcsrf_token,
  _accessToken,
) => {
    let formData = new FormData();
    formData.append('File', _file);

    let headers = {
        headers: {
            Accept: 'application/hal+json',
            'Content-Type': 'application/octet-stream',
            'Content-Disposition': 'file; filename="' + _file.name + '"',
            'X-CSRF-Token': _xcsrf_token,
            Authorization: 'Bearer ' + _accessToken,
        },
    };

    return await fetch(_uri, {
        method: 'POST',
        headers: headers,
        body: formData,
        credentials: 'include'
    });
};

The file object:


text:
Q: Is double slit interference due to EM/de Broglie waves? And how does this relate to quantum mechanical waves? I'm really confused about the fact that there seems to be two types of waves at play: the EM wave, which I understand to be an actual fluctuation of EM fields in space, and this other type of bulk "wave" that's referred to in explanations of the double slit experiment, whereby the bulk light emanates as a circular, water-like wave from the two slits. The circular path of the bulk wave seems to be what results in the fringe pattern, depending on the phase (the EM phase?) of the two waves at the point where they interfere at the detector. These bulk-like waves turn out to be a consequence of quantum mechanics and even occur with single photons, but at the time the debate seemed to be between particles and these circularly-emanating waves. However, is the only reason they can interfere at all because they are fundamentally EM waves that undergo destructive interference when in opposite phase? There is a difference between the waves in question and EM waves, right?
If the only reason there are dark fringes is because the quantum mechanical distribution causes physical EM waves to interfere, how can electrons generate a fringe pattern as well? I thought the de Broglie waves were complex mathematical abstractions and not representative of physical electron waves. Are de Broglie waves in any way analogous to EM waves? Does the fringe pattern fro electrons occur because of destructive interference of de Broglie waves? Is this fundamentally different from the photon interference?

A: An electromagnetic wave is a field, it has a (possibly zero) value at every point in space at every time.
A wavefunction is not a field. It does not have a value at every point in space. For $n$ particles it is a function from $\mathbb R^{3n}$ into the joint spin state of the system. For the simplest case of one particle with spin zero it looks like a function from $\mathbb R^3$ into $\mathbb C$ so you might think it is a complex scalar field. It isn't and that's going to bite you later. And then everything will be confusing and mysterious. If you want to think quantum mechanics is confusing and mysterious then a good way to do that is to think a wavefunction is a complex scakar values field in space.

other type of bulk "wave" that's referred to in explanations of the double slit experiment, whereby the bulk light emanates as a circular, water-like wave from the two slits.

That does not happen. But you also need to be clear, there is a classical double slit experiment with light where the electromagnetic field does spread through space and pass through slits and form interference patterns that have nothing to do with quantum mechanics.

The circular path of the bulk wave seems to be what results in the fringe pattern, depending on the phase (the EM phase?) of the two waves at the point where they interfere at the detector.

Even uncharged particles experience interference when you take quantum effects into account. So it's just the phase of the (possibly zero) spin (which still has a phase even when it's zero spin).

These bulk-like waves turn out to be a consequence of quantum mechanics and even occur with single photons, but at the time the debate seemed to be between particles and these circularly-emanating waves.

If you are going to study history, you have to ask about a specific moment of history and a specific person since each person's understanding changes at specific moments in history.

However, is the only reason they can interfere at all because they are fundamentally EM waves that undergo destructive interference when in opposite phase?

No. Again, uncharged objects can still interfere. And the interference doesn't happen in physical space like $\mathbb R^3$ it happens in configuration space like $\mathbb R^{3n}$.

There is a difference between the waves in question and EM waves, right?

Every possible difference imaginable. An EM wave is a field in space and has electromagnetic fields (with six components) as its values. A Quabtum wavefunction goes from configuration space and is spin valued.

I thought the de Broglie waves were complex mathematical abstractions and not representative of physical electron waves.

It's a gauge theory so a wavefunction does have too many degrees of freedom. But it's pretty close.

Are de Broglie waves in any way analogous to EM waves?

You can add two together, just like electromagnetic waves.

Does the fringe pattern fro electrons occur because of destructive interference of de Broglie waves?

Yes. But keep in mind the interference fringes happen in regions of configuration space. And what you see when you look at the screen are residuals of that.

Is this fundamentally different from the photon interference?

I don't know what you are saying there.

You mentioned a classical double slit experiment. Are you saying the experiment was fundamentally different?

You could actually pass water waves through some slits and you notice an interference. The interference happens in a similar way for every other kind of interference. But since the wave has more space to move through sometimes when one particle hits the screen another particle has been deflected a different direction, so the wave in configuration space doesn't overlap and so no interference happens. The interference happened in the overlap. This is why interference fringes can be "destroyed" really its like deflecting the beam going through the right slit down and the beam through the left slit up so they don't overlap any more. But if the up and down in the the position of a different particle the residual of just that particle looks lined up when the waves are not overlapping.
Running the particles through one at a time is designed to control for the possibility that the many objects going through are just pushing against each other (like water does). If it's just one particle at a time going through then it has to be something else.


text:
Q: Webcam disabled by AVG antivirus I am creating a program with Qt on Windows using OpenCV.
When I launch the program, sometimes, the webcam won't start. cam.open(0) returns 1 (open succesfull) but the frames are empty. I spent many hours on this and I finally pinpoint the problem to "AVG Protection". About 50% of the time I launched the program, I was receiving empty frames. With AVG uninstalled, it works 100% of the time.
I guess AVG was sometimes detecting my program as malicious or something. I tried adding the program in the AVG exceptions but it did not change anything.
Could I do something programatically to prevent this ?
Thank you very much,
Alex

A: The same problem here for us. Some days ago customers started to report that our application does not receive video data from the camera anymore.
There are no errors or any exceptions raised.
Yesterday, I have reproduced this issue on a laptop with AVG installed. From what I can find from logs, the camera can be found and started by the application, but it does not receive any frames from it. Namely, presentFrame() method from dscamerasession.cpp is not being called back anymore by Windows process, as it used to before.
There is a question at AVG support:
https://support.avg.com/answers#!/feedtype=SINGLE_QUESTION_DETAIL&dc=All&criteria=ALLQUESTIONS&id=906b0000000DlgTAAS
Their answer is:
Please follow the instructions to change the Firewall settings to check the status : Open AVG Zen -> Internet Security -> Click on Menu in the top right corner -> Settings -> Components -> Firewall -> Customize -> Network Profiles -> Change the networks from Public to Private (If it is in Private, change it to Public).
Then check whether you are able to access it without any issues


text:
Q: opengl perspective view clipping glutSolidTeapot too early i got following code:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, (GLint)w, (GLint)h); //got w and h from QT4.7.1's QGLWidget
gluPerspective(90,1,0.1,1000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//me.position is 0;0;0
gluLookAt(me.position.x(), me.position.y(),      me.position.z(),
          me.position.x(), me.position.y(),      me.position.z()+1.0f,
          me.position.x(), me.position.y()+1.0f, me.position.z());
glTranslatef(-0.2,0.5,2);
glRotated(180,0,1,0);
glRotated(45,1,0,0);
glRotated(45,0,0,1);
glFrontFace(GL_CW);
glutSolidTeapot(0.5f);
glFrontFace(GL_CCW);

now, the problem is, opengl is clipping almost the complete teapot, and I don't understand why.
I think something is going wrong w/ the zNear/zFar planes, but I don't see why.
if anyone can tell me what I'm doing wrong/how to fix it, please do.
thanks in advance


text:
Q: Two Foreign Keys to the same Table with one inappropriately having a cascadeDelete: true. Why? Here is the model for Organization and Marker:
using System;
using System.Collections.Generic;
using System.Data.Entity.Spatial;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace MyApp.Models
{
    public class Orgainzation
    {
        public int ID { get; set; }

        [Required]
        [MaxLength(50, ErrorMessage = "Name cannot be longer than 20 characters.")]
        public string Name{ get; set; }

        [Required]
        public int MarkerId { get; set; }

        [Required]
        public int SystemMarkerId { get; set; }

        public virtual Marker Marker{ get; set; }

        [ForeignKey("SystemMarkerId")]
        public virtual Marker SystemMarker { get; set; }
    }

    public class Marker
    {
        public int ID { get; set; }

        [Required]
        [Display(Name="Marker")]
        public string MarkerName{ get; set; }

        public virtual ICollection<Organization> Organizations { get; set; }

        [InverseProperty("SystemMarkerId")]
        public virtual ICollection<Organization> SystemOrganizations { get; set; }
    }
}

Here is the DbContext with the override of OnModelCreating:
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace MyApp.Models
{
    public class MyAppDb : DbContext
    {
        public MyAppDb() : base("DefaultContextDb") { }

        public DbSet<MyApp.Models.Organization> Organizations { get; set; }
        public DbSet<MyApp.Models.Marker> Markers { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.Entity<MyApp.Models.Organization>()
                .HasRequired(x => x.Marker).WithMany(x => x.Organizations).WillCascadeOnDelete(false);

            modelBuilder.Entity<MyApp.Models.Organization>()
                .HasRequired(x => x.SystemMarker).WithMany(x => x.SystemOrganizations).WillCascadeOnDelete(false);
        }
    }
}

Here is the migration created with the inappropriate cascadeDelete: true set on the foreign key SystemMarkerId:
    public partial class Initial : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Organization",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Name= c.String(maxLength: 50),
                        MarkerId = c.Int(nullable: false),
                        SystemMarkerId = c.Int(nullable: false),

                    })
                .PrimaryKey(t => t.ID)
                .ForeignKey("dbo.Markers", t => t.MarkerId)
                .ForeignKey("dbo.Markers", t => t.SystemMarkerId, cascadeDelete: true)
                .Index(t => t.MarkerId)
                .Index(t => t.SystemMarkerId);
        }
    }

Why did it do this and how do I make it stop?


text:
Q: How do I find the largest integer fully supported by hardware arithmetics? I am implementing a BigInt class that must support arbitrary-precision operations on integers.
Quote from "The Algorithm Design Manual" by S.Skiena:

What base should I do [editor's note: arbitrary-precision] arithmetic in? - It is perhaps simplest to implement your own high-precision arithmetic package in decimal, and thus represent each integer as a string of base-10 digits. However, it is far more efficient to use a higher base, ideally equal to the square root of the largest integer supported fully by hardware arithmetic.

How do I find the largest integer supported fully by hardware arithmetic? If I understand correctly, being my machine an x64 based PC, the largest integer supported should be 2^64 (http://en.wikipedia.org/wiki/X86-64 - Architectural features: 64-bit integer capability), so I should use base 2^32, but is there a way in c++ to get this size programmatically so I can typedef my base_type to it?

A: You might be searching for std::uintmax_t and std::intmax_t.

A: static_cast<unsigned>(-1) is the max int. e.g. all bits set to 1 Is that what you are looking for ?
You can also use std::numeric_limits<unsigned>::max() or UINT_MAX, and all of these will yield the same result. and what these values tell is the maximum capacity of unsigned type.  e.g. the maximum value that can be stored into unsigned type.

A: Things are not so black and white. There are MAY issues here, and you may have other things worth considering. I've now written two variable precision tools (in MATLAB, VPI and HPF) and I've chosen different approaches in each. It also matters whether you are writing an integer form or a high precision floating point form.
The difference is, integers can grow without bound in the number of digits. But if you are doing a floating point implementation with a user specified number of digits, you always know the number of digits in the mantissa. This is fixed.
First of all, it is simplest to use a single integer for each decimal digit. This makes many things work nicely, so I/O is easy. It is a bit inefficient in terms of storage though. Adds and subtracts are easy though. And if you use integers for each digit, then multiplies are even easy. In MATLAB for example, conv is pretty fast, though it is still O(n^2). I think gmp uses an fft multiply, so faster yet.
But assuming you use a basic conv multiply, then you need to worry about overflows for numbers with a huge number of digits. For example, suppose I store decimal digits as 8 bit signed integers. Using conv, followed by carries, I can do a multiply. For example, suppose I have the number 9999.
N = repmat(9,1,4)
N =
     9     9     9     9

conv(N,N)
ans =
    81   162   243   324   243   162    81

Thus even to form the product 9999*9999, I'd need to be careful as the digits will overflow an 8 bit signed integer. If I'm using 16 bit integers to accumulate the convolution products, then a multiply between a pair of 1000 digits integers can cause an overflow.
N = repmat(9,1,1000);
max(conv(N,N))
ans =
       81000

So if you are worried about the possibility of millions of digits, you need to watch out.
One alternative is to use what I call migits, essentially working in a higher base than 10. Thus by using base 1000000 and doubles to store the elements, I can store 6 decimal digits per element. A convolution will still cause overflows for larger numbers though.
N = repmat(999999,1,10000);
log2(max(conv(N,N)))
ans =
       53.151

Thus a convolution between two sets of base 1000000 migits that are 10000 migits in length (60000 decimal digits) will overflow the point where a double cannot represent an integer exactly.
So again, if you will use numbers with millions of digits, beware. A nice thing about the use of a higher base of migits with a convolution based multiply is since the conv operation is O(n^2), then going from base 10 to base 100 gives you a 4-1 speedup. Going to base 1000 yields a 9-1 speedup in the convolutions.
Finally, the use of a base other than 10 as migits makes it logical to implement guard digits (for floats.) In floating point arithmetic, you should never trust the least significant bits of a computation, so it makes sense to keep a few digits hidden in the shadows. So when I wrote my HPF tool, I gave the user control of how many digits would be carried along. This is not an issue for integers of course.
There are many other issues. I discuss them in the docs carried with those tools.

A: int (and, by extension, unsigned int) is the "natural" size for the architecture. So a type that has half the bits of an int should work reasonably well. Beyond that, you really need to configure for the particular hardware; the type of the storage unit and the type of the calculation unit should be typedefs in a header and their type selected to match the particular processor. Typically you'd make this selection after running some speed tests.
INT_MAX doesn't help here; it tells you the largest value that can be stored in an int, which may or may not be the largest value that the hardware can support directly. Similarly, INTMAX_MAX is no help, either; it tells you the largest value that can be stored as an integral type, but doesn't tell you whether operations on such a value can be done in hardware or require software emulation.
Back in the olden days, the rule of thumb was that operations on ints were done directly in hardware, and operations on longs were done as multiple integer operations, so operations on longs were much slower than operations on ints. That's no longer a good rule of thumb.


text:
Q: Believe me right now vs believing me right now John called me when I was in the meeting so I couldn't answer his call. I told him the reason why I couldn't answer his call but he refuses to buy it.
Which of the following sentences should I use.

Why are you not believing me right now?

Vs

Why don't you believe me right now?

What is the difference?
Which one sounds more natural in terms of its usage and what meaning do they carry?
And what's the difference in usage of believe vs believing in general?

A: "Why don't you believe me right now" is more natural. I think it boils down to the perception that people control what they believe in, and not that it's something that they're just handed. (If you look at the current political situation, you will see a lot of this!)
That said, I'd just leave out the "right now" -- it's clear what John is thinking you're lying about.
I think the use of "believing" is more "to continue to believe". Like "I must not stop believing!"

A: The sentence

"I believe Bob's story."

Indicates a state of being. There is no real action still being performed. That is why "I am believing" sounds unnatural:

** "I am not believing Bob's story."

Although you could say this, it is unusual because it implies that you are still in the process of deciding whether or not you believe Bob's story. If this is the case, it would probably be better to use a different word:

"I am unconvinced by Bob's story."

Or use believe with not yet:

"I do not yet believe Bob's story."

I am (verb)+ing
When a verb is an action, it is quite natural to use it with the progressive form (-ing):

"They recite Shakespeare."

Recite is an action, so it is also quite natural to say:

"They are reciting Shakespeare."

Believe, Know, Think
Besides believe, another word which is usually only used to signal a state is know:

"He knows the answer to this riddle."

Know is just a verb, but here (and in most cases) it indicates the state of being that you know something. Yesterday, you didn't know Alice. Today, you meet Alice. Now you know Alice. For the same reason, saying "am knowing" or "is knowing" in this sense is unnatural:

** "He is knowing the answer to this riddle."

If you are still in the process of thinking of an answer, 'think' would be more appropriate:

"I am thinking of the answer to this riddle."

Note that 'think' can also be used to mean 'believe', and if you use it in that way, you have the same problem as with 'believe':

"I think Bob is telling the truth."

Here, think shows your state of mind. Thinking Bob is telling the truth is the same as believing Bob. Your thinking process has concluded and no further action is being performed. Thus, this sounds unnatural:

** "I am thinking Bob is right."

Of knowing, of believing
When speaking abstractly about words, "knowing", "believing" and so on can be used. But these also feel strange if you try to translate them to actions:

"The state of knowing everything is unobtainable. The more you know, the more you know what you don't know."
→ ** "No man is knowing everything."
→ "No man knows everthing."
"The state of being blissfully unaware of the plights of others."
→ ** "You are being blissfully unaware."
→ "You are blissfully unaware.
→ "You are ignoring the plights of others."

Ignore is a clear action, so using it in the progressive is quite natural.
Know thyself
"Know", "believe" and so on can be used commands (imperatives):

"To pass the test, know how to solve this problem without using a
  calculator."
"Believe me! I didn't mean to hurt him."

You could interpret these statements as literally meaning something like "please put yourself in a state of mind that you know how to solve this problem" or "please put yourself in the state of being that you believe me."


text:
Q: PyICU works in Django shell but not on web server I'm getting this error when trying to access ICU's Collator attribute on a staging server.
AttributeError at /...
'module' object has no attribute 'Collator'

When launching Django's shell and executing the exact same code, everything seems to be working just as well as it does locally. The code that is causing the error is:
import icu
    collator = icu.Collator.createInstance(icu.Locale(get_language()))
    objects = [i for i in sorted(objects, key=attrgetter('city'), cmp=collator.compare)]

I've successfully installed ICU (libicu52, libicu-dev) via Ondrej's PHP5 PPA, as well as PyICU, both locally and on our staging server. The server running Ubuntu Server 13.10 with Python 2.7.5, Django 1.5.5, Nginx 1.4.1 and uWSGI 1.9.13.
Here's the full traceback:
File "/var/www/venv/site/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/var/www/venv/site/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)
File "/var/www/venv/site/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  86.         return handler(request, *args, **kwargs)
File "/var/www/.../pages/views.py" in get
  48.             return StoreListView.as_view(object=self.object)(request)
File "/var/www/venv/site/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)
File "/var/www/venv/site/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  86.         return handler(request, *args, **kwargs)
File "/var/www/venv/site/local/lib/python2.7/site-packages/django/views/generic/list.py" in get
  124.         self.object_list = self.get_queryset()
File "/var/www/.../geosearch/views.py" in get_queryset
  22.             objects = self.sort_objects(objects)
File "/var/www/.../geosearch/views.py" in sort_objects
  59.         collator = icu.Collator.createInstance(icu.Locale(get_language()))

Exception Type: AttributeError at /...
Exception Value: 'module' object has no attribute 'Collator'

I managed to print ICU's __dict__, but it gives me an ICUError. Locally, ICU is returned with its actual attributes, including Collator.
ICUError=<class 'icu.ICUError'>,
__builtins__={'bytearray': <type 'bytearray'>,
'IndexError': <type 'exceptions.IndexError'>
[...]

What might be the reason the code is working as it should in Django's shell, but not through the web server?

A: It turned out to be a misconfiguration in uWSGI, and had nothing to do with PyICU or ICU. I figured out uWSGI was not using the packages installed in the virtualenv, so I had a second look in the uWSGI config file.
chdir was not set to the correct folder, instead it pointed to its parent folder.
Why all the other packages worked, I have no idea.


text:
Q: How to make the subtitle (a or b) of an image position correctly? I want the following subtitles (a or b) to be shown correctly not like the current view as shown in the following image:

Also how can I add more spacing between the two images?
\begin{figure*}[htp]
  \centering
  \subfigure [a] {\includegraphics[scale=0.5]{lap1.png}}\quad
  \subfigure [b]{\includegraphics[scale=0.5]{lap2.png}}
  \hfill
  \caption { (a) A ring graph (b) Its Laplacian matrix}
\end{figure*}

A: I think you are using subfigure package which is obsolete. Use either subcaption package that provides subfigure environment or subfig package which gives subfloat.
\documentclass{article}
\usepackage{subcaption,graphicx}
\begin{document}
  \begin{figure*}[htp]
    \centering
    \begin{subfigure}{0.5\textwidth}
      \centering
      \includegraphics[width=3cm]{example-image-a}
      \caption{}
    \end{subfigure}%
    \begin{subfigure}{0.5\textwidth}
      \centering
      \includegraphics[width=3cm]{example-image-b}
      \caption{}
    \end{subfigure}
  \caption { (a) A ring graph (b) Its Laplacian matrix}
\end{figure*}
\end{document}


text:
Q: Orthogonality of almost eiegnvectors of normal operator Suppose $\mathcal{H}$ is an innfinite dimensional, separable Hilbert space and $A : \mathcal{H}\rightarrow \mathcal{H}$
a bounded normal operator, i.e. $AA^{\ast} = A^{\ast}A$. Prove that if $\lambda$ and $\mu$  are complex
numbers such that $\lambda\neq\mu$    and $f_{n},g_{n}$ are sequences in $\mathcal{H}$ such that $\|f_n\| = \|g_n\| = 1$
and
$$\|Af_n-\lambda f_n\|\rightarrow 0,\|Ag_n-\mu g_n\|\rightarrow 0 $$
 as $n\rightarrow \infty$ , then $\langle f_{n},g_{n}\rangle\rightarrow 0$ as  $n\rightarrow \infty$

A: For a given $\nu\in\mathbb{C}$ denote $A_\nu=A-\nu I$.
1) One can check that if $A$ is normal so does $A_\nu$. Now, for any $x\in \mathcal{H}$, then
$$
\Vert A_\nu x\Vert^2
=\langle A_\nu x,A_\nu x\rangle
=\langle  x,A_\nu^*A_\nu x\rangle
=\langle  x,A_\nu A_\nu^* x\rangle
=\langle  A_\nu^*x,A_\nu^* x\rangle
=\Vert A_\nu^*x\Vert^2
$$
This means that
$$
\lim\limits_{n\to\infty}A_\nu x_n=0\quad\mbox{ if and only if }\quad\lim\limits_{n\to\infty}A_\nu^* x_n=0
$$
2) Moreover if $\lim\limits_{n\to\infty}A_\nu x_n=0$ and $\Vert y_n\Vert\leq C$ for all $n\in\mathbb{C}$, then
$$
\lim\limits_{n\to\infty}|\langle A_\nu x_n,y_n\rangle|
\leq\lim\limits_{n\to\infty}\Vert A_\nu x_n\Vert\Vert y_n\Vert
\leq C\lim\limits_{n\to\infty}\Vert A_\nu x_n\Vert=0
$$
so
$$
\lim\limits_{n\to\infty}\langle A_\nu x_n,y_n\rangle=0
$$
3) Now we return to the original problem. Using result of previous paragraphs we can say that
$$
\begin{align}
\lambda\lim\limits_{n\to\infty}\langle f_n,g_n\rangle
&=\lim\limits_{n\to\infty}\langle \lambda f_n,g_n\rangle\\
&=\lim\limits_{n\to\infty}(\langle A f_n,g_n\rangle - \langle A_\lambda f_n,g_n\rangle)\\
&=\lim\limits_{n\to\infty}\langle f_n, A^*g_n\rangle - \lim\limits_{n\to\infty}\langle A_\lambda f_n,g_n\rangle\\
&=\lim\limits_{n\to\infty}(\langle f_n, A_\mu^*g_n\rangle+\langle f_n, \overline{\mu}g_n\rangle)\\
&=\lim\limits_{n\to\infty}\mu\langle f_n, g_n\rangle\\
&=\mu\lim\limits_{n\to\infty}\langle f_n, g_n\rangle\\
\end{align}
$$
Since $\lambda\neq\mu$ we conclude
$$
\lim\limits_{n\to\infty}\langle f_n,g_n\rangle=0
$$


text:
Q: if $g$ be differentiable at $a$ and $f$ non-differentiable at $f(a)$ then how is $R$? let $R(x)=f(g(x))$ and $x=a \in D_R$ now :
$1-)$ if $g$ be differentiable at $a$ and $f$ non-differentiable  at $g(a)$ then how is $R$ ?
$2-)$ if $g$ be non-differentiable at $a$ and $f$ non-differentiable  at $g(a)$ then how is $R$ ?
$3-)$ if $g$ be non-differentiable at $a$ and $f$ differentiable  at $g(a)$ then how is $R$ ?

A: For 1: consider $g(x)=x, f(x)=|x|$ and $a=0.$
For 2: consider $g(x)=|x|, f(x)=|x|$ and $a=0.$
For 3: consider $g(x)=|x|, f(x)=x$ and $a=0.$


text:
Q: Id not saving in hive database flutter I'm using hive as a local DB for a mobile application, I have saved data to DB, and it returns the id for the entry, but when I retrieve the data from DB the value is null.
Future<void> addProduct(Cart value)async{

final cartDB=await Hive.openBox<Cart>('cart_db',crashRecovery: true);
final id= await cartDB.add(value);
cartDB.close();}

if I print the id its gives value against each entry
 Future<void>getCartProducts()async{
final cartDB=await Hive.openBox<Cart>('cart_db');
cartList.clear();
cartList.addAll(cartDB.values);
cartDB.close();}

at the point of reading data, it's giving the id as null.
Is there anything I miss?


text:
Q: Compile leveldb c++ program in linux error? I have install leveldb in my home directory ~/local like this.
[~/temp/leveldb-1.15.0] $ make
[~/temp/leveldb-1.15.0] $ cp -av libleveldb.* $HOME/local/lib/
[~/temp/leveldb-1.15.0] $ cp -av include/leveldb $HOME/local/include/

My c++ program like this:
#include <assert.h>
#include <iostream>
#include "leveldb/db.h"

using namespace std;

int main(int argc,char * argv[])
{
leveldb::DB* db;
leveldb::Options options;
options.create_if_missing = true;
std::string dbpath = "tdb";
leveldb::Status status = leveldb::DB::Open(options, dbpath, &db);
assert(status.ok());
std::string key1 = "grz";
std::string key2 = "grz-rt@63.com";
cout<<"Open db OK"<<std::endl;

std::string value;
leveldb::Status s ;
s = db->Put(leveldb::WriteOptions(), key1, key2);/*key1和key2作为一对key-value对插入*/
s = db->Get(leveldb::ReadOptions(), key1, &value);/*根据key返回对应的value值*/

cout<<value<<std::endl;
delete db;/*删除数据库*/

return 0;
}

I compile this C++ program like this:
g++ -o Main Main.cpp ~/local/lib/libleveldb.a -lpthread -I ~/local/include/

But I get the error like this:
/public/home/kli/local/lib/libleveldb.a(table_builder.o): In function `leveldb::TableBuilder::WriteBlock(leveldb::BlockBuilder*, leveldb::BlockHandle*)':
table_builder.cc:(.text+0x678): undefined reference to `snappy::MaxCompressedLength(unsigned long)'
table_builder.cc:(.text+0x6b2): undefined reference to `snappy::RawCompress(char const*, unsigned long, char*, unsigned long*)'
/public/home/kli/local/lib/libleveldb.a(format.o): In function `leveldb::ReadBlock(leveldb::RandomAccessFile*, leveldb::ReadOptions const&, leveldb::BlockHandle const&, leveldb::BlockContents*)':
format.cc:(.text+0x5de): undefined reference to `snappy::GetUncompressedLength(char const*, unsigned long, unsigned long*)'
format.cc:(.text+0x64e): undefined reference to `snappy::RawUncompress(char const*, unsigned long, char*)'
collect2: ld returned 1 exit status

I don't know what's wrong.
I am new to Linux. Thank you very much!

A: libleveldb.a misses Snappy when being linked which would be probably in libsnappy.a in the same directory.

A: Looks like the Makefile is incomplete.
With the current install, you need to edit the Makefile to link against snappy and to include -L/usr/local/lib instead of -L/usr/local/include.
(Will post pull request later)


text:
Q: Assign all rows and both columns of data to an array I'm trying to return all rows of data of an unknown amount [8 rows] from two columns. I get the subscript out of range error for >> SERnumber(rws, clm).
I'm simply trying to return:
in  AAA
out AAA
in  AAA
in  VVV
in  GGG

Here's my non-working code:
Sub Button1_Click()
Dim SERnumber() As String
Dim i As Integer
Dim strMessage As String
Dim rws As Integer
Dim clm As Integer
' assign variable > rws the # of rows containing data
         rws = Cells(Rows.Count, 2).End(xlUp).Row
' Redimension the SERnumber array variable >>
' for n? rows and 2 columns
         ReDim SERnumber(1 To rws, clm)

         For i = 1 To rws
               For clm = 1 To 2
                  SERnumber(rws, clm) = Cells(rws, clm).Value
               Next clm
         Next i
' Loop through the array and add the names to a string
        strMessage = "Here are the results:" & vbCrLf
            For i = 0 To rws
               strMessage = strMessage & SERnumber(i) & vbCrLf
            Next 'i
        MsgBox strMessage
End Sub

A: You can assign Excel Range to VBA Array object as shown in the following VBA code example (Range includes entire columns A and B):
Sub Range2Array()
    Dim arr As Variant
    arr = Range("A:B").Value
    'alternatively
     'arr = Range("A:B")
    'test
    Debug.Print (arr(1, 1))
End Sub

Such direct assignment to 2d-array has tremendous performance advantage vs using the Range iteration. You can then perform all necessary operations on array elements instead of range cells (it also will be really fast in comparison to iterative range ops).
Another useful technique is to assign Excel's UsedRange to VBA Array:
arr = ActiveSheet.UsedRange

And, the most trivial example (pertinent to your case of 2 columns, 8 rows):
arr = Range("A1:B8").Value

Hope this will help. Best regards,


text:
Q: Viewing PDF through WebBrowser control shows adobe reader menus instead of pdf There are some questions on here about getting a pdf to show up in a WPF app, I'm not having any issue with that. The issue is that when it does load up, there's all the default Adobe Reader toolbars and things clogging up the screen until I click options and set the file view mode to "Read Mode".
Screenshot:

Sometimes it opens up fine, but most of the time it opens like it does in that top pic.
I've looked around for default settings I might be able to change and for other people having this issue but have no luck.
I'm opening it in a pretty basic way:
this.webBrowser.Navigate("file:///" + "C:/code/example.pdf");

Any help would be greatly appreciated.


text:
Q: how to use stress-ng to stress memory I need to stress memory to about 50% of system memory bandwidth capacity(say 3000MT/s is system memory bandwidth capacity).
is this the right command for it?
stress-ng -vm 2 --vm-bytes 10% -t 10

A: You can exercise the memory bandwidth with the stress-ng memrate stressor, e.g.
stress-ng --memrate 1 --memrate-wr 2000 --memrate-rd 1000 -v

this will exercise memory writes at 2000 MB/s and reads at 1000 MB/s. Adjust the settings to match your requirement.  This is available in newer versions of stress-ng, so you may need to build stress-ng from source.


text:
Q: ASDF optional system dependencies I have a system I wrote that uses lparallel when possible, and otherwise works around it. Problem is, I'm now trying to test it on ECL, which errors upon merely loading lparallel.
Is  there a way (other than #-ecl ) to specify system dependencies parameterized by implementation type? I've looked at Madiera Port but it seems to work only for subcomponents, not system dependencies. I wish to keep my .asd file as a simple machine-readable form, without reader conditionals etc.
( aside: lparallel loads fine on a current ECL. mine was just outdated. )

A: To my knowledge there is no direct way to do that in ASDF apart from reader conditionals. You could use XCVB instead, or write a defsystem* macro that adds new syntax, or (maybe) hook into the existing defsystem as madeira does.
Without knowing your motivation, I wonder why the simple solution of #-ecl is being avoided. Do you wish to store metadata that links ECL to the nonexistence of lparallel? Note #-lparallel and #+lparallel may be used in lisp files.
By the way lparallel loads fine for me in ECL. Are you running the latest ECL? There is a known bug in ECL that causes the lparallel tests to eventually hang, however this may not affect all platforms.


text:
Q: A variant of the exponential integral Consider the following integral (for $x,y\in \mathbb{R}_{>0}$)
$$E(x,y) =  \int_0^1 \frac{\mathrm{e}^{-x/s-ys}}{s}\,\mathrm{d}s,$$
which is a variant of the usual exponential integral $E_1(x)$ to which it reduces when $y=0$.
I am interested in the efficient evaluation of $E(x,y)$, either by numerical or analytical means. One example would be e.g. a series representation; to give an example, consider expansion around $|ys|\ll 1$, which yields a series representation in generalized exponential integrals $E_n(x)$
\begin{align}
E(x,y) &=  \int_0^1 \frac{\mathrm{e}^{-x/s}}{s}\sum_{n=0}^\infty \frac{(-ys)^n}{n!} \,\mathrm{d}s
= \sum_{n=0}^\infty \frac{(-1)^n y^n}{n!}\int_0^1 \mathrm{e}^{-x/s} s^{n-1}\,\mathrm{d}s\\
&= \sum_{n=0}^\infty \frac{(-1)^n y^n}{n!}E_{n+1}(x).
\end{align}
This series, however, is rather poorly convergent when $y>1$. Can we do better?
Context: This integral arises in the Ewald summation technique for 1D-periodic systems embedded in a 2D coordinate system; in my case, $x$ and $y$ take values from $0$'ish to $10$'ish. Presently, I'm forced to evaluate the integral by numerical quadrature, which is painstakingly slow.

A: $\int_0^1\dfrac{e^{-\frac{x}{s}-ys}}{s}~ds$
$=\int_\infty^1se^{-xs-\frac{y}{s}}~d\left(\dfrac{1}{s}\right)$
$=\int_1^\infty\dfrac{e^{-xs-\frac{y}{s}}}{s}~ds$
$=K_0(x,y)$ (according to https://core.ac.uk/download/pdf/81935301.pdf)


text:
Q: Measure of dispersion for dataset with zero mean I'm testing a machine learning algorithm which, until now used coefficient of variation in order to relative measure dispersion among different attributes in a given dataset.
Now that I need to test it thoroughly on larger dataset, it's critical to do something about the possibility of a zero mean, which would immediately breaks down coefficient of variation (cv), and hence the algorithm. Please note that the distributions are not essentially Gaussian, and are often skewed when they are. Also, the measure of dispersion needs to be dimensionless.
I searched the web a bit to find ways to 'normalize' cv in some manner, or to even find an alternative to cv. I tried inter-quartile range(iqr), but there was a significant drop in performance when I migrate from cv to iqr.
Is there any other dispersion measure that returns similar values to that of cv? If not, is there any principled way to 'normalize' coefficient of variance?

A: You have really pointed out one of the limitations of the coefficient of variation as a dispersion measure. However, I have one alternative measure of dispersion to recommend regarding this problem of getting the zero mean. although it has not been peer-reviewed, I am certain that STATISTICAL MIRRORING (Abdullahi, 2020) could be an appropriate alternative.
For instance, suppose you have a dataset: -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5.
The mean, standard deviation, and coefficient of variation equal to 0, 3.3166, and #DIV/0! respectively. But, using statistical mirroring, you would get an answer to be -100% (i.e, the spread around the mean is perfectly equal and opposite direction as a mirror image of each other) and 0.00% (i.e, little dispersion around the mean) for the meanic proximity and meanic deviation respectively.
Reference:
Abdullahi, K.B. Optinalytic (Statistical) Mirroring: A New Novel Approach of Measure of Dispersion. Preprints 2019, 2019110268 (doi: 10.20944/preprints201911.0268.v1).
Or you can wait for a more detail explanation about statistical mirroring by following the up-coming version of the Preprint.
Sincerely,


text:
Q: Upgrade to iOS 5 I'm iPhone developer. I want to upgrade my iphone to iOS 5. But I'don't know if I can run applications for iOS 4? Do I need to install new Xcode with new SDK?

A: You can install iOS 5 using the beta SDK, or you can go through iTunes Beta 10.5.
I am sure iOS 4 apps will run on the Beta iOS 5. You may run into some crashes depending on what frameworks your app uses versus what frameworks have changed. This is a great opportunity to test your apps against iOS 5 and correct any issues.
But keep in mind it is still a beta, and an early one at that.

A: You have to install the new beta sdk and then just install iTunes 10.5 beta and open iOS 5 beta file, it will open in iTunes and install on your device.

A: Yes..You need to get the latest SDK from the Apple developer portal with your username and password.
You will also get the iTunes beta but that shouldn't be of much use as long you use the simulator to try stuff out; but if you have the developer access, use the device instead.


text:
Q: How should I handle removed elements in JSoup? I am working on an application that requires removal of Elements from document.
for(Element d : doc.getAllElements()){

if(condition){
 d.getAllElements().remove();
 }

}

On Doing this, I am constantly getting
Exception in thread "main" java.lang.IllegalArgumentException: Object must not be null

So far, I have checked various null conditions, like if(d != null) etc, but none seems working. Can you please suggest what should be the solution?
Update :
Suppose I have two loops in which I am removing Elements upon satisfaction of a condition.
Code below is just for example, please do not suggest workarounds on this, like break the loop on first condition etc, I need to understand it at logical level.
for(Element e: doc.getAllElements()){

if(condition1 == true)
{
e.getAllElements().remove();

}

if(condition2 == true){

e.getAllElements().remove();

}

}

If both conditions satisfy, elements get deleted in first loop, and when it comes to second condition, it throws illegal exception. I tried to evaluate the problem and found that JSoup internally checks if the element is not null, and if it is, it throws and exception. Consider the scene :
if(e != null) // e is an Element.

In the above null check, JSoup checks the existence of e, which is null in this case, and hence and exception, before coming to next words != null. I checked documentation and found there is a method existing Validation.notNull(Element), but it returns void. Is it possible to get a boolean return value from this? What else is the solution?

A: If you inspect the results of doc.getAllElements(), you'll see that the first element is the entire document, because technically, the <html></html> is a single element. If you try to .remove() this element, it has no parent, so you get this null error when it tries to validate that the parent exists.
If you just want to remove stuff from the body, I suggest using
for(Element e: doc.select('body'))

or similar if you don't just want the body

A: You must check if the element is still present inside the document, then remove it. Remove elements one-by-one:
for (Element element: doc.getAllElements()) {
    if(condition1 == true)
    {
        for (Element subElement: element.getAllElements()) {
            if (subElement.root() == doc) {
                subElement.remove();
            }
        }
    }
    if(condition2 == true)
    {
        for (Element subElement: element.getAllElements()) {
            if (subElement.root() == doc) {
                subElement.remove();
            }
        }
    }
}

A: Once you remove any element from jsoup document then it's reference becomes null. Hence you have to put null checks wherever you use 'remove'.


text:
Q: How to express "no information" in relational algebra? A task that I'm working on to learn relational algebra is asking me to find the clients who want to rent a property for free, or have not given information
about how much they are willing to pay. the table looks like this:
Client(clientNo, firstName, lastName, maxRent)
I have some trouble finding any information about how to represent a lack of information, or an empty data point.. so far I've come up with this where half of the expression is psuedo code:
σ maxRent = 0 OR [no info given] (Client)

A: What rows go in this table? How can we answer without knowing that? How can anyone query without knowing that?
Suppose your table holds the rows where "client [clientid] named [firstname] [lastname] is willing to pay [maxrent]". If a particular client doesn't have both a first & last name then there is no row for them in this table. You can't answer your query with it. If they do have first & last names but you don't know them then you can't set the table--you can't proceed--this table is not for you. Let's further suppose we have all client names. But we similarly can't proceed if we don't know what they are willing to pay.
Suppose your table holds the rows where "clent [clientid] named [firstname] [lastname] has said they are willing to pay [maxrent]". Then you can use it for clients who have given maximum rent. But it can't record anything for other clients. However if you also had a table holding the rows for "client [clientid] named [firstname] [lastname] has not said what they are willing to pay" then you could record for all clients. So you could answer your query.
Suppose your table holds the rows where "cilent [clientid] named [firstname] [lastname] has either said they are willing to pay [maxrent] or has not said how much they are willing to pay and [maxrent]='xxx'". If you have a client's id & names but they haven't said what they are willing to pay then there is a row for them with maxrent='xxx'. Then you can write your query--your "[no info given]" means maxrent='xxx'.
Suppose instead of that table we have two tables, "client [clientid] is named [firstname] [lastname]" & "client [clientid] is willing to pay [maxrent]". Then your table under its meaning is a certain query of those new tables under their meanings. And each of the new tables can be expressed in terms of the old. There is a simple correspondence between a query in one design & one in the other. So we can write your query.
In SQL the tradition is to use NULL as a special value instead of 'xxx'. The table meaning would be "client [clientid] named [firstname] [lastname] has either said they are willing to pay [maxrent] or has not said how much they are willing to pay and [maxrent] is NULL". Operators in SQL treat NULL specially--they aren't the same operators as the relational or everyday ones with the same names.
Notice that the NULL-free designs have more but simpler base tables & meanings. Any design with NULL can be rearranged to one without. All four of these designs can be rearranged to any other. There are other styles of  NULL-free designs that are more similar to designs with NULL.
(A certain textbook that your table is surely drawn from allows maxrent to be NULL. They also never clearly say what rows go in their tables. But the idea is that every table that can have NULLs has a meaning that is the obvious transformation of the obvious null-free meaning. They wrongly & fuzzily say, "Without nulls, it becomes necessary to introduce false data to represent this state or to add additional attributes that may not be meaningful to the user." They also say a lot of typical fuzzy unhelpful things like "null is not a value".)
(It's not clear what you mean by "unknown information" or by "expressing" something that is not known or "an empty data point". One can express that one doesn't know the value(s) satisfying a condition. But every row in a table asserts the statement made from its meaning and every row not in it (of the appropriate type) asserts the negation of the statement made from its meaning.)
Re relational querying.
What to do with null values when modeling and normalizing?


text:
Q: Convert postgresql ~* as ecto Is this the correct way to convert postgresql ~* syntax in ecto? When I convert the ecto back into SQL, it is different. It uses or's instead of the original ~*
SQL
SELECT
    col1,
    FROM table1
    WHERE col1 ~* 'AAA|bbb|CcC'

Ecto
from (t1 in table1,
where: ilike(t1.col1, "AAA") or ilike(t1.col1, "bbb") or ilike(t1.col1, "CcC"),
select: %{
 col1: t1.col1
}

The Ecto gets converted back as ORs like so instead of the original WHERE col1 ~* 'AAA|bbb|CcC'
where
    ((sssp0."col1" ilike 'AAA')
    or (sssp0."col1" ilike 'bbb'))
    or (sssp0."col1" ilike 'CcC'))

Is this the same?

A: I don't want to speak for the Ecto maintainers, but I believe this isn't included in the standard function set because covering all of the functionality that a database provides would be a virtual nightmare to maintain (I assume). You can, however, create your own API convenience functions to wrap the Postgres operators using fragments under the covers with macros.
In your case, you could create your own API module:
defmodule MyApp.QueryAPI do
  defmacro iregex(left, right) do
    quote do: fragment("? ~* ?", unquote(left), unquote(right))
  end
end

And in the module you want to use it:
defmodule MyApp.Logic do
  import Ecto.Query
  import MyApp.QueryAPI

  def reg_search(term) do
    MyApp.Model.Something
    |> where([s], iregex(s.name, ^term))
    |> MyApp.Repo.all()
  end
end

This is a really neat example of how extensible Ecto really is. I use convenience fragment wrappers all the time to make things more readable and DRY.


text:
Q: Как ускорить скрипт? При прохождение теста, 1 из тестов не срабатывает из за превышение лимита, либо ошибки в коде.

Суть задания если в нижней строке из файла text.txt (1 7 3 4 7 9) есть
  сумма из двух чисел равная значению верхней (5), то в файл записать 1,
  иначе 0.

    import os
    def main():
        f = open('text.txt', 'r').read().split()
        w = open('text2.txt', 'r+')
        target = int(f[0])
        l = [int(f[i]) for i in range(1, len(f))]
        l.sort()
        print(l)
        # Как ускорить данный участок кода
        for i in range(len(l)):
            for j in range(len(l) - 1):
                if l[i] + l[j + 1] == target:
                    w.write('1')
                    return
        #
        if os.stat('text2.txt').st_size == 0:
            w.write('0')

    if __name__ == "__main__":
        main()

Содержание файла text.txt:

```
5
1 7 3 4 7 9
```

Воспользовался всеми советами, в итоге на 1 тест прошел больше, но другой тест так же выходит за заданное время в 1 сек (1.091s). К сожалению, нет примерных данных с того теста. Спасиб всем кто помог с поиском решения.

    import itertools

    def fun(target, nums):
        for x in nums[:-1]:
            for y in nums[x+1:] :
                if x+y == target :
                    return True
        return False

    def main():
        with open('text.txt') as f:
            target, l = f.readlines()
        target = int(target)
        l = [int(i) for i in l.split() if target >= int(i)]
        l.sort()
        print(l)

        flag = fun(target, l)

        with open('text2.txt', 'w') as f:
            f.write('1' if flag else '0')

    if __name__ == "__main__":
        main()

A: на 20 % быстрее ответа @gil9red  :) на моем ноуте timeit дает (последний код ниже)
1.1719330577166354
0.6272641881987562
0.5278181732993907

def f( target, nums ):
    for x in nums[:-1]:
        for y in nums[x+1:] :
            if x+y == target :
                return True
    return False

A: Вместо двойного цикла можно использовать itertools.combinations, скорость работы увеличится на ~40%
Пример теста скорости:
import itertools

def has_1(target: int, nums: list) -> bool:
    for i in range(len(nums)):
        for j in range(len(nums) - 1):
            if nums[i] + nums[j + 1] == target:
                return True

    return False

def has_2(target: int, nums: list) -> bool:
    for a, b in itertools.combinations(nums, 2):
        if a + b == target:
            return True

    return False

target = 5
nums = [1, 3, 4, 7, 7, 9]

import timeit
print(
    timeit.timeit('has_1(target, nums)', globals=globals())
)
# 0.7132318

print(
    timeit.timeit('has_2(target, nums)', globals=globals())
)
# 0.3819617999999999

PS.
Использование itertools в коде из вопроса с небольшим рефакторингом:
import itertools

def main():
    with open('text.txt') as f:
        target, nums = f.readlines()

    target = int(target)
    nums = [int(i) for i in nums.split()]
    nums.sort()

    result = False
    for a, b in itertools.combinations(nums, 2):
        if a + b == target:
            result = True
            break

    with open('text2.txt', 'w') as f:
        f.write('1' if result else '0')

if __name__ == "__main__":
    main()

A: Если говорить про скорость.
Соберите все свои единички-нолики в единую строку,
а после окончания цикла запишите эту строку в файл одной-единственной операцией.
А вот что такое "верхняя" и "Нижняя" строка - непонятно.
Кстати, вот это условие - "сумма из двух чисел равная значению верхней (5), то в файл записать 1, иначе 0." у вас вообще никак не отрабатывается.
Так что исправляйте проблемы с логикой, потом - со скоростью -  потом будем смотреть дальше.
P.S. Даже после ваших корректировок ваш код не соответствует заданию в тойт формулировке, которую вы-же и привели.


text:
Q: Adding a variable to the PATH variable not translating I have a bunch of applications that I install using MDT packages.
One of the packages needs an entry to the PATH variable.
I would like to add a variable to the PATH variable. But this variable is not being translated.
My example:
I would like to add a location to PATH: C:\Program Files\gs\gs9.55.0\bin
Since this location uses a versionnumber, I find it easier to manage when I can create an extra variable. So I created an extra variable called GS_HOME with this location and added %GS_HOME% to PATH.

When doing this manually, everything works fine. I test this by doing "echo %path%" and it gives me the PATH result with the translated %GS_HOME% variable

The problem: When doing this via MDT, I can add the %GS_HOME% value just fine, and it shows up exactly the same in PATH. BUT the "echo %path%" test does not translate the %GS_HOME% variable.

For extra info. I use these commands to create/modify the variables:
powershell -command "[Environment]::SetEnvironmentVariable('Path', $env:Path + ";%GS_HOME%", [EnvironmentVariableTarget]::Machine)"

cmd /c setx /M GS_HOME "C:\Program Files\gs\gs9.55.0\bin


text:
Q: Where does SWT write dll files on windows? I cannot find on the Internet where SWT tries to write the dll files. I have a computer where the jar does not run only because SWT cannot write DLLs.
UPDATE 1
java.lang.reflect.InvocationTargetException
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at com.sun.javaws.Launcher.executeApplication(Unknown Source)
                at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
                at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
                at com.sun.javaws.Launcher.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
                no swt-win32-3738 in java.library.path
                no swt-win32 in java.library.path
                Can't load library: \\ubz01fst\Students\User2010\Com\xxx\swt-win32-3738.dll
                Can't load library: \\ubz01fst\Students\User2010\Com\xxx\swt-win32.dll

                at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
                at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
                at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
                at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
                at install.Main.main(Main.java:162)

A: I find out the answer myself.
Since SWT 3.3 you don't have to include the native (DLL) library anymore, because they are in the jar itself and they are unpacked as soon as the SWT library is called.
The DLL files are unpacked from the jar and placed in the ".swt" folder under your "System.getProperty("user.home")".
In my case the problem was that System.getProperty("user.home") is set to "\ubz01fst\Students\User2010\Com\xxx" which is a UNC path and that is not writable ( this often happen in companies or organizations computers ).
I donno for which reason the System.getProperty("user.home") in computers is taken from the environment variable "HOMESHARE" of Windows
The solution consists in changing the System.getProperty("user.home") with a writable path, for example:
System.setProperty("user.home", System.getenv("USERPROFILE"));

before calling any SWT code.

A: Ok, I found the solution. The problem was about the dll generation. I was using 3.7m5 version, I downloaded a previous version (3.7) and the application ran properly.
Regards.


text:
Q: Linq results are displayed in different ordering I am currently fiddeling around with the AdventureWorks sample database and LinqPad, for scratching out some ideas.
This is the query in question:
SalesOrderHeaders.GroupBy (soh => new {soh.CustomerID, soh.BillToAddressID})
                 .Where(soh => soh.Skip(1).Any())
                 .Dump();

The idea was to find duplicates based on some criteria and then display them except the first set of data. The result should be deleted from the table.
After executing the query I get result A)

After executing the query again I get Result B)

I do not care about the correct results of the query, but about the ordering of the resultset. Only those two possibilities exist and they alternate on every run of the query.
Surely I could just order by Key, but I am more interested in why does this even occur? Why is the order chaning/alternating?

A: Sql server select query's result set order is not deterministic. It's just how sql server works and it's not a bug in neither linq or linqpad. The only way to get deterministic results on your query, as yourself noted, is to use an OrderBy clause.
Edit: About getting same results in SSMS if you run the query multiple times, see this. This post explains why you might get the same results if you execute a query multiple times and why you shouldn't rely on it.

A: Ordering is never deterministic as suggested earlier, but try and insert orderby clause in either your sql query or the Linq query, that's the only way to make it deterministic.
In fact let's look little deeper in  the database for the reason. DB would be fetching all the data from the disk via i/o. data is stored in the internal sql server structures like pages, extents, segments (these are Oracle data blocks, I hope sql server have the similar stuff). Now when the query is fired, database would know all the different locations to fetch the data from, but this is not a serial operation, it is sort of parallel fetch, where different datasets are then combined to provide a user view. Now as we know in case of threads , it can never be deterministic that who goes first and who returns first, that's totally OS scheduling of the threads, hope that clarifies further little more.
OrderBy clause will work on fetched data to make in a particular order, so will always yield deterministic result.


text:
Q: Best practice for Vue.JS + Node.js backend in ONE SINGLE Heroku pod? This blog post I found today shows something like this for React. He  starts with a node project and then within that he creates a react project in a subfolder. Plus some proxy config stuff.
I wasn't this clever about 10 days ago but here's what I did for Vue.

*

*Created a Vue project

*Built it for production

*Added a package.json and a server.js in the dist folder created by the Vue build process

*The package.json contains these two lines: "postinstall": "npm install express" and "start": "node server.js"
And voilá! Express listens on 8081 internally (but translated to 80/443 by Heroku) and I can get a response in the Vue frontend from the Node backend. So technically it works. But I don't feel it's a nice solution. Kind of messy, smells like desperate hacking and tinkering.
The point is, of course, to avoid having two different Heroku pods for an otherwise small, almost weightless personal project. One for the frontend part and one for the backend.
Can you show me anything better?

A: You could use a vue-cli project
Then you create a subfolder with your express project and start your script (in package json) like :
npm run vueproject && npm run expressproject
and your both projects will start together.
You have to :

*

*Use a different port for each project.

*Install dependencies of the expressproject in the
vueproject package.

*Know that's not a good practice to do like this.


text:
Q: $\lim_{n \to \infty}(1 - \frac{1}{n^{p}})^{n}$ for $p< 1$ and $p > 1$ This
answers $\lim_{n \to \infty}(1 + \frac{1}{n^{p}})^{n}$ for $p< 1$ and $p > 1$
Is there a similar approach for the one below, or an approach that adapts what the link shows?
$\lim_{n \to \infty}(1 - \frac{1}{n^{p}})^{n}$ for $p< 1$ and $p > 1$

A: Note that for $p,q>0$, as $n$ goes to $+\infty$,
$$\left(1 - \frac{1}{n^{p}}\right)^{n^q}=\exp\left(n^q\ln(1 - \frac{1}{n^{p}})\right)\sim\exp(-n^{q-p})$$
(because $\ln(1+x)\sim x$ when $x$ goes to $0$).
Hence
$$\lim_{n\to +\infty} \left(1 - \frac{1}{n^{p}}\right)^{n^q}=
\left\{\begin{array}{lr}
        0, & \text{if $q>p$, } \\
        1, & \text{if $q<p$, }\\
        e^{-1}, & \text{if $q=p$. }
        \end{array}\right.
$$


text:
Q: R programming: which(colnames(df) == "thecolumnname") is not working inside a function? I have a function:
findcolnumber <- function(df, thecolumnname){
which(colnames(df) == "thecolumnname")
}

And I would like to be able to find the column number by giving the 2 arguments to the function.
Example arguments: data, columnX
which(colnames(data) == "columnX")    #This works properly

findcolnumber(data, columnX)    #This does not work

The function that I created does not work.  Do you know why?

A: Your function isn't working because while the column name must be quoted (which you did), the argument and the quoted column name should be the other way around.  That problem is fixed at the bottom of this answer.
First though, I'd like to point out that this is a situation where deparse and substitute come in very handy. Together, they eliminate the need to quote your function argument(s). Here's an example:
> findcolnumber <- function(df, thecolumnname){
      which(colnames(df) == deparse(substitute(thecolumnname)))
  }

> x <- data.frame(col1 = 1:4, col2 = 3:6, col3 = letters[1:4])

> findcolnumber(x, col1)
[1] 1
> findcolnumber(x, col2)
[1] 2
> findcolnumber(x, col3)
[1] 3

Now, if you want to do it without deparse and substitute, you could do the following.  Notice that you'll need to quote the column name in the function call.  That's why deparse(substitute(...)) is nice.
> findcolnumber <- function(df, thecolumnname){
      which(colnames(df) == thecolumnname)
  }
> findcolnumber(x, "col3")
[1] 3