All Questions
0
votes
0answers
4 views
java programming
public abstract class Shape
{
double dim1,dim2,pi;
public Shape(double a,double b, double p)
{
dim1=a;
dim2=b;
pi=3.14;
}
public abstract void ...
0
votes
0answers
2 views
Better way to organize an upload file method in Laravel 5.2
I am a Laravel newbie so please forgive me for my code... I have a method, in a Laravel controller, that updates the current logged user profile (...
0
votes
2answers
8 views
Using text-shadow in HTML with inline CSS
Is it possible to use the text-shadow feature with inline CSS? I am trying to give my header a border, but nothing seems to work. I am writing this for an email template in an IT ticketing ...
2
votes
1answer
9 views
Ruby method that is validating the payload received
What is a cleaner and/or clearer way of writing the following method
...
-4
votes
0answers
24 views
Validating html 5 tags using Stack C# [on hold]
This code works perfectly fine but I don't understand it, is there any other way to re write it with the same functionality which is more understandable?
I have just started to learn programming it ...
-9
votes
0answers
19 views
-4
votes
0answers
13 views
SPOJ - JULKHA getting result non zero exit code (nzec) [on hold]
Hello below is the code attached. I am getting NZEC.
I have checked my every function individually by test program for input of 1000.
Can you please suggest what is the possibility here for run time ...
2
votes
2answers
95 views
Get number from N
I'm trying to find the shortest and best way to achieve the following:
Given input integer $N, get the following output:
n = 0, output = 0
n = 1, output = 0
n = 2, output = 10
n = 3, output = ...
-8
votes
0answers
14 views
Oracle not showing count 0 [on hold]
SELECT dmn_id, COUNT (notactive), notactive
FROM student
GROUP BY dmn_id, notactive;
Here COUNT (notactive) with '0' is not showing in oracle. Please help.
0
votes
1answer
25 views
JavaScript function for to find a defined element within a nested array
Following task:
You've got an array which contains parts. Parts can contain subparts. Subparts can contain further subparts and so on.
For example:
...
-1
votes
1answer
24 views
0
votes
0answers
15 views
Collect several API call results
Want to brush up my rusty web dev skills. I want to call the twitch API for several channels and eventually call a callback function when all results are in without using a sync call.
I didn't work ...
1
vote
1answer
22 views
A Java subclass of ArrayList that supports rotation in constant time - follow-up
(See the previous (and initial) iteration.)
I have more progress on java.util.ArrayList subclass that supports rotations in constant time. See what I have now:
...
-3
votes
0answers
10 views
Add SaveChanges method in Model [on hold]
There are two, three approaches in my mind while saving model in database,
1) Create a different handler class that deals with context
2) Directly interact with db where it is required using context
...
2
votes
1answer
54 views
Verifying e-mail address in c
I have this little function to verify e-mail. It's a little piece of code to search major mistakes in e-mail input and it's part of a bigger program I have to as a school assignment. Is there a better ...
0
votes
0answers
15 views
-4
votes
0answers
21 views
Getting wrong answer on project euler problem 8 [on hold]
Can someone please tell me why am I getting wrong answer to this problem : https://projecteuler.net/problem=8. I used brute-forcing. My code gives correct answer for small numbers. However for 13- ...
0
votes
0answers
39 views
Helper method to find VisualChildren of multiple Types
I created an helper method to return a List of UIElements where the returned elements have to match with one of the ...
5
votes
3answers
311 views
Given an unordered list of numbers, find all pairs that add up to x
I am coding an interview question from Yahoo Software Engineer Intern Interview.
Given an unordered list of numbers, find all pairs that add up to x.
I have a working solution in Java:
...
2
votes
2answers
40 views
Loading settings from a file to a dictionary
Today I coded a class to get settings from a file and to load them in to a dictionary.
Please post and feedback, improvements and changes, no matter how big or small, as long as they are actual ...
3
votes
1answer
47 views
Weaving an array
In preparing this answer, one of the components was an algorithm to rearrange a sorted array in a particular way. To put it succinctly, here's the problem description:
Given an array \$A\$ with ...
4
votes
0answers
32 views
Simple OpenGL image viewer in C
I'm making an image viewer and before I continue development I want to make sure I haven't done anything bad. In particular, I was wondering if my error handling is sane.
Most of the code is ...
-3
votes
0answers
8 views
Chip8 emulator in C and ncurses [on hold]
I tried to write a chip8 emulator with C and ncurses. Launching games just causes scrambled output and segfaults.
Code:
...
2
votes
1answer
19 views
Count associations in a Ruby model
I'm trying to figure out if there's a better way to run the code below.
Basically Course is an association of Student and ...
3
votes
1answer
18 views
Replacing accented letters with regular letters in a spreadsheet
I am using the following VBA code to replace accented letters with regular letters in a spreadsheet. This is necessary because these spreadsheets have to be uploaded to an import tool that does not ...
2
votes
2answers
40 views
Blackjack game program
I'm learning C and decided to write my first major project in C. I was bored and wanted to play blackjack so I decided to create my own game. My program starts the user off with 500 credits and ...
2
votes
0answers
17 views
Restructure of Node CORS middleware for unit test
How should one break this component down to better perform unit test on its behaviors?
Issues:
Authentication middleware component makes external request.
Must recognize preflight and final ...
0
votes
0answers
10 views
Simple channel broadcaster via NodeJS websockets
I have a system in PHP and I was asked to add some real time features. I was wanting to learn NodeJS so I considered a opportunity to kill two birds with one stone.
But after some search I was unable ...
3
votes
2answers
40 views
Check whether a string contains exactly one distinct vowel
Over on Stack Overflow, someone asked a simple Haskell question: how to test whether there is exactly one distinct vowel in a given string. To clarify, there can be any number of non-vowel characters, ...
2
votes
0answers
42 views
Graph Library in C
Could you guys please review the Graph Library I developed in C? It's also on GitHub
...
1
vote
1answer
32 views
Library to handle strings and numbers
I have created a pretty bad (just being honest) Golang library. I will take any and all advice, as long as it's helpful. Sorry it's so long. Also, I easily forget some things, so many functions in ...
4
votes
2answers
46 views
Simple Timed Cache by Wrapping HashMap
Just wanted to get a bit of feedback on this simple cache. My use case is to store this data on an Android client to avoid making a high volume of network calls for lookups.
I feel like maybe I ...
5
votes
2answers
65 views
Compose valid subtractions using all digits from a set
I have created a brainteaser, which I called the "impossible problem" (see this video I made). The aim is to create a valid 3-digit subtraction which uses every digit from 1 to 9 once. Here is an ...
3
votes
0answers
12 views
Mounting a disk with Objective-C and the DiskArbitration framework
I have the following Obj-C code that makes use of the DiskArbitration framework to mount a disk to its default location:
...
1
vote
1answer
22 views
Using semaphore in C
This is my first time using semaphores and I was wondering if I implemented them to the best of their abilities in my code....
...
5
votes
4answers
308 views
Rotating strings in Java
I have this Java class for producing rotations of an input string:
StringRotator.java
...
2
votes
2answers
38 views
Excel VBA highlighting macro
I have this Excel macro I created to highlight all instances of a number if at least one instance is already highlighted before running the macro.
...
0
votes
0answers
22 views
Binary search tree and breadth first search
I have written code to implement Binary Search and Breadth First Search in JS. Please review my code. I want to ensure Im following the best practices.
Node.js
...
1
vote
1answer
13 views
UICollectionView button target
Within my app i have a UIButton (avatar button which shows a profileVC) within a UICollectionView this button shows up in about ...
1
vote
1answer
56 views
C# Encryption algorithm
I am using CTR mode (it is a cipher in itself) in this code below. I just wanted to see what you guys thought about it before I finish it.
(Yes, I know that the plaintext length and key length must ...
0
votes
1answer
29 views
Refactor two methods with only one little different for update or insert a (IoT) device into database
How could I refactor code below? So you can see I've two times the same methods where only an other method is called.
In Service.Insert(), I call ...
3
votes
0answers
54 views
Detecting the duration of a button press in a microcontroller project
I'm a C++ newbie and so far have written my code mostly in an not OO way. Since this is getting confusing I'd like to start creating libraries for some of the functionalities that I've implemented. ...
2
votes
1answer
49 views
RPi script to periodically collect data from Arduino through serial port
I'm not used to Python.
The script opens serial communications with an Arduino unit and send commands to and receives information from the Arduino. It is intended to run indefinitely until the system ...
2
votes
0answers
13 views
Liquid navigation tree generator
This include was written for a Jekyll site I'm building. It generates nested HTML unordered lists to a given depth dynamically by parsing page urls. It works fine, but the code feels messy and it ...
0
votes
0answers
23 views
Dynamic reports to Laravel view into HTML table
The getDynamicTeacherCount function is generating number-based reports from the table that I have in database and the ...
3
votes
0answers
10 views
Using STORAGE macro using QSAM for input/output
I was wondering if you can help me out. I wanted to know if there is an easier way to do the following. My code works but I feel like there is a lot things going out with multiple loops and wanted to ...
2
votes
0answers
35 views
Basic Python Tic-Tac-Toe Game
I have just decided to get into programming as a hobby (and possibly a job in the distant future). After learning the basics of Python, I made Tic-Tac-Toe to apply what I've learned. I would ...
1
vote
0answers
14 views
Connector for Odoo through xmlrpc (with testing code)
First time I write the tests before the actual code.
All fit in the same module.
...
1
vote
0answers
17 views
Dynamically create instance variables from a list of classes
I have a situation, where I want to add many classes as instance variables of another class, plus perform some action on each class. The purpose is to have an 'app' with many 'views', to represent ...
4
votes
3answers
46 views
Hackerrank Insertion Sort Part 2
I have started learning Java recently and was looking into the challenges on sorting on Hackerrank.I solved the following problemHackerrank on Insertion Sort.
The challenge was :
In Insertion ...