|
Hi I have one xml file,which contains some elements,so i want to load into C# application..i used to NUnit test cases for loading file or not ,,
cheers
Sridevi
|
|
|
|
|
I had tried googling but didn't found the answer to my case.
This problem is about PeakWorkingSet property of System.Diagnostics.Process class. This prop store the maximum amount of memory used by process during run time, but this property is inaccessible after the process has exited.
One workaround I used is to start another thread to monitor this property, but this is not well enough because some of processes I started exited too fast. ( They started and exited immediately).
Does anyone know how to get PeakWorkingSet property after process exited? or better workaround to this kind of problem.
Thank you
|
|
|
|
|
How can i print the values contained in System.Collections.Hashtable...............
Thanks,
Sandeep
+919891027854
|
|
|
|
|
foreach(object obj in hashTable.Values)<br />
{<br />
}
HTH, Cheers
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
Thanks Maqsood for ur reply. But when printing , it alos prints System.Collections.Hashtable, that is the type...........
Thanks,
Sandeep
+919891027854
|
|
|
|
|
Does it help
IDictionaryEnumerator en = h.GetEnumerator();
while (en.MoveNext())
{
Console.WriteLine(en.Key + " : " + en.Value);
}
|
|
|
|
|
I think there r again HashTables contained within the HashTable. That is why, it again prints System.Collections.Hashtable with output. Plz tell me the way to retrieve the values from Hashtables within Hashtables.
Thanks,
Sandeep
+919891027854
|
|
|
|
|
Hello,
You can call the same method recursively to get the values from the hashtable. Some like this:
<br />
private void PrintHashtable(Hashtable hash)<br />
{<br />
foreach(DictionaryEntry de in hash)<br />
{<br />
if(de.Value is Hashtable)<br />
{<br />
Console.WriteLine("Printing Values for Hashtable - " + de.Key);<br />
PrintHashtable((Hashtable)de.Value);<br />
}<br />
else<br />
Console.WriteLine(de.Key + " - " + de.Value);<br />
}<br />
}
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
Hello Maqsood,
ur method to print inner Hashtables worked out very well. They printed all the key value pairs in them. Plz tell me how I can print a particular key value pair from those key value pairs. If possible send me the code.
Thanks,
Sandeep
+919891027854
|
|
|
|
|
if(hash.ContainsKey(theRequiredKey))<br />
{<br />
object theValue = hash[theRequiredKey];<br />
if(theValue is Hashtable)<br />
PrintHashtable((Hashtable)theValue);<br />
else<br />
Console.WriteLine(theValue);<br />
}
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
Ur above doesn't work for me. I had tried ur earlier sent code and it worked very well. It printed the output as:
Printing values for Hashtable - 2
entity.description - sandeep.co.in
entity.currentstatus - Active
orders.orderid - 2235000
entity.entyid - 2235000
orders.timestamp - 2005-12-07 12:02:02.011307
....................
.............
Printing values for Hashtable - 3
entity.description - sandeep.biz
entity.currentstatus - Active
entity.orderid - 2234999
...................
..................
Now the problem is I want to print the value of key "entity.description" for every inner Hashtable.
Thanks,
Sandeep
+919891027854
|
|
|
|
|
Hi everybody,
I want to use common source files (my toolbox) in different projects without creating a library. How can I add this sourcefile, to my project, placed in a common files folder, "by reference" an not as a copy of it ? The IDE always copies the selected file to the project folder.
I did't found an option to do this ?
thanks in advance
Frank
|
|
|
|
|
The Link file option does the trick. When you add the common source files via "Add Existing Items", don't click the Open button in the "Add Existing Item" dialog. There is a tiny control to the right of the "Open" button, which when clicked, opens a context menu with the "Link File" option.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hey Senthil, great,
that's the thing what I'm looking for.
Thanks a lot !
Frank
|
|
|
|
|
Hi.
I wanna use the PersianClanedar as current culture in .NET 2.0 .
But an error occures in runtime.
would u plz help me?
|
|
|
|
|
how can i create a simple excel file starting from an xml one?
|
|
|
|
|
Hello,
I have an application which has some global resources. I use some system resources in these classes. The finalizer is called when the application is closed.
The problem is that a part of the .NET framework (System.Net.Sockets) gets disposed before my object is disposed. How do I make sure that my object is finalized before the system resources?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hi!
I suggest you don't rely on a certain order of finalization (which is almost always a bad idea) but rather implement IDisposable and perform your cleanup in Dispose() .
Regards,
mav
|
|
|
|
|
Bob Stanneveld wrote: How do I make sure that my object is finalized before the system resources?
That's not possible. In fact, members of an object might get finalized before the object itself.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi community!
I'd be happy if someone could give me some input on an idea I've been juggling with for some time:
I've got a single instance WindowsForms application (.NET 1.1) that's been working fine for quite some time now.
Now I'd have to make some of the functionality available for COM clients, but I can't seem to figure out how to start.
I know how to create a class library with COM visible classes, but instances of these classes will be created inside the calling process, so I can't call methods in my application to show some dialogs, for example.
As far as the idea has evolved, I'd have to make my application an out-of-process COM server, but I'm afraid I don't know how to achieve this.
Any input would be highly appreciated.
Thanks,
mav
|
|
|
|
|
Hi guys;
I have a flash object on a form and I have added a Class to my app.
I want to call the SetVariable() method of the flash object from the class and get some info from the flash obj.
there is a FScommand related to the flash obj when the SetVariable() is called flash transfers the data to the FScommand event of the flash obj inside my form.
Its all fine when I use the SetVariable() method from inside the form but when I call it from the class it just passes the command and nothing happens.
What should I do to get the FScommand event to work from the Class I have.
PLEASE HELP ITS VERY URGENT.
Thanks
Riazi
|
|
|
|
|
Hi
Using Microsoft.ink...I have to draw a image in the form and save that image in .jpeg format.....So i haveto install Microsoft Tablet pc.....
so finally I installed ... and i did a program with 2 buttons in the form namely SAVE and EXIT......
so now when i run this program..i can able to draw a image of my own in the form..now when i click save button...i should be able to save the image in .jpeg format.. BUT I couldnt save.. when i click the SAVE button..and give a name for the image .... an error is shown...
ERROR MESSAGE:
System.NullReferenceException: Object reference not set to an instance of an object.
at InkImage.Form1.button2_Click(Object sender, EventArgs e) in d:\inkimage\form1.cs:line 144..
ie, error in the last line of this program [ DrawArea.Save( sfd.FileName, format );]
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Microsoft.Ink;
using System.IO;
namespace InkImage
{
public class Form1 : System.Windows.Forms.Form
{
// Declare the Ink Collector object
private InkCollector myInkCollector;
private const float ThinInkWidth = 50;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private Bitmap DrawArea;// make a persistent drawing area
private void Form1_Load(object sender, System.EventArgs e)
{
// Create a new ink collector and assign it to this form's window
myInkCollector = new InkCollector(this.Handle);
// Set the pen width to be a width
myInkCollector.DefaultDrawingAttributes.Width = ThinInkWidth;
// Turn the ink collector on
myInkCollector.Enabled = true;
}
//EXIT BUTTON
private void button1_Click(object sender, System.EventArgs e)
{
myInkCollector.Enabled = false;
this.Dispose();
}
//SAVE BUTTON
private void button2_Click(object sender, System.EventArgs e)
{
ImageFormat format = ImageFormat.Jpeg;
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "JPEG Files(*.jpg)|*.jpg";
if (sfd.ShowDialog() == DialogResult.OK)
{
// now save the image in the DrawArea
DrawArea.Save( sfd.FileName, format );
}
}
}
}
please help me to get the solution......
D h o l
|
|
|
|
|
I am using a library built by some other person. It has various arguments......
The below mentioned function had been implemented by someone in .NET and I am using that library:
list(java.lang.String userName, java.lang.String password,java.lang.String role, java.lang.String langpref,int parentid,int[] orderId,int[] resellerId,int[] customerId, boolean showChildOrders,java.lang.String[] domainType,java.lang.String[] currentStatus,java.lang.String description,java.lang.String creationDTRangStart,
java.lang.String creationDTRangEnd,java.lang.String endTimeRangStart,java.lang.String endTimeRangEnd,
int numOfRecordPerPage,int pageNum,java.lang.String[] orderBy)
The problem is that I have only one reseller ID that is 40...
when I provide the seventh argument as 40, then I get error as:
Argument '7': cannot convert from 'int' to 'int[]'
Plz suggest any way to convert int to int[]
Thanks,
Sandeep
+919891027854
|
|
|
|
|
Just wrap the int in an array.
Like this
int []arr = new int[] {resellerID};
I'm a 23 yrs old developer working with HCL Technologies, Chennai. I'm currently working in C#, C++, but I've done some Java programming as well.
You can read My Blog here. I've also done some open source software, like WinMacro - A open source macro recorder/player for Windows, A Chess Game with AI that I wrote in college and Winbots - a game for programmers.
|
|
|
|
|
Hi i am pasting my code belo which is giving error
System.NullReferenceException' occurred in
Additional information: Object reference not set to an instance of an object.
it breaks on line
if(cl[i].status==true) in listen class
code for listen class
public class listen
{
TcpListener server=null;
Thread tcpthread=null;
client[] cl=new client[5];
public listen()
{
//
// TODO: Add constructor logic here
//
}
public void startlisten()
{
Int32 port = 3310;
IPAddress localAddr = IPAddress.Parse("192.168.0.5");
// TcpListener server = new TcpListener(port);
server = new TcpListener(localAddr, port);
// Start listening for client requests.
server.Start();
// Enter the listening loop.
// for(int i=0;i<5;i++)
// {
// cl[i].status=true;
// }
Boolean flag;
while(true)
{ flag=false;
// Perform a blocking call to accept requests.
// You could also user server.AcceptSocket() here.
for(int i=0;i<5;i++)
{
if(cl[i].status==true)
{
cl[i]= new client(server.AcceptTcpClient());
tcpthread=new Thread(new ThreadStart(cl[i].getClient));
tcpthread.Start();
flag=true;
break;
}
}
if(flag!=true)
{
//display error message
}
}
}
}
code for client class
public class client
{
TcpClient tcpClient;
public Boolean status;
// Buffer for reading data
Byte[] bytes = new Byte[256];
String data = null;
public client()
{ //
// TODO: Add constructor logic here
//
//status=true;
}
public client(TcpClient Client)
{
tcpClient =Client;
//
// TODO: Add constructor logic here
//
status=false;
}
public void getClient()
{
try
{
data = null;
// Get a stream object for reading and writing
NetworkStream stream = tcpClient.GetStream();
int i;
// Loop to receive all the data sent by the client.
while((i = stream.Read(bytes, 0, bytes.Length))!=0)
{
// Translate data bytes to a ASCII string.
data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
// Process the data sent by the client.
string replyMsg = data;
clamdCommand x=new clamdCommand();
replyMsg=x.Command(replyMsg);
byte[] msg = System.Text.Encoding.ASCII.GetBytes(replyMsg);
// Send back a response.
stream.Write(msg, 0, msg.Length);
//Console.WriteLine(String.Format("Sent: {0}", data));
}
}
catch(Exception se)
{
MessageBox.Show(se.ToString());
}
// Shutdown and end connection
tcpClient.Close();
status=true;
}
}
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|