Also, after posting please don't make any edits to your code. It can mess up review in progress as well as invalidate answers. — Easterly Irk42 secs ago
You have several options for follow-ups:
Accepting an answer
If one of the answers gives you good advice with clear directions for improving your code, just accept the best answer and upvote any other answers you feel were helpful. The checkmark that you confer is the best way to show appreci...
@SjoerdJobPostmus usually not even after you first posted it...
because your code should already be the best you can possibly produce without our help
Meme: JDQ
Originator: rolfl
Cultural Height: The 2nd Monitor
Background: JavaDeveloper is the user who has posted the most questions on Code Review. A JDQ is of course, a JavaDeveloper Question. JavaDeveloper is the first one, and currently the only one, who have received the newly invented So...
As an effort to teach myself swift as well as to get familiar with machine learning algorithms, I've been trying to implement common algorithms, starting with a Random Forest. This is, for the moment just one of the tree, but I have been trying to implement it just from the theory, without lookin...
The Node.JS http; and https; modules only provide .get shortcut function, unlike e.g.: [AngularJS's $http][1] which provides them all. So I went about creating a function that returns one of these shortcut functions:
'use strict';
var http = require('http');
function httpF(method) {
return...
I wrote the code for most significant radix sort but I keep getting an error of IndexBoundsException on the line: arr[i] = arr1.get(i);.
public static int[] msdRadixSort(int[] arr) {
if (arr == null) {
throw new IllegalArgumentException("The array is null!");
}
//search thr...
So, let's focus on your Node class at the top. I started off, without looking at anything else, and just swiftlinting it.
You have a 55 line file with 20 violations.
Fortunately, 19 of them are autocorrectable. Seven of the violations are for opening brace placement. In Swift, we prefer ...
I've been trying to make a brute forcing algorithm, but it doesn't seem to work. It stops after three Strings generated and freezes.
Here's my code:
public static final char[] CHARSET_1 = "abcdefghijklmnopqrstuvwxyz".toCharArray();
protected void recur(final String base, final int times) {
...
Can somebody please try and help me speed up my code? The file is ~12mb (you can download it here https://dl.dropboxusercontent.com/u/91292881/ShareX/2016/04/client.dll). It takes around 8-12 seconds to run on my i7 4790k.
public class HexDumper {
public static void main(String[] args) thro...
I wrote a javascript source which regrouping by new key.
i.e. following json to the other.
{
"items" : [
{
"company" : "A"
, "name" : "Prod_A01"
}
, {
"company" : "A"
, "name" : "Prod_A02"
}
, {
...
Forgive me if this is too simple, but I'm a beginner trying to learn and understand. I came across an exercise to create these three basic functions, and this is what I came up with.
Any glaring errors?
This progam defines three functions:
sum(x,y)
range(x,y,step)
rangeSum (start, end)
...
This is my question for PLSQL function
(http://stackoverflow.com/questions/36368956/how-to-return-varchar-input-in-reverse-by-using-funtion/36369809?noredirect=1#comment60358692_36369809)
Please check it and assist me.
My answer was in Screenshot.
public class FormulaNode {
private var nodeType: NodeType?
private var subNode: FormulaNode?
private var nextNode: FormulaNode?
private var nodeContent: String?
}
@IBAction func calculateFormula(sender: UIButton) {
let formula = Formula()
if (formula.fromString(formulaTextField.text!)) {
}
else {
// The formula could not be parsed
}
resultTextField.text = formulaTextField.text
}
Basically, I'm wondering how to go about the best way to design a bot which can be supplied different contexts that it can use to send messages.
So, the idea is to create an IMessageContext interface or similar, that either has: a single SendGlobalMessage(MessageLevel level, ...) method, or a method for each message level (I.e. SendGlobalImportantMessage(...), SendGlobalRegularMessage(...), etc.
I think I want to go with the SendGlobalMessage(MessageLevel level, ...), but then I wonder if I should change it to SendMessage(MessageType type, MessageLevel level, string target, ...) as well. The problem lies in that not every message type will have a target.
Some of them (global messages) have a single target.
I'm just trying to think from the aspect of expandability. If I make a single method that takes a MessageLevel enum, I can very easily add new levels without changing the interface contract.
So, I wonder if I shouldn't separate them into different methods by message type, and send all message types and levels to the same method.
Maybe I'll wait until Mat'sMug or Hosch250 get on.
Basically, the idea is to pass the IMessageContext to the bot so that it could post messages wherever necessary. And then I wonder if it shouldn't take a List<IMessageContext> so that messages can simultaneously be posted to multiple contexts.
Then you could easily log all your messages to a file or something, with a FileMessageContext or a SqlMessageContext next to your IrcMessageContext.
Blech, I think I'll need to do a bit more thinking about this before I get started.
WTB: better title for VBA code putting statistics and graph next to data
> Once Excel, Access and Windows were bragging to each other. Excel says, “I once crashed so hard, it took 5 minutes to recover”. Access says, “Oh thats nothing. I once crashed and took down an entire database. It took them 30 minutes to recover”. Windows doesn’t say anything. Excel pokes him in the arm asks “what about you?”, Windows jolts & replies, “Sorry, what did you say? I just crashed again.”
How do I improve this:
List<int> list = new List<int> { 1,2,3,0,5,7,0,6,0,0 };
list.Reverse();
list = list.SkipWhile(l => l == 0).ToList();
list.Reverse();
The goal is to trim trailing zeroes.
how to validate a string in Java with an if statement for example; to make sure that the user entered letters for his/her name instead of numbers or special characters?
I have the following data which gets served from a neo4j query, The data that gets sent back is in the format
home->parent->child1
home->parent->child2
home->parent2->child1
home->parent3->child1
home->parent3->child2
home->parent3->child3
I am trying to use javascript to display html which ...
I am trying to implement the reverse function of my own LinkedList implementation. Using my implementation of LinkedList:
public class LinkedList<T> {
public Node head;
public LinkedList(){
// Add HEAD
head = new Node(null);
}
public void add(T data){
ge...
i'm making a project - it's a simple labyrinth(i'm a new guy to python).
i want to make it that i could hit a wall, and if i did hit the wall, i wouldn't cross it. here is the code, i would really appreciate it if u guys could help me out, thanks in advanced
`
from turtle import *
from ...
I spent 2 months working on a user management library, with the intention of selling it on Codecanyon (I've never sold anything there before).
On Codecanyon, there's a screening process for everything that's uploaded, and five days later, aka today, I got an email from them saying this:
Unfo...
I'm logging data from an embedded platform over UART. This gets saved to a log file and I want to process the saved log with Excel.
I have no idea whether what I did was even remotely a good solution. My VBA experience so far consists mainly of code only used once. However, since I'll have to us...
What should one do about an answer that only gives hints to the OP because the OP of the answer wants to leave the actual improvements to be found out by the OP of the question as some sort of exercise?
Formally, a deterministic finite automaton is a 5-tuple \$M = (Q, \Sigma, \delta, q_0, F)\$, where
\$Q\$ is the set of all possible states,
\$\Sigma\$ is the alphabet,
\$\delta \colon Q \times \Sigma \to Q\$ is the transition function,
\$q_0\$ is the starting state, and
\$F\$ is the set of acce...
@SirPython I'd say it depends, I've seen it done plenty of times coming from experienced programmers in particular to beginners to encourage them to not only improve the code, but also to learn about it on their own to understand the how/why
Do you have a specific example in mind, or just asking in general?
Here is a puzzle:
U2 has a concert that starts in 17 minutes and they must all cross a bridge to get there. All four men begin on the same side of the bridge. You must help them across to the other side. It is night. There is one flashlight. A maximum of two people can cross at one time. Any ...
So, let's focus on your Node class at the top. I started off, without looking at anything else, and just swiftlinting it.
You have a 55 line file with 20 violations.
Fortunately, 19 of them are autocorrectable. Seven of the violations are for opening brace placement. In Swift, we prefer ...
Or... Make a formula model object with a stack of formula items and a method to actually print the formula pretty. That approach resolves the need to parse it...
Is there any smart way to compress the following code:
def __total(self, x, y):
count = 0
for x_offset in range(-1, 2):
x_index = x + x_offset
for y_offset in range(-1, 2):
y_index = y + y_offset
if 0 <= x_index < self.Size and 0 <= y_index < self....
I'm a novice and started learning C just a few days ago. So far I've learned if and else statements and how they work. So I wanted to make a program that will convert celcius to fareheight and vice versa. Users will be first asked to enter what is their input (celcius or farenheight) and the prog...
Definition - The product of a and b should be equal to the sum of all numbers in the sequence,excluding a and b.
I have made code for one program and need refactoring for code to get execution in less time
def get_correct_array(n)
beginning_time = Time.now
puts " Begin with #{Time.now}"
mul ...
A general reminder: VLQ flags are for incomprehensible garbage not for things that don't answer the question or seemingly spammy answers. Those get their own flags.
Since the deprecation of C-style for loops in Swift 2.2 (and the removal in Swift 3),
several questions about the possible replacements were asked on Stack Overflow. In most cases, a for .. in loop
is the appropriate replacement:
for i in 1 ... 5 { /* ... */ }
for j in 10.stride(through: 0, by: ...
So I ordered an SSD from Newegg at about 14:30 yesterday, and selected the basic 3 day shipping, the thing just got here at 14:00 today...literally less than 24 hours later.
I have a matrix and from any cell (a, b) i need to find a path to cell (c, d) and i must meet the following conditions:
1. |a - c| + |b - d| = 1
2. All the cells in the maze are traversed exactly once.
3. It is allowed to move only in the four directions - up, down, left and right from the curre...
Confirmed (I just installed it). I think that I have seen both patterns in the past, i: Int and i : Int. But if that is the only violation then I am quite satisfied :)
I have seen several (suggested) reviews lately, where someone edits the code in the original poster's question. Should such edits be allowed?
The edits in question are mostly minor. Some add spaces to the code to increase readability, others fix syntax errors in the posted code.
Some questions link to the code they want reviewed, which is against site policy. Should one edit the code into the question in these cases?
The problem I see is that all content on Stack Exchange is cc-wiki, which may not correspond to the wishes of the author. This is probably fine when the ...
i think your word is amazing, i'm very proud of you. i'm not felt sad because your word. can you explain where is the vulnerable? and do you have social media like facebook maybe(not twitter)? i need to make conversation with you — Zaki SulistyaMar 25 at 13:27
I'm working on an experiment to parse speech out of an emote in a text roleplaying game (MUD) so that if you can't hear it correctly, or if it's in a different language, you won't understand it. This works correctly, but I was just wanting to make sure it was as clear and efficient as possible.
...
I am writing Rijndael for academic purpose, following wikipedia's description.
https://en.wikipedia.org/wiki/Rijndael_key_schedule
I would like to know, if up to this point it is correct, both from pragmatic programmer and strict cryptographer views.
class KeyExpander
{
private static fina...
Desired Feedback
I'm looking for feedback regarding ways this could be: more concise/clean, more idiomatic Haskell, or if there are algorithmic/mathematical tricks I missed that could further simplify the computation.
Problem Description
The input is read in line by line from stdin.
Input For...
I have this school project to write a function that print characters on the terminal and the maximum lines in a function must be less than 25.
When we calculate the length of a function, do we include the curly braces and blank lines?
void rush(int x,int y)
{
int row;
int col;
row = 1;
whi...