magento2 – Don’t Sort by Name when have Mysql Search Engine Magento 2.4.1

I installed the Weltpixel AjaxLayeredNavigation extension and with the Swissup extension of Mysql Legacy Search Engine, having both activated when I want to sort by name gives me the following SQL error: Column not found: 1054 Unknown column ‘nameasc’ in ‘order clause’

If someone has gone through a similar error please it would be of great help.

Is there a search engine that supports searching using regex or wildcards?

I have a part of email address. I need to find a full one.
Part of email address example: amazon***@gmail.com.
I want to find all emails on web where characters instead of *.
As far as I know, Google doesn’t support it. (Or no?)
So, is there a search engine that can help me?
Hope for your help!
Thanks in advance!

vulkan – How does a subpass dependency guarantee the layout transition of a swapchain image happens after presentation engine finish reading the very image?

I’m going through vulkan-tutorial:

https://vulkan-tutorial.com/Drawing_a_triangle/Drawing/Rendering_and_presentation

And I found something weired:
enter image description here

How does this subpass dependency guarantee the layout transition(from UNDEFINED to COLOR_ATTACHMENT_OPTIMAL)of swapchain image happens after present engine finish reading(or working on) this swapchain image?i.e.Layout transition of this swapchain image from external to subpass0 guarantees to happen after the imageAvailableSemaphores is signaled.

I did find some explanations on this topics from this blog:

Yet another blog explaining Vulkan synchronization

External subpass dependencies Render passes in Vulkan have a concept
of EXTERNAL subpass dependencies. This is arguably the most
misunderstood aspect of Vulkan sync. I’d like to dedicate a section to
this, because too many developers are lured into using it in cases
where it’s not terribly useful and very likely to cause bugs.

The main purpose of external subpass dependencies is to deal with
initialLayout and finalLayout of an attachment reference. If
initialLayout != layout used in the first subpass, the render pass is
forced to perform a layout transition.

If you don’t specify anything else, that layout transition will wait
for nothing before it performs the transition. Or rather, the driver
will inject a dummy subpass dependency for you with srcStageMask =
TOP_OF_PIPE_BIT. This is not what you want since it’s almost certainly
going to be a race condition.
You can set up a subpass dependency with
the appropriate srcStageMask and srcAcessMask. The external subpass
dependency is basically just a vkCmdPipelineBarrier injected for you
by the driver. The whole premise here is that it’s theoretically
better to do it this way because the driver has more information, but
this is questionable, at least on current hardware and drivers.

There is a very similar external subpass dependency setup for
finalLayout. If finalLayout differs from the last use in a subpass,
driver will transition into the final layout automatically. Here you
get to change dstStageMask/dstAccessMask. If you do nothing here, you
get BOTTOM_OF_PIPE/0, which can actually be just fine. A prime use
case here is swapchain images which have finalLayout =
PRESENT_SRC_KHR.

Essentially, you can ignore external subpass dependencies. Their added
complexity give very little gain. Render pass compatibility rules also
imply that if you change even minor things like which stages to wait
for, you need to create new pipelines! This is dumb, and will
hopefully be fixed at some point in the spec.

However, while the usefulness of external subpass dependencies is
questionable, they have some convenient use cases I’d like to go over:

Automatically transitioning swapchain images Typically, swapchain
images are always just used once per frame, and we can deal with all
synchronization using external subpass dependencies. We want
initialLayout = UNDEFINED, and finalLayout = PRESENT_SRC_KHR.

srcStageMask is COLOR_ATTACHMENT_OUTPUT which lets us link up with the
swapchain acquire semaphore.
For this case, we will need an external
subpass dependency. For the finalLayout transition after the render
pass, we are fine with BOTTOM_OF_PIPE being used. We’re going to use
semaphores here anyways.

I also do this in Granite.

I Will Do Monthly SEO Optimization And Rank Your Website On Google Search Engine Through Proper SEO for $125

I Will Do Monthly SEO Optimization And Rank Your Website On Google Search Engine Through Proper SEO

I Can Do Seo Optimization And Rank Your Website On Google Search Engine Through Proper Seo Techniques.
I Will Increase Organic Web Traffic Of Your Site With White Hat Strategies And Tactics.


You Want To Improve Google Seo Of Your Site?
You Are At Right Place!


My Services Include:


  • Competitor Analysis
  • Keyword Research
  • Meta Title Optimization
  • Meta Description Optimization
  • Updated Robots.txt Submission
  • Updated Sitemap
  • .xml Submission
  • Google Analytics Setup
  • Heading Tags Optimization
  • Content Related Urls Check
  • High Da Pa Quality Back-links
  • Image Alt Tags Check
  • Seo Friendly Url




Preferred Platforms :

  • Weebly
  • Wix
  • Shopify
  • WordPress
  • Godaddy
  • Squarespace
  • Magento


Feel Free To Contact Me Any Time. I Am Available 24/7 For Your Assistance.


Thanks!

.

lightmap – Godot Engine: Why is baking light making my scene darker?

Apparently I don’t understand real time lighting. I have an interior scene with some windows. The light is from an OmniLight near the ceiling, default environmental light from outside, and a desk lamp with emission. Without baking light, the scene looks like this:

enter image description here

Consistent with the documentation for emission, the desk lamp is not affecting the surrounding objects. I want to bake the light to see the lamp’s effect and to support low end hardware.

I followed the baked lightmaps tutorial and set the BakedLightmap’s extents to encompass the entire room. After baking, the scene looks like this:

enter image description here

I can see the lamp’s light, as expected, but now everything is too dark. It is unclear to me from Godot’s documentation if scenes include indirect light without baking. I have tried this with the OmniLight set to bake “all” and only indirect light.

What am I missing here?

object oriented – Rust backtest forex engine

I wrote a backtest engine in Rust – essentially it is a bunch of if statements mutating variables in a intensive loop.

Recently I had to rewrite the whole because it was getting too complicated for me to understand.

I first wrote the code in my usual procedural style with functional iterators. When it started getting complicated, only thing that made sense was object-oriented style – a big struct with many methods.

It’s easier now and makes sense. Is object-oriented style idiomatic Rust for this kind of problem?

Here is the core code

object-oriented

loop

let mut engine = Backtest{
        instruments,
        strategies,
        algos: data.clone(),
        combos,
        timestamps,
        candles:all_candles.clone(),
        equity: accounts(0).balance,
        initial_balance: accounts(0).balance,
        balance: accounts(0).balance,
        entry_candle: None,
        entry_timestamp_option: None,
        tp_price: None,
        sl_price: None,
        combo: None,
        instrument_candles_option: None,
        instrument_option: None,
        entry_candle_iter_option: None,
        entry_candle_index: 0,
        index_time: None,
        index_candle: None,
        candles_cursor: 0,
        prog_candles: vec!(),
        progs: vec!(),
        entry_price: None,
        exit_price: None,
        wl: None
    };
loop {
        if engine.is_account_drawdown_breached() { break; }

        if engine.entry_candle.is_none() {

            let pti = engine
                .get_previous_timestamp_id();

            let next_combo_candle = engine
                .get_next_combo_candle(&combo_candles,pti);

            if next_combo_candle.is_none() { break; }

            engine.set_instrument_by_candle(next_combo_candle.unwrap());
            engine.set_instrument_candles_by_instrument();

            let ci_from_instrument_candles =
                engine.get_candle_index_from_instrument_candles_by_candle(
                        next_combo_candle.unwrap());
            if engine.is_last_instrument_candle(ci_from_instrument_candles.unwrap()) { break; }

            engine.entry_candle_index = ci_from_instrument_candles.unwrap()+1;
            engine.candles_cursor = ci_from_instrument_candles.unwrap()+1;
            engine.set_entry_candle();
            engine.set_entry_timestamp();
            engine.set_combo();
            engine.set_tp_price();
            engine.set_sl_price();
            engine.set_entry_price();
        }

        // set up candle index
        engine.set_index_candle();
        if engine.is_last_index_candle() { break; }
        engine.set_index_time();
        engine.add_to_prog_candles(engine.index_candle.unwrap());

        engine.set_exit_price();
        engine.set_balance();
        engine.add_to_progs();

        engine.reset_prog_candles();

        engine.increment_candles_cursor();
    }

struct with methods

use crate::db::model::define::*;
use chrono::Duration;

pub struct Backtest {
    pub instruments:Vec<Instrument>,
    pub strategies:Vec<Strategy>,
    pub algos: Vec<Algo>,
    pub combos: Vec<Combo>,
    pub timestamps: Vec<Timestamp>,
    pub candles:Vec<CandleTable>,
    pub equity:f64,
    pub initial_balance:f64,
    pub balance:f64,
    pub entry_candle:Option<CandleTable>,
    pub entry_timestamp_option:Option<Timestamp>,
    pub tp_price:Option<f64>,
    pub sl_price:Option<f64>,
    pub combo:Option<Combo>,
    pub instrument_candles_option:Option<Vec<CandleTable>>,
    pub instrument_option:Option<Instrument>,
    pub entry_candle_iter_option:Option<std::vec::IntoIter<CandleTable>>,
    pub entry_candle_index:usize,
    pub index_time:Option<Timestamp>,
    pub index_candle:Option<CandleTable>,
    pub candles_cursor:usize,
    pub prog_candles:Vec<CandleTable>,
    pub progs:Vec<Prog>,
    pub entry_price:Option<f64>,
    pub exit_price:Option<f64>,
    pub wl:Option<f64>,
}


impl Backtest {

    pub fn is_account_drawdown_breached(&self) -> bool{
        self.balance <= self.initial_balance / 2.0 || self.equity < 0.0
    }

    pub fn is_next_combo_candle_required(&self) -> bool{
        self.entry_candle.is_none()
    }

    pub fn is_last_instrument_candle(&self, index:usize) -> bool{
        self.instrument_candles_option.as_ref().unwrap().get(index+1).is_none()
    }

    pub fn is_last_index_candle(&self) -> bool{
        self.index_candle.is_none()
    }

    pub fn is_trade_expired(&self) ->bool{
        self.index_time
            .unwrap()
            .timestamp
            .signed_duration_since(
                self.entry_timestamp_option.unwrap().timestamp) > Duration::weeks(2)
    }

    pub fn is_buy(&self) -> bool {
        self.combo.as_ref().unwrap().action == 1
    }

    pub fn is_sell(&self) -> bool {
        self.combo.as_ref().unwrap().action == 0
    }
    pub fn set_exit_price(&mut self){
        if self.is_trade_expired() {

            if self.is_buy() {
                self.exit_price = Some(self.index_candle.unwrap().bid_open_num);
            } else {
                self.exit_price = Some(self.index_candle.unwrap().ask_open_num);
            }

        } else if self.is_stop_loss_reached() {
            if self.is_buy() {
                self.exit_price = Some(self.index_candle.unwrap().bid_low_num)
            } else {
                self.exit_price = Some(self.index_candle.unwrap().ask_high_num)
            }
        } else if self.is_take_profit_reached() {
            if self.is_buy() {
                self.exit_price = Some(self.index_candle.unwrap().ask_high_num)
            } else {
                self.exit_price = Some(self.index_candle.unwrap().bid_low_num)
            }
        }
    }

}

procedural

everything

    let account = &accounts(0);
    let strategy = &strategies(0);
    let equity = account.balance;
    let mut balance = account.balance;
    let mut entry_candle:Option<CandleTable> = None;
    let mut entry_timestamp_option:Option<&Timestamp> = None;
    let mut tp_price:Option<f64> = None;
    let mut sl_price:Option<f64> = None;
    let mut combo:Option<&Combo> = None;
    let mut instrument_candles_option:Option<Vec<CandleTable>> = None;
    let mut instrument_option:Option<&Instrument> = None;
    let mut entry_candle_iter_option:Option<std::vec::IntoIter<CandleTable>> = None;
    let mut entry_candle_index = 0;
    let mut index_time:Option<Timestamp> = None;
    let mut index_candle:Option<CandleTable> = None;
    let mut candles_cursor = 0;
    let mut history:History = History{..Default::default()};
    let mut histories:Vec<History> = vec!();

    let mut prog_candles:Vec<CandleTable> = vec!();
    let mut progs:Vec<Prog> = vec!();
    let mut entry_price:Option<f64> = None;
    let mut exit_price:Option<f64> = None;
    let mut wl:Option<f64> = None;


    //Backtest loop

    loop {

        // TODO - add drawdown to db
        if balance <= account.balance / 2.0 || equity < 0.0 {
            break;
        }

        /// Set trade_candle, trade_time, sl, tp
        ///
        /// trade_candle?
        /// ! Entry candle (point of entry) is trade candle.
        /// ! Signal candle is candle where a combo is identified.
        /// Find trade_candle by getting latest combo candle
        /// that hasn't been traded. The entry candle would
        /// be in front.
        ///
        /// trade_time?
        /// timestamp of trade_candle
        ///
        /// sl?
        /// sl from trade_candle
        ///
        /// tp?
        /// tp from trade_candle
        if entry_candle.is_none() {

            // set last known timestamp index
            let last_known_tindex = if entry_candle_index == 0 {
                0 as usize
            } else {
                if index_time.is_none() {
                    println!("{:?} {:?}",index_candle,index_time);
                    unreachable!()
                }
                index_time
                    .unwrap()
                    .id.unwrap() as usize + 1 as usize
            };

            // Get signal candle
            let signal_candle = combo_candles
                .iter()
                .find(|x|
                    x.timestamp_id >= last_known_tindex as i64);
            if signal_candle.is_none() {
                break;
            }

            // set instrument,
            // instrument_id,
            // instrument_candles,
            // signal_candle_index,
            // and check for valid entry candle
            // then set entry candle index,
            // entry candle,
            // entry timestamp
            let instrument_id = signal_candle.unwrap().instrument_id;
            instrument_option = instruments
                .iter()
                .find(|x| x.id.unwrap() == instrument_id);
            let instrument_candles = candles
                .iter()
                .filter(|x| x.instrument_id == instrument_id)
                .cloned()
                .collect::<Vec<_>>();
            instrument_candles_option = Some(instrument_candles.clone());
            let signal_candle_index = instrument_candles
                .iter()
                .position(|x|x.timestamp_id == signal_candle.unwrap().timestamp_id);
            if signal_candle_index.is_none() ||
                instrument_candles.get(signal_candle_index.unwrap()+1).is_none() {
                break;
            }
            entry_candle_index = signal_candle_index.unwrap()+1;
            candles_cursor = entry_candle_index;
            entry_candle = instrument_candles
                .get(entry_candle_index)
                .cloned();
            entry_timestamp_option = timestamps
                .iter()
                .find(|x|x.id.unwrap() == entry_candle.unwrap().timestamp_id);


            prog_candles.push(entry_candle.unwrap());


            // set entry candle iter
            let entry_candle_iter = instrument_candles
                .into_iter();
            entry_candle_iter_option = Option::from(entry_candle_iter);

            // Set combo
            combo = combos
                .iter()
                .find(|x| x.has_instrument_id(instrument_id))
                .or(Option::from(combos.get(0)));

            if combo.as_ref().unwrap().action == 1 {
                sl_price = Some(entry_candle.unwrap().bid_open_num - (strategy.sl / instrument_option.unwrap().decimal_place_value as f64));
                tp_price = Some(entry_candle.unwrap().bid_open_num + (strategy.tp / instrument_option.unwrap().decimal_place_value as f64));
                entry_price = Some(entry_candle.unwrap().bid_open_num)
            } else {
                sl_price = Some(entry_candle.unwrap().ask_open_num + (strategy.sl / instrument_option.unwrap().decimal_place_value as f64));
                tp_price = Some(entry_candle.unwrap().ask_open_num - (strategy.tp / instrument_option.unwrap().decimal_place_value as f64));
                entry_price = Some(entry_candle.unwrap().ask_open_num)
            }
        }

        // necessary vars
        index_candle = instrument_candles_option
            .clone()
            .unwrap()
            .get(candles_cursor)
            .cloned();
        if index_candle.is_none() {
            println!("{:?} {:?} {} {:?}",entry_candle,instrument_option,candles_cursor,
            instrument_candles_option.clone().unwrap().get(3025));
            println!("{} {}","out of bounds",balance);
            break;
        }
        index_time = timestamps
            .iter()
            .cloned()
            .find(|x|x.id.unwrap() == index_candle.unwrap().timestamp_id);

        // 1. if trade expired, perform 2. or 3.
        // 2. if sl reached, deduct losses from balance
        // 3. if tp reached, add profit to balance
        let _sl_price = sl_price.unwrap();
        let _tp_price = tp_price.unwrap();

        //TODO - trade expiry duration should be in strategy db
        //TODO - handle edge case - expiry candle could open in loss or profit
        if index_time.unwrap().timestamp.signed_duration_since(entry_timestamp_option.unwrap().timestamp) > Duration::weeks(2) {
            if combo.as_ref().unwrap().action == 1 {
                exit_price = Some(index_candle.unwrap().bid_open_num);
                let pl = (index_candle.unwrap().bid_open_num - entry_candle.unwrap().bid_open_num) * instrument_option.unwrap().decimal_place_value as f64;
                balance = balance + pl;
                wl = Some(pl);
            } else {
                exit_price = Some(index_candle.unwrap().ask_open_num);
                let pl = (entry_candle.unwrap().ask_open_num - index_candle.unwrap().ask_open_num) * instrument_option.unwrap().decimal_place_value as f64;
                balance = balance + pl;
                wl = Some(pl);
            }


            progs.push(Prog{
                id: None,
                candles:prog_candles.clone(),
                instrument: instrument_option.unwrap().clone(),
                combo: combo.unwrap().clone(),
                entry_price: entry_price.unwrap(),
                exit_price: exit_price.unwrap(),
                wl: if wl.unwrap() > 0.0 {1} else { 0 }
            });

            entry_candle = None;
            tp_price = None;
            sl_price = None;
            instrument_candles_option = None;
            instrument_option = None;
        } else if (combo.as_ref().expect("combo issue").action == 1 && index_candle.expect("index candle issue").bid_low_num as f64 <= _sl_price) ||
            (combo.as_ref().expect("combo issue").action == 0 && index_candle.expect("index candle issue").ask_high_num as f64 >= _sl_price) {
            balance = balance - strategy.sl;
            // todo - not entirely correct but serves the point
            if combo.unwrap().action == 1 {
                exit_price = Some(index_candle.unwrap().bid_low_num)
            } else {
                exit_price = Some(index_candle.unwrap().ask_high_num)
            }


            progs.push(Prog{
                id: None,
                candles:prog_candles.clone(),
                instrument: instrument_option.unwrap().clone(),
                combo: combo.unwrap().clone(),
                entry_price: entry_price.unwrap(),
                exit_price: exit_price.unwrap(),
                wl: 0
            });

            entry_candle = None;
            tp_price = None;
            sl_price = None;

            instrument_candles_option = None;
            instrument_option = None;
        } else if (combo.as_ref().unwrap().action == 1 && index_candle.unwrap().ask_high_num as f64 >= _tp_price) ||
            (combo.as_ref().unwrap().action == 0 && index_candle.unwrap().bid_low_num as f64 <= _tp_price) {
            balance = balance + strategy.tp;
            if combo.unwrap().action == 1 {
                exit_price = Some(index_candle.unwrap().ask_high_num)
            } else {
                exit_price = Some(index_candle.unwrap().bid_low_num)
            }


            progs.push(Prog{
                id: None,
                candles:prog_candles.clone(),
                instrument: instrument_option.unwrap().clone(),
                combo: combo.unwrap().clone(),
                entry_price: entry_price.unwrap(),
                exit_price: exit_price.unwrap(),
                wl: 1
            });

            entry_candle = None;
            tp_price = None;
            sl_price = None;

            instrument_candles_option = None;
            instrument_option = None;
        } else {
            candles_cursor = candles_cursor + 1;
        }

    }
```

google cloud platform – Can not ping compute engine VM

In the compute engine page GCP prompted me to save $12/month by reducing the size of my VM. After selecting this option and reducing the size of my VM, I am unable to ping the external ip of the VM from external addresses. Also no web traffic. traceroute ends, does not reach the server…

Firewall rules are correct and in place to allow icmp/https/http. Also when I test various networking scenario from the compute engine is says they should work and should pass firewall rules (Ie, it says a ping from my home pc should work, but it does not)…. I am able to ping/traceroute to external ip addresses from the compute engine VM.

I’ve tried several reboots.

Any suggestions welcome. Thanks,
_Gary