Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do the sinclock before anything else in that function. Move line 4 up to between lines 1 and 2 and move line 6 down to line 11. If you don't want to lock the entire thread then you might consider something like this: (I'm not VB.NET expert, but I think this will work)

  Private Sub Callback(ByVal o As Object)
      Dim Task As Action = Nothing
      SyncLock (Lock)
           If tasks.Count > 0 Then
              Task = tasks.Dequeue
            END IF
      End SyncLock
      IF Task <> Nothing THEN
        Task.BeginInvoke(AddressOf Callback, Nothing)
      Else
        Threading.Interlocked.Decrement(RunningThread)
      End If
    End Sub
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can also "shorten" it by putting several items on each line instead of one per.

Yes, but that would make it more difficult to change in the future.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

just delete line 21, not needed since those pointers were not allocated by calls to malloc()

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why not just copy the libs anywhere you want on the file system then use the -L<directory> to tell gcc where the library is located.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Actually XP support is ending April 2014

Ok, I'm just adhead of my time :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I also agree. When I was working on a team several years ago, I was senior member and young people was ask me how to do this or that. My response: RTFM! and use google to do research. If they still couldn't figure it out then I'd help them. It's surprising how much we can learn by reading manuals, learned a lot more than I had intended.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sounds like you are not logged in. Look in the purple ribbon at the top of the page, It should say "Logged in as Fiorentino01^" If it doesn't say that then you need to hit the login button.

The recommended way to thank someone is to hit the Up Arrow that appears to the right of the "Flag Bad Post" link. You can put in a comment if you want.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Microsoft does not support XP any more, so you probably can't get the service packs for it. Your hardware is too old to support Windows 7 or 8, so I'd suggest you toss out that computer and get a new one that will last a few years.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can install both if you want to as long as your computer has sufficient free disk space. If I were you I'd get Visual Studio 2012 Express and use VC++ 2008 only if you need to. Microsoft put all their compuiler into a single package, you can't just get VC++ 2012.

I have both 2012 Express and 2012 Pro installed on the same computer with no problems. I was using the Express version for awhile until I came upon something that it could not do. So, since I hade not purchased a Pro version since VC++ 6.0 I decided to just buy it. I could now uninstall the Express version because it is no longer of any practical use.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

it's been off-topic for a couple of days now, but that's the way it goes in Geek's Lounge :)

diafol commented: Haha know what you mean +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So that's your logic?

more drugs = more violence
more guns = less violenc

I didn't say that at all. What I meant was this:

more drugs = more guns = more violence

Here are a few interesting stats: This is the result of President Lyndon Johnson's so-called "war on drugs" in the 1960s. Big big failure.

(US Drug Prisoners) "The United States leads the world in the number of people incarcerated in federal and state correctional facilities. There are currently more than 2 million people in American prisons or jails. Approximately one-quarter of those people held in U.S. prisons or jails have been convicted of a drug offense. The United States incarcerates more people for drug offenses than any other country. With an estimated 6.8 million Americans struggling with drug abuse or dependence, the growth of the prison population continues to be driven largely by incarceration for drug offenses."

(Offense Distribution by Race/Ethnicity and Gender) "At yearend 2010, male and female state prison inmates differed in the types of offenses for which they were sentenced. At yearend 2010, 25% of female inmates in state prisons were incarcerated for drug crimes, compared to 17% of male inmates. Property crimes comprised 29% of the overall sentenced female population in state prison and 18% of the overall male population. An estimated 37% (34,100) of females in state prison were held for violent crimes, compared to 54% (689,000) of males. The percentage of females serving time …

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just delete the column names in parantheses. Surely you don't want me to come to your house and do your typing??

Dim SqlStatement As String = "INSERT INTO tblcenterlane VALUES( /* blabla */)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

. Chivalry is associated with a time in history when women were considered property.

Not really. I never considered my wife "property" (well, on the otherhand maybe I did, and the reverse was true too). People act like that even today. People are not property like you could buy/sell a dog, horse, car, house, etc. But property they are. If you don't believe me, the next time your wife or girl kisses (and I don't mean a simple peck on the cheed) another person do you get jealous? My wife used to say "That's my man, keep you paws off him!"

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Jesus isn't the only one who can raise things from the dead :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is that inserting a value into every column of the table? If it is then you don't need to specify the column names.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes, like this: mkdir("c:\\one\\two\\three"). (you actully need four of them to post here because the editor removes two of them. That is escaping the escape character \)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Don't you have to pass a user name and password (for security reasons don't post them here)?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First you will have to learn fundamentals of SQL (Structured Query Language), which is the language used by Access and other databases such as MySQL, Oracle, Sybase and MS SQL (there are lots of others too). If you already know that then go on to reading a tutorial. Here is a link that has other links to Microsoft tutorials

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

foo() on line 4 of that code is a pointer, not a function. All pointers regardless of type are the same size, and in 32-bit compilers they are 4 bytes. szieof() does not work on functions as it treats function names as pointers to a function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Another hint: mkdir() only works on one directory at a time. You have to call mkdir() for each new directory in the directory hierarcy. If you want to create a directory "c:\one\two\three" then call mkdir("c:\one"), mkdir("c:\one\two") and finally mkdir("c:\one\two\three")

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what is point3d?

line 31 doesn't work because there is no memory allocated for the pointers. We hve no clue what point3d and edge are so we can't really help you very much, except to say they are pointers which need to be allocated before attempting to read the data into them.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This has been going on for a few generations now with the "spare the rod and spoil the child" attitude. Ok, so the phrase is pretty old (coined in 1662) Parents can't even spank a child without getting arrested for child cruelty. I got ass likings when I was a kid and I grew up ok (at least I think I did)

I believe use of hard drugs (meth, coke, etc) are the downfall of any society. The more drug use we see the worse we are. Why do you think there is so much violence in America? Probably drug use has a lot to do with it. Dugs make people do things they wouldn't do otherwise.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is a good tutorial, it's written in vb.net but its almost identical to C# because they both use .NET framework classes and namespaces.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Dani has said several times before in this forum that there is nothing wrong with resurrecting old threads as long as the new posts are relevant to the topic.

Here is one of the threads. I seem to recall others.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'd suggest he starts to learn how to program any language, but probably start with VB.NET (Microsoft Visual Studio Express version is free). There are lots of intro tutorials on the web, and several books at amazon.com. Unfortunately he is too young to join DaniWeb (minimum age is 13). There are a lot of concepts he needs to learn before he can actually program is first game. If he is a fast learner then it shouldn't take more than a couple weeks, if that, to get through it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

@Rahul47: G_Waddell already provided some info about two commonly used databases, you just appeared to have ignored that advise. In addition to VB.NET you will have to learn how to communicate with the databases, the language is SQL (Structured Query Language). There are a number of online tutorials to help you with that.

If you want to use MySQL (recommended because it is very popular and it is free) here is a tutorial that uses vb.net to create/update files on mysql database. It's a pretty good tutorial, I just finished it myself last week.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

o you think the USA is some how different from the rest of the world

Yes. AFAIK the rest of the world doesn't have the Second Amendment rights to their constitutions. Our government can not arbitrarly disarm Americans as governments of other countries have done. Americans are so well armed that it would be impossible for our government to do that even if the Second Amendment were somehow abolished. Any attempt to do that would be met with bloody (bloodbath) resistance (civil war).

According to this NBC article there are enough weapons in the USA to give every citizen a weapon (not counting weapons on military installations).

How many guns do Americans own?
According to the Congressional Research Service, in 2009 there were an estimated 310 million firearms in the United States (not including weapons on military bases), of which 114 million were handguns, 110 million were rifles, and 86 million were shotguns. The current population of the United States, according to the Census, is around 314 million.

[edit]I just found out that there are quite a few countries that have right-to-bear-gun laws (link)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You could do that, but there is a much easier way if you use the macros in ctype.h

if( isdigit(i) )
{
    // blabla
} else if( isalpha(i) )
{
   // blabla
 }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Maybe 12-year-old don't know, but older students should. Isn't that taught in Programming 101?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

States’ crime rates show scant linkage to gun laws

President Obama has called for stricter federal gun laws to combat recent shooting rampages, but a review of recent state laws by The Washington Times shows no discernible correlation between stricter rules and lower gun-crime rates in the states.

States that ranked high in terms of making records available to the National Instant Criminal Background Check System also tended to have tighter gun laws — but their gun-crime rates ranged widely. The same was true for states that ranked poorly on disclosure and were deemed to have much less stringent gun-possession laws.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Professor John R. Lott, Jr. from University of Chicago Law School conducted a study of the impact of Brady gun control laws (link)

At the Democratic convention, President Clinton played up his proposed expansion of the 1994 Brady Law, which by making it harder for men convicted of domestic violence to obtain guns is designed to reduce crime against women. Our study is the first to provide direct empirical evidence of the Brady Law's effect on crime rates and we found just the opposite result: The law's implementation is associated with more aggravated assaults and rapes. Mrs. Brady's exaggerated estimates of the number of felons denied access to guns are a poor measure of the law's impact on crime rates.

What about minor disputes such as traffic accidents? Are legal owners of concealed handguns more likely to use them in such situations? In 31 states, some of which have had concealed weapons laws for decades, there is only one recorded incident (earlier this year in Texas) in which a concealed handgun, was used in a shooting following an accident. Even in that one case, a grand jury found that the shooting was in self-defense: The shooter was being beaten by the other driver.

And what about accidental deaths? The number of accidental handgun deaths each year is fewer than 200. Our estimates imply that if the states without "shall issue" laws were to adopt them, the increase in accidental handgun deaths would be at most nine more …

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You keep repeating that gun control laws have no impact and are just to make some people feel good.

I was talking about USA, not other countries.

but you can't keep repeating your point and expect rational people to buy it

Prove to me otherwise. Show me statistics where gun control laws in USA have made a significant impact. You can't, because there aren't any.

As an example in 1976 Washington D.C. banned handguns (click on chart title for source link) link)

During the years in which the D.C. handgun ban and trigger lock law was in effect, the Washington, D.C. murder rate averaged 73% higher than it was at the outset of the law

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Most programmers do NOT use Notepad or any other plain text editor, they use what's called an IDE (Integrated Development Environment). It includes a text editor, project editor, and the compiler (or ability to set up for some other compiler).

For MS-Windows and *nix I'd suggest Code::Blocks, you can download MS-Windows version free from here. If you don't already have a compiler installed on your computer (which you probably don't), you will want to download the version that includes MinGW compiler. Here is a YouTube tutorial how to get started using it. Although there are a lot of other IDEs, Code::Blocks is one of the easiest to learn how to use.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I love how this is always said as if it were a fact and is usually trotted out whenever any regulation is suggested in the USA almost always by people with a financial interest in avoiding the regulation

If your statement were correct then why didn't the Brady gun control laws stop gun violence? It did absolutely nothing to stop it. We have just as much if not more gun violance today then we did when those laws were passed. Brady Gun Bill == "Feel-Good about ourselves" bill with no real impact.

Take all of the mass shootings and imagine the killer was armed only with a knife. How much lower would the death toll have been?

True, but that is a fantisy world or the world before 1750 AD, not realistic.

You can actually blaim scientists (and China) for our gun violance. (link). They started it all in about 700 AD.

Another lie regarding Newtown - The killings happened because we took God out of the schools.

Never heard that one.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

C++ has supported an implicit return from main() since C++98, and C has supported it since C99.

Yes, I was just testing you to see if you knew it too :) Guess I'm getting obsolete.

deceptikon commented: ;) +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can use qsort() in C programs.

You can make an array resize itself by calling realloc() to change its size. The array has to be initially declared as a pointer, something like this: int* array = NULL; You also need to have two more integers, one integer to keep track of the current number of elements in the array, and another to keep track of the next useable element. For example initially allocate 10 elements in the array, when those are used up you have to call realloc() to increse the array size before adding another value to the array. Since reallocating array sizes is time consuming task you should realloc() the array by some constant value to reduce the number of reallocations. The value of that constant value will depend on how large you expect the array to grow.

const int BlockSize = 50; // realloc size 
void allocarray(int** array, int data, int *nItems, int* curSize)
{
    if( (*nItems+1) > *curSize)
    {
        *array = realloc(*array, *curSize+BlockSize); // increase size of array     
        *curSize += BlockSize;
    }
    *(*array+*nItems) = data;
    (*nItems)++;

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The void main() means it's techincally not legal C++.

I think it was 30 years ago, before the first c++ standards.

I think the standard says that main() will return 0 automatically.
True for C, but not C++

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And the argument "if we ban guns then only criminals will have guns" is invalid. If it held water then there would be no point in having any laws.

No need to ban guns -- there are already enough laws to put criminals behind bars for life (in some cases death penalty). Banning guns will do absolutely nothing. It works in other countries because their governments have already disarmed its citizens. I'm not an advocate of gun violence or even assult weapons. I wish we could rid our country of assult weapons, but that is just not realistically possible. And, in case anyone gets the wrong opinion, I'm not an NRA member but I am sympathetic to many of their causes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

World Famous Lie: Banning assult weapons will make America safer place to live.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Even if Congress and the Pres ban assult weapons doesn't mean the weapons will magically disappear. Such a ban will most likely have little or no affect. The ban is nothing more than a "feel good" law, making brownie points with parents who lost their children in that horrible school shooting.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Microsoft didnt warn about void main()?

No, it produced no warnings at all.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

NRA boycott kills outdoors show that banned assault weapons

A massive boycott sparked by the NRA and other gun-rights groups outraged that the nation's largest outdoors show banned the exhibition of assault weapons has caused the show's organizers to abruptly cancel the week-long event in Harrisburg, Pa

Pennsylvania Rep. Tom Marino said he was disappointed in the cancellation, and blamed Reed Exhibition's gun ban. "The decision represents yet another attempt to undermine protections guaranteed to all Americans under the Second Amendment to the United States Constitution and it restricts the ability for law-abiding citizens to purchase legal firearms that are increasingly being used for hunting in a number of states.

Link for full story

I didn't realize until I read that story that assult weapons were used for hunting! Hunting what, exactly??

I find your comment completely heartless and contemptible.

Yes, maybe my comment was going too far.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In nearly half of the real-life situations when a hand-gun is fired, it's for committing suicide.

Maybe that's a good thing. Remove the stupid gens from humanity.

mike_2000_17 commented: Suicide is a good thing!?!? Come on... that's going too far... +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Similar to when you use Win32 API functions dating to before all the post-XP strengthening of security. At least I thought so. In any case, if Microsoft hasn't officially deprecated it.

Nope. I set it to warning level 4 and no warnings, after changing <iostream.h> to <iostream> and adding the using statements.

One error: line 26 needs a semicolon at the end of the line.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The header #include <conio.h> dates back to MS-DOS and is also deprecated. Not many up-to-date compilers still provide that header, and I think that only older versions of Windows can still run it.

It was never part of the C or C++ standards, so it can't be deprecated. There are only two compilers I know of that support it: Borland and Microsoft. I don't know about Borland, but it's still supported by Visual Studio 2012.

As for the rest of your comments, he is probably using Turbo C. That was a valid program, if written 30 years ago.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It's snowing a little bit here today, just enough to make the ground white and clean looking.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Forums are not made by the "privately owned", its made by its members. If the "privately owned" made a rule such as no free speech, noone would visit the site at all.

Yes they are, Dani owns DaniWeb. In USA "Free speech" laws applies to governments, not individual people. Read Dani's post again just one week ago. If she didn't have the right to limit speech on DaniWeb then her actions in that post would have been illegal.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

After selecting the Files button in the purple bar just below Post, you will see a couple buttons called "Choose File". Hit that button then navigate to the file you want to upload and select it. After that you will still see some "Choose File" buttons, but this time there are a couple more buttons just above them -- "Insert <filename> into editor", and two more. You can select one of those options if you want to or just ignore them if you don't want to do any of them. After that, just continue editing your post, or if you are finished, hit the "Reply to this Discussion" button.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Diet Pepsi

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Except for line 3 it seems to meet the requirements of the instructions you originally posted. line 3 should be: int main() because main() always returns an int.