instruction
stringlengths
71
71.9k
I am trying to plot a 3Dplot of a linear regression with two variables. My linear model: ls = lm(mpg ~ disp + qsec, data = mtcars) The minimum and maximum values to predict: mmd = min(mtcars$disp):max(mtcars$disp) mmq = min(mtcars$qsec):max(mtcars$qsec) The linear function: flm = function(x1, x2) ( (ls$coefficients[1...
I'm fairly proficient in C and Python, but want to learn some skills for administrating my new Linux machine. I wrote this simple address book app to teach myself shell scripting. This is the first script I've written longer than a couple of lines. The address book is a plain text file stored in $HOME/.sab-db. Entries ...
Problem: Pascal’s triangle is a useful recursive definition that tells us the coefficients in the expansion of the polynomial (x + a)^n. Each element in the triangle has a coordinate, given by the row it is on and its position in the row (which you could call its column). Every number in Pascal’s triangle is d...
I am working on a project, and at the moment I have just finished the majority of the Bayes Rating/Classifier. I have two sets of methods I am most concerned about. Method set 1, will select a certain number of extraneous elements (which have probabilities furthest from 0.5), and only take those into account for classi...
This code is to find expiring/expired documents. It was included in one of the models, say Document. Is this good approach of using constant variables which holds the some data and used within this mixin only? Is there any better approach I could use instead the constants? require 'active_support/concern' module Expi...
Java program uses the following construction: (provided mainly for context) public class Utils { public static final byte PROVIDER_FOO = 0; public static final byte PROVIDER_MOO = 1; public static final byte PROVIDER_BAR = 2; public static final byte PROVIDER_FUR = 3; public static final byte PROVIDER_BOO = 4...
I have a collection of strings as follows: 44.01 44.02 44.03 44.04 44.12 46.05 46 ... and so on. I want to remove leading zeros from the component of the string after the full stop. As you can see from above, not all strings have a sub-component and not all sub-components will have leading zeros. Is there...
Having already attempted an implementation of the std::vector class here, I decided to take the comments on board and also do some new bits myself (mainly the algorithms for allocation and insert). I have a commented version, but it exceeded the character limit so I had to add the non-commented version. However, I can ...
I am building an application messaging system. I am planning on using channels for real-time notifications but I was wondering if this schema makes sense. I am looking for any constructive criticism and problems that might arise. message.ex defmodule Trophus.Message do use Trophus.Web, :model schema "messages" do ...
I have such input: [ { name: 'timezone', value: 'EST' }, { name: 'interval', value: 'day' }, { name: 'metrics[]', value: 1}, { name: 'metrics[]', value: 2} ] As you may already notice - these are parameters from POST request. What I need to do is to get such output: [ { name: 'timezone', value: 'EST' }, { name...
I've just started teaching myself Scala to get my feet wet with functional programming, and I'm messing with around with some classical cryptography. The following code produces monoalphabetic simple substitution encryption, but I'm still trying to wrap my head around both Scala itself and functional style, so I'm sure...
I am new to ASP.NET (C#) and MVC 5. I'm really enjoying it so far, but want to take a step back and make sure that I'm following best practices here. My controller seems like it may be getting too fat, but perhaps that's just part of it? This is the Index action for the TicketsController in a support ticket application...
Below you can see my binary search method, and as a relatively new programmer I am looking for any suggestions on how it could be improved. bool found = false; int min = 0; int max = 9; int avg; int anArray[] = {1,2,3,4,5,6,7,8,9,10}; int userNumber; printf("Enter a number between 1 and 10:\n"); scanf("%d", &userNumb...
This is my first time putting up a completed program onto the web and I was hoping to get some feedback on these areas: Commenting (Too much, not enough or do I need to simplify anything) Structure (I guess does it seem reasonably tidy, presentable and laid out well) Naming (Are my variables well named, are sensible?)...
The problem is to find the minimum number of moves that a knight will take to go from one square to another on a 'n' cross 'n' chessboard. The code below is based on backtracking. It works well until n equals 5 but from n equals 6 the time limit is exceeded on ideone. How can I make the code more efficient? #includ...
As I started to learn about regular expressions, and as part of bigger project, I wrote a regex analyzer, which: takes the PROPER regular expression, takes the String already MATCHED by this regex, visualize with (random) colors which parts of given regex are responsible for matching a particular fragment of given str...
I have a clear function that accepts an array, string, or no arguments. If no arguments, it should clear the entire data object. It works fine, but looking for a code review. The possibilities should be: clear('one'); clear(); //clear all clear(['one', 'three']); var data = { one: 'test1', two: 'test2', three:...
I put together this simple query which calculates the total percentage of answered questions and unanswered questions. The formulas used to calculate these are shown below: $$ \text{Answered Percentage} = 100 - \left(\frac{\text{Unanswered}}{\text{Answered}} \times 100\right) \\ \text{Unanswered Percentage} = \frac{\te...
I made a do...while loop in order to wait for the web browser to load completely in order to enter username and password. I don't know whether this impacts the system a lot because I repeated it in at least 4 places. Is there a better solution? private async void DeleteProduct() { if (string.IsNullOrEmpty(TextBoxF...
I am a Java programmer who recently started learning some Swift. I made an app that displays the Sierpinski triangle and adds triangles if the user pans up, and zooms in and out using the pinch gesture. I am wondering what I can do to make my code more Swift-y and how I can improve the zooming. SierpinskiViewController...
I wanted to create a save game system for my city building game that did not require the player to input a name for the city. It was also important to allow infinite save games, so I could not just use save slots to solve the problem. With a bit of help, I devised a system that would allow the player to optionally ente...
Is it appropriate for the class to subscribe to its own events like this? Should the class not subscribe, and instead move that code to before the OnEventName(Object args) methods call the EventHandlers? I'm curious if there are any downfalls to this approach. On one hand, with this approach I could remove all the null...
I want to replace rm by a more informative variant: I would like to see which files will be deleted, along with their size, and I would like this information to use the same coloring as ls. As an example (please imagine the coloring): # remove -r foo/ bar/* 4K bar/file1 1.2M foo/ 6.1M bar/file2 remove -r 3 files, 7.3...
I solved the following problem on Hackerrank. The challenge is to: Parse HTML input and display the tags and attributes in lexicographically ascending order. This is the input format: 2 //number of test cases/ lines of html <p><a href="http://www.quackit.com/html/tutorial/html_links.cfm">Example Link</a></p> <div cl...
All of this does just one thing. Move my player by finding the first finger that was used to touch the ship and drag it. I have a few questions: The first thing is I have an embedded class of MotionState. At first glance it makes a lot of sense to start with that. I latter ended up not using it. How do I go about ref...
I was doing a puzzle on Coderbyte, and here is what the puzzle stated: Have the function SimpleMode(arr) take the array of numbers stored in arr and return the number that appears most frequently (the mode). For example: if arr contains [10, 4, 5, 2, 4] the output should be 4. If there is more than one mode return the...
I have a requirement to check all records in a table which is big (Around 1.5-2 million records). What I am doing is very simple, just get all the records and loop through one by one, and do things. I have a quartz job which will run every 2 minutes to check things. ApplicationDetailCheckingJob.java public class Applic...
This method works for what I need it to do, but I just don't think it's extremely readable, and could be abstracted into different methods. I have a feeling I'm going against some best practices. Please let me know your suggestions: def reserve return render json: { error: "This entity is not available to reserve" ...
Because of the coupling with the VBIDE API (the extensibility library for the VBA IDE), unit testing the rubberduck refactorings, inspections and quick-fixes has been pretty much impossible, at least until a MockFactory was implemented, to do things like this: internal static Mock<CodeModule> CreateCodeModuleMock(strin...
This code encrypts a text with mono-alphabetic and poli-alphabetic substitutions ciphers. For further info see: Mono-alphabetic/Caesar Cipher Poli-alphabetic cipher require 'arrow_test' ALPHABET = ("a".."z").to_a # Moves a letter forward in the alphabet by # the given key wrapping around. # # <code> # shift('a', ...
I have an UpdateId class which represents some kind of version (like AssemblyVersion). UpdateId has three int values (listed in their compare priorities order): Year, ReleaseNumber and Revision. How can I make my CompareTo method better? It looks clumpy to me. public int CompareTo(object obj) { if(obj == null) retu...
This is my Java 8 code for a console calculator. I just want to know if it can be improved in any way. Just so you know i am a real beginner just got into java about a couple of weeks ago. import java.util.Scanner; public class Algorithm1 { public static int FirstNumber, SecondNumber; public static float TheAnswer...
Community moderator elections on the Stack Exchange network are really exciting. Alas, on the page of the primaries, I find it mildly annoying that candidates are randomly reordered on every page load, even if it's surely for a good reason. So, I cooked up (pun totally intended) this script using Beautiful Soup 4 in Py...
It randomly gets a word from an array of Strings. It prints out a '_' char for every letter of the word, displays the ones you have already guessed and displays the ones you have missed. Some advice would be welcome, such as what I should change, avoid and so on. Main class: import java.util.Scanner; public class Main ...
import java.util.Scanner; import java.lang.Comparable; class InsertionSort { private InsertionSort() {} private static boolean less(Comparable v, Comparable w) { return (v.compareTo(w) < 0); } private static void exch(Object[] a, int i, int j) { Object swap = a[i]; a[i] = a[j...
Here is my code for printf() implementation in C. Please share your thoughts for improvements. #define PRINTCHAR(c) putchar(c) #define MAXLEN 256 // Write a printf function which simulates printf() in C. int formatAndPrintString(char *pcFmt, va_list lList) { //Holds the number of characters printed, 0 on error ...
I tried to implement a generic stack in C using void pointers and tried to keep it as simple as possible by delegating all responsibility to the caller of the functions and avoiding more sophisticated approaches. stack.h #ifndef STACK_H #define STACK_H #include <stdbool.h> struct Stack { void *data; struct St...
I have had a hard time understanding all the documentation on the logger module and forking processes. My goal is to have each child process that's worked to write to their own separate log file. This seems to work but I just want to try and verify that this is the correct way. import os import logging def generate_p...
I found a custom function called UniqueItems() to use and then developed my own RemoveDups() and FaxesToUse() code: Function UniqueItems(ArrayIn, Optional Count As Variant) As Variant ' Accepts an array or range as input ' If Count = True or is missing, the function returns the number of unique elements ' If Cou...
I've got the following schema, which can not be modified since it's a problem taken from an exam: Player ------- player_id (PK) player_name player_games_total player_games_won Competition ----------- comp_id (PK) comp_player1 (FK references Player.player_id, NOT NULL) comp_player2 (FK references Player.player...
I created a widget to handle multiple selections in CoffeeScript. There's a working attached snippet that uses the compiled JavaScript (Stack Snippets don't support CoffeeScript), which is available to see. There are two classes: DocList and Doc (I didn't use Document fearing a name clash). The DocList class keeps trac...
Here is the slow part of my code: def Prepare_WCfst_file(): content_WCfst = "iteration\tlocus\tFromSite\tToSite\tWCFst\n" nbchunks = nbsites/nbsitesPerChunk if nbchunks%1 != 0: print("\n\nThe number of sites per chunk for WCFst is not a divisor of the number of sites per locus.\nProcess is aborted!\...
Please have a look at the HTML/CSS/JS (there is very little JS at the moment) and give me some feedback as to how my code looks to you, what level of skills it looks like I have and how I can improve. It's not anywhere near being completed but it should give you a good idea of where I'm at and where I'm going with it. ...
The function below accepts a hierarchical structure and returns a flat list of captions. There are few variations on the returned data: If showTotals is true, and root has children (if(!root.IsEmpty)) - "RootCaption" needs to be added as a first element of the list. If showTotals is false - all the children with a pr...
I was trying this problem and I was wondering if there is a way to check for the edge cases inside the for-loop. The problem statement: We'll say that a lowercase 'g' in a string is "happy" if there is another 'g' immediately to its left or right. Return true if all the g's in the given string are happy. Here I am s...
I implemented search module, but I'm a novice in programming and I'm not sure about public and private functions that I coded. Did I do it right? var data = require('./data'); function My_module(string) { var data_size_ = data.length; /** * @param {Array.<Object>} data. * @return {Array.<Object>} r...
I'm currently working on a simple simulator in Unity3D that involves planets orbiting each other. I wrote the following C# script to do that. It uses the classic gravitational formula, $$F=G\frac{m_1m_2}{r^2}$$ using UnityEngine; /// <summary> /// Class used for calculating /// how an object orbits another /// object...
I've built an app for members of an organization I'm in--the app shows the picture of a member with four multiple choice buttons, and the user then tries to guess the member's name. Pretty simple, but this is one of my first major apps. import UIKit import Foundation class ViewController: UIViewController { @IBO...
I have a process running in a separate thread which reads data over Ethernet and raises an event for each read. Then, this data is processed over a tree of classes. At the top of my class tree, I want to store the processed data to SQL tables. This read rate can be rather fast and often at times but on average its slow...
I'm trying to speed up this code that loops over an entire spectrum range. It's using a Raspberry Pi, and a rtl-sdr dongle that covers up to around 1.7 GHz. My goal is to be sweep over that spectrum and gather data from it in a timely manner. #!bin/usr/python #gathers from the rtl library needed for this program from ...
Here we trying to fix logs that have overlaps with each other. Am I doing it right? Is there any way to improve/refactor it? DROP TYPE IF EXISTS logs_with_error; CREATE TYPE logs_with_error AS ( model_id INT, model_type TEXT, initiator_id INT, initiator_type TEXT, error_type_id INT, ...
I have a Django view and template that work together, but I think I probably did things in a crappy way. I basically have many dynamic values that I want to display on the page, and in two different ways. When the user first comes to the page, these values get returned in the normal context and are stored in javascript...
In a recent CodeReview I presented a Product Manager that manages product listings and prices. Based on the great feedback I have refactored the mentioned Prompt and validator class and want feedback about the code and naming. Utilities/ProductValidator.cs namespace Ferienaufgabe_2.Utilities { class ProductValidator { ...
I attempted the Project Euler question #7 in C++ ("What is the 10 001st prime number?"). I took into account what I've been told about primes in order to create the most efficient algorithm I could in order to solve this. I would like to know if there is anything else I can do to check even fewer numbers for an even m...
Looking for review of design strategy of using a struct to return the functional result and error status. Your experience of how my design approach may succeeded or failed is especially welcomed. In constructing a library of functions, I've tried various error handling approaches, none completely satisfactory and was ...
I'm building a simple canvas animation engine as an exercise in learning ES6. Coming from C++ and Java, I miss static properties, but I've read that "Prototypes having data properties is generally considered an anti-pattern". The animation engine simulates \$n\$ river waves (simple lines), flowing from right to left in...
This script uses the Red Hat Satellite v5.4 API to delete servers which are read in from a file. The servers are listed in the file by hostname but the Satellite API deletes servers by ID number. The script runs the getId call using the hostname and stores the ID ( val[0]["id"] ) in the system_ids array (assuming it is...
I've refactored my previous query and added better checks when selecting the data. The query link can be found here. The formulas used to calculate the two percentages are the same, and can be seen below: $$ \text{Answered Percentage} = 100 - \left(\frac{\text{Unanswered}}{\text{Answered}} \times 100\right) \\ \text{Un...
I have just implemented an algorithm which calculates the direction an enemy in my game should face when moving to a location. This is a 2D game where characters can face in one of four directions: (Up, Down, Left, Right). When navigating to a point, if the new point is further away on the X axis than the Y axis, the ...
I was developing a web app using Entity Framework 6 and MVC 5. For the data access layer, I eased the job and wrote a generic repository as following: public class GenericRepository<T> where T : class { private EFDbContext context = new EFDbContext(); public IEnumerable<T> GetAll() { return contex...
I need to search for records based on their area, postcode, city and sort each group separately based on the value of their code field. Table is as follows: ID Code Name Area PostCode City 1 15 BV Shore 343444 Toronto 2 2 BB North 545555 London 3 3 AA ...
For the MDN documentation website we have written this jsonToDOM function and I was wondering how you all would improve it. It takes a json structure and creates DOM elements out of it and appends it to the document. It is written in such a way that the user has to pass the window/document as they might run this code f...
This is my player rotation script. I just want to make sure my naming conventions are right. If there is any way to make this code more readable I'm open to suggestions. This is also my 3rd post about along the same line so please be brutal. public class ShipRotation : MonoBehaviour { [SerializeField] Canvas canvas...
I'm working on a function to sort two elements using several properties. I want to know if the function is well structured. function comparePropsOfAWithB(a, b, props) { var prop = props[0]; var propA = a[prop]; var propB = b[prop]; if (propA === propB) { var array = props; array.shift(...
I writing tool to manage our application. One part of it - is INI-file, which contains UUIDs for some application modules. It looks like: [version_1_0_2_staging] MATH_DLL = 7a00ca94-b68d-4c89-a004-d3a4f5e7cf56 MATH_DLL_XML = 738174f7-f310-4989-8cae-da1690487e7c ASSETMANAGER_API_DLL = 2e9e3807-4f8a-4ae1-a873-4a8f6d152ea...
I'm looking to make my code faster for loading a hash table. Any pointers would be appreciated. Below are my includes, the node def and the loading code. The dictionary loaded could be any *.txt file. Its pre processed to contains just lower case words sans punctuation. #include <stdbool.h> #include <stdlib.h> #incl...
I'm looking for 3 different answers: Using Java predefined functions Converting from string to number Without the above two (any other types of answers are also welcome) I am looking for improving my code (as per the above 3 conditions for 3 answers) taken from my repository here. /* * Checks if the year passed is a...
Is there a way to make my code simpler/more pythonic? Given a non-negative number "num", return True if num is within 2 of a multiple of 10. Note: (a % b) is the remainder of dividing a by b, so (7 % 5) is 2. See also: Introduction to Mod near_ten(12) → True near_ten(17) → False near_ten(19) → True def near_ten(num...
Consuming input line-by-line until the end is often useful. In C# I would write the following loop: while ((line = Console.ReadLine()) != null) { // ... I wanted to do this using "idiomatic" F# (which to me includes avoiding let mutable) and I came up with this: let rec readlines = seq { let line = Console.Rea...
I am trying to parse escape sequences as well as plain characters. Can this be made more succinct? import Control.Applicative import Data.Char import Numeric import Text.Parsec hiding ((<|>)) echar :: Parsec String () Char echar = (char '\\' >> ((char 'b' >> return '\b') <|> (char 'f' >> return '\f'...
The question was to see if a word is an anagram of another word. How would you improve this? It returns True if an anagram, or False otherwise. # write the function is_anagram def is_anagram(test, original): if len(test) != len(original): return False for letter in test.lower(): if letter not in...
I'm making a hotel reservation app that has the following features: Promo Codes: The guest can choose to pay half a certain percent of the total_amount or the entire total_amount. I want to use stripe, PayPal and authorize.net as payment gateways. Reservations are stored here: CREATE TABLE `reservations` ( `id` int(11...
I know there must be an easier way to write this but I'm stuck in over-complicating mindset instead of just following the Zen of Python. Please help me simplify this. Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a boolean indicating if we are on vacation, return a string of the form "7:00"...
I'd like to generate an infinite list of prime candidates of the form 6k±1, but I'm looking for the fastest possible solution. Currently I have this: primeCands :: [Integer] primeCands = concatMap (\i -> [6*i-1, 6*i+1]) [1..] but I feel that concat is wasting too much time. Using all the odd numbers is almost the same...
Here is a simple Tic Tac Toe game. I would like to know how I can improve this code further. #include <iostream> #include <cctype> #include <array> #include <random> enum struct Player : char { none = '-', first = 'X', second = 'O' }; std::ostream& operator<<(std::ostream& os, Player const& p) { ...
I'm coding a plugin for a game that has a Player class which has a boolean attribute frozen, which decides if the player is frozen or not. There are more "effects" like frozen, but I'm using it as an example, since solving one should solve them all. The problem is, this frozen attribute only supports True/False, and if...
I am maintaining an old codebase of one of our legacy .Net applications which has a component that encrypts and decrypts user passwords using symmetric key cryptography. Since cryptography is not my domain, I need help figuring out whether this existing code needs to be fixed or not. I have a hunch that this code is cr...
I created a side bar of buttons for my game, the idea being that if you click on the "main" button of the group, the rest of the buttons in the group would pop out from the side of the screen. Later, I wanted to make it so that if you open one of the side menus the other ones would close. I thought about implementing ...
Below is an implementation of two graph traversals. Graph constructor creates a random graph with a fixed number of edges (fixed as a proportion of the maximum number of vertices, number_nodes-1). Any comments welcome, but especially data structure and algorithm comments. Tests are not implemented properly, but it is o...
I'm working on projecteuler.net problems, and I made this for problem #3: array = []; // use this to save the prime factors function factor(number, start){ //begin of the function prime=true; for(i = start; i < number+1; i++){ //begin of the first loop if(number % i == 0){ //is it a divisor of the number? ...
By utilizing an existing PHP encryption library (defuse/php-encryption) and a flat file database library (jamesmoss/flywheel), my application take a secret message from a user, encrypts it using a key derived from a password, and saves it to a flat file. The message can then be decrypted by visiting a unique link and ...
I have two simple functions where performance is critical, one for encoding an array of ints to a long, another for doing the opposite (decoding the long back to an array of ints). The solutions I have come up with below are fairly fast. Can these be made even faster? Please note: I am constrained by using the same fu...
My script takes a CSV file of strings and then creates an XML file for Android and a .strings file to be used for iOS. It separates each locale meaning that a file will be created for each language. This has come in handy so far, making localising mobile apps easier. However, I am always seeking feedback so let me know...
I am trying to load a module according to some settings. I have found a working solution but I need a confirmation from an advanced python developer that this solution is the best performance wise as the API endpoint which will use it will be under heavy load. The idea is to change the working of an endpoint based on p...
I have a very simple form that is designed to update account expiration dates. I'm currently creating a View Model and sending that to the form, however, I still have to pass along a GUID so I know what object is being referenced on POST back. What I'm worried about it is someone altering the guid (via JS, jQuery, etc...
I've written this code in 2013 or 2014, I think. I've rediscovered it today in one of my folders, made some changes and now I'm left (and my 2013/2014 me as well) wondering how good it looks for other C programmers. It's a simple dummy program that reads N and M from stdin, then creates a matrix with those values as r...
One of the first things I did when I learned Objective-C was to create a little canvas with editable angles. Basically, you tap to create points. Every tap connects to the previous tap. So if you tap in 2 spots, a line will be drawn from point 1 to point 2. Tap again, and a line will be drawn from point 2 to point 3. Y...
We'll say that a lowercase 'g' in a string is "happy" if there is another 'g' immediately to its left or right. Return true if all the g's in the given string are happy. gHappy("xxggxx") → true gHappy("xxgxx") → false gHappy("xxggyygxx") → false I have written two functions to solve this problem, but I have some con...
I'm posting here my implementation of the game Connect 4. It's obviously a pretty trivial game and code but I'm primarily interested in any advice concerning improvements to the code structure: types, dependencies and coupling, concerns, etc. I'm interested in attacking more complicated games but I think it's best to s...
I have two groups of two buttons (status). If you click on "Complete" or "On Hold", it will change the background color of the button. I am using same class name for all the buttons but each group of buttons have data attribute data-section='Park One' and data-section='Park Two' jsFiddle I am using the $.each() functio...
Trying to simply my code below: for (index, point) in enumerate(self.points){ let pointButton = UIButton() pointButton.frame = point.bounds self.view.addSubview(pointButton) } Is there a better way to accomplish this through .map .filter or .reduce ?
I have written this program to sort an array using heap sort. Please review it for further improvements. public static void main(String[] args) { int arr[] = {14, 70, 51, 16}; System.out.println("Input Array : " + Arrays.toString(arr)); buildMaxHeap(arr, arr.length); System.out.println("Max Heap Ord...
To hone my skills with C++11, I'm implementing a singly-linked list based on the requirements I found at this link. I've implemented code that supports the following subset of requirements from the link above. I would like feedback on what I have so far. The requirements implemented on the posted code are: Generic dat...
I am a beginner programmer trying to self learn how to write a code. To improve my skills, I'm currently working on a project to create an exact replica of windows minesweeper. It is written in JavaFX and most of the basic code is done. I am able to run the program to play minesweeper without bugs (maybe). If anybody w...
I was looking at a few profiles this afternoon and noticed a few users had plenty of open questions. This led me to wonder which users actually had the highest amount of questions with unaccepted answers (both in size and percent). So with all the hoopla I kept seeing in the 2nd monitor about SEDE queries, I decided ...
My htaccess has this block in it: RewriteRule ^login$ _user/login.php RewriteRule ^login\.php$ _user/login.php RewriteRule ^_user/login$ _user/login.php RewriteRule ^_user/login\.php$ _user/login.php How do I consolidate this block? The objective is to point to _user/login.php regardless of where on the server it's ca...
This was an exercise from cs50. The goal was to get the initials in upper letter of a name that we got from user. So for "barack obama" we would get "BO", input like "abc" should output "A" and so on. I am interested in knowing what I can do to simplify it or be more efficient. Do I need the check against '\0' in the ...
Given a list of words, this program outputs the starting letters of the words capitalized. I was reviewing this question that solves the same task, but over time so many changes accumulated, that I think my programme bears little resemblance to the original one, so instead of posting it as an answer, I ask you for furt...
I submitted a project and never heard back and I am wondering if my coding style is okay. At the company I work I get feedback, but I'd like to hear from the outside world. It's a drawing tool - the input is in a text file (each on its own line): C 20 4 L 1 2 6 2 L 6 3 6 4 R 16 1 20 3 It's called as so: python drawi...
The game model (Ultimatoe) consists of 9 instances of Tic-Tac-Toe (UltimatoeBoard) and some auxiliary information. As the number of all reachable boards is bound by \$3^9 = 19683\$, they all are pre-generated, which allows fast move evaluation. Before reviewing, please read the short text of the predecessor question an...