Categories
Mastering Development

How do i generate a random number in an Array that will repeat 3 times

So i have a game that have 9 boxes, each box will contain a random number from a range e.g 5-10. but only 3 number are random, the rest will be the same with 3 number had random before example: [5,6,6,5,5,6,10,10,10] or [14,13,14,14,13,20,20,13,20] the order doesn’t matter, i did tried that create a 3 specific […]

Categories
Mastering Development

Using excel to add a table in Word document

I’m creating a tool in Excel Which is going to read in some data and the create a word document based on that data. So far I’ve got excel to create the word document and add a few lines of text without any issue. The next bit though to add a table is causing issues. […]

Categories
CMS Mastering Development Wordpress

Change lost password url to a mailto URL in WordPress

can you help me, how can I change the lost password link to an email action with specified subject? I found that in the functions.php I can add a new filter like this: add_filter( ‘lostpassword_url’, ‘my_lostpassword_url’, 10, 0 ); function my_lostpassword_url() { return site_url(‘/password-reset/’); } But I dont know how can I implement the mailto […]

Categories
Mastering Development

Getting random images into qualtrics using Javascript

I’m new to Javascript and I’m creating a survey in Qualtrics platform. In the code attached bellow you can see that I have 5 diffrent stories, 20 names and 20 pictures that need to be randomly inserted into the survey. so far I’d manage to add the names and the stories but I don’t know […]

Categories
Mastering Development

saved order at API in woocommerce_thankyou page

Invoice information on the woocoommerce_thankyou page is curled by a web service. If the user does not see this page for any reason, how can the storage operation be performed? Can invoice storage action be changed in any other way? add_action( ‘woocommerce_thankyou’, ‘club_add_factor’, 10, 1 ); function club_add_factor( $order_id ) { if ( ! $order_id […]

Categories
Mastering Development

array.sort() is sorting everything the same way

I’m trying to practice by doing the following exercise: Write a function that takes a numeric array and returns an object containing two arrays. The first one should have the elements sorted in ascending order, and the second one should have them in descending order. This is the code without the validation portion (which I […]

Categories
Mastering Development

How to pretty print a json.loads method in Python

I am currently having a problem with pretty printing in Python when converting a dictionary from JSON to Python by using .loads(). When converting from Python to JSON, I use indent as a parameter. However, .loads() does not have an indent parameter. I have looked through the python JSON documentation and they only show how […]

Categories
Mastering Development

Pyspark StandardScaler over a Window

I want to use the standardscaler pyspark.ml.feature.StandardScaler over window of my data. df4=spark.createDataFrame( [ (1,1, ‘X’, ‘a’), (2,1, ‘X’, ‘a’), (3,9, ‘X’, ‘b’), (5,1, ‘X’, ‘b’), (6,2, ‘X’, ‘c’), (7,2, ‘X’, ‘c’), (8,10, ‘Y’, ‘a’), (9,45, ‘Y’, ‘a’), (10,3, ‘Y’, ‘a’), (11,3, ‘Y’, ‘b’), (12,6, ‘Y’, ‘b’), (13,19,’Y’, ‘b’) ], [‘id’,’feature’, ‘txt’, ‘cat’] ) w […]

Categories
Mastering Development

Use pivot_table and groupby for calculation

I have a big df that looks something like this: df = pd.DataFrame({‘Product’: [‘A’, ‘C’, ‘B’, ‘A’, ‘C’, ‘C’], ‘Inv_type’: [‘Packaging’, ‘Raw Materials’,’Packaging’, ‘Raw Materials’,’Packaging’,’Raw Materials’], ‘Total_cost’: [5, 7, 8, 9, 10, 19], ‘Batch’ : [‘1000’, ‘1001’, ‘1002’,’1003′, ‘1003’, ‘1004’], ‘Item’ : [‘peas’, ‘can’, ‘carrots’, ‘label’, ‘can’, ‘onion}) It’s basically a bill of materials list. […]

Categories
Mastering Development

Flutter will not color in containers

Im am using flutter and I have a custom widget that I’ve made. I use a list.builder to create the list of widgets. Now I want to color the container in which the custom widget lives in but I cant. I color coded each of the container I could see but for some reason I […]