Possible to avoid cost increase in move to GCP MySQL Second Generation?

I was using pay-per-use with MySQL first generation. It was a website with all I was using pay-per-use with MySQL first generation. It’s for a website with all pages cached in memcached and only evicted from cache when I update content. Writes to SQL can also occur if somebody register for newsletter or similar (happens ~10 times/month). I was getting away for free with the pay-per-use model, but that model is not available in the second generation.

As far as I can understand, there is no way to get below $ 7 per month now with the new model. Is that correctly understood?

Or is there an API where I can turn on/off the SQL instance when I receive a registration or update content? It feels strange to pay so much for a service I use for less than a second 10-100 times per month.

QEMU: qcow2 and RAM…..which filesystem combi (avoid writing journal twice)?

Let’s say my host disk is using EXT4, I place an image-file for my virtual machine in either QCOW2 or RAW format which again is formatted with EXT4 inside. Wouldn’t journal data be written twice? First in the guest drive and then on the host? Can I safely disable journal in one of them? Or should I use a combination of two different filesystems on host and guest (if both are Linux). If guest is Windows using NTFS, which also seem to be a journal-like filesystem, could I safely disable journal on host EXT4 FS?

How to develop real-time application avoid update collisions and log data updates

I have an application with react/node.js and firebase db.

Application is a page form where non-logged in user[customer] ( with session Id cookie) fills his details for buying a product (each product is assigned with a seller).

There are registered users, sellers, with a dashboard where they can see / edit that forms (customer’s or product details).

I want to make it real-time but of course there is always the problem of double update an input by both seller and non-logged user.

How can I prevent that? Should I add a flag on the session in the db with a timestamp and currentEditor so I should not allow the other person to edit but only to view the real-time changes? (And if the flag’s timestamp isn’t updated it would allow the other user to take control after a certain time).

Also If I want to log the changes that have been done ( for example seller changed address number on xxx date) should I create a separate database and log something like Session Id, user, data name, data value, date)?

Is my plan correct or is there a better solution?

How avoid Azure Subscription suspension?

Two weeks ago, all our Azure production systems went down, and we received an e-mail from them saying

We’ve disabled your Azure subscription

To protect the security and privacy of your account, we perform routine audits of all Azure subscriptions. During one of these audits, we identified suspicious activity in your subscription that violates the Microsoft Acceptable Use Policy. We’ve disabled your subscription until the issue can be resolved.

If you believe this is an error, please contact Azure support.

We knew of no problem, and had received no previous warnings, so we contacted support. (We have a Standard support plan, which gets us a fairly quick response, but not necessarily a resolution.) After 11 hours (and many e-mails) everything turned on again and we received a message saying simply

You subscription is enabled.

Microsoft have not answered queries for an explanation as to what this “suspicious activity” was, nor how they resolved the situation and were able to enable our account again. They have not explained why they could provide no information about the cause of the problem for the duration of the problem.

Has anyone else experienced this? How can we avoid it in future?

Avoid a while(continueListening) {} in main thread

I have the following piece of code:

public static void main(String[] args) {     ...     while(condition.continueListening()) {     }     log.info("Finished"); } 

The condition object creates its own thread that after one condition is met, make the method continueListening, to return false.

The thing is that, I want the main thread to not to finish until that method returns false, and the way I implemented it, it’s by using this structure that it’s quite “hard” for the CPU, do you know any other approach that could work better?

Pandas how to avoid apply in groupby nlargest n

Pandas apply is generally recommended not to be used. I have a situation here where I am interested if there are more efficient alternatives to the option of apply.

import numpy as np import pandas as pd  df = pd.DataFrame({'year': [1990,1990,1990,1992,1992,1992,1992,1993,1993,1993],                    'item': list('abcdefghij'),                   'value': [100,200,300,400,500,600,700,800,900,990]}) df 

I would like to get top 2 values for each year.

df.groupby('year')['value'].apply(lambda x: x.nlargest(2)).reset_index() 

Is there any alternative to this? Anything whether longer lines of codes or whatever!

How to avoid bad bounce rate and boost good bounce rate?

I’m working on a comparing website. We got lots of traffic from the blog article, yet the bounce rate is so high. We perform well on acquisition but bad on keeping the user in the site then generate good bounce rate. (checked on Similar web most user bounce to non-reveune generated website) Do u got any suggestion/ sample to enhance the situation with good bounce rate?