instruction
stringlengths
71
39k
I have prepared an implementation of sort_by_keys filter: {% for donation in donations|sort_by_keys:'date,-value' %} <img src="{{ donation.stamp_img_url }}" /> {% endfor %} Example data: donations = [ { date: '29-07-2014', value: 150, }, { date: '07-10-2014', value: 450,...
As the first step for writing a Morse code practice program, I thought I'd start with the very simplest step of a text-based Morse code translator. This simple program reads lines from stdin and emits them as a text-based representation of the Morse code equivalent. Any character that doesn't have a Morse code equiva...
I'm relatively new to NodeJS and Express, and I've recently run into the pyramid of Doom while doing stuff that requires multiple steps. I've found that promises are very promising indeed. But I definitely need opinions on various aspects of my approach to routes as a whole. Here's the full code: I'm not very sure abou...
I need to figure out if any anagram of the string can be a palindrome or not. Ideas: It relies on two observations: Frequency of every character in the string is even, if length of the string is even. Frequency of every character in the string is even except for one character, where frequency must be odd if the string...
I need to write a program that reads a sequence of integers and determines if the sequence is alternating. An alternating sequence is a sequence of numbers in which every number should be greater or smaller than the one before it according to the base alternation. For example, 1 5 4 8 2 10 is alternating. I wrote this ...
Natural merge sort is a modification of merge sort that sacrifices \$\mathcal{O}(N)\$ to actually build a list of "runs" that may be defined as monotonically increasing or strictly decreasing contiguous subsequences in the input array. After the run queue is established, the algorithm repetitively pops two runs from th...
I recently got interested in Go and wrote a database server which uses a binary tree for data storage for fun. As I have no prior experience in Go, I'd like to gather a bit feedback on my code and would like to know how I can improve/optimize it. File: BinaryTree.go package BinaryTree //import "fmt" type SearchTree s...
I feel I am over-complicating things, and that there should be a succinct way to achieve this - perhaps using concepts I have not learnt - or some prelude function I have missed out on. How can I improve this? data Mat2x2 = MkMat2x2 Integer Integer Integer Integer deriving (Show, Eq) -- modified versions of prelude...
I aim to create a few primitives for creating AES256-then-HMACSHA256 secured session state through cookies. What I've considered: HMAC instead of plain sha to avoid hash extension attacks input validation from the programmer AES in CBC mode, because we're supporting more than 128 bits of data PKCS7 mode for padding Co...
I'm writing code that makes the monster depend on value "followHunter", follow or run away from hunter. I have written the following code. Unfortunately it's long and non-optimized. I feel that there is a way to make it simpler by organizing it in procedures and functions but I have no idea how to do it. In this batch ...
I am coding an Objective-C MD5 hash "decrypter". Since you cannot decrypt such a hash function, I am approaching it with a brute force algorithm, that tries every single password combination until it found the correct one or not. I would highly appreciate any help to improve the algorithm to make it even faster. I am c...
Typeclassopedia presents the following exercise: Maybe can easily be made an instance of Applicative; writing such an instance is left as an exercise for the reader. Here's my implementation: data Option a = Some a | None deriving Show instance Functor Option where fmap _ None = None fmap ...
I'm creating a small app and decided to write my own DAO for learning, etc. At the moment it's in one big file, which I really don't like. Could you give me some tips on how: you would separate this into smaller classes and use abstraction, inheritance etc? how I can update the CRUD functions (they feel pretty "frumpy...
As a learning project I recently started writing a node module to generate / handle the creation of CRUD endpoints in a DRY way. The problem I was initially wanting to solve was that in my generator-angular-fullstack project I had several basic CRUD endpoints that all had identical controllers (e.g. this). My idea was ...
The script basically just appends the words based on the user's click/s on the textarea. I just need some help improving my code further using the .on("click", function{}) and making it shorter. $(document).ready(function() { $("#add_user").on("click",function() { $("#textareaFixed").append("Lorem"...
I was using the following code to construct the tree from a list of nodes: [1, 2] means that there is a bi-directional link between 1 and 2 def createTreeFromEdges(edges): tree = {} for i in edges: v1, v2 = i if v1 in tree: tree[v1].append(v2) else: tree[v1] = [v2...
Here is an example of how I solved this problem (though this is not the only nor the best way by any means) for an assignment where it was also requisite to determine if a string was a reverse prefix of the other. Obviously a palindrome is a reverse prefix of itself so if you can determine a reverse prefix then you can...
I want to convert int64 to custom base 64 number string, with this specification: 0..9 -> 0..9 10..35 -> a..z 36..61 -> A..Z 62 -> _ 63 -> - Is this implementation correct/efficient? func EncodeLogKey(id int64) string { str := make([]byte,0,12) if id == 0 { return "0" } for id>0 { var ch rune m...
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 This is my code so far, which I think is very messy. public boolean g...
The following page simulates XSS attacks and successfully (?) prevents them. I want to know if I've missed any other major attack vectors (or small ones) and/or if anyone has suggestions as to improving my escaping methods. There are three contexts in which I attack: direct PHP echo into an HTML tag Attack: an HTML e...
I have complex logic in QueryStatus event (CommandTarget) for a VS Addin (VS 2010). I'm a newbie using C#. I would like elegant, easily maintainable code that follows DRY and KISS principles. Maybe using helper with ActionT> or FuncT> methods. There are many commands to use: using if statements and switch statements. ...
I have two arrays of double, say x and y containing some physical data. I would like to find the best-fitting polynomial function at a given order: \$y=pol_n(x)=c_0 + c_1*x + c_2*x^2 + ... + c_n * x^n\$ and return the coefficients (\$c\$) in an std::vector. There are no constraints on the function interface. The GNU Sc...
I'm not a programmer and this code is probably not a nice one (suggestions are well accepted!), I'm trying to write a tool for my analyis and its the first time I'm using templates and polymorphism and here are my implementation: #ifndef XAODREADER_MONOJET_H_ #define XAODREADER_MONOJET_H_ // STL include(s): ...
Currently I am developing an application which uses a few variables which should be changable in a .ini file. Since I want to make the application to be able to continue if the user "forgets" to correctly implement the variables (read: "retard-proof"), I figured I would have to create an object for each variable which ...
I have made class to setup a random number bases on <random>. It works fine, but I have doubt in std::default_random_engine mEngine{ std::random_device()() }; Did i implement it correctly? What is the best practice for random? #include <random> #include <iostream> // for some compilers that's don't support nested temp...
Here is my implementation for one dimensional cellular automation in Python. Any suggestions for more efficiency - other strategies? ncells = ['111','110','101','100','011','010','001','000'] def next_state (state, rule): newstate = '' binrule = bin(rule)[2:] binrule = (8-len(binrule))*'0' + binrule fo...
The code I have works. I was just curious if there was an easier way to write the function. Note: It is referenced inside of an object so you may need to change the $this variables. public function workTime() { $startDate = new DateTime($this->start_date); $startPretty = date("F Y", strtotime($this->start_date...
I have to find the maximum value in a binary tree. This is how I did it iteratively: int maxValue(Node* node) { if (node == nullptr) throw "BT is empty"; int max = node->data; for (Node* left = node; left != nullptr; left = left->left) { if (left->data > max) max = left->dat...
I am trying to optimize the following code: private void Screen_Paint(object sender, PaintEventArgs e) { Graphics bmpGraphics = Graphics.FromImage(_screenBitmap); int xLoc = 0; int yLoc = 0; bmpGraphics.Clear(Color.Black); _resetInvoked = true; for (int i = 0; ...
Is there a better way to do this using chaining? var url = "www.mycompany.com/sites/demo/t1" var x = url.split('/'); console.log(x); var y = x.pop(); console.log(y,x); var z = x.join("/"); console.log(z); I tried something like but wouldn't work since pop just returns the last value and not the rest: parentUrl ...
I have four different classes. First being a base class for the second and third. The fourth being a container class that holds instances of second and third (stored as first). My base class for PC and Companion public class Controllable { protected String name; protected int x; public Controllable (String...
I have an interface and a concrete class which I am using in the code below: /// <summary> /// Converts a DataSet read from the DB to a list of objects of a type /// TemplatePart. /// </summary> /// <param name="templatePartDataSet">DataSet containing the information. /// </param> /// <retu...
This is my first program to convert temperatures. I have a very basic knowledge of Python and I tried using only what I already knew to make the program. What are some improvements I can make, or how can I re-create this in an easier way? temp_string = raw_input("What is the Temperature: ") x = int(temp_string) print...
I'm trying to represent the following mathematical expression in Python: $$P(n) = (n!)(6^n)$$ The program should compute the answer to expression when n = 156. I have attempted to create the program in python and it produces the correct answer (when compared with wolfram alpha's answer). The answer is approximately \$1...
It should work but my comp can't compute it in time. It is Project Euler problem 12. Just a small bit of advice would be nice. Only at this a short time so I probably just haven't learned a good way to manipulate the situation yet. public class HighlyDivisibleTriangularNumber{ public static void main(String args[])...
I'm working on a project that reads a series of SharePoint lists and outputs them into JSON file(s) which will later be uploaded via FTP to use on a website. I'm aware that there's a lot I could be doing better, but I need some direction on what these areas are and what I can be doing to improve upon my development ski...
In an interview about multithreading I was asked to write code to satisfy the requirements below: In the exercise you need to provide implementation of single-threaded TaskScheduler class with the following signatures: TaskScheduler { TaskScheduler(List<Task> tasks) int getPriority() void execute() where Ta...
I have written this function for the sole purpose to get a similar color either brighter or darker than any given color, depending on an average lightness/darkness. Essentially, I add up the R/G/B values and divide by 3, thus giving the average intensity of each color channel. Then, depending on that result, if it's le...
This is the batch file I have created which copy the specific folders which I want. I use the specific server folder name of which I want to copy. This batch file will also delete the folder which you don't want to copy. My batch file will ask for the user input for the source path as well the destination path and to n...
I am a newbie jQuery developer and i have created a responsive image solution where the HTML custom data attributes are used for loading images according to size like desktop, laptop, iPad etc... Here is a live demo of the project. I hope you like the project. Please tell me how to improve this. // Mezzaraine Beta Vers...
I need to unit test my authentication handler. I don't really want do an assert against the text message returned by the handler. How could this be improved ? protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { // Check for API key if (!reque...
I developed a SQL stored procedure which works lovely, but when under stress, it takes more than 2 minute to get back to the user. I am providing the stored procedure but would also provide the table structure if required. /* Stored procedure to get fruits checks that the user has access to*/ ALTER procedure [dbo].[Fru...
I'm trying to get a good grasp on ASP.Net MVC, Razor and RadioButtons, so I tried to make a quiz to test my skills. I implemented a working quiz form in the following way in Razor (not posting the controller that manages it and just showing the important part of the view file): @using (Html.BeginForm("Quiz", "CourseDe...
Previous question: Tic-Tac-Toe in C++11 - follow-up 4 How to improve this code further? #include <iostream> #include <cctype> #include <algorithm> #include <functional> #include <array> #include <random> #include <ctime> // empty struct for inheriting functionality struct Mute { Mute() = default; Mute(const Mu...
I want to design a row of the following style in my Android project: I have the following code for this: <?xml version="1.0" encoding="UTF-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.example" android:id="@+id/relativePrime"...
I am studying Java and trying to write an HTML parser, which should parse tag names and attributes. I wrote a class (code below) using the State pattern. This is necessary for my training project, where I currently use JSoup. JSoup is too slow for me though, so I want better performance. Although suggestions about fol...
I want to do some Monte Carlo simulations on a system based on a pool of dice. For each trial, a number of dies are rolled, and the winner is the highest value, getting as many points as dice are over the second, including ties. Examples: [1, 2], [5, 1] One point for the second (5 is the only value over 2). [20, 12, ...
This is a follow up to Messenger supporting notifications and requests 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 sent out that expects a returned value). Since the last ques...
I have complex logic manage EnvDTE.Project and EnvDTE.ProjectItem for a VS Addin (VS 2010). I would like elegant, easily maintainable code that follows DRY and KISS principles. Maybe using helper with Action<T> or Func<T> methods. I want a Dictionary<string, ItemBranchable>, for access by "Key" (an Id, the name of a pr...
My approach to unit testing feels very wrong. I feel like I am missing something very basic, and I'm looking for some insight please. Let's assume that I am testing a method (I'm using NUnit) that returns an object. It might look like this: public void TestConnection() { DBConnector dbConn = new DBConnector(connSt...
I know there have been a lot of post, blog article answer on Stack Overflow (but the validation does return true on a tab character) about this. But I'm still looking for a neat way to validate if a value is a number. I wrote the following. Does that cover the 99% of the cases? Is there a better way to do that? functio...
While DoCmd.RunSQL is all well and good for simple code, the number of times I've run into problems with unescaped apostrophes and the like was starting to nark a bit. With that in mind I crafted the below, a first attempt at a SQL wrapper for VBA which constructs and executes an arbitrary INSERT INTO query using param...
I am attempting to write a function that returns the records that a user has selected on a grid. In this example, I grab all of them and return their IDs. Grid.prototype.getSelectedRecords = function () { var self = this; self.selectedRecords = this.grid.selModel.getSelection().map(function (record) { ...
To illustrate some algorithmic problems I found while writing this code review, I needed to include a live demonstration, which I implemented using a Stack Snippet with Angular.js. The demonstration takes a color input and a scalar parameter, and produces two read-only color outputs. The "Original" output is known to ...
I'm trying to represent the following mathematical expression in C: $$P(n)=(n!)(6^n)$$ The first program should compute the answer to expression when n = 20. I have attempted to create the program in C and it produces the correct answer (when compared with wolfram alpha's answer). The answer is approximately \$10^{34}\...
I recently studied SkipList and thought I would create one on my own. This implementation uses a 2 layer `SkipList where the size of the support list is roughly square root of the size of the original list. package skiplists.skiplist; public class SkipList<T extends Comparable<T>> { private SkipNode<T> start; private ...
I have 2 booleans: host.isReachableOnLan, and host.isReachableOnWan I have a listener onItemClick doing work on network on button event Then I have an anonymous thread than runs a while loop, evaluating the booleans each iteration with the evalFlag method. This works, but feels hackish and wrong. Is there a more elegan...
I got a Reservation model that has reservation_start and reservation_end. Then I have the usual date validations (end date cannot be lesser than start date and so on). The problem is with these two guys: def reservation_start_available reservations = Reservation.where(["transport_id =?", transport_id]) date_r...
I am totally confused while implementing Repository pattern with unit of work and Entity framework because I have seen tons of examples. Please suggest whether I am on the right track or not. public interface IUnitOfWork: IDisposable { void Commit(); void Dispose(bool disposing); } Here, Medevenet is EF DBCont...
My Resolver.resolve class returns a hash of objects and I would like to return a specific object if it exists. Is there a more concise way to write this? def resolve_url(url) # Resolver library now returns a hash of objects # Using this helper method to preserve the old functionality of returning a single objec...
After reading this question, it jumped to me that many said that the solution to the problem is over-engineered / overkill. Here I solve the same problem in Python in a more compact way. I think that this solution is compact enough. If you still think that this is overkill for the problem, please tell me. Any kind of o...
Before you can do any sort of card game, you must first write some code to define your deck of cards. One thing I've noticed in looking at some of Apple's Swift interfaces is that they very much so like to use extensions. This is probably good. In the big picture long term, it's a really good way of allowing ever-exp...
I'm a sysadmin writing a tool to perform administrative tasks on our upcoming new account management system that runs over LDAP. I want the tool to be highly flexible, configurable, and reliable, so I'm using automated test-driven development. I've started writing a module to perform LDAP connections and commands, but...
I'm using Caliburn Micro to create a WPF application. So what I want to do here is a typical Master/Detail situation. I'm displaying a list of Users and you can can add/edit a User and save the changes back to the database. Everything works, but I'm just not sure if I'm creating the UserViewModels in the correct way. ...
The code takes a matrix and turns it into a tree of all the possible combinations. It then "maps" the tree by setting the value of the ending nodes to the total distance of the nodes from beginning node to ending node. It seems to work fairly well but I've got a couple questions: Is a Python dict the best way to repr...
I have the following program and it's working as I had hoped but now I would like to tidy up the code, putting bits into new methods, so I'm not left with loads of code in the main method. I'm new to Java, so don't know how to go about this. I have the following methods: public String getInventoryCode() { retur...
I have a service which needs to store some settings data in a DB and at the same time maintain a reference to that in the user'slocalStorage (we want two users logged in to the same account to be able to view them differently). This method looks for an existing previewSession in the localStorage and if not found, creat...
This is a typical interview question: Given an array that contains both positive and negative elements without 0, find the largest subarray whose sum equals 0. I am not sure if this will satisfy all the edge case. If someone can comment on that, it would be excellent. I also want to extend this to sum equaling to any...
I wrote this just for fun, to hone my exception handling skills. I want to know what I can do better in terms of exception handling (and otherwise) in the below code Server import java.io.EOFException; import java.io.IOException; import java.io.ObjectInputStream; import java.net.ServerSocket; import java.net.Socket; im...
I just made a method that should handle GET and POST parameters (primitive types) sent by AJAX requests to the server: protected T GetParam<T>(string key) { string value = HttpContext.Current.Request[key]; if (string.IsNullOrEmpty(value)) return default(T); return (T)Convert.ChangeType(value, typ...
I have written some basic implementation of a Minimum Spanning Tree using a indexed minimum priority queue. For the implementation of the Priority Queue I used Sedgewick's Tutorials. However, it seems that I am passing a lot of arrays around for the priority queue. Here, is my code snippet. Could someone point out the ...
I am new to C# and I have big functions that receives the following arguments: (Package inPackage, string materialIDs, string functionIDs, string companyIDs) Asides from the first argument, which is an object of type Package, all the other arguments are strings of IDs. So, for example, a valid input for this function...
I had some issues with the behavior of the iterator in my prime generator: #include <vector> #include <set> #include <iostream> using namespace std; int main() { int a,b; int nbr; vector<int> t; set<int> s; // prime generated to b b = 10; // set 2 -> b. for (int i = 2; i != b; i++) ...
I've developed some code in Python to apply a harmonic analysis of timeseries (for satellite imagery data). It's based on this, but then I would like to optimize the performance. So instead of a single timeseries as input I've an array of 10000 timeseries as input. Even though I've tried to make use of some nice funct...
There are three scenarios only for when the sign up validations fail, so is there a better way of representing them rather than having 4 scenarios? I don't want to create a model folder so please don't suggest that. Is there a better way of representing this RSpec code on Rails using Capybara? feature 'Login' do befo...
I'm wondering if this code can be made more clear and fluent: using System; using System.Threading.Tasks; using Windows.Data.Json; using System.Collections.ObjectModel; using System.Net.Http; using System.Collections.Generic; using Newtonsoft.Json; using System.Linq; using eTest.Space.Log; using eTest.Space.Interface; ...
I work in a project based on C language. I want to read a file that contains two lines of numeric characters. Example 9 8 9 5456 32 2 45 34 98 5 I want to pass the elements of the second line into an array. As you saw the first line tell us how big needs to be the array. In the above example we want to create an arr...
I wrote a extender function to observableArray in knockout js. What I'm looking for is a way to extract the intersection records based on one property. This works well on smaller number of arrays, but shows pretty poor performance in larger arrays. I dont know if it is the observables that makes it slower? How would yo...
Each letter represent a category. Example the group with "M" Code is greater Than "I" and "C" group. "F" is the higher group Here is what I did but I wonder if there is a better way to do it. Private Function CompareCode(ByVal code As String, ByVal otherCode As String) As Boolean Dim orderedCode As New List(Of St...
I have posted before, and the code was very bulky and ugly. Here is the new and improved version. #RPG_TEST #Dennis Gordick #Brandon McCurry #10/21/2014 #file system fully works, if you don't understand how to use it ask Brandon """ Task list: allow player to leave game create different types of monsters improve shop ...
I have to share data between controllers. In this example I'm using an aside. This has the exact same functionality as a modal from Angular Bootstrap. I put the aside in my service so I can close it from another controller. The problem is that I have to share the complete scope / object in the service so i can share t...
I wrote a mediocre Tic Tac Toe game. Take a look. # Tic-Tac-Toe # Plays the game of tic-tac-toe against a human opponent # global constants X = "X" O = "O" EMPTY = " " TIE = "TIE" NUM_SQUARES = 9 def display_instruct(): """Display game instructions.""" print( """ Welcome to the greatest intel...
I'm not really even sure if this counts as a game. There is so little code, but it works. It is a game where you have to guess the computers number, and it tells you how many times you took to get it right. I kind of want feedback, and not ways to improve the code. I want to know ways to improve my future projects and ...
See the previous iteration: Natural merge sort in Java See the next iteration: Natural merge sort in Java - follow-up 2 Arrays.java package net.coderodde.util; /** * This class contains static methods implementing a natural merge sort * algorithm, which runs in time <tt>O(n log m)</tt>, where <tt>n</tt> is the * le...
I'm new to java and was just wondering if you could see anything wrong with my code. The program works but I have a feeling it's not the right way to do it. public class ShoppingItem { private String ItemName; private double ItemPrice; private int ItemQty; public ShoppingItem() { ItemName = "Fruit"; ...
I'm not sure if a Markov Chain generator is the proper term for this, really all it does is create the chain, it doesn't generate any text from it. The code is below, and I'd appreciate any feedback: bad practices, code smells, poor naming, anything at all really. module Main where import Data.List(find, delete) type ...
I have made my own MinHeap in Java. I would like to get review comments on the same. package heap.minheap; public class MinHeap { private int[] heap; private int size; private int maxSize; private static final int FRONT = 1; public MinHeap(int maxSize){ this.heap = new int[maxSize+1]; heap[0] = Integer.MIN_V...
I just yesterday started learning some Java. I wrote this piece and got some help from @Simon André Forsberg to refine it some. I added a few things since. It's super-simple but I just want to make sure I have a few concepts down before I move on to more complex things. Any constructive criticism is appreciated! import...
The below code takes an incoming sequence of objects, checks each object's type and then yields the object in a specific order. This is all taking place in an active pattern. As I am still new to F#, I would like to know if there is a better or more efficient way of accomplishing this task. type ArticleObj = ...
I have an application that is using MVC5 with C# and Razor Engine. This view displays a huge table: <table class="table table-bordered" id="pendingTable"> <thead> <tr> <th>Actions</th> <th>Order Status</th> <th>Order Details</th> <th>Order Date</th> ...
I have a created small program that prints a sequence of prime numbers. Based on the origin code in here. How can I improve this code? #include <iostream> template <std::size_t p, std::size_t i> struct Run { static const bool mValue = ((p % i) && Run<p, i - 1>::mValue); }; template <std::size_t p> struct Run<p,...
I aim to improve my PHP OOP skills and made a simple calculator. Visitors can choose 2 numbers and a prefix, so they can add, subtract, divide and so forth. The output is the sum. The good thing is it's working, but is it also clean coding? Also, is it wise to use the switch statement in a function? I hope to get some ...
Is there a better way to insert after a node in a linked list? Currently I go through the node from the head of the list and find the node that has the value pos. If the node is not null at the end of the search then we found the position, so we do the insert. void insert_after(List& list, int pos, int value) { Nod...
I have extended this class http://wiki.unity3d.com/index.php/CSharpMessenger_Extended to accept strings containing wildcards as eventTypes, therefore I am able to write things like Messenger.AddListener("*", () => Console.WriteLine("woohoo, generic handler")); But I am highly concerned about the performance of this im...
Linq's AsParallel() call would be my normal way of doing something like this, but Rust hasn't stolen that just yet. This method has obvious shortcomings, but I'm still sort of hoping for it to shave off a little time by engaging a second core. How can I achieve this less terribly? use std::num::Float; use std::sync::Fu...
Problem H (Longest Natural Successors): Two consecutive integers are natural successors if the second is the successor of the first in the sequence of natural numbers (1 and 2 are natural successors). Write a program that reads a number N followed by N integers, and then prints the length of the longest sequence...
The question was: Create an algorithm to check if two strings differ by one character. This wasn't my interview, so I tried to understand the question. Options: just compare the chars one by one, I assume the lower case and uppercase isn't the same. compare the chars in any given order meaning "tube" and "bute" are ...
I have two interfaces. Entity for updates. Drawable for rendering. They both have two interface methods. One that is called every frame, one every second. Entity.java public interface Entity { public void updatePerFrame (); public void updatePerSecond (); } Drawable.java public interface Drawable { public ...
The question was: Write a function that calculates the root of a given number. Answer A = I wrote it for integers. just run up to half of the number Answer B+C = are for double, using Newton's law. I just implemented this in C#. They all work and were tested.Please comment me about anything from not well written co...
My attempt at writing code to input values of arbitrary bitlength based on a bytearray in Factor. Any comments on the correctness or style would be appreciated. USING: kernel locals accessors math sequences math.bitwise ; TUPLE: bitreader bytearray curpos curbit ; : <bitreader> ( bytearray -- bitreader ) 0 0 bitreader...