java – How to implement greaterThan in embeed document spring data mongoDB

Member.class

@Document(collection = "alfagift_member")
public class Member {

    @Field(value = "full_name")
    private String fullName;

    @Field(value = "member_id")
    private String memberId;

    @Field(value = "pin")
    private Pin pin;
}

Pin.class

public class Pin {

    @Field(value = "encrypted_value")
    private String encryptedValue;
    
    @Field(value = "last_blocked")
    private Date lastBlocked;
}

MemberRepository.class

@Repository
public interface MemberRepository extends MongoRepository<Member, String> {

  @Query(value="{'member_id' : ?0}, {'pin.last_blocked' : ?1}")
  Member findByMemberIdAndLastBlockedGreaterThan(Integer memberId, Date now);
}

Then I tried to make a query method like this, but the function of greaterthan itself doesn’t work

I was confused, how to solve it ??

applications – How to implement APK pipelines in Android core under Software Interoperability Act, enacted by the Congress?

re.:
How to implement APK pipelines in Android core under Software Interoperability Act, enacted by the Congress

Software interoperability is well supported in health industry, enabling patient’s test data from one medical equipment to read by another equipment to make COVID-19 treatment an integrated process between health institutes, hospitals.

There are Ts of applications developed by third parties in Google Play store, which don’t interoperate, since were never intended to be run in pipelines.

Good example is live analog audio input processing

APKs in the store, generally read audio as input, process and output live, to file, via Bluetooth, WiFi

Since I build Live Audio > MIDI stream > MIDI animation + sound out software pipeline, made of
APKs developed by third parties

my pipeline works in off-line mode, manually operated only.

I can run 2 applications in parallel,

  1. reading audio input from analog grand piano, converting to MIDI
    but MIDI streaming or output to streaming device is not supported.

All I can do is to save generated MIDI to file

  1. I need to open second app and open saved MIDI file within it and manually click to open it
    to have MIDI animation generated live.

Under Software Interoperability Act, enacted by Congress, developers of software,
may offer interfaces, API, streaming devices to support building of software pipelines made
of software blocks developed by third parties.

Contacting developers fails to work since one is living in Osaka Japan, another in Spain and one another somewhere in the Internet space, not responding to email contacts.

So let me know state-of-the-art in Software Interoperability in case of Android and Android APKs, published via Play Store
and if such tools, of interest to me and other, are offered by Android core development team.

thank you

❕NEWS – Twitter to implement subscription model to their platform after ads revenue fall | Proxies123.com

As their ads earning dipped 23% in the second quarter of this year, Twitter is now mulling over to develop a paid subscription version of the platform. The pandemic and civil unrest that spreads throughout US states are the one to blame for the dip. Some people speculate that this new subscription will be ads free and enable creators to put paywall to their creations.

javascript – JS Stopwatch – This is a good way to implement the observer pattern?

I’m learning oop and also trying to learn and implement some design patterns.
This question is a follow up of Stopwatch interface OOP (Vanilla JS)

The app is available in https://nacho-p5.github.io/

Here’s the code:

Repo: https://github.com/nacho-p5/nacho-p5.github.io

Community gave me good feedback and I made the following changes to my first codebase:

  • Changed syntax to ES6
  • Methods added to prototype rather than instance
  • Vars, attrs and methods names changed to be descriptive
  • Replaced error handler logic when start/stop are clicked twice
  • Time tracker logic changed. Count is calculated using Date.now() rather than counting setInterval iterations
  • Script tag position changed to head using defer
  • Stopwatch class should not know about the DOM -> Observer pattern implemented

As I wrote in the last point, I refactored the code using the observer pattern. I had two goals doing that:

  1. Implement the observer pattern
  2. One class – One thing: separation of concerns in stopwatch, ui and controller class

I know that trying to implement design patterns in a simple problem like this seems like overwork. This is purely for learning purposes.

What do you think about the code? Any feedback will be appreciated 🙂

stopwatch.js

class Stopwatch {
    _timer = 0;
    isRunning = false;
    startTime = 0;
    elapsedTime = 0
    observers = ()

    get timer() {
        return this._timer
    }
    
    set timer(val) {
        this._timer = val
        this.notifyController(val)
    }

    registerObserver(observer) {
        this.observers.push(observer);
    };

    notifyController(val) {
        this.observers.forEach(observer => {observer.update(val)})
    }

    updateTime() {
        const newTime = Date.now() - this.startTime + this.elapsedTime;
        this.timer = newTime;
    };

    start() {
        if (!this.isRunning) {
            this.isRunning = true;
            this.startTime = Date.now();
            this.setIntervalID = setInterval(this.updateTime.bind(this), 100);
        };
    };

    stop() {
        if (this.isRunning) {
            clearInterval(this.setIntervalID);
            this.isRunning = false;
            this.elapsedTime = this._timer;
        };
    };

    reset() {
        clearInterval(this.setIntervalID);
        this.isRunning = false
        this.elapsedTime = 0;
        this.startTime = 0;
        this.timer = 0;
    };
};

class UI {
    constructor(displayID, btnStartID, btnStopID, btnResetID) {
        // HTML Components
        this.buttons = {
            start: document.getElementById(btnStartID),
            stop: document.getElementById(btnStopID),
            reset: document.getElementById(btnResetID)
        },
        this.display = document.getElementById(displayID)
    };

    resetAllButtonsStyle() {
        Object.values(this.buttons).forEach(e => e.classList.remove('activeBtn'))
    };

    showButtonAsActive(btn) {
        this.resetAllButtonsStyle();
        btn.classList.add('activeBtn')
    };

    updateDisplay(value) {
        this.display.innerText = value;
    };
}

class Controller {
    constructor(sw, ui) {
        this.sw = sw;
        this.ui = ui;

        // Add event listeners
        this.ui.buttons.start.addEventListener('click', function() {
            sw.start();
            ui.showButtonAsActive(this);
        });
        this.ui.buttons.stop.addEventListener('click', function() {
            if (sw.isRunning) {
                sw.stop();
                ui.showButtonAsActive(this);
            };
        });
        this.ui.buttons.reset.addEventListener('click', function() {
            sw.reset();
            ui.resetAllButtonsStyle();
        });
    }

    update(val) {
        ui.updateDisplay((val/1000).toFixed(3))
    }
}


// Initialize classes

const ui = new UI('sw-display', 'btnStart', 'btnStop', 'btnReset');
const sw = new Stopwatch();
const controller = new Controller(sw, ui);

// Register controller in sw 
sw.registerObserver(controller);

////////////////////////

plugins – How to implement Sentry on WordPress?

I found out I can take the code of the bundle and the initialization and put in the header, using “add scripts to header and footer” plugin. https://wordpress.org/plugins/header-and-footer-scripts
It took me time to notice I can’t put the initialization within the bundle import.
Got something like this:

<script
  src="https://browser.sentry-cdn.com/5.20.1/bundle.min.js"
  integrity="sha384-O8HdAJg1h8RARFowXd2J/r5fIWuinSBtjhwQoPesfVILeXzGpJxvyY/77OaPPXUo"
  crossorigin="anonymous">
</script>
<script>
Sentry.init({ dsn: 'https://unique@unique' });
</script>

E-commerce Process Automation | 14 Things Every Online Business Should Implement

JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.


There is no doubt hard-working can grow your eCommerce or online business but you have to implement different processes to automate your business operations for getting higher ROI (Return Over Investment) value. Once there was a time when process automation was considered only for big organizations but nowadays, smaller companies can also automate their processes to improve efficiency and reduce labor costs. Process automation is a software, system, or strategy used for digital transformation based on the AI or Machine learning.

As an online shopping store owner, you need to show the right products on your website and fulfill different orders, payments 24/7, dispatch packages and many more. So, it will be difficult to manage thousands of customers without automating your eCommerce processes.

In this article, you will understand all the basics of business process automation, different examples, why you need to automate, principles of BPA, what processes can be automated and the benefits of process automation. Moreover, you will also learn 15 ways to automate your e-commerce business.

Full Article Source: https://www.temok.com/blog/ecommerce-process-automation/

 

How to implement code in the template under wix website

I have made a design of a website using Wix. But I don’t know how to implement code in it. For example, I want to add validation in the form. How to do that?

java – How to implement the “technological tree” drawing?

I want to make a tech tree at least like in Civilization, but I don’t know how to do it. I want to fill in some data structure and then display it on the screen in the form of a technology tree, but I don’t know how to implement it in code.

The only way I came up with was:

public class Technology1
{
String name;
TextButton button;
LinkedList<Technology1> NextTech;
}

TextButton is the libGDX class with which I was going to display each individual technology on the screen.

LinkedList NextTech- all technologies that are accessed after studying the current one are stored here. In other words, “children” are stored here The problem is how to set the coordinates for all technologies in such a tree so that they do not overlap when displayed and that it looks more or less normal overall.

If I started to do it wrong, then please tell me a more correct option.

How to implement DAO design pattern for a game?

I’m trying to learn how to implement a DAO design pattern for a game. In my game, I have a database layer which has user objects. Then in the code, I have a DAO class DAO_USER which reads and writes to the database.

Once it reads from the database, it creates class instances of the user objects MDL_USER which model the properties of the database object such as id and name.

Then the business logic of the game will called GET and SET methods of the MDL_USER class instance.

My idea here is that, the business logic will only interact with the MDL_USER object, which that only interacts with the DAO_USER object which only interacts with the database.

The thing to note here is now I have the data in the database and a local copy of it in the MDL_USER object. If I do a SET update, I need to update the local copy and the database, but only if the database update succeeded. If I do a GET, it can just read from the local copy.

Where I am getting stuck is, in my program in the DAO_USER class, it imports the MDL_USER class just to make the class instances of it. However the MDL_USER class needs to import the DAO_USER class to call its method to update the database.

This creates a circular loop in imports and makes it error out. How can I improve this design so it works?

Thanks

database design – How to implement a website with translatable articles?

I am developping a website that is supposed to be in at least two languages. I am now a skilled developper, but I never had to deal with i18n.

The owner of the site will create a new article in a language (say English) and link it to a category. Then, a translator will translate that article into another language (say Spanish) and it will appear in the same category in the other language. It must be the same article translated! It is not like Wikipedia, where two versions of the site coexist and sometimes you can link to the other. I intend to implement a warning “translation missing for article blahblahblah“, articles are single entities in multiple languages.

I had a few ideas so far, but I can’t decide which is best:

My first idea was to have a “main language”. In the articles tables, I would have:

id SERIAL
title VARCHAR
content TEXT
author_id FK
category_id FK
created_at DATETIME

I would then have a translations table with:

lang VARCHAR(2)
title VARCHAR
content TEXT
article_id FK

The problem is that, sometimes, the articles are created in a “secondary language” first, and then translated into the “main language” (there are some community contributions involved). This is therefore not an option.

My next approach was to have an articles table containing pretty much nothing:

id SERIAL
category_id FK
created_at DATETIME

And then to have translations:

lang VARCHAR(2)
title VARCHAR
content TEXT
author_id FK
article_id FK

Then, when I want to load the list of articles (or the content of a given one), a JOIN gives me content from both tables, based on the current language preferences of the viewer.

This looks promising but also highly unmaintainable (although it’s just my feeling).

Last idea was to have an articles table with all the content:

id SERIAL
lang varchar(2)
title VARCHAR
content TEXT
base_article FK
author_id FK
category_id FK
created_at DATETIME

The based_on field is a foreign key to another article. If it is not null, some content from the base article will be used (category, for instance). If I want to display all articles in a given language and in a given category, the query is not trivial: I have to find all articles that match the category and the language, plus those that have the correct language, a base_article not null, only if the base_article has the same category.

This is not so easy to implement and so very easy to screw up. I have to think about loops, redundancy and deletions of entries are a nightmare.

I couldn’t find any documentation about what is usually done. The versions up there are only presented to show what I’ve done so far, I’m not convinced it’s good. I believe I should simply do as others do (I’m certainly not the first one to face this wall).

How does the world translate websites?