instruction stringlengths 71 71.9k |
|---|
I need to create a phone directory with given inputs, then I need to
query the dictionary for unknown number of given keys, if not found,
print Not found. Link of Original HackerRank Problem here
I have written this code in Python3, and it's working fine. Please review, and suggest other ways of taking unknown nu... |
Here is the problem, any advice about code improvement, more efficient implementation in terms of time complexity, functional bugs, etc. are appreciated.
Given an unsorted integer array, find the first missing positive
integer.
For example,
Given [1,2,0] return 3,
and [3,4,-1,1] return 2.
Your algorithm should r... |
Problem statement
Given a matrix (up to 300 × 300), rotate each element R steps anti-clockwise along concentric rectangular paths (R up to 109).
The algorithm is rated as hard on HackerRank.
On April, 2016, I wrote the algorithm with a bug, scored 8 out of maximum 80 points. I could not find the bug after hours wor... |
I want to skip validations based on attributes. If certain attributes are not in form so I do not want to validate them.
Currently, if I post them from one form which has 1 field, it still validates other 9 fields and show me errors that it cant be blank.
If I check from big form which has 10 fields, it passes successf... |
I just have started to introduce myself into network programming using C++. So I started with Winsock. The code I made is compiled with MinGW and works perfectly!
As a beginner, the main purpose of code was to do what I wanted. Now it's time to go to next level!
The program will download a webpage source using a given ... |
The code below takes two command line arguments, an absolute folder path and integer, which is the minimum number of qualifying photos in each folder required to return a positive search result.
Saves/prints to screen a dictionary containing the path of the photo containing folders and the paths of the images within ... |
I want to allow anyone that has never coded to make classes depending on my template with little to no knowledge of Python.
These classes need to do 2 things:
Inherit from other classes similar to them.
Contain variables, updating values if they have been changed or keeping them if not.
For the sake of simplicity I d... |
I have gone through all steps to optimize the code, deactivating screenupdate, deactivating calculation, events, and pagebreaks removed the unnecessary selects, adding constants, and etc. However, I don't think my algorithm for coping is the best one, even if it is probably the simplest of them all.
For Each cell In cu... |
A version of CGOL made in Python using the turtle module.
Any suggestions for optimisations or improvement:
import time
import turtle
import threading
wn = turtle.Screen()
t = turtle.Turtle()
t.penup()
t.speed(0)
t.ht()
mode = int(input("What mode do you want to use to get the initial state? (1 - from a .cgol file,2 - ... |
I have written this code in C# and have tested this code to ensure it works well. Any other suggestions for this code would be appreciated as I have a number of users who are sending data on this port.
private Socket serverSocket = null;
private List<EndPoint> clientList = new List<EndPoint>();
private byte[] byteData ... |
This is my implementation of calculating CRCs which supports arbitrary polynomials specified in different representations (according to the explanations given here and here).
My concerns are:
I don't like the weak typing (having to supply the numeric value and its size for both the data and the polynomial; possibility... |
Awhile back, I wrote a quick and dirty webapp to read the remote server's log files, without a user needing to ssh in to view it via command line. It's meant to be a quick and dirty tool since we don't have anything like logstash available.
I am rewriting in Java 8 and have used the Streaming API to remove about 60% of... |
I have this code but it takes over a minute to run. I'm looking at around 400 entries being brought back for the first loop. Any ideas on how it could be improved for speed?
<?php
$context = stream_context_create(array(
'http' => array(
'method' => 'GET',
'header' => "Authorization:... |
I have created a basic login system that asks the user for a password. Here's a list of what it does:
When you run the code it will open an Inputbox asking you for a password.
There is one criteria: You have to enter a password of 8 characters. If you enter a password with less or more, it will give you an error messa... |
I´m working on trying to get the n most frequent items from a pandas dataframe similar to
+----+-----+-------+------+------+------+
| cod| name|sum_vol| date| lat| lon|
+----+-----+-------+------+------+------+
|aggc|23124| 37|201610|-15.42|-32.11|
|aggc|23124| 19|201611|-15.42|-32.11|
| abc| 231| 22... |
I am a beginner with Erlang and currently making my way through the awesome Joe Armstrong's book. The following are my answers to exercises 5 and 6 for the concurrency chapter. The code can probably be much better but at least it seems to work fine after some tests. I'm just happy to be able to understand this language... |
I have some code that I posted as a possible answer on StackOverflow (and the code I post here is almost an exact duplicate of that, but I'd rather include complete information in this post as well so people don't have to jump back and forth between posts to understand the question). I truthfully haven't quite decided ... |
CustomClass.class
Description
The CustomClass is created with init(), which returns a CustomBuilder saving both as static fields.
public class CustomClass {
private static CustomClass customClass;
private static CustomBuilder customBuilder;
public static CustomBuilder init(){
customClass = new Cus... |
I've written a function that searches for the nth occurrence of a character in the given string. A positive value for n will search from left-to-right, while a negative value will search from right-to-left. Zero is not a valid value for n.
Left-to-Right Search
"AABAXYAMN".NthIndexOf('A', 1) -> 0
"AABAXYAMN".NthIndexOf(... |
I am looking for ideas how to improve this cucumber scenario (testing a REST interface) and make it more concise.
Feature: Get list of Logbooks
As a client, I want to get a list of a certain users logbooks so that i can present
the logbooks name and the number of scuba dives to the user.
Scenario: Get a list o... |
I wanted to represent graphs in Python, and wrote the following class. I don't care about values associated with nodes or the weights of the connections between them, simply the connections between nodes.
Is this a good enough implementation? Or is there a significantly better way?
class Graph:
def __init__(self, n... |
While the task at hand is relatively straightforward, it turned out AES in Go is a bit clunky so I was wondering if this seems right. Also, any tips on Go coding in general are more than welcome.
// Package aesjson provides a function to encode an object to JSON and apply
// AES encryption to it.
package aesjson
impor... |
Word Wrap problem in short:
Given n words and a line length, break the words into lines in such a manner that minimizes the sum of the costs of all the lines. Consider the cost of each line being (free space in the line)^2.
I'm supposed to implement an algorithm with \$O(n)\$ time complexity and \$O(n^2)\$ space com... |
I implemented a script for a LinkedIn user to connect with all profiles on a LinkedIn search page and move to the next one automatically.
As I am a new javaScript programmer, could someone look at my code and tell me how to write better code?
// Every 1 second, click all the connect buttons on the result page
window.s... |
I am teaching myself JavaScript and made a little Tic-Tac-Toe web app. I'm not asking anyone to read through it all, but to just tell me what I need or should not do in the future.
var boxes = document.querySelectorAll("td");
var boxtext = document.querySelectorAll("td span");
var player = document.querySelector("#pl... |
Notes:
I know \ are against PEP8; they are for readibility
I created this working through a tutorial
I forgot to add blank lines, so it may be a little squished
''' Tic-Tac-Toe Minimax Program by Peter'''
#Tutorial found at: http://giocc.com/concise-implementation-of-minimax-through-higher-order-functions.html'''
... |
I ask because it seems to be taking waaaay more space/time than it should. Also, I know that if I want to be super efficient I should use Java's BitSet and a Sieve of Eratosthenes, but I wrote it like this to compare to a friend's implementation in C#.
(defn primes-upto [n]
(let [primes (transient [2 3])]
(loop [... |
This is a simple real state based markov chain (I'm using real states instead of a markov matrix to enable making an animated version later).
My goal was to make the markov chain as generic and reusable as possible, while practicing using smart pointers.
What general coding style, performance, semantic, or functional i... |
It is just a simple piece of C code that generates random lenght random HEX srings. Any ideas how this code can be improved?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define MAX_SIZE 256
int main() {
time_t t;
srand((unsigned) time(&t));
const char* digits = "0123456789ABCDEF";
unsig... |
I have started this project basically for learning perspective and wanted to learn good object oriented design. What I am trying to do is making clone of something like this but this is a command line version.
There are lots of bits and pieces of this application that I would like to be reviewed in detail.
Separating ... |
I am a novice coder and I am very new to algorithms. Something about my code leads me to believe that it is unnecessarily verbose and/or inefficient. I am building a command line Mastermind game, and part of the project is to provide feedback for a user's guess. In the game, the codemaker creates a secret code with fou... |
Problem statement:
https://www.hackerrank.com/contests/ncr-codesprint/challenges/spiral-message
You've intercepted an encoded spy message! The message originated as a
single line of one or more space-separated words, but it was encoded
into an matrix as a clockwise spiral starting in the lower left-hand
corner. Fo... |
It's a very simple question, but I wonder if there is a more pythonic way to add each previous elements in a list like this (for example with a list comprehension maybe) :
input : L = [4, 2, 1, 3]
output : new_L = [4, 6, 7, 10]
Which I've done this way :
def add_one_by_one(L):
new_L = []
for elt in L:
... |
Requirements:
Must convert a double to a string, without losing any digits.
Cannot use scientific notation.
In C#, no format string exists that you can you pass into Double.ToString(format) to accomplish this, because ToString will use only 15 digits, even though a double can have 17. Although R and G17 can use 17 di... |
I have made a program to calculate the amount of flour, eggs, sugar and butter required for making lemon cakes and cupcakes.
import math
cupcake = [4, 0.1, 12, 14]
#[Butter, egg, flour, sugar]
lemon = [80, 4.5, 240, 300]
#[Butter, egg, flour, sugar]
cup_in = int(input('How many cupcakes would you like? '))
lem_in = i... |
Can you just shoot me some ideas on how to better structure the program and also if you notice any big no-nos at first glance? This is certainly not production code, it is my first attempt at a data structure implementation in C, which I am also new to. One thing I am aware of/will structure differently next time is th... |
I'm trying to write a function that returns the number of bits set in a 32-bit integer in VBScript, it's just for practising the language. The function I've written so far looks okay, but I'm wondering if there was a simpler solution.
Function countBits(value)
Dim n : n = 0
Dim mask : mask = 1
Dim i
For i = 0 t... |
This is just a simple median calculator that calculates the median for a given array/list.
def median(lst):
nl = []
nl = sorted(lst)
e = int(len(nl))
if e % 2 != 0: # True if odd # of #'s
ind = int(((e / 2.0) - 0.5)) # index of the median
c = nl[ind]
print c
else: # even # o... |
Problem - The classic puzzle of finding the minimum amount of time required to cross a bridge given that only two people can cross the bridge at any one time.
Since they have only one flashlight (it's dark and they need the flashlight), the two people move at the speed of the slower one.
Constraints - Upto 6 people (al... |
A working example of mine, trying to streamlining my Django views, with absolute inspiration from Laravel:
class BaseController(View):
template_404 = "404.html"
def __call__(self, *args, **kwargs):
return self.view(*args, **kwargs)
def view(self, request, slug=None):
method = request.metho... |
I was told to use the following Rabin algorithm to find the shortest distance between 2 points in 2D:
Randomly choose sqrt(n) and brute force to find the closest distance in this set. Let this distance be delta.
Make a delta grid on top of all n points, which partitions all n points into different bins/buckets.
For ea... |
I'm a beginner C programmer. I want to write a program with the following characteristics:
The program is essentially a 'daemon' or a 'service' that sits in the background doing nothing except maintaining a variable value in memory.
Once a program that queries the saved values is executed, the background program shoul... |
I'm just looking for some feedback:
import javax.swing.JFrame;
import java.awt.Color;
import javax.swing.JComboBox;
import javax.swing.JPanel;
public class Clock extends JFrame {
public Clock () {
setContentPane(new ScreenSaver());
}
public static void main(String[] args) {
Clock clock ... |
I have a list of tuples which may vary in size quite significantly. Typical number of tuples in the list would be somewhere around 100.000. I am trying to perform a down-selection on these tuples to end up with a more workable amount of them.
Each tuple contains (among other insignificant for this example data) an inte... |
This code gives the solution to Part 1 of this question:
http://adventofcode.com/2016/day/9
Summary: You have to find the length of the input string after using the markers to duplicate parts of it. A marker is enclosed in parentheses and contains two numbers separated by an x. The first number is the number of followi... |
There can only be better ways to do this?
create strings for today's directory
strDate is yesterday's date in format ddmmyyyy (e.g. 08122016)
DateStr is yesterday's date in format yymmdd (e.g 161208)
strDate = '{d.year}{d.month:02}{d.day:02}'.format(d=datetime.datetime.now()- timedelta(1))
strDate = str(strDate)
da... |
Google FooBar came up a few days ago and I took it as a challenge to learn python quickly while having fun. However, I ran into one challenge today that has left me stumped, I've come up with a solution that finds the correct result, however it is not fast enough for some test cases. How can I improve upon it?
Queue T... |
Amongst the lesser-known unstable sorting algorithms is the QuickXsort family of algorithms, as described in QuickXsort: Efficient Sorting with n log n - 1.399n +o(n) Comparisons on Average by Stefan Edelkamp and Armin Weiß. This family of sorting algorithms tries to exploit the technique of internal buffering that we ... |
I'm evaluating the security level of a file encryption app, which implements Scrypt and Inferno, in an ECIES context. The encrypted files are either stored on the user's PC/laptop, either sent with gmail. I must reach a security level appropriate for files containing sensitive data like credit card number, medical info... |
I wrote a Chrome extension that lists upcoming concerts for the next seven days, this month, and next month. I had trouble with the nextSeven() method, especially transitioning from dates like Dec. 31st to Jan. 1st, hence the really fugly if-statements. I was wondering if anyone had any advice to make the code more con... |
I'm writing a scripting language and I'm trying to implement a dynamic number type in C++. Right now, I'm only interested in getting long doubles and long longs working right. I was able to get this contraption to work. I would like to know if there's an easier, more organized idea than mine.
I don't want the class to ... |
Can my code be reviewed by common C++ formatting standards, and can it be optimized? My code determines if the number (x) you input is greater then the other number (y) you input, the code then prints out the results.
#include <iostream>
#include <stdio.h>
using namespace std;
int oper();
int main() {
oper(); ... |
I'm just learning functional programming in JavaScript using Ramda.
I took this tutorial and implemented the server core.js component using Ramda.
The idea is that we'll have a collection of things to vote from: Movies, songs, programming languages, Horse JS quotes, anything. The app will put them against each other i... |
This code invokes a function for every 40 seconds inside a loop. I am doubtful about this condition:
if ((time_left <= 0 || time_left > interval))
Is only checking (time_left <= 0) fine? I referred to some websites and they have also added a check for time_left > interval. Is this check required?
int print_timed_op(... |
For the past few weeks, I've been using the wonderful cJSON to add content to my game. But recently, I got tired of JSON's verbosity so I decided to roll my own format called SON (Simple Object Notation). I plan on using this format in all of my future game projects.
rogue
anim
timer 0
brain
typ... |
This program calculates wood length and area of glass required for the window.
I am a beginner in C# and I want to know how professional programmers will write program like this.
double width, height, woodLength, glassArea;
const double MAX_WIDTH = 5.0;
const double MIN_WIDTH = 0.5;
con... |
I started picking up Rust on my free time, and I'm curious about what style errors have I made and where should I improve as a programmer.
The problem is from HackerRank and very simple: there is a fixed-format input of time in 12 hour format (07:05:45PM), and the objective is to convert it to 24 hour format (19:05:45)... |
EDIT 1
Changed code to PEP8
My task is to create custom script to control PTZ (pan-tilt-zoom) cameras. We have an application for video surveillance but problem is that some functions are missing, like speed zoom out. Also, some cameras loses focus etc.
My idea is to create appindicator to control cameras from there.... |
This question is part of a series solving the Rosalind challenges. For the previous question in this series, see Calculating protein mass ruby. The repository with all my up-to-date solutions so far can be found here.
I started the Rosalind challenges roughly a year ago in Ruby. Now I got curious whether I could do th... |
This is my first go at a Go program that's not a variation of "Hello {$name}". It's about twice as long as my previous Python implementation, and perhaps an order of magnitude messier.
The goal is to read in /etc/hosts and combine the various entries I've made over time:
127.0.0.1 host1.test
127.0.0.1 host2.test
111.11... |
I currently have the following code:
unsigned int symToZ(const std::string & sym){
unsigned int atomicNum;
if(sym == "H"){atomicNum = 1;}
else if(sym == "He"){atomicNum = 2;}
else if(sym == "Li"){atomicNum = 3;}
else if(sym == "Be"){atomicNum = 4;}
else if(sym == "B"){atomicNum = 5;}
else if... |
Please check the code to see if there anything I can improve .
Everyting is working as expected.
matrix.h
#ifndef Matrix_h
#define Matrix_h
using namespace std;
class Matrix
{
private:
int rows;
int cols;
int **Mat;
public:
Matrix (const int &rows,const int &cols);
Matrix(const Matrix &other);
~... |
This is a simple tool to parallelize execution of multiple tasks in Bash, since env_parallel can't handle the environment size (or something of the sort - dies for mysterious reasons.) I'd love to hear your critique.
#
# Simple parallel executor. Takes a list of commands and executes each in its own child process. Ass... |
To learn Go I decided to write a vowel/consonant counter. I really need tips/ideas on how I can improve my code.
package main
import (
"os"
"bufio"
"fmt"
)
func isVowel(x string) bool {
vowels := [5]string{"a", "e", "i", "o", "u",}
vowelLookupTable := make(map[string]bool)
for _, v := range vo... |
I have implemented Dijkstra's algorithm using a slightly modified version of the structure and class posted here. Unfortunately, I have ruined the efficiency. I am intent on using this structure. I will NOT use BOOST. Any STL algorithms are acceptable.
#include <iostream>
#include <vector>
#include <map>
#include <stri... |
For part of a project, I was given this directive:
The “ls” command will require you to use directory functions to list
out what the filenames are in the directory. Functions required to
make a “ls” command work are included in the <dirent.h> header file (
man dirent ). You will need to open a directory and iter... |
I have taken advice on board and had a go at a new project, to write a program that lets you play the card/dice game, Machi Koro. The complexity of the game isn't too great, which makes it a good target.
What I would like reviewing is the first "real-world" class I have created, the Establishment. There are many differ... |
Looking for a general review.
pub struct BitVector {
bits: Vec<u8>,
size: usize,
}
impl BitVector {
pub fn new() -> BitVector {
BitVector {
bits: Vec::new(),
size: 0,
}
}
pub fn push(&mut self, bit: bool) {
let leftover = self.size % 8;
if le... |
I am no longer running this server, nor does this question reflect my current political views.
I am currently running a small Donald Trump-themed Discord server. Recently, a few members requested that I create a bot for the server, so I obliged and created, this, TrumpBot. It uses the Discord.Net API to interface with ... |
I've programmed a few Project Euler problem but they are all separated in different solutions so I decided to group them all together in a nice Windows forms application. Here's how it looks like :
You can select any of the available problems from the list check the answer and the execution time. I'm looking primarly ... |
Find the substring count from a string without string functions in Java. Given String str = "abcdefghcde"; and String find = "cde";, count occurrences of "cde" in String str.
Taking into account overlaps.
Example: String str = "cdcdcdc"; and String find = "cdc";, occurrence count is 3
Please give any feedback about ... |
I'm trying to increase my hash table size by two if the table is filled more than half of it. I tried to rehash every single element from the old table and put it back to my new table, then assign my old table as the new table again. What do you guys think of my own created function? I'm practicing for my final exam an... |
I was creating some solving algorithm and write test for it. this is the tests :
@Test
public void test1(){
boolean expected = true;
int n = 7;
DigitIncreasing digitIncreasing = new DigitIncreasing();
assertEquals(expected,digitIncreasing.isDigitIncreasing(n));
}
@Test
... |
I am working on an implementation of the Needleman-Wunsch sequence alignment algorithm in python, and I've already implemented the one that uses a linear gap penalty equation for scoring, but now I'm trying to write one that uses an affine gap penalty equation.
I tried using as a reference the chapter that covers this ... |
This is my attempt to solve the percolation problem for the Princeton Algorithm-I course, the problem is well-defined here. My implementation is in C++ not Java and the following procedure is followed:
Create an NxN grid using QuickUnion class and keep track of each grid site by labeling it (except the first row that ... |
I want to encode unicode codepoints to UTF-8 manually. I wrote the following C# code. I tested it with some cases I know, but I would like to know if it's correct for all inputs. I know that Unicode codepoints are undefined beyond 0x10FFFF ,but I don't care about that. Therefore the output of my method might be more th... |
I have an autofiltered table in Excel. I have to copy/paste values based on certain conditions and I also have to perform this on all visible cells in a particular column. I have written the code and it works well but the only thing is that it takes a lot of time as there are many rows. Can anyone please help me how to... |
I attempted the Business Rules Kata. Here's a video overview.
However, I am not confident that going functional is a good strategy for the following objective:
How can you tame these wild business rules? How can you build a system
that will be flexible enough to handle both the complexity and the
need for change? ... |
I need to create this eventEmitter class with the functions listed below. I think I could clean the code a little but don't really know where to start.
var eventEmitter =function (){
this.listeners = 0;
this.events = {};
return this;
};
eventEmitter.prototype.on = function(ev, cb) {
if (typeof ev !== 'string... |
I have a log file with a million lines, and my task is to code something that outputs the lines that have duplicates, and the line numbers.
I've thought of two ways to approach this :
1) Use python's inner tools :
load my file's lines in a list,
load them in a dict in which the keys are the lines, and the values are... |
I'd like to know if the following code is a good implementation of MergeSort? I tried some examples and the code was right, so I guess that the algorithm works correctly.
public static int[] myMerge (int[] array, int[] array2){
int[] giveback = new int[array.length + array2.length];
int i = 0;
int j = 0; ... |
A week ago I did a three function calculator, I took the input from you guys and made it better. Overall it works fine, I didn't find any problems. But as a beginning programer I'd like some input on this calculator.
// Three function Calculator.cpp : main project file.
#include "stdafx.h"
#include<iostream>
using std:... |
For part of a project, I was given this directive:
The grep command will take an exact string and an exact filename as
the 2 arguments and you will need to search through the filename for
the given string and display the "line" and "line number" the string
resides in.
Example output would be:
# grep bob FileWi... |
We have written a Python script using arcpy modules. It is was written by Python beginners and many parts of the code are written in 'unpythonic way'. The goal is to re-write or address 'unpythonic' code. The software used for this script are ArcMap 10.4 and written in Python 2.7. The complete script is available on Gi... |
I have built a Vue app which fetches data from an endpoint and presents that data in a table with sortable columns.
The app is based on this React challenge which is to create a table of users and their properties, from the data provided in the endpoint.
Here are the user stories fulfilled:
I can see a table of the F... |
Its purpose is to find the longest path in an equally-weighted tree denoted as such:
3
1 2
2 3
The first number denotes both the number of vertices and the number of edges (3 - 1).
(defn farthest [edg current-node entry-node len]
(let [
farthest-key (atom current-node)
farthest-val (atom len)
... |
Here is my code for classic merge sort. My question is, each time I create a new list result to merge sub-parts, is there a way to save the space -- not creating a new list result?
Besides my above major question, any advice for code improvement, bugs, performance (algorithm time complexity perspective) is highly appre... |
My goal was to create a function that could check for duplicates in an array no matter what the data type was, given that the size of the data type was provided. This was done by using the \$\mathcal{O}(n^2)\$ algorithm and casting to char because of its 1 byte property.
/**
* Returns count of duplicates in an array
... |
How can I make this better?
import random
def roll():
input("Press Enter to roll")
dice = random.randint(1, 6) + random.randint(1, 6)
print("You rolled a {}" .format(dice))
return dice
def checkRoll(dice):
if dice == 7 or dice == 11:
print("You win")
playAgain()
elif dice == 2 ... |
This code is written to find substring count in a string in Python 3. The original problem description is here. Please suggest better ways of solving this.
string =input()
substring = input()
count = 0
i=0
while(i<(len(string)-len(substring))):
if(string.find(substring,i,len(string))>=0):
count+=1
i... |
RunMyAtm
package ATM;
import java.util.*;
import java.io.*;
public class RunMyAtm
{
int input;
static Scanner sc = new Scanner(System.in);
Account[] myAccounts = new Account[3];
public static void main(String[] args)
{
RunMyAtm rma = new RunMyAtm();
rma.preAtmMenu();
}
public void preAtmMenu()
{ ... |
Here is my code of serialize and de-serialize a binary tree, looking for advice. One issue in my mind which I cannot resolve is, I am using a global variable index, wondering if more elegant solutions in Python 2.7 -- since in Python there is no solution to pass a reference as Java/C++ did.
index = 0
class Node:
d... |
In this program, there is a code that the user has to try to solve in 10 guesses. If you have any numbers in the right spot, it will tell you how many you have correct and the value of the correct numbers so you can figure it out.
I know there has to be a much simpler way to do this, I just can't put one together. I... |
I'm currently enrolled in a node.js course. The first app we have done in the course was a terminal notebook. It appends objects to a json-file.
Example call on the terminal:
node notebook.js add Second "Aenean commodo ligula eget dolor."
Example structure json-file:
[{
"title": "First",
"timestamp": 1481534161237... |
The following code snippet is about adding rules that filters Payment Methods listing to customer, for email we provide 4 different types of payment methods, but we do show them depending on some rules.
<?php
namespace App\Services\Checkout\Module;
use App\Services\Checkout\Module\PaymentMethodRules\PaymentMethodRule;... |
I have written a solution for the codility task which is Binary Gap.
finding the highest gap in Binary. for example 1041 is the input number and convert it to binary the result is 5. here is the code :
package codility
import(
"strconv"
)
func Solutions(N int) int{
binary := convertNumberToBinary(N)
res... |
I wrote a node editor library which can be found here. What can I do to make the code more readable and maintainable? I'd like to stay in plain javascript and keep a single reference to use the library.
"use strict";
/**************************
* Main object
**************************/
var Ned = {
create(svg) {
... |
I need to implement a hash function for a key of type structure. This structure is as follows:
typedef struct hash_key_s {
void *k1;
char *k2;
char *k3;
} hash_key_t;
My proposed hash function is as follows:
unsigned long hash_func (void *key)
{
hash_key_t *k = (hash_key_t *) key;
unsigned long h ... |
The code below uses a single command line 'filename' argument to create a batch and python skeleton script file in the cwd. The python file is then automatically opened in IDLE for convenience.
As a beginner making a significant amount of python files for worked educational examples this could save me 15 minutes per da... |
This is an efficiency question to the following code, written in MS Visual in C#. If any explanation is missing, please let me know and I will add. What this part of the program does is:
Button is pushed
Motor starts moving (by sending 9-byte array with command)
Waiting for Sensor to register a change in value
Motor ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.