How to add Pagination to foreach loop to page

I create a page in wordpress series.php and here it the code where I block! <?php $categories=get_categories( array( 'parent' => $cat->cat_ID) ); foreach ($categories as $c) { // what you really want instead of var_dump is something to // to create markup-- list items maybe, For example $idp = $c->term_taxonomy_id; //then i get the data from the database $cat_data = get_option("category_".$idp); ?> <div class="wide-box"> <!-- Content Detail Box --> <a href="<?php echo get_category_link( $idp ); ?>" class="wb-image"><img src="<?php echo $cat_data['original_img']; …
Category: Web

Finding the tightest (smallest) triangle that fits all points

I'm supposed to find an algorithm that, given a bunch of points on the Euclidean plane, I have to return the tightest (smallest) origin centered upright equilateral triangle that fits all the given points inside of it, in a way that if I input some random new point, the algorithm will return $+$ if the point is inside the triangle and $-$ if not. Someone has suggested me to go over all the possible points and find the point with …
Category: Data Science

How to split train/test in recommender systems

I am working with the MovieLens10M dataset, predicting user ratings. If I want to fairly evaluate my algorithm, how should I split my training v. test data? By default, I believe the data is split into train v. test sets where 'test' contains movies previously unseen in the training set. If my model requires each movie to have been seen at least once in the training set, how should I split my data? Should I take all but N of …
Category: Data Science

add_submenu_page() issue

I am trying to add a Menu in WordPress Admin Panel. I am using below code. This code is working. add_submenu_page('weather_info', 'Weather Information', 'Weathers', 'manage_options', 'weathers', [$this, 'weathers']); But below code is not working. I am facing error Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'edit.php?post_type=weather' not found or invalid function name . add_submenu_page('weather_info', 'Weather Information', 'Weathers', 'manage_options', 'weathers', 'edit.php?post_type=weather');
Category: Web

Generate and send ICS file through WordPress

I'm writing a custom plugin for reservations. I need to generate an .ics file that needs to be sent to a predefined email address. I've tried some library like ZContent iCalendar and a PHP script that I found on github that I've included inside my plugin code. The script works well and I can obtain a valid output. The problem is I can't figure out how to generate the ics file and attach it to an email using the wp_mail …
Category: Web

Error loading tidyverse in R Studio - No broom package

I'm getting numerous errors when trying to install packages, namely tidyverse and ggplot. The error is of the form are always in the form: > library(tidyverse) Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called ‘broom’ Error: package or namespace load failed for ‘tidyverse’ I have already tried installing the package broom independently with dependecies = TRUE per the below Having trouble installing and loading tidyverse- No DIB package I've also tried restart …
Topic: rstudio r
Category: Data Science

Create a Dropdown Selector and Redirect for a Custom Taxonomy in WordPress?

I'm trying to create a dropdown selector on my CPT and CT archive page for a custom taxonomy called "location". I've managed to get the form to submit, however, it does not direct me to the archive page, rather it directs me to a URL that looks something like this https://example.com/?location=11 I'm wanting the destination URL to be this: https://example.com/location/term-name Bare with me as I have no background in Computer Science / IT so I'm learning on my own. Below …
Category: Web

WordPress 6.0 class-wp-widget.php fatal errors in PHP 8.1.6

/wp-includes/class-wp-widget.php gives me an error for one blog, but not the other, and both have the same version of class-wp-widget.php which makes no sense to me. PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function WP_Widget::__construct(), 0 passed in /home/www/stackexchange.com/wp-includes/class-wp-widget-factory.php on line 61 and at least 2 expected in /home/www/stackexchange.com/wp-includes/class-wp-widget.php:162 Reading the code, it appears class-wp-widget.php is the root of the problem, but I could be wrong. My other (working) blog on the same server has this same file …
Category: Web

Importing Excel format data into R/R Studio and using glmnet package?

I have no problem importing Excel formatted data into R/R Studio and use all other R packages that I use. But, when I want to use the glmnet package to develop a regularization model, I invariably run into the following error (after specifying my regularization model and attempting to run it): Error in storage.mode(y) <- "double": (list) object cannot be coerced to type 'double' Here is what I have already tried to resolve this: De-format the numbers in Excel (no …
Category: Data Science

Disable device preview options in the block editor

In a recent update to WordPress, the following responsive device preview system was added to the Block Editor: Easy to hide them via: .block-editor-post-preview__button-resize { display: none; } But, how can we disable this feature so when you click on the preview button, it opens up a front-end preview of the post on a new tab. Just as it used to be.
Category: Web

Applying a matching function for string and substring with missing values on a python dataframe

I have programmed the following functionality: The function returns True, when the two strings match sequentially except for a "*" value and false when they differ by at least 1 character. def matching(row1, row2): string = row1['number'] sub_string = row2['number'] flag = True i=0 if len(string) == len(sub_string): while i < len(string) and flag==True: if string[i] != "*" and sub_string[i] != "*": if string[i] != sub_string[i]: flag = False i+=1 else: flag = False return flag Assuming I have a …
Topic: pandas python
Category: Data Science

Background image not appearing

I'm trying to add a custom background on a child theme. In the child theme's functions.php, I add add_theme_support( 'custom-background'); and the background option appears under the "Appearance" menu as expected. I add the image that I want, save, and nothing happens. The image won't appear as the background. What am I doing wrong? Using version 4.3.1. This is all that's in my child theme's function.php" <?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); …
Category: Web

How to get the number of syllables in a word?

I have already gone through this post which uses nltk's cmudict for counting the number of syllables in a word: from nltk.corpus import cmudict d = cmudict.dict() def nsyl(word): return [len(list(y for y in x if y[-1].isdigit())) for x in d[word.lower()]] However, for words outside the cmu's dictionary like names for example: Rohit, it doesn't give a result. So, is there any other/better way to count syllables for a word?
Topic: nlp
Category: Data Science

Automatically login user across multisite

When new site is created on my multisite installation, I automatically add the new user to the main site (because I need him to order the product): add_user_to_blog( 1, $user_id, 'customer' ); I'd like to have the users automatically login them to all their sites, as soon as they login to one of the sites they belong to. I hoped to hook to the wp_login action and just set the auth_cookie for each sites the user belongs to, something along …
Category: Web

What folder to place Large Video files?

I'm using WordPress to upload videos. I have to use WordPress to upload the videos, because they need to remain past a password protected side of the website. I have access to the WordPress content folders, so I can move media in and out from the folders, and it would be reflective on the WordPress (basically FTP). Currently, my upload limit is 200MB, and I'm having trouble uploading anything past about 30MBs. I'm getting an HTTP error. I have the …
Category: Web

Neural network always outputting 1

I'm trying to develop a small network for the aerial cactus identification challenge. This is a binary classification challenge (0 no cactus, 1 is cactus), but my networks is always outputting 1. I have identified that the network always output values >= 0.5, so the sigmoid function outputs 1. However, I can't understand why. I built a simple network, which works when implemented with keras, but I'm trying to use tf.nn for learning purposes, but can't make it work My …
Category: Data Science

How "similarity" is measured in image retrieval?

I know what content based image retireval is. I have read this and this as one of them says: "given a query images, get a rank list that are most similar to the query image, based on the content of the query image. " But my question is how the "similar" images are determined. Assume we are working on Oxford5k dataset. The dataset contains 5k images in 17 classes. So, when I feed one of the images as a query, …
Category: Data Science

I have data with customer personal information and customer transaction. I cannot figure out how to use the data for training my model?

Customer information attributes: ID Age Gender State etc Customer transaction ID Store ID No of items bought State etc Store info Store ID State Daily revenue Store size etc I want to predict if customer will buy at a particular store or not/ So can I have the train data with suppose 5 different stores for every customer where the customer shops and then predict in other store?
Category: Data Science

Woocommerce modifying the html on the checkout page?

I'm trying to wrap 'some' of the fields of the checkout page in a div and inject some buttons because I am implementing some address validation. Basically to start with I need a wrapper around company, address line 1, address line 2, town and postcode so I can show/hide them but I can't seem to get anything to work. Here's what I've tried - In my filters file: function change_woocommerce_field_markup($field, $key, $args, $value){ if($key === 'billing_company') { $field = '<div …
Category: Web

seasonality in classification model

I am building a classification model to predict customer status a year from a given time. There seems to be some seasonality, for example, more changes occur in Summer than in Winter etc. so my dataset (mainly labels) would change depending on how to define prediction time (eg 2020 Jan) and predicting time (eg 2021 Jan). Let's say there are 100 customers and I could make 1,200 entries (100 per month for every month in 2020, where labels are from …
Category: Data Science

Shortcode displays only default attribute values

For some reasons every shortcode, that I try to add to functions.php, displays only default attribute value and ignores what I specify in a post. E.g.: function my_shortcode( $atts ) { extract( shortcode_atts( array( 'id' => '18', ), $atts ) ); return $id; } add_shortcode( 'sc', 'my_shortcode' ); So I use shortcode [sc id="81"] and expect echoing 81 but I get 18. BTW I use child theme, and latest version of wordpress. I'm really stuck. Thanks for any help.
Category: Web

Jet filter redirection to single post template

I am using the jet filter plugin to filter posts, After applying a filter, I want the "apply filter button" to redirect me to single post template of filtered post ( not on archive page for where the posts listing is shown ) Any one can help me with code?
Category: Web

Using $_FILES variable into the same function for uploading images and files

I want start saying that I'm learning and I'm trying to understand the use of $_FILES and $file_handler which are making me crazy into this function to upload attachments from a frontend form. What I've discovered into mine yesterday question was that using $_FILES into the same function makes it overwritten so some nice dude suggested to change this variable in something different like $whatever. Both files could be managed and uploaded then but of course this is not happening …
Category: Web

Seems like the Keras .fit and .evaluate methods give different training accuracy (yet the same validation accuracy). Same thing on loss.?

The code below is a translation of Nielsen's first mnist code to Keras. Surprisingly, the last accuracy value of the .fit method and the accuracy value for the .evaluate method are different for the training data. As I expected, for the validation data the accuracies are the same. The same behavior is seen with losses. I would appreciate finding out what is going on. import numpy as np from tensorflow import keras from tensorflow.keras import layers num_classes = 10 input_shape …
Topic: keras
Category: Data Science

Logging in to the frontend works correctly but not for WP-Admin

On my private page, I want the website to be shown only to logedin people. So if a person comes to the site, the first is displayed custom template login form. When the person log-in, the home page is displayed. I have this redirect done with the following code: add_action( 'template_redirect', function() { if ( ! is_user_logged_in() && ! is_page( array( 'prijava', 'pozabljeno-geslo' ) ) ) { wp_redirect( esc_url( home_url( '/prijava/' ) ) ); exit; } }); And the log …
Category: Web

Is the Dataset XiangyaDerm available anywhere?

I've searched far and wide, does anybody know how to access the XiangyaDerm dataset? They say in their paper, that it is accessible. It has 150k images of skin lesions, which is way more than currently publicly available to all other datasets combined (106k~). XiangyaDerm: A Clinical Image Dataset of Asian Race for Skin Disease Aided Diagnosis https://airl.csu.edu.cn/PDFs/LABELS2019_XiangyaDerm.pdf
Topic: dataset
Category: Data Science

Need help on Time Series ARIMA Model

I'm working on forecasting daily volumes and have used time series model to check for data stationarity. However, I'm strugging at forecasting data with 90% accuracy. Right now variation is extremely high and I'm just unable to bring it down. I've used log method to transform my data. Please find the link to folder below which contains ipynb and csv files: https://drive.google.com/drive/folders/1QUJkTucLPIf2vjo2mRmoBU6be083dYpQ?usp=sharing Any help will be highly appreciable Thanks, Rahul
Category: Data Science

Want a plugin for my market

I am trying to design a wordpress market and now i have a problem … is there any plugin that can help to have a search by two categories in woocomerce (parent and sub) and can design it on my own like this photo … One category search is for gender other is for useing
Category: Web

XGBClassifier's predictions are not probabilities with objective='binary:logistic'

I am using a XGBoost's XGBClassifier, a binary 0-1 target, and I am trying to define a custom metric function. It supposedly receives an array of predictions and a DMatrix with the training set according to the XGBoost Tutorials. I have used objective='binary:logistic' in order to get probabilities but the prediction values passed to the custom metric function are not between 0 and 1. They can be like between -3 and 5 and the range of values seems to grow …
Category: Data Science

Send data using GET method not work correctly

Im using WP 3.5.2 and WPMU. I develop one page http://baohiem.info/chon-mat-gui-vang. This page uses global $wpdb to query table _blogs.(_blogs was customized, added some fields.) When submit form, I use GET method, but, when log in, i have data ($_REQUEST; $_GET) but not log in, there're no data. Why? I don't understand what happen. Can anyone help me? Thank you. <?php get_header(); ?> <form action="" method="get"> <input id="searchfield-cmgv" type="text" name="hoten" placeholder="Họ và tên tư vấn viên...." size="35" value="<?=$_REQUEST['hoten']?>"/> <!-- location--> …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.