I have a class that draws itself.
The class draws a picture of what a node looks like in a B tree. But this takes a lot of method calls.
1. draw top line
2. draw bottom line
3. draw left arc
4. draw right arc
5. draw diving lines inside node
6. draw left rectangle
7. draw left circle
8. draw right rectangle
9. draw right circle
10. draw rectangle between left and right (in a for statement, so if there are 50 data cells this code runs 48 times)
11. draw in numbers on each data cell
etc etc etc
I dont want the computer to have to execute all of that code every time it has to repaint the window (due to it being minimized or another window dragged over top of it, etc).
So I just want to know how programmers usually deal with something like this. Is it okay to have it go through all of that drawing every single time it needs to repaint? Mind you, this will be the drawing of only one node.... there could be hundreds that need to be drawn!
thanks for your help!
C# drawing question (asked in an easier to understand way). A best answer will be awarded.?
You can make a path and save it. I assume that since you are drawinf nodes, that each looks the same. I program in VB.Net, but the code is virtually the same for C#...
Dim path As New GraphicsPath
Dim rectRoundBounds As New Rectangle
path.StartFigure()
path.AddLine(rect.X + Radius, rect.Y, rect.X + rect.Width - 2 * Radius, rect.Y)
path.AddArc(rect.X + rect.Width - 2 * Radius, rect.Y, 2 * Radius, 2 * Radius, 270, 90)
path.AddLine(rect.X + rect.Width, rect.Y + Radius, rect.X + rect.Width, rect.Y + rect.Height - 2 * Radius)
path.AddArc(rect.X + rect.Width - 2 * Radius, rect.Y + rect.Height - 2 * Radius, 2 * Radius, 2 * Radius, 0, 90)
path.AddLine(rect.X + rect.Width - 2 * Radius, rect.Y + rect.Height, rect.X + Radius, rect.Y + rect.Height)
path.AddArc(rect.X, rect.Y + rect.Height - 2 * Radius, 2 * Radius, 2 * Radius, 90, 90)
path.AddLine(rect.X, rect.Y + rect.Height - 2 * Radius, rect.X, rect.Y + Radius)
path.AddArc(rect.X, rect.Y, 2 * Radius, 2 * Radius, 180, 90)
path.CloseFigure()
Then call
g.FillRegion(brushBackground, New Region(path))
or
g.DrawPath(BorderPen, path)
Reply:Hm, I already answered this question elsewhere ;-)
My advice is to use double buffering, or just ignore it. It might not even be a problem unless youve tonnes of them
Remember modern graphics cards can thousands and thousands of polygons per second without even sweating
Reply:a simple and fast solution would be to following: I am assuming that you are writing to a picture box.
Im not going to provide the code since you seem to know what you're doing.
after you draw the image that you want save it as a .bmp to memory. when the screen needs to be refreshed simply draw the .bmp image to the device context (aka the picture box).
good luck
survey
Monday, May 24, 2010
Which one of the following individuals would be most likely to vote?
A. A 19-year-old high school graduate who likes to complain about the government
B. A 22-year-old computer programmer
C. A 30-year-old college graduate who has just moved to a new state
D. A 50-year-old corporate executive who holds a master's degree in business
Anyone able to find documentation on this, or have definite knowledge to this answer, I'd really appreciate it. I'm honestly stuck between answer D, it sounds logical, but I'm worried I'm going more so by age. Thanks anyone =)
Which one of the following individuals would be most likely to vote?
As far as I know, age IS the determining factor for voting. As a general rule, the older you are, the more likely you are to vote. That's why you have to be 21 to drink instead of 18, like in the 70s. There weren't any kids voting to vote against it.
B. A 22-year-old computer programmer
C. A 30-year-old college graduate who has just moved to a new state
D. A 50-year-old corporate executive who holds a master's degree in business
Anyone able to find documentation on this, or have definite knowledge to this answer, I'd really appreciate it. I'm honestly stuck between answer D, it sounds logical, but I'm worried I'm going more so by age. Thanks anyone =)
Which one of the following individuals would be most likely to vote?
As far as I know, age IS the determining factor for voting. As a general rule, the older you are, the more likely you are to vote. That's why you have to be 21 to drink instead of 18, like in the 70s. There weren't any kids voting to vote against it.
Which one of the following individuals would be most likely to vote?
A. a 19-year-old high school graduate who likes to complain about the government?
B. a 22-year-old computer programmer?
C. a 30-year-old college graduate who has just moved to a new state?
OR...
D. a 50-year-old corporate executive who holds a master's degree in business?
THESE ARE QUESTIONS THAT COME OUT OF MY HIGH SCHOOL QUESTION'S BOOK! I HAVE EXAM TEST AFTER EACH CHAPTER! %26amp; I STILL HAVE NO CLUE? help me please. I really do need answers that are correctly answered and not people who are going to mess around and be mean or try and say something stupid. Like they have before. THX
Which one of the following individuals would be most likely to vote?
I would say the corporate executive.... he makes tons of money and needs to vote people in who will give him tax breaks.... and tax the sh/t out of the poor.
Reply:The 50 year old. He has seen enough elections to be pissed off about the way somthing is going in the government and his company probably contributes to the Republican party.
Reply:Well it depends if the 19 yrd is a conservative they WILL vote if the twenty-two year old is a conservative they WILL vote. The thirty year old is a conservative they will Vote. The fifty year old will probably vote irregardless unless they are cynical about government.
Now a liberal 19, 22,30 will probably not vote.
Reply:Older and richer are always more likely to vote. Older and richer.
Reply:D. a 50-year-old corporate executive who holds a master's degree in business.
They have the most to lose financially, and we all know about how the rich want to hold on to their money. It's how they define themselves.
Reply:I think it's D, since the reason for it would be that for A. the kid is probably just like to make themselves feel important by voicing his/her opinion, but when it comes to action, probably the student would not actually take the effort to vote.
B. In a choice like this, when the subject (programmer) has really nothing to do with politics, there's really no motivation for the programmer to vote.
C. College graduate is not the same kind of easily excited high school student, and is usually more moderate in their actions. So, while a college graduate can still be interested in voting (in fact every choice can be somebody who is interested to vote), a thirty year-old who has just moved to a new environment would tend to see things more objectively and act after more consideration and more experience living in that new state.
D. The real incentive for this guy to vote is that a corporate executive is really concerned with money!!! And a right or left wing party can really make a huge difference to the economy. So, the executive would care to vote for somebody who would support the kind of business that he/she is doing.
And of course, I don't know what subject of study does this question belong to. I would be interested to know.
Reply:A,D, and D
Reply:I would say teh High School Graduate. They are complaining about teh government, so they would be motivated to influence change. The computer Programer would be secure enough finanicaly to probably not worry to much about it, the executive is set up- his life is so hetic right now, that following the election would be to much bother (if he did vote he would vote along party lines the same way he has done for 30 years), and teh 30 year old that just moved to a new state probably hasn't register to vote in his new home yet. This is assuming a national government. When it comes to city/ state elections, I'd put my money on teh executive who probably has kids in teh eduational system and might gain a few tax breaks with new laws, etc.
Reply:This happens to be my area of expertise....
The first correlate of voting is age....young people DO NOT VOTE....scratch those under 24.
Secondly, income/education is the second correlate....as income and education rises so does the incedence of voting.
Thirdly, race.....minorities are least likely to vote.
The 'just moved' is a trick....it DEPENDS ON THE STATE....
some states (six to be exact) allow you to register and vote THE DAY of a an election You can read more here: http://www.epic.org/privacy/voting/regis...
Reply:after som pondering, and trying to think like a high school text book lol ok. 19yr-30yr are the hardest ages to get to the polling stations, because they dont believe their vote will make a difference, their lives are usually self absorbed and generally they are removed from the political happenings of the country. Therefore, the 50yr Corporate Exec would be most likely to vote, because he knows what a vote can do for his company. Good Luck!
Reply:I considered myself a diehard voter after seeing 9/11, and couldn't wait to cast my vote come election time; but because I was so caught up in work and school, I kinda got sidetracked and had to do some last minute registration. It took hours for me and my wife to even find the place to cast our votes! (Which turned out to be inside a church...wtf) anyway, I ended up voteing for Al in the end, but my point is sometimes no matter how badly you want to vote, if you are caught up with personal stuff, (which most of us are) you can easly forget to vote, let alone know how in some areas. So, yes, my answer is D. Everyone else is too buisy with jobs/social life to follow through. But the old fart doen't have anything else better to do.
B. a 22-year-old computer programmer?
C. a 30-year-old college graduate who has just moved to a new state?
OR...
D. a 50-year-old corporate executive who holds a master's degree in business?
THESE ARE QUESTIONS THAT COME OUT OF MY HIGH SCHOOL QUESTION'S BOOK! I HAVE EXAM TEST AFTER EACH CHAPTER! %26amp; I STILL HAVE NO CLUE? help me please. I really do need answers that are correctly answered and not people who are going to mess around and be mean or try and say something stupid. Like they have before. THX
Which one of the following individuals would be most likely to vote?
I would say the corporate executive.... he makes tons of money and needs to vote people in who will give him tax breaks.... and tax the sh/t out of the poor.
Reply:The 50 year old. He has seen enough elections to be pissed off about the way somthing is going in the government and his company probably contributes to the Republican party.
Reply:Well it depends if the 19 yrd is a conservative they WILL vote if the twenty-two year old is a conservative they WILL vote. The thirty year old is a conservative they will Vote. The fifty year old will probably vote irregardless unless they are cynical about government.
Now a liberal 19, 22,30 will probably not vote.
Reply:Older and richer are always more likely to vote. Older and richer.
Reply:D. a 50-year-old corporate executive who holds a master's degree in business.
They have the most to lose financially, and we all know about how the rich want to hold on to their money. It's how they define themselves.
Reply:I think it's D, since the reason for it would be that for A. the kid is probably just like to make themselves feel important by voicing his/her opinion, but when it comes to action, probably the student would not actually take the effort to vote.
B. In a choice like this, when the subject (programmer) has really nothing to do with politics, there's really no motivation for the programmer to vote.
C. College graduate is not the same kind of easily excited high school student, and is usually more moderate in their actions. So, while a college graduate can still be interested in voting (in fact every choice can be somebody who is interested to vote), a thirty year-old who has just moved to a new environment would tend to see things more objectively and act after more consideration and more experience living in that new state.
D. The real incentive for this guy to vote is that a corporate executive is really concerned with money!!! And a right or left wing party can really make a huge difference to the economy. So, the executive would care to vote for somebody who would support the kind of business that he/she is doing.
And of course, I don't know what subject of study does this question belong to. I would be interested to know.
Reply:A,D, and D
Reply:I would say teh High School Graduate. They are complaining about teh government, so they would be motivated to influence change. The computer Programer would be secure enough finanicaly to probably not worry to much about it, the executive is set up- his life is so hetic right now, that following the election would be to much bother (if he did vote he would vote along party lines the same way he has done for 30 years), and teh 30 year old that just moved to a new state probably hasn't register to vote in his new home yet. This is assuming a national government. When it comes to city/ state elections, I'd put my money on teh executive who probably has kids in teh eduational system and might gain a few tax breaks with new laws, etc.
Reply:This happens to be my area of expertise....
The first correlate of voting is age....young people DO NOT VOTE....scratch those under 24.
Secondly, income/education is the second correlate....as income and education rises so does the incedence of voting.
Thirdly, race.....minorities are least likely to vote.
The 'just moved' is a trick....it DEPENDS ON THE STATE....
some states (six to be exact) allow you to register and vote THE DAY of a an election You can read more here: http://www.epic.org/privacy/voting/regis...
Reply:after som pondering, and trying to think like a high school text book lol ok. 19yr-30yr are the hardest ages to get to the polling stations, because they dont believe their vote will make a difference, their lives are usually self absorbed and generally they are removed from the political happenings of the country. Therefore, the 50yr Corporate Exec would be most likely to vote, because he knows what a vote can do for his company. Good Luck!
Reply:I considered myself a diehard voter after seeing 9/11, and couldn't wait to cast my vote come election time; but because I was so caught up in work and school, I kinda got sidetracked and had to do some last minute registration. It took hours for me and my wife to even find the place to cast our votes! (Which turned out to be inside a church...wtf) anyway, I ended up voteing for Al in the end, but my point is sometimes no matter how badly you want to vote, if you are caught up with personal stuff, (which most of us are) you can easly forget to vote, let alone know how in some areas. So, yes, my answer is D. Everyone else is too buisy with jobs/social life to follow through. But the old fart doen't have anything else better to do.
Why is goto in programming frowned upon?
Being a hobby programmer (c++ and any other language I feel like learning) I have read from numerous source that using the
goto keyword is a bad thing and should be avoided.
From what I've read it is avoided because it basically makes your code hard to read/understand, but I think that if used properly it can be usefull.
I also dabble in assembly, and was getting confused with the jmp until I learned about the goto and then it hit me....
jmp is almost exact to goto.
So wouldn't goto help people who want to learn oh say assembly??
I have also found goto helpfull in rare cases.
what about you??
Why is goto in programming frowned upon?
A program statement is like a sentence. It can be direct. It can also be long and rambling, taking you from the court of Saladin the Magnificent to H. P. Lovecraft's dinner table where you will learn he detested fish.
I have no doubt you have found gotos useful. C has a statement called break, which gets you out of whatever loop or switch statement you hapen to be in. There are certainly cases where they are called for. Generally, though, they are so useful in redirecting program actions that they can give you a scope as broad as my sentence with Saladin and Lovecraft. And it makes it very easy to forget that happens after the sentence is complete. The program can hang or terminate without accomplishing its original purpose.
If you expect to be the person maintaining this code until it's finished or the Messiah comes, fine. If not then you are well advised to think of others and plot things from the top down so you do leave the most direct and uncluttered sentences for them to look at you can.
%26lt;/tongue in cheek %26gt;
Reply:Using goto does make you code harder to follow and opens up the possibility that another person that modifies the code will make a mistake. If it wasn't for the use of gosub it might be alright. If one uses a goto after a gosub and before the return then you can imagine how confusing it could become.
If there are several gosubs within gosubs then it gets even worse.
Time is money and all the employers I have worked for do not like spending money on spaghetti code problems.
Top down and modular, that's the ticket
goto keyword is a bad thing and should be avoided.
From what I've read it is avoided because it basically makes your code hard to read/understand, but I think that if used properly it can be usefull.
I also dabble in assembly, and was getting confused with the jmp until I learned about the goto and then it hit me....
jmp is almost exact to goto.
So wouldn't goto help people who want to learn oh say assembly??
I have also found goto helpfull in rare cases.
what about you??
Why is goto in programming frowned upon?
A program statement is like a sentence. It can be direct. It can also be long and rambling, taking you from the court of Saladin the Magnificent to H. P. Lovecraft's dinner table where you will learn he detested fish.
I have no doubt you have found gotos useful. C has a statement called break, which gets you out of whatever loop or switch statement you hapen to be in. There are certainly cases where they are called for. Generally, though, they are so useful in redirecting program actions that they can give you a scope as broad as my sentence with Saladin and Lovecraft. And it makes it very easy to forget that happens after the sentence is complete. The program can hang or terminate without accomplishing its original purpose.
If you expect to be the person maintaining this code until it's finished or the Messiah comes, fine. If not then you are well advised to think of others and plot things from the top down so you do leave the most direct and uncluttered sentences for them to look at you can.
%26lt;/tongue in cheek %26gt;
Reply:Using goto does make you code harder to follow and opens up the possibility that another person that modifies the code will make a mistake. If it wasn't for the use of gosub it might be alright. If one uses a goto after a gosub and before the return then you can imagine how confusing it could become.
If there are several gosubs within gosubs then it gets even worse.
Time is money and all the employers I have worked for do not like spending money on spaghetti code problems.
Top down and modular, that's the ticket
The project role most involved in interacting with users to determine their specific needs is the:?
a)system analyst
b)programmer
C)project manager
D)inteface designer
The project role most involved in interacting with users to determine their specific needs is the:?
Is this a test question or are these your choices? I would say that the Business Analyst or Application Architect are most involved with client requirements. I am a sales rep for a consulting company and that's my opinion for what it's worth. If this is a test and these are my options - C or D would be most involved.
land survey
b)programmer
C)project manager
D)inteface designer
The project role most involved in interacting with users to determine their specific needs is the:?
Is this a test question or are these your choices? I would say that the Business Analyst or Application Architect are most involved with client requirements. I am a sales rep for a consulting company and that's my opinion for what it's worth. If this is a test and these are my options - C or D would be most involved.
land survey
Why is goto in programming frowned upon?
Being a hobby programmer (c++ and any other language I feel like learning) I have read from numerous source that using the
goto keyword is a bad thing and should be avoided.
From what I've read it is avoided because it basically makes your code hard to read/understand, but I think that if used properly it can be usefull.
I also dabble in assembly, and was getting confused with the jmp until I learned about the goto and then it hit me....
jmp is almost exact to goto.
So wouldn't goto help people who want to learn oh say assembly??
I have also found goto helpfull in rare cases.
what about you??
Why is goto in programming frowned upon?
Goto's can make programs hard to read and understand. That's a good enough reason not to use them. Would Stephen King reference page 217 in his novel if you are at page 41? Exactly.
Reply:Even as a hobby programmer - do you expect to ever have to work on your code after you finish it? Unless you leave yourself extensive comments,
if (x == y) goto z;
a few pages of code
z:
is a lot more confusing than
if (x %26lt;%26gt; y) bypass = true;
if (!bypass) {
a few pages of code
}
Reply:If you or your team are the only ones who will see the code, then I do not see a problem. If you plan on releasing the code to other people, then it would be best to use other methods.
goto keyword is a bad thing and should be avoided.
From what I've read it is avoided because it basically makes your code hard to read/understand, but I think that if used properly it can be usefull.
I also dabble in assembly, and was getting confused with the jmp until I learned about the goto and then it hit me....
jmp is almost exact to goto.
So wouldn't goto help people who want to learn oh say assembly??
I have also found goto helpfull in rare cases.
what about you??
Why is goto in programming frowned upon?
Goto's can make programs hard to read and understand. That's a good enough reason not to use them. Would Stephen King reference page 217 in his novel if you are at page 41? Exactly.
Reply:Even as a hobby programmer - do you expect to ever have to work on your code after you finish it? Unless you leave yourself extensive comments,
if (x == y) goto z;
a few pages of code
z:
is a lot more confusing than
if (x %26lt;%26gt; y) bypass = true;
if (!bypass) {
a few pages of code
}
Reply:If you or your team are the only ones who will see the code, then I do not see a problem. If you plan on releasing the code to other people, then it would be best to use other methods.
Which one of the following individuals would be most likely to vote?
A. A 19-year-old high school graduate who likes to complain about the government
B. A 22-year-old computer programmer
C. A 30-year-old college graduate who has just moved to a new state
D. A 50-year-old corporate executive who holds a master's degree in business
Which one of the following individuals would be most likely to vote?
Not really enough info to make an educated decision but I guess D.
Sry misunderstood question thought you meant vote for.oops.
Answers still the same.
Reply:c.
Reply:Just based on that? D. I would need a LOT more info to vote for anyone.
Reply:As a general rule, the likelihood of voting increases with age and intelligence.
So the 50-year old corporate executive is most likely to vote of those listed.
The 19-year old is least likely to vote even though you have profiled him/her as a complainer about government.
I know for sure this is true from TWO sources:
Statistics I have often seen through life.
My own personal experience with people, both young and older.
Reply:I think it is D, older people tend to vote more because I think they realize how important it is to be counted.
Reply:While I suppose it depends on how strongly they feel about what they're voting for, I would say B or D. The corporate executive likes to vote to make sure he can stay wealthy. The computer programmer is young and wants to see if he can improve his life now that he's out on his own. The teenager probably thinks his vote doesn't count or the government fixes the elections. The college graduate is too busy unpacking if he JUST moved to a new state.
Reply:Without looking at the answers, I choose B.
Reply:i'll go with A. being newly eligible to vote, the appeal to do so is there. hopefully, an 19 year old would have learned (recently graduated) that one way to change existing policies and practices is to VOTE for someone who is promising GOOD CHANGE.
Reply:I'd go with C
Reply:I would say C as well, but maybe A would as well. I first voted at 19, because of the same reason.
B. A 22-year-old computer programmer
C. A 30-year-old college graduate who has just moved to a new state
D. A 50-year-old corporate executive who holds a master's degree in business
Which one of the following individuals would be most likely to vote?
Not really enough info to make an educated decision but I guess D.
Sry misunderstood question thought you meant vote for.oops.
Answers still the same.
Reply:c.
Reply:Just based on that? D. I would need a LOT more info to vote for anyone.
Reply:As a general rule, the likelihood of voting increases with age and intelligence.
So the 50-year old corporate executive is most likely to vote of those listed.
The 19-year old is least likely to vote even though you have profiled him/her as a complainer about government.
I know for sure this is true from TWO sources:
Statistics I have often seen through life.
My own personal experience with people, both young and older.
Reply:I think it is D, older people tend to vote more because I think they realize how important it is to be counted.
Reply:While I suppose it depends on how strongly they feel about what they're voting for, I would say B or D. The corporate executive likes to vote to make sure he can stay wealthy. The computer programmer is young and wants to see if he can improve his life now that he's out on his own. The teenager probably thinks his vote doesn't count or the government fixes the elections. The college graduate is too busy unpacking if he JUST moved to a new state.
Reply:Without looking at the answers, I choose B.
Reply:i'll go with A. being newly eligible to vote, the appeal to do so is there. hopefully, an 19 year old would have learned (recently graduated) that one way to change existing policies and practices is to VOTE for someone who is promising GOOD CHANGE.
Reply:I'd go with C
Reply:I would say C as well, but maybe A would as well. I first voted at 19, because of the same reason.
Subscribe to:
Posts (Atom)