instruction
stringlengths
71
71.9k
My question is mostly directed towards the principles of object-oriented programming. I have an Android application and one of the activities has a ListView. In this ListView, I am displaying a list of players and their leagues. Therefore I have constructed the ListViewModel to be either a league or a player, inflatin...
Part 2 of this question. I've rewritten most parts of the code, for the better I hope. The code now has some more logic and less readability. Functions included in the calculator: Addition User input 2+2 Program output 4 Subtraction User input 2-2 Program output 0 Multiplication User input 2*2 Program output 4 Divis...
I'm not very familiar with MPI. I've written this little piece of code to draw the Mandelbrot fractal processing each row of the image in parallel. It works but it's really slow. I've written code to perform the same task with OpenMP and with no parallelization, and both run instantly with the default parameters, where...
Here is how it looks at the beginning: And after I can add random counts of line edits: Or delete them: The main purpose is the possibility to add or delete QlineEdits which stores user names and each QlineEdit adds a username to the vector in the right order (index) like this: users => [0] = "a"; [1] = "b"; [2] ...
I implemented merge sort with C++ and would like to get some feedback. #include <iterator> #include <vector> template<typename It> std::vector<typename It::value_type> merge(const It begin, const It mid, const It end) { std::vector<typename It::value_type> v; It it_l{ begin }, it_r{ mid }; const It it_mid{...
I've made an attempt at a recursive Red-Black tree in Java. I realise that some of my code could be condensed but I tried to favour readability with this code as Red-Black trees can be somewhat confusing. The tree is implemented as per the method in Lafore (Data Structures and Algorithms in Java), this implementation p...
I'm writing my own HTTP client, kinda like cURL. (I already know I'm reinventing the wheel, this is more or less getting an inside look of HTTP 1.x before 2 becomes a thing.) So far pages download perfectly fine using OS provided socket libs. (Linux/Mac) So what the problem/question is, how can I better my client? One ...
Suppose there is a huge bitmap, huge_bitmap, in the drawable-nodpi folder. I want to create a custom view with huge_bitmap as its background: public class CustomView extends View { private Bitmap mBackground; public CustomView(Context context) { super(context); } public CustomView(Context con...
I'm working on this snippet of code within a PHP file. The upload function is working but I suspect it is not secure. I move all the files into an upload folder within the site folder. I think that some of this could be tricked into uploading malicious files but I'm not sure how it would be done and more importantly, h...
I was going through this tutorial for Pretty Printing a binary search tree and decided to implement my own version. Here is my implementation. This version works only for trees that are complete binary tree. I would like to know what all optimisations can be done (errors present can be removed) in the code. public clas...
I'm currently working on an enormous, enterprise level project. There are about 130 other devs on said project, and I aim to document my code in the clearest way, so others may easily see what I'm doing and why. I'm using JSDoc style comments to summarize my functions, but sometimes I feel the need to break it down to ...
Previous question: Text-based Snake game on Window Summary of improvements: Removed unnecessary functions such as clearScreen() Added new Matrix and range helper classes Implemented double-buffer by using WriteConsoleOutputA Added the color Split into separate files How can I improve this game? World.h #pragma once #...
The goal of my code is to sort data into two categories. It must use a local copy of the initial data from Collar (Top View).csv. My code creates a Collection of items called Collars using the initial data file, then moves each Collar into its respective category based upon its E dimension. I would like feedback on if ...
I asked this question a few days ago. The question is about producing moving/rolling windows of an array in Python as in the following example: from skimage.util import view_as_windows view_as_windows(np.arange(10*10).reshape(10,10), (4,4),4) Out[14]: array([[[[ 0, 1, 2, 3], [10, 11, 12, 13], [20,...
My task is pretty simple and my code works, it's just that my code feels a bit clumsy to me (and probably will for you too). I have a view controller (HomeViewController) with a scrollView, inside this scroll view I have a label, and the scroll view is set to scroll horizontally. So now we have a view controller with a...
I want to assign the row of a matrix the return value of a function, but the only way I can figure out how to do this is with a for-loop. I'm assuming this is bad and vectorization would be better. I'm trying to implement the first principle of the Neural Engineering Framework for a class. The function of the code is t...
I have created an awesome cheat/fan page for the game Doodle Creatures with the help of some cool people in The 2nd Monitor. Is there anything I can do to improve this code? Here is my ASP.NET markup: <asp:SqlDataSource ID="SQL_CreatureCombos" runat="server" ConnectionString='<%$ ConnectionStrings:KJAI_DBConnectionStri...
For a list li, I want to print only the values of the triplets a, b, c where 0 <= index(a) < index(b) < index(c) < len(li). Example: f([6, 3, 88, 4]) 6 3 88 6 3 4 6 88 4 3 88 4 Here is my solution, but it is O(n**3) (time complexity): def f(li): for i, n in enumerate(li): for j, o in enumerate(li): ...
I recently started playing around with R and am currently trying to plot GPS data points onto a perspective plot. I have a script that works and I get my desired results out of it and it works ok for my test file of about 12000 data points, but when I increase the amount of data points to about 4 million it takes a whi...
I'm working through the common divisibility tests, and implementing them in Racket. I'm working on divisible by three, for which I thought it'd be nice to keep summing until I got to a single digit (which I can then check for divisibility by 3). My code is here, but it feels like there are rather a lot of steps, and I...
The following is the description of the R build system I am using (very happy) with Sublime Text 2 on linux (Crunchbang). With it, I am able to: to source the current file.R to an interactive R session; to send the current selection to an interactive R session (supports multi selection); to output plots and *.Rout fil...
How can duplication be removed from this? class Authentication PROVIDERS = if Rails.env.production? %w(weibo open_wechat wechat) else %w(weibo open_wechat wechat developer) end.freeze end
I'm working on a PHP based web application. While building the UserStorage class, (which acts as a storage source for user data, and implements the UserStorageInterface), I noticed something. The get method fetches the user data from the storage source, and returns it: public function get($identifier = null, $alias = n...
I have tried to write a small part of a Poker game to check the Poker hand rankings. Please review and provide your feedback. package com.sa.test.conditions.poker; import java.util.Arrays; import java.util.HashMap; import java.util.Map; class Hand { Card[] cards; public Card[] getCards() { return car...
Lately I have been learning about serialization so I decided to write a little helper class for my application to make it easy to use this feature in multiple places. I actually mixed some generics in the code and want to hear your feedback on my overall approach. SerializationService.cs public class SerializationServ...
What I am planning on doing is pulling the first post of my news section. This was made for VBulletin and now I need to add it for IPb. package com.rigory.loader.main.services; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.InputStreamReader; import java.net.MalformedURLException; i...
Here's a function that splits given string according to predefined patterns. It's part of a trigger function used to populate one table from another. I want to be sure that I'm not making any mistakes. CREATE TRIGGER insert_t2 AFTER INSERT ON t1 FOR EACH ROW EXECUTE PROCEDURE insert_t2(); CREATE OR REPLACE FUNCTION in...
I have improved the Pretty Printing of binary tree that I implemented previously. In this follow up I have made changes such that every tree is printed (not just a Complete binary tree). Here is my changed implementation. Please suggest any improvements that are required. public class PrettyPrintTree { public Tre...
This is a follow up on my previous question: A grid and a menu walked into a program I integrated classes into the mix. The program now asks how big you want the grid to be. import java.util.Arrays; import java.util.Random; import java.util.Scanner; class NumberGrid { private static final int RANDOM_NUMBER = 1...
I'm a beginner in C++, and I'd like you to review the class I wrote for the Game Of Life. GameOfLife.h #include <vector> #include <iostream> using namespace std; class GameOfLife{ public: GameOfLife(void); GameOfLife(const unsigned &, const unsigned &); ~GameOfLife(void); void disp...
I have resolved the Problem presented in Project Euler #10: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. But this code takes too long before producing a result, 12.4195167 minutes to be exact. What should I do to optimize this code? public class summationOfPr...
I have this contract: public interface Stack<T> { void push(T object); T pop(); int size(); } I am curious what you think about my test of the size() and pop() in order to prevent bugs (underlying data structure in not being cleaned) in implementation like below: Implementation: public class StackImpl impl...
I have several huge 100MB text files that I need to scan through to pick out certain frame numbers which relate to a specific log packet of interest. My plan was to scan for these frame numbers and drop them into a list (often 6000+ frames per text file!). Ok so far, but there is second packet of interest which shoul...
I have written the below code to handle accessing and parsing the data presented in XML format from our server room environmental monitor. The plan is to call this class from a controller/view handling the "dashboard" on our Intranet page. Is there any way I could optimize the class? should the methods really be static...
I'm looking for some hints or advice regarding efficiency, performance and some good coding practices. Also I'm curious about synchronization. The server is multithreaded, so I think some operations should be synchronized. HttpServer.java import java.io.IOException; import java.io.InputStream; import java.util.Properti...
This is a follow up to: Lvl 1 upgradeable attributes From before: I've built the groundwork for an attributes (as in Strength, Intelligence, not as in DebuggerHidden, TestMethod) framework for my game. Each attribute can be upgraded and downgraded individually as well as part of a bulk change (such as for upgr...
This is a follow up of: Messenger supporting notifications and requests Shoot the Messenger pt. 2 Shoot the Messenger Part 3 I've written a lightweight (I think) class that acts as a messenger service between classes for both notifications (fire and forget updates to other classes) and requests (a notification s...
I have a WPF C# application that I want to move to a MVVM pattern. My first step is to remove the button click handlers from the code behind of the UI. I've found some examples online and then modified them to my needs. Is the following code a good way to use buttons without the code-behind click handlers? And is this ...
While answering this question, I wanted to use a generic sum of Collection function. Java doesn't have a native method, so I wrote one. There are a couple things I don't like about it though, so I wrote a more specific method for my answer. public static <T extends Number, U extends Collection<T>> BigInteger sum(U ...
I have a project that relies on finding all cycles in a graph that pass through a vertex at most k times. Naturally, I'm sticking with the case of k=1 for the sake of development right now. I've come to the conclusion that this algorithm as a depth first search is at worst \$O(kn^{kn})\$ for a complete graph, but I rar...
I created a pretty complex algorithm for calculating matches on a Bejeweled board that kept track of matches involving wilds. After doing some in-game testing, I found quite a few bugs that needed to be eliminated. In order to deal with this problem, I first created an undo system for the game, and then when I saw u...
I have an array filled with 5 other arrays that consists of arrays of 2 values (first a date then a count): [ [ [dt, cnt], [dt, cnt], .... ], [ [dt, cnt], [dt, cnt], .... ], [ [dt, cnt], [dt, cnt], .... ], [ [dt, cnt], [dt, cnt], .... ], [ [dt, cnt], [dt, cnt], .... ...
I still feel like I struggle to grasp some concepts of SOLID principles at times, and am hoping for some clarification here. The following classes are entities in an Entity Framework project. namespace MyCompany.MyProduct.Core { public abstract class DataError { public int ErrorId { get; set; } pub...
This is the a bit of code that works with Echonest API's pyechonest and remix libraries combined with matplotlib.pyplot to offer a simple visual representation of the start and end "parts" of a music track: #!/usr/bin/env python # encoding: utf=8 """ mix_track_utils.py Analyze music track using echonest API with pyech...
Project Euler #5: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? Here is my solution: class SmallestMultiple { private static final int MAX = 20; ...
Project Euler #6: The sum of the squares of the first ten natural numbers is, \$1^2+2^2+ ... + 10^2 = 385\$ The square of the sum of the first ten natural numbers is, \$(1+2+ ... + 10)^2 = 55^2 = 3025\$ Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is \$...
Feedback I would love to hear: Since this is really my first real JavaScript app, being that I can never find a project I want to actually work on, I want to know how I can improve my JS techniques. Am I doing a good job separating logic? Am I using good techniques? Should I completely forget about vanilla JS and just ...
The problem statement can be found here. Description (short): Input The input stream contains a set of integer numbers \$A_i\$ (\$0 \le A_i \le 10^{18}\$). The numbers are separated by any number of spaces and line breaks. A size of the input stream does not exceed 256 KB. Output For each number \$A_i\$ from the last ...
I'm using SFML to manage my windows and I'm writing this engine to visualize some PSO work. I'm trying to make it generic enough that I can extend it for other simulations later on and keep it as minimal as possible. (I'm going to copy this design pattern to a freeglut initialized openGL 3D engine w/CUDA later on as we...
I had a problem to define propTypes for my React class. I ran into solution that doesn't feel right: let React = require('react') let CallerCard = require('caller-card') class CallerDetailsPanel { render() { return ( <div className='caller-details-panel'> <CallerCard person={this.props.callerData.o...
This is the code I've written to find the maximum-weight independent set of a graph path. It's a standard problem with a well-known dynamic programming solution of linear complexity. Since it's a graph path, it's simplified down to a sequence of vertex weights, and we need to find the subset of non-adjacent vertices ha...
I once asked a similar question but in C#. Now I have the same problem in powershell.. What is the fastest way, to search files newer than 15 minutes, in a file system with more than 1 million files? Is there any faster way than using pipe? Get-ChildItem -Path $path -Recurse | Select Name, PSIsContainer, Directory, Las...
The graphic guy wants to display dates like 16. February 17. - 24. February, or 25. February - 02. March. Here is my solution: $d1 = new \DateTime('2015-02-06'); $d2 = new \DateTime('2015-03-02'); $dateDiff = $d1->diff($d2); if (intval($dateDiff->d) != 0) { $d = $d1->format('d.') . ' ' . ($d1->format('m') != $d2...
I've tried to make a better any than before: #ifndef ANY_HPP # define ANY_HPP # pragma once #include <cassert> #include <cstdint> #include <stdexcept> #include <typeinfo> #include <type_traits> #include <utility> class any { public: template <typename T> using remove_cvr = ::std::remove_cv< typename ::s...
Is there any way to easily remove synchronization from this code, when there is a validation step before acquiring a lock? I tried an AtomicReference<Pair<Integer, Double>> to hold the state. But that complicates the algorithm a lot because I have to use compareAndSet() in accept(), and then if that returns false, I ha...
This is a simple program I've made using Qt Creator and Pyside: I made a list of activities that I would like to enforce Then I made a program that randomly pick them based on chance It has some buttons to set an activity as Completed/Postponed It can be added new activities for extra 'points' Some activities can take...
I'm trying to have a HTML / CSS structure for flexible layouts for forms. I tried to look at Bootstrap codes for help with this (without actually using Bootstrap itself). I've gone with something along these lines: http://cssdeck.com/labs/stidyuic * {padding: 0; margin: 0; box-sizing: border-box;} body {width: 80%; m...
I've made a strange method with multiples conditionals, creating a lot of Lists and I was wondering if I could write it in a better and more legible way. def findRooms(room:Room) = { ... if(room.id != null && !room.id.isEmpty) query+=("_id" -> room.id) if(room.members != null && room.members.length > ...
I currently have this code: <Window x:Class="Listener.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="600" Width="800" Loaded="Window_Loaded" WindowStyle="None" AllowsTransparency="True" Backgroun...
I'm making a road tax data calculator/parser for practice. I do this because I want to learn more about OOP and arrays with its functionality. On my previous post, I made this same application but also included the ability to decode the data and putted it in right format. Now, I've already done that with a different ap...
I have a search form where users can enter ValidFrom and ValidTo dates, There are three conditions: ValidFrom and ValidTo NOT NULL Action: Get values between two dates ValidFrom is NOTNULL and ValidTo is NULL Action: Get values where date is greater than ValidFrom ValidFROM is NULL and ValidTo is NOTNULL Action: get v...
I've seen a lot of Objective-C implementations but I'd like to do it in Swift. I did it like this and it seems to work just fine. Does anyone have comments and/or improvements to make? import SystemConfiguration class EnvData: NSObject { class func getSSID() -> String { var currentSSID = "" let ...
In my project, for inserting an autosuggestion function (also in presence of little insertion errors, like Google), I've created this class: import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.SortedSet; import java.util.TreeSet; ...
I have a series if statements where I am trying to find the highest resolution file in an set of files. Is there a way that I can refactor this code to be shorter and or cleaner? begin icon = icons.find { |name, _| name.downcase.include? 'xxxhdpi' } if icon.nil? icon = icons.find { |name, _| name.downcase.inclu...
I am very new to network programming and I'm thinking I have probably misconstrued the creation of an appropriate TCP listener. The code I have below works perfectly, but I have a feeling it's a "hack and slash" miracle and could come apart easily when set into my production environment. What can I do to improve this r...
How can I refactor this method to look cleaner and free from 2 If statements? If NullableDate.HasValue Then Dim DayCount As Integer = (DateTime.Now.Date - NullableDate.Value).TotalDays Dim positive As Boolean = DayCount >= 0 dim TimeLenght as Integer If positive Then If DayCount <= 364 Then ...
I have a custom class I've written which allows me to validate individual properties of items, without firing validation errors on other properties. This allows me to individually validate what my users are editing without flinging up a lot of red mess on fields they haven't gotten to yet. The validator uses reflection...
I am a newcomer to jQuery and am working on an app that allows the user to paint images. To do that, I've created a color palette, and if a user clicks on a color, the paint brush successfully changes to that color. However, my code looks really ugly. I really want to clean it up. $(document).ready(function() { ...
I'm wondering wether there is a way to walk through every branch of this switch without using goto public static List<KpiGroup> GetKpiGroups(int siteId, int topLevelProjectId, SiteDetailsModel.KpiCategory category, bool applyMapFilters) { var kpiGroups = new List<KpiGroup>(); switch (category) ...
Below is the code to find the minimum average waiting time for customers at a store. I want improve the time complexity of the code. As an overview of the logic, I start from currentTime = 0 and increment it by preparation time of the current order (as only one order can be prepared at any given time). When that order ...
I would love to hear any thoughtful suggestions on how to improve my programming style in order to be more understandable. Listed below is a sample of my code which I wrote in Eclipse: //Implement using a linked list public class FrequencyBag<T> { // TO DO: Instance Variables private Node firstNode; private int numOfIt...
I'm wondering if my code is just a tad too long to post here, but if the only consequence seems to be getting high-level reviews, then that's perfectly fine. This is my implementation of Hangman in C++, split up into a handful of classes. I'm familiar with the syntax of curly brace languages but lack experience with th...
Project Euler #7: 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? Here is my solution: public class PrimeFinder { public static void main(String[] args) { long time = System.nanoTime(); int result = getNthPrim...
I'm doing another Project Euler problem, number 35: The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. How many circular primes are there below one mi...
I've just written a simple caching / memoization python decorator. It's purpose is to cache what the function returns for all the arguments combinations it's been ever invoked with. So, if, say, we had a function my_function(a, b=2, c=3) invoked once with my_function(1, 2, c=3), the results should be then cached whenev...
Project Euler #10: The sum of the primes below 10 is \$2 + 3 + 5 + 7 = 17\$. Find the sum of all the primes below two million. My solution: public class PrimeSumFinder { private static final int MAX = 2_000_000; public static void main(String[] args) { long time = System.nanoTime(); long res...
This is supposed to encode and decode small strings of text. Unfortunately, even on a really good laptop, it performs slowly. This might have to do with my looping, or just the sheer computation. It takes a string, uses simple RSA, subtracts by random #, converts both to fixed binary, then compresses using base 80 "eve...
Most of my experience is in Python, Java and embedded C, and I need to learn Scala and Play for a new job. As an exercise, I decided to create a very simple API for looking up area by postal code, backed by Redis. It's just a single controller with a couple of routes. I'm hoping for feedback from experienced Scala or P...
My home-made wannabe-a-parser was wet behind the ears, so I started seriously looking into more mature alternatives, and ended up adding a dependency to the ANTLR lexer/parser generator tool, and using that along with a slightly modified Visual Basic 6 grammar I was able to generate the real deal - a full-blown real pa...
I am making a key-value database using acid-state. It has three similar "pools", one for cookie records, one for email verification of new accounts, and the last for resetting passwords. There are three Update/Query: 1. insert a new record 2. verify using records in the db 3. delete a record Initially, I wrote three di...
This is an interview question from here. Specifically, the second asked for a function that took in two sorted arrays of integers with no duplicate values within a single array and which returned an array of the duplicates between the two arrays. Here is my solution (with tests): public class ArrayDuplicates { pub...
I have been programming for about ~2 years, and mostly wrote OOP and structural code. Recently, I have decided to pick up a functional programming language, and Haskell being too alien for me, looked to Racket (since it is high time I learned a LISP anyways) and am loving it. Since this is a new area of programming for...
I have this piece of code for running a Stored Procedure, and I was wondering if there is a way of cutting code like: uPar = .CreateParameter("@PropertyID", ADODB.DataTypeEnum.adInteger, ADODB.ParameterDirectionEnum.adParamInput) .Parameters.Append(uPar) .Parameters("@PropertyID").Value = Val(lblPro...
I required a trigger, whenever the window text selection cleared. Finally I found this approach. Using the same id, I have added multiple event handlers, but I am not sure my work is the best. Is there a better way to do this? $('#tenderContent').on('mouseup', '.tenderdocument', function (e) { e.stopPropagation()...
This is the problem statement for Insertion Sort - Part 2. In Insertion Sort Part 1, you sorted one element into an array. Using the same approach repeatedly, can you sort an entire unsorted array? Guideline: You already can place an element into a sorted array. How can you use that code to build up a sorted array, o...
recently I've started to learn Clojure. I came up with an easy programming problem, described by this C code: int main() { const int N = 5; const int M = 12; uint8_t small[N] = { 1, 2, 3, 4, 5 }; uint8_t big[M]; memset(big, 0xff, M); for(size_t i = 0; i < M; ++i) { big[i] ^= small[i...
This is supposed to search for a node in a huge Treeview. The node could be found in many places. In other words there may be many nodes and the resulting tree should be expanded depending on where nodes are found. I was asked to avoid recursivity in this method. The only solution I was able to get is using LINQ querie...
I'm rather new to C#, and found relevant subclassing examples surprisingly hard to come by. I've whipped up this class that appears to work, but am pretty sure this is not optimal: private class ThrottledRestClient { int pause; // mininum ms between requests double rpm; // max requests per minute long las...
I've been researching AES encryption a bit over the past several days. The official (MSDN) examples I've seen are encrypting and decrypting using the same AES instance. They don't go in to what to do when generating and saving an encrypted value with AES and needing to decrypt it later with another AES instance. I came...
How can I improve readability of this code? indentChar needs to be reused elsewhere. toCoordinate = dropWhile ((||) <$> (not . indentChar) <*> (=='(')) >>> takeWhile(/= ' ') indentChar = (||) <$> isAlpha <*> (=='(') Desired result: *Parse> toCoordinate " \\--(my.coordinate - from outerspace)" "my.coordinate"
I have implemented the question #268 from Topcoder. The question is that there are 4 conditions for a lottery ticket: CHOICES - numbers available (10 ≤ CHOICES ≤ 100) BLANKS - number of numbers that can be chosen (1 ≤ BLANKS ≤ 8) SORTED - are the numbers sorted UNIQUE - are the numbers unique The input is given as (C...
I'm doing practice interview questions from here. Here is the one I am currently on - if you are given a very large sorted int array, then check of there exists a pair. public static int sumOfTwoExists(int[] largeArray, int a, int b) { A: for(int count = 0; count < largeArray.length; count ++) { for(int cou...
Originally, I created a program that echoes files or strings to output. This is a modification of that same program and goes a step further. It does work (in both Linux and Windows), but I can NOT guarantee that it is bug free or that it is even fully compatible with both OS's. This program writes, reads, and copies fi...
I want to redirect all pages under a certain directory to a single file, like so: /dir/a → /dir/new /dir/b → /dir/new /dir/new → /dir/new With the straightforward RedirectMatch 301 ^/dir/ http://example.com/dir/new I get a redirect loop, since /dir/new redirects to itself. I replaced it with a regular expression R...
I have a spreadsheet with order date data: I need to find the average interval in days between each order date. I have to both find a way to get past the blank cells in the row, and also take into account that some clients have 5-10 orders and some clients have 2 orders when calculating my average frequency (interval...
I'm writing unit tests for a web application that has quite a lot of UI interactions. I would like some feedback regarding on how to handle click events with asynchronous code. My goal here is to simluate users interacting with the page. That's why I'm triggering events rather than making function calls. Here is my id...
This below program will be further enhanced for TicTacToe game with Human and Computer as players. Currently this program is written for choosing best move for a given grid position. package project2.tictactoe; enum TicTacToe{ X, O, NULL; @Override public String toString(){ switch(this){ ...
I made my first jQuery plugin, and was hoping to get a review. I'm especially interested in comments on whether I went about building up my html and applying the css in a reasonable manner (I chose to do it all in jQuery to keep the dependencies limited). I welcome most of all comments regarding ways to improve the cod...
I have an application with a recent addition that requires the removal of a struct pointer from a slice that is itself an element of another struct. A summary of the usage. I am wondering if this is idiomatic and okay usage of the go languages. Things appear to work and this appears to be inline with the golang recomme...
My code below ensures that only land animals can be a "representatives" for Land while only ocean animals can be representatives for Ocean, and so forth for Air, Underground, etc... Just want some feedback about whether this system I've come up with is any good or if there is a better one. Note: I'm using structs in...