instruction stringlengths 71 71.9k |
|---|
As title says, this piece of code migrates files (binary and metadata) from a database to another one with different structure.
Currently my problem is that when I have to deal with a big database (between 12 and 30GB) , at a certain point the script CRASHES. With the 30GB database, this took 4 days of activity and th... |
I've developed a spreadsheet that has evolved over several years to help keep track of the number of student contact hours that have been used to help flag up when students have run out / are running out of allocated hours (so that additional hour requests can be made if necessary).
There is a master workbook, which co... |
The task is to merge 2 text files containing sorted integers into one file. Each number in both files is stored in new line(there are no empty lines,and only numbers are stored). Requirements are that if file1 has n numbers and file2 has m numbers, running time must be O(n+m) and memory consumption O(1).
My current sol... |
I'm looking for feedback about anything and everything to do with this short program. For example, is there a risk in not sanitising the data, and if so, how would I do that given the need for non-alpha-numerics? How is the logic? Is my html up to date? Suggestions for styling? All input appreciated. I'm on a learning ... |
Please help me reduce its complexity and maybe optimize it a little bit more.
#include <stdio.h>
#include <string.h>
#include <time.h>
#define size 3
void Clear_board(char (*)[size]);
void Player_turn(char (*)[size],char);
void PC_turn(char (*)[size],char,char,int*);
void Print_board(char (*)[size]);
void Scan_corners... |
I have a process that does a bunch of document processing. One of the tasks being performed is OCR, which is the slowest part of the process, so I decided to run that in another thread.
I decided the producer/consumer would work best because I will be adding document ids as each document is being processed (and ther... |
I have some code that reads from an XML file and updates if needed. I want to move some of the stuff around. Here is the code overall:
priv.refAddUpdate = function(addressDoc, addressLine, value)
{
if(!S(value).isEmpty())
{
var found = $(addressDoc).find('addressLines').find(addressLine);
if(found.lengt... |
I just picked up Async Await and I am trying to use Async Await in Console App along with TPL for querying webservices. The code works fine and I am able to get the speed using HttpClient and async. Wanted to know if I am overusing async/await and if there is anything that I should avoid and can be simplified further.
... |
I have a modified version of the first Project Euler problem — where I find the sum of all the numbers below the value 2100000000 that are multiples of 3 or 5 using a multi-threaded program.
The concept of the partially-multi-threaded version: we have a value sum, where we add together all the multiples of 3 (that are ... |
In my office, we use a software called Blue Prism, a Robotic Process Automation System. The idea is to allocate tasks for the robots to perform thereby simulating users. The system enables you to use a code stage ( with an option of C# with dotnet framework 2.0) and to import some objects in C#, you require a DataTable... |
I'm a complete beginner at python and I know I'm probably approaching this the wrong way but I've tried making a quiz and can't work out how to make it more concise and work with longer lists of questions and answers without having to use lots of "if" statements. Here's the code:
import random
score = 0
questions = [... |
I have written a small calculator REST API and I need someone to look the structure and design of what I did. I want to know how I can make it better. Here is an example with multiplication. Other operations are similar.
Task was to write RESTfull API that will take request like this /multiply/a/b/c with double type p... |
This is my attempt at the mirror encryption challenge posted on r/dailyprogrammer/. The idea is that each character is to be replaced by its counterpart in the mirror field, as if a laser pointer were reflected off of all of the diagonal barriers in the grid.
Since I am relatively new to python, I'd like for someone t... |
As a study project I was supposed to write an RSS reader in Java (I used Swing to make GUI) using MVC pattern.
I finished it, but it's not quite polished yet (still gotta write these javadocs and add deleting categories/channels) and there are most likely a lot of dumb things as I wrote my first line of code in Java a ... |
Quite similar to my earlier review this script parses a frequency calculation and reformats the found values to either fit into one row for easier importing into a spreadsheet software or a formatted table.
The whole project including sample calculation files for testing can be found on github. I checked the script wit... |
In Voxel Islands, each individual voxel is represented by their own unique class. Each of those unique classes is a subclass of a parent, Voxel class:
using UnityEngine;
using System.Collections;
using VoxelIslands.Engine.Utilities;
namespace VoxelIslands.Engine
{
/// <summary>
/// This class represents a voxe... |
Background
I often see blogs/articles split out the implementation of the Query and QueryHandler classes. I had briefly asked a question on Stack Overflow about whether or not a self-executing Query class would be a violation of SOLID design principals (I deleted the question as it was feeling like the wrong place to a... |
I was wondering if I am doing any useless conversions byte←→int, for example:
byte((int(ch-'A')+shift)%26 + 'A')
Converting ch-'A' to an int is because the shift argument can be negative (to implement the decode function). I couldn't figure out a simpler way to negate the operation using bytes.
package main
import (
... |
While reviewing Encryption using a mirror field, I decided to write my own solution from scratch. The challenge, from Reddit's /r/dailyprogrammer, is to implement a monoalphabetic substitution cipher whose key is derived from a pictorial 13×13 grid. Here's a simplified 5×5 example:
abcde
A \ f
B g
C \ h
D ... |
Here's my implementation of Game of Life. I'm quite new to Python and would like to know how could I improve that code, especially in terms of performance, compactness and readability.
import copy
import pygame
from pygame import *
import random
#constants
red = (255, 0, 0)
black = (0, 0, 0)
white = (255, 255, 255)
#n... |
The four parameters a, b, c and d can be -1 (meaning it's not set) or a random one of {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}. If they are different from -1, they are guaranteed to be distinct.
The code looks at the four least significant bits of the four ints and tests if they all have a bit in common:
... |
I'm making a simple guess a number game. In game, user should input minimum and maximum value and program should generate random number between this numbers, later user should try and guess the number.
This is one of my first programs, so I'd like to check my coding techniques, what should I do differently etc.
I have ... |
I have solved the problem "Substitute" at Topcoder.
A simple, easy to remember system for encoding integer amounts can be very useful. For example, dealers at flea markets put the information about an item on a card that they let potential buyers see. They find it advantageous to encode the amount they originally paid... |
We have an integer array as:
private int[] arr = {1, 3, 5, 14, 18, 29, 78};
We have a function which takes three inputs of the array and checks whether:
a * a = b * b + c * c
If the function returns true then those 3 inputs are stored in an ArrayList:
private boolean findTriplet(int a, int b, int c) {
int squareA... |
This is a simple script for moving my MP3 files from one directory to another. I'd like to know if there is a more efficient way to handle my task in the script. I analyzed the algorithm to be \$O(n^2)\$.
import os
import shutil
import re
files = os.listdir(os.path.dirname('/home/rich/Downloads/'))
regex = r"(.mp3)"
... |
I want to compare (500) and find duplicate daily records within 2 sheets, and copy the unmatched row to another sheet, copy the match from another to 3rd sheet, and delete the matched records from original sheet.
I have 3 worksheets (results, Master List, Follow Ups) " results" update daily with 500 records, and added ... |
The reliability polynomial (specifically, the all-terminal reliability polynomial) is, given a value \$0 \le p \le 1\$, outputs the probability that a given graph \$G\$ is connected.
Note: at the link given, the probability is given to an edge being deleted, and not to an edge existing (which is the definition we will ... |
I want to capture some state in a Haskell function. For instance, I have many thread trying to print on the console and I want the to play nice with each other. So I want to have some XX to make the police among the threads and I want that to be hidden as most as possible to my client.
I can think of a few alternatives... |
I am creating this converter.
There are three units that can be converted: kelvin, celcius and fahrenheit.
I used two variables to check which unit is chosen.
It's cek and cek2.
Is there any way I can shorten this code,
or I just have to add all possible combination using if statements as i am doing now?
if (cek=="cel... |
The purpose of this program is to run an infinite prime generator that won't stop unless I tell the console to stop. This is not a sieve of Eratosthenes; it stores prime numbers in an array and divides by those primes to check if they are prime. This allows me to avoid dividing by the multiple of all primes.
Are there ... |
As a personal exercise, I'm trying to write an algorithm to compute the n-th derivative of an ordered, simplified polynomial (i.e., all like terms have been combined). The polynomial is passed as an ordered list where the i-th index corresponds (though is not equivalent) to the coefficient of x to the n-th power.
Examp... |
I needed a mechanism for creating types dynamicaly from strings and bytes etc.
I tried really hard to use the .net's TypeConverter system as it seemed to be the right choice. Unfortunately it turned out to be extremely hard to customize (either by adding attributes to classes via reflection (which is like hacking it) ... |
I am calling a ajax method for a number of hidden client ids on an aspx page. The ajax method returns some html to a div provided.
So the code looks like below:
<asp:HiddenField runat="server" ID="hdnSomeProperty" Value="False"/>
<asp:HiddenField runat="server" ID="hfMyIndex" Value="0" />
<asp:HiddenField runat="serv... |
Challenge
Given a list of words mixed with extra symbols. Write a program that will clean up the words from extra numbers and symbols.
Specifications
The first argument is a path to a file.
Each line includes a test case.
Each test case is a list of words.
Letters are both lowercase and uppercase, and mixed with ex... |
I have written this code to simulate a Turing machine and wonder what could be improved. In particular, the --tape.end() seems a bit dodgy.
#include <array>
#include <iostream>
#include <list>
typedef enum {right, left} Direction;
template<int n> // n is the number of symbols
struct State {
std::array<in... |
I'm new to C#, so I'm eager for any and all criticism/advice.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FileTransfer
{
class Program
{
private static string targetPath;
public static bool runnin... |
I made a small function that is getting looped when an input is getting focus and stopping the loop when the input is losing focus. Now I would like to know if there is a better way to write this code.
var timer;
function Change () {
if( !$('#eventurl').val() ) {
$("#js-skipbutton").text('overslaan');... |
Does this code outperform the common implementation with path-compression and union-by-rank? I'm still okay with a review.
GitHub
import java.util.*;
public class DisjointSet<E> {
public static void main(String... args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
DisjointSe... |
I started writing this program to get a better understanding of different aspects of Ruby. I tried to follow the ruby style guide here.
What it's supposed to do is take the exercises/tasks you give it, and record those tasks. It uses a record of those tasks to automatically create/update the header row of a .csv file f... |
I am trying to create a function that can either beat numexpr or perform comparably for the vectorized mathematical operation k * exp(ee), where k and ee are 1D arrays of complex numbers. I had tried using OpenMP in Cython directly, but I have resorted to creating a DLL in C++ and then wrapping with Cython. Here are th... |
I have an app that uses the file system a lot to store generated files (zip files and scss/css fil). When a user generates a file, the metadata and other information is stored in the db for later retrieval and action in another part of the app. Through testing or error, I realized the DB and file system could beco... |
I recently decided to code some in Python after coding in Java using lombok for quite some time. However, I got bit real hard when I forgot to implement __eq__, since Lombok normally does it for you.
I decided to try to implement something similar to Lombok's @EqualsAndHashCode, which I called eqhash. Then, I added a s... |
I'm moving away from map, reduce and filter in favour of list comprehensions. I like list comps but I feel like this is getting on the unreadable side.
Is this the most idiomatic way of achieving this? Is it easy enough to read?
int_list = [-1,-3,5,7]
absolute_diffs = [max( [abs( int_2 ) - abs( int_1 ) for int_2 in in... |
Is there a way to collapse multiple_get into as few lines as possible?
def single_get(target):
return [some list of objects] # might be an empty list
def multiple_get(targets):
result = []
for target in targets:
result.extend(single_get(target))
return result
|
I submitted the following Python 3 code for this HackerRank challenge. Given an n × n grid with an m and a p in random cells of the grid, it prints the next step in a path that moves the m to the p. I'd like any feedback on this.
def nextMove(n,r,c,grid):
#First, find the princess
for i in range(len(grid)):
... |
I 'm trying to create a universal CSS template for global styles. I can not find unambiguous recommendations. After inspecting various sites, I have compiled the following template . I ask your advice . Thank you!
*,
*:after,
*:before {
box-sizing: border-box;
}
html,
body {
overflow-x: hidden;
overflow-y:... |
My Person class has two properties; name and surname, and a function that returns the first name and the surname together.
Is there anything that can be done better? Anything that is done poorly?
public class Person
{
private string Firstname { get; set; }
private string Surname { get; set; }
public Person... |
This is the second version of my type converter framework.
The the previous one can be found here: Type creator service & framework
In this version I mostly implemented what @Dmitry Nogin suggested in his great reviews
I also extended it so that each converter has access to all the registered converters in case it need... |
I'm using a simple logger on a server, which uses a method that looks like this:
@Override
public synchronized void write(String logtag, String reason, int severity) {
long logtime = System.currentTimeMillis();
String message = "";
switch (severity) {
case DEBUG:
if (!debug) return;
... |
I wish to make a mixin to produce the following result of modifier classes:
.text-left {
text-align: left
}
.text-right {
text-align: right
}
.text-center {
text-align: center
}
.text-justify {
text-align: justify
}
.float-left {
float: left
}
.float-right {
float: right
}
.float-none {
floa... |
I have a table with (CompanyNumber, File_Date, [various financial results])
I wanted to get only the most recent set of accounts for each company.
After various googling I eventually got a query that does what I want it to do.
Is this a good way of doing it?
N.B. the File_Date field is actually a text field, so need... |
I am getting back into python after a year of not doing it at all. I just wrote a bit of code to create a file that looks like this:
1,2
1,1,1,1
-1,0,1
42,17
Then I decided to take the average of each line and put it into a list. For this I wrote the following:
def line_averages():
out_file = open("data.csv", "w")... |
I am relatively new to Ruby, having worked with Rails for about 8 months.
For fun and my own education, I have written a Ruby gem (no Rails) that models dates with a precision (second, minute, hour, day ... billion years). A big part of my goal was create dates from the date format on Wikidata, and format them as huma... |
Challenge
Write a program which reads a file and outputs a specified number of lines, sorted on length in descending order.
Specifications
The first argument is a path to a file.
The file contains multiple lines.
The first line indicates the number of lines to output.
The following lines are of differing lengths and p... |
This is the "Clean up the words" challenge from CodeEval:
Challenge
Given a list of words mixed with extra symbols. Write a program that will clean up the words from extra numbers and symbols.
Specifications
The first argument is a path to a file.
Each line includes a test case.
Each test case is a list of words.
... |
I'm using the command pattern to enable actions in my game to be undoable. ICommand defines individual commands, ICommandHandler does the undo-redo logic and might be decorated with other handlers like logging etc.
public interface ICommand
{
void Execute();
void Undo();
}
public interface ICommandHandler
{
... |
I was given a school assignment to implement atoi(). Please review my code.
int my_atoi(char *ato)
{
int res;
int sign;
res = 0;
sign = 1;
while (*ato == ' ' || *ato == '\t' || *ato == '\n' || *ato == '\f' || *ato == '\r')
ato++;
if (*ato == '-')
sign = -1;
if (*ato == '-' |... |
I wrote a UserScript that auto-sorts contacts by offline time using the MutationObserver API. I tried to make it as DRY as I could think, and I also tried to make my code as straight-forward as possible, commenting thoroughly. Please let me know any improvements I can make.
// ==UserScript==
// @name Facebook M... |
The problem
Project Euler: 35 is stated in the following way
Circular primes
Problem 35
The number, 197, is called a circular prime because all rotations of
the digits: 197, 971, and 719, are themselves prime.
There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31,
37, 71, 73, 79, and 97.
How many ci... |
I wrote codes that listener and callback function like this:
struct MyListener
{
virtual void callback1(int value) = 0;
virtual void callback2(string value) = 0;
...
};
vector<weak_ptr<MyListener>> _listeners;
void MyClass::fireCallback1(int value)
{
vector<weak_ptr<MyListener>>::iterator iter = _lis... |
I'm attempting a programming challenge type task in C#, where the goal is to determine how many unique strings can be obtained by removing two characters. The prompt for the task implied that I should create the set of all possible strings with 2 chars removed, then return the number of items in the set. I was initiall... |
Following is Objective-C method implementation I did for one of the most simplest sorting algorithms, Bubble Sort to sort an array of integers.
Note:- I have defined it as a static method in the SimpleAlgorithms class.
/**
* When given jumbled or discending ordered array of integers, following bubble sort method will ... |
My code takes a long time for big graphs.
How can I make it faster?
I'm trying to calculate the shortest path for 3 path's using queue but for big input my program crashes.
I'm stuck here. Can someone help me?
def bfs(graph, start, end):
queue = []
queue.append([start])
while queue:
path = queue.pop... |
So I need to update some certain values within text file based on actual values there. Any advice on making it more effective or just readable is appreciated.
Example text file:
Lalala
There is tons of text in this file log-12345sr
And somewhere within
There are log file names log-23456sr
Some more text here
I want ... |
http://pastebin.com/7UqD0gwF
I'm looking for serious feedback on my first serious program.
This is a program to calculate PvZ income over time of sunflowers and sunshrooms on nighttime pool levels.
Shrooms might have an obvious advantage but this program was borne over the idea that once all space allocated to income ... |
I recently tried to dip back into my old JavaScript 'skills' to make a script for Photoshop. It's simply a recursive function that will loop over all the layers in a file and renames any duplicate names to add numbers so every layer name is unique.
In Photoshop, an ArtLayer is just a regular layer, and a LayerSet is a ... |
Implementation of a Robust (i.e. with a finite plane thickness) Sutherland–Hodgman algorithm for clipping polygons against an axis-aligned bounding box. I use the following code only for clipping triangles. So the clipped polygon can consist only of at most 9 vertices. The third-party code of Point, BBox and Lerp is no... |
The institution I work for uses an application that has an awful software bug causing useless <code>span</code> tags to appear next to "misspelled" words in iframes.
For instance, HTML that should look like this:
<span class="myClass">Hello! My name is Tabitha.</span>
...might look like this instead:
<span class="myCl... |
KITTEH HAS IMPROOVD CODE SKILLS, AN NAO HAS BETTR CODE 4 U
This is an improvement of my original Haskell Lolcats Translator, and now features a function to do the translation (recursively?) using a map. I still have two let statements, which I know are frowned upon, but I couldn't get both the strToUpper and inline fma... |
I have the following manager class that handles access and caching attributes from classes. I am a bit worried about the caching mechanism.
Is there a better way of handling it?
public static class AttributeManager
{
private static Dictionary<Type, Attribute> _cache = new Dictionary<Type, Attribute>();
... |
I'm a business student who just started to learn VBA. I am trying to write a macro for a project but only have minimal experience actually stepping into the code.
The macro I have written is to delete all row entries which do not meet my criteria if they contain certain words, including removing those with future month... |
I'm writing a simple shell and want to parse and execute a simple shell script.
PAGER=more
if type less > /dev/null;then PAGER=less; fi
echo $PAGER
printenv|grep $1|$PAGER
The above sets a pager and greps the environment variables for a variable.
I run the script from my shell after I start it:
$ ./shell
'PATH' is ... |
The following code takes in an point array and removes all of the nearby points whilst averaging them based on the conditions past in.
The variable _nCornerTolerance is an int that is calculated prior in the class. Typically it is around 5;
private Point[] AverageNearbyPoints(Point[] points, bool averageLeft, bool aver... |
As stated in the title, the code produces a simple drop-down menu that allows you to select your Starter, Main and Dessert courses, and will show your order in a small box underneath (like a bill).
$(document).ready(function() {
//Variables
var selectedStarter = {
dish: "(None)",
price: 0
};
var selec... |
I have this C implementation of the bottom-up (iterative) mergesort:
mergesort.h:
#ifndef MERGESORT_H
#define MERGESORT_H
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
void my_mergesort(void* base,
size_t num,
size_t size,
int (*c... |
Recently, i have been indulging in a lot of codility challenges to improve my coding performance. For each of this exercise, I always aim for simple solutions as opposed to complicated ones that arrive at the same answer . The question is
Two positive integers N and M are given. Integer N represents the number of choc... |
I did a small sample application for an Interview. Since I didn't got accepted I would like your opinion on how to improve it.
The aux methods are private.
I have a usage_common to remove duplication in the usage and usage_instance methods
add_item_hash is used because the format written in the database is different fr... |
This is the Longest lines challenge from CodeEval:
Challenge
Write a program which reads a file and outputs a specified number of lines, sorted on length in descending order.
Specifications
The first argument is a path to a file.
The file contains multiple lines.
The first line indicates the number of lines to out... |
I got annoyed having to do things like string.IsNullOrEmpty(myString) when it seemed as if myString.IsNullOrEmpty() would perfectly suffice. Therefore, I wrote a small, simple library to wrap the static methods of primitives in extension methods.
I don't suppose there is much to critique about the code itself, as most ... |
I have created a utility class which allows random iteration over an array.
The idea is pretty much a divide and conquer approach.
public class RandomIterator<T> implements Iterator<T> {
//recursion stack
private final LinkedList<int[]> offsets = new LinkedList<>();
private final ThreadLocalRandom random =... |
I am writing a code for Barabási–Albert(BA) model with specific node and edges.
The algorithm is almost like [1] as follows:
1.Add m<N nodes to G.
2.Connect nodes in G randomly until you get a connected graph.
3.Create a new node i.
4.Pick a node j uniformly at random from the graph G. Set p=k(j)/k_tot.
5.Pic... |
I've been working on another timesaver because I really really don't like to type all those validation ifs and exceptions over an over again.
What I came up with this time is a set of validation extensions that make use of expression trees even if very simple ones.
There are three classes. The basis is the Validate cl... |
How would I properly indent this code in PHP (I'm using WordPress)? I'm mostly concerned about how the <button> comes into this equation @ items_wrap.
<?php
if (has_nav_menu('primary_navigation')) :
wp_nav_menu( array(
'theme_location' => 'primary_navigation',
'container' => 'nav',
'con... |
I have a parser which consumes an ordered list of tokens (based on Vim's command grammar) and returns either:
an error object, or
an object that can be directly eval-ed by a separate function (not shown)
The code that calls parse handles both of these cases. I am looking for help with the structure/architecture of t... |
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
int l=0;
bool isprime;
vector<int>primes;
primes.push_back(2);
for (int nur = 3;true;nur+=2)
{
isprime=true;
double ilimit= sqrt(nur);
for (int primecount=0 ;primes[primecount]<=ilimit;primecount++)
{
if ... |
I am working on a fingerprint matching technique and it takes a lot of computation time to obtain the result. I am trying to implement the matching process given in A Minutia Matching Algorithm in Fingerprint Verification. I would like to know if there is any method available to reduce the for loop for this code:
[Tdro... |
I need to transfer purchase order (PO) information from SQL Server into Sage 300 ERP, so using my Linq-to-Sage implementation, I wrote a little console application that connects to a SQL Server database to fetch PO header information, including some metadata telling me whether a purchase order...
is new and should be ... |
What do you think about the following syntax for some very simple and intensively reusable validations?
Does this:
string name = (SomeText)"Hm…";
mean for you a none-safe cast to none-empty required text? How does it play with C# syntax/semantics? So these two should throw:
string name = (SomeText)null;
string name =... |
Inspired by a comment on this question, I thought I'd exercise my C skills by implementing something like it using a priority queue.
The idea is to be able to invoke the program like this:
./longline 10 < /usr/share/dict/linux.words
And get it to print the 10 longest lines in the linux.words file. I chose to impleme... |
I have been working on the following kata from CodeWars. It's basically a Caesar Cipher — see the test cases below my solution code.
Any comments/feedback appreciated!
def encryptor(key, message):
new = ""
for letter in message:
if letter.isalpha():
id = ord(letter)
shift = id+... |
This is my attempt to answer my own equally named question on SO. In this case, I need a method comparing two strings so that the running time is input independent.
// Not private in order to prevent optimizations.
static class Blackhole {
private static void eat(long n) {
dummy += n;
}
// Not priv... |
Keep state the same if it doesn't fall in the following conditions:
Change to 2 if there are exactly 2 ones in the neighbors
Change to 3 if there are more than 2 ones in the neighbors
It is also wrapping around so neighbors can be cyclic.
I wrote a basic structure and modularized it to individual functions. I wish to... |
First here is my settings object below. insight, spike and momentum are binded to 3 checkboxes in the markup. The objective here is to prevent the user from deselecting all choices, 1 choice must remain selected.
var settings = {
user_id : 0,
insight : true,
spike : true,... |
I implemented this solution for the problem. Please provide feedback and review if this can be improved in any way.
public class queueUsingStack {
static Stack<Integer> s1 = new Stack();
static Stack<Integer> s2 = new Stack();
public static void enqueue(int element){
s1.push(element);
Syst... |
I'm looking for a critique of this audio management system I wrote for Unity games. It references a JSON file to trigger the clips by events.
The main AudioController.cs class is pasted below. The full codebase can be found here: https://github.com/GlowLimeGames/audio-system-unity
/*
* Authors): Isaiah Mann
* Descript... |
Up-to-date version: Countable and uncountable sets in .NET (IEnumerable and Predicate).
Here is my own predicate class; it is equipped with some operators. Demo:
using static BusinessObjects;
using static Console;
class Program
{
static void Main(string[] args)
{
WriteLine(Sell("John Doe", "test@examp... |
I'm new to Python! Kindly suggest me improvements!
Problem statement :
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number. A number n is called... |
I am new Python user, who decided to use Python to create simple application that allows for converting json files into flat table and saving the output in cvs format. I was wondering if you could give me some advice how I could improve my code to make it work in more efficient way. I am asking since if I convert relat... |
My naive version now is too slow. I think setting/accessing concurrent atomic bit is way slower compared to access/modify an array of boolean. Second, the parallel execution only happens on the beginning of the process. For bigger numbers, thread-pool is not really active.
public class EratosthenesSieve {
private... |
Simple extension method for Kotlin. Should perform an action on every element in a 2d array. i.e. An array of arrays.
I have made the assumption that because the receiver type is defined as an array of arrays of type T, that I do not need to do any checks or casts.
fun <T> Array<Array<T>>.forEach2d(action: (T) -> Unit)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.