Jump to content
xisto Community

osknockout

Members
  • Content Count

    401
  • Joined

  • Last visited

Everything posted by osknockout

  1. Spending a few millions in the process... I think it's a relatively nice idea and probably should be made, but I still think this product simply couldn't some pull some things off. Puns for example. "Orange ya gonna ask me?" doesn't have that same feel as "Naranja me preguntaras?" in spanish (of course, the nonsensical latter sounds a million times cooler, but anyway...) Come to think of it, just about any translation doesn't have the same feel in a different language. My experience in reading Shakespeare in Spanish and de la Barca in English has been totally different from reading it in each author's original medium. At international consortiums and diplomatic meetings - where I'd imagine this type of product would be used most - I'd think a feel of what the speaker is saying would be one of the most important things to transmit. Plus, there'd be the added problem of knowing what not to translate. (For example, Los Angeles - "the angels" - also a city in the US, the product would need to know when to say "the angels" instead of "Los Angeles" when translating to English, in other words, it needs so context-sensitive AI) So, I think that the most amount of investment would need to go into a bit of AI and translation -even though speech recognition still needs a lot of work.
  2. Bah! Teachers... I'm so glad I learned C myself.I for one completely disregard that rule. You know, looking at the code again, I think if you increased your range to say 1 to a billion, your technique would not be the most efficient anymore, but it's the best I can think of right now for low ranges.
  3. prefix changes the value of the variable before the expression is calculated, postfix changes the value of the variable after the expression is calculated. So in the example a=(++x)+(x++) with x=10, first, the value of x is incremented by the ++x. So x = 11. a = 11 + x++. The x++ increments x after the expression, so a = 11 + 11 = 22. x is now 12. Now personally, I wouldn't write code out like that unless I was in a rush, because that just confuses other people who'd read it. This type of devilish code belongs to schools and obfuscation contests.
  4. A simple idea. Replace your index++'s with index += 2 since there is no other even prime number other than 2.You're going to have to readjust your code a bit, but it should be worth the ~50% performance increase. Same thing with your boolean array you don't need to account for any even value besides two, so you couldjust have a boolean variable for 2 (or nothing, really) and just have a boolean array for odd number tests.-Btw, it's generally a good thing if you keep short code in main if you can - particularly if you're only callinga function only once, makes reading easier. Other than that, seems like nice code.
  5. Sure, no problem. In your code, you posted "cout <<" something without declaring the std (standard) namespace. Basically, you referred to something that doesn't exist all by itself in the C++ language, but rather in a standard group of functions. std - the namespace - is defined in iostream, cout is defined as part of std. So for a program, people would normally write std::cout. Now, if you wanted to write just cout, you would write "using std" before going "cout" something to tell the compiler that if something's not in the list of definitions, look in the std namespace. Normally, just posting "cout" something is fine because some compilers use std as default , but at least a few ANSI-strict compilers will have problems with that - and a lot of older compilers will have problems with that too. Also, supposing that you made another namespace - say foo for example - and you declared using foo before you declared "cout". Then instead of referring to std::cout, you'd be referring to foo:cout, which is probably not what you want. ~ It's just bad for portability and some style reasons. Tell me if that makes sense.
  6. @zamaliphe: I believe there *still* is a tutorial section of this site, why not just post this stuff there?Not everyone here is a n00b or needs to see yet another tutorial, and there's a clearly definedforum feature for it.About your code - you gave a PURE C program - for crying out loud, you gave arguments to main(),so what's with the the association with C++?@Csshih: That's technically bad code is why. You didn't declare a namespace for cout.It's a lot easier to write printf() than std::cout any day just because you don't have tostand there all day shifting to get a colon.Logically speaking, it'd still be easier to do a printf() because there's no classes toabstract around.@de4thproof: C/C++ is not the easiest language to perform web interaction in.My recommendation would be perl, but assuming you're doing things with a basis of client-serverrelationships, PHP would do really nicely too.-And a general question for everybody... why're we treating C and C++ as the same thing?They're not, they're just very well associated with each other.
  7. Pretty simple. Because bit-shifting like that and storing the extra stuff would require more computation. It's betteroff to do a cyclic shift than what you're suggesting. What I'm saying here is that any one operand instruction is too simple. You can break the stuff into legible messages faster than it'd take you to write the original message. Of course choosing one possibility out of n combinations would still be a slight problem (hence why you'd use a dictionary attack in many cases) but still quite fast. Now I'm not saying that linear bit-shifts and numerical shifts are bad. They're pretty nice actually, when they're used properly. Simple one operation encoders that can be programmed by total newbies don't count as serious stuff. I don't like to say that - nor am I trying to be condescending towards newbs, but it's what I've seen. If I were to try to make an encryption program, I'd probably use cyclic shifts (personal preference), xors, and a lookup table with prime numbers to start. There, code that properly and I'd start worrying about the security of the program when someone gets a Cray supercomputer to work on this thing and the Riemann Hypothesis has been proven. Methodwise, we know that nothing is unbreakable, but it's how long it'd take to break that matters. Since that bit shift would probably have O(n) complexity in encoding and is reversible without serious caveats (check out the last steps in the encoding of Salsa20 if you care to see examples), I'd say it'd have O(n) time to decode as well. That's low-level cryptography to me.
  8. Wait... this is encryption? I clicked on the first topic I saw without reading, read the description and thought "Oh, yet another ascii shift." Seriously, how can that even be called "encryption" anymore? At least have some xor's in there. Someone can brute-force-check an alphanumeric sequence like that with a dictionary file in a few minutes. Just by looking at the output of that you can tell it'd follow Zipf's Law. (see here) Then it'd be a matter of finding out what (sub)language the author's writing this in and then the final ascii-substitute-until-we-find-dictionary-matches algorithm. Anyway, following that logic... "Well, we all know that writing an operating system in C is not a very hard task because we can do low-level programming. Just make a kernel to handle interrupts and with a valid algorithm make sense out of them. Example: To create a simple kernel we can make a source file that has a main() function with a self-referencing goto. Or an infinite while loop. Or we can just have it display "hello world!\n" or any other random thing we can think of. I have a kernel which can do things with interrupts and make lots of different results out of them. It's at https://www.kernel.org/." ... needless to say, this post's making a strawman that doesn't really mean anything out of a very complex subject. I know it's a year old, but come on, why is this type of stuff still floating around?
  9. A high school class? Dude, don't worry. It shouldn't be that hard - though I wouldn't expect it to be easy if you're learning C/C++ (or at least, that's what I'd be assuming seeing that you posted in this forum section. Any clue what the syllabus is like? @Punisher12: I'm not too sure about that. If you're looking for a job, a B.S. or master's looks pretty nice - unless you've made a major piece of software of course. :XD: Ajax ay? You mean the web page content reload thing or some language I don't know about?
  10. Alright. ^^ Well, in case I ever need anything, I'll know who to contact :XD:
  11. @rajibbd: No problem, here to help. ^^@sonalurfrnd: Is the code still a problem or is this topic basically over...?
  12. Hey, no problem. Ok, see the beginning disclaimer statement they have? You're supposed to put printf("%s and %s converted to upper case is %s and%s\n\n",str1,str2,ConvertToUpperCase(str1),ConvertToUpperCase(str2)); as printf("%s and %s converted to upper case is %s and %s\n\n",str1,str2,ConvertToUpperCase(str1),ConvertToUpperCase(str2));[That's basically the only problem you have. Otherwise, your libraries are compiling perfectly. So make those two lines into one, recompile, and send us some feedback.
  13. Hmm... this seems like a topic I posted a long time ago - except that you actually took the time to describe what closed/open source means. Seems you're a little biased on the open source side. I am too,, but let's try to be objective. Three questions: 1) Wouldn't this go better in the debate/ideas section? 2) What do you think of non-commercial licenses or corporate products based on open-source code? 3) What happens to the millions of open source projects that get no one in them? Take a look at sourceforge and see how many projects don't even have a file out.
  14. Yeah, fork() basically is Thread - if you're talking about the public class in Java.A process and a thread are technically different things, but the words are used almost interchangably at times.Technically, you have one process running with multiple threads, but with the fork() command, the aim is tomake threads using miniature processes. Tell me if that makes sense.
  15. No problem. I think you can skip the second step now. What happened before was that the functions strncpy and strcpy were not available. They're defined in string.h (not cstring.h - that was my mistake. It's cstring.h in C++ but just string.h in C) I was thinking that whoever made the libraries forgot to include string.h - just a simple #include <string,h> would have worked. Like I said, I'm pretty sure you don't need to do that because the library seems to work fine with those functions now. Now for the third thing: Ok, the error you made was very simple - an innocent error actually. You put one line of code on two lines. You can't do that normally. Here's your code: printf("%s and %s converted to upper case is %s and%s\n\n", str1,st2,ConvertToUpperCase(str1),ConvertToUpperCase(str2)); What happens is that the compiler thinks that the second line is a different statement from the first. What you have to do is put all of that code on only one line, OR you can put a / on the last "and" in the first line to tell the compiler that your code continues to the next line. / is the continuation character when put at the end of the line. So your code should look like: printf("%s and %s converted to upper case is %s and %s\n\n", str1,st2,ConvertToUpperCase(str1),ConvertToUpperCase(str2)); or: printf("%s and %s converted to upper case is %s and \%s\n\n", str1,st2,ConvertToUpperCase(str1),ConvertToUpperCase(str2)); It looks like that should cover everything. Do tell if there are more errors, I might have missed something accidentally.
  16. @rajibbd: fork() creates a process running the program. If you had two cpu's, you'd theoretically fork a program once to have parts of it running on both. @sonalufrnd: Ok, what exactly are you trying to do? It looks like you're trying to get the result "1 1 2 2 2 2". It'd help if you could tell us what the aim of the code is. - and you're missing a semicolon on the second printf(). I'm under the impression that you need to get only the parent process to wait() otherwise all processes wil be waiting for other processes to finish that don't exist - I haven't tested the code or played with processes for a while, so I'm not exactly sure. However, if that is the case, you need to be able to distinguish the parent process from the others. This page should help a good bit.
  17. Hi. It seems your problems aren't that bad actually. (I was thinking random library-object file error when I was reading the post)Ok, I'm going by the order that the actual errors were reported in the Dev-C++ screenshot.First: I don't know why, but one of your libraries defines 'bool' a second time. Go to line 61 of genlib.h and remove the bool definitionthere. There shouldn't be too many problems coming from that one line.Second: Ok, I think you need to add cstring.h to the header since the functions that are missing are probably from there.An include <cstring> should do it.Third/Fourth: As for lines 37 and 38, you're going to have to show the source code for us to find what's wrong, but it seems youjust have an error in the test program there, probably with string format problems.If the first two don't work, go to your professor and complain that someone in the department's slacking off.
  18. Alright. What on earth are you trying to say?Anyway, isn't it common programming practice to do what you're suggesting anyway? I mean really, who actually spends time looping through a function recursively until he gets an answer instead of simply writing some code to go from (n-1) to n? Oh, and there's a name for your little technique. It's called lookup tables. Look it up.
  19. Aah... sse... I remember when sse2 came out - that thing was a lifesaver. Having three systems simultaneously doing integer calculations (mmx,sse,normal alu) at the same time was probably the best thing about the new pentium and athlon releases at the time. - and all this without 64-bit too.And St. Michael,I'm glad you did your homework on this one, but it seems that a few facts are underrepresented. Mmx boosts computational speed a LOT - but only if you're using it mainly for integer calculations. Oh, and how come 3Dnow! (trademark) wasn't mentioned in light of its own merit? It was a big step forward at the time, even if it was just an AMD thing. Plus, one could always theoretically say that you'll always get more floating-point performance on an AMD chip because of the extension.
  20. @htdefiant: You'll never need to move to Visual-C++ ever. And I mean EVER. I'm not saying this because I'm anti-Windows or anything. It's just that the Windows API functions are easily as accessible on Dev-C++. Look up NeHe's tutorials on OpenGL (google it if you need to) and under the Dev-C++ code section for the windows download to the first lesson to see what I'm talking about. Plus, if you ever want to get into low-level routines in C/C++ or optimization, I'll be more than willing to help.
  21. Ooh! C++ experience... let's see. I started when I was like 12 because I felt bored one day and picked up this book at the library.Learned the language and played around it for a few months and then dropped it because it couldn't do anything interesting at the time.Few years later, came across OpenGL and the gcc and started using it again. I've been using it for almost everything since - until I came acrossassembly of course, but that's a different story.
  22. (What am I doing up this late?)I haven't read the book yet, but I'm glad you guys choose to at least warn people before spoilers, some sites literally ambush their readers with them and the images cannot BE EXTINGUISHED!That said, what gives people the need to spoil the ending, middle, or any part of the novel before or even the day after release? There are better things to do with one's time than ruin the experience for others. What do they gain? The joy of posting? Please.Thanks again, and please, at least wait a week before discussing the details. I'd write more, but the eyes are drooping...
  23. @Tetraca: That was VERY informative. I'm going to go out now and BUY the book just so I can read ALL about it and double-check if you're right. @9block: Well, I've never thought it'd come to this, but would you say that reading Harry Potter is "gangsta" now?I didn't get to go to the long lines to buy a book, but a friend of mine's father went out and got it... and promptly told us bits and pieces of information about the plot.I didn't know it gets so extreme that people dress up as if they're going to a movie release... and apparently a bunch of cities transform a street into diagon alley. I'm going to miss these little fests later on.
  24. Alright, for a few weeks I've been wondering about this. I'm a newbie when it comesto database languages. What's so special about the SQL family of languages thatmost people use it? Would there be any real difference if I made an SQL databasewith entries or if I setup a perl script - or any other web language - to do the same thing using plain text/binary files?
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.