0
votes
0answers
9 views

How to execute a method within only if multiple are set properly?

Lets assume that we have a simple class which holds my product. Someone can add a serial to this product and also a purchaseid. On change of the properties i want to check wether both properties are ...
1
vote
0answers
4 views

Wrap glium_text so that parameters aren't passed redundantly

I was annoyed by the API of glium_text, so I decided to make a wrapper that cleans up the API instead of coding my own text rendering. (I might do that later.) The wrapping turned out to be rather ...
2
votes
0answers
7 views

Encoding a list of frequencies as WAV audio

This code gets a list of signals with predefined frequency from struc.num I need to encode it to wave format, so i use this code. This works, but i dont sure it is a correct decision to encode like ...
3
votes
0answers
14 views

Making template meta-programming a little easier with integer packs

In template meta-programming, integer sequences and ranges are very useful. I've made a couple of utility classes that do various operations on compile-time integer packs. The implementation is non-...
-4
votes
0answers
24 views

Simplify IF statement

Any suggestions on simplifying the following If check Approach1 ...
-3
votes
0answers
12 views

How can I do a prefix tree? [on hold]

I wanna do a preffix tree with this suffix array code but I don't know how to do it, can somebody help me? ...
1
vote
0answers
16 views

asp.net core mvc read image from folder and display

I have a question concerning the correctness of the reading and displaying the image in asp.net core mvc web application. So this is the code: This is the way I am reading image names from a specific ...
11
votes
3answers
354 views

Generalized Project Euler 1: A sledgehammer to crack a nut

The problem Project Euler 1 is one of the most asked questions on site. However I wanted to solve the more general problem of division. Multiples of a list If we list all the natural numbers ...
4
votes
1answer
32 views

Test if a string is a palindrome

I got this out of an article on interviews / code challenges. The challenge text goes like this: A palindrome is a word, phrase, number, or other sequence of characters which reads the same ...
0
votes
2answers
15 views

Recursive Scala Case class Reduction

I have a case class that is recursive and looks like this: ...
0
votes
0answers
6 views

Displaying “tooltips” in Highcharts

I have the following piece of code: ...
2
votes
2answers
28 views

Finding median of 3 elements in array, and sorting them

The method medianOfThree returns the median of the first, center and last element in array sorts the first, center, and last element of the array, so they are in ...
0
votes
0answers
15 views

need to remove last comma in java [on hold]

This is my code ...
0
votes
0answers
11 views

Continuously execute runnables on the UI thread [android]

I need to run a sequence of runnables on the main (ui) thread with a given delay between them indefinitely until signalled to stop. Code: ...
2
votes
1answer
24 views

WPF - Run an async Task with DispatcherTimer

I have a small application that checks some system status and display it details. I have the following code which is working. But I want to make sure it's optimal: ...
0
votes
1answer
11 views

Single endpoint for ingoing mail with multiple purposes

The following code is not one of my proud moments. In its initial state, I had only a single purpose, but know I'm up to three purposes and I don't know if it would stop there. I'm using mailin.io to ...
1
vote
0answers
15 views

Matching text is one set of <li> to another set of <li> using jQuery

I'm trying to match the text in one block of li tags against another block of li tags, and although this works, there must be a better way of doing it without nested loops. ...
1
vote
1answer
19 views

A String.prototype.diff() implementation (text diff)

I just had the idea to develop an algorithm to calculate and highlight the difference between two strings. I know that there are already some libraries to do the job but i just tried to make my own. I ...
2
votes
2answers
36 views

Find maximum value of Point represented by an Array of values for each coordinate

Suppose there is an array A = {3,2,5}, then points for this array correspond to indexes (i,j) where ...
2
votes
4answers
31 views

PHP mysqli code for login form

Can you check my code if I wrote like a professional? connection page. form sign page. plan page. log out page. First I create the database and tables, then the connection file, then the form sign ...
0
votes
0answers
8 views

Mini school database with JS revealing module pattern

I tried the module pattern for the first time, with this exercise as a problem to solve: http://exercism.io/exercises/javascript/grade-school/readme It's a small exercise requiring simple tasks : ...
5
votes
1answer
37 views

Python comparing a string or list of strings to a string or list

I'm using a selfmade python program for learning new words in new languages. Originally I made this program for a university course but now I'm just trying to imrove it and make the code "prettier" ...
0
votes
0answers
7 views

php - strpos vs preg_match - memory and resource differences [migrated]

There have been questions asking which is faster strpos or preg_match, but I'm interested which in knowing which uses the least memory and CPU resources. I want to check a line for one of 5 matches: ...
0
votes
3answers
37 views

Toggling image sources

I have a set of images with class = tt like so <img src="images/arc_unselected.png" title="Arc" class="tt" /> and I have written this code to change the ...
6
votes
4answers
910 views

Python. Guess the Number

I have been using Python 3 to learn programming, this is very basic task, but I want to gain good programming patterns/habits at the very beginning. The program will first randomly generate a number ...
1
vote
0answers
17 views

SI1145 Adafruit UV Sensor Library porting from Ardunio to Python SMBUS [on hold]

First post here. I originally asked this question on the Raspberry Pi Exchange because of its specific nature but it was suggested it would be better seen here so here goes. I have spent the day ...
2
votes
0answers
18 views

Python: Optimizing simple image scraping code

I'm fairly new to python. I wrote this code over the last few days. I learned a lot, and it works how I expect, however I suspect it's woefully inefficient: ...
2
votes
0answers
16 views

AVL Tree Implementation in Haskell

I'd like to get some feedback on my AVL tree implementation. I appreciate any comments related to style and performance, particularly if something can be written in a more concise or idiomatic way. If ...
0
votes
0answers
11 views

Parametric HOAS and graph reification [on hold]

Is it possible to reify the graph of lambda terms expressed as parametric HOAS. Not quite sure if it is ...
0
votes
0answers
7 views

Need Some Help in Excel Formula [on hold]

I make some Formula in Excel that will monitor all my report coming and how many days left. im having trouble with the previous day because it still appear the hour that i need to meet per day. maybe ...
2
votes
0answers
12 views

Movies wrapper script

I'm trying to do a nice script to be able to wrap my movies. Can you help me to improve it? I want to structure my code better but I don't know the language enough to do it. ...
0
votes
0answers
19 views

Roll dice 10,000 times. 7 and 11 are wins everything else loss. [on hold]

I am writing a program that rolls a pair of dice 10,000 times. If they total 7 or 11 it is considered a win. Every other total is a loss. Need the out put to state the number of wins, losses and the ...
3
votes
1answer
15 views

Retrieve value from a formula in cells into different merged cells and retrieved value can be edited

I have created this macro and having a small issue. I am very new to this VBA and did this with experts’ guides by googling it. I am creating an excel form for a work purpose at work. The Excel form ...
2
votes
0answers
24 views

Split string into 160 character parts while adding text to each part

The send_sms_message method takes text as an argument. The length of text is unknown and can ...
3
votes
1answer
23 views

4 versions of the same C function to compare error handling

I'm starting a new, small C project and would like to have the safest, cleanest and shortest error handling code possible. Here is a comparison of different ways to handle errors in the same C ...
-2
votes
0answers
9 views

FCC Profile Lookup [on hold]

i have trouble with that code. ...
5
votes
2answers
48 views

Non-repeatability (plagiarism and time travel)

I heard/read that writers of texts can be recognized by counting their used words and compare these to previous works. As a code kata I experimented with this a bit and found some disturbing facts. ...
1
vote
1answer
26 views

Python Decimal to Binary converter

There is no input validation for this, but that aside, I would appreciate it if anyone could help me improve the logic of this script. ...
-3
votes
0answers
18 views

Project Euler Problem 21 - Amicable Numbers - JAVA [on hold]

Help Debugging please. Program won't stop. ...
2
votes
0answers
10 views

Creating a Kinesis stream, Firehose, and lambda event source from config file

I'm in the process of writing a python script for automating a data ingestion pipeline using Amazon Web Service's Kinesis stream, Firehose and lambda. This is my first stab at writing Python, but I do ...
1
vote
0answers
27 views

Interactive Android AppWidget Collection to Populate Activity On Click [on hold]

I recently developed my first appwidget for Android, and it works really nice. I basically created a collection widget and use a Loader to retrieve the data from a database, and when a user clicks on ...
2
votes
1answer
19 views

Start and end times of recurring events

I'm working on a function that returns a specific set of times for a given timezone and a given frequency; day, week, month. For any given timezone and a frequency the function will return the ...
5
votes
3answers
126 views

Finding the duplicate with an array with 1,000,000 integers between 1 and 1,000,000

I recently had an interview and got to phase 2 which is a coding assessment. One of the questions was: Given an array with 1,000,000 integers between 1 and 1,000,000, one integer is in the array ...
1
vote
0answers
12 views

Exponential backoff generator

Exponential backoff in the context of various networking protocols looks something like this: When a collision first occurs, send a “Jamming signal” to prevent further data being sent. ...
1
vote
1answer
18 views

Database connection in MVC model

I followed the tutorial Build a PHP MVC Application and have implemented a database connection. I made a seperate database connection class and I call it in the controller. It works, but now I have ...
1
vote
1answer
46 views

C++ Prime Number Library

This prime number library is one of my first programming projects I've done in c++. My goal is to create useful functions that deal with prime numbers in an efficient way.Note: (Most of the functions ...
11
votes
6answers
1k views

Find the first non-repeating character in a string: (“DEFD” → E)

I recently had an interview and got to phase 2 which is a coding assessment. One of the questions was: Find the first non-repeating character in a string: ("DEFD" --> E) I didn't pass the coding ...
3
votes
0answers
11 views

Memoizing decorator with retries, part 2

A while ago I asked this question Memoizing decorator that can retry and then promptly forgot about it. I more recently saw Python decorator for retrying w/exponential backoff and wanted to add ...
3
votes
1answer
22 views

Implementing joinWithSeparator on a Character array

I recently answered a Stack Overflow question about transforming an array of Characters into a String in Swift. Looking at the question and the Swift standard lib, it appears that there is a method <...
4
votes
2answers
25 views

Error-checking macro to jump to specified label given a failing statement

I'm starting a new C projet and I want to have the cleanest and shortest error checking code possible. To that aim, I often use two things : functions return 0,...

15 30 50 per page