|
Hi
I don't have something smart to say regarding XML encryption,
But i want to mention something else regarding XML Serialization.
when you are using the XmlSerializer in order to serialize XML it create temporary dll that contain the serialization logic code.
In my experience i saw that it is better to use a pre compiled serialization logic code in two dimension
1.performance
2.security
you can create pre compiled serialization logic code by using the sgen.exe tool
|
|
|
|
|
In my application, i start a new thread which waits for a connection from another machine:
TcpListener connect = new TcpListener(IPAddress.Any, 7777);
connect.Start();
Socket clientSocket = connect.AcceptSocket();
If it receives a connection it goes into a while loop and communicates with the other machine. And it closes when finished.
But, if i want to stop the thread before it's made a connection...
connect.AcceptSocket is blocking so...
and when i try to abort the thread nothing seems to happen.
-- modified at 11:55 Saturday 22nd September, 2007
Never mind, i made the TcpListener a class variable, and added a method that calls connect.Stop(); and flags that the thread should stop. Then everything works out.
|
|
|
|
|
Hello all,
I have a MA-620 USB Infrared Adapter. I'm trying to make a small application that will receive my Sony TV remote controller signals.
Is it possible? do I have the right hardware? All Infrared-C# articles I found were WinCE specific.
|
|
|
|
|
I want to get the Processor ID of CPU.
I have tried to use the sample in the code project.
I have tested the application in 5 dual core machine, but it is giving the same Processor ID for all
Can you please suggest me a way to get the ID for dual core processor machine (Intel(R) Pentium(R) D CPU 300 GHz).
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
M. J. Jaya Chitra wrote: I have tried to use the sample in the code project.
What sample or article was that? You might want to try the forum at the bottom of the particular article, which might alert the author, in turn the author might reply to you.
"Try asking what you want to know, rather than asking a question whose answer you know." - Christian Graus
|
|
|
|
|
Hi
In order to retrieve information regarding the current cpu you can use WMI
In this case i am using the Win32_Processor Class
http://msdn2.microsoft.com/en-us/library/Aa394373.aspx[^]
Try using the following code:
class Program
{
static void Main(string[] args)
{
ConnectionOptions conn = new ConnectionOptions();
conn.Impersonation = ImpersonationLevel.Impersonate;
ManagementScope scope = new ManagementScope(@"\\mymachine", conn);
ObjectQuery query = new ObjectQuery("Select * From Win32_Processor");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
ManagementObjectCollection coll = searcher.Get();
foreach (ManagementObject obj in coll)
{
Console.WriteLine(obj["UniqueId"].ToString());
}
}
}
|
|
|
|
|
i have a enum type with the following defination
enum enumCatalogExportStandard { CatccExportAsISO, CatccExportAsFGDC, CatccExportAsNative };
enumCatalogExportStandard ImportStandard ;
ImportStandard = enumCatalogImportStandard.CatccImportAsISO ;
ImportStandard is showing value as 1 instead of CatccExportAsISO how can i get the "CatccExportAsISO " instead of 1.
Please help me.
|
|
|
|
|
Please post which method do you use to visualize enumeration variable's value.
To obtain a text representation, try ImportStandard.ToString() method.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
i tried to display the value "ImportStandard.ToString() " using messagebox it returned 1 only.
can u please tell me some other alternative.
|
|
|
|
|
This is an alternative:
MessageBox.Show(Enum.GetName(typeof(enumCatalogExportStandard ), ImportStandard));
But... it is impossible. The code:
enum alph { A, B, C }
alph ph = alph.A;
MessageBox.Show(ph.ToString());
gives me "A"... Please post the full code.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
hi Gajatko,
i don't know why any alternative is not working in my m/c.
when i tried
MessageBox.Show(Enum.GetName(typeof(enumCatalogExportStandard ), ImportStandard));
gave me a null string as output.
i am sending the code snippets where ever i am using the enum related stuff in my code pls view.
public enum enumCatalogImportStandard { CatccImportAsISO, CatccImportAsFGDC, CatccImportAsNative };
enumCatalogImportStandard ImportStandard;
private void cmbTargetstd_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbTargetstd.SelectedItem.ToString() == "ISO")
ImportStandard = enumCatalogImportStandard.CatccImportAsISO ;
else if (cmbTargetstd.SelectedItem.ToString() == "FGDC")
ImportStandard = enumCatalogImportStandard.CatccImportAsFGDC ;
else if (cmbTargetstd.SelectedItem.ToString() == "Native")
ImportStandard = enumCatalogImportStandard.CatccImportAsNative;
}
private void btnApply_Click(object sender, EventArgs e)
{
CImportCatalogRecordService.ImportCatalogRecordService objImpRecService = new CImportCatalogRecordService.ImportCatalogRecordService();
//below statement returning number instead of string
objImpRecService.ImportStandard = ImportStandard;
objImpRecService.InputFileName = txtImportFolder.Text + "\\" + Rec;
objImpRecService.CatalogConnection = con;
objImpRecService.Execute(out MetadataID);
}
this is all my code Pls view.
|
|
|
|
|
nicolus wrote:
objImpRecService.ImportStandard = ImportStandard;
Of course it returns a number. Change it to:
objImpRecService.ImportStandard = ImportStandard.ToString();
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Hi,
Please consider the following interface in C++.Net
<br />
public __interface IAnimal<br />
{<br />
void Eat(String^ food);<br />
};<br />
when I try to implement this in a C# class...
class Dog : IAnimal<br />
{<br />
...<br />
}
It gives me an error "error CS0509: 'Dog': cannot derive from sealed type 'IAnimal'"
What am I doing wrong here?
SDX2000
|
|
|
|
|
Your definition of the IAnimal interface is incorrect. Try:
public interface class IAnimal {
void Eat(String^ food);
};
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Thanks Tom.
The best way to accelerate a Macintosh is at 9.8m/sec-sec.
- Marcus Dolengo
|
|
|
|
|
Hi All,
I have one HTML Table. Table has 3 rows and 2 columns. It is just like this:::::
COL 1 COL2
+++++++++++++++++++++++++++++++++
Label1 Label1.Text
Label2 Label2.Text
Label3 Label3.Text
+++++++++++++++++++++++++++++++++
Now I want to take this information into DataTable by dynamically adding columns and rows to DataTable. Means in the 1st column, name of the labels and in the 2nd column,Labels's Text field. Plz give me the idea about it.
I m working on .net 1.1 + c#
Thank you............
Keep Smiling...........
|
|
|
|
|
vhs17 wrote: Now I want to take this information into DataTable by dynamically adding columns and rows to DataTable.
You've answered your own question. Now all you need to do is write some code.
The MSDN documentation[^]shows you how to do this.
Paul
|
|
|
|
|
Hi Paul,
Thank you for reply. I have tried this code. But it gives me error.
<br />
DataTable dt3 = new DataTable();<br />
DataColumn dc1 = new DataColumn("Col_1",System.Type.GetType("System.String"));<br />
DataColumn dc2 = new DataColumn("Col_2",System.Type.GetType("System.String"));<br />
for(i=0;i<=2;i++)<br />
{<br />
dr = dt3.NewRow();<br />
dr["Col_1"] = "TOTAL less GST";<br />
dr["Col_2"] = lbl_total_less_GST.Text; <br />
dt3.Rows.Add(dr);<br />
} <br />
<br />
dt3.Columns.Add(dc1);<br />
dt3.Columns.Add(dc2); <br />
<br />
can you plz tell me where I m wrong???
Thank you
Keep Smiling ...............
-- modified at 7:24 Saturday 22nd September, 2007
|
|
|
|
|
|
Hi Paul,
Thank you for reply again. But I have done this like following:
<br />
DataTable dt3 = new DataTable();<br />
dt3.Columns.Add("TOTAL less GST");<br />
dt3.Columns.Add("GST"); <br />
dt3.Rows.Add(new string[] {"TOTAL less GST",lbl_total_less_GST.Text});<br />
dt3.Rows.Add(new string[] {"GST",lbl_GST.Text});<br />
dt3.Rows.Add(new string[] {"TOTAL",lbl_TOTAL.Text});<br />
Actually my table structure is static only label's text is variant. So i have done this.
thank you.
Keep smiling........
|
|
|
|
|
You're original code didn't make logical sense and there were undefined variables which prevented it from compiling.
I changed it to the following, which works:
DataTable dt3 = new DataTable();
DataColumn dc1 = new DataColumn("Col_1", System.Type.GetType("System.String"));
DataColumn dc2 = new DataColumn("Col_2", System.Type.GetType("System.String"));
dt3.Columns.Add(dc1);
dt3.Columns.Add(dc2);
DataRow dr = dt3.NewRow();
dr["Col_1"] = "TOTAL less GST";
dr["Col_2"] = lbl_total_less_GST.Text;
dt3.Rows.Add(dr);
dr = dt3.NewRow();
dr["Col_1"] = "GST";
dr["Col_2"] = lbl_GST.Text;
dt3.Rows.Add(dr);
dr = dt3.NewRow();
dr["Col_1"] = "Total";
dr["Col_2"] = lbl_TOTAL.Text;
dt3.Rows.Add(dr);
Paul
|
|
|
|
|
You must add DataColumn objects to a table before you bind to them. Also you have another error which will not be catched by any compiler. Make meaningful names! Col_1 and Col_2 tells nothing!
I would do it like this:
DataTable table = new DataTable();
table.Columns.Add("Name", typeof(string));
table.Columns.Add("Text", typeof(string));
DataRowView dr;
for (int i = 0; i < 10; i++) {
dr = table.DefaultView.AddNew();
dr["Name"] = "Name " + i.ToString();
dr["Text"] = "Some text no. " + i.ToString();
}
table.AcceptChanges();
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Is the "double" type is faster than "float" type in .Net when using them in loops?
I sensed in my experience that it is true. somebody has any idea about it?
and why it must be true?
thank you
|
|
|
|
|
small_programmer wrote: Is the "double" type is faster than "float" type in .Net when using them in loops?
I sensed in my experience that it is true. somebody has any idea about it?
and why it must be true?
double and float have different precisions. Performance is not something I've ever taken into consideration when deciding to use one over the other.
I'm guessing that if you've seen double as being faster it is probably because the processor's native floating point representation is a double and float s (although they save memory) will be slower as a result because the processor converts them internally to double s, processes it then converts it back. But, that is just my guess.
|
|
|
|
|
Thank you
I think you are right.
|
|
|
|