text:
Q: How to instruct Ninject hide a Type from its implicit binding list Does Ninject have an attribute which I could use to decorate class or constructor to let Ninject to ignore it?
I need to get rid of:

A cyclical dependency was detected between the constructors of two
  services.

This is my code:
// Abstraction
public interface ICommandHandler<TCommand>
{
    void Handle(TCommand command);
}

// Implementation
public class ShipOrderCommandHandler
    : ICommandHandler<ShipOrderCommand>
{
    private readonly IRepository<Order> repository;

    public ShipOrderCommandHandler(
        IRepository<Order> repository)
    {
        this.repository = repository;
    }

    public void Handle(ShipOrderCommand command)
    {
        // do some useful stuf with the command and repository.
    }
}

My generic decorator:
public TransactionalCommandHandlerDecorator<TCommand>
    : ICommandHandler<TCommand>
{
    private ICommandHandler<TCommand> decoratedHandler;

    public TransactionalCommandHandlerDecorator(
        ICommandHandler<TCommand> decoratedHandler)
    {
        this.decoratedHandler = decoratedHandler;
    }

    public void Handle(TCommand command)
    {
        using (var scope = new TransactionScope())
        {
            this.decoratedHandler.Handle(command);
            scope.Complete();
        }
    }
}

My container registration:
kernel.Bind(typeof(ICommandHandler<>))
    .To(typeof(TransactionCommandHandlerDecorator<>));

A: Here's a working example based on your code.
public class AutoDecorationFacts
{
    readonly StandardKernel _kernel = new StandardKernel();

    public AutoDecorationFacts()
    {
        _kernel.Bind( typeof( ICommandHandler<> ) )
            .To( typeof( TransactionalCommandHandlerDecorator<> ) )
            .Named( "decorated" );
    }

    [Fact]
    public void RawBind()
    {
        _kernel.Bind( typeof( ICommandHandler<> ) ).To<ShipOrderCommandHandler>().WhenAnyAnchestorNamed( "decorated" );
        VerifyBoundRight();
    }

    void VerifyBoundRight()
    {
        var cmd = _kernel.Get<ICommandHandler<ShipOrderCommand>>();
        Assert.IsType<TransactionalCommandHandlerDecorator<ShipOrderCommand>>( cmd );
    }

Best used with Ninject.Extensions.Conventions:-
    [Fact]
    public void NameSpaceBasedConvention()
    {
        _kernel.Bind( scan => scan
            .FromThisAssembly()
            .SelectAllClasses()
            .InNamespaceOf<CommandHandlers.ShipOrderCommandHandler>()
            .BindAllInterfaces()
            .Configure( x => x.WhenAnyAnchestorNamed( "decorated" ) ) );
        VerifyBoundRight();
    }

    [Fact]
    public void UnconstrainedWorksTooButDontDoThat()
    {
        _kernel.Bind( scan => scan
            .FromThisAssembly()
            .SelectAllClasses()
            .BindAllInterfaces(  )
            .Configure( x=>x.WhenAnyAnchestorNamed("decorated" )));
        VerifyBoundRight();
    }
}

Your classes:
public class ShipOrderCommand
    {
    }
// Abstraction
public interface ICommandHandler<TCommand>
{
    void Handle( TCommand command );
}

// Implementation
namespace CommandHandlers
{
    public class ShipOrderCommandHandler
        : ICommandHandler<ShipOrderCommand>
    {
        public ShipOrderCommandHandler(
            )
        {
        }

        public void Handle( ShipOrderCommand command )
        {
            // do some useful stuf with the command and repository.
        }
    }
}
public class TransactionalCommandHandlerDecorator<TCommand>
    : ICommandHandler<TCommand>
{
    private ICommandHandler<TCommand> decoratedHandler;

    public TransactionalCommandHandlerDecorator(
        ICommandHandler<TCommand> decoratedHandler )
    {
        this.decoratedHandler = decoratedHandler;
    }

    public void Handle( TCommand command )
    {
        this.decoratedHandler.Handle( command );
    }
}

(used NuGet-latest versions of Ninject and Ninject.Extensions.Conventions)

A: You should be able to use Contextual Binding to Bind the raw interfaces with a constraint to make them only be considered in the right context (i.e., when they're going into a decorator).
I have a very similar such When extension one I can paste here tomorrow if you're still looking then.
EDIT: The code I had in mind (turns out it doesnt do want you want directly)
public static class NinjectWhenExtensions
{
    public static void WhenRootRequestIsFor<T>( this IBindingSyntax that )
    {
        that.BindingConfiguration.Condition = request => request.RootRequestIsFor<T>();
    }
}

public static class NinjectRequestExtensions
{
    public static bool RootRequestIsFor<T>( this IRequest request )
    {
#if false
        // Need to use ContextPreservingGet in factories and nested requests for this to work.
        // http://www.planetgeek.ch/2010/12/08/ninject-extension-contextpreservation-explained/
        return RootRequest( request ).Service == typeof( T );
#else
        // Hack - check the template arg is the interface wer'e looking for rather than doing what the name of the method would actually suggest
        IRequest rootRequest = RootRequest( request );
        return rootRequest.Service.IsGenericType && rootRequest.Service.GetGenericArguments().Single() == typeof( T );
#endif
    }

    static IRequest RootRequest( IRequest request )
    {
        if ( request.ParentRequest == null )
            return request;

        return RootRequest( request.ParentRequest );
    }
}

Used to attach decorators:-
root.Bind<IEndpointSettings>().To<IAnonymousEndpointSettings>().WhenRootRequestIsFor<IAnonymousService>();
root.Bind<IEndpointSettings>().To<IAuthenticatedSettings>().WhenRootRequestIsFor<IServiceA>();

EDIT 2: You should be able to use create a When derivative which takes the general binding for IX out of the picture except when it's being Resolved to be fed into a Decorator. Then the Bind for your Decorator can either use Context Preservation (@Remo has an article on it) to ensure that gets into the context so your predicate can decide or you may be able to add metadata to the Request and have the When rely on that.
So, I'd:
1. read about Context Preservation
2. examine/dump the contents of the context on the request that comes into your When condition and determine how you can appropriately filter.
(And hope someone will come along with a canned one liner answer!)
The Context Preservation extension may have a part to play.


text:
Q: CS1998: This async method lacks 'await' We got many cs1998 code compiler bugs in our project, if I add await Task.Delay(0) in the async method will that resolve the bugs?

A:
if I add await Task.Delay(0) in the async method will that resolve the bugs?

Maybe. CS1998 is a warning, which means the code is probably wrong. In this case, the methods will run synchronously. If that's the desired behavior, then there's no bug, and I recommend avoiding it via #pragma (not await Task.Delay(0);). If you want the code to be asynchronous, then the code has a bug: it's not asynchronous.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Install devtools package in ubuntu VM I try to install devtools package in an Ubuntu 16.04 VM
in which I am wrong.
Other packages I tried the installed successsfully
However I can't install it and the process in the console is this:
> install.packages("devtools")
Installing package into '/home/stefan/R/x86_64-pc-linux-gnu-library/3.2'
(as 'lib' is unspecified)
also installing the dependencies 'curl', 'openssl', 'httr', 'git2r'

--2018-01-26 22:14:08--  https://cran.rstudio.com/src/contrib/curl_3.1.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 366086 (358K) [application/x-gzip]
Saving to: '/tmp/RtmpIF4wAz/downloaded_packages/curl_3.1.tar.gz'

     0K .......... .......... .......... .......... .......... 13% 1017K 0s
    50K .......... .......... .......... .......... .......... 27% 1,62M 0s
   100K .......... .......... .......... .......... .......... 41% 1,32M 0s
   150K .......... .......... .......... .......... .......... 55% 4,09M 0s
   200K .......... .......... .......... .......... .......... 69% 4,59M 0s
   250K .......... .......... .......... .......... .......... 83% 12,0M 0s
   300K .......... .......... .......... .......... .......... 97% 2,84M 0s
   350K .......                                               100% 19,6M=0,2s

2018-01-26 22:14:09 (2,18 MB/s) - '/tmp/RtmpIF4wAz/downloaded_packages/curl_3.1.tar.gz' saved [366086/366086]

--2018-01-26 22:14:09--  https://cran.rstudio.com/src/contrib/openssl_0.9.9.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1112927 (1,1M) [application/x-gzip]
Saving to: '/tmp/RtmpIF4wAz/downloaded_packages/openssl_0.9.9.tar.gz'

     0K .......... .......... .......... .......... ..........  4% 1,02M 1s
    50K .......... .......... .......... .......... ..........  9%  194K 3s
   100K .......... .......... .......... .......... .......... 13%  215K 3s
   150K .......... .......... .......... .......... .......... 18%  227K 3s
   200K .......... .......... .......... .......... .......... 23% 10,2M 3s
   250K .......... .......... .......... .......... .......... 27%  253K 3s
   300K .......... .......... .......... .......... .......... 32%  271K 2s
   350K .......... .......... .......... .......... .......... 36%  289K 2s
   400K .......... .......... .......... .......... .......... 41%  317K 2s
   450K .......... .......... .......... .......... .......... 46% 3,97M 2s
   500K .......... .......... .......... .......... .......... 50%  338K 2s
   550K .......... .......... .......... .......... .......... 55%  346K 1s
   600K .......... .......... .......... .......... .......... 59%  372K 1s
   650K .......... .......... .......... .......... .......... 64% 5,58M 1s
   700K .......... .......... .......... .......... .......... 69%  317K 1s
   750K .......... .......... .......... .......... .......... 73%  315K 1s
   800K .......... .......... .......... .......... .......... 78%  344K 1s
   850K .......... .......... .......... .......... .......... 82%  344K 1s
   900K .......... .......... .......... .......... .......... 87% 6,08M 0s
   950K .......... .......... .......... .......... .......... 92%  404K 0s
  1000K .......... .......... .......... .......... .......... 96%  567K 0s
  1050K .......... .......... .......... ......               100% 7,47M=2,8s

2018-01-26 22:14:13 (394 KB/s) - '/tmp/RtmpIF4wAz/downloaded_packages/openssl_0.9.9.tar.gz' saved [1112927/1112927]

--2018-01-26 22:14:13--  https://cran.rstudio.com/src/contrib/httr_1.3.1.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 147593 (144K) [application/x-gzip]
Saving to: '/tmp/RtmpIF4wAz/downloaded_packages/httr_1.3.1.tar.gz'

     0K .......... .......... .......... .......... .......... 34%  934K 0s
    50K .......... .......... .......... .......... .......... 69%  100K 0s
   100K .......... .......... .......... .......... ....      100%  342K=0,7s

2018-01-26 22:14:15 (212 KB/s) - '/tmp/RtmpIF4wAz/downloaded_packages/httr_1.3.1.tar.gz' saved [147593/147593]

--2018-01-26 22:14:15--  https://cran.rstudio.com/src/contrib/git2r_0.21.0.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1155512 (1,1M) [application/x-gzip]
Saving to: '/tmp/RtmpIF4wAz/downloaded_packages/git2r_0.21.0.tar.gz'

     0K .......... .......... .......... .......... ..........  4% 1,06M 1s
    50K .......... .......... .......... .......... ..........  8% 1,52M 1s
   100K .......... .......... .......... .......... .......... 13% 1,28M 1s
   150K .......... .......... .......... .......... .......... 17% 1,54M 1s
   200K .......... .......... .......... .......... .......... 22% 6,96M 1s
   250K .......... .......... .......... .......... .......... 26% 1,10M 1s
   300K .......... .......... .......... .......... .......... 31% 1,21M 1s
   350K .......... .......... .......... .......... .......... 35%  940K 1s
   400K .......... .......... .......... .......... .......... 39% 1,72M 0s
   450K .......... .......... .......... .......... .......... 44% 5,84M 0s
   500K .......... .......... .......... .......... .......... 48% 1,38M 0s
   550K .......... .......... .......... .......... .......... 53% 2,17M 0s
   600K .......... .......... .......... .......... .......... 57% 2,20M 0s
   650K .......... .......... .......... .......... .......... 62% 5,09M 0s
   700K .......... .......... .......... .......... .......... 66% 2,36M 0s
   750K .......... .......... .......... .......... .......... 70% 3,40M 0s
   800K .......... .......... .......... .......... .......... 75% 1,73M 0s
   850K .......... .......... .......... .......... .......... 79% 2,03M 0s
   900K .......... .......... .......... .......... .......... 84% 42,4M 0s
   950K .......... .......... .......... .......... .......... 88% 2,49M 0s
  1000K .......... .......... .......... .......... .......... 93% 1,68M 0s
  1050K .......... .......... .......... .......... .......... 97% 3,40M 0s
  1100K .......... .......... ........                        100% 83,9M=0,6s

2018-01-26 22:14:16 (1,93 MB/s) - '/tmp/RtmpIF4wAz/downloaded_packages/git2r_0.21.0.tar.gz' saved [1155512/1155512]

--2018-01-26 22:14:16--  https://cran.rstudio.com/src/contrib/devtools_1.13.4.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 486348 (475K) [application/x-gzip]
Saving to: '/tmp/RtmpIF4wAz/downloaded_packages/devtools_1.13.4.tar.gz'

     0K .......... .......... .......... .......... .......... 10% 1,10M 0s
    50K .......... .......... .......... .......... .......... 21% 1,40M 0s
   100K .......... .......... .......... .......... .......... 31% 1,54M 0s
   150K .......... .......... .......... .......... .......... 42% 1,72M 0s
   200K .......... .......... .......... .......... .......... 52% 2,99M 0s
   250K .......... .......... .......... .......... .......... 63% 1,54M 0s
   300K .......... .......... .......... .......... .......... 73%  867K 0s
   350K .......... .......... .......... .......... .......... 84% 2,16M 0s
   400K .......... .......... .......... .......... .......... 94% 3,66M 0s
   450K .......... .......... ....                            100% 8,73M=0,3s

2018-01-26 22:14:17 (1,63 MB/s) - '/tmp/RtmpIF4wAz/downloaded_packages/devtools_1.13.4.tar.gz' saved [486348/486348]

* installing *source* package 'curl' ...
** package 'curl' successfully unpacked and MD5 sums checked
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
 * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
 * rpm: libcurl-devel (Fedora, CentOS, RHEL)
 * csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package 'curl'
* removing '/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/curl'
Warning in install.packages :
  installation of package 'curl' had non-zero exit status
* installing *source* package 'openssl' ...
** package 'openssl' successfully unpacked and MD5 sums checked
Using PKG_CFLAGS=
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing:
 * deb: libssl-dev (Debian, Ubuntu, etc)
 * rpm: openssl-devel (Fedora, CentOS, RHEL)
 * csw: libssl_dev (Solaris)
 * brew: openssl@1.1 (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package 'openssl'
* removing '/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/openssl'
Warning in install.packages :
  installation of package 'openssl' had non-zero exit status
* installing *source* package 'git2r' ...
** package 'git2r' successfully unpacked and MD5 sums checked
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking size of void*... 8
checking for library containing inflate... -lz
checking for library containing EVP_EncryptInit... no
checking for openssl... no
configure: error: in `/tmp/RtmpQ9e11v/R.INSTALL82977388520/git2r':
configure: error:
  ---------------------------------------------
   The OpenSSL library that is required to
   build git2r was not found.

   Please install:
     libssl-dev    (package on e.g. Debian and Ubuntu)
     openssl-devel (package on e.g. Fedora, CentOS and RHEL)
     openssl       (Homebrew package on OS X)
   and try again.

   If the OpenSSL library is installed on
   your system but the git2r configuration
   is unable to find it, you can specify
   the include and lib path to OpenSSL with:
   R CMD INSTALL --configure-args='--with-libssl-include=INCLUDE_PATH --with-libssl-lib=LIB_PATH' git2r
  ---------------------------------------------
See `config.log' for more details
ERROR: configuration failed for package 'git2r'
* removing '/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/git2r'
Warning in install.packages :
  installation of package 'git2r' had non-zero exit status
ERROR: dependencies 'curl', 'openssl' are not available for package 'httr'
* removing '/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/httr'
Warning in install.packages :
  installation of package 'httr' had non-zero exit status
ERROR: dependencies 'httr', 'git2r' are not available for package 'devtools'
* removing '/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/devtools'
Warning in install.packages :
  installation of package 'devtools' had non-zero exit status

The downloaded source packages are in
    '/tmp/RtmpIF4wAz/downloaded_packages'

Any idea how could I install it? The problem is the same if I use instead of Rstudio I use the terminal for R
Also installing car package from github, as I can't find it in the list of Tools->Install Packages has problem:
> library(devtools)
> install_github("cran/car")
Downloading GitHub repo cran/car@master
from URL https://api.github.com/repos/cran/car/zipball/master
Installing car
--2018-01-26 22:39:07--  https://cran.rstudio.com/src/contrib/pbkrtest_0.4-7.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 156406 (153K) [application/x-gzip]
Saving to: '/tmp/RtmpIF4wAz/pbkrtest_0.4-7.tar.gz'

     0K .......... .......... .......... .......... .......... 32% 1,16M 0s
    50K .......... .......... .......... .......... .......... 65% 1,45M 0s
   100K .......... .......... .......... .......... .......... 98% 3,79M 0s
   150K ..                                                    100% 8,52M=0,09s

2018-01-26 22:39:07 (1,68 MB/s) - '/tmp/RtmpIF4wAz/pbkrtest_0.4-7.tar.gz' saved [156406/156406]

Installing pbkrtest
--2018-01-26 22:39:11--  https://cran.rstudio.com/src/contrib/lme4_1.1-15.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3610706 (3,4M) [application/x-gzip]
Saving to: '/tmp/RtmpIF4wAz/lme4_1.1-15.tar.gz'

     0K .......... .......... .......... .......... ..........  1% 1,05M 3s
    50K .......... .......... .......... .......... ..........  2% 1,52M 3s
   100K .......... .......... .......... .......... ..........  4% 3,40M 2s
   150K .......... .......... .......... .......... ..........  5% 1,36M 2s
   200K .......... .......... .......... .......... ..........  7% 3,97M 2s
   250K .......... .......... .......... .......... ..........  8% 15,4M 2s
   300K .......... .......... .......... .......... ..........  9% 2,23M 2s
   350K .......... .......... .......... .......... .......... 11% 65,5M 1s
   400K .......... .......... .......... .......... .......... 12% 3,85M 1s
   450K .......... .......... .......... .......... .......... 14% 60,4M 1s
   500K .......... .......... .......... .......... .......... 15% 79,4M 1s
   550K .......... .......... .......... .......... .......... 17% 6,83M 1s
   600K .......... .......... .......... .......... .......... 18% 2,60M 1s
   650K .......... .......... .......... .......... .......... 19% 4,68M 1s
   700K .......... .......... .......... .......... .......... 21% 83,6M 1s
   750K .......... .......... .......... .......... .......... 22% 91,2M 1s
   800K .......... .......... .......... .......... .......... 24% 96,8M 1s
   850K .......... .......... .......... .......... .......... 25% 4,27M 1s
   900K .......... .......... .......... .......... .......... 26% 91,6M 1s
   950K .......... .......... .......... .......... .......... 28% 1,39M 1s
  1000K .......... .......... .......... .......... .......... 29% 3,98M 1s
  1050K .......... .......... .......... .......... .......... 31% 27,1M 1s
  1100K .......... .......... .......... .......... .......... 32% 91,8M 1s
  1150K .......... .......... .......... .......... .......... 34% 86,4M 1s
  1200K .......... .......... .......... .......... .......... 35% 3,19M 1s
  1250K .......... .......... .......... .......... .......... 36% 5,66M 1s
  1300K .......... .......... .......... .......... .......... 38% 43,6M 0s
  1350K .......... .......... .......... .......... .......... 39% 86,1M 0s
  1400K .......... .......... .......... .......... .......... 41% 5,28M 0s
  1450K .......... .......... .......... .......... .......... 42% 16,6M 0s
  1500K .......... .......... .......... .......... .......... 43% 9,84M 0s
  1550K .......... .......... .......... .......... .......... 45% 3,84M 0s
  1600K .......... .......... .......... .......... .......... 46% 4,36M 0s
  1650K .......... .......... .......... .......... .......... 48% 19,5M 0s
  1700K .......... .......... .......... .......... .......... 49% 4,09M 0s
  1750K .......... .......... .......... .......... .......... 51% 84,7M 0s
  1800K .......... .......... .......... .......... .......... 52% 1,32M 0s
  1850K .......... .......... .......... .......... .......... 53%  104M 0s
  1900K .......... .......... .......... .......... .......... 55% 14,4M 0s
  1950K .......... .......... .......... .......... .......... 56% 23,1M 0s
  2000K .......... .......... .......... .......... .......... 58% 3,18M 0s
  2050K .......... .......... .......... .......... .......... 59% 2,28M 0s
  2100K .......... .......... .......... .......... .......... 60%  103M 0s
  2150K .......... .......... .......... .......... .......... 62% 2,08M 0s
  2200K .......... .......... .......... .......... .......... 63% 13,6M 0s
  2250K .......... .......... .......... .......... .......... 65% 3,23M 0s
  2300K .......... .......... .......... .......... .......... 66% 4,50M 0s
  2350K .......... .......... .......... .......... .......... 68% 13,9M 0s
  2400K .......... .......... .......... .......... .......... 69% 98,1M 0s
  2450K .......... .......... .......... .......... .......... 70% 42,6M 0s
  2500K .......... .......... .......... .......... .......... 72% 4,12M 0s
  2550K .......... .......... .......... .......... .......... 73% 17,2M 0s
  2600K .......... .......... .......... .......... .......... 75% 73,7M 0s
  2650K .......... .......... .......... .......... .......... 76% 94,0M 0s
  2700K .......... .......... .......... .......... .......... 77%  102M 0s
  2750K .......... .......... .......... .......... .......... 79% 80,8M 0s
  2800K .......... .......... .......... .......... .......... 80%  101M 0s
  2850K .......... .......... .......... .......... .......... 82% 3,39M 0s
  2900K .......... .......... .......... .......... .......... 83% 89,8M 0s
  2950K .......... .......... .......... .......... .......... 85% 88,7M 0s
  3000K .......... .......... .......... .......... .......... 86% 82,8M 0s
  3050K .......... .......... .......... .......... .......... 87% 7,12M 0s
  3100K .......... .......... .......... .......... .......... 89% 80,9M 0s
  3150K .......... .......... .......... .......... .......... 90% 79,9M 0s
  3200K .......... .......... .......... .......... .......... 92% 7,38M 0s
  3250K .......... .......... .......... .......... .......... 93%  100M 0s
  3300K .......... .......... .......... .......... .......... 95% 88,2M 0s
  3350K .......... .......... .......... .......... .......... 96% 9,04M 0s
  3400K .......... .......... .......... .......... .......... 97% 11,9M 0s
  3450K .......... .......... .......... .......... .......... 99% 99,2M 0s
  3500K .......... .......... ......                          100% 97,2M=0,6s

2018-01-26 22:39:12 (6,14 MB/s) - '/tmp/RtmpIF4wAz/lme4_1.1-15.tar.gz' saved [3610706/3610706]

Installing lme4
--2018-01-26 22:39:20--  https://cran.rstudio.com/src/contrib/nloptr_1.0.4.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 54.230.27.181
Connecting to cran.rstudio.com (cran.rstudio.com)|54.230.27.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 353957 (346K) [application/x-gzip]
Saving to: '/tmp/RtmpIF4wAz/nloptr_1.0.4.tar.gz'

     0K .......... .......... .......... .......... .......... 14% 1,11M 0s
    50K .......... .......... .......... .......... .......... 28%  106K 1s
   100K .......... .......... .......... .......... .......... 43%  644K 1s
   150K .......... .......... .......... .......... .......... 57%  677K 0s
   200K .......... .......... .......... .......... .......... 72% 5,64M 0s
   250K .......... .......... .......... .......... .......... 86%  628K 0s
   300K .......... .......... .......... .......... .....     100% 2,39M=0,8s

2018-01-26 22:39:22 (448 KB/s) - '/tmp/RtmpIF4wAz/nloptr_1.0.4.tar.gz' saved [353957/353957]

Installing nloptr
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmpIF4wAz/devtools756410ec724/nloptr' --library='/home/stefan/R/x86_64-pc-linux-gnu-library/3.2' --install-tests

ERROR: failed to lock directory '/home/stefan/R/x86_64-pc-linux-gnu-library/3.2' for modifying
Try removing '/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/00LOCK-nloptr'
Installation failed: Command failed (3)
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL '/tmp/RtmpIF4wAz/devtools7561eb5da54/lme4'  \
  --library='/home/stefan/R/x86_64-pc-linux-gnu-library/3.2' --install-tests

ERROR: dependency 'nloptr' is not available for package 'lme4'
* removing '/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/lme4'
Installation failed: Command failed (1)
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmpIF4wAz/devtools75623bf595c/pbkrtest' --library='/home/stefan/R/x86_64-pc-linux-gnu-library/3.2' --install-tests

ERROR: dependency 'lme4' is not available for package 'pbkrtest'
* removing '/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/pbkrtest'
Installation failed: Command failed (1)
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmpIF4wAz/devtools75635e8f138/cran-car-4f39fce' --library='/home/stefan/R/x86_64-pc-linux-gnu-library/3.2' --install-tests

ERROR: dependency 'pbkrtest' is not available for package 'car'
* removing '/home/stefan/R/x86_64-pc-linux-gnu-library/3.2/car'
Installation failed: Command failed (1)

A: As of Ubuntu 20.0 devtools is available as a r-cran ubuntu package.
https://packages.ubuntu.com/groovy/r-cran-devtools
Install with sudo apt-get install r-cran-devtools

A: Certainly, the answer is within the output you pasted. You need to install in the OS (as opposed as in R) the following dependencies:
libcurl4-openssl-dev
libssl-dev
To install them, run in your terminal:
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libssl-dev

And then go to R and try reinstalling "devtools".

A: Guess you need to add
sudo apt-get install libxml2-dev
also. This is because devtools require the package xml2 as well.

A: For Ubuntu 18.04 worked for me:
apt-get install libzmq3-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev build-essential libcurl4-openssl-dev libxml2-dev libssl-dev libfontconfig1-dev


text:
Q: Cannot Filter Locations In Flutter I am trying to filter out locations in my flutter application. I can filter my markers but, I'm not sure what the best way to pull the locations by name details. Here is how I'm creating markers:

  Map<MarkerId, Marker> markers = <MarkerId, Marker>{};

  Future filterMarker(_userlat, _userlong) async {
    int filterCounter = 0;

    for (int i = 0; i < venues.length; ++i) {
      Geolocator()
          .distanceBetween(
              _userLat, _userlong, venues[i].latitude, venues[i].longitude)
          .then((calcDist) {
        if (calcDist / 1000 < 1) {
          filterCounter++;
          placeFilteredMarker(filterCounter, calcDist / 1000, venues[i].name,
              venues[i].latitude, venues[i].longitude);

          filtervenues(filterCounter, venues[i].name, venues[i].address,
              venues[i].rating, calcDist / 1000);
        }
      });
    }
  }

  placeFilteredMarker(counter, distance, name, lat, lng) {
    final int markerCount = counter;

    for (int i = 0; i < markerCount; i++) {
      final String markerIdVal = 'marker_id_$markerCount';

      final MarkerId markerId = MarkerId(markerIdVal);

      // creating a new MARKER
      final Marker marker = Marker(
        markerId: markerId,
        position: LatLng(lat, lng),
        infoWindow: InfoWindow(title: name, snippet: '$distance'),
        icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueBlue),
      );

      setState(() {
        markers[markerId] = marker;
        // adding a new marker to map
      });

      return;
    }
  }

I'm trying something similar with a list of details. Filtering by location and showing the details but, I don't understand what I'm doing wrong. Here is what I'm trying
Here is the issue: I'm not sure what I should do to pull out Name,address, and rating.

List<Venue>venue;

  Future filterMarker(_userlat, _userlong) async {
    int filterCounter = 0;

    for (int i = 0; i < venues.length; ++i) {
      Geolocator()
          .distanceBetween(
              _userLat, _userlong, venues[i].latitude, venues[i].longitude)
          .then((calcDist) {
        if (calcDist / 1000 < 1) {
          filterCounter++;
          placeFilteredMarker(filterCounter, calcDist / 1000, venues[i].name,
              venues[i].latitude, venues[i].longitude);

          filtervenues(filterCounter, venues[i].name, venues[i].address,
              venues[i].rating, calcDist / 1000);
        }
      });
    }
  }

  filtervenues(counter, name, addres, rating, distance) {
    final int venueCounter = counter;

    for (int i = 0; i < venueCounter; i++) {
      setState(() {

      });
      return;
    }
  }

That should iterate and then add to the container below:

  Widget _buildList(BuildContext context, _name, _address, _rating) {

    return Container(
      height: 425,
      child: Column(
              children: <Widget>[
                SizedBox(
                  height: 2,
                ),
                SizedBox(
                  height: 2,
                ),
                _locations(venues[index].name, venues[index].address,
                    venues[index].rating),
                Divider(
                  height: 2,
                )
              ],
            );
          ),
    );
  }

Photo update. I am trying to put the data that the markers have into this bottom sheet.

A: First: This whole logic seems to be pretty unperformant. You are setting State on each iteration of the for loop, which causes the MapsWidget to rebuild each iteration. Why don't you create a List of Marker Items and then in the end do smth like in the following code. Additionaly i would do the something similar to the Venues:
class Location {
   final Venue venue;
   final double dist;
   final int index;
   Location({this.venue, this.dist, this.index});
}

  Set<Marker> markers = Set(); //Google Maps Markers are normally a Set
  List<Location> location = List();

  Future filterMarker(_userlat, _userlong) async {
    Set<Marker> _tmpMarkers = Set();
    int filterCounter = 0;
    List<Location> _tmpLocation = List();
    for (int i = 0; i < venues.length; ++i) {
      Geolocator()
          .distanceBetween(
              _userLat, _userlong, venues[i].latitude, venues[i].longitude)
          .then((calcDist) {
        if (calcDist / 1000 < 1) {
          filterCounter++;
          final String markerIdVal = 'marker_id_$filterCounter';

          final MarkerId markerId = MarkerId(markerIdVal);

         // creating a new MARKER
         tmpMarkers.add(Marker(
           markerId: markerId,
           position: LatLng(venues[i].latitude, venues[i].longitude),
           infoWindow: InfoWindow(title: venues[i].name, snippet: '$calcDist / 1000'),
           icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueBlue),
          ));
          _tmpLocation.add(Location(index: i, Venue: venue[i], dist: calcDist / 1000));
        }
      });
    }
    setState((){
     markers = _tmpMarkers;
     location = _tmpLocation;
    });
  }

Then you use your Location Object in the bottom sheet. Furthermore I was not able to test this code as I don't have your full code, perhaps there are some brackets missing.
Then you can use the location list in a ListView.builder in the bottomSheet.
There you can style each List tile yourself.
// As you didn't provide any code of your bottom sheet i just call it DraggableBottomSheet
bottomSheet: DraggableBottomSheet(
   child: Column(
    children : [
      Row(
        children: [
           Text('bla'),
           Text(location.length.toString(),
             ]
        ),
      ListView.builder(
          itemCount: location.length,
          itemBuilder: (context, index) {
             return Container(
                 child Column(
                     children : [
                          Text(location[index].venue.name),
                          Text(location[index].dist.toString()),
                       ]
                 )
              );
            }
        )
     ]
   )
)


text:
Q: How to display overlay when Search button is clicked on? I would like to be able to display an overlay when the search button is clicked.
I am new to Jquery/JavaScript and based on what I am learning on stack-overflow and google, I was able to come up with the following code:

function displayOverlay(text) {
    $("

" + text + "

").css({
        "position": "fixed",
        "top": "0px",
        "left": "0px",
        "width": "100%",
        "height": "100%",
        "background-color": "rgba(0,0,0,.6)",
        "z-index": "10000",
        "vertical-align": "middle",
        "text-align": "center",
        "color": "#fff",
        "font-size": "40px",
        "font-weight": "bold",
        "cursor": "wait",
    }).appendTo(".btn");
}

function removeOverlay() {
    $("#overlay").remove();
}

function closeOverlay{
 if($(".btn").data('clicked')){
  displayOverlay("Loading...");
 }
 else{
  $("#overlay").remove();
 }
}

  <form name="providerSearch" ng-submit="SearchProvider(searchParam);" novalidate="" role="form">

<input class="form-control" id="physiciansfirstname" ng-model="searchParam.FirstName" placeholder="First name:" type="text" />

<input class="form-control" id="physicianslastname" ng-model="searchParam.LastName" placeholder="Last name:" type="text" />

<select class="form-control" id="providerSpecialty" ng-model="searchParam.Specialty"><option disabled="disabled" selected="selected" value="">Specialty</option>
            <option value=""></option><option>Family practice</option><option>General practice</option><option>Internal medicine</option><option>Pediatrics</option> </select>

             <SELECT name="proCity" class="form-control" id="city" placeholder="City" ng-model="searchParam.City">
        <option disabled="disabled" selected="selected" value="">City</option>
        <option value=""></option>
        <cfoutput query="cityFind">
                           <option value=#city#>#city#</option>
      </cfoutput>
       </select>

                    <select name="language" class="form-control" ng-model="searchParam.Language">
         <option disabled="disabled" selected="selected" value="">Language</option>
                        <option value=""></option>
      <cfoutput query="Languages">
        <option value=#Language#>#Language#</option>
      </cfoutput>
       </select>

<select class="form-control" name="gender" ng-model="searchParam.Gender">
                    <option disabled="disabled" selected="selected" value="">Gender</option>
                    <option value=""></option>
                    <option>Male</option><option>Female</option> </select>

* or Search by Zip code radius *

<select class="form-control" name="distance" ng-model="searchParam.distance"><option selected="selected">5</option><option selected="selected">10</option><option selected="selected">15</option><option selected="selected">20</option> </select>

mi

<input allow-pattern="[\d\-]" class="form-control" id="zip" maxlength="5" ng-model="searchParam.Zip" placeholder="Zip code" type="text" data-default=""/>

<input class="btn btn-warning btn-block" ng-click="gotoElement('SearchResultsAnchor');" type="submit" value="Search" />

  </form>
 --->

However, the overlay does not appear when the search button is clicked on.
UPDATE
The following is when the body is called and the overlay appears when the page is visited which is not desired.
$(function () {
    $("body").click(function () {
        if ($("#overlay").length > 0) {
            removeOverlay();
        } else {
            displayOverlay("Loading...");
        }
    });
});

This is the line where I am calling the setTimeout() function:

<input class="btn btn-warning btn-block ignore" ng-click="gotoElement('SearchResultsAnchor');" onclick="setTimeout(overlayDisplayButton,3000)" type="submit" value="Search" />

I currently updated what I did and this is what I am using to display the overlay:
    function displayOverlay(text) {
    $("

" + text + "

").css({
        "position": "fixed",
        "top": "0px",
        "left": "0px",
        "width": "100%",
        "height": "100%",
        "background-color": "rgba(0,0,0,.6)",
        "z-index": "10000",
        "vertical-align": "middle",
        "text-align": "center",
        "color": "#fff",
        "font-size": "40px",
        "font-weight": "bold",
        "cursor": "wait",
        "overflow-y":"hidden"
    }).appendTo("body");
}

function removeOverlay() {
    $("#overlay").remove();
}

$(function overlayDisplayButton() {
    $(".btn").click(function () {
        if ($("#overlay").length > 0) {
            removeOverlay();
        } else {
            displayOverlay("Loading...");
        }
        displayOverlay("Loading...");
    });
});
</script>

Small Change on what I did
    $(function overlayDisplayButton() {
    $("#submit").click(function () {
        if ($("#overlay").length > 0) {
            removeOverlay();
        } else {
           displayOverlay("Loading...")
        }
    });

});

and I still don't understand how to do the callback when the data is retrieved and displays on the screen so that the overlay goes away
Any help would appreciated.
Thanks

A: You can create an html user interaction blocking layer more easily with just a combo of a div and css and js.  You just show or hide a div with this class.  I don't see any reason to use a table.  You just have that div sitting at the bottom of your page, with nothing in it.  The css floats it above everything else and it expands to cover everything.  The css height 100% still needs a little help from the js because it won't auto adjust when the window changes sizes I recall.
css:

div.BlockUserInteractionWithPage {
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: 2000;
    padding-top: 0px;
    padding-right: 0px;
    padding-bottom: 0px;
    padding-left: 0px;
    background-color: #ffffff;
    opacity: 0.0;
    filter: alpha(opacity=0); /* filter:alpha for IE8 and earlier */
    height: 100%;
    width: 100%;
}

js:

show

var pageLength = document.body.clientHeight;
var blockingLayerObject = $("#blockingLayer")[0];
blockingLayerObject.style.height=pageLength;
$(blockingLayerObject ).show();

hiding is easy of course, once it is hidden it is no longer blocking

html:


text:
Q: How to see what Observables are not completed while debugging In an Angular app you might end up having quite a few Observables and you might forget to complete them when not needed anymore. Because of that they might trigger unexpectedly leading to unexpected side effects that are difficult to debug.
Is there a way to see at any moment during debugging all the Observables that are not completed? I am thinking of a DevTools tool.

A: yes, there is a memory profiler devtool. Memory -> take snapshot. do something that causes memory leaks, take another snapshot and compare them

A: I don't think there's any obvious and simple way to do exactly what you're looking for.
However, since RxJS 7.3 tap() operator can handle apart from the three notification types three new event "subscribe", "unsubscribe" and "finalize" (basically the same as using finalize() operator). (the same functionality could be achieved using defer() and finalize() in RxJS versions < 7.3).
In your case you could listen to all "subscribe" and "unsubscribe" and if they're called the same number of times then you know that all subscriptions were unsubscribed either manually or the source completed/errored:
import { of, tap, delay } from 'rxjs';

let counter = 0;

const source$ = of('World')
  .pipe(
    delay(1000),
    tap({
      subscribe: () => console.log('Subscribers: ', ++counter),
      finalize: () => console.log('Subscribers: ', --counter),
    }),
  );

source$.subscribe();
source$.subscribe();
setTimeout(() => source$.subscribe(), 500);
setTimeout(() => source$.subscribe(), 2000);

Live demo: https://stackblitz.com/edit/rxjs-oht1ex?devtoolsheight=60
If all subscribers get unsubscribed then you have to see "Subscribers: 0" in the console at the end.
Note, that tap() needs to be the last operator so the finalize handler is called after the delayed value is emitted.


text:
Q: React Native Picker: Show different item lists I am learning to use React Native Picker. For now, as an example, I have added two user type: Freelancer, and Client.
I want to show different picker item depending on the user type selected. At the moment, my app shows all the items regardless of the user type selected.
For example: If the user selects user type Freelancer, I want to show picker item to be Freelancer 1 and Freelancer 2.
And, if user selects user type Client, I want to show picker item to be Client 1 and Client 2.
I am new with this so any help will be highly appreciated.
Code snippet provided below:
export default class FrTopUpScreen extends Component {

    constructor(props) {
        super(props);
        this.state = {
            userType: '',
            clientName: '',
            freelancerName: '',
        }
    }
    render() {
        return (
            <View>
                <View style={{ flexDirection: 'row' }}>
                    <Text style={styles.titleStyle}>User Type</Text>
                    <View style={styles.pickerStyle}>
                        {<Picker
                            mode='dropdown'
                            selectedValue={this.state.userType}
                            onValueChange={(itemValue, itemIndex) =>
                                this.setState({ userType: itemValue })
                            }>
                            <Picker.Item label="Select User Type" value="" />
                            <Picker.Item label="Freelancer" value="Freelancer" />
                            <Picker.Item label="Client" value="Client" />
                        </Picker>}
                    </View>
                </View>
                <View style={{ flexDirection: 'row' }}>
                    <Text style={styles.titleStyle}>Name</Text>
                    <View style={styles.pickerStyle}>
                        <Picker
                            mode='dropdown'
                            selectedValue={this.state.name}
                            onValueChange={(itemValue, itemIndex) =>
                                this.setState({ name: itemValue })
                            }>
                            <Picker.Item label="Please Select" value="" />
                            <Picker.Item label="Freelancer 1" value="Freelancer 1" />
                            <Picker.Item label="Freelancer 2" value="Freelancer 2" />
                            <Picker.Item label="Client 1" value="Client 1" />
                            <Picker.Item label="Client 2" value="Client 2" />
                        </Picker>
                    </View>
                </View>
        );
    };
};

A: You should try something like this :
var pickerItems = ["Freelancer","Client"];
var freelancer =["Freelancer1","Freelancer2"];
var client =["Client1","Client2"];

<Picker
    style={{your_style}}
    mode="dropdown"
    selectedValue={this.state.selected}
    onValueChange={()=>{
     if(selectedValue == Freelancer)
     {
         this.setState({
              pickerItems=this.state.freelancer
         });
     }
     else{
         this.setState({
              pickerItems=this.state.client
         });
     }
   }}>
    {pickerItems.map((item, index) => {
        return (<Picker.Item label={item} value={index} key={index}/>)
    })}
</Picker>


text:
Q: Can I change the color of the text loaded from ilab=cbind in Forest Plot in metafor? Please, find my data q below.
I have produced this Forest Plot, and I would like the encircled text to be red instead of black. Can this be done?

My script
q <- escalc(measure="IRR", x1i=x1i, t1i=t1i, x2i=x2i, t2i=t2i, data=q)
q1 <- rma(yi, vi, data=q, slab=paste(study, sep=", "), method = "REML")

## Forest
forest(q1, xlim=c(-27,8), atransf=exp, showweights = FALSE, psize = 1.6, refline=log(1),
       cex=0.5, ylim=c(0.1, 17), font=1, col="white", border="white", order=order(q$order),
       ilab=cbind(q$x1i, q$t1i, q$ir1, q$x2i, q$t2i,q$ir2),
       ilab.xpos=c(-19.3,-17,-15,-12.3,-10,-8),
       rows=c(2:7,11:13),xlab="Rate ratios", mlab="")

# Headlines
text(c(-19,-16.8,-15,-12,-9.8,-8)   ,15.7,font=1, cex=0.5, c("Events\n per total\n", "Person-\nyrs\n", "IR\n", "Events\n per total\n", "Person-\nyrs\n","IR\n"))
text(c(-18.75,-18.75,-18.65)   ,c(13,12,11),font=1, cex=0.54, c("/ 32", "/ 32", " / 23"))
text(c(-18.75,-18.75,-18.75)   ,c(7,6,5),font=1, cex=0.54, c("/ 37", "/ 37", "/ 37"))
text(c(-18.65,-18.65,-18.65)   ,c(4,3,2),font=1, cex=0.54, c(" / 29", " / 29", " / 19"))

text(c(-11.65,-11.65,-11.65)   ,c(13,12,11),font=1, cex=0.54, c("  /23", " /16", " /16"))
text(c(-11.65,-11.65,-11.75)   ,c(7,6,5),font=1, cex=0.54, c(" /29", "/19", "  /25"))
text(c(-11.65,-11.75,-11.75)   ,c(4,3,2),font=1, cex=0.54, c("/19", " / 25", " / 25"))

text(8                       ,15.7,font=1, "Rate ratio [95% CI]", pos=2, cex=0.5)
text(-27                     ,c(14,8),font=2, c("Progression rates","Mortality rates"), pos=4, cex=0.5)
text(-27                     ,c(1,10),font=1, c("\nCohort: 110 patients included","\nCohort: 76 patients included"), pos=4, cex=0.45)

My data q
q <- structure(list(study = structure(c(2L, 4L, 7L, 3L, 5L, 1L, 8L,
6L, 9L), .Label = c("WHO-I versus Unknown ", "WHO-I versus WHO-II",
"WHO-I versus WHO-II ", "WHO-I versus WHO-III", "WHO-I versus WHO-III ",
"WHO-II versus Unknown", "WHO-II versus WHO-III", "WHO-II versus WHO-III ",
"WHO-III versus Unknown"), class = "factor"), order = 9:1, x1i = c(4L,
4L, 15L, 9L, 9L, 9L, 15L, 15L, 12L), n1i = c(32L, 32L, 23L, 37L,
37L, 37L, 29L, 29L, 19L), t1i = c(74.7, 74.7, 22.8, 108.1, 108.1,
108.1, 48.3, 48.3, 27.9), x2i = c(15L, 15L, 15L, 15L, 12L, 9L,
12L, 9L, 9L), n2i = c(23L, 16L, 16L, 29L, 19L, 25L, 19L, 25L,
25L), t2i = c(22.8, 4.4, 4.4, 48.3, 27.9, 79.1, 27.9, 79.1, 79.1
), ir1 = c(5.4, 5.4, 65.7, 8.3, 8.3, 8.3, 31.1, 31.1, 43.1),
    ir2 = c(65.7, 339.6, 339.6, 31.1, 43.1, 11.4, 43.1, 11.4,
    11.4)), class = "data.frame", row.names = c(NA, -9L))

A: Changing the color of what's added via ilab isn't possible, but you can always just add the text yourself using text() (e.g., on top of the existing text). This will do it:
text(-15, rev(c(2:7,11:13)), q$ir1, col="red", font=1, cex=0.5)
text( -8, rev(c(2:7,11:13)), q$ir2, col="red", font=1, cex=0.5)


text:
Q: .NET Core Identity UI - overriding SignInManager I try:
public class VoySignInManager : SignInManager<IdentityUser>
{
    public VoySignInManager(Microsoft.AspNetCore.Identity.UserManager<Microsoft.AspNetCore.Identity.IdentityUser> userManager, Microsoft.AspNetCore.Http.IHttpContextAccessor contextAccessor, Microsoft.AspNetCore.Identity.IUserClaimsPrincipalFactory<Microsoft.AspNetCore.Identity.IdentityUser> claimsFactory, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Identity.IdentityOptions> optionsAccessor, Microsoft.Extensions.Logging.ILogger<Microsoft.AspNetCore.Identity.SignInManager<Microsoft.AspNetCore.Identity.IdentityUser>> logger, Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider schemes)
        : base(userManager, contextAccessor, claimsFactory, optionsAccessor, logger, schemes)
    {
    }

    public override Task<Microsoft.AspNetCore.Identity.SignInResult> PasswordSignInAsync(IdentityUser user, string password, bool isPersistent, bool lockoutOnFailure)
    {
        return Microsoft.AspNetCore.Identity.SignInResult.Success;
    }
}

I get:
Error   CS0029  Cannot implicitly convert type 'Microsoft.AspNetCore.Identity.SignInResult' to 'System.Threading.Tasks.Task<Microsoft.AspNetCore.Identity.SignInResult>'

What am I doing wrong ? how do I return a successful SignInResult here ?
(note obviously this is just a simplified version to show the error)

A: No async/await needed.  Just return your result as return Task.FromResult(SignInResult.Success);

A: You lack async when define function:
public override async Task<Microsoft.AspNetCore.Identity.SignInResult> PasswordSignInAsync(IdentityUser user, string password, bool isPersistent, bool lockoutOnFailure)
{
    return await Task.FromResult(SignInResult.Success);
}


text:
Q: Page Title loading before css I'm experiencing a glitch on page load.
The title is loading first its starts on the left hand side of the page(my site is centered) and then moves to the correct position once the page is fully loaded. Please refresh a couple of times to see what i'm referring to.
I tried to use inline styles to make it start correctly but its not working -- i'm using an ERP system netsuite which is one of the reasons why i'm having trouble.
Any ideas on how i can fix this?

A: CSS arranges everything before and Javascript loads. Your Javascript fixes the display AFTER the page is loaded and displayed, so you need to fix your CSS
It appears that in your HTML you have set for the DIV containing "40% off Gluten-Free Lunches and Snacks" has it's margins defined there as 0px, which would make it not centered.
Line 247 when you view source in your HTML:
<div id='div__body' style="margin: 0px;  margin-top: 3px;">
This overrides any CSS you have in your CSS files. You need to change that to margin: auto; to center that div before and Javascript manually positions the div.
PS: if you are using javascript to position things it may not be neccessary as you should be able to do most things with raw CSS.

A: On line 440-ish (depending on your prettifier) of NLUtil.jsp__NS_VER=2014.2.0 (in the function resetDivSizes) you are changing the width of the "div__body" DIV dynamically, which may be the culprit here.


text:
Q: I have a switch, a cable modem and 2 macs with mac os x, can I configure one of the macs as wired and wireless router? It's pretty simple really, if anyone has instructions on how to do this, I would appreciate it. My router is on the way, but I don't want to wait, I have a switch, a cable modem and 2 macs with mac os x, can I configure one of the macs as wired and wireless router?

A: Yes you can, plug one of the Mac's in directly to the cable modem (make sure the firewall in enabled first!) and setup Internet Sharing  in Network Preferences to allow the other Mac to connect wirelessly.   See these instructions from life hacker.


text:
Q: Non-union-affiliated shop steward I'm looking for an English word or short phrase to convey a meaning which is similar to "union representative" or "shop steward", except that the person in question is not (necessarily) associated with a union. That person is an employee of a company who is elected by his fellow employee to represent him in various relations with the employer.
The point is to distinguish between two concepts in French labor relations: a "délégué syndical" (lit. "union representative"), and a "délégué du personnel" (lit. "representative of the workforce"). While it is possible for a délégué du personnel to also be a délégué syndical, they are separate roles, and the délégué du personnel does not have to be a union member, and even if he is he does not speak for the union in his role as a délégué du personnel.
IATE is decidedly unhelpful here, suggesting only "shop steward" and "trade union representative" for délégué du personnel, both of which are wrong. Linguee offers suggestions, but none that strike me as clearly making the difference between union and union-agnostic representatives. There evidently is no similar concept in labor relations in English-speaking countries, so I'm looking for a good enough approximation.
What would be a good way to translate délégué du personnel into English (taking care not to imply a union representative)? A way to describe this role in a sentence or two that makes sense to UK and US audiences would be appreciated too.

A: As you say, I don't think there is a well-established word for it. I would go for workers' representative, but it will need a bit of explanation exactly what is meant.

A: A general term for this is staff representative or staff rep for short. This can be used for any person who represents staff and need not be a member of any union (although they may).
If it really must be stressed the person is not a union member, I'd got for non-union [staff] rep.


text:
Q: Using Jest with gRPC-Web We are using gRPC-Web client in our project, but when we try to run unit tests on code that imports generated gRPC classes we get an error

TypeError: cannot read property 'navigator' of undefined.

I guess the problem is somehow related to the way generated modules are exposed, however I cannot figure out how to make it work with Jest.
I tried to mock global.navigator object manually using setupTests.js file, but it didn't help. It looks like the gRPC code is being executed before Jest.
Our web project is created using Create React App library with TypeScript without ejecting and we use default Jest configuration to run unit tests.
Please advise.


text:
Q: Delayed data causes NullPointerException on OnCreate I have this activity that receives a JSON Response to display on UI. My request goes like this.
public void onClick(View click) {
    if (click == profBtn) {
       //this line creates the post request on my RequestHandler class.
       requestHandler.setURL(url);
       Intent it = new Intent(MainActivity.this, ProfActivity.class);
    startActivity(it);
    } else if....

This is my OnCreate method looks like in my ProfActivity
    TextView tv;
    protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.prof_activity);

            //this command gets the data from the JSON Response from my mapper class.The JSON Response was converted to a HashMap.
            mapData=MapperClass.map;

    String value=mapData.get("key");
        tv = (TextView) findViewById(R.id.textView1);
        tv.setText(value);
}

The setText command causes NullPointerException. The making of request, receiving of the response, mapping of response into hashmap and passing the value of the map to the ProfActivity works fine. The problem here is the JSON Response is a bit late. The Oncreate method was already performed before the data to be displayed arrives.
Any idea how I can tell my activity to wait for the data?

A: Instead of asking your ProfActivity to wait, you should only start it when the request has finished. Put the startActivity code into the end of the postExecute method of your async task.
For me, I would also move the network request part into ProfActivity so that you do not need to access the result via a public variable.

A: If you insist on using activity, then please use startActivityForResult, and put the parsing and setText part in onActivityResult.
Furthermore, AsyncTask maybe a better choice.


text:
Q: How to search datetime value in JSONB using ransack This is a sample code that searches key value inside jsonb_column for name
ransacker :name do |parent|
  Arel::Nodes::InfixOperation.new('->>', parent.table[:jsonb_column_here],
  Arel::Nodes.build_quoted('name'))
end

BEFORE we're not using JSONB column and this works for searching using datetime values.
 Ransack.configure do |config|
  config.add_predicate 'between_begin_and_end',
                       arel_predicate: 'between_begin_and_end',
                       formatter: proc { |v| v.to_date },
                       validator: proc { |v| v.present? },
                       type: :string
end

module Arel
  module Predications
    def between_begin_and_end date
      gteq(date.to_date.beginning_of_day).and(lt(date.end_of_day))
    end
  end
end

**Example data:**

jsonb_column {
  "data_created_at"=>2020-03-23 05:10:46 UTC,
  ....
  ....
}

HOW to incorporate my previous method now with JSONB column.


text:
Q: Custom Gem in /vendor/gems not Loading I recently decided to take some functionality that I have in several of my Rails apps and extract it into an Engine. I have now finished the Engine and I'm trying to install the finished gem into one of my apps.
This particular gem isn't something that I want to be public, so I packaged the gem with gem build my_gem.gemspec and then put the packaged gem in the vendor/gems folder of my application. Then, I added gem 'my_gem', '0.0.1', :path => 'vendor/gems' to my gemfile and ran bundle install.
Unfortunately though, Rails doesn't seem to be loading the gem and I can't seem to require it manually:
$ bundle exec rails console --sandbox
Loading development environment in sandbox (Rails 3.2.11)
Any modifications you make will be rolled back on exit
irb(main):001:0> MyGem
NameError: uninitialized constant MyGem
        from (irb):1
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'
irb(main):002:0> require 'my_gem'
LoadError: cannot load such file -- my_gem
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
        from (irb):2
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

Am I doing something wrong? How do I fix this?

Edit: Here's my gem environment information.
$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.16
  - RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [i386-mingw32]
  - INSTALLATION DIRECTORY: c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe
  - EXECUTABLE DIRECTORY: c:/RailsInstaller/Ruby1.9.3/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1
     - c:/Users/Ajedi32/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

A: Type gem env to check where Ruby is searching for gems.
You then want to append the directory you put your gem in, to the GEM_PATH environment variable. e.g.:
  export GEM_PATH="./vendor/gems:$GEM_PATH"

See also:  http://docs.rubygems.org/read/chapter/12
If you are using a Gemfile, you can also do this:
  gem 'my-gem', '0.0.1', :path => 'vendor/gems/my-gem'

(you have to add the name of your gem directory to the path)


text:
Q: Prove holomorphic $f$ is constant if given $f'(z)=0$ only on a curve Let $f(z):U\to\mathbb{C}$ be a holomorphic function, where $U=\left\{z\mid 0<|z|<2\right\}.$ It is given that $f'(z)=0$ for very $z\in C= \left\{z\mid |z|=1\right\}.$ Prove that $f$ is a constant function on $U$.

This is a question I had in my Complex Analysis exam. Its solution is pretty easy if you use the Identity Theorem, but I unfortunately forgot that theorem and didn't use it. I would like to know what you think about my solution:
My solution: Let $D=\left\{z\mid 0<|z|<1\right\}$. Since $f$ is holomorphic, then $f'$ is also holomorphic, and then we can use Cauchy's Integral Formula, by which, for every $z\in D$, if we choose to use the curve $C$:
$$f'(z)=\oint_C\frac{f'(w)}{w-z}\ dw=0$$
Therefore, $f'(z)=0$ for every $z\in D$. Let $K$ be a complex constant such that $f(z)\equiv K$ for every $z\in D$, and let $g(z)=f(z)-K$. We know that $g(z)\equiv 0$ for every $z\in D$, thus there exists $z_0\in D$ such that $z_0$ is a zero of $g$ which is not isolated. Since $g$ is holomorphic as a difference of holomorphic functions, $g$ must be equal to the zero function on the entire of $U$, because every holomorphic function which is not constant has only isolated zeroes. Thus $g\equiv 0$ on $U$, meaning $f\equiv K$ on $U$.

*

*The theorem of isolated zeroes is not a theorem that I've studied in the course, so I explained it with power series.

Thanks!
P.S.: I'm not sure if using Cauchy's Integral Formula is valid when there might be a singularity inside of the curve which is used. $f$ might not be holomorphic on $0$. If it's not, is it a problem?

A: Your proof is not valid. Cauchy's integral formula
$$
  g(z)=\frac{1}{2 \pi i}\oint_C\frac{g(w)}{w-z}\ dw
$$
in it's simplest form requires that $g$ is holomorphic in a neighbourhood of the closure of the disk $D$ and $C$ is the (counter-clockwise) circle forming the boundary of $D$. That cannot be applied here because $g = f'$ is not holomorphic at $z=0$.
There is also a variant
$$
  N(w, \gamma) g(z)=\frac{1}{2 \pi i}\oint_\gamma\frac{g(w)}{w-z}\ dw
$$
where $f$ is holomorphic in $U$, $\gamma$ a cycle which is homologous to zero in $U$, and $N(w, \gamma) $ is the winding number of $w$ with respect to $\gamma$. That cannot be applied here because your $C$ is not  homologous to zero in $U=\left\{z\mid 0<|z|<2\right\}$, since $N(0, C) = 1 \ne 0$.

A: Using Laurent series, we can write
$$f(z)=\sum_{-\infty}^{\infty}a_nz^n$$
for $z\in U.$ It follows that
$$f'(z)=\sum_{n\ne 0}na_nz^{n-1}.$$
On the unit circle, we get
$$f'(e^{it})=\sum_{n\ne 0}na_ne^{int}.$$
Now apply a little Fourier series:
$$\int_0^{2\pi}|f'(e^{it})|^2\,dt = \sum_{n\ne 0}|na_n|^2.$$
It follows that $a_n=0,n\ne 0.$ Therefore $f=a_0$ everywhere, i.e., $f$ is constant.


text:
Q: find the value of $ S = \sum _{k=1}^{\infty }\left(\frac{\left(-1\right)^{k+1}}{(k)(2k+1)}\right)$ Find the value of $\frac{1}{3}-\frac{1}{10}+\frac{1}{21}-\frac{1}{36}+...$
I have no idea how to solve this infinite sum, I appreciate any help, thanks in advance.

A: $$\frac S2=\sum_{k=1}^\infty\frac{(-1)^{k+1}}{2k(2k+1)}
=\sum_{k=1}^\infty(-1)^{k+1}\left(\frac1{2k}-\frac1{2k+1}\right)
=\sum_{k=1}^\infty(-1)^{k+1}\int_0^1(x^{2k-1}-x^{2k})\,dx
=\int_0^1 \frac{x-x^2}{1+x^2}\,dx$$
etc.

A: Observe you have
\begin{align}
\operatorname{Log}(1+i)=\sum^\infty_{n=1} (-1)^n\frac{i^n}{n}=\sum^\infty_{k=1}\frac{(-1)^k}{2k}+i\sum^\infty_{k=1}\frac{(-1)^{k+1}}{2k-1}
\end{align}
where $\operatorname{Log}z$ is the principal branch.
Hence it follows
\begin{align}
\operatorname{Log}(1+i)=\log 2+ i\arg (1+i) = \log 2 + i\frac{\pi}{4}
\end{align}
which means
\begin{align}
\sum^\infty_{k=1}\frac{(-1)^{k+1}}{2k+1}=1-\frac{\pi}{4}.
\end{align}
For the other problem, we see that
\begin{align}
\sum^\infty_{k=1}(-1)^{k+1} \frac{1}{2k(2k+1)} = \sum^\infty_{k=1}(-1)^{k+1}\left( \frac{1}{2k}-\frac{1}{2k+1}\right)=-\frac{1}{2}\sum^\infty_{k=1}\frac{(-1)^k}{k}-\frac{\pi}{4} = \frac{1}{2}\log 2+\frac{\pi}{4}-1.
\end{align}


text:
Q: Prove directly that $S(n, n - 1) = \binom{n}{2}$ (Striling numbers of 2nd kind) Can some one please show me how to prove directly that $S(n, n - 1) = \binom n 2$
 I know that $S(n,n)=1$

A: If you want to partition $n$ objects into $n-1$ nonempty sets, then exactly one of the sets will have two elements and the rest will all have one. It is thus equivalent to decide which two elements will be paired together, which can be done in $\binom{n}{2}$ ways.


text:
Q: How to list the directories non recursively which are 30 days older I want to list the folders in UNIX which are older than a month. I have tried the following options:
find . -type d -mtime +30

Which will list files recursively however I want non recursive one.

A: Add the maxdepth option:
find . -maxdepth 1 -type d -mtime +30


text:
Q: split SQL field We are exporting data from one application to another and have a problem where 5 fields are stored within 1 field in the old application we are getting rid of.
example of Field 'notes' contents,

Job ID: 1234 Job Type: Maintenance Contract: 4321/M - Maint - Computer Site: fred @ House Task Performed: Check HDD

How can i split this into different fields for Job ID, Job Type, Contract, Site and Task Performed, we have over 10,000 records in this format that need to be split to import to the new database

A: Assuming you know what these fields are prefixed with, and that they are the same in every entry, you can use the FIELD('target phrase', 'string to check') function to get the locations of the various fields, and then use SUBSTRING to remove the bits in-between for your inserts.


text:
Q: Speed up Python/Numpy Code for Ising-/Potts-Model Monte-Carlo For a small side-project I have written an 2D Ising-/Potts-Model Monte-Carlo simulation in Python/Numpy with the (simplified) code below.
Essentially the code does the following:

*

*Sets up a NXM array filled with random integers (orientations) in [1,orientations]

*for every time-step (MCS) the every pixel of the array is visited once in a pseudo-randomized order (therefore largest prime under() and
index = (a*i + rand) % (N**2)
    x = index % N
    y = index // N  )

*the 8 neighboring array entries are checked (periodic boundary conditions) and the entry is changed to one of the neighboring values

*if the energy of the new configuration becomes lower the change is accepted, else it is rejected unless a condition is fulfilled

I tried to speed it up as much as I could think of, but for large arrays (N,M > 500) the code isn't really fast. As I need about 10e5 MCS for an array to see a clear trend, the achieved
1 loop, best of 3: 276 ms per loop

for 1 MCS on a 100x100 array isn't really sufficient. Unfortunately I don't know how to increase the performance given my lack of experience.
I assume the Neighbors() and the calc_dE() functions are the bottle-necks and especially the nested loops but I can't find a way to speed it up. My cython trys weren't really successful as I haven't done anything with cython before so I'm open to any suggestion.
CODE:
(The pyplot commands are just for visualization and are usually commented.)
import math
import numpy as np
import matplotlib.pyplot as plt

def largest_primes_under(N):
    n = N - 1
    while n >= 2:
        if all(n % d for d in range(2, int(n ** 0.5 + 1))):
            return n
        n -= 1

def Neighbors(Lattice,i,j,n=1):
    ''' Returns an flat array of all neighboring sites in the n-th coordination sphere including the center'''
    N, M = Lattice.shape
    rows = [(i-1) % N, i, (i+1) % N]
    cols = [(j-1) % N, j, (j+1) % M]
    return Lattice[rows][:, cols].flatten()

def calc_dE(Lattice, x, y, z):
    N, M = Lattice.shape
    old_energy = 0
    new_energy = 0
    for i in [0,1,-1]:
        for j in [0,1,-1]:
            if i == 0 and j == 0:
                continue
            if Lattice[x%N,y%M] == Lattice[(x+i)%N,(y+j)%M]:
                old_energy += 1
            elif z == Lattice[(x+i)%N,(y+j)%M]:
                new_energy += 1
    return old_energy-new_energy

N, M = 100,100
orientations = N*M
MCS = int(100)

a = largest_primes_under(N*M)
L = np.random.randint(1,orientations+1,size=(N,M))

mat = plt.matshow(L,cmap = plt.get_cmap('plasma', orientations+1), vmin = -0.5, vmax = orientations+0.5, interpolation='kaiser')
plt.axis('off')

for t in range(1,MCS+1):
    rand = np.random.random_integers(N*M)
    for i in range(0,N**2):
        index = (a*i + rand) % (N**2)
        x = index % N
        y = index // N
        n = Neighbors(L,x,y)
        if len(n)-1 == 0:
            continue
        else:
            z = np.random.choice(n)
        dE = calc_dE(L,x,y,z)
        if  (dE < 0):
            L[x%N,y%N] = z
        elif np.random.sample() < math.exp(-dE*2.5):
            L[x%N,y%N] = z

    mat.set_data(L)
    plt.draw()
    plt.pause(0.0001)

A: Not sure if you have any sort of restrictions in terms of dependencies, but I would definitely look into Numba. It provides a set of decorators (njit, in particular) that will compile your code to machine code and make it potentially much, much faster, provided you are using compatible types (e.g. numpy arrays, but not pandas DataFrames).
Also, not sure what scale you are looking at, but I'm quite you can find examples of much better optimized prime search algorithms than a manually implemented for loop.
Otherwise you can always fall-back on Cython, but it requires re-writing your code.

EDIT: ok, I gave it a try with numba.
A few notes:

*

*moved the whole for loop inside a function, so that you can decorate it with njit

*in Neighbors, I had to change rows and cols from lists to np.arrays because numba does not accept indexing through lists

*I replaced np.random.random_integers with np.random.randint since the former is deprecated

*I replaced math.exp with np.exp which should give a minor performance boost (besides saving you an import)

import numpy as np
from numba import njit

def largest_primes_under(N):
    n = N - 1
    while n >= 2:
        if all(n % d for d in range(2, int(n ** 0.5 + 1))):
            return n
        n -= 1

@njit
def Neighbors(Lattice,i,j,n=1):
    ''' Returns an flat array of all neighboring sites in the n-th coordination sphere including the center'''
    N, M = Lattice.shape
    rows = np.array([(i-1) % N, i, (i+1) % N])
    cols = np.array([(j-1) % N, j, (j+1) % M])
    return Lattice[rows,:][:,cols].flatten()

@njit
def calc_dE(Lattice, x, y, z):
    N, M = Lattice.shape
    old_energy = 0
    new_energy = 0
    for i in [0,1,-1]:
        for j in [0,1,-1]:
            if i == 0 and j == 0:
                continue
            if Lattice[x%N,y%M] == Lattice[(x+i)%N,(y+j)%M]:
                old_energy += 1
            elif z == Lattice[(x+i)%N,(y+j)%M]:
                new_energy += 1
    return old_energy-new_energy

@njit
def fun(L, MCS, a):
    N, M = L.shape

    for t in range(1,MCS+1):
        rand = np.random.randint(N*M)
        for i in range(0,N**2):
            index = (a*i + rand) % (N**2)
            x = index % N
            y = index // N
            n = Neighbors(L,x,y)
            if len(n)-1 == 0: continue
            else: z = np.random.choice(n)
            dE = calc_dE(L,x,y,z)
            if  (dE < 0): L[x%N,y%N] = z
            elif np.random.sample() < np.exp(-dE*2.5): L[x%N,y%N] = z
    return L

Running the same example
N, M = 100,100
orientations = N*M
MCS = 1

L = np.random.randint(1,orientations+1,size=(N,M))
a = largest_primes_under(N*M)

through %timeit fun(L, MCS, a) (in Jupyter) gives me
16.9 ms ± 853 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

which is ~15 times faster than what you currently have. There are probably more optimizations you can do, the nice thing about numba is that I obtained a x15 speed up without delving into or changing significantly how your code is implemented.
A couple of general observations:

*

*in Neighbors, the argument/parameter n is not used, so you should remove it for clarity (or update the code)

*in Python, you generally want to use lowercase for function names and variables. Uppercase it usually reserved for Classes (not objects) and "global" variables

*Your comment above about largest_primes_under being called only once is definitely spot on, I should have looked better at the code.

premature optimization is the root of all evil

A: Thanks for the code, which I found very useful for supporting a course on Monte Carlo that I'm developing (and also to Giorgio for the optimizations). However, I believe there may be a critical flaw in your original code above, which leads to problems in simulating above or around the critical point.
I believe that the line
z = np.random.choice(n)

should be
z = np.random.choice(orientations)+1

otherwise the code will not be able to escape from a configuration where all neighbouring spins have the same orientation. This is particularly important when looking at the limiting case of Ising model (orientations = 2) above the critical point (kT/J = 2.27, which in your code would mean changing the beta factor from 2.5 to 0.441).
Hope this is helpful.


text:
Q: Submenu for services I have written a small application and want to allow other applications to share data with it.
My first idea was to integrate it into the service menu. However, I need dynamically populated submenus and the Apple dev page for System Services states that "There are no submenus in the Services menu" since 10.6.
Are there any alternatives for integrating into the context menu of other applications and having submenus?

A: A better place to ask is probably the programmer forum https://stackoverflow.com/questions/tagged/osx
But offhand I think you can make a few different variants of your .app each one registering their own Services action.  Those variants could then launch your "main" app to do the heavy lifting.
These variants could be bundled inside the main application, like I see some examples here:

/Applications/Adium.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app
/Applications/Android File Transfer.app/Contents/Frameworks/Breakpad.framework/Versions/A/Resources/crash_report_sender.app
/Applications/Android File Transfer.app/Contents/Resources/Android File Transfer Agent.app
/Applications/Android File Transfer.app/Contents/Resources/Android File Transfer Agent.app/Contents/Frameworks/Breakpad.framework/Versions/A/Resources/crash_report_sender.app
/Applications/Google Chrome Canary.app/Contents/Versions/26.0.1400.0/Google Chrome Framework.framework/Resources/app_mode_loader.app
/Applications/Google Chrome Canary.app/Contents/Versions/26.0.1400.0/Google Chrome Framework.framework/Resources/crash_report_sender.app
/Applications/Google Chrome Canary.app/Contents/Versions/26.0.1400.0/Google Chrome Helper EH.app
/Applications/Google Chrome Canary.app/Contents/Versions/26.0.1400.0/Google Chrome Helper NP.app
/Applications/Google Chrome Canary.app/Contents/Versions/26.0.1400.0/Google Chrome Helper.app
/Applications/Quicksilver.app/Contents/Resources/QSDroplet.app
/Applications/Stainless.app/Contents/Helpers/StainlessClient.app
/Applications/Firefox.app/Contents/MacOS/crashreporter.app
/Applications/Firefox.app/Contents/MacOS/plugin-container.app
/Applications/Firefox.app/Contents/MacOS/updater.app
/Applications/TextMate.app/Contents/SharedSupport/Bundles/ActionScript.tmbundle/Support/bin/XTrace.app
/Applications/TextMate.app/Contents/SharedSupport/Support/bin/CocoaDialog.app
/Applications/TextMate.app/Contents/SharedSupport/Support/bin/CommitWindow.app
/Applications/Xcode.app/Contents/Applications/Accessibility Inspector.app
/Applications/Xcode.app/Contents/Applications/Application Loader.app
/Applications/Xcode.app/Contents/Applications/FileMerge.app
/Applications/Xcode.app/Contents/Applications/Instruments.app
/Applications/Xcode.app/Contents/Applications/OpenGL ES Performance Detective.app
…

A: One alternative might be the AppleScript menu. It presents all scripts in the ~/Library/Scripts/ folder, and preserves the hierarchy of subfolders.
Issues:

*

*You'd have to build AppleScript support into your app.

*You'd have to build a bunch of AppleScripts to expose your functionality.

*The AppleScript menu is disabled by default.

*It's a kludgy hack.

A: Another alternative would be to expose only the top-level services, and then make it your app's responsibility to display the "submenu" choices.
This lends the benefit of putting you in control of keyboard shortcuts for the secondary choices. The user also gains a cleaner list of services.


text:
Q: Code give me segmentation fault I don't know why my code gives me a segmentation fault.
Before it worked fine, so i must have done something to it,
but I don't know what.
This function gets some Markdown-Elements from a specific line in a file
and returns a dynamic array ( int * elements) with the elements
int * parser_getElements(char * string)
{

int * elements;

char * token, * temptoken;
int charcount = 0, elemcount = 1, i = 0;

assert(string != NULL);

elements = malloc(sizeof(int));
*elements = 0;

token = strtok(string," ");

while(token != NULL)
{
    temptoken = token;
    while (*temptoken)
    {
        charcount++;
        ++temptoken;
    }

    if(token[0] == '*' && token[charcount - 1] == '*')
    {

        if(token[1] == '*' && token[charcount - 2] == '*')
        {
            elements[elemcount-1] = EMPH;
        }
        else
        {
            if(token[1] != '*' && token[charcount - 2] != '*')
            {
                elements[elemcount-1] = ITAL;
            }
        }
        elemcount++;
        elements = realloc(elements,sizeof(int) * elemcount);
    }
    else if(token[0] == '_' && token[charcount - 1] == '_')
    {

        if(token[1] == '_' && token[charcount - 2] == '_')
        {
            elements[elemcount-1] = EMPH;
        }
        else
        {
            if(token[1] != '_' && token[charcount - 2] != '_')
            {
                elements[elemcount-1] = ITAL;
            }
        }
        elemcount++;
        elements = realloc(elements,sizeof(int) * elemcount);
    }

    else
    {
        elements[elemcount-1] = TEXT;
        elemcount++;
        elements = realloc(elements,sizeof(int) * elemcount);
    }

    token = strtok(NULL, " ");
    charcount = 0;
}

return elements;
}

The problem occurs in the function below.
void parser_printMDElements(List markdown, FILE * out)
{
MD_Element element;
int count = 0, no_text = 0;

if(markdown != NULL)
{

    element = markdown->value->elements[0];

    while(element <= EMPH)
    {
        if(element > TEXT)
        {
            no_text = 1;
        }
        count++;
        element = markdown->value->elements[count];
    }

    count = 0;
    element = markdown->value->elements[0];

    while(element <= EMPH)
    {
        if(no_text)
        {
            printf("%s\n",MD_Element_Descr[element]);
        }
        count++;
        element = markdown->value->elements[count];
    }

    parser_printMDElements(markdown->next,out);
}
}

This line(first appearance)
element = markdown->value->elements[0];

gives me a segmentation fault and I don't know why.
The program stops after this line.
This is the main program
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "errors.h"
#include "parser.h"

int main(int argc, char * argv[])
{

Errorcode error = ERR_NULL;
char * gap;
int gapcount = 1;
List md = parser_newList();

/** Save name of document in firstnode */
md->value = malloc(sizeof(struct NodeValue));
md->value->string = argv[1];
md->type = DOCUMENT;

md->next = malloc(sizeof(struct Node));

error = parser_parseFile(argv[1],&(md->next));
if(error == ERR_NULL)
{
    gap = malloc(sizeof(char));
    *gap = '\0';
    parser_printMDElements(md, gap, gapcount, stdout);
    printf("\n");
}

return 0;
}

This code is extracted from parser.h
enum MD_Element
{
    DOCUMENT,
    LINE,
    SECTION,
    LISTELEMENT,
    H1,
    H2,
    H3,
    H4,
    H5,
    H6,
    TEXT,
    IMG,
    LINK,
    QUOTE,
    CODE,
    ITAL,
    EMPH
};

typedef enum MD_Element MD_Element;

typedef struct NodeValue * NodeValue;

struct NodeValue
{
    char * string;
    int * elements;
};

typedef struct Node * Node;

struct Node
{
    MD_Element type;
    NodeValue value;
    Node next;
};

typedef Node List;

Can sb. tell me what I've done wrong?
Thanks!

A: There are still many pieces of your code missing here.
I'm guessing that your problem is possibly in md->value->string = argv[1];.
(athough your question does not show how you are using md->value->string).
If you attempt to change the contents of the memory pointed by md->value->string, then you will have a memory access violation, since this variable is pointing to a read-only memory segment.
If that is indeed the case, then you can solve it by replacing md->value->string = argv[1]; with:
md->value->string = malloc(strlen(argv[1])+1);
strcpy(md->value->string,argv[1]);


text:
Q: Scala/Slick plain SQL: retrieve result as a map I have a simple method to retrieve a user from a db with Sclick plain SQL method:
object Data {

    implicit val getListStringResult = GetResult[List[String]] (
        prs => (1 to prs.numColumns).map(_ => prs.nextString).toList
    )

    def getUser(id: Int): Option[List[String]] = DB.withSession {
        sql"""SELECT * FROM "user" WHERE "id" = $id""".as[List[String]].firstOption
    }

}

The result is List[String] but I would like it to be something like Map[String, String] - column name and value pair map. Is this possible? If so, how?
My stack is Play Framework 2.2.1, Slick 1.0.1, Scala 2.10.3, Java 8 64bit

A: import scala.slick.jdbc.meta._
val columns = MTable.getTables(None, None, None, None)
                    .list.filter(_.name.name == "USER") // <- upper case table name
                    .head.getColumns.list.map(_.column)
val user = sql"""SELECT * FROM "user" WHERE "id" = $id""".as[List[String]].firstOption
                                                         .map( columns zip _ toMap )

A: It's possible to do this without querying the table metadata as follows:
   implicit val resultAsStringMap = GetResult[Map[String,String]] ( prs =>
      (1 to prs.numColumns).map(_ =>
         prs.rs.getMetaData.getColumnName(prs.currentPos+1) -> prs.nextString
      ).toMap
   )

It's also possible to build a Map[String,Any] in the same way but that's obviously more complicated.


text: Q: High CPU usage when typing in TexMaker. Is this normal? Background: I am a beginner at LaTex. I didn't know how to install LaTex and packages properly. I remember installing the Tikz/PGF package, but I don't know how. Then after assuming that everything was good to go, I proceeded to learn to write in LaTex for a few days. However, when I write my LaTex document, my CPU usage ramps up to 100%. Is this expected?


text:
Q: How does MPlayer recognize an MJPEG stream? Since MJPEG over http consists basically on the transmission of a series of JPEG  images seperated by a defined seperator, how does MPlayer recognize that it is an MJPEG stream?
Thank you

A: Have a look at:
MplayerMjpegStreamViewing < Motion < Foswiki
e.g.
mplayer -fps 4 -demuxer lavf http://rpi-6:8080/?action=stream

does the job for me. Suitable for a streaming server running on a Raspberry like this:
/usr/local/bin/mjpg_streamer -o output_http.so -w ./www -i input_raspicam.so -x 1920 -y 1440 -fps 3 -hf -vf


text:
Q: SSH: What's the difference between -L and -R? I looked at the ssh manual (man ssh) and read the definitions for -L and -R option but don't quite understand the difference. Both seem capable of forwarding requests to a desired host and port. Can someone trying explaining the difference to a kid... What's the primary different between the two options?

A: It's right there, in the man page:

-L
Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on the remote side.
-R
Specifies that connections to the given TCP port or Unix socket on the remote (server) host are to be forwarded to the local side.

(highlighting by me)
The difference is the direction. -L forwards local to remote, -R the reverse.


text:
Q: Add a field with value to all existing Solr documents I want to add a field with value to all my existing Solr documents. I was searching a lot online but can't find a clear way to do it. I need to be able to search/filter documents by that field as well.
Edit: Added clarification - I want to update all existing documents with this new field and value as well.

A: A default value that will be added automatically to any document that does not have a value in this field when it is indexed.
If this property is not specified, there is no default.
e.g.
<field name="timestamp" type="date" indexed="true" stored="true" default="NOW" />

Please refer the Solr Documentation
Another option to it partial update of the documents as below
{
 "id": "123",
 "name" : "Solr Updates"
}

Lets add an author field to the document the field value would be a json object with "set" attribute and the field value
$ curl http://localhost:8983/solr/update -H 'Content-type:application/json' -d '
[
 {"id"       : "123",
  "author"   : {"set":"Robert Wark"}
 }
]'

Your new document will look like as below after you query
$ curl http://localhost:8983/solr/get?id=123

The updates document is :
{
 "doc" : {
    "id"    : "123",
    "name"  : "Solr Updates"
    "author": "Robert Wark"
 }
}

Please refer the below Updating parts of DOcuments
Using Java and Solrj api it can be done as follows.
SolrInputDocument doc = new SolrInputDocument();
Map<String, String> partialUpdate = new HashMap<String, String>();
partialUpdate.put("set", "Robert Wark");
doc.addField("id", "123");
doc.addField("author", partialUpdate);

A: For people who might have the same or similar problems in the future:
My Solr configuration was kept in Java, not in xml files, so I decided to do the whole update process in Java as well. First add the new field to the configuration, then read in a batch of documents, check if the new field value is null - it should be since we just added it, then set the field with new value and save. Do it in batches so you don't run out of memmory by reading in too many documents at once.


text:
Q: ECDH VS. DH benchmarking in JAVA This questions was previously posted on crypto.exchange, however since my problem still remain i thought perhaps this could be more of a programming detail that i might have overlooked and not something theoretical.
So basically my problem is the odd result i get when measuring the time it takes to generate a ECDH key in java vs. the time it takes to generate a DH key.
I compare the time it takes to generate:

*

*192bit ECDH-key to a 512bit DH-key

*224bit ECDH-key to a 1024 DH-key

Now I expected the ECDH key pair generation to beat regular DH keys due to difference in key size, however that is not the case when I do it. Perhaps I'm measuring this wrong or is there another explanation.
    public void generateKeyPair() {

    try {

        keyfactory = KeyFactory.getInstance("ECDH");

        keyPairGenerator = KeyPairGenerator.getInstance("ECDH", "BC");

        //NIST EC-Curve P-224"
        org.bouncycastle.jce.spec.ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec(EllipticCurveDiffieHellman.curveNames.get(new Integer(224)));

        keyPairGenerator.initialize(ecSpec, new SecureRandom());

    int num = 10;

        /* Warm up */
        for (int wRound = 0; wRound < 200; wRound++) {
            keyPairGenerator.generateKeyPair();
        }

        /*
         * Finding the right number of iterations such that we iterate for
         * at least 2s
         */
        for (;;) {

            long begin = System.currentTimeMillis();

            for (int i = 0; i < num; i++) {

                keypair = keyPairGenerator.generateKeyPair();
            }

            long end = System.currentTimeMillis();

            long time = end - begin;

            if (time >= 2000) {
                System.out.printf("Average keygen time: %.2f ms\n",
                        (double) time / num);
                break;
            }

            num *= 2;
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
}


text:
Q: Use injected service from JS code to static Blazor method I have an app that uses a jQuery lib to show 'confirmation' dialogs.
When a user clicks 'OK' or 'Cancel' on the dialog, then first a callback is made to my Javascript code. From there I do a call to a Blazor method, based on the decision the user made.
This all looks something like this:
My js code:
$('.alert-yesno).on('click', function() {
    // For simplicity I immediately call the Blazor method
    DotNet.invokeMethodAsync('[Assembly name]', 'DoSomething')
                            .then(data => {
                                // do something...
                            });
});

Blazor page:
@inject MyService MyService

<button class="alert-yesno">Show dialog</button>

@code
{
    [JSInvokable]
    public static async Task DoSomething()
    {
        // How to use the non static MyService here...?
    }
}

This all works fine. The Javascript part calls my Blazor method. But how can I use MyService from there? This is injected into the page. Which is good, because it makes use of dependency injection.
I don't want to create a new instance everytime from within the static method, because that way I loose all the auto injected dependencies.
How can I solve this issue?

A: See https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interop?view=aspnetcore-3.0#instance-method-call for a more complete example, but you can pass a reference to the the .net instance to the javascript code by calling
DotNetObjectReference.Create(myInstance);

Then the javascript code can call the instance method on that object. Since the component (and thus the service which is injected into it) has a potentially different lifespan than the jquery click handler, this might cause some other issues, but the link above should be a good starting point.


text:
Q: How do I change the color of the menu bar for a specific page in Android studio? In my app, I have the menu bar set for one color on the home screen, but my app would look a lot better if it could be a different color on different screens. What's the best way to do this?

A: Search in your project directory for app>res>values>colors.xml . Once you open the file search for "ColorPrimary" and a code with the likes of "#e65100". That code represents the color for you app bar, and one way you can change is to visit: https://material-ui.com/style/color/ and copy the code for your color of choice. The other way is to click on the small rectangle on the left and a color picker should pop up. To use different color for each activity, I'd suggest to edit that color code through java code each time the activity is started. I hope that helps.


text:
Q: Mouse and keyboard take long time to activate when disks are connected When booting up Windows 7, my mouse and keyboard (USB) take a small while before they are operational, depending on the number of external hard disk drives connected to the PC during boot (also USB).
For example, if I have no external disks on, the mouse and keyboard are operational immediately. If I have one disk on, they may take 2-3 seconds to activate. If I have two, they take about double this time, and so on.
The problem is that the system in question has a large array of disks, both internal and external (7 external disks to be exact, 4 of them through a hub) and if they are all connected during boot, the mouse and keyboard will take about 20-30 seconds to activate.
If these disks are connected after Windows has booted, there is no problem with the mouse and the keyboard, but it's inconvenient to do that every time. The OS is installed on a solid state drive (but the behavior and the times were the same when the OS was on a mechanical hard disk drive).
What is the reason for this and (more importantly) are there any convenient (software-based, preferably) workarounds?

A: Because they're all sharing the same USB bus, the 7 external have to be spun-up and checked first, in case one of them holds system data.
So the USB device polling probably stops until all 7 of those drives are checked.
Ensure the devices (specifically the mouse/Kb vs. the drives) are a on separate USB "hubs" (not a physical hub, but the internal "hubs" listed in the Device Manager), or perhaps add an additional/separate USB controller (example) and connect either the drives or the mouse/KB to it.


text:
Q: Using pg_restore with a remote file I'm trying to use pg_restore to restore my database from a remote file stored in an amazon S3 bucket.
I tried to do this : pg_restore -c -d mydb https://myfileURL but it doesn't work, it says there is no such file or directory. The URL is fine, it's just that it can't get the file from it.
Which makes sense somehow but how can I do such a thing then ?
Perhaps there is a way to do something like this : https://myfileURL > dump.tmp and then executing pg_restore with the created file ?
Not sure if it could be a solution but I don't want to use the AWS CLI.

A: Download the file first:
wget https://myfileURL -O dump.tmp
pg_restore -c -d dump.tmp

A: If you are using PgAdmin4 I've found that if you copy & paste the script to a new SQL window the actual errors show up.


text:
Q: Не компилится solidity Компилирую вот по этому ману.
Вылетает такая ошибка:
[ 25%] Building CXX object libsolidity/CMakeFiles/solidity.dir/codegen/CompilerUtils.cpp.o
/home/dar/solidity/libsolidity/codegen/CompilerUtils.cpp: В функции-члене «void dev::solidity::CompilerUtils::convertType(const dev::solidity::Type&, const dev::solidity::Type&, bool, bool, bool)»:
/home/dar/solidity/libsolidity/codegen/CompilerUtils.cpp:788:3: ошибка: this statement may fall through [-Werror=implicit-fallthrough=]
   }
   ^
/home/dar/solidity/libsolidity/codegen/CompilerUtils.cpp:790:2: замечание: here
  default:
  ^~~~~~~
cc1plus: все предупреждения считаются ошибками
make[2]: *** [libsolidity/CMakeFiles/solidity.dir/build.make:543: libsolidity/CMakeFiles/solidity.dir/codegen/CompilerUtils.cpp.o] Ошибка 1
make[1]: *** [CMakeFiles/Makefile2:275: libsolidity/CMakeFiles/solidity.dir/all] Ошибка 2
make: *** [Makefile:130: all] Ошибка 2

Что могло пойти не так?

A: Скорее всего, у вас включён флаг -Werror. Его можно отключить целиком (найти поиском в CMakeList), или отключить конкретную проверку, добавив -Wno-error=implicit-fallthrough к флагам компиляции. Ну или можно подправить исходники, чтобы для каждого case был свой break.
Кроме того, если я правильно понял, это только на gcc-7 работает, разработчики добавили флаг в основном в связи с добавлением в C++17 атрибута [[fallthrough]]. Из-за этого добавление -Wno-error=implicit-fallthrough приведет к сбою для более старых версий gcc.