instruction stringlengths 71 71.9k |
|---|
I have taken the critiques from the original post and tried to refactor. I used int.TryParse and that cleaned up quite nicely. What can I further improve on?
Edit: (Guess a number between 1 and 100 (revision 2))
//Program.cs
class Program
{
static void Main(string[] args)
{
//RunTheGame game = new RunTh... |
I am currently attempting to make some code more maintainable for a research project I am working on. I am definitely looking to create some more functions, and potentially create a general class to conduct such data calculations.
The code works, however, I am new to Python, and was wondering if someone could review my... |
Hoping to get feedback on how this program could be written in the most pythonic way. Also welcome any criticisms of styling as I know this is not in accordance with pep-8
from collections import namedtuple
a = namedtuple('assignment', 'weight scores')
def average(scores:list):
'''average a list of scores'''
re... |
This is actually a follow-up question of Yet another Pascal triangle in Python written in functional programming pattern, which is put on hold for posting broken code.
Again, this is my implementation of a Pascal program, which is used to print an n-order Pascal triangle. I write it to familiarize myself with Python's ... |
Azure Service Fabric uses DataContract serialization, which is a total disaster – it violates LSP (wiki) - see all those KnownTypeAttribute things, making framework development basically impossible.
I made the following class be a parent of all ValueObject to convince Service Fabric actually consume Binary serializatio... |
Here is a simple script that I am using to ping 50 sites at a time and check if they are up or not. If not, save the down time with error in MongoDB.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from urllib.request import urlopen, Request
from threading import Thread
from time import sleep, time
import datetime
impor... |
I have been doing a brilliant course on coursera based on the book "The Elements of Computing Systems: Building a Modern Computer from First Principles" by Simon Schocken and Noam Nisan.
You can find the specification for the Hack Machine Language and the Hack Assembly Language here.
In essence, you are given a text fi... |
After researching for an hour regarding SOLID Principles, I tried to do it myself. Please note that most of these codes were from the ideas of others.
I created a simple program which returns specific value from array, depends on what you choose.
public interface IArrayPerformer
{
int GetAnswer(int[]arr);
}
public... |
I am trying to upload a CSV file to a database which has around 800,000 rows. I am able to do this on my server with the following specs:
RAM: 4GB
Rows: 800,000
Time taken: 305 seconds
Usage: 15% RAM
Database: Postgres (Amazon RDS)
My upload code looks like this:
public function handle()
{
set_time_limit ... |
I am a complete beginner in C and I have started learning it by implementing binary trees. So have implemented a basic k-d-Tree. I provide two structs and two methods for comparing values on different axis.
typedef struct Point2D {
double x;
double y;
} Point2D;
int x_comparator(const void *v1, const void *v2)... |
I have an array which represent the item purchases of a customer, and computed the items subtotal in this logic:
function getSubtotal(arr) {
let total = 0.00;
arr.forEach(function(i) {
total += (i.qty * i.price)
});
return total; // 1274.21
}
And yes of course I get the correct result, but is there any ef... |
I am using following code to maintain some static information. The problem I see with it is that, if the information retrieved using GeKeysFromCache is modified without using lock keyword it may lead to exceptions in a multithreaded environment. Is there a way to improve this implementation?
public class CacheHelper
{
... |
I am new to using Classes and Objects, and as such thought i would edit a previous Tic Tac Toe game i created, this time using Classes. I found it easier using entirely public (Class?) variables (ie, ClassName.Variable). This way any variable can be accessed from anywhere, making utilising said variables much easier ac... |
I made this application that runs fine, but I feel the code is sloppy as there are many if statements. I'm a beginner so I'm not sure how to improve it, at least not without messing everything up. Any suggestions?
#!/usr/bin/ruby
require 'thor'
require 'json'
class ListTrends < Thor
desc "list_trends json", "list ... |
I'm currently working on a library that provides a mathematical interface for different operations. Operations like solving an equation or calculate derivatives of a function. With a recent update in the requirements, I have to include Scalar and Complex numbers, as well as Vectors and Matrices. With this second part, ... |
In answering this question, it seemed to me that it would be nice to have a runtime expandable Sieve of Eratosthenes. This is my implementation of that notion.
Design
I've created a class named Sieve which has two member functions:
unsigned Sieve::expand(unsigned upperlimit);
This expands the existing sieve up to the... |
I made a Snake game in Python 3 with pygame. Please do critique it as much as possible.
IMPORTANT NOTE: I updated the code at 3:30 3/23
# main.py
# [My Name]
import pygame
from pygame.locals import *
from vector import *
import better_exceptions
import random
import colr
import sys
SCREENSIZE = (1664, 960)
CELLSIZE = ... |
A sorting algorithm i have written.
Pros
- Gives each element a position once.
- Few comparisons needed.
Cons
- For certain sets of data, large amount of extra storage is needed.
- Only works with integers.
The main reason i post the algorithm here is to learn if it already exists or not. From the research i have don... |
Given a string, write a program to find the first non repeated character in the string. Assume that the given string only contains ASCII chars. Examples can be found in the test cases below.
code.js
'use strict';
module.exports = input => {
if (typeof input !== 'string') {
throw new TypeError(`Expected a st... |
I am quite new to Rust and this is my first library written in it. It's an article date extractor heavily inspired by the original Python library as well as its Haskell port.
It is fairly small and most of the logic was taken from the Python library. I want to make sure my Rust code is idiomatic.
This is extract_date.r... |
From K&R:
Extend atof to handle scientific notation of the form
123.45e-6
where a floating-point number may be followed by e or E and an optionally
signed exponent.
I only added the part that handles the scientific notation. It compiles and works fine. I think it's way too long and could be shortened. I also d... |
I made a simple program to generate fractal tree using PATH object of SVG. Any suggestions?
import math
from random import randint
# const - upper limit for randint
s = 10
"""Simple fractal tree using SVG and recursion.
Usage:
Create Root object bt Branch(x1=400, y1=800, x2=400, y2=600, color=60, size=35)
x... |
Somewhat recently I encountered an issue where my projects were simply taking to long to run. A lot of my macro work comes down to taking multiple tables (generally formatted in the same way) and joining together these tables based on specific users. This led to instances of loops that would loop over one table nearly ... |
I have a few resources set in my class – coins, diamonds, hearts, enum of these resources names, and method for increasing specified resource. I want to make single "Increase" method for all resources that wouldn't have switch statement. Sort of single-line not overloaded "generic" method independently on which propert... |
It's a march madness simulator for the final 4!!!
Please be as critical as you can :)
# March Madness Program
import random
from bs4 import BeautifulSoup
import urllib3
import re
import time
def getTeams():
""" Get team data """
website = 'http://www.ncaa.com/rankings/basketball-men/d1'
siteData = urllib3... |
Previous Question (Initial Level Optimization) : Excel 'big' data processing with vlookups
Code Purpose: Recalculate 25 columns of 500,000 rows each based on new information (provided by a different macro). Before the previous thread it took 28 hours to run, now it takes 8, my goal is under 3.
Notes
We plan on trans... |
Topic is about a LoB web application written in C# for ASP.Net Core. We're following the blue book DDD architecture. We're using SimpleInjector as dependency injection container. Every request opens a new injection scope and implicitly a UnitOfWork and a database transaction which is committed/completed when the respon... |
I'm working through a problem I have with Excel VBA. I have two object classes. Class clsLoadStep stores three copies of class clsLoad objects. Class clsLoad simply stores a value and a string stating where that value came from. One clsLoad stores a max value and another a min value. My problem comes to read/write acce... |
Greg Beech says here that he asks C# candidates to produce a formula that calculates PI Given that Pi can be estimated using the function \$4 * (1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \dots)\$.
I'm far from C# interview ready, but I like the challenge. Here is my attempt at the formula. Let me know if there is a... |
I put my code below to ask you for a review and ask you if this can be considered a good and clean code?
The game works just fine, I have encountered one issue though - the Food condition to not to create new food on current snake position is not working, and to be honest with you - I have been trying to solve it, but ... |
I was required to implement the code to a spec file I was provided in Ruby. I was rejected with the message "The quality of your code isn't sufficient for this position". Can you please tell me what can be improved in order to achieve higher quality?
game_board_spec.rb (file provided)
require './game'
require './game_b... |
I have a react native component called "width". It has 3 width values which have associated <TextInput>s which map to the redux store as
{width:{width1: "somevalue", width2: "someValue", width3: "someValue"}}
I need to create an exact replica component but called thickness and it needs to map to the redux store with ... |
I am discussing with one of my peers about proper encapsulation. We had to write this code. One of the specifications is: "The Student object has to have a Grade object called finalGrade. Code hint: Grade finalGrade;"
This is my code
public class Student
{
private String firstName;
private String lastName;
privat... |
I have just finished coding a permission system for my game server but one method in the class is seeming to be very complicated, and maybe some people on this site can help me improve the method?
Let me walk you through the permission system, which will give you a better understanding of the question, and how you can ... |
I have a Python script that plays Airline Manager 2 (on Facebook) for me. So far it can depart flights and buy fuel when the price is good. I would like the program to also automatically plan maintenance for aircraft. The following code will only be run when a check is due (one of the four checks will have the value 0.... |
import random, os
HIGHSCORE_DATA = []
NUM_DIGITS = 1
MAX_GUESS = 10
if os.path.isfile('./highscore.txt'):
f = open("highscore.txt", "r")
highscore_data = f.readline().split(',')
HIGHSCORE_DATA = highscore_data[0], highscore_data[1]
def increment_difficulty(difficulty = 1):
global NUM_DIGITS
NUM_... |
I want to make a coffee machine class which can produce coffee with condiments I like, and the price of the final coffee can be easily calculated.
I chose decorator pattern in my design. I've tried making the fields private to follow the principle of making scope as small as possible, but when I implemented the concret... |
Further revision based on comments (Guess a number between 1 and 100 (revision 1)). Is there any issue with using DisplayBeginMessage in the ctor (¿constructor?) of GuessingGame? Is there any preference over the ternary
guess = _isHumanGuessing ? GetHumanInput() : GetComputerInput(lbound, ubound);
or this form
if (_is... |
Our site sends users transactional html emails. That content is then stored in a DB for retrieval when the user visits the mailbox section of our site.
The emails which get sent contain media queries in the header, which are lost as our system only pulls in the of the content.
This is why I need to convert at fixed w... |
I've written a function to convert an image into characters and colors for the windows console. At the moment the calculation takes about 13 seconds with a 700x700 pixel image but that time is undesirable especially when I plan on making the function more complex in order to account for character shapes.
What are some ... |
I've blatantly copied fejesjoco's solotion to this codegolf into Rust, and was hoping for some feedback.
Basically, it begins by generating a vector containing every possible 15-bit RGB color, and then randomizes it. In addition, a blank image buffer is created, and a 2-d vector is initialized to represent the image. T... |
I have implemented for-each as in jQuery, this is the code below,
var $ = (function(){
var obj = {};
return obj;
})();
$.each = function(collection,fn){
if(collection.constructor.name === 'Array'){
for(var i = 0; i < collection.length; i++){
fn.call(this,collection[i]);
}
... |
I have written some Assembly code for an assignment, that has me activating the outer bounds of a 7-segment display.
The toggle is every time there is a state change, so both when I flick a switch, and when the switch is returned.
The microcontroller I have programmed is an ATMega32.
How can I make this code more 'cris... |
I would really like to get some feedback on how you would improve my code's style, readability, and efficiency. I failed an interview recently and was unable to get any feedback so I thought I would try asking here. I have cleaned up the code a bit already based on advice from friends but would like to have more critic... |
I am new to ASP.NET and I just developed a simple online examination portal for learning. I used ADO.NET, MySQL and developed in VS 2010.
I have a login page in which the user can login and register for a new user. After successful login, the user is redirected to the question page and I fetch the first question from t... |
I coded a (more or less) simple Tetris game as an example for some of the other trainees in my company. Since I am used to my coding style I would like to have some other people to look over it and maybe give me some advices to improve the readability of the code.
Some of the class names in the code (such as actor) are... |
Currently I am working on a Receipt Printing Tabulation code in Java/Android.
StringBuilder textData2 = new StringBuilder();
StringBuilder textData3 = new StringBuilder();
StringBuilder textData4 = new StringBuilder();
StringBuilder textData5 = new StringBuilder();
StringBuilder textData6 = new StringBuilder();
And I ... |
I've built a Palindrome checker in JavaScript. It's fairly simple.
I'm still learning JS and am looking to learn.
So I would love hear ideas on how to improve the JavaScript in this. Like more efficient ways to resolve the task of checking for Palindrome.
Source code is below. Link to CodePen is her: http://codepen.io/... |
Couple of months ago I was asked to develop a console app to do the following:
Write an application that takes an array of ICharacterReader
interfaces, accesses them in parallel, and outputs a list of word
frequencies ordered by word count and then alphabetically, every 10
seconds.
For example, if the stream re... |
I made the following code to take two reports and compares them to show the end user elements which are missing from one of the reports so they can make the adjustments needed.
This is the main part of the process where the data within the two reports are processed and it's working with around 85K lines in one report... |
I have a small callback function which receives a comment in array like below:
$data[$count] = array(
'comment_id' => $comment['id'],
'comment_body' => $comment['message'],
'comment_author_id' => $comment['from']... |
I want to get the next character giving a position of a another character of a string in a dataframe. If we have browsed every character of a string I should go to the next line.
And to do so I have written the function bellow.
def get_char(df, y, z):
if z < len(df[0][y])-1:
return df[0][y][z+1]
elif z... |
I have the following given code after some refactoring:
public static void storePreferences() {
try {
Preferences.userRoot().exportSubtree(new FileOutputStream(ReleaseInfo.getAppFolder() + File.separator + SETTINGSFILENAME));
} catch (IOException e) {
e.printStackTrace();
} catch (BackingSto... |
So we're starting to use Typescript for a new project at work. Part of the application allows a user to retrieve their future availabilities (present/absent/possibly present), for planning purposes.
This is the get function of the service right now.
getMyAvailabilities(startDate: Moment, endDate : Moment): Observable<M... |
My console app needs to read several big CSV files to update its data, which are stored in a SQLite database. I am new to C# and would like to know if there are ways to improve this sample code I wrote to simulate the app flow.
What the code does:
The DataRequester asks a DataLoader object for data. For simplicity, her... |
On several occasions I had to use a fixed set of keys (constants in the sense of static final String) with some additional logic (grouping in different keySets). After some more or less lefthanded approaches with static final String constants, I learned the advantages of enum. Since everything is known from the start I... |
Background Information:
Here is an outline of the algorithm known as Forward Monte Carlo for pricing American options which is from the paper, "A Forward Monte Carlo Method for American Options Pricing" by Daniel Wei-Chung Miao and Yung-Hsin Lee.
Generate M paths of stock prices, where each path i = 1,...,M evolves ... |
Out of personal interest and as a learning exercise I've written a C# class (.NET 4) to perform encryption/decryption of a file along with some compression upon encryption. Most of my understanding of this has been based on web research so I'd like some feedback on coding style, optimizations and, if any cryptography e... |
All of these if conditions in the below method have similar pattern, Any ideas to come up with a common method to reduce the duplication in this method?
some case we want all the version, and in some case we want only specific version.
I tried with switch case.
public override Func<JObject, dynamic, string> VersionMeth... |
I am new to the code review area of Stack and welcome all positive criticism.
I would be grateful if someone could review my code below and let me know where I can improve or have gone wrong that I cannot see.
The only thing that I have left is to write the delete and would appreciate help in doing this is possible t... |
I'm using Codefights to improve my skills. This challenge is to change the number submitted as total minutes into the digital read out on a clock i.e. hh:mm and then add all the numbers to together. So h + h + m + m.
My code works and I've passed all the tests, but it duplicates the same process for variables I've name... |
I'm currently looking into the quickest way to sort an almost sorted array:
Given an array of \$n\$ elements, where each element is at most \$k\$ away
from its target position, devise an algorithm that sorts in \$O(n \log k)\$
time.
I've implemented a sorting function which "slides" through an input list, pushes ... |
In a project I decided to parse a file and create functions during compilation to speed up rendering of a payroll template. I had (or still have?) a hard time grasping macros in Elixir so I started experimenting in a smaller scale. This was the winner and it also worked out in the project:
defmodule Swapper do
defmod... |
I am working on a script to write an array formula to a large number of cells. I have a code that works, but is very slow. Any thoughts on how to speed it up? The end goal is to be able to quickly write an array formula to several cells. The problem is that each cell has a unique formula. So I couldn't think of a way t... |
The premise of the problem is that given an array of numbers, can you remove only one to make it a strictly increasing sequence?
[1, 1, 1, 2, 3] would be false because if you remove one of the 1s the array would still start off non-increasing because of the other two remaining 1s before it increased.
[1, 2, 3, 4, 99,... |
I'm a beginner in Python but I have tried to implement K-means algorithm in python and it's working... but it's too slow... Instead of few seconds I can spend hours to finish it and I don't know why... something it's wrong... Could anyone of you give me some advice please?
Code:
import math
from random import randint
f... |
I want to get the latest release of certain package. In order to do so I did this:
wget https://chromedriver.storage.googleapis.com/LATEST_RELEASE -O /tmp/chromedriver_release
wget http://chromedriver.storage.googleapis.com/`cat /tmp/chromedriver_release`/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip
Ther... |
There are two ciphers, Caesar and Vigenère, both with an encoder and a decoder. Both work with spaces and can be passed any case (the output will be always lowercased, though).
I'm a complete Haskell beginner and so my implementations are quite ugly and wordy. I'd welcome any help which would help me refactor the code,... |
I had a job interview one of the questions was the following
Given an api - you submit a name of a person and it gives back a sorted list of all the free time slots this person has. the list might be very long.
List<TimePeriod> GetTimesAvail(String person)
You are given list of people and I need to implement a functio... |
I was wondering if this implementation of generic list with iterator is correct. The code compiles and goes fine. What would you think shall I improve? (first time I post here, I'm scared).
I'm also concerned about the const correctness of the code.
Class node
#ifndef LIST_H_
#define LIST_H_
template<typename K>
class... |
After a few days of reading articles, watching videos and bugging my head around neural networks, I have finally managed to understand it just so I could write my own feed-forward implementation in C++.
It does have some scratch back-propagation functionality, but it needs further work (not done yet).
Here's my code, I... |
I am new to promises and although I am enjoying the simplicity after dealing with callback hell I am having some issues trying to chain them together as you can see by the mess below. So basically what I am trying to achieve is to run through the chain and if there are no duplicate people found then hit the catch and c... |
I have made a drag and drop todo list.
I would like to hear If there is anything better I can do about this code.
Here it is:
/*
* @param event A jQuery event that occurs when an .droppable is being dragged
*/
function dragStartHandler(event){
//e refers to a jQuery object
//that does not have dataTransfer prop... |
I have this script that i use to get all clients with their events, main thing here is that i need to return all clients that have some events in specific periods and also i need to show clients that don't have events, so for example if i have group of 10 clients, and in that group 5 clients have some events, i need to... |
I wrote a fighting game. My code is rough. I would appreciate constructive and critical feedback please. The goal is to become a better programmer/developer.
(I wrote this using 2 Files - The Main Game File & Then a Character File):
pyfight_characters.py
import math
import random
class Berserker(object):
MAX_h... |
Is this a good Singleton implementation? Is there anything I should be aware of? If so, how can it be improved?
template <class T>
class Singleton
{
public:
static T& getInstance()
{
static T instance;
return instance;
}
protected:
Singleton() {}
~Singleton() {}
private:
Single... |
I'm having fun with shared pointers in a splay tree. Please let me know what I can do about code readability, and if you have any tips on speeding up my code, let know about that too (however, I am aware of unique_ptr and will implement that next; this is for practice).
*edit: I removed keys from the node class (remnan... |
I am developing a feature where the user has to request for invitation if he/she wants to sign up on the site. When the request is accepted by the admin, the user gets to sign up, otherwise it shows them an error saying they are not invited at this time, and saves a email so we can follow up with him/her. To be generic... |
I'm trying to calculate speed between consecutive timepoints given data that is in a '.csv' file with the following columns: "Time Elapsed", "x", and "y". The ultimate goal is to get the data into a format where I can plot "Time Elapsed" vs. "speed"
I'm fairly sure that my implementation is doing what I want, but it's ... |
I made a new version of this which was actually not behaving correctly, because it showed duplicated values, it just didn't add them again, this is the link to that program, someone point at correctly I think that the problem didn't state that student should use an ArrayList, but an Array, so I made this program again ... |
I am working to solve this HackerRank puzzle: Hash Tables: Ransom Note
The premise is that if I am given a string like this:
give one grand today
I can find a match for each of the words in the following string, but I cannot use the same word more than once:
give me one grand today night
My code looks like this:
... |
So, I have my code here:
import turtle
class fractal:
"""A class containing methods that will replicate
various fractals.
Attributes:
num: An integer representing the number of iterations
t: A turtle graphics object imported from Turtle.py
"""
def __init__(self, num, t=turtle.Tur... |
struct __fifo_node_t {
void *next;
};
typedef struct __fifo_node_t fifo_node_t;
struct __fifo_list_t {
void *next;
void *tail;
};
typedef struct __fifo_list_t fifo_list_t;
static inline void __fifo_list_push(fifo_list_t *head, fifo_node_t *node)
{
fifo_node_t *prev;
node->next... |
I have implemented a queue data structure using linked list in C#. I have also associated my implementation with unit tests. Is this implementation correct? Any suggestion?
namespace QueueDataStructure
{
internal class Node
{
internal int value;
internal Node next;
}
public class Que... |
This helper class is supposed to validate the user input from a text based wifi login form.
The entire process is basically this:
I use the create_voucher function of this API passing voucher_duration to set the amount of time for which the voucher is going to be valid and $this->clean['name']." ".$this->clean['surname... |
Recently, I read a article about work stealing queue Job System 2.0: Lock-Free Work Stealing – Part 3: Going lock-free, and this is my c++11 naive implementation based on my understand of c++11 memory order model. This works on x86 , as x86 has a strong memory model, is there any issue running on other architecture (w... |
I made a hacky version of a chrome extension to compliment a weekly literary/arts publication. The extension helps me curate links from my publication's readers since there's only so much I can curate and read/watch.
Users sign in through google and can share the link of the opened tab to me.
I'm new to programming. A... |
following application:
Users can join Rooms. A Gameroom inherits from Room and has a queue where Users can queue for a game. If enough people queue they get thrown into a game lobby. Lobby also inherits from Room. Rooms implement chat functionality which should be used in Gamerooms and Lobbies aswell.
Right now I am pa... |
I am a beginner when it comes to cryptography and OpenSSL. I have written a short wrapper of some functions in OpenSSL as well as a test of this wrapper, copied below.
Specifically, this code is intended to be used as a means of encrypting and decrypting data using either RSA or AES. This code is also meant to abstract... |
I want to know if there is a better way to modify a 3 bit chunks of any of 5 variables, 4 are int16 and 1 is int8.
for example:
int16 leds1 = 0b0100000000100101;
//color white=111
put_color_white_in_offset_of_9_bits_Rotuine_without_modifying_other_bits();
leds1 = 0b0100111000100101;
//leds1 old value: 0b01000000001001... |
This is a library I wrote to enable task-based multithreading. It allows execution of task graphs with arbitrary dependencies. Dependencies are represented as atomic counters. Under the covers, the task graph is executed using fibers, which in turn, are run on a pool of worker threads (one thread per CPU core). This al... |
Is there any way to make this code run faster. I have to compare values in a text file which is written in the format:
1 1.12345
2 0.12345
3 3.45678...
The values are in billions and the code takes weeks to run. As far as I can see, the calculation (subtraction in my case) is the heavy step.
a=open("output.txt","w")
... |
I have solved the Ransom Note
challenge on HackerRank using JavaScript / ECMAScript 6. The challenge goes like this:
A kidnapper wrote a ransom note but is worried it will be traced back to him. He found a magazine and wants to know if he can cut out whole words from it and use them to create an untraceable replica o... |
Half an year ago I posted an implementation of a URL encoder for review. I didn't have any time to work on it until recently, but now looking at my old code with new eyes I saw how unreadable the code was.
So here comes my second attempt. The "requirements" are the same:
no changes to the public API of the original e... |
In working on a review for Solve a set of "restricted" linear equations efficiently, I decided to reimplement from scratch using the method I proposed in my answer.
The application
I won't repeat the entire specification here, but in a nutshell, this program is intended to solve a very restricted system of linear equat... |
I receive a list of links via http and I want to open them all in a new Firefox (or default browser) window as tabs; that is my script must not touch existing windows.
This is the best solution I could come up with:
from subprocess import call
links = GetListViaHTTP()
if len(links) == 1:
call(['firefox', '-new-wi... |
I have implemented the following two methods which are described in 1. and 2..
Is there another better simpler way to implements those methods?
A static method, nearestPoint , accepts an array of points (objects of type Point ) and one point (an object of type Point),
and returns that point in the array which is cl... |
The goal is to try and make an everlasting SESSION without too much or unnecessary scripting for updating of sessions. And at the same time to avoid session collision as session collisions could lead to 2 users trying to make use of the same session. That would not look pretty! And it does happen. Also for websites tha... |
The script tests a server rendering PDFs. The server is running as a Windows service.
The script does the following:
Prepare the test
configure server
export script variables to xml
copy input
Run the test with 4 paralel jobs
Gather logs and clean up after the test
Step 1.2. is needed bacause the tests might be st... |
Here's a class I made in java. It's pretty simple, the description of what it does is in the comment. I'd appreciate any feedback.
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* An unordered, duplicate-allowing collection of items that are added with a
* time-to-live, and will au... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.