Rashakil Fol 978 Super Senior Demiposter Team Colleague

...

Rashakil Fol 978 Super Senior Demiposter Team Colleague

s += String.Format("{0:F2} ", num1);
s += String.Format("{0:F3}", num2);

Ruh roh, you forgot to use code tags!

But seriously in that contrived case you'd just write string s = String.Format("{0:F2} {1:F3}", num1, num2);

Rashakil Fol 978 Super Senior Demiposter Team Colleague

String.Format?

string s = String.Format("{0:F2}", num);
Rashakil Fol 978 Super Senior Demiposter Team Colleague

In your main function, pContext is NULL.

And use code tags please.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

This isn't really a databases question; this is a "I can't do even the simplest of programming" problem.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

This might not seem serious but if the array was String it would null. So next time, you don't just create the array, you put values in it as well

Um, no, the problem here was not how the array was initialized with default values.

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

Well I don't know about you, but I was just being short-fused. And i don't really care.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Anyway, your first example (where A gets assigned 54) is perfectly right.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

When you store something in B, that means the predefined value will be overwritten.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You initialized the variable 'lowest' with the value of numbers[0]. Note that numbers[0] contains 0 at that point in time. See your problem?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

honeybits already failed the assignment. Asking for information on what went wrong is an appropriate reaction from someone that is interested in learning.

You should be a bit more paranoid. People come up with all sorts of stories to explain how their assignment isn't a homework assignment, in hopes of getting better help, or just in getting the answer. There's no way to tell whether that's the case here or not.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

In your code sample, g1 and g2 are local variables in the Main function. They cannot be seen anywhere outside the main function. Since you're trying to use a variable named g1 in GoodMorning, you're getting an error.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Your function Goodmorning is referring to some variable g1, and there is no variable named g1 in its scope. Learn how scope works in C# and you'll understand your problem.

Edit: And I'm assuming all the typos happened because you typed this manually, and you're not actually having problems caused by extra spaces and incorrect capitalization.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You can test your own code by providing multiple example inputs and seeing what the output is.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Presumably he has random access to the list; otherwise this problem would be impossible.

The answer is pretty simple, and we're not just going to give you the answer.

Here's a hint though: There obviously must be some way to find a value _greater_ than the one you're searching for, in O(log n) time.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Your function is static but it's referring to variables that are part of instances.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Well here's another hint. In general, recursive functions on lists follow the form

f(nil) = baseCase
f(h :: t) = g(h, f(t))

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Look at your examples in class or your textbook, it should follow the same pattern...

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Yes. Never override any implementation with a different implementation. Only override pure virtual functions. Use composition to parameterize your instances instead of using inheritance -- "never" use protected virtual functions, overriding them in subclasses, to parameterize a class's behavior. Instead, make a separate datatype that performs the method's computation and pass it in as a parameter.

You should never be making "heavy" use of inheritance. (But I'm not sure what your standards of "heavy" are.)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Do you understand what recursive definitions are? The recursive definitions for 2 and 3 should come quite naturally.

1. Construct a recursive definition , where all variables are natural numbers.

f(n, k) = k + (k + 1) + (k + 2) + ... + (k + n).

Hint: f(n, k) = [k + (k + 1) + (k + 2) + ... + (k + (n - 1))] + (k + n)

2. Construct a recursive function definition for the following string functions for strings over the alphabet {a, b}.

f(x) = x, y, where y is the reverse of x.

Devise any means to break the string into substrings, and the recursion should be the obvious.

3. Construct a recursive definition for each of the following functions that involve lists. Use the infix form of cons in the recursive part of each definition. In other words, write h ::t in place of cons(h,t).

(1, n = subscripts)
f(a, (<x1, y1),...(xn, yn)>) = <(x1 + a, y1), ..., (xn + a, yn)>

Your recursive call will be on the tail of the list. (What else could it possibly be on?)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Actually, ___ is easier than ___, because the syntax is less insane, and because my views on syntax should be shared by everybody ;)

Edited: the original version of this post had languages in the spaces, some folks in this thread might evade the need for some necessary critical thinking.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Well gee. You could start by actually paying attention to the user's input.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Saying that programming is easy is another way of saying that you've never worked with code written by other people.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I know that the x is of type User, and i can get that, but what I need to be able to do is pull the x.AccountName and the "first.last" from the lambda expression. Anyone have any idea how to do this?

What do you mean by "pull"? You want to inspect the implementation of a Func<>? Why? You are wanting something impossible; the real problem here is that you are wanting it.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

hey guys,
I`m trying to overload operator = in my class in windows application`s form , I`m not sure what is my problem,would you take a look at my code?

Your problem is really just that you're trying to write C++ instead of C#.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You don't need to use set or get. You could write functions named setFoo or getFoo instead of using a property Foo:

class Point {
    double x, y;
    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }
    public double GetX() { return x; }
    public void SetX(double x) { this.x = x; }
    public double GetY() { return y; }
    public void SetY(double y) { this.y = y; }
}

But that's a real pain -- you'd rather write pt.Y = 3; and be able to write things like pt.Y += 5; , instead of pt.SetY(pt.GetY() + 5); .

So instead C# has properties:

class Point {
    double x, y;
    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }
    public double X {
        get { return x; }
        set { x = value; }
    }
    public double Y {
        get { return y; }
        set { y = value; }
    }
}

Inside the setter, the keyword 'value' is the variable containing the value that is getting assigned to the property Y.

The pattern of having properties directly backed by fields is so common that in C# 3, shortcut syntax was added.

class Point {
    public Point(double x, double y) {
        X = x;
        Y = y;
    }
    public double X { get; set; }
    public double Y { get; set; }
}

There are a few reasons to use properties, instead of public fields. One is …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

And, you know, that's just such an incomplete answer.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I understand HOW to use delegates, but in what situations would you actually use them?

There are two places in this answer: first, consider any place that calls for an interface of the following form:

interface IBlah {
    Foo JustOneMethod();
}

These interfaces happen all the time.

Instead of defining these classes all over the place, you can just use a delegate of type Func<Foo>. For example, compare IComparer<T> against Comparison<T>.


A second reason to use delegates: to use them in ways that makes low-level code more readable and less risky. Consider the following piece of code, that we see all the time:

List<Blah> blahs = new List<Blah>();
foreach (Bar elem in someOtherList)
{
     blahs.Add(elem.Prop);
}

Disgusting! It is much more readable to write the following:

List<Blah> blahs = someOtherList
    .Select(elem => elem.Prop)
    .ToList();

Consider a similar variant:

List<Blah> blahs = new List<Blah>();
foreach (Bar x in someOtherList)
{
     if (x.Foo())
         blahs.Add(x.Prop);
}

Yuck. It is much more readable to write the following:

List<Blah> blahs = someOtherList
    .Where(x => x.Foo())
    .Select(x => x.Prop)
    .ToList();

The code is faster to read and easier to read because you don't have to decode complicated loops -- or because you don't have to put your code out in all these separate functions to avoid complicated loops, or whatever other things blub programmers do.

It makes no sense to rewrite hard-coded implementations of Where and Select and First and Any and a lot of other …

sknake commented: That is a rather comprehensive answer, good job! +1
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Where is the error generated from?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Unfortunately, at that time the MS book out then wasn't much good so I went on Amazon and found 'Head First C#' which the reviews said was an excellent introduction. So I've been studying that, unfortunately it doesn't look like it was the exact right stuff.

What do you mean by the "right stuff"? What was wrong with Head First C#'s introduction to the language?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You could use those methods for printing an argument, but I want to use a specific argument.

For example, I want to look to see if the value of x is declared in the parameter. I don't care about the rest, I just want to get what the user put after /x= . Thanks.

So you have an array of strings and you want to see if one of them looks like "/x=something".

To do that, you could loop through the strings and find one that begins with "/x=". You could use FirstOrDefault which does the looping for you:

string xArg = args.FirstOrDefault(s => s.StartsWith("/x="));

and then take xArg and sift it apart as you like. If you need any more help with string manipulation functions or array manipulation functions, say so, but the documentation should give you the tools you need.

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

This question should go in a new thread, not as a reply to somebody else's thread.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Maybe I'm not being very clear. I'm saying, suppose your class began with the following:

class dequeint {

private:
       NodeType NodeArray[MAXSIZE];
       int headi; // index of first element: 0 <= headi < MAXSIZE
       int length; // number of elements: 0 <= length <= MAXSIZE
public:

How would you implement it then?

You can see that if your version contained say, 0 in both headi, you'd have no way of knowing if the length was 0 or MAXSIZE.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

For what OS? My automatic answer is SBCL.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The only real difference between these two that I can tell is that the CS major is more math and science based and the MIS is more business side of things. Both of them will have their technical background, but one is for more of engineering such as hardware and stuff and MIS is more management in business like network administrator or something like that or an HR person.

I would just look at MIS as an inferior degree for inferior people.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Im new at programming. How do you call the method.

You really just need to learn how to program. Follow whatever book or high quality tutorial you're using and burn through the basics.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Put the code you want in a function and call the function. You can't use goto statements across functions -- that wouldn't even make any sense.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You want to use (AcctNum[0] != 'B' && AcctNum[0] != 'P') . There's a difference between a character 'b' (which is really an integer between 0 and 255 or between -128 and 127) and the value "b" , which is really a pointer to an array with two characters, the first whose value is 'b' (i.e. 98), the second whose value is 0 (which delineates the end of the C-style string).

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Maybe some more explanation is needed for me to corret that problem.

Maybe some thinking would work, too.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

then again daniweb seems like an utterly facist place to ask or say anything,

No it isn't, except towards people who write like sperging imbeciles, making statements not grounded in reality.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

What do you mean 'retrieve' the data? You have the data. If you want to use the data, put it in an array and iterate over it.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

This: ((tailsucci+1)%MAXSIZE) !=headi is wrong.

Figure out why.


One problem you have is that if tailsucci and headi are both equal, you can't tell whether the buffer is full or empty. You should store the number of elements in the buffer, instead of storing the value tailsucci, because that's an easy way to avoid this ambiguity.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

If Input is a method group, then you can't call a method on it. That makes no sense. You might have some serious misconceptions; maybe try answering this question a second time: What is the type of the variable or property, Input?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

They mean errors that occurred while processing, converting, or programming, respectively.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

By doing just what you described.

What knowledge are you lacking that is preventing you from implementing this behavior? (Bringing up a message? Something else?)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

put the enums outside of the class. there's no reason they should be in there...

Yes there is -- they're not general enumerations of color and general enumerations of size, they're specific to what kinds of marbles you can have, so it's reasonable to have them namespaced inside Marble.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Yuck! If you're going to comment on a post, decide whether it's good or bad!

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The compiler doesn't recognize the type Color. How about Marble::Color? I don't know my C++ anymore...