0
votes
0answers
3 views

Idiomatic ruby to calculate distance to points on a graph

Can this code be made more like idiomatic ruby using methods such as map or inject? @random_tour is a variable length array of points on a graph: ...
0
votes
0answers
5 views

F# logging agent with mailboxprocessor

I'm still learning F# and have written this logger agent I want to use in a project. How is the coding style? Especially the part with MailboxProcessor.Start ... ...
0
votes
1answer
11 views

Particle in Cell: efficient data structure handling

I am building a simulation where you have 'Agents' distributed over a rather large landscape. Because the number of Agents is small, compared to the size of the landscape, I use the PIC approach where ...
0
votes
0answers
10 views

Is there a better way to to call logging here?

I have written a code which is basically a web server, handling request ...
-1
votes
0answers
17 views

C# Lexical Analyser [on hold]

I am trying to make a lexical analyser for university as part of our compiler project building off an example given by my lecturer. His example was only good for a single line entry at a time and I ...
2
votes
1answer
15 views

Semantic structure HTML5

I'm developing a website and I cut the images that I will use: ...
1
vote
0answers
11 views

Idiomatic abstract inheritance with Go

I am currently discovering Golang, and I try to implement some random variable generation functions similar to R functions. To avoid code repetition, I'd like to use inheritance, which is quite ...
2
votes
2answers
15 views

Idiomatic Leap years in haskell

I wrote a simple function to determine if a year is a leap year or not. It works, but does not feel idiomatic. ...
2
votes
0answers
25 views

Abstract Factory Pattern in Java

I reproduced my version of Abstract Factory Pattern in Java. I know it's redundant but can I get critical comments about my code. Is it really the classic implementation of the pattern or not? ...
0
votes
2answers
34 views

Rewrite conditional statement

I have this if else block code ...
-4
votes
0answers
24 views

C# Http Server Socket error [on hold]

I have a simple application, that acts as an HTTP Server, that only accepts HTTP POST. It has been working great the past few months, but suddenly I have noticed a specific error in my LOG. And it ...
-2
votes
0answers
9 views

Program received signal SIGSEGV, Segmentation fault [on hold]

How can I fix this segmentation error? After running debugger on the code below I got the following error. Setting breakpoints Debugger name and version: GNU gdb (GDB) 7.6.1 Child process PID: ...
-1
votes
0answers
14 views

The Trip — Programming Challenge 2 [on hold]

kindly review my code and help me find what might be causing Online Judge to reject this code. I also tried various test input available on the web, including this website and code seems to give ...
2
votes
1answer
27 views

Simple image loader using SDL and C++

I have been coding Java for 5+ years and before that did a little professional C. Picking up C++ again for the fun of it and I feel like I am just writing Java in C++ rather than understanding the C++ ...
2
votes
0answers
10 views

Fetching a weather report on an Arduino from a web service

I'm writing some code which is basically supposed to http get some information from my own website and parse it, which (finally) works. However, when I compile the code, it shows this: Sketch uses ...
2
votes
0answers
76 views

Wrapper for a transfer transaction API

I'm looking for any kind of advice, like when or where to do exception handling, the overall library structure/layout, usage of classes/partial classes, code efficiency, naming conventions, and so on ...
0
votes
2answers
29 views

Class inheritance testing

I'm just messing around with class inheritance. I originally had a separate goal in mind but I ended up here, and my new goal was to have a parent that was completely ignorant of it's self, i.e. no ...
1
vote
0answers
16 views

Design Patterns in Swift: Mediator

I'm solving the following problem using the Mediator design pattern in Swift: Assume we track the location of all our mobile mechanics. We have noticed that there are times when a mobile ...
2
votes
1answer
19 views

Arabic numbers to Roman numerals conversion

The following converts Arabic numbers to Roman numerals. I decided to factor each digit into its place value, then use a mapping to convert it to its Roman equivalent. For example, 1997 is factored ...
1
vote
1answer
18 views

Design Patterns in Swift: Chain of Responsibility

I'm solving the following problem using the Chain Of Responsibility design pattern in Swift: Not all mechanics are created equally. Some mechanics are more experienced and can do more than ...
2
votes
0answers
11 views

object.Body.js - module for changing background image

I use and ID instead of the body directly so I can easily modify this for other elements. I'm looking for general feedback and am interested more on code structure than things like naming ...
2
votes
0answers
29 views

Java MVC TicTacToe - follow-up

Here is my previous question: Java Tic-Tac-Toe game (implemented through MVC) I'm reposting again because I made a lot of changes to the code. I wasn't able to implement everything as I don't know ...
7
votes
1answer
34 views

Recreate cat in C

I have a school project, to create a program that works the same as the Linux cat. The code works, I just need find out where I can Improve it or handle errors. The ...
6
votes
0answers
22 views

Data marshaling wrapper for a TCP server

After a lot of research, I created this wrapper which I think fits very well to my needs. My project is a TCP server and I will be using this wrapper every time the server receives a packet. ...
2
votes
2answers
44 views

Generated serialization code

CGbR project I am currently working on a project that generates code from classes. The idea is to achieve maximum performance by replacing reflection use cases with fast, generated code. Current ...
-1
votes
0answers
11 views

Working with Astar Algorithm [on hold]

I am Rewriting an A* Algorithm in C++ which I found on the internet, I'm compiling it to get the Route, but the while loop inside the path function iterates only once and returns out empty. main.cpp ...
1
vote
0answers
24 views

Hearthstone mana curve Google chart

My code displays a Google chart that shows a mana curve. I'm not very experienced with Google charts, so I'd like help optimizing my code. I'd like my code to be more readable and to have fewer lines ...
3
votes
0answers
31 views

Ship capt crew dice game

I built this game that I used to play at family get-togethers. I am still working on the final implementation of how to actually play someone in the game. Please critique the main logic of the dice ...
-1
votes
0answers
11 views

Serializing an object to a file using BinaryFormatter [on hold]

I have never used or even learned about using compression before. In my program I have a custom object and I am serializing that object to a file using ...
1
vote
0answers
21 views

JavaScript Pong clone - classroom use

I'm creating a Pong clone for use in teaching JavaScript to beginners. Unfortunately, I am largely a JS beginner myself, so I probably missed something in the below code; however, I do not want to ...
2
votes
3answers
48 views

Filtering an array of objects

The code does the following: Gets an array of objects and filters them according to some properties Returns the array of objects with the filtered data I'm using the following code which is ...
-3
votes
0answers
15 views

Vba code to clear sheet content except Row A5 [on hold]

vba code to clear all content of sheet1 except row A5 or header row.
2
votes
1answer
38 views

String-casting utility functions

I wrote a small header that is supposed to take care of calling the right strtoX or or stoX function for me and doing so at ...
3
votes
0answers
12 views

Parsing cells containing Line Feed Characters

Link to sanitized xls on dropbox if test data is needed Essentially the reports I work with aren't bad - The issue is the way it exports to excel - With the problem being that these cells are ...
-2
votes
0answers
11 views

Put predefined text in cell just below Headers in a column [on hold]

Suppose if select any cell from column A that to bellow “Header Flag” then it will only insert ‘Y’ in column A (other cells will not except flag ‘Y’), if the user has entered the Headers exactly below ...
-3
votes
1answer
44 views

Nim Game with Arrays [on hold]

I am suppose was to incorporate arrays in my NIM game java code, so that we can allow the user to decide on how many heaps are in play. I am stuck and have no clue how to do so. Heap Class ...
2
votes
0answers
30 views

Analysis of TV station preferences for various demographic groups

I have a notebook here which details my code and may be more legible. I worked on a project that flattens a table that initially looked like this (this is table1): ...
-1
votes
1answer
17 views

Singly linked list abstraction in ES5 JavaScript

Below is the code for, Singly linked list implementation, ...
0
votes
1answer
20 views

Common ancestor in a binary tree

This method finds the common ancestor of two nodes in a binary tree. Any style suggestions or ways to make it more idiomatic? Is the algorithm correct? Rubocop says the cyclomatic complexity is too ...
5
votes
2answers
40 views

Menu Model class using Model-View-Presenter

The following code is for my Object Oriented Programming class. My program simulate the cashier's machine to order food. The code uses Model View Presenter. This class is the model. I have an ...
8
votes
0answers
69 views

A status bar for the VBE

One of the most annoying things about the VBE (VBA's IDE), is that it doesn't have a status bar. Rubberduck 2.0 works around this by introducing the ...
1
vote
1answer
11 views

Python 3 Packages, Modules, and Classes - is this approach any good? [on hold]

After reading a decent amount in this area, I've come up with the following for myself. __init__.py has imports of all submodules which are intended for outside ...
-2
votes
0answers
12 views

Project Euler #8 Largest product in a series [migrated]

I am working on Project Euler's problem #8 in which I am asked to "Find the thirteen adjacent digits in this 1000-digit number that have the greatest product. What is the value of this product?" Here ...
0
votes
0answers
13 views

Code Cleanup - Create share folder, AD security group, add descriptions, and apply security to new folder

My goal for this script was to: Create new folder Create AD group FS-TESTSHARE-R Create AD group FS-TESTSHARE-RW Apply both groups to the new share folder Set full read permissions to FS-TESTSHARE-R ...
1
vote
0answers
27 views

Simple port scanner

At the moment, prtscn takes a server, and a list of port ranges to test (of the form x,y-z,a-c,d,e etc). The -v option will show ...
1
vote
1answer
45 views

A basic pure Python hash map using a tree

I would like feedback on my first attempt to understand how hash tables work. I've read some on how hash tables use modulo operations to find the location of a key. Can you help me understand, ...
1
vote
3answers
41 views

User-tracking history query

I have a query consisting of UNIONs. ...
2
votes
2answers
58 views

Booking system for shows

Kindly accept my apologies as Java is something my mind cannot digest no matter what I do. At the moment I have an assignment and have written a piece of code and have used Constructor (I think so) ...
4
votes
1answer
64 views

JavaScript function for to toggle multiple CSS-classes at once

The method toggle of Element.classList expects a parameter which names a CSS-class. You can't assign multiple classes at once ...
2
votes
1answer
38 views

Simple function to generate an HTML-safe string

Sometimes, we have to do some fixing to insert a string into an HTML property. Or just to display it. But not everything is safe! Consider the following example: ...

15 30 50 per page