|
Hi,
I have to do a project on "Server Monitoring and Management using TCP and UDP"..Can you please send me any links or documents to give an idea about what does that actually mean and why is it necessary to do that....Please help me with this...thanks for any help in advance...
|
|
|
|
|
It doesn't mean much. The first bit is about managing a server, the second are network protocols. Surely you have some more requirements than that??
Regards,
Rob Philpott.
|
|
|
|
|
hi ,
all how i make a setup of my windows application for installtion can any body guide me or point me in right direction .
Best regards
Rameez
|
|
|
|
|
There are applications that can build a setup for you. Google for these terms;
- OneClick
- InnoSetup
- MSI
- InstallShield
HTH
I are troll
|
|
|
|
|
|
there is a project type in visual studio :
"New Project -> Other Project Types -> Setup and Deployment"
i used it and made a setup for my application. it is very cool and has several options that makes your work very easy.
sometimes 0 can be 1
|
|
|
|
|
Hi
You can in Visual Studio 08 Prof make another project under File -> New -> Project -> Other Project Types-> Setup Project.
Then you configure the installation project.
When you are finnished you click make Setup Project and then you have the *.exe file saved in a output folder.
DJ-Boris
|
|
|
|
|
This is My data
CategName subCateName Id Products
NULL NULL 6 Prod3
NULL NULL 9 SalesProd7
Beverages Beers 15 Bell Lager 500 ML
Beverages Beers 16 CLUB PILSENER 500 ML
Beverages Juices 24 Apple Juice
Beverages Juices 25 Chikooo Juice
Beverages SoftDrinks 26 Coke
Beverages SoftDrinks 27 Pepsi
Beverages Wines 28 RED WINE
Beverages Wines 29 White Wine
Food MeatProducts36 GOAT MEAT
Food Fruits 18 APPLE GREEN
Food Fruits 19 LOCAL ORANGES
Others OtherItems 30 BENSON & HEDGES LIGHT
VegeTable NULL 20 BEETROOT
VegeTable NULL 21 TOMATO FRESH
I got the above data into Datatable 'table' and I am trying to insert into tree view
as Categories-subcategories-Products. I have tried the following and my output in such a way i get only
one product for each categorie and sub categorie.
if (table != null)
{
foreach (DataRow row in table.Rows)
{
MainNode = new TreeNode(row.ItemArray[0].ToString());
MainNode.Name = row.ItemArray[0].ToString();
if (MainNode.Text == "")
{
MainNode = new TreeNode(row.ItemArray[1].ToString());
MainNode.Name = row.ItemArray[1].ToString();
if (MainNode.Text == "")
{
MainNode = new TreeNode(row.ItemArray[3].ToString());
MainNode.Name = row.ItemArray[3].ToString();
MainNode.Tag = row.ItemArray[2].ToString();
if (!RootNode.Nodes.ContainsKey(MainNode.Name))
{
RootNode.Nodes.Add(MainNode);
} }
else
{
ChildNode = new TreeNode(row.ItemArray[3].ToString());
ChildNode.Name = row.ItemArray[3].ToString();
ChildNode.Tag = row.ItemArray[2].ToString();
if (!MainNode.Nodes.ContainsKey(ChildNode.Name))
{
MainNode.Nodes.Add(ChildNode);
}
if (!RootNode.Nodes.ContainsKey(MainNode.Name))
{
RootNode.Nodes.Add(MainNode);
} } }
else
{
ChildNode = new TreeNode(row.ItemArray[1].ToString());
ChildNode.Name = row.ItemArray[1].ToString();
if (ChildNode.Text == "")
{
ChildNode = new TreeNode(row.ItemArray[3].ToString());
ChildNode.Name = row.ItemArray[3].ToString();
ChildNode.Tag = row.ItemArray[2].ToString();
if (!MainNode.Nodes.ContainsKey(ChildNode.Name))
{
MainNode.Nodes.Add(ChildNode);
} }
else
{
SubNode = new TreeNode(row.ItemArray[3].ToString());
SubNode.Name = row.ItemArray[3].ToString();
SubNode.Tag = row.ItemArray[2].ToString();
if (!ChildNode.Nodes.ContainsKey(SubNode.Name))
{
ChildNode.Nodes.Add(SubNode);
} }
if (!MainNode.Nodes.ContainsKey(ChildNode.Name))
{
MainNode.Nodes.Add(ChildNode);
}
else
{
for (int i = 0; i <= MainNode.Nodes.Count; i++)
{
MainNode.Nodes.Add(ChildNode);
} }
if (!RootNode.Nodes.ContainsKey(MainNode.Name))
{
RootNode.Nodes.Add(MainNode);
} } } }
Code complexity is more here...(worst) Is there any other way of implementing
like Switch or any other methods.
|
|
|
|
|
Did Any body got any idea
|
|
|
|
|
Udayaraju wrote: Is there any other way of implementing
like Switch or any other methods.
create functions to break the processing up into smaller routines. For example:
if (table != null)
{
foreach (DataRow row in table.Rows)
{
MainNode = new TreeNode(row.ItemArray[0].ToString());
MainNode.Name = row.ItemArray[0].ToString();
ProcessRow(row, MainNode);
}
}
private void ProcessRow (DataRow row, TreeNode MainNode)
{
}
and then try to break up the ProcessRow function into smaller ones. This should make it easier to see what's going on and possibly reduce some code duplication.
Visual Studio has built in refactoring tools to help with this kind of thing. Try highlighting all of the text inside of the foreach loop, goto the "Refactor" menu of the main VS toolbar and select "Extract Method" to have VS help break up your functions.
|
|
|
|
|
|
If u see the above code I have problem here to fill the remaining Data.
Please trace these at
else
{
SubNode = new TreeNode(row.ItemArray[3].ToString));
SubNode.Name = row.ItemArray[3].ToString);
SubNode.Tag = row.ItemArray[2].ToString);
if (!ChildNode.Nodes.ContainsKeySubNode.Name))
{
ChildNode.Nodes.Add(SubNode);
} }
if (!MainNode.Nodes.ContainsKey(ChildNode.Name))
{
MainNode.Nodes.Add(ChildNode);
}
else
{
for (int i = 0; i <=MainNode.Nodes.Count;i++)
{
MainNode.Nodes.Add(ChildNode);
}
}
|
|
|
|
|
Here I am trying to do like these
Beverages
| |-Beers
| |-Bell Lager 500 ML
| |-CLUB PILSENER 500 ML
| |-Juices
| |-Apple Juice
| |-Chikooo Juice
|-Food
| |-MeatProducts
| |-GOAT MEAT
| |-Fruits
| |-APPLE GREEN
| |-LOCAL ORANGES
|-VegeTable |
| |-BEETROOT
| |-TOMATO FRESH
|
|
|
|
|
Hi Guys. I'm processing a bunch of files in a directory, approximately 650 files. I read each file into mem, search for "LONER" CR and replace that with a space. The search and replace works fine. However, after it has processed say 200 files it stops with the following error message. Does anybody know what it is and how I get it fixed. As you will see I am using ReadToEnd as this is the only way I can read the file inorder to correctly pick up the invalid character. I can't change this to ReadLine.
My Code:
private void button1_Click(object sender, EventArgs e)
{
string filepath;
filepath = textBox1.Text;
char[] ch = { '.', 't', 'x', 't' };
foreach (string f in Directory.GetFiles(filepath))
{
StreamReader sr = new StreamReader(f);
StreamWriter sw = new StreamWriter(Path.Combine(filepath, f.Trim(ch) + ".new"));
while (!sr.EndOfStream)
{
string holdLine = sr.ReadToEnd();
if (String.IsNullOrEmpty(holdLine))
continue;
string output = Regex.Replace(holdLine, "\r(?!\n)", " ");
sw.WriteLine(output);
}
sr.Close();
File.Move(f, f.Trim(ch) + ".done");
sw.Close();
Error Message:
ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x1a0970 to COM context 0x1a0ae0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
You are blocking the UI thread for too long with your operations in the button click. You could try moving the processing stuff to a different thread.
Or try this,
Debug -> Exceptions -> Managed Debug Assistants
and uncheck the ContextSwitchDeadlock item
Even though the second one might overcome the error, i would recommend the first suggestion of moving the file processing to a differnt thread. Your UI will be non-responsive(hung!!) for the period the file is being processed and will beat the fact of having a GUI.
|
|
|
|
|
Thanks AbitSmart. You nopt just A Bit Smart are you??
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Kwagga wrote: I can't change this to ReadLine.
Why not?
Most commands are blocking; i.e., execution is halted until the instruction is completed. ReadToEnd() reads the *entire* file, before moving on to the next instruction. This will take a lot of time if you got a large file - in some cases longer than a minute. If Windows' doesn't get any messages from your application, it will assume that your either a dead application, or an application that should be dead. The so much feared,
"XXX has become unresponsive".
Instructions should do their thing fast, and move on. Longer-running processes must give a signal to Windows, just to prove that the application is still actually doing processing, instead of just "hanging dead in some loop".
Windows wants to kill your app, because you didn't phone home from work. So, the right way would be to make that call, whilst working. Now, the problem with ReadToEnd is that you can't stop it and tell it to call Windows.. So, that's something you'll have to build yourself.
string holdLine = string.Empty;
string output = string.Empty;
while (!sr.EndOfStream)
{
holdLine += sr.ReadLine();
Application.DoEvents();
if (String.IsNullOrEmpty(holdLine))
continue;
output += Regex.Replace(holdLine, "\r(?!\n)", " ");
}
sw.WriteLine(output);
sr.Close();
The Streamer now reads all lines as separate lines, does it's work on it,
and appends it to the output-string. The entire outputstring is written to disk when the looping is done.
The above code wasn't tested, but should be enough to get you on track. The Application.DoEvents is there to let Windows' know that your application has not gone James Brown.
You also might want to consider moving this logic to a background-worker. That's going to take more time to research, but once you know how it works, you start re-using the pattern more often. Well worth the investment in time, I daresay
Hope this helps,
I are troll
|
|
|
|
|
I have 30 buttons and I am trying to implement context menu on each button click by using following method.
void OnButtonClick(object sender, EventArgs e)
{
Button btn = (Button)sender;
btn.ContextMenuStrip.Show(btn, new System.Drawing.Point(0, btn.Height));
}
I have 2 context menu strip items, Add text Label and Add colour
private void addTextLabelToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Control item in panel2.Controls)
{
Button btn = (Button)item;
if (string.IsNullOrEmpty(btn.Text.Trim()))
{
frmAddText form = new frmAddText();
form.ShowDialog();
if (frmAddText.IsTextMod)
{
return;
}
btn.Text = form.TextInfo;
btn.Tag = 0;
} } }
Wen i try to do this it is implementing on last button itself. Here Ia m returning
Here foreach is not acceptable.
private void addColourToolStripMenuItem_Click(object sender, EventArgs e)
{
colorDialog1.ShowDialog();
DialogResult dResult = colorDialog1.ShowDialog();
foreach (Control item in panel2.Controls)
{
Button btn = (Button)item;
string strBtnName = btn.Name;
if (string.Equals(btn.Name, strBtnName, StringComparison.OrdinalIgnoreCase))
{
if (dResult == DialogResult.OK)
btn.BackColor = colorDialog1.Color;
} } }
It is applying color to all buttos. But it should apply for only specific clicked button. Here foreach is not acceptable.
|
|
|
|
|
Udayaraju wrote: string strBtnName = btn.Name;
if (string.Equals(btn.Name, strBtnName, StringComparison.OrdinalIgnoreCase))
{
this condition will always be True and all button will be colored.
Edit - you need to refactor your code. You can get the button on whom the contextmenu click happpened rather than looping through all controls.
Button btn = (sender as ContextMenuStrip).SourceControl as Button;
|
|
|
|
|
There may be a quicker way of doing it, but the code below works.
private void testToolStripMenuItem_Click(object sender, EventArgs e)
{
if(sender is ToolStripMenuItem)
{
ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender;
ContextMenuStrip strip = (ContextMenuStrip)clickedItem.Owner;
if (strip.SourceControl is Button)
{
Button button = (Button)strip.SourceControl;
button.BackColor = Color.Blue;
}
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
|
You're welcome
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
How to call a from from another call in windows application with c#
|
|
|
|
|
It would help to write a more explanable header to your post.
And trying to understand your query, you want to invoke a FORM ??
YourForm frm = new YourForm();
frm.Show();
Hope you can build on the above code.
|
|
|
|
|
Hi,
I want to create a simple function(only) with input and output parameters in pl/sql. I want the way of that function execution in c#.net.
Pls help. Thanx in advance.
|
|
|
|