|
What do you mean? Can you give us an example?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I have a String
I wish to check that are there repeat substring in the String and what substring repeat.
Sorry fro bad English
Thank You.
|
|
|
|
|
hi,
These contents i want to insert after farm elements where farm is equal to dev2
<database state="0" name="one" sourceType="amacs">
<database>
I want Xml(database) to be inserted after farm where farm is equal to "dev2"
I am giving you the structure of XML file
<?xml version="1.0" encoding="UTF-8"?>
<root>
<farm-config>
<farm name="dev1">
<connection address="localhost" user="root" selectedConnection="1" password="ram">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
<database state="0" name="bd_plc1_house1_14022005" sourceType="amacs">
<tables state="0" name="feed_delivery">
</table>
</database>
</farm>
<farm name="dev2">
<connection address="localhost" user="root" selectedConnection="1" password="ram">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
</farm>
</farm-config>
</root>
i have the code pls anybody can modify it
This code givens syntax error
xmldoc.DocumentElement["farm name='dev2'"].PrependChild(databaseElement);
regards
sanjeev
|
|
|
|
|
Hi
I want to add string to an array and retrieve that string from Array
Pls send me code for that regards
sanjeev
|
|
|
|
|
ArrayList myStrings = new ArrayList();
Add item to array:
myStrings.Add("string1");
myStrings.Add("string2");
myStrings.Add("string3");
Get item at index "index":
string getString=(string)myStrings[index];
modified 12-Sep-18 21:01pm.
|
|
|
|
|
If you mean add ONE string as array,you can add it by several methods as Split(),and Substring(),or ToCharArray().
|
|
|
|
|
Hi,
I want to create a textbox which shows text in black when disabled.
Unfortunately the selecting, deleting and editing the text don't work and it's in a different font.
Does anyone know what code I need to add to make the textbox work like a textbox except for the enabled = false part?
Thanks,
Serdar YILMAZ
Senior Developer
|
|
|
|
|
Have you inhereted your class from TextBox() ?
|
|
|
|
|
If someone know yahoo messanger or msn know i can press a button in the chat window and other play a sound to make quaver the chat window.
How can i do it using c#?
Tnx
|
|
|
|
|
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.
|
|
|
|