# All Questions

6 views

### Vending Machine in Idris

Type Driven Development with Idris demonstrates how Idris can be used to build a Finite State Machine for a vending machine. Here's my implementation: ...
5 views

### Regex password strength test

I've been following a Python programming book and reached the Regex chapter where I encountered this challenge: "Write a password strength checker that checks if a password is: At least 8 ...
72 views

### First-time C code - Palindromes

To start off, as the title suggests I don't have a very thorough understanding of C yet. This is my first program, although I know Java well so that's a good starting point. The function tests ...
20 views

### Singly linked list delete() method

I would like a quick review on my method to delete a node from a singly linked list. I'm fairly certain that this is not near optimally done, and would love to get feedback. It uses a ...
4 views

### Angular.js: Require a module like a controller in Link Function

Currently the code I am looking at pulls in a constant module into the linking function by calling the element's injector. My question is there a way that I can "require" the constant similar to ...
14 views

### Displaying a map of points

I'm working on an html game of the type of Ogame and other browser games of the genre. I've tried worked on a grid controller to display a map of points that you can move around when you have an ...
16 views

### CSS animation via Javascript - further optimization possible?

I call this 'animateElements' function as part of an animation loop [inspired via Dave Gamache] - all works as expected - but I would love to try and improve/optimize if possible? ...
39 views

### Merges two lists into one list

The code works as it is written, however; I was wondering if there are any easier or more effective ways to merge two lists. ...
15 views

### Matlab Computer Vision

Im not really certain whether this is OK, but I'm looking for some code advice- particularly around style and efficiency. the code takes a video (a drop onto a fabric surface) and I want it to return ...
66 views

### Pairing Labels with Images when building a UI

In a prototype 4X space game that I am working on recently, I have two different scroll panes to show the ships and the stars of the player. The ships are displayed in a vertical scroll pane on the ...
13 views

### code to check if it possible to separate the graph or not [on hold]

I have an assignment to check if the graph can be separated or not as this picture,in this case it can be separated using BFS I did write all the code but I have a little problem in coloring the ...
29 views

### My implementation of (open) Knight's Tour

This is my implementation of the (open) Knight's Tour on a 5v5 board. My original assignment for CS was to solve the Knight's Tour from any startings position (0,0 -> 4,4). The goal for myself was to ...
10 views

### Unlocking spreadsheet files quickly - follow-up

I recently posted a program I made to unlock spreadsheet files( see also ), I've taken all of your advice and made it more Ruby like, it has no shell commands in it, and uses ...
40 views

### TicTacToe C# game [on hold]

I have created a TicTacToe game using C#. The game operates correctly and runs. I am looking for advice from people who have worked on games like these before. I am wanting to see if there are ways to ...
27 views

### Stack Exchange moderation-action auto-comments

I've written a userscript that pops up a dialog before you take a moderation action (closing, deleting) with some pro-forma comments, so that you can add one of those before you cast your vote. I'm ...
32 views

### Longest common subsequence (LCS) for multiple strings

How would you improve this code? Particularly the check and check_all functions? The time complexity of the algorithm of mlcs is $O(|\Sigma|MN)$, where $\Sigma$ is the alphabet, M is the number ...
60 views

### Pythonish integer range in C++

Python has that range: >>> range(10, -20, -3) [10, 7, 4, 1, -2, -5, -8, -11, -14, -17] I have this C++ implementation of exactly the same facility: range.h: ...
24 views

### A way of keeping a constant game speed at any fps with Pygame

Normally the game speed with pygame is locked with the fps, so I attempted making a simple two classes that'd be super easy to use, to allow for the same game speed no matter what the fps is. For ...
9 views

### SQLite : insert values into database through windows form using c# [on hold]

I am new to use SQLite database and do coding for windows forms. My requirement was to create a .exe file for a simple project which has a registration form with 2 inputs. 1) UerName 2)PassWord. So I ...
16 views

### Port of NLTK tokenizing code from Python to Rust

I'm working on a port of NLTK to Rust. I am fairly new to Rust, so I wanted to post a small file to check if I was writing idiomatic Rust. I've included the original Python. The Python has docstrings ...
22 views

### Optimize Data Sending/Querying to Parse Swift iOS

I have a swift method that I'm using to update Parse in the backend when the button is tapped. The method acts as a voting system, incrementing a label every time it's tapped: ...
29 views

### Start with nil, loop over array and break if not nil, then check if nil [on hold]

I wrote a snippet that starts with a nil object, iterates over an array and attempts a query for each element in the array. If the query result is not ...
194 views

### C# FTP class for interaction with FTP server (Download only)

I'm writing my own FTPclient for downloading files from my FTPserver as a project. So far I can download and go backwards/forwards in the folders using this code. How does it look? What could be done ...
56 views

### Partition algorithm with two loops c++ [on hold]

I was given pseudo code for a partition algorithm but I'm not really sure how to implement it. Below is the pseudo code and my implementation. Please let me know if this is correct/explain what it's ...
27 views

### Using PHP to create a file structure

I am using PHP to create a file structure in which to store XLSX files, for this I have created this class: ...
38 views

### Inserting JSON array data into a MySQL database using PHP

Here I am parsing a JSON array and inserting it into a MySQL database. The JSON Array comes from my android code. This is how my JSON array looks like: ...
466 views

### Date of latest GitHub project release

I needed a clean, simple and robust piece of code to retrieve the date of publication of the latest release of a given GitHub Project. My constraints were that it needed to be written in the C++11 ...
777 views

### It'th wabbit theathon

I don't know regex. I want to learn regex, but learning regex just for the sake of regex would be quite boring. So I decided to learn Ruby as well (which so far looks a lot like Python, which I'm ...
37 views

### Better way to merge pdfs

I am trying to merge two pdfs - one from a razor view and one from a file on the server. To create the pdf from the razor view I have used the following nuget package: MVCRazorToPDF. Unfortunately ...
73 views

### Finding permutations of a word

This was a basic anagram problem. Take an input word, find all its permutations, then check a dictionary file to see what if any of those are real words. Dictionary file My input data: ...
23 views

### Validation for DTO using DataAnnotations

I need validation for all DTO objects using System.ComponentModel.DataAnnotations. You can see how I implemented. Idea is to have one abstract class that will be inherited in all dto classes. This ...
11 views

### Please check my code to calculate pespective [on hold]

I've got a homework in which I have to calculate and plot some points using a pespective transformation, but I'm not sure my results are correct, since the 3d plot using Camera coordinates looks very ...
32 views

### Anti-pattern or acceptable way of using Promises? [on hold]

Whenever I need to use a Promise interface in my NodeJs code and I don't have a promise to start off with, I do this: ...
36 views

### Calculating company-wise total expenses

I have a variable List. Its declaration is like : List<HashMap<String, Object>> Sample data in it: [{total-expense=228, company=HiHard, ...
17 views

### Reimplementing enumerate() to produce a sequence or iterator

Apparently it is possible to implement enumerate so it produces a sequence when given a sequence, and produces an iterable otherwise. Sequence can be safely ...
19 views

### Sprite as an component in an entity-component system

I'm reading that Components in ECS are just only data and have no logic. I'm trying to follow this and I got that working: ...
34 views

### Comparing puzzle solvers in Java

I have this program that solves a $(n^2 - 1)$-puzzles for general $n$. I have three solvers: BidirectionalBFSPathFinder ...
35 views

### Bluebird: promisify xhr request

I use bluebird promises. I want to promisify my requests from communication layer: Utils.js ...
25 views

### How can I remove/reduce redundancy in this scenario? [on hold]

Consider the following code snippets in Borland C++: ...
27 views

### CRUD in Managed Bean

I want know what are best practices for CRUD operations in Managed Bean. I created EntityManagerUtils class which contains CRUD methods and redirect value to ...
25 views

### array_diff in JavaScript

In PHP exists a function array_diff (http://php.net/manual/de/function.array-diff.php) which returns the difference of two arrays. I have tried the implement my own version in JavaScript. Any ...
12 views

### Looking for recommendations on Reddit

My ViewController's model has a need to contact an api with an initial request, followed by an arbitrary (~20) amount of API calls, each containing an arbitrary ...
46 views

### Tracking hours worked for the days of the week

I am working through a udemy course on Python, this is the first real program I've written. I am new to Python and to programming. I'd like to replace the main ...
34 views

### Chatty AI that saves .txt files to remember

This is a basic AI that I created. It has a teach function that creates a .txt file with user inputed info for future use. If you type teachme you have the option to type in something that you have ...
21 views

...
59 views

### Toggle four relays on/off based on bitmap stored in uint8_t

I am using a one-byte bitmap to control four relays. I am writing a function which will take the bitmap stored as uint8_t, look to see which bits are set/cleared, ...
13 views

### Groovy pathfinding algorithm

I have created a bit of path-finding code in response to this code golf question. Since this is one of my first large bits of code in Groovy that I have written, I would like to see how I could ...
16 views

### Managing users and profiles in Rails

I am building a Rails marketplace application using TDD. I would like to get advice on the way in which I have built the User associated ...