1
vote
0answers
3 views

Api with security through a private and public key

I want to make users login into an app, the code on my server serves a "token". This is based on a salt that is saved for each user, the login date, expDate and the userId. That value is hashed by the ...
3
votes
0answers
11 views

Python matrix implementation

I created a simple matrix implementation and would like some critique of it, for example: Things I could add to make it more useful Ways I could make it more efficient (for example __pow__ or ref()) ...
1
vote
1answer
20 views

C++ Queue Implementation

so I wrote a queue implementation in c++ and even though I know the code probably isn't as robust as it should be and probably doesn't perform all the checks it should, I'd like to know mostly if ...
2
votes
1answer
19 views

Save the Prisoner

A jail has prisoners, and each prisoner has a unique id number, S, ranging from 1 to N. There are M sweets that must be distributed to the prisoners. The jailer decides the fairest way to do this is ...
-1
votes
0answers
5 views

How to pass template as argument to angular directive

This code works perfectly to me but my problem is that my template i.e config.BaseURL+"Controllers/News_feed/feed_posts/review_feed.html" string is inbulit: How do ...
3
votes
1answer
26 views

A command-line calculator in C++

I was in the mood for some C++ and decided to write a command line calculator, which understands addition, subtraction, multiplication and parentheses. See what I have: main.cpp ...
2
votes
1answer
14 views

Getting the smallest snippet from content containing all keywords

This returns the smallest snippet from the content containing all of the given keywords (in any order). This provides the correct solution but I would like to know if it can be made more efficient. <...
1
vote
0answers
7 views

Fetching specific foreign exchange rates from fixer using curl and jsconcpp in C++

I am trying to create my own algorithmic trading system using C++. I have searched the web for a nice tutorial for such systems and I didnt find any. Then I started to learn about ...
-1
votes
0answers
7 views

Testing a C library without access to internals [on hold]

I wrote a simple C library which generates OAuth authorization headers. It exposes a few methods for setting the parameters that are required from the user, such as the url, token, http method, etc; ...
1
vote
1answer
12 views

LRU cache in Python

Here is my simple code for LRU cache in Python 2.7. Appreciate if anyone could review for logic correctness and also potential performance improvements. A confusion want to ask for advice is, I am ...
0
votes
0answers
14 views

Implementation of circular douby linked list and functions [on hold]

I have some functions I'd like looked over by better eyes. I consider myself a newbie so I was just wondering if you could spot any errors (or potential errors I may have missed) or maybe see ...
1
vote
1answer
21 views

Data structure limited by range

For a utility class, I've created a particular implementation of a list where the list's items can be limited to a specific range, using the google guava Range utility. Items in the list must ...
2
votes
0answers
16 views

Stampcalculator - Given a set of stamps, what combinations are there to reach a certain amount?

Background My mother has a hobby of buying and reselling books via online trading sites. After a price is agreed on, the books have to be put into an envelope for mailing. On this envelope, stamps ...
3
votes
0answers
13 views

KNN pipeline w/ cross_validation_scores

Using the wine quality dataset, I'm attempting to perform a simple KNN classification (w/ a scaler, and the classifier in a pipeline). It works, but I've never used ...
2
votes
2answers
24 views

C Threadsafe Priority Queue O(log n) push, O(1) pop

I wrote this for an A* implementation: (pqueue.c) ...
0
votes
1answer
47 views

Poker Hand Evaluator

Poker is 52 cards - 4 suite and 13 rank: Hand is exaclty 5 cards Order of hands Straight-flush - all same suite and in order Quad four of same rank Boat three of one rank and two of another rank ...
0
votes
0answers
9 views

Find installed and available Windows Updates

I have a function that uses Windows Update Agent (WUA) API through COM using the win32com.client module, part of pywin32 package for retrieving the installed and the available (not yet installed) ...
0
votes
0answers
13 views

Task-Based Overlapped IO In .NET

I've been working wrapping the Windows API's Overlapped methods in the more usable Task based approach. There isn't much information out there on doing this, so I've been flying blind apart from a few ...
0
votes
0answers
13 views

Mad Libs program

Is there any way I could reduce the code yet work just as efficiently? Also, is there anything I could add to make the experience more convenient like adding helpful buttons or function? ...
0
votes
0answers
14 views

Should my Java method close the input stream? [on hold]

I have a Java class responsible for validating documents, its signature is: String validate(String workingDirectory, InputStream input) Should this method close ...
1
vote
0answers
30 views

Take two sets of randomly-sorted scores and find their common improvement percentage [on hold]

I was studying for an upcoming phone interview, and Googling programming terms which I needed to strengthen myself in. Well after I Googled "Dependency Injection", a banner appeared asking if I ...
1
vote
1answer
21 views

Setting a textbox value to zero if null

Is this the correct way to set value of textbox to zero when it's null? Is there any way I can improve the calculation that I am doing? ...
0
votes
1answer
21 views

Password validator using regular expressions

I wanted to learn some regex, but learning regex is super boring so I decided to write a password validator that will validate a password with regular expressions. How it works: You enter a ...
0
votes
0answers
11 views

Check the battery's charge level and emit an alert on low/high value

The following script check constantly the battery's charge level of the user's laptop via the acpi command. When such level reach a low/high value, the script will ...
3
votes
0answers
13 views

Filtering conversation by filter type and value

I have been assigned to developed a feature that filters a conversation. For example, I want to filter the conversation by user id then export it to something either JSON or text file. In this case, I ...
4
votes
1answer
25 views

Initializing a std::array from a recursive template computation

I wrote this code for an answer over on SO. I suspect it's possible to clean it up a bit, particularly the base-case specialization for FactorialArray, which is ...
0
votes
1answer
22 views

JavaScript to parse json that can be, string, object and array

I have to parse a json object that can be a string, array, array of strings and array of object. I realised that it's not good from the beginning that one object can be many types, but I can't change ...
0
votes
0answers
10 views

Servlet to generate HTML printable form

I'm using a java servlet to generate HTML code to produce a printable form. I want the form to look like the paper version being used now (or as close as possible) to reduce confusion during the ...
0
votes
1answer
9 views

Generate SQL for translated resources from Excel Spreadsheet

I do some work that involves translating resources for a webpage. These are all stored in a SQL Server table that looks like this (plus a few irrelevant constraints). ...
2
votes
1answer
38 views

Optimizing Java HTML parser

I wrote a program that goes through a webpage and returns matches of regex. I used it on my letterboxd.com account to go through all of my movies (over 900 entries) and then find genres field for each ...
4
votes
1answer
26 views

Takes function and throws exception if passed function doesn't throw an exception

The code below is part of a toy test assertion library I've written. I'm looking for feedback specifically on lines 4 - 9. I'd like to extract them from the ...
3
votes
1answer
41 views

Evaluating a completely parenthesized arithmetic expression

I tried to solve the following problem in a programming challenge, but the veredict was time limit exceeded. Completely parenthesized expression Write a program that reads a completely ...
3
votes
2answers
62 views

Making a game called Hack_exe

I have been making a small game which resembles a computers terminal. There isn't much in the way of a game, but before I go any further I want to know if there are any things that I can improve, or ...
2
votes
0answers
41 views

Database Query Optimization

I made a website where is possible to search for the best transportation from a place to another. For instance, i need to go from Berlin to Bremen? the website will search in its internal database for ...
2
votes
1answer
28 views

Find offset that minimizes squared difference between two vectors of different size

I am working on a project where the hotspot is some code that is supposed to find an offset, such that the squared differences between a reference vector and a given vector becomes minimal. The core ...
2
votes
0answers
11 views

Tkinter RSS feed

I am creating a GUI program using Tkinter wherein I utilise the Feedparser module. My code executes in the following way: Get the stock ticker to insert into the URL from the user. Parse the URL and ...
5
votes
3answers
238 views

Checking whether relations are equal to foreign fields using LINQ Any()

Can you find a more understandable way to write the following one-liner? ...
0
votes
0answers
21 views

HackerEarth Prateek and his Friends non-contiguous

How to solve this problem for non-contiguous range? Prateek wants to give a party to his N friends on his birthday, where each friend is numbered from 1 to N. His friends are asking for a gift to ...
-1
votes
0answers
11 views

return value in multi if in python [on hold]

I'm doing a unit testing, I'm checking fields in two databases collections so during it I have to do a multi if conditions like this: ...
7
votes
2answers
88 views

Game of Fifteen - A Sliding Puzzle Game

I'm reviewing C by working through the edX CS50 problem sets. This task was to implement Game of Fifteen aka 15 Puzzle. Project details here. Implemented as an interactive console game. The board is ...
2
votes
0answers
19 views

Factory to augment JS classes with validation methods

I have some validation classes. To keep things smooth, I create a single class that has those validation classes inside of it. That class will be a singleton, and gets injected into my other classes. ...
3
votes
1answer
29 views

Quicksort using uniform_int_distribution to select the pivot

I have not used C++ for a while. Could you please tell me if my usage of the <random> module is correct? I am not sure if I need to be creating a new instance ...
0
votes
0answers
30 views

Replace Vowel in a string by number 1, 2,…,5 [on hold]

I'm a java Beginner and I'm trying to Replace Vowel in a string by number 1, 2,3,4,5. for example - aeiously is printed as 12345sly. being stuck in this code for like the past 2 hours. Kindly help me ...
6
votes
1answer
39 views

Constructing entities from API with foreign keys

I'm loading three kinds of entities from an API (in csv format unfortunately). While the first two are fine, the third has foreign keys to both of them. What I'm currently doing is constructing the ...
1
vote
1answer
27 views

Arabic to Roman Number in Ruby on Rails

I am making a class method in ruby to convert from roman number to Arabic and vice versa. However the loop is run to match each character and again to match with roman mapper. Can I optimize the same? ...
3
votes
1answer
38 views

JSON API client to manage user accounts

I have the following class in Typescript (using the Aurelia SPA-framework). ...
4
votes
2answers
85 views

Age verification module in Python

I wrote an age verification module in Python 2.5 . How can I improve on current_year? import time perhaps? ...
7
votes
2answers
716 views

Homework to display a square and calculate tips

Here's a simple school assignment I did: Problem 1: Write a program that asks the user for a positive integer no greater than 15. The program should then display a square on the screen using ...
3
votes
0answers
24 views

Haskell Parsec parser of Verilog-style number literals

I've set myself the task to write a function that parses Verilog-style number literals. In Verilog, numbers are written like this: 8'b10101100, ...
5
votes
1answer
46 views

Crawl site getting URL and status code

I wrote a crawler that for every page visited collects the status code. Below my solution. Is this code optimizable? ...

15 30 50 per page