The code currently works as it should and seems to work dynamically as I need it to but I am pretty new to Excel so I think there is probably a better way to do some of the things I have set up. I also would like to make the code a bit prettier.
'************************************************...
I am a beginner at coding in C#, hadn't had any experience with coding before and after beginning my learning I stated working on this calculator ahead that functions on the console. I'd like for you to please (if it's not too much to ask) review it and hopefully teach me what I could have done d...
Can you help me verify my test result? I'm testing different malloc implementations with a small program that allocates gigabytes many times:
int main(int agrc, char **argv) {
int i;
for (i = 0; i < 1000000; i++) {
void *p = malloc(1024 * 1024 * 1024);
free(p);
}
...
Looking for feedback on any bad practices and general advice on how I might better structure my code.
$(function() {
// Load song on page load
var song = new Audio('./songs/DJ Snake - Middle (Bad Royale Remix).mp3');
song.load();
// Update song duration display
song.addEvent...
I've User and Notification Entity relation ship as
@Entity
public class Notification implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String notification;
@Temporal(TemporalType.TIMESTAMP)
private Date sentDate;
...
So the problem states that find out all the distinct possible ways there are to move from the first point (1,1) to point (n,n) in an n*n lattice.
So my code is:
def lattice_paths_of_n(n):
list2 = []
my_list = []
for i in range(1, n+2):
list2.append(i)
for i in range(...
My assignment wants me to create a class called "Name", which stores first, middle, last. Wouldn't it make a tad bit more sense for the class to be called "Person" ......
My program is supposed to sort a stack such that the smallest item are on the top. I can use a temporary stack, but you may not copy the elements into any other data structure. The program works overall, but I was wondering if there is anything that I can do to make it more efficient/better.
imp...
I have been tinkering with generic methods in java but still haven't figured out a way to optimize this code.
public Set<SubscriptionDto> getCustomerSubscriptions(Integer customerId) {
Set<SubscriptionDto> subscribedProducts = new HashSet<>();
Set<PlanDto> subscribedPlans = new HashSet<>...
What I'm asking here is to verify my results, that multi-threaded (4 threads) merge sort is about 3 times as fast as single-threaded merge sort on a 4 or more core processor. The merge sorts are bottom up merge sorts.
The example programs below are Windows specific and built with Visual Studio. ...
I have to make a program which creates a number of threads that are waiting at the beginning, then the main process creates a doubly linked list where random numbers are put and then a signal tells the threads that a number has been put in the list, then the threads should "process" these numbers...
Looking for criticism on JavaChat, a JavaFX chat program I made! Comments on better practices, organization, or anything you find I could improve on would be very useful, thanks!
GitHub: https://github.com/Sunquyman/JavaChat
Thanks in advance!
INTEST - Enormous Input Test
no tags
The purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Output warning. You are expected to be able to process at least 2.5MB of input data per second...
@Matt I get your point, still I've modified my initial question, so it stopped being a duplicate. In short terms: current question is "what are known ways to solve a problem?" and the one on codereview is "why are my solutions so slow?". — haldagan21 secs ago
I used this code for finding prime numbers in Python 3.5.1.
n=eval(input("Enter a number:"))
import math
a=math.sqrt (n)
for p in range (2,a):
if n%p==0:
print ("It is not a prime number. It is a multiple of", p)
break
else:
print ("It is a prime numbe...
I have used Reverse-Engineering then Switch to Code First but below are my couple of questions to use the things right:
If i alter my DB Table in which some Data is there,How i will manage these changes in my model. Because in my model i have added RequiredField property. So will this be overwri...
I am trying to estimate a good approximation for sqrt(1-x^2) for x ∈ [0, 1]. I did this using a bezièr curve, and made it so that the area under the two curves are alike. In order to estimate the error I want to calculate the differences in arclength. The arclength of a quarter circle is pi/4 so ...
@DanPantry The first video is quite decent, but it's very, very basic. This course better ramps up it's complexity or it will be just a lousy part of simplified documentation.
I think this question is quite meta.
As part of a recruitment process, I was asked to solve some programming problem. They thought my code wasn't up to their standards, but I feel like I need more context to their feedback (which companies don't really bother supplying more of), and I'd really l...
I want to handle a c++ win32 API button press in a native window, I'm currently attempting doing it like so -
#include <stdint.h>
#include <Windows.h>
#include <process.h>
#include <iostream>
#include <sstream>
#include <tchar.h>
#include <strsafe.h>
#include <crtdefs.h>
#include <stdafx.h>
#in...
I'm writing a C# WPF project built with a MVVM pattern.
This software is written to use a medical diagnostic device, so in our planning it will be certified IEC 62304. Since I've been mainly writing only C++ software for the last few years, I don't have much exeperience with C# programming. So I ...
So I'm building a 2D Array class.
I want to have CopyArray and RemoveIndexes functions. However, in both cases, the method will be the same (iterate over the array, copy every element unless it's in an index to remove, return the result).
I have 2 public methods like so:
Public Function Rem...
Please note: your question actually translates to "can you help me improve this code" ... and such questions better go to codereview.stackexchange.com. Here we help with "concrete" problems ... — Jägermeister37 secs ago
As part of my own C++11 learning exercise I have implemented this Blocking Queue using the new C++11 thread API. One of the aspects I would like to improve is efficiency i.e. in the take member function while returning the Job template type to be returned by reference instead of by value.
/*
* ...
I just started learning Haskell and this is my first big project (ie not factorials, fibonacci or graphers). This is kind of a gift for somebody so the language is a bit different. The program works, but I felt that some parts of the code could be improved, specifically:
Is Vector the best choi...
(1) Try the function out on some sample data and compare the result to calculations done by some other method, e.g. manually or an online tool. (2) If the code works, ask codereview.stackexchange.com if they can improve it. (3) Google "alternatives to chi squared test". — Alex Hall42 secs ago
I am testing out a responsive horizontal scroll UI. The horizontal scroll position is calculated according to the mouse horizontal position:
codepen
$(document).ready(function() {
var docWidth = $('body').width(),
slidesWidth = $('#imgs').width(),
rangeX = slidesWidth - docWidth,
...
I used QueryDsl before, but now I have trouble with some specific thing :
What I need is not showing when current user has followUp.
With the following part :
builder.and(task.followUp.isEmpty().or((task.followUp.any().user().eq(SecurityUtil.getUser())).eq(false)));
or
builder.and(task.follo...
I was trying to write a code from scratch for Chi-square test.This is the code that I had written in python using pandas.I had a doubt whether the code can produce the desired output or can be written in a more compacted way.
import pandas as pd
from scipy import chisqprob
from scipy import stat...
I have a class a which has some methods(geti, seti) which I want to have in all classes b, b1, b2,...b100
I can only think of using a macro right now and it makes debugging a pain, is there a better way to do this?
I am not really looking for naming conventions and stuff as this is just an exam...
Normally, I don't anticipate exceptions and if I get them, its something that I can't fix in my code - bad user input or connectivity issues with the database.
But errors do occur so at the very least, I want to inform my user that something went wrong and log the error.
My exception handling g...
Welcome to this site. I'm afraid your question is off topic as the scope of this site is to review existing code. Your question is better suited for Stack Overflow. Be warned though, it's likely not going to be well received there the way you asked it here for lack of research effort or being a duplicate of another question. Do your research, especially How to Ask on each individual site. — I'll add comments tomorrow33 mins ago
I am trying to write industry standard code.
https://www.quora.com/How-do-I-follow-a-user-on-Spoj-for-solving-problems-Refer-Details
Someone gave me this A2A.
And I wrote this code for it
//compile with g++ -std=c++11
#include <bits/stdc++.h>
using namespace std;
struct PROBLEM
{
string nam...
@Vogel612 There is an helm that produce light around you which is quite useful for that part! Are you enjoying it so far ? I loveeeee bosses fight in Dark Souls!
if notepad/file has contents it will display the contents.
but if the notepad/file has no contents, it will automatically let the user enter first name, last name and address then write it on the file.
here's my code. I don't know what condition to use if the file is empty. I could use some hel...
@DanPantry In an interview, they said that's how they were doing things to begin with because a lot of developers like to get up and running. Later in the series/class they'll dive deeper into how the actual ML stuff works.
I'm trying to transition myself from my old coding-style (if-else, for.. in) to functional programming. I've tried to update the following code:
old
class test {
childrenCount(group) {
let childCount = 0;
let excluded = ['html'];
let iterable = group.children || grou...
I've written a "simple" interpreter for a programming language in Python, called Tellurium (named after the element of the same name). So far, it's working pretty well, but there are some things I'd like to fix/remove.
The code can be found here.
The reason I posted this here is because the cod...
@N3buchadnezzar VBA gets a lot of undeserved condescension. There are many problematic programs written in VBA, most of the problems are not the fault of the language.
@Zak Indeed, as a teacher i have plundered (although by neccecity) a bit in excel. Surprisingly much can be done with a few VLOOKUPS and some VBA scripts.
It's using four sections of code block, I just want it to be reduced to one contiguous set that does either a or b with the two sections not a copy/pasted approach as done here:
public function process_bulk_action() {
//Detect when a bulk action is being triggered...
if ( 'delete' ==...
You really shouldn't use your own salts on password hashes and you really should use PHP's built-in functions to handle password security. Make sure that you don't escape passwords or use any other cleansing mechanism on them before hashing. Doing so changes the password and causes unnecessary additional coding. — Jay Blanchard29 secs ago
The fact is, whitout it, the one-function method is faster as expected. With it, the two-functions-method is faster. I posted the code here — user62450728 secs ago
I'm writing a module to procedurally generate a map of islands.
What it does is choosing for each chunk some points inside that chunk that work as the center of each island, then for each tile on the map it calculates the distance from the points in the 9 chunks around the tile's chunk and subtr...
Sometime ago I asked a question regarding a slow Filtering method for my DataGrid. Months later and I have a relatively quick method, though I am still looking to improve performance, especially when the user is deleting text from the SearchBox as this seems to slow down more than if the user is ...
@Mast Except that then you've got X hundred hard-coded SWITCH functions. And to change them requires editing the function and then applying that change to every other instance of the function. Whereas with table lookups, you can just say to people "look here. Change those if you need to" and you have a short INDEX(MATCH) function rather than a 20-line switch statement ^^
OP needs to clarify if they want their specific question answered (in which case it should go back to SO) or they're happy with a general performance review.
Inspired by this meta question I decided to take a look at Rosalind. Their first challenge seemed easy enough:
An example of a length 21 DNA string (whose alphabet contains the symbols 'A', 'C', 'G', and 'T') is "ATGCTTCAGAAAGGTCTTACG."
Given: A DNA string s of length at most 1000 nt.
...
@N3buchadnezzar You and me both. Rounding should NOT be the default behaviour.
(unless you work in finance, in which case I have an entire valuation model where the regulations SPECIFY how many decimal places to round every factor to before calculating the end result.)
@Zak Would recommend avoid working fiances. Surely it leads to you being eaten alive by angry boyfriends. "You were just showing her your magic Excel skills? Yeah, right..." pumps fist angrily
I am using numpy random choice np.random.choice(m, k, replace=False) to select k items randomly from a list and this is very time consuming if I have to run this step for 1 million transactions. I used cProfile and the above step was the culprit.
Is there an alternative to this np.random.choice(...
I realized I had just created two classes that were virtually identical for simply saving objects to their own json files, so I've attempted to make it more generic. My only noticeable problem is because I am using gson to serialize / deserialize, that requires an explicit class type, which gets ...
Yeah but I don't think it's fair to say : You change your implementation for testing purpose. It's bad practice. I think what is bad practices in the OP situation is he is testing the implementation not the return value.
This is super bad because he's asserting that operations.add is called 5 times, but that's not part of the interface, that's part of the implementation
@vp_arth Changing implementation for testing pupose is ok. You should make your code testable. If you can't test your code this is legacy code now and this is bad. The problem here I think is OP is checking if add is called multiple times and this is not important normally. You should check for contract and not implementation details. — Marc-Andre25 secs ago
Good we proved someone on the internet was wrong! This is a good day! Good Job everyone!
Below is my implementation of a generic linked list in swift. Unfortunately, swift playgrounds won't run until the compiler is totally happy - often, that involves clang making me explicitly unwrap some optionals. I just want a general idea of how to restructure my code to avoid unwrapping option...
As I did the same exercise some time ago, I used a different approach, using hashes. It takes advantage of the ability to define a default for hashes when accessing a not present element.
So, in general:
x=Hash.new
x[1]
#=> nil
but
x=Hash.new{12}
x[1]
#=>12
Now... what happens if I define t...
I recently started Learning COBOL from Lynda and this is my code for the first challenge .
The Objective is that the user will provide the radius and we have to calculate the Circumference and the area of the circle and then display it.
Here is the Code.
IDENTIFICATION DIVISION.
PROG...
The following Macro sorts through a worksheet, copying and removing lines based on what appears in column A. If ("A" & i) is not a number, it triggers and moves the data to the appropriate place. The script at the moment is very slow, however. Is there an easier way to achieve this?
Sub FixAbstr...
Recently, I encountered this coding exercise on codility and the idea is
A zero-indexed array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is also moved to the first place.
For example, the r...
I'm learning Clojure, and decided to write a Conway's Game of Life clone as my starting project. I ended up dicking around for a bit before diving in, and came up with a few functions and macros that I'd like looked over. Mainly, I'm concerned about writing functions more concisely and idiomatica...
StackOverflow is not a code review site. There's codereview.stackexchange.com for that. You might want to write a better description than "Can anyone review my code" though. — Michael53 secs ago