I created a function to find primes in order to prove the Collatz conjecture. My hope is that people in the future can use this for their projects.
Basically, how it works is it converts a number into a string, and if it finds any even in the string then it gives foundEven variable a positive va...
I am trying to write a code that will fill theNums with the following values (in order): 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8.
and also I am looking for code of the sum of theNums.
As an exercise to learn how OpenGL and image creation worked, as well as to satisfy a curiosity I've developed for Chaos Theory, I decided to create a mandelbrot fractal drawer in C++, which can either draw to an OpenGL context or to a PNG image. I am a beginner at C++, and would much appreciate ...
I'm working on a .Net Core API with EF and AutoMapper. I have a Topic entity that is essentially a blog post and it of course has items like categories and tags. When the topics are requested I return a property that is a list of all the tags associated with the topic. The difficult part is that ...
I've been having a tough time trying to cipher my program. Thus far I've been able to insert strings into the file that I'm ciphering and also shift.I’m trying to make it so any character not part of the alphabet isn’t shifted in the text file but it does 'take up' a shift amount. For example, if...
First time here and would definitely love some feedback on this message board app I made. I been doing front end development for the most part and I just want to keep my backend chops up. Let me know anywhere that can be improved. Thanks!
Here's the github and the heroku
Had a fun one for my last call of the day (35+ minutes), this lady just refused to believe my explanation that even though she's getting really great internet speed on her computer via Ethernet, that her smart TV on the other side of the house, which uses Wi-Fi, barely gets enough speed to stream from Netflix in 4K resolution.
The below code is working uses formula to concatenate the result from Range("K:M") and write the result in column H.
Sub GenerateStyleFabricColourV4()
Dim srcData As Range
Dim rowNum As Long, lastRow As Long
With Worksheets(2)
lastRow = Application.Max(4, _
...
Is it not returning desired results? If you are here just to find efficient approach to do this then Code Review is better place for such type of quesitons. — mmushtaq52 secs ago
Anyone present that I could bug with more basic questions about binary trees in private? The kind where apparently the knowledge is so widespread that it's barely mentioned anywhere
i'm not going to be able to answer the questions until later today (in around 9 hours or so), but if you didn't find anyone until then, feel free to ping me :)
I want to prove that a security property hold for a formal model. I previously asked about this on SO. My scenario is a UART connector that can transmit and receive data via Tx and Rx and get written and read from via memory-mapped i/o. There is also main memory and a user process that does the r...
so, I have an array with values: unqiue_array = ['a;b', 'c;d', 'e:f'] and I'd like to put them in an object x={} in Javascript. I seem to be able to add only the last value:
var x = {};
for (var i = 0; i < unique_array.length; ++i) {
var field = unique_array[i].split(';');
x = {
id: Number(field[0]),
label: 'Node ' + field[0]
};
}
@Peilonrayz I actually managed to do it :D I wanted a list of obects, so:
var x = [];
for (var i = 0; i < unique_array.length; ++i) {
var field = unique_array[i].split(';');
x.push({
'id': Number(field[0]),
'label': 'Node ' + field[0]
});
}
That's curious. For now I'll just eat that info, I currently do not have many good memories of stack from what I've learned so far so I'm somewhat taken aback by the use of that ADT for arrays, but I bet there's something I just don't know currently
@Isofruit It may just exert the interface to one. I know in Python it contains an hard C-array as the internal data structure, but has the interfaces to be used as a stack and a queue. Doesn't mean they'd be better than a stack or a queue, but lets you swap it out to one if needed.
I have a web application that is structured as the following:
Application purpose is to present the client with processed tabular data residing at the server. Server is written in Python. It serves the client an HTML page with about 200 different tables (grids) and matching JS files.
All the J...
I am trying to convert "Random = 1" into dictionary {"Random":1}
I tried
Key = (line.split('=')[0]).split()[0] #to get key and remove spaces
value = (line.split('=')[1]).split()[0]
CQ_Options[Key] = value
How could I do it in more mature way?
This code is written using the latest version of Processing. This has been compiled and proven working.
What this code does: Enter name of the web color listed in Wikipedia in the text field. Or press CTRL for a random color.
How to compile: Get the latest version of Processing (3.3) and copy-...
I have made an implementation of coin change problem solved with Dynamic Programming. Could you guys help with redefining some method names/variable names, change some implementation for the better.
Here is my implementation -
public class CoinChange {
public int computeMinimumNumberOfCoi...
The challenge was to find the missing letter in an array in alphabetical order.
My solution was this ;
function fearNotLetter(str) {
var letters = str.split('');
var codes = [];
var missing = 0;
var start = 0 , next = 0 , c = 0;
for(var i= 0; i < letters.length; i++){
var charcod...
I'm reading 'Haskell Programming from First Principles' book written by Christopher Allen and Julie Moronuki. As part of the exercises, I'm supposed to implement encrypt and decryption functions for Vigenere cipher.
This is my implementation.
shift :: (Int -> Int -> Int) -> Char -> Char -> Char...
I am creating a class called Piece which will contain the pieces that will be used for the board game.
I am trying to apply a color, however it doesn't recognize the color. I am writing this for an android application.
public enum Piece {
Black(Color.Black),
White(Color.White);
private fin...
I'm looking for a way how to send templated emails using mailkit in ASP.NET Core.
Here's a short point of views how I see the solution:
I would like to send emails if I get some API call, then I'll to look for a template from DB.
The question is:
How do I know what someone should send me via ...
I removed Any suggestions or what I could improve in my script? As that makes the question too broad. If you truly want a review of your script consider asking on CodeReview.SE — Matt9 secs ago
I have created a function which converts number in text format and successfully converted upto 6 digit number but need to be sure if i can do any further customisation's to make code even more shorter.
Please look at it and revert.
$(document).ready(function() {
var onesVal = ['Zero', 'On...
You realise that the link from Code Review is a simply ceasar cypher and the one you want to convert is a RSA. This is like asking for a Ferrari in a Fiat garage... — AxelH16 secs ago
I don't know about C#, but in VBA, one can read the range into an array in a single line (eg. arrMine = Range("bigrange")); process the array; then write the array back to the worksheet (again in a single step). This speeds up processing by a factor of at least ten compared with multiple worksheet accessing. If that doesn't work in C#, suggest you post your working code to Code Review for advice. — Ron Rosenfeld51 secs ago
@Peilonrayz big fat thanks at you for helping me with the binary tree thing! I currently don't have the time to look through it but will once I'm on the train
This is brittle as table could change and then it would randomly stop working... also duplicate rows would still produce duplicates. This is lazy in my opinion and I wouldn't let past code review - safer to aggregate — Milney43 secs ago
objective: i need the command I am executing on a datagrids context menu to know which column was clicked on
XAML
<DataGrid x:Name="dataGrid" ItemsSource="{Binding Table}" ContextMenuOpening="DataGrid_ContextMenuOpening">
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem He...
I've got a React.Component which return a react-native-router-flux redirection Actions.home(). How would you test this kind of behaviour ?
Here is my Component :
export default class FacebookButtonConnect extends Component {
constructor(props) {
...
}
async _onFacebookButtonPress() {...
I have created one method that get whois information from arin server is this any changes in this code for good code structure.
public ArinResponse GetWhoisInfo(string domainName)
{
if (string.IsNullOrEmpty(domainName))
{
throw new ArgumentException("You have to supply a domainNa...
I'm developing a system that supports creating accounts and multiple users within every account that can each access a certain subset of data of their "parent" account.
The data is stored in a SQL Server database in the following tables: Accounts: Id(guid, primary key), Title(nvarchar(200)), User...
Given a text file containing a list of links, I worte a code to download them one by one from youtube, using either YoutubeMP3 or Convert2mp3 logging any songs that failed to download.
The code with Youtube-mp3 is significantly faster than Convert2mp3 but less accurate (some songs fail for unkno...
I have to create a user control to an existing web applicaiton.
User control will have four text boxes(startdate, enddate, location, surname), submit buttton and export to excel button.
Two of the text boxes(locaiton and surname) are autocomplete ones and I am using ajax autocompleteextender for ...
I'm trying to implement this problem in python3. The answer for a stream of integers from 1 to 10,000 is supposed to be 1213, which I'm not getting. I suspect there's a problem with my implementation of the heap and not the actual solution in the main() function.
#A = [4, 1, 3, 2, 16, 9, 10, 14...
I have been interested in writing some code that allows an object to wrap around the screen. It turned out to be much simpler than I was expecting, so I kept working and changed the white box that I had to a car that can rotate and move in the direction that it is facing by using basic trigonomet...
Description
rollup-plugin-bundle-worker does a great job of shimming web workers into a rollup bundle, this example shows how to extend it to allow importScripts statements inside the web worker and to share code between the main bundle and the web worker.
Motivation
The serialise/de-serialise...
package kataKeptar;
import java.util.Scanner;
public class Main {
static Scanner scan = new Scanner(System.in); //scan is the Scanner variable for user input
static String[] weapons = {"Bow and Arrow","Metal Rod","Axe","Sledge Hammer"};
String[] firstAidSmall = {"Band-Aid","Ace Ba...
@JamieD77 But if you do that, then adding a new field to the table (which SHOULD be a non-breaking change) will break the query... Also if there are any duplicates, they will be duplicated in the results... I would not let that through a code review as it will be prone to break in future... and it is not a performance concern because SQL is clever enough to only do the second group if it needs too (to eliminate duplicates etc.). Also, what if he wants to show another field in the query anyway? — Milney21 secs ago
the problem is that it seems they don't actually run the application to see what happens when they run the code.... but that is what I am there for, right?
I think you (or your manager) should definitely make it clear to them that they're not testing enough, unless someone along their chain objects they should be doing their utmost best to leave no bugs behind, on the other hand you should still continue testing as strictly as ever before
My current embedded project uses a 16x2 LCD controlled by the HD44780 standard controller. My PIC18 speaks to the LCD via the Adafruit LCD serial backpack (schematic link). I chose the SPI interface.
The HD44780 is controlled through various instruction writes to 8 data pins (DB0-7), a read/writ...
Artjom's input looks very promising, but I am still getting a DOMException client side, but no details in the error. The BouncyCastle code which I'm using <codereview.stackexchange.com/questions/14892/…; was using a 128 bit nonce. I've tried changing it to 96, with the same results. Will keep trying. — andrew39 secs ago
It's a common occurrence nowadays to have different refresh rates across different devices. That's why it's very important to keep track of the device's frame rate to keep the game time consistent across different refresh rates.
Is this an efficient way to go about this?
var timeBetween;
var ti...
I have been tinkering with a project I found on GitHub to learn how to use Immutable.js with React's own shouldComponentUpdate. The code works, but I am not sure it works as it's supposed to work.
import React from 'react';
import CreateTodo from './create-todo';
import TodosList from './todos-l...
This program will read data in the form of:
Number Name
In each line of a text file, then it will write it to a binary file and print the resulting binary file.
I am getting a warning in line 73, but I don't think it's an issue as null is converted into 0, right?
#include <stdio.h>
#include <...
This question could be suitable for Code Review, as long as (a) your code works as intended, (b) your code is real code, rather than example code, and (c) your code is included in the body of the question. If you wish for a peer review to improve all aspects of your code, please post it on Code Review. — Mike McCaughan52 secs ago
So I inherited an PHP application that was last maintained in 2003 or so. I've managed to get it migrated over to a new host with updated mySQL and PHP and have replaced all of the deprecated commands and fixed all the bugs except one. There's a contact list page that puts a pagination index at t...
I currently have a languages.js set up as such:
var MaterialProperties = 0;
var YieldStrength = 1;
var OtherPhrases = 2;
//continue to list other phrases - there are 40+
var English = [
"Material Properties",
"Yield Strength",
"Other Phrases"
];
var Chinese = [
// Chinese stri...
@Jacob: This is a good question, so don't get frustrated by downvotes and critics. It's just that you should ask in code review instead of here. — Federico Peralta Schaffner20 secs ago
I have implemented the following MCMC algorithm for the german tank puzzle
found here
I just want to make sure everything is legit and that I am not getting the right answer by chance.
from scipy.stats import norm
import numpy as np
import math
import scipy as sp
import matplotlib.pyplot as pl...
I'm working on an algorithm to search through 100,000+ lines of dna sequencing, with the fastest time possible. Here is my current code, I was wondering if there's any ways to make this run faster:
public static void mostCommonKmer(String s, int k) {
// your code here
HashMap<String, Int...
The context:
I am currently struggling with a conception problem:
I am building a SEO tags generator in PHP. I already managed to render some beautiful tags like these:
<meta name="keywords" content="look, at, my, horse" />
<meta property="og:title" content="My horse is amazing" />
<meta http-e...
I'm currently coding for a school project. I'm planning on creating a virtual and simple Launchpad. Here's the first part of my code which treats the graphical interface. I know it's not well organized and that's why I ask for your help and tips! Thanks
import java.awt.EventQueue;
import java.a...
I want to easily create a binary tree given an array. The array elements are processed in a level order manner. E.g. If the array contains:
{19,10,43}
Then the root is 19, left child is 7 and right child is 3. To declare that the node does not have a child, I'm using a speciate data value as in...
I found myself in need of a fixed size queue and decided to implement one using a ring (cyclic) buffer.
I have tried my best to match the API of std::queue with the addition of full() to test if the queue is full and unable to accept another element.
The code compiles cleanly with: -Wall -Wext...
I have implemented a working version of perceptron learning algorithm in C. Right now, it only works on single layer perceptrons and only takes two inputs.
I plan on making it work with more than two inputs, but want to make sure I'm doing everything right first.
Here is the tutorial I used: htt...
I'm learning Python after a 30+ year break from programming, got bored with the usual TicTacToe exercise, so went a bit wild adding functionality to it to make something that's a bit more fun to play than losing to the computer every time.
Now reached the stage of aimlessly noodling around with ...
I am using following code to populate userform from tabulated data in excel sheet and trying to use a next and previous button to cycle through previous entries in a table and have done successfully for the first table starting from A1 (row 1). With this code, the previous button selects the prev...
I have written a haskell program for the following 'Code Monk' Challenge at HackerEarth.
Here is the challenge description. Basically, we are looking for the number of vowels in a string. The first input n is the number of string to parse, followed by n number of random strings.
And here is my i...
I have put together this function which compares two XMLs. On debugging, I found out that there are lot of useless loops which might cause performance problems for me if the files to compare are very big in size. Is there a tweak that I can do to this function so that i can cut down on some (if n...
I was asked to write the HTML markup and CSS for several of the following, like in a comments section in a webpage:
User's profile picture on the left
his message heading
his message content
I was so concerned with how to correctly make it displayed, and used
<div class="comment-section">
<...
I have decided to let my pet project created some years ago to undergo a code review here.
The review will be broken into parts according to meta question Multiple reviews or one big review?.
The overall concept and motivation can be inspected here (be patient, it takes some time to load).
An...
I've been reading "clean code" tutorials, and I definitely see the value of using good names that "document themselves" to make intent clear. However, what can be done about complex formulas where describing the meaning of a symbol is difficult?
My solution is to include a reference to the math ...