• 0

    posted a message on C&T Restructure
    Quote from BKrenz

    From what I've seen, especially recently, there is hardly any programming threads going on. I'm not sure why that is, but if we could get 2-3 new threads every day, that'd probably be fine for a subforum, in my opinion. As it is now, I rarely see more than 2-3 a week.

    Yes, definitely. I do recall a time when programming topics were far more frequent than they are now (I used to check the forum daily quite a while ago). There actually used to be a lot of other tech related topics as well but you hardly see those anymore, either. The forum is downright inundated with the "builds" topics.

    I don't know why the build topics exploded like they did. You'd think people would just get on pcpartpicker.com and be done with it already. I don't think I'll ever understand the attraction some people seem to have for asking other humans questions that a computer can answer much quicker.
    Posted in: Computer Science and Technology
  • 0

    posted a message on C&T Restructure
    Quote from BKrenz

    I don't think there is enough activity for just programming. Grouping it with general computer discussion or support depending on the nature of the thread would be fine.

    What's the harm in having a forum with low traffic? From my point of view trying to group things so that there is always some minimum level of traffic does more harm than good. What it does is increase the signal-to-noise ratio for readers. I like to read specific topics (like I usually really enjoy the programming topics), but I stopped bothering to look for them after this section was last restructured because they were completely drowned out by all the "is this a good build" topics (which, by the way, I think it's awesome that this is being addressed now).

    It could also be the case that programming questions just aren't posted often because they get drowned out so easily, or the existing topics make it appear as if this forum is inappropriate for programming topics.

    I can't imagine that having a low activity forum costs much in terms of server-side resources or moderation resources. The same number of posts are being made either way, it's just that with an extra forum it's organized better making for a friendlier UX.

    Now, that said, the only thing I really have a problem with is grouping programming with general support. General support (at least my perspective) is for IT-like questions about "why doesn't hamachi work" or "how do I record what's on my screen". Programming discussions really don't belong with that since I feel it's a qualitatively different kind of problem to solve (and is usually a bit more involved).

    I would prefer a separate forum for programming topics, but I wouldn't be entirely opposed to having that share space with "Computers, Science, and Technology" in general (so long as "tech support" as it were is kept separate from all of these things), if it's really deemed necessary to have forums with a traffic quota.
    Posted in: Computer Science and Technology
  • 5

    posted a message on Python vs Java which one is better
    Neither, both, this is an ill-formed and meaningless question.

    Better for what? Better when used by who? If you don't know either language and don't know what you'd do with them then it really doesn't matter what you pick. If you know the languages and you know what you want to do with them, then you wouldn't ask a question like this because it's clearly the wrong question to ask.
    Posted in: Computer Science and Technology
  • 3

    posted a message on Why do we Learn Things in School we Will never Use?
    How are we supposed to find new ways to do things if no one wants to learn anything that might be useless? The more you know, the more chances you have to apply that knowledge.

    If you understand something well enough you will find a use for it.
    Posted in: General Off Topic
  • 0

    posted a message on .exe
    Quote from nathan5541

    Well I'm kind of curious if there is a way to decode this.


    Decode it into what?
    Posted in: Computer Science and Technology
  • 1

    posted a message on Why No One Will Guess Your Password
    Quote from dillonsup

    Here Are The Possibility's For Different Password Lengths.

    This Includes Every Key On An Average Keyboard
    so a - z And A - Z
    Also 0 - 9 and , < . > / \ ' : ; } { + =] [ ] -_ `~ ? " |

    K = 1,000
    M = 1,000,000
    B = 1,000,000,000
    T = 1,000,000,000,000
    Z = 1,000,000,000,000,000

    1 Key Long = 85
    2 Keys Long = 7225 Or 7.2 K
    3 Keys Long = 614125 Or 614 K
    4 Keys Long = 52200625 Or 52.2 M
    5 Keys Long = 4437053125 Or 4.4 B
    6 Keys Long = 377149515625 Or 377 B
    7 Keys Long = 32057708828125 Or 32 T
    8 Keys Long = 2724905250390625 Or 2.7 Z

    For Average Password Websites Like Minecraft Forums
    Where a -z and A -z Including 0 - 9 are only Allowed

    1 Key Long = 62
    2 Keys Long = 3844 Or 3.8 K
    3 Keys Long = 238328 Or 238 K
    4 Keys Long = 14776336 Or 14.7 M
    5 Keys Long = 916132832 Or 916 M
    6 Keys Long = 56800235584 Or 56.8 B
    7 Keys Long = 1476806125184 Or 1.4 T
    8 Keys Long = 91561979761408 Or 91.5 T
    9 Keys Long = 5676842745207296 5.6 Z

    Specail Thanks To My Calculator


    Of course the problem here is that humans don't pick uniformly random passwords. A completely random password is difficult to remember, which makes it very secure, but generally a bad password because you want to remember it. It's not impossible to memorize a long, random password, but it is difficult.

    So people are far more likely to pick something that has some kind of meaning. Usually the password will be pronounceable in some way, so the letters will form phonemes. Very frequently they'll contain words. If there's numbers in the password those, too, will not usually be random. By a wide margin any numbers in a password will be the user's birthday or some other significant date expressed as 2-4 digits.

    This reduces the search space for passwords quite drastically and pretty much makes your analysis totally wrong.
    Posted in: Hardware & Software Support
  • 0

    posted a message on How to start PC game Programming?
    Quote from TheCProGamer

    Now, how would I start out as a beginner programmer?


    You just start doing it. The most talented people when it comes to just about anything (playing an instrument, programming, writing, drawing, painting, building stuff out of popsicle sticks, whatever), generally don't ask how they should get started or how to get good or what they should do next. I think the one thing they all have in common is they just start doing it.

    What programming language should I learn?


    The ones that you need.

    What does this have that others don't?


    What is "this"?

    How should I start after learning the language?


    That's up to you to decide. There is no right thing to do. Also I feel that you have a misunderstanding here. You don't start after learning a language. You start before learning a language and you learn a language according to what it is you're trying to do.

    What kind of software should I use to write the lines of code?


    Whatever's appropriate. There are many IDEs out there and they can all be found with simple Google searches. You're the one that's going to be using it, you decide.

    Any other advice that may prove useful.


    Asking others how to get started is mostly a waste of time. Just start doing things. When you start doing things, you'll have more specific questions and specific questions are the kind that will actually have answers.
    Posted in: Computer Science and Technology
  • 0

    posted a message on Programming idea
    Quote from BC_Programming

    That only works for functions that can only accept a specific range of values (or can be converted into a specific range of values. sqrt doesn't work because you can sqrt anything.


    Well, if you're trying to square root a floating point number, you could be clever and store a look-up table for values in the range 0-2. Then, to take the square root, you separate the exponent and mantissa. If the exponent is odd, multiply the mantissa by 2. You then compute the new exponent and mantissa by dividing the exponent by 2 and feeding your mantissa through the look-up table.

    Of course that's still probably slower than just calling sqrt, but that particular function is actually amenable to a lookup (for floating points, at least).

    Also, depending on the nature of the function, it could be possible to remap an infinite domain into a finite one. For example, if the function takes any value in the range [0, infinity), you could instead run that input through 1/(x + 1) and map that onto (0, 1] and built your look-up table there. However, this will really only work well for functions that don't change much as they tend towards infinity.
    Posted in: Hardware & Software Support
  • 2

    posted a message on How to learn to program games?
    Quote from Fred2000789

    Why?

    There are libraries and game engines. You wont have to touch low-level things.

    Well C++ can run on more places than Java, and I'd say C# is pretty cross-platform too.

    That's not what I was getting at.


    C++ is not a good place to start because it's a terribly bloated language that has a lot of confusing features. At similar skill levels between both languages, it is almost always faster to develop something of equivalent functionality in Java than it is in C++.

    I think perhaps one of those cumbersome things I encounter in C++ is just how files usually end up organized. At work one of the more annoying things I have to do in C++ is add a member variable because it requires modifying two separate files: the header and the source. If you want to avoid that you end up inlining everything into header files and if the project ends up being any reasonable size, you'll start getting irritated by build times, because just about any change results in a full rebuild.

    Even build times on the order of 10s of seconds get frustrating when you're trying to debug problems where you're constantly making changes and then rebuilding and running the code again to see if the problem's been fixed.

    Speaking of debugging, the support for C++ debugging is not terrific. I'm not sure how it works in Java, but debugging things line-by-line in C# is an absolute breeze compared to C++. If I want to debug something in C++, I have to do a debug build, which usually means a full rebuild that ends up taking significantly more time than a release build. The resulting code will then have horrendous performance which can be extremely frustrating if you're waiting for it to load resources in completely un-optimized code.

    Which, by the way, is what gives C++ its performance: compiler optimizations. This is something that C# and Java don't really have to a significant degree. Those languages leave optimizations to the JIT, which can perform some optimizations that a compiler can't, because the JIT has access to runtime behavior where a compiler can only reason statically.

    If you want to develop a game faster, then use C#. I'm telling you that Java isn't the right tool here.

    Except there's only so much you can do on a virtual machine.

    That makes no sense whatsoever.

    I'd say C++. But we still know close to nothing about what you want your game to be.

    C# would be my next choice.


    For beginners there's not going to be a significant difference in effort between Java or C#. Most of the additional features that C# provides are something that a beginner probably wouldn't need to deal with to a significant degree anyway (and anyone asking what language to use is a beginner).

    There is plenty of stuff you can do to optimize even in a virtual machine environment (which is mostly a non-issue). If you want good performance, pick good algorithms, don't fret over what language you're going to use. And don't under any circumstances break the two rules of optimization:

    1. Don't do it.
    2. Don't do it yet.

    Optimization comes last and only when and where it's needed. Premature optimization is the tool of the devil.

    Quote from Fred2000789



    Every language can create a game. Whether the game will run at a desired rate is another matter entirely.

    But,
    Things Java can't do that C++ can:
    Pointers
    Memory Management
    inline assembly (Not used by me, but some do)
    More platforms
    Easy access to binary data
    Operator overloading


    Inline assembly is not a feature of C++, it's a compiler extension and it ends up being different depending on which compiler you're using.

    Technically C# has something similar since it provides you with the ability to emit IL at runtime (basically letting you write compiled at runtime). Similar things exist for Java.

    I also don't know what you mean by "easy access to binary data". Reading and writing binary data is pretty similar between all languages since they typically abstract it away as streams. I guess about the only difference is that C++ can reinterpret_cast a pointer to an arbitrary object and then screw with the bytes. I wouldn't really advertise that as a feature because it's really just an example of a lack of type safety in C++.

    Also C++ doesn't technically feature any actual memory management features (perhaps with the exception of smart pointers nowadays). The programmer handles all memory management in C++. Java and C# handle memory management for you since garbage collection is kind of a core feature of both languages.
    Posted in: Computer Science and Technology
  • 1

    posted a message on How to learn to program games?
    Name one reason why programming this game in Java would benefit the game in any way.


    Less time dinking around with low level crap and boilerplate and more time dinking around with actual game design and development.

    Quote from Fred2000789

    I'm trying to tell you that Java isn't made for this type of stuff. You're only hurting yourself.


    C++ isn't made for games, either. Actually, pretty much all general purpose programming languages aren't made for games.

    I will say that if your goal is to actually accomplish something, then Java or C# would be a better choice than C++. The less time you have to spend messing around with low-level stuff, the better.

    Personally, I prefer C#, just because I find it to be a more expressive language (I also think the whole type erasure thing for Java generics is kind of stupid; but that's going to be mostly a non-issue in this case).
    Posted in: Computer Science and Technology
  • 0

    posted a message on How do you square numbers on a calculator?
    Quote from SeaWry

    That is true I guess, but did not slip to my mind at time. What is amusing is how everyone is taught different methods and some things I do not know.


    That method is more useful for computing large powers of numbers (usually modulo some other number). Like, if I asked you what the last 4 digits of 7213 were you wouldn't want to multiply by 7 213 times, that'd take a while and you'd probably lose count. Instead you do it this way:

    Keep track of a multiplier, start it at 7 (or whatever the base number is). Keep track of the exponent (213 in this case). Keep track of the result, this always starts as 1:

    At every step, check if your exponent is odd. If it is, multiple the result by the multiplier.
    Next divide the exponent by 2 and truncate.
    Next square the multiplier.
    Repeat until the exponent is 0.

    Now, since I want the last 4 digits, I'm only ever going to keep the last 4 digits of any result.

    7, 213, 1
    49, 106, 7
    2401, 53, 7
    4801, 26, 6807
    9601, 13, 6807
    9201, 6, 4007
    8401, 3, 4007
    6801, 1, 2807
    3601, 0, 0407

    So the last 4 digits of 7^213 are 0407. Took 9 steps which is a lot less than 213 steps.

    If I wanted to I could compute 7 to a power in the billions and it'd only take around 32 steps to do it.
    Posted in: Computer Science and Technology
  • 1

    posted a message on How do you square numbers on a calculator?
    Quote from SeaWry



    Do you know how to do it manually though? I would sorta hope you do?

    8^8 = 16777216
    8*8*8*8*8*8*8*8 = 16777216

    (Before any open their lips saying ""oh that is wrong"", no one is taught the same.)


    Or:

    88 = ((82)2)2

    Meaning you can just hit the x² button 3 times.

    Quote from Christoi


    First one is fairly straightforward, using the rules of exponents you get 8-1.5=8-1-0.5=(1/8)(1/sqrt(8)). I can't think of a quick way to evaluate a cube root off the top of my head though, if your calculator doesn't do it for you.

    In what context do these questions come up? Are the questions designed under the assumption that your calculator can compute powers of non-integer values, or are you expected to break them up using the rules and such?


    If you have a logarithm table you can do any exponentiation problem:

    xy = eln(xy) = ey ln x

    So all you have to do is find the logarithm of your base (x), multiply it by y, and then find e raised to that power. Alternatively this works with any logarithm base, so if all you had was a table of base 10 logarithms that'd be fine. This is usually how a calculator computes these things anyway.
    Posted in: Computer Science and Technology
  • 0

    posted a message on New to Programming... Any Tips?
    Quote from Fred2000789

    I fail to understand how that's a language issue.


    Linker errors are a language issue because pretty much any implementation of a build system for C++ will have them. It's something that you will encounter in the process of using C++, ergo, it's an issue with using the language.

    My point about IDEs was simply to refute your claim that my opinions were based only on one IDE. They weren't. For that matter, IDEs are also a language use issue because they are the tools you will be using to develop software in that language.

    And text editors are not a reasonable alternative to an IDE. You may be the John Henry of writing code, but as I recall that folk tale ended with him working himself to death.
    Posted in: Computer Science and Technology
  • 0

    posted a message on New to Programming... Any Tips?
    Quote from Fred2000789

    So you're basing a language on a single IDE?


    No, I've used Eclipse, Code::Blocks, Dev-C++ and maybe some others. They were all equally terrible, but in their own unique ways.

    I've never encountered a linker error that a quick google search or a post on a forum couldn't solve.


    Like I said, linker errors are either stupid simple, or the beginning of your own personal hell. A few weeks ago I had the pleasure of trying to find the source of a linker error for a mismatched function signature. I couldn't find the problem. The function signature it was expecting was exactly right.

    It turned out, the problem was with a function signature in another class entirely. I'm not even sure what the problem actually was, because the problem class wasn't even being used by the code I was working on and it didn't even inherit from the original class that the function resided in. I think it was some kind of template shenanigans. So in spite of the fact that I managed to find and fix the problem, I don't even really know why it was broken.

    And that's what I'd classify as an easy linker error, because it took me less than 15 minutes to fix. And I didn't have to Google it, either (because that wouldn't have helped).

    In modern C++, pointers are barely used.


    Okay, that's complete nonsense. Pointers are a fundamental part of the language. You cannot use C++ effectively without them. The recommendation is to use smart pointers instead of raw pointers. Basically this amounts to garbage collection for C++. Really that's it. Pointers are still pretty much at the core of everything in C++ (polymorphism would not work without them). Not to mention that any modern codebase is going to be rife with pointers (and usually not smart pointers).

    I think most of that post is just biased hate.


    I've been using C++ for 13 years, I think my "biased hate" is totally justifiable.

    EDIT: For the 'most vexing parse' link, isn't function declarations inside of other functions illegal? That would most likely never happen in the real world.


    Did you even really read the link? If it wasn't legal C++, it wouldn't be a problem and it certainly wouldn't have its very own Wikipedia article dedicated to it.

    It's a problem because the syntax for object construction looks a lot like the syntax for function definitions. So people type something that they think is just your normal everyday object construction, but because of the parsing rules of C++ it ends up being interpreted as a function definition, when then usually results in some other compiler error because you end up misusing the function you accidentally declared.

    It does happen in real life. I've seen this question crop up on more than one occasion, especially with beginners. Like you, they can't imagine why that would be considered a function definition and so get totally confused when it happens.

    Quote from Fred2000789

    C# technically isn't a full OOP language, as it has:
    Enums
    Value types
    Static methods
    Static classes

    Pretty much nitpicking, but that's what you're doing.


    Yeah, no, you don't know what you're talking about. The presence of those constructs does not ssuddenly make C# not a "full OOP language" because there is no such thing as a "full OOP language". Languages have OOP features. C# does have OOP features, so does C++. I would argue that C#'s OOP is considerably more well-developed than those in C++.

    I would also like to point out that IL, the language that C# and other .NET languages are compiled into (and ultimately run by the CLR) is very much object-oriented. The idea of things being objects is very much embedded at the core of C# and the CLR. In C++ this is not the case. After you compile C++ what you're left with usually doesn't have much in the way of objects (save for RTTI). There's no such thing as a class in natively compiled code.
    Posted in: Computer Science and Technology
  • 4

    posted a message on New to Programming... Any Tips?
    Quote from fm87

    For someone with absolutely no experience though? The barrier to entry might be lower, but that doesn't necessarily mean they will have an overall easier time with getting used to it, especially if they still don't have a clue what they are doing.

    I'm sure in the long run that is the case, but in the shorter term, I think it's a bit more up in the air.


    Yes, even for someone with absolutely no experience. C++ is confusing, even more so when you don't know anything. Higher level languages ease that burden. That's the whole point of higher level languages. Not to mention that the tools for C++ are pretty crappy, especially for a beginner. Like BC_Programming mentioned, the intellisense provided by Visual Studio in C++ is pretty much garbage. I've found that to be almost universally true; I have never found an IDE that's actually given me what I felt was useful intellisense in C++.

    Compare that with the intellisense for C# in Visual Studio and it makes the C++ stuff look like a total joke (and then toss in something like ReSharper which can make even the Visual Studio built-in intellisense look like total crap).

    Another problem with C++ is actually how comparatively complicated it is to build a project. Visual Studio manages to hide most of this process from you, but if you ever need to touch any part of the build process you're not going to know what the hell to do. When it comes to C++, learning how the toolchains actually worked and how to link in external libraries that aren't just header files was one of the last things I really learned about the language. Like I remember how much of a hassle it was to build against things like zlib.

    Hell, managing the build process professionally is something of a nightmare. Like, when my company upgraded from Visual Studio 2005 (if you want to talk about C++ intellisense really being a joke, go check that crap out) to Visual Studio 2010, it took months to transition over the code base. It caused all sorts of problems with Boost and stlport and a number of other third party libraries.

    Oh, and then there's the fantastically incomprehensible world of build errors in C++. Anything involving templates turns into a nigh-unreadable mess. And linker errors can either be trivial (unless you're a beginniner) or take significant effort to figure out. There's really not a lot of middle ground with linker errors.

    Oh, also there's the most vexing parse.

    Now, I'm getting pretty close to just ranting about the stuff I hate about C++, but the language does have its placee, but not really in a beginner's toolbox. The language suffers because it doesn't appear to have been designed so much as congealed. Not really what you want when you know nothing of programming.
    Posted in: Computer Science and Technology
  • To post a comment, please or register a new account.