api – Asynchronous communication with legacy system

Background

My task is to create new system (X) for realtime work tracking for internal use. You should think it like an app that you have opened on a separate monitor/ on phone all day and you are logging your work progress there. In fact, there is already a system (Y) that solves this and internally its working well, but it’s really annoying to use because of slowness, unresponsiveness, and terrible UX design. The legacy system cannot be replaced at this time (a lot of reasons) and data from app new must be synchronized with it. The legacy system Y is also integrated with a lot of other systems and plan is to take over these integrations and rebuild them to system X. There is intent to completely replace the legacy system with a new one in the future – not only because of unresponsiveness but also because of monster technical debt and obsolete tech stack.

I proposed to create new system X as a standalone software with its own database and integrate it with Y using its API. The problem is – API calls (http requests) to Y are slow (up to 10 seconds). System X should have to be very responsive, all requests have to be processed in < 1s. So my plan is to push events from X to some kind of queue and sent them to Y asynchronously. Additionally, it’s important to process responses from system Y in system X (example below) but it can be delayed. Also, other systems can eventually consume the same events from the queue.

Example of communication

User ->    X    : Create job request 
X    ->    User : Job(id_X=1,id_Y=null) created and Event1 pushed to queue
Y               : Starting processing event1
User ->    X    : Add comment to Job(id_X=1,id_Y=null)
X    ->    User : Comment(id_X=2,id_Y=null) created Event2 and pushed to queue
Y               : Starting processing event2
Y    ->    X    : Event1 processed, returning id_Y=8876 for job with id_x=1
X               : Update job (id_X=1,id_Y=8876) internally from resnponse
X    ->    User : Display updated job info

.. and so on.

Questions

  • Is my proposed communication pattern meaningful or are there any design flaws?
  • Should be queue functionality part of the system X or is it better to make it standalone?
  • Can you suggest any existing software for the queue?

Thank you in advance for any advice

beginner – Railway Reservation system in C

#include<stdio.h>

int main(void)
{

struct passenger
{
    char source_destn(30), target_destn(30), name(50), gender(1), address(50); int age;
      
}p(3);

int flush;

for (int i = 0; i < 3; i++){
    printf("enter the name :");
    fgets(p(i).name, 51, stdin);    // +1 for accomodating "n"
    printf("Enter the address :");
    fgets(p(i).address, 51, stdin);
    printf("Enter the gender(M/F/N) :");
    fgets(p(i).gender, 3, stdin);   // why do i have to use 3????
    
    printf("Enter the src_destn :");
    fgets(p(i).source_destn, 31, stdin);     
    printf("Enter the target_destn :");     
    fgets(p(i).target_destn, 31, stdin);
    
    printf("Enter the age :");
    scanf("%d",&p(i).age);
    
    while((flush = getchar()) != 'n')  // this is used to flush out the keyboard buffer since scanf is used at the end
        ;
        
}

    printf("this is what you entered: n");

    for (int i = 0; i < 3; i++){
        printf("n ---------------- %d th  PASSENGER ---------------nn",i+1);
        printf("name: %s address: %s gender:%s age: %d src_destn: %s target_destn: %s",p(i).name, p(i).address, p(i).gender, p(i).age, p(i).source_destn, p(i).target_destn);
    }



return 0;
}

i was recently learning how to use data structures in c and started making a program to simulate a railway reservation system and during running the program initially the size of input here:

    printf("Enter the gender(M/F/N) :");
fgets(p(i).gender, 2, stdin);

was set to 2 (1 for storing M/F/N and +1 for storing n ) but while compiling and running this i found that i get this output

    Enter the src_destn :Enter the target_destn :

i cant supply the source destination to the program and setting input buffer size of
p(i).gender to 3 solved the error :

    printf("Enter the gender(M/F/N) :");
fgets(p(i).gender, 3, stdin);

so my question is why do i need to set the input buffer size to 3 ??
This is my first post so pardon my mistakes and any suggestions would be appreciated

differential equations – ParametricNDSolve for a system of 4 non-linear ODEs and plotting the solutions

I have four coupled first-order non-linear differential equations, denoted as: A1(x), A2(x), A3(x), A4(x) which are all functions of x. I have the following code which attempts to solve the equations using ParametricSolveND by varying one of the initial conditions of the parameter (namely, A4(0) which I have denoted as the parameter j).

ω1 = 2 π*5*10^9;
ω2 = 2 π*5*10^9;
ω3 = 2 π*3*10^9;
ω4 = ω1 + ω2 - ω3;
Cj = 329*10^-15;
LL = 100*10^-12;
a = 10*10^-6;
I0 = 3.29*10^-6;
CC0 = 39*10^-15;
k1 = (Sqrt(CC0 LL) *(ω1))/(a Sqrt(1 - Cj LL *(ω1)^2));
k2 = (Sqrt(CC0 LL) *(ω2))/(a Sqrt(1 - Cj LL *(ω2)^2));
k3 = (Sqrt(CC0 LL) *(ω3))/(a Sqrt(1 - Cj LL *(ω3)^2));
k4 = (Sqrt(CC0 LL) *(ω4))/(a Sqrt(1 - Cj LL *(ω4)^2));
Δkl = k1 + k2 - k3 - k4;
κ1 = (a^4*k1*k2*k3*k4*(k3 + k4 - k2))/(8*CC0*I0^2*LL^3*ω1^2);
κ2 = (a^4*k1*k2*k3*k4*(k3 + k4 - k1))/(8*CC0*I0^2*LL^3*ω2^2);
κ3 = (a^4*k1*k2*k3*k4*(k1 + k2 - k4))/(8*CC0*I0^2*LL^3*ω3^2);
κ4 = (a^4*k1*k2*k3*k4*(k1 + k2 - k3))/(8*CC0*I0^2*LL^3*ω4^2);
α11 = (a^4*k1^5)/(16*CC0*I0^2*LL^3*ω1^2);
α12 = (a^4*k1^3*k2^2)/(8*CC0*I0^2*LL^3*ω1^2);
α13 = (a^4*k1^3*k3^2)/(8*CC0*I0^2*LL^3*ω1^2);
α14 = (a^4*k1^3*k4^2)/(8*CC0*I0^2*LL^3*ω1^2);
α21 = (a^4*k2^3*k1^2)/(8*CC0*I0^2*LL^3*ω2^2);
α22 = (a^4*k2^5)/(16*CC0*I0^2*LL^3*ω2^2);
α23 = (a^4*k2^3*k3^2)/(8*CC0*I0^2*LL^3*ω2^2);
α24 = (a^4*k2^3*k4^2)/(8*CC0*I0^2*LL^3*ω2^2);
α31 = (a^4*k3^3*k1^2)/(8*CC0*I0^2*LL^3*ω3^2);
α32 = (a^4*k3^3*k2^2)/(8*CC0*I0^2*LL^3*ω3^2);
α33 = (a^4*k3^5)/(16*CC0*I0^2*LL^3*ω3^2);
α34 = (a^4*k3^3*k4^2)/(8*CC0*I0^2*LL^3*ω3^2);
α41 = (a^4*k4^3*k1^2)/(8*CC0*I0^2*LL^3*ω4^2);
α42 = (a^4*k4^3*k2^2)/(8*CC0*I0^2*LL^3*ω4^2);
α43 = (a^4*k4^3*k3^2)/(8*CC0*I0^2*LL^3*ω4^2);
α44 = (a^4*k4^5)/(16*CC0*I0^2*LL^3*ω4^2) // N;

system = {A1'(x) == I*κ1*Conjugate(A2(x))*A3(x)*A4(x)*E^(-I*Δkl*x) + I*A1(x)*(α11*Abs(A1(x))^2 + α12*Abs(A2(x))^2 + α13*Abs(A3(x))^2 + α14*Abs(A4(x))^2), 
          A2'(x) == I*κ2*Conjugate(A1(x))*A3(x)*A4(x)*E^(-I*Δkl*x) + I*A2(x)*(α21*Abs(A1(x))^2 + α22*Abs(A2(x))^2 + α23*Abs(A3(x))^2 + α24*Abs(A4(x))^2), 
          A3'(x) == I*κ3*A1(x)*A2(x)*Conjugate(A4(x))*E^(I*Δkl*x) + I*A3(x)*(α31*Abs(A1(x))^2 + α32*Abs(A2(x))^2 + α33*Abs(A3(x))^2 + α34*Abs(A4(x))^2), 
          A4'(x) == I*κ4*A1(x)*A2(x)*Conjugate(A3(x))*E^(I*Δkl*x) + I*A4(x)*(α41*Abs(A1(x))^2 + α42*Abs(A2(x))^2 + α43*Abs(A3(x))^2 + α44*Abs(A4(x))^2), 
          A1(0) == (I0*25)/ω1, A2(0) == (I0*25)/ω2, A3(0) == 0, A4(0) == j};

DEsols = ParametricNDSolve(system, {A1(x), A2(x), A3(x), A4(x)}, {x, 0, 2000}, {j})
Plot(Evaluate@Table(Abs((A4(j)(x)) /. DEsols)^2, {j, 0, 10}), {x, 0, 2000}, PlotStyle -> {Orange}, PlotLegends -> {"A4"}, PlotRange -> All, AxesOrigin -> {0, 0})

However, it is not plotting and I’m not sure what I’ve done wrong. Furthermore, I intend to plot A4(x) as a function of A4(0) for a fixed x (x=2000). How should I go about fixing this? Thank you.

domain name system – Router caching “A” zone record?

OK, this is driving me bonkers.

I had a website at a subdomain, site.domain.com, set up with an A record that pointed to my home IP address with the website running on a NAS device at 192.168.1.122. I have modified the zone record so it is now a CNAME that points to a totally different domain with an IP address outside of my home network.

On my mobile devices, and only on the mobile devices (I’ve tested on my iPhone and iPad and my son’s iPhone), I still pull up the website from a machine on my home network. The really weird thing is that every once in a while, the new site will pop up if I refresh the browser.

When I do a DNS query of my router with dig @192.168.1.1 site.domain.com from my desktop machine, it pulls up an “A” record–with the IP address of the local machine the website used to be on–and not the CNAME record:

; <<>> DiG 9.10.6 <<>> @192.168.1.1 site.domain.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46256
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;site.domain.com.             IN      A

;; ANSWER SECTION:
site.domain.com.      0       IN      A       192.168.1.122

;; Query time: 5 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Wed Jul 08 19:38:50 EDT 2020
;; MSG SIZE  rcvd: 62

The desktop computer is set to query my local DNS server on my network. The mobile devices are set to get DNS from the router at 192.168.1.1. So that explains why the desktop works and the mobile devices do not.

So it looks to me like my router is caching the A record. But how? It’s been well over 24 hours now. I have also rebooted the router to try to clear stuff from the cache.

I have double checked my local DNS zone settings on my local network, also at 192.168.1.122, and those look fine. And querying my local DNS machine also returns the proper value.

Dropshiply-The System You Need To Profit Massively in 2020!

​Imagine making $10,000 to $20,000 this month…and then next month… and one after that and so on – consistently and with surety.
This is about running a highly profitable dropshipping store in minutes regardless If you are a complete newbie or advanced marketer! To be successful with this system requires absolutely no experience! Everything is completely AUTOMATED for you to easily earn 6-figures.

That is the Dropshiply platform,
So, Dropshiply is a complete "full blown" dropshipping platform that will help you create and run a complete dropshipping store in just a few minutes per day with NO money, NO inventory, NO experience, or any products of your own!

Every feature you get is completely automatic.

Generally, Dropshiply is a MUST-HAVE item for:

  • Affiliate Marketers
  • Marketers
  • Com + Amazon
  • Freelancers
  • Website Owners
  • Social Media Marketers
  • Local businesses
  • Any other kinds of online business

Keep going goes to Dropshiply Review to review the features in detail so you can better understand the platform

.

macos – How can I select “Allow” from System Preferences -> Security Panel to allow the installer to run from TERMINAL

I am connecting to a MAC OS X computer remotely from my Windows machine. And I am trying to install Docker on the OS X machine. In order to do this, I am running “brew cask install virtualbox” command. However I get an error. From some websites, I learned that I should enable the “Allow” option from System Preferences -> Security and Privacy.

But I can’t do this because I only have access to the terminal (because I am connecting from another machine). I don’t know how to enable this option from the terminal.

Thank you

nosql – Which database system should I use for my startup project

Let me describe a model I want to have:

  • Company – everything belongs to a company, I need to support multiple companies (clients)
  • Device – data about a hardware used in the system
  • DeviceClassification – describes the ways I can segment devices
  • DeviceGroup – for a given DeviceClassification I can make groups tree and to store device in one group of that classification. There are top level groups with children.
  • DeviceLocation – country, state, city, zip code, address, geo location
  • MediaResource – a media file (image, video)
  • Playlist – list of media resources and additional data for playlist behavior. Playlist can be assigned to many device groups.
  • PlaylistItem – references a media resource and describes how that resource is being used

Above that I will need data store to support authentication, authorization and license checking for clients.

There should be a “table” for storing some data to be consumed by BI systems.

My question is: Would I be wrong if I used NoSql database like ArangoDB or Neo4j, and which one is better for my use case? Or I should stick with relational database?
I am exploring NoSql databases and I want to try something new. I will develop my project in .NET.

unity – New Input System Differs Between Editor and Runtime?

I’m sure the problem is me.

Here is a simple look script (from a tutorial, actually).

I’m getting inconsistent results between editor and runtime. I’m guessing its a framerate thing.

Code:

using UnityEngine;
using Mirror;
using Cinemachine;

public class PlayerCameraController : NetworkBehaviour
{
    (Header("Camera"))
    (SerializeField) private Vector2 maxFollowOffset = new Vector2(-1f, 6f);
    (SerializeField) private Vector2 cameraVelocity = new Vector2(4f, 0.25f);

    (SerializeField) private Transform playerTransform = null;
    (SerializeField) private CinemachineVirtualCamera virtualCamera = null;

    private Controls controls;
    private Controls Controls {
        get {
            if (controls != null) { return controls; }
            return controls = new Controls();
        }
    }
    private CinemachineTransposer transposer;

    public override void OnStartAuthority()
    {
        transposer = virtualCamera.GetCinemachineComponent<CinemachineTransposer>();
        virtualCamera.gameObject.SetActive(true);
          
        Controls.Player.Look.performed += ctx => Look(ctx.ReadValue<Vector2>());

        enabled = true;
    }

    (ClientCallback)
    private void OnEnable() => Controls.Enable();

    (ClientCallback)
    private void OnDisable() => Controls.Disable();

    private void Look(Vector2 lookAxis) {
        float deltaTime = Time.deltaTime;

        float followOffset = Mathf.Clamp(
            transposer.m_FollowOffset.y - (lookAxis.y * cameraVelocity.y * deltaTime),
            maxFollowOffset.x,
            maxFollowOffset.y);


        transposer.m_FollowOffset.y = followOffset;
        playerTransform.Rotate(0f, lookAxis.x * cameraVelocity.x * deltaTime, 0f);
    }
}

The code seems right. Watching the values of Vector2 lookAxis reveals that the numbers are slightly different coming into the function based on environment.

Is there something wrong with this code that would give different results between editor and runtime?

synchronization – Help with reviewing locking logic for sync system

I’m implementing a sync algorithm where multiple apps sync files with a data source. Syncing is already working and has been for several years so there’s no issue with this.

Now I want to implement a way to lock the data source, to tell clients that they shouldn’t write to it anymore. This will be used to upgrade the data source – i.e. upgrade its structure, move folders around, etc. which needs to be done when nothing else is syncing.

So I came up with the following algorithm, inspired by [SQLite 3 locking mechanism][1], but changed to take into account that it’s network based.

There are three types of locks, and a client request a lock by POSTing a file to the data source. The locks are:

  • SYNCING: The client is syncing – any other client can still read or write to the data source. There can be multiple SYNCING locks.
  • PENDING: The client wants to acquire an exclusive lock on the data source – any other clients can still read or write to the data source, but no new SYNCING lock can be posted. There can be multiple PENDING locks.
  • EXCLUSIVE: The client has locked the data source – no other client can read or write to it. There can be only one EXCLUSIVE lock.

And it would work like so:

  • When a client starts syncing with the data source, they acquire a SYNCING lock. When a client finishes syncing, they release the SYNCING lock they’ve created
  • When a client needs to lock the data source, it first posts a PENDING lock. When a PENDING lock is present, no new SYNCING or PENDING locks can be posted. Clients that are syncing however can complete the process. The client who has acquired a PENDING lock will poll the data source and wait for all SYNCING lock to be released. When they are all gone, the client checks for all the PENDING locks – if there are others, the client checks the timestamps of these other locks and if his lock is not the oldest one, it deletes it and exit. Locking failed, and it will need to try again later.
  • If the PENDING lock is the oldest, then the client posts an EXCLUSIVE lock. At this point, no other client can post any other lock.

I’m wondering if I overlook something with this system, like I’m wondering if there could be some race conditions in some cases?

For now, I’m not dealing with clients that post a lock then crash, there will be some logic to clean up. At this point, I just want to make sure that this system will only allow one client to acquire an EXCLUSIVE lock. Any ideas?

Banners And Brands System Marketplace

Hello guys!

I am currently working on a marketplace store project based on: eBay and BestBuy, in both stores there is the partner and brand system where you are on the home page, I am using this plugin for the marketplace: https: // addons. prestashop.com/pt/criacao-marketplace/18656-ja-marketplace.html and I’m doing it for prestashop, unfortunately the plug-in does not have the option to create the automatic banner (in fact there is more with this problem) and I spent 200 dollars in this plugin and I would not like to spend more, I need some help how to configure the banners and brand parts with this plug-in.
SEMrush

:) Any help already agrees