text:
Q: For accessibility can a website have an H1 on a site logo and an H1 on a text headline? Typically you only want one H1 per page for screen readers. But I have seen a trend where the site logo in a header has an H1 around it and a separate main headline on a page also has an H1. Is this acceptable or is there a better way to handle this?

A: WCAG compliance
From a perspective of WCAG and compliance, this is acceptable, you can have multiple h1s on a page, it is still in the HTML5 spec.
Conventions for headings
However, convention and best practices advises there is only one, visible
 on a page and that
 should accurately describe the current page.
The main reason for this is assistive technology, namely screen readers.
Someone who uses a screen reader is likely to navigate by sections, links or headings using shortcuts. Obviously in this cases headings is the bit we are focusing on.
They use the keys 1-6 to cycle through headings. When landing on a page the first thing they might do is press "1" to get to the main heading on the page.
If pressing "1" instead reads out the site logo it might be confusing and they may think the site structure is wrong and instead start cycling
s with the "2" key. This may take them a little while to realise the page structure is not typical.
It may only take a minute or so before a screen reader user realises the strange structure of your site, so it doesn't make it inaccessible, but in terms of user experience it isn't great.
Convention for company logos as part of the
The convention for a logo is to wrap it in a hyperlink and point it to the home page. Expected behaviour is key for accessibility.
The simplest form of this would be:

So whoever started that trend needs to stop it, it doesn't even make sense from an SEO perspective so I am not sure why someone started that if it is indeed a trend!


text:
Q: Anaconda 4.7.12 activate environment not work I create an environment using this command:
conda create -n my_env11 python=3.7.3

but when I use the following command:
conda activate my_env11

doesn't work
note:
anaconda version is
4.7.12

redpajama_set_name: RedPajamaStackExchange


text:
Q: LetsEncrypt - "Can't connect to the client for DV" I am using LetsEncrypt on Ubuntu 15.10.
I have opened ports 443 and 80 using UFW and can access the domain (akuk.co.uk) I'm trying to secure in web browsers from HTTP.
When running the ./letsencrypt-auto command and selecting the domains (akuk.co.uk and www.akuk.co.uk), I receive the following message:

Failed authorization procedure. www.akuk.co.uk (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client for DV :: Failed to connect to host for DVSNI challenge
IMPORTANT NOTES:

*

*The following 'urn:acme:error:connection' errors were reported by
  the server:
Domains: www.akuk.co.uk
  Error: The server could not connect to the client for DV

Running ./letsencrypt-auto --verbose, I see:

Generating key (2048 bits):
  /etc/letsencrypt/keys/0026_key-letsencrypt.pem
  Creating CSR: /etc/letsencrypt/csr/0026_csr-letsencrypt.pem
  Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
  Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
  Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
  Performing the following challenges:
  tls-sni-01 challenge for akuk.co.uk
  tls-sni-01 challenge for www.akuk.co.uk
  Enabled Apache ssl module
  Waiting for verification...
  Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
  Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
  Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
  Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
  Reporting to user: The following 'urn:acme:error:connection' errors
  were reported by the server:
  Domains: www.akuk.co.uk
  Error: The server could not connect to the client for DV
  Cleaning up challenges

My ports.conf file looks like this:
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

The sites-enabled file akuk-co-uk.conf looks like this:
<VirtualHost *:80>
        ServerAdmin webmaster@akuk.co.uk
        ServerName www.akuk.co.uk
        ServerAlias akuk.co.uk
        DocumentRoot /var/www/html/akuk_co_uk/public_html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

# Server Settings for Port 443 (SSL)
<VirtualHost *:443>
        ServerAdmin webmaster@akuk.co.uk
        ServerName www.akuk.co.uk
        ServerAlias akuk.co.uk
        DocumentRoot /var/www/html/akuk_co_uk/public_html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

With the ports 80 and 443 open, I can't understand the issue; how can this be fixed?

A: The solution was to forward port *:443 on my router to the relevant IP on my network (192.168.0.23, in my case)


text:
Q: How to keep an executorService running? I have a task, I am calling it MyTask which is basically a Callable class.
Say:
public class MyTask implements Callable
{
// my custom code which returns from call()
}

public class Worker
{
 ExecutorService service = Executors.newSingleThreadExecutor();
}

I have a singleThreadpoolExecutorService inside the Worker class, which should start off, on initialization  when my worker class is called.
And the service should keep on running , till i submit a MyTask to the object....
which, on execution returns me the result of callable.
Now, my issue is,
The service should keep on runnning, and keep on accepting input in the form of future objects. and execute it and deliver a result.
How do I do it , so that the service is not stopped in between.
the service should be stopped when called off from an external flag- say isShutDown.
Can you please help?
Thank you.

A: The executor service will keep running until you shutdown() it.  It will even keep running if there is no other non-daemon thread and there is nothing for it to do. i.e. keep your program running even though it might not really be needed.
If you believe it is shutting down, you are doing something wrong, but it is not clear what for your question.


text:
Q: Pass a Struct array ByRef from C# to C++ and get it back I've a very weird issue when calling a CPP dll.
I can call the method passing an struct array (with several positions) marshalled and loop it and set data to it as well. But when the code comes back to C#, the array has only one position.
For example, I create an array of my struct with 3 position (0, 1, 2), in the C++ Dll I receive the entire array and do nothing with it and when the execution returns to the C# Caller, the array has only one position on the array, with the first item.
The code:
C++ side:
extern "C" __declspec(dllexport) int ViewItems(int * nTotalItems, void ** paramStruct)
{
    // TODO nothing here.
    return 1;
}

C# side:
[DllImport(@"MyCustomLib.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ViewItems(ref int resultItemsCount, ref MyStruct[] MyStruct);

Invoke:
var resultSize = 3;
var resultStruct = new MyStruct[3];

for (int i = 0; i < resultSize; i++)
{
    resultStruct[i].SomePropValue = i+2;
}

// Before this, the resultStruct.Lenght is 3
var resultCall = ViewItems(ref resultSize, ref resultStruct);
// After this, the resultStruct.Lenght is

Struct:
[StructLayout(LayoutKind.Sequential)]
public struct MyStruct
{
    public int SomePropValue;
}

I tried the following with no success:

*

*[MarshalAs(UnmanagedType.LPArray)]

*[In, Out]

*read other questions, but none of those had this issue.

Anyone have any idea of what I missed?
Thanks in advance!

A: I solved the issue.
I removed the ref from the DllImport and put the [MarshalAs(UnmanagedType.LPArray)] and [In, Out] decorator in MyStruct param.
Finally, I changed to void * paramStruct in C++ and finally all worked!


text:
Q: Set Interval doesnt update price on my UI (reactjs) I have this code here to setInterval to update the price every second on my react site:
import React, { Component } from 'react'
import './Coin.css'
import PropTypes from 'prop-types';

export default class Coin extends Component {
    constructor(props){
        super(props);
        this.state = {
            price: this.props.price
        }
    }
    componentDidMount(){
        const callback = () => {
            //set the state to a new random value
            const randomPercentage = 0.995 + Math.random() * 0.01;
            // Dont do this:
            // this.state.price = this.state.price * randomPercentage:

            this.setState(function(oldState){
                return {
                    price: oldState.price * randomPercentage
                };
            });
        }
        setInterval(callback, 1000);
    }
    render() {
        return (

                {this.props.name}
                {this.props.ticker}
                ${this.props.price}

        );
    }
}

Coin.propTypes = {
    name:PropTypes.string.isRequired,
    ticker: PropTypes.string.isRequired,
    price: PropTypes.number.isRequired
}

When i run this app the price on my site should update every second with some random Number
This is a screenshot of my UI

When i run it nothing happens- price isnt changing every second and i also get no errors in my console. The only thing that i see is this entry in the console:
[HMR] Waiting for update signal from WDS...

Whats wrong here? And how can i fix it?
Here is a screenshot from the tutorial and his code is working
https://imgur.com/a/Ol1rrZf

A: replace
${this.props.price}	 with ${this.state.price}


text:
Q: Launching a program with GUI, without having to log into windows I am new here, please let me know if I made an error in my posting.
I'm trying to launch an exe that has a GUI, without needing to log in to Windows 7.
I have tried:
 Windows Task Scheduler,
 NSSM,
 SC command,
 Batch file in startup folder,
 executable in startup folder,
Also, the SC command has been tried with many different arguments and options. I have tried NSSM, Windows Task Scheduler, and SC command, with the option of using a specific account (not sure about the details), by providing local username and password.
All of these have been tried with both batch files and executables. The only purpose of the batch file was to start the executable. I thought maybe this indirect approach would help to an extent, but no there was no difference in trying to launch a program before login.
The key is the GUI, because, for example, I was able to launch a batch file that created a blank text file before logging in (verified by time), using  Windows task scheduler, NSSM, and the SC command.
However, if I try to launch, say notepad.exe (start notepad.exe), it won't work. Notepad will not appear as a task, will not have a window, and will not appear as a process. I have tried putting the txt file creation command after the start command in the batch file, and the file is created (so the batch file isn't hanging on the start), but notepad has no trace whatsoever.
Some of my peers have also suggested it is a result of the GUI and how it has to have a desktop session.
What has WORKED:
1. Allowing login on bootup without needing password.
2. Executing batch file that would launch program, and then
   lock the computer.
3. The desktop would flash for only about 1 second.
Problem: This isn't good enough since it is a vulnerability, even if it is only for a split-second.
Found someone who had a similar issue as me, and incorporated it as his solution, but he admits, that it isn't a secure approach.
https://serverfault.com/questions/583517/start-program-on-computer-startup-when-nobody-is-logged-on-and-show-the-window-w
There is another avenue that I don't quite understand, that I think could possibly work. Its in regards to the functions LogonUser(), ImpersonateLoggedOnUser(), CreateProcessAsUser(), CreateProcessWithLogonW().
I would be hoping to run it as a service that would be able to "login" and start the program.
Code for creating session:
bool startProcess(string path) {

    _STARTUPINFOA info;

    info.cb = sizeof(info);
    info.lpReserved = NULL;

    //The name of the desktop to which we want to connect.
    info.lpDesktop = NULL;

    //The title assigned to the GUI window.
    info.lpTitle = NULL;

    //Offset of the window from top left corner
    info.dwX = 0;
    info.dwY = 0;

    //Size of the GUI window that is created.
    info.dwXSize = 1000;
    info.dwYSize = 900;

    //Specifies the nunmber of columns of a console (if applicable) of characters.
    info.dwXCountChars = 30;

    //Specifris the number of rows of characters of a console window
    info.dwYCountChars = 0;

    //Specifies the color when opening the new GUI
    info.dwFillAttribute = 0;

    //Specifies different visual attributes, such as for the cursor.
    info.dwFlags = 0;

    //This must be zero.
    info.cbReserved2 = 0;
    //This must be NULL.
    info.lpReserved2 = NULL;

    info.dwFlags = 0;

    //This is NULL because of the value of dwFlags.
    info.hStdInput = NULL;

    //This is ignored because of dwFlahs.
    info.wShowWindow = 0;

    //This is NULL because of the dwFlags.
    info.hStdOutput = NULL;

    //This is NULL because of the value of dwFlags.
    info.hStdError = NULL;

    PROCESS_INFORMATION ThreadInfo;
    bool success = CreateProcessAsUserA(theHandle, path.c_str(), NULL, NULL, NULL, false, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, &info, &ThreadInfo);
    //lpStartupInfo might be useful in the situation that a display window is not being shown.
    threadHandle = ThreadInfo.hThread;
    if (!success) {
        return false;
    }
    else {
        return true;
    }
}

Something that I don't think is as significant, and isn't encountered in most cases, but appears when I'm hacking around:
error encountered : Error 1053 : The service did not respond to the start of control request in a timely fashion
Tried: Cleaning registry
       Downloading framework NET 4.5.


text:
Q: MySQL Join help from two tables I'm sure there are a bunch of examples on S.O. but I don't even know what to search for since I'm very limited when it comes to working with databases, so I thought I'd post here and hope to get some help.
I have two tables, Users and Profiles.  There can be multiple profiles for one email, and there can multiple profiles for in the Users table.
I need to write a query that selects all of the profileIDs from the Profile table where the email matches ("test@test.com" for example.  This should return a bunch of profiles (1, 23, 444, 9203, 034)  But I only want to return the profileIDs (and username) that are in the Users table. (for example only profileID 444 is in the User's table.
Profile Table Example:
profileID | primaryEmail | name | otherStuff |
User Table:
profileID | username | password | otherUserStuff|
This is probably extremely simple, but it would take me quite a bit of time to research, and I'm on a time crunch.
Something like(?):
    SELECT t1.profileID, t2.username
    FROM Profiles as t1 INNER JOIN Users as t2 ON t1.profileID = t2.profileID
    WHERE t1.primaryEmail="test@test.com"

I'm a frontend dev that picked up a task that has a bunch more backend work than I thought.. and I'm already a couple days past the due date..

A: The sql documentation from mysql's documentation site should help you form the query you're looking for, but for what a working join example would look something like this:
SELECT column1 FROM table1 tableAlias
INNER JOIN table2 table2Alias ON tableAlias.column = table2Alias.column
WHERE tableAlias.column = this AND table2Alias.column = that

NOTE:  There's more than one type of join you can use, so take a moment to read through the documentation, and determine which one is best suited for solving your problem.

A: You may write this query.
SELECT Profile.ProfileID, User.username from Profile INNER JOIN User ON Profile.ProfileID = User.ProfileID WHERE Profile.primaryEmail = "test@test.com"

Try it.
Thanks.

A: SELECT ProfileID, Username
  FROM Profile
  JOIN Users USING (ProfileID)
 WHERE primaryEmail = "test@test.com"

It will show data that exists in both table which has same profileID


text:
Q: Identity involving parametric curves Below is the question:

If $x=\sin t$ and $y=\cos 2t$, find $\frac{dy}{dx}$ in terms of $x$ and prove that $\frac{d^2y}{dx^2} + 4 =0$.

I found $\frac{dy}{dx}$ first (using the chain rule, since what they have given us is parametric equations) and got $$\frac{dy}{dx} = -\frac{2\sin 2t}{\cos t}$$ and then I derived that again to get the second derivative, but was not able to prove it.
For the second derivative I got $$\frac{d^2y}{dx^2} = -\frac{4cost}{\sin t} - \frac{4\cos 2t}{\cos t}.$$
After this I tried to bring the two together getting this: $$\frac{-4 \cos t^{2} - 4\sin t\ cos 2t}{\sin t\cos t}$$
But then did not know how to get it to $-4$ (considering $-4+4=0$).
Can someone help me on how to solve this? As well as point out what I have done wrong?
Thank you.

A:
find $\frac{dy}{dx}$ in terms of $x$

Hint: use the expansion of $\sin 2t = 2\sin t\cos t$
You have:
$$\frac{dy}{dx} = -\frac{2\sin{2t}}{\cos t} = -\frac{4\sin t\cos t}{\cos t} = -4\sin t$$
$$\Rightarrow \frac{dy}{dx} = -4x$$
The rest should be straightforward.
Note: I think the reason you did not get to the same result is because you have not used the quotient rule for the second-order derivative.


text:
Q: Same class name in library and project If I have a class named ClassA in my main project, and I have a sub project built for a static library, in this sub project a class also named ClassA. I'm wonder that I can build and run successfully, how the compiler distinguish the two class?

A: I think you are talking about how linker works.
The static library is a collection of several relocatable object files with the suffix ".o". The source files in your project are also compiled into a relocatable object files.
When linker works, it will resolve the symbols like ClassA that used in your code. If it finds that in a relocatable object file - let's say rof1.o, it would absorb rof1.o into the executable file. The searching order of relocatable object file when linker try to resolve symbols determines which ClassA is used. As the searching order is non-deterministic to us, you should use a different class name.
BTW if you set the other link flags to '-all_load', which indicates that the linker will try to combine all the relocatable object files into the executable file. Then if there are two or more same symbols, it will show an error "duplicated symbols".

A: You need to rename one of your classes otherwise compiler throws an error when building your code.


text:
Q: Logarithmic differentiation - when we can use it? Assume I need to differentiate:
$$
f(x)=x^{\cos(x)}
$$
so, by using logarithmic differentiation, I get:
$$
f'(x)=x^{\cos(x)} \left( -\sin(x)\ln(x) + \frac{1}{x}\cos(x) \right)
$$
my questions are:

*

*how can I determine from this process where the function $f$ is differentiable and where it is not?

*Where is the function $f$ defined?
Hope someone will help me
Thanks !

A: For the first question, check where $f'(x)$ exists and where it does not to find out where it is differentiable and where it is non-differentiable.
As for your $f(x)$, $f'(x)$ does not exist for $x \le 0$ , so $f(x)$ is not differentiable there.
For your second question, the process of differentiation is not important. You can check that from the function itself.

A: For arbitrary function $f:\Bbb R \to \Bbb C$, the points where $f$ is non-zero, we can apply logarithmic differentiation. For your particular problem $f$ is defined on $\Bbb R$ and logarithmic differentiation is applicable for $x \neq 0$.


text:
Q: DropDown is getting opened for every other button in the table I am new to React. Here, I have a table , in which there are more that 20 elements are there. So, there are 20 td's.
Now,

  {props.isRowAddingEditorVisible && <RowAddingEditor removeRow={props.removeRow} />}
  {props.jobList && props.jobList && props.jobList.length > 0 && props.jobList.map((item, key) => {
    return (

          <input type="checkbox" name={item.jdName} checked={!!props.parentState[item.jdName]} onChange={props.handleTableCheckboxChange} />

        {item.technology}
        {item.jdIdScore ? item.jdIdScore.resumeCount : 0}

{item.jdName}

          {(item.isNew) &&
New
}

        {item.jdIdScore ? item.jdIdScore.totalFinalScore : 0}
        {item.jdIdScore ? item.jdIdScore.jdAverage : 0}

          <JobActionsButton />

    )
  })}

Now, Here there is one component that is
<JobActionsButton />

which actually is like this .
import React from "react";

export default class NewCollapse extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      quizEnable: false,
      viewEnable: false,
      uploadEnable: false
    };
  }
  enableQuiz = () => {
    this.setState({
      quizEnable: true,
      viewEnable: false,
      uploadEnable: false
    });
  };
  enableView = () => {
    this.setState({
      quizEnable: false,
      viewEnable: true,
      uploadEnable: false
    });
  };

  enableUpload = () => {
    this.setState({
      quizEnable: false,
      viewEnable: false,
      uploadEnable: true
    });
  };

  render() {

    const btnHeight = {
      height: "100%",
      background: "rgb(87, 160, 245)",
      borderRadius: "2px"
    };

    return (

          <button
            href="#menupos1"
            data-toggle="collapse"
            data-parent="#mainmenu"
            style={btnHeight}
          >
            Quick Action

          </button>

              Quiz

                Create New

                View

                Update

              View

                Job Description

                Resume

              Upload

                Folder

                Resume

              Download Tracker

              Selection Criteria

              Remove

    );
  }
}

Now, In this there is one button on click of this button it gets open .
But what is happening currently is that on click of a single td button others are also getting opend .
So, I actually getting confused why is this happeing ? can any one help me with this ?


text:
Q: Dir /b /s shows different results in a batch file and cmd.exe This is my first time here. I used the site to find answers to my questions anonymously many times before.
A very similar question already exists here, but it didn't help me with my problem.
In my batch file, I set a variable to pass to robocopy the files to exclude:
SET EXCL=*.bak *.inp_bak *.dwl *.err plot.log dotlog.txt logs\*.log
EDIT: I want to list and confirm all files to be excluded first.
The problem is in the last part, "logs\*.log", i.e. I am looking for .log files in a subfolder "logs" under the current folder.
In a command prompt window, I can execute this command without problems:
dir %EXCL% /b /s
and %ERRORLEVEL% returns 0. However, in my .bat I have this same line but %ERRORLEVEL% returns 1, and I noticed that DIR shows me all the files but when it gets to the "logs\*.log" part I get the message "File not found".
What I am trying to do is list any "plot.log" files in the current folder or any subfolder (/s) + all the .logs in the specified subfolder, but NOT other .log files in other subfolders.
Is it possible to do this on a single line within the batch file? I don't want to run two different DIRs


text:
Q: how to program a multi-criteria Access search Form Hello i have a problem i want to make a multi-criteria Access search form. i wrote the vba code to select some of the reseach criteria in my database but everytime it show me the error. i don't know exactly what is the error in the syntax that i wrote.
'searches parameters according to option criteria
Private Sub txtCherche_Change()
    If Rahmen0 = 1 Then 'search  name in the table Assistenz_Verwaltung
    strRowSource = "SELECT [Name], [Wohnort], [Region]" & "FROM Assistenz_Verwaltung"
                    WHERE [Name] Like "*" & Me.txtCherche.Text & "*"

    ElseIf Rahmen0 = 2 Then 'search Wohnort in the table Assistenz_Verwaltung
    strRowSource = "SELECT [Name], [Wohnort], [Region]" & "FROM Assistenz_Verwaltung"
                    WHERE [Wohnort] Like "*" & Me.txtCherche.Text & "*"

    Else: Rahmen0 = 3 'search Region in the table Assistenz_Verwaltung
    strRowSource = "SELECT [Name], [Wohnort], [Region]" & "FROM Assistenz_Verwaltung"
                    WHERE [Region] Like "*" & Me.txtCherche.Text & "*"

    End If

    lst0.RowSource = strRowSource

End Sub

what i expected was that when i choose one of the criteria and write a letter it will select the name or the place or the region according to the letter i chose but it show me the same error messages.

"Error compiling: Sub or function not defined"

A: The way you are concatenating your string is part of the problem:
strRowSource = "SELECT [Name], [Wohnort], [Region]" & "FROM Assistenz_Verwaltung"
                WHERE [Name] Like "*" & Me.txtCherche.Text & "*"

That will produce:
SELECT [Name], [Wohnort], [Region]FROM Assistenz_VerwaltungWHERE [Name] Like *ChercheStuff*

That will not work because you need a space between your SQL keywords like this
SELECT [Name], [Wohnort], [Region] FROM Assistenz_Verwaltung WHERE [Name] Like *ChercheStuff*

The second problem is that you are not putting quotes around the string you are trying to match (single quotes are easier in this case) - You would want it to look more like this:
SELECT [Name], [Wohnort], [Region] FROM Assistenz_Verwaltung WHERE [Name] Like '*ChercheStuff*'

In order to achieve that, the code would look more like this:
strRowSource = "SELECT [Name], [Wohnort], [Region] FROM Assistenz_Verwaltung WHERE [Name] Like '*" & Me.txtCherche.Text & "*'"

See the single quotes within the double quotes? That is important.


text:
Q: Force rendering of already computed reactive elements I'm trying to build a shiny app that outputs several results through different render* functions.
The problem is that one of those results takes some time to compute. So I would like shiny to render the quick results as soon as possible.
Here is some code to illustrate
# ui.R
library(shiny)

shinyUI(fluidPage(
    textOutput("res1"),
    textOutput('res2')
))

# server.R
library(shiny)

shinyServer(function(input, output) {

    output$res1 = renderText({
        "shows up instantly"
    })

    output$res2 = renderText({
            Sys.sleep(3)
            "shows up after 3 sec"
    })
})

For now, the webpage stays empty for 3 seconds and the two elements are rendered at once.
My question is the following one: is it possible to enforce that output$res1 executes before output$res2 and that it sends its results to the browser before the long computation begins ?

A: Check out invalidateLater otherwise if you only want to render text you can send text directly to the client using:
# ui.R
library(shiny)

ui <- shinyUI(fluidPage(
  tags$head(
    tags$script(
      HTML("
            Shiny.addCustomMessageHandler ('print',function (message) {
              $('#'+message.selector).html(message.html);
              console.log(message);
            });
           ")
    )
  ),
  textOutput("res1"),
  textOutput('res2')
))

# server.R
server <- shinyServer(function(input, output, session) {
  session$sendCustomMessage(type = 'print', message = list(selector = 'res1', html = "shows up instantly"))
  Sys.sleep(3)
  session$sendCustomMessage(type = 'print', message = list(selector = 'res2', html = "shows up after 3 sec"))
})

shinyApp(ui = ui, server = server)

A: I found a workaround. The idea is to force all render* functions to send their results to the browser once before launching the long computations.
In the following code, the two text zones appear immediately and the second one is updated after 3 seconds.
shinyServer(function(input, output,session) {

    status=reactiveValues(res1IsDone=FALSE,res2HasRendered=FALSE)

    output$res1 = renderText({
        status$res1IsDone = TRUE
        "shows up instantly"
    })

    output$res2 = renderText({
        if(isolate(!status$res1IsDone || !status$res2HasRendered)) {
            status$res2HasRendered = TRUE
            invalidateLater(100,session)
            "wait"
        } else {
            Sys.sleep(3)
            "shows up after 3 sec"

        }
    })
})

To my understanding, shiny is monothreaded and the results are sent back to the browser once all the render* functions are executed once (or when all invalidation are resolved ?).


text:
Q: dojo: inheritance with default value - the mixin doesn't happen I wish to declare a new dojo class inheriting from an existing dojo class, but with my own choice of default values for the class's properties.  (The user can still override those values.)
I am declaring my own version of the dijit.form.FilteringSelect such that:

*

*the hasDownArrow property defaults to false (rather than the standard true) and

*there's an extra possible property storeUrl which allows me to connect the FilteringSelect to the corresponding QueryReadStore.

Here's what I did, without success:
dojo.provide("my.FilteringSelect");
dojo.require("dijit.form.FilteringSelect");
dojo.require("dojox.data.QueryReadStore");
dojo.declare(
   "my.FilteringSelect",
   [
      dijit.form.FilteringSelect,  /* base superclass */
      { hasDownArrow:false, storeUrl:"/" }  /* mixin */
   ],
   {
      constructor: function(params, srcNodeRef){
         console.debug("Constructing my.FilteringSelect with storeUrl "
                        + this.storeUrl);
         this.store = new dojox.data.QueryReadStore({url:this.storeUrl});
      }
   }
);

Say, I try to generate declaratively in the HTML such a version of my.FilteringSelect:
<input type="text" id="birthplace" name="birthplace"
       promptMessage="Start typing, and choose among the suggestions"
       storeUrl="/query/regions"
       dojoType="my.FilteringSelect" />

This will indeed create a FilteringSelect with the desired promptMessage (which means that the superclass is properly getting the params), but hasDownArrow is true (contrary to my default mixin) and the store is null (and the Firebug console reports that storeUrl is "undefined").
What am I doing wrong?

A: Oops!  I really had things on their head.  I found the right way around. The following works:
dojo.provide("my.FilteringSelect");
dojo.require("dijit.form.FilteringSelect");
dojo.require("dojox.data.QueryReadStore");
dojo.declare(
   "my.FilteringSelect",
   dijit.form.FilteringSelect,
   {
      hasDownArrow : false,
      storeUrl : "/",
      constructor: function(params, srcNodeRef){
         dojo.mixin(this, params);
         console.debug("Constructing my.FilteringSelect with storeUrl "
                        + this.storeUrl);
         this.store = new dojox.data.QueryReadStore({url:this.storeUrl});
      }
   }
);


text:
Q: Where does a torque-invoking force belong in work energy theorem? First of all, sorry for the poorly phrased question, simply couldn't figure out a better way to put it.
So, the work energy theorem states that work done on an object is equal to the change in its kinetic energy.
$W=\Delta K$
Now consider a yo-yo that is dropped from rest. Say it fell a distance h in t seconds. For the correct result we need to take the effect of T into account while calculating h, but not while calculating F.
if:
$$\sum F = mg$$
$$h = \frac{(g - \frac{T}{m})t^2}{2}$$
Since $$W = \Delta K = mgh = K_{rot} + K_{trans} = \frac{3}{4} m  v^2$$
$$v=\frac{mg-T}{m}t$$
We find $T = mg/3$
But if:
We say $\sum F = mg - T$;
We find $2=3$ after cancellations.
My actual question is why don't we take T into account while calculating the total force doing the work. Tension and gravity both do work on the object but when I take tension into account it all comes crashing down. What is it that seperates tension?

A: The force of tension does 2 'types' of work:

*

*It acts on the yoyo opposing its motion, affects translational KE, and;

*Provides a torque about the center of rotation (presumably the CoM), affecting the rotational KE.

The work (affecting translational motion) by the tension force is $$W_\mathrm{tension,\ trans}=-Th$$
whereas the work by the tension (affecting rotational motion) is $$W_{\rm tension,\ rot}=Tr\Delta\theta$$
where $r$ is the distance between the center of rotation and the point where tension is applied. Assuming rolling without slipping, $h=r\Delta\theta$ and thus,
$$W_{\rm tension, \ rot}=Th$$
Therefore, it is obvious that $W_\mathrm{tension,\ trans}+W_{\rm tension,\ rot}=0$. So, if you decide to include the work by tension, you have to account for the work done on the translation of the CoM AND the torque about the CoM, which both sum to zero, hence can be excluded from calculations.
Also, do not forget to include the rotational kinetic energy in your work-KE theorem.

A: $\vec F_{ext} = M \vec a$ where $\vec F_{ext}$ is the net external force, $M$ is the total mass, and $\vec a$ is the acceleration of the center of mass (CM). $F_{ext} = mg - T$ downward where T is the tension in the yo yo string.  This is for the motion of the CM.  $T$ is not constant.
The yo yo has rotational motion about the CM as well as translational motion of the CM.  $\vec \tau_{ext} = d\vec L/dt$ where $\vec \tau _{ext}$  is the total torque with respect to the CM and $\vec L$ is the angular momentum with respect to the center of mass.  This torque is due to $T$.
Regarding your question about T and work, the force T does no work assuming there is no slip at the string/yo yo surface. The force T is a constraint that provides a torque but T does no work on the yo yo as a whole. This is similar to an object rolling down a plane without slipping; here, the force of friction provides a torque but does no work since there is no relative motion between the friction force and the point of contact of the object on the plane.  See one of the physics texts by Halliday and Resnick. This allows us to use the conservation of mechanical energy to evaluate the problem as follows. [If the string slips, then $T$ does work on the yo yo.]
Assuming no friction loss and no slipping of the yo-yo string, for a yo yo unwinding down starting from rest, from the conservation of energy, after falling a distance $h$:  $mgh = mv^2/2 + I \omega ^2/2$ where $I$ is the moment of inertia of the yo yo, $v$ is the velocity of the CM, and $\omega$ is its angular velocity with respect to the CM, equal to $v/r$ where $r$ is the distance from the CM to where the string is wound on the yo yo.  [Note: this is an evaluation of $Work = \Delta Kinetic \enspace Energy$ for the yo yo where $Work = mg$ (the work from gravity is considered as a change in potential energy), and $Kinetic \enspace Energy$ includes translational energy of the CM and rotational energy about the CM. $\int_{a}^{b}(mg - T)dx = \Delta KE_{CM} = 1/2Mv^2$ where x is the downward distance travelled by the CM, but this is just for the kinetic energy of the CM not for the entire yo yo.  In this sense T does work on the CM, but not on the yo yo as a whole; the earlier answer by @User256872 discusses this.]
This exchange has numerous discussions of this problem; for example see Simple yo-yo work problem. Also see https://physics.princeton.edu/~mcdonald/examples/yoyo.pdf on the web.

A:
My actual question is why don't we take T into account while
calculating the total force doing the work. Tension and gravity both
do work on the object but when I take tension into account it all
comes crashing down. What is it that seperates tension?

We do take into account $T$ (Torque) when calculating the total force doing the work. It takes it into account because the $\Delta KE$ in the work energy theorem is the sum of the change in rotational and translational kinetic energy. The torque $T$ provide the rotational kinetic energy component of the total change in kinetic energy due to net work (rotational + translational) done.
Hope this helps.


text:
Q: Find the seller user id and buy user id located in different states I am trying to find the following below.
" Find the seller user id and buy user id such that the buyer has bought at least one item from the seller but the buyer and seller are located in different states."
I tried the following code but i don't think its right. I am attaching a picture of my tables to this post. I don't think the state is correct here.
select selleruserid, buyeruserid
from sales_fact
where EXISTS (select b.userid
from buyers_dim b, sellers_dim s
where b.state <> s.state)

[Tables]

A: Never use comma in the FROM clause.  In this case, you can get the pairs of such buyers and sellers using:
select sf.selleruserid, sf.buyeruserid
from sales_fact sf join
     buyers_dim b
     on sf.buyeruserid = b.userid join
     sellers_dim s
     on sf.sellersuserid = s.userid
where b.state <> s.state;

A: If you want buyer's all the transaction who have made atleast one inter-state transaction then you can use your existing query with correlation as follows:
select selleruserid, buyeruserid
from sales_fact sf
where EXISTS (select b.userid
from buyers_dim b join sellers_dim s on b.state <> s.state
  and B.userid = SF.buyeruserid and sf.sellersuserid = s.userid)


text:
Q: xtable for MANOVA object obtained with car package I wonder how to get xtable of MANOVA object obtained with car package. Here is MWE:
library(xtable)
library(car)
MANOVA <- Anova(lm(cbind(Al, Fe, Mg, Ca, Na) ~ Site, data=Pottery))
xtable(MANOVA)

Error in UseMethod("xtable") :    no applicable method for 'xtable'
  applied to an object of class "Anova.mlm"

A: The problem is that xtable has a method for objects of class anova, but the car package's Anova function returns an object of class anova.mlm. I found a fix at https://stat.ethz.ch/pipermail/r-help/2009-June/201478.html:
library(xtable)
library(car)

# Create some example data
Pottery <- data.frame(
  "Al" = rnorm(10),
  "Fe" = rnorm(10),
  "Mg" = rnorm(10),
  "Ca" = rnorm(10),
  "Na" = rnorm(10),
  "Site" = sample(LETTERS[1:2], 10, replace = TRUE))

# Create a custom function handling `anova.mlm` objects
xtable.Anova.mlm <- function (x, ...) {
  test <- x$test
  repeated <- x$repeated
  ntests <- length(x$terms)
  tests <- matrix(NA, ntests, 4)
  if (!repeated)
    SSPE.qr <- qr(x$SSPE)
  for (term in 1:ntests) {
    eigs <- Re(eigen(qr.coef(if (repeated) qr(x$SSPE[[term]]) else
      SSPE.qr,
      x$SSP[[term]]), symmetric = FALSE)$values)
    tests[term, 1:4] <- switch(test, Pillai = stats:::Pillai(eigs,
      x$df[term], x$error.df), Wilks = stats:::Wilks(eigs,
        x$df[term], x$error.df), `Hotelling-Lawley` = stats:::HL(eigs,
          x$df[term], x$error.df), Roy = stats:::Roy(eigs,
            x$df[term], x$error.df))
  }
  ok <- tests[, 2] >= 0 & tests[, 3] > 0 & tests[, 4] > 0
  ok <- !is.na(ok) & ok
  tests <- cbind(x$df, tests, pf(tests[ok, 2], tests[ok, 3],
    tests[ok, 4], lower.tail = FALSE))
  rownames(tests) <- x$terms
  colnames(tests) <- c("Df", "test stat", "approx F", "num Df",
    "den Df", "Pr(>F)")
  tests <- structure(as.data.frame(tests), heading = paste("\nType ",
    x$type, if (repeated)
      " Repeated Measures", " MANOVA Tests: ", test, " test
statistic",
    sep = ""), class = c("anova", "data.frame"))
  #    print(tests)
  #    invisible(x)
  xtable(tests)
}

MANOVA <- Anova(lm(cbind(Al, Fe, Mg, Ca, Na) ~ Site, data=Pottery))

xtable(MANOVA)

% latex table generated in R 2.15.2 by xtable 1.7-1 package
% Tue Jun 11 20:49:51 2013
\begin{table}[ht]
\centering
\begin{tabular}{lrrrrrr}
\hline
& Df & test stat & approx F & num Df & den Df & Pr($>$F) \\
\hline
Site & 1 & 0.61 & 1.24 & 5 & 4 & 0.4288 \\
\hline
\end{tabular}
\end{table}


text:
Q: How to perform onDelete with Section item inside ForEach in SwiftUI In abolutely new project I have this code for testing:
extension Int: Identifiable {

    public var id: UUID { UUID() }
}

struct ContentView: View {

    let data: [Int] = [1, 2, 3, 4, 5]

    var body: some View {
        List {
            ForEach(data) {
                Section(header: Text("\($0)")) {
                    ForEach(data) {
                        Text("\($0)")
                    }.onDelete(perform: { indexSet in
                        print("Delete \(indexSet)")
                    })
                }
            }
        }
    }
}

In this case there is no such action as swipe to delete. By default you can swipe and see delete button right after you type onDelete to ForEach. But when you place Section in ForEach this isn't happening.
It will appear when I remove Section. Even if I have ForEach in ForEach in ForEach it still works. But not with Section in it – why?
Xcode 12.4
Swift 5

A: You just need to provide an array of arrays with the rows for each section:
struct ContentView: View {
    @State var data: [[Int]] = [[1, 2, 3, 4, 5],[1, 2, 3, 4, 5],[1, 2, 3, 4, 5],[1, 2, 3, 4, 5],[1, 2, 3, 4, 5]]
    var body: some View {
        List {
            ForEach(data.indices, id: \.self) { section in
                Section(header: Text("\(section+1)")) {
                    ForEach(data[section], id: \.self) { row in
                        Text("\(row)")
                    }.onDelete(perform: { indexSet in
                        data[section].remove(atOffsets: indexSet)
                    })
                }
            }
        }
    }
}


text:
Q: Replacing disk when using FreeBSD ZFS zroot (ZFS on partition)? How to replace broken disk with new when using ZFS on root?
I have 4 disk RAIDZ2 pool using zroot. This means that ZFS is running on separate partition instead of using whole disk. I didn't find any documentation on how to replace disk in this situation or information was deprecated. Pool was generated by the installation automatically.
Camcontrol device list:
% doas camcontrol devlist -v
scbus0 on mpt0 bus 0:
<>                                 at scbus0 target -1 lun ffffffff ()
scbus1 on ahcich0 bus 0:
<>                                 at scbus1 target -1 lun ffffffff ()
scbus2 on ahcich1 bus 0:
<>                                 at scbus2 target -1 lun ffffffff ()
scbus3 on ahcich2 bus 0:
<ST2000DM001-1CH164 CC43>          at scbus3 target 0 lun 0 (pass0,ada0)
<>                                 at scbus3 target -1 lun ffffffff ()
scbus4 on ahcich3 bus 0:
<ST2000DM001-1CH164 CC43>          at scbus4 target 0 lun 0 (pass1,ada1)
<>                                 at scbus4 target -1 lun ffffffff ()
scbus5 on ahcich4 bus 0:
<ST2000DM001-1CH164 CC43>          at scbus5 target 0 lun 0 (pass2,ada2)
<>                                 at scbus5 target -1 lun ffffffff ()
scbus6 on ahcich5 bus 0:
<SAMSUNG HD204UI 1AQ10001>         at scbus6 target 0 lun 0 (pass3,ada3)
<>                                 at scbus6 target -1 lun ffffffff ()
scbus7 on ahciem0 bus 0:
<AHCI SGPIO Enclosure 1.00 0001>   at scbus7 target 0 lun 0 (pass4,ses0)
<>                                 at scbus7 target -1 lun ffffffff ()
scbus-1 on xpt0 bus 0:
<>                                 at scbus-1 target -1 lun ffffffff (xpt0)

gpart of existing disk:
% gpart show ada0
=>        40  3907029088  ada0  GPT  (1.8T)
          40        1024     1  freebsd-boot  (512K)
        1064         984        - free -  (492K)
        2048     4194304     2  freebsd-swap  (2.0G)
     4196352  3902832640     3  freebsd-zfs  (1.8T)
  3907028992         136        - free -  (68K)

zpool status:
% zpool status zroot
  pool: zroot
 state: DEGRADED
status: One or more devices has been removed by the administrator.
        Sufficient replicas exist for the pool to continue functioning in a
        degraded state.
action: Online the device using 'zpool online' or replace the device with
        'zpool replace'.
  scan: scrub repaired 28K in 0h41m with 0 errors on Thu Sep 27 17:58:02 2018
config:

        NAME                      STATE     READ WRITE CKSUM
        zroot                     DEGRADED     0     0     0
          raidz2-0                DEGRADED     0     0     0
            ada0p3                ONLINE       0     0     0
            ada1p3                ONLINE       0     0     0
            ada2p3                ONLINE       0     0     0
            15120424524672854601  REMOVED      0     0     0  was /dev/ada3p3

errors: No known data errors

Offline:
% doas zpool offline zroot 15120424524672854601

I tried to copy first few GiB to ada3 from ada0 with dd but both zpool attach and zpool replace gives error: /dev/ada3p3 is part of active pool 'zroot' and even force flag doesn't help. I'm guessing disk UUID's are colliding.
What are the steps of how to copy/replicate ada0-2p1-3 partitions to the new disk (ada3) and replace the faulted drive? What commands did the automated installer run to create these partitions in first place?

A: First: remember to take the new drive offline and be sure that it's not mounted or in use in any way.
Copy partition tables from old disk ada0 to new disk ada3:
% doas gpart backup ada0 | doas gpart restore -F ada3

Now ada3 has same three partitions as ada0:
% doas gpart show ada3
=>        40  3907029088  ada3  GPT  (1.8T)
          40        1024     1  freebsd-boot  (512K)
        1064         984        - free -  (492K)
        2048     4194304     2  freebsd-swap  (2.0G)
     4196352  3902832640     3  freebsd-zfs  (1.8T)
  3907028992         136        - free -  (68K)

Remove old ZFS metadata (notice partition p3):
% doas dd if=/dev/zero of=/dev/ada3p3

Replace drive (notice partition p3):
% doas zpool replace -f zroot 15120424524672854601 /dev/ada3p3
Make sure to wait until resilver is done before rebooting.

If you boot from pool 'zroot', you may need to update
boot code on newly attached disk '/dev/ada3p3'.

Assuming you use GPT partitioning and 'da0' is your new boot disk
you may use the following command:

        gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0

Run the mentioned command to update boot information on the new disk:
% doas gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada3
partcode written to ada3p1
bootcode written to ada3

UUID's are now different:
% gpart list ada0 | grep uuid | sort
   rawuuid: 7f842536-bcd0-11e8-b271-00259014958c
   rawuuid: 7fbe27a9-bcd0-11e8-b271-00259014958c
   rawuuid: 7fe24f3e-bcd0-11e8-b271-00259014958c
% gpart list ada3 | grep uuid | sort
   rawuuid: 9c629875-c369-11e8-a2b0-00259014958c
   rawuuid: 9c63d063-c369-11e8-a2b0-00259014958c
   rawuuid: 9c66f76e-c369-11e8-a2b0-00259014958c
% gpart list ada0 | grep efimedia | sort
   efimedia: HD(1,GPT,7f842536-bcd0-11e8-b271-00259014958c,0x28,0x400)
   efimedia: HD(2,GPT,7fbe27a9-bcd0-11e8-b271-00259014958c,0x800,0x400000)
   efimedia: HD(3,GPT,7fe24f3e-bcd0-11e8-b271-00259014958c,0x400800,0xe8a08000)
% gpart list ada3 | grep efimedia | sort
   efimedia: HD(1,GPT,9c629875-c369-11e8-a2b0-00259014958c,0x28,0x400)
   efimedia: HD(2,GPT,9c63d063-c369-11e8-a2b0-00259014958c,0x800,0x400000)
   efimedia: HD(3,GPT,9c66f76e-c369-11e8-a2b0-00259014958c,0x400800,0xe8a08000)

Drive is now resilvering:
% zpool status zroot
  pool: zroot
 state: DEGRADED
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Sat Sep 29 01:01:24 2018
        64.7G scanned out of 76.8G at 162M/s, 0h1m to go
        15.7G resilvered, 84.22% done
config:

        NAME                        STATE     READ WRITE CKSUM
        zroot                       DEGRADED     0     0     0
          raidz2-0                  DEGRADED     0     0     0
            ada0p3                  ONLINE       0     0     0
            ada1p3                  ONLINE       0     0     0
            ada2p3                  ONLINE       0     0     0
            replacing-3             OFFLINE      0     0     0
              15120424524672854601  OFFLINE      0     0     0  was /dev/ada3p3/old
              ada3p3                ONLINE       0     0     0

After resilver:
% zpool status zroot
  pool: zroot
 state: ONLINE
  scan: resilvered 18.6G in 0h7m with 0 errors on Sat Sep 29 01:09:22 2018
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          raidz2-0  ONLINE       0     0     0
            ada0p3  ONLINE       0     0     0
            ada1p3  ONLINE       0     0     0
            ada2p3  ONLINE       0     0     0
            ada3p3  ONLINE       0     0     0

errors: No known data errors


text:
Q: Can't load assembly generated with code in a new Application Domain I have an asp.net application, which generates assemblies on the fly from user scripts.
It's all working good, but now I want to run the assembly in a SandBox application domain with reduced permissions.
When I load the assembly in a new application domain, I get the Exception

Could not load file or assembly 'genb3336c1d82074079911fb70bd8bd7e65.dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

In an effort to see what's happening, I saved the generated assembly to disk and just wrote a simple application with the following code
string path = @"test.dll";
byte[] buffer = File.ReadAllBytes(path);

var assembly = AppDomain.CurrentDomain.Load(buffer); //This works

var appDomain = AppDomain.CreateDomain("Test");
assembly = appDomain.Load(buffer); //Exception

Again when I try to load the assembly in the new domain, I get the same exception. Loading it in the CurrentDomain works fine.
Then I created a class library with just a class and the source code I generated the dll from.
Source code is minimal, 2 lines of code in a method. Now when I build and load this dll in the new application domain, it loads just fine.
I opened the 2 dlls in ILSpy and they look identical

So I have no idea what's wrong with the generated dll.
I generate the assembly using the following code.
public class ScriptCompiler
{
    public static (byte[], byte[], Assembly) Compile((string Source, string Path)[] sources, string[] references, params Type[] types)
    {
        var assemblyName = "gen" + Guid.NewGuid().ToString().Replace("-", "") + ".dll";
        byte[] rawAssembly;
        byte[] rawPdb;

#if DEBUG
        var encoding = Encoding.UTF8;
        var symbolsName = Path.ChangeExtension(assemblyName, "pdb");

        var sourceTexts = sources
            .Select(s => new { Buffer = encoding.GetBytes(s.Source), s.Source, s.Path })
            .Select(b => new { SourceText = SourceText.From(b.Buffer, b.Buffer.Length, encoding, canBeEmbedded: true), b.Path });

        var syntaxTrees = sourceTexts
            .Select(s => new { Tree = CSharpSyntaxTree.ParseText(s.SourceText, new CSharpParseOptions(), s.Path), s.Path })
            .Select(t => new { Node = t.Tree.GetRoot() as CSharpSyntaxNode, t.Path })
            .Select(n => CSharpSyntaxTree.Create(n.Node, null, n.Path, encoding));

        var options = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithOptimizationLevel(OptimizationLevel.Debug);
#else
        var syntaxTrees =
            from source in sources.Select(s => s.Source)
            select CSharpSyntaxTree.ParseText(source);

        var options = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithOptimizationLevel(OptimizationLevel.Release);
#endif

        var typeRefs = new List<MetadataReference>();
        foreach (var type in types)
        {
            typeRefs.Add(MetadataReference.CreateFromFile(type.Assembly.Location));
        }

        var compilation = CSharpCompilation.Create(assemblyName,
            options: options,
            syntaxTrees: syntaxTrees,
            references: typeRefs.Union(references.Select(r => MetadataReference.CreateFromFile(r))));

        EmitResult emitResult;

        using (var peStream = new MemoryStream())
        using (var pdbStream = new MemoryStream())
        {
#if DEBUG
            emitResult = compilation.Emit(
                peStream: peStream,
                pdbStream: pdbStream,
                embeddedTexts: sourceTexts.Select(s => EmbeddedText.FromSource(s.Path, s.SourceText)),
                options: new EmitOptions(debugInformationFormat: DebugInformationFormat.PortablePdb, pdbFilePath: symbolsName)
            );
#else
            emitResult = compilation.Emit(peStream: peStream);
#endif

            if (emitResult.Success)
            {
                rawAssembly = peStream.GetBuffer();
                rawPdb = pdbStream.GetBuffer();
                var assembly = Assembly.Load(rawAssembly, rawPdb);
                return (rawAssembly, rawPdb, assembly);
            }
        }

        var message = string.Join("\r\n", emitResult.Diagnostics);
        throw new ApplicationException(message);
    }
}

Anyone got any idea?
Edit:
This is the fusionLog. I don't know how to interpret it.
=== Pre-bind state information ===
LOG: DisplayName = genb3336c1d82074079911fb70bd8bd7e65.dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Users/Admin/source/repos/LoadAssembly/LoadAssembly/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Admin\source\repos\LoadAssembly\LoadAssembly\bin\Debug\LoadAssembly.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/Admin/source/repos/LoadAssembly/LoadAssembly/bin/Debug/genb3336c1d82074079911fb70bd8bd7e65.dll.DLL.
LOG: Attempting download of new URL file:///C:/Users/Admin/source/repos/LoadAssembly/LoadAssembly/bin/Debug/genb3336c1d82074079911fb70bd8bd7e65.dll/genb3336c1d82074079911fb70bd8bd7e65.dll.DLL.
LOG: Attempting download of new URL file:///C:/Users/Admin/source/repos/LoadAssembly/LoadAssembly/bin/Debug/genb3336c1d82074079911fb70bd8bd7e65.dll.EXE.
LOG: Attempting download of new URL file:///C:/Users/Admin/source/repos/LoadAssembly/LoadAssembly/bin/Debug/genb3336c1d82074079911fb70bd8bd7e65.dll/genb3336c1d82074079911fb70bd8bd7e65.dll.EXE.


text:
Q: Xcode 7 will NOT build a valid Archive from the same project that builds a valid archive in Xcode 6 When using Xcode 7b5 to build my app that contains a Today Extension I cannot create a valid archive. When I make an archive the build succeeds and then in Organizer it shows up under "Other Items" instead of under "iOS Apps".
If I close the project and open up the same project in Xcode 6.3.2 when I make the archive it shows up under "iOS Apps".
I compared the archives and the one thing I noticed is that my Today Widget is being placed outside of the Applications directory. The structure looks like this for Xcode 6.3.2 vs Xcode 7b5:
Xcode 6.3.2
|-Archive
|--Products
|---Applications
|----MyMainApp.app
Xcode 7 Beta 5
|-Archive
|--Products
|---Applications
|----MyMainApp.app
|---MyTodayWidget.appex
I think the problem is that the MyTodayWidget is packaged outside of the Applications dir and outside of the .app. I'm not sure why Xcode 7 beta 5 would package the app differently than Xcode 6.3.2 when I didn't make any changes.
UPDATE 8/14/2015:
This appears to be an issue with CocoaPods and Extensions like a WatchKit or Today extension. It has been reported as Invalid archive produced when using "Archive" in Xcode 7 beta 5 (with watchkit extension) #4021 by another developer. It appears to be the root cause of this issue.
Environment:
- Xcode 7 Beta 5
- Today Extension
- Normal App
- CocoaPods 0.38.2 (Latest Released Version as of 9/22)
- AFNetworking Used in Extension & App

A: Finally it`s fixed in the latest stable Version 0.39.0:
So instead of uninstalling
sudo gem uninstall cocoapods

and reinstalling via
sudo gem install cocoapods

Also a simple
sudo gem update cocoapods

should fix it!

A: It's an issue with CocoaPods v0.39.0.beta.4.
As described in CocoaPods GitHub the beta 3 of CocoaPods allows you to build archives as expected. Beta 4 has a bug preventing this from working.
Uninstall your previous CocoaPods version first
sudo gem uninstall cocoapods
and then do:
sudo gem install cocoapods -v 0.39.0.beta.3 --verbose
then
pod update
and you'll be able to build archives again as expected.

A: I just confirmed today that this was a CocoaPods issue for me, specifically 4021. I tried as the other users on the issue and removed "copy pod resources" from my today extension target. Once that was removed I was able to package up an archive successfully in Xcode 7 Beta 5.
Hopefully this still works in the next beta and the GM...
UPDATE 9/22: This is the answer if you are using 0.38.2 of CocoaPods their latest Release version as of 9/22/2015. I was able to submit my app to the app store using Xcode 7 GM using this method.

A: I had the same issue when updated Xcode to Version 7.0 (7A220).
And they said this issue is already tracked(Issue#4274)
finally,i fixed this issue with following steps:
1)clear all "Private Headers Folder Path" and "Public Headers Folder Path" in all the Pods Targets->Build Setting->Packaging
2)delete the "Copy Pods Resources" in our Targets->Build Phases.

A: This can be caused by using CocoaPods 0.38.[0-2] and Xcode 7.
It works with an older version of CocoaPods:
$ gem install cocoapods -v "=0.37.2"
$ gem uninstall cocoapods # then select 0.38.[0-2]
$ pod update

(Additionally, I also had to clean my build folder and wipe the Pods folder before the pod update and make changes to the AFNetworing post install hook in my Podfile)
Further causes are discussed in Cannot generate iOS App archive in xcode.

A: Works fine if you delete Copy Pod Resources from your extension. Though I have no idea what this could cause, my app worked, archived and went to review.

A: If using Xcode 7 with cocoapods v.0.38.2. Try removing copy pod resources from your today extension target.


text:
Q: how to overload a task in the controller - MVC I have 2 tasks in my controller that perform 2 very different actions.
The first task provides functionality to my search bar - it displays data the user requests to search for in the search field.
The second task simply returns a view, the view isn't relevant to the question.
The search bar's function will only work if I call the "index" task of my controller. The documentation doesn't explain why you have to put the search bar functionality in the index task, but you have to otherwise you will get exceptions.
My issue is that I already have code in my index task - what can I do to have 2 index controllers? I've tried overloading it directly in the controller and it didn't work.
Here's the code I currently have for reference:
public async Task<IActionResult> Index(string searchString)
{
        var course = from m in _context.Course
                     select m;

        if (!String.IsNullOrEmpty(searchString))
        {
            course = course.Where(s => s.CourseName.Contains(searchString));
        }

        return View(await course.ToListAsync());
}

// GET: Course
public async Task<IActionResult> Index()
{
    return View(await _context.Course.ToListAsync());
}

My front end code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - SEWebPage03</title>
    <link rel="stylesheet" href="~/css/site.css" />

                    Home

                    Privacy

                    Courses

                    Professors

        <form asp-controller="Course" asp-action="Index">

                <input type="text" name="SearchString">
                <input type="submit" value="Search" />

        </form>

            @RenderBody()

    @RenderSection("Scripts", required: false)

When trying to change the name to my task that returns a view, I get this error
(I changed the name of the task to testing):

InvalidOperationException: The view 'Testing' was not found. The following locations were searched:
/Views/Course/Testing.cshtml
/Views/Shared/Testing.cshtml
/Pages/Shared/Testing.cshtml

A: You can change your asp-action in your form:
Change
<form asp-controller="Course" asp-action="Index">

                <input type="text" name="SearchString">
                <input type="submit" value="Search" />

        </form>

to
 <form asp-controller="Course" asp-action="Search">

                    <input type="text" name="SearchString">
                    <input type="submit" value="Search" />

            </form>

And then you need to change your ActionName and the ViewName you return:
Change
public async Task<IActionResult> Index(string searchString)
{
        var course = from m in _context.Course
                     select m;

        if (!String.IsNullOrEmpty(searchString))
        {
            course = course.Where(s => s.CourseName.Contains(searchString));
        }

        return View(await course.ToListAsync());
}

to
public async Task<IActionResult> Search(string searchString)
{
        var course = from m in _context.Course
                     select m;

        if (!String.IsNullOrEmpty(searchString))
        {
            course = course.Where(s => s.CourseName.Contains(searchString));
        }

        return View("Index",await course.ToListAsync());
}


text:
Q: If heapify(x) takes O(n) how can heappush() take O(log n)? Let's say there is a list arr with n elements.
Then, heapq.heapify(arr) takes O(n).
But I learned heapq.heappush(arr, element) will take O(log n).
Isn't heapify same as calling heappush n times?


text:
Q: Is there a text editor which displays column numbers and/or displays text in a grid to quickly glance column numbers? I basically need a text editor which displays text in a grid, so that I can know the exact column numbers of the text. The numerical simulation software I am using, TOUGH+ (written in FORTRAN), has a strict format and I need to specify my input files in the exact format.
A letter misplaced here and there can make the whole file useless. So I need this to quickly glance at the input files, and know/verify which text starts and ends in which column. Otherwise, the file gets confusing sometimes.
For example in the image of the input file snippet, it's very difficult to separate at a glance where one value ends and other starts.

The most useful thing I have tried is the TextFX plugin with Notepad++, but it is very inelegant, as in it just places a text of characters to see the column numbers.

The best way to describe my requirement would be Spreadsheet but which takes only one character in a cell.

A: I notice you tagged the question with Excel. You could use text to columns, specify fixed width, then add a break line at every column break (bit tedious), then use the column ID as your identifier.
A cleaner solution would be to use a macro/VBA to do the split, something like
Selection.TextToColumns Destination:=Range("A2"), DataType:=xlFixedWidth, _
    FieldInfo:=Array( _
        Array(0, 1), _
        Array(1, 1), _
        Array(2, 1), _
        Array(3, 1), _
        Array(4, 1), _
        Array(5, 1)), _
        TrailingMinusNumbers:=True

Expanding out the number of array items to cover appropriate number of columns.

A: Posting as an answer, as it's too big for even multiple comments. Disclosure: I have not tried any of these, but some have been accepted as answers.

*

*Multiple margins in Atom Editor? on S.O says that it is possible, and the answer was accepted.

*IntelliJ IDE: How to add one or more margins on this site has an accepted answer saying that you can do it with Sublime text (which is not an IDE), plus a comment, with screenshots, showing how to do it with PyCharm, which is JetBrains' excellent and free (even for commercial use), Python IDE.

Personally, I would find it simple enough to write a Python script to:

*

*strip multiple spaces from each line

*split each line into multiple words

*insert spaces as appropriate

A: This can be easily solved by using VBA (Macro):
This code will Loop through all Worksheets in active workbook, find the value in SearchRange on each sheet, and store values in the worksheet named FindAddressWorksheet in row Sheetindex of column A.
Sub FindAddress()

Sheetindex = 1
For Each ws In Worksheets

  If ws.Name <> FindAddressWorksheet Then
    FindAddressWorksheet.Cells(Sheetindex, 1).Value = _
    ws.Range(Myrange).Value
    Sheetindex = Sheetindex + 1
  End If
Next
End Sub

How it works:

*

*Copy & Paste this Macro as Standard Modele.

*Input All Data to be searched, and Name it as Myrange (this name is editable).

*Name any blank Sheet as FindAddressWorksheet (Sheet name is editable) before you RUN the  Macro.

This Can be used if you are working on a Sheet only:
Sub FindRange()

    Dim rngX As Range
    Dim Data As String

    Data = InputBox("Write Value", "Obtain Cell Address")
    Set rngX = Worksheets("Sheet1").Range("A1:AFD65000").Find(Data, lookat:=xlPart)

    If Not rngX Is Nothing Then
        MsgBox "Found at " & rngX.Address
    End If

End Sub

N.B.

*

*Sheet Name & Data Range are editable.

A: If you are able to use Microsoft Access you can use a text-to-column method similar to Excel but with the advantage of saving your specification for re-use. This will import your fixed-width text file into an easily-readable data table. Repeating the import can be as simple as three or four clicks.
(I don't know if this is relevant to you, so I would put this as a comment, but I don't have the reputation for that.)

A: If you know the unix vi text editor, you can open your text file therein and make initial guesses as to which column a particular field or text item starts. For example, if an item looks like it may be at or near column number 45, you enter 45| (vertical bar) and the cursor will go right to that column. From there, you can then space or backspace while keeping count to determine the true column number. I happen to have a PC version of the vi editor which I use a lot on the command line. Hope this helps.


text:
Q: Using class and struct class Account:
        let id
        let type
        let balance

        # Account(nat?, account_type?, num?) -> Account?
        # Constructs an account with the given ID number, account type, and
        # balance. The balance cannot be negative.
        def __init__(self, id, type, balance):
            if balance < 0: error('Account: negative balance')
            if not account_type?(type): error('Account: unknown type')
            self.id = id
            self.type = type
            self.balance = balance

        struct customer:
            let name
            let bank_account

The above class and struct are given. My understanding is that we have to substitute the Account class in place of bank_account in struct. The purpose is to create a function that would add a new bank account information into the existing or empty array every time a function is called. I just tried it the following way and it didn't seem to work. Any suggestions or tips would be appreciated. The language I use was DSSL2. Thanks.
def open_account(name, type, customers):
           let newacc = customer(name, Account(id, type, balance))
           newacc.name = name
           newacc.Account.type = type
           newacc.Account.balance = 0
           if len.customers == 0: newacc.Account.id = 1
           else: newacc.Account.id = customers[len.customers-1].Account.id + 1
           customers = customers + newacc

A: You should not substitute Account for anything; you should set the field bank_account to an instance of Account.
That's what the struct creation does for you, so you don't need to think about it.
You need to determine the id first, and the field access syntax is object.field, not field.object or object.type.field.
Also, assigning to customers only changes the value of that variable, not the value of the object it represents (DSSL does not have call-by-reference).
You need to use one of the mutating methods, such as push_back.
And the struct-creation syntax is
struct_name { field1: value1, field2: value2, field3: value3 }

So (thoroughly untested), something like this:
def open_account(name, type, customers):
    if customers.empty?:
        id = 1
    else:
        id = customers[customers.len-1].id + 1
    let newcustomer = customer { name: name, bank_account: Account(id, type, 0) }
    customers.push_back(newcustomer)


text:
Q: Guessing how switches are wired together with minimal information Given a switch S1, I'd like to guess the target port of a switch S2 to which it is wired.
I can get their updated Mac Address Table (some say Address Forwarding Table) and that's all. I can't enable any CDP, LLDP or any other such protocol.
So with the MAT/AFT, I know that to reach a given set of mac address, I have to go through port P1 of switch S1. If S2 also holds all these mac addresses in its MAT/AFT, I can guess that they're most probably wired together.
I tried finding if any port of S2 holds a bunch of MACs that can be found on S1, but with this I sometime got several candidate ports… or even none (which seems a little stupid to me). For the moment I do not analyse VLANs separately.
I wonder if anyone knows any good algorithm to infer the target port of S2?

A: *

*Analyze Vlans separately.

Depending on the gear you're using and how it's configured, you make have a separate spanning tree topology for each given Vlan.  If you're dealing with a different effective topology from one MAC address to the next, things can be a little messy, and would certainly have the potential to give you multiple candidate ports.
In general, make sure that you're checking the spanning tree status on these switches, as that can be a major factor in this kind of mapping (which inherently makes blocked links invisible to you).

*

*Use known hosts for your checks.

Just because a host MAC address is known one switch, does not necessarily mean that it's known on each switch in the broadcast domain.  Switches keep their MAC tables up to date by watching traffic being sent by hosts on those ports; if all of the traffic from host A never has any need to traverse switch 2, switch 2 will forget about it.  Blast some broadcast traffic from a device behind switch 2, then check the address tables.


text:
Q: react native map is not updating custom style directly I have created a custom map style using react native maps but sometimes it shows a default map for 1-2 seconds then a new style will update. Is there any way we can check the map is loaded or not?
<MapView
        ref={mapRef}
        provider={PROVIDER_GOOGLE}
        customMapStyle={customMapStyle}
        showsCompass={false}
        showsScale={false}
        showsBuildings={false}
        showsTraffic={false}
        showsIndoors={false}
        showsUserLocation={false}
        zoomEnabled={true}
        pitchEnabled={true}
        zoomTapEnabled={true}
        {...props}
        style={[styles.map, mapStyle as any]}
    >
        {props.children}
</MapView>

A: I think you could try to use onMapReady event.
DOC
It will "Callback that is called once the map is fully loaded."


text:
Q: How do I get a response from Jenkins after triggering build remotely I am attempting to trigger a jenkins job from my company's machine and then return if it was a success or not. Currently I am able to trigger the job via the URL I create (masked for privacy), so I feel as though the URL is correct and the parameters are being passed correctly as well as they show up in the Console Output of the job and everything is ok there. However, I would like to know if the build was successful or not.
From most of the examples I see there is a response from jenkins with a status code indicating success (201). However, I never receive anything in my callback function. Any ideas?
function onButtonClick()
{
    var JenkinsURL = "http://mycompany:8080/view/project/job/jobname/buildWithParameters?token=TokenHere";

    var params = new Object();
    params.Data1 = "Data";
    params.Data2 = "";
    for (var i = 0; i < list.length; i++) {
        params.Data2 += list[i];
    }

    $.ajax(
    {
      url: JenkinsURL,
      method: 'POST',
      data: params,
      dataType: 'json',
      success: RebootCallback,
      fail: RebootCallback,
    }
    );
}

function RebootCallback(result)
{
    alert(result);
}

A: Triggering a build with the API like this just enqueues a build, waiting to be executed.  Therefore the API call returns immediately, without waiting for the build to start, or complete (it's possible that neither may happen).
But the response to your request will contain a Location HTTP header, pointing to the newly created queue item.  For example:
HTTP/1.1 201 Created
Location: http://localhost:8080/queue/item/16/

Checking the API URL of this resource (i.e. append either api/json or api/xml to the URL) will return information about the queued item.
If the build is still in the queue, you'll see the why reason (e.g. waiting for an available agent), but if the build has been started, you'll see an executable.url field pointing to the build.  For example, the API JSON for a build that started:
{
  …
  "url": "queue/item/16/",
  "executable": {
    "_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
    "number": 16,
    "url": "http://localhost:8080/job/test/4/"
  }
  …
}

If you fetch the API URL for that build #4, you would be able to check its result field to get the build outcome.


text:
Q: How to use proxy class generated by WSDL in web service? Disclaimer: My experience/knowledge of web services is very limited.
There is an existing web service WSDL that I have reverse engineered with wsdl.exe to create a C# proxy class.
Using Visual Studio 2008  I created a default web service template.
How do I reference the generated proxy class so that it will work in the web service?
For example -> calling http://localhost/webservice/service.asmx?WSDL will return the details from the proxy class.

A: First of all, you should not be using ASMX web services. Microsoft now considers them to be "legacy technology", and suggests that all new development of web service clients or services be done using WCF. Don't start off at a disadvantage.
Secondly, the normal way to make use of a WSDL is to use the "Add Web Reference" command in Visual Studio ("Add Service Reference" if you were using WCF). This generates the proxy classes for you and adds them to your project.
I'm not sure from your question that this is what you want, since you first talk about the WSDL, but then talk about a "default web service template". What do you mean to do with the "default web service template"?

Try using the svcutil.exe program (not WSDL.EXE) as follows:

svcutil YourWsdl.WSDL  /language:C# /d:subdirectory

This should produce a number of files in the subdirectory. Take a look at the .cs files, one of which will contain an interface which is the service contract. That is the interface that your service must implement. Look at your "default" WCF service application and you'll see that it does the same thing - produces an interface that is implemented by the service.


text:
Q: Auto fill google slide template from google spreadsheet data Am new to google app script.
Am trying to Auto fill a google slide template with some data from spread sheet.
I created a list in the spreadsheet containing the data.
function onOpen() {
  const ui = SpreadsheetApp.getUi();
  ui.createMenu('COS Auto Fill').addItem('COS Auto Fill',
    'Presentation_Call').addToUi();
}

function Presentation_Call() {
  var range = SpreadsheetApp.getActiveSheet().getRange('G1');
  var value = range.getValue();
}

function fillTemplate() {
  var presentation = SlidesApp.openById(Presentation_Call);
  var values = SpreadsheetApp.getActive().getDataRange().getValues();
  values.forEach(function (row) {
    var templateVariable = row[1];
    var templateValue = row[2];
    presentation.replaceAllText(templateVariable, templateValue);
  });
}

Spreadsheet Link
https://docs.google.com/spreadsheets/d/1J11tI2O5NUEr_2HpYYgCrseh9U_0KWF5YJeZ2uOV2gE/edit#gid=0

Google Slides Link
https://docs.google.com/presentation/d/10vGaLWo1ro1d3jzUrEVwOjozHHkxWCMzHEcikqwl_08/edit#slide=id.p1`

What I want to do is replacing the {{Number}} in the google slides template with the corresponding data from Gsheet.
By opening the presentation using the presentation ID that is being called from a fixed cell in Gsheet then update the template variable.
Thanks in advance.

A: There are a couple of issues with your project:

*

*The ID in G1 is enclosed in double quotes. Enter just the plain ID.

*In SlidesApp.openById(Presentation_Call), you pass in the function, rather than the return value of the function. Change it to SlidesApp.openById(Presentation_Call())

*The function Presentation_Call doesn't return anything. Add a return value; at the end.

*You add the function Presentation_Call to the menu. But I think you want to call fillTemplate instead. So, change that line to .addItem('COS Auto Fill', 'fillTemplate')
I made the changes here: https://docs.google.com/spreadsheets/d/1GzBgot6Q818rV488Bfx_Q8yknUCvjHUzyInfWob9XzU


text:
Q: Passing blank array to a function to and populate it from there I am trying to pass a blank array to a function that will manipulate the array dependent on certain scenarios. I don't know where I am going wrong with this but I am getting the following error Type mismatch. Below shows how I am creating the blank array:
 Dim testArray(0 to 10) as string
 Dim ABredu() As String
 ABredu = Equipment(testArray)

Below shows the function that I have written to populate the array
Function Equipment(Test() As String)
     If standYes = True And .ComboBox2.ListIndex = 0 Then
         ReDim ABredu(1 To 3)
         ABredu(1) = "Pen"
         ABredu(2) = "Ruler"
         ABredu(3) = "Monitor"
     Else
         ReDim ABredu(1 To 3)
         ABredu(1) = "17-P2"
         ABredu(2) = "17-L73"
         ABredu(3) = "16-ENR"
     End If
 End sub

If someone could help me or give a push in the right direction it would be greatly appreciated!

A: Pass the array by reference as a variant.
Function Equipment(ByRef Test As Variant)
     If standYes = True And .ComboBox2.ListIndex = 0 Then
         ReDim Test(1 To 3)
         Test(1) = "Pen"
         Test(2) = "Ruler"
         Test(3) = "Monitor"
     Else
         ReDim Test(1 To 3)
         Test(1) = "17-P2"
         Test(2) = "17-L73"
         Test(3) = "16-ENR"
     End If
 End sub

A: Slightly different approach using variant arrays.
Sub Some_Macro()
    Dim ABredu As Variant, i As Long
    ABredu = Equipment(True, 0)
    For i = LBound(ABredu) To UBound(ABredu)
        Debug.Print ABredu(i)
    Next i
    ABredu = Equipment(False, 0)
    For i = LBound(ABredu) To UBound(ABredu)
        Debug.Print ABredu(i)
    Next i
End Sub

Public Function Equipment(standYes As Boolean, cdLI As Long)
    Dim vEQUIP As Variant
     If standYes And cdLI = 0 Then
        vEQUIP = Array("Pen", "Ruler", "Monitor")
     Else
        vEQUIP = Array("17-P2", "17-L73", "16-ENR")
     End If
     Equipment = vEQUIP
 End Function

There are several ways to accomplish what you are looking for. Pick the one that makes the most sense to you.

A: Okay, so I'm going to make a couple of assumptions about your expected logic here, since the code in your question is a bit nonsensical.
You're trying (I think) to:

*

*Create an array of strings called ABredu

*Use a function or subroutine to populate that array based on some conditions

With that in mind, you can create the following sub
Sub PopulateEquipment(EquipArr() As String)
    ReDim EquipArr(1 To 3)
    If <condition> Then '<~~ Insert your own conditions here
        EquipArr(1) = "Value 1"
        EquipArr(2) = "Value 2"
        EquipArr(3) = "Value 3"
    Else
        EquipArr(1) = "AltVal 1"
        EquipArr(2) = "AltVal 2"
        EquipArr(3) = "AltVal 3"
    End If
End Sub

Then to populate your array using this, you need only Dim it and then call the subroutine, passing the variable as an argument.
Dim ABredu() As String
Call PopulateEquipment(ABredu)

A: Even simpler, use an ArrayList.
Public arList As Object

Sub PartOne()

Set arList = CreateObject("System.Collections.ArrayList")

Call Equipment

End Sub

Private Sub Equipment() '// No Need to pass argument as arList is of Public scope.

With arList

If standYes And Me.ComboBox2.ListIndex = 0 Then
     .Add "Pen"
     .Add "Ruler"
     .Add "Monitor"
Else
     .Add "17-P2"
     .Add "17-L73"
     .Add "16-ENR"
End If

End With

End Sub


text:
Q: Что означает $countj = count($arr[$i])? $arr = [
  ["рр","ыы","ыаы",20,"ыаы",2],
  ["ыпв","ып","вп",9,"впрр",4],
  [ "вр","вр","вр",30,"вр",5],
  ["врар","ароа","аоао",50,"ааоао",12]
];

for($i = 0, $counti = count($arr); $i < $counti; $i++)
{
  for($j = 0, $countj = count($arr[$i]); $j < $countj; $j++)
  {
  }
}

Хотелось бы понять что означает выражение $countj = count($arr[$i]), ибо впервые сталкиваюсь с подобным, да и в документации хотелось бы более понятного как для меня, новичка, изложения сути. Объясните в двух словах, чему равно и почему допустима такая запись, пожалуйста.

A: $countj - переменная
count() - функция возвращающая длину массива (кол-во элементов в массиве)
$arr[$i] - возвращает i-тый элемент массива
т.к. у вас массив массивов то count($arr) вернёт 4, первый цикл for будет работать пока $i будет меньше 4, а второй пока $j будет меньше 6 т.к. count($arr[$i]) вернёт 6 так как у вас 4 массива по 6 элементов каждый типа "рр" и т.д. Например $arr[0] это ["рр","ыы","ыаы",20,"ыаы",2] а
$arr[3]=["врар","ароа","аоао",50,"ааоао",12]


text:
Q: Complex fields and action in electrodynamics The interaction action in QED is
$$
S_{\text{int}} = \int j^\mu (x) \delta_+((x-y)^2) j_\mu(y) d^4 x d^4 y
$$
where $\delta_+(x) = \delta(x) - \frac{i}{\pi x}$ is the photon propagator.
This expression is given in many places, e.g. QED and the Men Who Made It page 423. It is what you'd expect to get from the path integral formulation of QED.
I have two issues with it however. Firstly, since the propagator is complex, the action will be complex, and I assumed this would not be allowed.
Second, one would expect a form schematically like $A^\mu j_\mu$ in the action and so I am tempted to say that
$$
A^\mu(x) = \int \delta_+((x-y)^2) j^\mu(y) d^4 y,
$$
which reduces to
$$
A^\mu(x) = \int j^\mu(y)\frac{1}{2R} \left( \delta_+(t-R) + \delta_+(t+R) \right) d^4 y,
$$
where I defined $t = x^0-y^0$, $R = |\mathbf{x}-\mathbf{y}|$.
If I ignore the $1/x$ part in the $\delta_+$, then I get the beautiful and I think correct result
$$
A_\mu(x) = \frac{1}{2} \left( A_{\mu}^{\text{advanced}} + A_{\mu}^{\text{retarded}} \right) ,
$$
where
$$
A_\mu^{\text{adv.}/\text{ret.}} = \int j_\mu(y)\frac{1}{2R}\delta(t\pm R) d^4 y.
$$
However, there are extra bits due to the $1/x$ part of $\delta_+$ and I would have a complex and acausal field
$$
A_\mu^{\text{adv.}/\text{ret.}} = \int j_\mu(y)\frac{1}{2R}\delta(t\pm R) d^4 y \mp \frac{i}{\pi} \int j_\mu(y)\frac{1}{2R (t \pm R)} d^4 y.
$$
I would like to perform a gauge transformation to eliminate that imaginary part but I know that can't work because it would also have to change the action. What's going on here?


text:
Q: Problems with SystemClock config for STM32L4R5 My initial project, generated on CubeMX was working on 32MHz. Since I am trying to implement an ADC with 80MHz I decided to increase the System Clock to 100MHz. The changes I made in the source are in the main.c:
void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
  RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};

  /** Configure the main internal regulator output voltage
  */
  if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)
  {
    Error_Handler();
  }
  /** Initializes the CPU, AHB and APB busses clocks
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLM = 12;
  RCC_OscInitStruct.PLL.PLLN = 50;
  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
  RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
  /** Initializes the CPU, AHB and APB busses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
  {
    Error_Handler();
  }

  PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_I2C1|RCC_PERIPHCLK_USB
                              |RCC_PERIPHCLK_ADC;
  PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1;
  PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_PLLSAI1;
  PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
  PeriphClkInit.PLLSAI1.PLLSAI1Source = RCC_PLLSOURCE_HSE;
  PeriphClkInit.PLLSAI1.PLLSAI1M = 6;
  PeriphClkInit.PLLSAI1.PLLSAI1N = 20;
  PeriphClkInit.PLLSAI1.PLLSAI1P = RCC_PLLP_DIV2;
  PeriphClkInit.PLLSAI1.PLLSAI1Q = RCC_PLLQ_DIV2;
  PeriphClkInit.PLLSAI1.PLLSAI1R = RCC_PLLR_DIV2;
  PeriphClkInit.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_ADC1CLK;
  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
  {
    Error_Handler();
  }

}

I just changed PLLM and PLLN to adjust to 100MHz. Now when I debug the program in the SysTick register I see that:
SYST_CSR = 7
SYST_RVR = 99999
So I think the ticks are correctly showing 100MHz.
I am not sure how correct is that, but let's say for a simple line to execute:
i_flag=1;

it takes 7 cycles according to the SYST_CVR->CURRENT.
Considering some timing issues with the ADC, I suppose I did not set correctly the System clock and it is still 32MHz. Any ideas if my code and checks are correct?


text:
Q: nested foreach loop stop repeat Look at the code below. I have a foreach loop inside another one, but when I run the page rows repeats. Is there any way to stop repeat of rows.
Here's the code and the result:
![

        @foreach(var row in select)
        {
            foreach(var rows in selects)
            {

                    @rows.Specifications
                    @row.LaptopOptions

            }
        }

A: The inner loop is repeated for each iteration of the outer loop. However, you cannot iterate synchronously over two lists, because foreach only cares about one, and inside that loop, you dont really know where in the list you are (so you cannot sync with the second list).
Possible solutions:
1) if the select[s] can be accessed with index, use one for loop to iterate over both (provided they are sorted the same way):
for(int idx=0;idx<select.Count;idx++)
{
  ...
  @select[idx].Specifications
  ...
  @selects[idx].LaptopOptions
  ...
}

2) try to reduce to one select with several values (in the code before the posted code), then you only need one foreach loop:
foreach (var row in select)
{
  ...
  @row.Specifications
  ...
  @row.LaptopOptions
  ...
}

A: I'm not entirely sure what you're trying to achieve with the final layout, but from your image, I think you're looking for something along the lines of showing a header for the Specification and then all of the Laptop Options. If this is the case, then you'll need something like:
@foreach(var row in select){

        @row.LaptopOptions

    foreach(var rows in selects){

            @rows.Specifications

    }
}

A: The inner loop must be your outer loop because a laptop option can have multiple spec
          foreach(var rows in selects){
foreach(var row in select){


text:
Q: Bash completion dynamic behavior I would like to have 2 different behavior of "tab" depending of the usage context.
I would like to have the default behavior of bind '"\t":complete' any time except when users are trying to complete arguments of the "mybashfunction" command. In this case I call a special function to generate the completion, but I would like "tab" to work like if bind '"\t":menu-complete' was set.

A: I believe that its readline library will only support one kind of tab-completion behaviour at a time.

A: Is this what you're looking for? Bash: menu-complete only for few matches

A: You can achieve this by using bash complete rules ...
_myfunc() {
    _opts="zero one two"
    # COMPREPLY is bash built-in for array of possible completions
    COMPREPLY=()
    # cur & prev are current & previous words typed in shell
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    COMPREPLY=( $( compgen -W "${_opts}" -- ${cur} ))
    return 0
}
complete -F _myfunc myfunc

This won't touch bash's normal completion but when you tab complete myfunc you'll have "zero one two" as possible completions.
Edit: oh yeah, jam this into your bashrc or similar so it's sourced in new shells.


text:
Q: How to determine a subset selecting a percentage of population? I would need to compute the percentage of a population. Specifically, I would need the 10% of the initial population in order to determine a new subset.
I tried using
proc sql;
select time,
      count(*)*0.1
from table1
group by 1;
quit;

and it works, as I have the percentage of population that I wanted. However, I have difficulties in finding a way that can allow me to include another condition (where var1>0 and var2=24) where variables are from the original dataset (i.e. var1 and var2 are from table1).
Do you know how I could do that?

A: Suppose you have 1,000 items (row) from which you want a 10% random sample.
Proc SURVEYSELECT is probably the best way to select samples.
data have;
  do id = 1 to 1000; output; end;
run;

proc surveyselect noprint data=have method=srs rate=10 out=want;
run;

A SQL selection based on a random number can provide a crude analog but does not produce a precise 10% sampling rate.
proc sql;
  create table want as
  select id from have
  where rand('uniform') <= 0.10  %* roughly 10% of a uniform distribution;
;

There are other ways, such as DATA step with a k/n algorithm.
data want;
  call streaminit(123);

  do k=0.10*N by 0 while (k > 0);
    set have nobs=n;

    if rand('UNIFORM') <= k/n then do;
      k + (-1);
      output;
    end;
    n +(-1);
  end;

  stop;
run;


text:
Q: Smoothing a density field in Python I want to smooth a density field. It's represented as a contour plot. The data were given from a 3d array. A smoothed field should be periodic but what I take does not have periodicity. The code I use is the following:
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from scipy.ndimage.filters import gaussian_filter
central_plane = planes[:,:,64]
sigma = 5
data = gaussian_filter(central_plane, sigma)
plt.xlim([0, 100])
plt.ylim([0, 100])
plt.contourf(data)
plt.show()
plt.xlabel("Box Size (Mpc/h)")
plt.ylabel("Box Size (Mpc/h)")
plt.colorbar(label="Density Contrast", orientation="vertical")

The values plotted are density values. The axes labels show the size of my simulation box. The "central_plane" is the slice of the 3d array I want to plot. The sigma I use for the smoothing corresponds to Mpc/h.
The second image shows my result, but it is not correct because it does not have periodicity, there are issues in the box boundaries. Any help would be very essential. Thank you very much!


text:
Q: Changing Array causing glitches with splice I have a form event which takes entered values and constructs an array out of them using the following:
    keywordArray = []
    var getVal = $('#search').val();
    if(getVal.length > 1){
        keywordArray.push(getVal);
        $('.test').on('click', function(){
            removeTag(this, getVal);
        });
        $('#search').val("");
    }

My remove function then looks as follows:
    function removeTag(el, getVal){
        var index = keywordArray.indexOf(getVal);
        keywordArray.splice(index, 1);
    }

There is no problem when removing a value for the first time as the index is in sync, but once a value is removed the index changes and it seems that JS isn't staying in sync with the updated index, so when I remove another value it glitches with a -1 on splice and will remove all values.

A: The main problem is pointed out by @vijayP in the comments. Here is a first possible solution.
When adding a tag, use the data attribute to associate the tag with the remove button (el):
function addTag(el, value) {
    $(el).data('value', value).on('click', removeTag);
}

I assume you have a separate remove button for each tag. Then, the click handler function can look like this (with the check for a correct index):
function removeTag(){
    var index = keywordArray.indexOf($(this).data('value'));
    if (index > -1) keywordArray.splice(index, 1);
}

A: I see two problems: Your removeTag function and the way it is called.
First of all, removeTag() does not need the element, so remove the el parameter if it is really not needed. Second, it should do nothing when the given string does not occur in the array:
function removeTag(val){
    var index = keywordArray.indexOf(val);
    if (index >= 0) keywordArray.splice(index, 1);
}

The second problem might be related to this part of your code:
$('.test').on('click', function(){
    removeTag(this, getVal);
});

I suspect that you don't want to register a click handler for all '.test' elements because you refer to this in the next line but this is not used in the removeTag function (see above). In case there are several '.test' elements, you should make sure that removeTag() is only called with the value that corresponds to the clicked '.test' element. Currently you call removeTag() several times for each click -- once for each '.test' element.


text:
Q: Reader Writer java with a limited number of readers I am a Master Student and I have to write code for the classic reader writer problem with a limited number of readers at a time.
I have to write in Java using multithreading.
But without semaphore.
Only using monitors and the keyword synchronized.
I have already get some code that working. But I have to change it to limit to 3 readers at a time.
And I dont know how...
My code is below
There is no priority to readers or writer but I don't want any staravation too.
But at first step I just want to play with sleeping to let my writer access the journal.
Thanks
(I have to do this in the next hours)
class Journal {
public static final int PAUSE = 5;
private int nbReaders ;
private boolean Reading,Writing ;
public Journal () {nbReaders = 0 ;Reading = false ;Writing = false ;}

public synchronized int demandeReading () {
    while (Writing == true)
           try{ wait(); } catch(InterruptedException e) {}

    if (++nbReaders == 1)
        Reading = true ;
    return nbReaders ;
}
public synchronized int finReading () {
    if (--nbReaders == 0)
        Reading = false ;
    notifyAll();
    return nbReaders ;
}
public synchronized void demandeWriting () {
    while ( Reading == true || Writing == true )
        try{ wait () ; }catch(InterruptedException e) {}
    Writing = true ;
}
public synchronized void finWriting() { Writing = false ; notifyAll () ; }

public static void travaille(){
    int tpsPause = (int) ( PAUSE * Math.random () ) ;
    try {  Thread.sleep ( tpsPause * 100 ) ; }  catch(InterruptedException e) {}
}
}
class Reader extends Thread {
private int nbReadings = 5;
private Journal journal ;
public Reader ( Journal j ) {        journal = j ;    }
public void run () {
    int nbReaders ;
    while ( nbReadings > 0 ) {
        nbReaders = journal.demandeReading () ;
        System.out.println( Thread.currentThread().getName() +  " lit ... " +nbReaders + " Reading en cours" ) ;
        Journal.travaille () ;
        nbReaders = journal.finReading () ;
        nbReadings -- ;
        System.out.println( Thread.currentThread().getName() + " ne lit plus ..." +nbReaders + " Readings en cours" ) ;
    }
}
}
class Writer extends Thread {
private int nbWritings = 2;
private Journal journal;
public Writer(Journal j) {journal = j;}

public void run() {
    while (nbWritings > 0) {
        journal.demandeWriting();
        System.out.println(Thread.currentThread().getName() + " ecrit ...");
        Journal.travaille();
        journal.finWriting();
        nbWritings--;
    }
}
}
class ReadersWriterCours {
static Journal journal = new Journal ( ) ;
public static void main ( String [] args ) {
    Writer tabW [] = new Writer [ 5 ] ;
    Reader tabR [] = new Reader [ 5 ] ;
    for (int i = 0 ; i < 5 ; i ++ ) {
        tabW[ i ] = new Writer ( journal ) ;
        tabR[ i ] = new Reader ( journal ) ;
        tabW [ i ].start () ;
        tabR [ i ].start () ;
    }
}
}


text:
Q: Widget Not showing up after phone restart I created a widget that works great until I restart the phone, then the widget doesn't display it is invisible but if i hold and click i can throw it in the garbage
I have a function that is called from my configure activity in my widgetprovider that does the following:
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
            int appWidgetId, int version)
 {
        if(savedType == -1)
            savedType = version;
//   android.os.Debug.waitForDebugger();
    RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.main);

    Intent configIntent = new Intent(context, Configure.class);
    configIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);

    Uri data = Uri.withAppendedPath(
            Uri.parse(appWidgetId + "://widget/id/")
            ,String.valueOf(appWidgetId));
    configIntent.setData(data);

    PendingIntent pendingIntent = PendingIntent.getActivity
    (context, 0, configIntent,
    PendingIntent.FLAG_UPDATE_CURRENT);

    views.setOnClickPendingIntent(R.id.MainImage,pendingIntent);

    views.setImageViewResource(R.id.MainImage, lv_images[version]);

    appWidgetManager.updateAppWidget(appWidgetId, views);
}

I had my onUpdate not doing anything because there is never anything to update but thinking this would be called after a phone restart i copied the code i had in the function
for(int i = 0; i < appWidgetIds.length; ++i)
{
     updateAppWidget(context, appWidgetManager, appWidgetIds[i], savedType);
}

but this didn't seem to do much either.... suggestions?

A: When phone restart, it will call onEnable instead of onUpdate.
--update--
int[] allids = AppWidgetManager
    .getInstance(Context)
    .getAppWidgetIds(new ComponentName(Context, YourAppWidgetProvider.class);

This will get all ids that is under the control of YourAppWigetProvider. Read more on this