instruction
stringlengths
71
95.1k
Here is the task description for the codility's stonewall problem. I would like to get a feedback on my code, and I specify at the bottom what the title states. (I had to make the figure by hand, because I couldn't paste the site's one for some reason, but it can be seen here, if mine doesn't look right) Task descript...
I have a tableView, which auto locates back at indexPath after user has dragged it. In other words, bouncing the tableView back into its bounds, after user dragged it out. Here is the code: // ... var tracking = false var currentPath = 0 @objc func updateRecorder(_ timer: Timer){ currentPath = somethingCalculate...
Some background: The counter was first made as a joke because we have a lecturer who repeats the 9 phrases found in the program over and over during lectures and I thought it would be funny to create a program that (using user input) would count the number of times the lecturer said these phrases. Two days later (and ...
I'm trying to have one WPF application to communicate with an other application when something change on the UI. For example : a slider changes and I send the new value or a textbox input change and I send the new input value. The second application is listening and receive those changes to use them in some way, doesn...
I've built this little C++ program just to take some rust off my coding skills since it's been ages since the last time I coded something. The purpose is to organize my music, so I've built the classes 'song' and 'playlist' with some methods which could come in handy - maybe - such as printing on file the list of songs...
I have a complex array function that takes way too much time to calculate, which is why I'm looking for ways to make it more efficient. Basically, I have a transaction sheet in which I list all goods sold in a bunch of different stores. The formula that I've written picks the last stock amount in the list where a speci...
Somehow this code looks messy to me: var results = query.GroupBy(x => x.ProductStatusId == ProductStatus.Sold || x.ProductStatusId == ProductStatus.OnHold ? "Delivered" : x.ProductStatusId == ProductStatus.Shiped ? "Shiped" : x.ProductStatusId == ProductS...
I am having severe problems with performance on a WEB API helper method, the performance is simply dreadful, 1-2 connections / second, I am trying to make 40k API calls and 5 hours later it is still going. I added and set the proxy property of the request to null as per other answers on SE but it doesn't seem to help m...
Here is the part of working code: function SelectPoints(lat,lon){ var dist = document.getElementById("miles").value; xy = [lat,lon]; //center point of circle var theRadius = parseInt(dist) * 1609.34 //1609.34 meters in a mile //dist is a string so it's convered to an Interger. selPts.length =0; //Reset the arr...
I finished Python Principles and this is my first program I've done (mostly) from scratch since, having to get some outside help on the loop to repeat the program, and I saw a nifty thing about using modular math to figure out the results so I did that to save a bunch of lines. I'm just looking for any comments, improv...
I wrote a brute-force algorithm which shall find all possible combinations of ASCII-values that can sum up to a specific value (int hashval). The algorithm is derived from a recursive algorithm that could print all binary numbers that are possible within a specific length characters. I modified it, so it now iterates ...
I'm asked to print the sentences from the corpus containing the word(s) with the greatest number of distinct tags. I already got the top 6 words with most distinct tags (5 tags). My questions are: I don't know how to get the words without using "len(cfd[key])>4"? Because I've tried using max() function but it doesn't ...
Original inspiration was by this Python beginner, and it prompted me to rewrite a bunch of stuff with my flair and my Python experience: First attempt: Python Rock Paper Scissors Okay, so I looked at the aforementioned post, and was bored and needed to kill an hour at work. So I killed an hour - I took their RPS gam...
I have unstructured input-output data, f=f(x). I want to estimate the range of f as a function of x, given limited sampled. So, I tried to discretize the data use small bins in x to estimate the variance of f associated with that bin. After a lot of work, I cobbled together a working code. But, I'm sure there must be a...
My lead developer has commented that the code I write is hard to understand and that I "overcomplicate things". I'm willing to accept this and improve but I'm not sure if this is genuinely the case or if his personal preferences are seeping into his judgement. A red flag for me was the following situation: We're receiv...
For my first CodeReview, I would like to present my FizzBuzz solution in C#. My design has all of the rule logic about when to display what in separate classes through an interface. This design should be able to handle the common follow-up changes (ie. mod 7 instead of mod 3, bazz, etc.) for this problem by simply addi...
I've seen a few TTT related posts recently, and thought I might learn something or be reminded of certain techniques from attempting my own rendition. Here is that attempt! Hopefully any new coders can benefit from this as well. Any improvement suggestions are welcome, and numpy, scipy & bitwise operations are open to ...
What's up smart people. A little backstory for context: I'm a completely self taught dev, and the only person ever looking at my code for the past 6 years is myself. I realize that's not the best idea moving forward, since I now know that this is what I love doing, and what I want to make a career out of. I'd like to f...
Update: The code below has some obvious problems, and it is not allowed to revise code in the original question, so I have to post a new question, the revised code is here. std::shared_ptr has the potential problem that two pointer point to the same object but to different control blocks. And its atomic operation is pu...
std::shared_ptr does not stop you from having the same resource managed by multiple control-blocks (and thus independent sets of shared-pointers), even though it is illegal and leads to double-deletes. Additionally, atomic reference-counts don't have any advantage in single-threaded environments but are still more expe...
I've reproduced the example of this video where dependency inversion principle is explained by Tim Corey based on C# I had some trouble understanding the scope of the Logger and MessageSender properties and how to set them with the Create function inside the Chore class Also: With Rubberduck inspections I receive Pr...
I am interesting in the topic of finite automata, so I started over by implementing a parking machine from this video: Computers Without Memory - Computerphile to understand conceptions. Didn't do much of an error checking - have made a minimal working version. Short description of the task, but for better understandin...
I am making a Trello clone just for personal project and I wonder if my implementation on mutating the state is good. My state is basically shaped like this: boards: [ { id: Number, title: String, tasks: Array, columns: Array, columnOrder: Array } ] I want to mutate the ...
I wrote cat program in x64 FASM and I would like to know if there is anything that can be improved. This implementation of cat supports: Reading from stdin. Multiple arguments. I checked few cases and program behaves exactly like original cat command. Is there anything I could do to improve performance of this progra...
In Kotlin comparison operators can be used instead of compareTo method: a > b // a.compareTo(b) > 0 a < b // a.compareTo(b) < 0 a >= b // a.compareTo(b) >= 0 a <= b // a.compareTo(b) <= 0 It's convenient and makes comparisons a lot more readable. However, these operators cannot be used if there is no suitable co...
How is this Implementation of a list in C? Please tell me whether it is good or please mention any problems. It is a singly linked List and I tried to do it recursively. #include <stdio.h> #include <stdlib.h> #include <conio.h> struct node{ int value; struct node *next; }; void add(struct node *lst, int num){...
This function determines which images should be loaded based on which image is currently in the viewport (array index), what direction the user is scrolling, and if the image has yet to be loaded. It has a bias for what direction the user is scrolling, and proximity to the current image in viewport (delta). It attempts...
I'm not quite sure I understood thread-safe correctly. I built the following registry: @Service public final class EntityDefinitionRegistry { private static final Logger logger = LogManager.getLogger(EntityDefinitionRegistry.class); private final HashMap<String, EntityDefinition> definitions = new HashMap<>()...
After a relative hiatus of around two years, I've decided to start delving back into the programming world; to start, I've appropriated one of my older projects, CLIGL, and have made a solar system simulator that runs exclusively within a console interface. There are several classes of importance, whose purposes and fu...
Update: see also version 2 The Service This code uses two API's. List https://LokiAstari.com/sample/list https://LokiAstari.com/sample/list?token=<continuation Token> This API returns a JSON object. The first version starts a list and will return an array of user ID (not all of them). The second version takes a tok...
I am working on an e-commerce website. What I need to do is to save an advertisement. The ad has some properties and some photos... properties should be save to DB and photos should be saved to file system (I am using an amazon S3 bucket for photo storage). So, in order to simplify the process of saving an ad, I have c...
As part of my college class, I have to write a program that returns the "smallest" letter in the string. Input is assumed to be a non empty string. "Smallest" is defined as: The smallest decimal value of the character, pertaining to this chart. The range of acceptable values is 0 <= x <= 127 I would like to get feedb...
I just finished writing the core for my WPF application and because I'm still a very beginner at software design I wanted to get some feedback about the design decisions I've made. I've uploaded the project to Github and I'll post the most important parts here (the project is to big to be posted as a whole). To see t...
The following code is an experiment that I ran to play with the advantages of multi-threading in C++. Given a number 10000000000 it calculates how many numbers are even, divisible by 5, divisible by 8, divisible by 10 between the range 1 to 10000000000. First, it runs single-threaded function followed by a multi-threa...
I am building a digital clock in C# after watching a tutorial. The code in the tutorial I need help understanding looks like this: if (hh < 10) { time += "0" + hh; } else { time += hh; } time += ":"; Can anyone explain to me why hh < 10? Should it not be at least 12? My end game is to make a timer that starts...
Can someone help me in optimizing the code here? This is the original question Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Question link: http...
i have a pagination library in php. i want to know: how can i make it more efficient when passing large arrays into the constructor how can i add db support paginator.php public function __construct($options = []) { $this->items = $options['data']; $this->limit = $options['limit'] ?? 10; $...
namespace DataStructures type Queue<'T>() = let mutable _list : List<'T> = [] let mutable _count : int = 0 member this.Enqueue value = let revList = List.rev _list _list <- List.rev (value :: revList) _count <- _count + 1 member this.Dequeue = match _list with ...
Continuing from: Part 1 I was not convinced this was true (see comment): std::async([&users, job = std::make_unique<ListJob>(apiList)](){job->run(users);}); // This will not return until all async jobs have completed. So I rewrote it to make sure that I waited for all child work. This means collecting and then waiting...
I am using minimax algorithm (for now without alpha beta pruning) for AI in tic tac toe game in Python and Numpy. It's working, but very slow, so I would like to optimize it. A few rules for current purposes: Board is 4x4 square, Player wins when he has 3 symbols (X or O) in row, column or diagonal, Empty field is rep...
I am new to Python and would like to get helpful tips and suggestions on this code. Would be awesome if you provide info if anything is fundamentally incorrect, improve the algorithm, and any room for further improvements. class Game: def __init__(self): self.board = ["0", "1", "2", "3", "4", "5", "6", "7", "8"] ...
Quick review: I've been writing API code which receives user input that can come as either an object or a value type - a problem outlined here. In order to write an unknown data type to a variable, I first came up with this: Public Sub LetSet(ByRef variable As Variant, ByVal value As Variant) If IsObject(value) The...
I am working on a login/register system and want the register and log in process as smooth as possible. One way of making it smoother is in my opinion to make a multi-step login/register. What I mean: If a user want's to log in, he first have to type in his username and if this username exists, he can type in a passwo...
How does this Pygame code look? Is the run loop usually in a class? I'm a beginner and was wondering what the best format and structure is for using OOP in Pygame. import pygame pygame.init() win = pygame.display.set_mode((500, 500)) pygame.display.set_caption("Game") class Game: def __init__(self): se...
I made a simple code to improve the results for WordPress related posts area and it works fine , but because my experience in coding is low , my code is very long and i believe that there is a way to make simple and better here is the code :- $cat = get_the_category(); $cat0 = $cat[0]; $cat1 = $cat[1]; $cat2 = $cat[2];...
I'm working with an input array, which is 3 levels deep, and creating error message strings accordingly in a separate output array. Below is the code. $e['invalid']['key'][] = 'a123'; $e['invalid']['key'][] = 'a456'; $e['invalid']['color'][] = 'red'; $e['missing']['key'][] = 'b72'; $e['missing']['color'][] = 'blue'; $...
Let me preface this by detailing some of my design philosophy. The intent is to view the board from the perspective of the active player. Player moves are also factored into the design. When determining move logic, all that needs to happen is comparing against '0'. For checking the whiteness or blackness of a piece, or...
I just built a simple calendar app using angular 8. I would like to get some suggestions for improvements in the project. any feedback will be appreciated. I would like to know what I could have done better in the application in terms of both typescript code and overall app design. this is the github link for my projec...
Please review my code where I want to handle the timeout errors and send parsed JSON response if any. There are times when a POST request does not ALWAYS return JSON code. def use_service(branch: str, relative_url: str, request_type: str = 'GET', data=None, retry=1): """ :param – relative_url – the relative url...
I'm trying to do some task scheduler and worker. Tasks are added to the queue from which worker retrieves and processes them. Tasks from one queue must be executed sequentially. Tasks from different queues are executed in parallel. When the worker has completed all the tasks in the queue, he waits for a while and finis...
I'm doing a Java software engineering team project in school and my team has decided on a Finance Tracker application, which contains the main components of Expense, Budget, Statistics, Suggestions and GUIPanels. Currently, the application only allows actions(add, delete, edit) on an expense to revolve around a primary...
I've written a small script to calculate Collatz sequences. For background, read here about the Collatz conjecture. Largest number I've tried so far in my implementation is 93571393692802302 (which wikipedia claims is the number requiring most steps below 10e17), which needs 2091 steps. Apparently I count different fro...
How to open an input file programmatically (javascript) in a reliably way? The most modern versions of internet browsers prevent the opening of input files programmatically (javascript) under certain circumstances. For this reason I opened this thread to define a way to open input files so that we have no problems - or...
I begun to work for a company which do not have enough time to practice code review. As a beginner programmer I would like to improve my skills on real working cases. I have been asked to facilitate translations on "tableau workbook" files (those are just XML files) by replacing french text with English one. I work in...
Follow-up from: Back to Basics - Tic Tac Toe Again, any optimizations and critique is welcome! I'm particularly interested if it involves numpy, scipy | bitwise operators. import numpy as np from random import randint def print_board(board): print(""" +---+---+---+ c | {} {} {} | + + + + b | {} ...
I've translated an implementation of strlen in x86 assembly to C and added alignment checking: #include <strings.h> #include <string.h> #include <stdint.h> #define NOT_HIGH_MASK 0x080808080 #define HIGH_MASK 0x7f7f7f7f #define LOW_MASK 0x01010101 #define mul4(x) ((x) << 2) #define div8(x) ((x) >> 3) size_t strlen(con...
I need to find a root of strictly monotonic function f (only raising or only lowering). There is only a one root of a function. If given range from a to b doesn't contain root (fabs(f(a)*f(b) is not lower or equal than 0), we need to change range, since the assumption is that there is a one root, so we need to move on ...
This is my implementation of the suffix tree using the O(n^2) naive algorithm recursively. It is also my first big project in which I've used all the knowledge I have acquired about C++ so far. I would appreciate any advice on how to improve my code and make it compatible with the modern C++ best practices. SuffixTree....
As an exercise, I want to rewrite a C++ program to import measurement files (and later create excelsheets, reports ...). The measurement files split in 2 files, a binary file, and a xml-file. Because I can't control how the vendor might change the file structure or the names for data, I thought up a way, to put them as...
I made a SHA256 hash bruteforcer as my first program in Rust. It's very specific to what I'm trying to bruteforce and I'll probably never find it. I translated it from Python to make it faster, but can I make it even faster than this? // Disable snake case warning #![allow(non_snake_case)] extern crate crypto; extern...
My code picks a value from a too large csv file (~300MB.) at a given index i and j (assuming the csv as 2D array because it contains just data without headers), it works but it is slow. Is there other method to pick a value from csv file faster? import java.io.BufferedReader; import java.io.InputStreamReader; import ja...
It is a usual pattern when creating a new component, to load references to other components of the same GameObject. Here is an extreme case: [RequireComponent(typeof(Animator))] [RequireComponent(typeof(SpriteRenderer))] [RequireComponent(typeof(Stats))] [RequireComponent(typeof(Hunger))] [RequireCo...
I have been building my data access layer and performance is key for the project I am working on. I have chosen to use Dapper and dotnet core 3. I want to make use of the latest and greatest async features in dotnet core and Dapper to allow for smarter resource allocation under heavy load, however there is not much do...
I am working with a library that has a base class Base, and three class descending from it Destination, Amenity and Landmarks. The Base class looks something like this public class Base { public Integer id; public String externalId; public Base() { } public int getId() { return this.id; ...
I've written a simple unconventional calculator application using Python and tkinter. It's unconventional because you use the "modes" (+ - * /) to add to the current sum, instead of entering in a statement and doing that calculation. Because of this, 0 is not included. The main part of my program I would appreciate bei...
I recently got some help from Stack Overflow on my Tic-Tac-Toe code for the win conditions, but I think it could be optimized a little more. Any tips? moves = [["1", "2", "3"], ["1", "2", "3"], ["1", "2", "3"]] acc = 0 def win(letter): for i in range(3): if ((moves[i][0] == moves[i][1] == move...
The following code is greatly inspired on this question and this answer. That answer works quite well for a specific case, but I was looking for a solution that: could be used more generic (so I can put this in a base library and never have to think about it anymore). got rid of the Find() and replace it with a O1 dic...
I started learning Haskell a while ago and now I am in this dangerous state where I can produce code that does things but which probably makes experienced developers hit their heads against the wall :) So I thought I'd try posting it here and get some feedback. The problem I'm looking at is the "Longest Substring Witho...
I hacked a way to print a christmas tree, to use it in the usual seasons greetings email, you know the drill. Next Step is to integrate a multi lines of text in the border left side of the tree. For this i like to use an offset to the TREE['center']. """ Seasons Greeting mail - ascii Christmas Tree """ import pprint im...
I have a class MassiveDTO that contains lists. At some point in the project, I need to generate an object of this class, that will contain some hardcoded data. I would like to know if there is a better way (or a design pattern) to populate those lists with known data. With the method generateLists I populate them and...
I was doing this algo on leetcode: https://leetcode.com/problems/subtree-of-another-tree/ Question: Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this node's descendants. The...
I am getting used to how things should be written/thought about in (idiomatic) Haskell. I wrote a FizzBuzz program that prints to the console. I wanted to generate things from the core info of the divisors and the strings that go with them, and an array of such rules to be processed. This is in some sense a port of my ...
I've tried with: dictionary.TryGetValue("MoreDetails", out bool MoreDetails); but if the key is not present it defaults to false, and I need it to default to true. Else I have this working implementation: Dictionary<string, bool> CheckNullsSectionsVisibility(Dictionary<string, bool> dictionary) { bool Summary = tr...
Of the languages that I use, I have the most experience with C++. I am looking to sharpen my skills with C, so I wrote this small calculator program. What I have here is a sample of how I would probably write larger programs. #include <stdio.h> #include <string.h> int getSumInteriorAngles(const unsigned int numSides...
I am given a short int. I need to print the bits of it into two bytes. My code is as follows: #include <stdio.h> union info{ short z; struct data{ unsigned a:1; unsigned b:1; unsigned c:1; unsigned d:1; unsigned e:1; unsigned f:1; unsigned g:1; un...
Follow up to: Printing Command Line Unicode Chess Board A couple people from the previous question mentioned looking into coloring the command line with ANSI escape sequences. In Python, colorama seems to handle this quite nicely. Below is my attempt at using it for printing out a chess board. from enum import Enum f...
Currently, I'm going over the CTCI, I'm working on the problem removing the middle node. I'm using Ruby to go over these problems. I have the following solution. def remove_middle_node node = @head count = 1 while(node = node.next ) count += 1 end # reset node to point to head node = @he...
So this original piece of code: const imgUrls = {}; function onXhrLoad() { const json = JSON.parse(this.response); const photos = json.photos ? json.photos.photo : [json.photo]; for (const {id, url_o} of photos) { imgUrls[id] = url_o; } } The original code assumed that the biggest available url to an imag...
Just started learning/relearning data structures for the semester exams. Most of the examples found online are too cluttered or bloated. For myself, I implemented it from theory I learned. It works. I want to know if there are any mistake that I have done, anything that can be improved .. . Thanks for your time :) #i...
The following code computes three different features over the same dataset. I'm not sure if the filter_by_day_segment function can be made tidy or there's a more efficient/short but still readable way of refactor my code. library(dplyr) filter_by_day_segment <- function(data, day_segment){ if(day_segment == "daily"...
I have built a class which validates configuration data. Below is a very simplified version with only the code that's relevant to this question. class configValidator { private $_errors = []; public function validate() { $this->errorGenerator(1, 'fail'); if ($this->_errors) return $...
So I'm creating a unity3D game with infinite terrain and it's going great! However, I'm struggling with a specific but important part of the 'infinite' terrain. Make the terrain actually infinite. I got it working but it's very slow and I've looked through the code and at the profiler that unity has built in and came t...
The past week I have tinkered making a sound visualizer using Tkinter, Matplotlib, NumPy, PyAudio and using a thread to be able to play the sound and to display the plot at the same time. I have been coding Python now for almost two years and I think the program expresses my knowledge as to date. I would appreciate rev...
The goal I really enjoy the game Stardew Valley. One of the things that the game has are geodes. Much like real-world geodes, these geodes can be cracked open, and you can find some fun things inside. Some relatively rare/valuable items can be found inside of them, so it can be beneficial to try and collect them to get...
I have recently learnt SOLID patterns and started practicing them. I did follow all the guidelines but was thinking for a final review from experts if possible. What is the code about ? It encrypts any given string and outputs a hash. Code interface IHash { string Hash(); } // Abstract class implements interface p...
I have some code which transforms a transformation on quaternions and works. But it is written pretty badly, does someone know how to write this better/shorter and does someone knows, if this entire transformation is a transformation 90 degrees on y in euler angles? Edit: I get a quaternion (orix, oriy, oriz, oriw), th...
Here is the description of the problem. Write a simple interpreter which understands "+", "-", and "*" operations. Apply the operations in order using command/arg pairs starting with the initial value of value. If you encounter an unknown command, return -1. Example: interpret(1, ["+"], [1]) → 2 interpret(4, ["...
This library provides methods for storing items into an inventory. the container is based on a grid as well as the items going into that container. can you please review the code in any way? public interface GridContainer { public Collection<GeoPoint> getContainer(); public Collection<GridShape> getContent();...
I'm not a professional Javascript developer and never worked within JS teams. I've made a small library, that is kind of a silly ReactJS clone, optimized for size and minimalism aesthetics, rather than performance. Terrible performance is by design, but I would like the code to be at least a little bit more readable. M...
I'm trying to design a better solution for img srcset with lazy load. Below is the code from the component responsible for lazy load img, maybe someone has a better way to achieve this effect. Full github repo import React, { useState, useEffect, useRef } from 'react'; const ImageLoader = ({ alt, height, id, width })...
I have just finished learning basic-intermediate Python subjects and wanted to test myself. This word-guessing game is one of the first programs I have written. import random def pick_random_word(): word_list = ["python", "c", "java", "swift", "html", "css", "go", "ruby"] random_word = random.choice(word_lis...
I built an algorithm to estimate real-time temperature and humidity values ​based on daily values ​of the same variables. The algorithm works, however the speed with which it processes the information is too slow and this causes me problems when the data is of many years or decades. I need to increase the processing sp...
This code is about merging two or more images. Minimum images are two while maximum images loaded are four. So I will check how many images the user wants to merge. If the user chooses 2 and selects the merge type, two images will be checked for their height or width to resize then append them. I keep using the code fo...
I have just finished learning basic-intermediate Python subjects and wanted to test myself. So here is the my basic Rock-Paper-Scissors game. def play(): import random player_score = 0 ai_score = 0 while True: try: user_choice = int(input("\nRock: 1" ...
EquiLeader A non-empty array A consisting of N integers is given. The leader of this array is the value that occurs in more than half of the elements of A. An equi leader is an index S such that 0 ≤ S < N − 1 and two sequences A[0], A[1], ..., A[S] and A[S + 1], A[S + 2], ..., A[N − 1] have leaders of the sam...
I have working VBA code in excel that changes a network folders permissions. The code uses Wscript.Shell to run icacls commands but there are multiple instances of this command and each time it runs, it opens up a new shell window. It would be interesting to see if there is a way of making the code more efficient by op...
I implemented a sign in from different accounts on which different amounts of money lie. You must also specify what will be sold in the store. When you buy, you can put things in the basket, get them out of there, empty the basket. When you exit, the transaction will occur, and money will be withdrawn from your account...
I wrote a Keylogger in Python who transfers the Key Strokes to an S3 storage. What do you think about the Code? I would add the file saving in an other place and make it more legible. Feel free to copy the code and use it for your own. To run and compile it you need: Python 3.7.5 boto3 pynput pyinstaller Greetings ""...
I've been using Beanstaldk (not Amazon's one) for years and loved the possibility to handle delays and priorities in the tasks, but I recently had to filters the tasks for specific reasons, and Beanstalk doesn't allow that easily. So, after searching a bit, I decided to use Mongo as it seems to be pretty fast, and I wr...
I've written the following Octave function which is designed to be repetively called in a Bayesian optimisation routine and which outputs a value J, the Akaike Information Criteria for the Logistic regression model being tested, given the data function J = rvfl_training_of_cyclic_embedding ( x ) global sample_features ...