instruction stringlengths 71 71.9k |
|---|
I'm looking to achieve a time format that looks like this: 2d 4h remaining; or 1h 36m remaining; or 35s remaining, etc. So that it only displays the two largest values of time (this is how Clash of Clans and some other mobile games format wait times.)
I would like to format the wait time value as simply 5h or 5h 0m dep... |
I wrote a dirty and ugly code to show in console how many bugs are left until the release of elementary codename Isis.
The code works but it's pretty inefficient. What it does is:
downloads the entire Launchpad site
writes it down to a temp file
scans for the appropriate lines in said file
stores the number of bugs st... |
I am new to JavaScript programming and would like to get your comments/input or corrections on this chunk of code. I have tried to emulate patterns from recognized GitHub projects but I still don't have good feel for what "good" NodeJS code looks like.
I have written a very simple HTTP routing framework that works diff... |
The following ActionScript code just downloads and attempts to parse some JSON from an API service. Inside the method I have defined a cleanUp() function, just to remove 2 event listeners.
I think these event listeners will be garbage collected anyway though, so is it worth it? I would prefer to just use 2 anonymous fu... |
I'm playing with unit-testing in Ruby. There is a situation that I don't know if is good enough or if I am doing the wrong abstraction.
I have two classes: Transaction and Account. An Account could have 0..* Transactions. The only constraint is shall not have duplicated transactions for an Account.
it "add a duplicated... |
I'm using Groovy to grab properties from a page and each of the properties are grouped into a specific type:
Groovy:
String headerImage = null
String sidebarImage = null
String footerImage = null
String mainVideo = null
String sidebarVideo = null
String overviewVideo = null
//Images
headerImage = properties["headerIm... |
I'm writing C# code to read and eventually parse VB6/VBA code modules. I have an interface like this:
/// <summary>
/// An abstraction that represents an object
/// that can read a code file and return its content.
/// </summary>
public interface ICodeFileReader
{
/// <summary>
/// Reads and returns the conten... |
I have never written a unit test and I am really new to C#. I am attempting to test a method, am I testing for the right things here?
The Method
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Reflection;
using Orlean.Properties;
namespace Orlean.Helpers
{
public... |
Given an undirected graph and a number m, determine if the graph can be colored with at most m colors such that no two adjacent vertices of the graph are colored with same color. Here coloring of a graph means assignment of colors to all vertices.
Special request to verify complexity:
Complexity:
Time:
\$O(EV^2)\$ :w... |
I have been using the pattern below for some time and it has worked well, but more than once I have almost bled my brain out of my ear trying to keep track of:
the recursion depth
the recursion path
I commented the line of the code where the information I would like to retain is generated:
//if recurse
What a... |
After finishing up finals, I wasn't really working on coding for a while. I decided to write a card game to get back into the programming scene. I'm just wondering if there's anything that I missed or could be improved upon.
import random
suit_choices = ("Diamonds", "Hearts", "Clubs", "Spades")
suit_picked = random.c... |
I was interested to know which words of the English language, when spelled backwards, are still valid words (e.g. "drawer", which when spelled backwards is "reward"), so I wrote a small program to go through a dictionary text file to search for them.
I don't know if there's a word to describe them, but because of the s... |
I'm writing a node.js application that involves handling clients based on their ID without any real way of confirming that the ID a client says it has is its actual ID. That is, it's possible for a client to tell the server it has an ID of foo even though it was assigned an ID of bar, thus being able to send and receiv... |
I have used jQuery AJAX for my development. Below I have added example code for AJAX request and response.
ajax.php
$queView = array();
$queView['time'] = 40;
$queView['name'] = "Level hard";
$queView ['noQuestions'] = 10;
$queView['queDetails'] .= "<h1>Some html content</h1>";
$queView['queDetails'] .= "<img src='ro... |
I made a fairly simple template engine (if I could call it that). Basically my server returns something like
string "This text should be [color:red;font-weight:bold; red and bold]"
Then on the client side I have my parser, for HTML in this case
function parse(str){
return str.replace(/\[(.+?) (.+?)\]/g,'<span styl... |
I'm trying to make a simple proxy server in Python using the socket library, mostly to understand how it works. I'm a noob both at programming and networking, so please be nice if my questions are totally dumb.
At the moment I've set up a proxy server which intercepts requests from the browser, prints them and sends b... |
I want to write my own program to search for a word in a sorted text file. In the text file each word is in one line. I want to write this myself because I did not find any simple program (without libraries such as boost) which can provide suggestion word which means a word with most similarity. Here is my code but I d... |
I am willing to switch to OOP concept, but before working on that I would like to know whether what I have working so far is OK, or if any major change is required?
For every form I create 3 files:
for front end html
a js file as a mediator between client and server
a server side php file which handles data services.
... |
I have implemented a quite long program in R and I have noticed that one block, concearning a backward model selection, is too slow and I would like to receive some suggestions in order to speed up all the program. Here is the code:
library(MASS)
df.Cars <- na.omit(Cars93[-57, -c(1,2,4,6,27)])
rownames(df.Cars) <- 1:82... |
I would like to ask for code review for my project related to sorting and search C# lists with IComparer on objects. I expect some design tips and how to make code more effective.
Job class:
class Job
{
public string Title { get; set; }
public int Salary { get; set; }
public string Category { get; set; }
... |
as I was reading the Git Internals in the Pro Git book, I decided to see what objects I need to create to have the short hash say something funny. To do this, I have written the following code:
messages = ['badcafe','deaddad','badbeef','feedbac']
possible_letters = string.ascii_lowercase + string.ascii_uppercase + ' '
... |
I'm just trying to master the art of using classes in PHP and have come across a concern.
For security reasons, I sometimes use two database connections in my application; one with read-only privileges and one with full read/write. Unfortunately, I wasn't really thinking about this when I started to build a few classes... |
This code is about finding Pythagorean triplets. I take a number as input, and find from 1 to that number, how many Pythagorean triplets exist.
Are there ways this can be optimized? It takes a lot of time, but actually doesn't only provide the output for no > 10000
import java.util.*;
import java.io.*;
public class S... |
Nothing more to add than the title. Looking for code review, optimizations and best practices.
public final class BaseAdder {
private BaseAdder() { }
/**
* Given two numbers and their bases, adds the number
* and returns the result in the same base.
*
* This code supports max-base 26.
... |
I've been playing around with functional programming for a while now and just started learning Clojure. So the problem I'm trying to solve is the following:
I have a tree-like hashmap of tasks where each task can include a number of tasks and each of those can include other tasks. The toy one I'm using for starters loo... |
I'm working on quite complicated scientific project.
I decided to use a configuration file for model description. However it was quite complicated to parse all strings after ConfigParser and convert every option to required objects, so I would like to avoid this long/boring code.
I wrote very simple parser which conver... |
How can I remove duplicated code?
It's hard to me because I use different service class and model each code.
public class AcrAccessAreaController extends BaseController {
@Autowired
private AcrAccessAreaService acrAccessAreaService;
@Req... |
The original code: Refactoring conditional statements among different classes
I am now doing it continually. I fixed a few part as mentioned.
public abstract class BaseService<T> {
protected Logger logger = Logger.getLogger(this.getClass());
protected static final String SAVE = "save";
public abstract Ma... |
In a Windows forms payroll application employing MVP pattern (for a small scale client) I'm planing user permission handling as follows (permission based) as basically its implementation should be less complicated and straightforward.
NOTE: System could be simultaneously used by few users (maximum 3) and the database i... |
After years of criticizing others, I've finally found the time and worked up the courage to polish up one of my bits of code and solicit criticisms of my own.
This is a simple dynamic-string library that I wrote for one of my old C projects (don't judge too harshly if you look into it -- it's a few years old, and I've ... |
I am using Backbone Marionette - I would like to set the user name and password if that passes the model validation method.
I am highly confused with that. Please show me a handy approach or correct me if I'm doing this wrong.
define(["backbone"], function(Backbone){
var LoginModel = Backbone.Model.extend({
... |
I have been playing with a new JavaScript module pattern to see what I can come up with. I think it's quite powerful and wanted to know if it is something people would find useful?
I'm looking for some advice on optimisation, or possible missing features.
Quick Example:
var a = function(){
this.propa = 'a';
}
var ... |
I am working on a Python/Django project which has turned into a JavaScript/jQuery project due to the amount of asynchronous functionality that I thought to add.
There is a JavaScript file which is doing everything for the JS side. I am a newbie in JavaScript/jQuery and am starting to think that this is going to becom... |
I just wanted to get an opinion on my dynamic-programming Haskell implementation of the solution to Project Euler problem 18.
The Problem:
By starting at the top of the triangle below and moving to adjacent
numbers on the row below, the maximum total from top to bottom is 23.
$$\begin{array}{ccc}
& & & \color{... |
I need the ulp method in Codename ONE, and since it isn't available there, I tried to come up with my own version. The code is completely written from scratch, based solely on the documentation of the java.lang.Math class.
Please ignore the @Override annotations. This is from a utility class I wrote to be able to use t... |
In a WinForms application I'm doing the password validation as follows:
When the user presses the OK button after entering username and password, an event will be fired and the listener in the presenter will then do the validation with the help of the Encryption class. It will basically compare the two hash values.
Use... |
I am currently trying to make a Walmart Scraper, where I have to scrape the title, link, image URL, price, category and subcategory of the product.
Now my approach is that I will collect seed pages for each department, like a link of USB drives from computer from electronics departments. Likewise that there are so many... |
I am porting an application from django 1.4.5 to django 1.6.1. I found that commit_on_success has been deprecated. Moreover I found specific incompatibilities when calling get_or_create from inside commit_on_success.
atomic is often mentioned as drop-in replacement for commit_on_success, but using atomic alone does not... |
I'm implementing the backtracking solving algorithm for a Sudoku in F#. I'm wondering if I could make my code better respect the functional programming paradigm or even just making it simpler/better.
let solve originalSudoku =
let sudoku = Array2D.copy originalSudoku
let isValidNumber (x,y) n =
let sq... |
This is a script (function) to be added to a bashrc. The purpose is to not actually remove files, but rather to send them to a trash folder for safe keeping. I was tired of deleting important files. Because files may have the same name, I chose to create subdirectories with the date and file name on them, for easy acce... |
I have to read a line of strings and split it for whitespace:
ArrayList<HashSet<String>> setOfStrings = new ArrayList<HashSet<String>>();
while ((currentLine = bufferedReader.readLine()) != null) {
String[] tokens = currentLine.split(" ");
for (int i = 0; i < tokens.length; i++) {
setOfStrings.a... |
Inspired by Tool for creating CodeReview questions.
This script generates a markdown document suitable for a CR question from a list of files. For each file it finds, it sends the following to stdout:
The relative path to the file, in bold.
The byte count and line count, in parentheses.
The contents of the file, inden... |
I'm trying to iterate through all the combinations of pairs of positive long integers in Java and testing the sum of their cubes to discover if it's a Fibonacci number. I'm currently doing this by using the value of the outer loop variable as the inner loop's upper limit, with the effect being that the outer loop runs ... |
This code is very long, and you need a separate method. How can I implement it?
I have 6 (x2) imageview buttons and 6 edittext.
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId())
{
case R.id.imageViewPlusSubEdit1:
if(editTextInputNameSubEdit1.... |
I have developed a generic HTTP functionality using Android Asynctask and Apache HTTP client. Please review the code and let me know if it is the right way of doing or there are other ways to achieve it.
Async class
public class HTTPAsyncTask extends AsyncTask<String, Void, String> {
private CallBack mCb;
Hash... |
I have just begun to work with OOP and I am converting my current project into OOP classes. I have a few questions about this User class.
class User {
private $db;
public function __construct($db, $utilities) {
$this->db = $db;
$this->utilities = $utilities;
}
function set_user($input)... |
I have written a logic part in my app. I'd like to learn best practices, so can you please check my class?
This class is a little too big in my opinion, but I have no idea what I should do now. I've pasted only the main class, but if you'd like to see anything related, please tell me.
This class is my logic in model la... |
I need your help in reviewing the following code. My main concern is dead-lock, but there might also be other issues.
The EventGenerator object is owned by a single thread that running the ThreadTask. Other threads might access EventGenerator public APIs to set/remove event handlers.
A few corner cases that I've thoug... |
I've read a lot of stuff about mixins, inheritance and such, and in the end I came up with this solution for extending a class with multiple mixins. I haven't seen this anywhere else...
var Classes = {}; // I keep all classes inside this objects, so I can do new Classes[obj_name]();
Classes.asA = function () {
var ... |
I wrote a basic binary tree in JS. Can anyone give me some feedback about my code?
I just want to know if this is the right approach, and how I can improve the tree. I am new to JavaScript and data structures.
function bst() {
this.root = null;
}
bst.prototype.insert = function( obj ){
if ( this.root == null... |
I have to read a String from console, so I used the tokenizer to split it and add each token in a position on arrayList, is there a way to improve the operation of split?
while ((currentLine = bufferedReader.readLine()) != null ) {
StringTokenizer string = new StringTokenizer(currentLine, " ");
... |
public class RunnableThreadPrimeNumber implements Runnable
{
private long startNum;
private long endNum;
private Thread t;
RunnableThreadPrimeNumber(long start , long end )
{
t = new Thread(this);
this.startNum = start;
this.endNum = end;
t.start();
}
public void run()
{... |
I want to simplify an if: .. else: .. construct:
def find_eulerian_tour(graph):
available_edges, path = initial_state(graph)
while incomplete(available_edges):
edge = propose_extension_edge(available_edges, path)
if extension_is_possible(edge):
extend_path(available_edges, path, edge... |
I wrote a script that does the following:
Run another script on the system
Filter the output to find lines that contain ALL of the given patterns
Pipe the output to a second script on the system
I feel like the way I did it is a dirty hack. I use a control character to join the arguments, and then replace them with /... |
I've previously posted a version of this code here:
MS Access VBA code to compare records in a table and combine data where necessary
To repeat what I'm looking for from my previous post:
Note I have written "Suspect there is a better way to do this" etc. in the comments of a line which I think is questionable, so if y... |
I am attempting to break down a Rebol View into a Forth style 'divide and conquer' word set, to optimize readability and organization, and to segregate the business logic from the view layout inner workings.
Business intelligence
Field
declaration
initialization
processing
Software intelligence
view layout
Is there... |
How can I improve this code with nested null check statements?
public class AcrCategoryService extends BaseActionService<AcrCategoryModel> {
@SuppressWarnings({ "rawtypes", "unchecked" })
public Map getCategoryList(String categoryCd, String categoryNm, String rgstTrgt) throws Exception{
Map mod... |
As part of a project I'm working on, I've implemented a class that encapsulates the syntax for a vb6/vba Dim statement.
Given a line of code, the Parse method uses a regular expression to match the keyword's syntax and extract the relevant parts.
As it stands there's no support for some valid syntaxes, the following ar... |
The following method is used in a call center application to display an approximation of remaining time. The call center telephone operator would inform the caller that they could perform their desired action (like, for example, place another order) after N time has elapsed. You'll note some arbitrary rules revolving a... |
<html>
<head>
<title>GPS Tracker</title>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="view/style.css">
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">/script>
<script type="text/javascript">
... |
I'm looking for a code review for my JavaScript code that checks if there is any memory leaks in data structures. Please include constructive criticism, as well as details on what I can do to make this code more efficient.
// memoryleak.js
// (C) 2014 Kyle Maune
// checks for memory leaks in data structs
MemoryLeak = ... |
Can you give me some idea how to optimize the switch statements, maybe a for or do while loop? Which is faster, switch or for/while loop?
public class CalculateTheValueOfE {
static long start1 = System.currentTimeMillis();
static int numberOfThread = 4;
private static int precision = 0;
private static ... |
My question is: Using C# and/or Linq, how can this existing code be improved to be more efficient? (My "Complex" example takes about 5 seconds to run, how to make it faster?)
What the code is actually doing: I want to get all unique combinations from choosing 1 number from each group of numbers.
However, I have added... |
[This is a follow-up question to: Displaying TimeSpan as largest interval (with units). The code listed here has been refactored since the original question was posed. Please note that the scope of this question is limited to the declaration and implementation of the listed method.]
The method listed below is used in a... |
After playing around with Java 8 and Generics for some time, I came across an idea while reading some posts about Apple's new programming language Swift.
Swift has AOP-like methods for properties (willSet and didSet) and I thought of creating something similar in Java with the help of the new functional interfaces of J... |
I am trying to learn kTurtle (slightly different from Logo) so that I can help my daughter learn to write code. I have decided that I would write a program that would play Tic-Tac-Toe with a user. So far, all I have is the Game board, and I make it more than just a single board to add to the intensity of my learning.... |
For minimalist sake, let's say I have an image of a button in a game and on the screen.
When you left-click the button, it will disappear. If you right-click (anything), the button will reappear.
I'm trying to improve my code, so if you see anything that is redundant or that can be done cleaner, it'd be awesome if you ... |
The goal is to convert a hex string to a byte array with the following requirements:
\$O(1)\$ additional space apart from input and output.
\$O(n)\$ runtime
This mostly just prohibits creating a new string with a 0 prepended to avoid having to deal with odd strings.
private static byte[] ConvertHexToBytes(string inp... |
I know prime number programs have been beaten to death. I have been programming for eight years (not that long, but I'm not in my 20s yet and I got a programming job straight out of high school so I'm not doing too shabby). Everyone's first instinct is the "Naive" approach (nested loops, check for divisors), and I wrot... |
I have the below code to check for a winner in a Tic Tac Toe game. I'm wondering if this is a good approach, and if there is a better way of doing this (maybe by monitoring the state of the board).
public void CheckWinner()
{
var board = GameBoard.Content;//stores data as dictionary
for (int i = 0; i < 8; i++)... |
Below is a script to find cheating students in a quiz in a daily moodle activity log exported in .xls. It works fine and is written in a procedural way.
Essentially the script isolates the activity log entry in a worksheet for students listed in another worksheet, identifies when they are taking a quiz (looking ahead i... |
I wanted to use hal in one of my personal Clojure projects, but unfortunately the only library I could find (halresource) was somewhat out of date when compared to the current specification. So, I decided to roll my own, which works fine for me personally, but I'd like to make it publicly available. However, I don't ha... |
I was trying to refactor the following Python code (keeping the same time-complexity) which is an implementation of Z-Algorithm for pattern matching in strings.
def compute_z(string):
n = len(string)
z = [n]
L = R = 0
for i in xrange(1,n):
if (i > R):
L = R = i
while (R < n... |
I have three lists, and I need to operate on the ith element of each list simultaneously.
private void TripleForEach<T1, T2, T3>(IEnumerable<T1> a1, IEnumerable<T2> a2, IEnumerable<T3> a3, Action<T1, T2, T3> x)
{
a3.Zip(a2, (t3, t2) => Tuple.Create(t2, t3)).Zip(a1, (t23, t1) => Tuple.Create(t1, t23.Item1, t23.Item2... |
I'm using System.Timers to schedule tasks. I find this working, but I'm not quite sure if it's ok to do it this way.
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Timers;
using System.IO;
using System.Threading;
namespace WebApplication2
{
public class Global : System.We... |
I'm working on an ASP.Net MVC 5/WebApi 2 project. I'm using EF 6 code first for my database access.
I have a WebApi action method in which I've to update some data in my database based on the request. To correctly update the data it is very important that:
The method doesn't change the same records concurrently
The m... |
I've read a lot of stuff about mixins, inheritance and such, and in the end I came up with this solution for extending a class with multiple mixins. I haven't seen this anywhere else...
Is this a good method? Do you see any problems with it?
What I'm trying to achieve:
I need classes that share properties and methods, ... |
I am needing to import a tab delimited text file that has 11 columns and an unknown number of rows (always minimum 3 rows).
I would like to import this text file as an array and be able to call data from it as needed, throughout my project. And then, to make things more difficult, I need to replace items in the array, ... |
Just wanted to ask if there is an other way of PHP coding for displaying my subcategories and subsubcategries than mine.
My tables:
Categories
-------------------------
cat_ID | cat_name
------------------
4 | Baby & Kids
5 | Bicycles
6 | Boats
7 | Books & Comics
....
13 | Clothes & Accessories... |
Searching on Stack Overflow and Google, I find many and many different implementation for Unit-of-Work/Repository patterns, but none of that really convinced me; each had some small defect that prevented me from using it. So I tried to create my own version and would like to know what you think.
Essentially everything ... |
I am wondering about the feasibility of the following basic implementation of a server and how well it would scale. I know that large-scale, distributed servers should probably be written in a language like Erlang, but I'm interested in the viability of the following code "these days".
Other than bugs/issues I'd primar... |
The following is a series of functions to ensure that various elements on a page line up no matter what window size or when the window is resized. However I'm not sure my code is very concise as I am using the same function on three different event handlers. I read that function expressions aren't "hoisted" so I can't ... |
I have this simple code and it is working fine it is self explanatory: the user will choose a random number 10 times and based on the random number the array will be filled by fruits.
var fruit =[];
for( x=0; x<10,x++){
var r = Math.floor(Math.random() * 100 + 1);
choose(r);
}
function choose(num){
if(num... |
Here is the solution to generating possible moves and keeping the king safe.
If someone is willing to look it over and come with some suggestion to perhaps improve it, I would appreciate it.
Full source code is at GitHub
King:
@Override
public Collection<Square> generatePossibleMoves() {
possibleMoves.clear();
... |
I was cleaning up my code when I came across this situation :
var a = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
var count = 1;
var html = '';
for (var i = 0; i < a.length; i++) {
var rowStart = '<div class="row">';
var cell = '<div class="c">';
cell += '<div class="title">' +... |
I work with a legacy application. This is my attempt to add some sanity in an new feature I want to add.
It's a social application with users, sessions etc. The entire application is run in a procedural fashion. It still uses MySQL, so once this feature is complete, upgrading to PDO will be my next project.
class Grou... |
I am working on a personal project for managing my bookmarks, which is basically a web page to manage my bookmarks by categories. Managing here means everything - adding, viewing, updating, searching by categories, adding new categories.
As can be guessed there is need of AJAX and JavaScript. I have a JavaScript file ... |
private void merge(ArrayList<String> operations, ArrayList<LinkedHashSet<String>> setOfStrings) {
String toMerge = operations.get(1);
String fromMerge = operations.get(2);
boolean enteredFirstToMerge = false;
boolean enteredFirstForMerge = false;
// references that points one on ... |
I created a simple number-guessing game. Do I need to divide this program into functions? Please offer suggestions.
#include<iostream>
#include<string>
#include<ctime>
void drawLine(int n, char symbol);
void rules();
int main()
{
int amount;
int bettingAmount;
int guess;
int dice;
std::string pl... |
Is this code good practice? What kind of design pattern should I use for this specific situation?
The following function creates a new marker on a map. It sets a new image for it, except when the marker references the user location.
$scope.addMarker = function (lat, lng, isUserLocation) {
if (typeof(isUserLocation... |
I've recently started programming (learning Ruby) and wrote a small game. Now I've started reading about MVC and am trying to refracture my code to follow that architecture. The only classes with big changes so far are the intended controller and view (which is completely temporary.
# This file will handle the Demigod ... |
In MVP pattern we can use DI when our presenter classes need services as follows:
class APresenter
{
Public Presenter(DataService dataService, PermissionService permissionService)
{
//
}
// can use services injected through parameter...
}
As my all most all the presenter classed need these ser... |
I have a script that matches a string against ~20 different regexs for the purpose of changing it. They are ordered and formed that the string will only ever match against one. How can I avoid checking all the str.replaces after I match once?
My code here works, but I repeat myself a lot and it does not seem optimal.
T... |
I have a simple strategy game, and I implemented a simple counter object to count down a number whenever the game ticks. I have heard about something called NSTimer but I haven't messed with it at all yet. I have also heard that you should use Core Animations to move objects around when rendering rather than a tick b... |
The code takes in a hash that comes from a webform and also works with product data from the database. It then uses an eBay gem I built that connects with the eBay API and then returns a response object that you can call #extract on to return desired data. #extract takes an optional argument that will return data other... |
Description
This is the common code for all my Card Game projects. It is intended to be very flexible. This is related to the recent Community Challenge
The kinds of Card Games supported by this code is everything from Hearts to Castle Wars to some more Trading Card Games similar to Magic: The Gathering. This is becaus... |
I came across the question about creating memory-efficient Ruby pipe class with lazy evaluation. Some code is given to effectively create a pipeline of commands using lazy enumerators. I have been messing round with it and have implemented a tee command shown below. I feel like there is a better way to do it though.
cl... |
I'm looking for a review of my Connect4 game board. If there is anything I can do better, easier, shorter, etc., please let me know! If you need to see other files for the game, let me know as well.
var players = {};
var outOfTime;
$(document).ready(function() {
// Game variables.
var board,
width = 7,
... |
I want to take user input strings and add them together with proper spacing.
HTML:
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<input id="input" type="text" placeholder="Wor... |
I've asked a question about pinging a URL before, but I wanted something that was a bit shorter and still just as efficient. libcurl seemed to be the perfect answer. Here is my method:
/**
* @fn int testConnection(void)
* @brief Pings "https://www.google.com/" to test if there is an internet connection. Timeout is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.