classification – Random dependency Select the dependence of the complexity of time in k: the index to be selected

I was analyzing the complexity of the Quick Random Selection time, as a function of n – the size of the input, and k – the index of the element to be selected.
The dependence of time complexity on n was linear as expected, but the dependence of k was on an inverted parabola, that is, the complexity of time was greater when trying to select the median and the lowest when trying to select the first or last element of the matrix.

Is there an explanation for that?

How to avoid dependency on time? [on hold]

We are developing a payroll system and everything depends on time. Here are some examples that affect the salary:

  • The time an employee signs the agreement.
  • The time he enters the office and the time he leaves.
  • The history of the employee's shift plan (his previous salaries must be calculated based on his older shift plans)
  • Time for requesting your vacation (and if it has been in your work hours).
  • Your mission time (and if it's been in your work hours).
  • The time we pay you, and so on!

If the hardware date changes accidentally, the system can be seriously damaged due to invalid data entry. How to eliminate dependence over time?

magento2.3 – Change of the arguments of a specific injectable dependency Magento 2.3

I'm trying to change the arguments of a specific injectable dependency. The class in question is:
Magento Customer Block Adminhtml Edit Tab View PersonalInfo

The construct of this class looks like:

public function __constructed (
 Magento  Backend  Block  Template  Context $ context,
AccountManagementInterface $ accountManagement,
 Magento  Customer  Api  GroupRepositoryInterface $ groupRepository,
 Magento  Customer  Api  Data  CustomerInterfaceFactory $ customerDataFactory,
 Magento  Customer  Helper  Address $ addressHelper,
 Magento  Framework  Stdlib  DateTime $ dateTime,
 Magento  Framework  Registry $ registry,
Mapper $ addressMapper,
 Magento  Framework  Api  DataObjectHelper $ dataObjectHelper,
 Magento  Customer  Model  Logger $ customerLogger,
array $ data = []
) {
$ this-> coreRegistry = $ registry;
$ this-> accountManagement = $ accountManagement;
$ this-> groupRepository = $ groupRepository;
$ this-> customerDataFactory = $ customerDataFactory;
$ this-> addressHelper = $ addressHelper;
$ this-> dateTime = $ dateTime;
$ this-> addressMapper = $ addressMapper;
$ this-> dataObjectHelper = $ dataObjectHelper;
$ this-> customerLogger = $ customerLogger;

parent :: __ construct ($ context, $ data);
}

I want to include 3 additional classes without the requirement to copy the constructor in my class, therefore, in the di.xml of my module I have:


    
        
            Magento  Framework  Pricing  Helper  Data
            Provider  Module  Assistant  helper
            Supplier  Module  Model  ResourceModel  CollectionFactory
        
    

Then my class looks like this:

class myClass extends  Magento  Customer  Block  Adminhtml  Edit  Tab  View  PersonalInfo
{

public function myFunction ()
{

$ collection = $ this-> myCollectionFactory-> create ();

}

}

However, it does not work and I get the error of

Fatal error: Error not detected: call to a member function create ()

What am I doing wrong?

erlang – Phoenix: The dependency could not be compiled: ranch

Background

I have created a project using mix new my_app --no-ecto and everything looked good. However, I can not execute the created project.

Error

When I execute mix phx.server (After running mix deps.get)I got the following error:

===> Ranch compilation
===> The command & # 39; OTP & # 39; it is not found in the namespace
** (Mix) The dependency could not be compiled: ranch, "/home/admanmedia/.asdf/installs/elixir/1.7.3-otp-21/.mix/rebar3 bare compile --paths" / home / admanmedia / Workspace / An error occurred in the functional web development with Elixir, OTP and Phoenix / islands_interface / _build / dev / lib / * / ebin "". You can recompile this dependency with "mix deps.compile ranch", update it with "mix deps.update ranch" or clean it with "mix deps.clean ranch"

OS and language information

Dealer ID: Ubuntu
Description: Ubuntu 19.04
Release: 19.04
Name in code: disk

elixir 1.7.3-otp-21
erlang 21.1    

What am I doing wrong?

c # – Dependency injection error

insert the description of the image here

I am using xUnit to perform my tests, I'm trying to access my. ChampionshipsController, so I have to pass the value shown in the image as a parameter, but I am receiving the following error.

They would know how to help me.

My test class:

public class ChampionshipTest
{
private const string IdReturnsOk = "2021";
private const string IdNotFound = "XXXX";

(in English).

private readonly ICompetitionService _competitionManager;

public ChampionshipTest (
Competitive competitionManager)
{
_competitionManager = competitionManager;

_campeonato = new ChampionsController (_competitionManager);
}

    [Fact]
    public async Task Championship_GetById_ValuesReturnsOkResponse ()
{
var response = await _campeonato.Get (IdReturnsOk);

var objectResponse = response to ObjectResult;

Assert.Equal (200, objectResponse.StatusCode);
}

    [Fact]
    public async Task Championship_GetById_ReturnsNotFoundResponse ()
{
var answer = expected _campeonato.Get (IdNotFound);

var objectResponse = response to ObjectResult;

Assert.Equal (404, objectResponse.StatusCode);
}
}

And here is my Controller:

public class ChampionshipsController: ControllerBase
{
private readonly ICompetitionService _competitionManager;

public ChampionsController (
Competitive competitionManager)
{
_competitionManager = competitionManager;
}

// GET api / championships / 5
    [HttpGet("{id}")]
    public async Task Get (string id)
{
HttpResponseMessage respToken = await _competitionManager.GetIdCompetitionAsync (id);

string content = respToken.Content.ReadAsStringAsync (). Result;

if (respToken.StatusCode == HttpStatusCode.OK)
{
return Ok (content);
}
other
{
return StatusCode (StatusCodes.Status500InternalServerError);
}
}

}

Can a person apply for a German dependency visa from a country other than their country of residence?

I want to apply for a dependency visa for my husband, since I am traveling to Germany for a long time at work. My husband is currently working in Singapore since the last 8 months. Can you apply for a dependent visa at the German consulate in Singapore?

c # – Class of container for the system dialog to allow dependency injection

The next class is a wrapper for Microsoft.Win32.SaveFileDialog. I have implemented the use of Microsoft.Win32.SaveFileDialog in this way because I'm using the ISaveFileDialog Interface as a dependency throughout my code base.

public class SaveFileDialog: ISaveFileDialog
{
Public bool Save (content string, string SuggestFileExtension = null, string suggestFileExtensionName = null, string SuggestFileName = null)
{
string filter = "All files | *. *";

if (SuggestFileExtension! = null)
{
filter = $ "{SuggestFileExtensionName? string.Empty} | * {SuggestFileExtension} |" + filter;
}

Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog
{
FileName = SuggestFileName ?? string.Empty,
DefaultExt = SuggestFileExtension ?? string.Empty,
Filter = filter
};

switch (dlg.ShowDialog ())
{
true case:
returns WriteFile (dlg.FileName, content);
default:
false return;
}
}

private bool WriteFile (string filePath, string content)
{
try
{
File.WriteAllText (filePath, content);
true returns
}
capture (PathTooLongException)
{
false return;
}
capture (DirectoryNotFoundException)
{
false return;
}
capture (IOException)
{
false return;
}
capture (UnauthorizedAccessException)
{
false return;
}
catch (System.Security.SecurityException)
{
false return;
}
}
}

While this is working, I am struggling to refactor this class to allow unit tests since there is currently no way to simulate / reject the Microsoft.Win32.SaveFileDialog – Have I missed a trick here? Or is there really a nice way to do a unit test and should you rely on integration tests?


I know I could refactor the capture blocks to be

capture (Exception)
{
false return;
}

Or even be

catch (Exception ex) when (ex is PathTooLongException
|| ex is DirectoryNotFoundException
........)
{
false return;
}

But I'd like to keep them as they are because I'd like to avoid catching all the exceptions and I'm using a Visual Studio add-on to help me manage the exceptions and complain when I use the second option.

Thanks for any help!

asp.net – Object reference ServiceLocator.Current not set for dependency injection in ASPX?

I am trying to check an ASPX code but the following line sends me an error of object reference not established (ServiceLocator.Current), I ask that if there is someone who can put me in context about what I need so that I do not have the error

var solr = ServiceLocator.Current.GetInstance <ISolrOperations> ();

in ubuntu 18.04 and 19.04 the required dependency can not be added: pbutils of gstreamer

I have the following

meson.build:49:02: ERROR: the dependency "gstreamer-pbutils-1.0" is not found

I want to know the necessary dependencies. the previous one was:

meson.build:48:0: ERROR: dependency "gstreamer-1.0" was not found

but that was solved with the website and instructions from gstreamer: https://gstreamer.freedesktop.org/documentation/installing/on-linux.html?gi-language=c#install-gstreamer-on-ubuntu-or- debian

however, I can not find any way to install gstreamer-pbutils-1.0.

This page is not very helpful:
https://gstreamer.freedesktop.org/documentation/gst-plugins-base-pbutils-1.0/gstpbutils.html?gi-language=c#pbutils-page

It seems that they assume that the pbutils utils would be sent with the instructions they gave.

I'm in ubuntu 19.04

bitcoind – add dependency on mysql configure.ac bitcoin

I'm working on the bitcoin code, my goal is to move the data from the block chain to relational db, but I can not solve the mysql dependency for different platforms, the platform includes mac and ubuntu. I tried to give static and dynamic dependence, but both things do not work at all.

    [--with-mysql=[--with-mysql=[--with-mysql=[--with-mysql=     path of the root directory of the MySQL installation],
    [MYSQL_lib_check="$with_mysql/lib/mysql $with_mysql/lib"
MYSQL_inc_check="$with_mysql/include/mysql"],
    [MYSQL_lib_check="/usr/local/mysql/lib/mysql /usr/local/lib/mysql /opt/mysql/lib/mysql /usr/lib/mysql /usr/local/mysql/lib /usr/local/lib /opt/mysql/lib /usr/lib"
MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql /opt/mysql/include/mysql /usr/include/mysql"])

AC_ARG_WITH (mysql-lib,[--with-mysql-lib =[--with-mysql-lib =
    [--with-mysql-lib= directory path of the MySQL library installation],
    [MYSQL_lib_check=$with_mysql/lib/mysql])

AC_ARG_WITH (mysql-include,[--with-mysql-include =[--with-mysql-include =
    [--with-mysql-include=
                          directory path of the MySQL header installation],
    [MYSQL_inc_check=$with_mysql/include/mysql])

AC_MSG_CHECKING ([for MySQL library directory])
MYSQL_libdir =
for m in $ MYSQL_lib_check; do
if you try -d "$ m" && 
(test -f "$ m / libmysqlclient.so" || test -f "$ m / libmysqlclient.a")
so
MYSQL_libdir = $ m
break
fi
fact

while I was configuring, I was trying to give a path to the installation directory, ie ./configure –with-mysql = / path configured correctly, but when I run the make command, the exception "_get_driver_instance", referenced from: makeConnection () in libbitcoin_wallet.a (libbitcoin_wallet_a-walletdb.o)

I may not be on the right track, help me if you have any ideas on how to make a file system.

Any help is appreciable, thanks.