|
You are at least on the wrong forum (C# not C++). Anyway I think you are looking the wrong way. If you see the basic math operations are too slow, maybe there is a need to change the algorithm? Please take a look at http://en.wikipedia.org/wiki/Prime_number[^]. There are also two basic ways for finding prime numbers.
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
thanks......
looking for other places for potimising....
i do not think its is a slow code, its just that there is alot of numbers to run, så any improvment in program code will be signifigant i think.
/t
|
|
|
|
|
http://en.wikipedia.org/wiki/Prime_number
There are some very fast prime number generators and such out there.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Hi all,
I have an unmanaged dll written in VC++ 6.0. I want to pass my custom messages from dll to C# application. C# application should retrieve this message from its message queue. My problem is that i want to run that C# application as Windows Service without UI and i need a mechanism of Message loop without UI so that i can receive the messages posted by the dll inside that service.
Thanx.
Rashid Mahmood
"Imagination is much more important than implementation"
|
|
|
|
|
Hello
You can pass a delegate of a function that queues messages, then deal with it in the dll as a function pointer.
Check interoperability articles for details.
Regards
|
|
|
|
|
Thanx.
Is there any way like MessageFilter that work on threads other than UI threads.
Bcz i need a builtin message queuing system.
"Imagination is much more important than implementation"
|
|
|
|
|
Hello
You can use the Windows API function PostThreadMessage() and supply it with your service's thread id, but catching the message would be a tricky part!! I don't have anything about it in my mind for now.
Yet why making things complicated for yourself??
Regards
|
|
|
|
|
Hi,
I have the following problem. I create a file using the SaveFileDialog class. The file gets created in ANSI encoding, this according to many programs including notepad and MS Word. But then i try to write strings in non english languages and i get those symbols you know. OK, to try to solve this issue i set the text i want to write to UTF-8 encoding for international character support but the problem is: Have you ever tried to write utf-8 or variants to an ascii file? it's a mess!
Is there a way to solve this problem in any way? Creating the file with different encoding (don't know how to do this cause the file gets created in ascii by force) or changing it's encoding type later.
Thanx.
|
|
|
|
|
Hello
Heinz_ wrote: The file gets created in ANSI encoding, this according to many programs including notepad and MS Word.
Who in the world said that?!?!?
You can create your file in any format you want. Besides, if you want to write text in UTF-8, here is a sample:
SaveFileDialog save = new SaveFileDialog();
save.ShowDialog();
StreamWriter Fs = File.CreateText(save.FileName);
Fs.WriteLine("Test");
Fs.WriteLine("اختبار");
Fs.WriteLine("épreuve");
Fs.WriteLine("Prüfung");
Fs.WriteLine("试验");
Fs.WriteLine("試験");
Fs.Flush();
Regards
|
|
|
|
|
Hi, thanx for your answer and your code. I know taht your code works cause i have used this write method tons of time but this time i'm using the Stream class returned by SaveFileDialog.OpenFile(), this write method uses arrays of bytes to write to the files so characters in strings must be converted to bytes corresponding to the encoding type. This is where this encoding type compatibility game begins.
I think i'll have to recode this block of code again to use the great StreamWriter, thanks in advance,
Heinz
|
|
|
|
|
Nader Elshehabi wrote: Heinz_ wrote:
The file gets created in ANSI encoding, this according to many programs including notepad and MS Word.
Who in the world said that?!?!?
Regarding to this, when you call SaveFileDialog.ShowDialog() and the DialogResult is OK, or al least when you call SaveFileDialog.OpenFile(), your file gets created automatically and by force in an ANSI or ASCII formatting, check this info by opening the file with any word editing software that can show you the formatting type info.
This is how it works, i didn't say anything, don't blame me.
|
|
|
|
|
I tried the above write method, it works ok, it writes international characters (checked by opening it with notepad) and the encoding type of the file is UTF-8. The file i create and write is a csv.
I have another problem now, when i open this file with Excel these special characters are replaced by those weird symbols. Thats an Excel bug but how to solve it?
Thanks.
|
|
|
|
|
Hello
For this you have to check the language settings of Excel, or even your windows. Sorry, I don't think I can be of an assistance there.
Regards
|
|
|
|
|
hi all,in my web application link buttons are not working,it works well upto yesterday but today morning it's not working what will be the problem.in the link button click event,i just add the code to redirect the page nothing more.
what will be the prob.....i really struck with this prob....
Regards,
ayyp
|
|
|
|
|
If you use Visual Studio, it sometimes remove the click evnet in the "Web Form Designer generated code"
|
|
|
|
|
my application is actually a web application where i manually upload CSV file to the database.but i want to automate the process,so i have thought of a second stage to this application i.e through a windows application i would download the CSV file from the NSEIndia.com site automatically and then upload the same to SQLServer on the server.i dont have any idea about auto-upload i.e exporting the data to the database automatically.it would be a great help to me if any one could provide me a solution either in VB.Net code or C# code.
AMIT(TATA CMC)
-- modified at 4:51 Tuesday 11th July, 2006
|
|
|
|
|
Hello
amitcoder83 wrote: i am facing a problem with upload
Pardon me if I ask... What is exaclty your problem???
amitcoder83 wrote: if any one could provide me a solution
Indeed, but to what??
Regards
|
|
|
|
|
the actual problem is upload,i dont have any solution for automatic uploading can u give me a solution
Amit(TATA CMC)
|
|
|
|
|
Hello
There should not be any problem. Just work it out systematically.
1- You mentioned that downloading isn't a problem. So should the upload.
2- you got a CSV file, so you should parse it fist. I think that's easy, isn't it??
3- About the auto upload. If you mean for example that you put the files in a certain folder. Then when you launch the program it will automatically enumerate the files and upload them to our SQL server, hen what would be the problem here?
4- Uploading the values of the CSV files -or even the entire files without parsing-, is just a matter of connection to the sql server on the net. There are BOOKS on that, not just articles. Yet These following links may give you a push in the right direction:
CodeProjects Databse Page[^]
Especially this article:
Uploading / Downloading Pictures to / from a SQL Server[^]
After all that, I still have a bad feeling that I didn't get your problem correctly, did I? If so, posting the code that's causing you the problem would be helpful.
Remember that SQL server on the internet can be dealt with as if it's on a LAN or even on your PC -with some differences of course;)-. Just take care of the settings of the server.
Time to do some homework.
Regards
|
|
|
|
|
How I can write a custom control, like Add/Remove Programs List in Control Panel (Windows)?
|
|
|
|
|
Hello
Sashulika wrote: like Add/Remove Programs List
Like it in what exactly??
Ps.
There is a project named UserControl int he new projects list if that's all you want.
Regards
|
|
|
|
|
That's not a question that can be answered on a message board. Creating custom controls can be very complicated. You'll need to read whatever is in MSDN regarding custom control development. Then look for samples on CP. Who knows, there might already be a control that does what you need out on the web somewhere.
:josh:
My WPF Blog[^]
|
|
|
|
|
Hi All,
I have some int that i use in my project.
I need to print the value - but i must print it in 2 digit place.
I mean that if the int is 2 i need to print it as "02" and if its 15 it need to be as string "15".
How can i do it ?
Thanks for any help.
|
|
|
|
|
This[^] MSDN page lists all the custom numeric formatting strings. For your requirement, all you need to do is
int x = 2;
string formattedValue = x.ToString("00");
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Lets suppose that your int is i. Then you can use following code:
String intI=i.ToString();
if(intI[0]!='0')
intI="0"+intI;
Console.WriteLine(intI);
Regards,
Wasif Ehsan.
|
|
|
|