Rashakil Fol 978 Super Senior Demiposter Team Colleague

A handle is as far as I know an address to an address or if you like a pointer to a pointer.

What are you talking about.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

What is your definition of "object"? Things are what things are.

In .NET 2.0, arrays, in particular, are essentially full-blooded objects in the way that List<T>s are full-blooded objects. They have some weird constructor syntax (with initializer lists and new string[n] syntax) but they are the same kind of thing.

Really, you could say (1) that arrays have weird constructor syntax, and (2) that other types have a different weird constructor syntax

In pre-2.0 versions of .NET, arrays were special because they were parameterized on the type they held.

You can't inherit from arrays, but you can't inherit from any other sealed class anyway.

There are basically two kinds of types in C#: reference types and value types. Reference types can be null and you work with them by copying references to some (possibly mutable) object. Value types cannot be null and their values are immutable in the way that strings are immutable.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

First of all, Narue's definitions are BS. (What the fuck is a "full" inheritance hierarchy?)

Second, mutators are almost always a sign of design problems, unless your problem provably requires mutators, but getters aren't. Well, if you have mutators that aren't provably necessary, it's evidence that there's a "better" design (one which involves completely immutable objects, for some definition of the term), but it doesn't mean yours is terrible. Of course, considering the low-level nature of C++, I'd say this paragraph really applies more to high level languages like C# or low-level languages like Java.

Third, it's perfectly fine to return a reference and modify it, instead of having methods named 'setFoo' -- if you ever need to change your mind about that design decision, you can change the interface later and then get a bunch of compiler errors, and update the code that corresponds to each compiler error accordingly. On the other hand, using explicit functions like getFoo and setFoo might require less work for small changes.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

It doesn't have data in it. What makes you say it has data in it? If it had data in it, the exception wouldn't be thrown.

I don't see any place in your code where you check to see if the stack has data in it.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The main problem is that all your code is in one function, making it difficult to reason about. You need to design your code around the limitations of your brain.

Also, you end up with an empty stack because you never check if your stack is empty.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Why should I?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

And... how do you plan to make money....

Rashakil Fol 978 Super Senior Demiposter Team Colleague
Rashakil Fol 978 Super Senior Demiposter Team Colleague

You should follow scru's advice and use a List<T> if you want to have a resizable container.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

userChoice<B> = chosenClass; use of object without instantiation

More like, syntax error.

FallenPaladin why don't you paste some representative code to show exactly the kind of thing you're trying to do?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Why the hell are you writing "two = 2.0"? That's retarded.

The problem with your code should be obvious if you stepped through the calculations by hand.

iamthwee commented: two? I see tow = 2.0, next time please be more careful honey! -4
Rashakil Fol 978 Super Senior Demiposter Team Colleague

That doesn't seem _crazy_ to me. If you ask me, technically speaking, version numbers should correspond to the structure of your branches in version control. I don't know what "build numbers" refers to, but if the build number corresponds to version control, it's a reasonable system.

For example, at my workplace, we have "version numbers" which are really just names for release branches, like 3.0, 3.5.m1, 3.6. We identify a particular build with a version number plus an incremented build number, so the build will be known as something like 3.0-build05.

With that, it's trivial to see which revision corresponds to a given build, because it's a tag in the version control system.

The rationale involving updating the installer really is a sign of incompetence though. He's worried about changing strings in an installer? Are you not automatically generating those strings? That's retarded. If your manager can't grasp the concept of basic build scripts for stuff like that, there might be other mental problems. Where do your build numbers come from? Surely you can configure an installer with the same information.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Use C#, not Java. Java is the worst language in popular use, besides C++.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Visual C++ 6 is extremely out of date; I was talking about the 2008 version.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Then don't use it. Use Microsoft Visual C++ Express.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

F - Other - Please specify.
Thanks!

Start with Malbolge and then move on to Brainfuck.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I think it's kind of funny that way.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

only problem with this teach a man to fish deal you have running is that not everyone has Visual Studio, some people are compiling using free software with no help files, and online help from Microsoft is practically Japanese to a weekend programmer.

Visual C# Express is free.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

1. The typical practice is to store the password in plaintext. And this is okay, frequently.

1a. Store the password in plaintext on a usb drive.

2. A better practice is to store the password encrypted and have the encryption key hardcoded into the application -- this is not cryptographically secure by any means, but it would stop unknowledgeable disgruntled employees, which are the primary threat. It's better than 1a because somebody who copies your hard drive needs a short amount of time to get the true password, which might give you a chance to react.

2a. Store the encrypted password on a usb drive.
2b. Store the encrypted password on a network drive.

With 2a and 2b, somebody who gets access to backup tapes will not be able to see your password. 2a has the advantage of not relying on the accessibility of some thing on the network.

3. An even better practice is to store the encryption key locally and store the encrypted password on a network drive that lives far away. Use the password to login and clear it from memory. That way, somebody who steals or sniffs backup tapes for one of the drives doesn't have the means to acquire the password.

4. Alternately, you could have a human type in the password whenever the program starts, or a password from which an encryption key used in #2 or #3 is used.

5. Whatever you do, don't rely …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Yawn.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

What part do you need help with?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Your database API should have support for transactions; if you put your set of database actions in a transaction, it will see a consistent view of the database -- it will never put the database in some unpredictable state. You should want your transactions to be as short in time duration as possible.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Certifications and experience are the key

Certifications? If you want to be a certified moron. A BS in Comp Sci is more than enough certification unless you got it from Bob Jones University.

DavidT, if I received your resume, what would make me want to hire you?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

An actual GUI.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Why would they be equal? You would only expect them to be equal if k is 1.0.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

If you have a bunch of processes or threads reading from a table without modifying the table, in a way that affects the others' results, you won't have any problems.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You can probably find references by searching for them on a search engine.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Have you ever used Scheme or Haskell in a commercial application, or have you used them primarily in an educational setting?

And that doesn't matter. If you want better code writing techniques in languages like C#, the easiest and best way is to learn Haskell.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Have you ever used Scheme or Haskell in a commercial application, or have you used them primarily in an educational setting?

Yes.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Learn Scheme, C++, Haskell, and C#. That will take some time. You have to actually do projects in them, of course.

The languages you've listed, and most other languages, are not worth learning if you have those four and are interested in generally improving your coding ability, but they may be worth learning because they're nice languages to know and to be able to use. (For example, I never use Scheme and frequently use Perl, and would use Python or Ruby instead of Scheme, too, but I have to recommend Scheme for pedagogical purposes.)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

3 and 2 are integers (in C++, they have the 'int' type), so the division sign in 3/2 refers to integer division, which produces an int return value, which must be truncated. If you write 3.0/2 or 3/2.0, one of the values will be a double, thus forcing the other value to autoconvert to a double. Then you'll get floating point division, which will give you 1.5, or an approximation of 1.5.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

This is the most retarded thread I have ever read.

Ezzaral commented: Nailed it on the head. +16
Rashakil Fol 978 Super Senior Demiposter Team Colleague

I don't think anybody has done that.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

how thats really complicated. I 'm only a beginner. maybe this problem in project euler is not for me.
Thanks for your help

He made it waaay unnecessarily complicated.

#include <iostream>
#include <vector>

std::vector<int> mulTwo(const std::vector<int>& v) {
  std::vector<int> builder;
  int carry = 0;
  for (int i = 0; i < v.size(); ++i) {
    int s = v[i] * 2 + carry;
    carry = (s >= 10);
    builder.push_back(s[i] - 10 * carry)
  }
  if (carry)
    builder.push_back(1);
  return builder;
}

int sum(const std::vector<int>& v) {
  int sum = 0;
  for (int i = 0; i < v.size(); ++i)
    sum += v[i];
  return sum;
}

int main() {
  std::vector<int> n(1, 1);
  for (int i = 0; i < 1000; ++i) {
    n = mulTwo(n);
  }
  std::cout << sum(n);
}
iamthwee commented: exceeeeeeeeelent +17
Rashakil Fol 978 Super Senior Demiposter Team Colleague

First of all, if I'm not mistaken, your macro is wrong: the string "x" will not get replaced. You need to use some weird escaping thing to concatenate strings or something, like "##x##" . Maybe your version is fine; I don't know.

Second, the macro is incorrectly named, and it's named like a function would be named. A more reasonable name would be something like CRAZY_UNSAFE_DANGER_DANGER_SET_MEMBER_IF_attrName_EQUALS_TOKEN(name)

Second, I see no reason to believe this claim:

I need to make a string at compile time you see:

We can't actually discuss avoiding this macro without discussing what caused you want to use this preprocessing directive.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

That macro is fucking retarded. Use a function.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You shouldn't think about the average pay level, you should think about what you'll be paid.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The dot product of two vectors is equal to the cosine of the angle between them divided by the vectors' magnitudes. For example:

The dot product of <1, 2> and <3, 4> is 1*3 + 2*4, i.e. 11. The magnitudes of the vectors are sqrt(1*1+2*2) and sqrt(3*3+4*4), i.e. sqrt(5) and sqrt(25).

So the cosine of the angle between the vectors is 11 / (sqrt(5)*sqrt(25)), i.e. 11 / (sqrt(5) * 5).

If we take the arccosine of that value, we get the angle:

acos(11/(sqrt(5)*5)).

So in general, the angle between two vectors u and v is

acos(dot(u, v) / sqrt(dot(u, u) * dot(v, v))),

where dot is the dot product function.

(It happens that the magnitude of a vector v can be written as sqrt(dot(v, v)).)

And if you haven't figured it out, the dot product of two vectors is the sum of the products of their constituent parts: <x,y,z> `dot` <x', y', z'> = x*x' + y*y' + z*z'. This works for any number of dimensions.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Just write some code that does the algorithm you want, there's no "effective" solution.

I'm sure there's some matrix slicing functions you could use; Matlab does those faster than its interpreted language.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

A way to make this really easy is to get the GMP library (it comes with C++ bindings, right?) and use that.

It's silly to output the number to a file and then read the file back in.
Since you don't have enough precision in the built in numerical types, you need to use your own representation. One option is to represent numbers using a std::string.

It's fairly simple to write an algorithm that multiplies a std::string decimal representation by two, taking something like "54321" and returning "09642".

Rashakil Fol 978 Super Senior Demiposter Team Colleague

F(N) = O(G(N)) reads that F of N is Big O of G of N

That's not a "solid definition", that's a description of how you read the notation out loud.

F(N) = O(G(N)) if there exist two constants c and k such that F(N) <= cG(N) for all n >=k

Now that's a solid definition. It means what it says: There are two numbers c and k, where it's true that if n >= k, then F(n) <= c*G(n).

Let's see how we might come up with this definition.

Suppose we want to have a few rules to follow whereby we can say that the function "g" is no bigger than the function "f". We could go with the following:

> "g <= f provided that for all real numbers x, |g(x)| <= |f(x)|"

Now, the trouble with that definition, practically speaking, is that most typical functions are then incomparable. There are places where |x^2| is greater than |x| and places where |x^2| is less than |x|. Also, it isn't useful at all to say that the function x -> 3x is any bigger than the function x -> 2x. These two functions are separated by a constant multiple, and that could be an artifact of how the code is written and what our definition of a "single instruction" is -- a constant factor can be corrected by getting hardware that's slightly faster, or a compiler that's slightly better. The important part is that …

darkagn commented: Excellent description +3
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Don't listen to jbennet's nonsense. Top schools' admissions departments do their admissions in ignorance of students' need for financial aid, although some schools don't offer financial aid to international students. A few schools consider it a slight plus if your relatives have attended (e.g. Harvard, UPenn), while other schools are highly meritocratic (e.g. MIT, Caltech, any state schools, ...), but in cases where it is considered, it provides some students a plus -- it's not "key" at all.

If you want information on a particular university's admissions process, you need to look at that university's website and read the instructions. There is no standard USA admissions process, though I think a "common application" has recently become popular.

At least for American students, the application procedure is to take the SAT and some SAT II subject tests, and to fill out an application form and mail it in. Some schools have an optional interview process.

And your grades matter, but there are zillions of students out there who have good grades.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You haven't even told us what processor this is for.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Actually it's impossible, if you're using integers, because the size of the solution is n*log_2(x) + O(1).

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You can't use commas that way. You want to write again == 'Y' || again == 'y' .

The comma operator behaves in the following way. The left side of the comma operator is evaluated first, and then the right side is evaluated, and the expression's return value will be the right side. For example, the expression 2, 3 will evaluate to 3 .

You should basically never use the comma operator for this purpose, but there are some interesting idioms found in some libraries where the operator is overloaded to have a different meaning.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Sort them by the kind of terms they have, and then group the similar terms together.

Alternately, don't use letters at all in your representation of polynomials -- but this only works if you limit yourself to polynomials of a single variable.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

If you want to know what the algorithm is, read the whole paper.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

This is a complete waste of your time.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I'm pretty sure you want something that works like the following:

(transform '(+ - + - / + - + - + + + / + + + - - - / + + + - - - - +))

It would make no sense to make transform into a macro.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I'll post an example of what I would consider to be a more comfortable C++ parser generator at this level of scope later tonight.

Er, tomorrow night.