1
vote
0answers
4 views

A dice roller in node.js

I knocked out a dice roller in 2 days. I think this is the first coding project I've ever actually completed to a degree where I'm not embarrassed to post it. This is my first time working with ...
1
vote
0answers
5 views

Eliminate redundancy from session authentication

I have a session authentication script and it works, but I can't find a way to eliminate the redundancy where the two database queries are. One checks if the cookie has a corresponding entry, and the ...
1
vote
0answers
10 views

Telegram Rest API client design

I'm working on a "framework" for Telegram bots and right now everything "just works". I'm now in the process of rethinking about what I wrote and one of the things I dislike a lot is how I implemented ...
0
votes
1answer
16 views

Binary to decimal converter in javascript

Exercise with test suite from http://exercism.io/exercises/javascript/binary/readme. I did not intend to use ES6 features, it's plain old javascript. That's why I seek advice more on the good ...
-2
votes
0answers
11 views

Program to create an doubly-linked-list. Why does my code work? Am I missing something? [on hold]

I'm working through the exercises in the 'Pointers' chapter of 'Programming in C' by Kochan. I have written a program that creates a doubly-linked-list. It first prints the values. It then proceeds ...
1
vote
0answers
7 views

Inner function accessing variables directly from outer function scope - What are the drawbacks?

I saw this snippet in a code that I am working on. And I feel that accessing the outer function variable directly in the inner function brings some undesirable magic. For e.g. when I read the function,...
4
votes
3answers
101 views

Interview solutions to reverse a string and reverse a sentence

Recently in an interview I was asked to Write a method to reverse a string. I used StringBuilder but was asked not to use reverse method of builder but iterate ...
0
votes
0answers
6 views

SDK Login & Web Classes

Currently I am writing an SDK for use with an existing API. Primarily I am seeking input on whether the way I am writing this code is efficient and if not what steps can I take to streamline the code. ...
-1
votes
0answers
13 views

C++ While Loop Function Using Recursion

I was learning about recursion and how supposedly any loop could be made into a recursive function. This had me interested, so I tried making the standard while ...
1
vote
0answers
10 views

Library for manipulation of binary protocol headers

I'm starting with implementing a TCP/IP stack for embedded systems which will be done in C++ and I've found I need a good way to work with protocol headers involved (e.g. ARP, IP, TCP). Major ...
0
votes
0answers
8 views

Explode list of lists to separate lists in Python [on hold]

I currently have a list of lists like L = [['E2', 'C1', 'A1', 'B1', 'C2'], ['C1', 'D1', 'A1'], ['C1', 'C2']] My aim is to compare L[i] against L[i+1] to make sets. ...
1
vote
0answers
11 views

Pagination from resultset for JTable

I am trying to create simple app, where I need a pagination for my JTable. I want have there buttons with number for all "pages" in my JTable. I have code here: Class Customer: ...
4
votes
0answers
24 views

Similarity research : K-Nearest Neighbour(KNN) using a linear regression to determine the weights

I have a set of houses with categorical and numerical data. Later I will have a new house and my goal will be to find the 20 closest houses. The code is working fine, and the result are not so bad but ...
-2
votes
0answers
12 views

Game engine code [on hold]

I'm currently working again on my game engine CreekEngine. I wrote the engine to use the SFML library as graphic and audio library. I need some review on my engine. Can someone tell me what's the good ...
0
votes
0answers
19 views

HTML structure for website

I am fairly new to coding and currently trying to write as much as I can get my hands on. I started off playing around with templates but now I've decided to go without and therefore I am sure there ...
3
votes
1answer
29 views

Passing variable to BackgroundWorker and use the same value later

I create multiple BackgroundWorker within a for-loop and each of them needs to know a special value. To simplify, it is just <...
2
votes
1answer
22 views

Ribbon animation code too repetitive

I spent the last two days getting a ribbon animation to work with divs so that I can later add li link elements to them to act as a menu. I used the progess bar animation code as inspiration from ...
2
votes
1answer
15 views

Verify if user has at least one of required roles to be able to update a record owned by a certain user

I have a Microsoft CRM 2016 plugin that checks if the user that triggers an update message has at least one of the required roles, when the updated record is owned by a specific user. Here's the code:...
1
vote
1answer
20 views

Optimize code for proccessing a string with foreach

I have a variable containing a string in this format "Size-XS|Size-XL|Color-Red|Color-Green". When i process it the final result is "Variations: Size: XS, XL, Color: Green, Red. The code for this is ...
4
votes
0answers
15 views

ListBox with a dynamic number of TextBox elements

I am making a kind of form, and I want the user to be able to enter a dynamic number of string inputs. The idea is that a single TextBox will be displayed, and once ...
2
votes
1answer
19 views

Exercise to create an insertString function to linked-list. Seems too simple. Am I missing something?

Working from 'Programming in C' by Kochan. I'm on an exercise in the chapter 'Pointers'. This was the exercise: 'Write a function called insertEntry() to inset a ...
2
votes
2answers
21 views

Insert a Node at the Tail of a Linked List

I've solved this question, but have a small question. In the while loop we check if (temp->next != NULL), why wouldn't work if we check (temp != NULL). Isn't it the same, both checks will get us to ...
2
votes
1answer
18 views

Google Codejam 2016 Round 3 Problem A

I'm learning Rust by completing a variety of coding challenges, such as the Google Codejam problem stated in the title. I completed a Python 3 implementation that I liked, which I then tried to port ...
1
vote
0answers
19 views

Recursive Implementation of Merge Sort C++

I am currently reading an algorithms book and I read on the insertion and merge sorts. I implemented the merge sort in C++, The first function MERGE is responsible for the merging of the two subarrays ...
3
votes
4answers
39 views

Project Euler Problem #4 Ruby

I've solved the Project Euler Problem #4, but I'd like some tips as to how to make this more efficient. I am a beginner to Ruby, so please be nice about the stupid stuffs (but still tell me about it). ...
-1
votes
0answers
12 views

parsing a table with jsoup [on hold]

i'm trying to extract the e-mail adress and the phone number from a linkedin profile using jsoup. I have written a code but it doesn't work, the code should work on any linkedin profile. Any help or ...
-1
votes
0answers
20 views

Image input output in Java [on hold]

In this code I have taken an image as input and output the same image. As far I know if two images are same then their PSNR value will be inf. So I calculate their PSNR value using MATLAB but it shows ...
6
votes
1answer
52 views

Get host ip address behind load balancer or without lb

Description Aplication type: WEB API .NET Framework: 4.5 MVC: 5 I need caller host ip in my custom action filter and then in action. On some enviroments we have configured load balancer which ...
0
votes
0answers
12 views

ASP.net MVC Controller that relies on a WCF Service - Error handling

Inside one of the Controllers of my MVC application, I have the following. ...
6
votes
1answer
40 views

Simon memory game

I have recently started to learn Python and I have decided to apply what I have learnt so far to creating a Simon Memory Game clone. I am now looking for help with improving the code. Any help with ...
0
votes
2answers
41 views

Randomly re-partition 1Dimensional List to 2Dimensional [on hold]

I wrote a solution Please look at the my approach is correct? There is a better solution? ...
-5
votes
1answer
37 views

Shortening form id and input id [on hold]

I would like to make my script more efficient and while looking at my script which is fairly large I realize thatnT.dS[v] is repeated quite often. I've tried do ...
3
votes
0answers
29 views

Partial anagram generator in VBA Excel

I'm trying to make a VBA code to arrange k-element subset of an n-set into some sequence. In other word, I'm trying to list all of k-permutations of n member set. For example, let's try to list all of ...
2
votes
0answers
16 views

Sequence generator with custom step size, start value and operation

I have created a little generator class to generate number sequences.The intended purpose of this class is to be used with generate_n to populate containers. I would like to know whether there is ...
1
vote
2answers
31 views

PHP script that combines data from two CSV files to produce two new files

I've spent some time looking at various posts on Stack Overflow regarding PHP CSV file manipulation and have devised a script that combines data from two CSV files to create two new files. The aim of ...
4
votes
2answers
70 views

Testing if array is heap

This method tests an array of integers satisfies to see if its a max binary heap. This means each node is greater than or equal to it's children each node has at most 2 children the leaf nodes are ...
0
votes
0answers
24 views

Check fragment for exclude show same fragment again

I use this code to check a fragment before showing it. What can you say about it? ...
4
votes
1answer
60 views

Javascript contact form validation code

I'm a UI / UX Designer trying to sharpen my JS skills. I wanted someone else to check this code snippet and maybe have a Pro tip to improve or shorten it. Javascript: ...
0
votes
0answers
11 views

Simple cache to avoid database read [on hold]

My goal is to use as a Map as a simple cache in a threadsafe manner i to avoid reading from the database. I'm solely interested in the correctness of my code below to achieve the goal so please ...
2
votes
1answer
34 views

Simple Python script to sort and make json data unique

I'm retrieving e-mails from a collection of a few hundred *.json files using the following: Python Script ...
2
votes
0answers
20 views

Card combination finder in F#

I have been adding and tinkering a bit with the code from my Baloot tally finder. I updated the code a bit and factored a new things, but for this post I am trying different stuff: to detect whether ...
0
votes
0answers
13 views

Kruskal's MST algorithm for HackerRank [on hold]

My code passes all but the last two test cases. I've been trying to figure out what edge cases I missed. ...
14
votes
4answers
1k views

Printing the PID of a program immediately before it runs

I need to know (for monitoring purposes) the PID of a program immediately before I start it. There could be multiple of the same program launched at the same time, so monitoring ...
3
votes
2answers
42 views

Print element in a linked list in reverse

I solved this problem in C++ and was looking for feedback on my code. I'm not sure if storing the data in an array and looping through it in reverse and printing was the right approach since this ...
1
vote
1answer
36 views

Unbounded Sieve of Eratosthenes in Swift

I've spent a while teaching myself Swift, and decided to take on the challenge of writing an unbounded Sieve of Eratosthenes to challenge myself. This is actually the first time I've written an ...
0
votes
2answers
26 views

Exception handling in URL builder method

I have a method which is part of a request-handling class. It creates a URL, depending on the resource send request. This is a part of the REST service: ...
4
votes
1answer
44 views

Generate dictionary of points on n-sphere

This is a long-shot, but my question is to simply optimize this particular function in some code I have written: ...
9
votes
2answers
122 views

Structure to ByteArray Extension

I have a need to turn various structures into byte arrays to be sent over serial port to another machine. I created generic extensions to turn any structure into a byte array and from a byte array ...
2
votes
1answer
35 views

Simple object oriented design for an Temperature class

Design a temperature class for nurses to store patient temperature and the method of taking the temperature. How would you handle different units of temperature? Write a function to determine if a ...
1
vote
1answer
25 views

Entity resolution with NLTK

I am trying to write a script of Python code, for entity extraction and resolution. The excerpts of the algorithm: It is trying to extract the entity as PoS Tag with Hidden Markov Model(HMM). After ...

15 30 50 per page