instruction stringlengths 71 71.9k |
|---|
Is there a better way to handle this ClassNotFoundException ?
private Class<?> getClass(String value)
{
Class<?> columnClass = null;
try
{
columnClass = Class.forName(StringUtils.trim(value));
}
catch (ClassNotFoundException ex)
{
if (value.contains("double") || value.contains("D... |
I'm trying to build an app which crawls a website to find the emails that it has and prints them. I also want to allow the user to type "false" into the console when they want to skip the website (maybe the user has already found 2 emails and doesn't need any more).
Is the way I'm approaching this the best way? If not... |
This is my second jQuery script: a universal tooltip for my entire web page. It took me a couple of days to research and make it work.
Now, I need help from the experts to optimize my newbie code.
This is one of the ways I can show the tooltip:
<a class="tooltip" data-tooltip="this is the text for my tooltip" href="#">... |
Two trees are called isomorphic if one of them can be obtained from other by a series of flips, i.e. by swapping left and right children of a number of nodes. Any number of nodes at any level can have their children swapped.
Looking for code-review, optimizations and best practices
This class appears to be threadsafe... |
I just jumped to a new project, which uses the active record pattern. It's a subscription service website.
I have the following User object that extends a framework specific ORM object:
class User extends ORM {
public function isSubscriber()
{
$activeSubscription = $this->subscriptions->where('activ... |
I have a class created for the sole purpose is to help handle files. The class holds a path (folder) that contains a single file at a time. Some extra properties to this class are: age of a file and max file size. I'm a very procedural style coder, and I'm trying to shift my work to a more OOP and eventually end up wi... |
I'm using this code to bring my phone numbers in a consistent format.
Desired: +(country code)phone number
Possible patterns:
01721234567 -> change to desired pattern
00491234567 -> change to desired pattern
+4912345678 -> do nothing, already desired pattern
This is what I use:
String number = allContactNumbers.get... |
Please be brutal and let me know what you think of the code below, if written at an interview.
Problem:
Given an index k, return the kth row of the Pascal's triangle.
For example, given k = 3, return [1,3,3,1].
Time it took:
25 minutes (perfectly working solution)
Space Complexity:
O(K)
Time Complexity:
O(N2)?
... |
I have previeous;y posted my php code with way to many nested blocks I hope I fixed it right.
I'd also like some tips on my OOP, as this is new to me.
class event {
//Builds the event in html
public function renderEvent($Array) {
echo "</p>";
echo "<p>";
if ($Array['ad']) {
e... |
I have taken a look at several answered questions on Stack Overflow about jQuery's new (since 1.9.1 upgrade)
.on('click','',function(){}
and that you need to delegate. However, in each one, it just provides the solution to fix the issue, but I need a bit more finest or an explanation to why it must be done like that.
... |
I've been trying to expand my programming horizons, and have entered the world of grammars and parsing, which I'm brand new to. I have been improving a little implementation of Dijkstra's shunting yard algorithm that currently handles negatives and parentheses correctly (which took a bit of work). I'm well aware that I... |
I have code that is used for retrieving and storing conversation for a chat application. I found this from a tutorial and tweak it a little bit. This script works fine but my concern is if it's the standard way. Can somebody please check this for me if to see if it's deprecated or a bad practice? And is there any other... |
I have an Account, User and Group model. All User and Group records belong to an Account, so it is possible for both users and groups to be related to various accounts.
Basically, I have some really hacky, pieced together SQL queries that lookup all Account records related to a given User or Group record through variou... |
I need to further simplify this solution to auto-format a text-box field intended only for the user to enter their college Grade Point Average (GPA). Here is my code:
<label for="collegeGPA">GPA:</label>
<input type="text" name="collegeGPA" id="collegeGPA" maxlength="4" style="width:45px;" onpaste="return false;" autoc... |
Given a complete binary tree returns the following format (Parent ( leftchild (leftchild, rightchild), rightchild(leftchild,rightchild) ). Looking for code review, optimizations and best practices.
public final class PreOrderList {
private TreeNode root;
/**
* Constructs a binary tree in order of elemen... |
I am trying to create a library of my own which contains (among others), a class called Point. As the name suggests, it is intended to encapsulate a point represented in 2D space. This is what I've come up with:
package geom;
import static java.lang.Math.atan2;
import static java.lang.Math.cos;
import static java.lang... |
I have a method that finds 3 numbers in an array that add up to a desired number.
public static void threeSum(int[] arr, int sum) {
quicksort(arr, 0, arr.length - 1);
for (int i = 0; i < arr.length - 2; i++) {
for (int j = 1; j < arr.length - 1; j++) {
for (int k = arr.length - 1; k > j; k--... |
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
public class LargestPalindrome{
static ArrayList<String> palinList=new ArrayList<String>();
public static void splitString(){
String actualString="ABCBAHELLOHOWRACECARAREYOUILOVEUEVOLIIAMAIDOINGGOOD";
for(int... |
I have implemented a ThreadPoolExecutor that will run a Consumer<T> only on elements not already consumed. This code uses Java 8.
The background behind this is that I scan a directory every x time units for which files are present, I must maintain a 100% accuracy on finding files and other mechanisms such as JNotify or... |
I have a model Collection which has a many to many relation to a model Item.
I want to be able to add or remove items to this collection using Django Rest Framework.
Option1 - make an action:
class CollectionViewSet(viewsets.ModelViewSet):
queryset = Collection.objects.all()
serializer_class = CollectionSeriali... |
How could I reduce the length of my functions restricting them to max 10 lines?
Other comments are welcome on the code in general.
import config_files
import math
from datetime import datetime
import importlib
import sys
from scan_twittosphere import *
from tweets import *
import nltk
debugger = importlib.import_module... |
#!/usr/bin/env python
from os import environ, path, name as os_name, getuid
from sys import exit
from fileinput import input
update_environ = lambda: environ.update(dict(env.split('=')
for env in
open('/etc/environment', 'r').readlines()... |
I have a completed application which I'm trying to write unit tests for (Yeah I know, talk about bad practices)
I have the following class here
public class UserManagementService : IUserManagementService
{
private static readonly IUserDao userDao = DataAccess.UserDao;
private static readonly ILog Log = LogM... |
I'm doing VBA macros and need to use Arrays of values extensively. After the below help from @TonyDallimore on Stack Overflow, I've decided to use nested variant arrays.
VBA chrashes when trying to execute generated sub
I use multidimensional, jagged arrays to SELECT data from DB's and efficiently perform calculations ... |
I have the below enum. I need to get the description by code. It is working but can it be improved still?
public enum Maps {
COLOR_RED("ABC", "abc description");
private final String code;
private final String description;
private static Map<String, String> mMap;
private Maps(String code, String... |
I need to use SQL extensively in VBA macros that I write. Since the DB is from our enterprise application, I use vendor's library for this.
I generate dynamic queries, sometimes with many JOINs and UNIONs, and the queries can be quite complex.
The procedure that I coded screams "I'm open to SQL injection". The macros u... |
I got the point of PEP8 naming conventions, docstrings going inside methods, catching exceptions and printing them, not doing import *. will correct them.
I need a bit of advice on the robustness and flexibility for the following code. Do you find the variable names descriptive and the flow of code optimal?
import co... |
So the two functions below both send emails via PHPMailer but both hold different messages (which use different data from the db). I was just wondering (as I plan to use PHPMailer more) a way to consolidate these functions into perhaps a sendMail() function which could handle different data variables and messages, whil... |
Problem Statement
Input
The input begins with the number t of test cases in a single line
(t<=10). In each of the next t lines there are two numbers m and n (1
<= m <= n <= 1000000000, n-m<=100000) separated by a space.
Output
For every test case print all prime numbers p such that m <= p <= n,
one number per line, te... |
I have some concerns on my refactoring for the data layer in my current Project. Just for a small info, I am currently building a CRM as "training JEE application". But enough of talk, let's talk code!
IService.java: (7 lines, 160 bytes)
public interface IService<T> {
public void update(T update);
public void d... |
I am implementing merge sort in Java and I have a performance problem in this method:
private static void marge(int[] source, int[] buffer, int startingIndex, int count) {
int index1 = startingIndex;
int index2 = startingIndex + count / 2;
int maxIndex1 = index2;
int maxIndex2 = star... |
Let's say that I have a method that makes an HTTP request that will take a long time to finish. While that's happening the UI is not updating because I'm doing it in the UI's thread.
One solution is to:
Show the "Loading" animation.
Start the HTTP request on a thread.
On the completion callback stop the "Loading" ani... |
I usually take my school code as a playground to mess around with things. I was given a bunch of premade hash functions and had to test their output and find when they reach a specific lower range. Since the functions all have the same structure, I made a check function that uses a function pointer parameter(I think th... |
I have the following method in a web service class. I'm a little unhappy about the big block of new JProperty(...) calls in the for loop. Is there a way to simplify that?
public string UserCatalog(string numericSessionId, JObject incomingRequestJson)
{
JObject json = new JObject();
JObject returningJs... |
I made a search method because I want to use binary data like PNG files. The point of this is to be able to find strings like IEND in a PNG file. I think it works properly. Any improvements/fixes would be appreciated.
public static int findString(byte[] in, byte[] find) {
boolean done = false;
for(int i... |
What is the best method/practice to keep, let's say, over 3,000 lines of code organized for readability?
What kind of NO-NOs in regards to coding habits should I get rid of before they become bad habits?
Inversely what kind of good coding habits should I be picking up?
Any glaringly obvious mistakes? Any helpful links... |
I wrote a small utility function that divides a total into n parts in the ratio given in load_list. Numbers in each part should be positive integers. It supports an optional min_num argument that, when specified, puts at least min_num in each of the n parts before distributing the rest. Please review.
def reduce_ratio... |
Here's a program to take a bitfield like 7 and decompose it into the flags [1,2,4].
Ignore that the algorithm for doing this doesn't use bit shifting/is stupid.
Problems: it seems like I have to have the bithelp function for the sole purpose of calling the other ones, since getFlags and findPower both need to be given ... |
I'm looking for code-review, optimization and best practices. Also verifying complexity to be O(E) time and O(V+E) space complexity.
final class NodeClone<T> {
private final T item;
NodeClone(T item) {
this.item = item;
}
public T getItem() {
return item;
}
}
final class EdgeClone... |
I have been trying to get as close to SRP in my code as possible. I have a situation where I need to log leads when interactions happen for a contact. A lead may be created or updated. There are three different states that I would like to set leads to.
Active - new interested interactions causes active lead to be crea... |
Here is my single parse code for splitting a std::string on a char into a std::vector<std::string>:
#include <iostream>
#include <vector>
std::vector<std::string> split_uri(std::string, unsigned chr='/');
int main() {
std::vector<std::string> uri_v = split_uri(uri, '/');
for (auto elem: uri_v)
std::... |
I want to split a list using another list which contains the lengths of each split.
E.g:
>>> print list(split_by_lengths(list('abcdefg'), [2,1]))
... [['a', 'b'], ['c'], ['d', 'e', 'f', 'g']]
>>> print list(split_by_lengths(list('abcdefg'), [2,2]))
... [['a', 'b'], ['c', 'd'], ['e', 'f', 'g']]
>>> print list(split_... |
I am working on some code and I have come across the following:
private int getPosition() {
List<IDescriptor> fragmentDescriptors = new ArrayList<IDescriptor>(mDescriptors);
int position = -1;
for (IDescriptor fragmentDescriptor : fragmentDescriptors) {
if (fragmentDescriptor instanceof VideoD... |
I'm using an API which returns text in the following format:
#start
#p 09060 20131010
#p 09180 AK
#p 01001 19110212982
#end
#start
#p 09060 20131110
#p 09180 AB
#p 01001 12110212982
#end
I'm converting this to a list of objects:
var result = data.match(/#start[\s\S]+?#end/ig).map(function(v){
var lines = v.split(... |
I've been following along a blog post on JavaScript inheritance. I wanted to slightly adapt this and try to write something more like I've seen in Backbone (extend method). See I set about it, and run into problems. Then I came across this SO post. It was so much simpler. So after some minor tweaks to that I set about ... |
import java.util.Collections;//for frequency of words
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Arrays;
/**
Output--In phrase count duplicate substrings or strings or with space
psuedo code---
1.splt phrase by particu... |
I made a command line Hacker News reader in Ruby that pulls the latest 10 stories from HN and allows the user to cycle through them or open them with Launchy. This was to play around with Ruby and APIs.
The data that I pulled from HN was messy, like an array of hashes with arrays and hashes inside. I feel like my code ... |
I have a web page with a set of icons that are grey by default:
If a user clicks one, it toggles green (.toggleClass('green')):
If a user clicks a green one, it toggles back to grey (.removeClass('green')).
Only one icon can be green at any given time, so if you have a green icon and you click a grey icon, the icon t... |
Learn You a Haskell gives this exercise:
Here's a problem that combines tuples and list comprehensions: which
right triangle that has integers for all sides and all sides equal to
or smaller than 10 has a perimeter of 24? First, let's try generating
all triangles with sides equal to or smaller than 10:
Here's m... |
I have written a numbers to text challenge for some people in my organisation to practice their Python skills. I am an economist working with pandas, but I am trying to teach them some stuff about general programming as well. I am not a trained computer scientist or anything, so what I know is just what I have picked u... |
I want to create a small web widget, you can see it at this jsfiddle. Right now it is organized by placing lists within lists and content within those lists. All of this is supposed to sit, as a bar, fixed to the bottom of your window, over the current website. I want to know, is my list set up too cumbersome, and at t... |
I have to deal with a really ugly looking response I get back from a particular device. The string represents a table. Each section of the string represents the form:
["id", "date_time", "path", "type","duration","count", "rate"]
Which as an example looks like:
"1,2014-4-3 10:1:10,somerandompath,some/screwy!stringwith... |
I want to include about 10 jQuery plugins in a project but do so in a better way than just pasting them into a JS file.
I want to capture various device data and other data passed from the server-side (in a HTML meta tag) and I want some of this to decide which jQuery scripts to run - or none in the case of some device... |
Schedule is a simple class that could be used in program to manage when a task should be repeated (a todo list, for example). Its constructor requires a start date and an optional end date, then type of repetition (daily, weekly or monthly) has to be set. If weekly is chosen, then the days of weeks when repetition occu... |
I have started using BEM syntax for my HTML and CSS. I got the idea from Harry Roberts' blog post "MindBEMding – getting your head 'round BEM syntax".
Please note I am not looking to use this for HTML email, it is just an example. Am I going too low in my element structures?
<div class="wrapper">
<!-- EMAIL ONE --... |
I'm hoping to get some feedback on how to improve and optimise a program I wrote which takes three values as input (via the terminal) and uses them in the quadratic formula.
I'm aware this is mostly micro-optimisation, but any advice whatsoever would be much appreciated.
public class Quadratic_Equations {
static Sc... |
I'm upgrading my project from YouTube's V2 API to their V3 API. I'm also taking the time to upgrade to Jasmine 2.0 since I already need to look at my test cases.
Here's a couple of test cases and the corresponding code. Am I doing 'it' correctly? Maybe I should have a spy?
define([
'common/model/youTubeV3API'
], f... |
I have an XML document that contains "ads" and includes information about the department name, image name, link to URL, and alt text. I have a PHP function that accepts two arguments, department name and the number of "ads" to display. It reads through the entire XML document, and stores the information in arrays if ... |
I needed a variadic function to pack and unpack bits into integer types. This is my first attempt:
template<typename T>
constexpr T pack(bool b)
{
return b;
}
template<typename T, typename... Types>
constexpr T pack(bool b, Types... args)
{
return (b << sizeof...(Types)) | pack<T>(args...);
}
template<typenam... |
I have two ModelForms that are the same, except that one of them has its form layout built in a view and one has a submit button. These are pretty long and I have a ton of duplicate code. I have tried subclassing, but I don't understand it well enough to make it work right. I end up unable to override things.
class Sur... |
I'm writing a simple Pong game. I have a method bounce() that makes everything run: the ball, the paddles, score etc. and it uses 12 arguments: 3 counters, 2 paddles, ball, 5 textures, 1 color. I'm a beginner to programming and only have couple months college experience so I don't know if that's too much. In classes, I... |
I have put together a small wrapper class to simplify creating parameterized ADODB queries with VB6/VBA. At this point I'm keeping things simple, so it's only supporting input parameters and from what I've tested it seems to work exactly as intended.
The main reason for writing this, is because creating SQL Injection -... |
I'm not a JavaScript programmer. I have next to no idea about "what's out there" of libraries and so on. Therefore it's not unlikely that the referred to Windows HTML Application (HTA) code here, which is a mix of HTML5, CSS3 and JScript 5.6, may be incompatible with such libraries, common naming conventions, whatever,... |
I have a bunch of functions that return strings based upon score ranges. Then I have another function that sums everything up and assigns a numeric weight.
@property
def risk_status(self):
""" This function assigns numeric weight to risks. It returns an over all integer score. """
# Build a string of risks, ie... |
I have Article and Category, with a has_and_belongs_to_many relation between the two.
I want to use Article.in_categories(category_ids) to get any Article that is in any of the category_ids passed, and I want to handle the possibility of category_ids being nil in a way that all Article items are returned. The category_... |
Problem Statement
Given \$n\$ digits and \$m\$ indices \$x\$ from \$1. \ldots,n\$, calculate the
difference \$b_y = a_x - a_y\$ for all indices \$y \; (y < x)\$. Then, calculate \$B1\$,
the sum of all \$b_y\$ which are greater than \$0\$ and \$B2\$,
the sum of all \$b_y\$ which are less than \$0\$. The answer ... |
After taking some great advice on this question, I'm hoping for some more feedback on my quadratic expression calculator.
This is my code as stands:
public class Quadratic_Equations {
private final static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
while (true) {
... |
Today, my project was to make a matrix in my web browser. It is really slow, so help with optimizing it would be nice. It runs slow on my PC, yet alone my iPod 4 which this is going to be for.
<html>
<head>
<title>Matrix</title>
<style type="text/css">
body {
background-color:black;
... |
I know there is a better way to store data. What is the most concise way to simplify this script?
from random import randint
from sys import exit
import os
os.system('clear')
print "Welcome to the dice rolling simulator!"
raw_input("Press enter to begin.")
total = 0
completed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
de... |
Please be brutal, and let me know how I've done on this problem, provided I coded it at an interview for a top tech firm.
Time it took me: 44 minutes
Worst case time complexity: O(n2)? Am I right?
Space Complexity: O(n)?
Problem:
A group of people stand before you arranged in rows and columns.
Looking from above, t... |
I have the following C++ interface (in Qt) for a tree node, inspired somewhat by Valve's implementation of a culling octree:
/**
* @brief Interface for a recursive tree node.
*/
class ITreeNode
{
public:
/**
* @brief Virtual destructor.
*/
virtual ~ITreeNode() {}
/**
* @brief Adds a child ... |
I'm trying to get a certain number of date ranges given a start date. Here's my code:
var startDate = new DateTime(2014, 1, 1);
var dates = new List<DateBlock>();
int counter = 0;
while(counter < 6)
{
if (startDate >= DateTime.UtcNow)
{
dates.Add(new DateBlock
{
StartDate = startDa... |
I want my socket class to be reviewed, including recommendations and optimizations.
Sokect.hpp
class Socket {
protected:
Socket(SOCKET s);
Socket();
SOCKET s_;
sockaddr_in sa_;
int* count_;
private:
static void StartSocket();
static void EndSocket()... |
I find myself using a lot of .find functions within what I'm developing. The reason being that I need to run this same function on a TON of different characters eventually, and the easiest way I could find to do this was make appropriate sections classes and wrap each character in their respective ID.
Is using .find a ... |
I am using Unity3D and I made a super simply pooling system to reuse a specific object. My only concern is I am not sure if I am doing it the best possible way. If I were doing this in C++ there would be a bunch of pointers and be passing pointers to the objects.
Now in C# I understand many things are hidden as pointer... |
When the app is run on an iPhone or simulator, tapping the screen spawns a dog class and displays an image of the dog.
I'd like comments, issues, whatever. Is this a decent first Objective-C project, and can others learn from it?
The code is meant to demonstrate Objective-C, Cocoa and UIKit.
Primary files in the projec... |
I'm new to C, and as an exercise I'm building 4 different factorial algorithm implementations and measuring their running time. I'm looking for this feedback, especially:
The implementation of the factorial algorithms. Can the they be improved? Is there something you would do different? Is something wrong?
The impleme... |
I am trying to make a linked list using 3 classes, however I cannot find ANY information online about it, and I can't seem to figure it out myself.
If you could please correct and explain what I am doing wrong, I would greatly appreciate it.
LinkTest.h:
#include <string>
class Test
{
public:
void get(int &, std::s... |
This post is a follow-up to Simple Pong game
I took the some advice from the previous post and I'm almost done with cleaning up the code. I didn't make any wrapper classes, because my game is already waaaay overkill for this assignment, but I did add more methods and fixed naming.
Are there any rules regarding method o... |
How can I make this matrix effect more like the matrix movie?
#include<stdlib.h>
#include<stdio.h>
int main()
{
srand((unsigned) time(0));
int i,j;
system("color 0a");
while(1)
{
i = rand() % 2;
j= rand() % 2;
if(j)
{
printf("%d ", i);
}
else
{
printf(" %d", i);
}
}
retu... |
Recently I built a map with custom markers (pins) and a sorting function to display each by type (Member, Supplier, Prospect, New Member).
The HTML (check boxes wired up with sort() function):
<input type="checkbox" value="Supplier" onclick="sort()" id="switch2" />
<label for="switch2">Suppliers</label>
T... |
We are following passive controller approach and when user clicks on submit, server side validations are fired. There are many other fields on the screen that needs to be validated.
I would like to get feedback about the following approach.
Is it ok to have validations in Presenter.
As there are many fields in UI, Per... |
I solved this a while ago. In the moment I solved it I was learning Scheme and, well, I still am. I'm not looking at the best solution (I searched for it and coded it already, in Python), what I want is to improve this code, maintaining the same (brute) approach, so I can learn some best practices and tips in Scheme. M... |
I am creating a class to be the end all defacto class for handling unit conversions. This is particularly difficult in my company's industry where imperial architectural strings are used as units. I wanted this class to be perfect in just about every way as it is the class that we will be giving our summer interns as t... |
I feel like there is room for improvement in the push/pop methods. Any suggestions?
#include <exception>
template <typename T>
class List
{
public:
List();
~List();
void PushBack(const T &data);
void PushFront(const T &data);
void Po... |
This is my first PHP script (although I like to think I'm a good general coder).
The script accepts a number from the user, uses it to generate a regular expression, and then returns all dictionary words that match that expression.
It's currently live here, and I'd appreciate any comments on style, security, best pr... |
Let's say I need to write a function that applies a function to each item in a List, and then appends it to an accumulator. When the List is empty, return the accumulator.
go :: [a] -> (a -> [b]) -> [b] -> [b]
go [] f acc = acc
go (x:xs) f acc = go xs f (acc ++ f x)
myFold :: [a] -> (a -> [b]) -> [b]
myFold as f = go ... |
Originally asked here: Dynamically call lambda based on stream input
The following version is based heavily on the answer provided by @iavr, though I hope that I have done enough more to make it worth reviewing again.
A way to clean parameters of all declarations:
template<typename Decorated>
struct CleanType
{
typ... |
I just spent almost one day to figure out the following code, which analyzes the output data from material science programs called VASP and Bader. As a Python beginner, I earnestly ask some aces to help me make this code more pythonic, or efficient. Because I know that although the code can run smoothly, it definitely ... |
The challenge is to reconstruct an n-digit number using the following information:
On each step, you choose an index x from 1 to n. For all indices y (y
< x), you calculate the difference by = ax - ay.
You then calculate B1 — sum of all by which are greater
than 0 and B2 — sum of all by which are less than 0.
The... |
The InputHandler class for my game detects key presses, turns each one into a GameAction, and raises an event:
public class InputHandler
{
public delegate void ActionListener(GameActions gameAction);
public event ActionListener ActionRequested;
private void ProcessKeyboard(KeyboardState keyboardState)
... |
I've written this class as an exercise for a synchronization construct to be used across multiple threads.
The intent is to have worker threads Increment() it, do some work, then finally Decrement()it.
Meanwhile, when a master thread decides to shut down the program, it signals the threads using a CancellationToken and... |
I have some code which is designed for the following purposes:
Implement a cache structure which stores cached elements, as well as a method for reloading those elements.
Ensure the new structure can use any type of IEnumerable to store the elements.
Implement a dynamic cache which inherits from the standard cache, as... |
I have been working with C++11 code that uses std::vector[] to store coordinates. Most often this code uses 2D or 3D but it occurred to me that it may be generally useful for n-dimensional Euclidean distance calculations.
Because these calculations are used within a simulation, they should be as fast as practical witho... |
I am generating a content bar with jQuery, that can be inserted into any webpage. It is a <ul> with two smaller lists within it. Those two minor lists have a header and a text box. The whole thing can be resized vertically, and each block within can be resized horizontally.
Is there a way to simplify the HTML and CSS?
... |
I have previously asked here for a review of my Pong game. Since then I have implemented most of the recommendations but I'm not sure I did so correctly, the result can be found on my github.
Would it be possible to get another review? Below is the whole source code of the game:
main.cpp
/*
* Pong game
* Author: Ch... |
This question is more-or-less code agnostic. Provided code analysis would be helpful though.
Background: I've never got along with logging too well - probably because I've never had a need to review the non-error level logs. I comply with logging practices on work projects, but I usually don't do any logging in persona... |
A few weeks ago I posted a code review of a linked list so I decided to implement bubble sort on my journey of learning C. Here is the referenced linked list library, though this isn't really what's being reviewed (feel free if you'd like!).
Linked lists seem inefficient for bubble sort as deletes and gets both have to... |
Recently I had a problem (not in C++) that required merging a number of sorted lists of values. This is effectively the generalised case of merging together two sorted lists. However, instead of merging them into one single list, the requirement was instead to effectively put them into "buckets" of like values. As an e... |
I am not happy with this code as I am sure there are better ways to do what I'm trying to achieve. I'm a beginner and I've used what I know to date to complete this.
import java.util.Random;
import java.util.Scanner;
public class SeventySix {
public static void main(String[] args) {
Scanner keyboard = n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.