@Corbin I don't know what is being discussed exactly, but it's common for well known people to teach at least one entry level course if they teach. It helps drum up more interest in the program and helps inspire those already interested to stick with it. And from a teaching perspective, it perhaps teachers better fundamentals. No matter the discipline, good fundamentals are always, well, fundamental...
True, I suppose. I'd just be afraid that someone so far advanced might not remember what it's like to be a beginner. I imagine someone as smart as Stroustroup or Feynman though would be aware of that and make sure to monitor it. Blerh who knows. Would certainly be interesting.
I don't think that will happen in a very long time. SO is just too big and is too active for people to keep it clean over time. But when we get a lot of new questions, we need enough reviewers around.
Here is my custom class that I have that represents a triangle. I'm trying to write code that checks to see if self.a, self.b, and self.c are greater than 0, which would mean that I have Angle, Angle, Angle.
Below you will see the code that checks for A and B, however when I use just self.a !...
@Corbin I think there's more to it than that. Specifically, a lot of answers on SO take only 15-20 seconds apiece (either to ask or answer). Asking a (decent) question here takes somewhat longer, and answering takes a lot longer.
Well, that's certainly part of it. I was seeing it more in terms of the higher time investment is why there's not many reviewers and why it would be incredibly unlikely to scale.
It takes 30 seconds to throw up a blurb of code from some project or other, but a thorough review can take any where from 15 minutes to an hour.
True. Very true, in fact. But still. Even if you just glance through the code and explain 1 item, it can be time consuming.
I've actually wondered before if we shouldn't all be breaking up our answers more. Some of our wall-of-text answers could really be more like 3 answers in spirit. Just a bit rep-whorey. On their own though, there's certainly nothing wrong with short answers. Half the time a short answer is actually sufficient.
I have the following method which basically converts an input audio file to a monophonic FLAC file.
Now I am getting Member has cyclomatic complexity of 21 (105%) message in Visual Studio, while I've taken care of improving it as in the beginning it was longer, now there's not much I can remove ...
Just a quick comment: Your Ocean class knows/does too many things.
I'd be expecting a Fish class and a Shark class. Creating an ocean requires a starveTime constructor parameter? That's a sign you've broken the single responsibility principle (SRP).
Methods like void addFish(int x, int y) would...
@Jamal Yes--when I started on Stack Overflow, "nice answer" flags were nearly meaningless; virtually any halfway decent answer was likely to get one. Nowadays, things stay on the front page such a short time, they happen a lot less frequently.
As I mentioned in this answer, your Ocean class is breaking SRP, which makes your code harder to maintain than it needs to be.
Memory Usage
Let's pretend the ocean is an array of X-Y coordinates with 3 possible values at each intersection: EMPTY, FISH or SHARK (what your code does). If the ocea...
@Mat'sMug Might be worth mentioning encapsulation in that first one. Your Fish class is certainly flirting with it.
But yeah, half the time "Look up SOLID" seems sufficient. Which is kind of sad, since I believe that reflects a lot of the state of software engineering as a field.
lol Thanks Santa (the intent wasn't to attract some more votes... merely to show that long, time-consuming answers are not always rewarded with as much love as a shorter, less time-consuming answer)
Oooo, I didn't know we have an Objective C person. I should post some of my iOS code. Got thrown into it for work, and I have some doubts about the quality.... x.x
Re-reading the introduction of Design Patterns: Elements of Reusable Object-Oriented Software, I feel like I'm a total noob at OOP. Probably am. And then I look at the code I'm coping with at work and ...I don't know anymore.
It'd be especially pointless if you already know OOP.
If you're completely comfortable with C# and you want to learn ObjC, you'd pretty well only want to learn it to write an OSX or iOS app... and you can't do that very easily in ObjC without Cocoa/CocoaTouch
I'm working on some of the old Google Code Jam problems as practice in python since we don't use this language at my school. Here is the current problem I am working on that is supposed to just reverse the order of a string by word.
Here is my code:
import sys
f = open("B-small-practice.in", ...
I'm working on some of the old Google Code Jam problems as practice in python since we don't use this language at my school. Here is the current problem I am working on that is supposed to just reverse the order of a string by word.
Here is my code:
import sys
f = open("B-small-practice.in", ...
Welcome to CR! Unfortunately this site can't help you with getting your code to do what you need it to do. Have you seen our help center? Take a look, get your code working as you want and then edit this post so that it's on-topic for this site and you'll certainly learn from our Python reviewers :) — Mat's Mug7 secs ago
@nhgrif Hah. Objective C syntax is like C had a misformed baby with Java version 4. NSArray, NSDictionary, etc using a glorified void* is just gross. Oh, you want to call a method on an item in an NSDictionary? Get ready to either use a cast or assign it to an intermediary variable!
There are certainly aspects of Objective C syntax that I like though. And, as a tool it's actually quite nice. GCD, for example, is a relatively painless way of concurrency in a fairly low level language.
I like so much your quizz application.
Can you please tell me how can I use it in my website.
Thanks you so much again for creating such a nice quizz application.
Your soonest reply will be highly appreciated.
Nasir Ahamed
@Corbin Not necessarily. Originated with Ada where (like in C++ templates) all the type checking is static, but some languages have generics that are checked at run time.
@JerryCoffin I suppose in a way type checking in Objective C is implicitly done at run time. I guess that's not the same as true checking though. It's more of just, you're going to get a segfault.
In C++ you know you're dealing with the right kind of object because you literally cannot compile the program if you're not (unless of course you use some kind of casting).
Because there are plenty of runtime checks you can do to make sure you're not trying to send a message to an object that doesn't respond to that message.
@nhgrif The fundamental difference is between "that you can do" and "that the compiler does completely automatically". Objective C (like Smalltalk) leaves the job entirely to you.
Yeah, it's not a huge missing thing. In fact, like you're saying, it can often times be an advantage. For example, parsing JSON in Objective C with an NSDictionary is much, much more natural than the C++ handling of it where you have to have a variant.
@syb0rg Sort of. I wouldn't say I'm learning it anymore. I've written a fairly complicated application alone in it. I'm somewhere between beginner and moderate knowledge, probably a bit closer to moderate.
Far from good at it though. I like it over all though. Very interesting way of thinking.
@nhgrif Yeah, it's definitely nice sometimes to just assume types are going to line up. That's probably one of the reasons ObjC is better for what it's used for than something like C++.
Though for something with a small set of types like a database, static typing wouldn't be too bad. Just a bit more typing and mental overhead.
I am using the GeoComplete plugin with RequireJS
It works, but please could someone confirm I've done this correctly, mainly my understanding of shim:
requirejs.config({
waitSeconds: 120,
paths: {
async: './lib/async',
jquery: './lib/jquery-1.7.2.min',...
Ugh. In SO's NSChat, there's a user who regularly complains about all these "bugs" he finds in Apple's code. And by "bugs", we're talking about a complete failure to ever read or understand any documentation and start with the assumption that the framework or library he's using is broken and buggy and the code he's writing is perfect, despite the fact that in a room full of professional iOS developers, he (an amateur) is the only one who is experiencing all these problems.
Apparently his latest tirade is now that someone apparently misinformed him about a class 2 days ago, and he's peeved that he spent 2 days trying to use it wrong before he finally read the docs to find out that it doesn't do what what he needs it to do.
I've downloaded it and using it now. Would it be possible to add unique image with each question? That would be huge help if you can do this.
Please let me know
thank you so much again.
Nasir
This code uses a ReaderWriterLockSlim to store data (on a disk or wherever), so that only one thread can write and many threads can read.
All writers should be finished before reading, and the write should not block the caller.
Basically my solution would work, but it doesn't look and feel natu...
I've downloaded it and using it now. Would it be possible to add unique image with each question? That would be huge help if you can do this.
Please let me know
thank you so much again.
Nasir
@konijn I've temporarily protected the question to prevent him from answering again. @Jamal Do you want to take further action?
A few notes:
Right now you have the method str_findString(). I'm guessing this is an variation of strstr(). I'm also guessing that <string.h>'s implementation of this method will be more efficient and faster, based on it being a standard library.
if (strstr(temp_a, "$#@#"))
{
...
}
Decla...
There's someone who makes a point of complaining all the time and his name is god? That seems either trolling-y or someone severely disconnected with reality O.o
I agree. The frustrating/stressful parts of my job are when I'm doing non-coding things.
Like trying to get a refund from the ODBC Router people.
I mean, I could understand finding programming frustrating or not enjoying programming. There are things I don't enjoy that other people do as work or hobby. But I certainly wouldn't pick up something as a hobby if I didn't enjoy it.
I'm designing a logo quiz type of game, and I want to create a scoring system, I'd like to know a few tutorials that can be useful, some books if they are available or any good resources that I should consider before designing the scoring system!
Can you help?
Thank you
If you're asking about the conceptual aspect of a scoring system, then you can just design it however you want. For instance, if the player gets a logo correct, increment their score by one.
Coding it is fairly straightforward. It is comprised of a property (or instance variable) that you change...
I have written this code to search for a string in a .txt file. Is it possible to optimize the code so that it searches for the string in fastest manner possible? Assuming the text file would be a large one (500MB-1GB)
I don't want to use regex.
import java.io.BufferedReader;
import java.io.Fil...