|
Explore the directx sdk on microsoft .
|
|
|
|
|
sameone can give me a more detailed answer, tnx.
|
|
|
|
|
i've used the Bob Bradley's textbox but i don't like it, becouse it has some bugs, can you show me another free to use or some tutorial by others to create one?
tnx
|
|
|
|
|
Now as I have told earlier, I am just 30 days old baby as far as C# is considered. But amibition knows flying since its birth.
I am interested in harnessing the power of C# for scientific calculation. I want to create a console like structure as cmd.exe in XP, which does mathematical calulation. Like if i write
>> 3+2 [Enter]
5
The output should be 5. How ambitious am I and where do I go before I see no falling of my ambition? What are the issues assocoated with it?
Regards,
Amit
|
|
|
|
|
This is pretty easy to do, you're talking about a console application, with a parser in it
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Well, you know how to write a console application, generally, right ? Then you need to accept input, presumably a string at a time, and then parse it to work out what is being requested, I guess first by looking for numbers and operators, then working out the order of operations.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can anyone help me with this problem, i am going blind looking at the code trying to figoure out whats wrong with it.
This is what I am trying to do ..
I have a small Form with a button, when the user clicks the button on the form, my program connects to a server and receive som information.
The server responds and sends back a couple of lines with text to my program, then my program prints out the info to the console. Simple enough rite ?
It actually works, or so it does the first time i click the button, but the second time i click the button my program decide only to print out the first line of what the server sent back to it.
First click on button: The program works 100% and prints out all the lines sendt from the server
Second click on the button: The program only prints out the first line of what the server sent back.
This is what i have in the button clickevent
NetworkStream myNetworkStream;
TcpClient tcpC = new TcpClient();
tcpC.Connect("home.bergetun.net",14000);
myNetworkStream = tcpC.GetStream();
string myCompleteMessage = "";
if(myNetworkStream.CanRead)
{
byte[] myReadBuffer = new byte[1024];
int numberOfBytesRead = 0;
do
{
numberOfBytesRead = myNetworkStream.Read(myReadBuffer, 0, myReadBuffer.Length);
myCompleteMessage =
String.Concat(myCompleteMessage, Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead));
}
while(myNetworkStream.DataAvailable);
Console.Out.WriteLine(myCompleteMessage);
}
myNetworkStream.Close();
tcpC.Close();
|
|
|
|
|
I'm surprised it even works it all.
The problem is, while "DataAvailable" is up to the vagueries of the server and the connection. If the server hasn't sent any data when you get to this point in the code, then there won't be any data available.
Even worse, if you try this over a real internet connection, packet delays, TCP/IP error recovery, etc., will delay your data in a completely random manner, so you can never rely on DataAvailable.
Pretty much, you need to put this code in a thread and the server should send some indication of how many lines the client should be expecting.
Hope that helps.
Marc
My website
|
|
|
|
|
Hmmm.. The problem is that the server doesnt give me a indication on how many lines to expect.
|
|
|
|
|
jbergetun wrote:
The problem is that the server doesnt give me a indication on how many lines to expect.
Ah, so you didn't write the server side?
Well, then I guess, then the approach would be to have thread that updates the string as information comes across. Maybe with some sort of a timeout "ok, I'm done waiting for the pokey server". That's pretty bad design on the part of the server, though!
Marc
My website
|
|
|
|
|
Can i get DirectX to play streams?
The stream is of a music file from the resources.
Also, once i've created a stream, can i save the file to the hard drive somewhere?
|
|
|
|
|
Please is there any one out there that can help me I am having a very tough time trying to figure this crap out. I know I have to create a loop to find the prime numbers, but i can't figure it out. I have never done any programming before. This is my 4th week in my C# programming class and its going to fast for me.
This website is supposed to have free code and tutorials. does anyone know the code for this? Please help I am lost!
Ryan
|
|
|
|
|
okay I found a code that displays the prime numbers, but i need to find the average of the dispalyed prime numbers. Here is the code does anyone what to let me know how to find the average please.
using System;
namespace PrimeNumbers
{
///
/// Summary description for Class1.
///
class PrimeNumbers
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
// Ask the user for the quantity to check for Prime Numbers.
Console.Write("Please enter the quantity to test for Prime Number: ");
// Assign topNumber with User's Input.
ulong topNumber = ulong.Parse(Console.ReadLine());
// Create an boolean array, numbers
bool[] numbers = new bool[topNumber];
// Assign all the values in numbers with 'true'.
for (ulong i = 0; i < topNumber; i++)
{
numbers[i] = true;
}
// Assign all those mutiples of 2 and 3 to be 'false'.
// So that it facilitate you in finding the Prime Numbers.
for (ulong i = 2; i < topNumber; i++)
{
if(numbers[i])
{
for(ulong j = i * 2; j < topNumber; j += i)
numbers[j] = false;
}
}
// The counter to count how many Prime Numbers.
ulong primes = 0;
// For the remaining numbers which are still 'true' are Prime Numbers.
for (ulong i = 1; i < topNumber; i++)
{
if(numbers[i])
{
primes++;
Console.Out.WriteLine(i);
}
}
Console.Out.WriteLine();
Console.Out.WriteLine(primes + " out of " + topNumber + " prime numbers found.");
Console.In.ReadLine();
}
}
}
Ryan
|
|
|
|
|
Well, an average is the sum of the numbers divided by how many numbers there are. You already know how many primes there are (ulong primes), you just need another variable to total them inside the same loop (the last loop). Then, after the loop exists, compute the average.
I'd rather not show you the exact code, because you're supposed to learn something.
BTW, the comment "Assign all those mutiples of 2 and 3 to be 'false'" should either read "Assign multiples of 2 to be false for all numbers", or "assign multiples of 2, 3, ... up to topNumber to be false".
And also, it's sort of pointless to assign multiples of i where i > topNumber / 2, since any multiples are outside of the range of the array.
Most of programming is NOT coding, it's figuring out the algorithm. Good luck!
Marc
My website
|
|
|
|
|
Pffff well done.
I make myself some work in the other thread to post you some code just to realize now that you already found most of what you were searching for.
Please stick to ONE thread and dont hop around.
|
|
|
|
|
hii all;
i want ask some questions about network.
1-if am in lan and we connect to internet through proxy server. of course the proxy replace each request ip address of any machine on lan by his ip. the destination host will replay on proxy ip. how can the proxy determine the staion on lan who made original request to take response? also same question if i access internet in lan through (ics) for ex pc has modem
2- if i bind a sockt on lan its address and port will be on lan only. if this machine can access internet through lan is there away to bind it on lan router which access internet or i mean the interface which has direct access to internet so i can communicate with it from outside like imesh wich can work even if am in lan?
marcoryos
|
|
|
|
|
With an admission that i am quite novice to C#, (i am only 30 days old) i have few doubts if C# is suited for engineers? Say, if I want to develop a numerical tool to do some matrix calculation or Computational Fluid Dyanmics Analysis, should i prefer C or C++ or C#....I know MATLAB is written in C and so do some other engineering software.
Regards,
Amit
|
|
|
|
|
amitmohanty wrote:
i am only 30 days old
Your parents must be congratulated as your linguistic skills for such a young person are way above what I could have ever expected.
amitmohanty wrote:
i have few doubts if C# is suited for engineers? Say, if I want to develop a numerical tool
Does this answer your question? Harness the Features of C# to Power Your Scientific Computing Projects[^]
- SUMMARY: The C# language has been used quite successfully in many kinds of projects, including Web, database, GUI, and more. One of the last frontiers for the application of C# code may well be scientific computing. But can C# measure up to the likes of FORTRAN and C++ for scientific and mathematical projects?
In this article, the author answers that question by looking at the .NET common language runtime to determine how the JIT compiler, Microsoft intermediate language, and the garbage collector affect performance. He also considers C# data types, including arrays and matrices, along with other language features that play an important role in scientific computing applications.
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Well I am 30 days old means I have started coding C# since last 30 days. I usually code in MATLAB and C.
Thanks, reading your link. Let me see what it has to offer.
Regards and Thanks,
Amit
|
|
|
|
|
|
Thats okay. Its fun By the way, the article is exactly what I was looking for. Thanks a lot.
Amit
|
|
|
|
|
Are you going to stick with C#?
/\ |_ E X E GG
|
|
|
|
|
Well thats a good question. I think nothign is all good and perfection is a myth. So I am still trying to find out what are the drawbacks of doing coding with C# if i am trying to develop a scitific tool. I will wait and see. But anyway, if nothign else I would still learn it. I like it. Reasons may be unknown. Now can anone tell me what is not so good about C# if i am considering scientific computing?
Regards,
Amit
|
|
|
|
|
amit
If you read the article posted by Colin, it is pretty interesting. The article was very interesting if you are a hardcore matlab user and seeing how one can exploit c#.
In the mean time you can take a look at this
http://www.codeproject.com/csharp/dynmatrixmath.asp
In my opinion having come from an embedded systems background and moving into windows application development, I have to say that matlab is simply the best for prototyping algorithms quickly and efficiently. The answer is partly baised because i have used matlab for 8 years and c# for 3 months. If you are going to do simulations using the model developed in matlab you can always run it on a unix box as well.
I have to say c# is fantastic for doing all the pretty window gui things
You can also do matrix calculations in c++ because i recall seeing someone develop c++ matrix libraries to give c++ matlab like matrix functionalities.
cheers
|
|
|
|