instruction
stringlengths
71
71.9k
I built this simple application to facilitate communication between two or more machines on a local area network. As each client starts up, it broadcasts and receives broadcast packets; allowing for the omission of inputting a peer's IP address. It then creates a new connection to each discovered peer (even to itself),...
I have a question about dependency injection and best practices when using simple classes which are meant to be created often, which have dependencies on external services. Here's a (vastly) simplified version of what I'm working on: app.js import {Factory} from './factory.js'; import {Convert} from './convert.js'; le...
I'm working on my library. It's just a boilerplate, wrapping some script code, with helper functions, some plugin implementation, required meta tags etc. How can I develop this better? // Namespace var KY = { init: function () { this.general.init(); this.ajax.init(); this.loadMore.init(); ...
I'm looking for a very simple (at first sight) CommandBus, which will handle some ICommand publication. The CommandBus implementation will find the appropriate IHandler to Execute the Command and then Notify some possible IObservers. My first step is to make it work, I've chosen to use a synchronous dependency injectio...
I want to read a file containing comma-separated values, so have written a finite state machine: private IList<string> Split(string line) { List<string> values = new List<string>(); string value = string.Empty; ParseState state = ParseState.Initial; foreach (char c in line) { switch (state) ...
As part of the distinction requirement, I am required to ask for testing/review of my code. There was no time allotted for this in class, and as such I am turning to the folks of StackExchange for help! This is a great way of doing it for me, as I can directly reference it in my bibliography, and easily format the crit...
I am seeing that this is actually not in accord with the difficulty level said there. Firstly I cannot list all possible improvements it could have. /* * A palindromic number reads the same both ways. The largest palindrome * made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the * largest palindro...
I have a script which is having too many modules. The script is working perfectly, but the only issue is it is taking too much time and I need to reduce the complexity of the script. I have a source file (it can have multiple rows of data, each column separated by a '|'). The script should check all the rows for all t...
Over the years I’ve seen many C# sieves and despite their varying internals all that I have seen invariably are a static method that returns a List<int>, perhaps with the occasional rare exception of an Enumerable<int>. This is fine for small collections. Granted relatively speaking for some people a 1 million item l...
I wrote a set of python classes for solving the change making problem, in various forms. Given the coin denominations and values: Find all possible ways of making change. Find a best way of making change (minimize number of coins). Determine whether it is possible to make change. This version of the project on gith...
I recently wrote a name generator that uses a DTMC underneath (I asked about it here) and, since I'm not entirely confident I did it right, I wrote a script to check my code, or at least its output. It works pretty well, but, being new to the language, I want to know how to make it more idiomatic. Performance boosts (i...
I'm learing Python by writing a program to solve some housekeeping I do weekly, namely renaming PDF files according to rules given in a text file. My end goal is to have idiomatic Python, with full test coverage. I have done some refactoring, and written a couple of tests. Ideally I would have done TDD from the beginni...
Here I have a method for reading the contents of a file into a buffer and returning whether or not it is successful. Here is what I would like reviewed: Speed: Am I reading in the file as fast as possible? Bugs: Are there cases where my code could fail or give unexpected behavior? Syntax/Styling: How does my code lo...
Is there any way I could improve this script, such as by writing it in fewer lines (more efficient)? I'm very interested in keeping my code dry and fast! Also, if there is a way to make it more dynamic don't hesitate to tell me! <?php /* Connect to an MYSQL database Using credentials and PDO(PHP DATA OBJECT) */ ...
About to get back into coding, so I implemented linear probing in Python. How did I do? Anything unnecessary? Am I using "global" right? I originally wanted to use an array with a fixed length, but couldn't get it to work. list = ["x", "x", "x", "x", "x", "x", "x"] state = 0 def main(): #tests linearProbing(1) ...
This is my first attempt at a program (outside of school) and I was trying to implement and learn polymorphism on a conversion calculator for volumes and weights. I found myself using long switch statements in the GUI to test user inputs against the units in order to make the calculations. Is there a better alternativ...
I made a very simple calculator in C that allows the user to perform calculations like addition, subtraction, multiplication and division. This is my first C program that I've made outside of my University course. It would be great to get some feedback on this program so that I can avoid bad practices early on in my co...
I want to thank you guys firstly for your previous comments and feedback. Really appreciate it. I am learning C with school at the moment, but I plan to be "fluent" in C at the end of august of this year. For school I have to write the following program: Open up a file. The file is a *.txt one. It consists of 32 num...
I wrote this little piece of script for my workplace (insurance, etc.) to help our admins, as a light and simple file I can just email to my colleagues. The purpose of it is to calculate a prorated refund in case of a policy holder cancelling it. Basically a policy's purchase value "ticks down" gradually after a certai...
It looks like this is a really classical question, but I'd like to ask it one more time as all those solutions look quite long and complicated for me (maybe because I am dumb :) ) So this is a Graham convex hull algorithm from the very beginning of the "Real World Haskell" book. And a perimeter function just for the s...
I decided to write a very simple web-game: function write_at(x, y, text, color, font) { ctx.fillStyle = color || "black"; ctx.font = font || "50px Arial"; ctx.fillText(text, x + 50, y + 50); } function write_at_random(text, color, font) { write_at(random_choice(range(0, canvas.width - 250)), random_choic...
I have these two methods: private static OpeningDay GetUsallyOpeningHour(List<OpeningDay> openingHoursDaily, DayOfWeek dayOfWeek) { var listOfSpecificDayOfWeek = openingHoursDaily.Where(x => x.DateTime.DayOfWeek == dayOfWeek); if(listOfSpecificDayOfWeek.Any()) return listOfSpecificDayOfWeek.GroupBy(x ...
I have this bit of code that needs refactoring/simplification. The below grabs the planning data for view A and B. Then it joins the planning and matching image for view details. So then it determines if it should set the buttons to be disabled or not based on whether or not, if the data is empty/null or not. I think ...
This is my first time using pytest. All feedback for this test case is much appreciated. import pytest from mock import mock_open, patch def get_file_contents(file_data): with patch.object('builtins.open', mock_open(read_data=file_data)) as mock: with open('mocked_file') as f: return (line for line in f....
Find the kth largest element in an array of integers. You may assume that: 1 <= k <=size(array). Any comments? Is there a more efficient solution? public int findKthLargest(int[] nums, int k) { int p = 0; int numElements = nums.length; // create priority queue where all the elements of nums will be sto...
Below is my working code written as an exercise in wildcards in generics and Java 8 type inference. My question will be about the commented line in union() method. I needed to create an instance of the interface type that does not include a static factory, so I was left with (seemingly) two choices: Use concrete im...
I have 5 nested for loops below, to add rows of data from multiple files to one of two lists. Is there a more pythonic way of doing this? I've come across an iterator-generator method named iteritems() -- could this be used to make this code more pythonic? # 5 nested loops for root,dirs,files in os.walk(src): fi...
I have a solution but it fails the performance for two tests. How can I speed it up? def palindrome?(str) str.reverse == str end def parse(str) return -1 if palindrome?(str) str.length.times do |i| before = str[0...i] after = str[i+1...str.length] return i if palindrome?(before + after) end end t...
I speedily wrote a bunch of crappy checks, to check whether strings are empty, in order to build a query string. StringBuilder SB = new StringBuilder(); SB.AppendFormat("{0}guide/search.aspx?", root); root is a const, containing the website address. It's like this because we have test servers. if (!String.IsNullOrEmp...
ReSharper has a very handy feature that's particularly useful when coding against abstractions. Since coding against abstractions is something that can also be done in VBA, the next release of rubberduck is going to include that functionality as well: The click handler for the code pane context menu simply calls the ...
I've developed my shopping cart further. This is related to my earlier post: Securing PHP shopping cart In addition to those functionalities, I've proceeded to make integration to Paytrail payment gateway. This post will add option to handle customer's personal data and to send that data to payment gateway. All credit ...
This is a little net health monitoring project I made in NodeJS. It pings Google every second and stores the result (true/false) along with the date in a database (MongoDB). I've collected enough data and I want to represent it for the past week. I created a 2x2 array of 7 days and 24 hours each. I go through each reco...
What about the following meta-predicate "fixed point"? fixedpoint(P_2,X0,X) :- call(P_2,X0,X1), if_(X0 = X1, X = X0, fixedpoint(P_2,X1,X)). fixedpointlist(P_2,X0,[X0|Xs]) :- call(P_2,X0,X1), if_(X0 = X1, Xs = [], fixedpointlist(P_2,X1,Xs)). The implementation is based, in part, on if_/3 and reified term e...
I am implementing my own UnitOfWork for an EntityFramework-DataContext. I want to call SaveChangesAsync and when this succeeds, clear a list. Is my approach with ContinueWith correct? public async Task<int> CommitAsync(int? commandTimeout = null, bool ignoreCustomLogic = false) { try { return await Dat...
This code gets request status based on request type and some mapping info. I'm wondering if there is a way to write nice conditional expressions in if statement. Expression should test if request.IsInvalid property equals null or false. It'd be nice that one can see just from looking at the expression that request.IsIn...
I need to pass a programming exam in order to graduate but I'm having a hard time passing it because most of my programs are too slow. Can someone give me some tips on how to make my programs faster please? Below is an example of a question we had in the last exam and the code i wrote. My code passed the first test cas...
I have a program that will get all possible permutations of a certain equation: A + 13 * B / C + D + 12 * E - F - 11 + G * H / I - 10 == 66 Where A, B....I is a value 1-9, and where each digit is used only once in the equation (So if A is 1, no other variable can be 1). There are 136 different solutions for this. usi...
I am dealing with a huge time taking with primes. I hope you know they are pretty random and that's why create many problem. Both are using the same logic/methods. /* * The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all * the primes below two million. * http://projecteuler.net/problem=10 */ ...
I'm developing a JavaSE-1.7 Swing application that displays XML files as a JTree. This will be the base for further work, e.g. filtering nodes. My questions, as a beginner in Java & Swing & MVC: Design: How would you refactor this into Model/View/Controller? (Doing the doc/tree model stuff inside of the GUI thread isn...
I am always surprised by JavaScript and how simple and elegant JS code can look. I have a piece of code below that simulates a finance calculator. Please share your thoughts, critiques/feedback on how the code can be improved. jsFiddle The calculation is just a simulation, so please ignore. Also please ignore the way I...
By profiling my application, I found that the bottleneck of my application is the function below. In particular it will be executed by a lot of entities (monsters) in a game, that will go onto a smartphone. The graph is the model for this type of grid: (the final one is 25x45) Also, each cell has an array of 4 pointer...
I was building a rails web, and used form object to separate the validation logics per form. I had to find_referral_code twice in order to store the user_id of referrer. I wonder how I can improve it. after_sign_up_form.rb def get_referred_by_id User.where(referral_code: referer_referral_code).first.id end def va...
I have a JSON file: { 'Document':[ [{'fields': {'name': 'js/main.js', 'content': 'hello'}, 'pk': 284, 'model': 'Document'}], [{'fields': {'name': 'css/main.css', 'content': '2'}, 'pk': 287, 'model': 'Document'}], [{'fields': {'name': 'about_us.html', 'content': 'again hello'}, 'pk': 306, 'model': 'Document'}]], 'Pa...
I have this example data : var objects = [ { title: "Parent Area", code: "P", areas: "B,C", child: [], selected: 0, remove: 0 }, { ...
When I want to try a new language, I first try to write a fairly basic sieve of Eratosthenes project in said language. This is a very simple algorithm, with predictable results, and can even be optimized somewhat to compare versions of different languages' compilers. I've done this in (chronological order) python, ru...
I wrote a PHP connector that will allow me to communicate with a REST API. This is the first time I am trying to make my code as clean as possible. I want to help myself learning how to better code. I have done everything I can think of to make my code clean and easy to read, but I would like to get feedback from the e...
/* * The following iterative sequence is defined for the set of positive * integers: * * n -> n/2 (n is even) n -> 3n + 1 (n is odd) * * Using the rule above and starting with 13, we generate the following * sequence: * * 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 It can be seen that * this sequen...
I'm new to Perl and have successfully written a merge sort program. I'll paste the entire program below, but would like mostly a review of the subroutines mergeSort() and merge(). I tried to use pass-by-reference as much as possible to make as it as fast as possible. Is there ways I can make this better/more optimi...
I have several tabbed views with a Unity scene in them. What I do between scene is hide the elements in that scene, then render them if the right view is shown. The method below is the method that renders all the lines previously drawn in my view. The lines can be lines, angles, points, etc.. private void RenderLine...
I am trying to make an inputin() function to take all the parameters input for the first time with exception and for individual parameter for the runtime proposition. I am thus looking forward to reducing code size or being a more efficient coder with more pythonic procedures. ""This code is well executed and tested fo...
I have a string like this : val content = "some_text{macro1}another_text{macro2}text" I want to replace the {macro1} and {macro2} with macro1 and macro2, i.e. just to remove the { and }. I wrote some piece of code which works fine, but for me it seems very hard to read: val Pattern = """\{(.*)\}""".r Pattern.findAl...
I've been working at speeding up my web scraping with the asyncio library. I have a working solution, but am unsure as to how pythonic it is or if I am properly using the library. Any input would be appreciated. import aiohttp import asyncio import requests from lxml import etree @asyncio.coroutine def get(*args, **k...
Is there any improvement possible in this implementation? #include<iostream> int search( int array[], int N, int key ) { int first_index = 0; int last_index = N - 1; while ( last_index >= first_index ) { int middle_index = last_index + first_index / 2; if( array[ middle_index ] == key...
My last question had a lot of views (over a 1000) so I decided to apply what I learned from the previous question and revamp the program. I learnt a lot from posting that question (functions, how to do a menu without using using a lot of printf and learning to not repeat code etc). So here's the updated program: #inclu...
I've written a simple script, that takes a 0, 0 style co-ordinate input, following the pattern of: $$0 \le n \le 9$$ Tacked onto the end of the output program, is a simple script that runs through all iterations of 0,0 - 9, 9. Below is a gif of that. Note: This code DOES not map multiple, I am not asking how you can m...
A string is said to be complete if it contains all the characters from a to z. Given a string, check if it complete or not. Input First line of the input contains the number of strings N. It is followed by N lines each contains a single string. Output For each test case print "YES" if the string is complete, else ...
I've recently started switching from JQuery to Angular and it's awesome at making my HTML expressive and easy to read but every reusable module I make has its own script which leads to a massive script loading area. I suppose I could closure compile them or something but is there a better way? <!DOCTYPE html> <html> <h...
I'm mostly curious if there's a faster or more efficient algorithm I could use. I created this for a unique side project, as well as for an issue at work, so what the function does (e.g., return a negative int) isn't what I'm focused on. In short, can I make this faster or more efficient? // GetBufferLength returns the...
There was a suggestion in this StackOverflow question to move this question here. I added some more information and restructured the question a bit. I'm trying to parse the following file which contains information in the following format: TABLE_NAME VARIABLE_LIST_OF_COLUMNS VARIABLE_NUMBER_OF_ROWS (Seperated by a ...
I have an if else statement like this deciding the pattern to be followed based on type or department of employee. The if else block goes like this. I am planning to simplify the if else block to a better format. public static Pattern decidePattern(Employee employee) { try { if ("individual".equals...
I have a group of four inputs, the first three are required, the fourth is optional. $fieldA $fieldB $fieldC $fieldD #Optional So to validate the inputs, I just use this: if($fieldA === '' || $fieldB === '' || $fieldC === '') { #error } That works pretty well, except there is a special case: If all four inputs ar...
I've used encountered this exercise from a tutorial: Create a function that takes a string as a parameter and returns True if the initial word of the string passed is an article (“The”, “A”, “An”) and returns False if it isn't an article. Be careful, if the string starts with “There”, it does not start with an article...
Please give feedback on all aspects of the code, whether it be the commenting, usage of methods, semantics or anything that can be improved. This code looks flawless to me, so any suggestions for improvements will make a difference. // Imports packages for AWT, Events, Scanner, File, PrintWriter, // exceptions and S...
I am trying to create a Sudoku game in F# and I'm having a bit of trouble with the file reading and writing. But since I've also just started programming in f# I would like to check if my thinking is truly functional or if it have any obvious flaws. The Sudoku game is made up of 5 parts, Logic.fs with the game board: l...
Beginner here, trying to make a small program that sorts three numbers from smallest to largest only by using ifs. Any thoughts on how to improve this? #include <iostream> using namespace std; int main () { int num1, num2, num3; int smallest, middle, biggest; cin >> num1 >> num2 >> num3; cout << endl;...
This PHP class connects to and queries the database MuSKL. I am a novice, and I ask you to comment on the approach and style of code. <?php class MysqlAccess { private $dsn = 'mysql:dbname=bid;host=127.0.0.1'; private $user = 'bid_root'; private $password = 'e1e2e3e4e5er'; private static $_db; pr...
I have managed to get this to work but I am sure there is a better/more polished way to write this can anyone guide me to some shortcuts? https://jsfiddle.net/zrpgvoL7/4 /* move the products down in the categories for the opening of filters/sort by aswell as slide down the filters or sort by sections */ var filterHeig...
I am working on some coursework for a simple Java EE web application that records blog comments. On the add comment page there are two fields: name and comments I am using a RequestDispatcher to pass control to an acknowledgement.jsp if the fields are not empty, and an error.jsp if one (or both) are empty passing a rel...
I have a method for generating a report in Python. I want to organize the section about the date into a separate method so I can repeat the report for different dates. What's the best way to organize this? Should I create a method using just *args or **kwargs where I can dump in all the various dicts...etc.? Does it...
I need to intercept a URL and go outside the WebView if the URL contains MAPS or DOCUMENTS constants. I must also go outside if url does not contain the value of DOMAIN and LOGIN_SALES_FORCE. This is working nice, but seems ugly for me. Any ideas? if ([request.URL.absoluteString rangeOfString:MAPS ].location != NS...
I am going through some PHP array exercises on w3resource because I want to get to grips with all the different functions PHP offers for arrays. I have just done this one: Write a PHP script to sort the following associative array : array("Sophia"=>"31","Jacob"=>"41","William"=>"39","Ramesh"=>"40") in a) ascending o...
I need to create a JavaScript Promise that will not resolve until a specific HTML element is loaded on the page. I don't have any way of knowing when this element will be loaded, other than to simply poll the DOM for it. It seems there should be a more concise way to accomplish this task. I don't want anything that's ...
I'm trying to solve one simple task and on first look it's working. Any advice on how I can optimize this code will be appreciated. A quick description of the task would be: You have a file from which you read the integers. The first line has two values: The array width The number of test cases The second line has ac...
I am writing a program that will take a binary bar code and convert it to a zip-code. I need to validate the bar code. A valid binary bar code contains no more and no less than two 1s in any position per five digits. This is what I have for the validation part so far and would like simplify this code. #include <iostrea...
I have an assignment for my Java programming class that is kind of an expanded FizzBuzz-like question: Write a program that iterates through numbers from 0 to 113 using a loop. Print the numbers, one number per line. As you print each number, say x, also print the following when appropriate, separated by commas: ...
I am going though some PHP arrays exercises on w3resource. I have just completed the following: Write a PHP script to calculate and display average temperature, five lowest and highest temperatures. Recorded temperatures : 78, 60, 62, 68, 71, 68, 73, 85, 66, 64, 76, 63, 75, 76, 73, 68, 62, 73, 72, 65, 74, 62, 62, 65...
For asynchronous requests, I use Alamofire. I have created one method for requesting async data. func requestData(method: Method, urlString: String, onSuccess: (AnyObject) -> Void , onFailure: (NSError) -> Void, sender: UIViewController, postParams:AnyObject? = nil) { let AFmanager = Manager(configuration: seesio...
Today I tried to code up a generic graph abstract data type in C++. Precisely, I implemented the adjacency list data structure for a generic graph type. I think it seems to work with different type according to the test cases I have tried :). Through this post I would like to know what kinds of optimizations can I make...
I am writing a jQuery plugin which, among other things, inserts a stylesheet in the head. Additionally, I also require vendor prefixes. A lot of values are derived from variables in the script, and I'm unsure how I can write this in a maintainable manner. Now I just list everything, but maybe there's a better way for v...
What I'm trying to do is bind the controls generated by a ItemsControl.ItemTemplate to a new instance of my ContactInterface class that is created whenever I run my query function. ContactInterface.cs class ContactInterface : INotifyPropertyChanged { public string Type { get; set; } private string firstname; ...
I'm working on a programming assignment which simulates network traffic between two hosts. My task is to implement the transport layer, the code for the other layers, GUI etc. is already provided. I have managed to do this and the code works according to the specifications listed below. My concern is that the code feel...
My goal was to replicate Ruby's each_cons and each_slice: (0..5).each_cons(3) {|a, b, c| print a, b, c, "\n"} 012 123 234 345 I made two functions, for_each_cons, and for_each_slice. They work similarly to their Ruby counterparts, except the slice is always passed to separate arguments. The slice size is deducted from...
This is a fun little program I made of a fruit machine gambler, aka "slot machine". What mistakes am I making? How can I make this better OOP programming, less spaghetti? var spin = false; var value1, value2, value3, value4; var holdFirst, holdSecond, holdThird, holdForth = false; var first, second, third, forth; ...
This is a program I wrote in Python using the BeautifulSoup library. The program scrapes YouTube search results for a given query and extracts data from the channels returned in the search results. I'm just looking for some tips on how to make my code look (and function) better. I removed most of the redundancies but ...
This is a simple User class that I'm using throughout the application for anything related to the users. To tell if a user is logged in or not, I check the presence of the userID in the $_SESSION. When I'm logging in the user, I simply set the $_SESSION["userID"] equal to the ID of the user. class User{ protected $pdo...
I solved the Girlfriend's Demand challenge on HackerEarth. In summary: Input: First line of the input contains a string S. Next line contains an integer Q, the number of queries. Each of the next Q lines contains a test case consisting of 2 integers, a and b. Output: If S is repeated infinitely, would string positio...
Using the async and child_process modules, I can create true "parallel" processing. My question is, how can I ensure that it is running on multiple cores? var cp = require('child_process'); var async = require('async'); async.parallel([ function(callback){ console.log('1'); var k = cp.fork('./doOt...
I am building a list of Python objects that I use fairly regularly that have a length property, (len, 'len') and I was trying to determine the best way to simplify the type/class formatter that the object uses. For example: type([]), returns "< type 'list'>" and type(collections.Counter()) returns "< class 'collectio...
This is my first time implementing a merge sort (just getting started with algorithms & data structures). Are there any obvious things I have done wrong? I am also worried that I have overused recursion, as both the merge & the sort function are recursive. function sort(array) { var len = array.length; var middle ...
Given a Integer, find the maximum number that can be formed from the digits. Input: 8754365 Output: 8765543 private static int largestNumber(int data) { int num = data; int[] times = new int[10]; while (num != 0) { if (num == 0) { break; } int val = num % 10; ...
I have a relatively long method, and I'm wondering: How readable is it? Is a method this long okay, or will it be bad later on? Note: This method enables users to select from a console menu - UpArrow and DownArrow change option, and LeftArrow and RightArrow change amount. Here is the method (from here): public st...
I am currently working in a Zend Framework 1 project. In the project we needed a sort of logging module, and Monolog was requested. Now since I'm quite a beginner with PHP, I'd like to know if I'm doing this right. I feel like I'm missing the whole prospect of Monolog: Custom Handler: <?php use Monolog\Logger; use Mon...
I've written a piece of code, where a pair of checkboxes and a textbox are generated N amount of times. Depending on what's in the DB, the checkbox/textbox may have a default value or are left empty. I've pasted the code below, could anyone take a look to see if I haven't created an abomination? <td> @if (singleIt...
The question - 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 deficient if the sum of its proper divisors is ...
I have the following code, which draws a overlay image onto video for each frame: video.addEventListener( 'play', function() { var $this = this; // cache (function drawCurrentFrameToCanvas() { if ( ! $this.paused && ! $this.ended ) { drawImage(); requestAnimationFrame( drawCurr...
I'm learning about time structs. Without assigning either in code or input routines I want the current time. Please help me refactor this, if it should be. This code just tries to make a time struct with the current UTC time. How am I doing? // better_current_gmtime_struct_builder.c // compile with : // gcc -Wall -g b...
The application is a web application that consumes a REST service. Web config has the REST URL along with the parameters. REST URL and the values are passed as IDictionary and in Repository I convert the same as meaningful REST URL using BuildCompleteUri(). I use RestSharp to consume REST service. I am trying to learn...
The point of this method is to emulate Java hashCode(). In order for this to work the project must have arithmetic overflow allowed under: project --> compiler options --> advanced. Public Shared Function GetHashCodeStr(value As String) As Integer Dim finalCode As Integer = 0 For i As Integer =...
In the code below, noisy data points with unique errors are created. From this, an exponential function is fitted to the data points, and then doubling times (10 unit windows) are calculated. I'm uncertain how to show the unique errors in the data points in the fitted function or doubling times. Output: from scipy imp...
I made a GPL project to read Shogi Western Notations that I made public in GitHub. The project works perfectly on Ubuntu. Please check README.md to check requirements. All this code works quite well. The basic idea was fragmenting each notated move with a long regexp, which I think is the best way to optimize the proce...