kubeadm – kube-adm tool fail to initialize cluster when –advertise ip address is DNS Entry instead of actual IP address

kubeadm – kube-adm tool fail to initialize cluster when –advertise ip address is DNS Entry instead of actual IP address – Server Fault

server – Parse Back4App database as a master database change log rather than actual database- thoughts on this design principle?

first post here. I’m looking for some general input as to the correctness of what I’m trying to do here. Is this a good idea, bad idea, what could be plus points or negative aspects to this design?

If this is not the right forum for this question please advise where is best, thanks 🙂

What I’m envisioning is using the Parse Back4App database as a “master database event log” which would act as a master database change log for any user accounts connected to one database. Full databases are stored with Hive on client devices. Any changes made are pushed to the server as log events. These will be read by client devices as instructions for any local database changes that need to be made so all databases stay in sync. This will be a last to write wins design. This database would be auto-deleting for data older than say every 3 months to ensure all users are updated and so that the data transfer doesn’t get too large.

My code is a bit messy as I haven’t refactored too much so please bear with that. I’m simply looking for advice as to if this is a good idea or not, and any other advice as per first paragraph.

Secondly (possibly this part belongs in SO) but if anyone wants to make general suggestions for my encryption issue please see the readMe file under MAJOR ISSUE on GitHub.

Example database log with create & delete actions logged.
Example database log

FULL PROJECT

Book model

import 'package:hive/hive.dart';
part 'book_model.g.dart';

@HiveType(typeId: 0)
class Book {
  @HiveField(0)
  String title;

  @HiveField(1)
  String author;

  @HiveField(2)
  DateTime publishingDate;

  @HiveField(3)
  DateTime dateAdded;

  @HiveField(4)
  DateTime lastModified;

  Book({
    this.title,
    this.author,
    this.publishingDate,
    this.dateAdded,
    this.lastModified,
  });

  @override
  String toString() {
  return '''
  title: $title
  author: $author
  publishingDate: $publishingDate
  dateAdded: $dateAdded
  lastModified $lastModified
  ''';
   }

  Book.fromJson(Map<String, dynamic> json)
      : title = json('title'),
        author = json('author'),
        publishingDate = json('publishingDate'),
        dateAdded = json('dateAdded'),
        lastModified = json('lastModified');

  Map<String, dynamic> toJson() => {
        'title': title,
        'author': author,
        'publishingDate': publishingDate,
        'dateAdded': dateAdded,
        'lastModified': lastModified
      };
}

Database sync item model

import 'book_model.dart';
import 'package:hive/hive.dart';
part 'database_sync_model.g.dart';

@HiveType(typeId: 1)
class DatabaseSyncItem {
  @HiveField(0)
  Book previousBookValue;

  @HiveField(1)
  Book updatedBookValue;

  @HiveField(2)
  DateTime dateAdded;

  @HiveField(3)
  DateTime lastModified;

  @HiveField(4)
  DatabaseAction entryAction;

  DatabaseSyncItem({
    this.previousBookValue,
    this.updatedBookValue,
    this.dateAdded,
    this.lastModified,
    this.entryAction,
  });

  @override
  String toString() {
  return '''
  previousValue: $previousBookValue
  updatedValue: $updatedBookValue
  dateAdded: $dateAdded
  lastModified: $lastModified
  entryAction: $entryAction
  ''';
   }

  // Turn json back into data model
  DatabaseSyncItem.fromJson(Map<String, dynamic> json)
      : previousBookValue = json('previousBookValue'),
        updatedBookValue = json('updatedBookValue'),
        dateAdded = json('dateAdded'),
        lastModified = json('lastModified'),
        entryAction = json('entryAction');

  // Turn data model into json
  Map<String, dynamic> toJson() => {
        'previousBookValue': previousBookValue,
        'updatedBookValue': updatedBookValue,
        'dateAdded': dateAdded,
        'lastModified': lastModified,
        'entryAction': entryAction,
      };
}

enum DatabaseAction {
  create,
  update,
  delete,
}

Local database services

import 'package:hive/hive.dart';
import 'package:service_database_sync/models/book_model.dart';
import 'package:service_database_sync/services/server_database_services.dart';

class ClientDatabaseServices {
  final String hiveBox = 'book_box';
  List<Book> _bookList = ();
  Book _activeBook;
  ServerDatabaseServices parseAction = ServerDatabaseServices();

  ///
  /// CREATE EVENT
  ///
  // Add book to database & update list
  Future<void> addBook(Book newBook) async {
    var box = await Hive.openBox<Book>(hiveBox);
    await box.add(newBook);
    _bookList = box.values.toList();
    await parseAction.logCreateEvent(newBook);
  }

  ///
  /// READ EVENTS
  ///
  // Send database items to list
  Future<void> _databaseToRepository() async {
    var box = await Hive.openBox<Book>(hiveBox);
    _bookList = box.values.toList();
  }

  // Return list for use
  Future<List<Book>> getBookList() async {
    await _databaseToRepository();
    return _bookList;
  }

  // Getter for list
  List<Book> get bookList => _bookList;

  // Return specific book
  Book getBook(index) {
    return _bookList(index);
  }

  // Return list length
  int get bookCount {
    return _bookList.length;
  }

  // Get active book
  Book getActiveBook() {
    return _activeBook;
  }

  // Set active book
  void setActiveBook(key) async {
    var box = await Hive.openBox<Book>(hiveBox);
    _activeBook = box.get(key);
  }

  ///
  /// UPDATE EVENT
  ///
  // Updates specific book with new data
  void editBook({Book book, int bookKey}) async {
    var box = await Hive.openBox<Book>(hiveBox);
    await box.put(bookKey, book);
    _bookList = box.values.toList();
    _activeBook = box.get(bookKey);
  }

  ///
  /// DELETE EVENTS
  ///
  // Deletes specific book and updates list
  Future<void> deleteBook(key) async {
    var box = await Hive.openBox<Book>(hiveBox);
    await parseAction.logDeleteEvent(box.getAt(key));
    await box.deleteAt(key);
    _bookList = box.values.toList();
  }

  // Empties hive box for database reset
  Future<void> deleteAll() async {
    var box = await Hive.openBox<Book>(hiveBox);
    await box.clear();
  }
}

Server database services

import 'package:parse_server_sdk/parse_server_sdk.dart';
import 'package:service_database_sync/models/book_model.dart';
import 'package:service_database_sync/models/database_sync_model.dart';

class ServerDatabaseServices {
  // Server app keys & data
  final keyApplicationId = 'jVrkUb6tvSheT4NHqGuF9FtFDtQkmqS3pJbKRyLN';
  final keyClientKey = 'MFYPnwLM1d38TtG2523YXxMQ4lCZdX9maovSjrdu';
  final keyParseServerUrl = 'https://parseapi.back4app.com';

  // String values
  String previousBookValue = 'previousBookValue';
  String updatedBookValue = 'updatedBookValue';
  String dateAdded = 'dateAdded';
  String entryAction = 'entryAction';
  String lastModified = 'lastModified';

  ///
  ///
  /// CREATION LOG EVENT
  Future<void> logCreateEvent(Book book) async {
    final createEvent = DatabaseSyncItem(
      previousBookValue: null,
      updatedBookValue: book,
      dateAdded: book.dateAdded,
      entryAction: DatabaseAction.create,
      lastModified: DateTime.now(),
    );
    final toServer = ParseObject('Event')
      ..set(previousBookValue, createEvent.previousBookValue)
      ..set(updatedBookValue, createEvent.updatedBookValue.toJson())
      ..set(dateAdded, createEvent.dateAdded)
      ..set(entryAction, createEvent.entryAction.toString())
      ..set(lastModified, createEvent.lastModified);
    await toServer.save();
  }

  ///
  ///
  /// UPDATE LOG EVENT
  Future<void> logEditEvent(Book previousValue, Book updatedValue) async {
    updatedValue.lastModified = DateTime.now();
    final editEvent = DatabaseSyncItem(
      previousBookValue: previousValue,
      updatedBookValue: updatedValue,
      dateAdded: previousValue.dateAdded,
      entryAction: DatabaseAction.update,
      lastModified: DateTime.now(),
    );
    final toServer = ParseObject('Event')
      ..set(previousBookValue, editEvent.previousBookValue.toJson())
      ..set(updatedBookValue, editEvent.updatedBookValue.toJson())
      ..set(dateAdded, editEvent.dateAdded)
      ..set(entryAction, editEvent.entryAction.toString())
      ..set(lastModified, editEvent.lastModified);
    await toServer.save();
  }

  ///
  ///
  /// DELETE LOG EVENT
  Future<void> logDeleteEvent(Book book) async {
    book.lastModified = DateTime.now();
    final deleteEvent = DatabaseSyncItem(
      previousBookValue: book,
      updatedBookValue: null,
      dateAdded: book.dateAdded,
      entryAction: DatabaseAction.delete,
      lastModified: DateTime.now(),
    );
    final toServer = ParseObject('Event')
      ..set(previousBookValue, deleteEvent.previousBookValue.toJson())
      ..set(updatedBookValue, deleteEvent.updatedBookValue)
      ..set(dateAdded, deleteEvent.dateAdded)
      ..set(entryAction, deleteEvent.entryAction.toString())
      ..set(lastModified, deleteEvent.lastModified);
      await toServer.save();
  }
}

Main

import 'dart:io';
import 'package:hive/hive.dart';
import 'package:parse_server_sdk/parse_server_sdk.dart';
import 'package:service_database_sync/data/books_hardcoded.dart';
import 'package:service_database_sync/models/book_model.dart';
import 'package:service_database_sync/services/client_database_services.dart';
import 'package:service_database_sync/services/server_database_services.dart';

Future<void> main(List<String> arguments) async {
  Hive.init('hive_database');
  Hive.registerAdapter(BookAdapter());
  await Parse().initialize(
    ServerDatabaseServices().keyApplicationId,
    ServerDatabaseServices().keyParseServerUrl,
    clientKey: ServerDatabaseServices().keyClientKey,
    debug: true,
  );

  await addBooksToLibrary();
  sleep(Duration(seconds: 5));
  await deleteSpicificBook(2);
}

Future<void> addBooksToLibrary() async {
  final bookDatabaseActions = ClientDatabaseServices();
  await bookDatabaseActions.addBook(bookOne);
  await bookDatabaseActions.addBook(bookTwo);
  await bookDatabaseActions.addBook(bookThree);
  await bookDatabaseActions.addBook(bookFour);
}

Future<void> deleteSpicificBook(int index) async {
  final bookDatabaseActions = ClientDatabaseServices();
  await bookDatabaseActions.deleteBook(index);
}

Future<void> deleteAllBooks() async {
  final bookDatabaseActions = ClientDatabaseServices();
  await bookDatabaseActions.deleteAll();
}

void printBookLibrary() async {
  final bookDatabaseActions = ClientDatabaseServices();
  final box = await Hive.openBox<Book>(bookDatabaseActions.hiveBox);
  final books = box.values;
  print(books);
}

client – Hash/TxID is WILDLY off my actual transaction

I was using Safepal Wallet and moved my funds to Trust Wallet.

I am currently tracking those original transactions for tax purposes next year.

I was simply using hash/txid provided in the transaction overview, but have an odd problem. The amount that shows up on my wallet is correct, but when I click to see the details, the hash/tax id links to a transaction where I received 5 BTC for around $250,000, but the original and true amount was around $30.

I have no idea what to do. I have checked on different searches and this is the same information. How on earth? Will this somehow screw me for taxes–be reported?

I have the correct number reflected on my wallet balance, but the “details” of this transaction are blatantly wrong. I have other coins and transactions with similar issues and some that are exactly correct. PLEASE HELP.

operating systems – Difficulty in understanding the “expontential average” plot of the estimate of the next CPU burst with the actual CPU burst

I was going through the portion of exponential averaging (to find the CPU bursts) under Shortest Job First (SJF) Scheduling from the dinosaur by Galvin et. al.

Let $t_n$ be the length of the $n$th CPU burst, and let $tau_{n+1}$ be our predicted value for the next CPU burst. Then, for $α, 0 ≤ α ≤ 1$, define
$$tau_{n+1}= alpha.t_n+(1-alpha).tau_{n}$$

Using $alpha=frac{1}{2}$ they give a plot as follows:

Plot

I am facing few issues with the plot shown above:

  1. I feel that the footer of the plot,i.e. the CPU burst and the guess, do not align. What I feel is that the $0$ th CPU burst time of $6$ units should be above the $0$ th “guess” of $10$ units in the footer…
  2. Though the domain is discrete as a whole, but why is the blue curve continuous? Moreover, strikingly between the time intervals $2-3$ and $3-4$ why is there a sudden dip in the blue (estimate) curve?

blockchain – Hash/TaxID is WILDLY off my actual transaction

I was using Safepal Wallet and moved my funds to Trust Wallet. I am currently tracking those original transactions for tax purposes next year. I was simply using hash/taxid provided in transaction overview, but have an odd problem. The amount that shows up on my wallet is correct, but when I click to see the details, the hash/tax id links to a transaction where I received 5 BTC for around $250,000, but the original and true amount was around $30. I have no idea what to do. I have checked on different searches and this is the same information. How on earth? Will this somehow screw me for taxes–be reported? I have the correct number reflected on my wallet balance, but the “details” of this transaction are blatantly wrong. I have other coins and transactions with similar issues, and some that are exactly correct. PLEASE HELP.

photography basics – What’s the actual physics of diffusion filters?

Recently, I purchased a Tiffen Black Pro Mist which adds halation to highlights via diffusion. I read online that diffusion filters do not add data as the entirety of the effect can be recreated in post with more flexibility. It appears that the size of the halation is proportional to the intensity of the light source. What’s the actual physics of diffusion filters? Thanks in advance.

diffusion 1

enter image description here

enter image description here

projective geometry – Determine if we’re looking at a video of a photo rather than the actual thing

Consider a video of someone holding up a photo of a face in front of a camera and translating and rotating it a bit. Imagine that we know the pixel coordinates of various features in the picture. Eye corners, the corners of the mouth etc.

The pose of the head in the world coordinate system can also be presumed to be known.

All the intrinsic and extrinsic camera parameters are known.

Is there a way using multiple view geometry, or any kind of geometry, to realize that we’re looking at a photo and not an actual face?

Maybe one can compute a homography between two frames with different head poses in the video, and distinguish between homographies based on feature points on a photo and feature points on an actual face since in the latter case they are not entirely planar?

Maybe one use the known head pose to see there two images from the different frames as two separate cameras. Then the fundamental matrix places some constraints on the homography, perhaps that could help?

I’ve been reading up on multiple view geometry but I’m not quite there yet where I can tell if there is an approach like this that might work, so I would be really grateful if someone better could tell what the most promising approaches may be, if any exist.

How to add a shortcode function that returns the taxonomy slug of the actual post within the loop

Circumstances: I have a CPT called “designs” and a taxonomy related to it, called “project_category” so that I can assign a category to each design. I’m building the template for each ‘design’ and I need a shortcode that returns the assigned project category SLUG of the current design within the loop.

It’s important that I retrieve the slug instead of the ID because I’ll be using the shortcode to wrap the whole template and assign it an #ID name so I can then target it with a link.

Example: I have a design post called “New logo for Pepsi” which has “Visual Identity” as it’s project category. So I’d need the shortcode to return “visual_identity” instead of “Visual Identity”.

Facts to consider: each design will have only one category assigned, so I don’t need the shortcode to return an array, only a single slug.

I guess it should be something like this:

add_shortcode( 'return_taxonomy_slug', 'my_shortcode_return_taxonomy_slug' );

function my_shortcode_return_taxonomy_slug() {
    return get_the_terms( $designs, $project_category->slug );
}

…or maybe something like this to work-around:

add_shortcode( 'return_taxonomy_slug', 'my_shortcode_return_taxonomy_slug' );

$terms = wp_get_post_terms( get_the_ID(), 'project_category');

function my_shortcode_return_taxonomy_slug() {
    return $terms->slug;
}

How do I save my actual SSH key (not passphrase) in the macOS Keychain

I want to store my SSH key in my iCloud keychain so it is available on all my devices. Checking this site and others, every answer to the question “How do I save my SSH key to the keychain” says to use ssh-add -K ~/.ssh/private_key_file, but that does not save the key to the keychain, it saves the passphrase for the key to the keychain. To use the key on another device, you still need to copy over the private key file.

Is there a way to store the actual SSH private key in the keychain so that I can use it without having a key file on my drive?

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheapest USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Proxyti.com Buy Quality Private Proxies