So, in the process of reviewing something on Code Review, I managed to write code worthy of a review!
This code takes input by form of a string parameter, and tests whether it's an integer (whole number) or not.
I went with the method of splitting by ., so 4.5*2 would make ['4','5*2'], which th...
I'm new to python and I'm trying to convert between Microsoft GUIDs and plain hex strings. My code (python 3) looks like this
def hex_to_guid(hex):
h = binascii.unhexlify(hex)
return '-'.join(map(bytes.decode, map(
binascii.hexlify, (h[0:4][::-1], h[4:6][::-1], h[6:8][::-1], h[8:...
@EthanBierlein Looking forward to the Raspi code! We should talk about it sometime, I picked up my first one recently, still trying to get in to it, only completed one project so far. Self-teaching bit rough, lacks appropriate direction.
I have code that fetches different templates for html and css in the file system. The templates are stored in different folders, so I have two implementations for the code that fetches them, passing the correct path as a parameter.
The code looks like this:
private string _templatePath;
...
@Bacon Good morning. I'll take a look, but I don't answer every Scala question. There are still parts of Scala that I just don't understand all that well.
I have this code querying for some objects from my database with Flask-SQLAlchemy
areas = Area.query.all()
subareas = Subarea.query.all()
And then I use it on html with Jinja template to display data
{% for area in areas %}
{% if area.number=='0' %}
<select id="{{ area.number }}" ...
Stack Overflow is for people looking for answers to problems, it's not really for giving feedback on your existing code. You might be interested in CodeReview but please read the How to ask page there. It would be a good idea to read StackOverflow's how to ask page too. — SuperBiasedMan13 secs ago
When the USS Enterprise first appeared, its warp nacelles looked like this from the rear:
At some point in The Original Series, the ship seems to have enjoyed a mild refit, resulting in ball-like attachments at the rear ends of the nacelles that weren't there before:
When exactly did the En...
I just wanted to use the .map closure in Swift and stumbled upon this:
//var oldUsers = [User]() -> containting >=1 Users at runtime
//var invitedUsers = [String]() -> gets filled with userIds during runtime by the user clicking on people to invite
let oldIds = self.oldUsers.map {$0.userId} //u...
Solving a problem or not, you have a very specific question about code. This question is off-topic for Code Review and (I believe) on-topic for Stack Overflow. — Simon André Forsberg39 secs ago
Note: For chat-like discussions of this subject, let's use this Discuss Close Reasons chat room
Code Review currently has three standard off-topic reasons:
Questions containing broken code or asking for advice about code not yet written are off-topic, as the code is not ready for review. A...
[(String)] and Array<String!> are not at all the same thing.
Also, String! is not explicitly unwrapped, but rather implicitly unwrapped. It is called implicitly unwrapped because we can try to use it as a String without explicitly writing any unwrapping code. Meanwhile, explicitly writing the ...
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the first seven triangle numbers:
1:...
This has recently been brought up that we should improve this off-topic/close reason.
While we can agree that this VTC reason is less than ideal (perhaps too broad, should be two separate reasons) right now in Beta we are limited to 3 pre-defined off-topic reasons.
The full reason (emphasis ...
The first thing that I see is a fundamental issue that would be a problem regardless of the programming language used - long procedures.
The folks who study the human aspects of software development have strong evidence suggesting that readability is critical to making code easier to understand ...
Thanks for the hint, but I already know the entire thing is currently above me, for now. It's an interesting one that I'll probably go back to one day.
Learn a new language!
Write anything1 in a language you're completely unfamiliar with.
1. Ideally, something more complicated than "Hello World" and something more interesting than FizzBuzz.
> Swift is a new programming language for iOS and OS X apps that builds on the best of C and Objective-C, without the constraints of C compatibility.
> Swift adopts safe programming patterns and adds modern features to make programming easier, more flexible, and more fun. Swift’s clean slate, backed by the mature and much-loved Cocoa and Cocoa Touch frameworks, is an opportunity to reimagine how software development works.
@IsmaelMiguel How much did you pay for your current machine?
And do you have any specific requirement for having Windows?
@nhgrif Too much. 50€ for an SSD Kingston v200 (I have a free v300 now), 20€ for the SATA3 PCI controller, 60€ for the GPU (the fan died and now I have a borrowed one), free CPU, ~80€ in DDR3 RAMs, 50€ on a 1TB HDD (top speed 150MBps), an Asus Xonar DG (20€), 20€ for the aftermarket cooler and 50€ for the motherboard
> I attempted this question, however, I was not able to find the answer because my computer is not that strong enough to process this program and my code is not efficient enough.
People were posting absolute every single possible answer they could and begging for up-votes even though the answer wasn't deserving, which guilt-ed people into voting for them.
@Malachi no, it's not, but slow down and let's handle this point by point.
Now that you've played around with his code instead of letting him do it, does all of his plain English still make sense?
I don't know that it does. And you don't, and you didn't pay attention to that before just editing away.
@Malachi More to this point though, if you post a question to SO, then find the solution, if you add "EDIT: This fixed it [solution here]" to your question, that will get rolled back 100% of the time. That's supposed to be posted as a self-answer.
I just had my hopefully last exam ever. Turns out that the preparation I made is about 150% of the exam. All I had to do was add an extra ImageView somewhere and otherwise my practice project was entirely the same with some extra features (which provide bonus points). #score
Project Euler, Challenge #12 in Swift
If editing in the edit keeps the question clear, should we edit the edit into the question instead of leaving it as two separate blocks of code.
It seemed obvious to me that the user wanted to edit the code into the code block but is used to SO's way of d...
@SimonAndréForsberg Yes, and it took me a while to learn that until finally, one day, I figured out that it doesn't matter how much reputation you have; it only matters if you are helping the community.
I changed the code. if you review this function, review this code instead, I changed it since I posted this question, it doesn't look like anyone has reviewed it yet, no harm no foul.
Just tell the OP what to do, ensure they understand. Also, my answer isn't about that specific case, but generally. If you in particular think it's clear, and it happens to be also what the OP wants EXACTLY, you should still explain this to them.
That's fantastic, again my answer is about this in general. You don't want to have that be an official standard because your edit matching what was wanted is luck.
Code Review would be a better place to ask this question, as your code works but for some reason 1 is just very slow. Code Review is the place to ask help about working code. — DragonSamu56 secs ago
I am having serious doubts about this code even producing the correct results, with that "improvement" of the code. I think you should spend a bit longer working on this code. I would recommend making sure that your code does get the right result in the end, before you post it here. — Simon André Forsberg ♦6 mins ago
@SimonAndréForsberg Not my place to determine from the looks whether it works or not. Did you try it out and see if it does or doesn't? Because otherwise I interpret the question as a badly optimized algorithm