instruction stringlengths 71 39k |
|---|
I have tried to simulate a cart (only partially completed). I just wanted to see how the code upto this point can be enhanced. I am trying to learn about the usage of directives.
Here I have used 2 directives:
msgpallette- to show the messages when something is added to the cart
item-container - to show each item in m... |
I have a very simple C program that continuously reads from a temperature sensor and displays the temperature on two 7-segment LEDs. Reading is simple, but to display the LEDs I need to write to 14 GPIO pins on every iteration. It gets real ugly.
I am running this program on an embedded device (BeagleBone Black), which... |
I have this code that requests the graph API from Facebook to respond with a shared count for a particular URL (could be multiple on the page). Graph returns a full number (135934) and I take that number and abbreviate it into more friendly numbers (135K). Basically I'm looking for any help on improving the code to be ... |
I need to optimize this code block below, this method converts a Datatable object to the Object that I am passing by parameter, in another words, this serializes the object, however I have to run this block 1 million times when reading data from the database, so this is the bottleneck of my application.
Obs: All my ob... |
This is an updated version of my previous Java program that asks the user for a sentence and then separates the words and then converts the sentence into Pig Latin. My previous program was working, but there was some tweeking that needed to be done which I did after getting positive feedback. Apparently, my loop in the... |
There was a Tweet from @ExcelEasy earlier this week, that linked to this article, to which I replied with a little challenge:
@ExcelEasy well done! #Challenge: make a more #OOP one without using the form's default/global instance! #becausewhynot
Of course I wouldn't just leave it at that, so here's my own implementat... |
Previous question was a little portion of the mailQueue.
I finished the MailQueue, which has the ability to start and stop itself. I also implemented some more threads for sending when the load becomes greater. This is because we do send at some points over the 15000 mail in a short time. The last MailQueue did need 2h... |
This question is a follow up of Calculate min/max values for signed or unsigned integral number with any valid number of bits (up to 64)
I was answering the question Given two int values, return the one closer to 10, and I indicated that something like the following snippet of code could be a different approach for s... |
I'm a beginner in Java and I tried to create a program that will perform basic arithmetic operations on binary numbers.
BinaryOperations class:
package binaryoperations;
import java.io.IOException;
import static java.lang.System.in;
import java.util.Scanner;
public class BinaryOperations {
public static void main... |
I'm new to iOS development and also Swift. I'm working on a project consisting of a menu that leads to my various experimentations with the iOS SDK.
I've written the menu titles and segueIdentifiers in a plist and I'm populating an array of NavigationItem in viewDidLoad().
Is the following code idiomatic, particularly ... |
I have written an implementation of Mitchell's best candidate algorithm. Mitchell’s best-candidate algorithm generates a new random sample by creating k candidate samples and picking the best of k. Here the “best” sample is defined as the sample that is farthest away from previous samples. The algorithm approximates Po... |
I have a class called FirmwareFile which represents and Intel HEX format file. The file is constructed with the name, build time and build date, at a later point file data is retrieved from the database (another class handles this) and is passed in with the setData(byte[] data) method.
After the data is set, the method... |
I've been reading up on OOP concepts such as: polymorphism, inheritance and encapsulation and would like to know if I am even close to using these concepts correctly.
interface Canine
{
public function bark();
public function howl();
}
interface Feline
{
public function chase();
}
interface Mammal
{
c... |
After I've discussed pointer semantics with Loki Astari previously, I finally managed to code the TextureManager class using auto_pointers. But the problem is that I need to pass an SDL_Renderer object to my class' constructor as an auto_ptr. But the object I want to pass is a raw pointer.
How should I do it? Also, I'm... |
I have created a program to validate a Canadian S.I.N. using Luhn's Algorithm, and was wondering if there was any way to make it more efficient. From what i can tell, it is already extremely efficient, but any tips or advice will be greatly appreciated.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
... |
I am creating an automated test system (scope bloat - the original intent was a one-off bash automation of a particular test case that has turned into creating a system that will do many other things). I've done a few things similar to this, but somehow never got to using classes; everything was down at the functions l... |
I have this very easy functionality to find, toggle and remove classes from my html elements. The thing is that I find my self repeating the same code with just different name classes. I basically wrote the same method 9 times. I know that is you keep writing the same thing over and over again there is a more efficient... |
I'm new to JavaScript (and programming) and taking a course. I was tasked with creating a bubble sort on any array using JavaScript. Of course, since this is an algorithm challenge, no sort method allowed. After I wrote this, I looked around at other implementations of bubble sort. I only found one that used a similar ... |
I have added bidirectional Dijkstra's algorithm into my pathfinding "framework", and I would like to make good use of C++ programming idioms, eliminate all possible memory leaks, otherwise improve readability, but I need your help for that to happen.
That's what I have scrambled:
shortest_path.h:
#ifndef SHORTEST_PATH_... |
I recently started looking into CQRS when using Entity Framework and the impact it has had on my systems has been overwhelming.
I implemented the following patterns described in these blog posts:
Query implementation
Command implementation
I have implemented these with Autofac as dependency injection, and Entity Fram... |
Previously, I use to always navigate through the $parent $scopes in order to send or change data from one Controller into/in another. I then created my own ScopeFactory as a way to storing each Controllers $scope and then getting those scopes from other Controllers.
Having not experienced any problems with using this m... |
I am a self-taught programmer. I decided to learn design patterns by reading about them, and then coming up with their implementation in PHP. I know that learning would be virtually impossible without code review.
I will be grateful if you could review my implementation of the Memento design pattern and point to any sh... |
This program is a random password generator. It asks the user how many chars they want their password to be and how many passwords it should generate.
I used the rand() and srand() methods to generate random letters.
I used dynamic allocation to create a char array based on user input. The comment line is where I trie... |
The open source project I work on uses Antlr4 pretty heavily, but I don't know much about it. I thought I would use April's Community Challenge as an opportunity to learn something about grammars, lexers, and parsers.
My calculator only handles integer multiplication, division, addition, and subtraction, but it does ha... |
I am learning C++ and I decided to implement a Directed and UnDirected graph. (I haven't learned how to do inheritance yet, so they are distinct classes.) I have not handled any error cases (i.e. trying to remove a vertex that doesn't exist.)
I am interested in any comments/criticisms of my approach.
#include <iostrea... |
The Cardshifter team has been working at "translating" a very complex Java class into JavaScript, to make it more accessible to somebody who would want to fork the game and make their own modification, which is an objective that's been close to our hearts since the very beginning (for the game to be very "moddable").
... |
I am using play framework with scala and here is a scenario on which I would like to have your opinion.
Let's say I have 2 custom exceptions that I can throw, which are EmailTaken and AuthFail. What I need to do here is, whenever any of these 2 exceptions happen, I need to return a json with 3 keys success, errorCode a... |
The Go Playground was boring so I decided to make a small application that throws me into the language. It basically queries the chatroom every second for new messages and displays them in the output pane (minus the bots their messages).
It's all new to me so any insight is welcome. One thing I've been particularly uns... |
I implemented the A* algorithm for pathfinding for a game of mine. The game uses hex rooms which are connected to each other by an int[] in the room class. Are there any pointers you can give me on my code?
public class Pathfinding
{
/// <summary>
/// Finds a path from one room to another using the ... |
I have some Python code that copies a table from a website using Selenium,to create a csv, but as I haven't used Selenium much, I have that irksome feeling in the back of my mind that there must be a better way. It's also quite a bit slower than I would like. Here's the relevant code:
# ...Navigate to proper page...
t... |
I want a homegrown version of C++11's std::thread. My motivation is to avoid manual memory management of the arguments passed to the thread function. I'm restricted to C++98. I want better type safety than what's available in the POSIX and Win32 thread APIs.
Two notes:
I can't think of a way to avoid a heap allocation... |
I wrote couple classes that calculate winner, winning hand and winning hands rank (straight, flush, fullhouse etc.). I searched for something similar, but only found posts where five cards are used, but in a holdem there are cards 7 cards and have to choose best 5 of them.
How it works:
You pass List<Card> cards to H... |
For positive integer x let define function F(x) = 1 * (1! + x) + 2 * (2! + x) + .. + x * (x! + x).
"k!" means factorial: k! = 1 * 2 * .. * k
Chef wants to calculate F(p1) + F(p2) + ... + F(pn).
As answer could be large, help him, calculate value modulo m.
Input
First line contains two integers n and m.
Next line con... |
I have a number of objects of a type Workplace that exist in a hierarchy that is given by some properties (Department, CostCenter, Group and Station of the type); there is no data structure that represents the hierarchy as such. Above the explicitly given hierarchy levels, an additional Root level is implied that is un... |
This is my basic C# calculator; I'm sure there is much that can be improved. This design is based on Bjarne Stroustrup's C++ calculator, a purposely be-bugged version of which can be found at his website.
enum Operators
{
Addition, Subtraction, Multiplication, Division, Modulo
}
static class ExtensionMethods
{
... |
parse_client = None
store_client = None
def init_client():
global parse_client
global store_client
// ... some codes
factory = ClientFactory(config)
parse_client = factory.getJdParseClient()
store_client = factory.getJdStoreClient()
def has_jd(jd_url):
jd_id = parse_client.parseJdId(jd... |
I am new here and learning Laravel 5 on my own. I want to get reviewed on the following routes.php code.
My question are:
Have I made any mistakes by doing this? If yes, then what could be the possible solution?
Have I followed the proper convention?
Do I need to optimize my code? If yes, then how do I optimize it?
... |
I'm new to PDO, so I was wondering if you guys could check over my PDO code for efficiency (and if the PHP can be improved)
public function ValidateUser($username = '', $password = '')
{
$prefix = "SELECT ";
$type = 'COUNT(id)';
$suffix = " FROM users WHERE username = :username LIMIT 1";
if($grabUser = ... |
I am writing a routine to calculate median using the minimum of the numbers and then changing the value of the minimum to a large value outside the range of numbers (assuming you know the nature of the numbers). I know I could use many other proven techniques, but have chosen to play around with this one.
I don't see ... |
I decided that it would be nice to write some code to draw a cloud of points.
Of course my first thought was to draw some random points but the result is not cloud-ish, it is well... random.
In the end I decided to use the Mitchell random points algoritmh generating pretty good results:
Blue = Random
Red = Cloud (Mich... |
I am looking for a elegant solution to this. I am new to Spring framework. I have a method:
public String getStringProperty(String property) {
Object value = SomeWrapper.getPropertyValue(property);
return (value != null) ? String.valueOf(value) : "";
}
The immediate upstream method is:
public Strin... |
This is my brief summary of Pyglet: it's a powerful, efficient, high-tech cage. But once you're in there, once you call pyglet.app.run(), it's all over - you can't go back. Thus, there is this huge initialization process that you must split up into as many separate pieces as you can or you'll get lost.
I tried to split... |
This is one of my first takes on Java, coming mainly from Matlab I found I had many things to learn.
The code will try to convert a number into an array of ones and zeros and then do the opposite returning you the original number (or at least something very close to it, as it is hard to return the exact number). It is ... |
I am a Haskell beginner. Here is my function to find prime factors of a number
primes = 2:takePrimes [3, 5 ..]
where takePrimes (x:xs) = let smallPrimes = untilRoot x primes
in if 0 `notElem` (map (mod x) smallPrimes)
then x:takePrimes xs
... |
I'm using a DataContext to insert an object. Currently it's working, but I'm feeling things could be done better. Method is called from UI (Using Caliburn Micro Binding). IsBusy is a property used by the UI (Xceed Extended WPF Toolkit) to display a wait message.
Repository inherits from DataContext (using Entity Code F... |
I saw a nice generic stack implemented in C, in Stanford's CS107 Programming Paradigms course, so I tried to rewrite it in C#:
public unsafe static class NativeMemory
{
[DllImport("msvcrt.dll", EntryPoint = "memcpy", CallingConvention = CallingConvention.Cdecl, SetLastError = false)]
public static extern void*... |
Just a self challenge/fun thing.
I have a scene where the player picks a character, of course it works but I'm repeating myself an awful lot. I would appreciate any formatting suggestions and making it more streamlined in general.
Champion ranger = new Champion.Generator(
"Legolas' Lover", // name
... |
I'm working on a webapp that I use gulp to build. It uses useref to gather and concatenate/uglify the assets used in the HTML files.
In this case, as things are getting concatenated, it doesn't make much sense to use a framework like RequireJS to separate out my modules, and I think browserify is overkill as I don't ne... |
I made a simple set of functions that returns a greeting based on the current time, the user's timezone offset, and the user's level. For context I wrote this as a part of a larger chat bot application. I am not sure if there is a better way to handle the if/elif/else blocks in both functions.
Please let me know of pl... |
I think that the following code isn't really nice. I can't see however another way (other than a switch statement) to better implement this. Especially since I don't think replacing this with the strategy pattern for instance is a better way.
String status;
if(userHasContact&&contactHasUser) {
status = "HAS_CONTACT... |
I was recently at a programming competition. One of the problems was to determine whether two line segments are parallel, intersect, or do not intersect.
For all of the test cases I ran, my solution worked. However, when I submitted it, it was rejected (but no other information was given). I suspect there is either som... |
I have completed a VHDL 16-bit parity generator and I would like to know if I have programmed it correctly. I have compiled it 10 times and worked out any bugs that it found. I was finally able to compile it successfully. My problem is that I am trying to run a timing simulation to make sure it will work correctly but ... |
I am rewriting Peter Norvig's Python regex golf solver in C++. I had originally planned to post the whole thing here at once when I was finished, but:
This program takes double the time of the Python version on the driver input shown in main(). And that's just to complete all the functions I have so far: in half the t... |
This is my model:
class Subject(Document):
uri = StringField(required=True,unique=True)
resources = EmbeddedDocumentListField('Resource')
date_modified = DateTimeField(default=datetime.datetime.now)
meta = {
'indexes': [
{'fields': ['uri'], 'unique': True},
],
}
class R... |
After having reviewed this question, I recalled that I haven't solved Project Euler's problem 54. So I did it, however, I fount out that implementing the exact rules is rather tricky.
So I implemented just the necessary part. It works, problem solved, so let's call my code working. However, there are pairs of cards (no... |
So I'm in the process of creating a simple Contract Bridge in Java. I will be using JavaFX to create the GUI component of the program. For right now I am trying to tackle writing each of the classes needed to run the game.
If you're unfamiliar with bridge the short explanation is as follows: you start with a 52 card de... |
This solves Sudoku by using backtracking. Accepts one grid where 0 represents a missing number. Here are some examples: http://norvig.com/easy50.txt
The program is quite slow. Input is stdin.
import Data.Char (isDigit)
import Data.List (intersperse, delete)
printGrid [] = []
printGrid x = (intersperse ' ' $ take 9 x) ... |
In the spirit of April 2015 Community Challenge, I have created two Java-based calculators with the following codebase layout:
An interface Calculeightor for describing how values can be appended into a stream and then reduced to a single result given an operator.
An enum Operator to represent the operators.
The GUI i... |
In the spirit of April 2015 Community Challenge, I have created two Java-based calculators with the following codebase layout:
An interface Calculeightor for describing how values can be appended into a stream and then reduced to a single result given an operator.
An enum Operator to represent the operators.
The GUI i... |
Firstly I am not a professional programmer and I am just learning C#, MVC and Web Development.
Much of what I describe here is self taught and comes from lots of googling and posts on Stack Overflow. I have adopted the approach outlined in Mike Brind's recent blog post
Can some of you with more experience than me crit... |
"""
Provides a way to caculate the area of an arbitrary
n-sided irregular polygon.
"""
import doctest
import math
def heron(a,b,c):
"""
Uses the heron formula to calculate the area
of the triangle where `a`,`b` and `c` are the side
lengths.
>>> heron(3, 4, 5)
6.0
>>> heron(7, 10, 5).__roun... |
Here is my code:
def odd_numbers_from(n):
if n % 2 == 0:
n = n + 1
while True:
yield n
n = n + 2
def takeWhile(pred, lst):
for item in lst:
if pred(item):
yield item
else:
break
def takePrimes(iterator):
for n in iterator:
if n... |
I have this piece of code which I know can be improved greatly, but I simply don't know how. I've been googling for a little while, but truth to be told, I'm not really sure what I should be even looking for.
As you can see the code is very straight forward. Different classes have attributes of a same name, but I can'... |
I have an SDL_Wrapper which is working perfectly (it is not broken)! Please suggest how I could improve performance, and how I could make my unique_ptr(s) dispose automatically.
So far, I call my class like this:
CWindow window = std::make_unique<CWindowWrap>("title", 0, 0, 140, 100, 0)
Is it the best way to do it? W... |
I’ve written a basic implementation of Breakout using Java 8 & Slick (~400 lines of code). Please let me know of any design/OOP improvements that can be made (any improvements in general are welcome, but I’m specifically looking for design & OOP improvements).
Game - the main class
package breakout;
import org.newdawn... |
For the below given problem from this assignment:
Q4. In passing, Ben also cryptically comments, "By testing the signs of the endpoints of the intervals, it is possible to break mul_interval into nine cases, only one of which requires more than two multiplications." Write a fast multiplication function using Ben's sug... |
I started with Haskell some months ago, but didn't really use it since then. As a simple training I implemented Conways game of life. What/How could it be improved?
module Main where
import Control.Monad.State
data CellState = Dead | Alive deriving (Eq)
data Cell = Cell CellState Int deriving (Eq)
data Row = Row [Cel... |
I know that this could be made much more efficient, I am just not sure as to how.
This program ignores the 100 dollar denomination to cut computation time in half and just starts totalcombinations at 1 to compensate. I'm fairly certain that there is some way that this could be made both more efficient and readable. If ... |
I have written some code for alpha beta for Chess programming and not sure completely if that is the correct way to do it. Can someone please tell me if I implemented the alpha_beta properly?
public class Minimax{
private boolean side;
public static int depth;
public Minimax(boolean inputSide, int inputDep... |
I am trying to get the maximum value out of this array.
There is a long rope of length totalLength at its each unit length some ropes are tied pointing in upper and lower directions with their length given. I am saving them in upper and lower arrays. Question is if we light up the front end how much time it will take t... |
I have read a few SO threads to implement remember_me functionality.
Steps I have followed:
User clicks on login button and if passes client side validation, it goes to php Login page.
First time
function storeCookie($row,$connection)
{
$user_id = $row['UserID'];
$token = uniqid($user_id,TRUE);
... |
I've been using a thread pool that I wrote using Windows threads for a while and I've decided to update it to use std::threads. I'm looking for some feedback on how this could be improved in terms of (in order of importance) reliability, usability, and performance.
Header
#pragma once
#include <queue>
#include <threa... |
The following is a shopping cart class. The initial version of this was pulled from a production application. Since then it has changed a bit but I'd love to hear your feedback on this.
Due to having multiple files, the full source can be found here.
Cart.php
<?php
namespace maldoinc\utils\shopping;
use maldoinc\util... |
I have written a Sudoku app for Ruby. This is my first attempt at coding in Ruby so there are sure to be lots of way to optimise it or make it more efficient.
To summarise the code: it takes an input file of a Sudoku problem in the format comma separated row, column, value of the initial Sudoku problem.
This is stored ... |
In my competition, I was to create a game that asked at least 5 easy questions, and up to ten hard questions, summing fifteen questions. Please review my code, especially how I formatted it with the class. ALL criticism is appreciated.
#SkillsUSA Computer Programming Problem Number One - Math Challenge
import random
i... |
I would appreciate if you could give me some advice about the code below. I am a student learning PHP programming and programming fundamentals. I have learned a lot from Stack Overflow but there are lot of things I don't know. I would like a senior developer's opinion on improving my codes overall quality.
This is a pa... |
Let me start off by saying that I have several years of experience in Java, but now I need to learn Python, so I decided to make a calculator as it also is a community challenge.
Please review the code looking for beginner mistakes, though I do intend the code to look professional. This is my first real program made in... |
First Python script, so my code is pretty laughable. Sensitive information has been redacted. One thing that I'd like to point out is that there is an inconsistent use of '' and "". This is an old habit that I really need to break.
import sys, os
import praw
import time
import sqlite3
import re
import requests
import ... |
I am writing, as review, Modern C++ compliant versions of sorting algorithms I previously have seen. This post is about selection sort, and selection sort only.
Whilst selection sort is rather simple, straightforward, and not the best in terms of performance, I wanted to know if there were any ways to improve upon my i... |
I want to implement some graph algorithms for learning purposes (e.g BFS, DFS, Karger's min-cut algo) and before diving into them I want to make sure I have got the graph representation right (using an adjacency list). I want to keep things minimum to exactly what I need to implement these algorithms on undirected grap... |
I am making a to-do tree application (Earlybird) in Python that will show checkable tasks/subtasks in a tree view. It includes higher-level groups of tasks grouped into blocks (e.g., Work block, Home block) that do not have checkboxes.
It looks like this:
This is is my first application using Python, and object-orien... |
Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error. If the score is between 0.0 and 1.0, print a grade using the following table:
Score | Grade
-------+------
>= 0.9 | A
>= 0.8 | B
>= 0.7 | C
>= 0.6 | D
< 0.6 | F
If the user enters a value out of range, print a su... |
This is a kind of follow up to my previous sort implementation question with specific questions to insertion sort, and Modern C++ idioms. Anybody seeing this post can see how I got to this modern equivalent of a typical C-style sort you can find everywhere on the web by visiting my prior sorting review.
I am writing, a... |
Here is my insertion method for a doubly linked list. It works, but passing two parameters for the method seems cumbersome. Can anyone suggest a cleaner approach than this?
LinkedList list = new LinkedList();
Link link1 = new Link("A");
list.insert(list.head,link1);
Link link2 = new Link("B");
list.i... |
I am working on an interview question in which I need to find the largest palindrome made from the product of two 3-digit numbers. Here is the question.
public class PalindromeThreeDigits {
public static void main(String[] args) {
int value = 0;
for(int i = 100;i <=999;i++) {
for(int j ... |
Oftentimes, I write small little dialogs or forms without a UI builder. I usually find myself having a lot of "container" panel variables that just float around. I found this leads to time-wasting experiences.
Where did I put that BorderLayout panel?
Oh right, here it is.
Wait, never mind. That one has a GridLayout.
... |
In order for Rubberduck to be able to "recognize" the built-in VBA functions, procedures and objects, I added yet another constructor parameter to my Declaration class:
public Declaration(QualifiedMemberName qualifiedName, string parentScope,
string identifierName, string asTypeName, bool isSelfAssigned, bool isWit... |
I have a script to load a range of number. This range of number is only 200 lengths. However, it has a change function. When the start number is change, the the end number will try to find its range again.
The whole of code is working fine. However, it gives me a time lag (sometime get crash) on each change.
Can anyon... |
There seem to be several questions floating around Stackexchange regarding how to take a python regular expression list the matching instances. This problem is a bit different because 1) I'm need to start off with a domain-specific regex system, not just the standard python regex, and 2) the possible matches for any g... |
In a far away dystopian world, the measure of the quality of a person’s life is the numbers of likes he gets for an article about their life. For a person to stay alive, he has to acquire at least L number of likes before D days pass.
People in this world employ various techniques to increase the number of likes. One ... |
I have a Map<String, List<Object>> multiFieldMap and I need to iterate over its value set and add the value to multiFieldsList:
public List<Object> fetchMultiFieldsList() {
List<Object> multiFieldsList = new ArrayList<>();
for (Entry<String, List<Object>> entry : multiFieldMap.entrySet()) {
String entit... |
I'm working on a search utility that searches through source files. It's only the beginning of the project. It lacks a lot of features, but a backbone of the project works and it would be great if you can take a look at it.
path, keyword = ARGV if ARGV.length == 2
if ARGV.length != 2
puts "Not enough argumetns. Type... |
I have written a water cooler example in which the consumer drinks from the water cooler until it's empty and when it gets empty the producer fills it up. The consumers wait until it's filled up and then start drinking again. Can you please review?
Producer
package com.par.consumer.producer;
import java.util.List;
pu... |
public final class DistanceCalculator {
public static void main(String args[]) {
System.out.println("distance="
+ calculateDistance(
"Khreschatyk Street 1, Kyiv, Kyiv city",
"Peremohy Avenue 22, Kyiv, Kyiv city"
)
); //distance=6266
Sy... |
My intention is to store the user's last login date and time when he logs in to the web page. I pass his username and password to the stored procedure to check whether is it correct or not! I believe it'll be fine to store his last login date and time if any record matches.
USE [DBNAME]
GO
/****** Object: StoredProced... |
I wrote the following code below to extract the least significant bit (LSB) of each pixel and store it into a byte[] array. I was wondering if Java has a more efficient way to do this?
Right now, I am looping over every pixel, extracting the LSB, and updating the current byte by shifting it to the left and adding the L... |
Just wanted to post this here to see if anyone has any critiques of my code, if I'm drawing the background image most efficiently, or if I'm doing anything which could benefit from obvious improvements.
RectangleMover
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Im... |
I am working my way through some exercises, using Java, to learn about programming. I have just finished the following Code Golf challenge:
Here is some example input, so I can explain what the problem is:
((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo)))
Think of this line of text as a topographic map of some mounta... |
Recently as part of a job interview I was given the following coding task:
Attached is a gzipped text file of about 100,000 English words. Write a
Python, C or C++ program that finds all the anagrams of the word
"empires" that exist in the words file (just a reminder: an anagram is
the result of rearranging the ... |
This code consumes a lot of CPU. Could you tell me where it is possible to improve the code or change the way rendering?
Or it is possible to reduce the overhead of calculations? If you are using only 1 point when drawing the load on the CPU is not changed! Load 50-60%
Ubuntu 15.04 / intel® Core ™ i5-3230M CPU @ 2.60GH... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.