instruction
stringlengths
71
71.9k
I have created a class which wraps pointers and behaves like a pointer would behave, minus a few cases. It is a lock wrapper class which simply locks before usage of the pointer and unlocks once the pointer usage is done. It must behave exactly like a pointer EXCEPT in the following cases: It cannot be implicitly conv...
I have this function that takes a number \$N\$, and \$N\$ C strings, concatenates and returns the result: #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> char* mystrcat(int count, ...) { char** p; char* result; char* ptr; size_t* len_array; va_list ap; int j; ...
I am working on Project Euler Problem 58: Starting with 1 and spiralling anticlockwise in the following way, a square spiral with side length 7 is formed. 37 36 35 34 33 32 31 38 17 16 15 14 13 30 39 18 5 4 3 12 29 40 19 6 1 2 11 28 41 20 7 8 9 10 27 42 21 22 23 24 25 26 43 44 45 46 47 48 49 It is interest...
I have written a function that fills in the values between points and creates one continuous path (essentially walks between the points) and I'd like some feedback on it's implementation. If two points are provided that are not "in line" with one another then an error is thrown, as I do not want to support diagonal mov...
As a newbie to Javascript (or coding for that matter), I'm sure I overdid this, but I couldn't get anything else to work. Here's what I'm doing: allData in createDiv has anywhere from 20-500 elements ["string", "string",...] (created elsewhere) I need it to create a div.row (I'm using bootstrap) and send to DOM Appe...
The following code checks if a string is a pangram or not: public static class StringExtensions { public static IEnumerable<char> EnglishAlphabet { get { for (char i = 'a'; i <= 'z'; i++) { yield return i; } yield break; } ...
This is the first time I'm parsing an XML file. So I will be grateful for any suggestions on how my code may be improved. Or if you could suggest another approach to solving this problem. One other question that I have is why attributes 'title' and 'score' have switched in the resulting XML file (xml2.xml)? I've go...
This was a simple IRC bot I threw together a long time ago, found recently, and was curious as to if there were any kind of significant improvements that could be made. using System; using System.Net; using System.Net.Sockets; using System.IO; using System.Threading; public class IRCbot { // server to connect to (...
I have written type traits for checking, if given class T has_member, then if it either has_non_static_function_member, has_static_function_member or has_non_function_member. These type traits don't take function arguments of the member nor return type to check signature validity (I will provide other type traits for t...
Not having found a satisfactory association rules implementation in Python, I set out to code my own. The code below runs reasonably quickly, but the groceries dataset used for testing is peanuts compared to the actual transactions dataset I'll be using in production (think hundreds of thousands of transactions). I'm l...
The following (stripped) program receives UDP packets on port 5000 and forwards them to port 5001. It may throw socket errors on startup (e.g.: if the port is already in use), but I am not too worried about that. import socket RECEIVE_IP = "0.0.0.0" RECEIVE_PORT = 5000 RECEIVE_BUFFER_SIZE = 4096 SEND_IP = "127.0.0.1"...
Interest is compounded monthly. Payment doesn't vary from month to month. Version 1 balance = 999999 annualInterestRate = 0.18 mRate = annualInterestRate/12 high = (((mRate+1)**12)*balance)/12 low = balance/12 guessed = False def balanceLeft(balance,mRate,minPayment): monthsLeft = 12 while monthsLeft > 0: ...
I need to walk through several nested dictionaries in a recursive way and return a value of the type property. How my code could be improved? Especially, how to do it without a global variable? field_mapping = { "logic_index" : { "mappings" : { "Patient" : { "Diagnosis.Diagnosis_Start_Date" : { ...
Context: My project has a hand-rolled ORM (... yeah ... I know) ... built around the MS DataSet objects that represent wrapped collections of rows of DBtables (... yeah ... I know) ... and which use negative ints to represent identity columns on new Rows which haven't yet been synched with the DB (... yeah ... I know) ...
I've a class called MassIndexer.java (on GitHub) and it uses chained invocation for building a batch job. Each method assigns a property of this job and finally the job will be started using method MassIndexer#start(). Here's an example for Java EE: long executionId = new MassIndexer() .addRootEntities(Company....
I've written a mirror folder application in C#. It uses CommandLine for command line parsing. I'm just looking for a general review. using CommandLine; using CommandLine.Text; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Threading; using System.Threading.Tasks;...
So like the title says, if we are close to the end of the month, we can check if a given weekday (or array of weekdays) will fall from the current day, to the end of the month. If any of the given days appear, return true, else return false. I'm quite inexperienced with JS, and this is my first time using the map func...
For my training, i've been given an assignment to build a simple, extendable 'grade' String calculator by a given grade. For now, I had to work by this table: When the grade was higher then 100, I had to return the String "You must have been cheating". What I currently came up with is: public String gradeBy(int grade)...
Update: This question has a follow-up here A utility class to handle the ubiquitous "turn off ScreenUpdating, Calculation, Events etc" for executing VBA code, and remembering what those values were before they were changed so they can be restored later on. Also comes with a module of Unit Tests (courtesy of Rubberduc...
I've created a vanilla JS function to indent XML strings so they can be more easily read. It uses some pretty nasty regex...yes, I know it's a cardinal sin for XML/HTML, but it works. For instance, this string... <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/enve...
(See the next iteration.) Introduction I was in the mood for some C code and wrote this program for handling a personal telephone record book. One of the goals is strict portability; the code compiles with gcc -ansi -pedantic -Wall ... silently. The second goal is being prepared for dealing with problems (out of memory...
This is the question: Write a method that takes in a string and returns the number of letters that appear more than once in the string. You may assume the string contains only lowercase letters. Count the number of letters that repeat, not the number of times they repeat in the string. How can I make this better? f...
How can I make this better? public int BubbleSortNonEfficient(int[] arr) { int temp = 0; int LoopCount = 0; for(int write = 0; write < arr.Length; write++) { for(int sort = 0; sort < arr.Length - 1; sort++) { LoopCount++; if(arr...
I'd like to get the code below reviewed on all aspects, specifically I wonder if it's common usage to use let like this, as currently more computations are done in the let statement than in the rest of the code. Find the difference between the sum of the squares of the first one hundred natural numbers and the square ...
I'm trying to write a module to dynamically load all the files from my "controllers" folder, and then add them to the main express instance as routers. The files inside the controllers export an Express router. So the code basically does the next things: Read the "controllers" dir. Store what each router exported by t...
Unrelated to code: This is my first project in Python using classes and algorithms. I have spent the last week self teaching myself about queues and stacks, so I am NOT trying to use any Python libraries for this as I would like to know how to implement my own priority queue About the code: Dictionary used for prior...
I was wondering if I can make this better: public int BinarySearchIterative(int[]inputArray, int Key) { int min = 0; Array.Sort(inputArray); int max = inputArray.Length; return BinarySearchIterative(inputArray,Key,min,max,0); } public int BinarySearchIterative(int[] inputArray, ...
I want to read only 1 column from file and save it in the list column. I have this code and I don't know how to optimize it. It takes lots of time because I need to call it a lot of times. column = (sum(1 for line in open(file) if line.strip("\n")))*[0] counter_row = 0 counter_column = 0 with open(file, 'r') as f: ...
Inspired by The Beauty and the Strings question, I tried to implement the "Maximum Beauty of String" in a stateless fashion using ES6. Unfortunately, I ran into two places where I had to assign variables. The questions I have: How can I remove the state in the reducer for mapLettersByCount? How can one use generators ...
I'm playing a bit with extensions for default protocols in Swift 3.0. I would like to implement rounded(toPlaces places: Int) -> Self for Double, Float. Both of these structs refer to FloatingType protocol. I wrote small extension for FloatingType protocol: extension FloatingPoint { typealias Exponent = Int // is...
I'm taking an algorithms class this semester and this homework seemed pretty easy. Easy usually means something is wrong. Not always, though. Through testing, this application successfully answered what was asked for by the professor. What I want to know is if there are any other solutions that fulfill the assignment f...
I'm trying to learn coding by actually coding my first working and hopefully expandable in future app. Yesterday I asked about optimizing my menu and got some answers about my take on it. Obviously and as expected I got picked bout my casing, code structure and naming. I fully understand and accept criticism as my goal...
In my previous post Optimise compare and match method using scripting.dictionary in VBA I wanted to address optimising the scripting.dictionary approach I was using and I feel I have achieved that (feel free to correct me though!). I am now implementing user input boxes which have also increased the complexity and now ...
I have an ItemData class in my program that stores saved data about a game inventory item that can change, such as its durability, quality, number of bullets in the clip and similar. ItemClass, on the other hand, lives in a DLL, and holds data that is always true for specific item, such as its name, max durability, siz...
editArticleService.show(item.facility, item.administrator, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, q21, q22, q23, q24, q25, q26, q27, q28, q29, q30, q31, q32, q33, q34, q35, q36, q37, q38, q39, q40, q41, q42, q43, q44, q45, q46, q47, q48, q49, q50, q51, q52, q53, q54, ...
Wherever the biggest number is always use the 'big' value If another number is equal to that number, use the 'big' value Set the next number in line to 'medium' If another number is equal to that number, use the 'medium' value Set the next number in line to 'small' If another number is equal to that number, use the 'sm...
What is Spellathon? The rules of Spellathon are as follows: Create words that have 4 to 7 letters. Include the center letter in every word. Form at least one 7-letter word. Plurals are acceptable. The dictionary used is in English. Here is a similar implementation. The dictionary (word list) I'm using is this. public...
How can I calculate simplex numbers in all dimensions? Example: dimension: 2| 3| 4| simpl(1) 1| 1| 1| simpl(2) 3| 4| 5| simpl(3) 6| 10| 15| simpl(4) 10| 20| 35| simpl(5) 15| 35| 70| First I considered about a recursive implementation...
Description Software like Swype and SwiftKey lets smartphone users enter text by dragging their finger over the on-screen keyboard, rather than tapping on each letter. You'll be given a string of characters representing the letters the user has dragged their finger over. For example, if the user wants "rest", the str...
This previous iteration of this question can be found here A utility class to handle the state of the Application object. Storing the application's initial state (ScreenUpdating, EnableEvents, Calculation) Disabling those settings for performance improvements Restoring the original state Operations that may nee...
I've made my first turn-based game in PyQt5. I suppose that its idea can also be used by other novice GUI programmers. There is a 5 by 5 squared unpainted field and 4 players. Each player starts at corner square and has his own colour. Player can move to adjacent square and fill it with his colour if it isn’t occupied ...
I've a file which is divided into two parts: The header The data part The header has of course a different format than the data part. The header part contains lines that look like this KEY: VALUE or KEY : VALUE or KEY:VALUE, in theory, clearly. The data part starts with a delimiter, which in my specific case should ...
To get n-th member of a struct without non-empty bases and w/o non-public members C++ now have a pretty way: #include <type_traits> #include <utility> #include <tuple> struct filler { template< typename type > operator type (); }; template< typename aggregate, typename index_sequence = std::index_sequence<>, typename...
I'm trying to write a C++ multiplication program using classes (for the first time - I usually try to avoid OOP) and am having trouble freeing my memory. What I'd ideally like is a matrix class with a function for allocating, initializing, multiplying, and freeing my matrices. What I currently have is #include <iostre...
Is this algorithm good or can I improve it? static void QuickSort(int[] a) { QuickSort(a, 0, a.Length - 1); } static void QuickSort(int[] a, int start, int end) { if (start >= end) { return; } int num = a[start]; int i = start, j = end; ...
Shortly, I need to create a Java application with client/server architecture (clients represent some sort of math functions and when they are done computing, server consumes these values and produces a final result). Also, there are should be two types of cancellation, first one allows to stop the server by entering a ...
I'm an absolute newb when it comes to PowerShell, and this is pretty much my first real script. I'd now like to know ways to improve it and if possible to shorten the code even further. I use it together with an XML file containing links and keywords to download the "latest" version of different applications to keep my...
This snippet is about a generic matrix type. The nice part is that given two matrices with respective entry types, say, of short and float, the result matrix entry type after the multiplication will be float. matrix.h: #ifndef MATRIX_H #define MATRIX_H #include <algorithm> #include <iomanip> #include <iostream> #inclu...
The function is to click a button, the browser window then scrolls to the top of the page, then a class is added to a menu item (with CSS to make the sub menu appear). Then when the cursor leaves the sub menu, the class is removed to allow the sub menu to disappear. Can I make the following code shorter or more efficie...
I am working on a sorted data file, so there does not need to be any sorting logic. I find unique values, feed them into an array, then use the worksheetfunction.sum to get totals for a field. Is this as efficient as I could be, or are there some things I'm not seeing and should? The "Items" sheet is where a number of...
I used strtok to tokenize a string. But many developers said me to avoid strtok, why? How should I optimize this code? Is it really wrong that I used strtok? If so then with what should I replace it? DWORD FN_attack_speed_from_file(const char *file) { FILE *fp = fopen(file, "r"); if(NULL == fp) { re...
I am reading in a file which consists of scores between two teams. The team that wins gets 2 points, if the teams tie both teams get one point. The result is ranked by points and if there is a tie ranked by alphabetic order. Then this is written to an output file. Any suggestions to improve the code? Input file: Bl...
I am new to C. And I just want to know if my code is horrible or not. I tried to make program to delete all comments in C program. It's from "The C Programming Language Second Edition" book, Exercise 1-23. Here is my solution : #include <stdio.h> #define MAXCHAR 1000 int c = 0; int d = 0; int newFileText[MAXCHAR]; int ...
I'm writing in Python (3.4) a double search function that looks in a list for one value and then the other alternatively. That is, start searching the second value once you find first the first value (and start searching from where you found the first value) and vice-versa. My first approach was to write a recursive fu...
Imagine you want to run a bunch of tasks in parallel, but you can't be sure that all of your tasks will eventually terminate or rather decide to eat up all your memory and CPU time. This should be easy, right? Create a new thread, run your task, and kill the thread if it doesn't terminate in a given time slot. Well, he...
We are using the following for evaluating strings for a pseudo fuzzy search. Curious if anything sticks out as needing optimization function getEditDistance(a, b) { if (a.length == 0) return b.length; if (b.length == 0) return a.length; var matrix = []; var i; for (i = 0; i <= b.length; i++) { ...
The following Function is one of the main analysis functions of a larger subroutine. The subroutine is responsible for translating codes that look like this "1|G|XNYM:O:LO:201611:P:44:+1/XNYM:O:LO:201611:C:51:+1" to something similar to this "LIVE WTI American X16 44.00/51.00 Strangle". There are multiple scenarios ...
I'm new to React.js and I've written a simple notes application as my first React program. I would like to know if it is idiomatic React code. List.js var React = require('react'); class List extends React.Component { render() { var items = this.props.items.map(function(item) { return <li key={item.id}>{i...
I want to achieve this var arr = [1,2,3]; var duplicateArr = duplicate(arr, 2) // will be [1,2,3,1,2,3] var duplicateArr2 = duplicate(arr, 3) // will be [1,2,3,1,2,3,1,2,3] I have implemented it like this: function duplicate(arr, n) { var len = arr.length; if (n == 0 || n == 1) { return arr; } if (n > ...
This is my best effort at converting a 32 bit integer in EAX, to an 8 character ascii string (result in RDI). It will work accurately up to 99,999,999. Higher values could be done using an xmm register. The byte order in RDI is correct (e.g. if copied directly to video ram, the most significant byte is displayed fir...
I was writing a basic calculator program to practice my skills at python. I'm a beginner at Python and was wondering if there is a way to simplify this code of mine? It seems a little bit too long and messy in some sort of way. Again, I'm still a beginner so I don't know all the tricks in the book! import math import t...
Keep in mind i'm not an expert or developer, working in IT operations and improving my coding skills. Goal: Trigger to send email when a specific configuration table is updated or deleted. Should never happen unless done for a release CREATE TRIGGER [Cfg].[t_tablename_TrackConfigChanges] ON [Cfg].[tablename] AFTER INSE...
I'm working on my data structures knowledge and wanted to create a graph with a small DFS driver which simply prints the nodes as it visits them. Here's my graph class: #ifndef GRAPH_H_ #define GRAPH_H_ #include <stack> #include <random> #include <iterator> #include <unordered_map> #include <unordered_set> template <...
I am an R programmer who is learning C++/Rcpp. I wrote some code to recreate survey adjusted contingency tables a la SAS's surveyfreq procedure using Taylor Series linearization to generate standard errors. Here is the documentation from SAS that I used as reference.I've reached the point where I know my code is correc...
I wrote code to demonstrate the Infinite Monkey Theorem which states that if a monkey types at a keyboard for an infinite amount of time it will almost surely type a given text such as William Shakespeare. Here I've replaced the monkey with Python code. I have a sentence and let Python choose from the 26 letters of the...
Over the last couple of weeks we build a huge Javascript menu. And we might think the whole code is a little bit too much. We are not pros, but came to a quit acceptable solution. (yeah it´s German, we know) We used jQuery-3.1.1. and jQeury-ui. I´ll put a short overview of the menu at the end. The question is, can we s...
Using Python 2.7 and here is my code which implement trie match for a whole word, and also support if the whole word contains ? (match any one character) or * (any zero or more characters). My question is wondering if any improvement I can make (in terms of performance) and also if any code functional bugs, please feel...
I coded a python solution for the question below. I am after the fastest solution. Also, I would be grateful if you could point out parts that are not pythonic / inefficient. Question: A website requires the users to input username and password to register. Write a program to check the validity of password input b...
I have modified a Z-Algorithm for string similarity in order to match strings which differ in 0 or 1 char. However, it seems much slower than original Z-Algorithm although from my point of view there is only a minor different and it also has a O(n) time complexity. Input is a string in which a pattern is going to be fo...
This is my second game, not yet finished but working. I've put so much time into it I wanted to get feedback before continuing. I always learn so much from those that comment. Whilst my first (still a work in progress), is object orientated, this isn't. Given that though, I certainly appreciate the OO method more now....
I'm beginner java programmer and would like to ask you to take a look at my code. I wrote small rest service among with tests. Now I have to questions to ask. The test methods: @Transactional public class CustomerControllerTests extends RestApplicationTests{ @Autowired private WebApplicationContext context; ...
Working on below problem and post problem and my current code. My idea is to always iterate from the minimal in-degree node which has not been visited before. Then based on this node to do a BFS. I am not sure if there are better ways to implement in terms of performance. If you also find any other code issues or bugs,...
I have an abstract class Consumer: abstract class Consumer { const API_DOMAIN = 'https://test-api.com/v1/'; private $client = null; private $credentials = []; public function __construct(array $credentials) { $this->client = new Client(); //This is GuzzleHttp/Client. $this->credent...
I have made this PHP login page. As far as I know, this is secure enough to avoid attacks and injection. This script: Notifies me with an e-mail when someone logs in or fails to login Only one user at a time CAPTCHA Secure session Auth lasts for 20 minutes Password is stored with MD5 hash Max 3 login attempts, then it...
(See the next iteration.) I have this small template function for conveniently dumping a sequence into a string such that there is a delimiter between two consecutive elements, and no such after the last element: #include <algorithm> #include <iostream> #include <iterator> #include <sstream> #include <string> #include ...
I wanted to cache methods using unity interception and not have the parameters passed in stay alive for the sake of caching. If the objects would have gone out of scope without caching then the cache should be invalidated. Also wanted to use MemoryCache class as if memory is low the cache should be the first thing to...
I have a CSV containing ~600k part numbers to be uploaded to my website's inventory. However, this CSV only contains limited information. We're missing pricing and other related information. To get this information I'm required to make requests to the provider's API, and add it into the CSV. At the moment, I've been sp...
I am using MVVM pattern with databinding. I have written tests. But I want them reviewed. The test is related to JUnit test on the ViewModel. FeedViewModelTest.java @RunWith(PowerMockRunner.class) @PrepareForTest({Observable.class, AndroidSchedulers.class}) @PowerMockIgnore("javax.net.ssl.*") public class FeedViewModel...
Problem statement I've tried to solve the following Euler problem in a very straight-forward way, ideally avoiding recursion if possible and writing it in a functional style. What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid? The full ...
I am working on a program to decode MMS PDU files. They are binary files and I am reading them byte by byte and decoding each header value as I come to it. One header value is the Date, and it's represented as follows (in hex): 85 04 57 E2 A2 49 0x85 is the "Date" header, 0x04 is the data length (4 bytes) and the 4 f...
One of the things believed to contribute to destabilizing Rubberduck 2.x, is the fact that a lot of COM object references are stored in many places, and Marshal.ReleaseComObject is never called for those, which is what the alleged problem would be. To fix this, I've undertaken the task of completely wrapping the VBIDE ...
I am working on a program to decode an MMS PDU file. In the file, the "content-length" is represented in a unique way. According to the MMS spec WAP-230 Section 8.1.2, it is encoded as a "Variable Length Unsigned Integer". Basically for each byte, the 1st bit is the "continue bit" and the other 7 are the "payload". ...
I'm trying to call a promise recursively. If I get a responseData with a key error I want to call the promise again and again until I don't get it. _getUser (url) { console.log('fetching url', url) return fetch(`$(url)/api`, { method: 'POST', headers: {}, body: '{"key" : "body"}' }) ...
I have coded a sudoku grid validator as a problem set from an online course. My input to the validator is a list of lists, that represents a sudoku grid. For reference, below are examples of an ill-formed sudoku grid, an invalid one, and a valid one. # check_sudoku should return None ill_formed = [[5,3,4,6,7,8,9,1,2],...
I have recently finished developing my ASCII based snake game. As a newbie to C++ I would appreciate it if I was given feedback as to how I could improve my code when it comes to efficiency and readability. #include <iostream> #include <cstdlib> #include <conio.h> #include <vector> using std::cout; using std::cin; usi...
I wrote a program to convert spaces to tabs. If there are 4 spaces it should convert them to tab. Please let me know how to improve it. #include <stdio.h> #define TABVALUE 4 int c, d, s; int main(void) { c = s = d = 0; while ((c = getchar()) != EOF) { if (c == ' ') { s++; for (i...
I made a simple linked list in C with the following functionalities: Create(creates the list); Find(searches for an element in the list); Insert(inserts a value at the beginning of the list); Destroy(destroys the entire list). It only uses integers (for simplicity), and I want to know for possible errors and how to imp...
I must write updates in a database from a flat file (CSV). I want to do that in the shell, with tools such as AWK. #!/bin/bash cat in.csv | sed -e '1d' | awk -F';' -v q=\' '{ # For each line. print "DECLARE @v_trmID varchar(16) = " q $1 q print "DECLARE @v_trmNom varchar(6) = " q $3 q print ...
I load some data from from my webservice via a method using blocks and callbacks. From my ViewController I make a request to the data loading class and pass the callback block: - (void)loadRadioStationList { [self.radioDataLoader getRadioStationList:^(NSArray *data, NSDictionary *dictData){ self.alphabetiz...
This asks the user if they would like to enable stack overflow protection. If they enter yes (Y or y), then a Boolean SOProtection is set to true. If they enter no (N or n), then SOProtection is set to false. If neither Y, y, N nor n is entered, then it clears the input stream (to protect against a case where multiple ...
I'm learning C++ as well as algorithms. Here's my implementation of finding the closest pair problem. I tried to minimize memory by using only iterators. And points are being read from points.txt file content: 2,1 3,5 8,3 5,8 9,1 5,2 3,3 4,5 6,5 1,9 Output is: Closest pair are: 3, 5 4, 5 Here's the code: #include <...
I don't really want to convert to using classes, but other feedback is appreciated. Game loop is at the bottom. colors.py r = '\033[0;31m'#red o = '\033[1;31m'#orange y = '\033[0;33m'#yellow g = '\033[0;32m'#green b = '\033[0;34m'#blue v = '\033[1;35m'#violet B03 = '\033[1;30m' B02 = '\033[0;30m' B01 = '\033[1;32m' B00...
I was wondering if someone could please point me in the right direction with this bit of JavaScript I have been working on. I have made this form that currently has onblur JavaScript validation and additionally I am to make it dynamic so that when a user selects an option from a dropdown option form a div is shown with...
This is a follow up of this question Optimal substructure of ED: Here is the reasoning behind my solution: let \$x = (\alpha _{1},\alpha _{2},\alpha _{3},...,\alpha _{m})\$ and \$y = (\beta_{1},\beta_{2},\beta_{3},...,\beta_{n})\$. We define \$c(i,j)\$ for \$ 0\leq i\leq m\$ and \$0\leq j\leq n\$ as the minimum edit di...
I have 3 classes: Server, Client, RequestHandler It's about reading out commands and executing them What the programm does: 1) The Server starts, opens a ServerSocket and starts listening for Clients on that Socket. 2)Several Clients start and try to connect to the socket. 3)If a client succesfully connects to the Sock...
The PowerShell script below queries the Security event log on one or more servers for events with id 4663. When trying to retrieve all audit events for event id 4663 with the following code the computer throws the following exception: how can we to optimize this PowerShell? So I just want to fetch security event log ba...
Curvesort is an adaptive integer sorting algorithm I discovered independently. It maintains a doubly-linked list, whose nodes have the following structure (in pseudo-C code): struct node { int key; int count; node* next; node* prev; } Above, count gives you the number of times key appeared in the seque...
My app, particularly the MainActivity suffers from some lag when I scroll through the RecyclerView. I tried to fix OverDraw as much as I can. This is what my OverDraw screenshot looks like: activity_main.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/andr...
I developed a cost to ship app in python. To use this app, you will need to install wxpython. Please review and tell me the areas i can improve. import wx # including a module class Test(wx.Frame): # creating a class def __init__(self, parent, id=wx.ID_ANY, title='McCastle App\'s - Shipping Calculator', pos=...
I am new to java and graphics, and I am creating a java program that draws a star. It took me a few hours, but I finally have it drawing a star, but I am wondering if there is a better way to write the "draw" method without having to repeat myself over and over. I am trying to use loops to minimize all this code, but I...