synchronization – How to sync my local files in a shared Google drive folder?

You will find detailed instructions to your answer within the Back up & sync files with Google Drive and the Drive File Stream help pages, depending on the kind of account you have.

Having already gone through the first step (Choose a sync solution), you can Turn on sync for your organization.

As a quick reference for the differences between the two options (Compare Backup and Sync & Drive File Stream) please read the following:

|               Compare Backup and Sync & Drive File Stream               |                 |                   |
|                                                                         | Backup and Sync | Drive File Stream |
| Use files in My Drive                                                   | Yes             | Yes               |
| Use files in shared drives                                              | No              | Yes               |
| Sync only selected folders in My Drive                                  | Yes             | Yes               |
| Sync only individual files in My Drive                                  | No              | Yes               |
| Use native apps, like Microsoft Office & Photoshop                      | Yes             | Yes               |
| See who's editing with real-time presence in Microsoft Office           | No              | Yes               |
| Integrates with Microsoft Outlook, Meet scheduling                      | No              | Yes               |
| Sync other folders, like Documents or Desktop                           | Yes             | No                |
| Use with your personal Google Account, like | Yes             | No                |
| Use with your work or school Google Account                             | Maybe           | Yes               |
| Upload photos and videos to Google Photos                               | Yes             | No                |

synchronization – How to “ignore” syncing of specific photos with Google Photos?

I have Google Photos on my iOS device. It has successfully synced most of my photos, but there are about 120 old photos that for one reason or the other it cannot sync (it doesn’t give me specifics, it just tells me it cannot sync the photo).

I don’t much care if those photos actually get synced, but I would like to remove them from the queue of photos to be synced (they never go away). I would like to tell Google Photos to just “ignore” those photos, but I cannot find a way to do this.

I considered deleting the photo from Google Photos, but it wanted to also delete the photo from my iOS device when I performed this action, and I do not consider this an acceptable alternative.

Is there a way to instruct Google Photos to ignore a photo when attempting to sync? (bonus if it can be done in bulk)

synchronization – Export google calendar into outlook

I have a Google calendar that I want to sync into Outlook (web application). So I reach Google calendar -> Settings -> Settings for my calendar -> Calendar integration -> Secrets address iCal format.

Once I copied that link I open Outlook -> Add calendar -> Subscribe from web, then I paste that URL.

This works because Google’s events are imported but, if I add a new project in Google this is not reflected on Outlook.

Is there something wrong with this?

Process synchronization problem

The atomic fetch-and-set x,y instruction unconditionally sets the memory location x to 1 and fetches the old value of x in y without allowing any intervening access to the memory location x. Consider the following implementation of P and V functions on a binary semaphore S.

   void P (binary_semaphore *s) { 
        unsigned y; 
        unsigned *x = &(s->value); 
        do { 
            fetch-and-set x, y; 
        } while (y); 

    void V (binary_semaphore *s) { 
        S->value = 0; 

Which one of the following is true?

  1. The implementation may not work if context switching is disabled in P()
  2. Instead of using fetch-and–set, a pair of normal load/store can be used
  3. The implementation of V is wrong
  4. The code does not implement a binary semaphore

Option 1 is correct. I am unable to understand the reason for it. Please explain.

Synchronization of the SSH public key on several servers, how to automate it?


I'm working on a script that will allow synchronization of multiple folders on multiple servers.
On each server, the script will download data from the rest of the servers via rsync via ssh (rsync has an archive and update attribute).
For this transfer, a ssh public access key is required.

When I add a new server to the group, I need to:
1) run ssh-keygen on the new server and via ssh-copy-id add the key to the rest of the servers so that i can download data from them …
2) Do the same on all the old servers so that each of them can also download data from my new server.

I am thinking how to automate this thing via a bash script …

In my backup script, I already have a list of all the IP addresses of the servers. So I can loop these IP addresses, exclude my new server IP address and after generating a key, I will manually put this key on all the old server IP addresses …?
Next, how to allow the old servers to access this new server. It seems more complicated because I would need to connect to each old server and there I do not know …

what about one way or another of sycing files with public keys between old legacy servers? An idea how to do it, how to make it in bash? THX

rabbitmq – Synchronization of different "channels" asynchronously

I have a scenario where a service has to update the back-and-forth information from different channels (and each channel should have the same information, for example product inventory).
Everything works well if the process is sequential. The problem is that by adding more and adding more channels, or with more information, the process becomes slow.

The creation of micro-services for each channel is not a problem; the problem is communication with each of them and logging errors if there are any (once you have written it, it seems better organized than planning it).

My question is; is using a Message Broker (like RabbitMQ) the right tool to consider in such cases ?! or if someone relies solely on communication between services.
A practical blueprint or use case to follow in such cases?

multithreading – C code using process synchronization and multithreading

The program below is one of my first C codes, so I'm fairly new to C coding and I feel like I wrote amateur code. I would appreciate any corrections and comments on my code.
It is a matrix-vector multiplication program using multi-threading. It takes as input the names matrixfile.txt and vectorfile.txt, the buffer size and the number of divisions and divides the matrix file into split files in the main function (the matrix is ​​divided into smaller parts). Then the mapper threads write the value to the buffer and the reducer thread writes result in resultfile.txt. The Resultfile algorithm is not efficient but the code works that I have tested with different inputs.

/* -*- linux-c -*- */
#include "common.h"
#include "stdint.h"

const int ROWS = 10000;
const int COLS = 3;

int twodimen(10000)(3); 
int count_lines;
int vector(10000);
int vector_lines;
int splitnum;
sem_t *sem_mutex;       /* protects the buffer */
sem_t *sem_full;        /* counts the number of items */
sem_t *sem_empty;       /* counts the number of empty buffer slots */

void * mapperThread(void * xx){
  int filecount = (intptr_t)xx;
  char filename(20) = "splitfile";
  char txt(5) = ".txt";
  char num(10);
  sprintf(num, "%d", filecount);
  strcat(filename, num);
  strcat(filename, txt);  
  printf ("mapper thread started with: %s n", filename);  
  struct buffer * bp = find(filecount);

  FILE *splitfileptr; 
  char *sline = NULL;
  size_t slen = 0;
  ssize_t sread;

  splitfileptr = fopen(filename, "r");   
  if (splitfileptr == NULL){  
  while ((sread = getline(&sline, &slen, splitfileptr)) != -1) {
    char *line_copy = strdup(sline);
      bp->buf(bp->in) = line_copy; 
      bp->count = bp->count + 1;
      bp->in = (bp->in + 1) % INPUT_BUF_SIZE; // incrementing buffer count, updating
      sem_post(sem_mutex); // releasing the mutex
      sem_post(sem_full);  // incrementing full count, sem_post is signal operation          
  printf("producer ended; bye...n");

void * reducerThread(char* resultfilename){
   printf("reducer thread startedn");     
   FILE *resultfileptr;
   char *line = NULL;
   size_t len = 0;
   ssize_t read;

   char* item;      
   int index = 0;
   while (index  < count_lines) {
     for(int i = 0; i < splitnum; i++){
        struct buffer * bp = find(i);
        if (SYNCHRONIZED && bp->count != 0) {          
          sem_wait(sem_full); // checks whether buffer has item to retrieve, if full count = 0, this statement will cause consumer to wait
          sem_wait(sem_mutex);  // makes sure when we are executing this section no other process executes at the buffer
          item = bp->buf(bp->out); // just retrieving the buffer. putting into item.
          bp->count = bp->count - 1;          
          bp->out = (bp->out + 1) % INPUT_BUF_SIZE; // updating out index variable, this is a circular bufer
          printf("retrieved item is: %s", item); 
          twodimen(atoi(&item(0)) - 1)(0) = atoi(&item(0));  
          twodimen(atoi(&item(0)) - 1)(2) = twodimen(atoi(&item(0)) - 1 )(2) + atoi(&item(4)) * vector(atoi(&item(2)) - 1);
          sem_post(sem_mutex); //
          sem_post(sem_empty); // number of empty cells in the buffer should be 1 more. incrementing empty size.           
   resultfileptr = fopen(resultfilename, "w+");
   for(int i = 0; i < NUMBER_OF_ROWS; i++){
     for(int j = 0; j < COLS; j++){
       if(twodimen(i)(j) != 0 && twodimen(i)(j + 2) != 0){
         char str(10);
         sprintf(str, "%d %d n", twodimen(i)(j), twodimen(i)(j + 2));
         fprintf(resultfileptr, "%s", str);      
   printf("consumer ended; bye...n");
   fflush (stdout); 

int main(int argc, char**argv)
  clock_t start_time = clock();
  const char *const matrixfilename = argv(1);
  const char *const vectorfilename = argv(2);
  const char *const resultfilename = argv(3);
  const int K = atoi(argv(4));
  INPUT_BUF_SIZE = atoi(argv(5));
  splitnum = K; 
  printf ("mv startedn");
  printf ("%sn", matrixfilename); 
  printf ("%sn", vectorfilename); 
  printf ("%sn", resultfilename);
  printf ("K is %dn", K);
  printf ("splitnum is %dn", splitnum);
  printf ("INPUT_BUF_SIZE is %dn", INPUT_BUF_SIZE);

    printf("Buffer input should be between 100 and 10000, BUFSIZE = 10000 will be used as default n");

  FILE *fileptr;
  count_lines = 0;
  char filechar(10000), chr;
  fileptr = fopen(matrixfilename, "r");
  // extract character from file and store it in chr
  chr = getc(fileptr);
  while(chr != EOF)
    // count whenever new line is encountered
    if(chr == 'n')
      count_lines = count_lines + 1;
    // take next character from file
    chr = getc(fileptr);
  printf("countlines is %d n", count_lines);
  fclose(fileptr); // close file
  printf("There are %d lines in in a filen", count_lines);

  int s = count_lines / K;
  int remainder = count_lines % K;

  printf("S is %d n", s);

  FILE *fw, *fr;
  char *line = NULL;
  size_t len = 0;
  ssize_t read;
  for(int i = 0; i < K; i++){
    char filename(20) = "splitfile";
    char txt(5) = ".txt";
    char its(10);
    sprintf(its, "%d", i);
    strcat(filename, its);
    strcat(filename, txt);

    fw = fopen(filename, "w+");
    fr = fopen(matrixfilename, "r");
    if(i == K - 1){
    for(int j = 0; j < count_lines; j++){
        while(((read = getline(&line, &len, fr)) != -1) && j >= (i * s)){
            char *line_copy = strdup(line);
            fprintf(fw, "%s", line_copy); 
    for(int j = 0; j < count_lines; j++){
        while(((read = getline(&line, &len, fr)) != -1) && j >= (i * s) && j <= (i + 1) * s - 1){
            char *line_copy = strdup(line);
            fprintf(fw, "%s", line_copy); 

    FILE *vectorfileptr;
    vector_lines = 0;
    char vchr;
    vectorfileptr = fopen(vectorfilename, "r");
    vchr = getc(vectorfileptr);

    line = NULL;
    len = 0;

    while(vchr != EOF)
      // count whenever new line is encountered
      if(vchr == 'n')
        vector_lines = vector_lines + 1;
      // take next character from file
      vchr = getc(vectorfileptr);
    printf("There are %d lines in vector filen", vector_lines);    


    vectorfileptr = fopen(vectorfilename, "r");
    if (vectorfileptr == NULL)

    int linenumber = 0;
    while ((read = getline(&line, &len, vectorfileptr)) != -1) {
          char *line_copy = strdup(line);    
          vector(linenumber) = atoi(line_copy);
    for(int i = 0; i < vector_lines; i++){
      printf("vector %d: %dn", i, vector(i));
  FILE *countfileptr;
  countfileptr = fopen(matrixfilename, "r");
  while ((read = getline(&line, &len, countfileptr)) != -1) { 
        char *line_copy = strdup(line);
        if(atoi(&line_copy(0)) > NUMBER_OF_ROWS){
          NUMBER_OF_ROWS = atoi(&line_copy(0));

  /* first clean up semaphores with same names */
  sem_unlink (SEMNAME_MUTEX); 
  sem_unlink (SEMNAME_FULL); 
  sem_unlink (SEMNAME_EMPTY); 

  /* create and initialize the semaphores */
  sem_mutex = sem_open(SEMNAME_MUTEX, O_RDWR | O_CREAT, 0660, 1);
  if (sem_mutex < 0) {
    perror("can not create semaphoren");
    exit (1); 
  printf("sem %s createdn", SEMNAME_MUTEX);

  sem_full = sem_open(SEMNAME_FULL, O_RDWR | O_CREAT, 0660, 0);
  if (sem_full < 0) {
    perror("can not create semaphoren");
    exit (1); 
  printf("sem %s createdn", SEMNAME_FULL);

  sem_empty = sem_open(SEMNAME_EMPTY, O_RDWR | O_CREAT, 0660, BUFSIZE); // initially bufsize items can be put 
  if (sem_empty < 0) {
    perror("can not create semaphoren");
    exit (1); 
  printf("sem %s createn", SEMNAME_EMPTY); 

  for(int i = 0; i < splitnum; i++){

   int err;
   pthread_t tid(splitnum); 
   printf ("starting threadn"); 
   for(int i = 0; i < splitnum; i++){
     err = pthread_create(&tid(i), NULL, (void*) mapperThread, (void*)(intptr_t)i);
     if(err != 0){
       printf("n Cant create thread: (%s)", strerror(err));
   pthread_t reducertid;
   pthread_create(&reducertid, NULL, (void*) reducerThread, (char*) resultfilename); 

   for(int i = 0; i < splitnum; i++){
   // join reducer thread
  // closing semaphores
  /* remove the semaphores */
  fflush( stdout );


/* -*- linux-c  -*-  */

#ifndef COMMON_H
#define COMMON_H
#define TRACE 1
#define SEMNAME_MUTEX       "/name_sem_mutex"
#define SEMNAME_FULL        "/name_sem_fullcount"
#define SEMNAME_EMPTY       "/name_sem_emptycount"   
#define ENDOFDATA -1 // marks the end of data stream from the producer
// #define SHM_NAME  "/name_shm_sharedsegment1"

#define BUFSIZE 10000       /*  bounded buffer size */
// #define NUM_ITEMS 10000      /*  total items to produce  */

/* set to 1 to synchronize; 
otherwise set to 0 and see race condition */
#define SYNCHRONIZED 1   // You can play with this and see race

struct buffer{
    struct buffer *next;
    char * buf(BUFSIZE);    // string array
    int count;           /* current number of items in buffer */
    int in; // this field is only accessed by the producer
    int out; // this field is only accessed by the consumer
    int source; // index of the producer

struct buffer *head = NULL;
struct buffer *current = NULL;

void printList(){
    struct buffer *ptr = head;

    while(ptr != NULL){
        printf("items of buffer %d: n", ptr->source);
        printf("buffer count is : %d n", ptr->count);
        printf("buffer in is : %d n", ptr->in);
        printf("buffer out is : %d n", ptr->out);                
        for(int i = 0; i < ptr->count; i++){
            printf("%s", ptr->buf(i));
        ptr = ptr->next;

void insertFirst(int count, int in, int out, int source){
    struct buffer *link = (struct buffer*) malloc(sizeof(struct buffer));
    for(int i = 0; i < BUFSIZE; i++){
        link->buf(i) = "";
    link->count = count;
    link->in = in;
    link->out = out;
    link->source = source;

    link->next = head;

    head = link;

struct buffer* find(int source){
    struct buffer* current = head;

    if(head == NULL){
        return NULL;
    while(current->source != source){
        if(current->next == NULL){
            return NULL;
            current = current->next;
    return current;


bitcoind – Send bitcoin with a bitcoin core without synchronization with the network

I want to use bitcoin-core only to send bitcoins from my address to another destination address. I don't need the huge historical information from the blockchain. In fact, I want to run a light bitcoin-core service on my local machine and simply use its associated commands to create, sign and send a transaction. Is this possible without synchronization with the blockchain network and download of blocks?

Thanks in advance

Reza Hedayati

why implement synchronization by disabling interrupts?

Why is the implementation of synchronization by disabling interrupts not appropriate in a single processor system if the synchronization primitives are to be used in user level programs?

Bitcon Core wallet showing zero after synchronization

My dad tried to sync his Bitcon Core wallet and he doesn't know why the sync took less time than the wallet had previously estimated. After synchronization, the wallet showed a crash and the balance is zero. He checked the portfolio 3-4 times but the balance is still the same.

How can my father return the money?