instruction stringlengths 71 71.9k |
|---|
I wrote an answer to this question on the Software Engineering SE site and was hoping to get it critiqued. (I'm told that it's acceptable to do so).
Essentially, this code uses reflection to check to ensure that none of the parameters of a method are null and none of the strings are empty or consist only of whitespace.... |
I am a Year 12 student studying CS for my A-Levels. I have had previous Python experience but it is obviously not to professional/industry standard. Therefore, my goal for this review is for my code to be criticised, allowing me to improve towards reaching such standards.
The program is a computer version of the Battle... |
I wanted to create some kind of generic text-based adventure-game
engine to see if I could build an interesting puzzle out of it.
The idea was to define a mini-language to be able to define the
adventure in a file and provide sessions of play like:
You are at the entrance of a temple. Type temple to go in.
> temple
A ... |
I wrote a solution to HackerRank Strange Counter:
The counter counts down in cycles. At t = 1, the counter displays the number 3. At each subsequent second, the number displayed by the counter decrements by 1.
Each time the counter reaches 1, the number becomes 2× the initial number for that countdown cycle.
The seq... |
I'm struggling with some coding-inexperience. The code I've written below, is extremely inconvenient and ugly to look at.
My question to you is:
How can this be done more efficiently? The way I've chosen to do it, is rather inefficient. Pay attention to the def freq_2dice(n, N): section of the code, as well as the pr... |
This is my first attempt at Scala programming. I tried to be functional but I'm not sure if I have achieved that.
DataTypes.scala
object DataTypes {
case class Position(xPos: Int, yPos: Int)
sealed trait Direction
case object N extends Direction
case object S extends Direction
case object E extends Dire... |
I am looking to speed up the search for black and white images. I have about 150,000 images that I need to check but this is taking so long. How can I speed up the code?
Private Sub BlackOrWhite()
Dim iPath As String = txtFile1.Text
Dim allFiles() As String = IO.Directory.GetFiles(iPath, "*.*", IO.SearchOpt... |
I wrote from the ground up this small piece of code which transforms dates and times formatted in ISO 8601 format into a more human readable format, client-side. The main goal is that you can create multiple and fully customizable instances that differ from each other for any given node living inside the DOM tree. It u... |
This code is meant to reduce a given string as much as possible by deleting adjacent characters. Here are some examples:
reduce('aa') = 'Empty String'
reduce('ab') = 'ab'
reduce('abba') = 'Empty String' # remove 'bb' then 'aa'
reduce('bbb') = 'b' # can only delete 2 chars at a time
This is based off this HackerRank q... |
Here is my iterative implementation of the Counting change example in SICP. Please note that I'm a beginner, which means I only know the basic syntax for the time being.
Requirement:
How many different ways can we make change of $ 1.00, given
half-dollars, quarters, dimes, nickels, and pennies? More generally,
can... |
In my project we have a few singletons, which tends to be problematic in unit tests. So I wanted to find solution for the problem. Here is what I came with so far:
smart_singleton.h
class smart_singleton
{
public:
static std::shared_ptr<smart_singleton> get_instance();
private:
smart_singleton();
smart_si... |
(See the next iteration as well.)
I have this Java program that can en-/decode files, both text and binary. What comes to critique I want to hear anything regarding these points:
Performance,
Modularity,
Coding conventions,
Naming conventions.
Code
BitString.java
package net.coderodde.compression.huffman;
import jav... |
I got fed up off opening a set of applications when I wanted to code. So I decided to read up on AppleScript and came up with the following task for myself.
Open a application of choice on a given page/directory. Arrange that
application depending on your monitor width/height by setting the
application display si... |
In my application I need to perform several SSH commands from Windows to a Linux machine.
Since I need to reduce as much as possible the SSH calls overhead and also limit the number of concurrent SSH commands, I thought to keep some sessions open and create a session pool class to manage this.
The following code se... |
I am implementing my own double-indirecting shared-ownership smart-pointer because I needed a way to replace the managed object a group of smart-pointers is pointing to with a new object (it's the method reset_all in the code below).
I tried to keep this as close as I could to the std::shared_ptr's interface, while avo... |
I would like some opinions on this Mobile Menu plugin I wrote for work. We develop custom WordPress themes, nothing too advanced or anything. I would like if anyone could just take a look and provide any pointers on what I could make better. This is my first actual plugin, so I am open to any critiques.
The functionali... |
I'm curious if there is another way to code this. Could it be done with a while loop for instance?
public static int numUnique(double[] list) {
int uniques = 0;
if(list.length == 0){return 0;}
for(int i = 0; i < list.length; i++){
int dups = 0;
for(int j = i + 1; j < list.length; j++){
... |
Summary
Usage will ask for a Context and a @MenuRes and then use the PopupHack.class to inflate the menu resource and retrieve the Menu and MenuItems.
Reasoning
To allow the creation of a List<Object> by supplying a menu resource xml. For use within a larger project/library.
PopupHack.class
static class PopupHack exten... |
So I have a program that visualizes data from files (csv,txt,etc.). These files are saved to database as individual tables. In my application I have DocumentExplorer which is just a module with a list of available documents(files). You can open and close any document you want, and you can have multiple documents opened... |
I was searching the internet for some Python exercises, and I've found a lab assignment from University of Toronto. Here's the major of it:
Question 1.
Welcome Message In the if __name__ == "__main__" block, write code that displays the following: Welcome to the calculator program. Current value: 0
Question 2.
Dis... |
I have implemented a BST for an assignment in C#. I am still in the process of implementing IEnumerable and ToList functions but the core of this is done.
Please review and critique this code. Additionall, I am using explicit interface implementation in order to force clients to use the interface to code against this.... |
The ZCO is today and I did 5 problems to prepare for it overnight. One of the problems is the CodeChef Chewing problem.
The code takes an integer N that specifies the number of chewing gums, integer K that is the maximum hardness quotient of a pair the chewing gums possible to be eaten. This is followed by N integers ... |
This code is meant to implement a Graph class which has a method that returns a path between 2 nodes using depth-first search.
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an upcoming coding interview.
from queue import PriorityQueue
from copy import deepc... |
# Prints Updates of whats currently happening
print('Importing Libraries')
# imports stuff
from tkinter import *
import sys, string, os, subprocess, openpyxl, time
from selenium import webdriver
from splinter import Browser
from twilio.rest import TwilioRestClient
import tkMessageBox
# Prints Updates of what's happenin... |
Background
Given a string (s) and an offset into that string (offset), find the whole word that can be found at the given offset. (Helpful for auto-completing text.)
Code
Consider:
import static java.lang.Character.isSpaceChar;
public final class TestWordParsing {
public TestWordParsing() {
}
public void run()... |
I previously attempted to implement a Graph class which has a method that returns a path between 2 nodes using depth-first search. This is my latest attempt at this (using the feedback I got from last time).
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an ... |
I have made a small app in React that fulfils the following user stories:
GIVEN I add an item using the form
THEN I see the text appear in the list below
GIVEN I see items in the list
AND I click the close button next to a list item
THEN the list item disappears from the page
GIVEN I refresh the page at any point
TH... |
I've decided to translate an old Unity AppIndicator I had written in C to Ruby, so I can practice coding with it (got a little bored with the completely beginner lessons I've been following, which I'll finish!). The C indicator itself was a bit raw, I kind of wrote it in an afternoon, so I think it reflected on the Rub... |
What it does:
Speak a random word chosen from an array and ask the user to type the word in the box for 15 seconds
If right, +1pts, reset the timer and go to next word.
If wrong: do nothing.
After 15 seconds: game over.
body {background-color: black; color: white;}
.center {
width: 50%;
height: ... |
This code is meant to find the median of a list of integers. The list is assumed to be of odd length.
This is based on this HackerRank question.
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an upcoming coding interview.
from heapq import heappush, heappop
... |
So i have a ConcurrentDictionary<int, string>
The "int" is merely the way i store the key, which i want more recommendations on.
Currently i do like this.
public string memoize(Func<string, uint, string> functor, string code, uint id)
{
//Used for the lookup to identify if it's been inputed before
... |
Fairly new to learning interview questions and I saw this one and gave it a shot. I would very much appreciate some constructive criticism of how I went about it and what you would tell me if you were the interviewer and watched me implement it this way.
public class FizzBuzz {
public static void main(String[] args) ... |
In Python I am trying to create an API for a connected device. I want to be available for both threaded (using request) and async applications (using aiohttp).
What I've come up with is wrapping the get method of both requests and aiohttp in a decorator. This decorator is passed at init and API calls are explicitly wra... |
My day job is supporting a piece of software that just started using the DevArt Oracle drivers, which utilize the Oracle.DataAccess .NET drivers.
However, the assemblies in the .NET GAC may not uninstall correctly, and I have encountered later assemblies that do not match the installed Oracle client, and which therefor... |
The idea is the following:
I have a large text with a header upon it and a navigation bar. The navigation bar is located between header and text.
If the user scrolls downwards then the header-part moves out of the browser window. The navigation bar moves upwards too. But just in the beginning. When its top reaches the ... |
I'm new to JavaScript and jQuery and need input about how to optimize my script:
(document).ready(function() {
var inputs_1 = $("form#myForm .case1 input, form#myForm .case1 select");
var inputs_2 = $("form#myForm .case2 input, form#myForm .case2 select");
var inputs_3 = $("form#myForm .case3 input");
... |
I have implemented a through function for myself in a project.
Since I am still quite new in python and want to learn it correctly, I would be happy about any feedback including style, variable naming...
A first question is how to name the function. Because of Mathematica's documentation I called it through. Is there a... |
I'd really appreciate if I could get some feedback on the following code with regard to security, efficiency and possible uncaught errors. Personally I feel the printAndCleanString and friendlyLookup functions combined are very messy but I don't know how to fix them.
In particular I would love feedack on how to more c... |
I am trying to return distinct characters from the combination of 2 Strings. The following is my solution which seems to work based on my tests.
Is there a more efficient way of going about this? I have converted the strings to arrays, to sets, to a StringBuilder and back to a String. I'm wondering if I have overcompli... |
I've been looking at some async comms in C#. As a proof of concept, I've written a simple multi-client echo server. The server allows multiple TCP clients to connect and listens for input from the clients. When it receives a complete line, it forwards the completed line to any other connected clients.
For testing, I... |
I've made some improvments on the code from : Csharp-AES-bits-Encryption-Library-with-Salt
saltBytes is now the SHA512 of the password.
Random IV for each encryption call. ( IV length 16 is added to the encrypted file , removed from file before decryption)
Do you see any flows, something that needs optimization ?
Is ... |
I tried avoiding nested loops and usage of too many variables. This is up for review and comments.
void bubble_Sort(int *arr, int n)
{
int i = 0;
int* temp = arr;
while(n > 1)
{
if(i == (n-1))
{
i=0;
n--;
temp = arr;
}
if(*temp > *(temp+1))
{
*temp ^= ... |
I decided to implement some data structures- this time an AVL tree. I think the logic is correct. Is there a way to make it clearer and do you have any ideas about more tests to add?
# An AVL tree, python
import random
class TreeNode:
def __init__(self, key, val, left=None, right=None, parent=None, bal=0):
... |
I created a quiz game program with 25 questions, 4 answer choices, correct answer and 4 points awarded per question. I realize this code isn't the best; I am still a beginner and this is my first major project. I am open to criticism and any suggestions on how to shorten this code (especially where the questions are ty... |
The following query lists all domains from multiple companies in which a value occurs in an XML set. This is filtered to the most recent occurrence within a provided date range.
On large databases the query has performance problems. Is there a more efficient method to retrieve the most recent query results within the p... |
I'm trying to make a game with inheritance & interfaces and I'm wondering if my system could be working without ECS. (I explain at the end why I'm not using components).
To make it easier to understand there are three core class "families" in the code:
Engine related classes:
Graphics, Inputs, Audio, Physics,...
Using... |
I want to make sure I won't have to go back and redo large chunks of code. I have each opcode as a value in an enum that implements Runnable. Is there a more efficient way that I should do this or am I on the right track to getting something that runs a testsuite ROM accurately?
package com.codeblox.nes.cpu;
public cl... |
I am implementing the Random Ferns Algorithm for Classification. For simplicity, let's imagine a single decision tree with only a single node. As input we have a feature and the label of each dataset.
The function should work properly for any number of classes (length of set(labels)). The output is a feature threshold... |
I made a Snake clone for a programming class. I wanted some feedback regarding coding style and will appreciate any other opinions concerning my code.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Snake extends JFrame {
/* Some properties. */
private final int BOARD_WIDTH = 20... |
My task is to write a function that would take an array of zip codes and spit out only the zip codes that do not qualify. A non-qualifying zip code will not exist in the database and does NOT have other input zip codes within 140 miles.
For example, if I input 90210, 90211, 77389 into the function, it should only spit... |
This code is meant to create a list of subsets of a given set which is represented as a list.
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an upcoming coding interview.
def subsets(s):
if s == []:
return [s]
sets = [s]
for i in range(0,... |
Here are two sample blocks of my code:
function FindTheNumberOfAddedItems ( PageObj, ItemType )
{
var localPageObj = PageObj;
var localItemType = ItemType;
var numberOfAddedItems = 0;
var NROCssSelector = "div[class='assessment-stub list-top-border-colour-1 clearfix box-shadow'] strong";
var OROCss... |
Intent
Increase code usability/readability of functions with many default parameters while maintaining as much compile time safety as possible.
Motivation
It is very common to create functions that have many default parameters that extend and customise their side-effects. A problem arises in function usability/readabil... |
I'm working on a quiz application for training purposes and I think I'm done with most of it.
However, I'm not comfortable with what I've done: it seems to be too complicated and unprofessional, and I would like to make it more organized and simple to understand.
first, the database contains a three simple tables:
quiz... |
I would just like some input on how I may improve my code(in terms of content not formatting) without changing the output. It's just a simple magic 8 ball program using dialog boxes.
import java.security.SecureRandom;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
public class MagicEightBall {
pub... |
In less that 5 seconds on a normal PC, I found the answer in simple brute-force. Before I met Go, I didn't believe that it will be so easy to use all the power of the PC by using Go Goroutines for concurrency and multithreading.
I tried exactly the same simple algorithm, without concurrency in Haskell and JavaScript. I... |
My goal with this bit of code is to check if my processor supports rdrand and, if not, execute some other random number generating function. To check if rdrand is supported, the 30th bit in the ecx register should be set.
I guess my one of my dilemmas is whether or not I should explicitly check inside level 1 but I thi... |
My code shares some values with its neighbor. The names "Instructions, Registers" can be ignored in the comments; just see them as "names". What's important is how they are shared, which can be seen in the calculations.
What I want is to improve this code, because it looks awful and one can barely understand what's goi... |
I am trying to optimize the filter method for RecyclerView Adapter in Android. The list is used as an ArrayList. I have seen this post but they are filtering from the original list every time. They are not using old results if a character is added.
Example: if there are 10 results for String 'a' then user type 'm' , 'a... |
My project is using a specific version of JDK which is jdk-6 and the default JDK_HOME path will vary from distribution to distribution, so I wrote a script to guess it. Is there any way to do this better?
#!/bin/bash
JAVA_HOME=""
JDK_TEMP=""
shopt -s extglob
JDK_ROOT_DIR=( /usr/java/ /usr/java/jdk/ /usr/j2se/ /usr/j... |
The base64 decode algorithm is taken directly from Base64 wiki page. This exercise is meant to help me learn Rust, so any pointers in that general direction are very welcome. :)
fn main() {
println!("{}",
hex_to_base64("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d75736... |
I've a standalone Java application, which basically starts and manages two socket servers. I'd like to configure server ports in a .properties file using the following class.
class ApplicationConfig {
private static final Logger LOG = Logger.getLogger(ApplicationConfig.class.getName());
private ... |
I've written a program that solves questions of:
Addition
Finding the hypotenuse of a triangle
Checking if the triangle has a right-angle or not
I've also written it to be viewed in English or French. There's a few errors regarding int and while but it still works all the same. In case of any exception, I just termin... |
I'm compressing an array of strings in an Android app. Is there something you would suggest?
public static String compressArray(String[] data){
String jsonData = Arrays.toString(data);
try {
String compressedData = compressString(jsonData);
int compressedLength = compressedData.length();
... |
I've just solved this problem and I hope you guys give me any feedback to make my code be better.
Problem: There are N strings. Each string's length is no more than 20 characters. There are also Q queries. For each query, you are given a string, and you need to find out how many times this string occurred previously.
... |
Basically, if the function parameter is None, I ignore it, else I concatenate all arguments like arg1:arg1_value AND arg2:arg2_value AND arg4:arg4_value considering arg3==None when the function got called.
def _get_query_string_for_get_config(self, host, app_name, instance, config_source, config_name):
query_string... |
There are APIs like the Except extension that require the IEqualityComparer<T> to work. I find it's too much work for such a simple task to implement an interface so I thought why not automate it.
I implemented this interface in a reusable fashion so that I can use it with any value and any number of properties.
inter... |
I'm making a text based java game to help me learn java. I would like to know if I am doing things ok and if there is a better way to do the things I'm doing thanks. I have two separate files.
adventure.java
package sam;
import java.util.Scanner;
public class Adventure extends TheGame{
public static void main(String... |
I got sent a challenge from a friend;
You are given a file that contains numbers, one number per line. Convert the numbers from the file into roman numerals.
Test input:
45
65
23
98
123
7754
Expected Output:
XLV
LXV
XXIII
XCVIII
CXXIII
MMMMMMMDCCLIV
I think I've succeeded in doing this successfully, and would like ... |
I made a simple temperature converter to serve as an introduction to swing. I used Eclipse WindowBuilder and did not attempt to make the components more modular. I'm curious as to how you guys would organize this code to improve readability.
Also, if you have any other criticism I'd love to hear it.
import java.awt... |
I started working on some code, and it works, but I feel like it could be done more effiently. Below is a portion of it to show what I'm doing. To simplify the idea, I've made it here so if the cell in column M is A, B, or C, it puts a 1 in column L. If column M is a D, E, or F, it puts a 2 in column L. And if column M... |
Always the endeavour to write cleaner code or in general better code.
I have a scenario where I receive an object OrdersRootObject which contains a list of Orders, BillingInfo, ShippingInfo, LineItems ... etc whilst receiving the object I need to connect to an additional data store ClientConfig, in which yet performs m... |
After learning prime factorization today, below is the C code written,
#include<stdio.h>
#include<stdlib.h>
#define FIRST_PRIME 2
typedef enum {false, true}bool;
bool isEvenlyDivide(int compositeNumber, int number){
return (compositeNumber % number)? false:true;
}
int findOtherFactor(int compositeNumber, int numbe... |
I have a basic example of a REST API that I've done to control LEDs. I've read Dr. Dobbs article about REST and how to do it but I feel that my example doesn't look professional for some reason. Particularly the main menu on GET / request. Could anyone please suggest improvements?
import falcon
import json
LEDS = {"r... |
I'm new to PHP and I didn't know there is something called coding style standards. Now I'm trying to stick to PSR coding style standards and after reading PSR-4, which is about autoloading standards. I wanted to change my php project to follow the standard. I'm also trying to change my project to be OOP rather than cur... |
I just recently started reading the python.org documents and it looked like a really interesting language. Now, since Visual Studio 2017 supports Python, I decided to finally actually start learning it. My friend challenged me to write a program that checks if a number is an Armstrong number.
import sys
def isArmstron... |
I have reached a mini-capstone where I am asked to create a tic tac toe program. I have successfully created the program. What I'd like feedback on is two things:
1. How do I number my columns like I numbered my rows?
2. Can you spot areas where this code could be written in a more optimal manner (i.e. better code reus... |
I've got a lot of links (150+) in an href (here I can only post 2) and I want them to be opened in a new tab or window. I've got this piece of code that works, but before I add it to my website and before I add it to a lot of articles of mine (250+), I want to make sure the syntax of the code is 100% correct. Also, do ... |
I'm a hobbyist programmer.
What I try to do here is to read 8-bit grayscale PNG file. Then unfilter it. (That caused a headache). And after that perform Prewitt operator for "edge detection". I know that there is million and five libs for this but I want to learn why and how these things works.
I try follow OOP-princi... |
I am trying to wrap a responseJSON function of a Request class of Alamofire because when I send an API request I get a response in a specific pattern. I have achieved this, but I am still not satisfied with it. I can see much code repeated in both "handle" functions. One is for handling an array of Mappable type and th... |
I've written the following unsafe C# method to convert a byte array to Base64 encoding. It works, but it runs at a significantly slower rate than the built-in Convert.ToBase64String method.
public static unsafe string From(byte[] data)
{
int div = data.Length / 3;
int mod = data.Length % 3;
... |
I have created a trie in Python and am looking for feedback. Specifically, I am looking for feedback on:
If my code is 'pythonic'
If my logic is proper when inserting and retrieving from the trie
I have implemented the following logic:
Insert a word into the trie
Check if a word exists in the trie
Given a prefix, g... |
This code is meant to implement a Graph class which has a method that returns a path between 2 nodes using breadth-first search.
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an upcoming coding interview.
from queue import PriorityQueue
from collections imp... |
I have a simple application that can receive and send tcp data.
right now there's a thread used to start the listener and within this thread there's another thread to receive.
it works but it seems like a waste of resources. Can the connect be simplified?
public partial class Form1 : Form
{
private readonly... |
I would like to find out if there's a cleaner way to go about validating input before it goes into a function. What I'm doing seems like a lot of code, I'm sure there's a better way. I would also really appreciate some constructive criticism as my goal is to grow as a developer so anything you may see wrong with it or ... |
I've been refining my previous idea for pretty exception strings and made the following changes:
Exceptions can be ordered.
Prints all properties including Data.
The stack trace formatting is now more eye friendly.
Added indentation for inner exceptions.
Examples
Output for Exception.ToString() does not contain any ... |
I would like to write a small helper to filter datasets. Each dataset is a dictionary and some filters I want to apply are common to all the datasets.
That my needs, I wrote this following pattern:
class Dataset(dict):
"""Just a regular dictionary that can be filtered using filters."""
_filters = []
def add... |
My server receives requests in one thread and responds in another. I am using thread pools of pthread-s for both receiving and sending. The performance is not that bad, however...
When I am doing the same algorithm in one thread only(MULTITHREAD not defined) so that both recvs and sends are in the same worker thread, m... |
A week ago I requested a review of my code for a game of Snake.
First game of Snake
I made some changes based on your answers and now I want to show you present code. Something else to modify here?
GameMain.java
import javax.swing.*;
public class GameMain extends JFrame{
public static void main(String[] args... |
I receive a message that contains a collection of items that need to be processed.
Processing each item involves sequential calls to various services.
The services return a CompletableFuture that will be completed when the result is available.
Data directed to certain services needs to be sent in a specific order.
Fo... |
I'm beginning with Django and I have a Civil Status project.
I created my first models.py in order to get a Form, but I had some advices in order to normalize my database.
I made this process and I would like to know what do you think about this new restructuration.
My old models.py :
from django.db import models
from... |
This is my attempt at making a 'rock, paper, scissors' game in python. The game takes the user's input and the computer's random selection and calculates who has won. All feedback appreciated.
from random import randint
def getUser():
print('Rock, Paper, Scissors: ')
userIn = input().lower()
if userIn == ... |
This is my first program in akka so I wanted to know if the program is efficient and is using the advantages of actor model.
The program's purpose is to scan a given directory for any files and print the number of lines in each file.
The main Application class will create the actor system and send a Scan message to a... |
Yesterday I posted a question about converting an integer to it's Roman Numeral equivalent. Apparently you guys liked it and gave me some good advice, so I decided to take all your advice, and go a step further, it will now not only convert to Roman but will now also convert to Greek numerals.
I would like some criti... |
I'm curious about the best way to instantiate my repositories. Currently they're in the main controllers constructor method.
I was thinking making separate controllers for inbounds, outbounds, directs then instantiate the correct repository in the controller constructor. But that seems redundant in some ways.
I am wo... |
I've done an equation system that takes as input the equations (you choose the number of equations), and gives as output the values of the unknowns.
I splitted the code in four files:
-equation class(move all to left member and acquire values)
-matrix class(find determinants)
-equations system class(craft matrices to ... |
I'm new to programming in Python, and I am trying to create a multiplication exercise generator. I've got the following code for the solution, but I'm wondering if there is any more elegant solutions than this one.
Note: I have not covered lists, tuples, or dictionaries as of yet so I'm using the absolute basics to cre... |
Given sample_size many arrays of length dim. For each index from 1 to dim, i want to give a list of indices, where no sample contained in both indexes 1s. The code is really slow and i want to improve the performance.
# Test set
dim = 10000
sample_size = 1000
from random import *
randBinList = lambda n: [randint(0,1... |
After my Brainfuck Interpreter written in x86 Assembly I decided that it was time to get to the next step, writing a Brainfuck Compiler in Java that generates x86 Assembly and compiles that to an executable.
Currently it only supports Windows and it still uses NASM and GCC as dependencies to transform the x86 Assembly ... |
Intention
I intend to replace my own Bash script executing the following commands indefinitely in favor of this C++ compiled code, the reason being that the Bash script seemed very CPU ineffective.
It's not that I would think this solution is effective, nor perfect, but better than the one written in Bash for there is ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.