mysql – Why does sql query variable break when using LEFT JOIN? (DBFiddle)

as in this fiddle

I’m trying to execute this to calculate running balance for accounts, and reset it between rows when account number changes/financial period changes (for account_type > 5).

But my problem is that variable “curr_account_no” gets a wrong value and breaks the running_balance variable when I use LEFT JOIN on financial_periods table (account_no is the correct value). Why does this join break the variable? how can I fix it?

My query with issue:

 SELECT , account_no, account_type, transaction_id, DATE_FORMAT(acc_transactions.transaction_date, "%d/%m/%Y") transaction_date, debit_balance, credit_balance 
        , IFNULL(,-1)
        ,(@current_period_id := IF(IFNULL(,-1) <> @current_period_id, IFNULL(,-1) ,@current_period_id) ) current_period_id
        ,(@running_balance   := IF(@curr_account_no < account_no OR (@current_period_id <> IFNULL(,-1) AND account_type > 5) , 0,@running_balance)) prev_runnng_bal
        ,(@curr_account_no   := IF(@curr_account_no < account_no ,account_no,@curr_account_no)) curr_account_no
        ,(@running_balance   := @running_balance + (acc_account_transactions.debit_balance - acc_account_transactions.credit_balance)) as running_balance
        FROM (SELECT @running_balance := 0,@curr_account_no := 0,@current_period_id := -1) r, acc_account_transactions
        INNER JOIN acc_transactions ON = acc_account_transactions.transaction_id
        INNER JOIN acc_accounts ON = acc_account_transactions.account_no
        LEFT JOIN acc_finacial_periods
        ON  DATE_FORMAT(transaction_date, "%Y/%m/%d")>= DATE_FORMAT(startdate, "%Y/%m/%d")
        AND DATE_FORMAT(transaction_date, "%Y/%m/%d")<= DATE_FORMAT(enddate, "%Y/%m/%d")

       ORDER BY account_no, 


magento2 – Migrating email templates variable from Magento 1.9 to Magento 2.3.4

I successfully migrated my Magento 1.9.3 to Magento 2.3.4 , the problem is the Magento 2.3.4 does not support this kind of variable {{var order.getCustomerName()}} because i need to change it into {{var order_data.customer_name()}} based on this documentation. Should i change the variable one by one? is there any script or method that can handle this automatically? or is there a way to allow this variable to be called up in Magento 2.3.4 email templates?

neutral density – Can I use a screw-on variable ND filter together with a square filter holder?

It’s possible to do what you want to do, but it’s a little fiddly to use. Certainly doable, though.

  1. Screw the K&F Concept VND onto the lens.
  2. Screw the correct Cokin Z lens adapter onto the front of the VND filter.
  3. Adjust the VND to the desired light stoppage.
  4. (Optional, but recommended) Tape down the VND so it can’t rotate. You don’t need a lot of tape, just a small tab or two. I highly recommend finding gaffer’s tape for this — it won’t leave a residue, is easy to remove, and is restickable so you can lift the tape, adjust the VND rotation, re-stick, etc.
  5. Attach the Cokin Z holder with whatever square filters you wish to use.
  6. Take the shots.

I’ve done this with my 100 mm square filter system, and various different circular polarizers mounted to the lens. It’s a bit tedious, but it works, and more importantly, doesn’t limit you to just the thin CPL that is made to only fit a particular holder brand.

Other than the fiddle nature of the setup, the other major drawback is that sometimes it’s difficult to remove filters (or adapters, in this case) that were mounted onto the front of a rotating-ring polarizer (which the VND counts as). This is especially true of aluminum filter rings & threads, which the vast majority of screw-on filters are these days (including K&F Concepts’ filters). Be sure to buy a couple inexpensive filter wrenches and keep them with you in the field, incase the Cokin adapter gets a bit stuck onto the K&F VND.

Special note for K&F Concept VND filters

With the K&F Concept VND filters, you have to pay special attention to the fact that the rear (male) threads of the VND are a different diameter than the front (female) threads. In essence, in addition to being a variable ND filter, the K&F VND also acts as a step-up ring.

For instance, say you want to fit the VND onto a lens with a 67 mm filter thread. The K&F VND filter with a 67 mm male thread has a front female thread of 72 mm. That means you would need the Cokin Z 72 mm adapter in order to mount the square filter holder.

But now, you can’t mount the Cokin holder onto the lens without the K&F VND, unless you either also buy the Cokin Z 67 mm adapter, or you buy a 67–72 mm step-up ring in order to use the 72 mm Cokin adapter. The step-up ring is definitely the cheaper option.

The FAQ section at the K&F Concepts’ VND product page states,

What is the lens hood/lens cap size if used on variable ND filters?

For this series, front thread diameter is bigger than the back thread diameter.

Variable ND filter size      other accessories size
37mm                         40.5mm
40.5mm                       43mm
43mm                         46mm
46mm                         49mm
49mm                         52mm
52mm                         55mm
55mm                         58mm
58mm                         62mm
62mm                         67mm
67mm                         72mm
72mm                         77mm
77mm                         82mm
82mm                         86mm

magento2 – Load times for files in pub/static/ are extremely variable and often painfully slow

On Magento 2.3.3 I’m seeing extremely variable load times for files served from Magento’s pub/static directory. This happens in both developer and production modes, and I can’t understand what’s causing it.

Main symptoms are pages which take a huge amount of time to load, especially on first visit and especially when the FPC is disabled. But I don’t just mean “a few seconds extra” – I’m talking minutes of load time.

pub/static resources (mainly JS files) take several seconds each to reach TTFB i.e. there’s tons of “waiting” for files in the browser. This causes a massive amount of request blocking as the browser waits.

Even if I load up the URI of a single JS file in the browser the load times are insanely variable: first time I request a file directly it might take 4 seconds to load, then I refresh a couple of times and it loads instantly, then I refresh again and it’s back to 4-5 seconds. And this is on a machine which has zero net traffic other than my own testing.

The hardware I’m using is a 32-core CentOS-based machine with 128GB RAM and SSDs so this should not be a hardware issue. I’m running httpd, MariaDB, php-fpm, redis/memcache for page cache and session storage. I’ve set up Varnish in the past but would prefer to get Magento running acceptably before resorting to using aggressive caching as a crutch.

My php-fpm config looks like this:

listen = /var/run/php-fpm/website.sock
listen.owner = magento = www
listen.mode = 0660
user = magento
group = www
pm = static
pm.max_children = 500
pm.start_servers = 30
pm.min_spare_servers = 30
pm.max_spare_servers = 50
pm.max_requests = 500
php_admin_flag(log_errors) = on
php_admin_flag(zlib.output_compression) = On
php_value(memory_limit) = "4096M"
php_value(session.gc_maxlifetime) = "86400"
php_value(opcache.memory_consumption) = 512MB
php_value(opcache.max_accelerated_files) = 60000
php_value(opcache.consistency_checks) = 0
php_value(opcache.revalidate_freq) = 0
php_value(opcache.enable_cli) = 1
php_value(opcache.interned_strings_buffer) = 64

Any ideas?

How to assign object to variable in Powershell

i am trying to assigned a variable from a search object :

$tes = $ListLookup.Items | where-object {$_.title -eq “TEST”} | sort Title | FT ID

So the above brings back the ID of the item l want but l want to assign that ID number “4” to a variable

So l can use it in $listLookup = $List.GetItemById(4) as l am trying to get information via that code

Hope that make sense

plugins – Getting value from dymanic text variable into Contact Form 7

I have an inscription form and I’m using Contact Form 7, Conditional Fields plugin and Dynamic Text Extension.
I want to show different prices according to the option selected and get the price for showing on the email confirmation (and save into database with Contact Form DB).

With the following code the price is displayed correctly on the web, but always appears with the same value in the confirmation email

Service type (select* serv_type "Regular" "Exceptional")
(group g_regular clear_on_hide)
  Price (dynamictext amount readonly "65")
  (dynamichidden price_value "65")
(group g_exceptional clear_on_hide)
  Price (dynamictext amount readonly "45")
  (dynamichidden price_value "45")

The conditional code is

show (g_regular) if (serv_type) equals "Regular"
show (g_exceptional) if (serv_type) equals "Exceptional"

And the email template code is

Subject: Inscription registered ((serv_type))    
New (serv_type) inscription with (price_value)€ ((amount)).

The price and amount value is always 65 on the email confirmation and should be 45 if is selected Exceptional

Probability random variable – Mathematics Stack Exchange

Thanks for contributing an answer to Mathematics Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

pr.probability – In the distribution and the expectation of the inverse se Gaussien Variable

let $H$ be $(N, M)$ Gaussienne independent elements matrix where $D$ represent the eigenvalue matrix of the SVD decomposition of $H$: $(U,D,V)=svd(H)$ my question is:

1) What is the distribution of the inverse of the nonnull element of $D$
f = frac{1}{{1 + sumlimits_{i = 1}^{Min(N,M)} {frac{1}{{D(i,i)}}} }}

2) the expectation of $f$?

api design – Long variable naming with chained filters on API best practices?

I am writing an application where a single variable may be affected by different filters applied to the data that’s read from the DB. Each different variation has to be stored (as each one serves different purposes) in different variables, however, I’m not sure about the best naming convention for this cases as it will become a public-accessible API at some point. A simple example:

  • meterPrice: original name.
  • meterPriceBySuburb: new variable with a suburb filter.
  • meterPriceBySuburbByType: new variable with the suburb and type filters.
  • meterPriceBySuburbByTypeBySchool: you get the point.

I have 2 main concerns with the naming that should be followed for these variables:

  1. Some variables names, following this format, can get way too long, the longer one we are planning on creating being something like: MeterPriceDistributionChartDataBySuburbByTypeBySimilarity. Does the longitude itself be a problem on a public-facing API?
  2. What is the convention or, at least, the best practice for chaining these filters? Currently I have thought about 4 different schemas:

    • meterPriceBySuburbTypeSimilarity: One after another after first By.
    • meterPriceBySuburbByTypeBySimilarity: Having By before each filter.
    • meterPriceBySuburbAndTypeAndSimilarity: Having a first By and then follow each new one with And.
    • meterPriceBySuburbTypeAndSimilarity: Having an initial By and just add Andto the final filter.

Thanks in advance for any responses! And sorry for my bad english.

special functions – Are symbols automatically generated when defining a variable in the global context and what are symbols?

Abstract: I have noticed something really tricky with Mathematica and the documentation for symbols is short on clearing the confusion. It likely reveals what symbols are but it’s not very prominent. I know unique symbols are created inside Modules but are they also generated every time we define regular functions and variables?

About The Code: I did a simple test with abc = 123. The output for ?abc gives a grayed out Symbol and SymbolName produces an error message. Does this mean it is not a symbol?

abc = 123

Four Questions:

  1. Are system functions symbols?
  2. Are user defined functions symbols?
  3. Are user defined variables symbols?
  4. What are symbols and are they automatically generated?