instruction
stringlengths
71
71.9k
I've written my own prime number sieve in JavaScript. It loops through numbers 1-100 and puts them in one of two arrays, depending on if it is composite or prime. I was wondering if there are any inefficient or unnecessary parts of my code that might be slowing down the program. Is there anything I can do so it will wo...
This is a C++ Vector that I've made for the pleasure of it. It was made on a whim and is not related any school assignment or anything alike this. This Vector does not aim to be compliant with the standard library, and does not aim to replace std::vector. However, its goal is to be very efficient while being simple and...
I've implemented a multicolored bar as shown in the image below. It is a bar that is placed above the legend of an HTML form. (Ignore the border radius for now.) I have accomplished this with a simple approach of using span elements. *{ margin: 0px; padding: 0px; } span{ height: 5px; width: calc(100...
There seem no end to fizzbuzz implementations. Something I rarely see is an implementation that's easy to extend with more name-divisor pairs. Another thing that usually annoys me is the lack of testability. Printing to standard output and verifying by reading is less than ideal. This FizzBuzz class can work with an ar...
A while back, I posted an XML Writer. Today I have finished what I hope to be a solid XML parser that, while not professional, will get the job done. To start, I do use a stack on one part of the parser, so you can find the code for that in the XML writer page I linked above. Xml.h #ifndef Xml_H #define Xml_H #include...
I want to send a string with the following path, and I want to verify if this is the right way to do that in JavaScript. Is this the right way to use the return in an if/else, or there is shorter way? Is the indexOf using correctly? https://test.com/plugins/plug/pluginr/poc/fact function isExt(path) { if(path....
The following is a basic implementation of a loop which is intended to launch a series of games in a loop (generic ones that can be overridden, but that have always have finite durations). The intention would be that a game can broadcast events to clients and would always broadcast its completion. When there are no c...
At first the input array is traversed and for each number the lsb is found. Then the number is put into appropriate bucket according to it. For example for an input array { 123, 45}, at first 123 will be put into bucket 3 (because 123 % 10 == 3). 45 goes to bucket 5. Then after first pass, the input array is cleared an...
As a variant on the fizzbuzz concept, and as an exercise for learning JavaScript, HTML5, and CSS (I know none of them very well). The regular fizzbuzz is somewhat tired, but having a web-based, visualizable output seems to be useful, and being able to adjust the inputs at will, allows you to see the impact of how the m...
I have just started using Python, and I am attempting to make a prime number sequence generator, where it will print the a specified amount prime numbers in terminal. I have other versions of this also, and versions for the Fibonacci sequence, although, I will post just the version for prime numbers I specified above....
I have an issue opened on GitHub since mid-November, to refactor & DRY up the Rubberduck Parser module (the idea is to model the code in a VBA project or code module, so it can be browsed and inspected programmatically). Yes, I've written this ........crap. I'm guilty of Ctrl+C/Ctrl+V coding here, of which I'm very unp...
I'm trying to create a single class to interact with my database (MariaDB, in this case). Is there anything I can do to improve this code? I'm fairly new to Object-oriented PHP. <?php namespace TOB\Model; use \TOB\Utility as U; abstract class CRUDD { protected $table_name = ""; public function __construct($da...
I have a Parser class which creates a collection of String pairs, parsed in the format key=value. public class Parser{ private final HashMap<String, String> val; private final File source; public Parser(final File path){ /*initialise stuff*/ val=new HashMap<>(); source=path; //thr...
Here is a String class that I've made for fun in my spare time, for myself. I have a few concerns about it, and am considering going immutable or a mix of the two where the string would be immutable when initialized from a constant, and then mutable when changed. Also I am considering how to implement Unicode. I could ...
Project Euler #1: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. Here is my solution: public class MultipleFinder { private static final int MAX_NUMBER = 1000; privat...
In my program, I'm getting Facebook objects and using temp to display on a separate screen how many unread messages they have. However, we have since decided to consolidate similar messages, such as getting XP from a Facebook friend more than once. We want those messages to be one message with the sum of the XP gifted ...
Here's something I wrote a while ago. I needed a collection that was ordered, but also guaranteed duplicates did not occur. So I made a class with both Set and List interfaces. It seems to work well. I'm interested if there are better ways of doing this, maybe in the standard API or some library. I'd also be intere...
I was wondering if there is a better way to code this: using (SqlConnection connection = new SqlConnection(ConnectionString)) { using (SqlCommand cmdDelete = new SqlCommand("DELETE FROM table WHERE (TestNumber = '" + testNumber + "')", connection)) { try { connection.Open(); i...
Project Euler #2: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valu...
Project Euler #3: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? Here is my solution: public class PrimeFactorFinder { private static final long NUMBER = 600851475143L; public static void main(String[] args) { long time = System.nano...
I've written a method to check if a directory already exists on an FTP server. The only way I could see to make this work was to return a different result from the method if an exception is thrown - very bad practice in my opinion. Is there a better way to write this? public bool DirectoryExists(string directory) { ...
I'm programming a system and I want to know if this is the correct way or if there is a better way to do it. Container: I have more fields but I only added one to show you the container. <form method="post" class="form-horizontal" onsubmit="return submitForm();" role="form" id="div-studentStatus"> ...
I'm looking for two kinds of feedback: Is there a better way of doing what I'm attempting to do? Any obvious weaknesses that could potentially cause problems? The code in question (I've broken it into lines to prevent horizontal scroll): items.ForEach(i => i.JobOrderTypeString = Context.JobOrderTypes...
I have made a LinkedList class. This is a singly-linked-list and I want to make a forward_iterator for this class without using Boost. I have made the code and I want to know whether I have implemented it correctly. The source I referred to make this code is here. template <class T> struct node { T data; node *...
I want to improve this program so I want you to criticize the code, and tell me what else can I do, and where can I find information about what I have to do. TODO: Fix wget timeout The code should always check the returned value from any of the malloc family of functions to assure to memory allocation was successful t...
I'm new to coding and this code pretty much goes to the extent of my current knowledge I'm looking for ways to improve this code. This code compiles and runs fine in Visual Studio 2013. I'm also using Windows 8.1 as my current OS for the computer I'm writing and compiling on. I'd like a review over anything and any err...
I was working on a little project that at the end of the script would write to a CSV file. I had to create a function that would combine multiple list elements of the same size into a single one. I would like to see if there is a more efficient way of doing this since I feel the way I did might not be the most efficien...
Given this sample input: ID Sample1 Sample2 Sample3 One 10 0 5 Two 3 6 8 Three 3 4 7 I needed to produce this output using GNU AWK (awk in Linux, gawk in BSD): ID Sample1 Sample2 Sample3 One 62.50 0.00 25.00 Two 18.7...
Inspired by Extensible and testable FizzBuzz I have decided to write my own implementation, partially based on my own answer and on the other answers. First a warning to all of you: Never make such complicated code for such simple jobs! Now the basic requirements of the code: Should be capable of solving the FizzBuzz ...
The user enters coefficients into input boxes on a form, called GetFunction. Upon clicking an OK button on said form, the input is validated using TryStrToFloat. If all the input boxes are valid,CreateGraphis called. As soon as an invalid input box is found,CreateGraph` should not be called and the user should be able ...
I have written the following meta-tags for SEO, please let me know if you think this could use any improvement. I have used this article to help me put it together. I have left out the page content on purpose, if you wish to see it I posted it here on CR and on Github (note the following updates have not been committed...
I recently wrote this code as a more versatile stand-in for Convert.ChangeType. I very recently posted an earlier version, for which I received some good feedback. I've incorporated that feedback and further refactored in an attempt to streamline the flow of the method. /// <summary> /// Returns an object o...
I just finished Project Euler #7 in Swift, and since there is not any version yet on Code Review, I would like to have some comments on what I did to try to improve it. By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? import Founda...
Most of the Rx Compelling Examples™ load and store data locally, which I don't find that Compelling. I spent some time coming up with how to best perform the following actions but want to make sure I am not Doing It Wrong™. Here are the cases I am trying to solve: Load data from cache and remote server when view model...
I had a school project to solve, which I did. The basic focus of the project was to create the simplest code possible to solve it. This topic was created just to ensure if I wrote the code correctly. The problem is the following: We have declared a dynamic array which will take numeric values from a txt file. We wan...
It takes around 5-8 seconds for me to retrieve a previously-closed stock price and a dividend rate from US Yahoo! Finance. If I wanted to retrieve 10+ stock prices, it would take me more than a minute with the below VBA code. Is there any other way to speed up or improve the code? I input multiple stock code on column ...
I started learning Python a couple of weeks ago, and to test my new knowledge of Python, I decided to use Pygame to code a random walk terrain generator. # Basic random walker program import random import pygame import sys # Screen width and height WIDTH = 900 HEIGHT = 900 # Initalize pygame pygame.init() screen = ...
I have worked for a few hours and this is the result: $(document).ready(function(){ var canvas = $("#snow-collision")[0]; var stats = new Stats(); stats.setMode(1); // 0: fps, 1: ms var debug = $("#debug"); var pi = Math.PI; var hpi = pi / 2; var tpi = hpi * 3; // align top-left stats.domElement.st...
This is my prime number checker in C++. I know that calculating the square root of a number can be very costly, so I don't do it unless the number is larger than 10k, where we would have to check 2450 extra values \$5k-\sqrt{10k}\over2\$. void primeChecker(std::vector<int> &primes, int val) { int max = val > 10000...
I've just done Project Euler question 10: Find the sum of all the primes below two million. I get the correct answer and it takes about 3.5-4 seconds to run. I tried to use the Sieve of Eratosthenes to find the solution, but am not sure if my solution is using the method correctly, or if it could be improved in any w...
Project Euler #3 asks: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? I've written a general solution for any number: module Main where isDiv :: Integer -> Integer -> Bool n `isDiv` k = n `mod` k == 0 fullyDiv :: Integer -> Integer -> Integer fullyDiv n...
Project Euler #4 asks: Find the largest palindrome made from the product of two 3-digit numbers. The code is as follows: module Main where import Data.List (sortBy) import Data.Ord (comparing) palindromes :: [Integer] palindromes = [calcPalindrome a b c | a <- [1..9], b <- [0..9], c <- [0..9]] where cal...
Please take a look at the following Scala program and give me suggestions for improvement. I'm sure there would be plenty. This is my very first Scala code, so please don't be frustrated because of its low quality. abstract class Expression { def eval() : List[List[String]] = this match { case Identifier(token) ...
If a checkbox is clicked, it will be added to the total, if not, it will be deducted or ignored. (The total number of checkboxes I have in real is 25.) Is there a way to write the code below in a shorter version? Function function tblcheckboxes(){ var a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v...
Data I have 4 Collection objects of the following kind: dates1=(12/01/02, 15/01/03, 17/01/03, 25/04/04...) dates2=(15/02/02, 17/06/07, 10/05/10, ...) numbers1 = (3,5,2,7,...) numbers2 = (1,-3,-1,...) The rules of the game are: dates1 will always have the same length of numbers1, dates2 will always have the same lengt...
I feel like I'm repeating a ton of code here and there's got to be a better way to do this but am just completely spacing right now. I basically have an else if clause that, if their conditions are met, repeat the same code, but I'm also repeating the same code in the else statement along with a few other conditions. W...
I wrote a simple Fibonacci checker using HTML, CSS, and JS. This is my first JS program, so be sure to tell me everything that is wrong with it. Check it out here (http://jsfiddle.net/z49fyypt/1/), and here is the runnable code snippet: <!DOCTYPE html> <head> <title>Fibonacci checker</title> <style> ...
When you start thinking about designing a Match 3 type game, you realize that there are a great many ways to structure the rules. In this particular variant, the direction that the player swipes the orbs determines the way that the board is refilled. The new pieces will enter the board opposite the direction that the...
I had some time to kill today, and I found the Karate Chop Kata. Specification: Write a binary chop method that takes an integer search target and a sorted array of integers. It should return the integer index of the target in the array, or -1 if the target is not in the array. I've never implemented a binary s...
I was given this project and have changed a lot of code on it, now I am going over the code to make sure that I know what everything does and can maintain it efficiently, and to make sure I want my name on it. Here is the method they have been using to validate e-mail addresses from a textbox input. private string Vali...
Before @bazola asked his recent question, we chatted about it for a bit. I figured that I could try implementing something similar myself. As I've heard that Scala has all the advantages of Java, but fewer of the disadvantages, I'd figured that I could try it. I have implemented checking for board matches, removing the...
I was recently working on a project, something jQuery-related for WP-Admin area. I enable post-formats and create metaboxes for these post-formats, so at the end I tried to hide these metaboxes until the user checks the radio button. I just want to know if there is a better way I can write this code. // hide the metabo...
I have written a functional GUI program using PyQt4, and I'm looking for some feedback because it's not as fast as I would like. It takes in some number of large, same-sized 2D arrays and displays a sub-image of each one in its own sub-window - at full resolution or only zoomed by a factor of 2 or 4. The central GUI ...
I have a requirement to be able to filter a list of strings by both inclusion and exclusion patterns (using fnmatch-style wildcards), of which there can be many. For example, given the set of values: ['a1', 'a2', 'a3', 'b1', 'b2', 'b3', 'c1', 'c2', 'c3'] And these inclusion filters: ['a*', 'b*'] It should return: ['a...
I made this Sudoku solver using depth first search, it takes less than 0.1 second to solve any simple solution(no guessing), but if the solution requires guessing (thus using the DFS) its time grows exponentially. One puzzle ('hard') makes 10 consecutive branches in the search, thus allowing 210 (I guess) possible outc...
I have a JSON response from the Facebook API, which contains the app requests of certain Facebook apps via FB.API('/me/apprequests') (using Graph API 2.0, Facebook SDK for Unity 6.0). There are 3 things I want to collect from the requests: The response data (a JSON string) A texture (in Texture2D class) Status of load...
This code gets all of a user's Facebook friends who use our app and returns a dictionary with keys that are their id's in our database and values that are a default connection level. The code should also return all of the users Facebook friends who aren't using our app. I made fb_id_on_app a dictionary of keys that are...
Is this a smart method? public static ArrayList<Integer> getWordLengths( String s ) { String str = " " + s + " "; ArrayList<Integer> list = new ArrayList<Integer>(); for ( int i = 0; i < str.length(); i++ ) { if ( str.charAt(i) == ' ' ) { for ( int j = i+1; j < str.length(...
This code works as it is supposed to: #include<iostream> #include<cmath> #include<cstdlib> using namespace std; int main() { char cAgain, type; int x, y=0; double addition(double num1, double num2), subtraction(double num1, double num2), division(double num1, double num2), multiplication(double n...
I was hoping for someone to review my current project, which was created in Swift and uses a PHP web service. I'm not worried about UI elements, as this is just a 'test' project, but I'm concerned about two things: using the best practices and security. I'm concerned that the SQL query is not safe, among other things. ...
I'm trying to learn how to build a good test suite, using simple sorting as an example. Particularly, I am using Nose to generate all the tests based on a simple list of lists, where each sublist is a unit-test for each sorting method, as seen below: from nose.tools import assert_equal def check_sort(s, arr): asse...
I was hoping people could help me review the following page that I've been working on. The page has a simple form that looks at a list of colours and draw a few divs with those colours as backgrounds (so I could see what the colours look like). I'm hoping to build a few complex interactions on this page, but I feel thi...
I have a very long switch statement which is expected to have nearly 50-55 cases. switch (commandType) { case COMMAND_LOGIN: command = getCommand(commandType, agentId); break; case COMMAND_MAKE_READY: command = getCommand(commandType, agentId); ...
I have code which styles standard Android widgets programmatically (not from XML). The code is working, but I have this bunch of if instanceof else if instanceof block which is ugly. I have read discussions on Stack Overflow, and my conclusion is instanceofis better on my case, but I'm not so sure, maybe I'm missing so...
Perfect numbers are strictly positive whole numbers of which the sum of their positive divisors equals a multiple of the number itself. An example of a 3-perfect number is 120. The sum of all divisors of 120, namely 1+2+3+4+5+6+8+10+12+15+20+24+30+40+60+120 = 360 equals three times 120. My code does work, but it's not ...
I have created a batch script to start the services in a gap of 10 min. My batch file will start the service on the local system and then will wait for 10 mins and starts the service on another system and then another. I have used the timeout command with nobreak statement which does not allows the user to stop the wai...
I've been trying to learn async coding recently. I've managed to get it to work and the UI thread doesn't block like it does if I don't make the code async. I realise this is a very contrived example, but is this how async should be done? public partial class MainWindow : Window { public MainWindow() { Initia...
I've seen a number of questions on Stack Overflow of the kind of "How do I sort on fields X AND Y?" The most common answers to those questions consists of "Write a custom Comparator." But what if you have 3 fields you can sort on? Or 13? or 300? My solution is this utility class, so that rather than writing a billion d...
I have a segment of code: /*functions return 4 if all digits are the same, 5 if digits are decreasing, 6 if digits are increasing, 7 if number's digits are bouncy.*/ int variable = 0; cout << number << endl; variable = sameDigitsTest(number); if (variable == 0) variable = dec...
Please review my pointer class. template<typename T> class Ptr { public: Ptr(T* t, int s = 1) { sz = s; p = new T[sz]; for (int i = 0; i < sz; ++i) { p[i] = t[i]; } } Ptr(const Ptr&) = delete; Ptr& operator=(const Ptr&) = delete; Ptr(Ptr &&t) :p{t.p}, sz...
I just finished Project Euler #8 in Swift, and since there is not any version yet on Code Review, I would like to have some comments on what I did to try to improve it. The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. 7316717653133062491922511967442657474235534...
Here is the class I'm using: <?php /** * Pastr 1.0 * @author Lloyd * Pastr is a quick and easy tool you can use to upload snippets of text and code * <pastr.co> */ class Pastr { /** * Our database information is stored here * Array */ public $dbInfo = array(); /** * Our array which ...
I was inspired by this SO post to investigate a good Java8 way to calculate Pi based on simulation. I used a similar task to learn about parallel programming on both CUDA, and Intel Xeon Phi processors. Those systems are more geared for parallel programming, but I felt inclined to apply it to 'regular' Java anyway....
The Rubberduck Saga continues as I find a need to roll my own configuration. Since the program is really a *.dll and available to several host applications, using app.config is not an option. I decided to leverage XML serialization to allow a user to modify which comments get picked up in the Task List. I feel like eve...
In Winter Bash 2014, since there is no easy way to see the hats I'm missing per site, I decided to use Gists for that. A perhaps not so well-known feature of GitHub Flavered Markdown (GFM) format used everywhere on GitHub is that if you write bullet point lists with embedded [ ] like this: - [ ] Bill Lumbergh: answer ...
I was bored recently and decided to write a class, MorseString. What this class does, is it takes a String that is coded like Morse (.... ..) and stores it. It also translates the String that is coded like Morse into a more "English-friendly" way (HI). This is just the basics I have written; there is much more to come....
Due to a performance profiling hotspot detailed here, I implemented my own BitSet using Java's BitSet. This is intended to replace the Enumeration.ValueSet. However, it's a bit awkward to use, primarily due to my likely misunderstanding of the relationships between the Enumeration class, Enumeration type and concrete...
I am practicing test-driven development in Python. Feedback about both the tests and the code is appreciated. I'm using luhn algorithm and regex to check credit card numbers for validity. Here are the tests: from unittest import TestCase import luhn_check class TestLuhnCheck(TestCase): def setUp(self): pa...
In my app, I have this code to display different tutorials about OneNote. This clears and resets certain values, and updates some variables so we know which version we are working with. The main problem is it has a lot of repetition in the three ifs, although all comments are welcomed. private void SwitchVersion(stri...
I wrote the below enum from which I need to extract the name and its value: public enum UserEnum { TreeUser("/tree"), ParentUser("/parent"); private String value; UserEnum(String value) { this.value = value; } public String value() { return value; } } This is the way I am usi...
I'm mostly used to writing scientific code in MATLAB / Python / Julia and my experience with C++ is very limited. I've implemented a fairly simple computation of the Rotne-Prager-Yamakawa tensor in dimensionless form using the Eigen library in C++11 (currently using the Visual Studio toolchain). #include <iostream> #in...
I am hoping that someone can help me out here. I am creating a PHP web app that requires a user to login to view their data in the MySQL database. I just want to know if this is a good approach and is it secure enough. I know that nothing is secure in PHP scripting but I need this fairly secure. Here is what I am doing...
When reviewing a Graham scan convex hull algorithm implementation, I wrote the following function in an answer: giftWrap :: [Vector2] -> [Vector2] giftWrap vs = result where -- Decides whether to keep or reject vertex b. -- Vertex b is provisionally kept if a left turn occurs there; the result -- is final...
I have written the following query to figure out activity streaks on a per-user basis. I find it... Ugly... And would love to improve it! Limitations Those are explained as commented text at the very top of the query. Problems Can this be done without a loop? Is there a better way to do this than #TempTables? Bonus...
I have a dining menu app that scrapes the data from a website and redisplays it in a mobile format, displayed below: If the user swipes left and right, the app will show the previous/next meal (ex. if current meal is lunch, swiping left will show dinner). I'm trying to come up with a more efficient way of switching be...
For the sake of full disclosure, this was written with bananas, not apples. The doctor may not be kept away. With AppleScript highlighting: For Copy&Pasting: activate application "TextEdit" tell application "System Events" repeat until first window of application "TextEdit" exists tell application "TextEd...
I am trying to create something that is very reusable here so that I can use it in other sites for other pages etc. This code is for a simple photo gallery, I took the code from here, but I changed it a bit and would like to add more functionality to it eventually, though. PhotoGallery.ascx <%@ Control Language="C#" ...
This question is from Cracking the Coding Interview and in this question they have asked to solve without using temporary buffer. I have used Iterator interface. Can I use it or need to re-implement it? import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; p...
I have a JavaScript array: var data = [{abc: "vf",def: [{ a:"1", b:"3"},{a:"2",b:"4"}]}]; I want it to convert to: [{"abc":"vf","a":"2","b":"4"},{"abc":"vf","a":"2","b":"4"}] I have written the JavaScript code for it: Javascript: var push_apply = Function.apply.bind([].push); var slice_call = Function.call.bi...
Previous question: https://codereview.stackexchange.com/questions/74677/text-based-tetris-game-follow-up-final Summary of improvements: Implementation of a Drawable class Separate functionality, input moves to Game class Implementation of Cloneable class by CRTP Removed global variables Added Block class Improving th...
I just finished Project Euler #9 in Swift, and since there is not any version yet on Code Review, I would like to have some comments on what I did to try to improve it. A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2 For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. There exi...
This question is a follow-up question of this one. I've learnt a bit more Python since then. I recently came back to making battleships again, and I think I did better. These are the changes I've made: Completely rewritten. Multiple battleships. Removed difficulty settings (as the way I was doing it before would...
I am setting a value to input box and trigger to hear the change. I would also like to always hear the input change, and for that I made this function. Can any expert please verify the way I did is correct? Or is it further tune-able? var page = function () { return { init : function () { var in...
I just started to learn AngularJS. I created a simple site using ASP.NET MVC as a backend. I created 1 main view and 4 partial views for the CRUD operations with a Company Entity. In the main page I have this element: <div ng-view></div> I load here the required partial view. I created 2 angular controllers, one for th...
I made a piece of software that basically adds the functionality of a compose key to Windows, after switching from one keyboard layout to another (for programming reasons), and being unable to find a piece of proper software that did what I wanted. This was my first venture into making applications for Windows, never t...
(A quick note on terminology: I use 'generalized functor' to refer to a functor that can be initialized from any callable entity, similar to the definition from Alexandrescu's Modern C++ Design. I use 'generic functor' to refer to functors in the general C++ sense, meaning anything which implements operator()) I'm work...
I've been playing around with Jekyll and CoffeeScript the last few days and made a Periodic Table to learn those two. Now, to create the Periodic Table, I take an array of lis as input which then replaces itself with a table using a custom format like so: periodicTable = [ [1, "s:16", 2], [3, 4, "s:10", 5, "-",...
I coded an executable program (.exe) that I only want run either from my home computer, our main server, or people in our development team. I have coded logic that will only allow the program to be run from certain IP addresses. The .txt file that's referenced in the getIPlist function looks like this: [123.456.78.90]...
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. I started out with this solution. It's iterative, and not very efficient. It multiplies all number combinati...
This is currently the code that I'm using to validate and check for errors in a flask app, where the form fields are coming from a /registration html page: @app.route("/register", methods=["GET", "POST"]) def register(): if request.method == "POST": if request.form['register'] == 'Register': if ...