|
with vs.net studio, it is simple to create a window service, and adding a notifyicon to bring it to system tray. But now how to add the context menu to this system trayed window service.
|
|
|
|
|
Hi all,
We are similar with Sniffer.NET program (written in VB.NET) in NETWORK topic, it's Packet Filtering.
I want to develop this project, for example "DoS recognition" module.
My idea depends on information in packet filtering to do this module.
For example, we can count the number of packet go through, total length of packets...per second. From these parameters and base on the rules (user defined), we can recognize the DoS such as Smurf or Fraggle attack...
Because of the various of DoS attacks, so I need your support.
Give your idea if you can!;)
I think it's very interesting!
Thanks a lot!
|
|
|
|
|
Look at SNORT (linux IDS) for ideas.
|
|
|
|
|
Is there a way to actually stop unauthorized use of code in a DLL?
The article on SecUtil[^] sounds nice, but doesn't work at all, unless I'm missing something painfully obvious.
I've got a signed DLL with a single public class exposing a single public method:
public class Thingy
{
private const string PUBLIC_KEY = "0x00..."
[StrongNameIdentityPermission(SecurityAction.Demand, PublicKey = PUBLIC_KEY)]
public Thingy ()
{
}
[StrongNameIdentityPermission(SecurityAction.Demand, PublicKey = PUBLIC_KEY)]
public int Add (int v1, int v2)
{
return (v1 + v2);
}
}
And I'm calling it in a separate unsigned application:
private void button1_Click (object sender, EventArgs e)
{
Thingy thingy = new Thingy();
int result = thingy.Add(6, 7);
MessageBox.Show("6 + 7 = " + result.ToString());
}
It should be protected, and yet I get my message box "6 + 7 = 13" just fine.
Any ideas?
--
I've killed again, haven't I?
|
|
|
|
|
Okay, it seems to work in .NET 1.1, but not in .NET 2.0.
Apparently .NET 2.0 has said, "The hell with security." One can easily run any code in a trusted zone without any regard whatsoever to standing individual assembly security requirements set by StrongNameIdentityPermission.
--
I've killed again, haven't I?
|
|
|
|
|
Hi everybody!
I want to check if two HTMLDocuments represent the same structure of HTML file. My problem is that I don't know how should I use the WebBrowser.DocumentCompleted Event to be sure that document has been loaded. I've got two files so I should wait for both of them ( how ?)
I would greatly appreciate your help.
|
|
|
|
|
makuda wrote: how should I use the WebBrowser.DocumentCompleted Event
You shouldn't. Why are you using the WebBrowser control to compare two HTML documents rather than using System.Net.WebRequest and WebResponse?
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
I don't want compare each sign, becouse I don't care about atributes. For example:
------- textA ---------
something
cos tam
---- endtextA ----
------- textB ---------
something
style="color: Red;">cos tam
---- endtextB ----
These files are equal.
So I want to create document tree for both files, and compare these trees.
|
|
|
|
|
These files are equal, not those
------- text 1 ---------
something.
cos tam
---- end text 1 ----
------- text 2 ---------
something.
style="color: Red;">cos tam
---- end text 2 2 ----
|
|
|
|
|
:/ I've forgotten tick "Ignore HTML tags"
These files are equal, not those
------- text 1 ---------
<P align="justify">
something
</p><SPAN style="color: Red;">buhuhu
</sPAn>
---- end of text 1 ----
------- text 2 ---------
<p>
something
</p>
<span> style="color: Red;">buhuhu</span>
---- end of text 2 ----
|
|
|
|
|
If you will build a DOM tree you will get different tree's.
You will have to use some other aproach...
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Ok. The trees coulde be diffrent. But when I'll comparing these trees I coudle ignore atributes, coulde I ?
If not, maybe you have some idea how to solve my problem?
|
|
|
|
|
could not coulde
|
|
|
|
|
Hi,
I have a dataset with some values from DB. I want to show the dataset as tooltip to a particular control, say a list box. How do I do that.
Thanks in advance.
|
|
|
|
|
ToolTip tp = New ToolTip();
tp.SetToolTip(listbox1, ds.GetXml());
|
|
|
|
|
how can i create a custom control with some properties i can see in property visual studio window when i use it inside a form?
|
|
|
|
|
You have to use fields, you cannot just make variables public:
This will not work:
public int MyInteger=1;
This will:
private int myInteger=1;
public int MyInteger
{
get
{
return myInteger;
}
set
{
myInteger=value;
}
}
If you want variables to be read only, just omit the set accessor:
private int myInteger=1;
public int MyInteger
{
get
{
return myInteger;
}
}
You can adjust the visible attributes in the property designer:
private int myInteger=1;
[Description("A useless number."),Category("Behavior")]
public int MyInteger
{
get
{
return myInteger;
}
set
{
myInteger=value;
}
}
Hope this helps,
DigitalKing
|
|
|
|
|
|
Hi Guys,
First up, my apologies because this is a cross forum post - I just wanted to try it in here as it seems a little busier!
I'm writing a C# application to help configure a Windows CE device (4.2), which I think only supports .Net CF 1.1 (this is a whole other headache at the moment, as I only have .Net 2.0 at the moment).
Part of the spec is to configure RAS phone book entries. Now I've managed to find quite a lot of information on MSDN about the RAS, but it all seems geared towards C++ development, which I haven't looked at in over 10 years, and my skills in that language were never that great anyway.
I wondered if any of you could perhaps point me towards a good guide on using the RAS registry entries from C#; My particular areas of interest are how the Passwords are stored in the registry (I've managed to find the entries in the registry, however they are in binary), whether passwords are encrypted and also how the dial string is stored (especially the extra connection settings "+cgdcont=...".
TIA,
Martin.
|
|
|
|
|
I had posted this question last friday, but havent found a solution yet, so posting it again in case somebody is aware of the solution.
** Original message **
Hello,
This is my code which will convert the ADO resultset to XML in C#.
I actually need the column type, column max length etc also in the xml, like the column type/length of id, loginuserid, deptid, wrkstnid etc.
So I am not sure whether I need to pass some parameters to SqlDataAdapter class while executing the SQL command or the XmlDataDocument class has some methods which would print out the datatype and column length information in the XML. Looked at both the classes, didnt find any method, anybody has any ideas about this? Thanks
DataSet ds = new DataSet();
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(ds);
if (ds.Tables.Count>0)
{
_sBody = new StringBuilder("", _bodySize);
//Get xml representation of the dataset
XmlDataDocument srcXML = new XmlDataDocument(ds);
srcXML.Save("c:\\XMLDocument.xml");
....
}
<NewDataSet>
<Table>
<id>1</id>
<LoginUserId>tpmadmin</LoginUserId>
<DeptId>1</DeptId>
<WrkstnId>1</WrkstnId>
</Table>
<Table>
<id>2</id>
<LoginUserId>sysadmin</LoginUserId>
<DeptId>2</DeptId>
<WrkstnId>2</WrkstnId>
</Table>
</NewDataSet>
-----------------------------------------------
** Paul Brower's Reply **
Try this, (with 'ds' being your dataset)
ds.WriteXml(@"c:\thedataset.xml",System.Data.XmlWriteMode.WriteSchema) ;
That will write out all your xml with the schema.
-----------------------------------------------
** Question **
I actually want the max size of the column and I think that information is missing in the XML. The XML looks something like this. Max size of the column is used by the XSL to print the data. For datatypes like int, numeric, datetime I can manage the column lenght, problem arises only when its of type string, char etc
It has the column name, type, minOccurs. I think the max size of the column is missing, do I need to try some other method, or any other argument? Thanks,
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:int" minOccurs="0" />
<xs:element name="LoginUserId" type="xs:string" minOccurs="0" />
Thanks.
-- modified at 17:47 Monday 8th May, 2006
|
|
|
|
|
Thread[] workerThread = new Thread[someInt];
for(int i = 0; i < someInt; i++)
{
string keyInfo = someKeyInfo().ToString();
workerThread[i] = new Thread(new ThreadStart(DoSomeWork(keyInfo)));
workerThread[i].Start();
}
foreach(Thread t in workerThread)
{
while(t.IsAlive()){}
}
|
|
|
|
|
I didn't think called methods could have parameters in Framework 1.1. The methods used by ThreadStart must be static.
|
|
|
|
|
First point is correct but .Net 2.0 has a new overload for the Thread constructor accepting a ParametrizedThreadStart. Second point isn't true even under 1.1 also 'normal' functions can be used.
|
|
|
|
|
Depending on the number of threads you could consider using ThreadPool.
Also you should rethink the IsAlive loop. First of all it could consume much processor time so you should at least do:
foreach(Thread t in workerThread)
while(t.IsAlive())
Thread.Sleep(10);
Instead of waiting for all threads separately you could also use a counter which counts the started and terminated threads. Have a look at the Interlocked[^] class for a sample.
|
|
|
|
|
Robert is right, just don't go thread crazy. Also, I don't know if it's still an issue on uniprocessor machines but the child thread won't start unless you call Thread.Sleep(0) in the parent after creating it.
|
|
|
|