instruction stringlengths 71 71.9k |
|---|
I wanted to write something that would be useful for the indices of a grid where if one walked off the edge of the grid they would re enter on the opposite side. This could in theory help with checking for special cases when checking for neighbours to a certain position on the grid. For example the neighbours of positi... |
I have this code block, where I search for the value of Ordnungsbegriff. I have to search through a tree of my CurrentDocument.
How can I rewrite it to be more dynamic? I don't know at which level I will find my value.
string xy = "";
try
{
if (string.IsNullOrEmpty(CurrentDocument.Ordnungsbegriff))
{
... |
I have the following method which extracts a decimal value from a string.
using System;
using System.Linq;
using System.Text;
namespace Foo.Bar.Common.Converters
{
public static class DecimalConverter
{
public static Decimal ExtractDecimalFromString(string str)
{
var sb = new String... |
In a project I'm working on, I need a component that is able to make a best guess about file's type based on its contents (a Stream). It doesn't need to do a particularly great job - basically just need to guess a file extension (which will later be mapped to a mime type). I can't trust any metadata - I can only act ba... |
I currently have a logging setup that looks like this:
require 'active_support'
require 'singleton'
class Worker
def initialize(logger)
@logger = logger
end
def perform
@logger.with_context(["tag1"], "Started work")
Provider.say_hello
end
end
class Vlogger
include Singleton
attr_accessor :logg... |
I need to implement a Ring Buffer/FIFO for data coming from a TCP socket.
It must support the following operations:
Append a the recv()'ed chunk of bytes.
Allow me to peek at the beginning of the buffer, since i get differently-sized packets, and I must decode a small fixed-size header to know how many bytes to proces... |
I'm relatively new to web development. I started learning JavaScript a few months ago and it's going well. I made this code for someone on fiverr, and it got the job done, but I know there's a more efficient way to write this without using a click handler for each element. There has to be a way to know which element is... |
I've written a small suite to easily convert my data between binary, hexadecimal and ASCII:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
def to_list(chain, offset):
return [chain[i:i+offset] for i in range(0, len(chain), offset)]
def bin2str(chain):
return ''.join((chr(int(chain[i:i+8], 2)) for ... |
I've written some jQuery for my navbar, but it's super sloppy and I'm always trying to write better code.
$(function(){
$(window).scroll(function(){
var sT = $(this).scrollTop();
if (sT >= 70) {
$('.navbar').addClass('navbar-switch')
$('.navbar .scroll-link').addClass('navbar-link-switch')
... |
I am getting into multithreading and I was wondering if the code below is good practice or not. This is one of my first tries at multithreading.
Is there a better way of getting the values from the Future<Integer> rather than saving them in a list and summing them up afterwards?
// Counting the number of prime-numbers... |
The function I need:
Rounds a double to the specified number of decimal places
I figured this would be a part of java.lang.math, but inexplicably it doesn't have a round function that returns a double. Thus, my proposed solution is to add my own round function in a MathEx class.
/**
* Holds generic math functions to... |
Original question: Union of intervals
In the original code, the Interval model class implements Comparable so that an input of List<Interval> objects can and must be sorted first for the logic to apply. I have decided to stick with the same approach, but applied a stream reduction operation to get our List<Interval> ou... |
I wrote this so I can learn CUDA. This is coded to work on my laptop's Nvidia GeForce GT 540M.
Main points I need reviewed:
CUDA programming conventions
Performance, especially kernel speed
C programming conventions
Preprocessor and macro conventions
Making it DRY
kernel.cu
/****************************************... |
I've started learning Haskell by following along the CIS 194 Course from UPenn.
In the first lessons there is talk about wholemeal programming and certain ways idiomatic Haskell code looks like.
Now, I think that my style is still far away from being idiomatic and I don't think I've grasped what wholemeal means.
To s... |
The original question came from this web site.
Revision 1
Revision 2
And this is the third revision. I delete spaces and validate an equation before computing.
public class Main {
private static final String EQUATION_REGEX = "^-?\\d+((\\/|\\*|\\+|-)\\d+)*$";
// http://www.careercup.com/question?id=49113801403... |
I wrote 3 subroutines related to batch data processing, they will be used together. A bit of background, I wrote this for my admin colleagues who do not write code. An application dumps daily .ack files onto a shared drive which contain data processing messages (success, errors, etc.).
I wrote the code with comments a... |
I needed a way to normalize nearly any given input for a configuration parameter on a dashboard. Server side code is in PHP so I wrote a test script to experiment with preg_replace and regex. When I say normalize meaning, the resulting value must match the following restrictions:
Take any cased value and return all ... |
The goal of this is just to practice. I went off on a self-challenge to replicate something(So the names of the parts can be ignored), I'm not done yet (Though what is here is fully runnable), but have enough code that I thought it could merit taking a moment to examine whether I could be doing anything a cleaner way.
... |
I'm making an experiment on JS, trying to build a framework for OOP. It's called Universe.
The main purpose is to emulate a mini-universe, where classes are "created" with a defined behavior (prototype) and objects are created from those classes to provide data.
So far I managed to make inheritance work (although the i... |
Please see this question for the general description.
Exercise 2: localMaxima :: [Integer] -> [Integer]
A local maximum
of a list is an element of the list which is strictly
greater than both the elements immediately before and after it
localMaxima :: [Integer] -> [Integer]
localMaxima l =
let getMaxOf3 x y z | x < y... |
I've been trying to solve this problem on Codeforces:
Challenge description:
After a hard day Vitaly got very hungry and he wants to eat his
favorite potato pie. But it's not that simple. Vitaly is in the first
room of the house with n room located in a line and numbered starting
from one from left to right. You... |
Please see here for the general description.
Exercise 3: histogram :: [Integer] -> String
takes as input a list of Integers between 0 and 9 (inclusive),
and outputs a vertical histogram showing how many of each number
were in the input list.
histogram :: [Integer] -> String
histogram xs = let
(a,m) = getCountOfElemen... |
I've got an object $contest which is a Symfony entity that has some other entities assigned. I can get them by $content->getEntries();. That will return an object with the lazyloaded db objects. I need to display them in a random order.
$tempEntries = $contest->getEntries();
$entries = array();
if (count($tempEntries))... |
I have implemented a basic high score server for my strategy game. The goal here was to get the high scores working for the browser based version of the game (I am using the libGDX library with GWT for this version). Unfortunately this required using websockets, which made the process more difficult than I would like... |
I've just finished a small function that will reduce the size of code as much as possible without breaking anything. Obviously it makes everything a bit unreadable so it's not really for cleaning the code, more for if you want to send something but make it awkward for people to edit.
Basically, on the highest level it'... |
Can someone tell me how good/bad this code is for a super simple todo list made from vanilla JavaScript? Anything to work on or consider on my next projects?
// establish variables
var addButton = document.getElementById('btnAdd');
// event listeners
addButton.addEventListener("click", addItem);
// assign event liste... |
I wrote this code to form combinations of a 16 bit binary number (I know it is in output is string format, but it is my goal to just print all possible 16 bit binary numbers). My question is, can this code be optimized? How can I calculate the time complexity of this code?
public class Combinations {
static int le... |
Here's a piece of working code wrote in C to calculate the median without putting all values in an array and sorting them. It reads values from a file.
#include <stdio.h>
#include <stdlib.h>
double find_min(FILE *, double, double);
double find_max(FILE *, double, double);
int main(int argc, char *argv[]) {
int C... |
Each ticket for the Pick-10 lotto has 10 unique numbers ranging from 1 to 99. Suppose you buy a lot of tickets and like to have them cover all numbers from 1 to 99. Write a program that reads the ticket numbers from a file and checks whether all numbers are covered. Assume the last number in the file is 0. Suppose the ... |
Background
A class provides an API to determine the index where two string lists diverge.
import java.util.LinkedList;
import static java.lang.System.out;
/**
* Provides the ability to determine the index whereat two lists begin
* to differ in content. Both this list and the list to comapre against
* must not cont... |
Knowing who's using what, and where, I've implemented a "Rename" refactoring for Rubberduck.
It works great - it needs further extensive testing, but the preliminary tests are very, very exciting.
There are a few things I'm not sure I like though:
The entire logic is implemented in the Rubberduck.UI namespace. The "E... |
I wrote a simple summation program in MARS to practice using loops and jump instructions. I feel like this is pretty lightweight and wanted some feedback on possible improvements:
Lowering instruction count
Organizational changes
Am I correct in assuming this is a "do-while" loop?
# Description: Summation program imp... |
I am wanting to encrypt a password and decrypt a password using PHP. Is this a safe method?
$pass = "password"
//encrypt password
$salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');
$salt = sprintf("$2a$%02d$", 10) . $salt;
$hash = crypt($pass, $salt);
//decryption in second program
if(... |
I've been steadily improving a show many move one carousel sample that I found a few weeks ago. I want to post my improvements for others to use but don't want to spread bad code. I'm not an expert in JavaScript but I always like to produce clean code.
Working demo
(function(){
$('.carousel-showmanymoveone .item').ea... |
A little over a year ago, I asked this question. Since then, I've implemented the larger bit variations and am looking for any and all feedback - performance is obviously key when talking about FNV-1a, but having maintainable code and being correct and decently unit-testable are also paramount.
GitHub
Base class Fnv1aB... |
Is it good to empty an array on focusout?
var arr = [];
$("#automobil").focus(function() {
$.getJSON("auto.json", function(data) {
$.each(data, function(key, value) {
if ($.inArray(value.name, arr) === -1) {
arr.push(value.name)
}
})
});
}).autocomplete({
... |
I am trying to simply measure my code execution time.
public class PerfMeasureUtil {
private static final Logger LOG = Logger.getLogger(PerfMeasureUtil.class.getName());
private long startTime;
private long duration;
private static final EnvironmentProperties env = new EnvironmentProperties();
/**... |
I tried to develop a new way to check if a number is divisible by 9. I have written my code and it is working fine. I'm not allowed to use *,/ and %.
int isDivby9(int x)
{
int status = 0;
int divby8 = 0;
int orgx = x;
if(x>=9)
{
divby8 = x >> 3;
int olddivby8 = ... |
I'm running a jQuery function to equalize heights. I want to equalize the heights of several pairs of elements, and can't think of a way to do so without repeating the whole function.
How can I combine the separate functions below into one function that equalizes the heights of each pair of <div>s without forcing all t... |
When running unit tests in JavaScript it is often useful to gain access to private members. Previously I would add an extra snippet of code inside the class definition (or whatever one calls this in a prototype-based language) to open up the object. Something like this was usually sufficient:
this.internal = function(n... |
I want a generic super-class that I can easily subclass - and if desired add slots to my class - without having to worry about any pickle issues (with the lowest protocol). Is this in general a good idea? And if so, is this class a good implementation?
class HasSlots(object):
"""Top-class that allows mixing of clas... |
I have the following code which I would like to simplify in Haskell, although I'm not sure how. I recall that I can use monads to simplify a case chain when the result of the case leads onto a next bit of code but in my example, I return from the function when I get a value, and continue to the next bit of code if I do... |
I have collected a large amount of data about the train network in my country. Now, I am writing some code that calculates the average amount of delay on the entire train network, for each day, in a given period of time. Important to note: every train has a unique train-number. Each train-number only occurs once each d... |
This is my version of a linked list in C. The function mergeSort requires a reference to the first and to the last nodes, as well as the indices of the first and the last node and a comparator.
You need to compile this source code using C99 standard in order to get it working.
#include <stdio.h>
#include <stdlib.h>
ty... |
Have I followed best practices for PHP development, or can this class be improved?
GitHub
<?php namespace azi;
/**
* Class Validator
*
* @package azi
* @author Azi Baloch <http://www.azibaloch.com>
* @version 1.0
* @license The MIT License (MIT)
*
*/
class Validator {
/**
* RegExp patterns
*
... |
I'm using multiple instances of an object creating a form:
{...
BPFormInputTextFieldCell *nameCell = [[inputTextFieldClass alloc] init];
nameCell.backgroundColor = cellBgnd;
nameCell.textField.placeholder = @"business_name";
nameCell.mandatory = YES;
nameCell.textField.delegate = self;
nameCell.cust... |
I am working through the CodingBat exercises for Java. I just completed this one, an exercise that requests the comparison of substrings of two strings:
Given 2 strings, a and b, return the number of the positions where they contain the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3, since the "xx", "aa",... |
I have the following list to sort:
A 0.53
B 0.56
C 0.56
D 0.98
E 0.33
Please note that my list may contains thousands of such type of records. I am sorting my list and put the sorted list into an array as:
String str="";
for(String s: mylist){
str+=s+",";
}
String[] sArr = str.spl... |
I solved the CodingBat task:
Given 2 strings, a and b, return the number of the positions where they contain the same length 2 substring. So "xxcaazz" and "xxbaaz"
yields 3, since the "xx", "aa", and "az" substrings appear in the same
place in both strings.
stringMatch("xxcaazz", "xxbaaz") → 3
stringMatch("abc", "ab... |
I have bunch of similar methods in different classes to average student grades.
In the Student class:
public double getAverageGrade() throws NoGradesForStudentException {
double sum = 0;
int totalGrades = 0;
ArrayList<Subject> studentSubjects = getStudentSubjects();
for(Subject subject : studentSubjects... |
I decided to make a Ruby app to search for songs, which uses the tinysong API. Things got really cryptic and weird in the view. I managed to get dynamic tables that adjust to data length, but I feel like there must be a much better way to accomplish this output.
require "rubygems"
require 'json'
require "httparty"
def... |
I am processing around 3 billion records using this piece of code. It's pretty slow; it would be really helpful if you could suggest better ways to do this.
'''
Created on 27-Mar-2015
@author: siddarth
'''
import rake
import multiprocessing as mp
import time
import os
import csv
filename = 'Large_Input_File.csv'
out... |
I am currently developing a password generator and just finished my first version. I know there is a lot to do but before I proceed with the next version I would like to have feedback on my current source code.
GitHub
The embedded source code does not contain comments to reduce characters.
Main.cpp
void main()
{
Co... |
The problem is adding two lists as numbers L1 = [1,9,9] and L2 = [0,9,9]:
?- sum([1,9,9],[0,9,9], Lo).
Lo = [2,9,8]
But I also wanted to add this:
?- sum([8,1,9],[1,8,2],Lo).
Lo = [1, 0, 0, 1].
I used the backtracking method I've learned:
link([],L,L).
link([Head|Tale],L2,L3):- link(Tale,L2,L), L3=[Head|L].
inve(... |
I am trying to create a simple NodeJS program that monitors few provided servers or machines and provides output in JSON.
// @file name : watch.js
// author : Abhinav Gauniyal
// requires
var os = require('os');
var http = require('http');
var net = require('net');
var diskspace = require('diskspace');
var s = net... |
Problem:I need to write an algorithm that will return length of longest possible palindrome from a given string.
So if the input is aabbbccdfg
Program output should be 7. //-->[cabbbac]
Can someone point it out if there are any problems with below code?
public static void GetLongestPalindromeLength()
{
var ... |
I am creating a game called Othello, the objective of the game is to close in your opponent's stones either horizontally, vertically or diagonally. All the stones that get closed in are then turned to your color. Win the game by having the most stones of your color.
Small example:
b = black
w = white
0 = empty space
... |
The LiveDate object displays the live current date and has a sendAjaxRequest() function dependency to send the AJAX requests.
I'd like to have a full review of any aspects of my code:
OOP
Readability
Performance
Usability
JS conventions
Error handling
Any other suggestions for improvement are always welcome!
sendAjax... |
In order to learn both scala and functional programming, I've been rewriting the projects from my introductory CS class in scala. One of the projects was a plinko game, where the user picks a slot to drop a token into and then the path that the token took and the money won from the end slot is printed to the console. T... |
I had been trying to find a suitable solution to implement localization in my Phonegap/Cordova application. My search proved that any localization through seperate .xml or .json files was a nightmare (mostly due to cross-access-origin).
Because of this, I decided to create a (very) simple, lightweight localization solu... |
I am hoping a Meteor guru can please review my code below and verify if I am properly using return false and event.preventDefault(), especially in the context of form submission.
The reason being, the Meteor docs use this approach:
// Prevent default form submit
return false;
while other tutorials use this approach:
e... |
I'm doing K&R C Exercises. I could use a code review to see how I can improve my logic. The excercise is:
Write a program that prints its input one word per line with getchar.
My basic idea is we need to know whether or not we're in a word. We use the IN status. Every time we hit a blank space, tab, or newline, the... |
As I'm new to HTML + CSS + JS I've been building a calendar (which I think anyone can use as a basis) but would like to get your suggestions on how I could improve my code specifically from the perspectives of:
Adherence to best practices in HTML + CSS + JS.
Usability.
Browser compatibility.
Note: The console logging... |
The following code creates a recursive backup of a directory in the form of interlinked HTML files, structured in the same form as the input directory.
It does not take the backup of the contents of a directory, just stores the names and sizes of all the files and folders contained in the directory.
(It can be though... |
I'm learning C++ so I thought I'd make game of life for practice and explore pointers, 1.5D arrays and stuff like that.
I have "finished" my implementation, but I have trouble with memory access. It seems like I'm stepping over the bounds somewhere and I simply can't figure out where. Everything looks fine to me.
Probl... |
The NICTA Haskell Course presents the following function to implement on List:
data List t =
Nil
| t :. List t
deriving (Eq, Ord)
And the function:
filtering :: Applicative f => (a -> f Bool) -> List a -> f (List a)
filtering _ Nil = pure Nil
filtering f (x :. xs) = (++) <$> ((\y -> case y of True -> x :. ... |
Task (1.20)
Write a program detab that replaces tabs in the input with the proper number
of blanks to space to the next tab stop.
Also, the condition is is not to use pointers and structs etc because they will be considered in next chapters.
I'm new in C, and want to know what in my solution is bad idea and what ca... |
I needed a way to find the number of arguments a function or operation in Rebol accepts (the functions arity). I could not find any direct support for this in the language, so I made my own arity function:
arity: func [
"Returns the arity of a function, disregarding refinements."
:f [function! op! native! actio... |
Just recently I've wanted to update the PHP scripts I use to fetch information from a database for an iOS application. I've got around to it today, and I had a few questions that'd I like a second opinion on before I use these scripts.
Will this method of operation work? As in, since the query and connection are in tw... |
I have made an attempt to write the mergesort routine on a LinkedList in Java. It will be great if somebody can review my implementation and point out the issues with it.
public class LinkedListSort{
static class Node<T extends Comparable<T>>{
private T value;
private Node<T> next;
public N... |
Are there any ways I can make my program more efficient? My program runs, but are there any things that are unneeded that I included?
The local Driver's License Office has asked you to write a program
that grades the written portion of the license exam. The exam has 20
multiple choice questions. Here are the corr... |
I have a 2D lattice with U × U number of grids. My goal is to create an array – of shape U^2 × U^2 – where each entry denotes the least-distance between each grid and any other grid.
Currently, for U=60, my Python script takes ~5 minutes to complete. As a novice programmer, I suspect there must be a more efficient ap... |
Say I am given a csv file that I want to import into an sqlite3 database. The first two columns in the csv file contain unique, important information while the rest of the columns are really a list of things. So the csv file with the header row could look like:
cucumber.csv
'important1', 'important2', 'listItem_1', ... |
I have the following Sieve of Eratosthenes algorithm:
public static ArrayList<Integer> sieveOfEra(int limit) {
int crosslimit = (int) Math.sqrt(limit);
boolean[] sieve = new boolean[limit+1];
ArrayList<Integer> primes = new ArrayList<Integer>(Arrays.asList(2));
for (int n = 4; n <= limit; n += 2) { /... |
I am working on a library in which I need to execute my URL using AsyncRestTemplate and after that I will get a json response back if it is successful. I am also making DataResponse object whether the response is successful or not which I will return back to the caller of my library.
If the response is not successful t... |
I wrote a script for my Raspberry Pi that keeps checking my external IP. If it changes, the Raspberry Pi will send me the new IP via email.
Any suggestions for improvements?
#!/usr/bin/python3
import os, time
def getIP():
os.system('dig +short myip.opendns.com @resolver1.opendns.com > raspip.txt')
wit... |
There are three functions involved. The first Init is run before the content is parsed. The second is parseContent where the content is generated. The third is displayPage that renders the page and HTML for the user.
They are within an OOP class that uses template files which have #KEYWORDS# that are dynamically replac... |
I want to convert db columns such as is_deleted or product_code which consist of xx_xx to java-style names: isDeleted or productCode. I wonder if there is a way to improve my following code, using regex or such things.
def getJavaName(column):
words = column.s... |
Any suggestions?
#include<iostream>
using namespace std;
class node
{
friend class linked;
private:
int data;
public:
node *link;
node()
{
data=0;
link=NULL;
... |
I'm currently learning C# so I can make real games with Unity. This is the first C# program I've built in Unity. Essentially what is does is control the thrust, and rotation of a GameObject shaped like a rocket. It may not necessarily be "real physics" but for my first program, it's good enough.
using UnityEngine;
usin... |
I would like to unit test my web requests, so on top of my head I came up with the solution below.
Since it seems to be working fine, I'm posting it on this site. Though it doesn't feel very dynamic, I would like your input. For example, this solution can't simulate response headers, which I'm also interested in mockin... |
I'm trying to understand memoization using Scala. I took the Fibonacci sequence as an example because of the high cost of recursively computing numbers in the sequence without memoization.
class memoize private (val f: Int => Int) {
import scala.collection.mutable
val cache = new mutable.HashMap[Int, Int]()
def m... |
I'm working on a port of some existing inline x86_64 assembly code to AArch64 compatible assembly and would appreciate the feedback. I'll post below the original x86 and my ported AArch64 code.
The purpose of the original x86 code is to increment a long/double value and handle overflow. My main concern is that due to d... |
I need to implement some function and I would like to report about a fail made inside a function. If function doesn't fail I need to get a some result (for example, std::string). I see two ways to implement function:
// 1. report with exception
std::string foo() {
std::string ret;
... // solving str
if (is_fail(... |
I am trying to code for both recursive and iterative approach to a problem.
Below is a recursive code to print the nodes of binarytree column wise. Basically I have count of root as 0 and if I move left I decrement count by 1 and if I move right I increment the count by 1:
public void printcolumnOrder_recursive(Tree cu... |
I'm working on a C++ custom memory allocator, that would be kind of a replacement for the C flexible array syntax, you know, the stuff like that:
struct C_Arena
{
struct Header header;
size_t size;
size_t used;
char* data[];
};
...
struct C_Arena *arena = malloc(1000);
arena->size = 1000 - sizeof(struct C_flexi... |
I have a system in which user id is "sharded" across all the machines which means each machine is responsible for certain user id data. I am working on a library which will take DataKey builder object which contains user id, timeout, and some other stuff. I will be using this user id to figure out which machines have t... |
I have been trying to create an event queue system using SDL. I've been trying to use this for Pong. The game is not even finished yet, but I stopped work to examine how my event system is organized.
Event_Queue - This is the heart of the system. All events go through here and all listeners come through here.
Event - ... |
Challenge:
Swap positions in a list
Specifications:
Your program should accept as its first argument a path to a filename.
The file contains several test cases, one on each line.
Each test case is a list of numbers, supplemented with positions to be swapped.
List and positions are separated by a colon.
Posi... |
I have made this small text-based casino game in C++. How could I improve it? Be as picky as you'd like.
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
// General functions
void bankrupt();
// Roulette functions
void roulette01();
void roulette02();
void rouletteWin();
void rouletteLoss... |
I've just finished with my python implementation of Conway's Game of Life. Can I get some opinions on it?
import pygame
import sys
import time
import random
rules = '''
1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
2. Any live cell with two or three live neighbour... |
I need to know how many times a substring occurs in a given string. I figured that I might as well create an extension method:
public static int Occurences(this string str, string val)
{
string copy = str;
int instancesOf = 0;
int indexOfVal;
while ((indexOfVal = copy.IndexOf(val)) != -1)
{
... |
Debug experience can be much improved in the Lazarus development interface. Please, if you use this free development environment and have the same felling, do not consider this affirmation simply as a "drawback". I would rather consider it as a challenge for improved documentation and contributing back to the community... |
I have been learning HTML/JavaScript and CSS. I have gone through some of the online tutorials, PDFs and books as well. Though, now I am familiar with syntactical stuff, I wasn't sure how I should design or structure code, so I started with a small ToDo application. I didn't want to use any frameworks. As I am still le... |
This is my first ever project and first GUI. I have finished it (with help from Stack Overflow) and it works but is very slow. Can anyone suggest improvements for speed, best practices or usability.?
It currently takes 16 seconds from pressing run in Eclipse to something appearing on my screen. You will need RXTX lib ... |
In column A, I have many strings ~ 32000 cells each containing unique string values. I then have columns C to as many as 30/40 columns which all contain approximately 400 rows of text.
Check column (j) for any text not present in column A
If true then add new string to column A
Run comparison of Column A against colu... |
I finished coding Conway's Game of Life in JavaScript and HTML table.
logic cells in a table will be assigned with unique id's and based on the id operations(based 4 rules) take place.
You can find the working code at Codepen or i have put the code below.
The thing is it works well with any number of rows and 9 columns... |
I have done #1 of Project Euler's in Ruby. Using two different approaches. One uses set, another uses reduce.
require 'set'
start = Time.now
s1 = Set.new (1..1000/3.floor).map { |x| 3 * x }
s2 = Set.new (1..1000/5.floor).map { |x| 5 * x }
sum = s1.merge(s2).to_a.inject(:+)
duration = Time.now - start
puts "Sum: #... |
I am making a simple function that retrieves a 3x3 cells out of NxM grid and determines the direction of cells base on their previous and next neighbor. It will return either any of the following
HORIZONTAL
VERTICAL
TOP_LEFT
TOP_RIGHT
BOTTOM_LEFT
BOTTOM_RIGHT
or INDETERMINATE
Suppose I have this data:
0 1 0
0 1 0
0 1... |
I tried to write a script which takes a list of URLs, checks if their FreeDNS record points to the current IP, and updates the record if not.
Intended use is that the script will be run periodically to keep FreeDNS always pointing to the dynamic IP.
Also, a log is kept so the user may later inspect what the script did.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.