Do I really need apt-daily.service and apt-daily-upgrade.service?

The startup with 18.04 seems to take a bit longer than 17.10 so I ran systemd-analyze blame and found that apt-daily.service and apt-daily-upgrade.service are taking up over three minutes between them.

:~$ systemd-analyze time
    Startup finished in 9.173s (kernel) + 3min 30.201s (userspace) = 3min 39.375s
    graphical.target reached after 15.268s in userspace
:~$ systemd-analyze blame
    1min 52.265s apt-daily-upgrade.service
    1min 27.579s apt-daily.service
          6.603s NetworkManager-wait-online.service
          5.105s plymouth-quit-wait.service
          1.517s plymouth-start.service
          1.439s dev-sda1.device.............

So, what are these services actually doing (checking apt is up to date I imagine), why do they take so long and do I really need them to run on every bootup?

Why to verify domain in G Suite, Atlassian or for any business service? [on hold]

I am looking into setting up business accounts for G Suite, Atlassian and Zoho. All 3 wants to verify domain before they provide access to any of the service. My question is,

Why domain verification is required for business accounts when email verification will work fine?

Any help will be appreciated.

Can you send console commands to a node-based systemd service?

I have a simple node.js script that accepts console commands using readline. I’ve set it up to run as a systemd service (on Debian 9):

[Unit]
Description=Web Game Server

[Service]
ExecStart=/usr/bin/node /var/www/index.js
Restart=always
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target

When running directly from the console with node index.js I’m able to send commands to it through the console. Is there any way to do this while it’s running as a service?

Has the civil service law ever been challenged in court by a president?

The Pendleton Civil Service Reform Act is one of the main reason why Federal employees often considered themselves as having a lifetime tenure, unable to be fired. Although the act certainly had a valid motive, nevertheless, it would seem to be an unconstitutional violation of the separation of powers, Congress infringing on the ability of the President to run the executive branch the way he wants.

Has any president ever attempted to challenge the law by firing mid-level civil service workers?

Why to verify domain in G Suite, Atlassian or for any business service?

I am looking into setting up business accounts for G Suite, Atlassian and Zoho. All 3 wants to verify domain before they provide access to any of the service. My question is,

Why domain verification is required for business accounts when email verification will work fine?

Any help will be appreciated.

Como enviar um objeto via Web service SOAP

Para enviar um dado primitivo é simples, porém quando se trata de dados complexos como o mostrado abaixo, uma exceção é lançada:

java.lang.RuntimeException: Cannot serialize: Pessoa{nome=dado, endereco=dado etc…}

A maioria dos tutoriais e exemplos abordam o uso de tipos primitivos e não de tipos complexos como a questão aqui apresenta.

Dado um objeto representado abaixo:

public class Pessoa {
    private String nome;
    private String endereco;
    private List emails;
    private boolean ativo;

    // getters e setters

    @Override
    public String toString(){
        return "Pessoa{nome="+dado+", endereco="+dado+" etc...}";
    }
}

Como enviá-lo para um serviço Web com o padrão SOAP utilizando a biblioteca kSOAP?

Azure Service Fabric – Designing a Calculation Engine

Suppose I have the following devices:
Device A
Device B
Device C
(…)

Also, for each device, I have the following measurements:
Measurement 1
Measurement 2
(…)

Each measurement event includes a measurement id (int), a date (DateTime) and a value (double).

What I’m trying to achieve is, in an event driven scenario, how would you design a calculation engine where, for each device, you want to calculate new measurements based on triggered events which we receive from the device’s measurements?

Key problems I’m trying to address here

  • Which components of Service Fabric should be used? Assume we have around 10.000 devices times 200 measurements. We can use external services like Rdis Cache or some memory based store (trying to avoid disk writes..)

  • Some calculations requires that a previous calculation is completed before its finished. Example:

    DeviceA.CalculatedMeasurement1 = DeviceA.Measurement1 + DeviceA.Measurement2
    DeviceA.CalculatedMeasurement2 = DeviceA.CalculatedMeasurement1 x DeviceA.Measurement3

  • Some calculations just aggregate data. Like hourly aggregations or daily aggregations. How would you trigger this kind of calculations since they can only be triggered if all the events are received for that particular hour or day?

I’m just looking for something to start with. Right now I’m kinda lost with all the options we have. If someone can point me to the right direction to approach this issues will be much appreciated.
Thank you for your time!

How to test a WCF service with JMeter when the WCF method accepts parameter as an Stream Object

There is a WCF service. The method i have to access has 1 parameter as input whoes type is Stream.

I don’t know how to provide stream object from JMeter to the WCF service.

Currently i have written a C# method (MVC Project) which accepts string from JMeter and then converts it into Stream type object, Which is than processed by the WCF service. But this approach does not give does not give the actual performance of the WCF service

Multitenant Service + UoW + Repository pattern

I’m currently working on a multitenant application with Service + UoW + Repository pattern and I’m curious if I’m using the correct approach and see if I can improve anything.

I am injecting services into my controllers

public class SomeController : BaseController
{
    public ISomeService SomeService { get; set; }

    public SomeController( ISomeService someService )
    {
        this.SomeService = someService;
    }

    public IActionResult Edit( Guid id )
    {
        var something = this.SomeService.Get( id );
        if ( something == null )
        {
            return StatusCode( 404 );
        }

        var vm = new SomeViewModel( person );
        vm.Title = "Edit something";

        return View( vm );
    }
}

My services look something like this:

public class SomeService : ISomeService
{
    private IUnitOfWork _uow;

    public SomeService( SomeDbContext dbContext )
    {
        _uow = new UnitOfWork( dbContext );
    }

    public Something Add( Something something )
    {
        var created = _uow.Something.Add( something );
        var saved = _uow.Save( );
        if(save)
        {
            return created;
        }

        return null;
    }
}

This UnitOfWork is implemented like this:

public class UnitOfWork : IUnitOfWork
{
    private readonly SomeDbContext _context;

    public ISomethingRepository Something { get; private set; }

    public UnitOfWork( SomeDbContext context )
    {
        _context = context;
        Something = new SomethingRepository( _context );
    }

    public void Dispose( )
    {
        _context.Dispose( );
    }

    public int Save( )
    {
        return _context.SaveChanges( );
    }
}

The repositories look like this:

public class SomethingRepository : Repository, ISomethingRepository
{
    public SomethingRepository( SomeDbContext context )
        : base( context )
    {
    }

    public IEnumerable GetSomethingSpecific( )
    {
        return SomeDbContext.Something.Where( w => w.Type == SomethingType.Special );
    }

    public SomeDbContext SomeDbContext
    {
        get { return Context as SomeDbContext; }
    }
}

The inherented generic base class is implemented like this:

public class Repository : IRepository where TEntity : class
{
    protected readonly DbContext Context;

    public Repository( DbContext context )
    {
        this.Context = context;
    }

    public TEntity Get( Guid id )
    {
        return Context.Set( ).Find( id );
    }

    public IEnumerable Find( Expression> predicate )
    {
        return Context.Set( ).Where( predicate );
    }

    public IEnumerable GetAll( )
    {
        return Context.Set( ).ToList( );
    }

    public TEntity Add( TEntity entity )
    {
        return Context.Set( ).Add( entity )?.Entity;
    }

    public void AddRange( IEnumerable entity )
    {
        Context.Set( ).AddRange( entity );
    }

    public void Remove( TEntity entity )
    {
        Context.Set( ).Remove( entity );
    }

    public void RemoveRange( IEnumerable entity )
    {
        Context.Set( ).RemoveRange( entity );
    }
}

The injected (EF Core) DbContext looks like this:

public class SomeDbContext: IdentityDbContext
{
    private ITenantProvider _tenantProvider;

    public SomeDbContext( DbContextOptions options, ITenantProvider tenantProvider )
        : base( options )
    {
        _tenantProvider = tenantProvider;
    }

    public SomeDbContext( )
    {
    }

    public DbSet Something { get; set; }

    protected override void OnModelCreating( ModelBuilder builder )
    {
        base.OnModelCreating( builder );

        builder.Entity( )
            .HasQueryFilter( p => p.TenantId == _tenantProvider.GetTenantId( ) );
    }
}

And the injectedITenantProvder had just one method that get’s the tenantId from hostname, headers or url parameter:
First, I have a TenantProvider that return the current tenantId based on either hostname or url parameter.

public interface ITenantProvider
{
    Guid GetTenantId( );
}