instruction stringlengths 71 71.9k |
|---|
After seeing Pretty print dice faces from multiple rolls of multi-sided dices,
I decided to make an infinite ASCII dice generator.
There was one requirement, it to follow a normal dice face.
And so I decided on making two classes, the Dice and Rings.
Dice outputs the ASCII dice, holds the rings, and tells the rings how... |
I've attempted a functional solution to Conway's Game of Life in Python.
The example code allows you to see the next generation of the universe by calling the step() function, passing the current generation of the universe. The universe is represented as a set of live cells. Live cells are represented as a tuple of x, ... |
I'm somewhat new to writing real-world projects in C, so I'm not familiar with best practices and standards. I'm writing code dealing with EGL and OpenGL, and some setup calls might fail for reasons outside my control. I want to write an initialization function that performs all necessary setup for my application, but ... |
I have the following code to solve dinning philosophers problem using Go channels and am looking for review comments:
package main
import (
"fmt"
"time"
"sync"
"os"
"bufio"
)
type diner struct {
thinkTime time.Duration
eatTime time.Duration
free []chan bool
done []chan bool
n ... |
I've written a JavaScript dictionary sorting algorithm, which takes a .txt file (the dictionary), and loads it via node's file system. The purpose of this algorithm is to sort every word into its corresponding array based on its letter pattern. For example, the word little would have the letter pattern of ABCCDE, and h... |
I started learning the Java language about 10 days ago, reading Introduction to Programming Using Java by David J. Eck. I've made it halfway through chapter six in about 9 days. I realized I was going way too fast to learn efficiently, and so I'm going back to reread the focal points of the chapters and finish the exe... |
In a recent interview I have been asked to write a program to generate the following output:
* * * * *
* * * *
* * *
* *
*
* *
* * *
* * * *
* * * * *
I had written the following code in java
public class Triangle
{
public static void main( String[] args )
{
show( 5 );
... |
There is data stored in JSON file with the following structure:
goods_data = {"year" : {"month" : {"day" : {"01" : {"name" : "some item", "price" : "10.01", "category" : "root | first | sub first | twice sub first", "02" : {"name" : "another item", "price" : "10.99", "category" : "root | first | sub first"} }}}}}
Th... |
The IRubberduckParser interface has seen breaking changes, and now looks like this:
public interface IRubberduckParser
{
RubberduckParserState State { get; }
Task ParseAsync(VBComponent component, CancellationToken token);
void Resolve(CancellationToken token);
}
This new interface does more than breaking ... |
This form will store research article information in a database. It would be nice to somehow add buttons to add additional author and university fields or also multiple universities for 1 author. Do you see any glaring issues with my code?
<!DOCTYPE html>
<html lang="en">
<head>
<title>Input Form - Research Ranke... |
When my go-to Japanese transcription site went down for a while, I decided to write my own. My application converts between Romaji, Hiragana and Katakana — however, unlike any other converter I've seen, this one does a three-way conversion: there are three text boxes, and typing in one will update the content of the ot... |
I have written my very first Haskell module and I feel that the code can be improved based on the simplicity of the problem I am solving. Do you have any suggestions?
Problem statement:
You are given a String code containing a message composed entirely of decimal digits ('0'-'9'). Each digit consists of some number of... |
I have made a class what uploads an image to imgur (a service with an API where you can upload images). And then I read the response of the API what contains the URL and the HTTP status code (200 if succeeded).
And I'd like some feedback, since the runtime is pretty long for a 50kb image. The current runtime is around... |
I made the following code.
Since it is a Batch, any kind of problems can appear.
Please review it and point any problems when copying files into Dropbox!
Its intent is that you will copy a file into an Dropbox folder.
Its syntax is dropbox <files-to-dropbox> <dropbox-folder-to-copy-to>.
@echo off
set dropbox=%userprofi... |
I was reading about making fake 3D effects or so-called "mode 7" on 2D contexts. I have made a small program to demonstrate the fake 3D effect by using SFML. How can I improve it?
#include <SFML/Graphics.hpp>
#include <array>
#include <cmath>
struct P
{
struct Screen
{
float x, y, w, scale;
}screen... |
I have solved the Problem 25 of the Euler Project:
The Fibonacci sequence is defined by the recurrence relation:
\$\qquad F_n = F_{n−1} + F_{n−2}\$, where \$F_1 = 1\$ and \$F_2 = 1\$.
Hence the first 12 terms will be:
\$\qquad F_1 = 1\$
\$\qquad F_2 = 1\$
\$\qquad F_3 = 2\$
\$\qquad F_4 = 3\$
\$\qquad F_5 = 5\$
\$\qqu... |
The following is my tree coloring realisation attempted to get a feel of Elixir (simple, but slow coloring algorithm from Principles of Distributed Computing). Coloring runs from the root, using alternative colors 0 and 1.
defmodule Graph do
def add_v g, v, label do
:digraph.add_vertex(g, v, label)
g
end
... |
Because it is a lot of code, I don't want to ask for details what is wrong, but want to ask about review what can be changed in approach to this.
This is controller that make query:
It grabs data within time range
Does aggregation so I get sum of some fields
Because there are some fields from different collections i.... |
I am working on a simple console chat in Python. I started from this Winforms application, removed all the forms (so that the chat could run on Windows and Linux) and did some refactoring (the "click events" did not exist any more, it needed a workaround).
The new client code:
import thread
from MinimalNetworkTools imp... |
Task: I have two dimensional array of chars filled with random values [a-z] and need to find if the word ala appears vertically, horizontally or diagonally in it.
In my program, I go through all characters and try to find word in all dimensions.
I feel there is more intelligent way to do this task which will:
Work wit... |
I'm reading the book Head First Java and got an assignment to re-create the 99 Bottles of Beer song according to those lyrics found in the URL. I've had to do this with a Java while loop.
class SecondBeerSong {
public static void main(String[] args) {
int beerBottles = 99;
String word;
whil... |
I wrote this bit of C that prints a half-pyramid,
*
**
***
****
Here's the main body:
#include <stdio.h>
#define SIZE 4
void printrow(int threshold);
int main()
{
int i, threshold;
for (i = 0; i < SIZE; i++) {
// threshold slides to the left with each iteration:
// ===|
// ==|=... |
I am trying to learn how to build a very basic MVC structure before jumping on rails and other frameworks. I am working from a .txt file, and I organized a project into four parts: a model, a view, a controller, and a runner.
.txt file pattern:
line1 -> "question"
line2 -> "answer"
line3 -> "" #blank line
line4 -> "qu... |
I am not quite sure how to attach my data, but it is 5737 observations of 3 variables. Variables V and P are strictly < 0, and variable R is -2 < R < 2.
The last function, correcttot, will help me find the optimal constants, or ranges of constants, for this function. However, the function that it runs over, percentcorr... |
I programmed in C# and I used the Qt framework. Both of them have their own signal slot mechanism which are really powerful. I looked at several implementations in C++ and based on what I learnt from those sources, I started to implement my own version to better understand how these could work under the hood.
My implem... |
I have written a simple flashcard program that runs in the terminal:
It loads the cards from an ordinary .txt file.
It provides a way to add flashcard from within the program to avoid that beginners editing the plain-text mess the formatting up.
It asks questions one after the other, because it maximizes learning (no ... |
Inspired by this post, I decided to try to implement my own Conway's Game of Life.
I started with a non-warping board:
/**
* Represents a single generation of a Conway's Game of Life.
*
*/
public class Generation {
protected static final int[][] SURROUNDING_CELL_POSITIONS = { { -1, -1 },
{ 0, -1 },... |
I wanted to write a function that when invoked, will scroll the page downwards in a smooth fashion.
Comments and criticism welcome. I don't like, for example that determining whether it is done is not based on the scroll position.
const EASING = BezierEasing(0, .1, .1, 1); // Example values.
const DURATION = 1000; //... |
I've written a singly linked list in C++. Would appreciate reviews on code efficiency and best practices.
#ifndef SLIST_HPP
#define SLIST_HPP
#include <stdexcept>
#include <iostream>
template <typename T> struct node{
node(T data):data(data),next(nullptr){}
T data;
node<T> * next;
};
template< typename ... |
I wrote some code in Python, to benchmark mathematical operations. It does not do anything in particular besides just calculating a lot of floating point numbers.
To clarify: I need 128-bits precision floating point numbers.
from __future__ import division
from numpy import arctan, sin, absolute, log10
from mpmath im... |
I wrote basic Python code for the summation of n primes. It works but I wanted to find out how I could improve it and what shortcuts I missed.
""" So this program is designed to add up the first 'b' primes
==> Prime number is defined as a number only divisible by itself or 1"""
def is_prime(a):
""" This f... |
I have just started implementing Binary Search tree on my own without using any tutorials online.
Please have a look and suggest how can I make code less cluttered and more faster. Right now I am using lots of if-else conditions and want to remove them as much as I can.
boolean deleteNode(int data, TreeNode node )
{
... |
Here is my working code for a min-heap sort using an Array-List. I would like any input as to areas that need additional refining and any areas that are against proper formatting/usage. Although not defined, I was attempting to use an array implementation instead of the Array-List collection as the class has been creat... |
I am a PyGame newbie and am learning as I go. I would like to become familiar with normal PyGame conventions. I would like you PyGame experts go over my code and let me know if there are any places I should modify my code to follow best practice.
The point of the game is to collect as many pills as possible. Yellows ar... |
I've decided to revisit a chunk of code I wrote a while back, and see what I could do to make some changes. As a result, I know have slow, but working piece of code which is able to simulate gravitational attractions between \$n\$ amount of bodies. Like usual, I'm using the formula described in Newton's Law of Gravitat... |
I am trying to solve apparatus problem, paraphrased below.
There is an apparatus with n on/off switches with a one-to-one correspondence to n lights (but with an unknown permutation).
We have several different photographs of the apparatus showing different configurations of the switches and lights. Are these photos ... |
A while back I made a custom String struct (see github repo) because of the difficulties in dealing with Mongolian Unicode rendering when using Swift String or NSString (see this question and the accepted answer for more details). The struct is an array of UInt32 so that it represents a string of Unicode scalar values.... |
Time complexity is supposed to be \$O(n \cdot \log(n))\$ and space complexity is supposed to be \$O(1)\$. Neither the elements of the container nor the container should be modified.
// Copyright [2015] <none>
#include <cstdlib>
#include <cstddef>
#include <cassert>
#include <iostream>
#include <vector>
#include <iterat... |
I've written a function which, given a number string, returns the next largest palindrome in string form. For example, if the input string is "4738", the output should be "4774". The original problem description is found here. The function seems to be working for all the tests I have thrown at it so far, but the probl... |
This seems to work, but for some reason I'm not entirely sure about it.
Can anyone point out any issues with this simple pub/sub library?
Thank you!
(function (undefined) {
window.mylib = $.extend(window.mylib, (function () {
var subscriptionsBag = function() {
var self = this;
se... |
I am very new to programming (using C++) and coded a sudoku solver as a weekend challenge. I guess there are so many things to criticize, but I would really appreciate some constructive criticism. Just what strikes you the most. If you want to run the code, a "sudoku.txt" has to be in the same directory. It's content a... |
I am training a colleague who is familiar with Python but has a limited knowledge of C# and complexity. I thought the following problem could be a good start.
You are in a desert, there is a (infinite) wall in front of you and you know there is exactly one door, but you don't know if it is on the left or on the right.
... |
I've written a simple tabbed component in ReactJS, whose purpose was to make defining different tabs very simple. My implementation does this very well in my opinion, since defining tabs becomes very simple:
<TabbedComponent>
<Tab>
<Name>Tab 1</Name>
<Content>
<h1>This is the first tab</h1>
<p>Thi... |
The objective of this code is to make the difference inbetween two lists of items, that is knowing which items are missing in the second list in regards to the first one.
The first list is built from an enumerator with the following method:
keysToPress = Enum.GetValues(enumType).ToList();
Once this list is built, no... |
This is a rags-to-riches attempt from this question, based on the popular 99 Bottles of Beer, by (lightly) using Java 8's stream-based processing.
Any room for improvement in terms of readability? I can only think of two concerns:
It's not immediately obvious what the placeholders for each Line value are expecting.
I ... |
I'm developing a web application for simulating electronic circuits and I'm trying to add backward propagation options (guess you can immagine why). During refactoring I came up with a base class for logic operations and wanted to ask for some feedback (whatever pops up in your mind) on it. The class code is the follow... |
Started working with CSS animations and I'm wondering if there's a more elegant way to manage (with class names) when an animation is on or off. The general pattern I have is like this:
<div class="base-class"></div>
<div class="base-class base-class-rest"></div>
<div class="base-class base-class-active"></div>
I real... |
Having read "Effective Java" and "Clean Code" I wanted to apply these principles in a manageable scenario. To this end I refactored a Java library that calculates similarities between strings.
The code below is that of a cosine metric. Documents are tokenized into multisets of strings. These are passed onto the metric... |
I wanted to write a function findDeep that would perform a recursive, depth-first search on plain objects and arrays.
Comments and criticism welcome.
function findDeep(dict, test, index = 0, keys = Object.keys(dict)) {
var item = dict[keys[index]];
if(index > keys.length) {
return null; ... |
I have made a time format converter which converts 12 hour format to 24 hour format. My convert_to_24() takes a string in format of HH:MM:SS followed by AM or PM. It returns a converted string to 24 hours format without the AM/PM string.
Note: Let us assume that input will always have no space between them e.g. 07:05:4... |
I'm developing backend for my mobile app by using gin-gonic and gorm ORM (mysql). But I'm not sure api and db handle huge amount requests if clients increased. for example I'm using my db struct as parameter, is this a problem for concurrency ?
Here is my implementation:
main.go:
var i Impl
func main() {
// #GIN... |
The app will allow users to login and upload a CSV file that contains temperature data from a device. This data will be stored and the user can view all these downloads and select one from a list to view using Highcharts.
Where I am getting hung up is with the temperature recorder device model. Each device has a unit s... |
Is there anyone who can help me improve the time complexity of this backpack algorithm, for which I already use sliding array to improve the space complexity.
The problem is as follows:
Given n items with size A[i], an integer m denotes the size of a backpack. How full you can fill this backpack?
Example:
If we have... |
Problem Statement
You are situated in an N dimensional grid at position (x1, x2, …, xN).
The dimensions of the grid are (D1, D2, …, DN). In one step, you can
walk one step ahead or behind in any one of the N dimensions. (So
there are always 2×N possible different moves). In how many ways can
you take M steps s... |
I've already made an implementation of unsorted List but I'm not happy with results it gives. It looks like Big-O is nearly \$N^2\$ which is, I suppose, not correct for my list.
Here's the graph that shows the problem:
The X axis represents number of total operations: adding new elements and same number of deleting ma... |
This is purely testing my skills; I am not actually coding for a bank. This is part of a bank account class.
public void withDraw(double amount)
{
if(balance - amount >= odLimit)
{
balance -= amount;
}
else
{
Console.WriteLine("Error. Withdrawing wil... |
I have written this code that takes input from a file and creates an output file that reports each person's name, percentage of B answers, and personality. However, the my computePersonality method, which takes the contents of an integer array and converts it into a string of \$4\$ letters based on if the number in the... |
I have implemented a basic stack just for fun. I've just started learning about move constructors and assignment and move semantics as a whole, so I would really appreciate some feedback as to whether I've done it right, and if not, some tips as to how I should do it would be most welcome!
I'm also following the examp... |
I do need to use jquery autocomplete for two inputs. But I have use same processing script for these two elements.
At this stage I am doing it like this.
$("#suburb").autocomplete({
source: function(request, response) {
$.ajax({
url: "includes/state_au_ajax.php",
dataType: "jso... |
I wrote a solution in Java to solve the problem here. I use BigInteger to convert first from base 16 to base 10, then base 10 to base 64.
This seems quite inefficient to me, and I would have no idea how to do this if I couldn't use BigInteger. I'm sure there's a nice and clever way to do this using a lot more bit ma... |
I have spent a few days coding an ATM. What I'm looking for is some critique of my work. Is there anything I can do better here?
The entire project has 9 files and one class, a checking account and savings accounts. It also has a section for loans (thought it was different). Any advice, or input would be greatly appre... |
I have implemented class which manages communication with measuring device, which sends list of assignments, like variableName=value. These assignments are always separated by space. There are two options, the first is simple assignment variableName=value (without space around equal sign), the second is "array assignme... |
This is my first programming project with real world application. It's purpose is to take a file from a directory, encrypt it with a predetermined password, and email to appropriate recipient.
ID Email and Password are found in a CSV file that I created EmailDict from.
ID and Filename are parsed and dropped into File... |
The evaluate_guess function below returns the evaluation of a guess with respect to Mastermind game rules:
# sample secret code and guess
secret_code = ["a", "a", "c", "a"]
guess = ["c", "a", "a", "b"]
def evaluate_guess(secret_code, guess):
score = []
temp_list = secret_code.copy()
for i in range(len(se... |
I have a file that at some point contains a line of the following form:
OutputFilename output.root
I want to write a Python function that replaces the text after "OutputFilename" and saves to a new file.
I have made the following attempt, which works, but I'm sure there must be a more efficient, Pythonic way to do thi... |
How can I improve the style to avoid so many float64()s?
func IsInTimeRange(tvalue int32,timeout int){
t := time.Now().Unix()
return int(math.Abs(float64(t)-float64(tvalue))) < timeout
}
|
So I've completely changed how BrainfuckSharp does things, and added some features. This is obviously a follow up to: Interpreting Brainfuck code to C#, then compiling to a .exe
It now features an OptimizationLevel (currently hardcoded, will fix for the future) that allows you to indicate how far you want the interpret... |
Needing a way to read the number of lines on a web page for the purpose of a progress bar the following method is created:
private static int countPageLines(String url) throws IOException {
URL page = null;
BufferedReader in = null;
int count = 0;
try {
page = new URL(url);
... |
I've been reading about Memory Pools since I came across them in the book Game Programming Complete 4th Edition, and I decided to try and spin my own since I didn't quite understand how the one they presented in the book worked at the time.
One thing I'm uncertain of is defining the deleter in the shared_ptr. I don't l... |
I just want to confirm that my ISO8583 format is correct.
Example:
For the data field 35, the length of the data is 36, so I put 36 before the 4842. Then all the data is inserted in a string (dataISO). This dataISO variable is then sent to another function SendISO().
private void btnSend_Click(object sender, RoutedEven... |
I was asked a question to write a optimal program that would determine the total number of stops a elevator has taken to serve X number of people.
There is a elevator in a building with M floors. This elevator can take a max of X people at a time or max of total weight Y. Given that a set of people has arrived and thei... |
I have this code below that needs to query multiple database tables.
import mysql.connector
import itertools, time
cnx = mysql.connector.connect(host="host", port=3306, user="user", passwd="pass", db="factory")
cursor = cnx.cursor()
cursor.execute("select distinct(batch) from batchdata where equipment = 'DUV001'"... |
I developed a javascript component to display a tree, based on D3.js
I'm not sure how clean my code is, I'm not used to code a lot of javascript and I'm constrained to write everything in 1 file.
So I'd take every advice on how to make this code better.
And in particular, there's a behaviour I don't understand: a "magi... |
My code implementing rock, paper and scissors in Python, using dicts to hold choices.
import random
choices = ['rock', 'paper', 'scissors']
def choice():
player_choice = raw_input('Choose rock, paper or scissors: ')
if player_choice.lower() in choices:
computer_choice = random.choice(choices)
... |
How to know if my code is spaghetti or not?
Is this is spaghetti code?
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
((Core) getActivity()).emailCore();
((Core) getActivity()).messengerSharer();
... |
Is static imports making my code incomprehensible?
If I have static a variable in a class, and I call it in another class:
MainClass.java :
public static String NAME = "Jack";
and:
AnotherClass.java :
textView.setText(MainClass.NAME);
What if I just made that in AnotherClass?
import static com.example.MainClass.NAME;... |
I have an API for managing an email mailbox. There is a class called Message, and it has two Move overloads:
/// <summary>
/// Move this message to the mailbox folder whose path is provided.
/// </summary>
/// <param name="toFolderPath">The path to the mailbox folder to which this message will be moved.</param>
/// <p... |
When a user registers (creates a new account), I want to encrypt password before storing in a database, and when a user logs on (with username & password) I want to check password. I did it in the following way:
function password_encrypt($pass) {
$hash_format = "$2y$10$"; // Tells PHP to use Blowfish with a "cost" ... |
I need to return True if a page contains any of a list of element types. This code works.
var elements = 0;
var content = $('.TestModule');
if (content !== null && typeof (content) !== "undefined") {
elements += content.first().find('.btn').length;
elements += content.first().find('.textbox').length;
elemen... |
I have the following code, that groups similar todos into an array of arrays, using lodash (https://lodash.com). Here is a plnkr http://plnkr.co/edit/t4J5bKGjMlQxW2z9Zh7x?p=preview (open your console and look into script.js)
function Todo(value) {
this.value = value;
this.isSimilar = function(todo) {
return thi... |
I have a project, that creates a custom DataBaseConnection pool as below:
public abstract class ObjectPool<T> {
private final long expirationTime;
private final Integer minimumConnection;
private final Integer maximumConnection;
private final Integer overFlowWaitTime;
/**
* Hash tables t... |
I've built an appointment manager and would like to notify clients 2 hours ahead of time by via email of their scheduled appointment time. I am storing their scheduled time in a MySQL Datetime field.
Example:
2015-11-24, 10:59:05
I currently have a cron scheduled to run every minute and collect the emails to be sent:... |
To get started with C++11/14/17, I decided to write a program that brute forces the problem described in this video (and gives a progress update every few seconds):
Divide the numbers [0, 31] into two sets A and B such that
\$\sum_A {a} = \sum_B{b}\$
\$\sum_A {a^2} = \sum_B{b^2}\$
\$\sum_A {a^3} = \sum_B{b^3}\$
\$\su... |
I need to create a byte array with 100 bytes from a string. The length of the string is unknown but it is always less than 100 bytes. So if the string is 65 bytes then i need the array to be 35 zero bytes and then the String bytes to follow.
At the moment i have something like this, that does the job, but maybe someth... |
I want to make it lightweight (fastest, best performance) as it possible for browser, but I have no idea - I haven't huge knowledge about JavaScript.
That code run parallax effect on my web page. I have three parallax containers, which are different position background image. Script call on scroll event and when some c... |
I'm working on small Javascript code that adds text from a clicked-href to the top right corner of the Wikipedia page. So for example, if I click the "Jamaican" link in Sly and Robbie, a textbox would be appended to the page on the top right.
Note: to test this code, copy it and paste it to your console, then click som... |
I have a form that I submit with these variables: category_time, date_month, date_year, and status_time.
Here is an example of different form possibilities:
CATEGORY_TIME 1
DATE_MONTH Month:
DATE_YEAR Year:
FIELDNAMES DATE_MONTH,DATE_YEAR,SUBMIT
STATUS_TIME Select:
SUBMIT submit
----------------
CA... |
I've written a bit of code designed to go through a log file and determine successes and failures for certain criteria for each server in an environment. The code works just fine, except that on environments of larger size, it's just too slow. Currently it's running on a 2000 server environment with 18 criteria and 500... |
I wrote this code to find if a directed graph contains a loop or not. I am pretty new to graphs and I saw some examples on the internet but couldn't actually understand their implementations. So I read somewhere that you can colour mark the nodes. So this is my iterative implementation of that method. Is it an okay'ish... |
My aim is to write a C program (I must create a function) that, given a string and a character, returns another string without the given char value.
For example: function("Hello World!", 'l'); /* Prints "Heo Word!" */
So I've programmed a lot with Java and I am used to programming but I am not used to C and in particu... |
I have removed a lot of the code, but you should get an idea of what I am doing:
<?php
$upOne = realpath(__DIR__ . '/..');
require_once $upOne . '/vendor/autoload.php';
use phpseclib\Net\SFTP;
$errors = array();
$fileData = array();
$inputArray = array();
$config = new CONFIG\Config();
if (empty($_POST['emailAdd']... |
Originally I had tried to implement this topic after having learned about Inheritence and posted it on here, but that forced complexity and the main suggestion was that this was ideal for templates. Now that I've learnt about templates I was hoping someone could review my code for a basic implementation of mathematical... |
I have the following code that works great, but takes 40 mins to 1 hours to finish the task. It has at least 30 rules for blocking lines, and 30k+ orders to check. I'm new to Python (3 months working with it), so I don't know what can I change to make it run faster. The version in my computer is Python 2.7.9.
import co... |
Given two strings, for example
s1 = "Valentino Rossi" (which may contain as many spaces between the 2 words as I like)
s2 = "Vale"
I have to create a function that requests these two strings and that it outputs another one like this one: "Valentino (Vale) Rossi".
So for example if I have
s1 = "Mario Belli... |
I've been playing around with some basic algorithms in Swift. Here I am trying to generate phone words, words which can be mapped from phone numbers using the characters under each digit. I was trying to use map/filter etc.. as much as possible, do you think the result ended up being more readable or less?
First step, ... |
I come from a PHP object oriented framework background (Laravel, Symfony, Silex...). With that, validation comes in pre-built classes mechanism in a framework that validates for you parameters that you define and validates against. If it fails validation, you don't proceed.
Example from Laravel:
public function store... |
There are 12 gates. Using our face recognition system, we check every person who tries to enter each gates. My MVC web application is to show the result data to the gate-keeper. And this is the important part. The people in the control center look closely at the current situations in real time.
To put it simply, always... |
I have some JS code that when the user clicks the "add" button, some text is displayed to a textarea.
The code seems to be working OK. However, I realize I must refactor the code so that I am using only the one on click function instead of the six that I have for each of the 6 add buttons.
$('#row_split_id_cover_letter... |
My Java is very rusty and I have been unlucky finding a better way to accomplish this task. I have two different methods which get called based on which radio button is selected. Is there a cleaner way to store/determine which radio button is currently selected in order to call the appropriate method? Here is the seg... |
I am a beginner in C and wrote this code to implement ARP.
3 threads are present - one to respond/receive any ARP packet targeted to me, one to refresh the ARP table on a periodic basis, and one to transmit packets present in the buffer.
An ARP table is implemented in a hash table. The sensitive areas are:
A reply nee... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.