instruction
stringlengths
71
71.9k
This is my attempt at a basic implementation of GOL. The user can add and remove cells with the mouse and some basic stats are printed to console. Any feedback is welcome, but I have a couple of specific questions: In Cell::get_neighbours() it seems a bit inefficient to keep constructing vectors for each cell. In Pyt...
I have still another version of my validation extensions. I've reworked it and added some new features. It doesn't relay on expression trees any more but as a compensation the same extensions can be used for unit testing. The base class is still the ValidationContext: public class ValidationContext<TArg> { private...
I'm a Java beginner and I've just started learning about GUI. However, I'm not sure about GUI coding conventions and whether I'm getting the object orientation part of it right. I feel like I'm passing objects around different classes too much. I would like some critique on my code and better ways to do the checkWinnin...
I've created a simple python meter simulator which connects to a serial port (in my case COM1) listens on the serial port and takes actions based on what it receives. I'm looking for some advice regarding: unnecessary / wrong logic (it looks like I've abused those while loops) code that might be rewritten in a more co...
There is a full featured support of countable sets in .NET: IEnumerable<T>. What about uncountable sets; sets defined by predicate? How can they be manipulated and interact with IEnumerable<T>? UPDATED: Countable and uncountable sets Was: Condition-class. Demo (you can play with it here online): using static System.Con...
I have a method that generates some HTML, but it looks ugly to me. Maybe there are some better solutions for this? public static string GetReview(Quiz quiz) { StringBuilder sb = new StringBuilder(); string questionSection = string.Format( "<div class=\"alert alert-info\" >" + ...
I have an application in which I have multiple slow running prerequisite methods I need to call in order to have the data I need to continue. To try to speed this up I am doing this: Dictionary<string, string> processOptions = null; Dictionary<string, string> businessAreas = null; Dictionary<string, string> requirement...
I've written the following code to take data from the Excel file "Data" and use it for a mailmerge in a prepare Word template named "Template." I'm new to using VBA in word or Access, so any feedback in these areas is very welcome Sub AccessTransfer() Dim strPath As String Dim objAccess As Access.Application Dim strEx...
The following function represents the electrostatic potential, in spherical coordinates, due to a ring of charge \$q=1\$ and radius \$R=1\$, placed in the plane \$x\$-\$y\$: $$\phi(r,\theta) = \sum_{n=0}^\infty \frac{r_\min^n}{r_\max^{n+1}} P_n(\cos\theta) P_n(0) $$ where \$P_n\$ are the Legendre Polynomials of degree ...
Right now this function takes an excessively long time to run, please let me know how to make it more efficient. lunarCal is 144x7 and the dput for it is here. Here's the code: if(!require(pacman)) install.packages("pacman") pacman::p_load(lubridate) cat("Please make sure that birthday inputs are in YYYY-MM-DD format")...
I have an object which stores an app configuration in an associative array, as this: [ 'Database' => [ 'DB_SERVER' => 'localhost' 'DB_NAME' => 'adbname' 'DB_USER' => 'theuser' 'DB_PASS' => 'thepass' ] ] And a function, get(), which receives a variable number of arguments and returns ...
I am learning functional programming in JavaScript. This is some code from a video tutorial by funfunfunction. I am particularly concerned about the way the existence of the customer key is checked in the customers object. Is it weird to do it this way? Is there any other way? Also, if you switch the order of the OR st...
I am working my way through FreeCodeCamp's Javascript challenges and Return Largest Numbers in Arrays took me a minute. In this one the goal was to create an array with the highest values from each array as its elements. I am currently using for loops to iterate through the various arrays and arrays of arrays. I wante...
Goals I want to be able to call async code using the MVVM pattern I want to be able to add loading animations/screens without having to add properties for each command on my viewmodels I may want to be able to cancel these operations This is what I came up with public abstract class CommandBase : ICommand { priv...
Sorry, it used to be some retired garbage in Countable and uncountable sets. Now and here it is clean. P.S. I would not like to say that this stuff is about to replace functional programming :) No, it is just about predicates becoming a full featured objects, so you can do math on them in the form of sets. We are alwa...
I'm new to and still fairly confounded by SVGs. I'm feeling pretty happy with the following hobbled together SCSS code demonstrated here: //Functions to create svg backgrounds: @function _buildSVG($bg, $width:'100%', $height:'100%', $viewboxx:'0', $viewboxy:'0', $viewboxw:'274', $viewboxh:'510') { $bg: '%3Csvg%20xml...
Today I solved problem #49 from project euler .net which reads : The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are permutations of one another. There are no arithmetic sequenc...
I have an assignment to write on the standard output the prime factors of a positive number displayed in ascending order and separated by '*'. My code works, but I need help reviewing it before I submit my work. Allowed functions: write, printf, atoi. void find_factors(int n) { int i; int separated; i =...
I completed this Codewars exercise. Here are the instructions: You are given an array (which will have a length of at least 3, but could be very large) containing integers. The integers in the array are either entirely odd or entirely even except for a single integer N. Write a method that takes the array as an...
How is it and can it be optimised? sentence = input("Enter a sentence you want to convert to pig latin: ") sentence = sentence.split() for i in range(len(sentence)): if sentence[i][0] in "aeiou": sentence[i] += 'yay' else: sentence[i]=sentence[i][1:]+sentence[i][0] sentence[i]+='ay' se...
I've implemented a bunch of activation functions for neural networks, and I just want have validation that they work correctly mathematically. I implemented sigmoid, tanh, relu, arctan, step function, squash, and gaussian and I use their implicit derivative (in terms of the output) for backpropagation. import numpy as ...
I am new to Java and would like to know whether my program is idiomatic. Please help me write idiomatic, terse code. My solution is functionally correct. Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent tweets in the user's news ...
For debugging purposes I am storing requests into files. This code is supposed to create a new file for each request. Somehow it doesn't look very nice, can it be improved? Additionally it would be nice if it could be made atomic. filenamePrefix := exeDir + "/debug/" + time.Now().Format("20060102150405") var filename s...
The vertices on the graph are numbers from 0 to |V| - 1 for convenience. I was thinking later to use a template wrapper for the graph. Graph.h: #pragma once #include <unordered_set> #include <vector> class Graph { public: using size_type = std::size_t; using adj_list = std::unordered_set<size_type>; private: ...
I'm creating dropdown list from all possible cities in database, all cities are distincted. $city = DB::table('contacts')->distinct('city')->lists('id', 'city'); ^ Extracts all possible cities, however it also extract empty string ['' => '95]. How I can forbid retrieving empty city ? I tried using $city = DB::table...
Function 1: public HttpResponseMessage Get340BValidations() { int partitionId = GetPartitionId(); //int partitionId = 10054; this.db.Database.CommandTimeout = 180; List<Validation340B> result = this.db.VW_Validation_340B.Where(x => x.partition_id == partitionId)....
I have this code that is working fine but it's taking pretty much 100% of my cpu to run and it takes around 25min. I'd really like to optimize it but don't know what parts I could improve. The main problem I guess is that I'm using coordinates of a file to be compared with a 3,5GB file. So I tried putting the informati...
I am relatively new to LINQ queries as I normally just use plain SQL to get my data back but i am changing for the good - Anyway obviously with SQL you pass in parameters so you do not get any SQL injections etc. Now the LINQ query I have written I think is safe but I am thinking it may be able to done a little easier ...
I have a polymorphic notification model with action attribute. When user clicks on a notification he/she should be redirected to given page the notification refers to through notifiable. What is the best way to refactor the following method? _notification.html.erb <%= link_to checking_decreasing_user_notifications_path...
Given an array, return True if the array contains consecutive values: has22([1, 2, 2]) - True has22([1, 2, 1, 2]) -False has22([2, 1, 2]) - False I do aware of a quick solution by iterating the list in a for loop and comparing current and next items for equality until it reaches the end, also using modules like ...
The list is pretty simple, here is my code: ILinkedList.java package datastructures; public interface ILinkedList<T> { public enum posForOperation { BEGGINIG,BEFORE ,AFTER ,END } public class Node<T>{ T data; Node next; public Node(T data){ this.data = data; thi...
I've very recently started using OOP paradigms for the code in my work (academic research). As an exercise I tried coding this quick scoreboard. I'm not interested in improving the 'display' part, I know there would be a lot to do there, but does my use of classes make any sense? import os from numpy import nan, nansum...
I have this all figured out now thanks to the help of a mod. Here's the working code: <script> jQuery(document).ready(function() { var queryString = location.search; var regEx = new RegExp("slide[0-9]"); var match = queryString.search(regEx); if (match === -1) { return; } else...
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. Is this the best way of doing this? def fizz_buzz(num): if num%3==0 and num%5==0: ...
I want to create a list of random integers in the range [0, 9], that sums up to 100 in Excel, using VBA. The list should be printed in a single column. The routine I've written is as follows: Sub RandomList() Dim arr(100) As Integer Dim i As Integer i = 0 Do arr(i) = Int(10 * Rnd()) i =...
I am trying to detect whether a condition is being returned true or false. The only problem is, I have a bunch of if/else statements. Is it possible to refactor this in less lines? Maybe a for loop or re-writing my markup? $(document).on('click', '.cert-modal-btn', function(event) { event.preventDefault(); var...
I am using the following code to retrieve the URL of a random image in a remote folder that I own. As a newbie and although this is working I would like to know if this is done properly, if it could be improved and if there is any security issue with this approach. I am using json_encode and json_decode because I need ...
So I have this piece of Python code that essentially takes a tuple, then modifies the second (and every other) element by prepending a string to it. Unfortunately the only way I can think to do it is convert it to a list (as tuples are immutable), step through, edit and then convert back to a tuple. It works so I can'...
I am using the following code to password protect pages on my site. This is how I am including it on a page: <?php include("/path/to/password_protect.php"); ?> After that line I have the rest of the page code, which is not displayed if the user is not logged in. This is the password protect code itself, included on ev...
Introduction Suppose you are given three elements \$a, b, c\$ with respective weights \$1, 1, 3\$. Now, a probability distribution data structures will return upon request \$a\$ with probability 20%, \$b\$ with probability 20%, and \$c\$ with probability 60%. The API for my probability distribution data structures is d...
The problem My intention is to have a class A and class B. class B has a std::list from a pointers of class A. I need three operations to complete very fast: Inserting new A elements into the list in B Removing these very fast Iterate through the A-s already registered in B sequentially. Their order is irrelevant. My...
I thought this would be a fun exercise to use SQL to participate in the June 2016 Community Challenge, so I did. Yes, you may call me crazy! I had to write a few little things to help me, I needed a function to simulate a dice roll, but functions do not support the using of RAND() function because it has side effects, ...
I need a generic data structure that ensures that its elements are unique. C# has HashSet<T>, great! As it turns out, the elements have to stay in the order in which they were added, too. This sounds more like List<T>. I tried to create my own: using System.Collections; using System.Collections.Generic; namespace Coll...
I'm having trouble optimising the project euler #50 exercise, it runs for around 30-35 seconds, which is terrible performance. The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred. The long...
I wrote a few simple extension methods that allow to traverse a hierachically data structure depth-first or breath-first using LINQ: Usage: public class Item { public Item(string name, params Item[] children) { Name = name; Items = (children ?? new Item[0]).ToList(); } public string Name...
I have the following problem: Given an Array, apply a certain method x to each Array element (yielding a new Array), with the restriction that array elements which are nil, should be mapped to some default value. Method and default element are parameters. Example: Array: ['abc',nil,'defg'] Method: :size Default elemen...
I am learning Clojure by implementing a simplistic resource reservation system. At its core are the two functions for placing/canceling reservations for a given resource: ; thread-safe map of {resource -> #{reservations}} (def known-reservations (atom {})) (defn place-reservation [new-res] (swap! known-reservation...
I am fairly new to Python so I am trying to learn more about its conventions and ways to make my codes more efficient. I am making a Blackjack game and so far have this class that draws, organizes, and scores a hand of cards. class Hand (object): def __init__(self, card=[], card2=[], score=0): self.card = c...
I was using this code to fetch a CGI parameter: $page = int(param('page')); This sometimes results in: warning: Use of uninitialized value in int Is this a good solution to resolve this warning, or is better and more succinct code available? if (defined param('page')) { $param_page = int(param('page')); } else { ...
I'm working on a biometric matching system and I would like to have few suggestions regarding vectorizing the following code: % tpol and ipol % column 1: x co-ordinate of the feature % column 2: y co-ordinate of the feature % column 3: angle orientation % column 4: type of feature ref_points=size(tpol,1); %number of ...
I wrote a ROT13 cipher script rotating uppercase letters only. Can this function be improved? ROT13 Wikipedia article function rot13(str) { var codeA = "A".charCodeAt(0); var codeN = "N".charCodeAt(0); var codeZ = "Z".charCodeAt(0); var newArr = []; for(var i =0; i<str.length; i++){ var code = str.charCodeAt(i); ...
I was just asking this question over here. I'm on a project in which I'm failing to see the point of how a previous developer made decisions. I HAVE taken over this project and wish to make changes. Same exact method names in DAL and BAL Static is EVERYWHERE What should I do with new methods to follow best practices?...
I struggled for the last couple days on this question and finally came up with a solution. But it's got so many loops I get dizzy just looking at the code - from recursive functions with loops to loops within loops. I really expected to find a canned function in a popular XML class to extract all the unique nodes witho...
I had a complex query in the controller like: def outgoing_tasks @tasks = current_user. assigned_tasks. uncompleted. includes(executor: :profile). order("deadline DESC"). paginate(page: params[:page], per_page: Task.pagination_per_page) end and since I have some...
Up-to-date version: IEnumerable and Predicate Sets in .NET (Complete, Explained). Previously: Countable and uncountable sets in .NET (clean version). Disclaimer: Please do not interpret my attempts to gain maximum from .NET as some kind of socially unacceptable behavior. You, probably, know someone who does it to his/h...
I currently have an app that uses Firebase for logging users in and I would like to know if I can make this code any better. I currently have 4 files: auth/models/User.java auth/BaseActivity.java auth/CreateAccountActivity.java auth/LoginActivity.java User.java: @IgnoreExtraProperties public class User { public ...
In my company, I've inherited some Java library that I'm now writing tests to, refactoring and fixing Sonar issues. One particular point that Sonar is complaining about is a big chaining of if/else if/else statements, that is used in a class responsible for parsing values that come from the DB to the corresponding valu...
I'm looking for feedback on the following code which checks if a number is prime using Swift 2. import UIKit var number:Int = 1123 var isPrime:Bool = true switch number { case 1: isPrime = false case 2: isPrime = true case 3: isPrime = true default: primeCheck:for i in 2...Int(sqrt(Do...
I'm updating an old ECS I wrote a couple years back, and I've written the following piece of code in order to generate a GUID: const auto& es::EntityStore::RequestEntity() { if(m_freeEntities.size() != 0) { return ec::ENTITY_ID_INVALID; } //Get the lastmost EntityID auto eid = m_freeEntities...
I wrote a solution to the Coding Challenge SPOJ Prime in C++ using the Sieve of Eratosthenes. How much Ever I tried I could not get over the Time Limit on SPOJ which is 6s for Primes upto 1000000000. Here is the Problem StateMent Input The input begins with the number t of test cases in a single line (t<=10). In eac...
I wrote a code which: - parse string to my enum - get description from enum - assign to string[] array private readonly string[] allowed; public AuthorizeRoles(params object[] arrayParam) { allowed = (arrayParam.Select(myField => Enum.Parse(typeof (MyEnum), myField.ToString())) .Select(temp => temp.GetTyp...
The idea of the algorithm is to decrease a number from a word. Is there a better way to write this algorithm? limitiation: it is important to decrease with a limit, if BB is the word we decrease from, after decreasing by 1 the result will be BA, but after decreasing by 2, we expect logically for the result to be AZ,...
The app calculates the tax which is included in a (given) amount. Because I'm new with both libraries (React.js and Foundation) I would appreciate hints and improvement suggestions. Live demo on CodePen var SelectInput = React.createClass({ changeHandler: function(e) { this.props.setTaxRate(e.target.value); }...
I've made mine first Java program and it was Guess a number game and got some great code review, so I've decided to first implement that suggestions and to make a game a bit more complex/advanced. So now, the user can select between 3 options, 3 different intervals (1-10, 1-20, 1-100), but also, in each interval there ...
Actually, I don't like to write for/foreach. I had to write a loop. I would like to replace it with array_map/array_walk. The code: foreach ($data as $key => $value) { if(isset(static::$specialKeywords[$value])) { unset($data[$key]); $check['specialKeys'][] = $key; $check['specialValues'][] ...
Having the following code in PHP 5.2, where: $row: Is an array that contains some things, but the ones that are interesting for the post are country_from and country_to, which are country names. $pBCountries: Array containing strings with country names. Here's the content of the array: http://pastebin.com/f241JeqV Th...
My name is Matt and I have a fat controller problem. In truth I have limited experience of MVC and I'm trying to learn how to organise my code better so it's more testable and more maintainable. Here's my first effort at rewriting a bit of my existing application to make it happier and slimmer. It's a controller which ...
Note: This question has a follow up question here. I have an Excel workbook with two sheets: "Raw data" and "Summary". In the raw data sheet there are several blocks with data structured like the image below: I want to create a summary of the data below, in the sheet "Summary", looking like this: The way I've done th...
Take a look at following code: /*abstract*/ class Capturable { object _lock = new object(); public bool IsCaptured { get; private set; } public bool TryCapture() { if (!IsCaptured) lock (_lock) if (!IsCaptured) return IsCaptured = true; re...
Thanks to zak for some great advice on this previous question. This is a follow up question: I have an Excel workbook with two sheets: "Raw data" and "Summary". In the raw data sheet there are several blocks with data structured like the image below: I want to create a summary of the data below, in the sheet "Summary"...
This is a script I made that opens img.png, downloads the JSON data from the API, writes it on image and displays it. It currently is a community ad over Arqade. <?php header('Content-type: image/png'); //setting header to png so it will display as an image $donationImage = imagecreatefrompng("img.png"); //loading the ...
I have a few thousand binary files that have corresponding structs in them, followed by any number of bytes (this exact number of bytes is given in one of the fields in the structs). I read in data from the binary files to a struct, and assign variables from certain fields in those structs. I was wondering if there is ...
The code below is for a social networking system. The problem is that when there are many posts and many followers, the performance is slow. Is something wrong with the queries and the script below? public function __construct($dbo = NULL) { parent::__construct($dbo); } public function count() { $count = 0; ...
I am new to Android development. I am currently working on an Android app that fetches changing location coordinates from a SQL database, and plots on a Map view at regular intervals. But I think this code can be made more efficient, as I am unable to fetch locations after a certain time and can't figure out how to sol...
This is my first attempt at making a program in C++, I was wondering if my code was good or should it be improved upon. Here is the code below. Any help debugging would be greatly appreciated. Some things do not work as intended, such as the battle. The grunt would still continue to attack after his health goes to zero...
GitHub Repository Previously: Countable and uncountable sets in .NET (clean version). Thesis There is a full featured support of countable sets in .NET: IEnumerable<T>. What about uncountable sets; sets defined by predicate? How can they be manipulated and interact with IEnumerable<T>? Solution Let;s introduce two lib...
I'm developing a plugin for Revit (a software to make 3D buildings). The goal is simple to understand. When there is an intersection between a Wall and a Duct I create an object called Reservation at this location. I need to extract the Curve of the Ducts and the Faces of the Walls in order to calculate this intersecti...
Up until recently, my LINQ-to-Sage provider didn't support projections, so the client code had to explicitly "transfer" to LINQ-to-Objects, like this: var vendorCodes = context.Vendors.ToList().Select(e => e.Code); Now, with a bit of help from Stack Overflow, I was able to modify my IQueryProvider implementation to ...
I am trying to copy values from one sheet to another using loop with two conditions and it is very slow. Removing conditions from code doesn't have any effect on the speed of the execution. I already have sample sheet where everything is done with functions (if/match/index...) but I would like to remove all functions f...
As you can see the below code for each method is that same, except for the properties it uses. For example X vs Y and Width vs Height. Is there anyway that I can refactor the code to use a common main method that changes on which property it uses? Notes: The all caps constant is BOX_LINEUP_TOLERANCE has a value of 0.15...
I am categorizing terms depending on what letter the term starts with. What is the cleanest way to do so? var parentGroup, startsWith = "H"; // Just simplifying and giving a static example here. switch(startsWith) { case "A": case "B": case "C": case "D": case "E": case "F": parent...
This is my second day in learning Scala and I still need to develop a taste of functional programming, I often find myself doing imperative coding. Below is the result of my TDD practice. Code class DNA(dnaSequence: String) { var count = collection.mutable.Map('A' -> 0, 'T' -> 0, 'C' -> 0, 'G' -> 0) dnaSequence.fo...
I am a beginner and would like to build a pool. I made some research and found out that if my software has heavy object create and delete part, I should use a pool because of performance. I made some function to get a T from the pool and reset it, and would like to know if it works correctly. I tried my implementation,...
The following is a function that accepts a hex value (with or without a #, 3 or 6 character) and returns another hex value that is "closest" to it from a set of static hex values defined within the function. It involves a conversion to RGB. How do I make this function more "elegant"? This is more of a question in gener...
The minimum window substring problem from leetcode.com asks: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity \$O(n)\$. For example, S = "ADOBECODEBANC" T = "ABC" Minimum window is "BANC". I post two versions of code. The differences between two...
Write a function that provides change directory (cd) function for an abstract file system. Notes: Root path is '/'. Path separator is '/'. Parent directory is addressable as "..". Directory names consist only of English alphabet letters (A-Z and a-z). For example, new Path("/a/b/c/d").cd("../x").getPath() should r...
I have a problem with Youtube videos being deleted from my big playlist and not knowing which videos got removed. So, I decided to write a Python script to save certain information(title etc.) about the videos in a playlist into a text-file. I particularly don't like the setChannelNames() func, but that's the best I co...
I have the following series of click events in my jQuery code: $('#morning .up .hour').click(function () { morning.hour++ update_hour(morning); }); $('#morning .up .min').click(function () { morning.min++ update_min(morning); }); $('#morning .up .sec').click(function () { morning.sec++ update_sec(morning)...
I have been reading the book Pattern Recognition and Machine Learning (Bishop) for a while, and recently I came across this figure, which was created using Bernoulli mixture model on the MNIST dataset: I figured it would be fun to code this, so I basically followed their algorithm: Suppose you have N images of handwr...
I wrote simple generic function to check if any STL container has an element. It seems work fine. I have tested it with VC++, GCC and Clang compilers. It works perfectly. How can I improve it further. #include <iostream> #include <algorithm> #include <utility> #include <map> #include <set> #include <vector> #include <a...
I am making a userform that grabs data from a data sheet and puts it into a table: Grabs the data based on what the user wants (Brand -> Items for brand) Allows multiple items to be added Displays the info about the items Allows the user to specify how many of each item (for when the data is put into the inventory tab...
I'm at uni and working on an assignment in c# that takes some user input (from they keyboard via console). The input validation required: numbers must be within range (range will vary depending on which menu they're in) strings must not be empty/null string must be no longer than 30 characters in length So I've chose...
This is the Swift code from one of the view controllers in my app that calculates a one rep maximum weight a person can theoretically lift. This particular view controller presents a list in a tableView of all types of lifts a user can choose from to set as a default preference. When the user selects a lift name, the r...
I'm looking for a better way to implement a huge CompareTo function that relies on an Enum to perform sorting. The data structure is essentially a flattened Multi Level Group. Any ideas and concept to make this function easier to understand and extend are appreciated. With the exception of of the Field 1,2,3 names ever...
Having played Human Resource Machine for over a day, and wanting to improve my interpreting / tokenizer skills, I made a Human Resource Machine interpreter. For those that do not know, so if you do you can skip this. Human Resource Machine is a game where you're an 'instruction follower' employee. You are given tasks ...
I have to write a little social network for a case study at university. I have done some simple webapps before but nothing that required authentication, login and so on. So I wrote this little application after reading several guides on how this is usually implemented. What I came up with is a simple login.html file in...
I want to show you an iterative algorithm to convert a signal to a Fourier series. When I ran unit tests I gaven following results: one iteration: 1 sec, passed; ten iterations: 3 sec, passed. I use Visual Studio Community 2015 environment. I'm writing this library in C# and MathNet NuGet package. How can I optimize ...
I have been working on a problem that asks me to a write recursive function that can reverse the words in a string. For example if the string is "cat is running", then the result should be "running is cat". I already completed the problem, but I feel like my implementation is really bad. Does anyone know any other way ...
I would like to merge multiple arrays that are already sorted, into one sorted array. My arrays look like this : { "arrays": [ [ { "type": "tag", "position": "start", "text": true, "offset": 1280, } { "type": "tag", "position": "end", "tex...
I have written some improved C-type classes in C++ and wondered whether these are suitable for professional use or in which way they would have to be improved to be professional or more powerful. Especially in such cases I was not sure about it: template <typename arg, typename ...args> void DoubleArray::append(arg num...