Rashakil Fol 978 Super Senior Demiposter Team Colleague

Basically anything would be faster.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Uh, write the code in a file? And then load the file.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I doubt it, but I don't have a convincing proof on hand.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Use gcc for the compiler, use whatever editor (Emacs or vim) for the editor. Anjuta looks good but it's unnecessary.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Here's one: "Sperm Whale Song Analysis"

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Just rewrite that section of the program. It's only a couple hundred lines of code.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I think the idiot button would be preferable, especially if it sent the user a PM telling them that somebody (who gets to remain anonymous) marked them as an idiot, every time somebody does. Then, for users who have been marked as an idiot by 5 or more people, the next time they visit the site, they get goatsed.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Semantic quibbles are silly.

No, when you say wrong things, like "you don't give the certificate," then you're wrong. Deal with it. Making secure systems is hard enough without people wantonly guessing the meaning of terminology.

You give a public key that is associated with your private key. Who holds the private key is relevant only as to trust issues (it should be the sender or someone the sender fully trusts). How the receiver gets the public key is relevant to trust, but otherwise unimportant. Whether the whole message is encrypted or only a "signature" part is irrelevant.

It is relevant, because then you're doing different things. If you encrypt the message, then the message is secret. If you don't, then the message is not secret. What does that have to do with authentication? Nothing. Authentication is a different idea than encryption, and needs to be identified as such.

To be more specific: If the whole document is not encrypted, then the signature has to be "locked" by the private key and by the contents of the message. "Unlocking" the signature then verifies that the private key was owned by the actual sender and that the message has not been altered during its journey. If the whole document is encrypted, then the fact that the public key decrypts it is proof of both the sender's bona fides and that the message has been unaltered.

Nope. This is wrong, and it's talking about stuff that doesn't happen. One does …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

If you got a programming job in the Army, what are your chance of getting a programming job that pays about 30k? 40k? 50k? or more?

Huh? Ask the Army how much they pay. If you got a programming job for 50k you'd be getting ripped off, at 30k you'd be getting really ripped off.

If you majored in a liberal arts major and then took a few programming courses in a prestigious university like University of Michigan - Ann Arbor, what is the chance of you getting a programming / software engineering job that pays 50k? (or more)

If I majored in a liberal arts major at Ann Arbor and took a few programming classes, I'd have no problem getting a development job that pays well more than 50k. But you? I have no idea. It depends on how smart you are.

Is it true that in programming job / SEng job you don't actually work 8 hours, but more like 6 hours and 2 hours of socializing?

No, it's more like you work 2 hours and spend 6 thinking about working.

If you just graduate with a liberal arts degree from a prestigious University like UMich without any programming classes, can you teach yourself programming and get certification online that you know how to program and then get hired to about 50k jobs?

Certifications are worthless and if you get them you'll only market yourself to worthless employers. Proving you know how to program is …

Ezzaral commented: Good points. +13
Rashakil Fol 978 Super Senior Demiposter Team Colleague

This is an excellent example of the retardedness and overcategorization of design patterns.

The "builder" is just a function.

The "director" is the thing that uses that function.

So this "design pattern" is just fancy way of describing one particular case where you use the behavior of one function to parameterize the behavior of another function. Big deal.

> Then why the need for an extra layer of complexity? So construct method could be moved from cook (director) into PizzaBuilder.

You could. And that would also be the right thing to do in this case.

You have to understand that the people who write design patterns articles on Wikipedia aren't the brightest people in the world.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Sure. Since your language's orthography apparently uses digits for any homonymous syllable, just use

(std::stringstream() << n).str()
Rashakil Fol 978 Super Senior Demiposter Team Colleague

If you're a fan of it, you should know more about it than us.

jonsca commented: Nice one +4
Rashakil Fol 978 Super Senior Demiposter Team Colleague

How about a cryptographically secure assassination market?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Then why do we use words like "for", "while", "if", "then", etc.? Might as well use "f", "w", "i", "t", etc. And why use infix notation?

"Natural language" doesn't mean using mathematical notation. Applying unique, memorable names to things is not the same thing as natural language, either. For example, sin^2(x) isn't natural language, and neither would be sine^2(x). If you've ever found yourself stumbling over saying "the expression <blah>" or "parenthesis <blah> end parenthesis" in an effort to be clear, you can see how mathematical notation is superior to natural language (for certain things). I don't think anybody would argue that "sum . map (** 3.0) $ [1..100]" is natural language, either, or that the uses of infix operators in that expression has anything to do with natural language. The dollar sign operator isn't even verbally pronounced.

Nor is the use of "if" or "for" or "let" or "function" in programming languages an example of natural language. They are memorable keywords used in various languages because it's common practice to let "if" be used for conditionals, "for" to be used for linear iteration, "let" to be used for declaring variables, and maybe "function" as a keyword used in function declaration syntax. When there is a line-up with natural language, it's more of a pun. "unless (x < 3) { ... }" is cute, but it's just cute. There's a reason why programmers who don't speak English as a first language end up using these keywords without problems, …

Bench commented: Excellent argument +5
jonsca commented: Excellent post +4
Rashakil Fol 978 Super Senior Demiposter Team Colleague

I just don't want to be limited by the pre-defined types.

You can define your own types easily enough, no?

For example, I want to make a 1kb integer or one that is dynamic and has no limits.

You're contradicting yourself. A 1kB integer has limits. An integer that is dynamic and has no limits won't always be 1kB.

And this (an integer type with no limits) is easy enough to implement in C# or C++, and you don't even have to use pointers. Here are some straightforward skeletons -- adding signedness and other operators, and fixing whatever bugs accidentally left in this code, are left as an exercise to the reader.

C#:

class BigInt {
  UInt32[] data;

  private BigInt(UInt32[] data) {
    this.data = data;
  }

  public BigInt(UInt32 x) {
    data = new UInt32[] { x };
  }

  public static BigInt operator+(BigInt x, BigInt y) {
    int xn = Length(x.data);
    int yn = Length(y.data);
    int n = xn < yn ? yn + 1 : xn + 1;
    UInt32[] ret = new UInt32[n];
    bool carry = false;
    for (int i = 0; i < n; ++i) {
      UInt32 xd = i < xn ? x.data[i] : 0;
      UInt32 yd = i < yn ? y.data[i] : 0;
      UInt32 xd_yd = xd + yd;
      UInt32 s = xd_yd + (carry ? 1 : 0);
      ret[i] = s;
      carry = (xd_yd < xd || s < xd_yd);
    }
    return new BigInt(ret);
  }

  public static BigInt operator*(BigInt x, BigInt …
Rashakil Fol 978 Super Senior Demiposter Team Colleague

You didn't understand what I was saying. Read it again.

iamthwee commented: yes +11
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Database administration seems well defined to me.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Why would employers care? It's not like they're going to ask you for your transcript.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

An example:
I made a replied to a post in the C++ forum and let the OP know that the reason for their error was that the variable they were trying to use (and was coming up with a random number) was uninitialized and/or unassigned. The next reply was "I'm not sure I understand what you mean exactly." Now, that could have been because I didn't delve deeply into the post, just let them know that an uninitialized variable is filled with junk and needs to be initialized or assigned before it can really be used.

DaniWeb and similar sites get a biased sample of students, attracting an excess of troglodytes who can't figure things out for themselves or learn things on their own. The idea of looking up a term on Google or the very technique of formulating a Google search is beyond their skill set. You would expect any reasonably intelligent person to be able to understand any subject just by reading a book or a jumping through a nest of Wikipedia articles about the subject, and by thinking and rereading when necessary, but apparently some people are incapable of manipulating logical thoughts and instead learn how to do things through repeated exposure and pattern-matching and having somebody tell them what to do. These students, unless cured of their problem, tend to do poorly at computer science, and would do poorly at math, except that math teachers have designed their courses and tests in a way that …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Just compute the following integral.

[tex]\int_0^n \int_0^{i^2} \int_0^j 1 dk dj di[/tex]

mrnutty commented: Cool +5
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Not stupid ... Just less informed than you

No, it's really a question of stupidity, because you'd have to have a seriously questionable understanding of what you can do with computation if you have to wonder whether programs could take input in other languages.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

-2 Rep lotrgandalf. Why are you talking about repping?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Two wrong answers, we have here.

Nick Evan commented: O god, you're right. I misread the original post :( +12
kvprajapati commented: N/A +9
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Hello all, my name is Corey, I am new to DaniWeb, and new to programming. I am very interested in software and java programming, to eventually make it into my profession. I am starting college in the Fall, and want to get a head start.

The best way to get a head start is to go to http://docs.python.org/tutorial/ and start programming.

My first question is: How is video game programming different from other types of programming? Are there certain elements of programming that I would need to learn that would not already be involved in regular programming courses at colleges?

Yes. Program some video games, and you'll find out what you need to learn. Generally speaking, programming is not something a class will teach you. It's not like you can go to a class and get taught how to program. You might go to a class, but you'll end up being the one teaching yourself how to code.

My second question is: Where should I get started? What language should I learn first, or are there multiple languages I should start with?

Okay, I just answered that above.

Good starting points in general for someone who wishes to become a software engineer.

Programming. The only way to get decent at programming is by doing it. The only way to get good is by doing it. Start now. Go to http://docs.python.org/tutorial/ and download Python and start programming.

Good literature for purchase on these …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

>> This is complete nonsense. You can't say "O(log(n)) < f(n)".

Why not ? Why can't a function be bounded by another function.

Functions can be bounded by other functions, but there's no way to make sense of the notation you're using.

For starters, you never really defined what O(...) < f(n) means. You're just throwing notation around. It would be fine if the meaning of the notation could be inferred, but here it can't be. Does, in your example, the statement "O(log(n)) < f(n)" mean that f(n) is "not" O(log(n))? Or does it mean that f(n) is omega(log(n))? That's lowercase omega. Or does it mean that f(n) is not O(log(n)) and is Omega(log(n))? There's no natural way to interpret that notation. There is with "f(n) <= O(n)", though. It clearly means that f(n) is O(n), and can also be written "f(n) = O(n)". There's no other meaning it could have.

If you want to say that f(n) grows no faster than n and no slower than log(n), one way to say that would be to say, "f(n) is O(n) and Omega(log(n))." Another way _might_ be to say "Omega(log(n)) <= f(n) <= O(n)". You could also say "Theta(log(n)) <= f(n) <= Theta(n)" and that would be understandable, because there's no way to misinterpret that statement. To say something is "less than or equal to" a Theta notation expression can only imply the meaning of O notation. People usually don't say things like that, because it's gross, and because …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You are trying to measure BigO(), Big ) measures the growth rate of an algorithm. For example say there is a function f(n) , and that it follows the following inequality :

O( log(n) ) < f(n) < O(n)

the above inequality says that the function f(n) is bounded on top by
O(n), that means its worst performance is O(n). That O(n) is bigO(n).

This is complete nonsense. You can't say "O(log(n)) < f(n)". That doesn't make any sense. It only makes sense to say that functions are less than or equal to big O bloboids, such as the statement, "f(n) <= O(log(n))".

def is_bst(root):
    
    a = b = True
    
    if not(root.left or root.right):
        return True
    
    if root.left:
        a = root.left.data < root.data and is_bst(root.left)
        
    if root.right:
        b = root.right.data > root.data and is_bst(root.right)
        
    return a and b

This algorithm is incorrect, by the way.

Its respect to the number n. Which is the size of the function.

Wat. No it's not.

thanks, I understand big-O (I've seen it used in math), but I don't understand the actual analysis of "growth rate". What is the growth rate with respect to?

The running time of the function is described with respect to some measurement of the "size" of the input. Often the measurement is the number of elements in the data structure, or the amount of memory used, or something with multiple variables. For example, a function that counts the number of spaces in a string …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Delete it.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You can make games in C#, you can make web applications in C#, and you can make desktop apps in C#, so just go with C#.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Um, iPad applications can do multi-threading. You don't know the difference between threads and processes, do you.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Hi I am ravi, this is my first personal interview in my career. Please comment me over my answers and my way of answering:)

No, I'm going to make some general commentary about society and seem really obnoxious but that's just the effect of stupidity rubbing off on me.

Q: Tell about yourself?
Me: I am N.Ravikumar coming from Unjapalayam; I am pursuing my B.Sc Information Technology degree in Dr.NGP Arts and Science College. I love programming and blogging.

Okay.

Q: what are the different stages in SDLC?
Me: Requirement Analysis -> Design -> coding -> Testing -> Implementation and Maintenance

What? WTF is SDLC? Is that some Indian codeword that they teach? Oh, it means Software Development Lifecycle. And your answer's wrong because there are plenty of different approaches to the question of how to develop software. It seems like you're describing the waterfall model, which is the worst one. I can't understand how an education system could churn out people who give such answers. And why would anybody even ask such a braindead question? It's not as if a candidate is going to have trouble adapting to whatever some particular company does for its development process.

Q: what are the advantages of C++ over C?
Me: C++ is an Object Oriented Programming Language while C is a Procedure oriented language
Q: Other than that?
Me: Sorry madam, I don’t know.

You didn't answer the question, you completely fail. You didn't even try …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

If they're separate questions then each question has infinitely many solutions. And it should be pretty obvious, if you know the basics of [s]algebra[/s] obviosity.

iamthwee commented: Just the right amount of help and not too much. +11
Rashakil Fol 978 Super Senior Demiposter Team Colleague

The question isn't really between Java and C#. It's between Java, Scala, C#, F#, and some others. The answer is Scala, which compiles to the JVM.

From a purely Java vs. C# language perspective, you would generally prefer to use C# because it has anonymous functions, using blocks, a reasonable collections library (in System.Linq), and no weird special cases for primitive types. However, Scala exists, and the Scala language is better than the C# language, and you should always use it in place of Java. That's assuming you aren't interested in using the .NET API. If you wanted to write a native Windows application, well, you might want C# then. From a multiprocessing/etc perspective they're both similar, but if you _really_ want to scale up you don't want to have to worry about getting a zillion Windows licenses and such, so the JVM rules there :P

I have never looked at performance information, but the general resonance I get from the Internet is that the JVM is faster and better than the .NET vm.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

If a + b = 23 and a^b = 16, well, you know that a = 23 - b, which means (23 - b) ^ b = 16.

So here's what you should do. Write (23 - b) ^ b - 16 = 0, and then use Newton's method to find the zero of that equation. You know how to differentiate (23 - b) ^ b, right? Haha, that's one of the harder ones. Good luck.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

All countries allow the brutal slaughter of animals, some just don't allow humans to do it, and it has nothing to do with improving the general animal condition and has everything to do with hating on sociopathic humans.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I recommend translating this problem.

How many integral solutions exist for y1 + y2 + ... + y100 = 5050, where each yi > -1?

You can see that these map to solutions to your equation by letting xi = yi - (i - 1).

The resulting equation is a simple combinatorial problem, if you look at it the right way.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

In some sense, the problem is impossible. Simply indexing an array takes O(log(n)) time. The reason is that the number of bits needed to describe the index is log_2(n). Of course, processors operate with bitstrings in chunks of 32 or 64 at a time, so we like to pretend that array indices are magic values that can be used in O(1) time. It's sensible, from a machine performance standpoint, to treat them as such.

The thing is that when we uncover problems such as the one we now face, the obvious solutions invariably produce real logarithmic time performance for lookup and setting operations. We could make a side-array of bits that describes whether a given element in the main array is initialized. Of course we'll need a side-side-array of bits to describe which chunks of bits in that side-array are initialized. And so on. This tower of side-arrays invariably has size O(log(n)), and the actual logarithmic constant depends on how many bits we chunk together.

We might decide that our main array is an array of n 32-bit integers. Then we have a side-array with n bits, each bit telling whether a given element of the main array is initialized. Then we have a side-side-array with n/32 bits, each bit telling whether a given block of 32 bits in the side-array has been initialized. (We initialize the whole block in the side-array to zero the first time we try to touch it.) Then we have a side-side-side-array with …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I can agree that any book by Strang is good, but I don't think a linear algebra book is the right choice. I say this because I actually had one before going to college -- it was similar in scope to your recommendation, and it didn't serve me very well.

The book I'm dreaming of should be (relatively) easy to understand and provide enough information to give me some idea of what will hit me when I finally head off to Uni.

I'm assuming you're a CS major or something like it. I dual majored in CS and Math.

First of all, you should recognize that you'll be fine. You don't need any preparation for the mathematics you'll use in computer science. The only piece of math that's really really necessary for undergraduate computer science, other than basic algebra, is an understanding of modular arithmetic and an understanding of big O notation, and they're not prerequisites -- you'll be taught about both when you need them.* I still recommend being comfortable with modular arithmetic now, though, because that's just a natural life skill people should have.

I recommend Reading, Writing, and Proving. It's actually designed for math majors, not CS majors, for a sort of "introduction to proofs" class. It's not a book with a bunch of math facts or what not, it's a book about thinking rigorously. I think it's the most relevant boost in mathematical ability that a future computer science student can …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Think I'll just stick to the complex fantasy worlds and intertwining storylines of most modern video games, than be subjected to 2.7 hours of some hack movie.

Agghhh this is James Cameron's first movie in over a decade, Ebert gave it four stars, some folks old enough to have seen Star Wars are reporting being blown away even moreso than Star Wars, and you're calling it a hack movie without having seen it? I'm surprised -- none of your previous posts have ever reached these extremes of mental illness.

iamthwee commented: Nice recommendation. +0
Rashakil Fol 978 Super Senior Demiposter Team Colleague

So, Avatar is an awesome movie. You need to see it in 3D. It is mandatory.

ahihihi... commented: yeahah +0
maydhyam commented: The plot was pointless...the graphics on the other hand was excellent! +0
Rashakil Fol 978 Super Senior Demiposter Team Colleague

The US Congress has already tried this with stuff like the CDA and COPA and both times got shot down by the Supreme Court.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Well, the exact same thing happened with normal rep before (cough rashkil, cough). Its a bot targeting me, ad and happygeek. Its under staff discussion.

Well you better do something about it. It wouldn't be fair to stop me after 3 hours, when it was funny, but let these doodooheads go on for weeks and weeks.

sknake commented: I still don't like you .. but this is too funny. +1 +0
Rashakil Fol 978 Super Senior Demiposter Team Colleague

For example, suppose you have a function

int f(int n) {
  if (n == 0) {
      return 1;
  }
  else {
      return n * f(n-1);
  }
}

We want to measure its cost. But before we do so, we'll say that its cost is O(t(n)) so that we can use it in the formula.

if (n == 0) { // O(1) conditional test
      // O(1)
  }
  else {
      // O(1) + t(n-1)
      return n * f(n-1);
  }

So t(0) = O(1) and t(n) = O(1) + t(n-1)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Hey, you're right, it is easy for me.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Let's look at this one. I'm going to ignore the swap for now.
Iteration2:

public static long dominoes(long x, long y){
		long temp;
		double koeficient = 0, faktor;
		for(long i=0; i<=x+y; i++){
			koeficient = 1;
			for(int j=1; j<y+1; j++){
				faktor = ((double)((i+1)-j)) / (double)j;
				faktor = koeficient * faktor;
				koeficient = faktor;
			}
		}	
		return (long)koeficient;
	}

Let's add annotations, giving the cost of each line.

public static long dominoes(long x, long y){
		long temp; // O(1)
		double koeficient = 0, faktor; // O(1)
		for(long i=0; i<=x+y; i++){
			// an O(1) cost for (i <= x+y) and (i++)
			koeficient = 1; // O(1)
			for(int j=1; j<y+1; j++){
				// an O(1) cost for (j < y+1) and (j++)
				faktor = ((double)((i+1)-j)) / (double)j; // O(1)
				faktor = koeficient * faktor; // O(1)
				koeficient = faktor; // O(1)
			}
		}	
		return (long)koeficient; // O(1)
	}

When we have successive statements with cost O(x) and O(y), their combined cost is O(x + y). Let's first remove the pieces of code that we've accounted for.

public static long dominoes(long x, long y){
		// O(1)
		// O(1)
		for(long i=0; i<=x+y; i++){
			// O(1)
			// O(1)
			for(int j=1; j<y+1; j++){
				// O(1)
				// O(1)
				// O(1)
				// O(1)
			}
		}	
		return; // O(1)
	}

You'll note that the lines of code don't modify i or j. If there was some line that said "i = i * i", we wouldn't want to delete that because it would affect the number of iterations of …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I suspect if this were looked in to you would find Rashakil Fol behind it.

That's just crazytalk.

See you on IRC.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I also forgot to ask before... What is the time complexity of BigInteger (in Java)?

Addition is O(n) where n is the number of bits in the BigInteger, and multiplication depends on the algorithm used: http://en.wikipedia.org/wiki/Multiplication_algorithm . That depends on the Java implementation. I don't know about division.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Well, I like it. In particular, slices, rather than pointer arithmetic, is simply The Right Thing.

I have been looking for a good safe systems programming language, and it seems like garbage collection is the practical thing to do. The other option is Cyclone, which I don't like.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Actually, at the risk of sounding whiny, I retract my statement. But I still believe that new members misuse the down vote system to "spite vote"

I just automatically downvote every one of your posts. It's like when a girl punches you -- it means she loves you. Except I'm not a girl. And I don't love you. You're the closest thing to serkan we've got, though. Well, sknake is closer, I suppose... the names are practically anagrams. I'll tell you what -- I'll downvote all of sknake's posts I see, instead.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

First, start working on it. Then, after you've shown some progress, you'll have an easier time convincing somebody to help you.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

this is stupid... :(

yeah

why did i pay for this? :(

Why would you pay for something stupid? Maybe you are stupid :P