Rashakil Fol 978 Super Senior Demiposter Team Colleague

and I know u can't bound a sum

Um, yes you can. For example, you can make a very rough bound: if you have a sum of j values that are each less than or equal to k, then their sum is less than or equal to j*k. You might be able to get a tighter bound, though -- going by the reasoning I just gave, you would say that 1+2+4+8+...+2^n <= (n+1)*2^n, which is more general than necessary -- a tighter bound would be 2*2^n. The sum actually equals 2*2^n - 1.

So you can, with very simple reasoning, find an upper bound for a sum -- but it might not be a tight upper bound -- it will give an asymptotic bound that is between O(1) and O(n) times the tightest possible.

To find a lower bound, you can use the same reasoning in the opposite direction: if you have a sum of j values that are each greater than or equal to l, then their sum is greater than or equal to j*l. So by that reasoning, you could say that 1+2+4+8+...+2^n >= n+1. That's pretty useless.

You can actually create a tighter lower bound (restricting yourself to dumb reasoning) by dropping the smaller elements from the sum. Let's drop half the elements from the sum: 2^(n/2) + 2^(n/2+1) + ... + 2^n >= ((n+1)/2)*2^(n/2). We get a tighter lower bound -- but not as tight as possible.

Try doing this reasoning to …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Especially I would recommend the comp.graphics.algorithms faq. There's a book section in there. I have no idea whether the recommendations are good or not, but if you look at the reviews on Amazon you might get some more info.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

D) Other, please explain

It doesn't matter. Do what you enjoy. It's not like it's hard to learn a new language later. Realize that you'll have to mostly teach yourself C++ if you really want to learn it, because your school is going to suck at teaching you C++, probably. You should take the C++ classes because if you're good at programming, they'll be easy, and if they're hard, they'll make your mind grow so that you become better at programming.

Also, you can learn more than one language at a time. You can learn 2 at a time. Or 3. Or dabble in whatever you want, from day to day.

Please consider Job opportunities.

This is the most depressing thing I've read today.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Don't listen to him, his complaint is logically inconsistent with the fact that you made this thread and using colors isn't going to draw extra attention to the first post of the thread.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

First you will need a medical degree so that you know how to recognize a cataract when you see one. My eye specialist had to shine a bright light in my eyes in order to find them. Maybe you can do the same with a color picture -- maybe not. I don't know.

You just need a bunch of pictures of eyes with cataracts and without. Then write a classifier to classify the images.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Recession is not over yet , so be happy whatever salary you are getting , more than 10% software engineers are job less now.

Don't listen to this troglodyte.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Just write your "codes" in Python, test it that way, and tweak your syntax in arbitrary directions so that your code suddenly becomes "pseudo" code.

Thank you, and stop bothering me with your inane questions.

majestic0110 commented: lol +3
Rashakil Fol 978 Super Senior Demiposter Team Colleague

The U means that it's an unsigned integer literal. size_t is an unsigned integer type that's guaranteed to be able to hold the size of an array. But not a std::string. If you're paranoid you should use std::string::size_type. Don't be.

Your program is not segfaulting because of the hash function. The error is elsewhere.

iamthwee commented: Telling it how it is. Props to you young man. +11
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Could someone explain to me why I received a down vote for my reply to this thread. Seems a little undeserving.
Or better yet, why doesn't the person who down voted my reply man-up and say why.

What do you care what other people think?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I'm not so sure I expected the Array.Sort to go through any particular order, but I expected it to only compare spots in which a file actually existed. If I declare the array to be 64 spaces large, then only fill 5 of them, and tell it to do an Array.Sort does it sort even blank spaces?

There's no such thing as a 'blank space.' An array with 64 elements will contain 64 elements. Some of them will be null, because that's what they were initialized with -- but that's no different than if you had assigned null to any particular element. Array.Sort will try to sort the entire array.

If that's the case I guess I could just as easily push each one to a List<File> and then call Array.Sort on that.

Yes. You shouldn't preallocate arrays and then put several values in them, you should just use List<>.

sknake commented: This pains me to +rep you, but it is deserved. +5
Rashakil Fol 978 Super Senior Demiposter Team Colleague

SVN I liked pretty well, but I agree with CVS. We were forced to use it for school one semester, and I used it without problems. The next semester, I helped a friend use it who didn't understand it. I locked him out of his own repository, giving an error that I couldn't resolve. It basically said another user had locked the resources, yet it was a one person project. . so there was nobody else who could lock the resources. Turns out a lot of his classmates experienced the same error and the professors just granted extensions.

I've found git and hg to be much easier to use than svn. Certainly for personal use they're very easy -- you don't have to setup an svn server anywhere. Then it's easy to add other people, because... you don't have to setup an svn server anywhere. And you don't have to worry about being connected to the internet all the time, which for somebody like me is useful. SVN is still better if you only want to give people access to a particular subfolder of your source code or if you're dealing with large binary files. And yeah, CVS is basically crap, that's the reason SVN got invented.

Nick Evan commented: Yes! +10
Rashakil Fol 978 Super Senior Demiposter Team Colleague
//load client details
            prevData = getFormData.DisplayData();

            for (int i = 1; i <= 3; i++)
            {
                
                switch (i)
                {
                    case 1: C_name = prevData[i].ToString(); break;
                    case 2: D_name = prevData[i].ToString(); break;
                    case 3: B_type = prevData[i].ToString(); break;
                }
            }

First of all, again, you should be iterating i from 0 to 2, not from 1 to 3.

Second, how do you know (at the time this code runs) that gemData has been written to? If you were getting an index error back when you had your indexes going from 0 to 2, it's because gemData had never had a three-element list written to it, because Preview_Meth was never called.

As an aside, your "for-switch" construct is a bit of a coding horror, and you should just write the three statements as follows. Also, .ToString() was superfluous too, because the values are already Strings.

C_name = prevData[0];
D_name = prevData[1];
B_type = prevData[2];
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Use private static Random random = new Random(); so that the same random number generator is used across different instances of Coin.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

For this specific mechanism, you could make a function that converts your ArrayList to a byte[] and then passes that through an MD5 or SHA1 algorithm or whatnot. See System.Security.Cryptography.SHA1, for example.

You should not rely on the behavior of GetHashCode being consistent on different computers unless you can find documentation guaranteeing that its behavior is. Also, GetHashCode is a hash function that produces duplicate hash codes for different values -- it's not a cryptographically strong hash, the way that SHA1 or MD5 are, which means the probability of getting two values that have the same hash is (in the long run) very high.

There are other ways to solve this problem that don't use hashes. You can keep a version number instead (every time you change the array list, you have to increment the version number) -- if the version number hasn't changed, then the clients don't need to be updated. I don't know how .NET remoting works; another way to send information about the ArrayList is to send a description of how the ArrayList has changed -- using some kind of tuple that says things like "insert blah at index 23" and "remove item at index 14". I don't know how .NET remoting works; you might want to investigate the possibility that it does this kind of thing (version numbers or hashing especially) automatically.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

So a Java interface is more important than a Java Object in your opinion? Since the purpose of object oriented programming is to use Objects? If you are talking about interfaces in general then I take that back, but you specifically mentioned Java interfaces. .

I'm talking about the idea of interfaces in general -- the fact that some particular object takes some particular set of methods, where you don't need to care what type the object really is an instance of.

Just because you're using "objects" doesn't mean you're doing object oriented programming. In that sense, the term "object" is a synonym for "value" -- you use "objects" when doing procedural programming too. "Object oriented" is really an inaccurate term to use -- "interface oriented" might have been a better term. But it's the objects that obey the interfaces, so "object oriented" ended up being the name.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I'm new to C++, and i've seen some C and C++ code.
I tried array[] and vector<> so i see i can use both, why should i use what way to work with vectors?
Furthermore, i've seen a lot of "array[]" in this forum... so, any lead?

Just use vector<>. Never use arrays. I mean, sure, at some point in time, you'll want to learn how to use them. They are useful for implementing vectors, after all. And sometimes, occasionally, rarely, a fixed-size array is just what you want and you can't accept the miniscule overhead that using a vector gives you. People use arrays in this forum usually because they are taking classes with out-of-date textbooks or out-of-date teachers.

The main problem with arrays is that you generally have to fill the array with values, when you want to use it. And this means you've first got to create the array, and you have to know what size it is, and then you have to put the values into it. Lots of times newbies on this forum will create an array _larger_ than the amount of stuff they're putting in it, and then, when it has too much stuff, they just throw an error. Or worse, they keep trying to put more stuff in, writing into memory past the end of the array, creating undefined behavior that's hard to debug. And then you've got to keep track of how much stuff you've put in the array.

Nick Evan commented: Yes! +10
Rashakil Fol 978 Super Senior Demiposter Team Colleague

I've created the following generic method

protected int GetSpecifiedIndexByName<T>(T collection, string itemName)
    {
      int count = 0;
      foreach (MyElement claim in collection)
      {
        if (itemName.Equals(claim.Name))
        {
          return count;
        }
        count++;
      }
    }

You have two problems with this method. One is that there is no proof that T : IEnumerable. You need to use a where clause to specify that. The other problem is that not all control paths lead to a return statement.

You shouldn't be using generics for this kind of behavior. Instead, you should just have the function take an object that implements the IEnumerable interface:

protected int GetSpecifiedIndexByName(IEnumerable collection, string itemName)
    {
      int count = 0;
      foreach (MyElement claim in collection)
      {
        if (itemName.Equals(claim.Name))
        {
          return count;
        }
        count++;
      }
      return -1;
    }

You could also use IEnumerable<MyElement> in the signature. This is a good idea because it more tightly defines the interface of the function.

protected int GetSpecifiedIndexByName(IEnumerable<MyElement> collection, string itemName)
    {
        ...
    }

So, you should not be trying to implement a generic function at all. You just want a function that takes a parameter of type IEnumerable<MyElement>.

I cannot cast the generic collection to the known collection directly i.e.

In general, you can't cast from one type to an unrelated type. For example, you can't cast something from Int32 to ArrayList. This is because there's no way that can be correct! Similarly, you can't cast a generic type, which could be anything, to the type MyCollection. You can only …

ddanbe commented: Thanks! Very instructive. +4
sknake commented: nice++ +5
DdoubleD commented: good explanation regarding down casting! +1
Rashakil Fol 978 Super Senior Demiposter Team Colleague

atoi(text[0]) will not work because atoi expects a char*, not a char. That half of NeoKyrgyz's answer was basically useless and dumb.

If you want to convert the character "c" representing the decimal digit n to the integer n, you can do so with (c - '0') . That's the same as what NeoKyrgyz said, because '0' is just a fancy way of writing 48 . You'll note that '0' == 48, '1' == 49, ..., '9' == 57. If text is a string containing "0R14", then text[0] will evaluate to 48.

atoi is for converting c-style strings containing sequences of digits into numbers, e.g. "123" -> 123

Rashakil Fol 978 Super Senior Demiposter Team Colleague

i have no idea where to even start any help would be greatly appreciated.

Look at the behavior of the division and modulo operators.

i would really appreciate a hand here!?

Learn how to take substrings and how to append strings to one another.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Q. How can 3/2 be 1? I thought it was 1.5.

A. Lookup "quotient" and "remainder" on the Internet.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I smell stackholm syndrome.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

This seems like an excellent way to be passive-agressive.

MosaicFuneral commented: Tis true. +0
iamthwee commented: hell yeah +0
Rashakil Fol 978 Super Senior Demiposter Team Colleague

I'm getting started myself and bought FPGA Prototypeing by VHDL Examples, the Xilinx Spartan-3 Version, by Pong P. Chu, and I ordered a Spartan 3E from Diligent, which should come Monday. I have only seen good reviews of the book, and if you wait a few weeks, I'll tell you how it goes.

Rashakil Fol 978 Super Senior Demiposter Team Colleague
var Column = from all in invaders group all by all.Location.X into grpResult orderby grpResult.ElementAt(0).Location.Y descending select grpResult;

foreach (var v in Column)
Console.WriteLine(v.ElementAt(v.Count()-1).Location.ToString());

You can and should use v.Last() instead of v.ElementAt(v.Count()-1) . Using v.Last() also only iterates through the collection once, which is sometimes something to be aware of (and sometimes a needless microoptimization) and anyway it's less code.

Edit: And I think you have it all wrong. Your code groups by the X value and sorts the collection of groups by the groups' first Y values. That's what you want?

jonsca commented: Some long overdue rep +1
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Blah blah blah, why don't you answer the question instead of linking to some reference site.

linkpraveen: if you use a List<Invoice>, for example, it's impossible to have anything in that list which is not an invoice. If you just used an ArrayList, you would increase the probability of making a mistake and putting something of the wrong type in. Generics also let you make guarantees that somebody's passing something sensible into your function. For example, consider the function

T MaxBy<T>(List<T> values, Comparer<T> comparer);

This function can guarantee that you've supplied a comparer intend to operate on things of type T. Without generics, you'd have to write something like

object MaxBy(ArrayList list, Comparer comparer);

where a Comparer is a delegate that takes two objects as arguments. You might accidentally use a wrong delegate or change the type of the elements stored in a list you're using somewhere, and the compiler would never warn you about the error. You'd have to compensate for the lack of generics by writing more careful unit tests. Also, you'd have to double-check the documentation of more APIs.

So there is the general question asking what are the most common practical uses of generics. The most common is the simple use of generic collections, like List<T>, HashSet<T>, Dictionary<TKey, TValue>, T[] (which formally speaking in .NETenese isn't a generic collection), IEnumerable<T>, and so forth. The second most common use I see is the use of generic function types. I.e. Func<T>, Func<A, T>, Action<T>, …

sknake commented: great answer +14
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Instead of keeping variables first_address , second_address , and third_address , and so on, make an array of addresses and walk through the array until one succeeds or until they all have failed.

serkan sendur commented: welcome +7
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Save it for FOX News.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The entertainment channel known as CNBC is the last place you should look for perspectives on the financial situation.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Wow, it seems like you're trying to be clever. How's that working out for you?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

2) Rashakil, if you're gonna post another video of yourself on youtube. Consider wearing something that hides your puny knees.

My knees are now flabby so I don't need to hide them anymore.

And why the hell are you sitting with your knees pinned together like a female?

Why the hell not?

iamthwee commented: Well are you a female? +18
Rashakil Fol 978 Super Senior Demiposter Team Colleague

For starters, replace [1-9]+ with [1-9][0-9]*

When you use a preceding @ sign in C#, that means escape characters won't work. You can then write backslashes freely.

For example, @"C:\Documents and Settings\rashakil\My Documents\serkan love files" would be a valid string literal. If you want to write a double quote character in such a representation, I think (but you should double check that) you can write it by writing two double quote characters: @"blah "" hah" == "blah \" hah"

ddanbe commented: The subtility of your style is by moments unsurpassable LOL! +4
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Your beautiful hands turn me on...

I'm going to make it so dry for you.

serkan sendur commented: if i had used protection, you wouldnt have existed today. -1
Comatose commented: Priestly +12 Cast Of Healing +12
Ancient Dragon commented: you are an immature newt +36
Rashakil Fol 978 Super Senior Demiposter Team Colleague

What? Why did you suddenly start using C?

Comatose commented: Hahahahha Exactly! +12
Rashakil Fol 978 Super Senior Demiposter Team Colleague

No, I don't.

serkan sendur commented: Rashakil Fool +4
Rashakil Fol 978 Super Senior Demiposter Team Colleague

That is the bad side of free software, it is always hard to find answers, when you stuck nobody takes care of you.

That is a completely retarded thing to say. Nobody at Microsoft cares about you either.

People at Firefox care more because they realize the privacy implications of sending a full file path to the browser. Firefox and other browsers will only send the file name.

You could try actually posting a useful answer instead of a completely wrong, idiotic one.

nav33n commented: Totally agree! +10
John A commented: I like how you cleverly disguised the answer in your post. No one can figure out where it is! +18
Rashakil Fol 978 Super Senior Demiposter Team Colleague

i started to wonder your age.. how old are you?

95 years old

serkan sendur commented: very beneficial +3
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Who do you think cares quality in todays world? Almost everything is about producing fast and consuming fast, you are American, you know what i mean..

I'm going to haunt all your posts and make your existence on this forum a miserable one.

iamthwee commented: brrrrrrrrilliant. +18
stephen84s commented: You got one recruit on that crusade in me. +7
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

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

Because I needed 0.

You're mistaking zero for Zorro. Get it right.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I see that the folder icons are using solid white backgrounds rather than transparent backgrounds. The white stands out when the icons are used on a non-white background, as seen at <http://www.daniweb.com/category2.html>.

This unacceptable, and I demand that this be fixed! How can I give information when these unkempt forum icons are profaning the digital landscape with their pixels of evil on every other page I visit?

Dictated but not read,
Rashakil Fol

iamthwee commented: Off topic, I have just noticed you have a beautiful blue eye. +18
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Is it possible to give negative votes for people?

John A commented: Negative votes should be worth twice as much. +17
Rashakil Fol 978 Super Senior Demiposter Team Colleague

is there any c++ equivalent of doing that?

Nope :)

cikara21 commented: ok.. +1
Rashakil Fol 978 Super Senior Demiposter Team Colleague

It's not necessary to right-shift a value immediately before you multiply it by a constant. So:

def luminance(pixel):
    """Calculate and return the luminance of a pixel."""

    return 0.299 * (pixel & 0xFF) + 0.002293 * (pixel & 0xFF00) + .00000174 * (pixel & 0xFF0000)

I assume removing the doc comment doesn't help, but maybe you shouldn't.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

No, it says you have non-exhaustive patterns!

In particular, you defined the function binadd for non-empty lists with:

binadd (x:xs) (y:ys) n = ...

But you didn't define the function for empty lists! What is the value of binadd ([True]) [] True ? Your function's behavior is not defined, because the empty list [] doesn't match the pattern (y:ys) . You need new cases below to handle empty lists, probably something like

binadd xs [] n = ...
binadd [] ys n = ...

But whatever you do, make sure your function can handle all the cases. I'm pretty sure there is some warning you can turn on that will tell you about functions that don't handle all the conceivable cases.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

d2b2 evaluates to something of type [Int] , right? Which means the expression (d2b2(n / 2):1) is trying to pass an [Int] as the left-hand argument of the (:) function. Since the (:) function is of type a -> [a] -> [a] , that means it expects on the right-hand side a list of whatever was on the left hand side. That means it expects a list of [Int] , i.e. something whose type is [[Int]] . Instead of an expression of type [[Int]] , you're supplying 1, or 0, something of type Int . That's the reason your error message is the way it is.

The function (:) is for appending elements to the left end of a list. If you want to append an element to the right end, wrap the element in a list an use a (++) operator. For example: [1,2,3] ++ [x] => [1,2,3,x] .

You have a number of other problems with your code. One of them has to do with this question: What do you expect 'return' to do?

chunalt787 commented: Great responses very informative and patient, thanks so much +1
Rashakil Fol 978 Super Senior Demiposter Team Colleague

don't type else part of if statements!just write two if statements!this would save you some time when you want to later view the program!

What the fuck are you talking about?

Comatose commented: Fully Agree +10
Rashakil Fol 978 Super Senior Demiposter Team Colleague

that's the main thing there are so many classes that it is impossible to save them in an array but some variable names

We're getting somewhere. Is there a particular reason you need to write this in C++? Would a solution that doesn't use C++ suffice?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Thank you so much for fast and detailed responce., so after statement p=a+i, does it mean that p equals 2 in the first pass?

No, the statement p=a+i changes the variable p so that it contains a memory address i units after a. There is no way p will equal 2, because 2 is an int, and p is an int*.

and does it mean that with statement x=*p means that x=2? i'm abit confused with these 3 lines...

If *p evaluates to 2, then that means x will contain 2. Here is a simple example:

int array[] = {2, 3, 5, 7, 11};
int* p = array;  // p contains the memory address of array[0]
int x = *p;  // *p returns whatever's at the memory address stored in p.  So it returns the value that's in array[0].  So it return 2.  Thus, the value 2 gets assigned to the variable x.
int* q = p + 2;  // q contains the memory address 2 units after p.
int y = *q;  // *q is 5, so y gets assigned 5.
Comatose commented: Nicely Done Man. +9
Rashakil Fol 978 Super Senior Demiposter Team Colleague
public void CalculateSize()
        {
            const int cMaxCol = 3;
            const int cMaxRow = 3;
            const int cGap = 9;

            bool highColCount = ColumnCount > cMaxCol;
            bool highRowCount = RowCount > cMaxRow;
            int CC = highColCount ? cMaxCol : ColumnCount; // or Math.Min
            int RC = highRowCount ? cMaxRow : RowCount;

            int ColScr = highColCount && !highRowCount ? 0 : 16;
            int RowScr = highRowCount && !highColCount ? 0 : 16;
            this.AutoScroll = highRowCount || highColCount;

            this.Size = new Size((cCellWidth + cGap) * CC + ColScr, (cCellHeigth + cGap) * RC + RowScr);  
        }
Antenka commented: mmm ... beautifully :) +1
ddanbe commented: Respect! +4
Ramy Mahrous commented: Very^10 great! +6