sync – Best practices for data management? (Linux, Windows, others)

I have multiple devices, like most people today.
They run a multitude of operating systems, including Linux (and its various distributions), Windows, Android, and possibly even Apple products.

The "old school way" (or almost how I perceived it while growing up) was that you had a personal main computer, which you used for most things; or at least you tried to keep everything important stored on this computer's hard drive, so you moved all important files via USB sticks, emails, cloud services, etc. And then you made backup copies of this computer.

Fast forward to the current year (2020), and now I'm wondering what is the best, or at least the most common, way of running your business assuming you have multiple computers and devices, and that each of them is used to generate important data, or must access it. I can quickly think of some diagrams, and I will present them here. I am also very allergic to depend on other parties on my data management / storage, so commercial cloud services are prohibited, even if they could be a great solution for this.

1) Decide on a "main device" / central point on which you synchronize all your data.

example: a desktop computer in your home that has its own storage, or some sort of storage solution (NAS, server?). And then, if you create important data on a device, you somehow transfer it to this centralized location. And also if you need to get / use data, you get it here. So your computers / devices act as "end devices" and the actual data is kept in a central location (with the necessary duplicates, etc. of course).

2) All your devices with separate storage.

example: you have a desktop computer that contains data, a laptop computer that has different data, a second laptop computer that contains different items again, a tablet that contains different items again … This option appears to be management chaos, and I can't think of how we could keep things in order, or remember where specific data is.

3) All your devices synchronized

example: as above, you create and store data on all your devices, but you keep them synchronized via the software automatically / manually: This would limit your storage as the smallest storage on your "synchronization network", and if a synchronization goes wrong, it could cause a "bad synchronization hell".

So my question is: What is the standard way to manage data on multiple devices?

What are the best practices for creating email addresses on a domain and its subdomains?

I want to configure several applications on my own server, both having their sub-domain.
Up to now, I had a generic email address generic@domain.com for each use.
I think this is a bad design, so I decided to implement it in a more hierarchical way with email redirects as below:

+-- admin@domain.com                     --> host administration
|   |
|   +-- webmaster@domain.com             --> RFC 2142, really needed ?
|   |
|   +-- test@domain.com                  --> dev & tests
|   |
|   +-- logs.server@domain.com           --> server error logs
|   |
|   +-- logs.crontab@domain.com          --> crontab error logs
|   |
|   -- logs.appname@domain.com          --> app logs...
|
+-- contact@domain.com                   --> contact with users
|   |
|   +-- notifications@domain.com         --> automatic emails to users
|   |
|   -- notifications.appname@domain.com --> or should I be more specific ?
|
-- username@domain.com                  --> user emails...

Should I use a dedicated email address for each goal and / or each application?

Do I have to define e-mail addresses for the subdomains? purpose.appname@domain.com against purpose@appname.domain.com ?

Do you have advice, good practices, examples?

programming practices – Always better to wait?

I was wondering if this concept had a name and a consolidated theory.

If you need to create software, but don't need it yet,
it's always better to wait because the technology will be better
the future.

I am sure this is true:

  • Computer technology improves over time: better software, better libraries, better IDE, …
  • So any development is going to be cheaper (without taking into account other factors like the state of the market, …)
  • And any resulting product will be better in terms of speed, robustness, look and feel, …

But I can't find any theory or name for this concept. Can you point me in the right direction?

python – My first code – looking for feedback on best practices and things I should avoid doing in the future

After learning a bit of Python, I tried to code something myself. I have tried to make a game of Blackjack, which is far from perfect, and still has no rules that a real game has (in my game an ace is always by 11 points, when in reality it can also be counted as 1 point).

There is, however, a problem I run into, just because I don't understand it: I would like to pack some of my code into methods and call them, but I have a problem with some variables. I use j as a variable for the card that would be on top of the game. By default, it is set to 4, because once the starting hands have been dealt, the top card of the deck is the fourth. Each time the player receives an additional card j is increased by 1. When the user has finished playing and it is the dealers, I want to keep the current value of j and not go back to j being 4. How should i restructure my code in order to keep the modifications made to j in the while loop, if i put this loop in its own method? Is there a way to "extract" a value from a variable from another method?

Also, I want to develop good habits from the start and I have tried to use the best practices that I know of, like using formatted strings or using j += 1instead of j = j + 1. Are there bad practices in my code, where can I improve? Here is the game in its current state, it seems to be working fine, as I haven't found a way to break it. (A minor flaw is that you have to press "Y" or "y" for another card, but instead of having to press "n" or "N" for more cards, you can press n & No matter what)

import random

# the player plays first
# dealer goes second
# dealer hits on 16 and stands on 17

deck_of_cards = ("Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King", "Ace")
cards = {
    "Two": 2,
    "Three": 3,
    "Four": 4,
    "Five": 5,
    "Six": 6,
    "Seven": 7,
    "Eight": 8,
    "Nine": 9,
    "Ten": 10,
    "Jack": 10,
    "Queen": 10,
    "King": 10,
    "Ace": 11,
}


def drawing_a_card(card_num):
    i = card_num - 1
    drawn_card = deck_of_cards(i)
    return drawn_card


random.shuffle(deck_of_cards)
players_first_card = drawing_a_card(card_num=1)
players_second_card = drawing_a_card(card_num=3)

dealers_first_card = drawing_a_card(card_num=2)
players_total = cards(players_first_card) + cards(players_second_card)

print(f"Your first card: {players_first_card}")
print(f"Your second card: {players_second_card}")
print(f"Dealer's first card: {dealers_first_card}")
decision = input(f"You are standing at {players_total}, would you like another card? (Y/N) ")
if players_total == 21 :
    print(f"You hit 21! That's Blackjack, you win!")

j = 4
while decision.lower() == "y":
    if decision.lower() == "y":
        players_next_card = drawing_a_card(card_num=j)
        print(f"Your card: {players_next_card}")
        players_total += cards(players_next_card)
        j += 1
        if players_total > 21:
            print(f"That's a Bust! Your total was {players_total}")
            break
        elif players_total == 21:
            print(f"You hit 21! That's Blackjack, you win!")
            break
        else:
            decision = input(f"You are now standing at {players_total}, would you like another card? (Y/N) ")

k = j+1

if players_total < 21:
    print("The Dealer will now take his turn...")
    dealers_second_card = drawing_a_card(card_num=k)
    k += 1
    print(f"Dealer's cards are {dealers_first_card} and {dealers_second_card}")
    dealers_total = cards(dealers_first_card) + cards(dealers_second_card)
    if dealers_total == 21:
        print(f"The Dealer hit 21! That's Blackjack, the Dealer wins!")
    while dealers_total <= 16:
        print(f"Dealer's total is {dealers_total}, he'll take another card.")
        dealers_next_card = drawing_a_card(card_num=k)
        print(f"The Dealer's card: {dealers_next_card}")
        dealers_total += cards(dealers_next_card)
        k += 1
    if dealers_total == 21:
        print(f"The Dealer hit 21! That's Blackjack, the Dealer wins!")
    elif dealers_total > 21:
        print(f"The Dealers total is {dealers_total}, he has bust and you win!")
    if dealers_total >= 17:
        print(f"The Dealer stands at {dealers_total}")
        if dealers_total < players_total:
            print(f"Your total is {players_total}, which is higher than the Dealer's {dealers_total}, you win!")
        elif dealers_total == players_total:
            print(f"You and the Dealer are both standing at {dealers_total}, it's a draw!")
        elif dealers_total > players_total:
            print(f"The Dealer beats your {players_total} with his {dealers_total}, you lose!")

```

design – Books on good coding practices and idioms in today's world?

From my college years, I remember some classic examples of books teaching good practice in code writing and software engineering. The examples that come to mind are:

  1. Own code
  2. Full code
  3. Design patterns: elements of
    Reusable object oriented software

However, they all come from an era that seems to be fading – OOP architectures and programming languages.

Who are the new kids on the block? Are there such books about this new era of highly parallel and functional software influenced by programming?

Best practices for filters

I have several domains that I want to filter from my projects so that they never try to publish them.

I have 2 questions.

1. Is it better to create a .txt file with a list of all the domains that I want to filter and enter the URL of this .txt file in the "Options" —> "Filter" section and GSA will pull the list daily, -OR- is it better to list each domain individually in the filtering list itself?

2. If I want to filter / block a domain and ALL its sub-domains, what format should I use? Have I seen * domain.com suggested?

For example, if I want to block all art.blog subdomains and put * art.blog, would that also block bestart.blog (I don't want that, I just want to blog the art.blog subdomains ).

settings – Portable input device, best practices for configuration

We are working on a mobile 3D scanning device. The device is a small portable device, about the size of a GoPro camera. The device does not have a display or other controls. The idea is that the user connects the device to a computer / smartphone, configures the desired settings, and then bypasses the object with the scanner pointed at the object.

Technically, we have both Bluetooth and WiFi interfaces available on the device. What are the best practices / examples for the process of connecting the computer / smartphone with the device?

So far, our ideas are:

  • Add a button to the device to put it in "Bluetooth pairing mode", the user pair the device using the Bluetooth menu on the computer, then download and run our application for configuration. All subsequent communications take place via Bluetooth. (Like most Bluetooth headsets)

  • Upon startup, the device exposes a WiFi network, the user connects to that network and then opens a website in the browser. The website is served by the device and directly allows configuration. (Like some printers)

  • The user downloads our app, which then tries to establish a direct Wi-Fi connection (not too familiar with this technology) with the device. (I don't know if something like this is used)

  • The user downloads our app, which prompts the user to plug in the device with a cable. Once plugged in, we automatically configure Bluetooth connectivity or allow the user to configure their home Wi-Fi credentials for the device. (Apple's magic keyboard does)

I would welcome any advice on this.

meta tags – Good SEO practices for a root page that detects the language and redirects

I have a multilingual static website; the pages of each language live in specific sub-folders such as / en, / es, / fr, etc.

In my idnex root page, I dynamically detect the user's language (via Javascript) then I redirect to the appropriate language specific folder.

What should I think about in terms of SEO for this index page?

  • Should I add hreflang attributes pointing to the index page in the language-specific subfolders?
  • What should I add as x-default? One of the language-specific index pages, or the "language detection" page itself (which has no actual content ..)
  • Should I add a robots meta tag?

modeling – How should I model the standard processing of orders / payments? Best practices

We would like to implement payments in our system. I have found no good practice on modeling such a standard case.

We are planning a model like:

(Order) 1 <=> * (Transaction) 1 <=> * (TransactionItem)

Or:

  • Ordering entities are responsible for an order separate from the transaction
    • Name, customer, should we have items here too?
  • Transition entities are responsible for payments (payment processor, etc.)
    • Transaction: name, type of transaction (processor, gratis), amount / VAT, currency
    • TransactionItem: Name, amount, Price / VAT per single

Benefits?

So even if the transaction has expired, we can generate one more depending on the order

What do you think about this? Is it too complex and should we limit ourselves to the level of transactions?

How do you model payments in your system?

.net – Implement heart rate in terms of best practices

I have a web application that runs under the .NET Framework and that uses JS / JQuery on the client side. I am the owner and the only developer of this web application, and it is not fully in production. This just to say that I can change the whole architecture of this application without problem.

I want to implement client side heartbeat to be able to know who is connected and who is not and also to notify the user if there are live updates etc … My biggest fear is that I am not sure to have it implemented myself as this would slow the system down in the future. So I have a lot of questions in mind:

  • Is 5 seconds a good interval between each heart rate

  • Can a 5 second heart rate slow the system down?

  • How can I implement it in terms of best practices, can I just do a setInterval and send an ajax request to the server every 5 seconds?

  • I have heard that nodejs also has this option, should I migrate part to nodejs (I am not a nodejs expert)

PS: my app will only have 100 to 300 clients in the future