All Questions
0
votes
0answers
10 views
How to avoid passing parameters through the call chain?
I am trying to write better code using spark and scala.
I have a driver program which create the Sprak Context and configure it and then calls on a executor class which handle the specific logic I ...
0
votes
1answer
10 views
Save user input in server-side database
I have created a site for practice and I have already asked a question on Stack Overflow about XSS.
Someone tell me to show your php functions on this site that i created using ...
0
votes
0answers
13 views
-3
votes
1answer
17 views
Stacks with linked lists in C [on hold]
I am trying to do the push operation of a stack as a linked list .. However in the part of the code scan->next = n a segmentation fault is happening .. any help please ?
...
2
votes
2answers
27 views
C program to generate Seed programs from statically defined Befunge code
My program takes static input, and then number crunches for a few hours. I am currently using Macros, but is there a better, more "user friendly" way to do this without losing on performance.
I have ...
1
vote
0answers
15 views
Function which returns the smallest / largest numbers in a nested array structure
Given is an array which contains sub-arrays. The elements in this sub-arrays are numbers.
The task is to implement a JavaScript-function which returns an array with the smallest / largest numbers in ...
-3
votes
0answers
25 views
Is this good code? [on hold]
I've quickly wrote up a copy of a design for the purpose of practicing code. My question is what is the correct code to use to get elements around the website to display properly without using ...
2
votes
0answers
35 views
TLV implementation in C++
I tried implementing TLV(https://en.wikipedia.org/wiki/Type-length-value).
Actually my implementation is more than TLV because it supports additional "Tag" elements for TLV objects.
My goal is to ...
2
votes
0answers
16 views
Parallel reduction by key implementations
I have an implementation of the reduction approach used in this document. Furthermore, I extended (crudely) this so I can reduce-by-key.
In my setup I can assume that a ...
3
votes
0answers
13 views
Highest andLowest in PLSQL
I have made a procedure to display the highest and the lowest popular Items for a particular time of a given date. The procedure works with no errors or exceptions ...
4
votes
2answers
42 views
Video streaming client
I have written a client for streaming video playback.
The client uses two threads, a receive thread and a decode thread. Events are fired off periodically for drawing a completed frame onto a SDL ...
6
votes
1answer
132 views
Change calculator
I likes my use of functions so I'm mostly looking for little things but if you see something tell me :)
...
5
votes
2answers
378 views
Reverse “Guess the Number” program
I recently got to a certain exercise in a book I am reading, and am looking for feedback. It is a program in which the user picks a number and the computer uses algorithms to guess it. If there is any ...
5
votes
0answers
20 views
Folder watching in Go
To try and track down a troublesome AS400 bug, my company wants me to keep track of the order in which files are put into a folder. I spent an hour whipping something up in Go, but I'm still pretty ...
7
votes
2answers
273 views
Maximum product of word lengths in Python
Problems was to calculate maximum product of word lengths:
Given a string array words, find the maximum value of length(word[i])
* length(word[j]) where the ...
1
vote
2answers
27 views
Check if a linked list is a palindrome in O(n) time and O(1) space
I liked this problem because there are so many sub-problems that are interview problems in their own right-- (reverse linked list, find midpoint)
...
3
votes
0answers
21 views
Simple object-oriented calculator - part 3
This question is an improvement I did based on recommendations from these other questions:
Simple object-oriented calculator
Simple object-oriented calculator - follow-up
To those looking this ...
-4
votes
0answers
13 views
mysql_fetch_array is not returning result [on hold]
Below the //message for the driver comment; $search_loc['location'] is not getting the location in mysql db. I want to be able to retrieve location and email it to driver.
...
3
votes
0answers
16 views
Nesting BsonDocuments in MongoDB queries
I have a MongoDB collection setup where each document's JSON looks like this:
...
2
votes
2answers
58 views
HashMap or Associative Arrays in C
I am trying to implement an HashMap in C. I am trying to used a linked list style of interfacing to make adding and removing keys easy and efficient. Searching is not something I am considering at ...
3
votes
1answer
34 views
Utilizing Areas to handle subdomains with shared state/resources
I am currently working on a side-project and have the basic foundation and architecture I want in place for the site. I wanted to get your opinion and thoughts on my current practices and methods ...
1
vote
0answers
13 views
Move zipped files from multiple subfolders into one master folder via loop process
I am trying to write a code that:
First Prompt: asks the user to select the folder that contains all zipped folders where each zipped folder contains a data file.
Second Prompt: Ask the user to ...
0
votes
0answers
8 views
Concatenate data files into master document
Here is code I wrote to concatenate data files into master file. Once the data to be pasted into the master sheet exceeds the number of rows left in the master sheet, the program will create a new ...
3
votes
0answers
23 views
JavaScript calculator for adding discounts on some number of people
I am trying to learn JS and I am trying to make a simple calculator which will calculate price against number of people and will give discount on some amount of people. For instance, every 6th person ...
3
votes
1answer
25 views
Reversing a list without (append)
I would like to reverse a list using cdr, car and cons. Since lists in lisp are asymmetrical (can only insert at the beginning), I am interested on how one would write a procedure to do that without ...
1
vote
1answer
26 views
Replacing elements from a list and its sublists
Write a procedure substitute that takes three arguments: a list, an old word, and a new word. It should return a copy of the list, but with every occurrence of the old word replaced by the new word, ...
2
votes
0answers
10 views
Wrapping a small animation library for Angular
I've started out working on a larger project using Angular for the first time.
For visual feedback, I'm using Waves (Github) (you can see a demo page here).
The standard way to use Waves is to ...
6
votes
1answer
27 views
Listview from SQLite
I'm trying to get back into programming by building an app I've had in mind for quite a while. I've created an SQLite database and have managed to get some data in it. I'm trying to display the data ...
2
votes
2answers
56 views
Connect 4 refine the diagonal check
I am creating a connect 4 game in python and I have managed to write the code so that it runs. However I have a lot of duplicated data in it and was just wondering if anyone could help me to refine it ...
-7
votes
0answers
21 views
Project Euler 48 [on hold]
This is ProjectEuler Q48
I don't know why but retmod is giving wrong answer after (16^16)%(10^10)
https://www.hackerearth.com/notes/number-theory-1/
...
6
votes
1answer
22 views
Convert data back-and-forth between CSV files and pretty-print
I wrote a script to convert CSV files in human readable format and vice versa.
Human readable format is achieved like so:
...
3
votes
2answers
58 views
A Slice-type for C++
The Go programming language has that slice type, which is under the hood a pointer to an actual array. This allows treating the subarrays as actual arrays with almost no performance overhead. This ...
6
votes
3answers
516 views
Checking if characters in a string can be rearranged to make a palindrome
Can I please have some advice on optimizing and cleaning up my code? Places where I could save space/time?
...
5
votes
2answers
73 views
Find no of swaps needed to club identical elements of array together
I have created a solution for the problem as below:
Given a string S consisting of letters 'O' and 'Z'. Calculate the
minimum number of changes required such that all O's are adjacent to
each ...
-1
votes
0answers
11 views
Using MergeSort with BigDecimal [on hold]
I recently accepted the "Java BigDecimal" challenge at Hackerrank.com. For sorting in reverse order I used a modified version of MergeSort. However, in my Merge function I could not find a way to ...
3
votes
0answers
15 views
Return four spreadsheets of Google Analytics account, property, profile, and filter information
Scenario goes like this:
User enables plugin from within Google Spreadsheet
Authenticates with their Google Analytics Account
They select which accounts they'd like to perform an audit on
Four ...
0
votes
2answers
25 views
JLabel formatting on GPA calculator
I am currently working on a GPA Calculator side project over holiday break to become more familiar with Swing, but I find the number formatting is more complicated than in regular Java. At the moment ...
0
votes
0answers
14 views
Angular Pagination Directive
I wrote this small pagination directive after having to do something similar for an app I'm writing. For the app I wanted something that would be flexible and could be reused just about anywhere. ...
4
votes
1answer
39 views
Caching mechanism for saving a bitmap
I needed a quick caching mechanism to save a bitmap (picture). There was no way I could get the bitmap to the class where I need to upload it to the server so for the sake of organization and code ...
4
votes
5answers
89 views
Basic contact form
This is for commercial purposes. It's not going to a database, but will just be emailed to a person via phpMailer.
I am not good at PHP (truly awful). I'd like to know whether this is good enough for ...
3
votes
2answers
29 views
Closing InputStream of a running process
Let's say you want to extract the output of a console application till you've found a certain keyword. If you have found the keyword the started console process still should be running, however the ...
1
vote
0answers
8 views
Visualizing Brainf_ck interpreter in ClojureScript
I have written a working Brainfuck interpreter using ClojureScript, reagent, core.async and dommy. I am not very satisfied with the code, however, in particular the central part of the code - the ...
11
votes
5answers
495 views
isPermutation method
I wrote an isPermute method. Can I get some tips and advice on better coding style?
...
10
votes
1answer
216 views
C++ Http Request and Http Client abstractions
I am trying to make an OOP abstraction for a very simple http client. I have also created a simple abstraction for a (GET only for now) http Request.
I am using winsock2 sockets for Windows and the ...
4
votes
1answer
37 views
Worst case runtime analysis of a string partitioning algorithm
Give all the partitionings of a string s such that every substring of the partition is a
palindrome
What is the time complexity of this solution? And, how can I improve my code overall?
...
4
votes
2answers
75 views
Enums for the four directions
I have walls that I can spawn. They wll move in one of four directions, up, down, right or left. Now I can set, wether the wall is thin, wide, long or short, but the problem is:
Nearly everything I ...
8
votes
2answers
278 views
Calculate volume of a cylinder with user input
I'm looking for a fast OR simple way to calculate the volume of a user-entered cylinder. Here is my solution:
...
1
vote
1answer
50 views
Java MultiThreading .wait() .notify()
I have been working on a long project trying to understand the basics of multi-threading. The application is supposed to simulate a Shop and a Customer which share a Box and a PayPal account.
...
6
votes
0answers
60 views
String merge sort in Java
This snippet is about sorting a set of strings using merge sort. However, this version is tailored for strings as it relies on lcp values:
Given two strings \$A\$ ...
5
votes
0answers
43 views
Graph as adjacency lists: BFS DFS Topological Sort
I have written some code to practise graphs. Graph is represented as vector<list<int>> . Would you share some feedback with me?
Are algorithms correct ...