All Questions
0
votes
0answers
6 views
Addition of two IEEE754-32bit single precision floating point numbers in C++
I made a C++ program which takes a list of triplets with S.No. from a text file, where the triplet, i.e. a,b,c correspond to a+b=c (addition done using float data type). Now I convert a and b from hex ...
3
votes
1answer
24 views
Java Brainfuck Interpreter Method
Due to the fact that nobody's ever posted this before (sarcasm) I've made a brainfuck interpreter in java. The interpreter fits in a single method, and is designed to be readable, fast, and concise, ...
2
votes
0answers
15 views
Make one greenlet tell another to shutdown
I am building a commandline app to check proxies, which has a daemon flag (running forever or just once).
There are producers, checkers and storers. I want them to run in parallel and be able to ...
3
votes
1answer
21 views
Number class to add/compare different kinds of numbers
I am creating a Number class having Integer and Fraction derive class which add/compare different kinds of numbers. In addition, the caller need not needs to know ...
-2
votes
1answer
15 views
Replacing inline onclick with unobtrusive JavaScript [on hold]
I built this web app to present a random group of questions for quizzes and tests. The page opens with random questions. Clicking anywhere shows (only) the spinner div. Clicking anywhere again brings ...
1
vote
0answers
7 views
Dynamically displaying different controllers
I have here a simple webapp for displaying different D3 demonstrations:
The idea is - the user can select one of many modules in the control bar at the top, and the corresponding controls for that ...
0
votes
0answers
6 views
Bot command logic for ordered turned playing list
This is the switch statement for an unfinished bot I'm making that maintains a user list and responds to these commands in an irc chat. For whatever reason, the list order gets scrambled when around 5 ...
1
vote
0answers
11 views
RPG character, levelUp system and stat checking for object usage
So I am working on a small RPG in Unity.
Right now I am writing some business classes, POCOs, that have no link to Unity excepted being in the required C# flavor and using Debug.Log and stuff.
I ...
-2
votes
0answers
19 views
Randomize same list multiple times without column duplicates [on hold]
If I have a sorted list of int with members 1 to 6, how do I sort it multiple times, making sure that the same number doesn't come up in the same list index?
I'm using C#, but pseudocode is fine.
<...
2
votes
0answers
20 views
Unstructured quantum search algorithm for unknown solutions
I put together this code for IBM's 5 qubit processor as an implementation of Grover's search algorithm, but for an unknown number of solutions:
...
0
votes
2answers
28 views
Random Password Generator in Java
I made a random password generator in Java using a GUI. In the program, the user can choose the length, and whether to include lowercase letters, uppercase letters, symbols or numbers in the password. ...
1
vote
0answers
11 views
Simple PyQt5 counting GUI
I just began learning how to use signals and slots in PyQt5, and so I made a cute (pun intended) little program to display just one button. When the button is pressed a thread is spawned which will ...
2
votes
1answer
18 views
Formatting a phone number
I have a program that will format a phone number in this format: (###)###-####
...
2
votes
1answer
60 views
My attempt at Dijkstra's Algorithm in Python 3
I am practicing my coding at HackerRank. The exact problem statement can be found here, but to summarize, it is finding the distances of the shortest path from a starting node to every other node in a ...
0
votes
0answers
13 views
Best way to implement my custom protocol onto my wrappers for the TcpClient/Listener classes [on hold]
I'm making a wrapper of the TcpClient/Listener class in VB which also includes a protocol for communication.
The protocol is actually a ...
1
vote
0answers
11 views
Workbook for tracking projects
This workbook is used to track projects. I have this VBA code linked to a Form Control button. When I press the button it will run through and get information from all the project sheets and feed it ...
0
votes
1answer
22 views
Java Scanner String input [on hold]
I am doing Java exercises from HackerRank.com and bit confused about this problem.
Here is my code that pass the test case.
...
4
votes
1answer
14 views
PE4: Largest Palindrome Product (Clojure)
I solved Project Euler 4 using Clojure Lisp.
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the ...
4
votes
0answers
29 views
Micro ORM on the lines of dapper
Designing a micro ORM inspired by Dapper. I'm building this as an exercise to learn. I would appreciate if you guys can review my code.
I would also appreciate any suggestions regarding the features ...
-1
votes
0answers
8 views
Showing overlay on onbeforeunload event [on hold]
I have two problem with event close tab.
I have a function to put a overlay with some text while browser ask to user if to close or not to close. I would like to show "Hello world!" instead of ...
2
votes
0answers
14 views
Prim's MST Java implementation
Can someone review this code, just have look if it's logically correct
or
If you may point me to a more simple and minimalist program
...
0
votes
0answers
11 views
Libgdx play class becoming overwhelmingly complex/messy
I came here today to see if I could get some pointers to cleaning up some code for my game. I started developing this game, and now the class seems to have gotten way to big. It's the play screen ...
4
votes
1answer
19 views
jQuery for revealing secondary menu
Below is some jQuery I recently wrote and I'm quite sure there is a more elegant and/or efficient way to write it. The gist is, when a user clicks on a Primary Nav link, its Secondary menu slides down....
0
votes
1answer
45 views
DIY String Encryption
I was asked to make a String encryption utility without using encryption API. I basically had to come up with my own encryption methodology! the program was to be able to encrypt a string and decrypt ...
-1
votes
0answers
17 views
CRUD class for database
I have a database class that connects to a Database and runs CRUD operations. I need a critique of how well this class adheres to SOLID principles.A class to run all database operations seems like '...
3
votes
2answers
17 views
Ruby Select uniq in one statement
I'm trying to implement some simple logic using rails. Code is working fine but its look uglier to me, could any one help me on refractor or implement in a efficient way.
Context:
Data hash ...
0
votes
1answer
33 views
Assigning default values to function arguments which may be “empty”
Is there a canonical practice for assigning value to an argument which, if "empty", is assigned a default value? Here, "empty" is defined as an argument value which is either ...
1
vote
0answers
17 views
3
votes
2answers
36 views
Simple program to read memory usage by PID in Linux
I just learn a little bit about C Programming and try to create a modular program so I created simple program to read memory usage by pid(s) in Linux.
...
-1
votes
0answers
8 views
-1
votes
0answers
11 views
Java 8 lambdas and streams Map to constrained Map [on hold]
I have a Map with 1000 keys, which have Integer 'fitness' values
...
1
vote
1answer
34 views
Project Euler 12 (triangle numbers), solved using functools.reduce() and looping
I have solved problem 12 on Project Euler website, which reads:
The sequence of triangle numbers is generated by adding the natural
numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 ...
2
votes
1answer
22 views
Un-wrap lines in a text file
I have a function which takes a string representing a text file, joins lines which were wrapped, and returns a slice with the wrapped lines. I'm interested in ...
1
vote
1answer
25 views
Alternative to using Object and casting in a map
I have the following class which represents a set of properties.
...
7
votes
1answer
38 views
Retrieving all institutions in a specified country
I'm checking each variable to prevent null exception, but still wondering can this be improve in much simpler and cleaner if you will be writing the same code? Please see the below snippet:
...
3
votes
1answer
23 views
Filling Array with Alphanumeric values
I've done a function that does the following :
It takes an argument length that it will be the length of the result array.
The Array should start with alphabet ...
1
vote
0answers
13 views
Image resize optimization
This Delphi (Seattle 10) routine resizes a JPG image if one of its sizes is larger than AMaxDimension pixels, and gives it a compression factor of ...
3
votes
1answer
37 views
Naughts and Crosses: Human vs Computer in Python
So I am very new to programming and I am trying to pick up Python as a first language. I have programmed a simple game of naughts and crosses, but it is very wordy and there must be a simpler/quicker ...
1
vote
2answers
26 views
Finds a position to break a string that is not part of a <br>
I have a 'read more' angular directive copied from:
https://github.com/doukasd/AngularJS-Components/blob/master/dd-text-collapse/dd-text-collapse.js
Some of my text can already have ...
2
votes
2answers
39 views
Concatenate unlimited amount of arrays with predefined function
I am working on learning more about arrays and loops! I have been trying to create a method which will allow me to take for example an unlimited amount of arrays and append or concatenate them to each ...
0
votes
0answers
6 views
Creating a custom Rubocop rule to detect backtickets [on hold]
I'm trying to create a new Rubocop rule to detect the usage of backticks in custom Facts.
It seems fairly hard to figure out how the detection of
...
5
votes
2answers
1k views
0
votes
1answer
30 views
Circular Array Rotation C++ HackerRank [on hold]
I'm a first time poster. I conceded defeat and looked at the answers given on hackkerank itself but the ones I saw used things like vectors, which are concepts I'm a noob at as my knowledge of C++ ...
-2
votes
0answers
25 views
Excel VBA to edit response in Google sheet via Google form [on hold]
I have modified this Excel VBA code to edit response of Google form, this code is working for one url (Response edit URL) but how to edit all existing response with excel until the last empty row. Any ...
2
votes
2answers
27 views
Collect, filter and display archive logs on demand
Wrote a php site to gather/filter/search daily archived logs from the archive directory using bash cat and ...
2
votes
2answers
390 views
A simple daily horoscope
I wrote a simple daily horoscope in Python using Beautiful Soup as scraper. It works fine but the code can use some sort of a... direction if you want to put it that way. I have used underscores in my ...
2
votes
1answer
39 views
A clock implemented using Moment.js
This is a POC for a clock using moment.js, eventually I plan to recreate this in Raect.js. Any opimisations or a better way to do it?
...
-3
votes
0answers
22 views
-2
votes
1answer
39 views
How to efficiently perform calculation in do while loop? [on hold]
I am trying to do some calculations in do while loop, there are no errors but it is just taking lots and lots of time.
Basically I have got an array that contains 240 strings, there are 20+ radio ...
-3
votes
0answers
17 views
Invalid syntax error [on hold]
l'm a fresh python user and l'm trying to create a calculator. l run into a problem "invalid syntax" but l could not find a solution. The error is related to Stroke function. In Stroke function, ...