@skiwi I had a similar problem with my Java calculator...
c:\Users\Simon\Documents\workspace\javafx\Calculator\target>java -jar calculator-0.1-SNAPSHOT.jar 4*2
8.0
c:\Users\Simon\Documents\workspace\javafx\Calculator\target>java -jar calculator-0.1-SNAPSHOT.jar 4 * 2
Exception in thread "main" net.zomis.calculator.model.CalculationException: Not sure what to do with expression: '4 calculator'
It's not really about code review, more about web scraping techniques and/or libraries people who don't do this professionally might not be aware of. As it's a bit of an open question and it doesn't look like there is a definite answer, I'll accept one of the answers I received. — makhan57 secs ago
I'm writing a small script, that should be able to handle multiple files. So I've added that files can be passed comma seperated, and do a arg.split(',') and then handle each one.
Now I've wanted to add asterisk as input possibility like
python myPythonScript.py -i folder/*
If I print the the...
Is there any way for a compiled command-line program to tell bash or csh that it does not want any wildcard characters in its parameters expanded?
For instance, one might want a shell command like:
foo *
to simply return the numeric ASCII value of that character.
eg.
me$ FOO="BAR * BAR"
me$ echo $FOO
BAR file1 file2 file3 file4 BAR
and using the "\" escape character:
me$ FOO="BAR \* BAR"
me$ echo $FOO
BAR \* BAR
I'm obviously doing something stupid.
How do I get the output "BAR * BAR" ?
Let me start off by saying that I have several years of experience in Java, but now I need to learn Python, so I decided to make a calculator as it also is a community challenge.
Please review the code looking for beginner mistakes, though I do intend the code to look professional. This is my fi...
SHORT ANSWER
Like others have said - you should always quote the variables to prevent strange behaviour. So use echo "$foo" in instead of just echo $foo.
LONG ANSWER
I do think this example warrants further explanation because there is more going on than it might seem on the face of it.
I ca...
Let me start off by saying that I have several years of experience in Java, but now I need to learn Python, so I decided to make a calculator as it also is a community challenge.
Please review the code looking for beginner mistakes, though I do intend the code to look professional. This is my fi...
I want to know if there is a proper way to load data from a slide-out menu in an iOS app. I recently read this tutorial, and incorporated the slide-out menu using the hamburger menu in my app.
Should I create a separate viewcontroller (VC) for each element / item in the table view? And ideally...
I want to know if there is a proper way to load data from a slide-out menu in an iOS app. I recently read this tutorial, and incorporated the slide-out menu using the hamburger menu in my app.
Should I create a separate viewcontroller (VC) for each element / item in the table view? And ideally...
This is a small gem that gives the possibility to include counts of reflections when fetching active record objects. What do you think of the code? Any improvements or other (similar) use cases where it might be useful?
require 'active_record'
ActiveRecord::Base.extend AssociationCount
module A...
I would appreciate if you could give me some advice about the code below. I am a student learning PHP programming and programming fundamentals. I have learned a lot from Stack Overflow but there are lot of things I don't know. I would like a senior developer's opinion on improving my codes overal...
I thought the code had been added before your comment though, and I wasn't sure if your comment was implying it might still have problems? I don't PHP at all.
Okay... how does this even happen? I never ever remember seeing any questions with "OBJECTIVE-C" or "OBJC" or any such all-caps language description in the title for Objective-C. But I definitely saw it regularly for Java... and now it's happening for Swift.
First Python script, so my code is pretty laughable. Sensitive information has been redacted. One thing that I'd like to point out is that there is an inconsistent use of '' and "". This is an old habit that I really need to break.
import traceback
import sys, os
import praw
import time
import ...
I am writing, as review, Modern C++ compliant versions of sorting algorithms I previously have seen. This post is about selection sort, and selection sort only.
I wanted to know if there were any ways to improve upon my implementation, especially in terms of performance:
// Orders a list of val...
Hmm... I was thinking my next blog post would be a rudimentary tutorial on the absolute basics of debugging...
I will definitely do that at some point, but now I'm thinking my next blog may instead actually be about breaking big problems down into small problems.
That's one thing I really see people struggle with as new programmers. They're asking a question which in plain English doesn't sound like much, but to a programmer, you say "Whoa, that's about 10 different problems that all needs to be solved one by one by one."
@nhgrif The ability to break down problems is definitely something that some new programmers are lacking. Seems like sometimes they want to do all things at once.
the sub-compartmentalizing of larger problems in to smaller ones is always a problem for beginners.
functional extraction is also one of the key lessons to teach, becuase it teaches exactly that: that problems should be broken down to smaller tasks, and then solved indepenednelty, then brought together to build a solution from the parts.
@janos I'm not quite sure what to do if I see code I'm unhappy with, do I add comments to the PR, sit down with the person and make him improve the code (thus slowing down development), or do I fix the code myself in an additional commit before merging it and only slowing down myself?
time wasted on chasing weird bugs, doing the proper fix later when the topic is not so fresh in your or anybody's head anymore, typically somebody else having to debug the problem than the guy who caused it, re-delivering, .... seriously, not worth it
btw, I have a few new guys on my team who send in mostly crap these days. PR cycles are long and exhausting. Code review doesn't seem effective enough to get them up to speed quickly. I plan to try something new I really didn't want: pair programming. I hope it will work
The only small issue I have with that approach is that I'm not worth more than my classmates, what I'm saying is that if you are a manager of them, telling them to do things is really easy, now it's not really easy
It's a project that takes 9 weeks of which 2 weeks are planning, documentation, client meetings, etc. then 5x 1-week sprints and 1 week for testing/presentations and there are like 6 national holidays
I want to implement some graph algorithms for learning purposes(e.g bfs, dfs, karger's min-cut algo) and before diving into them I want to make sure I have got the graph representation right (using an adjacency list). I want to keep things minimum to exactly what I need to implement these algorit...
I recently participated in a programming contest and I couldn't really bring my teammates on board in terms of baseline quality. I couldn't even get them to please let's use indentation width = 4, even though they used PyCharm as their IDE like me, where that's the default setting (!@#!@#)
> Please can you help me out to find out what is wrong?
That comment is wrong!
@SimonAndréForsberg - Thank you for that link. After suggesting this and clicking submit, I started looking for just this type of information. Reading now. — Mike28 secs ago
I am making a to-do tree application in Python that will show checkable tasks/subtasks in a tree view, with higher-level groups of tasks grouped into blocks (e.g., Work block, Home block) that do not have checkboxes.
It looks like this:
I'm calling it Earlybird. The application has two main ...
(I've trimmed the question slightly to ask about one thing - I think it is OK for Stack Overflow now. The original rather sounded like a request for code review, which is rather too broad here). — halfer48 secs ago
@ɐuıɥɔɐɯ This question doesn't look like it would be a very good fit for Code Review. This question appears to be asking for an explanation or verification of the code's time complexity. The asker doesn't appear to be seeking out a review of the code. — nhgrif22 secs ago
Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error. If the score is between 0.0 and 1.0, print a grade using the following table:
Score Grade
>= 0.9 A
>= 0.8 B
>= 0.7 C
>= 0.6 D
< 0.6 F
If the user enters a value out of range, print a suitable ...
> I'm closing this because it does not work. It does not handle the specific requirement for values >= 0.0/ When I run it, and enter -1, it grades it as an F.
Was about to put that... but then decided mod hammer not appropriate
It's a challenge, in general, to debug someone's code problem remotely, especially when a question is vague or ambiguous. But sometimes I have a pretty good idea where the issue lies, and how to ferret out the problem, so I suggest debugging / problem solving steps. These are typically for questi...
From that question you almost closed but then answered.
I know that comes from his teacher or the assignment or whatever.
But someone at some point decided it'd be acceptable to write this program that does all this, but then indicate to the novice programmer that testing a single input is an acceptable level of testing.
At a minimum, that program should be tested with a negative number, a number larger than 1.0, and then at least one number in all of the defined ranges plus numbers that fall right on the borders of the ranges.
A good teacher probably writes a test app and grades all of the student's assignments more completely and in less total time. A bad teacher just runs the projects one by one and sees if entering 85 returns a B
Someone is trying to tell me that DOM is better than JDOM.
They work at IBM....
Some of us would say you really, really should be using DOM rather than any version of JDOM ... — keshlam28 mins ago
@keshlam - that may be, but, as the maintainer of JDOM, you likely won't hear me saying that. Don't get me wrong, there are reasons to use DOM, but in this case, compare the logic above with what you would have to do in DOM. — rolfl25 mins ago
Most of the examples I've seen that make jdom look better were clearly written by someone who didn't know how to use the DOM effectively. I haven't worked thru this one, but it looks like DOM level 2 can do it just about as easily, and more portably. — keshlam8 mins ago
Then, his profile:
> CLAIMER:
I'm a long-time IBMer, having worked on the IBM and Apache XML/XPath/XSLT code and been involved in some of the W3C efforts (DOM Working group primarily but that interacted with some of the others).
> Feel free to consider me biased in favor of IBM -- and even more biased in favor of industry standards, whenever possible -- but I make every attempt to be fair and honest.
I have a Java program that loops over all rows in a SQLite Database, does some processing and the writes back the results in a remote MySQL Database:
private static long parseAndUploadData(Connection sqliteConnection, Connection connection, String part) throws SQLException {
Date star...
This is a kind of follow up to my previous sort implementation question with specific questions to insertion sort, and Modern C++ idioms. Anybody seeing this post can see how I got to this modern equivalent of a typical C-style sort you can find everywhere on the web by visiting my prior sorting ...
I'm learning how to code with wibit.net and am having trouble getting this code to execute. I'm assuming it's just user error, but some input would help. Any input is appreciated.
#include <stdio.h>
int main i = -1;
while (i < 5)
{
i++; if ((i % 2 == 1) || (i == 0))
continue;
pr...