timestamp – Compare two dates saved in SharedPreferences

I want to save the current date when I click a button and then I want to compare this date every day with the current one; BUT if it’s been 30 days since the first day the app needs to do something. The problem is that there is an overwrite of dates every day, while to make the comparison with the thirtieth day I only need the first date. Maybe the solution is in the shared preferences keys but I don’t know how. Thank you.

long timeNew = System.currentTimeMillis();

long timeOld = sharedPreferences.getLong("UPDATE_TIMESTAMP", 0L);
   
editor.putLong("UPDATE_TIMESTAMP", timeNew);
sharedPreferences.edit().apply();

long millis = 2592000000L // 30 days

if (timeNew == dayOld + millis) {
// do something} // This works onlfy if I make an access the day 1 and after 30 days, while if I make an access day 1, day 2, day 3 and day 30, the comparison is beetwen day 3 and day 33.

Can a website steal passwords saved in my browser?

Today I was on Steam and someone sent me a link and asked me to vote for him in some online gaming league. I clicked on it and the browser told me that this could be an unsafe link so I didn’t proceed further. Then I opened in another browser to see if it was a legit site.

I see that this was a domain registered today and on it there are some game related content but it looks very suspicious. What I am curios about is if I am at risk? Can they steal browser content such as bookmarks or saved passwords and cookies by just navigating to a website?

Woocommerce Dynamic Pricing – show amount saved in cart

I would like you to help me with this problem, I am working with Woocommerce Dynamic Pricing and everything is going well, the problem is that the client wants to show how much a client has saved below the sub-total, all good until there, the problem is The discount given by dynamic pricing does not call me, instead it calls me the sale price, which is the normal woocommerce discount, I am using this code which is the one that has shown me the discount best:

function wc_discount_total() {
   global $woocommerce;
    $discount_total = 0;
      
    foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values) {
          
    $_product = $values('data');
  
        if ( $_product->is_on_sale() ) {
        $regular_price = $_product->get_regular_price();
        $sale_price = $_product->get_sale_price();  
        $discount = ($regular_price - $sale_price) * $values('quantity');
        $discount_total += $discount;
        }
    }        
    if ( $discount_total > 0 ) {
    echo '<tr class="cart-discount">
    <th>'. __( 'Your Savings', 'woocommerce' ) .'</th>
    <td data-title=" '. __( 'You Saved', 'woocommerce' ) .' ">'
    . wc_price( $discount_total + $woocommerce->cart->discount_cart ) .'</td>
    </tr>';
    }
}
add_action( 'woocommerce_cart_totals_before_shipping', 'wc_discount_total', 99);
add_action( 'woocommerce_cart_totals_before_shipping', 'wc_discount_total', 99);

the problem is in this line: “$sale_price = $_product->get_sale_price();” this calling is the woocommerce discount price and not the discount price that dynamic pricing gives, could you help me since I have more than 5 days trying to find the code and I could not!

Custom block being saved as core block

I have setup a custom block (my-block/my-first-block). The block works when adding it to the editor, but after saving and reloading the page I get this message:

Your site doesn’t include support for the “core/my-first-block” block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely.

In the database the block is being saved as <!-- wp:my-first-block -->

I’m enqueueing my block script with the enqueue_block_editor_assets hook and I’m registering my block in php on init.

In the JS, I return null in the save function, because I’m using dynamic rendering.

I have found other threads where a similar problem has occurred, but never where it seems the block is being saved as a “core” block. What could cause this?

How to be sure that views are saved?

I just had a terrible learning experience. I spent several days building up a bunch of views, only to find that they vanished entirely from my site when I synchronized my configurations to handle another issue. They’re gone. I have a dump of the db, but they’re not on there either.

The funny thing is that not all of the views are gone. Some that I made several weeks ago are there, but the more recent ones are irrevocably lost.

And yes, I clicked “Save” on each view when I was creating it.

How can I be sure that this never happens again? What steps do I need to take save the views permanently in the db?

Version: Drupal 8.9.6

spotlight – Saved Searches in Finder Don’t Work

I tagged all my 3rd Party Applications with a tag called “Third Party” and then did a search in Finder for all applications with this Tag and saved the search. It seemed to work.

Then I noticed that some preference panes that were third party weren’t included. So I removed the “Kind” search criteria and still no preference panes. I checked the Finder sidebar and there is a tag for “Third Party” and it does have the preference panes included.

I tried a new search with Kind = “macOS Preference Pane” but that returned nothing, even though I copied that from a 3rd part Preference Pane’s Get Info window.

What is going on?

magento2 – The stock item was unable to be saved on freshly installed Magento v2.4.0

I installed the sample data ok – but when I try to add a new product, or even save changes to an existing product this happens:
enter image description here

In the exception.log I get:
(2020-09-28 10:00:44) main.CRITICAL: The stock item was unable to be saved. Please try again. {“exception”:”(object) (MagentoFrameworkExceptionCouldNotSaveException(code: 0): The stock item was unable to be saved. Please try again. at /var/www/html/magento/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php:187, MagentoFrameworkExceptionLocalizedException(code: 0): Could not ping search engine: No alive nodes found in your cluster at /var/www/html/magento/vendor/magento/module-elasticsearch/Model/Adapter/Elasticsearch.php:122)”} ()

I did install the latest version of elasticsearch and it’s up and runnning on localhost.
I can even telnet into it.

I’ve heard someone say disable MSI – would that help? If so how do I do that please?

Thanks In Advance!

¿Cual es la razon de ser de saved id en UNIX?

No se cual es la diferencia

Estoy aprendiendo con este tutorial, exactamente de lo que estoy preguntando se empieza a hablar en el minuto 35:12.

  • real id: Es el usuario que inicio el proceso, segun he entendido
  • effective id: Es el usuario que determina los privilegios
  • saved id: la llamada al sistema exec inicializa este id de usuario de
    manera que este valor es igual al de effective id

No se muy bien como es lo del saved id, hasta donde he entendido es como tener el effective id repetido dos veces. ¿En que se diferencia saved id del effective id de un proceso en cuestión?