• Content count

  • Joined

  • Last visited

Community Reputation

198 Neutral

About EmrldDrgn

  • Rank
  1. I am trying to write a GUI wrapper for a command line application using I/O redirection to collect the output. Basically I'm trying to do: system("\"Frequency Analysis.exe\" \"C:\\Some\\Path\\To\\File.wav\" > log.txt"); and then read in the output from log.txt. Unfortunately, while system("\"Frequency Analysis.exe\" > log.txt"); works just fine, system("\"Frequency Analysis.exe\" \"anything\" > log.txt"); reports that 'Frequency' is not recognized as an internal or external command blah blah blah (only if I redirect stderr with 2>, since that would be printed on the error console). Is this a bug in... something (compiler, C runtime library, etc)? Or am I doing something stupid? Thanks!
  2. I am capturing sound from a microphone into a buffer of 16-bit signed integers. What I want to do is get an approximation of the average frequency of the audio, but I'm not 100% sure how to go about doing this. Can someone point me in the right direction? My instinct is to take the Fourier transform and average the results I get, but I'm not sure that will work correctly... My apologies if this is in the wrong forum, I figured it fit here better than in Sound and Music.
  3. Set dimensions of stack-based array in constructor?

    Yes, C++ (should have mentioned). Darn... seems like that's something that'd come up a lot. Oh well. Thanks.
  4. Is it possible to do something like this: class Foo { private: Bar[] mArr; } Foo::Foo(int dim) : Bar[dim] { } Obviously that syntax is invented but I think it conveys what I'm trying to do, as well as my confusion about the appropriate syntax =). If it's not possible, oh well, but it would be the nicest solution to my problem.
  5. std::iostream output decisions

    How do the standard output classes from the STL decide what to output given a statement like: std::cout << 65; ? 65 is ASCII for capital A, but it's also an integer. What will be printed, and how does it choose? Also, how does it handle floating-point numbers (i.e., how does it decide when to use scientific notation and when to just display 100.6)? A reference of some kind would be more useful than a straight answer, but either would help.
  6. I've recently become interested in prime number sieves. The Sieve of Eratosthenes is simple, but I'm having quite a hard time understanding some of the other ones, especially the Sieve of Sundaram. Does anyone have/know of any example code for the algorithm, to help me understand how it works? I'd prefer Java or C++ if possible - all I've found so far has been Python, and I don't speak Python.
  7. As a learning exercise, I'm trying to implement a (drastically simplified) version of the printf function in C. My version will (for the time being) only print integers wherever it finds a %[character] in the format string. However, it's not working. The relevant code from the printf method is as follows: void prinf(const char * format, ...) { [...] va_list args; va_start( args, format ); int percent = 0; char character = format[0]; [...] while (character != '\0') { if (percent) { char string[11]; tostring(va_arg( args, signed int ), &string); printf(string); percent = 0; } else if (character == '%') { percent = 1; } [...] } } and tostring is: void tostring(int num, char (*string)[11]) { int i = 1; if (num < 0) { (*string)[0] = '-'; num = -num; } else { (*string)[0] = ' '; } while (num != 0) { (*string)[i] = (num % 10) +'0'; num /= 10; } while (i < 11) { (*string)[i] = ' '; i++; } return; } It's entirely possible that I'm doing something really stupid (I'm really a C++ guy normally, learning C), but I've been staring at these two functions for quite some time with no results. I've never done variable parameters before, so my guess is that's where the bug is, but I'm following the examples I've seen and no luck. The function works with no %'s in the format string (if it's used as a simple print). Any help will be appreciated!
  8. How do projects like wine work? I don't understand how wine can allow a program written for Windows to run on a completely different operating system. Is it just an open-source implementation of the Win32 API, or is there something more?
  9. Designing Code?

    Whiteboards have become my new best friends in the past few years. Unfortunately the environment I work in includes a lot of people who don't respect the DNE! I used to hate whiteboards until I figured out that the right way to use them (for me) is not to hang them up, but to lie them down. Seriously, when I switched from writing upright to writing naturally at table level, everything just fell into place. As soon as I can afford it I plan to build myself a table where the top is a whiteboard. I don't like to plan my overall project, because then I spend a ton of time agonizing over my design decisions. I like to delay any sort of decision for as long as possible in my projects, so that I avoid my own personal tendency to overthink. However, within subsystems I like to draw the flow of the typical interaction in a way that makes sense to me (not anything formal like UML). This helps me to be able to take a break, come back, and pick up all the state I was juggling in my head with something that at least resembles ease. Sometimes I don't even have to review the whiteboard, but the act of drawing helps me encode the information. This is especially critical for me when deciding how to store data to a file, lest my read and write functions be mismatched. But of course, your milage may vary. I just know that I personally overthink. If you tend to underthink and write yourself into corners, you may want to plan more. Everything is individual, and unless you're being held to a standard by your organization, you should find what you like and stick with it. I've never used postits AND whiteboards... I'll have to try it.
  10. AP Computer Science?

    The guy above is wrong, according to the College Board website... support I took Comp Sci A in high school, with no knowledge of Java besides what I learned while prepping. Java is really quite similar syntactically to C++, and syntax is what's most important on A, or at least that's my opinion of the test (which is low, I finished in like 20 minutes and had to sit for 3 hours). I will also mention, however, that even though I got a 5, it didn't get me out of any college courses. My college, and from what I understand a lot of colleges, want the AB test, which focuses more on data structures. I didn't take that one, but a friend of mine without a Java background did and he did quite well. Course, he's brilliant, so it has to do with how good you think you are. I did most of my prep from this website: http://javabat.com/ . I found it really quite helpful, and it was pretty representative of the sorts of things I saw on the test (just not ALL of it, for instance there's no OOP).
  11. Web Application Programming Resources

    Yep! Thanks for the enlightenment, everybody!
  12. Web Application Programming Resources

    Quote:Original post by swiftcoder HTML is solely interpreted on the client, and may be interpreted in many ways (i.e. screen reader, braille display, etc.). javascript in the browser is again only running/affecting the client end. So... the server code in PHP or whatever generates HTML/javascript and sends it to the browser, which parses it? Yes/no/maybe? Does that mean that pointing a browser at a .php file on the local hard disk would just display the text?
  13. Web Application Programming Resources

    Thank you! That's exactly what I was looking for. Just a couple of questions, if I may... What determines whether a specific server-side language can be used? Is it whether the server (Apache, IIS) supports it, or whether the web browser (IE, Firefox) does? Since the client-side program is a Web browser, is there really any client-side programming being done? Isn't all web development, even a simple static HTML page, technically "server-side"? Obviously I now have a million more technical questions, but the best way to answer those is just to dig in and try it, so I'll do that. Thank you so much for your assistance!
  14. Web Application Programming Resources

    No one? I understand it's not a very specific question, but that's my problem... I don't know enough to ask specific questions.
  15. Web Application Programming Resources

    Talking about web applications. Like google docs or gmail, although obviously less complex. PHP is just a language, right? So it might be involved in some way (I'm not sure), but wouldn't be the entirety of what I'd need to know about, at least as far as I know. Is web programming so different from standalone programming that the language choice is that critical? I'm used to being able to do pretty much anything in pretty much any language, even if some are better suited to some things...