One C program I encountered requires it to search for the country name base on the country code.
The program read from a reference file and use 1 array to store country_name[] & another to store country_code[].
Then it read from the raw data file which contains the country_codes. It use a for loop to try to match the country_code from the raw data file and the arrays to get the country_name. The it print it to another file.
This is stupid, I change the C program so that the array for country_name[] use the country_code as index. eg. country_name[country_code] This method eliminate the use of for loops.
When the program read from the raw data file, it directly use the country_code to get the country_name without searching for it in a loop.
eg. print country_name[country_code from raw data file].
This speed up the C program.
Array and Pointer are not the cause for slow speed
on
Arrays vs Pointers in C?
·
· Score: 2, Interesting
First of all, the array and pointers are not the reason why a C program run slowly.
"Unnecessary looping" is the cause of the problem. I have encountered and fixed many C programs created by programmers, who have left the company.
I have found that many programmers like use alot of for-loop and while-loop in their programs. Most of the time, the algorithm of their C programs can be modified to reduce the need for the loops and increase the speed of the C programs by 10 times or more.
I believe you have confuse Steve Jobs with another co-founder Steve Wozniak. Steve Jobs is the marketing guru while Steve Wozniak is the technical guy, who created the Apple I & II and wrote sweet-16.
According to the old Byte Magazine, Woz wrote sweet-16 for Apple II because it is a 8 bits machine and he need to use a 16 bits pointer to address the memory.
You hire good programmer to make code. You hire average programmer to make test. You hire cheap programmer to make documentation. You hire bad programmer to make coffee. You hire sexy programmer to make love. You hire ugly programmer to make installation CD.
The software will be affordable. Good programmer - high pay but U hire only one. Average programmer - average pay. Cheap programmer - low pay. Bad programmer - under pay. Sexy programmer - average pay. Ugly programmer - low pay.
NASA is in a budget crunch ????
Bull shit. They can learn from the Russian, get money from space tourists.
For example, charge Bill Gates $1 Billion to go to sent him out of space and charge him $20 Billion to get him back to earth.
Why is it so expensive to get back ? Well, he must out bid millions of hackers and his competitors (Sun, IBM, Netscape, AOL, Apple ) who are willing to pay NASA to leave him out there.
Well, it you don't want to move out of your "COMFORT" zone, you will never succeed in losing weight.
I use to be fat. I eat a big breakfast, a bigger lunch and a huge dinner everyday. When I decided to lose weight. I just eat my food in the reverse order. I eat a small breakfast, a smaller lunch and a tiny dinner. On top of that, I run 2 miles everyday.
Within a month, I lost 3 inches.
A lot of people will tell you don't eat fatty food, don't eat food with high sugar content or eat only protein. However, what really matters is not the type of food you eat. But the amount of food you eat. Try to control the amount of food you eat and maintain a balance diet. for example if you eat steak for lunch, then you should eat salad for dinner.
The banned Arcades actually serve as a front end for the street gang recruitment. The gang lure students to the Arcades, let them think they can easily win alot of extra pocket money. However, at the end of the day those student will end up owning the gang alot of debts. Inorder to clear the debt, they must work for them by selling illegal pirated VCDs or drugs. If the students happens to get caught, the authority will have alot of problems dealing with them because they are underage. So a ban on the arcades actually helps to protect young people from bad elements.
You may lose what you EARN but you won't lose what you LEARN :)
I can manage all their exe-files, X-files and XXXXX-rated files :)
The most beautiful equation is ......
0 0000000000
income - spending = 1000000000000000000000000000000000000000000000000
When your mind is in the algorithm, you will have no time to feel depress. Thats why whenever I feel the blues, I start coding like a mad man.
This measure will help authority to trace the terrorists, who use cell phones to trigger bombs.
using binoculars are too low tech.
p
Some criminals are using card readers and hidden cameras.
http://www.snopes.com/crime/warnings/atmcamera.as
http://bizpartner.com.my/article/23
In Malaysia, a gang even created a fake ATM machine that "collected" the users cards and pin numbers.
By the time the user get the new ATM card and the bank statement. Thousands of dollars would have disappear from their account.
Example for avoiding loops
One C program I encountered requires it to search for the country name base on the country code.
The program read from a reference file and use 1 array to store country_name[] & another to store country_code[].
Then it read from the raw data file which contains the country_codes. It use a for loop to try to match the country_code from the raw data file and the arrays to get the country_name. The it print it to another file.
This is stupid, I change the C program so that the array for country_name[] use the country_code as index. eg. country_name[country_code]
This method eliminate the use of for loops.
When the program read from the raw data file, it directly use the country_code
to get the country_name without searching for it in a loop.
eg.
print country_name[country_code from raw data file].
This speed up the C program.
First of all, the array and pointers are not the reason why a C program run slowly.
"Unnecessary looping" is the cause of the problem. I have encountered and fixed many C programs created by programmers, who have left the company.
I have found that many programmers like use alot of for-loop and while-loop in their programs. Most of the time, the algorithm of their C programs can be modified to reduce the need for the loops and increase the speed of the C programs by 10 times or more.
I believe you have confuse Steve Jobs with another co-founder Steve Wozniak. Steve Jobs is the marketing guru while Steve Wozniak is the technical guy, who created the Apple I & II and wrote sweet-16.
According to the old Byte Magazine, Woz wrote sweet-16 for Apple II because it is a 8 bits machine and he need to use a 16 bits pointer to address the memory.
You hire good programmer to make code.
You hire average programmer to make test.
You hire cheap programmer to make documentation.
You hire bad programmer to make coffee.
You hire sexy programmer to make love.
You hire ugly programmer to make installation CD.
The software will be affordable.
Good programmer - high pay but U hire only one.
Average programmer - average pay.
Cheap programmer - low pay.
Bad programmer - under pay.
Sexy programmer - average pay.
Ugly programmer - low pay.
True, there are no "best" language, just good/bad programmer and good/badly design applications.
NASA is in a budget crunch ????
Bull shit. They can learn from the Russian, get money from space tourists.
For example, charge Bill Gates $1 Billion to go to sent him out of space and charge him $20 Billion to get him back to earth.
Why is it so expensive to get back ? Well, he must out bid millions of hackers and his competitors (Sun, IBM, Netscape, AOL, Apple ) who are willing to pay NASA to leave him out there.
Well, it you don't want to move out of your "COMFORT" zone, you will never succeed in losing weight.
I use to be fat. I eat a big breakfast, a bigger lunch and a huge dinner everyday. When I decided to lose weight. I just eat my food in the reverse order.
I eat a small breakfast, a smaller lunch and a tiny dinner. On top of that, I run 2 miles everyday.
Within a month, I lost 3 inches.
A lot of people will tell you don't eat fatty food, don't eat food with high sugar content or eat only protein. However, what really matters is not the type of food you eat. But the amount of food you eat. Try to control the amount of food you eat and maintain a balance diet. for example if you eat steak for lunch, then you should eat salad for dinner.
First, FIX the PRESENT OS so that it will be immune to
I_LOVE_U => NIMDA virus
Then think about FUTURE OS
The banned Arcades actually serve as a front end for the street gang recruitment. The gang lure students to the Arcades, let them think they can easily win alot of extra pocket money. However, at the end of the day those student will end up owning the gang alot of debts. Inorder to clear the debt, they must work for them by selling illegal pirated VCDs or drugs. If the students happens to get caught, the authority will have alot of problems dealing with them because they are underage. So a ban on the arcades actually helps to protect young people from bad elements.