Where to place complex business logic in a state machine?

I have a state machine that has about 10 states. Whenever I receive a valid event for the current status of the state machine, I will handle this event, which will change the state machine to another state.

The commercial logic involved here is quite complex, I use the model of mediator to delegate this responsibility elsewhere, because I do not want to inject 20 services into my state machine.

However, this basically means that, from state A, I will receive an event, call the mediator reason to indicate the work to be done, which will bring the machine to state B.

I now have the feeling that my state machine is not doing anything, all the logic to decide in which state the state machine must pass is delegated, so that it becomes a little anemic.

Is this the right approach? If not, what are the best practices for managing complex business logic in a state machine?

SQL Server – Connecting to a local database on an Azure virtual machine

When I use DBforge to try to connect to a local MSSQL database on an Azure Ubuntu 18 virtual machine, the following error message is displayed:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify
that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open
a connection to SQL Server)

J & # 39; have:

  1. Enabled SSH on incoming rules.
  2. I can SSH in the Azure VM using PuTTY
  3. I've tried both the host name (xx.eastus.cloudapp.azure.com) and the public IP address (13.82.xx.xx) to try to connect, both give this error.
  4. I can connect to the Web site running on the virtual machine using the host name, and accessing the public IP address displays the Apache landing page.
  5. The website is running at 100% and I can login, so the database instance is running.
  6. I've followed the advice here: https://stackoverflow.com/questions/12297475/how-to-find-sql-server-running-port. I confirm that my server is listening on port 1433. (Log entry: the server is listening (& # 39; any & # 39; 1433).)
  7. Various other answers suggest that I have to enter services.msc, etc., but it is a Linux virtual machine, so it will not work either.

I get the same error using SSMS, and none of the answers here seem to work for my specific case. All are talking about connecting to an Azure SQL database, which is not the case.

An idea of ​​what else can I try?

How to copy the Time Machine directory when rsync can see files but not ls?

I've recently used GNU ddrescue to record a 6 TB disk that had problems. When I was trying to mount the disc, fsck_hfs determined that he could not be corrected (he was trying to rebuild the b-tree catalog, but then said that the disc was full and that he could not write it). The reader would then go up to read only and I found that I would have a input-output error if I tried to ls in my Time Machine backup directory. After trying many things that did not work, I decided to ddrescue to a 6 TB .dmg file, which did not work without bad sectors.

So, now I have a 6 TB .dmg image of the drive, and I find that it has the same problems: fsck_hfs think that it can not be corrected, and that gives input/output error trying to ls in the Time Machine directory. I then formatted the external drive, and that seems to go, so I thought it was never a hardware problem.

I discovered that even though ls do not like the Time Machine directory, rsync seems good with that. When I try to synchronize the directory on a new disk with rsync -avhHW --progress , the output lists all the files I'm waiting for, and I can see them appear successfully on the destination. However, this does not seem to work for copying a Time Machine directory because the size is ballooning on the destination. rsync the habit of having --hfs-compression and --protect-decmpfs options, but they seem to be broken in v3.1.3, and as discussed here, these might not be enough anyway. Indeed, I find that I've filled a 6TB destination even before going through half of the 6TB image directories.

I'm trying to copy the files through Finder now, but it's understandable to spend centuries preparing. I liked the idea of ​​using rsync not only because it can actually see the files, but also because it is ok when it is interrupted.

So, does anyone know why? rsync can see these files when ls can not Is it possible to copy them securely without interrupting but do not ruin hfs + compression or mess up physical links (or linked directories, what this article claims to be the problem rsync even when he had the old options)?

Any advice is greatly appreciated.

machine learning – How to fix the error with fgets (invalid file identifier) ​​to load files in Matlab

I want to scan the .txt files with my m file, but I'm faced with the fgets Error.

The contents of my file m:

function ROIs = loadROIfiles(ROIfileName)
% Loads all the ROIs stored in the *.txt file from the specified location.
% The ROIs are returned as a structure array as:
% ROIs(i).spacing_x (double)
% ROIs(i).spacing_y (double)
% ROIs(i).label (string)
% ROIs(i).slice_number (double)
% ROIs(i).xValues (vector of double)
% ROIs(i).yValues (vector of double)
% ROIs = loadROIfiles(ROIfileName)
% @author University & University Hospitals of Geneva (HUG) MedGIFT Group
%         Adrien Depeursinge adrien.depeursinge@hevs.ch
%      Copyright (C) 2012, MedGIFT group at University Hospitals of Geneva
%      This program is free software; you can redistribute it and/or modify
%      it under the terms of the GNU General Public License as published by
%      the Free Software Foundation; either version 2 of the License, or
%      (at your option) any later version.
%      This program is distributed in the hope that it will be useful,
%      but WITHOUT ANY WARRANTY; without even the implied warranty of
%      GNU General Public License for more details.
%      You should have received a copy of the GNU General Public License
%      along with this program; if not, write to the Free Software
%      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 

fid = fopen(ROIfileName, 'r');
while 1
    tline = fgetl(fid);
    if ~ischar(tline), break, end

    if (isempty(findstr(tline, 'SpacingX:')) == false)
        spacing_x = str2double(strrep(tline, 'SpacingX: ', ''));
    elseif (isempty(findstr(tline, 'SpacingY:')) == false)
        spacing_y = str2double(strrep(tline, 'SpacingY: ', ''));
    elseif (isempty(findstr(tline, 'label:')) == false)
        label = strrep(tline, 'label: ', '');
    elseif (isempty(findstr(tline, 'slice_number:')) == false)
        slice_number = str2double(strrep(tline, 'slice_number: ', ''));
    elseif (isempty(findstr(tline, 'nb_points_on_contour:')) == false)
        nb_points_on_contour = str2double(strrep(tline, 'nb_points_on_contour: ', ''));
        xValues = ();
        yValues = ();
        for j=1:nb_points_on_contour
            tline = fgetl(fid);
            (xValStr, yValStr) = strtok(tline, ' ');
            xVal = str2double(xValStr);
            yVal = str2double(yValStr);
            xValues = (xValues xVal);
            yValues = (yValues yVal);
        % store the ROI into the struct array "ROIs"
        ROIs(i).spacing_x = spacing_x;
        ROIs(i).spacing_y = spacing_y;
        ROIs(i).label = label;
        ROIs(i).slice_number = slice_number;
        ROIs(i).xValues = xValues;
        ROIs(i).yValues = yValues;



Code in the command window:

ROIs = loadROIfiles('CT-INSPIRIUM-6817.txt')


Error using fgets
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in fgetl (line 32)
(tline,lt) = fgets(fid);

Error in loadROIfiles (line 38)
    tline = fgetl(fid);

By the way, I'm not sure that this was due to the online Matlab, but not to the desktop version that I use. Thank you in advance for any suggestions!

Network – Network Configuration Running Android x86 on a VirtualBox Virtual Machine

I managed to start Android x86 8.1 R2 on a VirtualBox virtual machine running on a Windows 10 host. I can now boot on Android, but as I'm on a virtual machine, there is no WiFi hardware, and therefore no network.

If booting into debug mode, it falls into a command line where I can use ifconfig and ip commands to configure the eth0 device. I can then ping the local network. So, I know that the VM configuration is OK.

network – the Internet connection on the Ubuntu virtual machine works after reboot, then stops

I successfully start the Internet connection on my Ubuntu 19.04 virtual machine (in VirtualBox).
I checked this by connecting to the company's internal page, which is authorized by proxy.
The proxy is configured by Wired settings -> Network Proxy -> Automatic.
There are no other changes on this machine, it is a new installation.

Then I try to wget http://google.com and it gives me The network is inaccessible Error.
After that I try to wget the same site as before with result: Temporary failure of name resolution.

When I restart, I can connect to the first site without problems.

In addition, Network connection the application is launched, Hotspot connection window opens with information Error while resolving "nmcheck.gnome.org": temporary failure of name resolution. inside – I do not know what it is and why it appears.

The question is: what is happening on my virtual machine? Why does the connection seem to be there, and then go?

In addition, a question mark is displayed at the top of the wired connection icon (you do not know if this is related).

automatic shutdown of Esxi virtual machine in case of power failure

Do you have any idea how to shut down the ESXi host automatically (in normal mode) in the event of a power failure?

I should use a smart UPS or what?

Thank you

ssh in a Linux virtual machine on Windows 10 with PowerShell Direct

How can I connect to a Linux virtual machine under Windows 10 with the help of PowerShell Direct?

I saw the blog of Thomas Maurer which explains how to integrate SSH under Linux 10 under Windows 10 with PowerShell Direct.

When I run hvc ssh or hvc.exe ssh from any directory, I receive:

Copyright (c) Microsoft Corporation. All rights reserved.

usage: hvc.exe ssh (options) (user@)

  Connects to the VM via ssh. The command line is passed through to the
  configured ssh client.

  Configuration options:

    ssh.command       Command to use. (default: ssh.exe, putty.exe, or
                      "wsl.exe ssh", whichever exists)

    ssh.commandtype   The type of options that the ssh client supports,
                      openssh or putty. (default: auto-detect)

  Environment variables:

    HV_SSH_COMMAND    Overrides the ssh.command configuration option.

So, it seems that hvc is in the $env:Path variable.
However, when I run hvc.exe ssh test_vm or hvc.exe ssh "test_vm", I receive:

'C:Program' is not recognized as an internal or external command,
operable program or batch file.

Get-VM results:

Name            State   CPUUsage(%) MemoryAssigned(M) Uptime           Status             Version
----            -----   ----------- ----------------- ------           ------             -------
test_vm         Running 0           1478              00:48:07.9110000 Operating normally 9.0

I am using CentOS 7.7.1908 as a virtual machine image.

The best manufacturers of alkaline water ionizer machine in India. – Other opportunities to earn money

As the world becomes acidic, alkaline water is the new trend in food solutions that strikes the world. Buy only the best Alkaline water machine with 100% efficiency of the leader ionizer water India. A powerful machine that helps fight osteoporosis and acidic water cancer.


installing the compiler c on an offline machine

I am new to Ubuntu. I program for years physics and rendering logic for PC games in c, c ++ and opengl windows. I can not use Windows anymore and I try Linux. I want to continue the development using linux. I'm learning about Ubuntu Studio (the latest version), but my PCs working on development are completely offline machines. always. I need to install a c compiler and a linker to compile from sources, but I can not find an install program or an offline package for gcc or any other solution. I can not use "software center" or "sudo apt get …" because it is only an offline machine. I need to get some sort of offline package or installer and transfer it between machines via USB stick to install it on my offline workstation. I came to Ubuntu to free myself from Windows OS and the imposed design paradigm online, but all the advice I find is to use "sudo apt get …". Ubuntu seems to be more and more dependent on the Internet than Windows. I am here to stay and learn though.
Does anyone know any installation solutions? if not, would it be possible to create a basic c99 compiler from scratch using terminal commands? because then I could compile another official compiler c or c ++ and create tools to resume work officially. Thank you for your time. I appreciate you all.