Generate JSON files for language translation from po file without wp-cli i18n make-json

My plugin uses wp_set_script_translations() to load translations for JS as mentioned here

I understand that when translations for a locale is added it will create the JSON files.

But, we have a lot of site owners wants to translate a few words and start using the plugin. They can create .po and .mo files, but how they can create the JSON files without setting up wp-cli to use (wp i18n make-json).

Loco Translate plugin is not supporting JSON file generation.

I couldn’t find any online sites supporting .po to .json(with below mentioned format) conversion.

Out put file should in $ {domain}-$ {locale}-$ {handle}.json or $ {domain}-$ {locale}-$ {md5}.json JED 1.x ( .json ) file format for each JS file that called with wp_set_script_translations().

Plugin or standalone script for wordpress automatic generate passwords for admin users with 24h regenerate

I have clean wordpress installation with one admin user. I want some script or plugin with autogenerate passwords for WordPress’s admin and sent automatically to email notification. Is possible? Example : i have user’s admin with password ‘test’ – i want generate random passwords for this admin once at 24h and send automatically thsi fact to email.

previous_posts_link & next_posts_link doesn’t generate any output

Hey I am using a WPQuery to loop through and show blog categories in posts. It’s in a page tempplate. has 21 posts and I want them to show 10 per page with navigation links for next pages of 10 posts but below code is not outputting that buttons

enter image description here

<div class="container-blog-post d-flex flex-wrap justify-content-start">          <?php  $  paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;         $  args = array(             'post_type'      => 'post',             'category_name'  => 'blog',             'posts_per_page' => 10,             'orderby'        => 'date',             'order'          => 'DESC',              'paged' => $  paged         );          $  the_query = new WP_Query( $  args ); ?>          <?php if ( $  the_query->have_posts() ) : ?>              <?php while ( $  the_query->have_posts() ) : $  the_query->the_post();                    if(has_post_thumbnail()) {                     $  image = get_the_post_thumbnail_url();                 }else{                     $  image = get_template_directory_uri().'/assets/images/default.svg';                 }                                             $  url   = get_permalink();                 $  title = get_the_title();                 $  text  = excerpt(20);                 $  date = get_the_date();              ?>                                <a href="<?php echo $  url; ?>" class="single-post card">                 <figure class="image-wrapping">                   <img src="<?php echo $  image; ?>" alt="">                 </figure>                 <div class="body-post card-body">                   <h3 class="title-post card-title"><?php echo $  title; ?></h3>                   <p class="card-text line-clamp-2"><?php echo excerpt(10); ?></p>                   <button class="btn-read-more arrow">Read more</button>                   <div class="button-post">                     <span class="date-post"><?php echo $  date; ?></span><span class="author-post"><?php echo the_author(); ?></span>                   </div>                 </div>               </a>                <?php endwhile; ?>                      <div class="previous">                 <?php previous_posts_link(); ?>         </div>         <div class="next">             <?php next_posts_link(); ?>         </div>             <?php wp_reset_postdata(); ?>         <?php endif; ?>        </div> 

How to generate a star onto a render texture with spherical warping

How would one proceduraly generate a star in a compute shader that looks like one of thes two at any size needed. Also any way transfer this into a spherical map, would be appreciated. Goal is to create a spherical skybox of stars, (stars a pre generated, and not just decoration).

So far got accurate positioning of the stars on the spherical skybox but lack the equations to get it looking like I want.

Preferably the one on the right.

enter image description here enter image description here

This below is what I currently have, ~~5 to 15ms processing time, little over 30k stars

enter image description here

Using Unity2019.3.1f1, needs to be compute shader compatible. (if not I will convert it somehow) Render Texture output.

Generate constraints that ensure positive definiteness

What is a good way to generate algebraic constraints that ensure matrix be positive definite? Ideally, I’d be able to do something like below

Solve[# \[Element] Reals & /@ Eigenvalues[A]]

However, this doesn’t directly work. Practical example below uses this to find the norm of a positive linear operator (related issue). It works, but requires AposDefiniteConstraints to be specified manually which I’d like to avoid.

(also tried Thread[Eigenvalues[X] > 0] suggestion from Find minimum with matrix positive-definiteness constraint but I get Maximize returning unevaluated)

(* Find norm of a positive transformation of a positive definite \ d-by-d matrix *) SeedRandom[1]; d = 2; symmetricMatrix[d_] := Array[a[Min[#1, #2], Max[#1, #2]] &, {d, d}]; extractVars[mat_] := DeleteDuplicates@Cases[Flatten@A, _a];  (* using built-in Norm/Simplify too slow, use this helper instead *)  norm[A_] :=    Max[x /. # & /@ Solve[CharacteristicPolynomial[A, x] == 0, x]];  A = symmetricMatrix[d]; Avars = extractVars[A];  B = Mean[#\[Transpose].A.# & /@     Table[RandomReal[{-1, 1}, {d,        d}], {d^2}]]; (* random positive transformation of A *) normA =   norm[A]; normB = norm[B]; AposDefiniteConstraints =    a[1, 1]^2 + 4 a[1, 2]^2 - 2 a[1, 1] a[2, 2] + a[2, 2]^2 >= 0 &&     a[1, 1]^2 + 4 a[1, 2]^2 - 2 a[1, 1] a[2, 2] + a[2, 2]^2 >= 0; Maximize[{normB, normA < 1,    AposDefiniteConstraints}, Avars] (* => {0.7853700810760375`,{a[1,1]\ \[Rule]0.999855037823971`,a[1,2]\[Rule]0.00017274783320670866`,a[2,2]\ \[Rule]0.9997941436806035`}} *)  ``` 

How do you generate random row order in a subquery?

I know other answers here (and here) say to order by newid(). However if I am selecting top 1 in a subquery – so as to generate a random selection per row in the outer query – using newid() yields the same result each time.

That is:

select *,     (select top 1 [value] from lookupTable where [code] = 'TEST') order by newid()) from myTable 

… yields the same lookupTable.value value on each row returned from myTable.

What’s a secure way to generate a keypair from a secret password?

I like to generate a public-private key pair that is seeded from a string. So having the string and the generation algorithm is enough to recreate the keys. I want to do this because I can then combine a password (that I’ll memorize), with a long, secret (randomly generated) text file (that I’ll store securely), and generate a key pair. I’ll then delete the key pair after each usage and regenerate them when needed. Thus, for the keys to be compromised, someone would need both the long text file, and the password in my head. (Or they need to intercept the key in the narrow intervals that it exists.) This seems safer to me than just storing the keys securely, where anyone with physical access to the keys can use them.

PS: I am obviously confident in not forgetting the password.

There is a similar question, but it’s old and doesn’t have a useful answer.