instruction
stringlengths
71
95.1k
There is some language where the following are considered comments: [str] // comment [str] /* comment */ [str] [str] # comment [str] /* comment1 comment2 */ [str] where [str] is 0 or more occurrences of some string. I'm reading a file line by line, and need to remove the comments from the whole file (the file is larg...
I am in the process of learning Rust and am still having some issues with borrowing and ownership. I find myself trying to borrow mutable references that are already borrowed as immutable references etc... I noticed that when I try to iterate over the primes without owning them, I encounter issues trying to modify the ...
I am using the following pattern in my code. It works. But, it feels as though it is on the edge of what should work! Should I consider an alternative? I have an array in my class that maps an underlying data array. This is the sort of thing for which I could use a lazy sequence. However, I don't want to re-evaluate ev...
I have completed my website and I'm super happy with its design, but I feel that how I reached this point can be made more efficient and genuinely improved. Note: I'm only looking for assistance on how I can get the same output, but with fewer media queries for responsive design I feel that there is a flaw in the about...
I'm working through Paul Graham's ANSI Common Lisp and in Exercise 2.5, I'm stumped. My specific question (I wasn't sure whether this type of question is suitable for stack overflow, code review, or neither) is: How to even begin working on an answer to this question. What's interesting is that I simply don't know how ...
The task: Given an array of numbers and an index i, return the index of the nearest larger number of the number at index i, where distance is measured in array indices. For example, given [4, 1, 3, 5, 6] and index 0, you should return 3. If two distances to larger numbers are the equal, then return any one of th...
I'm using Ionic 4 and Angular animations to animate modals. I created the following two functions that control the animations but they share a lot of repeated code. Is there a way I can clean these up into a single function that just takes an array of parameters for the animations? import { Injectable } from '@angular/...
The overall idea is: I have an Android phone and I would like to copy the files in a folder from the phone (which is running an SSH server, that's how I connect to it) to a harddrive connected to my Raspberry Pi. (I want to know, for sure, what files on my Android were copied to the Harddrive, which is why I have the...
I have a Numpy function that takes the values of an existing array X and a size (int) k equivalent to the columns of the array. This function does some calculations in a new array, to finally output the new array after the calculations are done. def ff(x, k): newarr = np.zeros((x.shape[0], 1), dtype=np.uint32) ...
#include <iostream> #include <iomanip> #ifdef USE_OLD_RAND #include <stdlib.h> inline double getRandDart() {return rand() * 1.0 / RAND_MAX;} #else #include <random> std::default_random_engine generator; std::uniform_real_distribution<double> distribution(0,1); inline double getRandDart() {return dist...
I have a Winforms MVP application where I need to use the ErrorProvider on the view. I have added the following methods to my presenter to allow me to show the ErrorProvider but it just doesn't feel right. Please review my code and tell me if you think there is a more efficient way of carrying out the validation. priva...
I've recently decided to get into functional programming with F#, and decided to learn the language through Project Euler. The following is my implementation of problem 102: Problem: Three distinct points are plotted at random on a Cartesian plane, for which -1000 ≤ x, y ≤ 1000, such that a triangle is formed. Consi...
I am trying to solve this HackerRank challenge which asks to write a function that prints the indexes of all sentences which contain the query words. For example, if the inputs to the function are: textQueries(sentences, queries) textQueries(['jim likes mary','kate likes tom', 'tom does not like jim'],['jim tom', 'like...
I'm extracting variables from user entered mathematical expressions, so that I can enter them into the expression evaluator exprtk. For now, the condition is given that variable names will be composed of consecutive capital letters. Any mathematical constants or function names will be lowercase. Some hypothetical input...
Yesterday I saw a CodeTrain video in where Daniel Shiffman tried to approximate Pi using the Leibniz series. It was interesting so I decided to try it too. I wrote this console application with a simple goal: Approximate as fast as possible as many digits of Pi the program can until it reaches the maximum number the cy...
I read an interesting old question on the Software Engineering SE about how to transition away from std::auto_ptr. So I wrote a wrapper around the common subset of std::auto_ptr and std::unique_ptr. The wrapper's mission in life at runtime is to clean up pointers created with new when the scope ends regardless of how t...
This function is a wrapper for arc4random(3), a cryptographic pseudo-random number generator on macOS and BSDs, but you can also get it by installing libbsd-devel on most Linux distros. It serves the same purpose as arc4random_uniform(3), the official wrapper for arc4random(3), i.e. to generate a nonnegative random int...
I am trying to make a simple expression evaluator in Java using Jacc (a parser generator). I am done with the AST creation and now need to create an evaluator. For this I made a simple test to try to understand how visitors work. Here is my code interface Visitor { public void visitB(B b); public void visitC(C ...
Implement an autocomplete system. That is, given a query string s and a set of all possible query strings, return all strings in the set that have s as a prefix. For example, given the query string de and the set of strings [dog, deer, deal], return [deer, deal]. class DailyCodingProble11 { public ...
The problem is regarding probability. The problem is given in detail here. In an \$m \times n\$ grid, \$2mn -m -n\$ matchsticks are placed at the boundaries between cells. We can play a chance experiment where each matchstick can be removed with a certain probability \$p\$. We can define the ratio between numbe...
This is what I am doing and it's working: var isEmpty = true; for(let i = 0; i< members.length; i++) { var member = members[i]; if(member && member[3]){ isEmpty = false; break; } } if(isEmpty) { var somePrefix = "123 -" for(let i = 0; i< members.length; i++) { v...
I have no problem, but I would like some advice: I've read some help to do some jQuery plugin, and I just did my first one. This plugin helps to generate dynamic datatable: Autofill the table with some JSON data using the plugin datatable Create a form to add new lines Create some trigger click on the line => display ...
I am writing function numericValues(text: String): List[Int] to extract patterns """([a-z]+)\s*:\s*(\d+)""" and return the list of the numeric values : numericValues("a123 : 0 abc:123 123:abc xyz:1") // List(123, 1) I would write numericValues like this: def numericValues(text: String): List[Int] = { val regex = """...
(We are on SQL Server 2008). The following constellation: Our applications passes date&time around (in the most horrible way possible). We want to simplify this. Instead of a culture-specific string like '31.12.2019', we're now passing an ecma-timestamp (the number of milliseconds between the point in time in UTC and 1...
I have often found myself using a try {semaphore.Wait()} finally {semaphore.Release()} pattern when using a semaphore, so decided I wanted to try and write an extension method to do this instead. This stems from the problem where I wanted to dispose of my class containing the SemaphoreSlim instance, and was unsure how ...
This emulates behavior of tab and shifttab with → and ←. I.e., switch focus to the next/previous select field with parent class .tab (which are not siblings in the DOM.) It works, but is there any way to make it more elegant? Especially the if/then and the limit to range. I'm fairly new to JavaScript. $(document).on('k...
GitHub repo (MIT) Clone the repo and replace the contents of example.py with the one at the bottom and you'll have everything setup. Explanation of the code A long while ago I posted the question "Abstract graphing-and-timing functions". It was a god class, wasn't extendable/configurable, you also had to use strings to...
The task: Given a pivot x, and a list lst, partition the list into three parts. The first part contains all elements in lst that are less than x The second part contains all elements in lst that are equal to x The third part contains all elements in lst that are larger than x Ordering within a part can be arbitr...
This working script reads a list of URLs from one or more text files, and for each, retrieves the page title from the Internet and appends the results in the format <url/>\t<title/>\n to the output file (for each input file it creates a corresponding output file). I am a Python newbie and would appreciate any feedba...
I'm new to python, and I wrote the following code. Please review, critique and enhance. This project compares quicksort, mergesort and bubblesort write/test the partition routine for quicksort. (20 points) The rest of the code is given. write/test the merging part of the mergesort. (20 points) The rest of the code i...
The User story is as follows: Users are allowed to get "verified", so other users know they have passed a background check. After tapping "get verified" button, or the "verification badge" displayed on another users profile, they will be redirected to a view that will either prompt the current user to get verified, in...
Say that I have running id from 1 to n, and a value column: set.seed(1) x <- data.frame(c(1:10),rnorm(10,10, sd = 2.5)) colnames(x) <- c("id", "value") id value 1 1 8.433865 2 2 10.459108 3 3 7.910928 4 4 13.988202 5 5 10.823769 6 6 7.948829 7 7 11.218573 8 8 11.845812 9 9 11.439453 10 10 ...
The HTML page shows list of a friend network of a person (each Name has anchor <a> tag w. link to list of friend network). Since the page has a timer, I've written Python code to scrape the mth position (friend) of the nth count (page) by traversing through the cycle: (m->n->m->n....). And it works! import urllib.reque...
I have inherited this nightmare Python, Selenium, and Pandas project. I am learning Python as I go; and have been cleaning up and refactoring the code where I see necessary - It was worst if you can imagine; anyway, if anyone is a Python/Pandas/Selenium enthusiast and has ideas to optimize it further beyond this point;...
This is also on github: https://github.com/theypsilon/getters-by-type-rs #[proc_macro_derive(GettersByType)] pub fn getters_by_type(input: TokenStream) -> TokenStream { ImplContext::new(input, "GettersByType", false).transform_ast() } #[proc_macro_derive(GettersMutByType)] pub fn getters_mut_by_type(input: TokenSt...
I wrote a function to convert an unsigned integer number given by a string from one base to another. Can you please give me any tips to improve it? #include <assert.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <limits.h> #define MAX_BASE() strlen(alphabet) static char cons...
I have a script for zipping up old files. I know using Windows Compression isn't ideal, so I will make the script run using 7-Zip later on. For now though, I just want see how I can make my current script better. By better I mean, how could I make this code cleaner or neater? How could I make the script more effective?...
I have written the following function to be a general "error logging" solution for my Windows API projects. Basically, given a Windows system error code (a la GetLastError()), it will log the error message into a file: #include <Windows.h> #include <strsafe.h> // MAX_PATH for file name, 12 for max signed int in base 1...
The following code works fine, however, I'm trying to simplify it. I wrote it but I'm a beginner PHP coder. I can see that most probably the use of a function or class would be better... or anything to make it more concise in terms of PHP. This is WordPress PHP code. I can't do it in a loop. You see how repetitive it i...
I'm beginning to learn about Golang and I would like to have some advice about the following program. package main import ( "fmt" "net/http" "time" ) const BenchmarkTry = 1000 type PageBenchmark struct { url string time int64 // microseconds } func execBenchmark(url string, channel chan PageBen...
In my second post I am looking for the way to change answer dynamically. As you can see there it changes when I completely fill the input. I want it to change for every letter typed . I will be gratefull guys ! var passwordField = document.forms["takis"]["hero"]; var checkContrainer = document.getElementById("contrai...
I'm trying to write a program that stores usernames and passwords. So I have created a Record class. Each record has an id, title, username, and password field. I want to write each record to a text file. However, I am having some issues. When I compile I get the following errors. 'Record::getTitle': non-standard synt...
I am a beginner programmer and would like some feedback on this Tic Tac Toe game I made on Python. Any feedback would be appreciated, as I really want to get better at programming and pick up good habits. Here is my code. Something I would add is try statements for invalid user input, but this is not important as I wou...
Further-developed followup to this question Python beginner here. I created a command-line program that generates poker hands (5-52 cards) and compares their strength. On my Macbook Pro, it generates and compares 1m 5-card hands in ~2m. Here's my code: import copy import distutils.core from enum import Enum from time i...
Lots of Prim's algorithm implementations seem long, and rely on a priority queue implementation. If I use an adjacency matrix I can then calculate the next item to take using functional programming in Swift. func prims (_ matrix : [[Int]]) { var selected = 0 var selectedSoFar = Set<Int>() selectedSoFar.inse...
I got this question during my interview: Given an integer N, output an N x N spiral matrix with integers 1 through N. Examples: Input: 3 Output: [[1, 2, 3], [8, 9, 4], [7, 6, 5]] Input: 1 output: matrix filled out as a spiral [[1]] /*PSEUDO: rowMin = 0 rowMax = n - 1 colMin = 0 colMax = n - 1...
I am looking for ways to make this code more "pythonic" and any issues with my implementation. This was designed to solve Crytopal's Challenge 10. This challenge requires recreating the AES-CBC cipher using a library-provided AES-ECB function. PKCS7 padding is also used to align bytes to block boundaries. from Cryptodo...
While trying to discover a way to calculate the digits of Pi faster with the Leibniz formula for Pi, I noticed that, if I took two consecuent numbers in the series, and calculate their average, I would get a number incredibly closer to Pi compared to these other two numbers, and furthermore, if I took another consecuen...
I'm currently reading Mastering Perl for Bioinformatics; I'm using the book for learning bioinformatics while implementing the code in C++. I came across a situation where I needed to use the minimum of three numbers, which the author did using a function call min3 which, as expected, returns the minimum of three numbe...
I have the following simple function: __device__ mirror(int index , int lB, int uB) { while(index < lB || index >= uB) { if(index < lB) { index = lB + (lB-index); } if(index >= uB) { index = uB-1 -(index-uB); } } return index; } Assume lb <= uB. ...
For the past months I have been learning plain javascript without jquery or libraries/frameworks. So now, when I develop a website, I want to write all of the JS code by myself to fully understand what is going on and to learn the language. So far so good. I tried to implement a slideshow with a fading background image...
Problem description: Molly wants to purchase laptops for her school. Find out how many laptops she can purchase by comparing the vendors available. Each vendor sells the laptops in batches, with a quantity identifying how many laptops on each batch, and a cost for the whole batch. Sample input: 50 [20,19] [24,20] ...
I need you help with my php session class. I can not understand, the class implements adequate work with sessions. By adequate work, I understand the security and correctness of the methods. <?php namespace Core; class Session { /** * @var string Название сесии */ private $name; /** * @var...
This is a homework question, and I have written the code but wasn't sure if I had picked the right data structure for this job and minimised time complexity. Can anyone give me some feedback, anything about space complexity or potential bugs that can occur is appreciated as well. Problem Description MagicTheGathering ...
I was asked to create a Java program that will navigate through a series of mazes. I would like to know if this is the optimal way of using a DFS or is there a better way and I am doing something wrong? Example of a Maze File: 10 10 1 1 8 8 1 1 1 1 1 1 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 1 0 1 0 0 0 0 0 ...
The following source code is working Quad Tree Implementation in C++11. How can I simplify the source code but also allow the user to bring his own Point Class Implementation? #pragma once #include <algorithm> #include <array> #include <cstddef> #include <functional> #include <vector> namespace forest { template <typ...
Mainly looking for feedback on my use of smart pointers to implement a standard stack. For interview level production code I have also include a namespace and asserts to test my class, let me know if that would be appropriate for an interview. I'd like feedback on my pointer management to avoid memory leaks, like how I...
I've added a timer to my code and the bottleneck comes when I'm looping through 47 rows and inputting data from a dictionary that I previously loaded with values. Since i use these files for a lot of different things I've set up public variables in order to avoid setting them up for every new code. So my question is, i...
I started coding in August 2018, and I was wondering on how I can improve as a programmer. I'm more concerned about coding conventions. Particularly, how can I improve the structure of my code, organization, comments, variables, formatting, etc. Any other feedback is welcome and appreciated as well. I completed a Snake...
We know that P-values (within t-test context as an example..) is highly sensitive to sample size. A larger sample will yield a smaller p-value remaining everything else constant. On the other hand, Cohen´s d effect size remains the same. I'm inspired in this code here, but I´ve changed some parts to make the differenc...
The algorithm takes input for a string's length for L, and the number of strings altogether for X. The hamming distance is for input D. Input Z calculates the exact amount of all possible characters in the string besides the permutations for input D. We get a set of Z amount of characters. We divide Z by D which is S. ...
I am trying to create a function for a larger script to determine the third octet of a site IP address based off a user entered site number. I have actually come up with the function, but was hoping that someone could help me come up with something that is simpler and more elegant, instead of the multitude of nested if...
I have a function that changes the image on a webpage every three seconds. I would like feedback on efficiency, good code practices, and anything else that can improve the quality of this code. It works, I just want any insight if it can work any better. Any and all feedback is welcomed and considered. Slideshow Script...
I've done a little bit of programming in the past, mostly just dabbling. After a long time of not touching an IDE, I am getting back into it, with Visual Studio. I just threw this quick project together to make sure I remember how to use classes and objects before I start playing with bigger projects. I would love a qu...
There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters. For example, if N is 4, then there are 5 unique ways: 1, 1, 1, 1 2, 1, 1 1, 2, 1 1, 1, 2 2, 2 What i...
I try the most to solve a twoSum problem in leetcode 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. Example: Given nums = [2, 7, 11, 15], target = 9, B...
I'm developing a face recognizing application using the face_recognition Python library. The faces are encoded as 128-dimension floating-point vectors. In addition to this, each named known person has a variance value, which is refined iteratively for each new shot of the face along with the mean vector. I took the re...
I have a program that prints the star pattern. Starr Pattern is: * * * * * * * * * * * * * * * * * My code is: $n=5; for($i=0; $i<$n; $i++){ for($k=$n-$i; $k>0; $k--){ echo ' '.' '; } for($j=0; $j< ($tot = $i+1); ...
I tried a binary solution to 3Sum problem in LeetCode: Given an array nums of \$n\$ integers, are there elements \$a\$, \$b\$, \$c\$ in nums such that \$a + b + c = 0\$? Find all unique triplets in the array which gives the sum of zero. Note: The solution set must not contain duplicate triplets. Example: Given array n...
I need to determine the status of a parent object based on 2 variables of each of its children. I came up with a working solution, but this includes a nested "if-else if-else". Needless to say, it doesn't look very elegant. I was wondering if there is a way to simplify this. I have muddled around with some map/reduce ...
I have been working with Rcpp to perform a forward and backward Hilbert Mapping. Below is an implementation based on this code. My application is in genomics and I may be dealing with enormous datasets, which necessitates the use of very large integers for indices, so I found this code for passing large integers to R ...
I am just starting my journey in to rust and will gladly accept any feedback you can give me. This is the third exercise in the Rust book chapter 8. Exercise description Using a hash map and vectors, create a text interface to allow a user to add employee names to a department in a company. For example, “Add Sally to...
I'm trying to create a generic Makefile that will work with the following directory structure: Project Directory Makefile main.c source file source directory Source files include directory Header files for each source file depend directory GCC generated depend (.d) files for each source/header pair object d...
This is the main code. Here I'm joining vertices by edges. node[] gra=new node[5]; { for (int i = 0; i < 5; i++) gra[i] = new node(i); //I'm allocating memory for all the vertices. } void add_edge(int to,int from) //to represent the vertice the edge is going and from is now self explanatory { node ne...
I need to process an array of number pairs. Here are the constraints on the pairs: The second item may be missing, in this case 0 will be used as second item - - 38 is the same as 38,0 The pair items may be a number, or a range - 149,0, 149,[3,7], [5,9],11, [3,6],[2,9], [4,8] The range may be inclusive or exclusive -...
I have written the following program in C# to display an ASCII pyramid. public static void method1() { int k; int kCond = 5; int i; int inc = 0; for (int p = 0; p <=5; p++) { for(k = 0; k <= kCond; k++) { Console.Write(" "); } kCond--; for(i=0; i<=inc; i++) { Cons...
This is my first full program I've written in C. It took me about 2 hours to pull together today. Looking for any sort of feedback on the code, formatting, cleanliness etc. I didn't follow any guides or tutorials, but did have some existing C++ knowledge and knowledge in other languages. The game is Mastermind. The way...
I just finished working on a personal project, it is a sort of email type program where you create an account and you can message people, the code works (as far as I’m aware) but it requires review, different areas have different indents, I add more variable than I need, I print things that don’t need to be printed and...
I read the guiding solution to twoSum in leetcodes ; 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. Example: Given nums = [2, 7, 11, 15], target = 9, ...
In my application of Monte Carlo simulation, the crucial part is to generate a random number from a binomial distribution with parameters n = size and p = 0.5. Here is my current implementation #include <stdio.h> #include <stdint.h> #include <x86intrin.h> int64_t rbinom(int64_t size) { if (!size) { return ...
I have a distributed application (YARN), which runs a WebApp. This application use a default port to start (8008), before I start I need to check if port is in use. A container may run in the same virtual machine, hence port may be in use. (Max I have 4 containers in WebApp). I created the following code which seem to ...
I've been doing a task for an interview that I will have soon. The requirement is to code the following problem in C#. Write a program (and prove that it works) that: Given a text file, count the occurrence of each unique word in the file. For example; a file containing the string “Go do that thing that you do so we...
I have a function which contains two switches, which check for Command Code and Response Code after that updating UI elements. The code is working fine. How I can reduce or improve those switch cases? private void port_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { byte[] buffer = ne...
I want to create a wrapper class for byte arrays so that I can use them as keys in fastutil's Object2LongAVLTreeMap. I have created a wrapper like this: (deftype Bytes [^bytes ba] Comparable (compareTo [this other] (let [m (alength ^bytes (.ba this)) n (alength ^bytes (.ba other)) l (min...
Here is my current toggle function: $scope.toggleSelect = event => { $scope.selection = event.target.innerHTML; if ($scope.selection === 'Select All') { $scope.emailList = $scope.users.filter(user => !user.report.emailed); } else { $scope.emailList = $scope.emailList = []; } }; Here are my thoughts ...
I wrote a Java program that when its executable .jar is opened manually, it re-opens itself inside the operating system's shell console. The purpose of this is to have a C#-style console application where the user can enter commands, without the user needing to manually open the shell console and run the java -jar ... ...
I am trying to make an efficient prime number calculator. I've seen ones that can go up to close to 1 trillion in right around 4 hours, however I left mine on overnight and didn't get anywhere near that. I am asking this to see if anyone here knows a more efficient way for me to get up to a really high number really qu...
This is a registration and login script I have made in Python 3. It uses a MySQL database. In the future I might use it with my Blackjack game and add a row called money, but for now I would like to hear your opinion about this script since I have little to no experience in SQL. import cymysql from getpass import getpa...
Problem Reverse digits of a 32-bit signed integer. When the reversed integer overflows return 0. Optimized code here. Feedback I'm looking for any ways I can optimize this with modern C++ features overall. I hope my use of const-correctness, exception handling, and assertions is implemented well here, please let me k...
After reading some articles about immutability, I found out that there are persistent data structures. In the following, I implemented a stack as a persistent data structure. What I like about the code in the current state it contains no if-statements no method is longer than one line it works like recursion Implem...
I'm learning Go and I wrote this for a programming challenge. It is working (building and running) but I feel the code is not what Go code should be: Am I using the struct element correctly? especially struct methods? In the playTurn() method, I reassign results (else not taken into account) because scope. How to wri...
I am learning C and this is an exercise from The C Programmnig Languange by Brian and Ritchie. Write a program "detab" that replaces tabs in the input with the proper number of blanks to space to the next tab stop. Assume a fixed set of tab stops, say every \$n\$ columns. Should \$n\$ be a variable or a symbolic param...
I am currently writing my first TDD application. The project is in Xamarin.Forms and tested in xUnit. I am also using Autofac and Moq. The first class below is testing second class (VM). The VM is: LoadGroups method is populating collection of group names (strings), LoadFromFile method is loading from CSV file string...
I'm looking for some feedback regarding my implementation of a generic singly-linked list in C#. I'm also looking for some tips on how to implement other techniques such as using IEnumerable or other .NET interfaces I'm currently not aware of. Node.cs using System; namespace SinglyLinkedLists { public class Node<T...
This is a simple C clone of the website hackertyper.net. The code can be found on Github and is reproduced below: Makefile PREFIX=/usr/local BINDIR=$(PREFIX)/bin DATAROOTDIR=$(PREFIX)/share DATADIR=$(DATAROOTDIR) MAN1DIR=$(DATAROOTDIR)/man/man1 CFLAGS=-Wall -pedantic -std=c99 LDFLAGS=-lncurses all: hackertyper .PHON...
This program draws a random music note on a staff, refreshing the note every second. It compiles with g++ and also emscripten, so it is runnable in both the browser and on desktop. This is my first attempt at graphics programming, so I'm not interested in feedback on how I'm using OpenGL. In particular, I'm vaguely con...
I completed a short coding challenge and just want to know if I should use shorter methods of which I am unaware, or make it more readable. /* * * Complete the vowelsAndConsonants function. * Print your output using 'console.log()'. */ function vowelsAndConsonants(s) { var strConsonants = ""; var strVowels = ""; v...
Preface: I've perused the other related questions before creating this one but I believe that those solutions weren't applicable to my situation. I'll concede that its possible that I may not have understood a possible solution (if any). I'm working on refactoring an old poker game that I created, which is a .NET Fram...
library(tidyr) d = seq(as.Date("2018-01-01"),Sys.Date()+365,by='day') saturdayList = d[weekdays(d)=='Saturday'] altSaturdayList = data.frame(lapply(split(saturdayList, format(saturdayList, "%Y-%m")), function(x) na.omit(x[c(2,4)]))) altSaturdayList = subset(gather(altSaturdayList),select = c(value)) HolidayList = r...
This is a tic-tac-toe game that I made in C. It works the way that I want it to but I feel like I could have done it better or shorter. Any input as to how I did would be appreciated. Include Statements and Prototypes #include <stdio.h> #include <stdlib.h> #include <string.h> //Creating the prototypes int init(char tt...